Commit 54e269ea authored by Deepak Saxena's avatar Deepak Saxena Committed by Russell King
Browse files

[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: default avatarDeepak Saxena <dsaxena@plexity.net>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 2b9ac7c1
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -332,11 +332,27 @@ static struct platform_device *ixp46x_devices[] __initdata = {
	&ixp46x_i2c_controller
};

unsigned long ixp4xx_exp_bus_size;

void __init ixp4xx_sys_init(void)
{
	ixp4xx_exp_bus_size = SZ_16M;

	if (cpu_is_ixp46x()) {
		int region;

		platform_add_devices(ixp46x_devices,
				ARRAY_SIZE(ixp46x_devices));

		for (region = 0; region < 7; region++) {
			if((*(IXP4XX_EXP_REG(0x4 * region)) & 0x200)) {
				ixp4xx_exp_bus_size = SZ_32M;
				break;
			}
		}
	}

	printk("IXP4xx: Using %uMiB expansion bus window size\n",
			ixp4xx_exp_bus_size >> 20);
}
+6 −4
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@
#include <linux/serial.h>
#include <linux/tty.h>
#include <linux/serial_8250.h>
#include <linux/slab.h>

#include <asm/types.h>
#include <asm/setup.h>
@@ -30,8 +31,6 @@ static struct flash_platform_data coyote_flash_data = {
};

static struct resource coyote_flash_resource = {
	.start		= COYOTE_FLASH_BASE,
	.end		= COYOTE_FLASH_BASE + COYOTE_FLASH_SIZE - 1,
	.flags		= IORESOURCE_MEM,
};

@@ -81,6 +80,11 @@ static struct platform_device *coyote_devices[] __initdata = {

static void __init coyote_init(void)
{
	ixp4xx_sys_init();

	coyote_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
	coyote_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;

	*IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
	*IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;

@@ -91,8 +95,6 @@ static void __init coyote_init(void)
		coyote_uart_data[0].irq = IRQ_IXP4XX_UART1;
	}


	ixp4xx_sys_init();
	platform_add_devices(coyote_devices, ARRAY_SIZE(coyote_devices));
}

+11 −4
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@
#include <linux/serial.h>
#include <linux/tty.h>
#include <linux/serial_8250.h>
#include <linux/slab.h>

#include <asm/types.h>
#include <asm/setup.h>
@@ -106,11 +107,9 @@ static struct flash_platform_data gtwx5715_flash_data = {
	.width		= 2,
};

static struct resource gtwx5715_flash_resource = {
	.start		= GTWX5715_FLASH_BASE,
	.end		= GTWX5715_FLASH_BASE + GTWX5715_FLASH_SIZE - 1,
static struct gtw5715_flash_resource = {
	.flags		= IORESOURCE_MEM,
};
}

static struct platform_device gtwx5715_flash = {
	.name		= "IXP4XX-Flash",
@@ -129,6 +128,14 @@ static struct platform_device *gtwx5715_devices[] __initdata = {

static void __init gtwx5715_init(void)
{
	ixp4xx_sys_init();

	if (!flash_resource)
		printk(KERN_ERR "Could not allocate flash resource\n");

	gtwx5715_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
	gtwx5715_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_8M - 1;

	platform_add_devices(gtwx5715_devices, ARRAY_SIZE(gtwx5715_devices));
}

+4 −9
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@
#include <linux/serial.h>
#include <linux/tty.h>
#include <linux/serial_8250.h>
#include <linux/slab.h>

#include <asm/types.h>
#include <asm/setup.h>
@@ -30,8 +31,6 @@ static struct flash_platform_data ixdp425_flash_data = {
};

static struct resource ixdp425_flash_resource = {
	.start		= IXDP425_FLASH_BASE,
	.end		= IXDP425_FLASH_BASE + IXDP425_FLASH_SIZE - 1,
	.flags		= IORESOURCE_MEM,
};

@@ -108,17 +107,13 @@ static struct platform_device *ixdp425_devices[] __initdata = {
	&ixdp425_uart
};


static void __init ixdp425_init(void)
{
	ixp4xx_sys_init();

	/*
	 * IXP465 has 32MB window
	 */
	if (machine_is_ixdp465()) {
		ixdp425_flash_resource.end += IXDP425_FLASH_SIZE;
	}
	ixdp425_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
	ixdp425_flash_resource.end =
		IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;

	platform_add_devices(ixdp425_devices, ARRAY_SIZE(ixdp425_devices));
}
+4 −2
Original line number Diff line number Diff line
@@ -26,8 +26,6 @@ static struct flash_platform_data nas100d_flash_data = {
};

static struct resource nas100d_flash_resource = {
	.start			= NAS100D_FLASH_BASE,
	.end			= NAS100D_FLASH_BASE + NAS100D_FLASH_SIZE,
	.flags			= IORESOURCE_MEM,
};

@@ -115,6 +113,10 @@ static void __init nas100d_init(void)
{
	ixp4xx_sys_init();

	nas100d_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
	nas100d_flash_resource.end =
		IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;

	pm_power_off = nas100d_power_off;

	platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices));
Loading