|
@@ -241,3 +241,192 @@ static struct gpio_led_platform_data net2big_led_data = {
|
|
static struct platform_device net2big_gpio_leds = {
|
|
static struct platform_device net2big_gpio_leds = {
|
|
.name = "leds-gpio",
|
|
.name = "leds-gpio",
|
|
.id = -1,
|
|
.id = -1,
|
|
|
|
+ .dev = {
|
|
|
|
+ .platform_data = &net2big_led_data,
|
|
|
|
+ },
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static void __init net2big_gpio_leds_init(void)
|
|
|
|
+{
|
|
|
|
+ int err;
|
|
|
|
+
|
|
|
|
+ /* Stop initial CPLD slow red/blue blinking on power LED. */
|
|
|
|
+ err = gpio_request(NET2BIG_GPIO_PWR_LED_BLINK_STOP,
|
|
|
|
+ "Power LED blink stop");
|
|
|
|
+ if (err == 0) {
|
|
|
|
+ err = gpio_direction_output(NET2BIG_GPIO_PWR_LED_BLINK_STOP, 1);
|
|
|
|
+ if (err)
|
|
|
|
+ gpio_free(NET2BIG_GPIO_PWR_LED_BLINK_STOP);
|
|
|
|
+ }
|
|
|
|
+ if (err)
|
|
|
|
+ pr_err("net2big: failed to setup power LED blink GPIO\n");
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * Configure SATA0 and SATA1 blue LEDs to blink in relation with the
|
|
|
|
+ * hard disk activity.
|
|
|
|
+ */
|
|
|
|
+ err = gpio_request(NET2BIG_GPIO_SATA0_BLUE_LED,
|
|
|
|
+ "SATA0 blue LED control");
|
|
|
|
+ if (err == 0) {
|
|
|
|
+ err = gpio_direction_output(NET2BIG_GPIO_SATA0_BLUE_LED, 1);
|
|
|
|
+ if (err)
|
|
|
|
+ gpio_free(NET2BIG_GPIO_SATA0_BLUE_LED);
|
|
|
|
+ }
|
|
|
|
+ if (err)
|
|
|
|
+ pr_err("net2big: failed to setup SATA0 blue LED GPIO\n");
|
|
|
|
+
|
|
|
|
+ err = gpio_request(NET2BIG_GPIO_SATA1_BLUE_LED,
|
|
|
|
+ "SATA1 blue LED control");
|
|
|
|
+ if (err == 0) {
|
|
|
|
+ err = gpio_direction_output(NET2BIG_GPIO_SATA1_BLUE_LED, 1);
|
|
|
|
+ if (err)
|
|
|
|
+ gpio_free(NET2BIG_GPIO_SATA1_BLUE_LED);
|
|
|
|
+ }
|
|
|
|
+ if (err)
|
|
|
|
+ pr_err("net2big: failed to setup SATA1 blue LED GPIO\n");
|
|
|
|
+
|
|
|
|
+ platform_device_register(&net2big_gpio_leds);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/****************************************************************************
|
|
|
|
+ * GPIO keys
|
|
|
|
+ ****************************************************************************/
|
|
|
|
+
|
|
|
|
+#define NET2BIG_GPIO_PUSH_BUTTON 18
|
|
|
|
+#define NET2BIG_GPIO_POWER_SWITCH_ON 8
|
|
|
|
+#define NET2BIG_GPIO_POWER_SWITCH_OFF 9
|
|
|
|
+
|
|
|
|
+#define NET2BIG_SWITCH_POWER_ON 0x1
|
|
|
|
+#define NET2BIG_SWITCH_POWER_OFF 0x2
|
|
|
|
+
|
|
|
|
+static struct gpio_keys_button net2big_buttons[] = {
|
|
|
|
+ {
|
|
|
|
+ .type = EV_SW,
|
|
|
|
+ .code = NET2BIG_SWITCH_POWER_OFF,
|
|
|
|
+ .gpio = NET2BIG_GPIO_POWER_SWITCH_OFF,
|
|
|
|
+ .desc = "Power rocker switch (auto|off)",
|
|
|
|
+ .active_low = 0,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ .type = EV_SW,
|
|
|
|
+ .code = NET2BIG_SWITCH_POWER_ON,
|
|
|
|
+ .gpio = NET2BIG_GPIO_POWER_SWITCH_ON,
|
|
|
|
+ .desc = "Power rocker switch (on|auto)",
|
|
|
|
+ .active_low = 0,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ .type = EV_KEY,
|
|
|
|
+ .code = KEY_POWER,
|
|
|
|
+ .gpio = NET2BIG_GPIO_PUSH_BUTTON,
|
|
|
|
+ .desc = "Front Push Button",
|
|
|
|
+ .active_low = 0,
|
|
|
|
+ },
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static struct gpio_keys_platform_data net2big_button_data = {
|
|
|
|
+ .buttons = net2big_buttons,
|
|
|
|
+ .nbuttons = ARRAY_SIZE(net2big_buttons),
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static struct platform_device net2big_gpio_buttons = {
|
|
|
|
+ .name = "gpio-keys",
|
|
|
|
+ .id = -1,
|
|
|
|
+ .dev = {
|
|
|
|
+ .platform_data = &net2big_button_data,
|
|
|
|
+ },
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+/*****************************************************************************
|
|
|
|
+ * General Setup
|
|
|
|
+ ****************************************************************************/
|
|
|
|
+
|
|
|
|
+static unsigned int net2big_mpp_modes[] __initdata = {
|
|
|
|
+ MPP0_GPIO, /* Raid mode (bit 0) */
|
|
|
|
+ MPP1_GPIO, /* USB port 2 fuse (0 = Fail, 1 = Ok) */
|
|
|
|
+ MPP2_GPIO, /* Raid mode (bit 1) */
|
|
|
|
+ MPP3_GPIO, /* Board ID (bit 0) */
|
|
|
|
+ MPP4_GPIO, /* Fan activity (0 = Off, 1 = On) */
|
|
|
|
+ MPP5_GPIO, /* Fan fail detection */
|
|
|
|
+ MPP6_GPIO, /* Red front LED (0 = Off, 1 = On) */
|
|
|
|
+ MPP7_GPIO, /* Disable initial blinking on front LED */
|
|
|
|
+ MPP8_GPIO, /* Rear power switch (on|auto) */
|
|
|
|
+ MPP9_GPIO, /* Rear power switch (auto|off) */
|
|
|
|
+ MPP10_GPIO, /* SATA 1 red LED (0 = Off, 1 = On) */
|
|
|
|
+ MPP11_GPIO, /* SATA 0 red LED (0 = Off, 1 = On) */
|
|
|
|
+ MPP12_GPIO, /* Board ID (bit 1) */
|
|
|
|
+ MPP13_GPIO, /* SATA 1 blue LED blink control */
|
|
|
|
+ MPP14_SATA_LED,
|
|
|
|
+ MPP15_SATA_LED,
|
|
|
|
+ MPP16_GPIO, /* Blue front LED control */
|
|
|
|
+ MPP17_GPIO, /* SATA 0 blue LED blink control */
|
|
|
|
+ MPP18_GPIO, /* Front button (0 = Released, 1 = Pushed ) */
|
|
|
|
+ MPP19_GPIO, /* SATA{0,1} power On/Off request */
|
|
|
|
+ 0,
|
|
|
|
+ /* 22: USB port 1 fuse (0 = Fail, 1 = Ok) */
|
|
|
|
+ /* 23: SATA 0 power status */
|
|
|
|
+ /* 24: Board power off */
|
|
|
|
+ /* 25: SATA 1 power status */
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+#define NET2BIG_GPIO_POWER_OFF 24
|
|
|
|
+
|
|
|
|
+static void net2big_power_off(void)
|
|
|
|
+{
|
|
|
|
+ gpio_set_value(NET2BIG_GPIO_POWER_OFF, 1);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static void __init net2big_init(void)
|
|
|
|
+{
|
|
|
|
+ /*
|
|
|
|
+ * Setup basic Orion functions. Need to be called early.
|
|
|
|
+ */
|
|
|
|
+ orion5x_init();
|
|
|
|
+
|
|
|
|
+ orion5x_mpp_conf(net2big_mpp_modes);
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * Configure peripherals.
|
|
|
|
+ */
|
|
|
|
+ orion5x_ehci0_init();
|
|
|
|
+ orion5x_ehci1_init();
|
|
|
|
+ orion5x_eth_init(&net2big_eth_data);
|
|
|
|
+ orion5x_i2c_init();
|
|
|
|
+ orion5x_uart0_init();
|
|
|
|
+ orion5x_xor_init();
|
|
|
|
+
|
|
|
|
+ net2big_sata_power_init();
|
|
|
|
+ orion5x_sata_init(&net2big_sata_data);
|
|
|
|
+
|
|
|
|
+ orion5x_setup_dev_boot_win(NET2BIG_NOR_BOOT_BASE,
|
|
|
|
+ NET2BIG_NOR_BOOT_SIZE);
|
|
|
|
+ platform_device_register(&net2big_nor_flash);
|
|
|
|
+
|
|
|
|
+ platform_device_register(&net2big_gpio_buttons);
|
|
|
|
+ net2big_gpio_leds_init();
|
|
|
|
+
|
|
|
|
+ i2c_register_board_info(0, net2big_i2c_devices,
|
|
|
|
+ ARRAY_SIZE(net2big_i2c_devices));
|
|
|
|
+
|
|
|
|
+ orion_gpio_set_valid(NET2BIG_GPIO_POWER_OFF, 1);
|
|
|
|
+
|
|
|
|
+ if (gpio_request(NET2BIG_GPIO_POWER_OFF, "power-off") == 0 &&
|
|
|
|
+ gpio_direction_output(NET2BIG_GPIO_POWER_OFF, 0) == 0)
|
|
|
|
+ pm_power_off = net2big_power_off;
|
|
|
|
+ else
|
|
|
|
+ pr_err("net2big: failed to configure power-off GPIO\n");
|
|
|
|
+
|
|
|
|
+ pr_notice("net2big: Flash writing is not yet supported.\n");
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/* Warning: LaCie use a wrong mach-type (0x20e=526) in their bootloader. */
|
|
|
|
+MACHINE_START(NET2BIG, "LaCie 2Big Network")
|
|
|
|
+ .atag_offset = 0x100,
|
|
|
|
+ .init_machine = net2big_init,
|
|
|
|
+ .map_io = orion5x_map_io,
|
|
|
|
+ .init_early = orion5x_init_early,
|
|
|
|
+ .init_irq = orion5x_init_irq,
|
|
|
|
+ .timer = &orion5x_timer,
|
|
|
|
+ .fixup = tag_fixup_mem32,
|
|
|
|
+ .restart = orion5x_restart,
|
|
|
|
+MACHINE_END
|
|
|
|
+
|