From a48015c74e6f5b52b6243a5c9272467747de9e6b Mon Sep 17 00:00:00 2001 From: Dmitry Baryshkov Date: Wed, 25 Mar 2009 10:14:25 +0100 Subject: [PATCH] --- yaml --- r: 137449 b: refs/heads/master c: 224be092d116b663ac426c4615e34ee54bab4a14 h: refs/heads/master i: 137447: fd79403ab94e27a4d681bc0661c1916bf3878ece v: v3 --- [refs] | 2 +- trunk/arch/arm/mach-sa1100/collie.c | 27 +++++++++++++++---- .../arm/mach-sa1100/include/mach/collie.h | 7 ++--- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/[refs] b/[refs] index fb638b0a55aa..5ce5964c94b2 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: cf281a99b6e4f1223c8fdce390db3bf79e773f4c +refs/heads/master: 224be092d116b663ac426c4615e34ee54bab4a14 diff --git a/trunk/arch/arm/mach-sa1100/collie.c b/trunk/arch/arm/mach-sa1100/collie.c index 2052eb88c961..a911f44aa9fc 100644 --- a/trunk/arch/arm/mach-sa1100/collie.c +++ b/trunk/arch/arm/mach-sa1100/collie.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -195,18 +196,34 @@ static struct mtd_partition collie_partitions[] = { } }; +static int collie_flash_init(void) +{ + int rc; + rc = gpio_request(COLLIE_GPIO_VPEN, "flash Vpp enable"); + if (rc) + return rc; + + rc = gpio_direction_output(COLLIE_GPIO_VPEN, 1); + if (rc) + gpio_free(COLLIE_GPIO_VPEN); + + return rc; +} + static void collie_set_vpp(int vpp) { - write_scoop_reg(&colliescoop_device.dev, SCOOP_GPCR, read_scoop_reg(&colliescoop_device.dev, SCOOP_GPCR) | COLLIE_SCP_VPEN); - if (vpp) - write_scoop_reg(&colliescoop_device.dev, SCOOP_GPWR, read_scoop_reg(&colliescoop_device.dev, SCOOP_GPWR) | COLLIE_SCP_VPEN); - else - write_scoop_reg(&colliescoop_device.dev, SCOOP_GPWR, read_scoop_reg(&colliescoop_device.dev, SCOOP_GPWR) & ~COLLIE_SCP_VPEN); + gpio_set_value(COLLIE_GPIO_VPEN, vpp); } +static void collie_flash_exit(void) +{ + gpio_free(COLLIE_GPIO_VPEN); +} static struct flash_platform_data collie_flash_data = { .map_name = "cfi_probe", + .init = collie_flash_init, .set_vpp = collie_set_vpp, + .exit = collie_flash_exit, .parts = collie_partitions, .nr_parts = ARRAY_SIZE(collie_partitions), }; diff --git a/trunk/arch/arm/mach-sa1100/include/mach/collie.h b/trunk/arch/arm/mach-sa1100/include/mach/collie.h index 69e962416e3f..9bc53497d355 100644 --- a/trunk/arch/arm/mach-sa1100/include/mach/collie.h +++ b/trunk/arch/arm/mach-sa1100/include/mach/collie.h @@ -14,6 +14,7 @@ #define __ASM_ARCH_COLLIE_H +#define COLLIE_SCOOP_GPIO_BASE (GPIO_MAX + 1) #define COLLIE_SCP_CHARGE_ON SCOOP_GPCR_PA11 #define COLLIE_SCP_DIAG_BOOT1 SCOOP_GPCR_PA12 #define COLLIE_SCP_DIAG_BOOT2 SCOOP_GPCR_PA13 @@ -21,13 +22,13 @@ #define COLLIE_SCP_MUTE_R SCOOP_GPCR_PA15 #define COLLIE_SCP_5VON SCOOP_GPCR_PA16 #define COLLIE_SCP_AMP_ON SCOOP_GPCR_PA17 -#define COLLIE_SCP_VPEN SCOOP_GPCR_PA18 +#define COLLIE_GPIO_VPEN (COLLIE_SCOOP_GPIO_BASE + 7) #define COLLIE_SCP_LB_VOL_CHG SCOOP_GPCR_PA19 #define COLLIE_SCOOP_IO_DIR ( COLLIE_SCP_CHARGE_ON | COLLIE_SCP_MUTE_L | COLLIE_SCP_MUTE_R | \ - COLLIE_SCP_5VON | COLLIE_SCP_AMP_ON | COLLIE_SCP_VPEN | \ + COLLIE_SCP_5VON | COLLIE_SCP_AMP_ON | \ COLLIE_SCP_LB_VOL_CHG ) -#define COLLIE_SCOOP_IO_OUT ( COLLIE_SCP_MUTE_L | COLLIE_SCP_MUTE_R | COLLIE_SCP_VPEN | \ +#define COLLIE_SCOOP_IO_OUT ( COLLIE_SCP_MUTE_L | COLLIE_SCP_MUTE_R | \ COLLIE_SCP_CHARGE_ON ) /* GPIOs for which the generic definition doesn't say much */