Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'versatile/multiplatform' into next/multiplatform

Merge "ARM Versatile multi-platform support" from Rob Herring:

Arnd lit a fire under me to dust this off and get it merged. So here it
is. The main change from prior version is I merged all the code to a
single file. It's a bigger patch than I'd like, but I don't think trying
to do it in multiple steps is worth it.

This is dependent on some solution for the default platform choice on
!MMU builds (allnoconfig) as it can't be Versatile after this series.
Arnd has some ideas on how to address that.

This is tested under QEMU. Linus previously tested this on actual h/w
and had a problem with the display identification which needs
investigation or agreement to worry about it if and when someone
actually cares.

* versatile/multiplatform:
ARM: versatile: convert to multi-platform
ARM: versatile: merge mach code into a single file
ARM: versatile: switch to DT only booting and remove legacy code
ARM: versatile: add DT based PCI detection

Acked-by: Marc Zyngier <marc.zyngier@arm.com>

+392 -2064
-17
arch/arm/Kconfig
··· 362 362 help 363 363 This enables support for ARM Ltd RealView boards. 364 364 365 - config ARCH_VERSATILE 366 - bool "ARM Ltd. Versatile family" 367 - select ARCH_WANT_OPTIONAL_GPIOLIB 368 - select ARM_AMBA 369 - select ARM_TIMER_SP804 370 - select ARM_VIC 371 - select CLKDEV_LOOKUP 372 - select GENERIC_CLOCKEVENTS 373 - select HAVE_MACH_CLKDEV 374 - select ICST 375 - select PLAT_VERSATILE 376 - select PLAT_VERSATILE_CLOCK 377 - select PLAT_VERSATILE_SCHED_CLOCK 378 - select VERSATILE_FPGA_IRQ 379 - help 380 - This enables support for ARM Ltd Versatile board. 381 - 382 365 config ARCH_CLPS711X 383 366 bool "Cirrus Logic CLPS711x/EP721x/EP731x-based" 384 367 select ARCH_REQUIRE_GPIOLIB
+1 -1
arch/arm/configs/versatile_defconfig
··· 6 6 CONFIG_MODULES=y 7 7 CONFIG_MODULE_UNLOAD=y 8 8 CONFIG_PARTITION_ADVANCED=y 9 + # CONFIG_ARCH_MULTI_V7 is not set 9 10 CONFIG_ARCH_VERSATILE=y 10 - CONFIG_MACH_VERSATILE_AB=y 11 11 CONFIG_AEABI=y 12 12 CONFIG_OABI_COMPAT=y 13 13 CONFIG_ZBOOT_ROM_TEXT=0x0
+12 -29
arch/arm/mach-versatile/Kconfig
··· 1 - menu "Versatile platform type" 2 - depends on ARCH_VERSATILE 3 - 4 - config ARCH_VERSATILE_PB 5 - bool "Support Versatile Platform Baseboard for ARM926EJ-S" 6 - default y 1 + config ARCH_VERSATILE 2 + bool "ARM Ltd. Versatile family" 3 + depends on ARCH_MULTI_V5 4 + select ARM_AMBA 5 + select ARM_TIMER_SP804 6 + select ARM_VIC 7 + select CLKSRC_VERSATILE 8 + select COMMON_CLK_VERSATILE 7 9 select CPU_ARM926T 10 + select ICST 8 11 select MIGHT_HAVE_PCI 12 + select PLAT_VERSATILE 13 + select VERSATILE_FPGA_IRQ 9 14 help 10 - Include support for the ARM(R) Versatile Platform Baseboard 11 - for the ARM926EJ-S. 15 + This enables support for ARM Ltd Versatile board. 12 16 13 - config MACH_VERSATILE_AB 14 - bool "Support Versatile Application Baseboard for ARM926EJ-S" 15 - select CPU_ARM926T 16 - help 17 - Include support for the ARM(R) Versatile Application Baseboard 18 - for the ARM926EJ-S. 19 - 20 - config MACH_VERSATILE_DT 21 - bool "Support Versatile platform from device tree" 22 - select CPU_ARM926T 23 - select USE_OF 24 - help 25 - Include support for the ARM(R) Versatile/PB platform, 26 - using the device tree for discovery 27 - 28 - config MACH_VERSATILE_AUTO 29 - def_bool y 30 - depends on !ARCH_VERSATILE_PB && !MACH_VERSATILE_AB 31 - select MACH_VERSATILE_DT 32 - 33 - endmenu
+1 -5
arch/arm/mach-versatile/Makefile
··· 2 2 # Makefile for the linux kernel. 3 3 # 4 4 5 - obj-y := core.o 6 - obj-$(CONFIG_ARCH_VERSATILE_PB) += versatile_pb.o 7 - obj-$(CONFIG_MACH_VERSATILE_AB) += versatile_ab.o 8 - obj-$(CONFIG_MACH_VERSATILE_DT) += versatile_dt.o 9 - obj-$(CONFIG_PCI) += pci.o 5 + obj-y := versatile_dt.o
-4
arch/arm/mach-versatile/Makefile.boot
··· 1 - zreladdr-y += 0x00008000 2 - params_phys-y := 0x00000100 3 - initrd_phys-y := 0x00800000 4 -
-808
arch/arm/mach-versatile/core.c
··· 1 - /* 2 - * linux/arch/arm/mach-versatile/core.c 3 - * 4 - * Copyright (C) 1999 - 2003 ARM Limited 5 - * Copyright (C) 2000 Deep Blue Solutions Ltd 6 - * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License as published by 9 - * the Free Software Foundation; either version 2 of the License, or 10 - * (at your option) any later version. 11 - * 12 - * This program is distributed in the hope that it will be useful, 13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 - * GNU General Public License for more details. 16 - * 17 - * You should have received a copy of the GNU General Public License 18 - * along with this program; if not, write to the Free Software 19 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 - */ 21 - #include <linux/init.h> 22 - #include <linux/device.h> 23 - #include <linux/dma-mapping.h> 24 - #include <linux/platform_device.h> 25 - #include <linux/interrupt.h> 26 - #include <linux/irqdomain.h> 27 - #include <linux/of_address.h> 28 - #include <linux/of_platform.h> 29 - #include <linux/amba/bus.h> 30 - #include <linux/amba/clcd.h> 31 - #include <linux/platform_data/video-clcd-versatile.h> 32 - #include <linux/amba/pl061.h> 33 - #include <linux/amba/mmci.h> 34 - #include <linux/amba/pl022.h> 35 - #include <linux/io.h> 36 - #include <linux/irqchip/arm-vic.h> 37 - #include <linux/irqchip/versatile-fpga.h> 38 - #include <linux/gfp.h> 39 - #include <linux/clkdev.h> 40 - #include <linux/mtd/physmap.h> 41 - #include <linux/bitops.h> 42 - #include <linux/reboot.h> 43 - 44 - #include <clocksource/timer-sp804.h> 45 - 46 - #include <asm/irq.h> 47 - #include <asm/hardware/icst.h> 48 - #include <asm/mach-types.h> 49 - 50 - #include <asm/mach/arch.h> 51 - #include <asm/mach/irq.h> 52 - #include <asm/mach/time.h> 53 - #include <asm/mach/map.h> 54 - #include <mach/hardware.h> 55 - #include <mach/platform.h> 56 - 57 - #include <plat/sched_clock.h> 58 - 59 - #include "core.h" 60 - 61 - /* 62 - * All IO addresses are mapped onto VA 0xFFFx.xxxx, where x.xxxx 63 - * is the (PA >> 12). 64 - * 65 - * Setup a VA for the Versatile Vectored Interrupt Controller. 66 - */ 67 - #define VA_VIC_BASE __io_address(VERSATILE_VIC_BASE) 68 - #define VA_SIC_BASE __io_address(VERSATILE_SIC_BASE) 69 - 70 - /* These PIC IRQs are valid in each configuration */ 71 - #define PIC_VALID_ALL BIT(SIC_INT_KMI0) | BIT(SIC_INT_KMI1) | \ 72 - BIT(SIC_INT_SCI3) | BIT(SIC_INT_UART3) | \ 73 - BIT(SIC_INT_CLCD) | BIT(SIC_INT_TOUCH) | \ 74 - BIT(SIC_INT_KEYPAD) | BIT(SIC_INT_DoC) | \ 75 - BIT(SIC_INT_USB) | BIT(SIC_INT_PCI0) | \ 76 - BIT(SIC_INT_PCI1) | BIT(SIC_INT_PCI2) | \ 77 - BIT(SIC_INT_PCI3) 78 - #if 1 79 - #define IRQ_MMCI0A IRQ_VICSOURCE22 80 - #define IRQ_AACI IRQ_VICSOURCE24 81 - #define IRQ_ETH IRQ_VICSOURCE25 82 - #define PIC_MASK 0xFFD00000 83 - #define PIC_VALID PIC_VALID_ALL 84 - #else 85 - #define IRQ_MMCI0A IRQ_SIC_MMCI0A 86 - #define IRQ_AACI IRQ_SIC_AACI 87 - #define IRQ_ETH IRQ_SIC_ETH 88 - #define PIC_MASK 0 89 - #define PIC_VALID PIC_VALID_ALL | BIT(SIC_INT_MMCI0A) | \ 90 - BIT(SIC_INT_MMCI1A) | BIT(SIC_INT_AACI) | \ 91 - BIT(SIC_INT_ETH) 92 - #endif 93 - 94 - /* Lookup table for finding a DT node that represents the vic instance */ 95 - static const struct of_device_id vic_of_match[] __initconst = { 96 - { .compatible = "arm,versatile-vic", }, 97 - {} 98 - }; 99 - 100 - static const struct of_device_id sic_of_match[] __initconst = { 101 - { .compatible = "arm,versatile-sic", }, 102 - {} 103 - }; 104 - 105 - void __init versatile_init_irq(void) 106 - { 107 - struct device_node *np; 108 - 109 - np = of_find_matching_node_by_address(NULL, vic_of_match, 110 - VERSATILE_VIC_BASE); 111 - __vic_init(VA_VIC_BASE, 0, IRQ_VIC_START, ~0, 0, np); 112 - 113 - writel(~0, VA_SIC_BASE + SIC_IRQ_ENABLE_CLEAR); 114 - 115 - np = of_find_matching_node_by_address(NULL, sic_of_match, 116 - VERSATILE_SIC_BASE); 117 - 118 - fpga_irq_init(VA_SIC_BASE, "SIC", IRQ_SIC_START, 119 - IRQ_VICSOURCE31, PIC_VALID, np); 120 - 121 - /* 122 - * Interrupts on secondary controller from 0 to 8 are routed to 123 - * source 31 on PIC. 124 - * Interrupts from 21 to 31 are routed directly to the VIC on 125 - * the corresponding number on primary controller. This is controlled 126 - * by setting PIC_ENABLEx. 127 - */ 128 - writel(PIC_MASK, VA_SIC_BASE + SIC_INT_PIC_ENABLE); 129 - } 130 - 131 - static struct map_desc versatile_io_desc[] __initdata __maybe_unused = { 132 - { 133 - .virtual = IO_ADDRESS(VERSATILE_SYS_BASE), 134 - .pfn = __phys_to_pfn(VERSATILE_SYS_BASE), 135 - .length = SZ_4K, 136 - .type = MT_DEVICE 137 - }, { 138 - .virtual = IO_ADDRESS(VERSATILE_SIC_BASE), 139 - .pfn = __phys_to_pfn(VERSATILE_SIC_BASE), 140 - .length = SZ_4K, 141 - .type = MT_DEVICE 142 - }, { 143 - .virtual = IO_ADDRESS(VERSATILE_VIC_BASE), 144 - .pfn = __phys_to_pfn(VERSATILE_VIC_BASE), 145 - .length = SZ_4K, 146 - .type = MT_DEVICE 147 - }, { 148 - .virtual = IO_ADDRESS(VERSATILE_SCTL_BASE), 149 - .pfn = __phys_to_pfn(VERSATILE_SCTL_BASE), 150 - .length = SZ_4K * 9, 151 - .type = MT_DEVICE 152 - }, 153 - #ifdef CONFIG_MACH_VERSATILE_AB 154 - { 155 - .virtual = IO_ADDRESS(VERSATILE_IB2_BASE), 156 - .pfn = __phys_to_pfn(VERSATILE_IB2_BASE), 157 - .length = SZ_64M, 158 - .type = MT_DEVICE 159 - }, 160 - #endif 161 - #ifdef CONFIG_DEBUG_LL 162 - { 163 - .virtual = IO_ADDRESS(VERSATILE_UART0_BASE), 164 - .pfn = __phys_to_pfn(VERSATILE_UART0_BASE), 165 - .length = SZ_4K, 166 - .type = MT_DEVICE 167 - }, 168 - #endif 169 - #ifdef CONFIG_PCI 170 - { 171 - .virtual = IO_ADDRESS(VERSATILE_PCI_CORE_BASE), 172 - .pfn = __phys_to_pfn(VERSATILE_PCI_CORE_BASE), 173 - .length = SZ_4K, 174 - .type = MT_DEVICE 175 - }, { 176 - .virtual = (unsigned long)VERSATILE_PCI_VIRT_BASE, 177 - .pfn = __phys_to_pfn(VERSATILE_PCI_BASE), 178 - .length = VERSATILE_PCI_BASE_SIZE, 179 - .type = MT_DEVICE 180 - }, { 181 - .virtual = (unsigned long)VERSATILE_PCI_CFG_VIRT_BASE, 182 - .pfn = __phys_to_pfn(VERSATILE_PCI_CFG_BASE), 183 - .length = VERSATILE_PCI_CFG_BASE_SIZE, 184 - .type = MT_DEVICE 185 - }, 186 - #endif 187 - }; 188 - 189 - void __init versatile_map_io(void) 190 - { 191 - iotable_init(versatile_io_desc, ARRAY_SIZE(versatile_io_desc)); 192 - } 193 - 194 - 195 - #define VERSATILE_FLASHCTRL (__io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_FLASH_OFFSET) 196 - 197 - static void versatile_flash_set_vpp(struct platform_device *pdev, int on) 198 - { 199 - u32 val; 200 - 201 - val = __raw_readl(VERSATILE_FLASHCTRL); 202 - if (on) 203 - val |= VERSATILE_FLASHPROG_FLVPPEN; 204 - else 205 - val &= ~VERSATILE_FLASHPROG_FLVPPEN; 206 - __raw_writel(val, VERSATILE_FLASHCTRL); 207 - } 208 - 209 - static struct physmap_flash_data versatile_flash_data = { 210 - .width = 4, 211 - .set_vpp = versatile_flash_set_vpp, 212 - }; 213 - 214 - static struct resource versatile_flash_resource = { 215 - .start = VERSATILE_FLASH_BASE, 216 - .end = VERSATILE_FLASH_BASE + VERSATILE_FLASH_SIZE - 1, 217 - .flags = IORESOURCE_MEM, 218 - }; 219 - 220 - static struct platform_device versatile_flash_device = { 221 - .name = "physmap-flash", 222 - .id = 0, 223 - .dev = { 224 - .platform_data = &versatile_flash_data, 225 - }, 226 - .num_resources = 1, 227 - .resource = &versatile_flash_resource, 228 - }; 229 - 230 - static struct resource smc91x_resources[] = { 231 - [0] = { 232 - .start = VERSATILE_ETH_BASE, 233 - .end = VERSATILE_ETH_BASE + SZ_64K - 1, 234 - .flags = IORESOURCE_MEM, 235 - }, 236 - [1] = { 237 - .start = IRQ_ETH, 238 - .end = IRQ_ETH, 239 - .flags = IORESOURCE_IRQ, 240 - }, 241 - }; 242 - 243 - static struct platform_device smc91x_device = { 244 - .name = "smc91x", 245 - .id = 0, 246 - .num_resources = ARRAY_SIZE(smc91x_resources), 247 - .resource = smc91x_resources, 248 - }; 249 - 250 - static struct resource versatile_i2c_resource = { 251 - .start = VERSATILE_I2C_BASE, 252 - .end = VERSATILE_I2C_BASE + SZ_4K - 1, 253 - .flags = IORESOURCE_MEM, 254 - }; 255 - 256 - static struct platform_device versatile_i2c_device = { 257 - .name = "versatile-i2c", 258 - .id = 0, 259 - .num_resources = 1, 260 - .resource = &versatile_i2c_resource, 261 - }; 262 - 263 - static struct i2c_board_info versatile_i2c_board_info[] = { 264 - { 265 - I2C_BOARD_INFO("ds1338", 0xd0 >> 1), 266 - }, 267 - }; 268 - 269 - static int __init versatile_i2c_init(void) 270 - { 271 - return i2c_register_board_info(0, versatile_i2c_board_info, 272 - ARRAY_SIZE(versatile_i2c_board_info)); 273 - } 274 - arch_initcall(versatile_i2c_init); 275 - 276 - #define VERSATILE_SYSMCI (__io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_MCI_OFFSET) 277 - 278 - unsigned int mmc_status(struct device *dev) 279 - { 280 - struct amba_device *adev = container_of(dev, struct amba_device, dev); 281 - u32 mask; 282 - 283 - if (adev->res.start == VERSATILE_MMCI0_BASE) 284 - mask = 1; 285 - else 286 - mask = 2; 287 - 288 - return readl(VERSATILE_SYSMCI) & mask; 289 - } 290 - 291 - static struct mmci_platform_data mmc0_plat_data = { 292 - .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, 293 - .status = mmc_status, 294 - .gpio_wp = -1, 295 - .gpio_cd = -1, 296 - }; 297 - 298 - static struct resource char_lcd_resources[] = { 299 - { 300 - .start = VERSATILE_CHAR_LCD_BASE, 301 - .end = (VERSATILE_CHAR_LCD_BASE + SZ_4K - 1), 302 - .flags = IORESOURCE_MEM, 303 - }, 304 - }; 305 - 306 - static struct platform_device char_lcd_device = { 307 - .name = "arm-charlcd", 308 - .id = -1, 309 - .num_resources = ARRAY_SIZE(char_lcd_resources), 310 - .resource = char_lcd_resources, 311 - }; 312 - 313 - static struct resource leds_resources[] = { 314 - { 315 - .start = VERSATILE_SYS_BASE + VERSATILE_SYS_LED_OFFSET, 316 - .end = VERSATILE_SYS_BASE + VERSATILE_SYS_LED_OFFSET + 4, 317 - .flags = IORESOURCE_MEM, 318 - }, 319 - }; 320 - 321 - static struct platform_device leds_device = { 322 - .name = "versatile-leds", 323 - .id = -1, 324 - .num_resources = ARRAY_SIZE(leds_resources), 325 - .resource = leds_resources, 326 - }; 327 - 328 - /* 329 - * Clock handling 330 - */ 331 - static const struct icst_params versatile_oscvco_params = { 332 - .ref = 24000000, 333 - .vco_max = ICST307_VCO_MAX, 334 - .vco_min = ICST307_VCO_MIN, 335 - .vd_min = 4 + 8, 336 - .vd_max = 511 + 8, 337 - .rd_min = 1 + 2, 338 - .rd_max = 127 + 2, 339 - .s2div = icst307_s2div, 340 - .idx2s = icst307_idx2s, 341 - }; 342 - 343 - static void versatile_oscvco_set(struct clk *clk, struct icst_vco vco) 344 - { 345 - void __iomem *sys_lock = __io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_LOCK_OFFSET; 346 - u32 val; 347 - 348 - val = readl(clk->vcoreg) & ~0x7ffff; 349 - val |= vco.v | (vco.r << 9) | (vco.s << 16); 350 - 351 - writel(0xa05f, sys_lock); 352 - writel(val, clk->vcoreg); 353 - writel(0, sys_lock); 354 - } 355 - 356 - static const struct clk_ops osc4_clk_ops = { 357 - .round = icst_clk_round, 358 - .set = icst_clk_set, 359 - .setvco = versatile_oscvco_set, 360 - }; 361 - 362 - static struct clk osc4_clk = { 363 - .ops = &osc4_clk_ops, 364 - .params = &versatile_oscvco_params, 365 - }; 366 - 367 - /* 368 - * These are fixed clocks. 369 - */ 370 - static struct clk ref24_clk = { 371 - .rate = 24000000, 372 - }; 373 - 374 - static struct clk sp804_clk = { 375 - .rate = 1000000, 376 - }; 377 - 378 - static struct clk dummy_apb_pclk; 379 - 380 - static struct clk_lookup lookups[] = { 381 - { /* AMBA bus clock */ 382 - .con_id = "apb_pclk", 383 - .clk = &dummy_apb_pclk, 384 - }, { /* UART0 */ 385 - .dev_id = "dev:f1", 386 - .clk = &ref24_clk, 387 - }, { /* UART1 */ 388 - .dev_id = "dev:f2", 389 - .clk = &ref24_clk, 390 - }, { /* UART2 */ 391 - .dev_id = "dev:f3", 392 - .clk = &ref24_clk, 393 - }, { /* UART3 */ 394 - .dev_id = "fpga:09", 395 - .clk = &ref24_clk, 396 - }, { /* KMI0 */ 397 - .dev_id = "fpga:06", 398 - .clk = &ref24_clk, 399 - }, { /* KMI1 */ 400 - .dev_id = "fpga:07", 401 - .clk = &ref24_clk, 402 - }, { /* MMC0 */ 403 - .dev_id = "fpga:05", 404 - .clk = &ref24_clk, 405 - }, { /* MMC1 */ 406 - .dev_id = "fpga:0b", 407 - .clk = &ref24_clk, 408 - }, { /* SSP */ 409 - .dev_id = "dev:f4", 410 - .clk = &ref24_clk, 411 - }, { /* CLCD */ 412 - .dev_id = "dev:20", 413 - .clk = &osc4_clk, 414 - }, { /* SP804 timers */ 415 - .dev_id = "sp804", 416 - .clk = &sp804_clk, 417 - }, 418 - }; 419 - 420 - /* 421 - * CLCD support. 422 - */ 423 - #define SYS_CLCD_MODE_MASK (3 << 0) 424 - #define SYS_CLCD_MODE_888 (0 << 0) 425 - #define SYS_CLCD_MODE_5551 (1 << 0) 426 - #define SYS_CLCD_MODE_565_RLSB (2 << 0) 427 - #define SYS_CLCD_MODE_565_BLSB (3 << 0) 428 - #define SYS_CLCD_NLCDIOON (1 << 2) 429 - #define SYS_CLCD_VDDPOSSWITCH (1 << 3) 430 - #define SYS_CLCD_PWR3V5SWITCH (1 << 4) 431 - #define SYS_CLCD_ID_MASK (0x1f << 8) 432 - #define SYS_CLCD_ID_SANYO_3_8 (0x00 << 8) 433 - #define SYS_CLCD_ID_UNKNOWN_8_4 (0x01 << 8) 434 - #define SYS_CLCD_ID_EPSON_2_2 (0x02 << 8) 435 - #define SYS_CLCD_ID_SANYO_2_5 (0x07 << 8) 436 - #define SYS_CLCD_ID_VGA (0x1f << 8) 437 - 438 - static bool is_sanyo_2_5_lcd; 439 - 440 - /* 441 - * Disable all display connectors on the interface module. 442 - */ 443 - static void versatile_clcd_disable(struct clcd_fb *fb) 444 - { 445 - void __iomem *sys_clcd = __io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_CLCD_OFFSET; 446 - u32 val; 447 - 448 - val = readl(sys_clcd); 449 - val &= ~SYS_CLCD_NLCDIOON | SYS_CLCD_PWR3V5SWITCH; 450 - writel(val, sys_clcd); 451 - 452 - #ifdef CONFIG_MACH_VERSATILE_AB 453 - /* 454 - * If the LCD is Sanyo 2x5 in on the IB2 board, turn the back-light off 455 - */ 456 - if (machine_is_versatile_ab() && is_sanyo_2_5_lcd) { 457 - void __iomem *versatile_ib2_ctrl = __io_address(VERSATILE_IB2_CTRL); 458 - unsigned long ctrl; 459 - 460 - ctrl = readl(versatile_ib2_ctrl); 461 - ctrl &= ~0x01; 462 - writel(ctrl, versatile_ib2_ctrl); 463 - } 464 - #endif 465 - } 466 - 467 - /* 468 - * Enable the relevant connector on the interface module. 469 - */ 470 - static void versatile_clcd_enable(struct clcd_fb *fb) 471 - { 472 - struct fb_var_screeninfo *var = &fb->fb.var; 473 - void __iomem *sys_clcd = __io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_CLCD_OFFSET; 474 - u32 val; 475 - 476 - val = readl(sys_clcd); 477 - val &= ~SYS_CLCD_MODE_MASK; 478 - 479 - switch (var->green.length) { 480 - case 5: 481 - val |= SYS_CLCD_MODE_5551; 482 - break; 483 - case 6: 484 - if (var->red.offset == 0) 485 - val |= SYS_CLCD_MODE_565_RLSB; 486 - else 487 - val |= SYS_CLCD_MODE_565_BLSB; 488 - break; 489 - case 8: 490 - val |= SYS_CLCD_MODE_888; 491 - break; 492 - } 493 - 494 - /* 495 - * Set the MUX 496 - */ 497 - writel(val, sys_clcd); 498 - 499 - /* 500 - * And now enable the PSUs 501 - */ 502 - val |= SYS_CLCD_NLCDIOON | SYS_CLCD_PWR3V5SWITCH; 503 - writel(val, sys_clcd); 504 - 505 - #ifdef CONFIG_MACH_VERSATILE_AB 506 - /* 507 - * If the LCD is Sanyo 2x5 in on the IB2 board, turn the back-light on 508 - */ 509 - if (machine_is_versatile_ab() && is_sanyo_2_5_lcd) { 510 - void __iomem *versatile_ib2_ctrl = __io_address(VERSATILE_IB2_CTRL); 511 - unsigned long ctrl; 512 - 513 - ctrl = readl(versatile_ib2_ctrl); 514 - ctrl |= 0x01; 515 - writel(ctrl, versatile_ib2_ctrl); 516 - } 517 - #endif 518 - } 519 - 520 - /* 521 - * Detect which LCD panel is connected, and return the appropriate 522 - * clcd_panel structure. Note: we do not have any information on 523 - * the required timings for the 8.4in panel, so we presently assume 524 - * VGA timings. 525 - */ 526 - static int versatile_clcd_setup(struct clcd_fb *fb) 527 - { 528 - void __iomem *sys_clcd = __io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_CLCD_OFFSET; 529 - const char *panel_name; 530 - u32 val; 531 - 532 - is_sanyo_2_5_lcd = false; 533 - 534 - val = readl(sys_clcd) & SYS_CLCD_ID_MASK; 535 - if (val == SYS_CLCD_ID_SANYO_3_8) 536 - panel_name = "Sanyo TM38QV67A02A"; 537 - else if (val == SYS_CLCD_ID_SANYO_2_5) { 538 - panel_name = "Sanyo QVGA Portrait"; 539 - is_sanyo_2_5_lcd = true; 540 - } else if (val == SYS_CLCD_ID_EPSON_2_2) 541 - panel_name = "Epson L2F50113T00"; 542 - else if (val == SYS_CLCD_ID_VGA) 543 - panel_name = "VGA"; 544 - else { 545 - printk(KERN_ERR "CLCD: unknown LCD panel ID 0x%08x, using VGA\n", 546 - val); 547 - panel_name = "VGA"; 548 - } 549 - 550 - fb->panel = versatile_clcd_get_panel(panel_name); 551 - if (!fb->panel) 552 - return -EINVAL; 553 - 554 - return versatile_clcd_setup_dma(fb, SZ_1M); 555 - } 556 - 557 - static void versatile_clcd_decode(struct clcd_fb *fb, struct clcd_regs *regs) 558 - { 559 - clcdfb_decode(fb, regs); 560 - 561 - /* Always clear BGR for RGB565: we do the routing externally */ 562 - if (fb->fb.var.green.length == 6) 563 - regs->cntl &= ~CNTL_BGR; 564 - } 565 - 566 - static struct clcd_board clcd_plat_data = { 567 - .name = "Versatile", 568 - .caps = CLCD_CAP_5551 | CLCD_CAP_565 | CLCD_CAP_888, 569 - .check = clcdfb_check, 570 - .decode = versatile_clcd_decode, 571 - .disable = versatile_clcd_disable, 572 - .enable = versatile_clcd_enable, 573 - .setup = versatile_clcd_setup, 574 - .mmap = versatile_clcd_mmap_dma, 575 - .remove = versatile_clcd_remove_dma, 576 - }; 577 - 578 - static struct pl061_platform_data gpio0_plat_data = { 579 - .gpio_base = 0, 580 - .irq_base = IRQ_GPIO0_START, 581 - }; 582 - 583 - static struct pl061_platform_data gpio1_plat_data = { 584 - .gpio_base = 8, 585 - .irq_base = IRQ_GPIO1_START, 586 - }; 587 - 588 - static struct pl061_platform_data gpio2_plat_data = { 589 - .gpio_base = 16, 590 - .irq_base = IRQ_GPIO2_START, 591 - }; 592 - 593 - static struct pl061_platform_data gpio3_plat_data = { 594 - .gpio_base = 24, 595 - .irq_base = IRQ_GPIO3_START, 596 - }; 597 - 598 - static struct pl022_ssp_controller ssp0_plat_data = { 599 - .bus_id = 0, 600 - .enable_dma = 0, 601 - .num_chipselect = 1, 602 - }; 603 - 604 - #define AACI_IRQ { IRQ_AACI } 605 - #define MMCI0_IRQ { IRQ_MMCI0A,IRQ_SIC_MMCI0B } 606 - #define KMI0_IRQ { IRQ_SIC_KMI0 } 607 - #define KMI1_IRQ { IRQ_SIC_KMI1 } 608 - 609 - /* 610 - * These devices are connected directly to the multi-layer AHB switch 611 - */ 612 - #define SMC_IRQ { } 613 - #define MPMC_IRQ { } 614 - #define CLCD_IRQ { IRQ_CLCDINT } 615 - #define DMAC_IRQ { IRQ_DMAINT } 616 - 617 - /* 618 - * These devices are connected via the core APB bridge 619 - */ 620 - #define SCTL_IRQ { } 621 - #define WATCHDOG_IRQ { IRQ_WDOGINT } 622 - #define GPIO0_IRQ { IRQ_GPIOINT0 } 623 - #define GPIO1_IRQ { IRQ_GPIOINT1 } 624 - #define GPIO2_IRQ { IRQ_GPIOINT2 } 625 - #define GPIO3_IRQ { IRQ_GPIOINT3 } 626 - #define RTC_IRQ { IRQ_RTCINT } 627 - 628 - /* 629 - * These devices are connected via the DMA APB bridge 630 - */ 631 - #define SCI_IRQ { IRQ_SCIINT } 632 - #define UART0_IRQ { IRQ_UARTINT0 } 633 - #define UART1_IRQ { IRQ_UARTINT1 } 634 - #define UART2_IRQ { IRQ_UARTINT2 } 635 - #define SSP_IRQ { IRQ_SSPINT } 636 - 637 - /* FPGA Primecells */ 638 - APB_DEVICE(aaci, "fpga:04", AACI, NULL); 639 - APB_DEVICE(mmc0, "fpga:05", MMCI0, &mmc0_plat_data); 640 - APB_DEVICE(kmi0, "fpga:06", KMI0, NULL); 641 - APB_DEVICE(kmi1, "fpga:07", KMI1, NULL); 642 - 643 - /* DevChip Primecells */ 644 - AHB_DEVICE(smc, "dev:00", SMC, NULL); 645 - AHB_DEVICE(mpmc, "dev:10", MPMC, NULL); 646 - AHB_DEVICE(clcd, "dev:20", CLCD, &clcd_plat_data); 647 - AHB_DEVICE(dmac, "dev:30", DMAC, NULL); 648 - APB_DEVICE(sctl, "dev:e0", SCTL, NULL); 649 - APB_DEVICE(wdog, "dev:e1", WATCHDOG, NULL); 650 - APB_DEVICE(gpio0, "dev:e4", GPIO0, &gpio0_plat_data); 651 - APB_DEVICE(gpio1, "dev:e5", GPIO1, &gpio1_plat_data); 652 - APB_DEVICE(gpio2, "dev:e6", GPIO2, &gpio2_plat_data); 653 - APB_DEVICE(gpio3, "dev:e7", GPIO3, &gpio3_plat_data); 654 - APB_DEVICE(rtc, "dev:e8", RTC, NULL); 655 - APB_DEVICE(sci0, "dev:f0", SCI, NULL); 656 - APB_DEVICE(uart0, "dev:f1", UART0, NULL); 657 - APB_DEVICE(uart1, "dev:f2", UART1, NULL); 658 - APB_DEVICE(uart2, "dev:f3", UART2, NULL); 659 - APB_DEVICE(ssp0, "dev:f4", SSP, &ssp0_plat_data); 660 - 661 - static struct amba_device *amba_devs[] __initdata = { 662 - &dmac_device, 663 - &uart0_device, 664 - &uart1_device, 665 - &uart2_device, 666 - &smc_device, 667 - &mpmc_device, 668 - &clcd_device, 669 - &sctl_device, 670 - &wdog_device, 671 - &gpio0_device, 672 - &gpio1_device, 673 - &gpio2_device, 674 - &gpio3_device, 675 - &rtc_device, 676 - &sci0_device, 677 - &ssp0_device, 678 - &aaci_device, 679 - &mmc0_device, 680 - &kmi0_device, 681 - &kmi1_device, 682 - }; 683 - 684 - #ifdef CONFIG_OF 685 - /* 686 - * Lookup table for attaching a specific name and platform_data pointer to 687 - * devices as they get created by of_platform_populate(). Ideally this table 688 - * would not exist, but the current clock implementation depends on some devices 689 - * having a specific name. 690 - */ 691 - struct of_dev_auxdata versatile_auxdata_lookup[] __initdata = { 692 - OF_DEV_AUXDATA("arm,primecell", VERSATILE_MMCI0_BASE, "fpga:05", &mmc0_plat_data), 693 - OF_DEV_AUXDATA("arm,primecell", VERSATILE_KMI0_BASE, "fpga:06", NULL), 694 - OF_DEV_AUXDATA("arm,primecell", VERSATILE_KMI1_BASE, "fpga:07", NULL), 695 - OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART3_BASE, "fpga:09", NULL), 696 - /* FIXME: this is buggy, the platform data is needed for this MMC instance too */ 697 - OF_DEV_AUXDATA("arm,primecell", VERSATILE_MMCI1_BASE, "fpga:0b", NULL), 698 - 699 - OF_DEV_AUXDATA("arm,primecell", VERSATILE_CLCD_BASE, "dev:20", &clcd_plat_data), 700 - OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART0_BASE, "dev:f1", NULL), 701 - OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART1_BASE, "dev:f2", NULL), 702 - OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART2_BASE, "dev:f3", NULL), 703 - OF_DEV_AUXDATA("arm,primecell", VERSATILE_SSP_BASE, "dev:f4", &ssp0_plat_data), 704 - 705 - #if 0 706 - /* 707 - * These entries are unnecessary because no clocks referencing 708 - * them. I've left them in for now as place holders in case 709 - * any of them need to be added back, but they should be 710 - * removed before actually committing this patch. --gcl 711 - */ 712 - OF_DEV_AUXDATA("arm,primecell", VERSATILE_AACI_BASE, "fpga:04", NULL), 713 - OF_DEV_AUXDATA("arm,primecell", VERSATILE_SCI1_BASE, "fpga:0a", NULL), 714 - OF_DEV_AUXDATA("arm,primecell", VERSATILE_SMC_BASE, "dev:00", NULL), 715 - OF_DEV_AUXDATA("arm,primecell", VERSATILE_MPMC_BASE, "dev:10", NULL), 716 - OF_DEV_AUXDATA("arm,primecell", VERSATILE_DMAC_BASE, "dev:30", NULL), 717 - 718 - OF_DEV_AUXDATA("arm,primecell", VERSATILE_SCTL_BASE, "dev:e0", NULL), 719 - OF_DEV_AUXDATA("arm,primecell", VERSATILE_WATCHDOG_BASE, "dev:e1", NULL), 720 - OF_DEV_AUXDATA("arm,primecell", VERSATILE_GPIO0_BASE, "dev:e4", NULL), 721 - OF_DEV_AUXDATA("arm,primecell", VERSATILE_GPIO1_BASE, "dev:e5", NULL), 722 - OF_DEV_AUXDATA("arm,primecell", VERSATILE_GPIO2_BASE, "dev:e6", NULL), 723 - OF_DEV_AUXDATA("arm,primecell", VERSATILE_GPIO3_BASE, "dev:e7", NULL), 724 - OF_DEV_AUXDATA("arm,primecell", VERSATILE_RTC_BASE, "dev:e8", NULL), 725 - OF_DEV_AUXDATA("arm,primecell", VERSATILE_SCI_BASE, "dev:f0", NULL), 726 - #endif 727 - {} 728 - }; 729 - #endif 730 - 731 - void versatile_restart(enum reboot_mode mode, const char *cmd) 732 - { 733 - void __iomem *sys = __io_address(VERSATILE_SYS_BASE); 734 - u32 val; 735 - 736 - val = __raw_readl(sys + VERSATILE_SYS_RESETCTL_OFFSET); 737 - val |= 0x105; 738 - 739 - __raw_writel(0xa05f, sys + VERSATILE_SYS_LOCK_OFFSET); 740 - __raw_writel(val, sys + VERSATILE_SYS_RESETCTL_OFFSET); 741 - __raw_writel(0, sys + VERSATILE_SYS_LOCK_OFFSET); 742 - } 743 - 744 - /* Early initializations */ 745 - void __init versatile_init_early(void) 746 - { 747 - u32 val; 748 - void __iomem *sys = __io_address(VERSATILE_SYS_BASE); 749 - 750 - osc4_clk.vcoreg = sys + VERSATILE_SYS_OSCCLCD_OFFSET; 751 - clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 752 - 753 - versatile_sched_clock_init(sys + VERSATILE_SYS_24MHz_OFFSET, 24000000); 754 - 755 - /* 756 - * set clock frequency: 757 - * VERSATILE_REFCLK is 32KHz 758 - * VERSATILE_TIMCLK is 1MHz 759 - */ 760 - val = readl(__io_address(VERSATILE_SCTL_BASE)); 761 - writel((VERSATILE_TIMCLK << VERSATILE_TIMER1_EnSel) | 762 - (VERSATILE_TIMCLK << VERSATILE_TIMER2_EnSel) | 763 - (VERSATILE_TIMCLK << VERSATILE_TIMER3_EnSel) | 764 - (VERSATILE_TIMCLK << VERSATILE_TIMER4_EnSel) | val, 765 - __io_address(VERSATILE_SCTL_BASE)); 766 - } 767 - 768 - void __init versatile_init(void) 769 - { 770 - int i; 771 - 772 - platform_device_register(&versatile_flash_device); 773 - platform_device_register(&versatile_i2c_device); 774 - platform_device_register(&smc91x_device); 775 - platform_device_register(&char_lcd_device); 776 - platform_device_register(&leds_device); 777 - 778 - for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { 779 - struct amba_device *d = amba_devs[i]; 780 - amba_device_register(d, &iomem_resource); 781 - } 782 - } 783 - 784 - /* 785 - * Where is the timer (VA)? 786 - */ 787 - #define TIMER0_VA_BASE __io_address(VERSATILE_TIMER0_1_BASE) 788 - #define TIMER1_VA_BASE (__io_address(VERSATILE_TIMER0_1_BASE) + 0x20) 789 - #define TIMER2_VA_BASE __io_address(VERSATILE_TIMER2_3_BASE) 790 - #define TIMER3_VA_BASE (__io_address(VERSATILE_TIMER2_3_BASE) + 0x20) 791 - 792 - /* 793 - * Set up timer interrupt, and return the current time in seconds. 794 - */ 795 - void __init versatile_timer_init(void) 796 - { 797 - 798 - /* 799 - * Initialise to a known state (all timers off) 800 - */ 801 - sp804_timer_disable(TIMER0_VA_BASE); 802 - sp804_timer_disable(TIMER1_VA_BASE); 803 - sp804_timer_disable(TIMER2_VA_BASE); 804 - sp804_timer_disable(TIMER3_VA_BASE); 805 - 806 - sp804_clocksource_init(TIMER3_VA_BASE, "timer3"); 807 - sp804_clockevents_init(TIMER0_VA_BASE, IRQ_TIMERINT0_1, "timer0"); 808 - }
-46
arch/arm/mach-versatile/core.h
··· 1 - /* 2 - * linux/arch/arm/mach-versatile/core.h 3 - * 4 - * Copyright (C) 2004 ARM Limited 5 - * Copyright (C) 2000 Deep Blue Solutions Ltd 6 - * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License as published by 9 - * the Free Software Foundation; either version 2 of the License, or 10 - * (at your option) any later version. 11 - * 12 - * This program is distributed in the hope that it will be useful, 13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 - * GNU General Public License for more details. 16 - * 17 - * You should have received a copy of the GNU General Public License 18 - * along with this program; if not, write to the Free Software 19 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 - */ 21 - 22 - #ifndef __ASM_ARCH_VERSATILE_H 23 - #define __ASM_ARCH_VERSATILE_H 24 - 25 - #include <linux/amba/bus.h> 26 - #include <linux/of_platform.h> 27 - #include <linux/reboot.h> 28 - 29 - extern void __init versatile_init(void); 30 - extern void __init versatile_init_early(void); 31 - extern void __init versatile_init_irq(void); 32 - extern void __init versatile_map_io(void); 33 - extern void versatile_timer_init(void); 34 - extern void versatile_restart(enum reboot_mode, const char *); 35 - extern unsigned int mmc_status(struct device *dev); 36 - #ifdef CONFIG_OF 37 - extern struct of_dev_auxdata versatile_auxdata_lookup[]; 38 - #endif 39 - 40 - #define APB_DEVICE(name, busid, base, plat) \ 41 - static AMBA_APB_DEVICE(name, busid, 0, VERSATILE_##base##_BASE, base##_IRQ, plat) 42 - 43 - #define AHB_DEVICE(name, busid, base, plat) \ 44 - static AMBA_AHB_DEVICE(name, busid, 0, VERSATILE_##base##_BASE, base##_IRQ, plat) 45 - 46 - #endif
-16
arch/arm/mach-versatile/include/mach/clkdev.h
··· 1 - #ifndef __ASM_MACH_CLKDEV_H 2 - #define __ASM_MACH_CLKDEV_H 3 - 4 - #include <plat/clock.h> 5 - 6 - struct clk { 7 - unsigned long rate; 8 - const struct clk_ops *ops; 9 - const struct icst_params *params; 10 - void __iomem *vcoreg; 11 - }; 12 - 13 - #define __clk_get(clk) ({ 1; }) 14 - #define __clk_put(clk) do { } while (0) 15 - 16 - #endif
-38
arch/arm/mach-versatile/include/mach/hardware.h
··· 1 - /* 2 - * arch/arm/mach-versatile/include/mach/hardware.h 3 - * 4 - * This file contains the hardware definitions of the Versatile boards. 5 - * 6 - * Copyright (C) 2003 ARM Limited. 7 - * 8 - * This program is free software; you can redistribute it and/or modify 9 - * it under the terms of the GNU General Public License as published by 10 - * the Free Software Foundation; either version 2 of the License, or 11 - * (at your option) any later version. 12 - * 13 - * This program is distributed in the hope that it will be useful, 14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 - * GNU General Public License for more details. 17 - * 18 - * You should have received a copy of the GNU General Public License 19 - * along with this program; if not, write to the Free Software 20 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 - */ 22 - #ifndef __ASM_ARCH_HARDWARE_H 23 - #define __ASM_ARCH_HARDWARE_H 24 - 25 - #include <asm/sizes.h> 26 - 27 - /* 28 - * PCI space virtual addresses 29 - */ 30 - #define VERSATILE_PCI_VIRT_BASE (void __iomem *)0xe8000000ul 31 - #define VERSATILE_PCI_CFG_VIRT_BASE (void __iomem *)0xe9000000ul 32 - 33 - /* macro to get at MMIO space when running virtually */ 34 - #define IO_ADDRESS(x) (((x) & 0x0fffffff) + (((x) >> 4) & 0x0f000000) + 0xf0000000) 35 - 36 - #define __io_address(n) ((void __iomem __force *)IO_ADDRESS(n)) 37 - 38 - #endif
-134
arch/arm/mach-versatile/include/mach/irqs.h
··· 1 - /* 2 - * arch/arm/mach-versatile/include/mach/irqs.h 3 - * 4 - * Copyright (C) 2003 ARM Limited 5 - * Copyright (C) 2000 Deep Blue Solutions Ltd. 6 - * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License as published by 9 - * the Free Software Foundation; either version 2 of the License, or 10 - * (at your option) any later version. 11 - * 12 - * This program is distributed in the hope that it will be useful, 13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 - * GNU General Public License for more details. 16 - * 17 - * You should have received a copy of the GNU General Public License 18 - * along with this program; if not, write to the Free Software 19 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 - */ 21 - 22 - #include <mach/platform.h> 23 - 24 - /* 25 - * IRQ interrupts definitions are the same as the INT definitions 26 - * held within platform.h 27 - */ 28 - #define IRQ_VIC_START 32 29 - #define IRQ_WDOGINT (IRQ_VIC_START + INT_WDOGINT) 30 - #define IRQ_SOFTINT (IRQ_VIC_START + INT_SOFTINT) 31 - #define IRQ_COMMRx (IRQ_VIC_START + INT_COMMRx) 32 - #define IRQ_COMMTx (IRQ_VIC_START + INT_COMMTx) 33 - #define IRQ_TIMERINT0_1 (IRQ_VIC_START + INT_TIMERINT0_1) 34 - #define IRQ_TIMERINT2_3 (IRQ_VIC_START + INT_TIMERINT2_3) 35 - #define IRQ_GPIOINT0 (IRQ_VIC_START + INT_GPIOINT0) 36 - #define IRQ_GPIOINT1 (IRQ_VIC_START + INT_GPIOINT1) 37 - #define IRQ_GPIOINT2 (IRQ_VIC_START + INT_GPIOINT2) 38 - #define IRQ_GPIOINT3 (IRQ_VIC_START + INT_GPIOINT3) 39 - #define IRQ_RTCINT (IRQ_VIC_START + INT_RTCINT) 40 - #define IRQ_SSPINT (IRQ_VIC_START + INT_SSPINT) 41 - #define IRQ_UARTINT0 (IRQ_VIC_START + INT_UARTINT0) 42 - #define IRQ_UARTINT1 (IRQ_VIC_START + INT_UARTINT1) 43 - #define IRQ_UARTINT2 (IRQ_VIC_START + INT_UARTINT2) 44 - #define IRQ_SCIINT (IRQ_VIC_START + INT_SCIINT) 45 - #define IRQ_CLCDINT (IRQ_VIC_START + INT_CLCDINT) 46 - #define IRQ_DMAINT (IRQ_VIC_START + INT_DMAINT) 47 - #define IRQ_PWRFAILINT (IRQ_VIC_START + INT_PWRFAILINT) 48 - #define IRQ_MBXINT (IRQ_VIC_START + INT_MBXINT) 49 - #define IRQ_GNDINT (IRQ_VIC_START + INT_GNDINT) 50 - #define IRQ_VICSOURCE21 (IRQ_VIC_START + INT_VICSOURCE21) 51 - #define IRQ_VICSOURCE22 (IRQ_VIC_START + INT_VICSOURCE22) 52 - #define IRQ_VICSOURCE23 (IRQ_VIC_START + INT_VICSOURCE23) 53 - #define IRQ_VICSOURCE24 (IRQ_VIC_START + INT_VICSOURCE24) 54 - #define IRQ_VICSOURCE25 (IRQ_VIC_START + INT_VICSOURCE25) 55 - #define IRQ_VICSOURCE26 (IRQ_VIC_START + INT_VICSOURCE26) 56 - #define IRQ_VICSOURCE27 (IRQ_VIC_START + INT_VICSOURCE27) 57 - #define IRQ_VICSOURCE28 (IRQ_VIC_START + INT_VICSOURCE28) 58 - #define IRQ_VICSOURCE29 (IRQ_VIC_START + INT_VICSOURCE29) 59 - #define IRQ_VICSOURCE30 (IRQ_VIC_START + INT_VICSOURCE30) 60 - #define IRQ_VICSOURCE31 (IRQ_VIC_START + INT_VICSOURCE31) 61 - #define IRQ_VIC_END (IRQ_VIC_START + 31) 62 - 63 - /* 64 - * FIQ interrupts definitions are the same as the INT definitions. 65 - */ 66 - #define FIQ_WDOGINT INT_WDOGINT 67 - #define FIQ_SOFTINT INT_SOFTINT 68 - #define FIQ_COMMRx INT_COMMRx 69 - #define FIQ_COMMTx INT_COMMTx 70 - #define FIQ_TIMERINT0_1 INT_TIMERINT0_1 71 - #define FIQ_TIMERINT2_3 INT_TIMERINT2_3 72 - #define FIQ_GPIOINT0 INT_GPIOINT0 73 - #define FIQ_GPIOINT1 INT_GPIOINT1 74 - #define FIQ_GPIOINT2 INT_GPIOINT2 75 - #define FIQ_GPIOINT3 INT_GPIOINT3 76 - #define FIQ_RTCINT INT_RTCINT 77 - #define FIQ_SSPINT INT_SSPINT 78 - #define FIQ_UARTINT0 INT_UARTINT0 79 - #define FIQ_UARTINT1 INT_UARTINT1 80 - #define FIQ_UARTINT2 INT_UARTINT2 81 - #define FIQ_SCIINT INT_SCIINT 82 - #define FIQ_CLCDINT INT_CLCDINT 83 - #define FIQ_DMAINT INT_DMAINT 84 - #define FIQ_PWRFAILINT INT_PWRFAILINT 85 - #define FIQ_MBXINT INT_MBXINT 86 - #define FIQ_GNDINT INT_GNDINT 87 - #define FIQ_VICSOURCE21 INT_VICSOURCE21 88 - #define FIQ_VICSOURCE22 INT_VICSOURCE22 89 - #define FIQ_VICSOURCE23 INT_VICSOURCE23 90 - #define FIQ_VICSOURCE24 INT_VICSOURCE24 91 - #define FIQ_VICSOURCE25 INT_VICSOURCE25 92 - #define FIQ_VICSOURCE26 INT_VICSOURCE26 93 - #define FIQ_VICSOURCE27 INT_VICSOURCE27 94 - #define FIQ_VICSOURCE28 INT_VICSOURCE28 95 - #define FIQ_VICSOURCE29 INT_VICSOURCE29 96 - #define FIQ_VICSOURCE30 INT_VICSOURCE30 97 - #define FIQ_VICSOURCE31 INT_VICSOURCE31 98 - 99 - 100 - /* 101 - * Secondary interrupt controller 102 - */ 103 - #define IRQ_SIC_START 64 104 - #define IRQ_SIC_MMCI0B (IRQ_SIC_START + SIC_INT_MMCI0B) 105 - #define IRQ_SIC_MMCI1B (IRQ_SIC_START + SIC_INT_MMCI1B) 106 - #define IRQ_SIC_KMI0 (IRQ_SIC_START + SIC_INT_KMI0) 107 - #define IRQ_SIC_KMI1 (IRQ_SIC_START + SIC_INT_KMI1) 108 - #define IRQ_SIC_SCI3 (IRQ_SIC_START + SIC_INT_SCI3) 109 - #define IRQ_SIC_UART3 (IRQ_SIC_START + SIC_INT_UART3) 110 - #define IRQ_SIC_CLCD (IRQ_SIC_START + SIC_INT_CLCD) 111 - #define IRQ_SIC_TOUCH (IRQ_SIC_START + SIC_INT_TOUCH) 112 - #define IRQ_SIC_KEYPAD (IRQ_SIC_START + SIC_INT_KEYPAD) 113 - #define IRQ_SIC_DoC (IRQ_SIC_START + SIC_INT_DoC) 114 - #define IRQ_SIC_MMCI0A (IRQ_SIC_START + SIC_INT_MMCI0A) 115 - #define IRQ_SIC_MMCI1A (IRQ_SIC_START + SIC_INT_MMCI1A) 116 - #define IRQ_SIC_AACI (IRQ_SIC_START + SIC_INT_AACI) 117 - #define IRQ_SIC_ETH (IRQ_SIC_START + SIC_INT_ETH) 118 - #define IRQ_SIC_USB (IRQ_SIC_START + SIC_INT_USB) 119 - #define IRQ_SIC_PCI0 (IRQ_SIC_START + SIC_INT_PCI0) 120 - #define IRQ_SIC_PCI1 (IRQ_SIC_START + SIC_INT_PCI1) 121 - #define IRQ_SIC_PCI2 (IRQ_SIC_START + SIC_INT_PCI2) 122 - #define IRQ_SIC_PCI3 (IRQ_SIC_START + SIC_INT_PCI3) 123 - #define IRQ_SIC_END 95 124 - 125 - #define IRQ_GPIO0_START (IRQ_SIC_END + 1) 126 - #define IRQ_GPIO0_END (IRQ_GPIO0_START + 31) 127 - #define IRQ_GPIO1_START (IRQ_GPIO0_END + 1) 128 - #define IRQ_GPIO1_END (IRQ_GPIO1_START + 31) 129 - #define IRQ_GPIO2_START (IRQ_GPIO1_END + 1) 130 - #define IRQ_GPIO2_END (IRQ_GPIO2_START + 31) 131 - #define IRQ_GPIO3_START (IRQ_GPIO2_END + 1) 132 - #define IRQ_GPIO3_END (IRQ_GPIO3_START + 31) 133 - 134 - #define NR_IRQS (IRQ_GPIO3_END + 1)
-416
arch/arm/mach-versatile/include/mach/platform.h
··· 1 - /* 2 - * arch/arm/mach-versatile/include/mach/platform.h 3 - * 4 - * Copyright (c) ARM Limited 2003. All rights reserved. 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License as published by 8 - * the Free Software Foundation; either version 2 of the License, or 9 - * (at your option) any later version. 10 - * 11 - * This program is distributed in the hope that it will be useful, 12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - * GNU General Public License for more details. 15 - * 16 - * You should have received a copy of the GNU General Public License 17 - * along with this program; if not, write to the Free Software 18 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 - */ 20 - 21 - #ifndef __address_h 22 - #define __address_h 1 23 - 24 - /* 25 - * Memory definitions 26 - */ 27 - #define VERSATILE_BOOT_ROM_LO 0x30000000 /* DoC Base (64Mb)...*/ 28 - #define VERSATILE_BOOT_ROM_HI 0x30000000 29 - #define VERSATILE_BOOT_ROM_BASE VERSATILE_BOOT_ROM_HI /* Normal position */ 30 - #define VERSATILE_BOOT_ROM_SIZE SZ_64M 31 - 32 - #define VERSATILE_SSRAM_BASE /* VERSATILE_SSMC_BASE ? */ 33 - #define VERSATILE_SSRAM_SIZE SZ_2M 34 - 35 - #define VERSATILE_FLASH_BASE 0x34000000 36 - #define VERSATILE_FLASH_SIZE SZ_64M 37 - 38 - /* 39 - * SDRAM 40 - */ 41 - #define VERSATILE_SDRAM_BASE 0x00000000 42 - 43 - /* 44 - * Logic expansion modules 45 - * 46 - */ 47 - 48 - 49 - /* ------------------------------------------------------------------------ 50 - * Versatile Registers 51 - * ------------------------------------------------------------------------ 52 - * 53 - */ 54 - #define VERSATILE_SYS_ID_OFFSET 0x00 55 - #define VERSATILE_SYS_SW_OFFSET 0x04 56 - #define VERSATILE_SYS_LED_OFFSET 0x08 57 - #define VERSATILE_SYS_OSC0_OFFSET 0x0C 58 - 59 - #if defined(CONFIG_ARCH_VERSATILE_PB) 60 - #define VERSATILE_SYS_OSC1_OFFSET 0x10 61 - #define VERSATILE_SYS_OSC2_OFFSET 0x14 62 - #define VERSATILE_SYS_OSC3_OFFSET 0x18 63 - #define VERSATILE_SYS_OSC4_OFFSET 0x1C 64 - #elif defined(CONFIG_MACH_VERSATILE_AB) 65 - #define VERSATILE_SYS_OSC1_OFFSET 0x1C 66 - #endif 67 - 68 - #define VERSATILE_SYS_OSCCLCD_OFFSET 0x1c 69 - 70 - #define VERSATILE_SYS_LOCK_OFFSET 0x20 71 - #define VERSATILE_SYS_100HZ_OFFSET 0x24 72 - #define VERSATILE_SYS_CFGDATA1_OFFSET 0x28 73 - #define VERSATILE_SYS_CFGDATA2_OFFSET 0x2C 74 - #define VERSATILE_SYS_FLAGS_OFFSET 0x30 75 - #define VERSATILE_SYS_FLAGSSET_OFFSET 0x30 76 - #define VERSATILE_SYS_FLAGSCLR_OFFSET 0x34 77 - #define VERSATILE_SYS_NVFLAGS_OFFSET 0x38 78 - #define VERSATILE_SYS_NVFLAGSSET_OFFSET 0x38 79 - #define VERSATILE_SYS_NVFLAGSCLR_OFFSET 0x3C 80 - #define VERSATILE_SYS_RESETCTL_OFFSET 0x40 81 - #define VERSATILE_SYS_PCICTL_OFFSET 0x44 82 - #define VERSATILE_SYS_MCI_OFFSET 0x48 83 - #define VERSATILE_SYS_FLASH_OFFSET 0x4C 84 - #define VERSATILE_SYS_CLCD_OFFSET 0x50 85 - #define VERSATILE_SYS_CLCDSER_OFFSET 0x54 86 - #define VERSATILE_SYS_BOOTCS_OFFSET 0x58 87 - #define VERSATILE_SYS_24MHz_OFFSET 0x5C 88 - #define VERSATILE_SYS_MISC_OFFSET 0x60 89 - #define VERSATILE_SYS_TEST_OSC0_OFFSET 0x80 90 - #define VERSATILE_SYS_TEST_OSC1_OFFSET 0x84 91 - #define VERSATILE_SYS_TEST_OSC2_OFFSET 0x88 92 - #define VERSATILE_SYS_TEST_OSC3_OFFSET 0x8C 93 - #define VERSATILE_SYS_TEST_OSC4_OFFSET 0x90 94 - 95 - #define VERSATILE_SYS_BASE 0x10000000 96 - #define VERSATILE_SYS_ID (VERSATILE_SYS_BASE + VERSATILE_SYS_ID_OFFSET) 97 - #define VERSATILE_SYS_SW (VERSATILE_SYS_BASE + VERSATILE_SYS_SW_OFFSET) 98 - #define VERSATILE_SYS_LED (VERSATILE_SYS_BASE + VERSATILE_SYS_LED_OFFSET) 99 - #define VERSATILE_SYS_OSC0 (VERSATILE_SYS_BASE + VERSATILE_SYS_OSC0_OFFSET) 100 - #define VERSATILE_SYS_OSC1 (VERSATILE_SYS_BASE + VERSATILE_SYS_OSC1_OFFSET) 101 - 102 - #if defined(CONFIG_ARCH_VERSATILE_PB) 103 - #define VERSATILE_SYS_OSC2 (VERSATILE_SYS_BASE + VERSATILE_SYS_OSC2_OFFSET) 104 - #define VERSATILE_SYS_OSC3 (VERSATILE_SYS_BASE + VERSATILE_SYS_OSC3_OFFSET) 105 - #define VERSATILE_SYS_OSC4 (VERSATILE_SYS_BASE + VERSATILE_SYS_OSC4_OFFSET) 106 - #endif 107 - 108 - #define VERSATILE_SYS_LOCK (VERSATILE_SYS_BASE + VERSATILE_SYS_LOCK_OFFSET) 109 - #define VERSATILE_SYS_100HZ (VERSATILE_SYS_BASE + VERSATILE_SYS_100HZ_OFFSET) 110 - #define VERSATILE_SYS_CFGDATA1 (VERSATILE_SYS_BASE + VERSATILE_SYS_CFGDATA1_OFFSET) 111 - #define VERSATILE_SYS_CFGDATA2 (VERSATILE_SYS_BASE + VERSATILE_SYS_CFGDATA2_OFFSET) 112 - #define VERSATILE_SYS_FLAGS (VERSATILE_SYS_BASE + VERSATILE_SYS_FLAGS_OFFSET) 113 - #define VERSATILE_SYS_FLAGSSET (VERSATILE_SYS_BASE + VERSATILE_SYS_FLAGSSET_OFFSET) 114 - #define VERSATILE_SYS_FLAGSCLR (VERSATILE_SYS_BASE + VERSATILE_SYS_FLAGSCLR_OFFSET) 115 - #define VERSATILE_SYS_NVFLAGS (VERSATILE_SYS_BASE + VERSATILE_SYS_NVFLAGS_OFFSET) 116 - #define VERSATILE_SYS_NVFLAGSSET (VERSATILE_SYS_BASE + VERSATILE_SYS_NVFLAGSSET_OFFSET) 117 - #define VERSATILE_SYS_NVFLAGSCLR (VERSATILE_SYS_BASE + VERSATILE_SYS_NVFLAGSCLR_OFFSET) 118 - #define VERSATILE_SYS_RESETCTL (VERSATILE_SYS_BASE + VERSATILE_SYS_RESETCTL_OFFSET) 119 - #define VERSATILE_SYS_PCICTL (VERSATILE_SYS_BASE + VERSATILE_SYS_PCICTL_OFFSET) 120 - #define VERSATILE_SYS_MCI (VERSATILE_SYS_BASE + VERSATILE_SYS_MCI_OFFSET) 121 - #define VERSATILE_SYS_FLASH (VERSATILE_SYS_BASE + VERSATILE_SYS_FLASH_OFFSET) 122 - #define VERSATILE_SYS_CLCD (VERSATILE_SYS_BASE + VERSATILE_SYS_CLCD_OFFSET) 123 - #define VERSATILE_SYS_CLCDSER (VERSATILE_SYS_BASE + VERSATILE_SYS_CLCDSER_OFFSET) 124 - #define VERSATILE_SYS_BOOTCS (VERSATILE_SYS_BASE + VERSATILE_SYS_BOOTCS_OFFSET) 125 - #define VERSATILE_SYS_24MHz (VERSATILE_SYS_BASE + VERSATILE_SYS_24MHz_OFFSET) 126 - #define VERSATILE_SYS_MISC (VERSATILE_SYS_BASE + VERSATILE_SYS_MISC_OFFSET) 127 - #define VERSATILE_SYS_TEST_OSC0 (VERSATILE_SYS_BASE + VERSATILE_SYS_TEST_OSC0_OFFSET) 128 - #define VERSATILE_SYS_TEST_OSC1 (VERSATILE_SYS_BASE + VERSATILE_SYS_TEST_OSC1_OFFSET) 129 - #define VERSATILE_SYS_TEST_OSC2 (VERSATILE_SYS_BASE + VERSATILE_SYS_TEST_OSC2_OFFSET) 130 - #define VERSATILE_SYS_TEST_OSC3 (VERSATILE_SYS_BASE + VERSATILE_SYS_TEST_OSC3_OFFSET) 131 - #define VERSATILE_SYS_TEST_OSC4 (VERSATILE_SYS_BASE + VERSATILE_SYS_TEST_OSC4_OFFSET) 132 - 133 - /* 134 - * Values for VERSATILE_SYS_RESET_CTRL 135 - */ 136 - #define VERSATILE_SYS_CTRL_RESET_CONFIGCLR 0x01 137 - #define VERSATILE_SYS_CTRL_RESET_CONFIGINIT 0x02 138 - #define VERSATILE_SYS_CTRL_RESET_DLLRESET 0x03 139 - #define VERSATILE_SYS_CTRL_RESET_PLLRESET 0x04 140 - #define VERSATILE_SYS_CTRL_RESET_POR 0x05 141 - #define VERSATILE_SYS_CTRL_RESET_DoC 0x06 142 - 143 - #define VERSATILE_SYS_CTRL_LED (1 << 0) 144 - 145 - 146 - /* ------------------------------------------------------------------------ 147 - * Versatile control registers 148 - * ------------------------------------------------------------------------ 149 - */ 150 - 151 - /* 152 - * VERSATILE_IDFIELD 153 - * 154 - * 31:24 = manufacturer (0x41 = ARM) 155 - * 23:16 = architecture (0x08 = AHB system bus, ASB processor bus) 156 - * 15:12 = FPGA (0x3 = XVC600 or XVC600E) 157 - * 11:4 = build value 158 - * 3:0 = revision number (0x1 = rev B (AHB)) 159 - */ 160 - 161 - /* 162 - * VERSATILE_SYS_LOCK 163 - * control access to SYS_OSCx, SYS_CFGDATAx, SYS_RESETCTL, 164 - * SYS_CLD, SYS_BOOTCS 165 - */ 166 - #define VERSATILE_SYS_LOCK_LOCKED (1 << 16) 167 - #define VERSATILE_SYS_LOCKVAL_MASK 0xFFFF /* write 0xA05F to enable write access */ 168 - 169 - /* 170 - * VERSATILE_SYS_FLASH 171 - */ 172 - #define VERSATILE_FLASHPROG_FLVPPEN (1 << 0) /* Enable writing to flash */ 173 - 174 - /* 175 - * VERSATILE_INTREG 176 - * - used to acknowledge and control MMCI and UART interrupts 177 - */ 178 - #define VERSATILE_INTREG_WPROT 0x00 /* MMC protection status (no interrupt generated) */ 179 - #define VERSATILE_INTREG_RI0 0x01 /* Ring indicator UART0 is asserted, */ 180 - #define VERSATILE_INTREG_CARDIN 0x08 /* MMCI card in detect */ 181 - /* write 1 to acknowledge and clear */ 182 - #define VERSATILE_INTREG_RI1 0x02 /* Ring indicator UART1 is asserted, */ 183 - #define VERSATILE_INTREG_CARDINSERT 0x03 /* Signal insertion of MMC card */ 184 - 185 - /* 186 - * VERSATILE peripheral addresses 187 - */ 188 - #define VERSATILE_PCI_CORE_BASE 0x10001000 /* PCI core control */ 189 - #define VERSATILE_I2C_BASE 0x10002000 /* I2C control */ 190 - #define VERSATILE_SIC_BASE 0x10003000 /* Secondary interrupt controller */ 191 - #define VERSATILE_AACI_BASE 0x10004000 /* Audio */ 192 - #define VERSATILE_MMCI0_BASE 0x10005000 /* MMC interface */ 193 - #define VERSATILE_KMI0_BASE 0x10006000 /* KMI interface */ 194 - #define VERSATILE_KMI1_BASE 0x10007000 /* KMI 2nd interface */ 195 - #define VERSATILE_CHAR_LCD_BASE 0x10008000 /* Character LCD */ 196 - #define VERSATILE_UART3_BASE 0x10009000 /* UART 3 */ 197 - #define VERSATILE_SCI1_BASE 0x1000A000 198 - #define VERSATILE_MMCI1_BASE 0x1000B000 /* MMC Interface */ 199 - /* 0x1000C000 - 0x1000CFFF = reserved */ 200 - #define VERSATILE_ETH_BASE 0x10010000 /* Ethernet */ 201 - #define VERSATILE_USB_BASE 0x10020000 /* USB */ 202 - /* 0x10030000 - 0x100FFFFF = reserved */ 203 - #define VERSATILE_SMC_BASE 0x10100000 /* SMC */ 204 - #define VERSATILE_MPMC_BASE 0x10110000 /* MPMC */ 205 - #define VERSATILE_CLCD_BASE 0x10120000 /* CLCD */ 206 - #define VERSATILE_DMAC_BASE 0x10130000 /* DMA controller */ 207 - #define VERSATILE_VIC_BASE 0x10140000 /* Vectored interrupt controller */ 208 - #define VERSATILE_PERIPH_BASE 0x10150000 /* off-chip peripherals alias from */ 209 - /* 0x10000000 - 0x100FFFFF */ 210 - #define VERSATILE_AHBM_BASE 0x101D0000 /* AHB monitor */ 211 - #define VERSATILE_SCTL_BASE 0x101E0000 /* System controller */ 212 - #define VERSATILE_WATCHDOG_BASE 0x101E1000 /* Watchdog */ 213 - #define VERSATILE_TIMER0_1_BASE 0x101E2000 /* Timer 0 and 1 */ 214 - #define VERSATILE_TIMER2_3_BASE 0x101E3000 /* Timer 2 and 3 */ 215 - #define VERSATILE_GPIO0_BASE 0x101E4000 /* GPIO port 0 */ 216 - #define VERSATILE_GPIO1_BASE 0x101E5000 /* GPIO port 1 */ 217 - #define VERSATILE_GPIO2_BASE 0x101E6000 /* GPIO port 2 */ 218 - #define VERSATILE_GPIO3_BASE 0x101E7000 /* GPIO port 3 */ 219 - #define VERSATILE_RTC_BASE 0x101E8000 /* Real Time Clock */ 220 - /* 0x101E9000 - reserved */ 221 - #define VERSATILE_SCI_BASE 0x101F0000 /* Smart card controller */ 222 - #define VERSATILE_UART0_BASE 0x101F1000 /* Uart 0 */ 223 - #define VERSATILE_UART1_BASE 0x101F2000 /* Uart 1 */ 224 - #define VERSATILE_UART2_BASE 0x101F3000 /* Uart 2 */ 225 - #define VERSATILE_SSP_BASE 0x101F4000 /* Synchronous Serial Port */ 226 - 227 - #define VERSATILE_SSMC_BASE 0x20000000 /* SSMC */ 228 - #define VERSATILE_IB2_BASE 0x24000000 /* IB2 module */ 229 - #define VERSATILE_MBX_BASE 0x40000000 /* MBX */ 230 - 231 - /* PCI space */ 232 - #define VERSATILE_PCI_BASE 0x41000000 /* PCI Interface */ 233 - #define VERSATILE_PCI_CFG_BASE 0x42000000 234 - #define VERSATILE_PCI_IO_BASE 0x43000000 235 - #define VERSATILE_PCI_MEM_BASE0 0x44000000 236 - #define VERSATILE_PCI_MEM_BASE1 0x50000000 237 - #define VERSATILE_PCI_MEM_BASE2 0x60000000 238 - /* Sizes of above maps */ 239 - #define VERSATILE_PCI_BASE_SIZE 0x01000000 240 - #define VERSATILE_PCI_CFG_BASE_SIZE 0x02000000 241 - #define VERSATILE_PCI_IO_BASE_SIZE 0x01000000 242 - #define VERSATILE_PCI_MEM_BASE0_SIZE 0x0c000000 /* 32Mb */ 243 - #define VERSATILE_PCI_MEM_BASE1_SIZE 0x10000000 /* 256Mb */ 244 - #define VERSATILE_PCI_MEM_BASE2_SIZE 0x10000000 /* 256Mb */ 245 - 246 - #define VERSATILE_SDRAM67_BASE 0x70000000 /* SDRAM banks 6 and 7 */ 247 - #define VERSATILE_LT_BASE 0x80000000 /* Logic Tile expansion */ 248 - 249 - /* 250 - * Disk on Chip 251 - */ 252 - #define VERSATILE_DOC_BASE 0x2C000000 253 - #define VERSATILE_DOC_SIZE (16 << 20) 254 - #define VERSATILE_DOC_PAGE_SIZE 512 255 - #define VERSATILE_DOC_TOTAL_PAGES (DOC_SIZE / PAGE_SIZE) 256 - 257 - #define ERASE_UNIT_PAGES 32 258 - #define START_PAGE 0x80 259 - 260 - /* 261 - * LED settings, bits [7:0] 262 - */ 263 - #define VERSATILE_SYS_LED0 (1 << 0) 264 - #define VERSATILE_SYS_LED1 (1 << 1) 265 - #define VERSATILE_SYS_LED2 (1 << 2) 266 - #define VERSATILE_SYS_LED3 (1 << 3) 267 - #define VERSATILE_SYS_LED4 (1 << 4) 268 - #define VERSATILE_SYS_LED5 (1 << 5) 269 - #define VERSATILE_SYS_LED6 (1 << 6) 270 - #define VERSATILE_SYS_LED7 (1 << 7) 271 - 272 - #define ALL_LEDS 0xFF 273 - 274 - #define LED_BANK VERSATILE_SYS_LED 275 - 276 - /* 277 - * Control registers 278 - */ 279 - #define VERSATILE_IDFIELD_OFFSET 0x0 /* Versatile build information */ 280 - #define VERSATILE_FLASHPROG_OFFSET 0x4 /* Flash devices */ 281 - #define VERSATILE_INTREG_OFFSET 0x8 /* Interrupt control */ 282 - #define VERSATILE_DECODE_OFFSET 0xC /* Fitted logic modules */ 283 - 284 - 285 - /* ------------------------------------------------------------------------ 286 - * Versatile Interrupt Controller - control registers 287 - * ------------------------------------------------------------------------ 288 - * 289 - * Offsets from interrupt controller base 290 - * 291 - * System Controller interrupt controller base is 292 - * 293 - * VERSATILE_IC_BASE 294 - * 295 - * Core Module interrupt controller base is 296 - * 297 - * VERSATILE_SYS_IC 298 - * 299 - */ 300 - /* VIC definitions in include/asm-arm/hardware/vic.h */ 301 - 302 - #define SIC_IRQ_STATUS 0 303 - #define SIC_IRQ_RAW_STATUS 0x04 304 - #define SIC_IRQ_ENABLE 0x08 305 - #define SIC_IRQ_ENABLE_SET 0x08 306 - #define SIC_IRQ_ENABLE_CLEAR 0x0C 307 - #define SIC_INT_SOFT_SET 0x10 308 - #define SIC_INT_SOFT_CLEAR 0x14 309 - #define SIC_INT_PIC_ENABLE 0x20 /* read status of pass through mask */ 310 - #define SIC_INT_PIC_ENABLES 0x20 /* set interrupt pass through bits */ 311 - #define SIC_INT_PIC_ENABLEC 0x24 /* Clear interrupt pass through bits */ 312 - 313 - /* ------------------------------------------------------------------------ 314 - * Interrupts - bit assignment (primary) 315 - * ------------------------------------------------------------------------ 316 - */ 317 - 318 - #define INT_WDOGINT 0 /* Watchdog timer */ 319 - #define INT_SOFTINT 1 /* Software interrupt */ 320 - #define INT_COMMRx 2 /* Debug Comm Rx interrupt */ 321 - #define INT_COMMTx 3 /* Debug Comm Tx interrupt */ 322 - #define INT_TIMERINT0_1 4 /* Timer 0 and 1 */ 323 - #define INT_TIMERINT2_3 5 /* Timer 2 and 3 */ 324 - #define INT_GPIOINT0 6 /* GPIO 0 */ 325 - #define INT_GPIOINT1 7 /* GPIO 1 */ 326 - #define INT_GPIOINT2 8 /* GPIO 2 */ 327 - #define INT_GPIOINT3 9 /* GPIO 3 */ 328 - #define INT_RTCINT 10 /* Real Time Clock */ 329 - #define INT_SSPINT 11 /* Synchronous Serial Port */ 330 - #define INT_UARTINT0 12 /* UART 0 on development chip */ 331 - #define INT_UARTINT1 13 /* UART 1 on development chip */ 332 - #define INT_UARTINT2 14 /* UART 2 on development chip */ 333 - #define INT_SCIINT 15 /* Smart Card Interface */ 334 - #define INT_CLCDINT 16 /* CLCD controller */ 335 - #define INT_DMAINT 17 /* DMA controller */ 336 - #define INT_PWRFAILINT 18 /* Power failure */ 337 - #define INT_MBXINT 19 /* Graphics processor */ 338 - #define INT_GNDINT 20 /* Reserved */ 339 - /* External interrupt signals from logic tiles or secondary controller */ 340 - #define INT_VICSOURCE21 21 /* Disk on Chip */ 341 - #define INT_VICSOURCE22 22 /* MCI0A */ 342 - #define INT_VICSOURCE23 23 /* MCI1A */ 343 - #define INT_VICSOURCE24 24 /* AACI */ 344 - #define INT_VICSOURCE25 25 /* Ethernet */ 345 - #define INT_VICSOURCE26 26 /* USB */ 346 - #define INT_VICSOURCE27 27 /* PCI 0 */ 347 - #define INT_VICSOURCE28 28 /* PCI 1 */ 348 - #define INT_VICSOURCE29 29 /* PCI 2 */ 349 - #define INT_VICSOURCE30 30 /* PCI 3 */ 350 - #define INT_VICSOURCE31 31 /* SIC source */ 351 - 352 - #define VERSATILE_SC_VALID_INT 0x003FFFFF 353 - 354 - #define MAXIRQNUM 31 355 - #define MAXFIQNUM 31 356 - #define MAXSWINUM 31 357 - 358 - /* ------------------------------------------------------------------------ 359 - * Interrupts - bit assignment (secondary) 360 - * ------------------------------------------------------------------------ 361 - */ 362 - #define SIC_INT_MMCI0B 1 /* Multimedia Card 0B */ 363 - #define SIC_INT_MMCI1B 2 /* Multimedia Card 1B */ 364 - #define SIC_INT_KMI0 3 /* Keyboard/Mouse port 0 */ 365 - #define SIC_INT_KMI1 4 /* Keyboard/Mouse port 1 */ 366 - #define SIC_INT_SCI3 5 /* Smart Card interface */ 367 - #define SIC_INT_UART3 6 /* UART 3 empty or data available */ 368 - #define SIC_INT_CLCD 7 /* Character LCD */ 369 - #define SIC_INT_TOUCH 8 /* Touchscreen */ 370 - #define SIC_INT_KEYPAD 9 /* Key pressed on display keypad */ 371 - /* 10:20 - reserved */ 372 - #define SIC_INT_DoC 21 /* Disk on Chip memory controller */ 373 - #define SIC_INT_MMCI0A 22 /* MMC 0A */ 374 - #define SIC_INT_MMCI1A 23 /* MMC 1A */ 375 - #define SIC_INT_AACI 24 /* Audio Codec */ 376 - #define SIC_INT_ETH 25 /* Ethernet controller */ 377 - #define SIC_INT_USB 26 /* USB controller */ 378 - #define SIC_INT_PCI0 27 379 - #define SIC_INT_PCI1 28 380 - #define SIC_INT_PCI2 29 381 - #define SIC_INT_PCI3 30 382 - 383 - 384 - /* 385 - * System controller bit assignment 386 - */ 387 - #define VERSATILE_REFCLK 0 388 - #define VERSATILE_TIMCLK 1 389 - 390 - #define VERSATILE_TIMER1_EnSel 15 391 - #define VERSATILE_TIMER2_EnSel 17 392 - #define VERSATILE_TIMER3_EnSel 19 393 - #define VERSATILE_TIMER4_EnSel 21 394 - 395 - 396 - #define VERSATILE_CSR_BASE 0x10000000 397 - #define VERSATILE_CSR_SIZE 0x10000000 398 - 399 - #ifdef CONFIG_MACH_VERSATILE_AB 400 - /* 401 - * IB2 Versatile/AB expansion board definitions 402 - */ 403 - #define VERSATILE_IB2_CAMERA_BANK VERSATILE_IB2_BASE 404 - #define VERSATILE_IB2_KBD_DATAREG (VERSATILE_IB2_BASE + 0x01000000) 405 - 406 - /* VICINTSOURCE27 */ 407 - #define VERSATILE_IB2_INT_BASE (VERSATILE_IB2_BASE + 0x02000000) 408 - #define VERSATILE_IB2_IER (VERSATILE_IB2_INT_BASE + 0) 409 - #define VERSATILE_IB2_ISR (VERSATILE_IB2_INT_BASE + 4) 410 - 411 - #define VERSATILE_IB2_CTL_BASE (VERSATILE_IB2_BASE + 0x03000000) 412 - #define VERSATILE_IB2_CTRL (VERSATILE_IB2_CTL_BASE + 0) 413 - #define VERSATILE_IB2_STAT (VERSATILE_IB2_CTL_BASE + 4) 414 - #endif 415 - 416 - #endif
-45
arch/arm/mach-versatile/include/mach/uncompress.h
··· 1 - /* 2 - * arch/arm/mach-versatile/include/mach/uncompress.h 3 - * 4 - * Copyright (C) 2003 ARM Limited 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License as published by 8 - * the Free Software Foundation; either version 2 of the License, or 9 - * (at your option) any later version. 10 - * 11 - * This program is distributed in the hope that it will be useful, 12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - * GNU General Public License for more details. 15 - * 16 - * You should have received a copy of the GNU General Public License 17 - * along with this program; if not, write to the Free Software 18 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 - */ 20 - #define AMBA_UART_DR (*(volatile unsigned char *)0x101F1000) 21 - #define AMBA_UART_LCRH (*(volatile unsigned char *)0x101F102C) 22 - #define AMBA_UART_CR (*(volatile unsigned char *)0x101F1030) 23 - #define AMBA_UART_FR (*(volatile unsigned char *)0x101F1018) 24 - 25 - /* 26 - * This does not append a newline 27 - */ 28 - static inline void putc(int c) 29 - { 30 - while (AMBA_UART_FR & (1 << 5)) 31 - barrier(); 32 - 33 - AMBA_UART_DR = c; 34 - } 35 - 36 - static inline void flush(void) 37 - { 38 - while (AMBA_UART_FR & (1 << 3)) 39 - barrier(); 40 - } 41 - 42 - /* 43 - * nothing to do 44 - */ 45 - #define arch_decomp_setup()
-368
arch/arm/mach-versatile/pci.c
··· 1 - /* 2 - * linux/arch/arm/mach-versatile/pci.c 3 - * 4 - * (C) Copyright Koninklijke Philips Electronics NV 2004. All rights reserved. 5 - * You can redistribute and/or modify this software under the terms of version 2 6 - * of the GNU General Public License as published by the Free Software Foundation. 7 - * THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED 8 - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. See the GNU 9 - * General Public License for more details. 10 - * Koninklijke Philips Electronics nor its subsidiaries is obligated to provide any support for this software. 11 - * 12 - * ARM Versatile PCI driver. 13 - * 14 - * 14/04/2005 Initial version, colin.king@philips.com 15 - * 16 - */ 17 - #include <linux/kernel.h> 18 - #include <linux/pci.h> 19 - #include <linux/ioport.h> 20 - #include <linux/interrupt.h> 21 - #include <linux/spinlock.h> 22 - #include <linux/init.h> 23 - #include <linux/io.h> 24 - 25 - #include <mach/hardware.h> 26 - #include <mach/irqs.h> 27 - #include <asm/irq.h> 28 - #include <asm/mach/pci.h> 29 - 30 - /* 31 - * these spaces are mapped using the following base registers: 32 - * 33 - * Usage Local Bus Memory Base/Map registers used 34 - * 35 - * Mem 50000000 - 5FFFFFFF LB_BASE0/LB_MAP0, non prefetch 36 - * Mem 60000000 - 6FFFFFFF LB_BASE1/LB_MAP1, prefetch 37 - * IO 44000000 - 4FFFFFFF LB_BASE2/LB_MAP2, IO 38 - * Cfg 42000000 - 42FFFFFF PCI config 39 - * 40 - */ 41 - #define __IO_ADDRESS(n) ((void __iomem *)(unsigned long)IO_ADDRESS(n)) 42 - #define SYS_PCICTL __IO_ADDRESS(VERSATILE_SYS_PCICTL) 43 - #define PCI_IMAP0 __IO_ADDRESS(VERSATILE_PCI_CORE_BASE+0x0) 44 - #define PCI_IMAP1 __IO_ADDRESS(VERSATILE_PCI_CORE_BASE+0x4) 45 - #define PCI_IMAP2 __IO_ADDRESS(VERSATILE_PCI_CORE_BASE+0x8) 46 - #define PCI_SMAP0 __IO_ADDRESS(VERSATILE_PCI_CORE_BASE+0x14) 47 - #define PCI_SMAP1 __IO_ADDRESS(VERSATILE_PCI_CORE_BASE+0x18) 48 - #define PCI_SMAP2 __IO_ADDRESS(VERSATILE_PCI_CORE_BASE+0x1c) 49 - #define PCI_SELFID __IO_ADDRESS(VERSATILE_PCI_CORE_BASE+0xc) 50 - 51 - #define DEVICE_ID_OFFSET 0x00 52 - #define CSR_OFFSET 0x04 53 - #define CLASS_ID_OFFSET 0x08 54 - 55 - #define VP_PCI_DEVICE_ID 0x030010ee 56 - #define VP_PCI_CLASS_ID 0x0b400000 57 - 58 - static unsigned long pci_slot_ignore = 0; 59 - 60 - static int __init versatile_pci_slot_ignore(char *str) 61 - { 62 - int retval; 63 - int slot; 64 - 65 - while ((retval = get_option(&str,&slot))) { 66 - if ((slot < 0) || (slot > 31)) { 67 - printk("Illegal slot value: %d\n",slot); 68 - } else { 69 - pci_slot_ignore |= (1 << slot); 70 - } 71 - } 72 - return 1; 73 - } 74 - 75 - __setup("pci_slot_ignore=", versatile_pci_slot_ignore); 76 - 77 - 78 - static void __iomem *__pci_addr(struct pci_bus *bus, 79 - unsigned int devfn, int offset) 80 - { 81 - unsigned int busnr = bus->number; 82 - 83 - /* 84 - * Trap out illegal values 85 - */ 86 - if (offset > 255) 87 - BUG(); 88 - if (busnr > 255) 89 - BUG(); 90 - if (devfn > 255) 91 - BUG(); 92 - 93 - return VERSATILE_PCI_CFG_VIRT_BASE + ((busnr << 16) | 94 - (PCI_SLOT(devfn) << 11) | (PCI_FUNC(devfn) << 8) | offset); 95 - } 96 - 97 - static int versatile_read_config(struct pci_bus *bus, unsigned int devfn, int where, 98 - int size, u32 *val) 99 - { 100 - void __iomem *addr = __pci_addr(bus, devfn, where & ~3); 101 - u32 v; 102 - int slot = PCI_SLOT(devfn); 103 - 104 - if (pci_slot_ignore & (1 << slot)) { 105 - /* Ignore this slot */ 106 - switch (size) { 107 - case 1: 108 - v = 0xff; 109 - break; 110 - case 2: 111 - v = 0xffff; 112 - break; 113 - default: 114 - v = 0xffffffff; 115 - } 116 - } else { 117 - switch (size) { 118 - case 1: 119 - v = __raw_readl(addr); 120 - if (where & 2) v >>= 16; 121 - if (where & 1) v >>= 8; 122 - v &= 0xff; 123 - break; 124 - 125 - case 2: 126 - v = __raw_readl(addr); 127 - if (where & 2) v >>= 16; 128 - v &= 0xffff; 129 - break; 130 - 131 - default: 132 - v = __raw_readl(addr); 133 - break; 134 - } 135 - } 136 - 137 - *val = v; 138 - return PCIBIOS_SUCCESSFUL; 139 - } 140 - 141 - static int versatile_write_config(struct pci_bus *bus, unsigned int devfn, int where, 142 - int size, u32 val) 143 - { 144 - void __iomem *addr = __pci_addr(bus, devfn, where); 145 - int slot = PCI_SLOT(devfn); 146 - 147 - if (pci_slot_ignore & (1 << slot)) { 148 - return PCIBIOS_SUCCESSFUL; 149 - } 150 - 151 - switch (size) { 152 - case 1: 153 - __raw_writeb((u8)val, addr); 154 - break; 155 - 156 - case 2: 157 - __raw_writew((u16)val, addr); 158 - break; 159 - 160 - case 4: 161 - __raw_writel(val, addr); 162 - break; 163 - } 164 - 165 - return PCIBIOS_SUCCESSFUL; 166 - } 167 - 168 - static struct pci_ops pci_versatile_ops = { 169 - .read = versatile_read_config, 170 - .write = versatile_write_config, 171 - }; 172 - 173 - static struct resource unused_mem = { 174 - .name = "PCI unused", 175 - .start = VERSATILE_PCI_MEM_BASE0, 176 - .end = VERSATILE_PCI_MEM_BASE0+VERSATILE_PCI_MEM_BASE0_SIZE-1, 177 - .flags = IORESOURCE_MEM, 178 - }; 179 - 180 - static struct resource non_mem = { 181 - .name = "PCI non-prefetchable", 182 - .start = VERSATILE_PCI_MEM_BASE1, 183 - .end = VERSATILE_PCI_MEM_BASE1+VERSATILE_PCI_MEM_BASE1_SIZE-1, 184 - .flags = IORESOURCE_MEM, 185 - }; 186 - 187 - static struct resource pre_mem = { 188 - .name = "PCI prefetchable", 189 - .start = VERSATILE_PCI_MEM_BASE2, 190 - .end = VERSATILE_PCI_MEM_BASE2+VERSATILE_PCI_MEM_BASE2_SIZE-1, 191 - .flags = IORESOURCE_MEM | IORESOURCE_PREFETCH, 192 - }; 193 - 194 - static int __init pci_versatile_setup_resources(struct pci_sys_data *sys) 195 - { 196 - int ret = 0; 197 - 198 - ret = request_resource(&iomem_resource, &unused_mem); 199 - if (ret) { 200 - printk(KERN_ERR "PCI: unable to allocate unused " 201 - "memory region (%d)\n", ret); 202 - goto out; 203 - } 204 - ret = request_resource(&iomem_resource, &non_mem); 205 - if (ret) { 206 - printk(KERN_ERR "PCI: unable to allocate non-prefetchable " 207 - "memory region (%d)\n", ret); 208 - goto release_unused_mem; 209 - } 210 - ret = request_resource(&iomem_resource, &pre_mem); 211 - if (ret) { 212 - printk(KERN_ERR "PCI: unable to allocate prefetchable " 213 - "memory region (%d)\n", ret); 214 - goto release_non_mem; 215 - } 216 - 217 - /* 218 - * the mem resource for this bus 219 - * the prefetch mem resource for this bus 220 - */ 221 - pci_add_resource_offset(&sys->resources, &non_mem, sys->mem_offset); 222 - pci_add_resource_offset(&sys->resources, &pre_mem, sys->mem_offset); 223 - 224 - goto out; 225 - 226 - release_non_mem: 227 - release_resource(&non_mem); 228 - release_unused_mem: 229 - release_resource(&unused_mem); 230 - out: 231 - return ret; 232 - } 233 - 234 - int __init pci_versatile_setup(int nr, struct pci_sys_data *sys) 235 - { 236 - int ret = 0; 237 - int i; 238 - int myslot = -1; 239 - unsigned long val; 240 - void __iomem *local_pci_cfg_base; 241 - 242 - val = __raw_readl(SYS_PCICTL); 243 - if (!(val & 1)) { 244 - printk("Not plugged into PCI backplane!\n"); 245 - ret = -EIO; 246 - goto out; 247 - } 248 - 249 - ret = pci_ioremap_io(0, VERSATILE_PCI_IO_BASE); 250 - if (ret) 251 - goto out; 252 - 253 - if (nr == 0) { 254 - ret = pci_versatile_setup_resources(sys); 255 - if (ret < 0) { 256 - printk("pci_versatile_setup: resources... oops?\n"); 257 - goto out; 258 - } 259 - } else { 260 - printk("pci_versatile_setup: resources... nr == 0??\n"); 261 - goto out; 262 - } 263 - 264 - /* 265 - * We need to discover the PCI core first to configure itself 266 - * before the main PCI probing is performed 267 - */ 268 - for (i=0; i<32; i++) 269 - if ((__raw_readl(VERSATILE_PCI_VIRT_BASE+(i<<11)+DEVICE_ID_OFFSET) == VP_PCI_DEVICE_ID) && 270 - (__raw_readl(VERSATILE_PCI_VIRT_BASE+(i<<11)+CLASS_ID_OFFSET) == VP_PCI_CLASS_ID)) { 271 - myslot = i; 272 - break; 273 - } 274 - 275 - if (myslot == -1) { 276 - printk("Cannot find PCI core!\n"); 277 - ret = -EIO; 278 - goto out; 279 - } 280 - 281 - printk("PCI core found (slot %d)\n",myslot); 282 - 283 - __raw_writel(myslot, PCI_SELFID); 284 - local_pci_cfg_base = VERSATILE_PCI_CFG_VIRT_BASE + (myslot << 11); 285 - 286 - val = __raw_readl(local_pci_cfg_base + CSR_OFFSET); 287 - val |= PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER | PCI_COMMAND_INVALIDATE; 288 - __raw_writel(val, local_pci_cfg_base + CSR_OFFSET); 289 - 290 - /* 291 - * Configure the PCI inbound memory windows to be 1:1 mapped to SDRAM 292 - */ 293 - __raw_writel(PHYS_OFFSET, local_pci_cfg_base + PCI_BASE_ADDRESS_0); 294 - __raw_writel(PHYS_OFFSET, local_pci_cfg_base + PCI_BASE_ADDRESS_1); 295 - __raw_writel(PHYS_OFFSET, local_pci_cfg_base + PCI_BASE_ADDRESS_2); 296 - 297 - /* 298 - * For many years the kernel and QEMU were symbiotically buggy 299 - * in that they both assumed the same broken IRQ mapping. 300 - * QEMU therefore attempts to auto-detect old broken kernels 301 - * so that they still work on newer QEMU as they did on old 302 - * QEMU. Since we now use the correct (ie matching-hardware) 303 - * IRQ mapping we write a definitely different value to a 304 - * PCI_INTERRUPT_LINE register to tell QEMU that we expect 305 - * real hardware behaviour and it need not be backwards 306 - * compatible for us. This write is harmless on real hardware. 307 - */ 308 - __raw_writel(0, VERSATILE_PCI_VIRT_BASE+PCI_INTERRUPT_LINE); 309 - 310 - /* 311 - * Do not to map Versatile FPGA PCI device into memory space 312 - */ 313 - pci_slot_ignore |= (1 << myslot); 314 - ret = 1; 315 - 316 - out: 317 - return ret; 318 - } 319 - 320 - 321 - void __init pci_versatile_preinit(void) 322 - { 323 - pcibios_min_mem = 0x50000000; 324 - 325 - __raw_writel(VERSATILE_PCI_MEM_BASE0 >> 28, PCI_IMAP0); 326 - __raw_writel(VERSATILE_PCI_MEM_BASE1 >> 28, PCI_IMAP1); 327 - __raw_writel(VERSATILE_PCI_MEM_BASE2 >> 28, PCI_IMAP2); 328 - 329 - __raw_writel(PHYS_OFFSET >> 28, PCI_SMAP0); 330 - __raw_writel(PHYS_OFFSET >> 28, PCI_SMAP1); 331 - __raw_writel(PHYS_OFFSET >> 28, PCI_SMAP2); 332 - 333 - __raw_writel(1, SYS_PCICTL); 334 - } 335 - 336 - /* 337 - * map the specified device/slot/pin to an IRQ. Different backplanes may need to modify this. 338 - */ 339 - static int __init versatile_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 340 - { 341 - int irq; 342 - 343 - /* 344 - * Slot INTA INTB INTC INTD 345 - * 31 PCI1 PCI2 PCI3 PCI0 346 - * 30 PCI0 PCI1 PCI2 PCI3 347 - * 29 PCI3 PCI0 PCI1 PCI2 348 - */ 349 - irq = IRQ_SIC_PCI0 + ((slot + 2 + pin - 1) & 3); 350 - 351 - return irq; 352 - } 353 - 354 - static struct hw_pci versatile_pci __initdata = { 355 - .map_irq = versatile_map_irq, 356 - .nr_controllers = 1, 357 - .ops = &pci_versatile_ops, 358 - .setup = pci_versatile_setup, 359 - .preinit = pci_versatile_preinit, 360 - }; 361 - 362 - static int __init versatile_pci_init(void) 363 - { 364 - pci_common_init(&versatile_pci); 365 - return 0; 366 - } 367 - 368 - subsys_initcall(versatile_pci_init);
-44
arch/arm/mach-versatile/versatile_ab.c
··· 1 - /* 2 - * linux/arch/arm/mach-versatile/versatile_ab.c 3 - * 4 - * Copyright (C) 2004 ARM Limited 5 - * Copyright (C) 2000 Deep Blue Solutions Ltd 6 - * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License as published by 9 - * the Free Software Foundation; either version 2 of the License, or 10 - * (at your option) any later version. 11 - * 12 - * This program is distributed in the hope that it will be useful, 13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 - * GNU General Public License for more details. 16 - * 17 - * You should have received a copy of the GNU General Public License 18 - * along with this program; if not, write to the Free Software 19 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 - */ 21 - 22 - #include <linux/init.h> 23 - #include <linux/device.h> 24 - #include <linux/amba/bus.h> 25 - #include <linux/io.h> 26 - 27 - #include <mach/hardware.h> 28 - #include <asm/irq.h> 29 - #include <asm/mach-types.h> 30 - 31 - #include <asm/mach/arch.h> 32 - 33 - #include "core.h" 34 - 35 - MACHINE_START(VERSATILE_AB, "ARM-Versatile AB") 36 - /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ 37 - .atag_offset = 0x100, 38 - .map_io = versatile_map_io, 39 - .init_early = versatile_init_early, 40 - .init_irq = versatile_init_irq, 41 - .init_time = versatile_timer_init, 42 - .init_machine = versatile_init, 43 - .restart = versatile_restart, 44 - MACHINE_END
+375 -1
arch/arm/mach-versatile/versatile_dt.c
··· 22 22 */ 23 23 24 24 #include <linux/init.h> 25 + #include <linux/io.h> 26 + #include <linux/of.h> 27 + #include <linux/of_address.h> 25 28 #include <linux/of_irq.h> 26 29 #include <linux/of_platform.h> 30 + #include <linux/slab.h> 31 + #include <linux/amba/bus.h> 32 + #include <linux/amba/clcd.h> 33 + #include <linux/platform_data/video-clcd-versatile.h> 34 + #include <linux/amba/mmci.h> 35 + #include <linux/mtd/physmap.h> 27 36 #include <asm/mach-types.h> 28 37 #include <asm/mach/arch.h> 38 + #include <asm/mach/map.h> 29 39 30 - #include "core.h" 40 + /* macro to get at MMIO space when running virtually */ 41 + #define IO_ADDRESS(x) (((x) & 0x0fffffff) + (((x) >> 4) & 0x0f000000) + 0xf0000000) 42 + #define __io_address(n) ((void __iomem __force *)IO_ADDRESS(n)) 43 + 44 + /* 45 + * Memory definitions 46 + */ 47 + #define VERSATILE_FLASH_BASE 0x34000000 48 + #define VERSATILE_FLASH_SIZE SZ_64M 49 + 50 + /* 51 + * ------------------------------------------------------------------------ 52 + * Versatile Registers 53 + * ------------------------------------------------------------------------ 54 + */ 55 + #define VERSATILE_SYS_LOCK_OFFSET 0x20 56 + #define VERSATILE_SYS_RESETCTL_OFFSET 0x40 57 + #define VERSATILE_SYS_PCICTL_OFFSET 0x44 58 + #define VERSATILE_SYS_MCI_OFFSET 0x48 59 + #define VERSATILE_SYS_FLASH_OFFSET 0x4C 60 + #define VERSATILE_SYS_CLCD_OFFSET 0x50 61 + 62 + /* 63 + * VERSATILE_SYS_FLASH 64 + */ 65 + #define VERSATILE_FLASHPROG_FLVPPEN (1 << 0) /* Enable writing to flash */ 66 + 67 + /* 68 + * VERSATILE peripheral addresses 69 + */ 70 + #define VERSATILE_MMCI0_BASE 0x10005000 /* MMC interface */ 71 + #define VERSATILE_MMCI1_BASE 0x1000B000 /* MMC Interface */ 72 + #define VERSATILE_CLCD_BASE 0x10120000 /* CLCD */ 73 + #define VERSATILE_SCTL_BASE 0x101E0000 /* System controller */ 74 + #define VERSATILE_IB2_BASE 0x24000000 /* IB2 module */ 75 + #define VERSATILE_IB2_CTL_BASE (VERSATILE_IB2_BASE + 0x03000000) 76 + 77 + /* 78 + * System controller bit assignment 79 + */ 80 + #define VERSATILE_REFCLK 0 81 + #define VERSATILE_TIMCLK 1 82 + 83 + #define VERSATILE_TIMER1_EnSel 15 84 + #define VERSATILE_TIMER2_EnSel 17 85 + #define VERSATILE_TIMER3_EnSel 19 86 + #define VERSATILE_TIMER4_EnSel 21 87 + 88 + static void __iomem *versatile_sys_base; 89 + static void __iomem *versatile_ib2_ctrl; 90 + 91 + static void versatile_flash_set_vpp(struct platform_device *pdev, int on) 92 + { 93 + u32 val; 94 + 95 + val = readl(versatile_sys_base + VERSATILE_SYS_FLASH_OFFSET); 96 + if (on) 97 + val |= VERSATILE_FLASHPROG_FLVPPEN; 98 + else 99 + val &= ~VERSATILE_FLASHPROG_FLVPPEN; 100 + writel(val, versatile_sys_base + VERSATILE_SYS_FLASH_OFFSET); 101 + } 102 + 103 + static struct physmap_flash_data versatile_flash_data = { 104 + .width = 4, 105 + .set_vpp = versatile_flash_set_vpp, 106 + }; 107 + 108 + static struct resource versatile_flash_resource = { 109 + .start = VERSATILE_FLASH_BASE, 110 + .end = VERSATILE_FLASH_BASE + VERSATILE_FLASH_SIZE - 1, 111 + .flags = IORESOURCE_MEM, 112 + }; 113 + 114 + struct platform_device versatile_flash_device = { 115 + .name = "physmap-flash", 116 + .id = 0, 117 + .dev = { 118 + .platform_data = &versatile_flash_data, 119 + }, 120 + .num_resources = 1, 121 + .resource = &versatile_flash_resource, 122 + }; 123 + 124 + unsigned int mmc_status(struct device *dev) 125 + { 126 + struct amba_device *adev = container_of(dev, struct amba_device, dev); 127 + u32 mask; 128 + 129 + if (adev->res.start == VERSATILE_MMCI0_BASE) 130 + mask = 1; 131 + else 132 + mask = 2; 133 + 134 + return readl(versatile_sys_base + VERSATILE_SYS_MCI_OFFSET) & mask; 135 + } 136 + 137 + static struct mmci_platform_data mmc0_plat_data = { 138 + .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, 139 + .status = mmc_status, 140 + .gpio_wp = -1, 141 + .gpio_cd = -1, 142 + }; 143 + 144 + static struct mmci_platform_data mmc1_plat_data = { 145 + .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, 146 + .status = mmc_status, 147 + .gpio_wp = -1, 148 + .gpio_cd = -1, 149 + }; 150 + 151 + /* 152 + * CLCD support. 153 + */ 154 + #define SYS_CLCD_MODE_MASK (3 << 0) 155 + #define SYS_CLCD_MODE_888 (0 << 0) 156 + #define SYS_CLCD_MODE_5551 (1 << 0) 157 + #define SYS_CLCD_MODE_565_RLSB (2 << 0) 158 + #define SYS_CLCD_MODE_565_BLSB (3 << 0) 159 + #define SYS_CLCD_NLCDIOON (1 << 2) 160 + #define SYS_CLCD_VDDPOSSWITCH (1 << 3) 161 + #define SYS_CLCD_PWR3V5SWITCH (1 << 4) 162 + #define SYS_CLCD_ID_MASK (0x1f << 8) 163 + #define SYS_CLCD_ID_SANYO_3_8 (0x00 << 8) 164 + #define SYS_CLCD_ID_UNKNOWN_8_4 (0x01 << 8) 165 + #define SYS_CLCD_ID_EPSON_2_2 (0x02 << 8) 166 + #define SYS_CLCD_ID_SANYO_2_5 (0x07 << 8) 167 + #define SYS_CLCD_ID_VGA (0x1f << 8) 168 + 169 + static bool is_sanyo_2_5_lcd; 170 + 171 + /* 172 + * Disable all display connectors on the interface module. 173 + */ 174 + static void versatile_clcd_disable(struct clcd_fb *fb) 175 + { 176 + void __iomem *sys_clcd = versatile_sys_base + VERSATILE_SYS_CLCD_OFFSET; 177 + u32 val; 178 + 179 + val = readl(sys_clcd); 180 + val &= ~SYS_CLCD_NLCDIOON | SYS_CLCD_PWR3V5SWITCH; 181 + writel(val, sys_clcd); 182 + 183 + /* 184 + * If the LCD is Sanyo 2x5 in on the IB2 board, turn the back-light off 185 + */ 186 + if (of_machine_is_compatible("arm,versatile-ab") && is_sanyo_2_5_lcd) { 187 + unsigned long ctrl; 188 + 189 + ctrl = readl(versatile_ib2_ctrl); 190 + ctrl &= ~0x01; 191 + writel(ctrl, versatile_ib2_ctrl); 192 + } 193 + } 194 + 195 + /* 196 + * Enable the relevant connector on the interface module. 197 + */ 198 + static void versatile_clcd_enable(struct clcd_fb *fb) 199 + { 200 + struct fb_var_screeninfo *var = &fb->fb.var; 201 + void __iomem *sys_clcd = versatile_sys_base + VERSATILE_SYS_CLCD_OFFSET; 202 + u32 val; 203 + 204 + val = readl(sys_clcd); 205 + val &= ~SYS_CLCD_MODE_MASK; 206 + 207 + switch (var->green.length) { 208 + case 5: 209 + val |= SYS_CLCD_MODE_5551; 210 + break; 211 + case 6: 212 + if (var->red.offset == 0) 213 + val |= SYS_CLCD_MODE_565_RLSB; 214 + else 215 + val |= SYS_CLCD_MODE_565_BLSB; 216 + break; 217 + case 8: 218 + val |= SYS_CLCD_MODE_888; 219 + break; 220 + } 221 + 222 + /* 223 + * Set the MUX 224 + */ 225 + writel(val, sys_clcd); 226 + 227 + /* 228 + * And now enable the PSUs 229 + */ 230 + val |= SYS_CLCD_NLCDIOON | SYS_CLCD_PWR3V5SWITCH; 231 + writel(val, sys_clcd); 232 + 233 + /* 234 + * If the LCD is Sanyo 2x5 in on the IB2 board, turn the back-light on 235 + */ 236 + if (of_machine_is_compatible("arm,versatile-ab") && is_sanyo_2_5_lcd) { 237 + unsigned long ctrl; 238 + 239 + ctrl = readl(versatile_ib2_ctrl); 240 + ctrl |= 0x01; 241 + writel(ctrl, versatile_ib2_ctrl); 242 + } 243 + } 244 + 245 + /* 246 + * Detect which LCD panel is connected, and return the appropriate 247 + * clcd_panel structure. Note: we do not have any information on 248 + * the required timings for the 8.4in panel, so we presently assume 249 + * VGA timings. 250 + */ 251 + static int versatile_clcd_setup(struct clcd_fb *fb) 252 + { 253 + void __iomem *sys_clcd = versatile_sys_base + VERSATILE_SYS_CLCD_OFFSET; 254 + const char *panel_name; 255 + u32 val; 256 + 257 + is_sanyo_2_5_lcd = false; 258 + 259 + val = readl(sys_clcd) & SYS_CLCD_ID_MASK; 260 + if (val == SYS_CLCD_ID_SANYO_3_8) 261 + panel_name = "Sanyo TM38QV67A02A"; 262 + else if (val == SYS_CLCD_ID_SANYO_2_5) { 263 + panel_name = "Sanyo QVGA Portrait"; 264 + is_sanyo_2_5_lcd = true; 265 + } else if (val == SYS_CLCD_ID_EPSON_2_2) 266 + panel_name = "Epson L2F50113T00"; 267 + else if (val == SYS_CLCD_ID_VGA) 268 + panel_name = "VGA"; 269 + else { 270 + printk(KERN_ERR "CLCD: unknown LCD panel ID 0x%08x, using VGA\n", 271 + val); 272 + panel_name = "VGA"; 273 + } 274 + 275 + fb->panel = versatile_clcd_get_panel(panel_name); 276 + if (!fb->panel) 277 + return -EINVAL; 278 + 279 + return versatile_clcd_setup_dma(fb, SZ_1M); 280 + } 281 + 282 + static void versatile_clcd_decode(struct clcd_fb *fb, struct clcd_regs *regs) 283 + { 284 + clcdfb_decode(fb, regs); 285 + 286 + /* Always clear BGR for RGB565: we do the routing externally */ 287 + if (fb->fb.var.green.length == 6) 288 + regs->cntl &= ~CNTL_BGR; 289 + } 290 + 291 + static struct clcd_board clcd_plat_data = { 292 + .name = "Versatile", 293 + .caps = CLCD_CAP_5551 | CLCD_CAP_565 | CLCD_CAP_888, 294 + .check = clcdfb_check, 295 + .decode = versatile_clcd_decode, 296 + .disable = versatile_clcd_disable, 297 + .enable = versatile_clcd_enable, 298 + .setup = versatile_clcd_setup, 299 + .mmap = versatile_clcd_mmap_dma, 300 + .remove = versatile_clcd_remove_dma, 301 + }; 302 + 303 + /* 304 + * Lookup table for attaching a specific name and platform_data pointer to 305 + * devices as they get created by of_platform_populate(). Ideally this table 306 + * would not exist, but the current clock implementation depends on some devices 307 + * having a specific name. 308 + */ 309 + struct of_dev_auxdata versatile_auxdata_lookup[] __initdata = { 310 + OF_DEV_AUXDATA("arm,primecell", VERSATILE_MMCI0_BASE, "fpga:05", &mmc0_plat_data), 311 + OF_DEV_AUXDATA("arm,primecell", VERSATILE_MMCI1_BASE, "fpga:0b", &mmc1_plat_data), 312 + OF_DEV_AUXDATA("arm,primecell", VERSATILE_CLCD_BASE, "dev:20", &clcd_plat_data), 313 + {} 314 + }; 315 + 316 + static struct map_desc versatile_io_desc[] __initdata __maybe_unused = { 317 + { 318 + .virtual = IO_ADDRESS(VERSATILE_SCTL_BASE), 319 + .pfn = __phys_to_pfn(VERSATILE_SCTL_BASE), 320 + .length = SZ_4K * 9, 321 + .type = MT_DEVICE 322 + } 323 + }; 324 + 325 + static void __init versatile_map_io(void) 326 + { 327 + debug_ll_io_init(); 328 + iotable_init(versatile_io_desc, ARRAY_SIZE(versatile_io_desc)); 329 + } 330 + 331 + static void __init versatile_init_early(void) 332 + { 333 + u32 val; 334 + 335 + /* 336 + * set clock frequency: 337 + * VERSATILE_REFCLK is 32KHz 338 + * VERSATILE_TIMCLK is 1MHz 339 + */ 340 + val = readl(__io_address(VERSATILE_SCTL_BASE)); 341 + writel((VERSATILE_TIMCLK << VERSATILE_TIMER1_EnSel) | 342 + (VERSATILE_TIMCLK << VERSATILE_TIMER2_EnSel) | 343 + (VERSATILE_TIMCLK << VERSATILE_TIMER3_EnSel) | 344 + (VERSATILE_TIMCLK << VERSATILE_TIMER4_EnSel) | val, 345 + __io_address(VERSATILE_SCTL_BASE)); 346 + } 347 + 348 + static void versatile_restart(enum reboot_mode mode, const char *cmd) 349 + { 350 + u32 val; 351 + 352 + val = readl(versatile_sys_base + VERSATILE_SYS_RESETCTL_OFFSET); 353 + val |= 0x105; 354 + 355 + writel(0xa05f, versatile_sys_base + VERSATILE_SYS_LOCK_OFFSET); 356 + writel(val, versatile_sys_base + VERSATILE_SYS_RESETCTL_OFFSET); 357 + writel(0, versatile_sys_base + VERSATILE_SYS_LOCK_OFFSET); 358 + } 359 + 360 + static void __init versatile_dt_pci_init(void) 361 + { 362 + u32 val; 363 + struct device_node *np; 364 + struct property *newprop; 365 + 366 + np = of_find_compatible_node(NULL, NULL, "arm,versatile-pci"); 367 + if (!np) 368 + return; 369 + 370 + /* Check if PCI backplane is detected */ 371 + val = readl(versatile_sys_base + VERSATILE_SYS_PCICTL_OFFSET); 372 + if (val & 1) { 373 + /* 374 + * Enable PCI accesses. Note that the documentaton is 375 + * inconsistent whether or not this is needed, but the old 376 + * driver had it so we will keep it. 377 + */ 378 + writel(1, versatile_sys_base + VERSATILE_SYS_PCICTL_OFFSET); 379 + return; 380 + } 381 + 382 + newprop = kzalloc(sizeof(*newprop), GFP_KERNEL); 383 + if (!newprop) 384 + return; 385 + 386 + newprop->name = kstrdup("status", GFP_KERNEL); 387 + newprop->value = kstrdup("disabled", GFP_KERNEL); 388 + newprop->length = sizeof("disabled"); 389 + of_update_property(np, newprop); 390 + 391 + pr_info("Not plugged into PCI backplane!\n"); 392 + } 31 393 32 394 static void __init versatile_dt_init(void) 33 395 { 396 + struct device_node *np; 397 + 398 + np = of_find_compatible_node(NULL, NULL, "arm,core-module-versatile"); 399 + if (np) 400 + versatile_sys_base = of_iomap(np, 0); 401 + WARN_ON(!versatile_sys_base); 402 + 403 + versatile_ib2_ctrl = ioremap(VERSATILE_IB2_CTL_BASE, SZ_4K); 404 + 405 + versatile_dt_pci_init(); 406 + 407 + platform_device_register(&versatile_flash_device); 34 408 of_platform_populate(NULL, of_default_bus_match_table, 35 409 versatile_auxdata_lookup, NULL); 36 410 }
-91
arch/arm/mach-versatile/versatile_pb.c
··· 1 - /* 2 - * linux/arch/arm/mach-versatile/versatile_pb.c 3 - * 4 - * Copyright (C) 2004 ARM Limited 5 - * Copyright (C) 2000 Deep Blue Solutions Ltd 6 - * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License as published by 9 - * the Free Software Foundation; either version 2 of the License, or 10 - * (at your option) any later version. 11 - * 12 - * This program is distributed in the hope that it will be useful, 13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 - * GNU General Public License for more details. 16 - * 17 - * You should have received a copy of the GNU General Public License 18 - * along with this program; if not, write to the Free Software 19 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 - */ 21 - 22 - #include <linux/init.h> 23 - #include <linux/device.h> 24 - #include <linux/amba/bus.h> 25 - #include <linux/amba/pl061.h> 26 - #include <linux/amba/mmci.h> 27 - #include <linux/io.h> 28 - 29 - #include <mach/hardware.h> 30 - #include <asm/irq.h> 31 - #include <asm/mach-types.h> 32 - 33 - #include <asm/mach/arch.h> 34 - 35 - #include "core.h" 36 - 37 - #if 1 38 - #define IRQ_MMCI1A IRQ_VICSOURCE23 39 - #else 40 - #define IRQ_MMCI1A IRQ_SIC_MMCI1A 41 - #endif 42 - 43 - static struct mmci_platform_data mmc1_plat_data = { 44 - .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, 45 - .status = mmc_status, 46 - .gpio_wp = -1, 47 - .gpio_cd = -1, 48 - }; 49 - 50 - #define UART3_IRQ { IRQ_SIC_UART3 } 51 - #define SCI1_IRQ { IRQ_SIC_SCI3 } 52 - #define MMCI1_IRQ { IRQ_MMCI1A, IRQ_SIC_MMCI1B } 53 - 54 - /* 55 - * These devices are connected via the DMA APB bridge 56 - */ 57 - 58 - /* FPGA Primecells */ 59 - APB_DEVICE(uart3, "fpga:09", UART3, NULL); 60 - APB_DEVICE(sci1, "fpga:0a", SCI1, NULL); 61 - APB_DEVICE(mmc1, "fpga:0b", MMCI1, &mmc1_plat_data); 62 - 63 - 64 - static struct amba_device *amba_devs[] __initdata = { 65 - &uart3_device, 66 - &sci1_device, 67 - &mmc1_device, 68 - }; 69 - 70 - static void __init versatile_pb_init(void) 71 - { 72 - int i; 73 - 74 - versatile_init(); 75 - 76 - for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { 77 - struct amba_device *d = amba_devs[i]; 78 - amba_device_register(d, &iomem_resource); 79 - } 80 - } 81 - 82 - MACHINE_START(VERSATILE_PB, "ARM-Versatile PB") 83 - /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ 84 - .atag_offset = 0x100, 85 - .map_io = versatile_map_io, 86 - .init_early = versatile_init_early, 87 - .init_irq = versatile_init_irq, 88 - .init_time = versatile_timer_init, 89 - .init_machine = versatile_pb_init, 90 - .restart = versatile_restart, 91 - MACHINE_END
+3 -1
drivers/clk/versatile/Kconfig
··· 1 1 config COMMON_CLK_VERSATILE 2 2 bool "Clock driver for ARM Reference designs" 3 - depends on ARCH_INTEGRATOR || ARCH_REALVIEW || ARCH_VEXPRESS || ARM64 || COMPILE_TEST 3 + depends on ARCH_INTEGRATOR || ARCH_REALVIEW || \ 4 + ARCH_VERSATILE || ARCH_VEXPRESS || ARM64 || \ 5 + COMPILE_TEST 4 6 ---help--- 5 7 Supports clocking on ARM Reference designs: 6 8 - Integrator/AP and Integrator/CP