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> |
Linus Walleij | ee66e65 | 2011-12-02 14:16:33 +0100 | [diff] [blame] | 22 | #include <linux/mfd/abx500/ab8500.h> |
Bengt Jonsson | 79568b94 | 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 | fe67dfc8 | 2011-03-07 11:48:15 +0100 | [diff] [blame] | 25 | #include <linux/mfd/tps6105x.h> |
Linus Walleij | ee66e65 | 2011-12-02 14:16:33 +0100 | [diff] [blame] | 26 | #include <linux/mfd/abx500/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> |
Robert Marklund | 350abe0 | 2011-06-20 15:55:46 +0200 | [diff] [blame] | 29 | #include <linux/smsc911x.h> |
Philippe Langlais | a71b819 | 2011-01-14 10:53:59 +0100 | [diff] [blame] | 30 | #include <linux/gpio_keys.h> |
Shreshtha Kumar Sahu | 1a7d436 | 2011-06-13 10:11:44 +0200 | [diff] [blame] | 31 | #include <linux/delay.h> |
Srinidhi Kasagar | aa44ef4 | 2009-11-28 08:17:18 +0100 | [diff] [blame] | 32 | |
Robert Marklund | 350abe0 | 2011-06-20 15:55:46 +0200 | [diff] [blame] | 33 | #include <linux/leds.h> |
Srinidhi Kasagar | aa44ef4 | 2009-11-28 08:17:18 +0100 | [diff] [blame] | 34 | #include <asm/mach-types.h> |
| 35 | #include <asm/mach/arch.h> |
Marc Zyngier | bbf5f38 | 2011-09-06 10:23:45 +0100 | [diff] [blame] | 36 | #include <asm/hardware/gic.h> |
Srinidhi Kasagar | aa44ef4 | 2009-11-28 08:17:18 +0100 | [diff] [blame] | 37 | |
Srinidhi Kasagar | d48a41c | 2010-02-03 13:02:48 +0100 | [diff] [blame] | 38 | #include <plat/i2c.h> |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 39 | #include <plat/ste_dma40.h> |
Shreshtha Kumar Sahu | 1a7d436 | 2011-06-13 10:11:44 +0200 | [diff] [blame] | 40 | #include <plat/pincfg.h> |
Linus Walleij | 0f33286 | 2011-08-22 08:33:30 +0100 | [diff] [blame] | 41 | #include <plat/gpio-nomadik.h> |
Srinidhi Kasagar | aa44ef4 | 2009-11-28 08:17:18 +0100 | [diff] [blame] | 42 | |
| 43 | #include <mach/hardware.h> |
| 44 | #include <mach/setup.h> |
Rabin Vincent | 9e4e7fe | 2010-05-03 08:03:52 +0100 | [diff] [blame] | 45 | #include <mach/devices.h> |
Linus Walleij | 29aeb3c | 2010-09-06 22:15:08 +0100 | [diff] [blame] | 46 | #include <mach/irqs.h> |
Andreas Westin | 585d188 | 2012-05-10 10:14:06 +0200 | [diff] [blame^] | 47 | #include <mach/crypto-ux500.h> |
Srinidhi Kasagar | aa44ef4 | 2009-11-28 08:17:18 +0100 | [diff] [blame] | 48 | |
Shreshtha Kumar Sahu | 1a7d436 | 2011-06-13 10:11:44 +0200 | [diff] [blame] | 49 | #include "pins-db8500.h" |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 50 | #include "ste-dma40-db8500.h" |
Rabin Vincent | fbf1ead | 2010-09-29 19:46:32 +0530 | [diff] [blame] | 51 | #include "devices-db8500.h" |
Hanumath Prasad | 008f8a2 | 2010-08-19 12:06:32 +0100 | [diff] [blame] | 52 | #include "board-mop500.h" |
Bengt Jonsson | a1e516e | 2010-12-10 11:08:48 +0100 | [diff] [blame] | 53 | #include "board-mop500-regulators.h" |
Rabin Vincent | ea05a57 | 2010-06-03 07:58:42 +0100 | [diff] [blame] | 54 | |
Robert Marklund | 350abe0 | 2011-06-20 15:55:46 +0200 | [diff] [blame] | 55 | static struct gpio_led snowball_led_array[] = { |
| 56 | { |
| 57 | .name = "user_led", |
| 58 | .default_trigger = "none", |
| 59 | .gpio = 142, |
| 60 | }, |
| 61 | }; |
| 62 | |
| 63 | static struct gpio_led_platform_data snowball_led_data = { |
| 64 | .leds = snowball_led_array, |
| 65 | .num_leds = ARRAY_SIZE(snowball_led_array), |
| 66 | }; |
| 67 | |
| 68 | static struct platform_device snowball_led_dev = { |
| 69 | .name = "leds-gpio", |
| 70 | .dev = { |
| 71 | .platform_data = &snowball_led_data, |
| 72 | }, |
| 73 | }; |
| 74 | |
Bibek Basu | 3ef374a | 2011-02-15 12:56:16 +0530 | [diff] [blame] | 75 | static struct ab8500_gpio_platform_data ab8500_gpio_pdata = { |
Philippe Langlais | a1524ee | 2012-02-13 10:52:25 +0100 | [diff] [blame] | 76 | .gpio_base = MOP500_AB8500_PIN_GPIO(1), |
Bibek Basu | 3ef374a | 2011-02-15 12:56:16 +0530 | [diff] [blame] | 77 | .irq_base = MOP500_AB8500_VIR_GPIO_IRQ_BASE, |
| 78 | /* config_reg is the initial configuration of ab8500 pins. |
| 79 | * The pins can be configured as GPIO or alt functions based |
| 80 | * on value present in GpioSel1 to GpioSel6 and AlternatFunction |
| 81 | * register. This is the array of 7 configuration settings. |
| 82 | * One has to compile time decide these settings. Below is the |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 83 | * explanation of these setting |
Bibek Basu | 3ef374a | 2011-02-15 12:56:16 +0530 | [diff] [blame] | 84 | * GpioSel1 = 0x00 => Pins GPIO1 to GPIO8 are not used as GPIO |
| 85 | * GpioSel2 = 0x1E => Pins GPIO10 to GPIO13 are configured as GPIO |
| 86 | * GpioSel3 = 0x80 => Pin GPIO24 is configured as GPIO |
| 87 | * GpioSel4 = 0x01 => Pin GPIo25 is configured as GPIO |
| 88 | * GpioSel5 = 0x7A => Pins GPIO34, GPIO36 to GPIO39 are conf as GPIO |
| 89 | * GpioSel6 = 0x00 => Pins GPIO41 & GPIo42 are not configured as GPIO |
| 90 | * AlternaFunction = 0x00 => If Pins GPIO10 to 13 are not configured |
| 91 | * as GPIO then this register selectes the alternate fucntions |
| 92 | */ |
| 93 | .config_reg = {0x00, 0x1E, 0x80, 0x01, |
| 94 | 0x7A, 0x00, 0x00}, |
| 95 | }; |
| 96 | |
Robert Marklund | 350abe0 | 2011-06-20 15:55:46 +0200 | [diff] [blame] | 97 | static struct gpio_keys_button snowball_key_array[] = { |
| 98 | { |
| 99 | .gpio = 32, |
| 100 | .type = EV_KEY, |
| 101 | .code = KEY_1, |
| 102 | .desc = "userpb", |
| 103 | .active_low = 1, |
| 104 | .debounce_interval = 50, |
| 105 | .wakeup = 1, |
| 106 | }, |
| 107 | { |
| 108 | .gpio = 151, |
| 109 | .type = EV_KEY, |
| 110 | .code = KEY_2, |
| 111 | .desc = "extkb1", |
| 112 | .active_low = 1, |
| 113 | .debounce_interval = 50, |
| 114 | .wakeup = 1, |
| 115 | }, |
| 116 | { |
| 117 | .gpio = 152, |
| 118 | .type = EV_KEY, |
| 119 | .code = KEY_3, |
| 120 | .desc = "extkb2", |
| 121 | .active_low = 1, |
| 122 | .debounce_interval = 50, |
| 123 | .wakeup = 1, |
| 124 | }, |
| 125 | { |
| 126 | .gpio = 161, |
| 127 | .type = EV_KEY, |
| 128 | .code = KEY_4, |
| 129 | .desc = "extkb3", |
| 130 | .active_low = 1, |
| 131 | .debounce_interval = 50, |
| 132 | .wakeup = 1, |
| 133 | }, |
| 134 | { |
| 135 | .gpio = 162, |
| 136 | .type = EV_KEY, |
| 137 | .code = KEY_5, |
| 138 | .desc = "extkb4", |
| 139 | .active_low = 1, |
| 140 | .debounce_interval = 50, |
| 141 | .wakeup = 1, |
| 142 | }, |
| 143 | }; |
| 144 | |
| 145 | static struct gpio_keys_platform_data snowball_key_data = { |
| 146 | .buttons = snowball_key_array, |
| 147 | .nbuttons = ARRAY_SIZE(snowball_key_array), |
| 148 | }; |
| 149 | |
| 150 | static struct platform_device snowball_key_dev = { |
| 151 | .name = "gpio-keys", |
| 152 | .id = -1, |
| 153 | .dev = { |
| 154 | .platform_data = &snowball_key_data, |
| 155 | } |
| 156 | }; |
| 157 | |
| 158 | static struct smsc911x_platform_config snowball_sbnet_cfg = { |
| 159 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH, |
| 160 | .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, |
| 161 | .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY, |
| 162 | .shift = 1, |
| 163 | }; |
| 164 | |
| 165 | static struct resource sbnet_res[] = { |
| 166 | { |
| 167 | .name = "smsc911x-memory", |
| 168 | .start = (0x5000 << 16), |
| 169 | .end = (0x5000 << 16) + 0xffff, |
| 170 | .flags = IORESOURCE_MEM, |
| 171 | }, |
| 172 | { |
| 173 | .start = NOMADIK_GPIO_TO_IRQ(140), |
| 174 | .end = NOMADIK_GPIO_TO_IRQ(140), |
| 175 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, |
| 176 | }, |
| 177 | }; |
| 178 | |
| 179 | static struct platform_device snowball_sbnet_dev = { |
| 180 | .name = "smsc911x", |
| 181 | .num_resources = ARRAY_SIZE(sbnet_res), |
| 182 | .resource = sbnet_res, |
| 183 | .dev = { |
| 184 | .platform_data = &snowball_sbnet_cfg, |
| 185 | }, |
| 186 | }; |
| 187 | |
Rabin Vincent | 39ae702 | 2010-07-26 11:12:15 +0100 | [diff] [blame] | 188 | static struct ab8500_platform_data ab8500_platdata = { |
| 189 | .irq_base = MOP500_AB8500_IRQ_BASE, |
Bengt Jonsson | dfa3a82 | 2011-03-09 13:34:17 +0100 | [diff] [blame] | 190 | .regulator_reg_init = ab8500_regulator_reg_init, |
| 191 | .num_regulator_reg_init = ARRAY_SIZE(ab8500_regulator_reg_init), |
Bengt Jonsson | a1e516e | 2010-12-10 11:08:48 +0100 | [diff] [blame] | 192 | .regulator = ab8500_regulators, |
| 193 | .num_regulator = ARRAY_SIZE(ab8500_regulators), |
Bibek Basu | 3ef374a | 2011-02-15 12:56:16 +0530 | [diff] [blame] | 194 | .gpio = &ab8500_gpio_pdata, |
Rabin Vincent | 39ae702 | 2010-07-26 11:12:15 +0100 | [diff] [blame] | 195 | }; |
| 196 | |
Linus Walleij | 29aeb3c | 2010-09-06 22:15:08 +0100 | [diff] [blame] | 197 | static struct resource ab8500_resources[] = { |
| 198 | [0] = { |
Rabin Vincent | 22039b7 | 2010-12-08 11:07:56 +0530 | [diff] [blame] | 199 | .start = IRQ_DB8500_AB8500, |
| 200 | .end = IRQ_DB8500_AB8500, |
| 201 | .flags = IORESOURCE_IRQ |
Linus Walleij | 29aeb3c | 2010-09-06 22:15:08 +0100 | [diff] [blame] | 202 | } |
| 203 | }; |
| 204 | |
| 205 | struct platform_device ab8500_device = { |
| 206 | .name = "ab8500-i2c", |
| 207 | .id = 0, |
| 208 | .dev = { |
| 209 | .platform_data = &ab8500_platdata, |
| 210 | }, |
| 211 | .num_resources = 1, |
| 212 | .resource = ab8500_resources, |
| 213 | }; |
| 214 | |
Rabin Vincent | b8410a1 | 2010-08-09 19:18:17 +0530 | [diff] [blame] | 215 | /* |
Linus Walleij | fe67dfc8 | 2011-03-07 11:48:15 +0100 | [diff] [blame] | 216 | * TPS61052 |
| 217 | */ |
| 218 | |
| 219 | static struct tps6105x_platform_data mop500_tps61052_data = { |
| 220 | .mode = TPS6105X_MODE_VOLTAGE, |
| 221 | .regulator_data = &tps61052_regulator, |
| 222 | }; |
| 223 | |
| 224 | /* |
Rabin Vincent | b8410a1 | 2010-08-09 19:18:17 +0530 | [diff] [blame] | 225 | * TC35892 |
| 226 | */ |
| 227 | |
Sundar Iyer | 20406eb | 2010-12-13 09:33:14 +0530 | [diff] [blame] | 228 | static void mop500_tc35892_init(struct tc3589x *tc3589x, unsigned int base) |
Rabin Vincent | b8410a1 | 2010-08-09 19:18:17 +0530 | [diff] [blame] | 229 | { |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 230 | struct device *parent = NULL; |
| 231 | #if 0 |
| 232 | /* FIXME: Is the sdi actually part of tc3589x? */ |
| 233 | parent = tc3589x->dev; |
| 234 | #endif |
| 235 | mop500_sdi_tc35892_init(parent); |
Rabin Vincent | b8410a1 | 2010-08-09 19:18:17 +0530 | [diff] [blame] | 236 | } |
| 237 | |
Sundar Iyer | 20406eb | 2010-12-13 09:33:14 +0530 | [diff] [blame] | 238 | static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = { |
Rabin Vincent | b8410a1 | 2010-08-09 19:18:17 +0530 | [diff] [blame] | 239 | .gpio_base = MOP500_EGPIO(0), |
| 240 | .setup = mop500_tc35892_init, |
| 241 | }; |
| 242 | |
Sundar Iyer | 20406eb | 2010-12-13 09:33:14 +0530 | [diff] [blame] | 243 | static struct tc3589x_platform_data mop500_tc35892_data = { |
Sundar Iyer | 611b759 | 2010-12-13 09:33:15 +0530 | [diff] [blame] | 244 | .block = TC3589x_BLOCK_GPIO, |
Rabin Vincent | b8410a1 | 2010-08-09 19:18:17 +0530 | [diff] [blame] | 245 | .gpio = &mop500_tc35892_gpio_data, |
| 246 | .irq_base = MOP500_EGPIO_IRQ_BASE, |
| 247 | }; |
| 248 | |
Philippe Langlais | dd7b2a0 | 2011-01-12 11:26:20 +0100 | [diff] [blame] | 249 | static struct lp5521_led_config lp5521_pri_led[] = { |
| 250 | [0] = { |
| 251 | .chan_nr = 0, |
| 252 | .led_current = 0x2f, |
| 253 | .max_current = 0x5f, |
| 254 | }, |
| 255 | [1] = { |
| 256 | .chan_nr = 1, |
| 257 | .led_current = 0x2f, |
| 258 | .max_current = 0x5f, |
| 259 | }, |
| 260 | [2] = { |
| 261 | .chan_nr = 2, |
| 262 | .led_current = 0x2f, |
| 263 | .max_current = 0x5f, |
| 264 | }, |
| 265 | }; |
| 266 | |
| 267 | static struct lp5521_platform_data __initdata lp5521_pri_data = { |
| 268 | .label = "lp5521_pri", |
| 269 | .led_config = &lp5521_pri_led[0], |
| 270 | .num_channels = 3, |
| 271 | .clock_mode = LP5521_CLOCK_EXT, |
| 272 | }; |
| 273 | |
| 274 | static struct lp5521_led_config lp5521_sec_led[] = { |
| 275 | [0] = { |
| 276 | .chan_nr = 0, |
| 277 | .led_current = 0x2f, |
| 278 | .max_current = 0x5f, |
| 279 | }, |
| 280 | [1] = { |
| 281 | .chan_nr = 1, |
| 282 | .led_current = 0x2f, |
| 283 | .max_current = 0x5f, |
| 284 | }, |
| 285 | [2] = { |
| 286 | .chan_nr = 2, |
| 287 | .led_current = 0x2f, |
| 288 | .max_current = 0x5f, |
| 289 | }, |
| 290 | }; |
| 291 | |
| 292 | static struct lp5521_platform_data __initdata lp5521_sec_data = { |
| 293 | .label = "lp5521_sec", |
| 294 | .led_config = &lp5521_sec_led[0], |
| 295 | .num_channels = 3, |
| 296 | .clock_mode = LP5521_CLOCK_EXT, |
| 297 | }; |
| 298 | |
Linus Walleij | fe67dfc8 | 2011-03-07 11:48:15 +0100 | [diff] [blame] | 299 | static struct i2c_board_info __initdata mop500_i2c0_devices[] = { |
Rabin Vincent | b8410a1 | 2010-08-09 19:18:17 +0530 | [diff] [blame] | 300 | { |
Sundar Iyer | 20406eb | 2010-12-13 09:33:14 +0530 | [diff] [blame] | 301 | I2C_BOARD_INFO("tc3589x", 0x42), |
Philippe Langlais | dd7b2a0 | 2011-01-12 11:26:20 +0100 | [diff] [blame] | 302 | .irq = NOMADIK_GPIO_TO_IRQ(217), |
Rabin Vincent | b8410a1 | 2010-08-09 19:18:17 +0530 | [diff] [blame] | 303 | .platform_data = &mop500_tc35892_data, |
| 304 | }, |
Linus Walleij | cf568c5 | 2011-03-30 14:31:42 +0200 | [diff] [blame] | 305 | /* I2C0 devices only available prior to HREFv60 */ |
Linus Walleij | fe67dfc8 | 2011-03-07 11:48:15 +0100 | [diff] [blame] | 306 | { |
| 307 | I2C_BOARD_INFO("tps61052", 0x33), |
| 308 | .platform_data = &mop500_tps61052_data, |
| 309 | }, |
| 310 | }; |
| 311 | |
Linus Walleij | cf568c5 | 2011-03-30 14:31:42 +0200 | [diff] [blame] | 312 | #define NUM_PRE_V60_I2C0_DEVICES 1 |
| 313 | |
Philippe Langlais | dd7b2a0 | 2011-01-12 11:26:20 +0100 | [diff] [blame] | 314 | static struct i2c_board_info __initdata mop500_i2c2_devices[] = { |
| 315 | { |
| 316 | /* lp5521 LED driver, 1st device */ |
| 317 | I2C_BOARD_INFO("lp5521", 0x33), |
| 318 | .platform_data = &lp5521_pri_data, |
| 319 | }, |
| 320 | { |
| 321 | /* lp5521 LED driver, 2st device */ |
| 322 | I2C_BOARD_INFO("lp5521", 0x34), |
| 323 | .platform_data = &lp5521_sec_data, |
| 324 | }, |
Lee Jones | bb3b218 | 2011-01-13 14:41:22 +0000 | [diff] [blame] | 325 | { |
| 326 | /* Light sensor Rohm BH1780GLI */ |
| 327 | I2C_BOARD_INFO("bh1780", 0x29), |
| 328 | }, |
Philippe Langlais | dd7b2a0 | 2011-01-12 11:26:20 +0100 | [diff] [blame] | 329 | }; |
| 330 | |
Linus Walleij | 2b030bd | 2011-05-13 12:31:13 +0200 | [diff] [blame] | 331 | #define U8500_I2C_CONTROLLER(id, _slsu, _tft, _rft, clk, t_out, _sm) \ |
Rabin Vincent | f9faf23 | 2010-05-03 08:24:37 +0100 | [diff] [blame] | 332 | static struct nmk_i2c_controller u8500_i2c##id##_data = { \ |
Srinidhi Kasagar | d48a41c | 2010-02-03 13:02:48 +0100 | [diff] [blame] | 333 | /* \ |
| 334 | * slave data setup time, which is \ |
| 335 | * 250 ns,100ns,10ns which is 14,6,2 \ |
| 336 | * respectively for a 48 Mhz \ |
| 337 | * i2c clock \ |
| 338 | */ \ |
| 339 | .slsu = _slsu, \ |
| 340 | /* Tx FIFO threshold */ \ |
| 341 | .tft = _tft, \ |
| 342 | /* Rx FIFO threshold */ \ |
| 343 | .rft = _rft, \ |
| 344 | /* std. mode operation */ \ |
| 345 | .clk_freq = clk, \ |
Linus Walleij | 2b030bd | 2011-05-13 12:31:13 +0200 | [diff] [blame] | 346 | /* Slave response timeout(ms) */\ |
| 347 | .timeout = t_out, \ |
Srinidhi Kasagar | d48a41c | 2010-02-03 13:02:48 +0100 | [diff] [blame] | 348 | .sm = _sm, \ |
| 349 | } |
| 350 | |
| 351 | /* |
| 352 | * The board uses 4 i2c controllers, initialize all of |
| 353 | * them with slave data setup time of 250 ns, |
Linus Walleij | 2b030bd | 2011-05-13 12:31:13 +0200 | [diff] [blame] | 354 | * Tx & Rx FIFO threshold values as 8 and standard |
Srinidhi Kasagar | d48a41c | 2010-02-03 13:02:48 +0100 | [diff] [blame] | 355 | * mode of operation |
| 356 | */ |
Linus Walleij | 2b030bd | 2011-05-13 12:31:13 +0200 | [diff] [blame] | 357 | U8500_I2C_CONTROLLER(0, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST); |
| 358 | U8500_I2C_CONTROLLER(1, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST); |
| 359 | U8500_I2C_CONTROLLER(2, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST); |
| 360 | 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] | 361 | |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 362 | static void __init mop500_i2c_init(struct device *parent) |
Rabin Vincent | fbf1ead | 2010-09-29 19:46:32 +0530 | [diff] [blame] | 363 | { |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 364 | db8500_add_i2c0(parent, &u8500_i2c0_data); |
| 365 | db8500_add_i2c1(parent, &u8500_i2c1_data); |
| 366 | db8500_add_i2c2(parent, &u8500_i2c2_data); |
| 367 | db8500_add_i2c3(parent, &u8500_i2c3_data); |
Rabin Vincent | fbf1ead | 2010-09-29 19:46:32 +0530 | [diff] [blame] | 368 | } |
Srinidhi Kasagar | aa44ef4 | 2009-11-28 08:17:18 +0100 | [diff] [blame] | 369 | |
Philippe Langlais | a71b819 | 2011-01-14 10:53:59 +0100 | [diff] [blame] | 370 | static struct gpio_keys_button mop500_gpio_keys[] = { |
| 371 | { |
| 372 | .desc = "SFH7741 Proximity Sensor", |
| 373 | .type = EV_SW, |
| 374 | .code = SW_FRONT_PROXIMITY, |
Philippe Langlais | a71b819 | 2011-01-14 10:53:59 +0100 | [diff] [blame] | 375 | .active_low = 0, |
| 376 | .can_disable = 1, |
| 377 | } |
| 378 | }; |
| 379 | |
| 380 | static struct regulator *prox_regulator; |
| 381 | static int mop500_prox_activate(struct device *dev); |
| 382 | static void mop500_prox_deactivate(struct device *dev); |
| 383 | |
| 384 | static struct gpio_keys_platform_data mop500_gpio_keys_data = { |
| 385 | .buttons = mop500_gpio_keys, |
| 386 | .nbuttons = ARRAY_SIZE(mop500_gpio_keys), |
| 387 | .enable = mop500_prox_activate, |
| 388 | .disable = mop500_prox_deactivate, |
| 389 | }; |
| 390 | |
| 391 | static struct platform_device mop500_gpio_keys_device = { |
| 392 | .name = "gpio-keys", |
| 393 | .id = 0, |
| 394 | .dev = { |
| 395 | .platform_data = &mop500_gpio_keys_data, |
| 396 | }, |
| 397 | }; |
| 398 | |
| 399 | static int mop500_prox_activate(struct device *dev) |
| 400 | { |
| 401 | prox_regulator = regulator_get(&mop500_gpio_keys_device.dev, |
| 402 | "vcc"); |
| 403 | if (IS_ERR(prox_regulator)) { |
| 404 | dev_err(&mop500_gpio_keys_device.dev, |
| 405 | "no regulator\n"); |
| 406 | return PTR_ERR(prox_regulator); |
| 407 | } |
| 408 | regulator_enable(prox_regulator); |
| 409 | return 0; |
| 410 | } |
| 411 | |
| 412 | static void mop500_prox_deactivate(struct device *dev) |
| 413 | { |
| 414 | regulator_disable(prox_regulator); |
| 415 | regulator_put(prox_regulator); |
| 416 | } |
| 417 | |
Andreas Westin | 585d188 | 2012-05-10 10:14:06 +0200 | [diff] [blame^] | 418 | static struct cryp_platform_data u8500_cryp1_platform_data = { |
| 419 | .mem_to_engine = { |
| 420 | .dir = STEDMA40_MEM_TO_PERIPH, |
| 421 | .src_dev_type = STEDMA40_DEV_SRC_MEMORY, |
| 422 | .dst_dev_type = DB8500_DMA_DEV48_CAC1_TX, |
| 423 | .src_info.data_width = STEDMA40_WORD_WIDTH, |
| 424 | .dst_info.data_width = STEDMA40_WORD_WIDTH, |
| 425 | .mode = STEDMA40_MODE_LOGICAL, |
| 426 | .src_info.psize = STEDMA40_PSIZE_LOG_4, |
| 427 | .dst_info.psize = STEDMA40_PSIZE_LOG_4, |
| 428 | }, |
| 429 | .engine_to_mem = { |
| 430 | .dir = STEDMA40_PERIPH_TO_MEM, |
| 431 | .src_dev_type = DB8500_DMA_DEV48_CAC1_RX, |
| 432 | .dst_dev_type = STEDMA40_DEV_DST_MEMORY, |
| 433 | .src_info.data_width = STEDMA40_WORD_WIDTH, |
| 434 | .dst_info.data_width = STEDMA40_WORD_WIDTH, |
| 435 | .mode = STEDMA40_MODE_LOGICAL, |
| 436 | .src_info.psize = STEDMA40_PSIZE_LOG_4, |
| 437 | .dst_info.psize = STEDMA40_PSIZE_LOG_4, |
| 438 | } |
| 439 | }; |
| 440 | |
| 441 | static struct stedma40_chan_cfg u8500_hash_dma_cfg_tx = { |
| 442 | .dir = STEDMA40_MEM_TO_PERIPH, |
| 443 | .src_dev_type = STEDMA40_DEV_SRC_MEMORY, |
| 444 | .dst_dev_type = DB8500_DMA_DEV50_HAC1_TX, |
| 445 | .src_info.data_width = STEDMA40_WORD_WIDTH, |
| 446 | .dst_info.data_width = STEDMA40_WORD_WIDTH, |
| 447 | .mode = STEDMA40_MODE_LOGICAL, |
| 448 | .src_info.psize = STEDMA40_PSIZE_LOG_16, |
| 449 | .dst_info.psize = STEDMA40_PSIZE_LOG_16, |
| 450 | }; |
| 451 | |
| 452 | static struct hash_platform_data u8500_hash1_platform_data = { |
| 453 | .mem_to_engine = &u8500_hash_dma_cfg_tx, |
| 454 | .dma_filter = stedma40_filter, |
| 455 | }; |
| 456 | |
Srinidhi Kasagar | d48a41c | 2010-02-03 13:02:48 +0100 | [diff] [blame] | 457 | /* add any platform devices here - TODO */ |
Robert Marklund | 350abe0 | 2011-06-20 15:55:46 +0200 | [diff] [blame] | 458 | static struct platform_device *mop500_platform_devs[] __initdata = { |
Philippe Langlais | a71b819 | 2011-01-14 10:53:59 +0100 | [diff] [blame] | 459 | &mop500_gpio_keys_device, |
Robert Marklund | 350abe0 | 2011-06-20 15:55:46 +0200 | [diff] [blame] | 460 | &ab8500_device, |
Srinidhi Kasagar | d48a41c | 2010-02-03 13:02:48 +0100 | [diff] [blame] | 461 | }; |
| 462 | |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 463 | #ifdef CONFIG_STE_DMA40 |
| 464 | static struct stedma40_chan_cfg ssp0_dma_cfg_rx = { |
| 465 | .mode = STEDMA40_MODE_LOGICAL, |
| 466 | .dir = STEDMA40_PERIPH_TO_MEM, |
| 467 | .src_dev_type = DB8500_DMA_DEV8_SSP0_RX, |
| 468 | .dst_dev_type = STEDMA40_DEV_DST_MEMORY, |
| 469 | .src_info.data_width = STEDMA40_BYTE_WIDTH, |
| 470 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, |
| 471 | }; |
| 472 | |
| 473 | static struct stedma40_chan_cfg ssp0_dma_cfg_tx = { |
| 474 | .mode = STEDMA40_MODE_LOGICAL, |
| 475 | .dir = STEDMA40_MEM_TO_PERIPH, |
| 476 | .src_dev_type = STEDMA40_DEV_SRC_MEMORY, |
| 477 | .dst_dev_type = DB8500_DMA_DEV8_SSP0_TX, |
| 478 | .src_info.data_width = STEDMA40_BYTE_WIDTH, |
| 479 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, |
| 480 | }; |
| 481 | #endif |
| 482 | |
| 483 | static struct pl022_ssp_controller ssp0_platform_data = { |
| 484 | .bus_id = 0, |
| 485 | #ifdef CONFIG_STE_DMA40 |
| 486 | .enable_dma = 1, |
| 487 | .dma_filter = stedma40_filter, |
| 488 | .dma_rx_param = &ssp0_dma_cfg_rx, |
| 489 | .dma_tx_param = &ssp0_dma_cfg_tx, |
| 490 | #else |
| 491 | .enable_dma = 0, |
| 492 | #endif |
| 493 | /* on this platform, gpio 31,142,144,214 & |
| 494 | * 224 are connected as chip selects |
| 495 | */ |
| 496 | .num_chipselect = 5, |
| 497 | }; |
| 498 | |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 499 | static void __init mop500_spi_init(struct device *parent) |
Rabin Vincent | fbf1ead | 2010-09-29 19:46:32 +0530 | [diff] [blame] | 500 | { |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 501 | db8500_add_ssp0(parent, &ssp0_platform_data); |
Rabin Vincent | fbf1ead | 2010-09-29 19:46:32 +0530 | [diff] [blame] | 502 | } |
| 503 | |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 504 | #ifdef CONFIG_STE_DMA40 |
| 505 | static struct stedma40_chan_cfg uart0_dma_cfg_rx = { |
| 506 | .mode = STEDMA40_MODE_LOGICAL, |
| 507 | .dir = STEDMA40_PERIPH_TO_MEM, |
| 508 | .src_dev_type = DB8500_DMA_DEV13_UART0_RX, |
| 509 | .dst_dev_type = STEDMA40_DEV_DST_MEMORY, |
| 510 | .src_info.data_width = STEDMA40_BYTE_WIDTH, |
| 511 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, |
| 512 | }; |
| 513 | |
| 514 | static struct stedma40_chan_cfg uart0_dma_cfg_tx = { |
| 515 | .mode = STEDMA40_MODE_LOGICAL, |
| 516 | .dir = STEDMA40_MEM_TO_PERIPH, |
| 517 | .src_dev_type = STEDMA40_DEV_SRC_MEMORY, |
| 518 | .dst_dev_type = DB8500_DMA_DEV13_UART0_TX, |
| 519 | .src_info.data_width = STEDMA40_BYTE_WIDTH, |
| 520 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, |
| 521 | }; |
| 522 | |
| 523 | static struct stedma40_chan_cfg uart1_dma_cfg_rx = { |
| 524 | .mode = STEDMA40_MODE_LOGICAL, |
| 525 | .dir = STEDMA40_PERIPH_TO_MEM, |
| 526 | .src_dev_type = DB8500_DMA_DEV12_UART1_RX, |
| 527 | .dst_dev_type = STEDMA40_DEV_DST_MEMORY, |
| 528 | .src_info.data_width = STEDMA40_BYTE_WIDTH, |
| 529 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, |
| 530 | }; |
| 531 | |
| 532 | static struct stedma40_chan_cfg uart1_dma_cfg_tx = { |
| 533 | .mode = STEDMA40_MODE_LOGICAL, |
| 534 | .dir = STEDMA40_MEM_TO_PERIPH, |
| 535 | .src_dev_type = STEDMA40_DEV_SRC_MEMORY, |
| 536 | .dst_dev_type = DB8500_DMA_DEV12_UART1_TX, |
| 537 | .src_info.data_width = STEDMA40_BYTE_WIDTH, |
| 538 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, |
| 539 | }; |
| 540 | |
| 541 | static struct stedma40_chan_cfg uart2_dma_cfg_rx = { |
| 542 | .mode = STEDMA40_MODE_LOGICAL, |
| 543 | .dir = STEDMA40_PERIPH_TO_MEM, |
| 544 | .src_dev_type = DB8500_DMA_DEV11_UART2_RX, |
| 545 | .dst_dev_type = STEDMA40_DEV_DST_MEMORY, |
| 546 | .src_info.data_width = STEDMA40_BYTE_WIDTH, |
| 547 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, |
| 548 | }; |
| 549 | |
| 550 | static struct stedma40_chan_cfg uart2_dma_cfg_tx = { |
| 551 | .mode = STEDMA40_MODE_LOGICAL, |
| 552 | .dir = STEDMA40_MEM_TO_PERIPH, |
| 553 | .src_dev_type = STEDMA40_DEV_SRC_MEMORY, |
| 554 | .dst_dev_type = DB8500_DMA_DEV11_UART2_TX, |
| 555 | .src_info.data_width = STEDMA40_BYTE_WIDTH, |
| 556 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, |
| 557 | }; |
| 558 | #endif |
| 559 | |
Shreshtha Kumar Sahu | 1a7d436 | 2011-06-13 10:11:44 +0200 | [diff] [blame] | 560 | |
| 561 | static pin_cfg_t mop500_pins_uart0[] = { |
| 562 | GPIO0_U0_CTSn | PIN_INPUT_PULLUP, |
| 563 | GPIO1_U0_RTSn | PIN_OUTPUT_HIGH, |
| 564 | GPIO2_U0_RXD | PIN_INPUT_PULLUP, |
| 565 | GPIO3_U0_TXD | PIN_OUTPUT_HIGH, |
| 566 | }; |
| 567 | |
| 568 | #define PRCC_K_SOFTRST_SET 0x18 |
| 569 | #define PRCC_K_SOFTRST_CLEAR 0x1C |
| 570 | static void ux500_uart0_reset(void) |
| 571 | { |
| 572 | void __iomem *prcc_rst_set, *prcc_rst_clr; |
| 573 | |
| 574 | prcc_rst_set = (void __iomem *)IO_ADDRESS(U8500_CLKRST1_BASE + |
| 575 | PRCC_K_SOFTRST_SET); |
| 576 | prcc_rst_clr = (void __iomem *)IO_ADDRESS(U8500_CLKRST1_BASE + |
| 577 | PRCC_K_SOFTRST_CLEAR); |
| 578 | |
| 579 | /* Activate soft reset PRCC_K_SOFTRST_CLEAR */ |
| 580 | writel((readl(prcc_rst_clr) | 0x1), prcc_rst_clr); |
| 581 | udelay(1); |
| 582 | |
| 583 | /* Release soft reset PRCC_K_SOFTRST_SET */ |
| 584 | writel((readl(prcc_rst_set) | 0x1), prcc_rst_set); |
| 585 | udelay(1); |
| 586 | } |
| 587 | |
| 588 | static void ux500_uart0_init(void) |
| 589 | { |
| 590 | int ret; |
| 591 | |
| 592 | ret = nmk_config_pins(mop500_pins_uart0, |
| 593 | ARRAY_SIZE(mop500_pins_uart0)); |
| 594 | if (ret < 0) |
| 595 | pr_err("pl011: uart pins_enable failed\n"); |
| 596 | } |
| 597 | |
| 598 | static void ux500_uart0_exit(void) |
| 599 | { |
| 600 | int ret; |
| 601 | |
| 602 | ret = nmk_config_pins_sleep(mop500_pins_uart0, |
| 603 | ARRAY_SIZE(mop500_pins_uart0)); |
| 604 | if (ret < 0) |
| 605 | pr_err("pl011: uart pins_disable failed\n"); |
| 606 | } |
| 607 | |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 608 | static struct amba_pl011_data uart0_plat = { |
| 609 | #ifdef CONFIG_STE_DMA40 |
| 610 | .dma_filter = stedma40_filter, |
| 611 | .dma_rx_param = &uart0_dma_cfg_rx, |
| 612 | .dma_tx_param = &uart0_dma_cfg_tx, |
| 613 | #endif |
Shreshtha Kumar Sahu | 1a7d436 | 2011-06-13 10:11:44 +0200 | [diff] [blame] | 614 | .init = ux500_uart0_init, |
| 615 | .exit = ux500_uart0_exit, |
| 616 | .reset = ux500_uart0_reset, |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 617 | }; |
| 618 | |
| 619 | static struct amba_pl011_data uart1_plat = { |
| 620 | #ifdef CONFIG_STE_DMA40 |
| 621 | .dma_filter = stedma40_filter, |
| 622 | .dma_rx_param = &uart1_dma_cfg_rx, |
| 623 | .dma_tx_param = &uart1_dma_cfg_tx, |
| 624 | #endif |
| 625 | }; |
| 626 | |
| 627 | static struct amba_pl011_data uart2_plat = { |
| 628 | #ifdef CONFIG_STE_DMA40 |
| 629 | .dma_filter = stedma40_filter, |
| 630 | .dma_rx_param = &uart2_dma_cfg_rx, |
| 631 | .dma_tx_param = &uart2_dma_cfg_tx, |
| 632 | #endif |
| 633 | }; |
| 634 | |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 635 | static void __init mop500_uart_init(struct device *parent) |
Rabin Vincent | fbf1ead | 2010-09-29 19:46:32 +0530 | [diff] [blame] | 636 | { |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 637 | db8500_add_uart0(parent, &uart0_plat); |
| 638 | db8500_add_uart1(parent, &uart1_plat); |
| 639 | db8500_add_uart2(parent, &uart2_plat); |
Rabin Vincent | fbf1ead | 2010-09-29 19:46:32 +0530 | [diff] [blame] | 640 | } |
| 641 | |
Andreas Westin | 585d188 | 2012-05-10 10:14:06 +0200 | [diff] [blame^] | 642 | static void __init u8500_cryp1_hash1_init(struct device *parent) |
| 643 | { |
| 644 | db8500_add_cryp1(parent, &u8500_cryp1_platform_data); |
| 645 | db8500_add_hash1(parent, &u8500_hash1_platform_data); |
| 646 | } |
| 647 | |
Robert Marklund | 350abe0 | 2011-06-20 15:55:46 +0200 | [diff] [blame] | 648 | static struct platform_device *snowball_platform_devs[] __initdata = { |
| 649 | &snowball_led_dev, |
| 650 | &snowball_key_dev, |
| 651 | &snowball_sbnet_dev, |
| 652 | &ab8500_device, |
| 653 | }; |
| 654 | |
Linus Walleij | 4b4f757 | 2011-02-15 15:01:35 +0100 | [diff] [blame] | 655 | static void __init mop500_init_machine(void) |
Srinidhi Kasagar | aa44ef4 | 2009-11-28 08:17:18 +0100 | [diff] [blame] | 656 | { |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 657 | struct device *parent = NULL; |
Linus Walleij | cf568c5 | 2011-03-30 14:31:42 +0200 | [diff] [blame] | 658 | int i2c0_devs; |
Lee Jones | b024a0c | 2012-02-06 11:22:25 -0800 | [diff] [blame] | 659 | int i; |
Linus Walleij | cf568c5 | 2011-03-30 14:31:42 +0200 | [diff] [blame] | 660 | |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +0100 | [diff] [blame] | 661 | mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR; |
Linus Walleij | 4b4f757 | 2011-02-15 15:01:35 +0100 | [diff] [blame] | 662 | |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 663 | parent = u8500_init_devices(); |
Rabin Vincent | ea05a57 | 2010-06-03 07:58:42 +0100 | [diff] [blame] | 664 | |
Rabin Vincent | fe05203 | 2011-02-11 17:07:21 -0700 | [diff] [blame] | 665 | mop500_pins_init(); |
Rabin Vincent | ea05a57 | 2010-06-03 07:58:42 +0100 | [diff] [blame] | 666 | |
Lee Jones | b024a0c | 2012-02-06 11:22:25 -0800 | [diff] [blame] | 667 | for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++) |
| 668 | mop500_platform_devs[i]->dev.parent = parent; |
| 669 | |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +0100 | [diff] [blame] | 670 | platform_add_devices(mop500_platform_devs, |
| 671 | ARRAY_SIZE(mop500_platform_devs)); |
Srinidhi Kasagar | d48a41c | 2010-02-03 13:02:48 +0100 | [diff] [blame] | 672 | |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 673 | mop500_i2c_init(parent); |
| 674 | mop500_sdi_init(parent); |
| 675 | mop500_spi_init(parent); |
| 676 | mop500_uart_init(parent); |
Hanumath Prasad | 008f8a2 | 2010-08-19 12:06:32 +0100 | [diff] [blame] | 677 | |
Andreas Westin | 585d188 | 2012-05-10 10:14:06 +0200 | [diff] [blame^] | 678 | u8500_cryp1_hash1_init(parent); |
| 679 | |
Linus Walleij | cf568c5 | 2011-03-30 14:31:42 +0200 | [diff] [blame] | 680 | i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices); |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +0100 | [diff] [blame] | 681 | |
| 682 | i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs); |
| 683 | i2c_register_board_info(2, mop500_i2c2_devices, |
| 684 | ARRAY_SIZE(mop500_i2c2_devices)); |
| 685 | |
| 686 | /* This board has full regulator constraints */ |
| 687 | regulator_has_full_constraints(); |
| 688 | } |
| 689 | |
| 690 | static void __init snowball_init_machine(void) |
| 691 | { |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 692 | struct device *parent = NULL; |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +0100 | [diff] [blame] | 693 | int i2c0_devs; |
Lee Jones | b024a0c | 2012-02-06 11:22:25 -0800 | [diff] [blame] | 694 | int i; |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +0100 | [diff] [blame] | 695 | |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 696 | parent = u8500_init_devices(); |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +0100 | [diff] [blame] | 697 | |
| 698 | snowball_pins_init(); |
| 699 | |
Lee Jones | b024a0c | 2012-02-06 11:22:25 -0800 | [diff] [blame] | 700 | for (i = 0; i < ARRAY_SIZE(snowball_platform_devs); i++) |
| 701 | snowball_platform_devs[i]->dev.parent = parent; |
| 702 | |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +0100 | [diff] [blame] | 703 | platform_add_devices(snowball_platform_devs, |
| 704 | ARRAY_SIZE(snowball_platform_devs)); |
| 705 | |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 706 | mop500_i2c_init(parent); |
| 707 | snowball_sdi_init(parent); |
| 708 | mop500_spi_init(parent); |
| 709 | mop500_uart_init(parent); |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +0100 | [diff] [blame] | 710 | |
| 711 | i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices); |
| 712 | i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs); |
| 713 | i2c_register_board_info(2, mop500_i2c2_devices, |
| 714 | ARRAY_SIZE(mop500_i2c2_devices)); |
| 715 | |
| 716 | /* This board has full regulator constraints */ |
| 717 | regulator_has_full_constraints(); |
| 718 | } |
| 719 | |
| 720 | static void __init hrefv60_init_machine(void) |
| 721 | { |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 722 | struct device *parent = NULL; |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +0100 | [diff] [blame] | 723 | int i2c0_devs; |
Lee Jones | b024a0c | 2012-02-06 11:22:25 -0800 | [diff] [blame] | 724 | int i; |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +0100 | [diff] [blame] | 725 | |
| 726 | /* |
| 727 | * The HREFv60 board removed a GPIO expander and routed |
| 728 | * all these GPIO pins to the internal GPIO controller |
| 729 | * instead. |
| 730 | */ |
| 731 | mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO; |
| 732 | |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 733 | parent = u8500_init_devices(); |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +0100 | [diff] [blame] | 734 | |
| 735 | hrefv60_pins_init(); |
| 736 | |
Lee Jones | b024a0c | 2012-02-06 11:22:25 -0800 | [diff] [blame] | 737 | for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++) |
| 738 | mop500_platform_devs[i]->dev.parent = parent; |
| 739 | |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +0100 | [diff] [blame] | 740 | platform_add_devices(mop500_platform_devs, |
| 741 | ARRAY_SIZE(mop500_platform_devs)); |
| 742 | |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 743 | mop500_i2c_init(parent); |
| 744 | hrefv60_sdi_init(parent); |
| 745 | mop500_spi_init(parent); |
| 746 | mop500_uart_init(parent); |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +0100 | [diff] [blame] | 747 | |
| 748 | i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices); |
| 749 | |
| 750 | i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES; |
Linus Walleij | cf568c5 | 2011-03-30 14:31:42 +0200 | [diff] [blame] | 751 | |
| 752 | i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs); |
Philippe Langlais | dd7b2a0 | 2011-01-12 11:26:20 +0100 | [diff] [blame] | 753 | i2c_register_board_info(2, mop500_i2c2_devices, |
| 754 | ARRAY_SIZE(mop500_i2c2_devices)); |
Linus Walleij | db24520 | 2011-04-04 10:44:51 +0200 | [diff] [blame] | 755 | |
| 756 | /* This board has full regulator constraints */ |
| 757 | regulator_has_full_constraints(); |
Srinidhi Kasagar | aa44ef4 | 2009-11-28 08:17:18 +0100 | [diff] [blame] | 758 | } |
| 759 | |
| 760 | MACHINE_START(U8500, "ST-Ericsson MOP500 platform") |
| 761 | /* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */ |
Nicolas Pitre | bc77b1a | 2011-07-05 22:38:18 -0400 | [diff] [blame] | 762 | .atag_offset = 0x100, |
Srinidhi Kasagar | aa44ef4 | 2009-11-28 08:17:18 +0100 | [diff] [blame] | 763 | .map_io = u8500_map_io, |
Rabin Vincent | 178980f | 2010-05-03 07:39:02 +0100 | [diff] [blame] | 764 | .init_irq = ux500_init_irq, |
Srinidhi Kasagar | aa44ef4 | 2009-11-28 08:17:18 +0100 | [diff] [blame] | 765 | /* we re-use nomadik timer here */ |
Rabin Vincent | 41ac329 | 2010-05-03 08:28:05 +0100 | [diff] [blame] | 766 | .timer = &ux500_timer, |
Marc Zyngier | bbf5f38 | 2011-09-06 10:23:45 +0100 | [diff] [blame] | 767 | .handle_irq = gic_handle_irq, |
Linus Walleij | 4b4f757 | 2011-02-15 15:01:35 +0100 | [diff] [blame] | 768 | .init_machine = mop500_init_machine, |
| 769 | MACHINE_END |
| 770 | |
| 771 | MACHINE_START(HREFV60, "ST-Ericsson U8500 Platform HREFv60+") |
Nicolas Pitre | bc77b1a | 2011-07-05 22:38:18 -0400 | [diff] [blame] | 772 | .atag_offset = 0x100, |
Linus Walleij | 4b4f757 | 2011-02-15 15:01:35 +0100 | [diff] [blame] | 773 | .map_io = u8500_map_io, |
| 774 | .init_irq = ux500_init_irq, |
| 775 | .timer = &ux500_timer, |
Marc Zyngier | bbf5f38 | 2011-09-06 10:23:45 +0100 | [diff] [blame] | 776 | .handle_irq = gic_handle_irq, |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +0100 | [diff] [blame] | 777 | .init_machine = hrefv60_init_machine, |
Srinidhi Kasagar | aa44ef4 | 2009-11-28 08:17:18 +0100 | [diff] [blame] | 778 | MACHINE_END |
Robert Marklund | 350abe0 | 2011-06-20 15:55:46 +0200 | [diff] [blame] | 779 | |
| 780 | MACHINE_START(SNOWBALL, "Calao Systems Snowball platform") |
Nicolas Pitre | bc77b1a | 2011-07-05 22:38:18 -0400 | [diff] [blame] | 781 | .atag_offset = 0x100, |
Robert Marklund | 350abe0 | 2011-06-20 15:55:46 +0200 | [diff] [blame] | 782 | .map_io = u8500_map_io, |
| 783 | .init_irq = ux500_init_irq, |
| 784 | /* we re-use nomadik timer here */ |
| 785 | .timer = &ux500_timer, |
Marc Zyngier | bbf5f38 | 2011-09-06 10:23:45 +0100 | [diff] [blame] | 786 | .handle_irq = gic_handle_irq, |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +0100 | [diff] [blame] | 787 | .init_machine = snowball_init_machine, |
Robert Marklund | 350abe0 | 2011-06-20 15:55:46 +0200 | [diff] [blame] | 788 | MACHINE_END |