aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-versatile
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
commit8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch)
treea8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /arch/arm/mach-versatile
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'arch/arm/mach-versatile')
-rw-r--r--arch/arm/mach-versatile/Kconfig4
-rw-r--r--arch/arm/mach-versatile/Makefile.boot2
-rw-r--r--arch/arm/mach-versatile/core.c140
-rw-r--r--arch/arm/mach-versatile/core.h21
-rw-r--r--arch/arm/mach-versatile/include/mach/debug-macro.S2
-rw-r--r--arch/arm/mach-versatile/include/mach/hardware.h2
-rw-r--r--arch/arm/mach-versatile/include/mach/irqs.h6
-rw-r--r--arch/arm/mach-versatile/pci.c36
-rw-r--r--arch/arm/mach-versatile/versatile_ab.c6
-rw-r--r--arch/arm/mach-versatile/versatile_dt.c3
-rw-r--r--arch/arm/mach-versatile/versatile_pb.c24
11 files changed, 137 insertions, 109 deletions
diff --git a/arch/arm/mach-versatile/Kconfig b/arch/arm/mach-versatile/Kconfig
index 63d8e9f81b9..c1f38f6625b 100644
--- a/arch/arm/mach-versatile/Kconfig
+++ b/arch/arm/mach-versatile/Kconfig
@@ -3,9 +3,9 @@ menu "Versatile platform type"
3 3
4config ARCH_VERSATILE_PB 4config ARCH_VERSATILE_PB
5 bool "Support Versatile Platform Baseboard for ARM926EJ-S" 5 bool "Support Versatile Platform Baseboard for ARM926EJ-S"
6 default y
7 select CPU_ARM926T 6 select CPU_ARM926T
8 select MIGHT_HAVE_PCI 7 select MIGHT_HAVE_PCI
8 default y
9 help 9 help
10 Include support for the ARM(R) Versatile Platform Baseboard 10 Include support for the ARM(R) Versatile Platform Baseboard
11 for the ARM926EJ-S. 11 for the ARM926EJ-S.
@@ -19,8 +19,8 @@ config MACH_VERSATILE_AB
19 19
20config MACH_VERSATILE_DT 20config MACH_VERSATILE_DT
21 bool "Support Versatile platform from device tree" 21 bool "Support Versatile platform from device tree"
22 select CPU_ARM926T
23 select USE_OF 22 select USE_OF
23 select CPU_ARM926T
24 help 24 help
25 Include support for the ARM(R) Versatile/PB platform, 25 Include support for the ARM(R) Versatile/PB platform,
26 using the device tree for discovery 26 using the device tree for discovery
diff --git a/arch/arm/mach-versatile/Makefile.boot b/arch/arm/mach-versatile/Makefile.boot
index ff0a4b5b0a8..c7e75acfe6c 100644
--- a/arch/arm/mach-versatile/Makefile.boot
+++ b/arch/arm/mach-versatile/Makefile.boot
@@ -1,4 +1,4 @@
1 zreladdr-y += 0x00008000 1 zreladdr-y := 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
4 4
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index 5d592945036..e340a54251d 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -22,6 +22,7 @@
22#include <linux/device.h> 22#include <linux/device.h>
23#include <linux/dma-mapping.h> 23#include <linux/dma-mapping.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/sysdev.h>
25#include <linux/interrupt.h> 26#include <linux/interrupt.h>
26#include <linux/irqdomain.h> 27#include <linux/irqdomain.h>
27#include <linux/of_address.h> 28#include <linux/of_address.h>
@@ -32,12 +33,13 @@
32#include <linux/amba/mmci.h> 33#include <linux/amba/mmci.h>
33#include <linux/amba/pl022.h> 34#include <linux/amba/pl022.h>
34#include <linux/io.h> 35#include <linux/io.h>
35#include <linux/irqchip/versatile-fpga.h>
36#include <linux/gfp.h> 36#include <linux/gfp.h>
37#include <linux/clkdev.h> 37#include <linux/clkdev.h>
38#include <linux/mtd/physmap.h> 38#include <linux/mtd/physmap.h>
39 39
40#include <asm/system.h>
40#include <asm/irq.h> 41#include <asm/irq.h>
42#include <asm/leds.h>
41#include <asm/hardware/arm_timer.h> 43#include <asm/hardware/arm_timer.h>
42#include <asm/hardware/icst.h> 44#include <asm/hardware/icst.h>
43#include <asm/hardware/vic.h> 45#include <asm/hardware/vic.h>
@@ -52,6 +54,7 @@
52#include <asm/hardware/timer-sp.h> 54#include <asm/hardware/timer-sp.h>
53 55
54#include <plat/clcd.h> 56#include <plat/clcd.h>
57#include <plat/fpga-irq.h>
55#include <plat/sched_clock.h> 58#include <plat/sched_clock.h>
56 59
57#include "core.h" 60#include "core.h"
@@ -65,6 +68,12 @@
65#define VA_VIC_BASE __io_address(VERSATILE_VIC_BASE) 68#define VA_VIC_BASE __io_address(VERSATILE_VIC_BASE)
66#define VA_SIC_BASE __io_address(VERSATILE_SIC_BASE) 69#define VA_SIC_BASE __io_address(VERSATILE_SIC_BASE)
67 70
71static struct fpga_irq_data sic_irq = {
72 .base = VA_SIC_BASE,
73 .irq_start = IRQ_SIC_START,
74 .chip.name = "SIC",
75};
76
68#if 1 77#if 1
69#define IRQ_MMCI0A IRQ_VICSOURCE22 78#define IRQ_MMCI0A IRQ_VICSOURCE22
70#define IRQ_AACI IRQ_VICSOURCE24 79#define IRQ_AACI IRQ_VICSOURCE24
@@ -90,19 +99,13 @@ static const struct of_device_id sic_of_match[] __initconst = {
90 99
91void __init versatile_init_irq(void) 100void __init versatile_init_irq(void)
92{ 101{
93 struct device_node *np; 102 vic_init(VA_VIC_BASE, IRQ_VIC_START, ~0, 0);
94 103 irq_domain_generate_simple(vic_of_match, VERSATILE_VIC_BASE, IRQ_VIC_START);
95 np = of_find_matching_node_by_address(NULL, vic_of_match,
96 VERSATILE_VIC_BASE);
97 __vic_init(VA_VIC_BASE, IRQ_VIC_START, ~0, 0, np);
98 104
99 writel(~0, VA_SIC_BASE + SIC_IRQ_ENABLE_CLEAR); 105 writel(~0, VA_SIC_BASE + SIC_IRQ_ENABLE_CLEAR);
100 106
101 np = of_find_matching_node_by_address(NULL, sic_of_match, 107 fpga_irq_init(IRQ_VICSOURCE31, ~PIC_MASK, &sic_irq);
102 VERSATILE_SIC_BASE); 108 irq_domain_generate_simple(sic_of_match, VERSATILE_SIC_BASE, IRQ_SIC_START);
103
104 fpga_irq_init(VA_SIC_BASE, "SIC", IRQ_SIC_START,
105 IRQ_VICSOURCE31, ~PIC_MASK, np);
106 109
107 /* 110 /*
108 * Interrupts on secondary controller from 0 to 8 are routed to 111 * Interrupts on secondary controller from 0 to 8 are routed to
@@ -138,6 +141,11 @@ static struct map_desc versatile_io_desc[] __initdata = {
138 }, 141 },
139#ifdef CONFIG_MACH_VERSATILE_AB 142#ifdef CONFIG_MACH_VERSATILE_AB
140 { 143 {
144 .virtual = IO_ADDRESS(VERSATILE_GPIO0_BASE),
145 .pfn = __phys_to_pfn(VERSATILE_GPIO0_BASE),
146 .length = SZ_4K,
147 .type = MT_DEVICE
148 }, {
141 .virtual = IO_ADDRESS(VERSATILE_IB2_BASE), 149 .virtual = IO_ADDRESS(VERSATILE_IB2_BASE),
142 .pfn = __phys_to_pfn(VERSATILE_IB2_BASE), 150 .pfn = __phys_to_pfn(VERSATILE_IB2_BASE),
143 .length = SZ_64M, 151 .length = SZ_64M,
@@ -169,6 +177,24 @@ static struct map_desc versatile_io_desc[] __initdata = {
169 .length = VERSATILE_PCI_CFG_BASE_SIZE, 177 .length = VERSATILE_PCI_CFG_BASE_SIZE,
170 .type = MT_DEVICE 178 .type = MT_DEVICE
171 }, 179 },
180#if 0
181 {
182 .virtual = VERSATILE_PCI_VIRT_MEM_BASE0,
183 .pfn = __phys_to_pfn(VERSATILE_PCI_MEM_BASE0),
184 .length = SZ_16M,
185 .type = MT_DEVICE
186 }, {
187 .virtual = VERSATILE_PCI_VIRT_MEM_BASE1,
188 .pfn = __phys_to_pfn(VERSATILE_PCI_MEM_BASE1),
189 .length = SZ_16M,
190 .type = MT_DEVICE
191 }, {
192 .virtual = VERSATILE_PCI_VIRT_MEM_BASE2,
193 .pfn = __phys_to_pfn(VERSATILE_PCI_MEM_BASE2),
194 .length = SZ_16M,
195 .type = MT_DEVICE
196 },
197#endif
172#endif 198#endif
173}; 199};
174 200
@@ -562,58 +588,58 @@ static struct pl022_ssp_controller ssp0_plat_data = {
562 .num_chipselect = 1, 588 .num_chipselect = 1,
563}; 589};
564 590
565#define AACI_IRQ { IRQ_AACI } 591#define AACI_IRQ { IRQ_AACI, NO_IRQ }
566#define MMCI0_IRQ { IRQ_MMCI0A,IRQ_SIC_MMCI0B } 592#define MMCI0_IRQ { IRQ_MMCI0A,IRQ_SIC_MMCI0B }
567#define KMI0_IRQ { IRQ_SIC_KMI0 } 593#define KMI0_IRQ { IRQ_SIC_KMI0, NO_IRQ }
568#define KMI1_IRQ { IRQ_SIC_KMI1 } 594#define KMI1_IRQ { IRQ_SIC_KMI1, NO_IRQ }
569 595
570/* 596/*
571 * These devices are connected directly to the multi-layer AHB switch 597 * These devices are connected directly to the multi-layer AHB switch
572 */ 598 */
573#define SMC_IRQ { } 599#define SMC_IRQ { NO_IRQ, NO_IRQ }
574#define MPMC_IRQ { } 600#define MPMC_IRQ { NO_IRQ, NO_IRQ }
575#define CLCD_IRQ { IRQ_CLCDINT } 601#define CLCD_IRQ { IRQ_CLCDINT, NO_IRQ }
576#define DMAC_IRQ { IRQ_DMAINT } 602#define DMAC_IRQ { IRQ_DMAINT, NO_IRQ }
577 603
578/* 604/*
579 * These devices are connected via the core APB bridge 605 * These devices are connected via the core APB bridge
580 */ 606 */
581#define SCTL_IRQ { } 607#define SCTL_IRQ { NO_IRQ, NO_IRQ }
582#define WATCHDOG_IRQ { IRQ_WDOGINT } 608#define WATCHDOG_IRQ { IRQ_WDOGINT, NO_IRQ }
583#define GPIO0_IRQ { IRQ_GPIOINT0 } 609#define GPIO0_IRQ { IRQ_GPIOINT0, NO_IRQ }
584#define GPIO1_IRQ { IRQ_GPIOINT1 } 610#define GPIO1_IRQ { IRQ_GPIOINT1, NO_IRQ }
585#define RTC_IRQ { IRQ_RTCINT } 611#define RTC_IRQ { IRQ_RTCINT, NO_IRQ }
586 612
587/* 613/*
588 * These devices are connected via the DMA APB bridge 614 * These devices are connected via the DMA APB bridge
589 */ 615 */
590#define SCI_IRQ { IRQ_SCIINT } 616#define SCI_IRQ { IRQ_SCIINT, NO_IRQ }
591#define UART0_IRQ { IRQ_UARTINT0 } 617#define UART0_IRQ { IRQ_UARTINT0, NO_IRQ }
592#define UART1_IRQ { IRQ_UARTINT1 } 618#define UART1_IRQ { IRQ_UARTINT1, NO_IRQ }
593#define UART2_IRQ { IRQ_UARTINT2 } 619#define UART2_IRQ { IRQ_UARTINT2, NO_IRQ }
594#define SSP_IRQ { IRQ_SSPINT } 620#define SSP_IRQ { IRQ_SSPINT, NO_IRQ }
595 621
596/* FPGA Primecells */ 622/* FPGA Primecells */
597APB_DEVICE(aaci, "fpga:04", AACI, NULL); 623AMBA_DEVICE(aaci, "fpga:04", AACI, NULL);
598APB_DEVICE(mmc0, "fpga:05", MMCI0, &mmc0_plat_data); 624AMBA_DEVICE(mmc0, "fpga:05", MMCI0, &mmc0_plat_data);
599APB_DEVICE(kmi0, "fpga:06", KMI0, NULL); 625AMBA_DEVICE(kmi0, "fpga:06", KMI0, NULL);
600APB_DEVICE(kmi1, "fpga:07", KMI1, NULL); 626AMBA_DEVICE(kmi1, "fpga:07", KMI1, NULL);
601 627
602/* DevChip Primecells */ 628/* DevChip Primecells */
603AHB_DEVICE(smc, "dev:00", SMC, NULL); 629AMBA_DEVICE(smc, "dev:00", SMC, NULL);
604AHB_DEVICE(mpmc, "dev:10", MPMC, NULL); 630AMBA_DEVICE(mpmc, "dev:10", MPMC, NULL);
605AHB_DEVICE(clcd, "dev:20", CLCD, &clcd_plat_data); 631AMBA_DEVICE(clcd, "dev:20", CLCD, &clcd_plat_data);
606AHB_DEVICE(dmac, "dev:30", DMAC, NULL); 632AMBA_DEVICE(dmac, "dev:30", DMAC, NULL);
607APB_DEVICE(sctl, "dev:e0", SCTL, NULL); 633AMBA_DEVICE(sctl, "dev:e0", SCTL, NULL);
608APB_DEVICE(wdog, "dev:e1", WATCHDOG, NULL); 634AMBA_DEVICE(wdog, "dev:e1", WATCHDOG, NULL);
609APB_DEVICE(gpio0, "dev:e4", GPIO0, &gpio0_plat_data); 635AMBA_DEVICE(gpio0, "dev:e4", GPIO0, &gpio0_plat_data);
610APB_DEVICE(gpio1, "dev:e5", GPIO1, &gpio1_plat_data); 636AMBA_DEVICE(gpio1, "dev:e5", GPIO1, &gpio1_plat_data);
611APB_DEVICE(rtc, "dev:e8", RTC, NULL); 637AMBA_DEVICE(rtc, "dev:e8", RTC, NULL);
612APB_DEVICE(sci0, "dev:f0", SCI, NULL); 638AMBA_DEVICE(sci0, "dev:f0", SCI, NULL);
613APB_DEVICE(uart0, "dev:f1", UART0, NULL); 639AMBA_DEVICE(uart0, "dev:f1", UART0, NULL);
614APB_DEVICE(uart1, "dev:f2", UART1, NULL); 640AMBA_DEVICE(uart1, "dev:f2", UART1, NULL);
615APB_DEVICE(uart2, "dev:f3", UART2, NULL); 641AMBA_DEVICE(uart2, "dev:f3", UART2, NULL);
616APB_DEVICE(ssp0, "dev:f4", SSP, &ssp0_plat_data); 642AMBA_DEVICE(ssp0, "dev:f4", SSP, &ssp0_plat_data);
617 643
618static struct amba_device *amba_devs[] __initdata = { 644static struct amba_device *amba_devs[] __initdata = {
619 &dmac_device, 645 &dmac_device,
@@ -644,18 +670,17 @@ static struct amba_device *amba_devs[] __initdata = {
644 * having a specific name. 670 * having a specific name.
645 */ 671 */
646struct of_dev_auxdata versatile_auxdata_lookup[] __initdata = { 672struct of_dev_auxdata versatile_auxdata_lookup[] __initdata = {
647 OF_DEV_AUXDATA("arm,primecell", VERSATILE_MMCI0_BASE, "fpga:05", &mmc0_plat_data), 673 OF_DEV_AUXDATA("arm,primecell", VERSATILE_MMCI0_BASE, "fpga:05", NULL),
648 OF_DEV_AUXDATA("arm,primecell", VERSATILE_KMI0_BASE, "fpga:06", NULL), 674 OF_DEV_AUXDATA("arm,primecell", VERSATILE_KMI0_BASE, "fpga:06", NULL),
649 OF_DEV_AUXDATA("arm,primecell", VERSATILE_KMI1_BASE, "fpga:07", NULL), 675 OF_DEV_AUXDATA("arm,primecell", VERSATILE_KMI1_BASE, "fpga:07", NULL),
650 OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART3_BASE, "fpga:09", NULL), 676 OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART3_BASE, "fpga:09", NULL),
651 /* FIXME: this is buggy, the platform data is needed for this MMC instance too */
652 OF_DEV_AUXDATA("arm,primecell", VERSATILE_MMCI1_BASE, "fpga:0b", NULL), 677 OF_DEV_AUXDATA("arm,primecell", VERSATILE_MMCI1_BASE, "fpga:0b", NULL),
653 678
654 OF_DEV_AUXDATA("arm,primecell", VERSATILE_CLCD_BASE, "dev:20", &clcd_plat_data), 679 OF_DEV_AUXDATA("arm,primecell", VERSATILE_CLCD_BASE, "dev:20", &clcd_plat_data),
655 OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART0_BASE, "dev:f1", NULL), 680 OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART0_BASE, "dev:f1", NULL),
656 OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART1_BASE, "dev:f2", NULL), 681 OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART1_BASE, "dev:f2", NULL),
657 OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART2_BASE, "dev:f3", NULL), 682 OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART2_BASE, "dev:f3", NULL),
658 OF_DEV_AUXDATA("arm,primecell", VERSATILE_SSP_BASE, "dev:f4", &ssp0_plat_data), 683 OF_DEV_AUXDATA("arm,primecell", VERSATILE_SSP_BASE, "dev:f4", NULL),
659 684
660#if 0 685#if 0
661 /* 686 /*
@@ -720,19 +745,6 @@ static void versatile_leds_event(led_event_t ledevt)
720} 745}
721#endif /* CONFIG_LEDS */ 746#endif /* CONFIG_LEDS */
722 747
723void versatile_restart(char mode, const char *cmd)
724{
725 void __iomem *sys = __io_address(VERSATILE_SYS_BASE);
726 u32 val;
727
728 val = __raw_readl(sys + VERSATILE_SYS_RESETCTL_OFFSET);
729 val |= 0x105;
730
731 __raw_writel(0xa05f, sys + VERSATILE_SYS_LOCK_OFFSET);
732 __raw_writel(val, sys + VERSATILE_SYS_RESETCTL_OFFSET);
733 __raw_writel(0, sys + VERSATILE_SYS_LOCK_OFFSET);
734}
735
736/* Early initializations */ 748/* Early initializations */
737void __init versatile_init_early(void) 749void __init versatile_init_early(void)
738{ 750{
@@ -757,6 +769,10 @@ void __init versatile_init(void)
757 struct amba_device *d = amba_devs[i]; 769 struct amba_device *d = amba_devs[i];
758 amba_device_register(d, &iomem_resource); 770 amba_device_register(d, &iomem_resource);
759 } 771 }
772
773#ifdef CONFIG_LEDS
774 leds_event = versatile_leds_event;
775#endif
760} 776}
761 777
762/* 778/*
diff --git a/arch/arm/mach-versatile/core.h b/arch/arm/mach-versatile/core.h
index 683e60776a8..e01422700eb 100644
--- a/arch/arm/mach-versatile/core.h
+++ b/arch/arm/mach-versatile/core.h
@@ -30,16 +30,25 @@ extern void __init versatile_init_early(void);
30extern void __init versatile_init_irq(void); 30extern void __init versatile_init_irq(void);
31extern void __init versatile_map_io(void); 31extern void __init versatile_map_io(void);
32extern struct sys_timer versatile_timer; 32extern struct sys_timer versatile_timer;
33extern void versatile_restart(char, const char *);
34extern unsigned int mmc_status(struct device *dev); 33extern unsigned int mmc_status(struct device *dev);
35#ifdef CONFIG_OF 34#ifdef CONFIG_OF
36extern struct of_dev_auxdata versatile_auxdata_lookup[]; 35extern struct of_dev_auxdata versatile_auxdata_lookup[];
37#endif 36#endif
38 37
39#define APB_DEVICE(name, busid, base, plat) \ 38#define AMBA_DEVICE(name,busid,base,plat) \
40static AMBA_APB_DEVICE(name, busid, 0, VERSATILE_##base##_BASE, base##_IRQ, plat) 39static struct amba_device name##_device = { \
41 40 .dev = { \
42#define AHB_DEVICE(name, busid, base, plat) \ 41 .coherent_dma_mask = ~0, \
43static AMBA_AHB_DEVICE(name, busid, 0, VERSATILE_##base##_BASE, base##_IRQ, plat) 42 .init_name = busid, \
43 .platform_data = plat, \
44 }, \
45 .res = { \
46 .start = VERSATILE_##base##_BASE, \
47 .end = (VERSATILE_##base##_BASE) + SZ_4K - 1,\
48 .flags = IORESOURCE_MEM, \
49 }, \
50 .dma_mask = ~0, \
51 .irq = base##_IRQ, \
52}
44 53
45#endif 54#endif
diff --git a/arch/arm/mach-versatile/include/mach/debug-macro.S b/arch/arm/mach-versatile/include/mach/debug-macro.S
index d0fbd7f1cb0..eb2cf7dc5c4 100644
--- a/arch/arm/mach-versatile/include/mach/debug-macro.S
+++ b/arch/arm/mach-versatile/include/mach/debug-macro.S
@@ -11,7 +11,7 @@
11 * 11 *
12*/ 12*/
13 13
14 .macro addruart, rp, rv, tmp 14 .macro addruart, rp, rv
15 mov \rp, #0x001F0000 15 mov \rp, #0x001F0000
16 orr \rp, \rp, #0x00001000 16 orr \rp, \rp, #0x00001000
17 orr \rv, \rp, #0xf1000000 @ virtual base 17 orr \rv, \rp, #0xf1000000 @ virtual base
diff --git a/arch/arm/mach-versatile/include/mach/hardware.h b/arch/arm/mach-versatile/include/mach/hardware.h
index 3e5d425e2a9..4d4973dd8fb 100644
--- a/arch/arm/mach-versatile/include/mach/hardware.h
+++ b/arch/arm/mach-versatile/include/mach/hardware.h
@@ -30,7 +30,7 @@
30#define VERSATILE_PCI_VIRT_BASE (void __iomem *)0xe8000000ul 30#define VERSATILE_PCI_VIRT_BASE (void __iomem *)0xe8000000ul
31#define VERSATILE_PCI_CFG_VIRT_BASE (void __iomem *)0xe9000000ul 31#define VERSATILE_PCI_CFG_VIRT_BASE (void __iomem *)0xe9000000ul
32 32
33/* macro to get at MMIO space when running virtually */ 33/* macro to get at IO space when running virtually */
34#define IO_ADDRESS(x) (((x) & 0x0fffffff) + (((x) >> 4) & 0x0f000000) + 0xf0000000) 34#define IO_ADDRESS(x) (((x) & 0x0fffffff) + (((x) >> 4) & 0x0f000000) + 0xf0000000)
35 35
36#define __io_address(n) ((void __iomem __force *)IO_ADDRESS(n)) 36#define __io_address(n) ((void __iomem __force *)IO_ADDRESS(n))
diff --git a/arch/arm/mach-versatile/include/mach/irqs.h b/arch/arm/mach-versatile/include/mach/irqs.h
index 0fd771ca617..bf44c61bd1f 100644
--- a/arch/arm/mach-versatile/include/mach/irqs.h
+++ b/arch/arm/mach-versatile/include/mach/irqs.h
@@ -25,7 +25,7 @@
25 * IRQ interrupts definitions are the same as the INT definitions 25 * IRQ interrupts definitions are the same as the INT definitions
26 * held within platform.h 26 * held within platform.h
27 */ 27 */
28#define IRQ_VIC_START 32 28#define IRQ_VIC_START 0
29#define IRQ_WDOGINT (IRQ_VIC_START + INT_WDOGINT) 29#define IRQ_WDOGINT (IRQ_VIC_START + INT_WDOGINT)
30#define IRQ_SOFTINT (IRQ_VIC_START + INT_SOFTINT) 30#define IRQ_SOFTINT (IRQ_VIC_START + INT_SOFTINT)
31#define IRQ_COMMRx (IRQ_VIC_START + INT_COMMRx) 31#define IRQ_COMMRx (IRQ_VIC_START + INT_COMMRx)
@@ -100,7 +100,7 @@
100/* 100/*
101 * Secondary interrupt controller 101 * Secondary interrupt controller
102 */ 102 */
103#define IRQ_SIC_START 64 103#define IRQ_SIC_START 32
104#define IRQ_SIC_MMCI0B (IRQ_SIC_START + SIC_INT_MMCI0B) 104#define IRQ_SIC_MMCI0B (IRQ_SIC_START + SIC_INT_MMCI0B)
105#define IRQ_SIC_MMCI1B (IRQ_SIC_START + SIC_INT_MMCI1B) 105#define IRQ_SIC_MMCI1B (IRQ_SIC_START + SIC_INT_MMCI1B)
106#define IRQ_SIC_KMI0 (IRQ_SIC_START + SIC_INT_KMI0) 106#define IRQ_SIC_KMI0 (IRQ_SIC_START + SIC_INT_KMI0)
@@ -120,7 +120,7 @@
120#define IRQ_SIC_PCI1 (IRQ_SIC_START + SIC_INT_PCI1) 120#define IRQ_SIC_PCI1 (IRQ_SIC_START + SIC_INT_PCI1)
121#define IRQ_SIC_PCI2 (IRQ_SIC_START + SIC_INT_PCI2) 121#define IRQ_SIC_PCI2 (IRQ_SIC_START + SIC_INT_PCI2)
122#define IRQ_SIC_PCI3 (IRQ_SIC_START + SIC_INT_PCI3) 122#define IRQ_SIC_PCI3 (IRQ_SIC_START + SIC_INT_PCI3)
123#define IRQ_SIC_END 95 123#define IRQ_SIC_END 63
124 124
125#define IRQ_GPIO0_START (IRQ_SIC_END + 1) 125#define IRQ_GPIO0_START (IRQ_SIC_END + 1)
126#define IRQ_GPIO0_END (IRQ_GPIO0_START + 31) 126#define IRQ_GPIO0_END (IRQ_GPIO0_START + 31)
diff --git a/arch/arm/mach-versatile/pci.c b/arch/arm/mach-versatile/pci.c
index 2f84f4094f1..c898deb3ada 100644
--- a/arch/arm/mach-versatile/pci.c
+++ b/arch/arm/mach-versatile/pci.c
@@ -24,6 +24,7 @@
24 24
25#include <mach/hardware.h> 25#include <mach/hardware.h>
26#include <asm/irq.h> 26#include <asm/irq.h>
27#include <asm/system.h>
27#include <asm/mach/pci.h> 28#include <asm/mach/pci.h>
28 29
29/* 30/*
@@ -173,7 +174,7 @@ static struct resource io_mem = {
173 .name = "PCI I/O space", 174 .name = "PCI I/O space",
174 .start = VERSATILE_PCI_MEM_BASE0, 175 .start = VERSATILE_PCI_MEM_BASE0,
175 .end = VERSATILE_PCI_MEM_BASE0+VERSATILE_PCI_MEM_BASE0_SIZE-1, 176 .end = VERSATILE_PCI_MEM_BASE0+VERSATILE_PCI_MEM_BASE0_SIZE-1,
176 .flags = IORESOURCE_MEM, 177 .flags = IORESOURCE_IO,
177}; 178};
178 179
179static struct resource non_mem = { 180static struct resource non_mem = {
@@ -190,7 +191,7 @@ static struct resource pre_mem = {
190 .flags = IORESOURCE_MEM | IORESOURCE_PREFETCH, 191 .flags = IORESOURCE_MEM | IORESOURCE_PREFETCH,
191}; 192};
192 193
193static int __init pci_versatile_setup_resources(struct pci_sys_data *sys) 194static int __init pci_versatile_setup_resources(struct resource **resource)
194{ 195{
195 int ret = 0; 196 int ret = 0;
196 197
@@ -214,11 +215,13 @@ static int __init pci_versatile_setup_resources(struct pci_sys_data *sys)
214 } 215 }
215 216
216 /* 217 /*
217 * the mem resource for this bus 218 * bus->resource[0] is the IO resource for this bus
218 * the prefetch mem resource for this bus 219 * bus->resource[1] is the mem resource for this bus
220 * bus->resource[2] is the prefetch mem resource for this bus
219 */ 221 */
220 pci_add_resource_offset(&sys->resources, &non_mem, sys->mem_offset); 222 resource[0] = &io_mem;
221 pci_add_resource_offset(&sys->resources, &pre_mem, sys->mem_offset); 223 resource[1] = &non_mem;
224 resource[2] = &pre_mem;
222 225
223 goto out; 226 goto out;
224 227
@@ -245,12 +248,9 @@ int __init pci_versatile_setup(int nr, struct pci_sys_data *sys)
245 goto out; 248 goto out;
246 } 249 }
247 250
248 ret = pci_ioremap_io(0, VERSATILE_PCI_MEM_BASE0);
249 if (ret)
250 goto out;
251
252 if (nr == 0) { 251 if (nr == 0) {
253 ret = pci_versatile_setup_resources(sys); 252 sys->mem_offset = 0;
253 ret = pci_versatile_setup_resources(sys->resource);
254 if (ret < 0) { 254 if (ret < 0) {
255 printk("pci_versatile_setup: resources... oops?\n"); 255 printk("pci_versatile_setup: resources... oops?\n");
256 goto out; 256 goto out;
@@ -304,8 +304,14 @@ int __init pci_versatile_setup(int nr, struct pci_sys_data *sys)
304} 304}
305 305
306 306
307struct pci_bus * __init pci_versatile_scan_bus(int nr, struct pci_sys_data *sys)
308{
309 return pci_scan_bus(sys->busnr, &pci_versatile_ops, sys);
310}
311
307void __init pci_versatile_preinit(void) 312void __init pci_versatile_preinit(void)
308{ 313{
314 pcibios_min_io = 0x44000000;
309 pcibios_min_mem = 0x50000000; 315 pcibios_min_mem = 0x50000000;
310 316
311 __raw_writel(VERSATILE_PCI_MEM_BASE0 >> 28, PCI_IMAP0); 317 __raw_writel(VERSATILE_PCI_MEM_BASE0 >> 28, PCI_IMAP0);
@@ -325,6 +331,7 @@ void __init pci_versatile_preinit(void)
325static int __init versatile_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 331static int __init versatile_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
326{ 332{
327 int irq; 333 int irq;
334 int devslot = PCI_SLOT(dev->devfn);
328 335
329 /* slot, pin, irq 336 /* slot, pin, irq
330 * 24 1 27 337 * 24 1 27
@@ -332,16 +339,19 @@ static int __init versatile_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
332 * 26 1 29 339 * 26 1 29
333 * 27 1 30 340 * 27 1 30
334 */ 341 */
335 irq = 27 + ((slot - 24 + pin - 1) & 3); 342 irq = 27 + ((slot + pin - 1) & 3);
343
344 printk("PCI map irq: slot %d, pin %d, devslot %d, irq: %d\n",slot,pin,devslot,irq);
336 345
337 return irq; 346 return irq;
338} 347}
339 348
340static struct hw_pci versatile_pci __initdata = { 349static struct hw_pci versatile_pci __initdata = {
350 .swizzle = NULL,
341 .map_irq = versatile_map_irq, 351 .map_irq = versatile_map_irq,
342 .nr_controllers = 1, 352 .nr_controllers = 1,
343 .ops = &pci_versatile_ops,
344 .setup = pci_versatile_setup, 353 .setup = pci_versatile_setup,
354 .scan = pci_versatile_scan_bus,
345 .preinit = pci_versatile_preinit, 355 .preinit = pci_versatile_preinit,
346}; 356};
347 357
diff --git a/arch/arm/mach-versatile/versatile_ab.c b/arch/arm/mach-versatile/versatile_ab.c
index 98f65493177..f8ae64b3eed 100644
--- a/arch/arm/mach-versatile/versatile_ab.c
+++ b/arch/arm/mach-versatile/versatile_ab.c
@@ -21,12 +21,12 @@
21 21
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/device.h> 23#include <linux/device.h>
24#include <linux/sysdev.h>
24#include <linux/amba/bus.h> 25#include <linux/amba/bus.h>
25#include <linux/io.h> 26#include <linux/io.h>
26 27
27#include <mach/hardware.h> 28#include <mach/hardware.h>
28#include <asm/irq.h> 29#include <asm/irq.h>
29#include <asm/hardware/vic.h>
30#include <asm/mach-types.h> 30#include <asm/mach-types.h>
31 31
32#include <asm/mach/arch.h> 32#include <asm/mach/arch.h>
@@ -35,12 +35,10 @@
35 35
36MACHINE_START(VERSATILE_AB, "ARM-Versatile AB") 36MACHINE_START(VERSATILE_AB, "ARM-Versatile AB")
37 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ 37 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
38 .atag_offset = 0x100, 38 .boot_params = 0x00000100,
39 .map_io = versatile_map_io, 39 .map_io = versatile_map_io,
40 .init_early = versatile_init_early, 40 .init_early = versatile_init_early,
41 .init_irq = versatile_init_irq, 41 .init_irq = versatile_init_irq,
42 .handle_irq = vic_handle_irq,
43 .timer = &versatile_timer, 42 .timer = &versatile_timer,
44 .init_machine = versatile_init, 43 .init_machine = versatile_init,
45 .restart = versatile_restart,
46MACHINE_END 44MACHINE_END
diff --git a/arch/arm/mach-versatile/versatile_dt.c b/arch/arm/mach-versatile/versatile_dt.c
index ae5ad3c8f3d..54e037c090f 100644
--- a/arch/arm/mach-versatile/versatile_dt.c
+++ b/arch/arm/mach-versatile/versatile_dt.c
@@ -24,7 +24,6 @@
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/of_irq.h> 25#include <linux/of_irq.h>
26#include <linux/of_platform.h> 26#include <linux/of_platform.h>
27#include <asm/hardware/vic.h>
28#include <asm/mach-types.h> 27#include <asm/mach-types.h>
29#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
30 29
@@ -46,9 +45,7 @@ DT_MACHINE_START(VERSATILE_PB, "ARM-Versatile (Device Tree Support)")
46 .map_io = versatile_map_io, 45 .map_io = versatile_map_io,
47 .init_early = versatile_init_early, 46 .init_early = versatile_init_early,
48 .init_irq = versatile_init_irq, 47 .init_irq = versatile_init_irq,
49 .handle_irq = vic_handle_irq,
50 .timer = &versatile_timer, 48 .timer = &versatile_timer,
51 .init_machine = versatile_dt_init, 49 .init_machine = versatile_dt_init,
52 .dt_compat = versatile_dt_match, 50 .dt_compat = versatile_dt_match,
53 .restart = versatile_restart,
54MACHINE_END 51MACHINE_END
diff --git a/arch/arm/mach-versatile/versatile_pb.c b/arch/arm/mach-versatile/versatile_pb.c
index 19738331bd3..37c23dfeefb 100644
--- a/arch/arm/mach-versatile/versatile_pb.c
+++ b/arch/arm/mach-versatile/versatile_pb.c
@@ -21,13 +21,13 @@
21 21
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/device.h> 23#include <linux/device.h>
24#include <linux/sysdev.h>
24#include <linux/amba/bus.h> 25#include <linux/amba/bus.h>
25#include <linux/amba/pl061.h> 26#include <linux/amba/pl061.h>
26#include <linux/amba/mmci.h> 27#include <linux/amba/mmci.h>
27#include <linux/io.h> 28#include <linux/io.h>
28 29
29#include <mach/hardware.h> 30#include <mach/hardware.h>
30#include <asm/hardware/vic.h>
31#include <asm/irq.h> 31#include <asm/irq.h>
32#include <asm/mach-types.h> 32#include <asm/mach-types.h>
33 33
@@ -58,28 +58,28 @@ static struct pl061_platform_data gpio3_plat_data = {
58 .irq_base = IRQ_GPIO3_START, 58 .irq_base = IRQ_GPIO3_START,
59}; 59};
60 60
61#define UART3_IRQ { IRQ_SIC_UART3 } 61#define UART3_IRQ { IRQ_SIC_UART3, NO_IRQ }
62#define SCI1_IRQ { IRQ_SIC_SCI3 } 62#define SCI1_IRQ { IRQ_SIC_SCI3, NO_IRQ }
63#define MMCI1_IRQ { IRQ_MMCI1A, IRQ_SIC_MMCI1B } 63#define MMCI1_IRQ { IRQ_MMCI1A, IRQ_SIC_MMCI1B }
64 64
65/* 65/*
66 * These devices are connected via the core APB bridge 66 * These devices are connected via the core APB bridge
67 */ 67 */
68#define GPIO2_IRQ { IRQ_GPIOINT2 } 68#define GPIO2_IRQ { IRQ_GPIOINT2, NO_IRQ }
69#define GPIO3_IRQ { IRQ_GPIOINT3 } 69#define GPIO3_IRQ { IRQ_GPIOINT3, NO_IRQ }
70 70
71/* 71/*
72 * These devices are connected via the DMA APB bridge 72 * These devices are connected via the DMA APB bridge
73 */ 73 */
74 74
75/* FPGA Primecells */ 75/* FPGA Primecells */
76APB_DEVICE(uart3, "fpga:09", UART3, NULL); 76AMBA_DEVICE(uart3, "fpga:09", UART3, NULL);
77APB_DEVICE(sci1, "fpga:0a", SCI1, NULL); 77AMBA_DEVICE(sci1, "fpga:0a", SCI1, NULL);
78APB_DEVICE(mmc1, "fpga:0b", MMCI1, &mmc1_plat_data); 78AMBA_DEVICE(mmc1, "fpga:0b", MMCI1, &mmc1_plat_data);
79 79
80/* DevChip Primecells */ 80/* DevChip Primecells */
81APB_DEVICE(gpio2, "dev:e6", GPIO2, &gpio2_plat_data); 81AMBA_DEVICE(gpio2, "dev:e6", GPIO2, &gpio2_plat_data);
82APB_DEVICE(gpio3, "dev:e7", GPIO3, &gpio3_plat_data); 82AMBA_DEVICE(gpio3, "dev:e7", GPIO3, &gpio3_plat_data);
83 83
84static struct amba_device *amba_devs[] __initdata = { 84static struct amba_device *amba_devs[] __initdata = {
85 &uart3_device, 85 &uart3_device,
@@ -103,12 +103,10 @@ static void __init versatile_pb_init(void)
103 103
104MACHINE_START(VERSATILE_PB, "ARM-Versatile PB") 104MACHINE_START(VERSATILE_PB, "ARM-Versatile PB")
105 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ 105 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
106 .atag_offset = 0x100, 106 .boot_params = 0x00000100,
107 .map_io = versatile_map_io, 107 .map_io = versatile_map_io,
108 .init_early = versatile_init_early, 108 .init_early = versatile_init_early,
109 .init_irq = versatile_init_irq, 109 .init_irq = versatile_init_irq,
110 .handle_irq = vic_handle_irq,
111 .timer = &versatile_timer, 110 .timer = &versatile_timer,
112 .init_machine = versatile_pb_init, 111 .init_machine = versatile_pb_init,
113 .restart = versatile_restart,
114MACHINE_END 112MACHINE_END