From 6be62ba215059258b68072d4553f765f9b34f3d1 Mon Sep 17 00:00:00 2001 From: Catalin Marinas Date: Thu, 12 Feb 2009 15:59:21 +0100 Subject: [PATCH] [ARM] 5396/1: RealView: Use PATA_PLATFORM to access the CompactFlash This driver adds the platform_device definitions to allow the use of CompactFlash on the RealView PB11MPCore and PB-A8 platforms. Note that the CompactFlash controller is expected to be initialised by the Boot Monitor and support the True IDE mode. Signed-off-by: Catalin Marinas Signed-off-by: Russell King --- arch/arm/mach-realview/Kconfig | 2 ++ arch/arm/mach-realview/core.c | 28 +++++++++++++++++++ arch/arm/mach-realview/core.h | 1 + .../mach-realview/include/mach/board-pba8.h | 2 -- .../arm/mach-realview/include/mach/platform.h | 6 ++++ arch/arm/mach-realview/realview_pb11mp.c | 27 +----------------- arch/arm/mach-realview/realview_pba8.c | 27 +----------------- 7 files changed, 39 insertions(+), 54 deletions(-) diff --git a/arch/arm/mach-realview/Kconfig b/arch/arm/mach-realview/Kconfig index ad911854eb4c..b6ec10627776 100644 --- a/arch/arm/mach-realview/Kconfig +++ b/arch/arm/mach-realview/Kconfig @@ -35,6 +35,7 @@ config MACH_REALVIEW_PB11MP bool "Support RealView/PB11MPCore platform" select CPU_V6 select ARM_GIC + select HAVE_PATA_PLATFORM help Include support for the ARM(R) RealView MPCore Platform Baseboard. PB11MPCore is a platform with an on-board ARM11MPCore and has @@ -51,6 +52,7 @@ config MACH_REALVIEW_PBA8 bool "Support RealView/PB-A8 platform" select CPU_V7 select ARM_GIC + select HAVE_PATA_PLATFORM help Include support for the ARM(R) RealView Cortex-A8 Platform Baseboard. PB-A8 is a platform with an on-board Cortex-A8 and has support for diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c index 27b48be73676..51972ecfc506 100644 --- a/arch/arm/mach-realview/core.c +++ b/arch/arm/mach-realview/core.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -150,6 +151,33 @@ int realview_eth_register(const char *name, struct resource *res) return platform_device_register(&realview_eth_device); } +static struct pata_platform_info pata_platform_data = { + .ioport_shift = 1, +}; + +static struct resource pata_resources[] = { + [0] = { + .start = REALVIEW_CF_BASE, + .end = REALVIEW_CF_BASE + 0xff, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = REALVIEW_CF_BASE + 0x100, + .end = REALVIEW_CF_BASE + SZ_4K - 1, + .flags = IORESOURCE_MEM, + }, +}; + +struct platform_device realview_cf_device = { + .name = "pata_platform", + .id = -1, + .num_resources = ARRAY_SIZE(pata_resources), + .resource = pata_resources, + .dev = { + .platform_data = &pata_platform_data, + }, +}; + static struct resource realview_i2c_resource = { .start = REALVIEW_I2C_BASE, .end = REALVIEW_I2C_BASE + SZ_4K - 1, diff --git a/arch/arm/mach-realview/core.h b/arch/arm/mach-realview/core.h index 44269b162d49..0ba1bfb1fe6b 100644 --- a/arch/arm/mach-realview/core.h +++ b/arch/arm/mach-realview/core.h @@ -45,6 +45,7 @@ static struct amba_device name##_device = { \ } extern struct platform_device realview_flash_device; +extern struct platform_device realview_cf_device; extern struct platform_device realview_i2c_device; extern struct mmc_platform_data realview_mmc0_plat_data; extern struct mmc_platform_data realview_mmc1_plat_data; diff --git a/arch/arm/mach-realview/include/mach/board-pba8.h b/arch/arm/mach-realview/include/mach/board-pba8.h index c8bed8f58bab..307f97b16e5b 100644 --- a/arch/arm/mach-realview/include/mach/board-pba8.h +++ b/arch/arm/mach-realview/include/mach/board-pba8.h @@ -45,8 +45,6 @@ #define REALVIEW_PBA8_DMC_BASE 0x100E0000 /* DMC configuration */ #define REALVIEW_PBA8_SMC_BASE 0x100E1000 /* SMC configuration */ #define REALVIEW_PBA8_CAN_BASE 0x100E2000 /* CAN bus */ -#define REALVIEW_PBA8_CF_BASE 0x18000000 /* Compact flash */ -#define REALVIEW_PBA8_CF_MEM_BASE 0x18003000 /* SMC for Compact flash */ #define REALVIEW_PBA8_GIC_CPU_BASE 0x1E000000 /* Generic interrupt controller CPU interface */ #define REALVIEW_PBA8_FLASH0_BASE 0x40000000 #define REALVIEW_PBA8_FLASH0_SIZE SZ_64M diff --git a/arch/arm/mach-realview/include/mach/platform.h b/arch/arm/mach-realview/include/mach/platform.h index 793a3a332712..c8f50835fed2 100644 --- a/arch/arm/mach-realview/include/mach/platform.h +++ b/arch/arm/mach-realview/include/mach/platform.h @@ -203,6 +203,12 @@ #define REALVIEW_SDRAM67_BASE 0x70000000 /* SDRAM banks 6 and 7 */ #define REALVIEW_LT_BASE 0x80000000 /* Logic Tile expansion */ +/* + * CompactFlash + */ +#define REALVIEW_CF_BASE 0x18000000 /* CompactFlash */ +#define REALVIEW_CF_MEM_BASE 0x18003000 /* SMC for CompactFlash */ + /* * Disk on Chip */ diff --git a/arch/arm/mach-realview/realview_pb11mp.c b/arch/arm/mach-realview/realview_pb11mp.c index 3ebdb2dadd6f..ff50ec2e4320 100644 --- a/arch/arm/mach-realview/realview_pb11mp.c +++ b/arch/arm/mach-realview/realview_pb11mp.c @@ -230,31 +230,6 @@ static struct resource realview_pb11mp_smsc911x_resources[] = { }, }; -struct resource realview_pb11mp_cf_resources[] = { - [0] = { - .start = REALVIEW_PB11MP_CF_BASE, - .end = REALVIEW_PB11MP_CF_BASE + SZ_4K - 1, - .flags = IORESOURCE_MEM, - }, - [1] = { - .start = REALVIEW_PB11MP_CF_MEM_BASE, - .end = REALVIEW_PB11MP_CF_MEM_BASE + SZ_4K - 1, - .flags = IORESOURCE_MEM, - }, - [2] = { - .start = -1, /* FIXME: Find correct irq */ - .end = -1, - .flags = IORESOURCE_IRQ, - }, -}; - -struct platform_device realview_pb11mp_cf_device = { - .name = "compactflash", - .id = 0, - .num_resources = ARRAY_SIZE(realview_pb11mp_cf_resources), - .resource = realview_pb11mp_cf_resources, -}; - static void __init gic_init_irq(void) { unsigned int pldctrl; @@ -308,7 +283,7 @@ static void __init realview_pb11mp_init(void) ARRAY_SIZE(realview_pb11mp_flash_resource)); realview_eth_register(NULL, realview_pb11mp_smsc911x_resources); platform_device_register(&realview_i2c_device); - platform_device_register(&realview_pb11mp_cf_device); + platform_device_register(&realview_cf_device); for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { struct amba_device *d = amba_devs[i]; diff --git a/arch/arm/mach-realview/realview_pba8.c b/arch/arm/mach-realview/realview_pba8.c index 34c94435d2d8..c6147cba2578 100644 --- a/arch/arm/mach-realview/realview_pba8.c +++ b/arch/arm/mach-realview/realview_pba8.c @@ -221,31 +221,6 @@ static struct resource realview_pba8_smsc911x_resources[] = { }, }; -struct resource realview_pba8_cf_resources[] = { - [0] = { - .start = REALVIEW_PBA8_CF_BASE, - .end = REALVIEW_PBA8_CF_BASE + SZ_4K - 1, - .flags = IORESOURCE_MEM, - }, - [1] = { - .start = REALVIEW_PBA8_CF_MEM_BASE, - .end = REALVIEW_PBA8_CF_MEM_BASE + SZ_4K - 1, - .flags = IORESOURCE_MEM, - }, - [2] = { - .start = -1, /* FIXME: Find correct irq */ - .end = -1, - .flags = IORESOURCE_IRQ, - }, -}; - -struct platform_device realview_pba8_cf_device = { - .name = "compactflash", - .id = 0, - .num_resources = ARRAY_SIZE(realview_pba8_cf_resources), - .resource = realview_pba8_cf_resources, -}; - static void __init gic_init_irq(void) { /* ARM PB-A8 on-board GIC */ @@ -276,7 +251,7 @@ static void __init realview_pba8_init(void) ARRAY_SIZE(realview_pba8_flash_resource)); realview_eth_register(NULL, realview_pba8_smsc911x_resources); platform_device_register(&realview_i2c_device); - platform_device_register(&realview_pba8_cf_device); + platform_device_register(&realview_cf_device); for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { struct amba_device *d = amba_devs[i];