Commit cf46b973 authored by Ben Dooks's avatar Ben Dooks Committed by Linus Torvalds

spi_s3c24xx: pin configuration updates

Add a pin configuration callback for the s3c24xx SPI driver, as there are
several options depending on the channel and the chip in use.

This is needed as the controller may not have been setup by the initial
bootloader and the fact that the SPI controller gets reset over
suspend/resume into slave mode but the GPIO function registers do not.
Signed-off-by: default avatarBen Dooks <ben-linux@fluff.org>
Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent f9b90e39
...@@ -18,6 +18,7 @@ struct s3c2410_spi_info { ...@@ -18,6 +18,7 @@ struct s3c2410_spi_info {
unsigned int num_cs; /* total chipselects */ unsigned int num_cs; /* total chipselects */
int bus_num; /* bus number to use. */ int bus_num; /* bus number to use. */
void (*gpio_setup)(struct s3c2410_spi_info *spi, int enable);
void (*set_cs)(struct s3c2410_spi_info *spi, int cs, int pol); void (*set_cs)(struct s3c2410_spi_info *spi, int cs, int pol);
}; };
......
...@@ -247,6 +247,9 @@ static void s3c24xx_spi_initialsetup(struct s3c24xx_spi *hw) ...@@ -247,6 +247,9 @@ static void s3c24xx_spi_initialsetup(struct s3c24xx_spi *hw)
writeb(0xff, hw->regs + S3C2410_SPPRE); writeb(0xff, hw->regs + S3C2410_SPPRE);
writeb(SPPIN_DEFAULT, hw->regs + S3C2410_SPPIN); writeb(SPPIN_DEFAULT, hw->regs + S3C2410_SPPIN);
writeb(SPCON_DEFAULT, hw->regs + S3C2410_SPCON); writeb(SPCON_DEFAULT, hw->regs + S3C2410_SPCON);
if (hw->pdata && hw->pdata->gpio_setup)
hw->pdata->gpio_setup(hw->pdata, 1);
} }
static int __init s3c24xx_spi_probe(struct platform_device *pdev) static int __init s3c24xx_spi_probe(struct platform_device *pdev)
...@@ -412,6 +415,9 @@ static int s3c24xx_spi_suspend(struct platform_device *pdev, pm_message_t msg) ...@@ -412,6 +415,9 @@ static int s3c24xx_spi_suspend(struct platform_device *pdev, pm_message_t msg)
{ {
struct s3c24xx_spi *hw = platform_get_drvdata(pdev); struct s3c24xx_spi *hw = platform_get_drvdata(pdev);
if (hw->pdata && hw->pdata->gpio_setup)
hw->pdata->gpio_setup(hw->pdata, 0);
clk_disable(hw->clk); clk_disable(hw->clk);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment