spi: spi_bfin, don't bypass spi framework
[linux-2.6-block.git] / drivers / spi / spi_bfin5xx.c
index c2d51cf3c639ad6200890cdceb17aece9e5b045f..8e4ea8906dc78a860523c27c63e60ff87b3d4876 100644 (file)
@@ -998,6 +998,18 @@ static int setup(struct spi_device *spi)
 
        /* chip_info isn't always needed */
        if (chip_info) {
+               /* Make sure people stop trying to set fields via ctl_reg
+                * when they should actually be using common SPI framework.
+                * Currently we let through: WOM EMISO PSSE GM SZ TIMOD.
+                * Not sure if a user actually needs/uses any of these,
+                * but let's assume (for now) they do.
+                */
+               if (chip_info->ctl_reg & (SPE|MSTR|CPOL|CPHA|LSBF|SIZE)) {
+                       dev_err(&spi->dev, "do not set bits in ctl_reg "
+                               "that the SPI framework manages\n");
+                       return -EINVAL;
+               }
+
                chip->enable_dma = chip_info->enable_dma != 0
                    && drv_data->master_info->enable_dma;
                chip->ctl_reg = chip_info->ctl_reg;