viresh kumar | bc4e814 | 2010-04-01 12:30:58 +0100 | [diff] [blame] | 1 | /* |
| 2 | * arch/arm/mach-spear3xx/spear320.c |
| 3 | * |
| 4 | * SPEAr320 machine 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) "SPEAr320: " fmt |
| 15 | |
viresh kumar | bc4e814 | 2010-04-01 12:30:58 +0100 | [diff] [blame] | 16 | #include <linux/ptrace.h> |
| 17 | #include <asm/irq.h> |
viresh kumar | 410782b | 2011-03-07 05:57:01 +0100 | [diff] [blame] | 18 | #include <plat/shirq.h> |
viresh kumar | bc4e814 | 2010-04-01 12:30:58 +0100 | [diff] [blame] | 19 | #include <mach/generic.h> |
viresh kumar | 02aa06b | 2011-03-07 05:57:02 +0100 | [diff] [blame] | 20 | #include <mach/hardware.h> |
viresh kumar | bc4e814 | 2010-04-01 12:30:58 +0100 | [diff] [blame] | 21 | |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 22 | /* pad multiplexing support */ |
| 23 | /* muxing registers */ |
| 24 | #define PAD_MUX_CONFIG_REG 0x0C |
| 25 | #define MODE_CONFIG_REG 0x10 |
| 26 | |
| 27 | /* modes */ |
| 28 | #define AUTO_NET_SMII_MODE (1 << 0) |
| 29 | #define AUTO_NET_MII_MODE (1 << 1) |
| 30 | #define AUTO_EXP_MODE (1 << 2) |
| 31 | #define SMALL_PRINTERS_MODE (1 << 3) |
| 32 | #define ALL_MODES 0xF |
| 33 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 34 | struct pmx_mode spear320_auto_net_smii_mode = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 35 | .id = AUTO_NET_SMII_MODE, |
| 36 | .name = "Automation Networking SMII Mode", |
| 37 | .mask = 0x00, |
| 38 | }; |
| 39 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 40 | struct pmx_mode spear320_auto_net_mii_mode = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 41 | .id = AUTO_NET_MII_MODE, |
| 42 | .name = "Automation Networking MII Mode", |
| 43 | .mask = 0x01, |
| 44 | }; |
| 45 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 46 | struct pmx_mode spear320_auto_exp_mode = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 47 | .id = AUTO_EXP_MODE, |
| 48 | .name = "Automation Expanded Mode", |
| 49 | .mask = 0x02, |
| 50 | }; |
| 51 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 52 | struct pmx_mode spear320_small_printers_mode = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 53 | .id = SMALL_PRINTERS_MODE, |
| 54 | .name = "Small Printers Mode", |
| 55 | .mask = 0x03, |
| 56 | }; |
| 57 | |
| 58 | /* devices */ |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 59 | static struct pmx_dev_mode pmx_clcd_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 60 | { |
| 61 | .ids = AUTO_NET_SMII_MODE, |
| 62 | .mask = 0x0, |
| 63 | }, |
| 64 | }; |
| 65 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 66 | struct pmx_dev spear320_pmx_clcd = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 67 | .name = "clcd", |
| 68 | .modes = pmx_clcd_modes, |
| 69 | .mode_count = ARRAY_SIZE(pmx_clcd_modes), |
| 70 | .enb_on_reset = 1, |
| 71 | }; |
| 72 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 73 | static struct pmx_dev_mode pmx_emi_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 74 | { |
| 75 | .ids = AUTO_EXP_MODE, |
| 76 | .mask = PMX_TIMER_1_2_MASK | PMX_TIMER_3_4_MASK, |
| 77 | }, |
| 78 | }; |
| 79 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 80 | struct pmx_dev spear320_pmx_emi = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 81 | .name = "emi", |
| 82 | .modes = pmx_emi_modes, |
| 83 | .mode_count = ARRAY_SIZE(pmx_emi_modes), |
| 84 | .enb_on_reset = 1, |
| 85 | }; |
| 86 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 87 | static struct pmx_dev_mode pmx_fsmc_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 88 | { |
| 89 | .ids = ALL_MODES, |
| 90 | .mask = 0x0, |
| 91 | }, |
| 92 | }; |
| 93 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 94 | struct pmx_dev spear320_pmx_fsmc = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 95 | .name = "fsmc", |
| 96 | .modes = pmx_fsmc_modes, |
| 97 | .mode_count = ARRAY_SIZE(pmx_fsmc_modes), |
| 98 | .enb_on_reset = 1, |
| 99 | }; |
| 100 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 101 | static struct pmx_dev_mode pmx_spp_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 102 | { |
| 103 | .ids = SMALL_PRINTERS_MODE, |
| 104 | .mask = 0x0, |
| 105 | }, |
| 106 | }; |
| 107 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 108 | struct pmx_dev spear320_pmx_spp = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 109 | .name = "spp", |
| 110 | .modes = pmx_spp_modes, |
| 111 | .mode_count = ARRAY_SIZE(pmx_spp_modes), |
| 112 | .enb_on_reset = 1, |
| 113 | }; |
| 114 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 115 | static struct pmx_dev_mode pmx_sdhci_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 116 | { |
| 117 | .ids = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE | |
| 118 | SMALL_PRINTERS_MODE, |
| 119 | .mask = PMX_TIMER_1_2_MASK | PMX_TIMER_3_4_MASK, |
| 120 | }, |
| 121 | }; |
| 122 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 123 | struct pmx_dev spear320_pmx_sdhci = { |
viresh kumar | 069580b | 2011-03-07 05:57:03 +0100 | [diff] [blame] | 124 | .name = "sdhci", |
| 125 | .modes = pmx_sdhci_modes, |
| 126 | .mode_count = ARRAY_SIZE(pmx_sdhci_modes), |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 127 | .enb_on_reset = 1, |
| 128 | }; |
| 129 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 130 | static struct pmx_dev_mode pmx_i2s_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 131 | { |
| 132 | .ids = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE, |
| 133 | .mask = PMX_UART0_MODEM_MASK, |
| 134 | }, |
| 135 | }; |
| 136 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 137 | struct pmx_dev spear320_pmx_i2s = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 138 | .name = "i2s", |
| 139 | .modes = pmx_i2s_modes, |
| 140 | .mode_count = ARRAY_SIZE(pmx_i2s_modes), |
| 141 | .enb_on_reset = 1, |
| 142 | }; |
| 143 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 144 | static struct pmx_dev_mode pmx_uart1_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 145 | { |
| 146 | .ids = ALL_MODES, |
| 147 | .mask = PMX_GPIO_PIN0_MASK | PMX_GPIO_PIN1_MASK, |
| 148 | }, |
| 149 | }; |
| 150 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 151 | struct pmx_dev spear320_pmx_uart1 = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 152 | .name = "uart1", |
| 153 | .modes = pmx_uart1_modes, |
| 154 | .mode_count = ARRAY_SIZE(pmx_uart1_modes), |
| 155 | .enb_on_reset = 1, |
| 156 | }; |
| 157 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 158 | static struct pmx_dev_mode pmx_uart1_modem_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 159 | { |
| 160 | .ids = AUTO_EXP_MODE, |
| 161 | .mask = PMX_TIMER_1_2_MASK | PMX_TIMER_3_4_MASK | |
| 162 | PMX_SSP_CS_MASK, |
| 163 | }, { |
| 164 | .ids = SMALL_PRINTERS_MODE, |
| 165 | .mask = PMX_GPIO_PIN3_MASK | PMX_GPIO_PIN4_MASK | |
| 166 | PMX_GPIO_PIN5_MASK | PMX_SSP_CS_MASK, |
| 167 | }, |
| 168 | }; |
| 169 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 170 | struct pmx_dev spear320_pmx_uart1_modem = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 171 | .name = "uart1_modem", |
| 172 | .modes = pmx_uart1_modem_modes, |
| 173 | .mode_count = ARRAY_SIZE(pmx_uart1_modem_modes), |
| 174 | .enb_on_reset = 1, |
| 175 | }; |
| 176 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 177 | static struct pmx_dev_mode pmx_uart2_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 178 | { |
| 179 | .ids = ALL_MODES, |
| 180 | .mask = PMX_FIRDA_MASK, |
| 181 | }, |
| 182 | }; |
| 183 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 184 | struct pmx_dev spear320_pmx_uart2 = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 185 | .name = "uart2", |
| 186 | .modes = pmx_uart2_modes, |
| 187 | .mode_count = ARRAY_SIZE(pmx_uart2_modes), |
| 188 | .enb_on_reset = 1, |
| 189 | }; |
| 190 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 191 | static struct pmx_dev_mode pmx_touchscreen_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 192 | { |
| 193 | .ids = AUTO_NET_SMII_MODE, |
| 194 | .mask = PMX_SSP_CS_MASK, |
| 195 | }, |
| 196 | }; |
| 197 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 198 | struct pmx_dev spear320_pmx_touchscreen = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 199 | .name = "touchscreen", |
| 200 | .modes = pmx_touchscreen_modes, |
| 201 | .mode_count = ARRAY_SIZE(pmx_touchscreen_modes), |
| 202 | .enb_on_reset = 1, |
| 203 | }; |
| 204 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 205 | static struct pmx_dev_mode pmx_can_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 206 | { |
| 207 | .ids = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE | AUTO_EXP_MODE, |
| 208 | .mask = PMX_GPIO_PIN2_MASK | PMX_GPIO_PIN3_MASK | |
| 209 | PMX_GPIO_PIN4_MASK | PMX_GPIO_PIN5_MASK, |
| 210 | }, |
| 211 | }; |
| 212 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 213 | struct pmx_dev spear320_pmx_can = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 214 | .name = "can", |
| 215 | .modes = pmx_can_modes, |
| 216 | .mode_count = ARRAY_SIZE(pmx_can_modes), |
| 217 | .enb_on_reset = 1, |
| 218 | }; |
| 219 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 220 | static struct pmx_dev_mode pmx_sdhci_led_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 221 | { |
| 222 | .ids = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE, |
| 223 | .mask = PMX_SSP_CS_MASK, |
| 224 | }, |
| 225 | }; |
| 226 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 227 | struct pmx_dev spear320_pmx_sdhci_led = { |
viresh kumar | 069580b | 2011-03-07 05:57:03 +0100 | [diff] [blame] | 228 | .name = "sdhci_led", |
| 229 | .modes = pmx_sdhci_led_modes, |
| 230 | .mode_count = ARRAY_SIZE(pmx_sdhci_led_modes), |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 231 | .enb_on_reset = 1, |
| 232 | }; |
| 233 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 234 | static struct pmx_dev_mode pmx_pwm0_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 235 | { |
| 236 | .ids = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE, |
| 237 | .mask = PMX_UART0_MODEM_MASK, |
| 238 | }, { |
| 239 | .ids = AUTO_EXP_MODE | SMALL_PRINTERS_MODE, |
| 240 | .mask = PMX_MII_MASK, |
| 241 | }, |
| 242 | }; |
| 243 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 244 | struct pmx_dev spear320_pmx_pwm0 = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 245 | .name = "pwm0", |
| 246 | .modes = pmx_pwm0_modes, |
| 247 | .mode_count = ARRAY_SIZE(pmx_pwm0_modes), |
| 248 | .enb_on_reset = 1, |
| 249 | }; |
| 250 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 251 | static struct pmx_dev_mode pmx_pwm1_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 252 | { |
| 253 | .ids = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE, |
| 254 | .mask = PMX_UART0_MODEM_MASK, |
| 255 | }, { |
| 256 | .ids = AUTO_EXP_MODE | SMALL_PRINTERS_MODE, |
| 257 | .mask = PMX_MII_MASK, |
| 258 | }, |
| 259 | }; |
| 260 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 261 | struct pmx_dev spear320_pmx_pwm1 = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 262 | .name = "pwm1", |
| 263 | .modes = pmx_pwm1_modes, |
| 264 | .mode_count = ARRAY_SIZE(pmx_pwm1_modes), |
| 265 | .enb_on_reset = 1, |
| 266 | }; |
| 267 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 268 | static struct pmx_dev_mode pmx_pwm2_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 269 | { |
| 270 | .ids = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE, |
| 271 | .mask = PMX_SSP_CS_MASK, |
| 272 | }, { |
| 273 | .ids = AUTO_EXP_MODE | SMALL_PRINTERS_MODE, |
| 274 | .mask = PMX_MII_MASK, |
| 275 | }, |
| 276 | }; |
| 277 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 278 | struct pmx_dev spear320_pmx_pwm2 = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 279 | .name = "pwm2", |
| 280 | .modes = pmx_pwm2_modes, |
| 281 | .mode_count = ARRAY_SIZE(pmx_pwm2_modes), |
| 282 | .enb_on_reset = 1, |
| 283 | }; |
| 284 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 285 | static struct pmx_dev_mode pmx_pwm3_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 286 | { |
| 287 | .ids = AUTO_EXP_MODE | SMALL_PRINTERS_MODE | AUTO_NET_SMII_MODE, |
| 288 | .mask = PMX_MII_MASK, |
| 289 | }, |
| 290 | }; |
| 291 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 292 | struct pmx_dev spear320_pmx_pwm3 = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 293 | .name = "pwm3", |
| 294 | .modes = pmx_pwm3_modes, |
| 295 | .mode_count = ARRAY_SIZE(pmx_pwm3_modes), |
| 296 | .enb_on_reset = 1, |
| 297 | }; |
| 298 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 299 | static struct pmx_dev_mode pmx_ssp1_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 300 | { |
| 301 | .ids = SMALL_PRINTERS_MODE | AUTO_NET_SMII_MODE, |
| 302 | .mask = PMX_MII_MASK, |
| 303 | }, |
| 304 | }; |
| 305 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 306 | struct pmx_dev spear320_pmx_ssp1 = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 307 | .name = "ssp1", |
| 308 | .modes = pmx_ssp1_modes, |
| 309 | .mode_count = ARRAY_SIZE(pmx_ssp1_modes), |
| 310 | .enb_on_reset = 1, |
| 311 | }; |
| 312 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 313 | static struct pmx_dev_mode pmx_ssp2_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 314 | { |
| 315 | .ids = AUTO_NET_SMII_MODE, |
| 316 | .mask = PMX_MII_MASK, |
| 317 | }, |
| 318 | }; |
| 319 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 320 | struct pmx_dev spear320_pmx_ssp2 = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 321 | .name = "ssp2", |
| 322 | .modes = pmx_ssp2_modes, |
| 323 | .mode_count = ARRAY_SIZE(pmx_ssp2_modes), |
| 324 | .enb_on_reset = 1, |
| 325 | }; |
| 326 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 327 | static struct pmx_dev_mode pmx_mii1_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 328 | { |
| 329 | .ids = AUTO_NET_MII_MODE, |
| 330 | .mask = 0x0, |
| 331 | }, |
| 332 | }; |
| 333 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 334 | struct pmx_dev spear320_pmx_mii1 = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 335 | .name = "mii1", |
| 336 | .modes = pmx_mii1_modes, |
| 337 | .mode_count = ARRAY_SIZE(pmx_mii1_modes), |
| 338 | .enb_on_reset = 1, |
| 339 | }; |
| 340 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 341 | static struct pmx_dev_mode pmx_smii0_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 342 | { |
| 343 | .ids = AUTO_NET_SMII_MODE | AUTO_EXP_MODE | SMALL_PRINTERS_MODE, |
| 344 | .mask = PMX_MII_MASK, |
| 345 | }, |
| 346 | }; |
| 347 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 348 | struct pmx_dev spear320_pmx_smii0 = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 349 | .name = "smii0", |
| 350 | .modes = pmx_smii0_modes, |
| 351 | .mode_count = ARRAY_SIZE(pmx_smii0_modes), |
| 352 | .enb_on_reset = 1, |
| 353 | }; |
| 354 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 355 | static struct pmx_dev_mode pmx_smii1_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 356 | { |
| 357 | .ids = AUTO_NET_SMII_MODE | SMALL_PRINTERS_MODE, |
| 358 | .mask = PMX_MII_MASK, |
| 359 | }, |
| 360 | }; |
| 361 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 362 | struct pmx_dev spear320_pmx_smii1 = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 363 | .name = "smii1", |
| 364 | .modes = pmx_smii1_modes, |
| 365 | .mode_count = ARRAY_SIZE(pmx_smii1_modes), |
| 366 | .enb_on_reset = 1, |
| 367 | }; |
| 368 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 369 | static struct pmx_dev_mode pmx_i2c1_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 370 | { |
| 371 | .ids = AUTO_EXP_MODE, |
| 372 | .mask = 0x0, |
| 373 | }, |
| 374 | }; |
| 375 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 376 | struct pmx_dev spear320_pmx_i2c1 = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 377 | .name = "i2c1", |
| 378 | .modes = pmx_i2c1_modes, |
| 379 | .mode_count = ARRAY_SIZE(pmx_i2c1_modes), |
| 380 | .enb_on_reset = 1, |
| 381 | }; |
| 382 | |
| 383 | /* pmx driver structure */ |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 384 | static struct pmx_driver pmx_driver = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 385 | .mode_reg = {.offset = MODE_CONFIG_REG, .mask = 0x00000007}, |
| 386 | .mux_reg = {.offset = PAD_MUX_CONFIG_REG, .mask = 0x00007fff}, |
| 387 | }; |
| 388 | |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 389 | /* spear3xx shared irq */ |
Ryan Mallon | f6558bf | 2011-05-20 08:34:20 +0100 | [diff] [blame] | 390 | static struct shirq_dev_config shirq_ras1_config[] = { |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 391 | { |
Ryan Mallon | 61e72bc | 2011-05-20 08:34:21 +0100 | [diff] [blame] | 392 | .virq = SPEAR320_VIRQ_EMI, |
| 393 | .status_mask = SPEAR320_EMI_IRQ_MASK, |
| 394 | .clear_mask = SPEAR320_EMI_IRQ_MASK, |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 395 | }, { |
Ryan Mallon | 61e72bc | 2011-05-20 08:34:21 +0100 | [diff] [blame] | 396 | .virq = SPEAR320_VIRQ_CLCD, |
| 397 | .status_mask = SPEAR320_CLCD_IRQ_MASK, |
| 398 | .clear_mask = SPEAR320_CLCD_IRQ_MASK, |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 399 | }, { |
Ryan Mallon | 61e72bc | 2011-05-20 08:34:21 +0100 | [diff] [blame] | 400 | .virq = SPEAR320_VIRQ_SPP, |
| 401 | .status_mask = SPEAR320_SPP_IRQ_MASK, |
| 402 | .clear_mask = SPEAR320_SPP_IRQ_MASK, |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 403 | }, |
| 404 | }; |
| 405 | |
Ryan Mallon | f6558bf | 2011-05-20 08:34:20 +0100 | [diff] [blame] | 406 | static struct spear_shirq shirq_ras1 = { |
Ryan Mallon | 61e72bc | 2011-05-20 08:34:21 +0100 | [diff] [blame] | 407 | .irq = SPEAR3XX_IRQ_GEN_RAS_1, |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 408 | .dev_config = shirq_ras1_config, |
| 409 | .dev_count = ARRAY_SIZE(shirq_ras1_config), |
| 410 | .regs = { |
| 411 | .enb_reg = -1, |
Ryan Mallon | 61e72bc | 2011-05-20 08:34:21 +0100 | [diff] [blame] | 412 | .status_reg = SPEAR320_INT_STS_MASK_REG, |
| 413 | .status_reg_mask = SPEAR320_SHIRQ_RAS1_MASK, |
| 414 | .clear_reg = SPEAR320_INT_CLR_MASK_REG, |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 415 | .reset_to_clear = 1, |
| 416 | }, |
| 417 | }; |
| 418 | |
Ryan Mallon | f6558bf | 2011-05-20 08:34:20 +0100 | [diff] [blame] | 419 | static struct shirq_dev_config shirq_ras3_config[] = { |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 420 | { |
Ryan Mallon | 61e72bc | 2011-05-20 08:34:21 +0100 | [diff] [blame] | 421 | .virq = SPEAR320_VIRQ_PLGPIO, |
| 422 | .enb_mask = SPEAR320_GPIO_IRQ_MASK, |
| 423 | .status_mask = SPEAR320_GPIO_IRQ_MASK, |
| 424 | .clear_mask = SPEAR320_GPIO_IRQ_MASK, |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 425 | }, { |
Ryan Mallon | 61e72bc | 2011-05-20 08:34:21 +0100 | [diff] [blame] | 426 | .virq = SPEAR320_VIRQ_I2S_PLAY, |
| 427 | .enb_mask = SPEAR320_I2S_PLAY_IRQ_MASK, |
| 428 | .status_mask = SPEAR320_I2S_PLAY_IRQ_MASK, |
| 429 | .clear_mask = SPEAR320_I2S_PLAY_IRQ_MASK, |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 430 | }, { |
Ryan Mallon | 61e72bc | 2011-05-20 08:34:21 +0100 | [diff] [blame] | 431 | .virq = SPEAR320_VIRQ_I2S_REC, |
| 432 | .enb_mask = SPEAR320_I2S_REC_IRQ_MASK, |
| 433 | .status_mask = SPEAR320_I2S_REC_IRQ_MASK, |
| 434 | .clear_mask = SPEAR320_I2S_REC_IRQ_MASK, |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 435 | }, |
| 436 | }; |
| 437 | |
Ryan Mallon | f6558bf | 2011-05-20 08:34:20 +0100 | [diff] [blame] | 438 | static struct spear_shirq shirq_ras3 = { |
Ryan Mallon | 61e72bc | 2011-05-20 08:34:21 +0100 | [diff] [blame] | 439 | .irq = SPEAR3XX_IRQ_GEN_RAS_3, |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 440 | .dev_config = shirq_ras3_config, |
| 441 | .dev_count = ARRAY_SIZE(shirq_ras3_config), |
| 442 | .regs = { |
Ryan Mallon | 61e72bc | 2011-05-20 08:34:21 +0100 | [diff] [blame] | 443 | .enb_reg = SPEAR320_INT_ENB_MASK_REG, |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 444 | .reset_to_enb = 1, |
Ryan Mallon | 61e72bc | 2011-05-20 08:34:21 +0100 | [diff] [blame] | 445 | .status_reg = SPEAR320_INT_STS_MASK_REG, |
| 446 | .status_reg_mask = SPEAR320_SHIRQ_RAS3_MASK, |
| 447 | .clear_reg = SPEAR320_INT_CLR_MASK_REG, |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 448 | .reset_to_clear = 1, |
| 449 | }, |
| 450 | }; |
| 451 | |
Ryan Mallon | f6558bf | 2011-05-20 08:34:20 +0100 | [diff] [blame] | 452 | static struct shirq_dev_config shirq_intrcomm_ras_config[] = { |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 453 | { |
Ryan Mallon | 61e72bc | 2011-05-20 08:34:21 +0100 | [diff] [blame] | 454 | .virq = SPEAR320_VIRQ_CANU, |
| 455 | .status_mask = SPEAR320_CAN_U_IRQ_MASK, |
| 456 | .clear_mask = SPEAR320_CAN_U_IRQ_MASK, |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 457 | }, { |
Ryan Mallon | 61e72bc | 2011-05-20 08:34:21 +0100 | [diff] [blame] | 458 | .virq = SPEAR320_VIRQ_CANL, |
| 459 | .status_mask = SPEAR320_CAN_L_IRQ_MASK, |
| 460 | .clear_mask = SPEAR320_CAN_L_IRQ_MASK, |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 461 | }, { |
Ryan Mallon | 61e72bc | 2011-05-20 08:34:21 +0100 | [diff] [blame] | 462 | .virq = SPEAR320_VIRQ_UART1, |
| 463 | .status_mask = SPEAR320_UART1_IRQ_MASK, |
| 464 | .clear_mask = SPEAR320_UART1_IRQ_MASK, |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 465 | }, { |
Ryan Mallon | 61e72bc | 2011-05-20 08:34:21 +0100 | [diff] [blame] | 466 | .virq = SPEAR320_VIRQ_UART2, |
| 467 | .status_mask = SPEAR320_UART2_IRQ_MASK, |
| 468 | .clear_mask = SPEAR320_UART2_IRQ_MASK, |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 469 | }, { |
Ryan Mallon | 61e72bc | 2011-05-20 08:34:21 +0100 | [diff] [blame] | 470 | .virq = SPEAR320_VIRQ_SSP1, |
| 471 | .status_mask = SPEAR320_SSP1_IRQ_MASK, |
| 472 | .clear_mask = SPEAR320_SSP1_IRQ_MASK, |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 473 | }, { |
Ryan Mallon | 61e72bc | 2011-05-20 08:34:21 +0100 | [diff] [blame] | 474 | .virq = SPEAR320_VIRQ_SSP2, |
| 475 | .status_mask = SPEAR320_SSP2_IRQ_MASK, |
| 476 | .clear_mask = SPEAR320_SSP2_IRQ_MASK, |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 477 | }, { |
Ryan Mallon | 61e72bc | 2011-05-20 08:34:21 +0100 | [diff] [blame] | 478 | .virq = SPEAR320_VIRQ_SMII0, |
| 479 | .status_mask = SPEAR320_SMII0_IRQ_MASK, |
| 480 | .clear_mask = SPEAR320_SMII0_IRQ_MASK, |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 481 | }, { |
Ryan Mallon | 61e72bc | 2011-05-20 08:34:21 +0100 | [diff] [blame] | 482 | .virq = SPEAR320_VIRQ_MII1_SMII1, |
| 483 | .status_mask = SPEAR320_MII1_SMII1_IRQ_MASK, |
| 484 | .clear_mask = SPEAR320_MII1_SMII1_IRQ_MASK, |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 485 | }, { |
Ryan Mallon | 61e72bc | 2011-05-20 08:34:21 +0100 | [diff] [blame] | 486 | .virq = SPEAR320_VIRQ_WAKEUP_SMII0, |
| 487 | .status_mask = SPEAR320_WAKEUP_SMII0_IRQ_MASK, |
| 488 | .clear_mask = SPEAR320_WAKEUP_SMII0_IRQ_MASK, |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 489 | }, { |
Ryan Mallon | 61e72bc | 2011-05-20 08:34:21 +0100 | [diff] [blame] | 490 | .virq = SPEAR320_VIRQ_WAKEUP_MII1_SMII1, |
| 491 | .status_mask = SPEAR320_WAKEUP_MII1_SMII1_IRQ_MASK, |
| 492 | .clear_mask = SPEAR320_WAKEUP_MII1_SMII1_IRQ_MASK, |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 493 | }, { |
Ryan Mallon | 61e72bc | 2011-05-20 08:34:21 +0100 | [diff] [blame] | 494 | .virq = SPEAR320_VIRQ_I2C1, |
| 495 | .status_mask = SPEAR320_I2C1_IRQ_MASK, |
| 496 | .clear_mask = SPEAR320_I2C1_IRQ_MASK, |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 497 | }, |
| 498 | }; |
| 499 | |
Ryan Mallon | f6558bf | 2011-05-20 08:34:20 +0100 | [diff] [blame] | 500 | static struct spear_shirq shirq_intrcomm_ras = { |
Ryan Mallon | 61e72bc | 2011-05-20 08:34:21 +0100 | [diff] [blame] | 501 | .irq = SPEAR3XX_IRQ_INTRCOMM_RAS_ARM, |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 502 | .dev_config = shirq_intrcomm_ras_config, |
| 503 | .dev_count = ARRAY_SIZE(shirq_intrcomm_ras_config), |
| 504 | .regs = { |
| 505 | .enb_reg = -1, |
Ryan Mallon | 61e72bc | 2011-05-20 08:34:21 +0100 | [diff] [blame] | 506 | .status_reg = SPEAR320_INT_STS_MASK_REG, |
| 507 | .status_reg_mask = SPEAR320_SHIRQ_INTRCOMM_RAS_MASK, |
| 508 | .clear_reg = SPEAR320_INT_CLR_MASK_REG, |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 509 | .reset_to_clear = 1, |
| 510 | }, |
| 511 | }; |
| 512 | |
viresh kumar | c2c0783 | 2011-03-07 05:57:05 +0100 | [diff] [blame] | 513 | /* Add spear320 specific devices here */ |
| 514 | |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 515 | /* spear320 routines */ |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 516 | void __init spear320_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs, |
| 517 | u8 pmx_dev_count) |
viresh kumar | bc4e814 | 2010-04-01 12:30:58 +0100 | [diff] [blame] | 518 | { |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 519 | void __iomem *base; |
| 520 | int ret = 0; |
| 521 | |
viresh kumar | bc4e814 | 2010-04-01 12:30:58 +0100 | [diff] [blame] | 522 | /* call spear3xx family common init function */ |
| 523 | spear3xx_init(); |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 524 | |
Uwe Kleine-König | b595076 | 2010-11-01 15:38:34 -0400 | [diff] [blame] | 525 | /* shared irq registration */ |
viresh kumar | 5382116 | 2011-03-07 05:57:06 +0100 | [diff] [blame] | 526 | base = ioremap(SPEAR320_SOC_CONFIG_BASE, SZ_4K); |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 527 | if (base) { |
| 528 | /* shirq 1 */ |
| 529 | shirq_ras1.regs.base = base; |
| 530 | ret = spear_shirq_register(&shirq_ras1); |
| 531 | if (ret) |
Viresh Kumar | 5fb00f9 | 2012-03-26 10:39:43 +0530 | [diff] [blame^] | 532 | pr_err("Error registering Shared IRQ 1\n"); |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 533 | |
| 534 | /* shirq 3 */ |
| 535 | shirq_ras3.regs.base = base; |
| 536 | ret = spear_shirq_register(&shirq_ras3); |
| 537 | if (ret) |
Viresh Kumar | 5fb00f9 | 2012-03-26 10:39:43 +0530 | [diff] [blame^] | 538 | pr_err("Error registering Shared IRQ 3\n"); |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 539 | |
| 540 | /* shirq 4 */ |
| 541 | shirq_intrcomm_ras.regs.base = base; |
| 542 | ret = spear_shirq_register(&shirq_intrcomm_ras); |
| 543 | if (ret) |
Viresh Kumar | 5fb00f9 | 2012-03-26 10:39:43 +0530 | [diff] [blame^] | 544 | pr_err("Error registering Shared IRQ 4\n"); |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 545 | } |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 546 | |
viresh kumar | 53688c5 | 2011-02-16 07:40:30 +0100 | [diff] [blame] | 547 | /* pmx initialization */ |
| 548 | pmx_driver.base = base; |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 549 | pmx_driver.mode = pmx_mode; |
| 550 | pmx_driver.devs = pmx_devs; |
| 551 | pmx_driver.devs_count = pmx_dev_count; |
| 552 | |
viresh kumar | 53688c5 | 2011-02-16 07:40:30 +0100 | [diff] [blame] | 553 | ret = pmx_register(&pmx_driver); |
| 554 | if (ret) |
Viresh Kumar | 5fb00f9 | 2012-03-26 10:39:43 +0530 | [diff] [blame^] | 555 | pr_err("padmux: registration failed. err no: %d\n", ret); |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 556 | } |