Add a gpio 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: Ben Dooks <[EMAIL PROTECTED]>

Index: linux-2.6.27-rc1-quilt1/drivers/spi/spi_s3c24xx.c
===================================================================
--- linux-2.6.27-rc1-quilt1.orig/drivers/spi/spi_s3c24xx.c      2008-08-04 
11:46:12.000000000 +0100
+++ linux-2.6.27-rc1-quilt1/drivers/spi/spi_s3c24xx.c   2008-08-04 
11:46:54.000000000 +0100
@@ -247,6 +247,9 @@ static void s3c24xx_spi_initialsetup(str
        writeb(0xff, hw->regs + S3C2410_SPPRE);
        writeb(SPPIN_DEFAULT, hw->regs + S3C2410_SPPIN);
        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)
@@ -412,6 +415,9 @@ static int s3c24xx_spi_suspend(struct pl
 {
        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);
        return 0;
 }
Index: linux-2.6.27-rc1-quilt1/arch/arm/mach-s3c2410/include/mach/spi.h
===================================================================
--- linux-2.6.27-rc1-quilt1.orig/arch/arm/mach-s3c2410/include/mach/spi.h       
2008-08-04 11:45:55.000000000 +0100
+++ linux-2.6.27-rc1-quilt1/arch/arm/mach-s3c2410/include/mach/spi.h    
2008-08-04 11:46:13.000000000 +0100
@@ -18,6 +18,7 @@ struct s3c2410_spi_info {
        unsigned int             num_cs;        /* total chipselects */
        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);
 };
 

-- 
Ben ([EMAIL PROTECTED], http://www.fluff.org/)

  'a smiley only costs 4 bytes'

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general

Reply via email to