Tim Nordell | d40f3f1 | 2010-09-27 16:05:47 +0000 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/mach-omap2/board-omap3logic.c |
| 3 | * |
| 4 | * Copyright (C) 2010 Li-Pro.Net |
| 5 | * Stephan Linz <linz@li-pro.net> |
| 6 | * |
Ashwin Bihari | 44bb319 | 2012-05-09 14:19:15 -0700 | [diff] [blame] | 7 | * Copyright (C) 2010-2012 Logic Product Development, Inc. |
Tim Nordell | d40f3f1 | 2010-09-27 16:05:47 +0000 | [diff] [blame] | 8 | * Peter Barada <peter.barada@logicpd.com> |
Ashwin Bihari | 44bb319 | 2012-05-09 14:19:15 -0700 | [diff] [blame] | 9 | * Ashwin BIhari <ashwin.bihari@logicpd.com> |
Tim Nordell | d40f3f1 | 2010-09-27 16:05:47 +0000 | [diff] [blame] | 10 | * |
| 11 | * Modified from Beagle, EVM, and RX51 |
| 12 | * |
| 13 | * This program is free software; you can redistribute it and/or modify |
| 14 | * it under the terms of the GNU General Public License version 2 as |
| 15 | * published by the Free Software Foundation. |
| 16 | */ |
| 17 | |
| 18 | #include <linux/kernel.h> |
| 19 | #include <linux/init.h> |
| 20 | #include <linux/platform_device.h> |
| 21 | #include <linux/delay.h> |
| 22 | #include <linux/err.h> |
| 23 | #include <linux/clk.h> |
| 24 | #include <linux/io.h> |
| 25 | #include <linux/gpio.h> |
| 26 | |
Russ Dill | 5b3689f | 2012-03-23 02:21:37 -0700 | [diff] [blame] | 27 | #include <linux/regulator/fixed.h> |
Tim Nordell | d40f3f1 | 2010-09-27 16:05:47 +0000 | [diff] [blame] | 28 | #include <linux/regulator/machine.h> |
| 29 | |
| 30 | #include <linux/i2c/twl.h> |
Tim Nordell | 8430281 | 2010-09-27 16:05:48 +0000 | [diff] [blame] | 31 | #include <linux/mmc/host.h> |
Tim Nordell | d40f3f1 | 2010-09-27 16:05:47 +0000 | [diff] [blame] | 32 | |
| 33 | #include <mach/hardware.h> |
| 34 | #include <asm/mach-types.h> |
| 35 | #include <asm/mach/arch.h> |
| 36 | #include <asm/mach/map.h> |
| 37 | |
| 38 | #include "mux.h" |
Tim Nordell | 8430281 | 2010-09-27 16:05:48 +0000 | [diff] [blame] | 39 | #include "hsmmc.h" |
Paul Walmsley | 4814ced | 2010-10-08 11:40:20 -0600 | [diff] [blame] | 40 | #include "control.h" |
Mike Rapoport | fbd8071 | 2011-04-25 01:09:06 +0300 | [diff] [blame] | 41 | #include "common-board-devices.h" |
Tim Nordell | d40f3f1 | 2010-09-27 16:05:47 +0000 | [diff] [blame] | 42 | |
| 43 | #include <plat/mux.h> |
| 44 | #include <plat/board.h> |
Tony Lindgren | 4e65331 | 2011-11-10 22:45:17 +0100 | [diff] [blame] | 45 | #include "common.h" |
Tim Nordell | 26428b5 | 2010-09-27 16:05:50 +0000 | [diff] [blame] | 46 | #include <plat/gpmc-smsc911x.h> |
Tim Nordell | d40f3f1 | 2010-09-27 16:05:47 +0000 | [diff] [blame] | 47 | #include <plat/gpmc.h> |
Tim Nordell | d40f3f1 | 2010-09-27 16:05:47 +0000 | [diff] [blame] | 48 | #include <plat/sdrc.h> |
Ashwin Bihari | 44bb319 | 2012-05-09 14:19:15 -0700 | [diff] [blame] | 49 | #include <plat/usb.h> |
Tim Nordell | d40f3f1 | 2010-09-27 16:05:47 +0000 | [diff] [blame] | 50 | |
| 51 | #define OMAP3LOGIC_SMSC911X_CS 1 |
| 52 | |
| 53 | #define OMAP3530_LV_SOM_MMC_GPIO_CD 110 |
| 54 | #define OMAP3530_LV_SOM_MMC_GPIO_WP 126 |
| 55 | #define OMAP3530_LV_SOM_SMSC911X_GPIO_IRQ 152 |
| 56 | |
| 57 | #define OMAP3_TORPEDO_MMC_GPIO_CD 127 |
| 58 | #define OMAP3_TORPEDO_SMSC911X_GPIO_IRQ 129 |
| 59 | |
Oleg Drokin | 786b01a | 2011-06-06 18:57:07 +0000 | [diff] [blame] | 60 | static struct regulator_consumer_supply omap3logic_vmmc1_supply[] = { |
| 61 | REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"), |
Tim Nordell | d40f3f1 | 2010-09-27 16:05:47 +0000 | [diff] [blame] | 62 | }; |
| 63 | |
| 64 | /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */ |
| 65 | static struct regulator_init_data omap3logic_vmmc1 = { |
| 66 | .constraints = { |
| 67 | .name = "VMMC1", |
| 68 | .min_uV = 1850000, |
| 69 | .max_uV = 3150000, |
| 70 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 71 | | REGULATOR_MODE_STANDBY, |
| 72 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
| 73 | | REGULATOR_CHANGE_MODE |
| 74 | | REGULATOR_CHANGE_STATUS, |
| 75 | }, |
Oleg Drokin | 786b01a | 2011-06-06 18:57:07 +0000 | [diff] [blame] | 76 | .num_consumer_supplies = ARRAY_SIZE(omap3logic_vmmc1_supply), |
| 77 | .consumer_supplies = omap3logic_vmmc1_supply, |
Tim Nordell | d40f3f1 | 2010-09-27 16:05:47 +0000 | [diff] [blame] | 78 | }; |
| 79 | |
| 80 | static struct twl4030_gpio_platform_data omap3logic_gpio_data = { |
| 81 | .gpio_base = OMAP_MAX_GPIO_LINES, |
| 82 | .irq_base = TWL4030_GPIO_IRQ_BASE, |
| 83 | .irq_end = TWL4030_GPIO_IRQ_END, |
| 84 | .use_leds = true, |
| 85 | .pullups = BIT(1), |
| 86 | .pulldowns = BIT(2) | BIT(6) | BIT(7) | BIT(8) |
| 87 | | BIT(13) | BIT(15) | BIT(16) | BIT(17), |
| 88 | }; |
| 89 | |
Ashwin Bihari | 44bb319 | 2012-05-09 14:19:15 -0700 | [diff] [blame] | 90 | static struct twl4030_usb_data omap3logic_usb_data = { |
| 91 | .usb_mode = T2_USB_MODE_ULPI, |
| 92 | }; |
| 93 | |
| 94 | |
Tim Nordell | d40f3f1 | 2010-09-27 16:05:47 +0000 | [diff] [blame] | 95 | static struct twl4030_platform_data omap3logic_twldata = { |
Tim Nordell | d40f3f1 | 2010-09-27 16:05:47 +0000 | [diff] [blame] | 96 | /* platform_data for children goes here */ |
| 97 | .gpio = &omap3logic_gpio_data, |
Tim Nordell | 8430281 | 2010-09-27 16:05:48 +0000 | [diff] [blame] | 98 | .vmmc1 = &omap3logic_vmmc1, |
Ashwin Bihari | 44bb319 | 2012-05-09 14:19:15 -0700 | [diff] [blame] | 99 | .usb = &omap3logic_usb_data, |
Tim Nordell | d40f3f1 | 2010-09-27 16:05:47 +0000 | [diff] [blame] | 100 | }; |
| 101 | |
Tim Nordell | d40f3f1 | 2010-09-27 16:05:47 +0000 | [diff] [blame] | 102 | static int __init omap3logic_i2c_init(void) |
| 103 | { |
Mike Rapoport | fbd8071 | 2011-04-25 01:09:06 +0300 | [diff] [blame] | 104 | omap3_pmic_init("twl4030", &omap3logic_twldata); |
Tim Nordell | d40f3f1 | 2010-09-27 16:05:47 +0000 | [diff] [blame] | 105 | return 0; |
| 106 | } |
| 107 | |
Tim Nordell | 8430281 | 2010-09-27 16:05:48 +0000 | [diff] [blame] | 108 | static struct omap2_hsmmc_info __initdata board_mmc_info[] = { |
| 109 | { |
| 110 | .name = "external", |
| 111 | .mmc = 1, |
| 112 | .caps = MMC_CAP_4_BIT_DATA, |
| 113 | .gpio_cd = -EINVAL, |
| 114 | .gpio_wp = -EINVAL, |
| 115 | }, |
| 116 | {} /* Terminator */ |
| 117 | }; |
| 118 | |
| 119 | static void __init board_mmc_init(void) |
| 120 | { |
| 121 | if (machine_is_omap3530_lv_som()) { |
| 122 | /* OMAP3530 LV SOM board */ |
| 123 | board_mmc_info[0].gpio_cd = OMAP3530_LV_SOM_MMC_GPIO_CD; |
| 124 | board_mmc_info[0].gpio_wp = OMAP3530_LV_SOM_MMC_GPIO_WP; |
| 125 | omap_mux_init_signal("gpio_110", OMAP_PIN_OUTPUT); |
| 126 | omap_mux_init_signal("gpio_126", OMAP_PIN_OUTPUT); |
| 127 | } else if (machine_is_omap3_torpedo()) { |
| 128 | /* OMAP3 Torpedo board */ |
| 129 | board_mmc_info[0].gpio_cd = OMAP3_TORPEDO_MMC_GPIO_CD; |
| 130 | omap_mux_init_signal("gpio_127", OMAP_PIN_OUTPUT); |
| 131 | } else { |
| 132 | /* unsupported board */ |
| 133 | printk(KERN_ERR "%s(): unknown machine type\n", __func__); |
| 134 | return; |
| 135 | } |
| 136 | |
Tony Lindgren | 3b972bf | 2012-02-20 09:43:29 -0800 | [diff] [blame] | 137 | omap_hsmmc_init(board_mmc_info); |
Tim Nordell | 8430281 | 2010-09-27 16:05:48 +0000 | [diff] [blame] | 138 | } |
| 139 | |
Tim Nordell | 26428b5 | 2010-09-27 16:05:50 +0000 | [diff] [blame] | 140 | static struct omap_smsc911x_platform_data __initdata board_smsc911x_data = { |
| 141 | .cs = OMAP3LOGIC_SMSC911X_CS, |
| 142 | .gpio_irq = -EINVAL, |
| 143 | .gpio_reset = -EINVAL, |
Tim Nordell | 26428b5 | 2010-09-27 16:05:50 +0000 | [diff] [blame] | 144 | }; |
| 145 | |
| 146 | /* TODO/FIXME (comment by Peter Barada, LogicPD): |
| 147 | * Fix the PBIAS voltage for Torpedo MMC1 pins that |
| 148 | * are used for other needs (IRQs, etc). */ |
| 149 | static void omap3torpedo_fix_pbias_voltage(void) |
| 150 | { |
| 151 | u16 control_pbias_offset = OMAP343X_CONTROL_PBIAS_LITE; |
| 152 | u32 reg; |
| 153 | |
| 154 | if (machine_is_omap3_torpedo()) |
| 155 | { |
| 156 | /* Set the bias for the pin */ |
| 157 | reg = omap_ctrl_readl(control_pbias_offset); |
| 158 | |
| 159 | reg &= ~OMAP343X_PBIASLITEPWRDNZ1; |
| 160 | omap_ctrl_writel(reg, control_pbias_offset); |
| 161 | |
| 162 | /* 100ms delay required for PBIAS configuration */ |
| 163 | msleep(100); |
| 164 | |
| 165 | reg |= OMAP343X_PBIASLITEVMODE1; |
| 166 | reg |= OMAP343X_PBIASLITEPWRDNZ1; |
| 167 | omap_ctrl_writel(reg | 0x300, control_pbias_offset); |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | static inline void __init board_smsc911x_init(void) |
| 172 | { |
| 173 | if (machine_is_omap3530_lv_som()) { |
| 174 | /* OMAP3530 LV SOM board */ |
| 175 | board_smsc911x_data.gpio_irq = |
| 176 | OMAP3530_LV_SOM_SMSC911X_GPIO_IRQ; |
| 177 | omap_mux_init_signal("gpio_152", OMAP_PIN_INPUT); |
| 178 | } else if (machine_is_omap3_torpedo()) { |
| 179 | /* OMAP3 Torpedo board */ |
| 180 | board_smsc911x_data.gpio_irq = OMAP3_TORPEDO_SMSC911X_GPIO_IRQ; |
| 181 | omap_mux_init_signal("gpio_129", OMAP_PIN_INPUT); |
| 182 | } else { |
| 183 | /* unsupported board */ |
| 184 | printk(KERN_ERR "%s(): unknown machine type\n", __func__); |
| 185 | return; |
| 186 | } |
| 187 | |
| 188 | gpmc_smsc911x_init(&board_smsc911x_data); |
| 189 | } |
| 190 | |
Tim Nordell | 26428b5 | 2010-09-27 16:05:50 +0000 | [diff] [blame] | 191 | #ifdef CONFIG_OMAP_MUX |
| 192 | static struct omap_board_mux board_mux[] __initdata = { |
Ashwin Bihari | 44bb319 | 2012-05-09 14:19:15 -0700 | [diff] [blame] | 193 | /* mUSB */ |
| 194 | OMAP3_MUX(HSUSB0_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), |
| 195 | OMAP3_MUX(HSUSB0_STP, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), |
| 196 | OMAP3_MUX(HSUSB0_DIR, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), |
| 197 | OMAP3_MUX(HSUSB0_NXT, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), |
| 198 | OMAP3_MUX(HSUSB0_DATA0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), |
| 199 | OMAP3_MUX(HSUSB0_DATA1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), |
| 200 | OMAP3_MUX(HSUSB0_DATA2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), |
| 201 | OMAP3_MUX(HSUSB0_DATA3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), |
| 202 | OMAP3_MUX(HSUSB0_DATA4, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), |
| 203 | OMAP3_MUX(HSUSB0_DATA5, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), |
| 204 | OMAP3_MUX(HSUSB0_DATA6, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), |
| 205 | OMAP3_MUX(HSUSB0_DATA7, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), |
| 206 | |
Tim Nordell | 26428b5 | 2010-09-27 16:05:50 +0000 | [diff] [blame] | 207 | { .reg_offset = OMAP_MUX_TERMINATOR }, |
| 208 | }; |
Tim Nordell | 26428b5 | 2010-09-27 16:05:50 +0000 | [diff] [blame] | 209 | #endif |
| 210 | |
Russ Dill | 5b3689f | 2012-03-23 02:21:37 -0700 | [diff] [blame] | 211 | static struct regulator_consumer_supply dummy_supplies[] = { |
| 212 | REGULATOR_SUPPLY("vddvario", "smsc911x.0"), |
| 213 | REGULATOR_SUPPLY("vdd33a", "smsc911x.0"), |
| 214 | }; |
| 215 | |
Tim Nordell | d40f3f1 | 2010-09-27 16:05:47 +0000 | [diff] [blame] | 216 | static void __init omap3logic_init(void) |
| 217 | { |
Russ Dill | 5b3689f | 2012-03-23 02:21:37 -0700 | [diff] [blame] | 218 | regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies)); |
Tim Nordell | 26428b5 | 2010-09-27 16:05:50 +0000 | [diff] [blame] | 219 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); |
| 220 | omap3torpedo_fix_pbias_voltage(); |
Tim Nordell | d40f3f1 | 2010-09-27 16:05:47 +0000 | [diff] [blame] | 221 | omap3logic_i2c_init(); |
| 222 | omap_serial_init(); |
Tony Lindgren | a4ca9db | 2011-08-22 23:57:23 -0700 | [diff] [blame] | 223 | omap_sdrc_init(NULL, NULL); |
Tim Nordell | 8430281 | 2010-09-27 16:05:48 +0000 | [diff] [blame] | 224 | board_mmc_init(); |
Tim Nordell | 26428b5 | 2010-09-27 16:05:50 +0000 | [diff] [blame] | 225 | board_smsc911x_init(); |
| 226 | |
Ashwin Bihari | 44bb319 | 2012-05-09 14:19:15 -0700 | [diff] [blame] | 227 | usb_musb_init(NULL); |
| 228 | |
Tim Nordell | d40f3f1 | 2010-09-27 16:05:47 +0000 | [diff] [blame] | 229 | /* Ensure SDRC pins are mux'd for self-refresh */ |
| 230 | omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); |
| 231 | omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT); |
| 232 | } |
| 233 | |
| 234 | MACHINE_START(OMAP3_TORPEDO, "Logic OMAP3 Torpedo board") |
Nicolas Pitre | 5e52b43 | 2011-07-05 22:38:15 -0400 | [diff] [blame] | 235 | .atag_offset = 0x100, |
Alex | afbb189 | 2012-03-05 11:08:35 -0800 | [diff] [blame] | 236 | .reserve = omap_reserve, |
Tim Nordell | d40f3f1 | 2010-09-27 16:05:47 +0000 | [diff] [blame] | 237 | .map_io = omap3_map_io, |
Tony Lindgren | 8f5b5a4 | 2011-08-22 23:57:24 -0700 | [diff] [blame] | 238 | .init_early = omap35xx_init_early, |
Tony Lindgren | 741e3a8 | 2011-05-17 03:51:26 -0700 | [diff] [blame] | 239 | .init_irq = omap3_init_irq, |
Marc Zyngier | 6b2f55d | 2011-09-06 10:23:45 +0100 | [diff] [blame] | 240 | .handle_irq = omap3_intc_handle_irq, |
Tim Nordell | d40f3f1 | 2010-09-27 16:05:47 +0000 | [diff] [blame] | 241 | .init_machine = omap3logic_init, |
Shawn Guo | bbd707a | 2012-04-26 16:06:50 +0800 | [diff] [blame] | 242 | .init_late = omap35xx_init_late, |
Tony Lindgren | e74984e | 2011-03-29 15:54:48 -0700 | [diff] [blame] | 243 | .timer = &omap3_timer, |
Russell King | baa9588 | 2011-11-05 17:06:28 +0000 | [diff] [blame] | 244 | .restart = omap_prcm_restart, |
Tim Nordell | d40f3f1 | 2010-09-27 16:05:47 +0000 | [diff] [blame] | 245 | MACHINE_END |
| 246 | |
| 247 | MACHINE_START(OMAP3530_LV_SOM, "OMAP Logic 3530 LV SOM board") |
Nicolas Pitre | 5e52b43 | 2011-07-05 22:38:15 -0400 | [diff] [blame] | 248 | .atag_offset = 0x100, |
Alex | afbb189 | 2012-03-05 11:08:35 -0800 | [diff] [blame] | 249 | .reserve = omap_reserve, |
Tim Nordell | d40f3f1 | 2010-09-27 16:05:47 +0000 | [diff] [blame] | 250 | .map_io = omap3_map_io, |
Tony Lindgren | 8f5b5a4 | 2011-08-22 23:57:24 -0700 | [diff] [blame] | 251 | .init_early = omap35xx_init_early, |
Tony Lindgren | 741e3a8 | 2011-05-17 03:51:26 -0700 | [diff] [blame] | 252 | .init_irq = omap3_init_irq, |
Marc Zyngier | 6b2f55d | 2011-09-06 10:23:45 +0100 | [diff] [blame] | 253 | .handle_irq = omap3_intc_handle_irq, |
Tim Nordell | d40f3f1 | 2010-09-27 16:05:47 +0000 | [diff] [blame] | 254 | .init_machine = omap3logic_init, |
Shawn Guo | bbd707a | 2012-04-26 16:06:50 +0800 | [diff] [blame] | 255 | .init_late = omap35xx_init_late, |
Tony Lindgren | e74984e | 2011-03-29 15:54:48 -0700 | [diff] [blame] | 256 | .timer = &omap3_timer, |
Russell King | baa9588 | 2011-11-05 17:06:28 +0000 | [diff] [blame] | 257 | .restart = omap_prcm_restart, |
Tim Nordell | d40f3f1 | 2010-09-27 16:05:47 +0000 | [diff] [blame] | 258 | MACHINE_END |