viresh kumar | bc4e814 | 2010-04-01 12:30:58 +0100 | [diff] [blame] | 1 | /* |
| 2 | * arch/arm/mach-spear3xx/spear300.c |
| 3 | * |
| 4 | * SPEAr300 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 | |
| 14 | #include <linux/types.h> |
| 15 | #include <linux/amba/pl061.h> |
| 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 0x00 |
| 25 | #define MODE_CONFIG_REG 0x04 |
| 26 | |
| 27 | /* modes */ |
| 28 | #define NAND_MODE (1 << 0) |
| 29 | #define NOR_MODE (1 << 1) |
| 30 | #define PHOTO_FRAME_MODE (1 << 2) |
| 31 | #define LEND_IP_PHONE_MODE (1 << 3) |
| 32 | #define HEND_IP_PHONE_MODE (1 << 4) |
| 33 | #define LEND_WIFI_PHONE_MODE (1 << 5) |
| 34 | #define HEND_WIFI_PHONE_MODE (1 << 6) |
| 35 | #define ATA_PABX_WI2S_MODE (1 << 7) |
| 36 | #define ATA_PABX_I2S_MODE (1 << 8) |
| 37 | #define CAML_LCDW_MODE (1 << 9) |
| 38 | #define CAMU_LCD_MODE (1 << 10) |
| 39 | #define CAMU_WLCD_MODE (1 << 11) |
| 40 | #define CAML_LCD_MODE (1 << 12) |
| 41 | #define ALL_MODES 0x1FFF |
| 42 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 43 | struct pmx_mode spear300_nand_mode = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 44 | .id = NAND_MODE, |
| 45 | .name = "nand mode", |
| 46 | .mask = 0x00, |
| 47 | }; |
| 48 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 49 | struct pmx_mode spear300_nor_mode = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 50 | .id = NOR_MODE, |
| 51 | .name = "nor mode", |
| 52 | .mask = 0x01, |
| 53 | }; |
| 54 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 55 | struct pmx_mode spear300_photo_frame_mode = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 56 | .id = PHOTO_FRAME_MODE, |
| 57 | .name = "photo frame mode", |
| 58 | .mask = 0x02, |
| 59 | }; |
| 60 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 61 | struct pmx_mode spear300_lend_ip_phone_mode = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 62 | .id = LEND_IP_PHONE_MODE, |
| 63 | .name = "lend ip phone mode", |
| 64 | .mask = 0x03, |
| 65 | }; |
| 66 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 67 | struct pmx_mode spear300_hend_ip_phone_mode = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 68 | .id = HEND_IP_PHONE_MODE, |
| 69 | .name = "hend ip phone mode", |
| 70 | .mask = 0x04, |
| 71 | }; |
| 72 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 73 | struct pmx_mode spear300_lend_wifi_phone_mode = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 74 | .id = LEND_WIFI_PHONE_MODE, |
| 75 | .name = "lend wifi phone mode", |
| 76 | .mask = 0x05, |
| 77 | }; |
| 78 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 79 | struct pmx_mode spear300_hend_wifi_phone_mode = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 80 | .id = HEND_WIFI_PHONE_MODE, |
| 81 | .name = "hend wifi phone mode", |
| 82 | .mask = 0x06, |
| 83 | }; |
| 84 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 85 | struct pmx_mode spear300_ata_pabx_wi2s_mode = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 86 | .id = ATA_PABX_WI2S_MODE, |
| 87 | .name = "ata pabx wi2s mode", |
| 88 | .mask = 0x07, |
| 89 | }; |
| 90 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 91 | struct pmx_mode spear300_ata_pabx_i2s_mode = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 92 | .id = ATA_PABX_I2S_MODE, |
| 93 | .name = "ata pabx i2s mode", |
| 94 | .mask = 0x08, |
| 95 | }; |
| 96 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 97 | struct pmx_mode spear300_caml_lcdw_mode = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 98 | .id = CAML_LCDW_MODE, |
| 99 | .name = "caml lcdw mode", |
| 100 | .mask = 0x0C, |
| 101 | }; |
| 102 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 103 | struct pmx_mode spear300_camu_lcd_mode = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 104 | .id = CAMU_LCD_MODE, |
| 105 | .name = "camu lcd mode", |
| 106 | .mask = 0x0D, |
| 107 | }; |
| 108 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 109 | struct pmx_mode spear300_camu_wlcd_mode = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 110 | .id = CAMU_WLCD_MODE, |
| 111 | .name = "camu wlcd mode", |
| 112 | .mask = 0x0E, |
| 113 | }; |
| 114 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 115 | struct pmx_mode spear300_caml_lcd_mode = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 116 | .id = CAML_LCD_MODE, |
| 117 | .name = "caml lcd mode", |
| 118 | .mask = 0x0F, |
| 119 | }; |
| 120 | |
| 121 | /* devices */ |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 122 | static struct pmx_dev_mode pmx_fsmc_2_chips_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 123 | { |
| 124 | .ids = NAND_MODE | NOR_MODE | PHOTO_FRAME_MODE | |
| 125 | ATA_PABX_WI2S_MODE | ATA_PABX_I2S_MODE, |
| 126 | .mask = PMX_FIRDA_MASK, |
| 127 | }, |
| 128 | }; |
| 129 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 130 | struct pmx_dev spear300_pmx_fsmc_2_chips = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 131 | .name = "fsmc_2_chips", |
| 132 | .modes = pmx_fsmc_2_chips_modes, |
| 133 | .mode_count = ARRAY_SIZE(pmx_fsmc_2_chips_modes), |
| 134 | .enb_on_reset = 1, |
| 135 | }; |
| 136 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 137 | static struct pmx_dev_mode pmx_fsmc_4_chips_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 138 | { |
| 139 | .ids = NAND_MODE | NOR_MODE | PHOTO_FRAME_MODE | |
| 140 | ATA_PABX_WI2S_MODE | ATA_PABX_I2S_MODE, |
| 141 | .mask = PMX_FIRDA_MASK | PMX_UART0_MASK, |
| 142 | }, |
| 143 | }; |
| 144 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 145 | struct pmx_dev spear300_pmx_fsmc_4_chips = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 146 | .name = "fsmc_4_chips", |
| 147 | .modes = pmx_fsmc_4_chips_modes, |
| 148 | .mode_count = ARRAY_SIZE(pmx_fsmc_4_chips_modes), |
| 149 | .enb_on_reset = 1, |
| 150 | }; |
| 151 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 152 | static struct pmx_dev_mode pmx_keyboard_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 153 | { |
| 154 | .ids = LEND_IP_PHONE_MODE | HEND_IP_PHONE_MODE | |
| 155 | LEND_WIFI_PHONE_MODE | HEND_WIFI_PHONE_MODE | |
| 156 | CAML_LCDW_MODE | CAMU_LCD_MODE | CAMU_WLCD_MODE | |
| 157 | CAML_LCD_MODE, |
| 158 | .mask = 0x0, |
| 159 | }, |
| 160 | }; |
| 161 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 162 | struct pmx_dev spear300_pmx_keyboard = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 163 | .name = "keyboard", |
| 164 | .modes = pmx_keyboard_modes, |
| 165 | .mode_count = ARRAY_SIZE(pmx_keyboard_modes), |
| 166 | .enb_on_reset = 1, |
| 167 | }; |
| 168 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 169 | static struct pmx_dev_mode pmx_clcd_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 170 | { |
| 171 | .ids = PHOTO_FRAME_MODE, |
| 172 | .mask = PMX_TIMER_1_2_MASK | PMX_TIMER_3_4_MASK , |
| 173 | }, { |
| 174 | .ids = HEND_IP_PHONE_MODE | HEND_WIFI_PHONE_MODE | |
| 175 | CAMU_LCD_MODE | CAML_LCD_MODE, |
| 176 | .mask = PMX_TIMER_3_4_MASK, |
| 177 | }, |
| 178 | }; |
| 179 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 180 | struct pmx_dev spear300_pmx_clcd = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 181 | .name = "clcd", |
| 182 | .modes = pmx_clcd_modes, |
| 183 | .mode_count = ARRAY_SIZE(pmx_clcd_modes), |
| 184 | .enb_on_reset = 1, |
| 185 | }; |
| 186 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 187 | static struct pmx_dev_mode pmx_telecom_gpio_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 188 | { |
| 189 | .ids = PHOTO_FRAME_MODE | CAMU_LCD_MODE | CAML_LCD_MODE, |
| 190 | .mask = PMX_MII_MASK, |
| 191 | }, { |
| 192 | .ids = LEND_IP_PHONE_MODE | LEND_WIFI_PHONE_MODE, |
| 193 | .mask = PMX_MII_MASK | PMX_TIMER_1_2_MASK | PMX_TIMER_3_4_MASK, |
| 194 | }, { |
| 195 | .ids = ATA_PABX_I2S_MODE | CAML_LCDW_MODE | CAMU_WLCD_MODE, |
| 196 | .mask = PMX_MII_MASK | PMX_TIMER_3_4_MASK, |
| 197 | }, { |
| 198 | .ids = HEND_IP_PHONE_MODE | HEND_WIFI_PHONE_MODE, |
| 199 | .mask = PMX_MII_MASK | PMX_TIMER_1_2_MASK, |
| 200 | }, { |
| 201 | .ids = ATA_PABX_WI2S_MODE, |
| 202 | .mask = PMX_MII_MASK | PMX_TIMER_1_2_MASK | PMX_TIMER_3_4_MASK |
| 203 | | PMX_UART0_MODEM_MASK, |
| 204 | }, |
| 205 | }; |
| 206 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 207 | struct pmx_dev spear300_pmx_telecom_gpio = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 208 | .name = "telecom_gpio", |
| 209 | .modes = pmx_telecom_gpio_modes, |
| 210 | .mode_count = ARRAY_SIZE(pmx_telecom_gpio_modes), |
| 211 | .enb_on_reset = 1, |
| 212 | }; |
| 213 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 214 | static struct pmx_dev_mode pmx_telecom_tdm_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 215 | { |
| 216 | .ids = PHOTO_FRAME_MODE | LEND_IP_PHONE_MODE | |
| 217 | HEND_IP_PHONE_MODE | LEND_WIFI_PHONE_MODE |
| 218 | | HEND_WIFI_PHONE_MODE | ATA_PABX_WI2S_MODE |
| 219 | | ATA_PABX_I2S_MODE | CAML_LCDW_MODE | CAMU_LCD_MODE |
| 220 | | CAMU_WLCD_MODE | CAML_LCD_MODE, |
| 221 | .mask = PMX_UART0_MODEM_MASK | PMX_SSP_CS_MASK, |
| 222 | }, |
| 223 | }; |
| 224 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 225 | struct pmx_dev spear300_pmx_telecom_tdm = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 226 | .name = "telecom_tdm", |
| 227 | .modes = pmx_telecom_tdm_modes, |
| 228 | .mode_count = ARRAY_SIZE(pmx_telecom_tdm_modes), |
| 229 | .enb_on_reset = 1, |
| 230 | }; |
| 231 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 232 | static struct pmx_dev_mode pmx_telecom_spi_cs_i2c_clk_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 233 | { |
| 234 | .ids = LEND_IP_PHONE_MODE | HEND_IP_PHONE_MODE | |
| 235 | LEND_WIFI_PHONE_MODE | HEND_WIFI_PHONE_MODE |
| 236 | | ATA_PABX_WI2S_MODE | ATA_PABX_I2S_MODE | |
| 237 | CAML_LCDW_MODE | CAML_LCD_MODE, |
| 238 | .mask = PMX_TIMER_1_2_MASK | PMX_TIMER_3_4_MASK, |
| 239 | }, |
| 240 | }; |
| 241 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 242 | struct pmx_dev spear300_pmx_telecom_spi_cs_i2c_clk = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 243 | .name = "telecom_spi_cs_i2c_clk", |
| 244 | .modes = pmx_telecom_spi_cs_i2c_clk_modes, |
| 245 | .mode_count = ARRAY_SIZE(pmx_telecom_spi_cs_i2c_clk_modes), |
| 246 | .enb_on_reset = 1, |
| 247 | }; |
| 248 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 249 | static struct pmx_dev_mode pmx_telecom_camera_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 250 | { |
| 251 | .ids = CAML_LCDW_MODE | CAML_LCD_MODE, |
| 252 | .mask = PMX_MII_MASK, |
| 253 | }, { |
| 254 | .ids = CAMU_LCD_MODE | CAMU_WLCD_MODE, |
| 255 | .mask = PMX_TIMER_1_2_MASK | PMX_TIMER_3_4_MASK | PMX_MII_MASK, |
| 256 | }, |
| 257 | }; |
| 258 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 259 | struct pmx_dev spear300_pmx_telecom_camera = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 260 | .name = "telecom_camera", |
| 261 | .modes = pmx_telecom_camera_modes, |
| 262 | .mode_count = ARRAY_SIZE(pmx_telecom_camera_modes), |
| 263 | .enb_on_reset = 1, |
| 264 | }; |
| 265 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 266 | static struct pmx_dev_mode pmx_telecom_dac_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 267 | { |
| 268 | .ids = ATA_PABX_I2S_MODE | CAML_LCDW_MODE | CAMU_LCD_MODE |
| 269 | | CAMU_WLCD_MODE | CAML_LCD_MODE, |
| 270 | .mask = PMX_TIMER_1_2_MASK, |
| 271 | }, |
| 272 | }; |
| 273 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 274 | struct pmx_dev spear300_pmx_telecom_dac = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 275 | .name = "telecom_dac", |
| 276 | .modes = pmx_telecom_dac_modes, |
| 277 | .mode_count = ARRAY_SIZE(pmx_telecom_dac_modes), |
| 278 | .enb_on_reset = 1, |
| 279 | }; |
| 280 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 281 | static struct pmx_dev_mode pmx_telecom_i2s_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 282 | { |
| 283 | .ids = LEND_IP_PHONE_MODE | HEND_IP_PHONE_MODE |
| 284 | | LEND_WIFI_PHONE_MODE | HEND_WIFI_PHONE_MODE | |
| 285 | ATA_PABX_I2S_MODE | CAML_LCDW_MODE | CAMU_LCD_MODE |
| 286 | | CAMU_WLCD_MODE | CAML_LCD_MODE, |
| 287 | .mask = PMX_UART0_MODEM_MASK, |
| 288 | }, |
| 289 | }; |
| 290 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 291 | struct pmx_dev spear300_pmx_telecom_i2s = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 292 | .name = "telecom_i2s", |
| 293 | .modes = pmx_telecom_i2s_modes, |
| 294 | .mode_count = ARRAY_SIZE(pmx_telecom_i2s_modes), |
| 295 | .enb_on_reset = 1, |
| 296 | }; |
| 297 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 298 | static struct pmx_dev_mode pmx_telecom_boot_pins_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 299 | { |
| 300 | .ids = NAND_MODE | NOR_MODE, |
| 301 | .mask = PMX_UART0_MODEM_MASK | PMX_TIMER_1_2_MASK | |
| 302 | PMX_TIMER_3_4_MASK, |
| 303 | }, |
| 304 | }; |
| 305 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 306 | struct pmx_dev spear300_pmx_telecom_boot_pins = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 307 | .name = "telecom_boot_pins", |
| 308 | .modes = pmx_telecom_boot_pins_modes, |
| 309 | .mode_count = ARRAY_SIZE(pmx_telecom_boot_pins_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_telecom_sdhci_4bit_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 314 | { |
| 315 | .ids = PHOTO_FRAME_MODE | LEND_IP_PHONE_MODE | |
| 316 | HEND_IP_PHONE_MODE | LEND_WIFI_PHONE_MODE | |
| 317 | HEND_WIFI_PHONE_MODE | CAML_LCDW_MODE | CAMU_LCD_MODE | |
| 318 | CAMU_WLCD_MODE | CAML_LCD_MODE | ATA_PABX_WI2S_MODE | |
| 319 | ATA_PABX_I2S_MODE, |
| 320 | .mask = PMX_GPIO_PIN0_MASK | PMX_GPIO_PIN1_MASK | |
| 321 | PMX_GPIO_PIN2_MASK | PMX_GPIO_PIN3_MASK | |
| 322 | PMX_GPIO_PIN4_MASK | PMX_GPIO_PIN5_MASK, |
| 323 | }, |
| 324 | }; |
| 325 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 326 | struct pmx_dev spear300_pmx_telecom_sdhci_4bit = { |
viresh kumar | 069580b | 2011-03-07 05:57:03 +0100 | [diff] [blame] | 327 | .name = "telecom_sdhci_4bit", |
| 328 | .modes = pmx_telecom_sdhci_4bit_modes, |
| 329 | .mode_count = ARRAY_SIZE(pmx_telecom_sdhci_4bit_modes), |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 330 | .enb_on_reset = 1, |
| 331 | }; |
| 332 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 333 | static struct pmx_dev_mode pmx_telecom_sdhci_8bit_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 334 | { |
| 335 | .ids = PHOTO_FRAME_MODE | LEND_IP_PHONE_MODE | |
| 336 | HEND_IP_PHONE_MODE | LEND_WIFI_PHONE_MODE | |
| 337 | HEND_WIFI_PHONE_MODE | CAML_LCDW_MODE | CAMU_LCD_MODE | |
| 338 | CAMU_WLCD_MODE | CAML_LCD_MODE, |
| 339 | .mask = PMX_GPIO_PIN0_MASK | PMX_GPIO_PIN1_MASK | |
| 340 | PMX_GPIO_PIN2_MASK | PMX_GPIO_PIN3_MASK | |
| 341 | PMX_GPIO_PIN4_MASK | PMX_GPIO_PIN5_MASK | PMX_MII_MASK, |
| 342 | }, |
| 343 | }; |
| 344 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 345 | struct pmx_dev spear300_pmx_telecom_sdhci_8bit = { |
viresh kumar | 069580b | 2011-03-07 05:57:03 +0100 | [diff] [blame] | 346 | .name = "telecom_sdhci_8bit", |
| 347 | .modes = pmx_telecom_sdhci_8bit_modes, |
| 348 | .mode_count = ARRAY_SIZE(pmx_telecom_sdhci_8bit_modes), |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 349 | .enb_on_reset = 1, |
| 350 | }; |
| 351 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 352 | static struct pmx_dev_mode pmx_gpio1_modes[] = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 353 | { |
| 354 | .ids = PHOTO_FRAME_MODE, |
| 355 | .mask = PMX_UART0_MODEM_MASK | PMX_TIMER_1_2_MASK | |
| 356 | PMX_TIMER_3_4_MASK, |
| 357 | }, |
| 358 | }; |
| 359 | |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 360 | struct pmx_dev spear300_pmx_gpio1 = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 361 | .name = "arm gpio1", |
| 362 | .modes = pmx_gpio1_modes, |
| 363 | .mode_count = ARRAY_SIZE(pmx_gpio1_modes), |
| 364 | .enb_on_reset = 1, |
| 365 | }; |
| 366 | |
| 367 | /* pmx driver structure */ |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 368 | static struct pmx_driver pmx_driver = { |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 369 | .mode_reg = {.offset = MODE_CONFIG_REG, .mask = 0x0000000f}, |
| 370 | .mux_reg = {.offset = PAD_MUX_CONFIG_REG, .mask = 0x00007fff}, |
| 371 | }; |
| 372 | |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 373 | /* spear3xx shared irq */ |
Ryan Mallon | f6558bf | 2011-05-20 08:34:20 +0100 | [diff] [blame] | 374 | static struct shirq_dev_config shirq_ras1_config[] = { |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 375 | { |
Ryan Mallon | 61e72bc | 2011-05-20 08:34:21 +0100 | [diff] [blame] | 376 | .virq = SPEAR300_VIRQ_IT_PERS_S, |
| 377 | .enb_mask = SPEAR300_IT_PERS_S_IRQ_MASK, |
| 378 | .status_mask = SPEAR300_IT_PERS_S_IRQ_MASK, |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 379 | }, { |
Ryan Mallon | 61e72bc | 2011-05-20 08:34:21 +0100 | [diff] [blame] | 380 | .virq = SPEAR300_VIRQ_IT_CHANGE_S, |
| 381 | .enb_mask = SPEAR300_IT_CHANGE_S_IRQ_MASK, |
| 382 | .status_mask = SPEAR300_IT_CHANGE_S_IRQ_MASK, |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 383 | }, { |
Ryan Mallon | 61e72bc | 2011-05-20 08:34:21 +0100 | [diff] [blame] | 384 | .virq = SPEAR300_VIRQ_I2S, |
| 385 | .enb_mask = SPEAR300_I2S_IRQ_MASK, |
| 386 | .status_mask = SPEAR300_I2S_IRQ_MASK, |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 387 | }, { |
Ryan Mallon | 61e72bc | 2011-05-20 08:34:21 +0100 | [diff] [blame] | 388 | .virq = SPEAR300_VIRQ_TDM, |
| 389 | .enb_mask = SPEAR300_TDM_IRQ_MASK, |
| 390 | .status_mask = SPEAR300_TDM_IRQ_MASK, |
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 = SPEAR300_VIRQ_CAMERA_L, |
| 393 | .enb_mask = SPEAR300_CAMERA_L_IRQ_MASK, |
| 394 | .status_mask = SPEAR300_CAMERA_L_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 = SPEAR300_VIRQ_CAMERA_F, |
| 397 | .enb_mask = SPEAR300_CAMERA_F_IRQ_MASK, |
| 398 | .status_mask = SPEAR300_CAMERA_F_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 = SPEAR300_VIRQ_CAMERA_V, |
| 401 | .enb_mask = SPEAR300_CAMERA_V_IRQ_MASK, |
| 402 | .status_mask = SPEAR300_CAMERA_V_IRQ_MASK, |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 403 | }, { |
Ryan Mallon | 61e72bc | 2011-05-20 08:34:21 +0100 | [diff] [blame] | 404 | .virq = SPEAR300_VIRQ_KEYBOARD, |
| 405 | .enb_mask = SPEAR300_KEYBOARD_IRQ_MASK, |
| 406 | .status_mask = SPEAR300_KEYBOARD_IRQ_MASK, |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 407 | }, { |
Ryan Mallon | 61e72bc | 2011-05-20 08:34:21 +0100 | [diff] [blame] | 408 | .virq = SPEAR300_VIRQ_GPIO1, |
| 409 | .enb_mask = SPEAR300_GPIO1_IRQ_MASK, |
| 410 | .status_mask = SPEAR300_GPIO1_IRQ_MASK, |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 411 | }, |
| 412 | }; |
| 413 | |
Ryan Mallon | f6558bf | 2011-05-20 08:34:20 +0100 | [diff] [blame] | 414 | static struct spear_shirq shirq_ras1 = { |
Ryan Mallon | 61e72bc | 2011-05-20 08:34:21 +0100 | [diff] [blame] | 415 | .irq = SPEAR3XX_IRQ_GEN_RAS_1, |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 416 | .dev_config = shirq_ras1_config, |
| 417 | .dev_count = ARRAY_SIZE(shirq_ras1_config), |
| 418 | .regs = { |
Ryan Mallon | 61e72bc | 2011-05-20 08:34:21 +0100 | [diff] [blame] | 419 | .enb_reg = SPEAR300_INT_ENB_MASK_REG, |
| 420 | .status_reg = SPEAR300_INT_STS_MASK_REG, |
| 421 | .status_reg_mask = SPEAR300_SHIRQ_RAS1_MASK, |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 422 | .clear_reg = -1, |
| 423 | }, |
viresh kumar | bc4e814 | 2010-04-01 12:30:58 +0100 | [diff] [blame] | 424 | }; |
| 425 | |
viresh kumar | c2c0783 | 2011-03-07 05:57:05 +0100 | [diff] [blame] | 426 | /* Add spear300 specific devices here */ |
| 427 | /* arm gpio1 device registration */ |
| 428 | static struct pl061_platform_data gpio1_plat_data = { |
| 429 | .gpio_base = 8, |
Ryan Mallon | 61e72bc | 2011-05-20 08:34:21 +0100 | [diff] [blame] | 430 | .irq_base = SPEAR300_GPIO1_INT_BASE, |
viresh kumar | c2c0783 | 2011-03-07 05:57:05 +0100 | [diff] [blame] | 431 | }; |
| 432 | |
Russell King | b5b654f | 2012-01-20 09:14:14 +0000 | [diff] [blame] | 433 | AMBA_APB_DEVICE(spear300_gpio1, "gpio1", 0, SPEAR300_GPIO_BASE, |
| 434 | {SPEAR300_VIRQ_GPIO1}, &gpio1_plat_data); |
viresh kumar | c2c0783 | 2011-03-07 05:57:05 +0100 | [diff] [blame] | 435 | |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 436 | /* spear300 routines */ |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 437 | void __init spear300_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs, |
| 438 | u8 pmx_dev_count) |
viresh kumar | bc4e814 | 2010-04-01 12:30:58 +0100 | [diff] [blame] | 439 | { |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 440 | int ret = 0; |
| 441 | |
viresh kumar | bc4e814 | 2010-04-01 12:30:58 +0100 | [diff] [blame] | 442 | /* call spear3xx family common init function */ |
| 443 | spear3xx_init(); |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 444 | |
Uwe Kleine-König | b595076 | 2010-11-01 15:38:34 -0400 | [diff] [blame] | 445 | /* shared irq registration */ |
viresh kumar | 5382116 | 2011-03-07 05:57:06 +0100 | [diff] [blame] | 446 | shirq_ras1.regs.base = ioremap(SPEAR300_TELECOM_BASE, SZ_4K); |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 447 | if (shirq_ras1.regs.base) { |
| 448 | ret = spear_shirq_register(&shirq_ras1); |
| 449 | if (ret) |
| 450 | printk(KERN_ERR "Error registering Shared IRQ\n"); |
| 451 | } |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 452 | |
viresh kumar | 53688c5 | 2011-02-16 07:40:30 +0100 | [diff] [blame] | 453 | /* pmx initialization */ |
Ryan Mallon | 6618c3a | 2011-05-20 08:34:22 +0100 | [diff] [blame] | 454 | pmx_driver.mode = pmx_mode; |
| 455 | pmx_driver.devs = pmx_devs; |
| 456 | pmx_driver.devs_count = pmx_dev_count; |
| 457 | |
viresh kumar | 5382116 | 2011-03-07 05:57:06 +0100 | [diff] [blame] | 458 | pmx_driver.base = ioremap(SPEAR300_SOC_CONFIG_BASE, SZ_4K); |
viresh kumar | 53688c5 | 2011-02-16 07:40:30 +0100 | [diff] [blame] | 459 | if (pmx_driver.base) { |
| 460 | ret = pmx_register(&pmx_driver); |
| 461 | if (ret) |
| 462 | printk(KERN_ERR "padmux: registeration failed. err no" |
| 463 | ": %d\n", ret); |
| 464 | /* Free Mapping, device selection already done */ |
| 465 | iounmap(pmx_driver.base); |
| 466 | } |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 467 | } |