Srinidhi Kasagar | aa44ef4 | 2009-11-28 08:17:18 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008-2009 ST-Ericsson |
| 3 | * |
| 4 | * Author: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2, as |
| 8 | * published by the Free Software Foundation. |
| 9 | * |
| 10 | */ |
| 11 | #include <linux/kernel.h> |
| 12 | #include <linux/init.h> |
| 13 | #include <linux/interrupt.h> |
| 14 | #include <linux/platform_device.h> |
| 15 | #include <linux/io.h> |
Rabin Vincent | b8410a1 | 2010-08-09 19:18:17 +0530 | [diff] [blame] | 16 | #include <linux/i2c.h> |
Rabin Vincent | ea05a57 | 2010-06-03 07:58:42 +0100 | [diff] [blame] | 17 | #include <linux/gpio.h> |
Srinidhi Kasagar | aa44ef4 | 2009-11-28 08:17:18 +0100 | [diff] [blame] | 18 | #include <linux/amba/bus.h> |
| 19 | #include <linux/amba/pl022.h> |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 20 | #include <linux/amba/serial.h> |
Srinidhi Kasagar | aa44ef4 | 2009-11-28 08:17:18 +0100 | [diff] [blame] | 21 | #include <linux/spi/spi.h> |
Rabin Vincent | 39ae702 | 2010-07-26 11:12:15 +0100 | [diff] [blame] | 22 | #include <linux/mfd/ab8500.h> |
Bengt Jonsson | 79568b9 | 2011-03-11 11:54:46 +0100 | [diff] [blame] | 23 | #include <linux/regulator/ab8500.h> |
Sundar Iyer | 20406eb | 2010-12-13 09:33:14 +0530 | [diff] [blame] | 24 | #include <linux/mfd/tc3589x.h> |
Linus Walleij | fe67dfc | 2011-03-07 11:48:15 +0100 | [diff] [blame] | 25 | #include <linux/mfd/tps6105x.h> |
Bibek Basu | 3ef374a | 2011-02-15 12:56:16 +0530 | [diff] [blame] | 26 | #include <linux/mfd/ab8500/gpio.h> |
Philippe Langlais | dd7b2a0 | 2011-01-12 11:26:20 +0100 | [diff] [blame] | 27 | #include <linux/leds-lp5521.h> |
Philippe Langlais | a71b819 | 2011-01-14 10:53:59 +0100 | [diff] [blame] | 28 | #include <linux/input.h> |
| 29 | #include <linux/gpio_keys.h> |
Srinidhi Kasagar | aa44ef4 | 2009-11-28 08:17:18 +0100 | [diff] [blame] | 30 | |
Srinidhi Kasagar | aa44ef4 | 2009-11-28 08:17:18 +0100 | [diff] [blame] | 31 | #include <asm/mach-types.h> |
| 32 | #include <asm/mach/arch.h> |
| 33 | |
Srinidhi Kasagar | d48a41c | 2010-02-03 13:02:48 +0100 | [diff] [blame] | 34 | #include <plat/i2c.h> |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 35 | #include <plat/ste_dma40.h> |
Srinidhi Kasagar | aa44ef4 | 2009-11-28 08:17:18 +0100 | [diff] [blame] | 36 | |
| 37 | #include <mach/hardware.h> |
| 38 | #include <mach/setup.h> |
Rabin Vincent | 9e4e7fe | 2010-05-03 08:03:52 +0100 | [diff] [blame] | 39 | #include <mach/devices.h> |
Linus Walleij | 29aeb3c | 2010-09-06 22:15:08 +0100 | [diff] [blame] | 40 | #include <mach/irqs.h> |
Srinidhi Kasagar | aa44ef4 | 2009-11-28 08:17:18 +0100 | [diff] [blame] | 41 | |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 42 | #include "ste-dma40-db8500.h" |
Rabin Vincent | fbf1ead | 2010-09-29 19:46:32 +0530 | [diff] [blame] | 43 | #include "devices-db8500.h" |
Hanumath Prasad | 008f8a2 | 2010-08-19 12:06:32 +0100 | [diff] [blame] | 44 | #include "board-mop500.h" |
Bengt Jonsson | a1e516e | 2010-12-10 11:08:48 +0100 | [diff] [blame] | 45 | #include "board-mop500-regulators.h" |
Rabin Vincent | ea05a57 | 2010-06-03 07:58:42 +0100 | [diff] [blame] | 46 | |
Bibek Basu | 3ef374a | 2011-02-15 12:56:16 +0530 | [diff] [blame] | 47 | static struct ab8500_gpio_platform_data ab8500_gpio_pdata = { |
| 48 | .gpio_base = MOP500_AB8500_GPIO(0), |
| 49 | .irq_base = MOP500_AB8500_VIR_GPIO_IRQ_BASE, |
| 50 | /* config_reg is the initial configuration of ab8500 pins. |
| 51 | * The pins can be configured as GPIO or alt functions based |
| 52 | * on value present in GpioSel1 to GpioSel6 and AlternatFunction |
| 53 | * register. This is the array of 7 configuration settings. |
| 54 | * One has to compile time decide these settings. Below is the |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 55 | * explanation of these setting |
Bibek Basu | 3ef374a | 2011-02-15 12:56:16 +0530 | [diff] [blame] | 56 | * GpioSel1 = 0x00 => Pins GPIO1 to GPIO8 are not used as GPIO |
| 57 | * GpioSel2 = 0x1E => Pins GPIO10 to GPIO13 are configured as GPIO |
| 58 | * GpioSel3 = 0x80 => Pin GPIO24 is configured as GPIO |
| 59 | * GpioSel4 = 0x01 => Pin GPIo25 is configured as GPIO |
| 60 | * GpioSel5 = 0x7A => Pins GPIO34, GPIO36 to GPIO39 are conf as GPIO |
| 61 | * GpioSel6 = 0x00 => Pins GPIO41 & GPIo42 are not configured as GPIO |
| 62 | * AlternaFunction = 0x00 => If Pins GPIO10 to 13 are not configured |
| 63 | * as GPIO then this register selectes the alternate fucntions |
| 64 | */ |
| 65 | .config_reg = {0x00, 0x1E, 0x80, 0x01, |
| 66 | 0x7A, 0x00, 0x00}, |
| 67 | }; |
| 68 | |
Rabin Vincent | 39ae702 | 2010-07-26 11:12:15 +0100 | [diff] [blame] | 69 | static struct ab8500_platform_data ab8500_platdata = { |
| 70 | .irq_base = MOP500_AB8500_IRQ_BASE, |
Bengt Jonsson | dfa3a82 | 2011-03-09 13:34:17 +0100 | [diff] [blame] | 71 | .regulator_reg_init = ab8500_regulator_reg_init, |
| 72 | .num_regulator_reg_init = ARRAY_SIZE(ab8500_regulator_reg_init), |
Bengt Jonsson | a1e516e | 2010-12-10 11:08:48 +0100 | [diff] [blame] | 73 | .regulator = ab8500_regulators, |
| 74 | .num_regulator = ARRAY_SIZE(ab8500_regulators), |
Bibek Basu | 3ef374a | 2011-02-15 12:56:16 +0530 | [diff] [blame] | 75 | .gpio = &ab8500_gpio_pdata, |
Rabin Vincent | 39ae702 | 2010-07-26 11:12:15 +0100 | [diff] [blame] | 76 | }; |
| 77 | |
Linus Walleij | 29aeb3c | 2010-09-06 22:15:08 +0100 | [diff] [blame] | 78 | static struct resource ab8500_resources[] = { |
| 79 | [0] = { |
Rabin Vincent | 22039b7 | 2010-12-08 11:07:56 +0530 | [diff] [blame] | 80 | .start = IRQ_DB8500_AB8500, |
| 81 | .end = IRQ_DB8500_AB8500, |
| 82 | .flags = IORESOURCE_IRQ |
Linus Walleij | 29aeb3c | 2010-09-06 22:15:08 +0100 | [diff] [blame] | 83 | } |
| 84 | }; |
| 85 | |
| 86 | struct platform_device ab8500_device = { |
| 87 | .name = "ab8500-i2c", |
| 88 | .id = 0, |
| 89 | .dev = { |
| 90 | .platform_data = &ab8500_platdata, |
| 91 | }, |
| 92 | .num_resources = 1, |
| 93 | .resource = ab8500_resources, |
| 94 | }; |
| 95 | |
Rabin Vincent | b8410a1 | 2010-08-09 19:18:17 +0530 | [diff] [blame] | 96 | /* |
Linus Walleij | fe67dfc | 2011-03-07 11:48:15 +0100 | [diff] [blame] | 97 | * TPS61052 |
| 98 | */ |
| 99 | |
| 100 | static struct tps6105x_platform_data mop500_tps61052_data = { |
| 101 | .mode = TPS6105X_MODE_VOLTAGE, |
| 102 | .regulator_data = &tps61052_regulator, |
| 103 | }; |
| 104 | |
| 105 | /* |
Rabin Vincent | b8410a1 | 2010-08-09 19:18:17 +0530 | [diff] [blame] | 106 | * TC35892 |
| 107 | */ |
| 108 | |
Sundar Iyer | 20406eb | 2010-12-13 09:33:14 +0530 | [diff] [blame] | 109 | static void mop500_tc35892_init(struct tc3589x *tc3589x, unsigned int base) |
Rabin Vincent | b8410a1 | 2010-08-09 19:18:17 +0530 | [diff] [blame] | 110 | { |
| 111 | mop500_sdi_tc35892_init(); |
| 112 | } |
| 113 | |
Sundar Iyer | 20406eb | 2010-12-13 09:33:14 +0530 | [diff] [blame] | 114 | static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = { |
Rabin Vincent | b8410a1 | 2010-08-09 19:18:17 +0530 | [diff] [blame] | 115 | .gpio_base = MOP500_EGPIO(0), |
| 116 | .setup = mop500_tc35892_init, |
| 117 | }; |
| 118 | |
Sundar Iyer | 20406eb | 2010-12-13 09:33:14 +0530 | [diff] [blame] | 119 | static struct tc3589x_platform_data mop500_tc35892_data = { |
Sundar Iyer | 611b759 | 2010-12-13 09:33:15 +0530 | [diff] [blame] | 120 | .block = TC3589x_BLOCK_GPIO, |
Rabin Vincent | b8410a1 | 2010-08-09 19:18:17 +0530 | [diff] [blame] | 121 | .gpio = &mop500_tc35892_gpio_data, |
| 122 | .irq_base = MOP500_EGPIO_IRQ_BASE, |
| 123 | }; |
| 124 | |
Philippe Langlais | dd7b2a0 | 2011-01-12 11:26:20 +0100 | [diff] [blame] | 125 | static struct lp5521_led_config lp5521_pri_led[] = { |
| 126 | [0] = { |
| 127 | .chan_nr = 0, |
| 128 | .led_current = 0x2f, |
| 129 | .max_current = 0x5f, |
| 130 | }, |
| 131 | [1] = { |
| 132 | .chan_nr = 1, |
| 133 | .led_current = 0x2f, |
| 134 | .max_current = 0x5f, |
| 135 | }, |
| 136 | [2] = { |
| 137 | .chan_nr = 2, |
| 138 | .led_current = 0x2f, |
| 139 | .max_current = 0x5f, |
| 140 | }, |
| 141 | }; |
| 142 | |
| 143 | static struct lp5521_platform_data __initdata lp5521_pri_data = { |
| 144 | .label = "lp5521_pri", |
| 145 | .led_config = &lp5521_pri_led[0], |
| 146 | .num_channels = 3, |
| 147 | .clock_mode = LP5521_CLOCK_EXT, |
| 148 | }; |
| 149 | |
| 150 | static struct lp5521_led_config lp5521_sec_led[] = { |
| 151 | [0] = { |
| 152 | .chan_nr = 0, |
| 153 | .led_current = 0x2f, |
| 154 | .max_current = 0x5f, |
| 155 | }, |
| 156 | [1] = { |
| 157 | .chan_nr = 1, |
| 158 | .led_current = 0x2f, |
| 159 | .max_current = 0x5f, |
| 160 | }, |
| 161 | [2] = { |
| 162 | .chan_nr = 2, |
| 163 | .led_current = 0x2f, |
| 164 | .max_current = 0x5f, |
| 165 | }, |
| 166 | }; |
| 167 | |
| 168 | static struct lp5521_platform_data __initdata lp5521_sec_data = { |
| 169 | .label = "lp5521_sec", |
| 170 | .led_config = &lp5521_sec_led[0], |
| 171 | .num_channels = 3, |
| 172 | .clock_mode = LP5521_CLOCK_EXT, |
| 173 | }; |
| 174 | |
Linus Walleij | fe67dfc | 2011-03-07 11:48:15 +0100 | [diff] [blame] | 175 | static struct i2c_board_info __initdata mop500_i2c0_devices[] = { |
Rabin Vincent | b8410a1 | 2010-08-09 19:18:17 +0530 | [diff] [blame] | 176 | { |
Sundar Iyer | 20406eb | 2010-12-13 09:33:14 +0530 | [diff] [blame] | 177 | I2C_BOARD_INFO("tc3589x", 0x42), |
Philippe Langlais | dd7b2a0 | 2011-01-12 11:26:20 +0100 | [diff] [blame] | 178 | .irq = NOMADIK_GPIO_TO_IRQ(217), |
Rabin Vincent | b8410a1 | 2010-08-09 19:18:17 +0530 | [diff] [blame] | 179 | .platform_data = &mop500_tc35892_data, |
| 180 | }, |
Linus Walleij | cf568c5 | 2011-03-30 14:31:42 +0200 | [diff] [blame] | 181 | /* I2C0 devices only available prior to HREFv60 */ |
Linus Walleij | fe67dfc | 2011-03-07 11:48:15 +0100 | [diff] [blame] | 182 | { |
| 183 | I2C_BOARD_INFO("tps61052", 0x33), |
| 184 | .platform_data = &mop500_tps61052_data, |
| 185 | }, |
| 186 | }; |
| 187 | |
Linus Walleij | cf568c5 | 2011-03-30 14:31:42 +0200 | [diff] [blame] | 188 | #define NUM_PRE_V60_I2C0_DEVICES 1 |
| 189 | |
Philippe Langlais | dd7b2a0 | 2011-01-12 11:26:20 +0100 | [diff] [blame] | 190 | static struct i2c_board_info __initdata mop500_i2c2_devices[] = { |
| 191 | { |
| 192 | /* lp5521 LED driver, 1st device */ |
| 193 | I2C_BOARD_INFO("lp5521", 0x33), |
| 194 | .platform_data = &lp5521_pri_data, |
| 195 | }, |
| 196 | { |
| 197 | /* lp5521 LED driver, 2st device */ |
| 198 | I2C_BOARD_INFO("lp5521", 0x34), |
| 199 | .platform_data = &lp5521_sec_data, |
| 200 | }, |
Lee Jones | bb3b218 | 2011-01-13 14:41:22 +0000 | [diff] [blame] | 201 | { |
| 202 | /* Light sensor Rohm BH1780GLI */ |
| 203 | I2C_BOARD_INFO("bh1780", 0x29), |
| 204 | }, |
Philippe Langlais | dd7b2a0 | 2011-01-12 11:26:20 +0100 | [diff] [blame] | 205 | }; |
| 206 | |
Linus Walleij | 2b030bd | 2011-05-13 12:31:13 +0200 | [diff] [blame^] | 207 | #define U8500_I2C_CONTROLLER(id, _slsu, _tft, _rft, clk, t_out, _sm) \ |
Rabin Vincent | f9faf23 | 2010-05-03 08:24:37 +0100 | [diff] [blame] | 208 | static struct nmk_i2c_controller u8500_i2c##id##_data = { \ |
Srinidhi Kasagar | d48a41c | 2010-02-03 13:02:48 +0100 | [diff] [blame] | 209 | /* \ |
| 210 | * slave data setup time, which is \ |
| 211 | * 250 ns,100ns,10ns which is 14,6,2 \ |
| 212 | * respectively for a 48 Mhz \ |
| 213 | * i2c clock \ |
| 214 | */ \ |
| 215 | .slsu = _slsu, \ |
| 216 | /* Tx FIFO threshold */ \ |
| 217 | .tft = _tft, \ |
| 218 | /* Rx FIFO threshold */ \ |
| 219 | .rft = _rft, \ |
| 220 | /* std. mode operation */ \ |
| 221 | .clk_freq = clk, \ |
Linus Walleij | 2b030bd | 2011-05-13 12:31:13 +0200 | [diff] [blame^] | 222 | /* Slave response timeout(ms) */\ |
| 223 | .timeout = t_out, \ |
Srinidhi Kasagar | d48a41c | 2010-02-03 13:02:48 +0100 | [diff] [blame] | 224 | .sm = _sm, \ |
| 225 | } |
| 226 | |
| 227 | /* |
| 228 | * The board uses 4 i2c controllers, initialize all of |
| 229 | * them with slave data setup time of 250 ns, |
Linus Walleij | 2b030bd | 2011-05-13 12:31:13 +0200 | [diff] [blame^] | 230 | * Tx & Rx FIFO threshold values as 8 and standard |
Srinidhi Kasagar | d48a41c | 2010-02-03 13:02:48 +0100 | [diff] [blame] | 231 | * mode of operation |
| 232 | */ |
Linus Walleij | 2b030bd | 2011-05-13 12:31:13 +0200 | [diff] [blame^] | 233 | U8500_I2C_CONTROLLER(0, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST); |
| 234 | U8500_I2C_CONTROLLER(1, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST); |
| 235 | U8500_I2C_CONTROLLER(2, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST); |
| 236 | U8500_I2C_CONTROLLER(3, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST); |
Srinidhi Kasagar | d48a41c | 2010-02-03 13:02:48 +0100 | [diff] [blame] | 237 | |
Rabin Vincent | fbf1ead | 2010-09-29 19:46:32 +0530 | [diff] [blame] | 238 | static void __init mop500_i2c_init(void) |
| 239 | { |
| 240 | db8500_add_i2c0(&u8500_i2c0_data); |
| 241 | db8500_add_i2c1(&u8500_i2c1_data); |
| 242 | db8500_add_i2c2(&u8500_i2c2_data); |
| 243 | db8500_add_i2c3(&u8500_i2c3_data); |
| 244 | } |
Srinidhi Kasagar | aa44ef4 | 2009-11-28 08:17:18 +0100 | [diff] [blame] | 245 | |
Philippe Langlais | a71b819 | 2011-01-14 10:53:59 +0100 | [diff] [blame] | 246 | static struct gpio_keys_button mop500_gpio_keys[] = { |
| 247 | { |
| 248 | .desc = "SFH7741 Proximity Sensor", |
| 249 | .type = EV_SW, |
| 250 | .code = SW_FRONT_PROXIMITY, |
Philippe Langlais | a71b819 | 2011-01-14 10:53:59 +0100 | [diff] [blame] | 251 | .active_low = 0, |
| 252 | .can_disable = 1, |
| 253 | } |
| 254 | }; |
| 255 | |
| 256 | static struct regulator *prox_regulator; |
| 257 | static int mop500_prox_activate(struct device *dev); |
| 258 | static void mop500_prox_deactivate(struct device *dev); |
| 259 | |
| 260 | static struct gpio_keys_platform_data mop500_gpio_keys_data = { |
| 261 | .buttons = mop500_gpio_keys, |
| 262 | .nbuttons = ARRAY_SIZE(mop500_gpio_keys), |
| 263 | .enable = mop500_prox_activate, |
| 264 | .disable = mop500_prox_deactivate, |
| 265 | }; |
| 266 | |
| 267 | static struct platform_device mop500_gpio_keys_device = { |
| 268 | .name = "gpio-keys", |
| 269 | .id = 0, |
| 270 | .dev = { |
| 271 | .platform_data = &mop500_gpio_keys_data, |
| 272 | }, |
| 273 | }; |
| 274 | |
| 275 | static int mop500_prox_activate(struct device *dev) |
| 276 | { |
| 277 | prox_regulator = regulator_get(&mop500_gpio_keys_device.dev, |
| 278 | "vcc"); |
| 279 | if (IS_ERR(prox_regulator)) { |
| 280 | dev_err(&mop500_gpio_keys_device.dev, |
| 281 | "no regulator\n"); |
| 282 | return PTR_ERR(prox_regulator); |
| 283 | } |
| 284 | regulator_enable(prox_regulator); |
| 285 | return 0; |
| 286 | } |
| 287 | |
| 288 | static void mop500_prox_deactivate(struct device *dev) |
| 289 | { |
| 290 | regulator_disable(prox_regulator); |
| 291 | regulator_put(prox_regulator); |
| 292 | } |
| 293 | |
Srinidhi Kasagar | d48a41c | 2010-02-03 13:02:48 +0100 | [diff] [blame] | 294 | /* add any platform devices here - TODO */ |
| 295 | static struct platform_device *platform_devs[] __initdata = { |
Philippe Langlais | a71b819 | 2011-01-14 10:53:59 +0100 | [diff] [blame] | 296 | &mop500_gpio_keys_device, |
Srinidhi Kasagar | d48a41c | 2010-02-03 13:02:48 +0100 | [diff] [blame] | 297 | }; |
| 298 | |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 299 | #ifdef CONFIG_STE_DMA40 |
| 300 | static struct stedma40_chan_cfg ssp0_dma_cfg_rx = { |
| 301 | .mode = STEDMA40_MODE_LOGICAL, |
| 302 | .dir = STEDMA40_PERIPH_TO_MEM, |
| 303 | .src_dev_type = DB8500_DMA_DEV8_SSP0_RX, |
| 304 | .dst_dev_type = STEDMA40_DEV_DST_MEMORY, |
| 305 | .src_info.data_width = STEDMA40_BYTE_WIDTH, |
| 306 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, |
| 307 | }; |
| 308 | |
| 309 | static struct stedma40_chan_cfg ssp0_dma_cfg_tx = { |
| 310 | .mode = STEDMA40_MODE_LOGICAL, |
| 311 | .dir = STEDMA40_MEM_TO_PERIPH, |
| 312 | .src_dev_type = STEDMA40_DEV_SRC_MEMORY, |
| 313 | .dst_dev_type = DB8500_DMA_DEV8_SSP0_TX, |
| 314 | .src_info.data_width = STEDMA40_BYTE_WIDTH, |
| 315 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, |
| 316 | }; |
| 317 | #endif |
| 318 | |
| 319 | static struct pl022_ssp_controller ssp0_platform_data = { |
| 320 | .bus_id = 0, |
| 321 | #ifdef CONFIG_STE_DMA40 |
| 322 | .enable_dma = 1, |
| 323 | .dma_filter = stedma40_filter, |
| 324 | .dma_rx_param = &ssp0_dma_cfg_rx, |
| 325 | .dma_tx_param = &ssp0_dma_cfg_tx, |
| 326 | #else |
| 327 | .enable_dma = 0, |
| 328 | #endif |
| 329 | /* on this platform, gpio 31,142,144,214 & |
| 330 | * 224 are connected as chip selects |
| 331 | */ |
| 332 | .num_chipselect = 5, |
| 333 | }; |
| 334 | |
Rabin Vincent | fbf1ead | 2010-09-29 19:46:32 +0530 | [diff] [blame] | 335 | static void __init mop500_spi_init(void) |
| 336 | { |
| 337 | db8500_add_ssp0(&ssp0_platform_data); |
| 338 | } |
| 339 | |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 340 | #ifdef CONFIG_STE_DMA40 |
| 341 | static struct stedma40_chan_cfg uart0_dma_cfg_rx = { |
| 342 | .mode = STEDMA40_MODE_LOGICAL, |
| 343 | .dir = STEDMA40_PERIPH_TO_MEM, |
| 344 | .src_dev_type = DB8500_DMA_DEV13_UART0_RX, |
| 345 | .dst_dev_type = STEDMA40_DEV_DST_MEMORY, |
| 346 | .src_info.data_width = STEDMA40_BYTE_WIDTH, |
| 347 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, |
| 348 | }; |
| 349 | |
| 350 | static struct stedma40_chan_cfg uart0_dma_cfg_tx = { |
| 351 | .mode = STEDMA40_MODE_LOGICAL, |
| 352 | .dir = STEDMA40_MEM_TO_PERIPH, |
| 353 | .src_dev_type = STEDMA40_DEV_SRC_MEMORY, |
| 354 | .dst_dev_type = DB8500_DMA_DEV13_UART0_TX, |
| 355 | .src_info.data_width = STEDMA40_BYTE_WIDTH, |
| 356 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, |
| 357 | }; |
| 358 | |
| 359 | static struct stedma40_chan_cfg uart1_dma_cfg_rx = { |
| 360 | .mode = STEDMA40_MODE_LOGICAL, |
| 361 | .dir = STEDMA40_PERIPH_TO_MEM, |
| 362 | .src_dev_type = DB8500_DMA_DEV12_UART1_RX, |
| 363 | .dst_dev_type = STEDMA40_DEV_DST_MEMORY, |
| 364 | .src_info.data_width = STEDMA40_BYTE_WIDTH, |
| 365 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, |
| 366 | }; |
| 367 | |
| 368 | static struct stedma40_chan_cfg uart1_dma_cfg_tx = { |
| 369 | .mode = STEDMA40_MODE_LOGICAL, |
| 370 | .dir = STEDMA40_MEM_TO_PERIPH, |
| 371 | .src_dev_type = STEDMA40_DEV_SRC_MEMORY, |
| 372 | .dst_dev_type = DB8500_DMA_DEV12_UART1_TX, |
| 373 | .src_info.data_width = STEDMA40_BYTE_WIDTH, |
| 374 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, |
| 375 | }; |
| 376 | |
| 377 | static struct stedma40_chan_cfg uart2_dma_cfg_rx = { |
| 378 | .mode = STEDMA40_MODE_LOGICAL, |
| 379 | .dir = STEDMA40_PERIPH_TO_MEM, |
| 380 | .src_dev_type = DB8500_DMA_DEV11_UART2_RX, |
| 381 | .dst_dev_type = STEDMA40_DEV_DST_MEMORY, |
| 382 | .src_info.data_width = STEDMA40_BYTE_WIDTH, |
| 383 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, |
| 384 | }; |
| 385 | |
| 386 | static struct stedma40_chan_cfg uart2_dma_cfg_tx = { |
| 387 | .mode = STEDMA40_MODE_LOGICAL, |
| 388 | .dir = STEDMA40_MEM_TO_PERIPH, |
| 389 | .src_dev_type = STEDMA40_DEV_SRC_MEMORY, |
| 390 | .dst_dev_type = DB8500_DMA_DEV11_UART2_TX, |
| 391 | .src_info.data_width = STEDMA40_BYTE_WIDTH, |
| 392 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, |
| 393 | }; |
| 394 | #endif |
| 395 | |
| 396 | static struct amba_pl011_data uart0_plat = { |
| 397 | #ifdef CONFIG_STE_DMA40 |
| 398 | .dma_filter = stedma40_filter, |
| 399 | .dma_rx_param = &uart0_dma_cfg_rx, |
| 400 | .dma_tx_param = &uart0_dma_cfg_tx, |
| 401 | #endif |
| 402 | }; |
| 403 | |
| 404 | static struct amba_pl011_data uart1_plat = { |
| 405 | #ifdef CONFIG_STE_DMA40 |
| 406 | .dma_filter = stedma40_filter, |
| 407 | .dma_rx_param = &uart1_dma_cfg_rx, |
| 408 | .dma_tx_param = &uart1_dma_cfg_tx, |
| 409 | #endif |
| 410 | }; |
| 411 | |
| 412 | static struct amba_pl011_data uart2_plat = { |
| 413 | #ifdef CONFIG_STE_DMA40 |
| 414 | .dma_filter = stedma40_filter, |
| 415 | .dma_rx_param = &uart2_dma_cfg_rx, |
| 416 | .dma_tx_param = &uart2_dma_cfg_tx, |
| 417 | #endif |
| 418 | }; |
| 419 | |
Rabin Vincent | fbf1ead | 2010-09-29 19:46:32 +0530 | [diff] [blame] | 420 | static void __init mop500_uart_init(void) |
| 421 | { |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 422 | db8500_add_uart0(&uart0_plat); |
| 423 | db8500_add_uart1(&uart1_plat); |
| 424 | db8500_add_uart2(&uart2_plat); |
Rabin Vincent | fbf1ead | 2010-09-29 19:46:32 +0530 | [diff] [blame] | 425 | } |
| 426 | |
Linus Walleij | 4b4f757 | 2011-02-15 15:01:35 +0100 | [diff] [blame] | 427 | static void __init mop500_init_machine(void) |
Srinidhi Kasagar | aa44ef4 | 2009-11-28 08:17:18 +0100 | [diff] [blame] | 428 | { |
Linus Walleij | cf568c5 | 2011-03-30 14:31:42 +0200 | [diff] [blame] | 429 | int i2c0_devs; |
| 430 | |
Linus Walleij | 4b4f757 | 2011-02-15 15:01:35 +0100 | [diff] [blame] | 431 | /* |
| 432 | * The HREFv60 board removed a GPIO expander and routed |
| 433 | * all these GPIO pins to the internal GPIO controller |
| 434 | * instead. |
| 435 | */ |
| 436 | if (machine_is_hrefv60()) |
| 437 | mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO; |
| 438 | else |
| 439 | mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR; |
| 440 | |
Rabin Vincent | ea05a57 | 2010-06-03 07:58:42 +0100 | [diff] [blame] | 441 | u8500_init_devices(); |
| 442 | |
Rabin Vincent | fe05203 | 2011-02-11 17:07:21 -0700 | [diff] [blame] | 443 | mop500_pins_init(); |
Rabin Vincent | ea05a57 | 2010-06-03 07:58:42 +0100 | [diff] [blame] | 444 | |
Srinidhi Kasagar | d48a41c | 2010-02-03 13:02:48 +0100 | [diff] [blame] | 445 | platform_add_devices(platform_devs, ARRAY_SIZE(platform_devs)); |
| 446 | |
Rabin Vincent | fbf1ead | 2010-09-29 19:46:32 +0530 | [diff] [blame] | 447 | mop500_i2c_init(); |
Hanumath Prasad | 008f8a2 | 2010-08-19 12:06:32 +0100 | [diff] [blame] | 448 | mop500_sdi_init(); |
Rabin Vincent | fbf1ead | 2010-09-29 19:46:32 +0530 | [diff] [blame] | 449 | mop500_spi_init(); |
| 450 | mop500_uart_init(); |
Hanumath Prasad | 008f8a2 | 2010-08-19 12:06:32 +0100 | [diff] [blame] | 451 | |
Sundar Iyer | d5d2281 | 2010-12-13 09:33:11 +0530 | [diff] [blame] | 452 | platform_device_register(&ab8500_device); |
Rabin Vincent | b8410a1 | 2010-08-09 19:18:17 +0530 | [diff] [blame] | 453 | |
Linus Walleij | cf568c5 | 2011-03-30 14:31:42 +0200 | [diff] [blame] | 454 | i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices); |
| 455 | if (machine_is_hrefv60()) |
| 456 | i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES; |
| 457 | |
| 458 | i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs); |
Philippe Langlais | dd7b2a0 | 2011-01-12 11:26:20 +0100 | [diff] [blame] | 459 | i2c_register_board_info(2, mop500_i2c2_devices, |
| 460 | ARRAY_SIZE(mop500_i2c2_devices)); |
Srinidhi Kasagar | aa44ef4 | 2009-11-28 08:17:18 +0100 | [diff] [blame] | 461 | } |
| 462 | |
| 463 | MACHINE_START(U8500, "ST-Ericsson MOP500 platform") |
| 464 | /* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */ |
Srinidhi Kasagar | aa44ef4 | 2009-11-28 08:17:18 +0100 | [diff] [blame] | 465 | .boot_params = 0x100, |
| 466 | .map_io = u8500_map_io, |
Rabin Vincent | 178980f | 2010-05-03 07:39:02 +0100 | [diff] [blame] | 467 | .init_irq = ux500_init_irq, |
Srinidhi Kasagar | aa44ef4 | 2009-11-28 08:17:18 +0100 | [diff] [blame] | 468 | /* we re-use nomadik timer here */ |
Rabin Vincent | 41ac329 | 2010-05-03 08:28:05 +0100 | [diff] [blame] | 469 | .timer = &ux500_timer, |
Linus Walleij | 4b4f757 | 2011-02-15 15:01:35 +0100 | [diff] [blame] | 470 | .init_machine = mop500_init_machine, |
| 471 | MACHINE_END |
| 472 | |
| 473 | MACHINE_START(HREFV60, "ST-Ericsson U8500 Platform HREFv60+") |
| 474 | .boot_params = 0x100, |
| 475 | .map_io = u8500_map_io, |
| 476 | .init_irq = ux500_init_irq, |
| 477 | .timer = &ux500_timer, |
| 478 | .init_machine = mop500_init_machine, |
Srinidhi Kasagar | aa44ef4 | 2009-11-28 08:17:18 +0100 | [diff] [blame] | 479 | MACHINE_END |