Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 1 | /* |
| 2 | * |
| 3 | * arch/arm/mach-u300/core.c |
| 4 | * |
| 5 | * |
Linus Walleij | fcb28d2 | 2012-08-13 10:11:15 +0200 | [diff] [blame] | 6 | * Copyright (C) 2007-2012 ST-Ericsson SA |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 7 | * License terms: GNU General Public License (GPL) version 2 |
| 8 | * Core platform support, IRQ handling and device definitions. |
| 9 | * Author: Linus Walleij <linus.walleij@stericsson.com> |
| 10 | */ |
| 11 | #include <linux/kernel.h> |
| 12 | #include <linux/init.h> |
| 13 | #include <linux/spinlock.h> |
| 14 | #include <linux/interrupt.h> |
| 15 | #include <linux/bitops.h> |
| 16 | #include <linux/device.h> |
| 17 | #include <linux/mm.h> |
| 18 | #include <linux/termios.h> |
Linus Walleij | ec8f125 | 2010-08-13 11:31:59 +0200 | [diff] [blame] | 19 | #include <linux/dmaengine.h> |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 20 | #include <linux/amba/bus.h> |
Linus Walleij | a64ae39 | 2012-02-20 21:26:30 +0100 | [diff] [blame] | 21 | #include <linux/amba/mmci.h> |
Linus Walleij | ec8f125 | 2010-08-13 11:31:59 +0200 | [diff] [blame] | 22 | #include <linux/amba/serial.h> |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 23 | #include <linux/platform_device.h> |
| 24 | #include <linux/gpio.h> |
Linus Walleij | b7276b2 | 2010-08-05 07:58:58 +0100 | [diff] [blame] | 25 | #include <linux/clk.h> |
| 26 | #include <linux/err.h> |
Linus Walleij | 93ac5a5 | 2010-09-13 00:35:37 +0200 | [diff] [blame] | 27 | #include <linux/mtd/nand.h> |
| 28 | #include <linux/mtd/fsmc.h> |
Linus Walleij | 98da352 | 2011-05-02 20:54:38 +0200 | [diff] [blame] | 29 | #include <linux/pinctrl/machine.h> |
Linus Walleij | 51dddfe | 2012-01-20 17:53:15 +0100 | [diff] [blame] | 30 | #include <linux/pinctrl/pinconf-generic.h> |
Jon Medhurst | d70a596 | 2011-08-04 15:41:42 +0100 | [diff] [blame] | 31 | #include <linux/dma-mapping.h> |
Linus Walleij | 50667d6 | 2012-06-19 23:44:25 +0200 | [diff] [blame] | 32 | #include <linux/platform_data/clk-u300.h> |
Linus Walleij | 6517285 | 2012-08-13 10:56:43 +0200 | [diff] [blame] | 33 | #include <linux/platform_data/pinctrl-coh901.h> |
Linus Walleij | 9f575d9 | 2013-01-04 10:35:06 +0100 | [diff] [blame] | 34 | #include <linux/platform_data/dma-coh901318.h> |
Rob Herring | 9e47b8b | 2013-01-07 09:45:59 -0600 | [diff] [blame] | 35 | #include <linux/irqchip/arm-vic.h> |
Linus Walleij | 978577e | 2013-04-08 11:38:50 +0200 | [diff] [blame] | 36 | #include <linux/irqchip.h> |
| 37 | #include <linux/of_platform.h> |
| 38 | #include <linux/clocksource.h> |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 39 | |
| 40 | #include <asm/types.h> |
| 41 | #include <asm/setup.h> |
| 42 | #include <asm/memory.h> |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 43 | #include <asm/mach/map.h> |
Linus Walleij | 234323b | 2012-08-13 11:35:55 +0200 | [diff] [blame] | 44 | #include <asm/mach-types.h> |
| 45 | #include <asm/mach/arch.h> |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 46 | |
| 47 | #include <mach/hardware.h> |
| 48 | #include <mach/syscon.h> |
Linus Walleij | a4fe292 | 2012-08-13 13:49:45 +0200 | [diff] [blame] | 49 | #include <mach/irqs.h> |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 50 | |
Linus Walleij | 234323b | 2012-08-13 11:35:55 +0200 | [diff] [blame] | 51 | #include "timer.h" |
Linus Walleij | c7c8c78 | 2009-08-14 10:59:05 +0100 | [diff] [blame] | 52 | #include "spi.h" |
Linus Walleij | 6be2a0c | 2009-08-13 21:42:01 +0100 | [diff] [blame] | 53 | #include "i2c.h" |
Linus Walleij | a64ae39 | 2012-02-20 21:26:30 +0100 | [diff] [blame] | 54 | #include "u300-gpio.h" |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 55 | |
| 56 | /* |
| 57 | * Static I/O mappings that are needed for booting the U300 platforms. The |
| 58 | * only things we need are the areas where we find the timer, syscon and |
| 59 | * intcon, since the remaining device drivers will map their own memory |
| 60 | * physical to virtual as the need arise. |
| 61 | */ |
| 62 | static struct map_desc u300_io_desc[] __initdata = { |
| 63 | { |
| 64 | .virtual = U300_SLOW_PER_VIRT_BASE, |
| 65 | .pfn = __phys_to_pfn(U300_SLOW_PER_PHYS_BASE), |
| 66 | .length = SZ_64K, |
| 67 | .type = MT_DEVICE, |
| 68 | }, |
| 69 | { |
| 70 | .virtual = U300_AHB_PER_VIRT_BASE, |
| 71 | .pfn = __phys_to_pfn(U300_AHB_PER_PHYS_BASE), |
| 72 | .length = SZ_32K, |
| 73 | .type = MT_DEVICE, |
| 74 | }, |
| 75 | { |
| 76 | .virtual = U300_FAST_PER_VIRT_BASE, |
| 77 | .pfn = __phys_to_pfn(U300_FAST_PER_PHYS_BASE), |
| 78 | .length = SZ_32K, |
| 79 | .type = MT_DEVICE, |
| 80 | }, |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 81 | }; |
| 82 | |
Linus Walleij | 234323b | 2012-08-13 11:35:55 +0200 | [diff] [blame] | 83 | static void __init u300_map_io(void) |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 84 | { |
| 85 | iotable_init(u300_io_desc, ARRAY_SIZE(u300_io_desc)); |
| 86 | } |
| 87 | |
| 88 | /* |
| 89 | * Declaration of devices found on the U300 board and |
| 90 | * their respective memory locations. |
| 91 | */ |
Linus Walleij | ec8f125 | 2010-08-13 11:31:59 +0200 | [diff] [blame] | 92 | |
| 93 | static struct amba_pl011_data uart0_plat_data = { |
| 94 | #ifdef CONFIG_COH901318 |
| 95 | .dma_filter = coh901318_filter_id, |
| 96 | .dma_rx_param = (void *) U300_DMA_UART0_RX, |
| 97 | .dma_tx_param = (void *) U300_DMA_UART0_TX, |
| 98 | #endif |
| 99 | }; |
| 100 | |
Russell King | 6db2a45 | 2011-12-18 15:26:38 +0000 | [diff] [blame] | 101 | /* Slow device at 0x3000 offset */ |
| 102 | static AMBA_APB_DEVICE(uart0, "uart0", 0, U300_UART0_BASE, |
| 103 | { IRQ_U300_UART0 }, &uart0_plat_data); |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 104 | |
| 105 | /* The U335 have an additional UART1 on the APP CPU */ |
Linus Walleij | ec8f125 | 2010-08-13 11:31:59 +0200 | [diff] [blame] | 106 | static struct amba_pl011_data uart1_plat_data = { |
| 107 | #ifdef CONFIG_COH901318 |
| 108 | .dma_filter = coh901318_filter_id, |
| 109 | .dma_rx_param = (void *) U300_DMA_UART1_RX, |
| 110 | .dma_tx_param = (void *) U300_DMA_UART1_TX, |
| 111 | #endif |
| 112 | }; |
| 113 | |
Russell King | 6db2a45 | 2011-12-18 15:26:38 +0000 | [diff] [blame] | 114 | /* Fast device at 0x7000 offset */ |
| 115 | static AMBA_APB_DEVICE(uart1, "uart1", 0, U300_UART1_BASE, |
| 116 | { IRQ_U300_UART1 }, &uart1_plat_data); |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 117 | |
Russell King | 6db2a45 | 2011-12-18 15:26:38 +0000 | [diff] [blame] | 118 | /* AHB device at 0x4000 offset */ |
| 119 | static AMBA_APB_DEVICE(pl172, "pl172", 0, U300_EMIF_CFG_BASE, { }, NULL); |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 120 | |
Russell King | 6db2a45 | 2011-12-18 15:26:38 +0000 | [diff] [blame] | 121 | /* Fast device at 0x6000 offset */ |
| 122 | static AMBA_APB_DEVICE(pl022, "pl022", 0, U300_SPI_BASE, |
| 123 | { IRQ_U300_SPI }, NULL); |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 124 | |
Russell King | 6db2a45 | 2011-12-18 15:26:38 +0000 | [diff] [blame] | 125 | /* Fast device at 0x1000 offset */ |
| 126 | #define U300_MMCSD_IRQS { IRQ_U300_MMCSD_MCIINTR0, IRQ_U300_MMCSD_MCIINTR1 } |
| 127 | |
Linus Walleij | a64ae39 | 2012-02-20 21:26:30 +0100 | [diff] [blame] | 128 | static struct mmci_platform_data mmcsd_platform_data = { |
| 129 | /* |
| 130 | * Do not set ocr_mask or voltage translation function, |
| 131 | * we have a regulator we can control instead. |
| 132 | */ |
| 133 | .f_max = 24000000, |
| 134 | .gpio_wp = -1, |
| 135 | .gpio_cd = U300_GPIO_PIN_MMC_CD, |
| 136 | .cd_invert = true, |
| 137 | .capabilities = MMC_CAP_MMC_HIGHSPEED | |
| 138 | MMC_CAP_SD_HIGHSPEED | MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, |
| 139 | #ifdef CONFIG_COH901318 |
| 140 | .dma_filter = coh901318_filter_id, |
| 141 | .dma_rx_param = (void *) U300_DMA_MMCSD_RX_TX, |
| 142 | /* Don't specify a TX channel, this RX channel is bidirectional */ |
| 143 | #endif |
| 144 | }; |
| 145 | |
Russell King | 6db2a45 | 2011-12-18 15:26:38 +0000 | [diff] [blame] | 146 | static AMBA_APB_DEVICE(mmcsd, "mmci", 0, U300_MMCSD_BASE, |
Linus Walleij | a64ae39 | 2012-02-20 21:26:30 +0100 | [diff] [blame] | 147 | U300_MMCSD_IRQS, &mmcsd_platform_data); |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 148 | |
| 149 | /* |
| 150 | * The order of device declaration may be important, since some devices |
| 151 | * have dependencies on other devices being initialized first. |
| 152 | */ |
| 153 | static struct amba_device *amba_devs[] __initdata = { |
| 154 | &uart0_device, |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 155 | &uart1_device, |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 156 | &pl022_device, |
| 157 | &pl172_device, |
| 158 | &mmcsd_device, |
| 159 | }; |
| 160 | |
| 161 | /* Here follows a list of all hw resources that the platform devices |
| 162 | * allocate. Note, clock dependencies are not included |
| 163 | */ |
| 164 | |
| 165 | static struct resource gpio_resources[] = { |
| 166 | { |
| 167 | .start = U300_GPIO_BASE, |
| 168 | .end = (U300_GPIO_BASE + SZ_4K - 1), |
| 169 | .flags = IORESOURCE_MEM, |
| 170 | }, |
| 171 | { |
| 172 | .name = "gpio0", |
| 173 | .start = IRQ_U300_GPIO_PORT0, |
| 174 | .end = IRQ_U300_GPIO_PORT0, |
| 175 | .flags = IORESOURCE_IRQ, |
| 176 | }, |
| 177 | { |
| 178 | .name = "gpio1", |
| 179 | .start = IRQ_U300_GPIO_PORT1, |
| 180 | .end = IRQ_U300_GPIO_PORT1, |
| 181 | .flags = IORESOURCE_IRQ, |
| 182 | }, |
| 183 | { |
| 184 | .name = "gpio2", |
| 185 | .start = IRQ_U300_GPIO_PORT2, |
| 186 | .end = IRQ_U300_GPIO_PORT2, |
| 187 | .flags = IORESOURCE_IRQ, |
| 188 | }, |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 189 | { |
| 190 | .name = "gpio3", |
| 191 | .start = IRQ_U300_GPIO_PORT3, |
| 192 | .end = IRQ_U300_GPIO_PORT3, |
| 193 | .flags = IORESOURCE_IRQ, |
| 194 | }, |
| 195 | { |
| 196 | .name = "gpio4", |
| 197 | .start = IRQ_U300_GPIO_PORT4, |
| 198 | .end = IRQ_U300_GPIO_PORT4, |
| 199 | .flags = IORESOURCE_IRQ, |
| 200 | }, |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 201 | { |
| 202 | .name = "gpio5", |
| 203 | .start = IRQ_U300_GPIO_PORT5, |
| 204 | .end = IRQ_U300_GPIO_PORT5, |
| 205 | .flags = IORESOURCE_IRQ, |
| 206 | }, |
| 207 | { |
| 208 | .name = "gpio6", |
| 209 | .start = IRQ_U300_GPIO_PORT6, |
| 210 | .end = IRQ_U300_GPIO_PORT6, |
| 211 | .flags = IORESOURCE_IRQ, |
| 212 | }, |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 213 | }; |
| 214 | |
| 215 | static struct resource keypad_resources[] = { |
| 216 | { |
| 217 | .start = U300_KEYPAD_BASE, |
| 218 | .end = U300_KEYPAD_BASE + SZ_4K - 1, |
| 219 | .flags = IORESOURCE_MEM, |
| 220 | }, |
| 221 | { |
| 222 | .name = "coh901461-press", |
| 223 | .start = IRQ_U300_KEYPAD_KEYBF, |
| 224 | .end = IRQ_U300_KEYPAD_KEYBF, |
| 225 | .flags = IORESOURCE_IRQ, |
| 226 | }, |
| 227 | { |
| 228 | .name = "coh901461-release", |
| 229 | .start = IRQ_U300_KEYPAD_KEYBR, |
| 230 | .end = IRQ_U300_KEYPAD_KEYBR, |
| 231 | .flags = IORESOURCE_IRQ, |
| 232 | }, |
| 233 | }; |
| 234 | |
| 235 | static struct resource rtc_resources[] = { |
| 236 | { |
| 237 | .start = U300_RTC_BASE, |
| 238 | .end = U300_RTC_BASE + SZ_4K - 1, |
| 239 | .flags = IORESOURCE_MEM, |
| 240 | }, |
| 241 | { |
| 242 | .start = IRQ_U300_RTC, |
| 243 | .end = IRQ_U300_RTC, |
| 244 | .flags = IORESOURCE_IRQ, |
| 245 | }, |
| 246 | }; |
| 247 | |
| 248 | /* |
| 249 | * Fsmc does have IRQs: #43 and #44 (NFIF and NFIF2) |
| 250 | * but these are not yet used by the driver. |
| 251 | */ |
| 252 | static struct resource fsmc_resources[] = { |
| 253 | { |
Jean-Christophe PLAGNIOL-VILLARD | 6d7b42a | 2012-10-04 15:14:16 +0200 | [diff] [blame] | 254 | .name = "nand_addr", |
| 255 | .start = U300_NAND_CS0_PHYS_BASE + PLAT_NAND_ALE, |
| 256 | .end = U300_NAND_CS0_PHYS_BASE + PLAT_NAND_ALE + SZ_16K - 1, |
| 257 | .flags = IORESOURCE_MEM, |
| 258 | }, |
| 259 | { |
| 260 | .name = "nand_cmd", |
| 261 | .start = U300_NAND_CS0_PHYS_BASE + PLAT_NAND_CLE, |
| 262 | .end = U300_NAND_CS0_PHYS_BASE + PLAT_NAND_CLE + SZ_16K - 1, |
| 263 | .flags = IORESOURCE_MEM, |
| 264 | }, |
| 265 | { |
Linus Walleij | 93ac5a5 | 2010-09-13 00:35:37 +0200 | [diff] [blame] | 266 | .name = "nand_data", |
| 267 | .start = U300_NAND_CS0_PHYS_BASE, |
| 268 | .end = U300_NAND_CS0_PHYS_BASE + SZ_16K - 1, |
| 269 | .flags = IORESOURCE_MEM, |
| 270 | }, |
| 271 | { |
| 272 | .name = "fsmc_regs", |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 273 | .start = U300_NAND_IF_PHYS_BASE, |
| 274 | .end = U300_NAND_IF_PHYS_BASE + SZ_4K - 1, |
| 275 | .flags = IORESOURCE_MEM, |
| 276 | }, |
| 277 | }; |
| 278 | |
| 279 | static struct resource i2c0_resources[] = { |
| 280 | { |
| 281 | .start = U300_I2C0_BASE, |
| 282 | .end = U300_I2C0_BASE + SZ_4K - 1, |
| 283 | .flags = IORESOURCE_MEM, |
| 284 | }, |
| 285 | { |
| 286 | .start = IRQ_U300_I2C0, |
| 287 | .end = IRQ_U300_I2C0, |
| 288 | .flags = IORESOURCE_IRQ, |
| 289 | }, |
| 290 | }; |
| 291 | |
| 292 | static struct resource i2c1_resources[] = { |
| 293 | { |
| 294 | .start = U300_I2C1_BASE, |
| 295 | .end = U300_I2C1_BASE + SZ_4K - 1, |
| 296 | .flags = IORESOURCE_MEM, |
| 297 | }, |
| 298 | { |
| 299 | .start = IRQ_U300_I2C1, |
| 300 | .end = IRQ_U300_I2C1, |
| 301 | .flags = IORESOURCE_IRQ, |
| 302 | }, |
| 303 | |
| 304 | }; |
| 305 | |
| 306 | static struct resource wdog_resources[] = { |
| 307 | { |
| 308 | .start = U300_WDOG_BASE, |
| 309 | .end = U300_WDOG_BASE + SZ_4K - 1, |
| 310 | .flags = IORESOURCE_MEM, |
| 311 | }, |
| 312 | { |
| 313 | .start = IRQ_U300_WDOG, |
| 314 | .end = IRQ_U300_WDOG, |
| 315 | .flags = IORESOURCE_IRQ, |
| 316 | } |
| 317 | }; |
| 318 | |
Linus Walleij | 08d1e2e | 2009-12-17 09:46:24 +0100 | [diff] [blame] | 319 | static struct resource dma_resource[] = { |
| 320 | { |
| 321 | .start = U300_DMAC_BASE, |
| 322 | .end = U300_DMAC_BASE + PAGE_SIZE - 1, |
| 323 | .flags = IORESOURCE_MEM, |
| 324 | }, |
| 325 | { |
| 326 | .start = IRQ_U300_DMA, |
| 327 | .end = IRQ_U300_DMA, |
| 328 | .flags = IORESOURCE_IRQ, |
| 329 | } |
| 330 | }; |
| 331 | |
Linus Walleij | 08d1e2e | 2009-12-17 09:46:24 +0100 | [diff] [blame] | 332 | |
Linus Walleij | 128a06d | 2012-02-21 14:31:45 +0100 | [diff] [blame] | 333 | static struct resource pinctrl_resources[] = { |
Linus Walleij | 98da352 | 2011-05-02 20:54:38 +0200 | [diff] [blame] | 334 | { |
| 335 | .start = U300_SYSCON_BASE, |
| 336 | .end = U300_SYSCON_BASE + SZ_4K - 1, |
| 337 | .flags = IORESOURCE_MEM, |
| 338 | }, |
| 339 | }; |
| 340 | |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 341 | static struct platform_device wdog_device = { |
Linus Walleij | 633e81a | 2010-01-25 07:18:16 +0100 | [diff] [blame] | 342 | .name = "coh901327_wdog", |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 343 | .id = -1, |
| 344 | .num_resources = ARRAY_SIZE(wdog_resources), |
| 345 | .resource = wdog_resources, |
| 346 | }; |
| 347 | |
| 348 | static struct platform_device i2c0_device = { |
Linus Walleij | 6be2a0c | 2009-08-13 21:42:01 +0100 | [diff] [blame] | 349 | .name = "stu300", |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 350 | .id = 0, |
| 351 | .num_resources = ARRAY_SIZE(i2c0_resources), |
| 352 | .resource = i2c0_resources, |
| 353 | }; |
| 354 | |
| 355 | static struct platform_device i2c1_device = { |
Linus Walleij | 6be2a0c | 2009-08-13 21:42:01 +0100 | [diff] [blame] | 356 | .name = "stu300", |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 357 | .id = 1, |
| 358 | .num_resources = ARRAY_SIZE(i2c1_resources), |
| 359 | .resource = i2c1_resources, |
| 360 | }; |
| 361 | |
Linus Walleij | 128a06d | 2012-02-21 14:31:45 +0100 | [diff] [blame] | 362 | static struct platform_device pinctrl_device = { |
| 363 | .name = "pinctrl-u300", |
| 364 | .id = -1, |
| 365 | .num_resources = ARRAY_SIZE(pinctrl_resources), |
| 366 | .resource = pinctrl_resources, |
| 367 | }; |
| 368 | |
Linus Walleij | cc890cd | 2011-09-08 09:04:51 +0100 | [diff] [blame] | 369 | /* |
| 370 | * The different variants have a few different versions of the |
| 371 | * GPIO block, with different number of ports. |
| 372 | */ |
| 373 | static struct u300_gpio_platform u300_gpio_plat = { |
Linus Walleij | cc890cd | 2011-09-08 09:04:51 +0100 | [diff] [blame] | 374 | .ports = 7, |
Linus Walleij | cc890cd | 2011-09-08 09:04:51 +0100 | [diff] [blame] | 375 | .gpio_base = 0, |
Linus Walleij | cc890cd | 2011-09-08 09:04:51 +0100 | [diff] [blame] | 376 | }; |
| 377 | |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 378 | static struct platform_device gpio_device = { |
| 379 | .name = "u300-gpio", |
| 380 | .id = -1, |
| 381 | .num_resources = ARRAY_SIZE(gpio_resources), |
| 382 | .resource = gpio_resources, |
Linus Walleij | cc890cd | 2011-09-08 09:04:51 +0100 | [diff] [blame] | 383 | .dev = { |
| 384 | .platform_data = &u300_gpio_plat, |
| 385 | }, |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 386 | }; |
| 387 | |
| 388 | static struct platform_device keypad_device = { |
| 389 | .name = "keypad", |
| 390 | .id = -1, |
| 391 | .num_resources = ARRAY_SIZE(keypad_resources), |
| 392 | .resource = keypad_resources, |
| 393 | }; |
| 394 | |
| 395 | static struct platform_device rtc_device = { |
Linus Walleij | 378ce74 | 2009-11-14 01:03:24 +0100 | [diff] [blame] | 396 | .name = "rtc-coh901331", |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 397 | .id = -1, |
| 398 | .num_resources = ARRAY_SIZE(rtc_resources), |
| 399 | .resource = rtc_resources, |
| 400 | }; |
| 401 | |
Linus Walleij | 93ac5a5 | 2010-09-13 00:35:37 +0200 | [diff] [blame] | 402 | static struct mtd_partition u300_partitions[] = { |
| 403 | { |
| 404 | .name = "bootrecords", |
| 405 | .offset = 0, |
| 406 | .size = SZ_128K, |
| 407 | }, |
| 408 | { |
| 409 | .name = "free", |
| 410 | .offset = SZ_128K, |
| 411 | .size = 8064 * SZ_1K, |
| 412 | }, |
| 413 | { |
| 414 | .name = "platform", |
| 415 | .offset = 8192 * SZ_1K, |
| 416 | .size = 253952 * SZ_1K, |
| 417 | }, |
| 418 | }; |
| 419 | |
| 420 | static struct fsmc_nand_platform_data nand_platform_data = { |
| 421 | .partitions = u300_partitions, |
| 422 | .nr_partitions = ARRAY_SIZE(u300_partitions), |
| 423 | .options = NAND_SKIP_BBTSCAN, |
| 424 | .width = FSMC_NAND_BW8, |
| 425 | }; |
| 426 | |
| 427 | static struct platform_device nand_device = { |
| 428 | .name = "fsmc-nand", |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 429 | .id = -1, |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 430 | .resource = fsmc_resources, |
Linus Walleij | 93ac5a5 | 2010-09-13 00:35:37 +0200 | [diff] [blame] | 431 | .num_resources = ARRAY_SIZE(fsmc_resources), |
| 432 | .dev = { |
| 433 | .platform_data = &nand_platform_data, |
| 434 | }, |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 435 | }; |
| 436 | |
Linus Walleij | 08d1e2e | 2009-12-17 09:46:24 +0100 | [diff] [blame] | 437 | static struct platform_device dma_device = { |
| 438 | .name = "coh901318", |
| 439 | .id = -1, |
| 440 | .resource = dma_resource, |
| 441 | .num_resources = ARRAY_SIZE(dma_resource), |
| 442 | .dev = { |
Linus Walleij | 08d1e2e | 2009-12-17 09:46:24 +0100 | [diff] [blame] | 443 | .coherent_dma_mask = ~0, |
| 444 | }, |
| 445 | }; |
| 446 | |
Linus Walleij | 51dddfe | 2012-01-20 17:53:15 +0100 | [diff] [blame] | 447 | static unsigned long pin_pullup_conf[] = { |
| 448 | PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_UP, 1), |
| 449 | }; |
| 450 | |
| 451 | static unsigned long pin_highz_conf[] = { |
| 452 | PIN_CONF_PACKED(PIN_CONFIG_BIAS_HIGH_IMPEDANCE, 0), |
| 453 | }; |
| 454 | |
| 455 | /* Pin control settings */ |
Linus Walleij | e93bcee | 2012-02-09 07:23:28 +0100 | [diff] [blame] | 456 | static struct pinctrl_map __initdata u300_pinmux_map[] = { |
Linus Walleij | 98da352 | 2011-05-02 20:54:38 +0200 | [diff] [blame] | 457 | /* anonymous maps for chip power and EMIFs */ |
Stephen Warren | 1e2082b | 2012-03-02 13:05:48 -0700 | [diff] [blame] | 458 | PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-u300", NULL, "power"), |
| 459 | PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-u300", NULL, "emif0"), |
| 460 | PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-u300", NULL, "emif1"), |
Linus Walleij | 98da352 | 2011-05-02 20:54:38 +0200 | [diff] [blame] | 461 | /* per-device maps for MMC/SD, SPI and UART */ |
Stephen Warren | 1e2082b | 2012-03-02 13:05:48 -0700 | [diff] [blame] | 462 | PIN_MAP_MUX_GROUP_DEFAULT("mmci", "pinctrl-u300", NULL, "mmc0"), |
| 463 | PIN_MAP_MUX_GROUP_DEFAULT("pl022", "pinctrl-u300", NULL, "spi0"), |
| 464 | PIN_MAP_MUX_GROUP_DEFAULT("uart0", "pinctrl-u300", NULL, "uart0"), |
Linus Walleij | 51dddfe | 2012-01-20 17:53:15 +0100 | [diff] [blame] | 465 | /* This pin is used for clock return rather than GPIO */ |
| 466 | PIN_MAP_CONFIGS_PIN_DEFAULT("mmci", "pinctrl-u300", "PIO APP GPIO 11", |
| 467 | pin_pullup_conf), |
| 468 | /* This pin is used for card detect */ |
| 469 | PIN_MAP_CONFIGS_PIN_DEFAULT("mmci", "pinctrl-u300", "PIO MS INS", |
| 470 | pin_highz_conf), |
Linus Walleij | 98da352 | 2011-05-02 20:54:38 +0200 | [diff] [blame] | 471 | }; |
| 472 | |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 473 | /* |
| 474 | * Notice that AMBA devices are initialized before platform devices. |
| 475 | * |
| 476 | */ |
| 477 | static struct platform_device *platform_devs[] __initdata = { |
Linus Walleij | 08d1e2e | 2009-12-17 09:46:24 +0100 | [diff] [blame] | 478 | &dma_device, |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 479 | &i2c0_device, |
| 480 | &i2c1_device, |
| 481 | &keypad_device, |
| 482 | &rtc_device, |
Linus Walleij | 8604ac3 | 2012-11-20 14:42:47 +0100 | [diff] [blame] | 483 | &pinctrl_device, |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 484 | &gpio_device, |
Linus Walleij | 93ac5a5 | 2010-09-13 00:35:37 +0200 | [diff] [blame] | 485 | &nand_device, |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 486 | &wdog_device, |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 487 | }; |
| 488 | |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 489 | /* |
| 490 | * Interrupts: the U300 platforms have two pl190 ARM PrimeCells connected |
| 491 | * together so some interrupts are connected to the first one and some |
| 492 | * to the second one. |
| 493 | */ |
Linus Walleij | 234323b | 2012-08-13 11:35:55 +0200 | [diff] [blame] | 494 | static void __init u300_init_irq(void) |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 495 | { |
| 496 | u32 mask[2] = {0, 0}; |
Linus Walleij | b7276b2 | 2010-08-05 07:58:58 +0100 | [diff] [blame] | 497 | struct clk *clk; |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 498 | int i; |
| 499 | |
Linus Walleij | 379aae5 | 2010-08-05 07:58:13 +0100 | [diff] [blame] | 500 | /* initialize clocking early, we want to clock the INTCON */ |
Linus Walleij | 50667d6 | 2012-06-19 23:44:25 +0200 | [diff] [blame] | 501 | u300_clk_init(U300_SYSCON_VBASE); |
| 502 | |
| 503 | /* Bootstrap EMIF and SEMI clocks */ |
| 504 | clk = clk_get_sys("pl172", NULL); |
| 505 | BUG_ON(IS_ERR(clk)); |
| 506 | clk_prepare_enable(clk); |
| 507 | clk = clk_get_sys("semi", NULL); |
| 508 | BUG_ON(IS_ERR(clk)); |
| 509 | clk_prepare_enable(clk); |
Linus Walleij | 379aae5 | 2010-08-05 07:58:13 +0100 | [diff] [blame] | 510 | |
Linus Walleij | b7276b2 | 2010-08-05 07:58:58 +0100 | [diff] [blame] | 511 | /* Clock the interrupt controller */ |
| 512 | clk = clk_get_sys("intcon", NULL); |
| 513 | BUG_ON(IS_ERR(clk)); |
Linus Walleij | 50667d6 | 2012-06-19 23:44:25 +0200 | [diff] [blame] | 514 | clk_prepare_enable(clk); |
Linus Walleij | b7276b2 | 2010-08-05 07:58:58 +0100 | [diff] [blame] | 515 | |
Linus Walleij | cc890cd | 2011-09-08 09:04:51 +0100 | [diff] [blame] | 516 | for (i = 0; i < U300_VIC_IRQS_END; i++) |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 517 | set_bit(i, (unsigned long *) &mask[0]); |
Linus Walleij | 1344500 | 2012-04-18 15:29:58 +0200 | [diff] [blame] | 518 | vic_init((void __iomem *) U300_INTCON0_VBASE, IRQ_U300_INTCON0_START, |
| 519 | mask[0], mask[0]); |
| 520 | vic_init((void __iomem *) U300_INTCON1_VBASE, IRQ_U300_INTCON1_START, |
| 521 | mask[1], mask[1]); |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 522 | } |
| 523 | |
| 524 | |
| 525 | /* |
| 526 | * U300 platforms peripheral handling |
| 527 | */ |
| 528 | struct db_chip { |
| 529 | u16 chipid; |
| 530 | const char *name; |
| 531 | }; |
| 532 | |
| 533 | /* |
| 534 | * This is a list of the Digital Baseband chips used in the U300 platform. |
| 535 | */ |
| 536 | static struct db_chip db_chips[] __initdata = { |
| 537 | { |
| 538 | .chipid = 0xb800, |
| 539 | .name = "DB3000", |
| 540 | }, |
| 541 | { |
| 542 | .chipid = 0xc000, |
| 543 | .name = "DB3100", |
| 544 | }, |
| 545 | { |
| 546 | .chipid = 0xc800, |
| 547 | .name = "DB3150", |
| 548 | }, |
| 549 | { |
| 550 | .chipid = 0xd800, |
| 551 | .name = "DB3200", |
| 552 | }, |
| 553 | { |
| 554 | .chipid = 0xe000, |
| 555 | .name = "DB3250", |
| 556 | }, |
| 557 | { |
| 558 | .chipid = 0xe800, |
| 559 | .name = "DB3210", |
| 560 | }, |
| 561 | { |
| 562 | .chipid = 0xf000, |
| 563 | .name = "DB3350 P1x", |
| 564 | }, |
| 565 | { |
| 566 | .chipid = 0xf100, |
| 567 | .name = "DB3350 P2x", |
| 568 | }, |
| 569 | { |
| 570 | .chipid = 0x0000, /* List terminator */ |
| 571 | .name = NULL, |
| 572 | } |
| 573 | }; |
| 574 | |
Linus Walleij | a2bb9f4 | 2009-08-13 21:57:22 +0100 | [diff] [blame] | 575 | static void __init u300_init_check_chip(void) |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 576 | { |
| 577 | |
| 578 | u16 val; |
| 579 | struct db_chip *chip; |
| 580 | const char *chipname; |
| 581 | const char unknown[] = "UNKNOWN"; |
| 582 | |
| 583 | /* Read out and print chip ID */ |
| 584 | val = readw(U300_SYSCON_VBASE + U300_SYSCON_CIDR); |
| 585 | /* This is in funky bigendian order... */ |
| 586 | val = (val & 0xFFU) << 8 | (val >> 8); |
| 587 | chip = db_chips; |
| 588 | chipname = unknown; |
| 589 | |
| 590 | for ( ; chip->chipid; chip++) { |
| 591 | if (chip->chipid == (val & 0xFF00U)) { |
| 592 | chipname = chip->name; |
| 593 | break; |
| 594 | } |
| 595 | } |
| 596 | printk(KERN_INFO "Initializing U300 system on %s baseband chip " \ |
| 597 | "(chip ID 0x%04x)\n", chipname, val); |
| 598 | |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 599 | if ((val & 0xFF00U) != 0xf000 && (val & 0xFF00U) != 0xf100) { |
Linus Walleij | ec8f125 | 2010-08-13 11:31:59 +0200 | [diff] [blame] | 600 | printk(KERN_ERR "Platform configured for BS335 " \ |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 601 | " with DB3350 but %s detected, expect problems!", |
| 602 | chipname); |
| 603 | } |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 604 | } |
| 605 | |
| 606 | /* |
| 607 | * Some devices and their resources require reserved physical memory from |
| 608 | * the end of the available RAM. This function traverses the list of devices |
Daniel Mack | 3ad2f3f | 2010-02-03 08:01:28 +0800 | [diff] [blame] | 609 | * and assigns actual addresses to these. |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 610 | */ |
| 611 | static void __init u300_assign_physmem(void) |
| 612 | { |
| 613 | unsigned long curr_start = __pa(high_memory); |
| 614 | int i, j; |
| 615 | |
| 616 | for (i = 0; i < ARRAY_SIZE(platform_devs); i++) { |
| 617 | for (j = 0; j < platform_devs[i]->num_resources; j++) { |
| 618 | struct resource *const res = |
| 619 | &platform_devs[i]->resource[j]; |
| 620 | |
| 621 | if (IORESOURCE_MEM == res->flags && |
| 622 | 0 == res->start) { |
| 623 | res->start = curr_start; |
| 624 | res->end += curr_start; |
Joe Perches | 28f65c11 | 2011-06-09 09:13:32 -0700 | [diff] [blame] | 625 | curr_start += resource_size(res); |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 626 | |
| 627 | printk(KERN_INFO "core.c: Mapping RAM " \ |
| 628 | "%#x-%#x to device %s:%s\n", |
| 629 | res->start, res->end, |
| 630 | platform_devs[i]->name, res->name); |
| 631 | } |
| 632 | } |
| 633 | } |
| 634 | } |
| 635 | |
Linus Walleij | 234323b | 2012-08-13 11:35:55 +0200 | [diff] [blame] | 636 | static void __init u300_init_machine(void) |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 637 | { |
| 638 | int i; |
| 639 | u16 val; |
| 640 | |
| 641 | /* Check what platform we run and print some status information */ |
| 642 | u300_init_check_chip(); |
| 643 | |
Linus Walleij | c7c8c78 | 2009-08-14 10:59:05 +0100 | [diff] [blame] | 644 | /* Initialize SPI device with some board specifics */ |
| 645 | u300_spi_init(&pl022_device); |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 646 | |
| 647 | /* Register the AMBA devices in the AMBA bus abstraction layer */ |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 648 | for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { |
| 649 | struct amba_device *d = amba_devs[i]; |
| 650 | amba_device_register(d, &iomem_resource); |
| 651 | } |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 652 | |
| 653 | u300_assign_physmem(); |
| 654 | |
Linus Walleij | 98da352 | 2011-05-02 20:54:38 +0200 | [diff] [blame] | 655 | /* Initialize pinmuxing */ |
Linus Walleij | e93bcee | 2012-02-09 07:23:28 +0100 | [diff] [blame] | 656 | pinctrl_register_mappings(u300_pinmux_map, |
| 657 | ARRAY_SIZE(u300_pinmux_map)); |
Linus Walleij | 98da352 | 2011-05-02 20:54:38 +0200 | [diff] [blame] | 658 | |
Linus Walleij | 6be2a0c | 2009-08-13 21:42:01 +0100 | [diff] [blame] | 659 | /* Register subdevices on the I2C buses */ |
| 660 | u300_i2c_register_board_devices(); |
| 661 | |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 662 | /* Register the platform devices */ |
| 663 | platform_add_devices(platform_devs, ARRAY_SIZE(platform_devs)); |
| 664 | |
Linus Walleij | ec8f125 | 2010-08-13 11:31:59 +0200 | [diff] [blame] | 665 | /* Register subdevices on the SPI bus */ |
| 666 | u300_spi_register_board_devices(); |
| 667 | |
Linus Walleij | c43ed56 | 2011-08-09 21:30:01 +0200 | [diff] [blame] | 668 | /* Enable SEMI self refresh */ |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 669 | val = readw(U300_SYSCON_VBASE + U300_SYSCON_SMCR) | |
| 670 | U300_SYSCON_SMCR_SEMI_SREFREQ_ENABLE; |
| 671 | writew(val, U300_SYSCON_VBASE + U300_SYSCON_SMCR); |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 672 | } |
| 673 | |
Russell King | 7e3974b | 2011-11-05 15:51:25 +0000 | [diff] [blame] | 674 | /* Forward declare this function from the watchdog */ |
| 675 | void coh901327_watchdog_reset(void); |
| 676 | |
Linus Walleij | 234323b | 2012-08-13 11:35:55 +0200 | [diff] [blame] | 677 | static void u300_restart(char mode, const char *cmd) |
Russell King | 7e3974b | 2011-11-05 15:51:25 +0000 | [diff] [blame] | 678 | { |
| 679 | switch (mode) { |
| 680 | case 's': |
| 681 | case 'h': |
Russell King | 7e3974b | 2011-11-05 15:51:25 +0000 | [diff] [blame] | 682 | #ifdef CONFIG_COH901327_WATCHDOG |
| 683 | coh901327_watchdog_reset(); |
| 684 | #endif |
| 685 | break; |
| 686 | default: |
| 687 | /* Do nothing */ |
| 688 | break; |
| 689 | } |
| 690 | /* Wait for system do die/reset. */ |
| 691 | while (1); |
| 692 | } |
Linus Walleij | 234323b | 2012-08-13 11:35:55 +0200 | [diff] [blame] | 693 | |
| 694 | MACHINE_START(U300, "Ericsson AB U335 S335/B335 Prototype Board") |
| 695 | /* Maintainer: Linus Walleij <linus.walleij@stericsson.com> */ |
| 696 | .atag_offset = 0x100, |
| 697 | .map_io = u300_map_io, |
Linus Walleij | d4a31ee | 2012-10-17 13:16:46 +0200 | [diff] [blame] | 698 | .nr_irqs = 0, |
Linus Walleij | 234323b | 2012-08-13 11:35:55 +0200 | [diff] [blame] | 699 | .init_irq = u300_init_irq, |
Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 700 | .init_time = u300_timer_init, |
Linus Walleij | 234323b | 2012-08-13 11:35:55 +0200 | [diff] [blame] | 701 | .init_machine = u300_init_machine, |
| 702 | .restart = u300_restart, |
| 703 | MACHINE_END |
Linus Walleij | 978577e | 2013-04-08 11:38:50 +0200 | [diff] [blame] | 704 | |
| 705 | #ifdef CONFIG_OF |
| 706 | |
| 707 | /* These are mostly to get the right device names for the clock lookups */ |
| 708 | static struct of_dev_auxdata u300_auxdata_lookup[] __initdata = { |
| 709 | OF_DEV_AUXDATA("stericsson,pinctrl-u300", U300_SYSCON_BASE, |
| 710 | "pinctrl-u300", NULL), |
| 711 | OF_DEV_AUXDATA("stericsson,gpio-coh901", U300_GPIO_BASE, |
| 712 | "u300-gpio", &u300_gpio_plat), |
Linus Walleij | 63a62ec | 2013-04-19 12:59:59 +0200 | [diff] [blame] | 713 | OF_DEV_AUXDATA("stericsson,coh901327", U300_WDOG_BASE, |
| 714 | "coh901327_wdog", NULL), |
Linus Walleij | ae87bb8 | 2013-04-19 13:22:57 +0200 | [diff] [blame^] | 715 | OF_DEV_AUXDATA("stericsson,coh901331", U300_RTC_BASE, |
| 716 | "rtc-coh901331", NULL), |
Linus Walleij | 978577e | 2013-04-08 11:38:50 +0200 | [diff] [blame] | 717 | OF_DEV_AUXDATA("arm,primecell", U300_UART0_BASE, |
| 718 | "uart0", &uart0_plat_data), |
| 719 | OF_DEV_AUXDATA("arm,primecell", U300_UART1_BASE, |
| 720 | "uart1", &uart1_plat_data), |
Linus Walleij | c023b8b | 2013-04-11 15:13:39 +0200 | [diff] [blame] | 721 | OF_DEV_AUXDATA("st,ddci2c", U300_I2C0_BASE, |
| 722 | "stu300.0", NULL), |
| 723 | OF_DEV_AUXDATA("st,ddci2c", U300_I2C1_BASE, |
| 724 | "stu300.1", NULL), |
Linus Walleij | 978577e | 2013-04-08 11:38:50 +0200 | [diff] [blame] | 725 | OF_DEV_AUXDATA("arm,primecell", U300_MMCSD_BASE, |
| 726 | "mmci", &mmcsd_platform_data), |
| 727 | { /* sentinel */ }, |
| 728 | }; |
| 729 | |
| 730 | static void __init u300_init_irq_dt(void) |
| 731 | { |
| 732 | struct clk *clk; |
| 733 | |
| 734 | /* initialize clocking early, we want to clock the INTCON */ |
| 735 | u300_clk_init(U300_SYSCON_VBASE); |
| 736 | |
| 737 | /* Bootstrap EMIF and SEMI clocks */ |
| 738 | clk = clk_get_sys("pl172", NULL); |
| 739 | BUG_ON(IS_ERR(clk)); |
| 740 | clk_prepare_enable(clk); |
| 741 | clk = clk_get_sys("semi", NULL); |
| 742 | BUG_ON(IS_ERR(clk)); |
| 743 | clk_prepare_enable(clk); |
| 744 | |
| 745 | /* Clock the interrupt controller */ |
| 746 | clk = clk_get_sys("intcon", NULL); |
| 747 | BUG_ON(IS_ERR(clk)); |
| 748 | clk_prepare_enable(clk); |
| 749 | |
| 750 | irqchip_init(); |
| 751 | } |
| 752 | |
| 753 | static void __init u300_init_machine_dt(void) |
| 754 | { |
| 755 | u16 val; |
| 756 | |
| 757 | /* Check what platform we run and print some status information */ |
| 758 | u300_init_check_chip(); |
| 759 | |
| 760 | u300_assign_physmem(); |
| 761 | |
| 762 | /* Initialize pinmuxing */ |
| 763 | pinctrl_register_mappings(u300_pinmux_map, |
| 764 | ARRAY_SIZE(u300_pinmux_map)); |
| 765 | |
| 766 | of_platform_populate(NULL, of_default_bus_match_table, |
| 767 | u300_auxdata_lookup, NULL); |
| 768 | |
| 769 | /* Enable SEMI self refresh */ |
| 770 | val = readw(U300_SYSCON_VBASE + U300_SYSCON_SMCR) | |
| 771 | U300_SYSCON_SMCR_SEMI_SREFREQ_ENABLE; |
| 772 | writew(val, U300_SYSCON_VBASE + U300_SYSCON_SMCR); |
| 773 | } |
| 774 | |
| 775 | static const char * u300_board_compat[] = { |
| 776 | "stericsson,u300", |
| 777 | NULL, |
| 778 | }; |
| 779 | |
| 780 | DT_MACHINE_START(U300_DT, "U300 S335/B335 (Device Tree)") |
| 781 | .map_io = u300_map_io, |
| 782 | .init_irq = u300_init_irq_dt, |
| 783 | .init_time = clocksource_of_init, |
| 784 | .init_machine = u300_init_machine_dt, |
| 785 | .restart = u300_restart, |
| 786 | .dt_compat = u300_board_compat, |
| 787 | MACHINE_END |
| 788 | |
| 789 | #endif /* CONFIG_OF */ |