Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: orion5x: convert d2net to Device Tree

This commit converts the LaCie d2 Network platform to the Device Tree.

All devices except LEDs are converted, because the LED code needs a
non-LED GPIO to be set to a given value for the LEDs to work, and this
cannot yet be easily represented in DT.

Also, references to the LaCie Big Disk Network platform are lost,
because this platform apparently has exactly the same hardware support
as the LaCie d2 Network, so their Device Tree files would be
identical.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Link: https://lkml.kernel.org/r/1398202002-28530-36-git-send-email-thomas.petazzoni@free-electrons.com
Cc: Simon Guinot <sguinot@lacie.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>

authored by

Thomas Petazzoni and committed by
Jason Cooper
94b0bd36 065194a0

+351 -378
+2 -1
arch/arm/boot/dts/Makefile
··· 289 289 am43x-epos-evm.dtb \ 290 290 am437x-gp-evm.dtb \ 291 291 dra7-evm.dtb 292 - dtb-$(CONFIG_ARCH_ORION5X) += orion5x-lacie-ethernet-disk-mini-v2.dtb \ 292 + dtb-$(CONFIG_ARCH_ORION5X) += orion5x-lacie-d2-network.dtb \ 293 + orion5x-lacie-ethernet-disk-mini-v2.dtb \ 293 294 orion5x-rd88f5182-nas.dtb 294 295 dtb-$(CONFIG_ARCH_PRIMA2) += prima2-evb.dtb 295 296 dtb-$(CONFIG_ARCH_QCOM) += qcom-msm8660-surf.dtb \
+236
arch/arm/boot/dts/orion5x-lacie-d2-network.dts
··· 1 + /* 2 + * Copyright (C) 2014 Thomas Petazzoni <thomas.petazzoni@free-electrons.com> 3 + * Copyright (C) 2009 Simon Guinot <sguinot@lacie.com> 4 + * 5 + * This file is licensed under the terms of the GNU General Public 6 + * License version 2. This program is licensed "as is" without any 7 + * warranty of any kind, whether express or implied. 8 + */ 9 + 10 + /dts-v1/; 11 + 12 + #include <dt-bindings/gpio/gpio.h> 13 + #include <dt-bindings/input/input.h> 14 + #include <dt-bindings/interrupt-controller/irq.h> 15 + #include "orion5x-mv88f5182.dtsi" 16 + 17 + / { 18 + model = "LaCie d2 Network"; 19 + compatible = "lacie,d2-network", "marvell,orion5x-88f5182", "marvell,orion5x"; 20 + 21 + memory { 22 + reg = <0x00000000 0x4000000>; /* 64 MB */ 23 + }; 24 + 25 + chosen { 26 + bootargs = "console=ttyS0,115200n8 earlyprintk"; 27 + linux,stdout-path = &uart0; 28 + }; 29 + 30 + soc { 31 + ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000>, 32 + <MBUS_ID(0x09, 0x00) 0 0xf2200000 0x800>, 33 + <MBUS_ID(0x01, 0x0f) 0 0xfff80000 0x80000>; 34 + }; 35 + 36 + gpio-keys { 37 + compatible = "gpio-keys"; 38 + pinctrl-0 = <&pmx_buttons>; 39 + pinctrl-names = "default"; 40 + #address-cells = <1>; 41 + #size-cells = <0>; 42 + front_button { 43 + label = "Front Push Button"; 44 + linux,code = <KEY_POWER>; 45 + gpios = <&gpio0 18 GPIO_ACTIVE_HIGH>; 46 + }; 47 + 48 + power_rocker_sw_on { 49 + label = "Power rocker switch (on|auto)"; 50 + linux,input-type = <5>; /* EV_SW */ 51 + linux,code = <1>; /* D2NET_SWITCH_POWER_ON */ 52 + gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>; 53 + }; 54 + 55 + power_rocker_sw_off { 56 + label = "Power rocker switch (auto|off)"; 57 + linux,input-type = <5>; /* EV_SW */ 58 + linux,code = <2>; /* D2NET_SWITCH_POWER_OFF */ 59 + gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>; 60 + }; 61 + }; 62 + 63 + regulators { 64 + compatible = "simple-bus"; 65 + #address-cells = <1>; 66 + #size-cells = <0>; 67 + pinctrl-0 = <&pmx_sata0_power &pmx_sata1_power>; 68 + pinctrl-names = "default"; 69 + 70 + sata0_power: regulator@0 { 71 + compatible = "regulator-fixed"; 72 + reg = <0>; 73 + regulator-name = "SATA0 Power"; 74 + regulator-min-microvolt = <5000000>; 75 + regulator-max-microvolt = <5000000>; 76 + enable-active-high; 77 + regulator-always-on; 78 + regulator-boot-on; 79 + gpio = <&gpio0 3 GPIO_ACTIVE_HIGH>; 80 + }; 81 + 82 + sata1_power: regulator@1 { 83 + compatible = "regulator-fixed"; 84 + reg = <1>; 85 + regulator-name = "SATA1 Power"; 86 + regulator-min-microvolt = <5000000>; 87 + regulator-max-microvolt = <5000000>; 88 + enable-active-high; 89 + regulator-always-on; 90 + regulator-boot-on; 91 + gpio = <&gpio0 12 GPIO_ACTIVE_HIGH>; 92 + }; 93 + }; 94 + }; 95 + 96 + &devbus_bootcs { 97 + status = "okay"; 98 + 99 + devbus,keep-config; 100 + 101 + /* 102 + * Currently the MTD code does not recognize the MX29LV400CBCT 103 + * as a bottom-type device. This could cause risks of 104 + * accidentally erasing critical flash sectors. We thus define 105 + * a single, write-protected partition covering the whole 106 + * flash. TODO: once the flash part TOP/BOTTOM detection 107 + * issue is sorted out in the MTD code, break this into at 108 + * least three partitions: 'u-boot code', 'u-boot environment' 109 + * and 'whatever is left'. 110 + */ 111 + flash@0 { 112 + compatible = "cfi-flash"; 113 + reg = <0 0x80000>; 114 + bank-width = <1>; 115 + #address-cells = <1>; 116 + #size-cells = <1>; 117 + 118 + partition@0 { 119 + label = "Full512Kb"; 120 + reg = <0 0x80000>; 121 + read-only; 122 + }; 123 + }; 124 + }; 125 + 126 + &mdio { 127 + status = "okay"; 128 + 129 + ethphy: ethernet-phy { 130 + reg = <8>; 131 + }; 132 + }; 133 + 134 + &ehci0 { 135 + status = "okay"; 136 + }; 137 + 138 + &eth { 139 + status = "okay"; 140 + 141 + ethernet-port@0 { 142 + phy-handle = <&ethphy>; 143 + }; 144 + }; 145 + 146 + &i2c { 147 + status = "okay"; 148 + clock-frequency = <100000>; 149 + #address-cells = <1>; 150 + 151 + rtc@32 { 152 + compatible = "ricoh,rs5c372b"; 153 + reg = <0x32>; 154 + }; 155 + 156 + fan@3e { 157 + compatible = "gmt,g762"; 158 + reg = <0x3e>; 159 + 160 + /* Not enough HW info */ 161 + status = "disabled"; 162 + }; 163 + 164 + eeprom@50 { 165 + compatible = "atmel,24c08"; 166 + reg = <0x50>; 167 + }; 168 + }; 169 + 170 + &pinctrl { 171 + pinctrl-0 = <&pmx_leds &pmx_board_id &pmx_fan_fail>; 172 + pinctrl-names = "default"; 173 + 174 + pmx_board_id: pmx-board-id { 175 + marvell,pins = "mpp0", "mpp1", "mpp2"; 176 + marvell,function = "gpio"; 177 + }; 178 + 179 + pmx_buttons: pmx-buttons { 180 + marvell,pins = "mpp8", "mpp9", "mpp18"; 181 + marvell,function = "gpio"; 182 + }; 183 + 184 + pmx_fan_fail: pmx-fan-fail { 185 + marvell,pins = "mpp5"; 186 + marvell,function = "gpio"; 187 + }; 188 + 189 + /* 190 + * MPP6: Red front LED 191 + * MPP16: Blue front LED blink control 192 + */ 193 + pmx_leds: pmx-leds { 194 + marvell,pins = "mpp6", "mpp16"; 195 + marvell,function = "gpio"; 196 + }; 197 + 198 + pmx_sata0_led_active: pmx-sata0-led-active { 199 + marvell,pins = "mpp14"; 200 + marvell,function = "sata0"; 201 + }; 202 + 203 + pmx_sata0_power: pmx-sata0-power { 204 + marvell,pins = "mpp3"; 205 + marvell,function = "gpio"; 206 + }; 207 + 208 + pmx_sata1_led_active: pmx-sata1-led-active { 209 + marvell,pins = "mpp15"; 210 + marvell,function = "sata1"; 211 + }; 212 + 213 + pmx_sata1_power: pmx-sata1-power { 214 + marvell,pins = "mpp12"; 215 + marvell,function = "gpio"; 216 + }; 217 + 218 + /* 219 + * Non MPP GPIOs: 220 + * GPIO 22: USB port 1 fuse (0 = Fail, 1 = Ok) 221 + * GPIO 23: Blue front LED off 222 + * GPIO 24: Inhibit board power off (0 = Disabled, 1 = Enabled) 223 + */ 224 + }; 225 + 226 + &sata { 227 + pinctrl-0 = <&pmx_sata0_led_active 228 + &pmx_sata1_led_active>; 229 + pinctrl-names = "default"; 230 + status = "okay"; 231 + nr-ports = <2>; 232 + }; 233 + 234 + &uart0 { 235 + status = "okay"; 236 + };
+3 -10
arch/arm/mach-orion5x/Kconfig
··· 115 115 Say 'Y' here if you want your kernel to support the 116 116 HP Media Vault mv2120 or mv5100. 117 117 118 - config MACH_D2NET 119 - bool "LaCie d2 Network" 120 - select I2C_BOARDINFO 118 + config MACH_D2NET_DT 119 + bool "LaCie d2 Network / Big Disk Network (Flattened Device Tree)" 120 + select ARCH_ORION5X_DT 121 121 help 122 122 Say 'Y' here if you want your kernel to support the 123 123 LaCie d2 Network NAS. 124 - 125 - config MACH_BIGDISK 126 - bool "LaCie Big Disk Network" 127 - select I2C_BOARDINFO 128 - help 129 - Say 'Y' here if you want your kernel to support the 130 - LaCie Big Disk Network NAS. 131 124 132 125 config MACH_NET2BIG 133 126 bool "LaCie 2Big Network"
+1 -2
arch/arm/mach-orion5x/Makefile
··· 12 12 obj-$(CONFIG_MACH_WRT350N_V2) += wrt350n-v2-setup.o 13 13 obj-$(CONFIG_MACH_TS78XX) += ts78xx-setup.o 14 14 obj-$(CONFIG_MACH_MV2120) += mv2120-setup.o 15 - obj-$(CONFIG_MACH_D2NET) += d2net-setup.o 16 - obj-$(CONFIG_MACH_BIGDISK) += d2net-setup.o 17 15 obj-$(CONFIG_MACH_NET2BIG) += net2big-setup.o 18 16 obj-$(CONFIG_MACH_MSS2) += mss2-setup.o 19 17 obj-$(CONFIG_MACH_WNR854T) += wnr854t-setup.o ··· 21 23 obj-$(CONFIG_MACH_LINKSTATION_LSCHL) += ls-chl-setup.o 22 24 23 25 obj-$(CONFIG_ARCH_ORION5X_DT) += board-dt.o 26 + obj-$(CONFIG_MACH_D2NET_DT) += board-d2net.o 24 27 obj-$(CONFIG_MACH_RD88F5182_DT) += board-rd88f5182.o
+109
arch/arm/mach-orion5x/board-d2net.c
··· 1 + /* 2 + * arch/arm/mach-orion5x/board-d2net.c 3 + * 4 + * LaCie d2Network and Big Disk Network NAS setup 5 + * 6 + * Copyright (C) 2009 Simon Guinot <sguinot@lacie.com> 7 + * 8 + * This file is licensed under the terms of the GNU General Public 9 + * License version 2. This program is licensed "as is" without any 10 + * warranty of any kind, whether express or implied. 11 + */ 12 + 13 + #include <linux/kernel.h> 14 + #include <linux/init.h> 15 + #include <linux/platform_device.h> 16 + #include <linux/pci.h> 17 + #include <linux/irq.h> 18 + #include <linux/leds.h> 19 + #include <linux/gpio.h> 20 + #include <asm/mach-types.h> 21 + #include <asm/mach/arch.h> 22 + #include <asm/mach/pci.h> 23 + #include <mach/orion5x.h> 24 + #include <plat/orion-gpio.h> 25 + #include "common.h" 26 + 27 + /***************************************************************************** 28 + * LaCie d2 Network Info 29 + ****************************************************************************/ 30 + 31 + /***************************************************************************** 32 + * GPIO LED's 33 + ****************************************************************************/ 34 + 35 + /* 36 + * The blue front LED is wired to the CPLD and can blink in relation with the 37 + * SATA activity. 38 + * 39 + * The following array detail the different LED registers and the combination 40 + * of their possible values: 41 + * 42 + * led_off | blink_ctrl | SATA active | LED state 43 + * | | | 44 + * 1 | x | x | off 45 + * 0 | 0 | 0 | off 46 + * 0 | 1 | 0 | blink (rate 300ms) 47 + * 0 | x | 1 | on 48 + * 49 + * Notes: The blue and the red front LED's can't be on at the same time. 50 + * Red LED have priority. 51 + */ 52 + 53 + #define D2NET_GPIO_RED_LED 6 54 + #define D2NET_GPIO_BLUE_LED_BLINK_CTRL 16 55 + #define D2NET_GPIO_BLUE_LED_OFF 23 56 + 57 + static struct gpio_led d2net_leds[] = { 58 + { 59 + .name = "d2net:blue:sata", 60 + .default_trigger = "default-on", 61 + .gpio = D2NET_GPIO_BLUE_LED_OFF, 62 + .active_low = 1, 63 + }, 64 + { 65 + .name = "d2net:red:fail", 66 + .gpio = D2NET_GPIO_RED_LED, 67 + }, 68 + }; 69 + 70 + static struct gpio_led_platform_data d2net_led_data = { 71 + .num_leds = ARRAY_SIZE(d2net_leds), 72 + .leds = d2net_leds, 73 + }; 74 + 75 + static struct platform_device d2net_gpio_leds = { 76 + .name = "leds-gpio", 77 + .id = -1, 78 + .dev = { 79 + .platform_data = &d2net_led_data, 80 + }, 81 + }; 82 + 83 + static void __init d2net_gpio_leds_init(void) 84 + { 85 + int err; 86 + 87 + /* Configure register blink_ctrl to allow SATA activity LED blinking. */ 88 + err = gpio_request(D2NET_GPIO_BLUE_LED_BLINK_CTRL, "blue LED blink"); 89 + if (err == 0) { 90 + err = gpio_direction_output(D2NET_GPIO_BLUE_LED_BLINK_CTRL, 1); 91 + if (err) 92 + gpio_free(D2NET_GPIO_BLUE_LED_BLINK_CTRL); 93 + } 94 + if (err) 95 + pr_err("d2net: failed to configure blue LED blink GPIO\n"); 96 + 97 + platform_device_register(&d2net_gpio_leds); 98 + } 99 + 100 + /***************************************************************************** 101 + * General Setup 102 + ****************************************************************************/ 103 + 104 + void __init d2net_init(void) 105 + { 106 + d2net_gpio_leds_init(); 107 + 108 + pr_notice("d2net: Flash write are not yet supported.\n"); 109 + }
-365
arch/arm/mach-orion5x/d2net-setup.c
··· 1 - /* 2 - * arch/arm/mach-orion5x/d2net-setup.c 3 - * 4 - * LaCie d2Network and Big Disk Network NAS setup 5 - * 6 - * Copyright (C) 2009 Simon Guinot <sguinot@lacie.com> 7 - * 8 - * This file is licensed under the terms of the GNU General Public 9 - * License version 2. This program is licensed "as is" without any 10 - * warranty of any kind, whether express or implied. 11 - */ 12 - 13 - #include <linux/kernel.h> 14 - #include <linux/init.h> 15 - #include <linux/platform_device.h> 16 - #include <linux/pci.h> 17 - #include <linux/irq.h> 18 - #include <linux/mtd/physmap.h> 19 - #include <linux/mv643xx_eth.h> 20 - #include <linux/leds.h> 21 - #include <linux/gpio_keys.h> 22 - #include <linux/input.h> 23 - #include <linux/i2c.h> 24 - #include <linux/ata_platform.h> 25 - #include <linux/gpio.h> 26 - #include <asm/mach-types.h> 27 - #include <asm/mach/arch.h> 28 - #include <asm/mach/pci.h> 29 - #include <mach/orion5x.h> 30 - #include <plat/orion-gpio.h> 31 - #include "common.h" 32 - #include "mpp.h" 33 - 34 - /***************************************************************************** 35 - * LaCie d2 Network Info 36 - ****************************************************************************/ 37 - 38 - /* 39 - * 512KB NOR flash Device bus boot chip select 40 - */ 41 - 42 - #define D2NET_NOR_BOOT_BASE 0xfff80000 43 - #define D2NET_NOR_BOOT_SIZE SZ_512K 44 - 45 - /***************************************************************************** 46 - * 512KB NOR Flash on Boot Device 47 - ****************************************************************************/ 48 - 49 - /* 50 - * TODO: Check write support on flash MX29LV400CBTC-70G 51 - */ 52 - 53 - static struct mtd_partition d2net_partitions[] = { 54 - { 55 - .name = "Full512kb", 56 - .size = MTDPART_SIZ_FULL, 57 - .offset = 0, 58 - .mask_flags = MTD_WRITEABLE, 59 - }, 60 - }; 61 - 62 - static struct physmap_flash_data d2net_nor_flash_data = { 63 - .width = 1, 64 - .parts = d2net_partitions, 65 - .nr_parts = ARRAY_SIZE(d2net_partitions), 66 - }; 67 - 68 - static struct resource d2net_nor_flash_resource = { 69 - .flags = IORESOURCE_MEM, 70 - .start = D2NET_NOR_BOOT_BASE, 71 - .end = D2NET_NOR_BOOT_BASE 72 - + D2NET_NOR_BOOT_SIZE - 1, 73 - }; 74 - 75 - static struct platform_device d2net_nor_flash = { 76 - .name = "physmap-flash", 77 - .id = 0, 78 - .dev = { 79 - .platform_data = &d2net_nor_flash_data, 80 - }, 81 - .num_resources = 1, 82 - .resource = &d2net_nor_flash_resource, 83 - }; 84 - 85 - /***************************************************************************** 86 - * Ethernet 87 - ****************************************************************************/ 88 - 89 - static struct mv643xx_eth_platform_data d2net_eth_data = { 90 - .phy_addr = MV643XX_ETH_PHY_ADDR(8), 91 - }; 92 - 93 - /***************************************************************************** 94 - * I2C devices 95 - ****************************************************************************/ 96 - 97 - /* 98 - * i2c addr | chip | description 99 - * 0x32 | Ricoh 5C372b | RTC 100 - * 0x3e | GMT G762 | PWM fan controller 101 - * 0x50 | HT24LC08 | eeprom (1kB) 102 - * 103 - * TODO: Add G762 support to the g760a driver. 104 - */ 105 - static struct i2c_board_info __initdata d2net_i2c_devices[] = { 106 - { 107 - I2C_BOARD_INFO("rs5c372b", 0x32), 108 - }, { 109 - I2C_BOARD_INFO("24c08", 0x50), 110 - }, 111 - }; 112 - 113 - /***************************************************************************** 114 - * SATA 115 - ****************************************************************************/ 116 - 117 - static struct mv_sata_platform_data d2net_sata_data = { 118 - .n_ports = 2, 119 - }; 120 - 121 - #define D2NET_GPIO_SATA0_POWER 3 122 - #define D2NET_GPIO_SATA1_POWER 12 123 - 124 - static void __init d2net_sata_power_init(void) 125 - { 126 - int err; 127 - 128 - err = gpio_request(D2NET_GPIO_SATA0_POWER, "SATA0 power"); 129 - if (err == 0) { 130 - err = gpio_direction_output(D2NET_GPIO_SATA0_POWER, 1); 131 - if (err) 132 - gpio_free(D2NET_GPIO_SATA0_POWER); 133 - } 134 - if (err) 135 - pr_err("d2net: failed to configure SATA0 power GPIO\n"); 136 - 137 - err = gpio_request(D2NET_GPIO_SATA1_POWER, "SATA1 power"); 138 - if (err == 0) { 139 - err = gpio_direction_output(D2NET_GPIO_SATA1_POWER, 1); 140 - if (err) 141 - gpio_free(D2NET_GPIO_SATA1_POWER); 142 - } 143 - if (err) 144 - pr_err("d2net: failed to configure SATA1 power GPIO\n"); 145 - } 146 - 147 - /***************************************************************************** 148 - * GPIO LED's 149 - ****************************************************************************/ 150 - 151 - /* 152 - * The blue front LED is wired to the CPLD and can blink in relation with the 153 - * SATA activity. 154 - * 155 - * The following array detail the different LED registers and the combination 156 - * of their possible values: 157 - * 158 - * led_off | blink_ctrl | SATA active | LED state 159 - * | | | 160 - * 1 | x | x | off 161 - * 0 | 0 | 0 | off 162 - * 0 | 1 | 0 | blink (rate 300ms) 163 - * 0 | x | 1 | on 164 - * 165 - * Notes: The blue and the red front LED's can't be on at the same time. 166 - * Red LED have priority. 167 - */ 168 - 169 - #define D2NET_GPIO_RED_LED 6 170 - #define D2NET_GPIO_BLUE_LED_BLINK_CTRL 16 171 - #define D2NET_GPIO_BLUE_LED_OFF 23 172 - 173 - static struct gpio_led d2net_leds[] = { 174 - { 175 - .name = "d2net:blue:sata", 176 - .default_trigger = "default-on", 177 - .gpio = D2NET_GPIO_BLUE_LED_OFF, 178 - .active_low = 1, 179 - }, 180 - { 181 - .name = "d2net:red:fail", 182 - .gpio = D2NET_GPIO_RED_LED, 183 - }, 184 - }; 185 - 186 - static struct gpio_led_platform_data d2net_led_data = { 187 - .num_leds = ARRAY_SIZE(d2net_leds), 188 - .leds = d2net_leds, 189 - }; 190 - 191 - static struct platform_device d2net_gpio_leds = { 192 - .name = "leds-gpio", 193 - .id = -1, 194 - .dev = { 195 - .platform_data = &d2net_led_data, 196 - }, 197 - }; 198 - 199 - static void __init d2net_gpio_leds_init(void) 200 - { 201 - int err; 202 - 203 - /* Configure GPIO over MPP max number. */ 204 - orion_gpio_set_valid(D2NET_GPIO_BLUE_LED_OFF, 1); 205 - 206 - /* Configure register blink_ctrl to allow SATA activity LED blinking. */ 207 - err = gpio_request(D2NET_GPIO_BLUE_LED_BLINK_CTRL, "blue LED blink"); 208 - if (err == 0) { 209 - err = gpio_direction_output(D2NET_GPIO_BLUE_LED_BLINK_CTRL, 1); 210 - if (err) 211 - gpio_free(D2NET_GPIO_BLUE_LED_BLINK_CTRL); 212 - } 213 - if (err) 214 - pr_err("d2net: failed to configure blue LED blink GPIO\n"); 215 - 216 - platform_device_register(&d2net_gpio_leds); 217 - } 218 - 219 - /**************************************************************************** 220 - * GPIO keys 221 - ****************************************************************************/ 222 - 223 - #define D2NET_GPIO_PUSH_BUTTON 18 224 - #define D2NET_GPIO_POWER_SWITCH_ON 8 225 - #define D2NET_GPIO_POWER_SWITCH_OFF 9 226 - 227 - #define D2NET_SWITCH_POWER_ON 0x1 228 - #define D2NET_SWITCH_POWER_OFF 0x2 229 - 230 - static struct gpio_keys_button d2net_buttons[] = { 231 - { 232 - .type = EV_SW, 233 - .code = D2NET_SWITCH_POWER_OFF, 234 - .gpio = D2NET_GPIO_POWER_SWITCH_OFF, 235 - .desc = "Power rocker switch (auto|off)", 236 - .active_low = 0, 237 - }, 238 - { 239 - .type = EV_SW, 240 - .code = D2NET_SWITCH_POWER_ON, 241 - .gpio = D2NET_GPIO_POWER_SWITCH_ON, 242 - .desc = "Power rocker switch (on|auto)", 243 - .active_low = 0, 244 - }, 245 - { 246 - .type = EV_KEY, 247 - .code = KEY_POWER, 248 - .gpio = D2NET_GPIO_PUSH_BUTTON, 249 - .desc = "Front Push Button", 250 - .active_low = 0, 251 - }, 252 - }; 253 - 254 - static struct gpio_keys_platform_data d2net_button_data = { 255 - .buttons = d2net_buttons, 256 - .nbuttons = ARRAY_SIZE(d2net_buttons), 257 - }; 258 - 259 - static struct platform_device d2net_gpio_buttons = { 260 - .name = "gpio-keys", 261 - .id = -1, 262 - .dev = { 263 - .platform_data = &d2net_button_data, 264 - }, 265 - }; 266 - 267 - /***************************************************************************** 268 - * General Setup 269 - ****************************************************************************/ 270 - 271 - static unsigned int d2net_mpp_modes[] __initdata = { 272 - MPP0_GPIO, /* Board ID (bit 0) */ 273 - MPP1_GPIO, /* Board ID (bit 1) */ 274 - MPP2_GPIO, /* Board ID (bit 2) */ 275 - MPP3_GPIO, /* SATA 0 power */ 276 - MPP4_UNUSED, 277 - MPP5_GPIO, /* Fan fail detection */ 278 - MPP6_GPIO, /* Red front LED */ 279 - MPP7_UNUSED, 280 - MPP8_GPIO, /* Rear power switch (on|auto) */ 281 - MPP9_GPIO, /* Rear power switch (auto|off) */ 282 - MPP10_UNUSED, 283 - MPP11_UNUSED, 284 - MPP12_GPIO, /* SATA 1 power */ 285 - MPP13_UNUSED, 286 - MPP14_SATA_LED, /* SATA 0 active */ 287 - MPP15_SATA_LED, /* SATA 1 active */ 288 - MPP16_GPIO, /* Blue front LED blink control */ 289 - MPP17_UNUSED, 290 - MPP18_GPIO, /* Front button (0 = Released, 1 = Pushed ) */ 291 - MPP19_UNUSED, 292 - 0, 293 - /* 22: USB port 1 fuse (0 = Fail, 1 = Ok) */ 294 - /* 23: Blue front LED off */ 295 - /* 24: Inhibit board power off (0 = Disabled, 1 = Enabled) */ 296 - }; 297 - 298 - #define D2NET_GPIO_INHIBIT_POWER_OFF 24 299 - 300 - static void __init d2net_init(void) 301 - { 302 - /* 303 - * Setup basic Orion functions. Need to be called early. 304 - */ 305 - orion5x_init(); 306 - 307 - orion5x_mpp_conf(d2net_mpp_modes); 308 - 309 - /* 310 - * Configure peripherals. 311 - */ 312 - orion5x_ehci0_init(); 313 - orion5x_eth_init(&d2net_eth_data); 314 - orion5x_i2c_init(); 315 - orion5x_uart0_init(); 316 - 317 - d2net_sata_power_init(); 318 - orion5x_sata_init(&d2net_sata_data); 319 - 320 - mvebu_mbus_add_window_by_id(ORION_MBUS_DEVBUS_BOOT_TARGET, 321 - ORION_MBUS_DEVBUS_BOOT_ATTR, 322 - D2NET_NOR_BOOT_BASE, 323 - D2NET_NOR_BOOT_SIZE); 324 - platform_device_register(&d2net_nor_flash); 325 - 326 - platform_device_register(&d2net_gpio_buttons); 327 - 328 - d2net_gpio_leds_init(); 329 - 330 - pr_notice("d2net: Flash write are not yet supported.\n"); 331 - 332 - i2c_register_board_info(0, d2net_i2c_devices, 333 - ARRAY_SIZE(d2net_i2c_devices)); 334 - 335 - orion_gpio_set_valid(D2NET_GPIO_INHIBIT_POWER_OFF, 1); 336 - } 337 - 338 - /* Warning: LaCie use a wrong mach-type (0x20e=526) in their bootloader. */ 339 - 340 - #ifdef CONFIG_MACH_D2NET 341 - MACHINE_START(D2NET, "LaCie d2 Network") 342 - .atag_offset = 0x100, 343 - .init_machine = d2net_init, 344 - .map_io = orion5x_map_io, 345 - .init_early = orion5x_init_early, 346 - .init_irq = orion5x_init_irq, 347 - .init_time = orion5x_timer_init, 348 - .fixup = tag_fixup_mem32, 349 - .restart = orion5x_restart, 350 - MACHINE_END 351 - #endif 352 - 353 - #ifdef CONFIG_MACH_BIGDISK 354 - MACHINE_START(BIGDISK, "LaCie Big Disk Network") 355 - .atag_offset = 0x100, 356 - .init_machine = d2net_init, 357 - .map_io = orion5x_map_io, 358 - .init_early = orion5x_init_early, 359 - .init_irq = orion5x_init_irq, 360 - .init_time = orion5x_timer_init, 361 - .fixup = tag_fixup_mem32, 362 - .restart = orion5x_restart, 363 - MACHINE_END 364 - #endif 365 -