viresh kumar | bc4e814 | 2010-04-01 12:30:58 +0100 | [diff] [blame] | 1 | /* |
| 2 | * arch/arm/mach-spear3xx/spear3xx.c |
| 3 | * |
| 4 | * SPEAr3XX machines common source file |
| 5 | * |
| 6 | * Copyright (C) 2009 ST Microelectronics |
| 7 | * Viresh Kumar<viresh.kumar@st.com> |
| 8 | * |
| 9 | * This file is licensed under the terms of the GNU General Public |
| 10 | * License version 2. This program is licensed "as is" without any |
| 11 | * warranty of any kind, whether express or implied. |
| 12 | */ |
| 13 | |
| 14 | #include <linux/types.h> |
| 15 | #include <linux/amba/pl061.h> |
| 16 | #include <linux/ptrace.h> |
| 17 | #include <linux/io.h> |
| 18 | #include <asm/hardware/vic.h> |
| 19 | #include <asm/irq.h> |
| 20 | #include <asm/mach/arch.h> |
| 21 | #include <mach/generic.h> |
viresh kumar | 02aa06b | 2011-03-07 05:57:02 +0100 | [diff] [blame] | 22 | #include <mach/hardware.h> |
viresh kumar | bc4e814 | 2010-04-01 12:30:58 +0100 | [diff] [blame] | 23 | |
| 24 | /* Add spear3xx machines common devices here */ |
Uwe Kleine-König | b595076 | 2010-11-01 15:38:34 -0400 | [diff] [blame] | 25 | /* gpio device registration */ |
viresh kumar | bc4e814 | 2010-04-01 12:30:58 +0100 | [diff] [blame] | 26 | static struct pl061_platform_data gpio_plat_data = { |
| 27 | .gpio_base = 0, |
Ryan Mallon | 61e72bc | 2011-05-20 08:34:21 +0100 | [diff] [blame] | 28 | .irq_base = SPEAR3XX_GPIO_INT_BASE, |
viresh kumar | bc4e814 | 2010-04-01 12:30:58 +0100 | [diff] [blame] | 29 | }; |
| 30 | |
Russell King | b5b654f | 2012-01-20 09:14:14 +0000 | [diff] [blame] | 31 | AMBA_APB_DEVICE(spear3xx_gpio, "gpio", 0, SPEAR3XX_ICM3_GPIO_BASE, |
| 32 | {SPEAR3XX_IRQ_BASIC_GPIO}, &gpio_plat_data); |
viresh kumar | bc4e814 | 2010-04-01 12:30:58 +0100 | [diff] [blame] | 33 | |
Uwe Kleine-König | b595076 | 2010-11-01 15:38:34 -0400 | [diff] [blame] | 34 | /* uart device registration */ |
Russell King | b5b654f | 2012-01-20 09:14:14 +0000 | [diff] [blame] | 35 | AMBA_APB_DEVICE(spear3xx_uart, "uart", 0, SPEAR3XX_ICM1_UART_BASE, |
| 36 | {SPEAR3XX_IRQ_UART}, NULL); |
viresh kumar | bc4e814 | 2010-04-01 12:30:58 +0100 | [diff] [blame] | 37 | |
| 38 | /* Do spear3xx familiy common initialization part here */ |
| 39 | void __init spear3xx_init(void) |
| 40 | { |
| 41 | /* nothing to do for now */ |
| 42 | } |
| 43 | |
| 44 | /* This will initialize vic */ |
| 45 | void __init spear3xx_init_irq(void) |
| 46 | { |
| 47 | vic_init((void __iomem *)VA_SPEAR3XX_ML1_VIC_BASE, 0, ~0, 0); |
| 48 | } |
| 49 | |
| 50 | /* Following will create static virtual/physical mappings */ |
| 51 | struct map_desc spear3xx_io_desc[] __initdata = { |
| 52 | { |
| 53 | .virtual = VA_SPEAR3XX_ICM1_UART_BASE, |
| 54 | .pfn = __phys_to_pfn(SPEAR3XX_ICM1_UART_BASE), |
viresh kumar | 5382116 | 2011-03-07 05:57:06 +0100 | [diff] [blame] | 55 | .length = SZ_4K, |
viresh kumar | bc4e814 | 2010-04-01 12:30:58 +0100 | [diff] [blame] | 56 | .type = MT_DEVICE |
| 57 | }, { |
| 58 | .virtual = VA_SPEAR3XX_ML1_VIC_BASE, |
| 59 | .pfn = __phys_to_pfn(SPEAR3XX_ML1_VIC_BASE), |
viresh kumar | 5382116 | 2011-03-07 05:57:06 +0100 | [diff] [blame] | 60 | .length = SZ_4K, |
viresh kumar | bc4e814 | 2010-04-01 12:30:58 +0100 | [diff] [blame] | 61 | .type = MT_DEVICE |
| 62 | }, { |
| 63 | .virtual = VA_SPEAR3XX_ICM3_SYS_CTRL_BASE, |
| 64 | .pfn = __phys_to_pfn(SPEAR3XX_ICM3_SYS_CTRL_BASE), |
viresh kumar | 5382116 | 2011-03-07 05:57:06 +0100 | [diff] [blame] | 65 | .length = SZ_4K, |
viresh kumar | bc4e814 | 2010-04-01 12:30:58 +0100 | [diff] [blame] | 66 | .type = MT_DEVICE |
| 67 | }, { |
| 68 | .virtual = VA_SPEAR3XX_ICM3_MISC_REG_BASE, |
| 69 | .pfn = __phys_to_pfn(SPEAR3XX_ICM3_MISC_REG_BASE), |
viresh kumar | 5382116 | 2011-03-07 05:57:06 +0100 | [diff] [blame] | 70 | .length = SZ_4K, |
viresh kumar | bc4e814 | 2010-04-01 12:30:58 +0100 | [diff] [blame] | 71 | .type = MT_DEVICE |
| 72 | }, |
| 73 | }; |
| 74 | |
| 75 | /* This will create static memory mapping for selected devices */ |
| 76 | void __init spear3xx_map_io(void) |
| 77 | { |
| 78 | iotable_init(spear3xx_io_desc, ARRAY_SIZE(spear3xx_io_desc)); |
| 79 | |
| 80 | /* This will initialize clock framework */ |
viresh kumar | b997f6e | 2011-05-20 08:34:18 +0100 | [diff] [blame] | 81 | spear3xx_clk_init(); |
viresh kumar | bc4e814 | 2010-04-01 12:30:58 +0100 | [diff] [blame] | 82 | } |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 83 | |
| 84 | /* pad multiplexing support */ |
| 85 | /* devices */ |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 86 | static struct pmx_dev_mode pmx_firda_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 87 | { |
| 88 | .ids = 0xffffffff, |
| 89 | .mask = PMX_FIRDA_MASK, |
| 90 | }, |
| 91 | }; |
| 92 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 93 | struct pmx_dev spear3xx_pmx_firda = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 94 | .name = "firda", |
| 95 | .modes = pmx_firda_modes, |
| 96 | .mode_count = ARRAY_SIZE(pmx_firda_modes), |
| 97 | .enb_on_reset = 0, |
| 98 | }; |
| 99 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 100 | static struct pmx_dev_mode pmx_i2c_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 101 | { |
| 102 | .ids = 0xffffffff, |
| 103 | .mask = PMX_I2C_MASK, |
| 104 | }, |
| 105 | }; |
| 106 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 107 | struct pmx_dev spear3xx_pmx_i2c = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 108 | .name = "i2c", |
| 109 | .modes = pmx_i2c_modes, |
| 110 | .mode_count = ARRAY_SIZE(pmx_i2c_modes), |
| 111 | .enb_on_reset = 0, |
| 112 | }; |
| 113 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 114 | static struct pmx_dev_mode pmx_ssp_cs_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 115 | { |
| 116 | .ids = 0xffffffff, |
| 117 | .mask = PMX_SSP_CS_MASK, |
| 118 | }, |
| 119 | }; |
| 120 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 121 | struct pmx_dev spear3xx_pmx_ssp_cs = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 122 | .name = "ssp_chip_selects", |
| 123 | .modes = pmx_ssp_cs_modes, |
| 124 | .mode_count = ARRAY_SIZE(pmx_ssp_cs_modes), |
| 125 | .enb_on_reset = 0, |
| 126 | }; |
| 127 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 128 | static struct pmx_dev_mode pmx_ssp_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 129 | { |
| 130 | .ids = 0xffffffff, |
| 131 | .mask = PMX_SSP_MASK, |
| 132 | }, |
| 133 | }; |
| 134 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 135 | struct pmx_dev spear3xx_pmx_ssp = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 136 | .name = "ssp", |
| 137 | .modes = pmx_ssp_modes, |
| 138 | .mode_count = ARRAY_SIZE(pmx_ssp_modes), |
| 139 | .enb_on_reset = 0, |
| 140 | }; |
| 141 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 142 | static struct pmx_dev_mode pmx_mii_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 143 | { |
| 144 | .ids = 0xffffffff, |
| 145 | .mask = PMX_MII_MASK, |
| 146 | }, |
| 147 | }; |
| 148 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 149 | struct pmx_dev spear3xx_pmx_mii = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 150 | .name = "mii", |
| 151 | .modes = pmx_mii_modes, |
| 152 | .mode_count = ARRAY_SIZE(pmx_mii_modes), |
| 153 | .enb_on_reset = 0, |
| 154 | }; |
| 155 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 156 | static struct pmx_dev_mode pmx_gpio_pin0_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 157 | { |
| 158 | .ids = 0xffffffff, |
| 159 | .mask = PMX_GPIO_PIN0_MASK, |
| 160 | }, |
| 161 | }; |
| 162 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 163 | struct pmx_dev spear3xx_pmx_gpio_pin0 = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 164 | .name = "gpio_pin0", |
| 165 | .modes = pmx_gpio_pin0_modes, |
| 166 | .mode_count = ARRAY_SIZE(pmx_gpio_pin0_modes), |
| 167 | .enb_on_reset = 0, |
| 168 | }; |
| 169 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 170 | static struct pmx_dev_mode pmx_gpio_pin1_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 171 | { |
| 172 | .ids = 0xffffffff, |
| 173 | .mask = PMX_GPIO_PIN1_MASK, |
| 174 | }, |
| 175 | }; |
| 176 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 177 | struct pmx_dev spear3xx_pmx_gpio_pin1 = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 178 | .name = "gpio_pin1", |
| 179 | .modes = pmx_gpio_pin1_modes, |
| 180 | .mode_count = ARRAY_SIZE(pmx_gpio_pin1_modes), |
| 181 | .enb_on_reset = 0, |
| 182 | }; |
| 183 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 184 | static struct pmx_dev_mode pmx_gpio_pin2_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 185 | { |
| 186 | .ids = 0xffffffff, |
| 187 | .mask = PMX_GPIO_PIN2_MASK, |
| 188 | }, |
| 189 | }; |
| 190 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 191 | struct pmx_dev spear3xx_pmx_gpio_pin2 = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 192 | .name = "gpio_pin2", |
| 193 | .modes = pmx_gpio_pin2_modes, |
| 194 | .mode_count = ARRAY_SIZE(pmx_gpio_pin2_modes), |
| 195 | .enb_on_reset = 0, |
| 196 | }; |
| 197 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 198 | static struct pmx_dev_mode pmx_gpio_pin3_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 199 | { |
| 200 | .ids = 0xffffffff, |
| 201 | .mask = PMX_GPIO_PIN3_MASK, |
| 202 | }, |
| 203 | }; |
| 204 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 205 | struct pmx_dev spear3xx_pmx_gpio_pin3 = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 206 | .name = "gpio_pin3", |
| 207 | .modes = pmx_gpio_pin3_modes, |
| 208 | .mode_count = ARRAY_SIZE(pmx_gpio_pin3_modes), |
| 209 | .enb_on_reset = 0, |
| 210 | }; |
| 211 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 212 | static struct pmx_dev_mode pmx_gpio_pin4_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 213 | { |
| 214 | .ids = 0xffffffff, |
| 215 | .mask = PMX_GPIO_PIN4_MASK, |
| 216 | }, |
| 217 | }; |
| 218 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 219 | struct pmx_dev spear3xx_pmx_gpio_pin4 = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 220 | .name = "gpio_pin4", |
| 221 | .modes = pmx_gpio_pin4_modes, |
| 222 | .mode_count = ARRAY_SIZE(pmx_gpio_pin4_modes), |
| 223 | .enb_on_reset = 0, |
| 224 | }; |
| 225 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 226 | static struct pmx_dev_mode pmx_gpio_pin5_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 227 | { |
| 228 | .ids = 0xffffffff, |
| 229 | .mask = PMX_GPIO_PIN5_MASK, |
| 230 | }, |
| 231 | }; |
| 232 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 233 | struct pmx_dev spear3xx_pmx_gpio_pin5 = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 234 | .name = "gpio_pin5", |
| 235 | .modes = pmx_gpio_pin5_modes, |
| 236 | .mode_count = ARRAY_SIZE(pmx_gpio_pin5_modes), |
| 237 | .enb_on_reset = 0, |
| 238 | }; |
| 239 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 240 | static struct pmx_dev_mode pmx_uart0_modem_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 241 | { |
| 242 | .ids = 0xffffffff, |
| 243 | .mask = PMX_UART0_MODEM_MASK, |
| 244 | }, |
| 245 | }; |
| 246 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 247 | struct pmx_dev spear3xx_pmx_uart0_modem = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 248 | .name = "uart0_modem", |
| 249 | .modes = pmx_uart0_modem_modes, |
| 250 | .mode_count = ARRAY_SIZE(pmx_uart0_modem_modes), |
| 251 | .enb_on_reset = 0, |
| 252 | }; |
| 253 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 254 | static struct pmx_dev_mode pmx_uart0_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 255 | { |
| 256 | .ids = 0xffffffff, |
| 257 | .mask = PMX_UART0_MASK, |
| 258 | }, |
| 259 | }; |
| 260 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 261 | struct pmx_dev spear3xx_pmx_uart0 = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 262 | .name = "uart0", |
| 263 | .modes = pmx_uart0_modes, |
| 264 | .mode_count = ARRAY_SIZE(pmx_uart0_modes), |
| 265 | .enb_on_reset = 0, |
| 266 | }; |
| 267 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 268 | static struct pmx_dev_mode pmx_timer_3_4_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 269 | { |
| 270 | .ids = 0xffffffff, |
| 271 | .mask = PMX_TIMER_3_4_MASK, |
| 272 | }, |
| 273 | }; |
| 274 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 275 | struct pmx_dev spear3xx_pmx_timer_3_4 = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 276 | .name = "timer_3_4", |
| 277 | .modes = pmx_timer_3_4_modes, |
| 278 | .mode_count = ARRAY_SIZE(pmx_timer_3_4_modes), |
| 279 | .enb_on_reset = 0, |
| 280 | }; |
| 281 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 282 | static struct pmx_dev_mode pmx_timer_1_2_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 283 | { |
| 284 | .ids = 0xffffffff, |
| 285 | .mask = PMX_TIMER_1_2_MASK, |
| 286 | }, |
| 287 | }; |
| 288 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 289 | struct pmx_dev spear3xx_pmx_timer_1_2 = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 290 | .name = "timer_1_2", |
| 291 | .modes = pmx_timer_1_2_modes, |
| 292 | .mode_count = ARRAY_SIZE(pmx_timer_1_2_modes), |
| 293 | .enb_on_reset = 0, |
| 294 | }; |
| 295 | |
| 296 | #if defined(CONFIG_MACH_SPEAR310) || defined(CONFIG_MACH_SPEAR320) |
| 297 | /* plgpios devices */ |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 298 | static struct pmx_dev_mode pmx_plgpio_0_1_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 299 | { |
| 300 | .ids = 0x00, |
| 301 | .mask = PMX_FIRDA_MASK, |
| 302 | }, |
| 303 | }; |
| 304 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 305 | struct pmx_dev spear3xx_pmx_plgpio_0_1 = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 306 | .name = "plgpio 0 and 1", |
| 307 | .modes = pmx_plgpio_0_1_modes, |
| 308 | .mode_count = ARRAY_SIZE(pmx_plgpio_0_1_modes), |
| 309 | .enb_on_reset = 1, |
| 310 | }; |
| 311 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 312 | static struct pmx_dev_mode pmx_plgpio_2_3_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 313 | { |
| 314 | .ids = 0x00, |
| 315 | .mask = PMX_UART0_MASK, |
| 316 | }, |
| 317 | }; |
| 318 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 319 | struct pmx_dev spear3xx_pmx_plgpio_2_3 = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 320 | .name = "plgpio 2 and 3", |
| 321 | .modes = pmx_plgpio_2_3_modes, |
| 322 | .mode_count = ARRAY_SIZE(pmx_plgpio_2_3_modes), |
| 323 | .enb_on_reset = 1, |
| 324 | }; |
| 325 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 326 | static struct pmx_dev_mode pmx_plgpio_4_5_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 327 | { |
| 328 | .ids = 0x00, |
| 329 | .mask = PMX_I2C_MASK, |
| 330 | }, |
| 331 | }; |
| 332 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 333 | struct pmx_dev spear3xx_pmx_plgpio_4_5 = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 334 | .name = "plgpio 4 and 5", |
| 335 | .modes = pmx_plgpio_4_5_modes, |
| 336 | .mode_count = ARRAY_SIZE(pmx_plgpio_4_5_modes), |
| 337 | .enb_on_reset = 1, |
| 338 | }; |
| 339 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 340 | static struct pmx_dev_mode pmx_plgpio_6_9_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 341 | { |
| 342 | .ids = 0x00, |
| 343 | .mask = PMX_SSP_MASK, |
| 344 | }, |
| 345 | }; |
| 346 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 347 | struct pmx_dev spear3xx_pmx_plgpio_6_9 = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 348 | .name = "plgpio 6 to 9", |
| 349 | .modes = pmx_plgpio_6_9_modes, |
| 350 | .mode_count = ARRAY_SIZE(pmx_plgpio_6_9_modes), |
| 351 | .enb_on_reset = 1, |
| 352 | }; |
| 353 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 354 | static struct pmx_dev_mode pmx_plgpio_10_27_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 355 | { |
| 356 | .ids = 0x00, |
| 357 | .mask = PMX_MII_MASK, |
| 358 | }, |
| 359 | }; |
| 360 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 361 | struct pmx_dev spear3xx_pmx_plgpio_10_27 = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 362 | .name = "plgpio 10 to 27", |
| 363 | .modes = pmx_plgpio_10_27_modes, |
| 364 | .mode_count = ARRAY_SIZE(pmx_plgpio_10_27_modes), |
| 365 | .enb_on_reset = 1, |
| 366 | }; |
| 367 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 368 | static struct pmx_dev_mode pmx_plgpio_28_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 369 | { |
| 370 | .ids = 0x00, |
| 371 | .mask = PMX_GPIO_PIN0_MASK, |
| 372 | }, |
| 373 | }; |
| 374 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 375 | struct pmx_dev spear3xx_pmx_plgpio_28 = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 376 | .name = "plgpio 28", |
| 377 | .modes = pmx_plgpio_28_modes, |
| 378 | .mode_count = ARRAY_SIZE(pmx_plgpio_28_modes), |
| 379 | .enb_on_reset = 1, |
| 380 | }; |
| 381 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 382 | static struct pmx_dev_mode pmx_plgpio_29_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 383 | { |
| 384 | .ids = 0x00, |
| 385 | .mask = PMX_GPIO_PIN1_MASK, |
| 386 | }, |
| 387 | }; |
| 388 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 389 | struct pmx_dev spear3xx_pmx_plgpio_29 = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 390 | .name = "plgpio 29", |
| 391 | .modes = pmx_plgpio_29_modes, |
| 392 | .mode_count = ARRAY_SIZE(pmx_plgpio_29_modes), |
| 393 | .enb_on_reset = 1, |
| 394 | }; |
| 395 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 396 | static struct pmx_dev_mode pmx_plgpio_30_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 397 | { |
| 398 | .ids = 0x00, |
| 399 | .mask = PMX_GPIO_PIN2_MASK, |
| 400 | }, |
| 401 | }; |
| 402 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 403 | struct pmx_dev spear3xx_pmx_plgpio_30 = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 404 | .name = "plgpio 30", |
| 405 | .modes = pmx_plgpio_30_modes, |
| 406 | .mode_count = ARRAY_SIZE(pmx_plgpio_30_modes), |
| 407 | .enb_on_reset = 1, |
| 408 | }; |
| 409 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 410 | static struct pmx_dev_mode pmx_plgpio_31_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 411 | { |
| 412 | .ids = 0x00, |
| 413 | .mask = PMX_GPIO_PIN3_MASK, |
| 414 | }, |
| 415 | }; |
| 416 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 417 | struct pmx_dev spear3xx_pmx_plgpio_31 = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 418 | .name = "plgpio 31", |
| 419 | .modes = pmx_plgpio_31_modes, |
| 420 | .mode_count = ARRAY_SIZE(pmx_plgpio_31_modes), |
| 421 | .enb_on_reset = 1, |
| 422 | }; |
| 423 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 424 | static struct pmx_dev_mode pmx_plgpio_32_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 425 | { |
| 426 | .ids = 0x00, |
| 427 | .mask = PMX_GPIO_PIN4_MASK, |
| 428 | }, |
| 429 | }; |
| 430 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 431 | struct pmx_dev spear3xx_pmx_plgpio_32 = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 432 | .name = "plgpio 32", |
| 433 | .modes = pmx_plgpio_32_modes, |
| 434 | .mode_count = ARRAY_SIZE(pmx_plgpio_32_modes), |
| 435 | .enb_on_reset = 1, |
| 436 | }; |
| 437 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 438 | static struct pmx_dev_mode pmx_plgpio_33_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 439 | { |
| 440 | .ids = 0x00, |
| 441 | .mask = PMX_GPIO_PIN5_MASK, |
| 442 | }, |
| 443 | }; |
| 444 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 445 | struct pmx_dev spear3xx_pmx_plgpio_33 = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 446 | .name = "plgpio 33", |
| 447 | .modes = pmx_plgpio_33_modes, |
| 448 | .mode_count = ARRAY_SIZE(pmx_plgpio_33_modes), |
| 449 | .enb_on_reset = 1, |
| 450 | }; |
| 451 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 452 | static struct pmx_dev_mode pmx_plgpio_34_36_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 453 | { |
| 454 | .ids = 0x00, |
| 455 | .mask = PMX_SSP_CS_MASK, |
| 456 | }, |
| 457 | }; |
| 458 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 459 | struct pmx_dev spear3xx_pmx_plgpio_34_36 = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 460 | .name = "plgpio 34 to 36", |
| 461 | .modes = pmx_plgpio_34_36_modes, |
| 462 | .mode_count = ARRAY_SIZE(pmx_plgpio_34_36_modes), |
| 463 | .enb_on_reset = 1, |
| 464 | }; |
| 465 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 466 | static struct pmx_dev_mode pmx_plgpio_37_42_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 467 | { |
| 468 | .ids = 0x00, |
| 469 | .mask = PMX_UART0_MODEM_MASK, |
| 470 | }, |
| 471 | }; |
| 472 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 473 | struct pmx_dev spear3xx_pmx_plgpio_37_42 = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 474 | .name = "plgpio 37 to 42", |
| 475 | .modes = pmx_plgpio_37_42_modes, |
| 476 | .mode_count = ARRAY_SIZE(pmx_plgpio_37_42_modes), |
| 477 | .enb_on_reset = 1, |
| 478 | }; |
| 479 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 480 | static struct pmx_dev_mode pmx_plgpio_43_44_47_48_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 481 | { |
| 482 | .ids = 0x00, |
| 483 | .mask = PMX_TIMER_1_2_MASK, |
| 484 | }, |
| 485 | }; |
| 486 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 487 | struct pmx_dev spear3xx_pmx_plgpio_43_44_47_48 = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 488 | .name = "plgpio 43, 44, 47 and 48", |
| 489 | .modes = pmx_plgpio_43_44_47_48_modes, |
| 490 | .mode_count = ARRAY_SIZE(pmx_plgpio_43_44_47_48_modes), |
| 491 | .enb_on_reset = 1, |
| 492 | }; |
| 493 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 494 | static struct pmx_dev_mode pmx_plgpio_45_46_49_50_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 495 | { |
| 496 | .ids = 0x00, |
| 497 | .mask = PMX_TIMER_3_4_MASK, |
| 498 | }, |
| 499 | }; |
| 500 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 501 | struct pmx_dev spear3xx_pmx_plgpio_45_46_49_50 = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 502 | .name = "plgpio 45, 46, 49 and 50", |
| 503 | .modes = pmx_plgpio_45_46_49_50_modes, |
| 504 | .mode_count = ARRAY_SIZE(pmx_plgpio_45_46_49_50_modes), |
| 505 | .enb_on_reset = 1, |
| 506 | }; |
Shiraz Hashim | 5c881d9 | 2011-02-16 07:40:32 +0100 | [diff] [blame] | 507 | #endif /* CONFIG_MACH_SPEAR310 || CONFIG_MACH_SPEAR320 */ |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 508 | |
Shiraz Hashim | 5c881d9 | 2011-02-16 07:40:32 +0100 | [diff] [blame] | 509 | static void __init spear3xx_timer_init(void) |
| 510 | { |
| 511 | char pclk_name[] = "pll3_48m_clk"; |
| 512 | struct clk *gpt_clk, *pclk; |
| 513 | |
| 514 | /* get the system timer clock */ |
| 515 | gpt_clk = clk_get_sys("gpt0", NULL); |
| 516 | if (IS_ERR(gpt_clk)) { |
| 517 | pr_err("%s:couldn't get clk for gpt\n", __func__); |
| 518 | BUG(); |
| 519 | } |
| 520 | |
| 521 | /* get the suitable parent clock for timer*/ |
| 522 | pclk = clk_get(NULL, pclk_name); |
| 523 | if (IS_ERR(pclk)) { |
| 524 | pr_err("%s:couldn't get %s as parent for gpt\n", |
| 525 | __func__, pclk_name); |
| 526 | BUG(); |
| 527 | } |
| 528 | |
| 529 | clk_set_parent(gpt_clk, pclk); |
| 530 | clk_put(gpt_clk); |
| 531 | clk_put(pclk); |
| 532 | |
| 533 | spear_setup_timer(); |
| 534 | } |
| 535 | |
| 536 | struct sys_timer spear3xx_timer = { |
| 537 | .init = spear3xx_timer_init, |
| 538 | }; |