diff options
-rw-r--r-- | drivers/spi/spi_bfin5xx.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index 830c7055f151..376f2f09e34c 100644 --- a/drivers/spi/spi_bfin5xx.c +++ b/drivers/spi/spi_bfin5xx.c | |||
@@ -972,6 +972,7 @@ static int bfin_spi_setup(struct spi_device *spi) | |||
972 | struct bfin5xx_spi_chip *chip_info; | 972 | struct bfin5xx_spi_chip *chip_info; |
973 | struct slave_data *chip = NULL; | 973 | struct slave_data *chip = NULL; |
974 | struct master_data *drv_data = spi_master_get_devdata(spi->master); | 974 | struct master_data *drv_data = spi_master_get_devdata(spi->master); |
975 | u16 bfin_ctl_reg; | ||
975 | int ret = -EINVAL; | 976 | int ret = -EINVAL; |
976 | 977 | ||
977 | /* Only alloc (or use chip_info) on first setup */ | 978 | /* Only alloc (or use chip_info) on first setup */ |
@@ -989,6 +990,10 @@ static int bfin_spi_setup(struct spi_device *spi) | |||
989 | chip_info = spi->controller_data; | 990 | chip_info = spi->controller_data; |
990 | } | 991 | } |
991 | 992 | ||
993 | /* Let people set non-standard bits directly */ | ||
994 | bfin_ctl_reg = BIT_CTL_OPENDRAIN | BIT_CTL_EMISO | | ||
995 | BIT_CTL_PSSE | BIT_CTL_GM | BIT_CTL_SZ; | ||
996 | |||
992 | /* chip_info isn't always needed */ | 997 | /* chip_info isn't always needed */ |
993 | if (chip_info) { | 998 | if (chip_info) { |
994 | /* Make sure people stop trying to set fields via ctl_reg | 999 | /* Make sure people stop trying to set fields via ctl_reg |
@@ -997,13 +1002,11 @@ static int bfin_spi_setup(struct spi_device *spi) | |||
997 | * Not sure if a user actually needs/uses any of these, | 1002 | * Not sure if a user actually needs/uses any of these, |
998 | * but let's assume (for now) they do. | 1003 | * but let's assume (for now) they do. |
999 | */ | 1004 | */ |
1000 | if (chip_info->ctl_reg & ~(BIT_CTL_OPENDRAIN | BIT_CTL_EMISO | \ | 1005 | if (chip_info->ctl_reg & ~bfin_ctl_reg) { |
1001 | BIT_CTL_PSSE | BIT_CTL_GM | BIT_CTL_SZ)) { | ||
1002 | dev_err(&spi->dev, "do not set bits in ctl_reg " | 1006 | dev_err(&spi->dev, "do not set bits in ctl_reg " |
1003 | "that the SPI framework manages\n"); | 1007 | "that the SPI framework manages\n"); |
1004 | goto error; | 1008 | goto error; |
1005 | } | 1009 | } |
1006 | |||
1007 | chip->enable_dma = chip_info->enable_dma != 0 | 1010 | chip->enable_dma = chip_info->enable_dma != 0 |
1008 | && drv_data->master_info->enable_dma; | 1011 | && drv_data->master_info->enable_dma; |
1009 | chip->ctl_reg = chip_info->ctl_reg; | 1012 | chip->ctl_reg = chip_info->ctl_reg; |
@@ -1011,6 +1014,9 @@ static int bfin_spi_setup(struct spi_device *spi) | |||
1011 | chip->idle_tx_val = chip_info->idle_tx_val; | 1014 | chip->idle_tx_val = chip_info->idle_tx_val; |
1012 | chip->pio_interrupt = chip_info->pio_interrupt; | 1015 | chip->pio_interrupt = chip_info->pio_interrupt; |
1013 | spi->bits_per_word = chip_info->bits_per_word; | 1016 | spi->bits_per_word = chip_info->bits_per_word; |
1017 | } else { | ||
1018 | /* force a default base state */ | ||
1019 | chip->ctl_reg &= bfin_ctl_reg; | ||
1014 | } | 1020 | } |
1015 | 1021 | ||
1016 | if (spi->bits_per_word != 8 && spi->bits_per_word != 16) { | 1022 | if (spi->bits_per_word != 8 && spi->bits_per_word != 16) { |