aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-bcm2835.c
diff options
context:
space:
mode:
authorStephen Warren <swarren@wwwdotorg.org>2013-03-26 22:37:58 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2013-04-01 09:14:33 -0400
commitf4b97eb5061256045e0f031b6a4bcf8c722b35ff (patch)
tree823ea30985327c098b07eaba70930461edb7fe50 /drivers/spi/spi-bcm2835.c
parent543bb255a1987836e64f5b7a63664ead8b32b042 (diff)
spi: bcm2835: make use of new bits_per_word_mask core feature
This driver only supports bits_per_word==8, so inform the SPI core of this. Remove all the open-coded validation that's no longer needed. Signed-off-by: Stephen Warren <swarren@wwwdotorg.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/spi/spi-bcm2835.c')
-rw-r--r--drivers/spi/spi-bcm2835.c36
1 files changed, 1 insertions, 35 deletions
diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c
index 346601e2461d..89c0b5033114 100644
--- a/drivers/spi/spi-bcm2835.c
+++ b/drivers/spi/spi-bcm2835.c
@@ -182,23 +182,6 @@ static irqreturn_t bcm2835_spi_interrupt(int irq, void *dev_id)
182 return IRQ_NONE; 182 return IRQ_NONE;
183} 183}
184 184
185static int bcm2835_spi_check_transfer(struct spi_device *spi,
186 struct spi_transfer *tfr)
187{
188 /* tfr==NULL when called from bcm2835_spi_setup() */
189 u32 bpw = tfr ? tfr->bits_per_word : spi->bits_per_word;
190
191 switch (bpw) {
192 case 8:
193 break;
194 default:
195 dev_err(&spi->dev, "unsupported bits_per_word=%d\n", bpw);
196 return -EINVAL;
197 }
198
199 return 0;
200}
201
202static int bcm2835_spi_start_transfer(struct spi_device *spi, 185static int bcm2835_spi_start_transfer(struct spi_device *spi,
203 struct spi_transfer *tfr) 186 struct spi_transfer *tfr)
204{ 187{
@@ -273,19 +256,6 @@ static int bcm2835_spi_finish_transfer(struct spi_device *spi,
273 return 0; 256 return 0;
274} 257}
275 258
276static int bcm2835_spi_setup(struct spi_device *spi)
277{
278 int ret;
279
280 ret = bcm2835_spi_check_transfer(spi, NULL);
281 if (ret) {
282 dev_err(&spi->dev, "setup: invalid message\n");
283 return ret;
284 }
285
286 return 0;
287}
288
289static int bcm2835_spi_transfer_one(struct spi_master *master, 259static int bcm2835_spi_transfer_one(struct spi_master *master,
290 struct spi_message *mesg) 260 struct spi_message *mesg)
291{ 261{
@@ -297,10 +267,6 @@ static int bcm2835_spi_transfer_one(struct spi_master *master,
297 bool cs_change; 267 bool cs_change;
298 268
299 list_for_each_entry(tfr, &mesg->transfers, transfer_list) { 269 list_for_each_entry(tfr, &mesg->transfers, transfer_list) {
300 err = bcm2835_spi_check_transfer(spi, tfr);
301 if (err)
302 goto out;
303
304 err = bcm2835_spi_start_transfer(spi, tfr); 270 err = bcm2835_spi_start_transfer(spi, tfr);
305 if (err) 271 if (err)
306 goto out; 272 goto out;
@@ -348,9 +314,9 @@ static int bcm2835_spi_probe(struct platform_device *pdev)
348 platform_set_drvdata(pdev, master); 314 platform_set_drvdata(pdev, master);
349 315
350 master->mode_bits = BCM2835_SPI_MODE_BITS; 316 master->mode_bits = BCM2835_SPI_MODE_BITS;
317 master->bits_per_word_mask = BIT(8 - 1);
351 master->bus_num = -1; 318 master->bus_num = -1;
352 master->num_chipselect = 3; 319 master->num_chipselect = 3;
353 master->setup = bcm2835_spi_setup;
354 master->transfer_one_message = bcm2835_spi_transfer_one; 320 master->transfer_one_message = bcm2835_spi_transfer_one;
355 master->dev.of_node = pdev->dev.of_node; 321 master->dev.of_node = pdev->dev.of_node;
356 322