aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDeepak Saxena <dsaxena@plexity.net>2006-01-05 15:59:29 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2006-01-05 15:59:29 -0500
commit54e269ead6e672325866037b0617a72edd1396b9 (patch)
tree3076c2e0187657daed3054d511b62dc33a4c8f8b
parent2b9ac7c15c0c5c9d6057b9e297dabaebd208ffe8 (diff)
[ARM] 3226/1: IXP4xx runtime expansion bus window size configuration
Patch from Deepak Saxena The expansion bus on the IXP46x NPU can be configured for either 32MiB or 16MiB windows and changing the configuration causes the base address for each chip select for each region to change. Because of this, we cannot hardcode the physical base as we currently do. This patch checks the expansion bus configuration registers at runtime to determine the appropriate window size. Note that this requires that the bootloader already configured the device sizes appropriately, but I feel that is valid assumption to make as the bootloader must configure and access the flash window, the output display (LCD, LEDs, etc) window, and other expansion bus devices. Signed-off-by: Deepak Saxena <dsaxena@plexity.net> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/mach-ixp4xx/common.c16
-rw-r--r--arch/arm/mach-ixp4xx/coyote-setup.c10
-rw-r--r--arch/arm/mach-ixp4xx/gtwx5715-setup.c15
-rw-r--r--arch/arm/mach-ixp4xx/ixdp425-setup.c13
-rw-r--r--arch/arm/mach-ixp4xx/nas100d-setup.c6
-rw-r--r--include/asm-arm/arch-ixp4xx/coyote.h5
-rw-r--r--include/asm-arm/arch-ixp4xx/gtwx5715.h4
-rw-r--r--include/asm-arm/arch-ixp4xx/ixdp425.h3
-rw-r--r--include/asm-arm/arch-ixp4xx/nas100d.h3
-rw-r--r--include/asm-arm/arch-ixp4xx/nslu2.h3
-rw-r--r--include/asm-arm/arch-ixp4xx/platform.h21
11 files changed, 53 insertions, 46 deletions
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index 9f33cb21e7f3..6b393691d0e8 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -332,11 +332,27 @@ static struct platform_device *ixp46x_devices[] __initdata = {
332 &ixp46x_i2c_controller 332 &ixp46x_i2c_controller
333}; 333};
334 334
335unsigned long ixp4xx_exp_bus_size;
336
335void __init ixp4xx_sys_init(void) 337void __init ixp4xx_sys_init(void)
336{ 338{
339 ixp4xx_exp_bus_size = SZ_16M;
340
337 if (cpu_is_ixp46x()) { 341 if (cpu_is_ixp46x()) {
342 int region;
343
338 platform_add_devices(ixp46x_devices, 344 platform_add_devices(ixp46x_devices,
339 ARRAY_SIZE(ixp46x_devices)); 345 ARRAY_SIZE(ixp46x_devices));
346
347 for (region = 0; region < 7; region++) {
348 if((*(IXP4XX_EXP_REG(0x4 * region)) & 0x200)) {
349 ixp4xx_exp_bus_size = SZ_32M;
350 break;
351 }
352 }
340 } 353 }
354
355 printk("IXP4xx: Using %uMiB expansion bus window size\n",
356 ixp4xx_exp_bus_size >> 20);
341} 357}
342 358
diff --git a/arch/arm/mach-ixp4xx/coyote-setup.c b/arch/arm/mach-ixp4xx/coyote-setup.c
index 050c92768913..679594a73981 100644
--- a/arch/arm/mach-ixp4xx/coyote-setup.c
+++ b/arch/arm/mach-ixp4xx/coyote-setup.c
@@ -14,6 +14,7 @@
14#include <linux/serial.h> 14#include <linux/serial.h>
15#include <linux/tty.h> 15#include <linux/tty.h>
16#include <linux/serial_8250.h> 16#include <linux/serial_8250.h>
17#include <linux/slab.h>
17 18
18#include <asm/types.h> 19#include <asm/types.h>
19#include <asm/setup.h> 20#include <asm/setup.h>
@@ -30,8 +31,6 @@ static struct flash_platform_data coyote_flash_data = {
30}; 31};
31 32
32static struct resource coyote_flash_resource = { 33static struct resource coyote_flash_resource = {
33 .start = COYOTE_FLASH_BASE,
34 .end = COYOTE_FLASH_BASE + COYOTE_FLASH_SIZE - 1,
35 .flags = IORESOURCE_MEM, 34 .flags = IORESOURCE_MEM,
36}; 35};
37 36
@@ -81,6 +80,11 @@ static struct platform_device *coyote_devices[] __initdata = {
81 80
82static void __init coyote_init(void) 81static void __init coyote_init(void)
83{ 82{
83 ixp4xx_sys_init();
84
85 coyote_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
86 coyote_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
87
84 *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE; 88 *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
85 *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; 89 *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
86 90
@@ -91,8 +95,6 @@ static void __init coyote_init(void)
91 coyote_uart_data[0].irq = IRQ_IXP4XX_UART1; 95 coyote_uart_data[0].irq = IRQ_IXP4XX_UART1;
92 } 96 }
93 97
94
95 ixp4xx_sys_init();
96 platform_add_devices(coyote_devices, ARRAY_SIZE(coyote_devices)); 98 platform_add_devices(coyote_devices, ARRAY_SIZE(coyote_devices));
97} 99}
98 100
diff --git a/arch/arm/mach-ixp4xx/gtwx5715-setup.c b/arch/arm/mach-ixp4xx/gtwx5715-setup.c
index 29a6d02fa851..038670489970 100644
--- a/arch/arm/mach-ixp4xx/gtwx5715-setup.c
+++ b/arch/arm/mach-ixp4xx/gtwx5715-setup.c
@@ -27,6 +27,7 @@
27#include <linux/serial.h> 27#include <linux/serial.h>
28#include <linux/tty.h> 28#include <linux/tty.h>
29#include <linux/serial_8250.h> 29#include <linux/serial_8250.h>
30#include <linux/slab.h>
30 31
31#include <asm/types.h> 32#include <asm/types.h>
32#include <asm/setup.h> 33#include <asm/setup.h>
@@ -106,11 +107,9 @@ static struct flash_platform_data gtwx5715_flash_data = {
106 .width = 2, 107 .width = 2,
107}; 108};
108 109
109static struct resource gtwx5715_flash_resource = { 110static struct gtw5715_flash_resource = {
110 .start = GTWX5715_FLASH_BASE,
111 .end = GTWX5715_FLASH_BASE + GTWX5715_FLASH_SIZE - 1,
112 .flags = IORESOURCE_MEM, 111 .flags = IORESOURCE_MEM,
113}; 112}
114 113
115static struct platform_device gtwx5715_flash = { 114static struct platform_device gtwx5715_flash = {
116 .name = "IXP4XX-Flash", 115 .name = "IXP4XX-Flash",
@@ -129,6 +128,14 @@ static struct platform_device *gtwx5715_devices[] __initdata = {
129 128
130static void __init gtwx5715_init(void) 129static void __init gtwx5715_init(void)
131{ 130{
131 ixp4xx_sys_init();
132
133 if (!flash_resource)
134 printk(KERN_ERR "Could not allocate flash resource\n");
135
136 gtwx5715_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
137 gtwx5715_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_8M - 1;
138
132 platform_add_devices(gtwx5715_devices, ARRAY_SIZE(gtwx5715_devices)); 139 platform_add_devices(gtwx5715_devices, ARRAY_SIZE(gtwx5715_devices));
133} 140}
134 141
diff --git a/arch/arm/mach-ixp4xx/ixdp425-setup.c b/arch/arm/mach-ixp4xx/ixdp425-setup.c
index 3a22d84e1047..c2e105c89c95 100644
--- a/arch/arm/mach-ixp4xx/ixdp425-setup.c
+++ b/arch/arm/mach-ixp4xx/ixdp425-setup.c
@@ -14,6 +14,7 @@
14#include <linux/serial.h> 14#include <linux/serial.h>
15#include <linux/tty.h> 15#include <linux/tty.h>
16#include <linux/serial_8250.h> 16#include <linux/serial_8250.h>
17#include <linux/slab.h>
17 18
18#include <asm/types.h> 19#include <asm/types.h>
19#include <asm/setup.h> 20#include <asm/setup.h>
@@ -30,8 +31,6 @@ static struct flash_platform_data ixdp425_flash_data = {
30}; 31};
31 32
32static struct resource ixdp425_flash_resource = { 33static struct resource ixdp425_flash_resource = {
33 .start = IXDP425_FLASH_BASE,
34 .end = IXDP425_FLASH_BASE + IXDP425_FLASH_SIZE - 1,
35 .flags = IORESOURCE_MEM, 34 .flags = IORESOURCE_MEM,
36}; 35};
37 36
@@ -108,17 +107,13 @@ static struct platform_device *ixdp425_devices[] __initdata = {
108 &ixdp425_uart 107 &ixdp425_uart
109}; 108};
110 109
111
112static void __init ixdp425_init(void) 110static void __init ixdp425_init(void)
113{ 111{
114 ixp4xx_sys_init(); 112 ixp4xx_sys_init();
115 113
116 /* 114 ixdp425_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
117 * IXP465 has 32MB window 115 ixdp425_flash_resource.end =
118 */ 116 IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
119 if (machine_is_ixdp465()) {
120 ixdp425_flash_resource.end += IXDP425_FLASH_SIZE;
121 }
122 117
123 platform_add_devices(ixdp425_devices, ARRAY_SIZE(ixdp425_devices)); 118 platform_add_devices(ixdp425_devices, ARRAY_SIZE(ixdp425_devices));
124} 119}
diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c
index bde9648e7afc..49998a8bd4e8 100644
--- a/arch/arm/mach-ixp4xx/nas100d-setup.c
+++ b/arch/arm/mach-ixp4xx/nas100d-setup.c
@@ -26,8 +26,6 @@ static struct flash_platform_data nas100d_flash_data = {
26}; 26};
27 27
28static struct resource nas100d_flash_resource = { 28static struct resource nas100d_flash_resource = {
29 .start = NAS100D_FLASH_BASE,
30 .end = NAS100D_FLASH_BASE + NAS100D_FLASH_SIZE,
31 .flags = IORESOURCE_MEM, 29 .flags = IORESOURCE_MEM,
32}; 30};
33 31
@@ -115,6 +113,10 @@ static void __init nas100d_init(void)
115{ 113{
116 ixp4xx_sys_init(); 114 ixp4xx_sys_init();
117 115
116 nas100d_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
117 nas100d_flash_resource.end =
118 IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
119
118 pm_power_off = nas100d_power_off; 120 pm_power_off = nas100d_power_off;
119 121
120 platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices)); 122 platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices));
diff --git a/include/asm-arm/arch-ixp4xx/coyote.h b/include/asm-arm/arch-ixp4xx/coyote.h
index dd0c2d2d8503..7ac9ba2c035c 100644
--- a/include/asm-arm/arch-ixp4xx/coyote.h
+++ b/include/asm-arm/arch-ixp4xx/coyote.h
@@ -16,9 +16,6 @@
16#error "Do not include this directly, instead #include <asm/hardware.h>" 16#error "Do not include this directly, instead #include <asm/hardware.h>"
17#endif 17#endif
18 18
19#define COYOTE_FLASH_BASE IXP4XX_EXP_BUS_CS0_BASE_PHYS
20#define COYOTE_FLASH_SIZE IXP4XX_EXP_BUS_CSX_REGION_SIZE * 2
21
22/* PCI controller GPIO to IRQ pin mappings */ 19/* PCI controller GPIO to IRQ pin mappings */
23#define COYOTE_PCI_SLOT0_PIN 6 20#define COYOTE_PCI_SLOT0_PIN 6
24#define COYOTE_PCI_SLOT1_PIN 11 21#define COYOTE_PCI_SLOT1_PIN 11
@@ -26,7 +23,7 @@
26#define COYOTE_PCI_SLOT0_DEVID 14 23#define COYOTE_PCI_SLOT0_DEVID 14
27#define COYOTE_PCI_SLOT1_DEVID 15 24#define COYOTE_PCI_SLOT1_DEVID 15
28 25
29#define COYOTE_IDE_BASE_PHYS IXP4XX_EXP_BUS_CS3_BASE_PHYS 26#define COYOTE_IDE_BASE_PHYS IXP4XX_EXP_BUS_BASE(3)
30#define COYOTE_IDE_BASE_VIRT 0xFFFE1000 27#define COYOTE_IDE_BASE_VIRT 0xFFFE1000
31#define COYOTE_IDE_REGION_SIZE 0x1000 28#define COYOTE_IDE_REGION_SIZE 0x1000
32 29
diff --git a/include/asm-arm/arch-ixp4xx/gtwx5715.h b/include/asm-arm/arch-ixp4xx/gtwx5715.h
index fc460af70627..c3069d67c00e 100644
--- a/include/asm-arm/arch-ixp4xx/gtwx5715.h
+++ b/include/asm-arm/arch-ixp4xx/gtwx5715.h
@@ -57,10 +57,6 @@
57#define GTWX5715_GPIO13_IRQ IRQ_IXP4XX_SW_INT1 57#define GTWX5715_GPIO13_IRQ IRQ_IXP4XX_SW_INT1
58#define GTWX5715_GPIO14_IRQ IRQ_IXP4XX_SW_INT2 58#define GTWX5715_GPIO14_IRQ IRQ_IXP4XX_SW_INT2
59 59
60
61#define GTWX5715_FLASH_BASE IXP4XX_EXP_BUS_CS0_BASE_PHYS
62#define GTWX5715_FLASH_SIZE (0x00800000)
63
64/* PCI controller GPIO to IRQ pin mappings 60/* PCI controller GPIO to IRQ pin mappings
65 61
66 INTA INTB 62 INTA INTB
diff --git a/include/asm-arm/arch-ixp4xx/ixdp425.h b/include/asm-arm/arch-ixp4xx/ixdp425.h
index 7d21bf941379..3d3820d7ba09 100644
--- a/include/asm-arm/arch-ixp4xx/ixdp425.h
+++ b/include/asm-arm/arch-ixp4xx/ixdp425.h
@@ -16,9 +16,6 @@
16#error "Do not include this directly, instead #include <asm/hardware.h>" 16#error "Do not include this directly, instead #include <asm/hardware.h>"
17#endif 17#endif
18 18
19#define IXDP425_FLASH_BASE IXP4XX_EXP_BUS_CS0_BASE_PHYS
20#define IXDP425_FLASH_SIZE IXP4XX_EXP_BUS_CSX_REGION_SIZE
21
22#define IXDP425_SDA_PIN 7 19#define IXDP425_SDA_PIN 7
23#define IXDP425_SCL_PIN 6 20#define IXDP425_SCL_PIN 6
24 21
diff --git a/include/asm-arm/arch-ixp4xx/nas100d.h b/include/asm-arm/arch-ixp4xx/nas100d.h
index ce7a86a98fc2..51ac0180427c 100644
--- a/include/asm-arm/arch-ixp4xx/nas100d.h
+++ b/include/asm-arm/arch-ixp4xx/nas100d.h
@@ -19,9 +19,6 @@
19#error "Do not include this directly, instead #include <asm/hardware.h>" 19#error "Do not include this directly, instead #include <asm/hardware.h>"
20#endif 20#endif
21 21
22#define NAS100D_FLASH_BASE IXP4XX_EXP_BUS_CS0_BASE_PHYS
23#define NAS100D_FLASH_SIZE IXP4XX_EXP_BUS_CSX_REGION_SIZE
24
25#define NAS100D_SDA_PIN 6 22#define NAS100D_SDA_PIN 6
26#define NAS100D_SCL_PIN 5 23#define NAS100D_SCL_PIN 5
27 24
diff --git a/include/asm-arm/arch-ixp4xx/nslu2.h b/include/asm-arm/arch-ixp4xx/nslu2.h
index b8b347a559c7..4281838873ef 100644
--- a/include/asm-arm/arch-ixp4xx/nslu2.h
+++ b/include/asm-arm/arch-ixp4xx/nslu2.h
@@ -18,9 +18,6 @@
18#error "Do not include this directly, instead #include <asm/hardware.h>" 18#error "Do not include this directly, instead #include <asm/hardware.h>"
19#endif 19#endif
20 20
21#define NSLU2_FLASH_BASE IXP4XX_EXP_BUS_CS0_BASE_PHYS
22#define NSLU2_FLASH_SIZE IXP4XX_EXP_BUS_CSX_REGION_SIZE
23
24#define NSLU2_SDA_PIN 7 21#define NSLU2_SDA_PIN 7
25#define NSLU2_SCL_PIN 6 22#define NSLU2_SCL_PIN 6
26 23
diff --git a/include/asm-arm/arch-ixp4xx/platform.h b/include/asm-arm/arch-ixp4xx/platform.h
index 6b77ed26be79..daf9790645ca 100644
--- a/include/asm-arm/arch-ixp4xx/platform.h
+++ b/include/asm-arm/arch-ixp4xx/platform.h
@@ -26,16 +26,17 @@
26 */ 26 */
27#define IXP4XX_EXP_BUS_BASE_PHYS (0x50000000) 27#define IXP4XX_EXP_BUS_BASE_PHYS (0x50000000)
28 28
29#define IXP4XX_EXP_BUS_CSX_REGION_SIZE (0x01000000) 29/*
30 30 * The expansion bus on the IXP4xx can be configured for either 16 or
31#define IXP4XX_EXP_BUS_CS0_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x00000000) 31 * 32MB windows and the CS offset for each region changes based on the
32#define IXP4XX_EXP_BUS_CS1_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x01000000) 32 * current configuration. This means that we cannot simply hardcode
33#define IXP4XX_EXP_BUS_CS2_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x02000000) 33 * each offset. ixp4xx_sys_init() looks at the expansion bus configuration
34#define IXP4XX_EXP_BUS_CS3_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x03000000) 34 * as setup by the bootloader to determine our window size.
35#define IXP4XX_EXP_BUS_CS4_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x04000000) 35 */
36#define IXP4XX_EXP_BUS_CS5_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x05000000) 36extern unsigned long ixp4xx_exp_bus_size;
37#define IXP4XX_EXP_BUS_CS6_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x06000000) 37
38#define IXP4XX_EXP_BUS_CS7_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x07000000) 38#define IXP4XX_EXP_BUS_BASE(region)\
39 (IXP4XX_EXP_BUS_BASE_PHYS + ((region) * ixp4xx_exp_bus_size))
39 40
40#define IXP4XX_FLASH_WRITABLE (0x2) 41#define IXP4XX_FLASH_WRITABLE (0x2)
41#define IXP4XX_FLASH_DEFAULT (0xbcd23c40) 42#define IXP4XX_FLASH_DEFAULT (0xbcd23c40)