Changeset 29708


Ignore:
Timestamp:
2012-01-11T10:14:15+01:00 (6 years ago)
Author:
juhosg
Message:

ar71xx: pb44_spi: introduce pb44_spi_{en,dis}able helpers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/ar71xx/files/drivers/spi/pb44_spi.c

    r23975 r29708  
    8787} 
    8888 
    89 static int pb44_spi_setup_cs(struct spi_device *spi) 
    90 { 
    91         struct ar71xx_spi *sp = spidev_to_sp(spi); 
    92  
     89static void pb44_spi_enable(struct ar71xx_spi *sp) 
     90{ 
    9391        /* enable GPIO mode */ 
    9492        pb44_spi_wr(sp, SPI_REG_FS, SPI_FS_GPIO); 
     
    9896        sp->ioc_base = pb44_spi_rr(sp, SPI_REG_IOC); 
    9997 
    100         /* TODO: setup speed? */ 
    10198        pb44_spi_wr(sp, SPI_REG_CTRL, 0x43); 
     99} 
     100 
     101static void pb44_spi_disable(struct ar71xx_spi *sp) 
     102{ 
     103        /* restore CTRL register */ 
     104        pb44_spi_wr(sp, SPI_REG_CTRL, sp->reg_ctrl); 
     105        /* disable GPIO mode */ 
     106        pb44_spi_wr(sp, SPI_REG_FS, 0); 
     107} 
     108 
     109static int pb44_spi_setup_cs(struct spi_device *spi) 
     110{ 
     111        struct ar71xx_spi *sp = spidev_to_sp(spi); 
     112 
     113        pb44_spi_enable(sp); 
    102114 
    103115        if (spi->chip_select) { 
     
    134146        } 
    135147 
    136         /* restore CTRL register */ 
    137         pb44_spi_wr(sp, SPI_REG_CTRL, sp->reg_ctrl); 
    138         /* disable GPIO mode */ 
    139         pb44_spi_wr(sp, SPI_REG_FS, 0); 
     148        pb44_spi_disable(sp); 
    140149} 
    141150 
Note: See TracChangeset for help on using the changeset viewer.