aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap1/board-osk.c
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2019-08-05 23:08:58 +0200
committerArnd Bergmann <arnd@arndb.de>2022-04-21 15:01:11 +0200
commitd87d44f7ab353dde25300ced494f98b69859a539 (patch)
treec6fd0712f7008072eba746fafefd311ae0f50de3 /arch/arm/mach-omap1/board-osk.c
parentARM: omap1: move perseus spi pinconf to board file (diff)
downloadlinux-dev-d87d44f7ab353dde25300ced494f98b69859a539.tar.xz
linux-dev-d87d44f7ab353dde25300ced494f98b69859a539.zip
ARM: omap1: move CF chipselect setup to board file
There is only one board that uses the omap_cf driver, so moving the chipselect configuration there does not lead to code duplication but avoids the use of mach/tc.h in drivers. Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/arm/mach-omap1/board-osk.c')
-rw-r--r--arch/arm/mach-omap1/board-osk.c38
1 files changed, 33 insertions, 5 deletions
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index b627a4351cf0..5dbc8f109aa7 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -153,14 +153,14 @@ static struct resource osk5912_cf_resources[] = {
[0] = {
.flags = IORESOURCE_IRQ,
},
+ [1] = {
+ .flags = IORESOURCE_MEM,
+ },
};
static struct platform_device osk5912_cf_device = {
.name = "omap_cf",
.id = -1,
- .dev = {
- .platform_data = (void *) 2 /* CS2 */,
- },
.num_resources = ARRAY_SIZE(osk5912_cf_resources),
.resource = osk5912_cf_resources,
};
@@ -275,13 +275,41 @@ static void __init osk_init_smc91x(void)
omap_writel(l, EMIFS_CCS(1));
}
-static void __init osk_init_cf(void)
+static void __init osk_init_cf(int seg)
{
+ struct resource *res = &osk5912_cf_resources[1];
+
omap_cfg_reg(M7_1610_GPIO62);
if ((gpio_request(62, "cf_irq")) < 0) {
printk("Error requesting gpio 62 for CF irq\n");
return;
}
+
+ switch (seg) {
+ /* NOTE: CS0 could be configured too ... */
+ case 1:
+ res->start = OMAP_CS1_PHYS;
+ break;
+ case 2:
+ res->start = OMAP_CS2_PHYS;
+ break;
+ case 3:
+ res->start = omap_cs3_phys();
+ break;
+ }
+
+ res->end = res->start + SZ_8K - 1;
+ osk5912_cf_device.dev.platform_data = (void *)(uintptr_t)seg;
+
+ /* NOTE: better EMIFS setup might support more cards; but the
+ * TRM only shows how to affect regular flash signals, not their
+ * CF/PCMCIA variants...
+ */
+ pr_debug("%s: cs%d, previous ccs %08x acs %08x\n", __func__,
+ seg, omap_readl(EMIFS_CCS(seg)), omap_readl(EMIFS_ACS(seg)));
+ omap_writel(0x0004a1b3, EMIFS_CCS(seg)); /* synch mode 4 etc */
+ omap_writel(0x00000000, EMIFS_ACS(seg)); /* OE hold/setup */
+
/* the CF I/O IRQ is really active-low */
irq_set_irq_type(gpio_to_irq(62), IRQ_TYPE_EDGE_FALLING);
}
@@ -580,7 +608,7 @@ static void __init osk_init(void)
u32 l;
osk_init_smc91x();
- osk_init_cf();
+ osk_init_cf(2); /* CS2 */
/* Workaround for wrong CS3 (NOR flash) timing
* There are some U-Boot versions out there which configure