Skip to content

Commit

Permalink
[ARM] 2962/1: scoop: Allow GPIO pin suspend state to be specified
Browse files Browse the repository at this point in the history
Patch from Richard Purdie

Allow the GPIO pin suspend states to be specified for SCOOP devices.
This is needed for correct operation on the spitz platform.

Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
  • Loading branch information
rpurdie authored and Russell King committed Oct 10, 2005
1 parent 1036260 commit 7c39898
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
20 changes: 18 additions & 2 deletions arch/arm/common/scoop.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ struct scoop_pcmcia_dev *scoop_devs;
struct scoop_dev {
void *base;
spinlock_t scoop_lock;
unsigned short suspend_clr;
unsigned short suspend_set;
u32 scoop_gpwr;
};

Expand Down Expand Up @@ -90,14 +92,24 @@ EXPORT_SYMBOL(reset_scoop);
EXPORT_SYMBOL(read_scoop_reg);
EXPORT_SYMBOL(write_scoop_reg);

static void check_scoop_reg(struct scoop_dev *sdev)
{
unsigned short mcr;

mcr = SCOOP_REG(sdev->base, SCOOP_MCR);
if ((mcr & 0x100) == 0)
SCOOP_REG(sdev->base, SCOOP_MCR) = 0x0101;
}

#ifdef CONFIG_PM
static int scoop_suspend(struct device *dev, pm_message_t state, uint32_t level)
{
if (level == SUSPEND_POWER_DOWN) {
struct scoop_dev *sdev = dev_get_drvdata(dev);

sdev->scoop_gpwr = SCOOP_REG(sdev->base,SCOOP_GPWR);
SCOOP_REG(sdev->base,SCOOP_GPWR) = 0;
check_scoop_reg(sdev);
sdev->scoop_gpwr = SCOOP_REG(sdev->base, SCOOP_GPWR);
SCOOP_REG(sdev->base, SCOOP_GPWR) = (sdev->scoop_gpwr & ~sdev->suspend_clr) | sdev->suspend_set;
}
return 0;
}
Expand All @@ -107,6 +119,7 @@ static int scoop_resume(struct device *dev, uint32_t level)
if (level == RESUME_POWER_ON) {
struct scoop_dev *sdev = dev_get_drvdata(dev);

check_scoop_reg(sdev);
SCOOP_REG(sdev->base,SCOOP_GPWR) = sdev->scoop_gpwr;
}
return 0;
Expand Down Expand Up @@ -151,6 +164,9 @@ int __init scoop_probe(struct device *dev)
SCOOP_REG(devptr->base, SCOOP_GPCR) = inf->io_dir & 0xffff;
SCOOP_REG(devptr->base, SCOOP_GPWR) = inf->io_out & 0xffff;

devptr->suspend_clr = inf->suspend_clr;
devptr->suspend_set = inf->suspend_set;

return 0;
}

Expand Down
2 changes: 2 additions & 0 deletions include/asm-arm/hardware/scoop.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
struct scoop_config {
unsigned short io_out;
unsigned short io_dir;
unsigned short suspend_clr;
unsigned short suspend_set;
};

/* Structure for linking scoop devices to PCMCIA sockets */
Expand Down

0 comments on commit 7c39898

Please sign in to comment.