blob: 90064494e82834256758d3c09bfff4451b795b9c [file] [log] [blame]
Chris Bootf8043872013-03-11 21:38:24 -06001/*
2 * Driver for Broadcom BCM2835 SPI Controllers
3 *
4 * Copyright (C) 2012 Chris Boot
5 * Copyright (C) 2013 Stephen Warren
Martin Sperle34ff012015-03-26 11:08:36 +01006 * Copyright (C) 2015 Martin Sperl
Chris Bootf8043872013-03-11 21:38:24 -06007 *
8 * This driver is inspired by:
9 * spi-ath79.c, Copyright (C) 2009-2011 Gabor Juhos <juhosg@openwrt.org>
10 * spi-atmel.c, Copyright (C) 2006 Atmel Corporation
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
Chris Bootf8043872013-03-11 21:38:24 -060021 */
22
23#include <linux/clk.h>
24#include <linux/completion.h>
25#include <linux/delay.h>
26#include <linux/err.h>
27#include <linux/interrupt.h>
28#include <linux/io.h>
29#include <linux/kernel.h>
30#include <linux/module.h>
31#include <linux/of.h>
32#include <linux/of_irq.h>
Martin Sperle34ff012015-03-26 11:08:36 +010033#include <linux/of_gpio.h>
Chris Bootf8043872013-03-11 21:38:24 -060034#include <linux/of_device.h>
35#include <linux/spi/spi.h>
36
37/* SPI register offsets */
38#define BCM2835_SPI_CS 0x00
39#define BCM2835_SPI_FIFO 0x04
40#define BCM2835_SPI_CLK 0x08
41#define BCM2835_SPI_DLEN 0x0c
42#define BCM2835_SPI_LTOH 0x10
43#define BCM2835_SPI_DC 0x14
44
45/* Bitfields in CS */
46#define BCM2835_SPI_CS_LEN_LONG 0x02000000
47#define BCM2835_SPI_CS_DMA_LEN 0x01000000
48#define BCM2835_SPI_CS_CSPOL2 0x00800000
49#define BCM2835_SPI_CS_CSPOL1 0x00400000
50#define BCM2835_SPI_CS_CSPOL0 0x00200000
51#define BCM2835_SPI_CS_RXF 0x00100000
52#define BCM2835_SPI_CS_RXR 0x00080000
53#define BCM2835_SPI_CS_TXD 0x00040000
54#define BCM2835_SPI_CS_RXD 0x00020000
55#define BCM2835_SPI_CS_DONE 0x00010000
56#define BCM2835_SPI_CS_LEN 0x00002000
57#define BCM2835_SPI_CS_REN 0x00001000
58#define BCM2835_SPI_CS_ADCS 0x00000800
59#define BCM2835_SPI_CS_INTR 0x00000400
60#define BCM2835_SPI_CS_INTD 0x00000200
61#define BCM2835_SPI_CS_DMAEN 0x00000100
62#define BCM2835_SPI_CS_TA 0x00000080
63#define BCM2835_SPI_CS_CSPOL 0x00000040
64#define BCM2835_SPI_CS_CLEAR_RX 0x00000020
65#define BCM2835_SPI_CS_CLEAR_TX 0x00000010
66#define BCM2835_SPI_CS_CPOL 0x00000008
67#define BCM2835_SPI_CS_CPHA 0x00000004
68#define BCM2835_SPI_CS_CS_10 0x00000002
69#define BCM2835_SPI_CS_CS_01 0x00000001
70
71#define BCM2835_SPI_TIMEOUT_MS 30000
Martin Sperl69352242015-03-19 09:01:53 +000072#define BCM2835_SPI_MODE_BITS (SPI_CPOL | SPI_CPHA | SPI_CS_HIGH \
73 | SPI_NO_CS | SPI_3WIRE)
Chris Bootf8043872013-03-11 21:38:24 -060074
75#define DRV_NAME "spi-bcm2835"
76
77struct bcm2835_spi {
78 void __iomem *regs;
79 struct clk *clk;
80 int irq;
Chris Bootf8043872013-03-11 21:38:24 -060081 const u8 *tx_buf;
82 u8 *rx_buf;
Martin Sperle34ff012015-03-26 11:08:36 +010083 int tx_len;
84 int rx_len;
Chris Bootf8043872013-03-11 21:38:24 -060085};
86
87static inline u32 bcm2835_rd(struct bcm2835_spi *bs, unsigned reg)
88{
89 return readl(bs->regs + reg);
90}
91
92static inline void bcm2835_wr(struct bcm2835_spi *bs, unsigned reg, u32 val)
93{
94 writel(val, bs->regs + reg);
95}
96
Martin Sperl4adf3122015-03-23 15:11:53 +010097static inline void bcm2835_rd_fifo(struct bcm2835_spi *bs)
Chris Bootf8043872013-03-11 21:38:24 -060098{
99 u8 byte;
100
Martin Sperle34ff012015-03-26 11:08:36 +0100101 while ((bs->rx_len) &&
102 (bcm2835_rd(bs, BCM2835_SPI_CS) & BCM2835_SPI_CS_RXD)) {
Chris Bootf8043872013-03-11 21:38:24 -0600103 byte = bcm2835_rd(bs, BCM2835_SPI_FIFO);
104 if (bs->rx_buf)
105 *bs->rx_buf++ = byte;
Martin Sperle34ff012015-03-26 11:08:36 +0100106 bs->rx_len--;
Chris Bootf8043872013-03-11 21:38:24 -0600107 }
108}
109
Martin Sperl4adf3122015-03-23 15:11:53 +0100110static inline void bcm2835_wr_fifo(struct bcm2835_spi *bs)
Chris Bootf8043872013-03-11 21:38:24 -0600111{
112 u8 byte;
113
Martin Sperle34ff012015-03-26 11:08:36 +0100114 while ((bs->tx_len) &&
Martin Sperl4adf3122015-03-23 15:11:53 +0100115 (bcm2835_rd(bs, BCM2835_SPI_CS) & BCM2835_SPI_CS_TXD)) {
Chris Bootf8043872013-03-11 21:38:24 -0600116 byte = bs->tx_buf ? *bs->tx_buf++ : 0;
117 bcm2835_wr(bs, BCM2835_SPI_FIFO, byte);
Martin Sperle34ff012015-03-26 11:08:36 +0100118 bs->tx_len--;
Chris Bootf8043872013-03-11 21:38:24 -0600119 }
120}
121
Martin Sperle34ff012015-03-26 11:08:36 +0100122static void bcm2835_spi_reset_hw(struct spi_master *master)
123{
124 struct bcm2835_spi *bs = spi_master_get_devdata(master);
125 u32 cs = bcm2835_rd(bs, BCM2835_SPI_CS);
126
127 /* Disable SPI interrupts and transfer */
128 cs &= ~(BCM2835_SPI_CS_INTR |
129 BCM2835_SPI_CS_INTD |
130 BCM2835_SPI_CS_TA);
131 /* and reset RX/TX FIFOS */
132 cs |= BCM2835_SPI_CS_CLEAR_RX | BCM2835_SPI_CS_CLEAR_TX;
133
134 /* and reset the SPI_HW */
135 bcm2835_wr(bs, BCM2835_SPI_CS, cs);
136}
137
Chris Bootf8043872013-03-11 21:38:24 -0600138static irqreturn_t bcm2835_spi_interrupt(int irq, void *dev_id)
139{
140 struct spi_master *master = dev_id;
141 struct bcm2835_spi *bs = spi_master_get_devdata(master);
Chris Bootf8043872013-03-11 21:38:24 -0600142
Martin Sperl4adf3122015-03-23 15:11:53 +0100143 /* Read as many bytes as possible from FIFO */
144 bcm2835_rd_fifo(bs);
Martin Sperle34ff012015-03-26 11:08:36 +0100145 /* Write as many bytes as possible to FIFO */
146 bcm2835_wr_fifo(bs);
Chris Bootf8043872013-03-11 21:38:24 -0600147
Martin Sperle34ff012015-03-26 11:08:36 +0100148 /* based on flags decide if we can finish the transfer */
149 if (bcm2835_rd(bs, BCM2835_SPI_CS) & BCM2835_SPI_CS_DONE) {
150 /* Transfer complete - reset SPI HW */
151 bcm2835_spi_reset_hw(master);
152 /* wake up the framework */
153 complete(&master->xfer_completion);
Chris Bootf8043872013-03-11 21:38:24 -0600154 }
155
Martin Sperl4adf3122015-03-23 15:11:53 +0100156 return IRQ_HANDLED;
Chris Bootf8043872013-03-11 21:38:24 -0600157}
158
Martin Sperle34ff012015-03-26 11:08:36 +0100159static int bcm2835_spi_transfer_one(struct spi_master *master,
160 struct spi_device *spi,
161 struct spi_transfer *tfr)
Chris Bootf8043872013-03-11 21:38:24 -0600162{
Martin Sperle34ff012015-03-26 11:08:36 +0100163 struct bcm2835_spi *bs = spi_master_get_devdata(master);
Chris Bootf8043872013-03-11 21:38:24 -0600164 unsigned long spi_hz, clk_hz, cdiv;
Martin Sperle34ff012015-03-26 11:08:36 +0100165 u32 cs = bcm2835_rd(bs, BCM2835_SPI_CS);
Chris Bootf8043872013-03-11 21:38:24 -0600166
Martin Sperle34ff012015-03-26 11:08:36 +0100167 /* set clock */
Chris Bootf8043872013-03-11 21:38:24 -0600168 spi_hz = tfr->speed_hz;
169 clk_hz = clk_get_rate(bs->clk);
170
171 if (spi_hz >= clk_hz / 2) {
172 cdiv = 2; /* clk_hz/2 is the fastest we can go */
173 } else if (spi_hz) {
Martin Sperl210b4922015-03-19 09:01:52 +0000174 /* CDIV must be a multiple of two */
175 cdiv = DIV_ROUND_UP(clk_hz, spi_hz);
176 cdiv += (cdiv % 2);
Chris Bootf8043872013-03-11 21:38:24 -0600177
178 if (cdiv >= 65536)
179 cdiv = 0; /* 0 is the slowest we can go */
Martin Sperl342f9482015-03-20 15:26:11 +0100180 } else {
Chris Bootf8043872013-03-11 21:38:24 -0600181 cdiv = 0; /* 0 is the slowest we can go */
Martin Sperl342f9482015-03-20 15:26:11 +0100182 }
Martin Sperle34ff012015-03-26 11:08:36 +0100183 bcm2835_wr(bs, BCM2835_SPI_CLK, cdiv);
Chris Bootf8043872013-03-11 21:38:24 -0600184
Martin Sperle34ff012015-03-26 11:08:36 +0100185 /* handle all the modes */
Martin Sperl69352242015-03-19 09:01:53 +0000186 if ((spi->mode & SPI_3WIRE) && (tfr->rx_buf))
187 cs |= BCM2835_SPI_CS_REN;
Chris Bootf8043872013-03-11 21:38:24 -0600188 if (spi->mode & SPI_CPOL)
189 cs |= BCM2835_SPI_CS_CPOL;
190 if (spi->mode & SPI_CPHA)
191 cs |= BCM2835_SPI_CS_CPHA;
192
Martin Sperle34ff012015-03-26 11:08:36 +0100193 /* for gpio_cs set dummy CS so that no HW-CS get changed
194 * we can not run this in bcm2835_spi_set_cs, as it does
195 * not get called for cs_gpio cases, so we need to do it here
196 */
197 if (gpio_is_valid(spi->cs_gpio) || (spi->mode & SPI_NO_CS))
198 cs |= BCM2835_SPI_CS_CS_10 | BCM2835_SPI_CS_CS_01;
Chris Bootf8043872013-03-11 21:38:24 -0600199
Martin Sperle34ff012015-03-26 11:08:36 +0100200 /* set transmit buffers and length */
Chris Bootf8043872013-03-11 21:38:24 -0600201 bs->tx_buf = tfr->tx_buf;
202 bs->rx_buf = tfr->rx_buf;
Martin Sperle34ff012015-03-26 11:08:36 +0100203 bs->tx_len = tfr->len;
204 bs->rx_len = tfr->len;
Chris Bootf8043872013-03-11 21:38:24 -0600205
Martin Sperle3a2be32015-03-29 16:03:25 +0200206 /* fill in fifo if we have gpio-cs
207 * note that there have been rare events where the native-CS
208 * flapped for <1us which may change the behaviour
209 * with gpio-cs this does not happen, so it is implemented
210 * only for this case
211 */
212 if (gpio_is_valid(spi->cs_gpio)) {
213 /* enable HW block, but without interrupts enabled
214 * this would triggern an immediate interrupt
215 */
216 bcm2835_wr(bs, BCM2835_SPI_CS,
217 cs | BCM2835_SPI_CS_TA);
218 /* fill in tx fifo as much as possible */
219 bcm2835_wr_fifo(bs);
220 }
221
Chris Bootf8043872013-03-11 21:38:24 -0600222 /*
223 * Enable the HW block. This will immediately trigger a DONE (TX
224 * empty) interrupt, upon which we will fill the TX FIFO with the
225 * first TX bytes. Pre-filling the TX FIFO here to avoid the
226 * interrupt doesn't work:-(
227 */
Martin Sperle34ff012015-03-26 11:08:36 +0100228 cs |= BCM2835_SPI_CS_INTR | BCM2835_SPI_CS_INTD | BCM2835_SPI_CS_TA;
Chris Bootf8043872013-03-11 21:38:24 -0600229 bcm2835_wr(bs, BCM2835_SPI_CS, cs);
230
Martin Sperle34ff012015-03-26 11:08:36 +0100231 /* signal that we need to wait for completion */
232 return 1;
Chris Bootf8043872013-03-11 21:38:24 -0600233}
234
Martin Sperle34ff012015-03-26 11:08:36 +0100235static void bcm2835_spi_handle_err(struct spi_master *master,
236 struct spi_message *msg)
Chris Bootf8043872013-03-11 21:38:24 -0600237{
Martin Sperle34ff012015-03-26 11:08:36 +0100238 bcm2835_spi_reset_hw(master);
Chris Bootf8043872013-03-11 21:38:24 -0600239}
240
Martin Sperle34ff012015-03-26 11:08:36 +0100241static void bcm2835_spi_set_cs(struct spi_device *spi, bool gpio_level)
Chris Bootf8043872013-03-11 21:38:24 -0600242{
Martin Sperle34ff012015-03-26 11:08:36 +0100243 /*
244 * we can assume that we are "native" as per spi_set_cs
245 * calling us ONLY when cs_gpio is not set
246 * we can also assume that we are CS < 3 as per bcm2835_spi_setup
247 * we would not get called because of error handling there.
248 * the level passed is the electrical level not enabled/disabled
249 * so it has to get translated back to enable/disable
250 * see spi_set_cs in spi.c for the implementation
251 */
252
253 struct spi_master *master = spi->master;
Chris Bootf8043872013-03-11 21:38:24 -0600254 struct bcm2835_spi *bs = spi_master_get_devdata(master);
Martin Sperle34ff012015-03-26 11:08:36 +0100255 u32 cs = bcm2835_rd(bs, BCM2835_SPI_CS);
256 bool enable;
Chris Bootf8043872013-03-11 21:38:24 -0600257
Martin Sperle34ff012015-03-26 11:08:36 +0100258 /* calculate the enable flag from the passed gpio_level */
259 enable = (spi->mode & SPI_CS_HIGH) ? gpio_level : !gpio_level;
Chris Bootf8043872013-03-11 21:38:24 -0600260
Martin Sperle34ff012015-03-26 11:08:36 +0100261 /* set flags for "reverse" polarity in the registers */
262 if (spi->mode & SPI_CS_HIGH) {
263 /* set the correct CS-bits */
264 cs |= BCM2835_SPI_CS_CSPOL;
265 cs |= BCM2835_SPI_CS_CSPOL0 << spi->chip_select;
266 } else {
267 /* clean the CS-bits */
268 cs &= ~BCM2835_SPI_CS_CSPOL;
269 cs &= ~(BCM2835_SPI_CS_CSPOL0 << spi->chip_select);
Chris Bootf8043872013-03-11 21:38:24 -0600270 }
271
Martin Sperle34ff012015-03-26 11:08:36 +0100272 /* select the correct chip_select depending on disabled/enabled */
273 if (enable) {
274 /* set cs correctly */
275 if (spi->mode & SPI_NO_CS) {
276 /* use the "undefined" chip-select */
277 cs |= BCM2835_SPI_CS_CS_10 | BCM2835_SPI_CS_CS_01;
278 } else {
279 /* set the chip select */
280 cs &= ~(BCM2835_SPI_CS_CS_10 | BCM2835_SPI_CS_CS_01);
281 cs |= spi->chip_select;
282 }
283 } else {
284 /* disable CSPOL which puts HW-CS into deselected state */
285 cs &= ~BCM2835_SPI_CS_CSPOL;
286 /* use the "undefined" chip-select as precaution */
287 cs |= BCM2835_SPI_CS_CS_10 | BCM2835_SPI_CS_CS_01;
288 }
Chris Bootf8043872013-03-11 21:38:24 -0600289
Martin Sperle34ff012015-03-26 11:08:36 +0100290 /* finally set the calculated flags in SPI_CS */
291 bcm2835_wr(bs, BCM2835_SPI_CS, cs);
292}
293
Martin Sperla30a5552015-04-06 17:16:31 +0000294static int chip_match_name(struct gpio_chip *chip, void *data)
295{
296 return !strcmp(chip->label, data);
297}
298
Martin Sperle34ff012015-03-26 11:08:36 +0100299static int bcm2835_spi_setup(struct spi_device *spi)
300{
Martin Sperla30a5552015-04-06 17:16:31 +0000301 int err;
302 struct gpio_chip *chip;
Martin Sperle34ff012015-03-26 11:08:36 +0100303 /*
304 * sanity checking the native-chipselects
305 */
306 if (spi->mode & SPI_NO_CS)
307 return 0;
308 if (gpio_is_valid(spi->cs_gpio))
309 return 0;
Martin Sperla30a5552015-04-06 17:16:31 +0000310 if (spi->chip_select > 1) {
311 /* error in the case of native CS requested with CS > 1
312 * officially there is a CS2, but it is not documented
313 * which GPIO is connected with that...
314 */
315 dev_err(&spi->dev,
316 "setup: only two native chip-selects are supported\n");
317 return -EINVAL;
318 }
319 /* now translate native cs to GPIO */
320
321 /* get the gpio chip for the base */
322 chip = gpiochip_find("pinctrl-bcm2835", chip_match_name);
323 if (!chip)
Martin Sperle34ff012015-03-26 11:08:36 +0100324 return 0;
325
Martin Sperla30a5552015-04-06 17:16:31 +0000326 /* and calculate the real CS */
327 spi->cs_gpio = chip->base + 8 - spi->chip_select;
328
329 /* and set up the "mode" and level */
330 dev_info(&spi->dev, "setting up native-CS%i as GPIO %i\n",
331 spi->chip_select, spi->cs_gpio);
332
333 /* set up GPIO as output and pull to the correct level */
334 err = gpio_direction_output(spi->cs_gpio,
335 (spi->mode & SPI_CS_HIGH) ? 0 : 1);
336 if (err) {
337 dev_err(&spi->dev,
338 "could not set CS%i gpio %i as output: %i",
339 spi->chip_select, spi->cs_gpio, err);
340 return err;
341 }
342 /* the implementation of pinctrl-bcm2835 currently does not
343 * set the GPIO value when using gpio_direction_output
344 * so we are setting it here explicitly
345 */
346 gpio_set_value(spi->cs_gpio, (spi->mode & SPI_CS_HIGH) ? 0 : 1);
347
348 return 0;
Chris Bootf8043872013-03-11 21:38:24 -0600349}
350
351static int bcm2835_spi_probe(struct platform_device *pdev)
352{
353 struct spi_master *master;
354 struct bcm2835_spi *bs;
355 struct resource *res;
356 int err;
357
358 master = spi_alloc_master(&pdev->dev, sizeof(*bs));
359 if (!master) {
360 dev_err(&pdev->dev, "spi_alloc_master() failed\n");
361 return -ENOMEM;
362 }
363
364 platform_set_drvdata(pdev, master);
365
366 master->mode_bits = BCM2835_SPI_MODE_BITS;
Axel Linc2b6a3a2013-08-05 08:43:02 +0800367 master->bits_per_word_mask = SPI_BPW_MASK(8);
Chris Bootf8043872013-03-11 21:38:24 -0600368 master->num_chipselect = 3;
Martin Sperle34ff012015-03-26 11:08:36 +0100369 master->setup = bcm2835_spi_setup;
370 master->set_cs = bcm2835_spi_set_cs;
371 master->transfer_one = bcm2835_spi_transfer_one;
372 master->handle_err = bcm2835_spi_handle_err;
Chris Bootf8043872013-03-11 21:38:24 -0600373 master->dev.of_node = pdev->dev.of_node;
374
375 bs = spi_master_get_devdata(master);
376
Chris Bootf8043872013-03-11 21:38:24 -0600377 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
Laurent Navet2d6e75e2013-05-02 14:13:30 +0200378 bs->regs = devm_ioremap_resource(&pdev->dev, res);
379 if (IS_ERR(bs->regs)) {
380 err = PTR_ERR(bs->regs);
Chris Bootf8043872013-03-11 21:38:24 -0600381 goto out_master_put;
382 }
383
384 bs->clk = devm_clk_get(&pdev->dev, NULL);
385 if (IS_ERR(bs->clk)) {
386 err = PTR_ERR(bs->clk);
387 dev_err(&pdev->dev, "could not get clk: %d\n", err);
388 goto out_master_put;
389 }
390
391 bs->irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
392 if (bs->irq <= 0) {
393 dev_err(&pdev->dev, "could not get IRQ: %d\n", bs->irq);
394 err = bs->irq ? bs->irq : -ENODEV;
395 goto out_master_put;
396 }
397
398 clk_prepare_enable(bs->clk);
399
Jingoo Han08bc0542013-12-09 19:25:00 +0900400 err = devm_request_irq(&pdev->dev, bs->irq, bcm2835_spi_interrupt, 0,
Martin Sperl342f9482015-03-20 15:26:11 +0100401 dev_name(&pdev->dev), master);
Chris Bootf8043872013-03-11 21:38:24 -0600402 if (err) {
403 dev_err(&pdev->dev, "could not request IRQ: %d\n", err);
404 goto out_clk_disable;
405 }
406
Martin Sperle34ff012015-03-26 11:08:36 +0100407 /* initialise the hardware with the default polarities */
Chris Bootf8043872013-03-11 21:38:24 -0600408 bcm2835_wr(bs, BCM2835_SPI_CS,
409 BCM2835_SPI_CS_CLEAR_RX | BCM2835_SPI_CS_CLEAR_TX);
410
Jingoo Han247263d2013-09-24 13:23:00 +0900411 err = devm_spi_register_master(&pdev->dev, master);
Chris Bootf8043872013-03-11 21:38:24 -0600412 if (err) {
413 dev_err(&pdev->dev, "could not register SPI master: %d\n", err);
Jingoo Han08bc0542013-12-09 19:25:00 +0900414 goto out_clk_disable;
Chris Bootf8043872013-03-11 21:38:24 -0600415 }
416
417 return 0;
418
Chris Bootf8043872013-03-11 21:38:24 -0600419out_clk_disable:
420 clk_disable_unprepare(bs->clk);
421out_master_put:
422 spi_master_put(master);
423 return err;
424}
425
426static int bcm2835_spi_remove(struct platform_device *pdev)
427{
Wei Yongjune0b35b82013-11-15 15:43:27 +0800428 struct spi_master *master = platform_get_drvdata(pdev);
Chris Bootf8043872013-03-11 21:38:24 -0600429 struct bcm2835_spi *bs = spi_master_get_devdata(master);
430
Chris Bootf8043872013-03-11 21:38:24 -0600431 /* Clear FIFOs, and disable the HW block */
432 bcm2835_wr(bs, BCM2835_SPI_CS,
433 BCM2835_SPI_CS_CLEAR_RX | BCM2835_SPI_CS_CLEAR_TX);
434
435 clk_disable_unprepare(bs->clk);
Chris Bootf8043872013-03-11 21:38:24 -0600436
437 return 0;
438}
439
440static const struct of_device_id bcm2835_spi_match[] = {
441 { .compatible = "brcm,bcm2835-spi", },
442 {}
443};
444MODULE_DEVICE_TABLE(of, bcm2835_spi_match);
445
446static struct platform_driver bcm2835_spi_driver = {
447 .driver = {
448 .name = DRV_NAME,
Chris Bootf8043872013-03-11 21:38:24 -0600449 .of_match_table = bcm2835_spi_match,
450 },
451 .probe = bcm2835_spi_probe,
452 .remove = bcm2835_spi_remove,
453};
454module_platform_driver(bcm2835_spi_driver);
455
456MODULE_DESCRIPTION("SPI controller driver for Broadcom BCM2835");
457MODULE_AUTHOR("Chris Boot <bootc@bootc.net>");
458MODULE_LICENSE("GPL v2");