[ARM] 3396/2: AT91RM9200 Platform devices update

Patch from Andrew Victor

This patch updates the platform device resources for the Ethernet and
MMC peripherals. It also adds platform device information for the NAND
(SmartMedia), I2C and the RTC.

(This version of the patch can be applied before Patch 3392/1)

Signed-off-by: Andrew Victor <andrew@sanpeople.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by

Andrew Victor and committed by
Russell King
3267c077 486bcc59

+146 -8
+127 -8
arch/arm/mach-at91rm9200/devices.c
··· 28 28 static u64 ohci_dmamask = 0xffffffffUL; 29 29 static struct at91_usbh_data usbh_data; 30 30 31 - static struct resource at91rm9200_usbh_resource[] = { 31 + static struct resource at91_usbh_resource[] = { 32 32 [0] = { 33 33 .start = AT91_UHP_BASE, 34 - .end = AT91_UHP_BASE + SZ_1M -1, 34 + .end = AT91_UHP_BASE + SZ_1M - 1, 35 35 .flags = IORESOURCE_MEM, 36 36 }, 37 37 [1] = { ··· 49 49 .coherent_dma_mask = 0xffffffff, 50 50 .platform_data = &usbh_data, 51 51 }, 52 - .resource = at91rm9200_usbh_resource, 53 - .num_resources = ARRAY_SIZE(at91rm9200_usbh_resource), 52 + .resource = at91_usbh_resource, 53 + .num_resources = ARRAY_SIZE(at91_usbh_resource), 54 54 }; 55 55 56 56 void __init at91_add_device_usbh(struct at91_usbh_data *data) ··· 121 121 static u64 eth_dmamask = 0xffffffffUL; 122 122 static struct at91_eth_data eth_data; 123 123 124 + static struct resource at91_eth_resources[] = { 125 + [0] = { 126 + .start = AT91_BASE_EMAC, 127 + .end = AT91_BASE_EMAC + SZ_16K - 1, 128 + .flags = IORESOURCE_MEM, 129 + }, 130 + [1] = { 131 + .start = AT91_ID_EMAC, 132 + .end = AT91_ID_EMAC, 133 + .flags = IORESOURCE_IRQ, 134 + }, 135 + }; 136 + 124 137 static struct platform_device at91rm9200_eth_device = { 125 138 .name = "at91_ether", 126 139 .id = -1, ··· 142 129 .coherent_dma_mask = 0xffffffff, 143 130 .platform_data = &eth_data, 144 131 }, 145 - .num_resources = 0, 132 + .resource = at91_eth_resources, 133 + .num_resources = ARRAY_SIZE(at91_eth_resources), 146 134 }; 147 135 148 136 void __init at91_add_device_eth(struct at91_eth_data *data) ··· 238 224 static struct at91_mmc_data mmc_data; 239 225 240 226 static struct resource at91_mmc_resources[] = { 241 - { 227 + [0] = { 242 228 .start = AT91_BASE_MCI, 243 229 .end = AT91_BASE_MCI + SZ_16K - 1, 244 230 .flags = IORESOURCE_MEM, 245 - } 231 + }, 232 + [1] = { 233 + .start = AT91_ID_MCI, 234 + .end = AT91_ID_MCI, 235 + .flags = IORESOURCE_IRQ, 236 + }, 246 237 }; 247 238 248 239 static struct platform_device at91rm9200_mmc_device = { 249 - .name = "at91rm9200_mci", 240 + .name = "at91_mci", 250 241 .id = -1, 251 242 .dev = { 252 243 .dma_mask = &mmc_dmamask, ··· 308 289 #else 309 290 void __init at91_add_device_mmc(struct at91_mmc_data *data) {} 310 291 #endif 292 + 293 + /* -------------------------------------------------------------------- 294 + * NAND / SmartMedia 295 + * -------------------------------------------------------------------- */ 296 + 297 + #if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE) 298 + static struct at91_nand_data nand_data; 299 + 300 + static struct resource at91_nand_resources[] = { 301 + { 302 + .start = AT91_SMARTMEDIA_BASE, 303 + .end = AT91_SMARTMEDIA_BASE + SZ_8M - 1, 304 + .flags = IORESOURCE_MEM, 305 + } 306 + }; 307 + 308 + static struct platform_device at91_nand_device = { 309 + .name = "at91_nand", 310 + .id = -1, 311 + .dev = { 312 + .platform_data = &nand_data, 313 + }, 314 + .resource = at91_nand_resources, 315 + .num_resources = ARRAY_SIZE(at91_nand_resources), 316 + }; 317 + 318 + void __init at91_add_device_nand(struct at91_nand_data *data) 319 + { 320 + if (!data) 321 + return; 322 + 323 + /* enable pin */ 324 + if (data->enable_pin) 325 + at91_set_gpio_output(data->enable_pin, 1); 326 + 327 + /* ready/busy pin */ 328 + if (data->rdy_pin) 329 + at91_set_gpio_input(data->rdy_pin, 1); 330 + 331 + /* card detect pin */ 332 + if (data->det_pin) 333 + at91_set_gpio_input(data->det_pin, 1); 334 + 335 + at91_set_A_periph(AT91_PIN_PC1, 0); /* SMOE */ 336 + at91_set_A_periph(AT91_PIN_PC3, 0); /* SMWE */ 337 + 338 + nand_data = *data; 339 + platform_device_register(&at91_nand_device); 340 + } 341 + #else 342 + void __init at91_add_device_nand(struct at91_nand_data *data) {} 343 + #endif 344 + 345 + 346 + /* -------------------------------------------------------------------- 347 + * TWI (i2c) 348 + * -------------------------------------------------------------------- */ 349 + 350 + #if defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE) 351 + static struct platform_device at91rm9200_twi_device = { 352 + .name = "at91_i2c", 353 + .id = -1, 354 + .num_resources = 0, 355 + }; 356 + 357 + void __init at91_add_device_i2c(void) 358 + { 359 + /* pins used for TWI interface */ 360 + at91_set_A_periph(AT91_PIN_PA25, 0); /* TWD */ 361 + at91_set_multi_drive(AT91_PIN_PA25, 1); 362 + 363 + at91_set_A_periph(AT91_PIN_PA26, 0); /* TWCK */ 364 + at91_set_multi_drive(AT91_PIN_PA26, 1); 365 + 366 + platform_device_register(&at91rm9200_twi_device); 367 + } 368 + #else 369 + void __init at91_add_device_i2c(void) {} 370 + #endif 371 + 372 + 373 + /* -------------------------------------------------------------------- 374 + * RTC 375 + * -------------------------------------------------------------------- */ 376 + 377 + #if defined(CONFIG_AT91_RTC) || defined(CONFIG_AT91_RTC_MODULE) 378 + static struct platform_device at91rm9200_rtc_device = { 379 + .name = "at91_rtc", 380 + .id = -1, 381 + .num_resources = 0, 382 + }; 383 + 384 + void __init at91_add_device_rtc(void) 385 + { 386 + platform_device_register(&at91rm9200_rtc_device); 387 + } 388 + #else 389 + void __init at91_add_device_rtc(void) {} 390 + #endif 391 + 311 392 312 393 /* -------------------------------------------------------------------- 313 394 * LEDs
+19
include/asm-arm/arch-at91rm9200/board.h
··· 38 38 extern int at91_serial_map[AT91_NR_UART]; 39 39 extern int at91_console_port; 40 40 41 + #include <linux/mtd/partitions.h> 42 + 41 43 /* USB Device */ 42 44 struct at91_udc_data { 43 45 u8 vbus_pin; /* high == host powering us */ ··· 78 76 u8 ports; /* number of ports on root hub */ 79 77 }; 80 78 extern void __init at91_add_device_usbh(struct at91_usbh_data *data); 79 + 80 + /* NAND / SmartMedia */ 81 + struct at91_nand_data { 82 + u8 enable_pin; /* chip enable */ 83 + u8 det_pin; /* card detect */ 84 + u8 rdy_pin; /* ready/busy */ 85 + u8 ale; /* address line number connected to ALE */ 86 + u8 cle; /* address line number connected to CLE */ 87 + struct mtd_partition* (*partition_info)(int, int*); 88 + }; 89 + extern void __init at91_add_device_nand(struct at91_nand_data *data); 90 + 91 + /* I2C*/ 92 + void __init at91_add_device_i2c(void); 93 + 94 + /* RTC */ 95 + void __init at91_add_device_rtc(void); 81 96 82 97 /* LEDs */ 83 98 extern u8 at91_leds_cpu;