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