Skip to content

Commit

Permalink
ARM: sa1100/simpad: switch simpad CF to use gpiod APIs
Browse files Browse the repository at this point in the history
Switch simpad's CF implementation to use the gpiod APIs.  The inverted
detection is handled using gpiolib's native inversion abilities.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
  • Loading branch information
Russell King committed Apr 6, 2018
1 parent b51af86 commit 64b2f12
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
11 changes: 11 additions & 0 deletions arch/arm/mach-sa1100/simpad.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

#include <linux/module.h>
#include <linux/gpio/machine.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/tty.h>
Expand Down Expand Up @@ -364,6 +365,15 @@ static struct platform_device *devices[] __initdata = {
&simpad_i2c,
};

/* Compact Flash */
static struct gpiod_lookup_table simpad_cf_gpio_table = {
.dev_id = "sa11x0-pcmcia",
.table = {
GPIO_LOOKUP("gpio", GPIO_CF_IRQ, "cf-ready", GPIO_ACTIVE_HIGH),
GPIO_LOOKUP("gpio", GPIO_CF_CD, "cf-detect", GPIO_ACTIVE_HIGH),
{ },
},
};


static int __init simpad_init(void)
Expand All @@ -385,6 +395,7 @@ static int __init simpad_init(void)

pm_power_off = simpad_power_off;

sa11x0_register_pcmcia(-1, &simpad_cf_gpio_table);
sa11x0_ppc_configure_mcp();
sa11x0_register_mtd(&simpad_flash_data, simpad_flash_resources,
ARRAY_SIZE(simpad_flash_resources));
Expand Down
12 changes: 3 additions & 9 deletions drivers/pcmcia/sa1100_simpad.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

#include <mach/hardware.h>
#include <asm/mach-types.h>
#include <asm/irq.h>
#include <mach/simpad.h>
#include "sa1100_generic.h"

Expand All @@ -21,12 +20,10 @@ static int simpad_pcmcia_hw_init(struct soc_pcmcia_socket *skt)

simpad_clear_cs3_bit(VCC_3V_EN|VCC_5V_EN|EN0|EN1);

skt->stat[SOC_STAT_CD].gpio = GPIO_CF_CD;
skt->stat[SOC_STAT_CD].name = "CF_CD";
skt->stat[SOC_STAT_RDY].gpio = GPIO_CF_IRQ;
skt->stat[SOC_STAT_RDY].name = "CF_RDY";
skt->stat[SOC_STAT_CD].name = "cf-detect";
skt->stat[SOC_STAT_RDY].name = "cf-ready";

return 0;
return soc_pcmcia_request_gpiods(skt);
}

static void simpad_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
Expand All @@ -42,9 +39,6 @@ simpad_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
{
long cs3reg = simpad_get_cs3_ro();

/* the detect signal is inverted - fix that up here */
state->detect = !state->detect;

state->bvd1 = 1; /* Might be cs3reg & PCMCIA_BVD1 */
state->bvd2 = 1; /* Might be cs3reg & PCMCIA_BVD2 */

Expand Down

0 comments on commit 64b2f12

Please sign in to comment.