diff options
Diffstat (limited to 'arch/arm/mach-omap2/board-rx51-peripherals.c')
| -rw-r--r-- | arch/arm/mach-omap2/board-rx51-peripherals.c | 232 |
1 files changed, 113 insertions, 119 deletions
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c index a7381729645c..da93b86234ed 100644 --- a/arch/arm/mach-omap2/board-rx51-peripherals.c +++ b/arch/arm/mach-omap2/board-rx51-peripherals.c | |||
| @@ -27,30 +27,13 @@ | |||
| 27 | #include <mach/dma.h> | 27 | #include <mach/dma.h> |
| 28 | #include <mach/gpmc.h> | 28 | #include <mach/gpmc.h> |
| 29 | #include <mach/keypad.h> | 29 | #include <mach/keypad.h> |
| 30 | #include <mach/onenand.h> | ||
| 31 | #include <mach/gpmc-smc91x.h> | ||
| 30 | 32 | ||
| 31 | #include "mmc-twl4030.h" | 33 | #include "mmc-twl4030.h" |
| 32 | 34 | ||
| 33 | 35 | #define SYSTEM_REV_B_USES_VAUX3 0x1699 | |
| 34 | #define SMC91X_CS 1 | 36 | #define SYSTEM_REV_S_USES_VAUX3 0x8 |
| 35 | #define SMC91X_GPIO_IRQ 54 | ||
| 36 | #define SMC91X_GPIO_RESET 164 | ||
| 37 | #define SMC91X_GPIO_PWRDWN 86 | ||
| 38 | |||
| 39 | static struct resource rx51_smc91x_resources[] = { | ||
| 40 | [0] = { | ||
| 41 | .flags = IORESOURCE_MEM, | ||
| 42 | }, | ||
| 43 | [1] = { | ||
| 44 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, | ||
| 45 | }, | ||
| 46 | }; | ||
| 47 | |||
| 48 | static struct platform_device rx51_smc91x_device = { | ||
| 49 | .name = "smc91x", | ||
| 50 | .id = -1, | ||
| 51 | .num_resources = ARRAY_SIZE(rx51_smc91x_resources), | ||
| 52 | .resource = rx51_smc91x_resources, | ||
| 53 | }; | ||
| 54 | 37 | ||
| 55 | static int rx51_keymap[] = { | 38 | static int rx51_keymap[] = { |
| 56 | KEY(0, 0, KEY_Q), | 39 | KEY(0, 0, KEY_Q), |
| @@ -107,98 +90,6 @@ static struct twl4030_keypad_data rx51_kp_data = { | |||
| 107 | .rep = 1, | 90 | .rep = 1, |
| 108 | }; | 91 | }; |
| 109 | 92 | ||
| 110 | static struct platform_device *rx51_peripherals_devices[] = { | ||
| 111 | &rx51_smc91x_device, | ||
| 112 | }; | ||
| 113 | |||
| 114 | /* | ||
| 115 | * Timings are taken from smsc-lan91c96-ms.pdf | ||
| 116 | */ | ||
| 117 | static int smc91x_init_gpmc(int cs) | ||
| 118 | { | ||
| 119 | struct gpmc_timings t; | ||
| 120 | const int t2_r = 45; /* t2 in Figure 12.10 */ | ||
| 121 | const int t2_w = 30; /* t2 in Figure 12.11 */ | ||
| 122 | const int t3 = 15; /* t3 in Figure 12.10 */ | ||
| 123 | const int t5_r = 0; /* t5 in Figure 12.10 */ | ||
| 124 | const int t6_r = 45; /* t6 in Figure 12.10 */ | ||
| 125 | const int t6_w = 0; /* t6 in Figure 12.11 */ | ||
| 126 | const int t7_w = 15; /* t7 in Figure 12.11 */ | ||
| 127 | const int t15 = 12; /* t15 in Figure 12.2 */ | ||
| 128 | const int t20 = 185; /* t20 in Figure 12.2 */ | ||
| 129 | |||
| 130 | memset(&t, 0, sizeof(t)); | ||
| 131 | |||
| 132 | t.cs_on = t15; | ||
| 133 | t.cs_rd_off = t3 + t2_r + t5_r; /* Figure 12.10 */ | ||
| 134 | t.cs_wr_off = t3 + t2_w + t6_w; /* Figure 12.11 */ | ||
| 135 | t.adv_on = t3; /* Figure 12.10 */ | ||
| 136 | t.adv_rd_off = t3 + t2_r; /* Figure 12.10 */ | ||
| 137 | t.adv_wr_off = t3 + t2_w; /* Figure 12.11 */ | ||
| 138 | t.oe_off = t3 + t2_r + t5_r; /* Figure 12.10 */ | ||
| 139 | t.oe_on = t.oe_off - t6_r; /* Figure 12.10 */ | ||
| 140 | t.we_off = t3 + t2_w + t6_w; /* Figure 12.11 */ | ||
| 141 | t.we_on = t.we_off - t7_w; /* Figure 12.11 */ | ||
| 142 | t.rd_cycle = t20; /* Figure 12.2 */ | ||
| 143 | t.wr_cycle = t20; /* Figure 12.4 */ | ||
| 144 | t.access = t3 + t2_r + t5_r; /* Figure 12.10 */ | ||
| 145 | t.wr_access = t3 + t2_w + t6_w; /* Figure 12.11 */ | ||
| 146 | |||
| 147 | gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, GPMC_CONFIG1_DEVICESIZE_16); | ||
| 148 | |||
| 149 | return gpmc_cs_set_timings(cs, &t); | ||
| 150 | } | ||
| 151 | |||
| 152 | static void __init rx51_init_smc91x(void) | ||
| 153 | { | ||
| 154 | unsigned long cs_mem_base; | ||
| 155 | int ret; | ||
| 156 | |||
| 157 | omap_cfg_reg(U8_34XX_GPIO54_DOWN); | ||
| 158 | omap_cfg_reg(G25_34XX_GPIO86_OUT); | ||
| 159 | omap_cfg_reg(H19_34XX_GPIO164_OUT); | ||
| 160 | |||
| 161 | if (gpmc_cs_request(SMC91X_CS, SZ_16M, &cs_mem_base) < 0) { | ||
| 162 | printk(KERN_ERR "Failed to request GPMC mem for smc91x\n"); | ||
| 163 | return; | ||
| 164 | } | ||
| 165 | |||
| 166 | rx51_smc91x_resources[0].start = cs_mem_base + 0x300; | ||
| 167 | rx51_smc91x_resources[0].end = cs_mem_base + 0x30f; | ||
| 168 | |||
| 169 | smc91x_init_gpmc(SMC91X_CS); | ||
| 170 | |||
| 171 | if (gpio_request(SMC91X_GPIO_IRQ, "SMC91X irq") < 0) | ||
| 172 | goto free1; | ||
| 173 | |||
| 174 | gpio_direction_input(SMC91X_GPIO_IRQ); | ||
| 175 | rx51_smc91x_resources[1].start = gpio_to_irq(SMC91X_GPIO_IRQ); | ||
| 176 | |||
| 177 | ret = gpio_request(SMC91X_GPIO_PWRDWN, "SMC91X powerdown"); | ||
| 178 | if (ret) | ||
| 179 | goto free2; | ||
| 180 | gpio_direction_output(SMC91X_GPIO_PWRDWN, 0); | ||
| 181 | |||
| 182 | ret = gpio_request(SMC91X_GPIO_RESET, "SMC91X reset"); | ||
| 183 | if (ret) | ||
| 184 | goto free3; | ||
| 185 | gpio_direction_output(SMC91X_GPIO_RESET, 0); | ||
| 186 | gpio_set_value(SMC91X_GPIO_RESET, 1); | ||
| 187 | msleep(100); | ||
| 188 | gpio_set_value(SMC91X_GPIO_RESET, 0); | ||
| 189 | |||
| 190 | return; | ||
| 191 | |||
| 192 | free3: | ||
| 193 | gpio_free(SMC91X_GPIO_PWRDWN); | ||
| 194 | free2: | ||
| 195 | gpio_free(SMC91X_GPIO_IRQ); | ||
| 196 | free1: | ||
| 197 | gpmc_cs_free(SMC91X_CS); | ||
| 198 | |||
| 199 | printk(KERN_ERR "Could not initialize smc91x\n"); | ||
| 200 | } | ||
| 201 | |||
| 202 | static struct twl4030_madc_platform_data rx51_madc_data = { | 93 | static struct twl4030_madc_platform_data rx51_madc_data = { |
| 203 | .irq_line = 1, | 94 | .irq_line = 1, |
| 204 | }; | 95 | }; |
| @@ -259,7 +150,7 @@ static struct regulator_init_data rx51_vaux2 = { | |||
| 259 | }; | 150 | }; |
| 260 | 151 | ||
| 261 | /* VAUX3 - adds more power to VIO_18 rail */ | 152 | /* VAUX3 - adds more power to VIO_18 rail */ |
| 262 | static struct regulator_init_data rx51_vaux3 = { | 153 | static struct regulator_init_data rx51_vaux3_cam = { |
| 263 | .constraints = { | 154 | .constraints = { |
| 264 | .name = "VCAM_DIG_18", | 155 | .name = "VCAM_DIG_18", |
| 265 | .min_uV = 1800000, | 156 | .min_uV = 1800000, |
| @@ -272,6 +163,22 @@ static struct regulator_init_data rx51_vaux3 = { | |||
| 272 | }, | 163 | }, |
| 273 | }; | 164 | }; |
| 274 | 165 | ||
| 166 | static struct regulator_init_data rx51_vaux3_mmc = { | ||
| 167 | .constraints = { | ||
| 168 | .name = "VMMC2_30", | ||
| 169 | .min_uV = 2800000, | ||
| 170 | .max_uV = 3000000, | ||
| 171 | .apply_uV = true, | ||
| 172 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
| 173 | | REGULATOR_MODE_STANDBY, | ||
| 174 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | ||
| 175 | | REGULATOR_CHANGE_MODE | ||
| 176 | | REGULATOR_CHANGE_STATUS, | ||
| 177 | }, | ||
| 178 | .num_consumer_supplies = 1, | ||
| 179 | .consumer_supplies = &rx51_vmmc2_supply, | ||
| 180 | }; | ||
| 181 | |||
| 275 | static struct regulator_init_data rx51_vaux4 = { | 182 | static struct regulator_init_data rx51_vaux4 = { |
| 276 | .constraints = { | 183 | .constraints = { |
| 277 | .name = "VCAM_ANA_28", | 184 | .name = "VCAM_ANA_28", |
| @@ -382,10 +289,8 @@ static struct twl4030_platform_data rx51_twldata = { | |||
| 382 | 289 | ||
| 383 | .vaux1 = &rx51_vaux1, | 290 | .vaux1 = &rx51_vaux1, |
| 384 | .vaux2 = &rx51_vaux2, | 291 | .vaux2 = &rx51_vaux2, |
| 385 | .vaux3 = &rx51_vaux3, | ||
| 386 | .vaux4 = &rx51_vaux4, | 292 | .vaux4 = &rx51_vaux4, |
| 387 | .vmmc1 = &rx51_vmmc1, | 293 | .vmmc1 = &rx51_vmmc1, |
| 388 | .vmmc2 = &rx51_vmmc2, | ||
| 389 | .vsim = &rx51_vsim, | 294 | .vsim = &rx51_vsim, |
| 390 | .vdac = &rx51_vdac, | 295 | .vdac = &rx51_vdac, |
| 391 | }; | 296 | }; |
| @@ -401,6 +306,13 @@ static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_1[] = { | |||
| 401 | 306 | ||
| 402 | static int __init rx51_i2c_init(void) | 307 | static int __init rx51_i2c_init(void) |
| 403 | { | 308 | { |
| 309 | if ((system_rev >= SYSTEM_REV_S_USES_VAUX3 && system_rev < 0x100) || | ||
| 310 | system_rev >= SYSTEM_REV_B_USES_VAUX3) | ||
| 311 | rx51_twldata.vaux3 = &rx51_vaux3_mmc; | ||
| 312 | else { | ||
| 313 | rx51_twldata.vaux3 = &rx51_vaux3_cam; | ||
| 314 | rx51_twldata.vmmc2 = &rx51_vmmc2; | ||
| 315 | } | ||
| 404 | omap_register_i2c_bus(1, 2600, rx51_peripherals_i2c_board_info_1, | 316 | omap_register_i2c_bus(1, 2600, rx51_peripherals_i2c_board_info_1, |
| 405 | ARRAY_SIZE(rx51_peripherals_i2c_board_info_1)); | 317 | ARRAY_SIZE(rx51_peripherals_i2c_board_info_1)); |
| 406 | omap_register_i2c_bus(2, 100, NULL, 0); | 318 | omap_register_i2c_bus(2, 100, NULL, 0); |
| @@ -408,12 +320,94 @@ static int __init rx51_i2c_init(void) | |||
| 408 | return 0; | 320 | return 0; |
| 409 | } | 321 | } |
| 410 | 322 | ||
| 323 | #if defined(CONFIG_MTD_ONENAND_OMAP2) || \ | ||
| 324 | defined(CONFIG_MTD_ONENAND_OMAP2_MODULE) | ||
| 325 | |||
| 326 | static struct mtd_partition onenand_partitions[] = { | ||
| 327 | { | ||
| 328 | .name = "bootloader", | ||
| 329 | .offset = 0, | ||
| 330 | .size = 0x20000, | ||
| 331 | .mask_flags = MTD_WRITEABLE, /* Force read-only */ | ||
| 332 | }, | ||
| 333 | { | ||
| 334 | .name = "config", | ||
| 335 | .offset = MTDPART_OFS_APPEND, | ||
| 336 | .size = 0x60000, | ||
| 337 | }, | ||
| 338 | { | ||
| 339 | .name = "log", | ||
| 340 | .offset = MTDPART_OFS_APPEND, | ||
| 341 | .size = 0x40000, | ||
| 342 | }, | ||
| 343 | { | ||
| 344 | .name = "kernel", | ||
| 345 | .offset = MTDPART_OFS_APPEND, | ||
| 346 | .size = 0x200000, | ||
| 347 | }, | ||
| 348 | { | ||
| 349 | .name = "initfs", | ||
| 350 | .offset = MTDPART_OFS_APPEND, | ||
| 351 | .size = 0x200000, | ||
| 352 | }, | ||
| 353 | { | ||
| 354 | .name = "rootfs", | ||
| 355 | .offset = MTDPART_OFS_APPEND, | ||
| 356 | .size = MTDPART_SIZ_FULL, | ||
| 357 | }, | ||
| 358 | }; | ||
| 359 | |||
| 360 | static struct omap_onenand_platform_data board_onenand_data = { | ||
| 361 | .cs = 0, | ||
| 362 | .gpio_irq = 65, | ||
| 363 | .parts = onenand_partitions, | ||
| 364 | .nr_parts = ARRAY_SIZE(onenand_partitions), | ||
| 365 | }; | ||
| 366 | |||
| 367 | static void __init board_onenand_init(void) | ||
| 368 | { | ||
| 369 | gpmc_onenand_init(&board_onenand_data); | ||
| 370 | } | ||
| 371 | |||
| 372 | #else | ||
| 373 | |||
| 374 | static inline void board_onenand_init(void) | ||
| 375 | { | ||
| 376 | } | ||
| 377 | |||
| 378 | #endif | ||
| 379 | |||
| 380 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) | ||
| 381 | |||
| 382 | static struct omap_smc91x_platform_data board_smc91x_data = { | ||
| 383 | .cs = 1, | ||
| 384 | .gpio_irq = 54, | ||
| 385 | .gpio_pwrdwn = 86, | ||
| 386 | .gpio_reset = 164, | ||
| 387 | .flags = GPMC_TIMINGS_SMC91C96 | IORESOURCE_IRQ_HIGHLEVEL, | ||
| 388 | }; | ||
| 389 | |||
| 390 | static void __init board_smc91x_init(void) | ||
| 391 | { | ||
| 392 | omap_cfg_reg(U8_34XX_GPIO54_DOWN); | ||
| 393 | omap_cfg_reg(G25_34XX_GPIO86_OUT); | ||
| 394 | omap_cfg_reg(H19_34XX_GPIO164_OUT); | ||
| 395 | |||
| 396 | gpmc_smc91x_init(&board_smc91x_data); | ||
| 397 | } | ||
| 398 | |||
| 399 | #else | ||
| 400 | |||
| 401 | static inline void board_smc91x_init(void) | ||
| 402 | { | ||
| 403 | } | ||
| 404 | |||
| 405 | #endif | ||
| 411 | 406 | ||
| 412 | void __init rx51_peripherals_init(void) | 407 | void __init rx51_peripherals_init(void) |
| 413 | { | 408 | { |
| 414 | platform_add_devices(rx51_peripherals_devices, | ||
| 415 | ARRAY_SIZE(rx51_peripherals_devices)); | ||
| 416 | rx51_i2c_init(); | 409 | rx51_i2c_init(); |
| 417 | rx51_init_smc91x(); | 410 | board_onenand_init(); |
| 411 | board_smc91x_init(); | ||
| 418 | } | 412 | } |
| 419 | 413 | ||
