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> |
Alessandro Rubini | af97bac | 2012-06-11 22:56:26 +0200 | [diff] [blame] | 18 | #include <linux/platform_data/i2c-nomadik.h> |
Rabin Vincent | ea05a57 | 2010-06-03 07:58:42 +0100 | [diff] [blame] | 19 | #include <linux/gpio.h> |
Srinidhi Kasagar | aa44ef4 | 2009-11-28 08:17:18 +0100 | [diff] [blame] | 20 | #include <linux/amba/bus.h> |
| 21 | #include <linux/amba/pl022.h> |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 22 | #include <linux/amba/serial.h> |
Srinidhi Kasagar | aa44ef4 | 2009-11-28 08:17:18 +0100 | [diff] [blame] | 23 | #include <linux/spi/spi.h> |
Linus Walleij | ee66e65 | 2011-12-02 14:16:33 +0100 | [diff] [blame] | 24 | #include <linux/mfd/abx500/ab8500.h> |
Bengt Jonsson | 79568b94 | 2011-03-11 11:54:46 +0100 | [diff] [blame] | 25 | #include <linux/regulator/ab8500.h> |
Sundar Iyer | 20406eb | 2010-12-13 09:33:14 +0530 | [diff] [blame] | 26 | #include <linux/mfd/tc3589x.h> |
Linus Walleij | fe67dfc8 | 2011-03-07 11:48:15 +0100 | [diff] [blame] | 27 | #include <linux/mfd/tps6105x.h> |
Linus Walleij | ee66e65 | 2011-12-02 14:16:33 +0100 | [diff] [blame] | 28 | #include <linux/mfd/abx500/ab8500-gpio.h> |
Ola Lilja | f242e50 | 2012-06-07 14:00:46 +0200 | [diff] [blame] | 29 | #include <linux/mfd/abx500/ab8500-codec.h> |
Philippe Langlais | dd7b2a0 | 2011-01-12 11:26:20 +0100 | [diff] [blame] | 30 | #include <linux/leds-lp5521.h> |
Philippe Langlais | a71b819 | 2011-01-14 10:53:59 +0100 | [diff] [blame] | 31 | #include <linux/input.h> |
Robert Marklund | 350abe0 | 2011-06-20 15:55:46 +0200 | [diff] [blame] | 32 | #include <linux/smsc911x.h> |
Philippe Langlais | a71b819 | 2011-01-14 10:53:59 +0100 | [diff] [blame] | 33 | #include <linux/gpio_keys.h> |
Shreshtha Kumar Sahu | 1a7d436 | 2011-06-13 10:11:44 +0200 | [diff] [blame] | 34 | #include <linux/delay.h> |
Arnd Bergmann | 2d33429 | 2012-03-07 15:04:07 +0000 | [diff] [blame] | 35 | #include <linux/of.h> |
| 36 | #include <linux/of_platform.h> |
Robert Marklund | 350abe0 | 2011-06-20 15:55:46 +0200 | [diff] [blame] | 37 | #include <linux/leds.h> |
Linus Walleij | a098066 | 2012-05-07 01:33:24 +0200 | [diff] [blame] | 38 | #include <linux/pinctrl/consumer.h> |
| 39 | |
Srinidhi Kasagar | aa44ef4 | 2009-11-28 08:17:18 +0100 | [diff] [blame] | 40 | #include <asm/mach-types.h> |
| 41 | #include <asm/mach/arch.h> |
Marc Zyngier | bbf5f38 | 2011-09-06 10:23:45 +0100 | [diff] [blame] | 42 | #include <asm/hardware/gic.h> |
Srinidhi Kasagar | aa44ef4 | 2009-11-28 08:17:18 +0100 | [diff] [blame] | 43 | |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 44 | #include <plat/ste_dma40.h> |
Linus Walleij | 0f33286 | 2011-08-22 08:33:30 +0100 | [diff] [blame] | 45 | #include <plat/gpio-nomadik.h> |
Srinidhi Kasagar | aa44ef4 | 2009-11-28 08:17:18 +0100 | [diff] [blame] | 46 | |
| 47 | #include <mach/hardware.h> |
| 48 | #include <mach/setup.h> |
Rabin Vincent | 9e4e7fe | 2010-05-03 08:03:52 +0100 | [diff] [blame] | 49 | #include <mach/devices.h> |
Linus Walleij | 29aeb3c | 2010-09-06 22:15:08 +0100 | [diff] [blame] | 50 | #include <mach/irqs.h> |
Andreas Westin | 585d188 | 2012-05-10 10:14:06 +0200 | [diff] [blame] | 51 | #include <mach/crypto-ux500.h> |
Srinidhi Kasagar | aa44ef4 | 2009-11-28 08:17:18 +0100 | [diff] [blame] | 52 | |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 53 | #include "ste-dma40-db8500.h" |
Rabin Vincent | fbf1ead | 2010-09-29 19:46:32 +0530 | [diff] [blame] | 54 | #include "devices-db8500.h" |
Hanumath Prasad | 008f8a2 | 2010-08-19 12:06:32 +0100 | [diff] [blame] | 55 | #include "board-mop500.h" |
Bengt Jonsson | a1e516e | 2010-12-10 11:08:48 +0100 | [diff] [blame] | 56 | #include "board-mop500-regulators.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", |
Lee Jones | c525f07 | 2012-05-02 09:20:37 +0100 | [diff] [blame] | 61 | .default_trigger = "heartbeat", |
Robert Marklund | 350abe0 | 2011-06-20 15:55:46 +0200 | [diff] [blame] | 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 | |
Ola Lilja | f242e50 | 2012-06-07 14:00:46 +0200 | [diff] [blame] | 100 | /* ab8500-codec */ |
| 101 | static struct ab8500_codec_platform_data ab8500_codec_pdata = { |
| 102 | .amics = { |
| 103 | .mic1_type = AMIC_TYPE_DIFFERENTIAL, |
| 104 | .mic2_type = AMIC_TYPE_DIFFERENTIAL, |
| 105 | .mic1a_micbias = AMIC_MICBIAS_VAMIC1, |
| 106 | .mic1b_micbias = AMIC_MICBIAS_VAMIC1, |
| 107 | .mic2_micbias = AMIC_MICBIAS_VAMIC2 |
| 108 | }, |
| 109 | .ear_cmv = EAR_CMV_0_95V |
| 110 | }; |
| 111 | |
Robert Marklund | 350abe0 | 2011-06-20 15:55:46 +0200 | [diff] [blame] | 112 | static struct gpio_keys_button snowball_key_array[] = { |
| 113 | { |
| 114 | .gpio = 32, |
| 115 | .type = EV_KEY, |
| 116 | .code = KEY_1, |
| 117 | .desc = "userpb", |
| 118 | .active_low = 1, |
| 119 | .debounce_interval = 50, |
| 120 | .wakeup = 1, |
| 121 | }, |
| 122 | { |
| 123 | .gpio = 151, |
| 124 | .type = EV_KEY, |
| 125 | .code = KEY_2, |
| 126 | .desc = "extkb1", |
| 127 | .active_low = 1, |
| 128 | .debounce_interval = 50, |
| 129 | .wakeup = 1, |
| 130 | }, |
| 131 | { |
| 132 | .gpio = 152, |
| 133 | .type = EV_KEY, |
| 134 | .code = KEY_3, |
| 135 | .desc = "extkb2", |
| 136 | .active_low = 1, |
| 137 | .debounce_interval = 50, |
| 138 | .wakeup = 1, |
| 139 | }, |
| 140 | { |
| 141 | .gpio = 161, |
| 142 | .type = EV_KEY, |
| 143 | .code = KEY_4, |
| 144 | .desc = "extkb3", |
| 145 | .active_low = 1, |
| 146 | .debounce_interval = 50, |
| 147 | .wakeup = 1, |
| 148 | }, |
| 149 | { |
| 150 | .gpio = 162, |
| 151 | .type = EV_KEY, |
| 152 | .code = KEY_5, |
| 153 | .desc = "extkb4", |
| 154 | .active_low = 1, |
| 155 | .debounce_interval = 50, |
| 156 | .wakeup = 1, |
| 157 | }, |
| 158 | }; |
| 159 | |
| 160 | static struct gpio_keys_platform_data snowball_key_data = { |
| 161 | .buttons = snowball_key_array, |
| 162 | .nbuttons = ARRAY_SIZE(snowball_key_array), |
| 163 | }; |
| 164 | |
| 165 | static struct platform_device snowball_key_dev = { |
| 166 | .name = "gpio-keys", |
| 167 | .id = -1, |
| 168 | .dev = { |
| 169 | .platform_data = &snowball_key_data, |
| 170 | } |
| 171 | }; |
| 172 | |
| 173 | static struct smsc911x_platform_config snowball_sbnet_cfg = { |
| 174 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH, |
| 175 | .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, |
| 176 | .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY, |
| 177 | .shift = 1, |
| 178 | }; |
| 179 | |
| 180 | static struct resource sbnet_res[] = { |
| 181 | { |
| 182 | .name = "smsc911x-memory", |
| 183 | .start = (0x5000 << 16), |
| 184 | .end = (0x5000 << 16) + 0xffff, |
| 185 | .flags = IORESOURCE_MEM, |
| 186 | }, |
| 187 | { |
| 188 | .start = NOMADIK_GPIO_TO_IRQ(140), |
| 189 | .end = NOMADIK_GPIO_TO_IRQ(140), |
| 190 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, |
| 191 | }, |
| 192 | }; |
| 193 | |
| 194 | static struct platform_device snowball_sbnet_dev = { |
| 195 | .name = "smsc911x", |
| 196 | .num_resources = ARRAY_SIZE(sbnet_res), |
| 197 | .resource = sbnet_res, |
| 198 | .dev = { |
| 199 | .platform_data = &snowball_sbnet_cfg, |
| 200 | }, |
| 201 | }; |
| 202 | |
Rabin Vincent | 39ae702 | 2010-07-26 11:12:15 +0100 | [diff] [blame] | 203 | static struct ab8500_platform_data ab8500_platdata = { |
| 204 | .irq_base = MOP500_AB8500_IRQ_BASE, |
Bengt Jonsson | dfa3a82 | 2011-03-09 13:34:17 +0100 | [diff] [blame] | 205 | .regulator_reg_init = ab8500_regulator_reg_init, |
| 206 | .num_regulator_reg_init = ARRAY_SIZE(ab8500_regulator_reg_init), |
Bengt Jonsson | a1e516e | 2010-12-10 11:08:48 +0100 | [diff] [blame] | 207 | .regulator = ab8500_regulators, |
| 208 | .num_regulator = ARRAY_SIZE(ab8500_regulators), |
Bibek Basu | 3ef374a | 2011-02-15 12:56:16 +0530 | [diff] [blame] | 209 | .gpio = &ab8500_gpio_pdata, |
Ola Lilja | f242e50 | 2012-06-07 14:00:46 +0200 | [diff] [blame] | 210 | .codec = &ab8500_codec_pdata, |
Rabin Vincent | 39ae702 | 2010-07-26 11:12:15 +0100 | [diff] [blame] | 211 | }; |
| 212 | |
Rabin Vincent | b8410a1 | 2010-08-09 19:18:17 +0530 | [diff] [blame] | 213 | /* |
Linus Walleij | fe67dfc8 | 2011-03-07 11:48:15 +0100 | [diff] [blame] | 214 | * TPS61052 |
| 215 | */ |
| 216 | |
| 217 | static struct tps6105x_platform_data mop500_tps61052_data = { |
| 218 | .mode = TPS6105X_MODE_VOLTAGE, |
| 219 | .regulator_data = &tps61052_regulator, |
| 220 | }; |
| 221 | |
| 222 | /* |
Rabin Vincent | b8410a1 | 2010-08-09 19:18:17 +0530 | [diff] [blame] | 223 | * TC35892 |
| 224 | */ |
| 225 | |
Sundar Iyer | 20406eb | 2010-12-13 09:33:14 +0530 | [diff] [blame] | 226 | static void mop500_tc35892_init(struct tc3589x *tc3589x, unsigned int base) |
Rabin Vincent | b8410a1 | 2010-08-09 19:18:17 +0530 | [diff] [blame] | 227 | { |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 228 | struct device *parent = NULL; |
| 229 | #if 0 |
| 230 | /* FIXME: Is the sdi actually part of tc3589x? */ |
| 231 | parent = tc3589x->dev; |
| 232 | #endif |
| 233 | mop500_sdi_tc35892_init(parent); |
Rabin Vincent | b8410a1 | 2010-08-09 19:18:17 +0530 | [diff] [blame] | 234 | } |
| 235 | |
Sundar Iyer | 20406eb | 2010-12-13 09:33:14 +0530 | [diff] [blame] | 236 | static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = { |
Rabin Vincent | b8410a1 | 2010-08-09 19:18:17 +0530 | [diff] [blame] | 237 | .gpio_base = MOP500_EGPIO(0), |
| 238 | .setup = mop500_tc35892_init, |
| 239 | }; |
| 240 | |
Sundar Iyer | 20406eb | 2010-12-13 09:33:14 +0530 | [diff] [blame] | 241 | static struct tc3589x_platform_data mop500_tc35892_data = { |
Sundar Iyer | 611b759 | 2010-12-13 09:33:15 +0530 | [diff] [blame] | 242 | .block = TC3589x_BLOCK_GPIO, |
Rabin Vincent | b8410a1 | 2010-08-09 19:18:17 +0530 | [diff] [blame] | 243 | .gpio = &mop500_tc35892_gpio_data, |
| 244 | .irq_base = MOP500_EGPIO_IRQ_BASE, |
| 245 | }; |
| 246 | |
Philippe Langlais | dd7b2a0 | 2011-01-12 11:26:20 +0100 | [diff] [blame] | 247 | static struct lp5521_led_config lp5521_pri_led[] = { |
| 248 | [0] = { |
| 249 | .chan_nr = 0, |
| 250 | .led_current = 0x2f, |
| 251 | .max_current = 0x5f, |
| 252 | }, |
| 253 | [1] = { |
| 254 | .chan_nr = 1, |
| 255 | .led_current = 0x2f, |
| 256 | .max_current = 0x5f, |
| 257 | }, |
| 258 | [2] = { |
| 259 | .chan_nr = 2, |
| 260 | .led_current = 0x2f, |
| 261 | .max_current = 0x5f, |
| 262 | }, |
| 263 | }; |
| 264 | |
| 265 | static struct lp5521_platform_data __initdata lp5521_pri_data = { |
| 266 | .label = "lp5521_pri", |
| 267 | .led_config = &lp5521_pri_led[0], |
| 268 | .num_channels = 3, |
| 269 | .clock_mode = LP5521_CLOCK_EXT, |
| 270 | }; |
| 271 | |
| 272 | static struct lp5521_led_config lp5521_sec_led[] = { |
| 273 | [0] = { |
| 274 | .chan_nr = 0, |
| 275 | .led_current = 0x2f, |
| 276 | .max_current = 0x5f, |
| 277 | }, |
| 278 | [1] = { |
| 279 | .chan_nr = 1, |
| 280 | .led_current = 0x2f, |
| 281 | .max_current = 0x5f, |
| 282 | }, |
| 283 | [2] = { |
| 284 | .chan_nr = 2, |
| 285 | .led_current = 0x2f, |
| 286 | .max_current = 0x5f, |
| 287 | }, |
| 288 | }; |
| 289 | |
| 290 | static struct lp5521_platform_data __initdata lp5521_sec_data = { |
| 291 | .label = "lp5521_sec", |
| 292 | .led_config = &lp5521_sec_led[0], |
| 293 | .num_channels = 3, |
| 294 | .clock_mode = LP5521_CLOCK_EXT, |
| 295 | }; |
| 296 | |
Linus Walleij | fe67dfc8 | 2011-03-07 11:48:15 +0100 | [diff] [blame] | 297 | static struct i2c_board_info __initdata mop500_i2c0_devices[] = { |
Rabin Vincent | b8410a1 | 2010-08-09 19:18:17 +0530 | [diff] [blame] | 298 | { |
Sundar Iyer | 20406eb | 2010-12-13 09:33:14 +0530 | [diff] [blame] | 299 | I2C_BOARD_INFO("tc3589x", 0x42), |
Philippe Langlais | dd7b2a0 | 2011-01-12 11:26:20 +0100 | [diff] [blame] | 300 | .irq = NOMADIK_GPIO_TO_IRQ(217), |
Rabin Vincent | b8410a1 | 2010-08-09 19:18:17 +0530 | [diff] [blame] | 301 | .platform_data = &mop500_tc35892_data, |
| 302 | }, |
Linus Walleij | cf568c5 | 2011-03-30 14:31:42 +0200 | [diff] [blame] | 303 | /* I2C0 devices only available prior to HREFv60 */ |
Linus Walleij | fe67dfc8 | 2011-03-07 11:48:15 +0100 | [diff] [blame] | 304 | { |
| 305 | I2C_BOARD_INFO("tps61052", 0x33), |
| 306 | .platform_data = &mop500_tps61052_data, |
| 307 | }, |
| 308 | }; |
| 309 | |
Linus Walleij | cf568c5 | 2011-03-30 14:31:42 +0200 | [diff] [blame] | 310 | #define NUM_PRE_V60_I2C0_DEVICES 1 |
| 311 | |
Philippe Langlais | dd7b2a0 | 2011-01-12 11:26:20 +0100 | [diff] [blame] | 312 | static struct i2c_board_info __initdata mop500_i2c2_devices[] = { |
| 313 | { |
| 314 | /* lp5521 LED driver, 1st device */ |
| 315 | I2C_BOARD_INFO("lp5521", 0x33), |
| 316 | .platform_data = &lp5521_pri_data, |
| 317 | }, |
| 318 | { |
| 319 | /* lp5521 LED driver, 2st device */ |
| 320 | I2C_BOARD_INFO("lp5521", 0x34), |
| 321 | .platform_data = &lp5521_sec_data, |
| 322 | }, |
Lee Jones | bb3b218 | 2011-01-13 14:41:22 +0000 | [diff] [blame] | 323 | { |
| 324 | /* Light sensor Rohm BH1780GLI */ |
| 325 | I2C_BOARD_INFO("bh1780", 0x29), |
| 326 | }, |
Philippe Langlais | dd7b2a0 | 2011-01-12 11:26:20 +0100 | [diff] [blame] | 327 | }; |
| 328 | |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 329 | static void __init mop500_i2c_init(struct device *parent) |
Rabin Vincent | fbf1ead | 2010-09-29 19:46:32 +0530 | [diff] [blame] | 330 | { |
Lee Jones | 98582d9 | 2012-04-17 15:52:26 +0100 | [diff] [blame] | 331 | db8500_add_i2c0(parent, NULL); |
| 332 | db8500_add_i2c1(parent, NULL); |
| 333 | db8500_add_i2c2(parent, NULL); |
| 334 | db8500_add_i2c3(parent, NULL); |
Rabin Vincent | fbf1ead | 2010-09-29 19:46:32 +0530 | [diff] [blame] | 335 | } |
Srinidhi Kasagar | aa44ef4 | 2009-11-28 08:17:18 +0100 | [diff] [blame] | 336 | |
Philippe Langlais | a71b819 | 2011-01-14 10:53:59 +0100 | [diff] [blame] | 337 | static struct gpio_keys_button mop500_gpio_keys[] = { |
| 338 | { |
| 339 | .desc = "SFH7741 Proximity Sensor", |
| 340 | .type = EV_SW, |
| 341 | .code = SW_FRONT_PROXIMITY, |
Philippe Langlais | a71b819 | 2011-01-14 10:53:59 +0100 | [diff] [blame] | 342 | .active_low = 0, |
| 343 | .can_disable = 1, |
| 344 | } |
| 345 | }; |
| 346 | |
| 347 | static struct regulator *prox_regulator; |
| 348 | static int mop500_prox_activate(struct device *dev); |
| 349 | static void mop500_prox_deactivate(struct device *dev); |
| 350 | |
| 351 | static struct gpio_keys_platform_data mop500_gpio_keys_data = { |
| 352 | .buttons = mop500_gpio_keys, |
| 353 | .nbuttons = ARRAY_SIZE(mop500_gpio_keys), |
| 354 | .enable = mop500_prox_activate, |
| 355 | .disable = mop500_prox_deactivate, |
| 356 | }; |
| 357 | |
| 358 | static struct platform_device mop500_gpio_keys_device = { |
| 359 | .name = "gpio-keys", |
| 360 | .id = 0, |
| 361 | .dev = { |
| 362 | .platform_data = &mop500_gpio_keys_data, |
| 363 | }, |
| 364 | }; |
| 365 | |
| 366 | static int mop500_prox_activate(struct device *dev) |
| 367 | { |
| 368 | prox_regulator = regulator_get(&mop500_gpio_keys_device.dev, |
| 369 | "vcc"); |
| 370 | if (IS_ERR(prox_regulator)) { |
| 371 | dev_err(&mop500_gpio_keys_device.dev, |
| 372 | "no regulator\n"); |
| 373 | return PTR_ERR(prox_regulator); |
| 374 | } |
| 375 | regulator_enable(prox_regulator); |
| 376 | return 0; |
| 377 | } |
| 378 | |
| 379 | static void mop500_prox_deactivate(struct device *dev) |
| 380 | { |
| 381 | regulator_disable(prox_regulator); |
| 382 | regulator_put(prox_regulator); |
| 383 | } |
| 384 | |
Andreas Westin | 585d188 | 2012-05-10 10:14:06 +0200 | [diff] [blame] | 385 | static struct cryp_platform_data u8500_cryp1_platform_data = { |
| 386 | .mem_to_engine = { |
| 387 | .dir = STEDMA40_MEM_TO_PERIPH, |
| 388 | .src_dev_type = STEDMA40_DEV_SRC_MEMORY, |
| 389 | .dst_dev_type = DB8500_DMA_DEV48_CAC1_TX, |
| 390 | .src_info.data_width = STEDMA40_WORD_WIDTH, |
| 391 | .dst_info.data_width = STEDMA40_WORD_WIDTH, |
| 392 | .mode = STEDMA40_MODE_LOGICAL, |
| 393 | .src_info.psize = STEDMA40_PSIZE_LOG_4, |
| 394 | .dst_info.psize = STEDMA40_PSIZE_LOG_4, |
| 395 | }, |
| 396 | .engine_to_mem = { |
| 397 | .dir = STEDMA40_PERIPH_TO_MEM, |
| 398 | .src_dev_type = DB8500_DMA_DEV48_CAC1_RX, |
| 399 | .dst_dev_type = STEDMA40_DEV_DST_MEMORY, |
| 400 | .src_info.data_width = STEDMA40_WORD_WIDTH, |
| 401 | .dst_info.data_width = STEDMA40_WORD_WIDTH, |
| 402 | .mode = STEDMA40_MODE_LOGICAL, |
| 403 | .src_info.psize = STEDMA40_PSIZE_LOG_4, |
| 404 | .dst_info.psize = STEDMA40_PSIZE_LOG_4, |
| 405 | } |
| 406 | }; |
| 407 | |
| 408 | static struct stedma40_chan_cfg u8500_hash_dma_cfg_tx = { |
| 409 | .dir = STEDMA40_MEM_TO_PERIPH, |
| 410 | .src_dev_type = STEDMA40_DEV_SRC_MEMORY, |
| 411 | .dst_dev_type = DB8500_DMA_DEV50_HAC1_TX, |
| 412 | .src_info.data_width = STEDMA40_WORD_WIDTH, |
| 413 | .dst_info.data_width = STEDMA40_WORD_WIDTH, |
| 414 | .mode = STEDMA40_MODE_LOGICAL, |
| 415 | .src_info.psize = STEDMA40_PSIZE_LOG_16, |
| 416 | .dst_info.psize = STEDMA40_PSIZE_LOG_16, |
| 417 | }; |
| 418 | |
| 419 | static struct hash_platform_data u8500_hash1_platform_data = { |
| 420 | .mem_to_engine = &u8500_hash_dma_cfg_tx, |
| 421 | .dma_filter = stedma40_filter, |
| 422 | }; |
| 423 | |
Srinidhi Kasagar | d48a41c | 2010-02-03 13:02:48 +0100 | [diff] [blame] | 424 | /* add any platform devices here - TODO */ |
Robert Marklund | 350abe0 | 2011-06-20 15:55:46 +0200 | [diff] [blame] | 425 | static struct platform_device *mop500_platform_devs[] __initdata = { |
Philippe Langlais | a71b819 | 2011-01-14 10:53:59 +0100 | [diff] [blame] | 426 | &mop500_gpio_keys_device, |
Srinidhi Kasagar | d48a41c | 2010-02-03 13:02:48 +0100 | [diff] [blame] | 427 | }; |
| 428 | |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 429 | #ifdef CONFIG_STE_DMA40 |
| 430 | static struct stedma40_chan_cfg ssp0_dma_cfg_rx = { |
| 431 | .mode = STEDMA40_MODE_LOGICAL, |
| 432 | .dir = STEDMA40_PERIPH_TO_MEM, |
| 433 | .src_dev_type = DB8500_DMA_DEV8_SSP0_RX, |
| 434 | .dst_dev_type = STEDMA40_DEV_DST_MEMORY, |
| 435 | .src_info.data_width = STEDMA40_BYTE_WIDTH, |
| 436 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, |
| 437 | }; |
| 438 | |
| 439 | static struct stedma40_chan_cfg ssp0_dma_cfg_tx = { |
| 440 | .mode = STEDMA40_MODE_LOGICAL, |
| 441 | .dir = STEDMA40_MEM_TO_PERIPH, |
| 442 | .src_dev_type = STEDMA40_DEV_SRC_MEMORY, |
| 443 | .dst_dev_type = DB8500_DMA_DEV8_SSP0_TX, |
| 444 | .src_info.data_width = STEDMA40_BYTE_WIDTH, |
| 445 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, |
| 446 | }; |
| 447 | #endif |
| 448 | |
Lee Jones | 15daf69 | 2012-03-15 16:47:11 +0000 | [diff] [blame] | 449 | static struct pl022_ssp_controller ssp0_plat = { |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 450 | .bus_id = 0, |
| 451 | #ifdef CONFIG_STE_DMA40 |
| 452 | .enable_dma = 1, |
| 453 | .dma_filter = stedma40_filter, |
| 454 | .dma_rx_param = &ssp0_dma_cfg_rx, |
| 455 | .dma_tx_param = &ssp0_dma_cfg_tx, |
| 456 | #else |
| 457 | .enable_dma = 0, |
| 458 | #endif |
| 459 | /* on this platform, gpio 31,142,144,214 & |
| 460 | * 224 are connected as chip selects |
| 461 | */ |
| 462 | .num_chipselect = 5, |
| 463 | }; |
| 464 | |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 465 | static void __init mop500_spi_init(struct device *parent) |
Rabin Vincent | fbf1ead | 2010-09-29 19:46:32 +0530 | [diff] [blame] | 466 | { |
Lee Jones | 15daf69 | 2012-03-15 16:47:11 +0000 | [diff] [blame] | 467 | db8500_add_ssp0(parent, &ssp0_plat); |
Rabin Vincent | fbf1ead | 2010-09-29 19:46:32 +0530 | [diff] [blame] | 468 | } |
| 469 | |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 470 | #ifdef CONFIG_STE_DMA40 |
| 471 | static struct stedma40_chan_cfg uart0_dma_cfg_rx = { |
| 472 | .mode = STEDMA40_MODE_LOGICAL, |
| 473 | .dir = STEDMA40_PERIPH_TO_MEM, |
| 474 | .src_dev_type = DB8500_DMA_DEV13_UART0_RX, |
| 475 | .dst_dev_type = STEDMA40_DEV_DST_MEMORY, |
| 476 | .src_info.data_width = STEDMA40_BYTE_WIDTH, |
| 477 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, |
| 478 | }; |
| 479 | |
| 480 | static struct stedma40_chan_cfg uart0_dma_cfg_tx = { |
| 481 | .mode = STEDMA40_MODE_LOGICAL, |
| 482 | .dir = STEDMA40_MEM_TO_PERIPH, |
| 483 | .src_dev_type = STEDMA40_DEV_SRC_MEMORY, |
| 484 | .dst_dev_type = DB8500_DMA_DEV13_UART0_TX, |
| 485 | .src_info.data_width = STEDMA40_BYTE_WIDTH, |
| 486 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, |
| 487 | }; |
| 488 | |
| 489 | static struct stedma40_chan_cfg uart1_dma_cfg_rx = { |
| 490 | .mode = STEDMA40_MODE_LOGICAL, |
| 491 | .dir = STEDMA40_PERIPH_TO_MEM, |
| 492 | .src_dev_type = DB8500_DMA_DEV12_UART1_RX, |
| 493 | .dst_dev_type = STEDMA40_DEV_DST_MEMORY, |
| 494 | .src_info.data_width = STEDMA40_BYTE_WIDTH, |
| 495 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, |
| 496 | }; |
| 497 | |
| 498 | static struct stedma40_chan_cfg uart1_dma_cfg_tx = { |
| 499 | .mode = STEDMA40_MODE_LOGICAL, |
| 500 | .dir = STEDMA40_MEM_TO_PERIPH, |
| 501 | .src_dev_type = STEDMA40_DEV_SRC_MEMORY, |
| 502 | .dst_dev_type = DB8500_DMA_DEV12_UART1_TX, |
| 503 | .src_info.data_width = STEDMA40_BYTE_WIDTH, |
| 504 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, |
| 505 | }; |
| 506 | |
| 507 | static struct stedma40_chan_cfg uart2_dma_cfg_rx = { |
| 508 | .mode = STEDMA40_MODE_LOGICAL, |
| 509 | .dir = STEDMA40_PERIPH_TO_MEM, |
| 510 | .src_dev_type = DB8500_DMA_DEV11_UART2_RX, |
| 511 | .dst_dev_type = STEDMA40_DEV_DST_MEMORY, |
| 512 | .src_info.data_width = STEDMA40_BYTE_WIDTH, |
| 513 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, |
| 514 | }; |
| 515 | |
| 516 | static struct stedma40_chan_cfg uart2_dma_cfg_tx = { |
| 517 | .mode = STEDMA40_MODE_LOGICAL, |
| 518 | .dir = STEDMA40_MEM_TO_PERIPH, |
| 519 | .src_dev_type = STEDMA40_DEV_SRC_MEMORY, |
| 520 | .dst_dev_type = DB8500_DMA_DEV11_UART2_TX, |
| 521 | .src_info.data_width = STEDMA40_BYTE_WIDTH, |
| 522 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, |
| 523 | }; |
| 524 | #endif |
| 525 | |
Shreshtha Kumar Sahu | 1a7d436 | 2011-06-13 10:11:44 +0200 | [diff] [blame] | 526 | #define PRCC_K_SOFTRST_SET 0x18 |
| 527 | #define PRCC_K_SOFTRST_CLEAR 0x1C |
| 528 | static void ux500_uart0_reset(void) |
| 529 | { |
| 530 | void __iomem *prcc_rst_set, *prcc_rst_clr; |
| 531 | |
| 532 | prcc_rst_set = (void __iomem *)IO_ADDRESS(U8500_CLKRST1_BASE + |
| 533 | PRCC_K_SOFTRST_SET); |
| 534 | prcc_rst_clr = (void __iomem *)IO_ADDRESS(U8500_CLKRST1_BASE + |
| 535 | PRCC_K_SOFTRST_CLEAR); |
| 536 | |
| 537 | /* Activate soft reset PRCC_K_SOFTRST_CLEAR */ |
| 538 | writel((readl(prcc_rst_clr) | 0x1), prcc_rst_clr); |
| 539 | udelay(1); |
| 540 | |
| 541 | /* Release soft reset PRCC_K_SOFTRST_SET */ |
| 542 | writel((readl(prcc_rst_set) | 0x1), prcc_rst_set); |
| 543 | udelay(1); |
| 544 | } |
| 545 | |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 546 | static struct amba_pl011_data uart0_plat = { |
| 547 | #ifdef CONFIG_STE_DMA40 |
| 548 | .dma_filter = stedma40_filter, |
| 549 | .dma_rx_param = &uart0_dma_cfg_rx, |
| 550 | .dma_tx_param = &uart0_dma_cfg_tx, |
| 551 | #endif |
Shreshtha Kumar Sahu | 1a7d436 | 2011-06-13 10:11:44 +0200 | [diff] [blame] | 552 | .reset = ux500_uart0_reset, |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 553 | }; |
| 554 | |
| 555 | static struct amba_pl011_data uart1_plat = { |
| 556 | #ifdef CONFIG_STE_DMA40 |
| 557 | .dma_filter = stedma40_filter, |
| 558 | .dma_rx_param = &uart1_dma_cfg_rx, |
| 559 | .dma_tx_param = &uart1_dma_cfg_tx, |
| 560 | #endif |
| 561 | }; |
| 562 | |
| 563 | static struct amba_pl011_data uart2_plat = { |
| 564 | #ifdef CONFIG_STE_DMA40 |
| 565 | .dma_filter = stedma40_filter, |
| 566 | .dma_rx_param = &uart2_dma_cfg_rx, |
| 567 | .dma_tx_param = &uart2_dma_cfg_tx, |
| 568 | #endif |
| 569 | }; |
| 570 | |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 571 | static void __init mop500_uart_init(struct device *parent) |
Rabin Vincent | fbf1ead | 2010-09-29 19:46:32 +0530 | [diff] [blame] | 572 | { |
Linus Walleij | 78d80c5 | 2012-05-23 21:18:46 +0200 | [diff] [blame] | 573 | db8500_add_uart0(parent, &uart0_plat); |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 574 | db8500_add_uart1(parent, &uart1_plat); |
| 575 | db8500_add_uart2(parent, &uart2_plat); |
Rabin Vincent | fbf1ead | 2010-09-29 19:46:32 +0530 | [diff] [blame] | 576 | } |
| 577 | |
Andreas Westin | 585d188 | 2012-05-10 10:14:06 +0200 | [diff] [blame] | 578 | static void __init u8500_cryp1_hash1_init(struct device *parent) |
| 579 | { |
| 580 | db8500_add_cryp1(parent, &u8500_cryp1_platform_data); |
| 581 | db8500_add_hash1(parent, &u8500_hash1_platform_data); |
| 582 | } |
| 583 | |
Robert Marklund | 350abe0 | 2011-06-20 15:55:46 +0200 | [diff] [blame] | 584 | static struct platform_device *snowball_platform_devs[] __initdata = { |
| 585 | &snowball_led_dev, |
| 586 | &snowball_key_dev, |
Lee Jones | e6fada5 | 2012-05-17 13:18:36 +0100 | [diff] [blame] | 587 | &snowball_sbnet_dev, |
Robert Marklund | 350abe0 | 2011-06-20 15:55:46 +0200 | [diff] [blame] | 588 | }; |
| 589 | |
Linus Walleij | 4b4f757 | 2011-02-15 15:01:35 +0100 | [diff] [blame] | 590 | static void __init mop500_init_machine(void) |
Srinidhi Kasagar | aa44ef4 | 2009-11-28 08:17:18 +0100 | [diff] [blame] | 591 | { |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 592 | struct device *parent = NULL; |
Linus Walleij | cf568c5 | 2011-03-30 14:31:42 +0200 | [diff] [blame] | 593 | int i2c0_devs; |
Lee Jones | b024a0c | 2012-02-06 11:22:25 -0800 | [diff] [blame] | 594 | int i; |
Linus Walleij | cf568c5 | 2011-03-30 14:31:42 +0200 | [diff] [blame] | 595 | |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +0100 | [diff] [blame] | 596 | mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR; |
Linus Walleij | 4b4f757 | 2011-02-15 15:01:35 +0100 | [diff] [blame] | 597 | |
Linus Walleij | ed781d39 | 2012-05-03 00:44:52 +0200 | [diff] [blame] | 598 | mop500_pinmaps_init(); |
Lee Jones | 3a8e39c | 2012-07-06 12:46:23 +0200 | [diff] [blame] | 599 | parent = u8500_init_devices(&ab8500_platdata); |
Rabin Vincent | ea05a57 | 2010-06-03 07:58:42 +0100 | [diff] [blame] | 600 | |
Lee Jones | b024a0c | 2012-02-06 11:22:25 -0800 | [diff] [blame] | 601 | for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++) |
| 602 | mop500_platform_devs[i]->dev.parent = parent; |
| 603 | |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +0100 | [diff] [blame] | 604 | platform_add_devices(mop500_platform_devs, |
| 605 | ARRAY_SIZE(mop500_platform_devs)); |
Srinidhi Kasagar | d48a41c | 2010-02-03 13:02:48 +0100 | [diff] [blame] | 606 | |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 607 | mop500_i2c_init(parent); |
| 608 | mop500_sdi_init(parent); |
| 609 | mop500_spi_init(parent); |
Ola Lilja | c0af14d | 2012-04-20 11:32:59 +0200 | [diff] [blame] | 610 | mop500_msp_init(parent); |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 611 | mop500_uart_init(parent); |
Hanumath Prasad | 008f8a2 | 2010-08-19 12:06:32 +0100 | [diff] [blame] | 612 | |
Andreas Westin | 585d188 | 2012-05-10 10:14:06 +0200 | [diff] [blame] | 613 | u8500_cryp1_hash1_init(parent); |
| 614 | |
Linus Walleij | cf568c5 | 2011-03-30 14:31:42 +0200 | [diff] [blame] | 615 | i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices); |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +0100 | [diff] [blame] | 616 | |
| 617 | i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs); |
| 618 | i2c_register_board_info(2, mop500_i2c2_devices, |
| 619 | ARRAY_SIZE(mop500_i2c2_devices)); |
| 620 | |
| 621 | /* This board has full regulator constraints */ |
| 622 | regulator_has_full_constraints(); |
Lee Jones | fd6948b | 2012-05-02 09:53:48 +0100 | [diff] [blame] | 623 | |
| 624 | mop500_uib_init(); |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +0100 | [diff] [blame] | 625 | } |
| 626 | |
| 627 | static void __init snowball_init_machine(void) |
| 628 | { |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 629 | struct device *parent = NULL; |
Lee Jones | b024a0c | 2012-02-06 11:22:25 -0800 | [diff] [blame] | 630 | int i; |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +0100 | [diff] [blame] | 631 | |
Linus Walleij | ed781d39 | 2012-05-03 00:44:52 +0200 | [diff] [blame] | 632 | snowball_pinmaps_init(); |
Lee Jones | 3a8e39c | 2012-07-06 12:46:23 +0200 | [diff] [blame] | 633 | parent = u8500_init_devices(&ab8500_platdata); |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +0100 | [diff] [blame] | 634 | |
Lee Jones | b024a0c | 2012-02-06 11:22:25 -0800 | [diff] [blame] | 635 | for (i = 0; i < ARRAY_SIZE(snowball_platform_devs); i++) |
| 636 | snowball_platform_devs[i]->dev.parent = parent; |
| 637 | |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +0100 | [diff] [blame] | 638 | platform_add_devices(snowball_platform_devs, |
| 639 | ARRAY_SIZE(snowball_platform_devs)); |
| 640 | |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 641 | mop500_i2c_init(parent); |
| 642 | snowball_sdi_init(parent); |
| 643 | mop500_spi_init(parent); |
Ola Lilja | c0af14d | 2012-04-20 11:32:59 +0200 | [diff] [blame] | 644 | mop500_msp_init(parent); |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 645 | mop500_uart_init(parent); |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +0100 | [diff] [blame] | 646 | |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +0100 | [diff] [blame] | 647 | /* This board has full regulator constraints */ |
| 648 | regulator_has_full_constraints(); |
| 649 | } |
| 650 | |
| 651 | static void __init hrefv60_init_machine(void) |
| 652 | { |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 653 | struct device *parent = NULL; |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +0100 | [diff] [blame] | 654 | int i2c0_devs; |
Lee Jones | b024a0c | 2012-02-06 11:22:25 -0800 | [diff] [blame] | 655 | int i; |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +0100 | [diff] [blame] | 656 | |
| 657 | /* |
| 658 | * The HREFv60 board removed a GPIO expander and routed |
| 659 | * all these GPIO pins to the internal GPIO controller |
| 660 | * instead. |
| 661 | */ |
| 662 | mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO; |
| 663 | |
Linus Walleij | ed781d39 | 2012-05-03 00:44:52 +0200 | [diff] [blame] | 664 | hrefv60_pinmaps_init(); |
Lee Jones | 3a8e39c | 2012-07-06 12:46:23 +0200 | [diff] [blame] | 665 | parent = u8500_init_devices(&ab8500_platdata); |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +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)); |
| 672 | |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 673 | mop500_i2c_init(parent); |
| 674 | hrefv60_sdi_init(parent); |
| 675 | mop500_spi_init(parent); |
Ola Lilja | c0af14d | 2012-04-20 11:32:59 +0200 | [diff] [blame] | 676 | mop500_msp_init(parent); |
Lee Jones | 1840342 | 2012-02-06 11:22:21 -0800 | [diff] [blame] | 677 | mop500_uart_init(parent); |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +0100 | [diff] [blame] | 678 | |
| 679 | i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices); |
| 680 | |
| 681 | i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES; |
Linus Walleij | cf568c5 | 2011-03-30 14:31:42 +0200 | [diff] [blame] | 682 | |
| 683 | i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs); |
Philippe Langlais | dd7b2a0 | 2011-01-12 11:26:20 +0100 | [diff] [blame] | 684 | i2c_register_board_info(2, mop500_i2c2_devices, |
| 685 | ARRAY_SIZE(mop500_i2c2_devices)); |
Linus Walleij | db24520 | 2011-04-04 10:44:51 +0200 | [diff] [blame] | 686 | |
| 687 | /* This board has full regulator constraints */ |
| 688 | regulator_has_full_constraints(); |
Lee Jones | fd6948b | 2012-05-02 09:53:48 +0100 | [diff] [blame] | 689 | |
| 690 | mop500_uib_init(); |
Srinidhi Kasagar | aa44ef4 | 2009-11-28 08:17:18 +0100 | [diff] [blame] | 691 | } |
| 692 | |
| 693 | MACHINE_START(U8500, "ST-Ericsson MOP500 platform") |
| 694 | /* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */ |
Nicolas Pitre | bc77b1a | 2011-07-05 22:38:18 -0400 | [diff] [blame] | 695 | .atag_offset = 0x100, |
Srinidhi Kasagar | aa44ef4 | 2009-11-28 08:17:18 +0100 | [diff] [blame] | 696 | .map_io = u8500_map_io, |
Rabin Vincent | 178980f | 2010-05-03 07:39:02 +0100 | [diff] [blame] | 697 | .init_irq = ux500_init_irq, |
Srinidhi Kasagar | aa44ef4 | 2009-11-28 08:17:18 +0100 | [diff] [blame] | 698 | /* we re-use nomadik timer here */ |
Rabin Vincent | 41ac329 | 2010-05-03 08:28:05 +0100 | [diff] [blame] | 699 | .timer = &ux500_timer, |
Marc Zyngier | bbf5f38 | 2011-09-06 10:23:45 +0100 | [diff] [blame] | 700 | .handle_irq = gic_handle_irq, |
Linus Walleij | 4b4f757 | 2011-02-15 15:01:35 +0100 | [diff] [blame] | 701 | .init_machine = mop500_init_machine, |
Shawn Guo | a010bc2 | 2012-05-02 17:10:07 +0800 | [diff] [blame] | 702 | .init_late = ux500_init_late, |
Linus Walleij | 4b4f757 | 2011-02-15 15:01:35 +0100 | [diff] [blame] | 703 | MACHINE_END |
| 704 | |
| 705 | MACHINE_START(HREFV60, "ST-Ericsson U8500 Platform HREFv60+") |
Nicolas Pitre | bc77b1a | 2011-07-05 22:38:18 -0400 | [diff] [blame] | 706 | .atag_offset = 0x100, |
Linus Walleij | 4b4f757 | 2011-02-15 15:01:35 +0100 | [diff] [blame] | 707 | .map_io = u8500_map_io, |
| 708 | .init_irq = ux500_init_irq, |
| 709 | .timer = &ux500_timer, |
Marc Zyngier | bbf5f38 | 2011-09-06 10:23:45 +0100 | [diff] [blame] | 710 | .handle_irq = gic_handle_irq, |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +0100 | [diff] [blame] | 711 | .init_machine = hrefv60_init_machine, |
Shawn Guo | a010bc2 | 2012-05-02 17:10:07 +0800 | [diff] [blame] | 712 | .init_late = ux500_init_late, |
Srinidhi Kasagar | aa44ef4 | 2009-11-28 08:17:18 +0100 | [diff] [blame] | 713 | MACHINE_END |
Robert Marklund | 350abe0 | 2011-06-20 15:55:46 +0200 | [diff] [blame] | 714 | |
| 715 | MACHINE_START(SNOWBALL, "Calao Systems Snowball platform") |
Nicolas Pitre | bc77b1a | 2011-07-05 22:38:18 -0400 | [diff] [blame] | 716 | .atag_offset = 0x100, |
Robert Marklund | 350abe0 | 2011-06-20 15:55:46 +0200 | [diff] [blame] | 717 | .map_io = u8500_map_io, |
| 718 | .init_irq = ux500_init_irq, |
| 719 | /* we re-use nomadik timer here */ |
| 720 | .timer = &ux500_timer, |
Marc Zyngier | bbf5f38 | 2011-09-06 10:23:45 +0100 | [diff] [blame] | 721 | .handle_irq = gic_handle_irq, |
Lee Jones | 110c2c2 | 2011-08-26 16:54:07 +0100 | [diff] [blame] | 722 | .init_machine = snowball_init_machine, |
Shawn Guo | a010bc2 | 2012-05-02 17:10:07 +0800 | [diff] [blame] | 723 | .init_late = ux500_init_late, |
Robert Marklund | 350abe0 | 2011-06-20 15:55:46 +0200 | [diff] [blame] | 724 | MACHINE_END |
Arnd Bergmann | 2d33429 | 2012-03-07 15:04:07 +0000 | [diff] [blame] | 725 | |
| 726 | #ifdef CONFIG_MACH_UX500_DT |
Lee Jones | 7e0ce27 | 2012-03-15 16:46:17 +0000 | [diff] [blame] | 727 | |
| 728 | struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = { |
Lee Jones | 96bbf79 | 2012-07-06 09:06:20 +0100 | [diff] [blame] | 729 | /* Requires call-back bindings. */ |
| 730 | OF_DEV_AUXDATA("arm,cortex-a9-pmu", 0, "arm-pmu", &db8500_pmu_platdata), |
Lee Jones | 513c27f | 2012-04-13 15:05:05 +0100 | [diff] [blame] | 731 | /* Requires DMA and call-back bindings. */ |
Lee Jones | 4905af0 | 2012-03-07 17:35:04 +0000 | [diff] [blame] | 732 | OF_DEV_AUXDATA("arm,pl011", 0x80120000, "uart0", &uart0_plat), |
| 733 | OF_DEV_AUXDATA("arm,pl011", 0x80121000, "uart1", &uart1_plat), |
| 734 | OF_DEV_AUXDATA("arm,pl011", 0x80007000, "uart2", &uart2_plat), |
Lee Jones | 513c27f | 2012-04-13 15:05:05 +0100 | [diff] [blame] | 735 | /* Requires DMA bindings. */ |
Lee Jones | 15daf69 | 2012-03-15 16:47:11 +0000 | [diff] [blame] | 736 | OF_DEV_AUXDATA("arm,pl022", 0x80002000, "ssp0", &ssp0_plat), |
Lee Jones | 5e1ac7d | 2012-05-29 14:40:04 +0800 | [diff] [blame] | 737 | OF_DEV_AUXDATA("arm,pl18x", 0x80126000, "sdi0", &mop500_sdi0_data), |
Lee Jones | 9cf24b1 | 2012-08-30 16:11:08 +0100 | [diff] [blame] | 738 | OF_DEV_AUXDATA("arm,pl18x", 0x80118000, "sdi1", &mop500_sdi1_data), |
| 739 | OF_DEV_AUXDATA("arm,pl18x", 0x80005000, "sdi2", &mop500_sdi2_data), |
Lee Jones | 5e1ac7d | 2012-05-29 14:40:04 +0800 | [diff] [blame] | 740 | OF_DEV_AUXDATA("arm,pl18x", 0x80114000, "sdi4", &mop500_sdi4_data), |
Lee Jones | 513c27f | 2012-04-13 15:05:05 +0100 | [diff] [blame] | 741 | /* Requires clock name bindings. */ |
| 742 | OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e000, "gpio.0", NULL), |
| 743 | OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e080, "gpio.1", NULL), |
| 744 | OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e000, "gpio.2", NULL), |
| 745 | OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e080, "gpio.3", NULL), |
| 746 | OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e100, "gpio.4", NULL), |
| 747 | OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e180, "gpio.5", NULL), |
| 748 | OF_DEV_AUXDATA("st,nomadik-gpio", 0x8011e000, "gpio.6", NULL), |
| 749 | OF_DEV_AUXDATA("st,nomadik-gpio", 0x8011e080, "gpio.7", NULL), |
| 750 | OF_DEV_AUXDATA("st,nomadik-gpio", 0xa03fe000, "gpio.8", NULL), |
Lee Jones | 079c61e | 2012-04-17 16:11:02 +0100 | [diff] [blame] | 751 | OF_DEV_AUXDATA("st,nomadik-i2c", 0x80004000, "nmk-i2c.0", NULL), |
| 752 | OF_DEV_AUXDATA("st,nomadik-i2c", 0x80122000, "nmk-i2c.1", NULL), |
| 753 | OF_DEV_AUXDATA("st,nomadik-i2c", 0x80128000, "nmk-i2c.2", NULL), |
| 754 | OF_DEV_AUXDATA("st,nomadik-i2c", 0x80110000, "nmk-i2c.3", NULL), |
| 755 | OF_DEV_AUXDATA("st,nomadik-i2c", 0x8012a000, "nmk-i2c.4", NULL), |
Lee Jones | 2b667a2 | 2012-07-06 15:59:01 +0100 | [diff] [blame] | 756 | /* Requires device name bindings. */ |
| 757 | OF_DEV_AUXDATA("stericsson,nmk_pinctrl", 0, "pinctrl-db8500", NULL), |
Lee Jones | 724ebbf | 2012-07-25 13:58:36 +0100 | [diff] [blame^] | 758 | /* Requires clock name and DMA bindings. */ |
| 759 | OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80123000, |
| 760 | "ux500-msp-i2s.0", &msp0_platform_data), |
| 761 | OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80124000, |
| 762 | "ux500-msp-i2s.1", &msp1_platform_data), |
| 763 | OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80117000, |
| 764 | "ux500-msp-i2s.2", &msp2_platform_data), |
| 765 | OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80125000, |
| 766 | "ux500-msp-i2s.3", &msp3_platform_data), |
Lee Jones | 7e0ce27 | 2012-03-15 16:46:17 +0000 | [diff] [blame] | 767 | {}, |
| 768 | }; |
| 769 | |
Lee Jones | 2cfaa62 | 2012-04-19 21:36:30 +0100 | [diff] [blame] | 770 | static const struct of_device_id u8500_local_bus_nodes[] = { |
Lee Jones | 7e0ce27 | 2012-03-15 16:46:17 +0000 | [diff] [blame] | 771 | /* only create devices below soc node */ |
| 772 | { .compatible = "stericsson,db8500", }, |
Lee Jones | 48a4ea6 | 2012-05-29 15:06:55 +0800 | [diff] [blame] | 773 | { .compatible = "stericsson,db8500-prcmu", }, |
Lee Jones | 2cfaa62 | 2012-04-19 21:36:30 +0100 | [diff] [blame] | 774 | { .compatible = "simple-bus"}, |
Lee Jones | 7e0ce27 | 2012-03-15 16:46:17 +0000 | [diff] [blame] | 775 | { }, |
| 776 | }; |
| 777 | |
Arnd Bergmann | 2d33429 | 2012-03-07 15:04:07 +0000 | [diff] [blame] | 778 | static void __init u8500_init_machine(void) |
| 779 | { |
Arnd Bergmann | 7734fed | 2012-03-02 22:25:02 +0000 | [diff] [blame] | 780 | struct device *parent = NULL; |
| 781 | int i2c0_devs; |
| 782 | int i; |
| 783 | |
Linus Walleij | ed781d39 | 2012-05-03 00:44:52 +0200 | [diff] [blame] | 784 | /* Pinmaps must be in place before devices register */ |
| 785 | if (of_machine_is_compatible("st-ericsson,mop500")) |
| 786 | mop500_pinmaps_init(); |
| 787 | else if (of_machine_is_compatible("calaosystems,snowball-a9500")) |
| 788 | snowball_pinmaps_init(); |
| 789 | else if (of_machine_is_compatible("st-ericsson,hrefv60+")) |
| 790 | hrefv60_pinmaps_init(); |
| 791 | |
Lee Jones | f65c198 | 2012-05-29 10:03:09 +0800 | [diff] [blame] | 792 | parent = u8500_of_init_devices(); |
Arnd Bergmann | 7734fed | 2012-03-02 22:25:02 +0000 | [diff] [blame] | 793 | |
| 794 | for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++) |
| 795 | mop500_platform_devs[i]->dev.parent = parent; |
Arnd Bergmann | 7734fed | 2012-03-02 22:25:02 +0000 | [diff] [blame] | 796 | |
Lee Jones | 7e0ce27 | 2012-03-15 16:46:17 +0000 | [diff] [blame] | 797 | /* automatically probe child nodes of db8500 device */ |
Lee Jones | 2cfaa62 | 2012-04-19 21:36:30 +0100 | [diff] [blame] | 798 | of_platform_populate(NULL, u8500_local_bus_nodes, u8500_auxdata_lookup, parent); |
Arnd Bergmann | 7734fed | 2012-03-02 22:25:02 +0000 | [diff] [blame] | 799 | |
| 800 | if (of_machine_is_compatible("st-ericsson,mop500")) { |
| 801 | mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR; |
Arnd Bergmann | 7734fed | 2012-03-02 22:25:02 +0000 | [diff] [blame] | 802 | |
| 803 | platform_add_devices(mop500_platform_devs, |
| 804 | ARRAY_SIZE(mop500_platform_devs)); |
| 805 | |
| 806 | mop500_sdi_init(parent); |
Lee Jones | 46a8b98 | 2012-08-09 16:47:28 +0100 | [diff] [blame] | 807 | mop500_msp_init(parent); |
Lee Jones | 4809f90 | 2012-04-19 21:36:40 +0100 | [diff] [blame] | 808 | i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices); |
| 809 | i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs); |
| 810 | i2c_register_board_info(2, mop500_i2c2_devices, |
| 811 | ARRAY_SIZE(mop500_i2c2_devices)); |
| 812 | |
Lee Jones | fd6948b | 2012-05-02 09:53:48 +0100 | [diff] [blame] | 813 | mop500_uib_init(); |
| 814 | |
Lee Jones | 46a8b98 | 2012-08-09 16:47:28 +0100 | [diff] [blame] | 815 | } else if (of_machine_is_compatible("calaosystems,snowball-a9500")) { |
Lee Jones | ae6d35b | 2012-07-26 17:42:01 +0100 | [diff] [blame] | 816 | mop500_of_msp_init(parent); |
Arnd Bergmann | 7734fed | 2012-03-02 22:25:02 +0000 | [diff] [blame] | 817 | } else if (of_machine_is_compatible("st-ericsson,hrefv60+")) { |
| 818 | /* |
| 819 | * The HREFv60 board removed a GPIO expander and routed |
| 820 | * all these GPIO pins to the internal GPIO controller |
| 821 | * instead. |
| 822 | */ |
| 823 | mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO; |
Arnd Bergmann | 7734fed | 2012-03-02 22:25:02 +0000 | [diff] [blame] | 824 | platform_add_devices(mop500_platform_devs, |
| 825 | ARRAY_SIZE(mop500_platform_devs)); |
| 826 | |
| 827 | hrefv60_sdi_init(parent); |
Lee Jones | 46a8b98 | 2012-08-09 16:47:28 +0100 | [diff] [blame] | 828 | mop500_msp_init(parent); |
Lee Jones | 4809f90 | 2012-04-19 21:36:40 +0100 | [diff] [blame] | 829 | |
| 830 | i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices); |
| 831 | i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES; |
| 832 | |
| 833 | i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs); |
| 834 | i2c_register_board_info(2, mop500_i2c2_devices, |
| 835 | ARRAY_SIZE(mop500_i2c2_devices)); |
Lee Jones | fd6948b | 2012-05-02 09:53:48 +0100 | [diff] [blame] | 836 | |
| 837 | mop500_uib_init(); |
Arnd Bergmann | 7734fed | 2012-03-02 22:25:02 +0000 | [diff] [blame] | 838 | } |
Arnd Bergmann | 7734fed | 2012-03-02 22:25:02 +0000 | [diff] [blame] | 839 | |
Arnd Bergmann | 7734fed | 2012-03-02 22:25:02 +0000 | [diff] [blame] | 840 | /* This board has full regulator constraints */ |
| 841 | regulator_has_full_constraints(); |
Arnd Bergmann | 2d33429 | 2012-03-07 15:04:07 +0000 | [diff] [blame] | 842 | } |
| 843 | |
| 844 | static const char * u8500_dt_board_compat[] = { |
| 845 | "calaosystems,snowball-a9500", |
| 846 | "st-ericsson,hrefv60+", |
| 847 | "st-ericsson,u8500", |
| 848 | "st-ericsson,mop500", |
| 849 | NULL, |
| 850 | }; |
| 851 | |
| 852 | |
| 853 | DT_MACHINE_START(U8500_DT, "ST-Ericsson U8500 platform (Device Tree Support)") |
| 854 | .map_io = u8500_map_io, |
| 855 | .init_irq = ux500_init_irq, |
| 856 | /* we re-use nomadik timer here */ |
| 857 | .timer = &ux500_timer, |
| 858 | .handle_irq = gic_handle_irq, |
| 859 | .init_machine = u8500_init_machine, |
Shawn Guo | a010bc2 | 2012-05-02 17:10:07 +0800 | [diff] [blame] | 860 | .init_late = ux500_init_late, |
Arnd Bergmann | 2d33429 | 2012-03-07 15:04:07 +0000 | [diff] [blame] | 861 | .dt_compat = u8500_dt_board_compat, |
| 862 | MACHINE_END |
| 863 | #endif |