diff options
Diffstat (limited to 'arch/arm/mach-orion5x/dns323-setup.c')
-rw-r--r-- | arch/arm/mach-orion5x/dns323-setup.c | 125 |
1 files changed, 58 insertions, 67 deletions
diff --git a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c index 27ce967ab9e5..3791ca6f001a 100644 --- a/arch/arm/mach-orion5x/dns323-setup.c +++ b/arch/arm/mach-orion5x/dns323-setup.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <asm/mach/pci.h> | 27 | #include <asm/mach/pci.h> |
28 | #include <asm/arch/orion5x.h> | 28 | #include <asm/arch/orion5x.h> |
29 | #include "common.h" | 29 | #include "common.h" |
30 | #include "mpp.h" | ||
30 | 31 | ||
31 | #define DNS323_GPIO_LED_RIGHT_AMBER 1 | 32 | #define DNS323_GPIO_LED_RIGHT_AMBER 1 |
32 | #define DNS323_GPIO_LED_LEFT_AMBER 2 | 33 | #define DNS323_GPIO_LED_LEFT_AMBER 2 |
@@ -52,8 +53,6 @@ static int __init dns323_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | |||
52 | if (irq != -1) | 53 | if (irq != -1) |
53 | return irq; | 54 | return irq; |
54 | 55 | ||
55 | pr_err("%s: requested mapping for unknown device\n", __func__); | ||
56 | |||
57 | return -1; | 56 | return -1; |
58 | } | 57 | } |
59 | 58 | ||
@@ -81,7 +80,6 @@ subsys_initcall(dns323_pci_init); | |||
81 | 80 | ||
82 | static struct mv643xx_eth_platform_data dns323_eth_data = { | 81 | static struct mv643xx_eth_platform_data dns323_eth_data = { |
83 | .phy_addr = 8, | 82 | .phy_addr = 8, |
84 | .force_phy_addr = 1, | ||
85 | }; | 83 | }; |
86 | 84 | ||
87 | /**************************************************************************** | 85 | /**************************************************************************** |
@@ -119,7 +117,7 @@ static struct mtd_partition dns323_partitions[] = { | |||
119 | .name = "u-boot", | 117 | .name = "u-boot", |
120 | .size = 0x00030000, | 118 | .size = 0x00030000, |
121 | .offset = 0x007d0000, | 119 | .offset = 0x007d0000, |
122 | } | 120 | }, |
123 | }; | 121 | }; |
124 | 122 | ||
125 | static struct physmap_flash_data dns323_nor_flash_data = { | 123 | static struct physmap_flash_data dns323_nor_flash_data = { |
@@ -137,7 +135,9 @@ static struct resource dns323_nor_flash_resource = { | |||
137 | static struct platform_device dns323_nor_flash = { | 135 | static struct platform_device dns323_nor_flash = { |
138 | .name = "physmap-flash", | 136 | .name = "physmap-flash", |
139 | .id = 0, | 137 | .id = 0, |
140 | .dev = { .platform_data = &dns323_nor_flash_data, }, | 138 | .dev = { |
139 | .platform_data = &dns323_nor_flash_data, | ||
140 | }, | ||
141 | .resource = &dns323_nor_flash_resource, | 141 | .resource = &dns323_nor_flash_resource, |
142 | .num_resources = 1, | 142 | .num_resources = 1, |
143 | }; | 143 | }; |
@@ -170,7 +170,9 @@ static struct gpio_led_platform_data dns323_led_data = { | |||
170 | static struct platform_device dns323_gpio_leds = { | 170 | static struct platform_device dns323_gpio_leds = { |
171 | .name = "leds-gpio", | 171 | .name = "leds-gpio", |
172 | .id = -1, | 172 | .id = -1, |
173 | .dev = { .platform_data = &dns323_led_data, }, | 173 | .dev = { |
174 | .platform_data = &dns323_led_data, | ||
175 | }, | ||
174 | }; | 176 | }; |
175 | 177 | ||
176 | /**************************************************************************** | 178 | /**************************************************************************** |
@@ -183,35 +185,53 @@ static struct gpio_keys_button dns323_buttons[] = { | |||
183 | .gpio = DNS323_GPIO_KEY_RESET, | 185 | .gpio = DNS323_GPIO_KEY_RESET, |
184 | .desc = "Reset Button", | 186 | .desc = "Reset Button", |
185 | .active_low = 1, | 187 | .active_low = 1, |
186 | }, | 188 | }, { |
187 | { | ||
188 | .code = KEY_POWER, | 189 | .code = KEY_POWER, |
189 | .gpio = DNS323_GPIO_KEY_POWER, | 190 | .gpio = DNS323_GPIO_KEY_POWER, |
190 | .desc = "Power Button", | 191 | .desc = "Power Button", |
191 | .active_low = 1, | 192 | .active_low = 1, |
192 | } | 193 | }, |
193 | }; | 194 | }; |
194 | 195 | ||
195 | static struct gpio_keys_platform_data dns323_button_data = { | 196 | static struct gpio_keys_platform_data dns323_button_data = { |
196 | .buttons = dns323_buttons, | 197 | .buttons = dns323_buttons, |
197 | .nbuttons = ARRAY_SIZE(dns323_buttons), | 198 | .nbuttons = ARRAY_SIZE(dns323_buttons), |
198 | }; | 199 | }; |
199 | 200 | ||
200 | static struct platform_device dns323_button_device = { | 201 | static struct platform_device dns323_button_device = { |
201 | .name = "gpio-keys", | 202 | .name = "gpio-keys", |
202 | .id = -1, | 203 | .id = -1, |
203 | .num_resources = 0, | 204 | .num_resources = 0, |
204 | .dev = { .platform_data = &dns323_button_data, }, | 205 | .dev = { |
206 | .platform_data = &dns323_button_data, | ||
207 | }, | ||
205 | }; | 208 | }; |
206 | 209 | ||
207 | /**************************************************************************** | 210 | /**************************************************************************** |
208 | * General Setup | 211 | * General Setup |
209 | */ | 212 | */ |
210 | 213 | static struct orion5x_mpp_mode dns323_mpp_modes[] __initdata = { | |
211 | static struct platform_device *dns323_plat_devices[] __initdata = { | 214 | { 0, MPP_PCIE_RST_OUTn }, |
212 | &dns323_nor_flash, | 215 | { 1, MPP_GPIO }, /* right amber LED (sata ch0) */ |
213 | &dns323_gpio_leds, | 216 | { 2, MPP_GPIO }, /* left amber LED (sata ch1) */ |
214 | &dns323_button_device, | 217 | { 3, MPP_UNUSED }, |
218 | { 4, MPP_GPIO }, /* power button LED */ | ||
219 | { 5, MPP_GPIO }, /* power button LED */ | ||
220 | { 6, MPP_GPIO }, /* GMT G751-2f overtemp */ | ||
221 | { 7, MPP_GPIO }, /* M41T80 nIRQ/OUT/SQW */ | ||
222 | { 8, MPP_GPIO }, /* triggers power off */ | ||
223 | { 9, MPP_GPIO }, /* power button switch */ | ||
224 | { 10, MPP_GPIO }, /* reset button switch */ | ||
225 | { 11, MPP_UNUSED }, | ||
226 | { 12, MPP_UNUSED }, | ||
227 | { 13, MPP_UNUSED }, | ||
228 | { 14, MPP_UNUSED }, | ||
229 | { 15, MPP_UNUSED }, | ||
230 | { 16, MPP_UNUSED }, | ||
231 | { 17, MPP_UNUSED }, | ||
232 | { 18, MPP_UNUSED }, | ||
233 | { 19, MPP_UNUSED }, | ||
234 | { -1 }, | ||
215 | }; | 235 | }; |
216 | 236 | ||
217 | /* | 237 | /* |
@@ -225,17 +245,15 @@ static struct platform_device *dns323_plat_devices[] __initdata = { | |||
225 | static struct i2c_board_info __initdata dns323_i2c_devices[] = { | 245 | static struct i2c_board_info __initdata dns323_i2c_devices[] = { |
226 | { | 246 | { |
227 | I2C_BOARD_INFO("g760a", 0x3e), | 247 | I2C_BOARD_INFO("g760a", 0x3e), |
228 | }, | ||
229 | #if 0 | 248 | #if 0 |
230 | /* this entry requires the new-style driver model lm75 driver, | 249 | /* this entry requires the new-style driver model lm75 driver, |
231 | * for the meantime "insmod lm75.ko force_lm75=0,0x48" is needed */ | 250 | * for the meantime "insmod lm75.ko force_lm75=0,0x48" is needed */ |
232 | { | 251 | }, { |
233 | I2C_BOARD_INFO("g751", 0x48), | 252 | I2C_BOARD_INFO("g751", 0x48), |
234 | }, | ||
235 | #endif | 253 | #endif |
236 | { | 254 | }, { |
237 | I2C_BOARD_INFO("m41t80", 0x68), | 255 | I2C_BOARD_INFO("m41t80", 0x68), |
238 | } | 256 | }, |
239 | }; | 257 | }; |
240 | 258 | ||
241 | /* DNS-323 specific power off method */ | 259 | /* DNS-323 specific power off method */ |
@@ -250,62 +268,35 @@ static void __init dns323_init(void) | |||
250 | /* Setup basic Orion functions. Need to be called early. */ | 268 | /* Setup basic Orion functions. Need to be called early. */ |
251 | orion5x_init(); | 269 | orion5x_init(); |
252 | 270 | ||
271 | orion5x_mpp_conf(dns323_mpp_modes); | ||
272 | writel(0, MPP_DEV_CTRL); /* DEV_D[31:16] */ | ||
273 | |||
274 | /* | ||
275 | * Configure peripherals. | ||
276 | */ | ||
277 | orion5x_ehci0_init(); | ||
278 | orion5x_eth_init(&dns323_eth_data); | ||
279 | orion5x_i2c_init(); | ||
280 | orion5x_uart0_init(); | ||
281 | |||
253 | /* setup flash mapping | 282 | /* setup flash mapping |
254 | * CS3 holds a 8 MB Spansion S29GL064M90TFIR4 | 283 | * CS3 holds a 8 MB Spansion S29GL064M90TFIR4 |
255 | */ | 284 | */ |
256 | orion5x_setup_dev_boot_win(DNS323_NOR_BOOT_BASE, DNS323_NOR_BOOT_SIZE); | 285 | orion5x_setup_dev_boot_win(DNS323_NOR_BOOT_BASE, DNS323_NOR_BOOT_SIZE); |
286 | platform_device_register(&dns323_nor_flash); | ||
257 | 287 | ||
258 | /* DNS-323 has a Marvell 88X7042 SATA controller attached via PCIe | 288 | platform_device_register(&dns323_gpio_leds); |
259 | * | ||
260 | * Open a special address decode windows for the PCIe WA. | ||
261 | */ | ||
262 | orion5x_setup_pcie_wa_win(ORION5X_PCIE_WA_PHYS_BASE, | ||
263 | ORION5X_PCIE_WA_SIZE); | ||
264 | |||
265 | /* set MPP to 0 as D-Link's 2.6.12.6 kernel did */ | ||
266 | orion5x_write(MPP_0_7_CTRL, 0); | ||
267 | orion5x_write(MPP_8_15_CTRL, 0); | ||
268 | orion5x_write(MPP_16_19_CTRL, 0); | ||
269 | orion5x_write(MPP_DEV_CTRL, 0); | ||
270 | |||
271 | /* Define used GPIO pins | ||
272 | |||
273 | GPIO Map: | ||
274 | |||
275 | | 0 | | PEX_RST_OUT (not controlled by GPIO) | ||
276 | | 1 | Out | right amber LED (= sata ch0 LED) (low-active) | ||
277 | | 2 | Out | left amber LED (= sata ch1 LED) (low-active) | ||
278 | | 3 | Out | //unknown// | ||
279 | | 4 | Out | power button LED (low-active, together with pin #5) | ||
280 | | 5 | Out | power button LED (low-active, together with pin #4) | ||
281 | | 6 | In | GMT G751-2f overtemp. shutdown signal (low-active) | ||
282 | | 7 | In | M41T80 nIRQ/OUT/SQW signal | ||
283 | | 8 | Out | triggers power off (high-active) | ||
284 | | 9 | In | power button switch (low-active) | ||
285 | | 10 | In | reset button switch (low-active) | ||
286 | | 11 | Out | //unknown// | ||
287 | | 12 | Out | //unknown// | ||
288 | | 13 | Out | //unknown// | ||
289 | | 14 | Out | //unknown// | ||
290 | | 15 | Out | //unknown// | ||
291 | */ | ||
292 | orion5x_gpio_set_valid_pins(0x07f6); | ||
293 | |||
294 | /* register dns323 specific power-off method */ | ||
295 | if ((gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0) | ||
296 | || (gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0)) | ||
297 | pr_err("DNS323: failed to setup power-off GPIO\n"); | ||
298 | |||
299 | pm_power_off = dns323_power_off; | ||
300 | 289 | ||
301 | /* register flash and other platform devices */ | 290 | platform_device_register(&dns323_button_device); |
302 | platform_add_devices(dns323_plat_devices, | ||
303 | ARRAY_SIZE(dns323_plat_devices)); | ||
304 | 291 | ||
305 | i2c_register_board_info(0, dns323_i2c_devices, | 292 | i2c_register_board_info(0, dns323_i2c_devices, |
306 | ARRAY_SIZE(dns323_i2c_devices)); | 293 | ARRAY_SIZE(dns323_i2c_devices)); |
307 | 294 | ||
308 | orion5x_eth_init(&dns323_eth_data); | 295 | /* register dns323 specific power-off method */ |
296 | if (gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0 || | ||
297 | gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0) | ||
298 | pr_err("DNS323: failed to setup power-off GPIO\n"); | ||
299 | pm_power_off = dns323_power_off; | ||
309 | } | 300 | } |
310 | 301 | ||
311 | /* Warning: D-Link uses a wrong mach-type (=526) in their bootloader */ | 302 | /* Warning: D-Link uses a wrong mach-type (=526) in their bootloader */ |