diff options
Diffstat (limited to 'arch/arm/mach-davinci/board-da850-evm.c')
-rw-r--r-- | arch/arm/mach-davinci/board-da850-evm.c | 123 |
1 files changed, 119 insertions, 4 deletions
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c index 008d51407cd7..6b22b543a83f 100644 --- a/arch/arm/mach-davinci/board-da850-evm.c +++ b/arch/arm/mach-davinci/board-da850-evm.c | |||
@@ -31,6 +31,8 @@ | |||
31 | #include <linux/input/tps6507x-ts.h> | 31 | #include <linux/input/tps6507x-ts.h> |
32 | #include <linux/spi/spi.h> | 32 | #include <linux/spi/spi.h> |
33 | #include <linux/spi/flash.h> | 33 | #include <linux/spi/flash.h> |
34 | #include <linux/delay.h> | ||
35 | #include <linux/wl12xx.h> | ||
34 | 36 | ||
35 | #include <asm/mach-types.h> | 37 | #include <asm/mach-types.h> |
36 | #include <asm/mach/arch.h> | 38 | #include <asm/mach/arch.h> |
@@ -49,6 +51,9 @@ | |||
49 | #define DA850_MMCSD_CD_PIN GPIO_TO_PIN(4, 0) | 51 | #define DA850_MMCSD_CD_PIN GPIO_TO_PIN(4, 0) |
50 | #define DA850_MMCSD_WP_PIN GPIO_TO_PIN(4, 1) | 52 | #define DA850_MMCSD_WP_PIN GPIO_TO_PIN(4, 1) |
51 | 53 | ||
54 | #define DA850_WLAN_EN GPIO_TO_PIN(6, 9) | ||
55 | #define DA850_WLAN_IRQ GPIO_TO_PIN(6, 10) | ||
56 | |||
52 | #define DA850_MII_MDIO_CLKEN_PIN GPIO_TO_PIN(2, 6) | 57 | #define DA850_MII_MDIO_CLKEN_PIN GPIO_TO_PIN(2, 6) |
53 | 58 | ||
54 | static struct mtd_partition da850evm_spiflash_part[] = { | 59 | static struct mtd_partition da850evm_spiflash_part[] = { |
@@ -122,7 +127,7 @@ static void da850_evm_m25p80_notify_add(struct mtd_info *mtd) | |||
122 | size_t retlen; | 127 | size_t retlen; |
123 | 128 | ||
124 | if (!strcmp(mtd->name, "MAC-Address")) { | 129 | if (!strcmp(mtd->name, "MAC-Address")) { |
125 | mtd->read(mtd, 0, ETH_ALEN, &retlen, mac_addr); | 130 | mtd_read(mtd, 0, ETH_ALEN, &retlen, mac_addr); |
126 | if (retlen == ETH_ALEN) | 131 | if (retlen == ETH_ALEN) |
127 | pr_info("Read MAC addr from SPI Flash: %pM\n", | 132 | pr_info("Read MAC addr from SPI Flash: %pM\n", |
128 | mac_addr); | 133 | mac_addr); |
@@ -251,7 +256,7 @@ static struct davinci_nand_pdata da850_evm_nandflash_data = { | |||
251 | .nr_parts = ARRAY_SIZE(da850_evm_nandflash_partition), | 256 | .nr_parts = ARRAY_SIZE(da850_evm_nandflash_partition), |
252 | .ecc_mode = NAND_ECC_HW, | 257 | .ecc_mode = NAND_ECC_HW, |
253 | .ecc_bits = 4, | 258 | .ecc_bits = 4, |
254 | .options = NAND_USE_FLASH_BBT, | 259 | .bbt_options = NAND_BBT_USE_FLASH, |
255 | .timing = &da850_evm_nandflash_timing, | 260 | .timing = &da850_evm_nandflash_timing, |
256 | }; | 261 | }; |
257 | 262 | ||
@@ -748,7 +753,7 @@ static struct snd_platform_data da850_evm_snd_data = { | |||
748 | .num_serializer = ARRAY_SIZE(da850_iis_serializer_direction), | 753 | .num_serializer = ARRAY_SIZE(da850_iis_serializer_direction), |
749 | .tdm_slots = 2, | 754 | .tdm_slots = 2, |
750 | .serial_dir = da850_iis_serializer_direction, | 755 | .serial_dir = da850_iis_serializer_direction, |
751 | .asp_chan_q = EVENTQ_1, | 756 | .asp_chan_q = EVENTQ_0, |
752 | .version = MCASP_VERSION_2, | 757 | .version = MCASP_VERSION_2, |
753 | .txnumevt = 1, | 758 | .txnumevt = 1, |
754 | .rxnumevt = 1, | 759 | .rxnumevt = 1, |
@@ -1143,6 +1148,110 @@ static __init int da850_evm_init_cpufreq(void) | |||
1143 | static __init int da850_evm_init_cpufreq(void) { return 0; } | 1148 | static __init int da850_evm_init_cpufreq(void) { return 0; } |
1144 | #endif | 1149 | #endif |
1145 | 1150 | ||
1151 | #ifdef CONFIG_DA850_WL12XX | ||
1152 | |||
1153 | static void wl12xx_set_power(int index, bool power_on) | ||
1154 | { | ||
1155 | static bool power_state; | ||
1156 | |||
1157 | pr_debug("Powering %s wl12xx", power_on ? "on" : "off"); | ||
1158 | |||
1159 | if (power_on == power_state) | ||
1160 | return; | ||
1161 | power_state = power_on; | ||
1162 | |||
1163 | if (power_on) { | ||
1164 | /* Power up sequence required for wl127x devices */ | ||
1165 | gpio_set_value(DA850_WLAN_EN, 1); | ||
1166 | usleep_range(15000, 15000); | ||
1167 | gpio_set_value(DA850_WLAN_EN, 0); | ||
1168 | usleep_range(1000, 1000); | ||
1169 | gpio_set_value(DA850_WLAN_EN, 1); | ||
1170 | msleep(70); | ||
1171 | } else { | ||
1172 | gpio_set_value(DA850_WLAN_EN, 0); | ||
1173 | } | ||
1174 | } | ||
1175 | |||
1176 | static struct davinci_mmc_config da850_wl12xx_mmc_config = { | ||
1177 | .set_power = wl12xx_set_power, | ||
1178 | .wires = 4, | ||
1179 | .max_freq = 25000000, | ||
1180 | .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_NONREMOVABLE | | ||
1181 | MMC_CAP_POWER_OFF_CARD, | ||
1182 | .version = MMC_CTLR_VERSION_2, | ||
1183 | }; | ||
1184 | |||
1185 | static const short da850_wl12xx_pins[] __initconst = { | ||
1186 | DA850_MMCSD1_DAT_0, DA850_MMCSD1_DAT_1, DA850_MMCSD1_DAT_2, | ||
1187 | DA850_MMCSD1_DAT_3, DA850_MMCSD1_CLK, DA850_MMCSD1_CMD, | ||
1188 | DA850_GPIO6_9, DA850_GPIO6_10, | ||
1189 | -1 | ||
1190 | }; | ||
1191 | |||
1192 | static struct wl12xx_platform_data da850_wl12xx_wlan_data __initdata = { | ||
1193 | .irq = -1, | ||
1194 | .board_ref_clock = WL12XX_REFCLOCK_38, | ||
1195 | .platform_quirks = WL12XX_PLATFORM_QUIRK_EDGE_IRQ, | ||
1196 | }; | ||
1197 | |||
1198 | static __init int da850_wl12xx_init(void) | ||
1199 | { | ||
1200 | int ret; | ||
1201 | |||
1202 | ret = davinci_cfg_reg_list(da850_wl12xx_pins); | ||
1203 | if (ret) { | ||
1204 | pr_err("wl12xx/mmc mux setup failed: %d\n", ret); | ||
1205 | goto exit; | ||
1206 | } | ||
1207 | |||
1208 | ret = da850_register_mmcsd1(&da850_wl12xx_mmc_config); | ||
1209 | if (ret) { | ||
1210 | pr_err("wl12xx/mmc registration failed: %d\n", ret); | ||
1211 | goto exit; | ||
1212 | } | ||
1213 | |||
1214 | ret = gpio_request_one(DA850_WLAN_EN, GPIOF_OUT_INIT_LOW, "wl12xx_en"); | ||
1215 | if (ret) { | ||
1216 | pr_err("Could not request wl12xx enable gpio: %d\n", ret); | ||
1217 | goto exit; | ||
1218 | } | ||
1219 | |||
1220 | ret = gpio_request_one(DA850_WLAN_IRQ, GPIOF_IN, "wl12xx_irq"); | ||
1221 | if (ret) { | ||
1222 | pr_err("Could not request wl12xx irq gpio: %d\n", ret); | ||
1223 | goto free_wlan_en; | ||
1224 | } | ||
1225 | |||
1226 | da850_wl12xx_wlan_data.irq = gpio_to_irq(DA850_WLAN_IRQ); | ||
1227 | |||
1228 | ret = wl12xx_set_platform_data(&da850_wl12xx_wlan_data); | ||
1229 | if (ret) { | ||
1230 | pr_err("Could not set wl12xx data: %d\n", ret); | ||
1231 | goto free_wlan_irq; | ||
1232 | } | ||
1233 | |||
1234 | return 0; | ||
1235 | |||
1236 | free_wlan_irq: | ||
1237 | gpio_free(DA850_WLAN_IRQ); | ||
1238 | |||
1239 | free_wlan_en: | ||
1240 | gpio_free(DA850_WLAN_EN); | ||
1241 | |||
1242 | exit: | ||
1243 | return ret; | ||
1244 | } | ||
1245 | |||
1246 | #else /* CONFIG_DA850_WL12XX */ | ||
1247 | |||
1248 | static __init int da850_wl12xx_init(void) | ||
1249 | { | ||
1250 | return 0; | ||
1251 | } | ||
1252 | |||
1253 | #endif /* CONFIG_DA850_WL12XX */ | ||
1254 | |||
1146 | #define DA850EVM_SATA_REFCLKPN_RATE (100 * 1000 * 1000) | 1255 | #define DA850EVM_SATA_REFCLKPN_RATE (100 * 1000 * 1000) |
1147 | 1256 | ||
1148 | static __init void da850_evm_init(void) | 1257 | static __init void da850_evm_init(void) |
@@ -1197,6 +1306,11 @@ static __init void da850_evm_init(void) | |||
1197 | if (ret) | 1306 | if (ret) |
1198 | pr_warning("da850_evm_init: mmcsd0 registration failed:" | 1307 | pr_warning("da850_evm_init: mmcsd0 registration failed:" |
1199 | " %d\n", ret); | 1308 | " %d\n", ret); |
1309 | |||
1310 | ret = da850_wl12xx_init(); | ||
1311 | if (ret) | ||
1312 | pr_warning("da850_evm_init: wl12xx initialization" | ||
1313 | " failed: %d\n", ret); | ||
1200 | } | 1314 | } |
1201 | 1315 | ||
1202 | davinci_serial_init(&da850_evm_uart_config); | 1316 | davinci_serial_init(&da850_evm_uart_config); |
@@ -1291,10 +1405,11 @@ static void __init da850_evm_map_io(void) | |||
1291 | } | 1405 | } |
1292 | 1406 | ||
1293 | MACHINE_START(DAVINCI_DA850_EVM, "DaVinci DA850/OMAP-L138/AM18x EVM") | 1407 | MACHINE_START(DAVINCI_DA850_EVM, "DaVinci DA850/OMAP-L138/AM18x EVM") |
1294 | .boot_params = (DA8XX_DDR_BASE + 0x100), | 1408 | .atag_offset = 0x100, |
1295 | .map_io = da850_evm_map_io, | 1409 | .map_io = da850_evm_map_io, |
1296 | .init_irq = cp_intc_init, | 1410 | .init_irq = cp_intc_init, |
1297 | .timer = &davinci_timer, | 1411 | .timer = &davinci_timer, |
1298 | .init_machine = da850_evm_init, | 1412 | .init_machine = da850_evm_init, |
1299 | .dma_zone_size = SZ_128M, | 1413 | .dma_zone_size = SZ_128M, |
1414 | .restart = da8xx_restart, | ||
1300 | MACHINE_END | 1415 | MACHINE_END |