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