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