Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 212332
b: refs/heads/master
c: 5b47bcd
h: refs/heads/master
v: v3
  • Loading branch information
Mike Frysinger committed Oct 18, 2010
1 parent 7e218c2 commit 79f0eb0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 033f44bd0ebca1809e8274237a64263d909f01a7
refs/heads/master: 5b47bcd48b3bd53c86040321de0d348aadebed87
12 changes: 9 additions & 3 deletions trunk/drivers/spi/spi_bfin5xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -972,6 +972,7 @@ static int bfin_spi_setup(struct spi_device *spi)
struct bfin5xx_spi_chip *chip_info;
struct slave_data *chip = NULL;
struct master_data *drv_data = spi_master_get_devdata(spi->master);
u16 bfin_ctl_reg;
int ret = -EINVAL;

/* Only alloc (or use chip_info) on first setup */
Expand All @@ -989,6 +990,10 @@ static int bfin_spi_setup(struct spi_device *spi)
chip_info = spi->controller_data;
}

/* Let people set non-standard bits directly */
bfin_ctl_reg = BIT_CTL_OPENDRAIN | BIT_CTL_EMISO |
BIT_CTL_PSSE | BIT_CTL_GM | BIT_CTL_SZ;

/* chip_info isn't always needed */
if (chip_info) {
/* Make sure people stop trying to set fields via ctl_reg
Expand All @@ -997,20 +1002,21 @@ static int bfin_spi_setup(struct spi_device *spi)
* Not sure if a user actually needs/uses any of these,
* but let's assume (for now) they do.
*/
if (chip_info->ctl_reg & ~(BIT_CTL_OPENDRAIN | BIT_CTL_EMISO | \
BIT_CTL_PSSE | BIT_CTL_GM | BIT_CTL_SZ)) {
if (chip_info->ctl_reg & ~bfin_ctl_reg) {
dev_err(&spi->dev, "do not set bits in ctl_reg "
"that the SPI framework manages\n");
goto error;
}

chip->enable_dma = chip_info->enable_dma != 0
&& drv_data->master_info->enable_dma;
chip->ctl_reg = chip_info->ctl_reg;
chip->cs_chg_udelay = chip_info->cs_chg_udelay;
chip->idle_tx_val = chip_info->idle_tx_val;
chip->pio_interrupt = chip_info->pio_interrupt;
spi->bits_per_word = chip_info->bits_per_word;
} else {
/* force a default base state */
chip->ctl_reg &= bfin_ctl_reg;
}

if (spi->bits_per_word != 8 && spi->bits_per_word != 16) {
Expand Down

0 comments on commit 79f0eb0

Please sign in to comment.