blob: fe69e94043e1fad93779d1d167ef48a300e57a5e [file] [log] [blame]
Kumar Galaccf06992006-05-20 15:00:15 -07001/*
2 * MPC83xx SPI controller driver.
3 *
4 * Maintainer: Kumar Gala
5 *
6 * Copyright (C) 2006 Polycom, Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13#include <linux/module.h>
14#include <linux/init.h>
15#include <linux/types.h>
16#include <linux/kernel.h>
17#include <linux/completion.h>
18#include <linux/interrupt.h>
19#include <linux/delay.h>
20#include <linux/irq.h>
21#include <linux/device.h>
22#include <linux/spi/spi.h>
23#include <linux/spi/spi_bitbang.h>
24#include <linux/platform_device.h>
25#include <linux/fsl_devices.h>
26
27#include <asm/irq.h>
28#include <asm/io.h>
29
30/* SPI Controller registers */
31struct mpc83xx_spi_reg {
32 u8 res1[0x20];
33 __be32 mode;
34 __be32 event;
35 __be32 mask;
36 __be32 command;
37 __be32 transmit;
38 __be32 receive;
39};
40
41/* SPI Controller mode register definitions */
Anton Vorontsov2a485d72007-07-31 00:38:45 -070042#define SPMODE_LOOP (1 << 30)
Kumar Galaccf06992006-05-20 15:00:15 -070043#define SPMODE_CI_INACTIVEHIGH (1 << 29)
44#define SPMODE_CP_BEGIN_EDGECLK (1 << 28)
45#define SPMODE_DIV16 (1 << 27)
46#define SPMODE_REV (1 << 26)
47#define SPMODE_MS (1 << 25)
48#define SPMODE_ENABLE (1 << 24)
49#define SPMODE_LEN(x) ((x) << 20)
50#define SPMODE_PM(x) ((x) << 16)
Joakim Tjernlundf29ba282007-07-17 04:04:12 -070051#define SPMODE_OP (1 << 14)
Kumar Galaccf06992006-05-20 15:00:15 -070052
53/*
54 * Default for SPI Mode:
55 * SPI MODE 0 (inactive low, phase middle, MSB, 8-bit length, slow clk
56 */
57#define SPMODE_INIT_VAL (SPMODE_CI_INACTIVEHIGH | SPMODE_DIV16 | SPMODE_REV | \
58 SPMODE_MS | SPMODE_LEN(7) | SPMODE_PM(0xf))
59
60/* SPIE register values */
61#define SPIE_NE 0x00000200 /* Not empty */
62#define SPIE_NF 0x00000100 /* Not full */
63
64/* SPIM register values */
65#define SPIM_NE 0x00000200 /* Not empty */
66#define SPIM_NF 0x00000100 /* Not full */
67
68/* SPI Controller driver's private data. */
69struct mpc83xx_spi {
70 /* bitbang has to be first */
71 struct spi_bitbang bitbang;
72 struct completion done;
73
74 struct mpc83xx_spi_reg __iomem *base;
75
76 /* rx & tx bufs from the spi_transfer */
77 const void *tx;
78 void *rx;
79
80 /* functions to deal with different sized buffers */
81 void (*get_rx) (u32 rx_data, struct mpc83xx_spi *);
82 u32(*get_tx) (struct mpc83xx_spi *);
83
84 unsigned int count;
85 u32 irq;
86
87 unsigned nsecs; /* (clock cycle time)/2 */
88
Anton Vorontsove24a4d12007-08-10 13:01:01 -070089 u32 spibrg; /* SPIBRG input clock */
Joakim Tjernlundf29ba282007-07-17 04:04:12 -070090 u32 rx_shift; /* RX data reg shift when in qe mode */
91 u32 tx_shift; /* TX data reg shift when in qe mode */
92
93 bool qe_mode;
94
Kumar Galaccf06992006-05-20 15:00:15 -070095 void (*activate_cs) (u8 cs, u8 polarity);
96 void (*deactivate_cs) (u8 cs, u8 polarity);
97};
98
99static inline void mpc83xx_spi_write_reg(__be32 __iomem * reg, u32 val)
100{
101 out_be32(reg, val);
102}
103
104static inline u32 mpc83xx_spi_read_reg(__be32 __iomem * reg)
105{
106 return in_be32(reg);
107}
108
109#define MPC83XX_SPI_RX_BUF(type) \
110void mpc83xx_spi_rx_buf_##type(u32 data, struct mpc83xx_spi *mpc83xx_spi) \
111{ \
112 type * rx = mpc83xx_spi->rx; \
Joakim Tjernlundf29ba282007-07-17 04:04:12 -0700113 *rx++ = (type)(data >> mpc83xx_spi->rx_shift); \
Kumar Galaccf06992006-05-20 15:00:15 -0700114 mpc83xx_spi->rx = rx; \
115}
116
117#define MPC83XX_SPI_TX_BUF(type) \
118u32 mpc83xx_spi_tx_buf_##type(struct mpc83xx_spi *mpc83xx_spi) \
119{ \
120 u32 data; \
121 const type * tx = mpc83xx_spi->tx; \
David Brownell4b1badf2006-12-29 16:48:39 -0800122 if (!tx) \
123 return 0; \
Joakim Tjernlundf29ba282007-07-17 04:04:12 -0700124 data = *tx++ << mpc83xx_spi->tx_shift; \
Kumar Galaccf06992006-05-20 15:00:15 -0700125 mpc83xx_spi->tx = tx; \
126 return data; \
127}
128
129MPC83XX_SPI_RX_BUF(u8)
130MPC83XX_SPI_RX_BUF(u16)
131MPC83XX_SPI_RX_BUF(u32)
132MPC83XX_SPI_TX_BUF(u8)
133MPC83XX_SPI_TX_BUF(u16)
134MPC83XX_SPI_TX_BUF(u32)
135
136static void mpc83xx_spi_chipselect(struct spi_device *spi, int value)
137{
138 struct mpc83xx_spi *mpc83xx_spi;
139 u8 pol = spi->mode & SPI_CS_HIGH ? 1 : 0;
140
141 mpc83xx_spi = spi_master_get_devdata(spi->master);
142
143 if (value == BITBANG_CS_INACTIVE) {
144 if (mpc83xx_spi->deactivate_cs)
145 mpc83xx_spi->deactivate_cs(spi->chip_select, pol);
146 }
147
148 if (value == BITBANG_CS_ACTIVE) {
149 u32 regval = mpc83xx_spi_read_reg(&mpc83xx_spi->base->mode);
150 u32 len = spi->bits_per_word;
151 if (len == 32)
152 len = 0;
153 else
154 len = len - 1;
155
156 /* mask out bits we are going to set */
Anton Vorontsov32421da2007-07-31 00:38:41 -0700157 regval &= ~(SPMODE_CP_BEGIN_EDGECLK | SPMODE_CI_INACTIVEHIGH
158 | SPMODE_LEN(0xF) | SPMODE_DIV16
Anton Vorontsov2a485d72007-07-31 00:38:45 -0700159 | SPMODE_PM(0xF) | SPMODE_REV | SPMODE_LOOP);
Kumar Galaccf06992006-05-20 15:00:15 -0700160
161 if (spi->mode & SPI_CPHA)
162 regval |= SPMODE_CP_BEGIN_EDGECLK;
163 if (spi->mode & SPI_CPOL)
164 regval |= SPMODE_CI_INACTIVEHIGH;
Anton Vorontsov32421da2007-07-31 00:38:41 -0700165 if (!(spi->mode & SPI_LSB_FIRST))
166 regval |= SPMODE_REV;
Anton Vorontsov2a485d72007-07-31 00:38:45 -0700167 if (spi->mode & SPI_LOOP)
168 regval |= SPMODE_LOOP;
Kumar Galaccf06992006-05-20 15:00:15 -0700169
170 regval |= SPMODE_LEN(len);
171
Anton Vorontsove24a4d12007-08-10 13:01:01 -0700172 if ((mpc83xx_spi->spibrg / spi->max_speed_hz) >= 64) {
173 u8 pm = mpc83xx_spi->spibrg / (spi->max_speed_hz * 64);
Clifford Wolf698ca472007-07-17 04:04:06 -0700174 if (pm > 0x0f) {
Anton Vorontsove24a4d12007-08-10 13:01:01 -0700175 dev_err(&spi->dev, "Requested speed is too "
176 "low: %d Hz. Will use %d Hz instead.\n",
177 spi->max_speed_hz,
178 mpc83xx_spi->spibrg / 1024);
Clifford Wolf698ca472007-07-17 04:04:06 -0700179 pm = 0x0f;
180 }
Kumar Galaccf06992006-05-20 15:00:15 -0700181 regval |= SPMODE_PM(pm) | SPMODE_DIV16;
182 } else {
Anton Vorontsove24a4d12007-08-10 13:01:01 -0700183 u8 pm = mpc83xx_spi->spibrg / (spi->max_speed_hz * 4);
Kumar Galaccf06992006-05-20 15:00:15 -0700184 regval |= SPMODE_PM(pm);
185 }
186
Anton Vorontsov49bb2302007-07-31 00:38:40 -0700187 /* Turn off SPI unit prior changing mode */
188 mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, 0);
Kumar Galaccf06992006-05-20 15:00:15 -0700189 mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, regval);
190 if (mpc83xx_spi->activate_cs)
191 mpc83xx_spi->activate_cs(spi->chip_select, pol);
192 }
193}
194
195static
196int mpc83xx_spi_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
197{
198 struct mpc83xx_spi *mpc83xx_spi;
199 u32 regval;
200 u8 bits_per_word;
201 u32 hz;
202
203 mpc83xx_spi = spi_master_get_devdata(spi->master);
204
205 if (t) {
206 bits_per_word = t->bits_per_word;
207 hz = t->speed_hz;
208 } else {
209 bits_per_word = 0;
210 hz = 0;
211 }
212
213 /* spi_transfer level calls that work per-word */
214 if (!bits_per_word)
215 bits_per_word = spi->bits_per_word;
216
217 /* Make sure its a bit width we support [4..16, 32] */
218 if ((bits_per_word < 4)
219 || ((bits_per_word > 16) && (bits_per_word != 32)))
220 return -EINVAL;
221
Joakim Tjernlundf29ba282007-07-17 04:04:12 -0700222 mpc83xx_spi->rx_shift = 0;
223 mpc83xx_spi->tx_shift = 0;
Kumar Galaccf06992006-05-20 15:00:15 -0700224 if (bits_per_word <= 8) {
225 mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u8;
226 mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u8;
Joakim Tjernlundf29ba282007-07-17 04:04:12 -0700227 if (mpc83xx_spi->qe_mode) {
228 mpc83xx_spi->rx_shift = 16;
229 mpc83xx_spi->tx_shift = 24;
230 }
Kumar Galaccf06992006-05-20 15:00:15 -0700231 } else if (bits_per_word <= 16) {
232 mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u16;
233 mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u16;
Joakim Tjernlundf29ba282007-07-17 04:04:12 -0700234 if (mpc83xx_spi->qe_mode) {
235 mpc83xx_spi->rx_shift = 16;
236 mpc83xx_spi->tx_shift = 16;
237 }
Kumar Galaccf06992006-05-20 15:00:15 -0700238 } else if (bits_per_word <= 32) {
239 mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u32;
240 mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u32;
241 } else
242 return -EINVAL;
243
Anton Vorontsov35cc0b92007-07-31 00:38:42 -0700244 if (mpc83xx_spi->qe_mode && spi->mode & SPI_LSB_FIRST) {
245 mpc83xx_spi->tx_shift = 0;
246 if (bits_per_word <= 8)
247 mpc83xx_spi->rx_shift = 8;
248 else
249 mpc83xx_spi->rx_shift = 0;
250 }
251
Kumar Galaccf06992006-05-20 15:00:15 -0700252 /* nsecs = (clock period)/2 */
253 if (!hz)
254 hz = spi->max_speed_hz;
255 mpc83xx_spi->nsecs = (1000000000 / 2) / hz;
256 if (mpc83xx_spi->nsecs > MAX_UDELAY_MS * 1000)
257 return -EINVAL;
258
259 if (bits_per_word == 32)
260 bits_per_word = 0;
261 else
262 bits_per_word = bits_per_word - 1;
263
264 regval = mpc83xx_spi_read_reg(&mpc83xx_spi->base->mode);
265
Anton Vorontsov32421da2007-07-31 00:38:41 -0700266 /* mask out bits we are going to set */
267 regval &= ~(SPMODE_LEN(0xF) | SPMODE_REV);
Kumar Galaccf06992006-05-20 15:00:15 -0700268 regval |= SPMODE_LEN(bits_per_word);
Anton Vorontsov32421da2007-07-31 00:38:41 -0700269 if (!(spi->mode & SPI_LSB_FIRST))
270 regval |= SPMODE_REV;
Kumar Galaccf06992006-05-20 15:00:15 -0700271
Anton Vorontsov49bb2302007-07-31 00:38:40 -0700272 /* Turn off SPI unit prior changing mode */
273 mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, 0);
Kumar Galaccf06992006-05-20 15:00:15 -0700274 mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, regval);
275
276 return 0;
277}
278
David Brownelldccd5732007-07-17 04:04:02 -0700279/* the spi->mode bits understood by this driver: */
Anton Vorontsov2a485d72007-07-31 00:38:45 -0700280#define MODEBITS (SPI_CPOL | SPI_CPHA | SPI_CS_HIGH \
281 | SPI_LSB_FIRST | SPI_LOOP)
David Brownelldccd5732007-07-17 04:04:02 -0700282
Kumar Galaccf06992006-05-20 15:00:15 -0700283static int mpc83xx_spi_setup(struct spi_device *spi)
284{
285 struct spi_bitbang *bitbang;
286 struct mpc83xx_spi *mpc83xx_spi;
287 int retval;
288
David Brownelldccd5732007-07-17 04:04:02 -0700289 if (spi->mode & ~MODEBITS) {
290 dev_dbg(&spi->dev, "setup: unsupported mode bits %x\n",
291 spi->mode & ~MODEBITS);
292 return -EINVAL;
293 }
294
Kumar Galaccf06992006-05-20 15:00:15 -0700295 if (!spi->max_speed_hz)
296 return -EINVAL;
297
298 bitbang = spi_master_get_devdata(spi->master);
299 mpc83xx_spi = spi_master_get_devdata(spi->master);
300
301 if (!spi->bits_per_word)
302 spi->bits_per_word = 8;
303
304 retval = mpc83xx_spi_setup_transfer(spi, NULL);
305 if (retval < 0)
306 return retval;
307
308 dev_dbg(&spi->dev, "%s, mode %d, %u bits/w, %u nsec\n",
309 __FUNCTION__, spi->mode & (SPI_CPOL | SPI_CPHA),
310 spi->bits_per_word, 2 * mpc83xx_spi->nsecs);
311
312 /* NOTE we _need_ to call chipselect() early, ideally with adapter
313 * setup, unless the hardware defaults cooperate to avoid confusion
314 * between normal (active low) and inverted chipselects.
315 */
316
317 /* deselect chip (low or high) */
318 spin_lock(&bitbang->lock);
319 if (!bitbang->busy) {
320 bitbang->chipselect(spi, BITBANG_CS_INACTIVE);
321 ndelay(mpc83xx_spi->nsecs);
322 }
323 spin_unlock(&bitbang->lock);
324
325 return 0;
326}
327
328static int mpc83xx_spi_bufs(struct spi_device *spi, struct spi_transfer *t)
329{
330 struct mpc83xx_spi *mpc83xx_spi;
331 u32 word;
332
333 mpc83xx_spi = spi_master_get_devdata(spi->master);
334
335 mpc83xx_spi->tx = t->tx_buf;
336 mpc83xx_spi->rx = t->rx_buf;
337 mpc83xx_spi->count = t->len;
338 INIT_COMPLETION(mpc83xx_spi->done);
339
340 /* enable rx ints */
341 mpc83xx_spi_write_reg(&mpc83xx_spi->base->mask, SPIM_NE);
342
343 /* transmit word */
344 word = mpc83xx_spi->get_tx(mpc83xx_spi);
345 mpc83xx_spi_write_reg(&mpc83xx_spi->base->transmit, word);
346
347 wait_for_completion(&mpc83xx_spi->done);
348
349 /* disable rx ints */
350 mpc83xx_spi_write_reg(&mpc83xx_spi->base->mask, 0);
351
352 return t->len - mpc83xx_spi->count;
353}
354
David Howells7d12e782006-10-05 14:55:46 +0100355irqreturn_t mpc83xx_spi_irq(s32 irq, void *context_data)
Kumar Galaccf06992006-05-20 15:00:15 -0700356{
357 struct mpc83xx_spi *mpc83xx_spi = context_data;
358 u32 event;
359 irqreturn_t ret = IRQ_NONE;
360
361 /* Get interrupt events(tx/rx) */
362 event = mpc83xx_spi_read_reg(&mpc83xx_spi->base->event);
363
364 /* We need handle RX first */
365 if (event & SPIE_NE) {
366 u32 rx_data = mpc83xx_spi_read_reg(&mpc83xx_spi->base->receive);
367
368 if (mpc83xx_spi->rx)
369 mpc83xx_spi->get_rx(rx_data, mpc83xx_spi);
370
371 ret = IRQ_HANDLED;
372 }
373
374 if ((event & SPIE_NF) == 0)
375 /* spin until TX is done */
376 while (((event =
377 mpc83xx_spi_read_reg(&mpc83xx_spi->base->event)) &
378 SPIE_NF) == 0)
379 cpu_relax();
380
381 mpc83xx_spi->count -= 1;
382 if (mpc83xx_spi->count) {
383 if (mpc83xx_spi->tx) {
384 u32 word = mpc83xx_spi->get_tx(mpc83xx_spi);
385 mpc83xx_spi_write_reg(&mpc83xx_spi->base->transmit,
386 word);
387 }
388 } else {
389 complete(&mpc83xx_spi->done);
390 }
391
392 /* Clear the events */
393 mpc83xx_spi_write_reg(&mpc83xx_spi->base->event, event);
394
395 return ret;
396}
397
398static int __init mpc83xx_spi_probe(struct platform_device *dev)
399{
400 struct spi_master *master;
401 struct mpc83xx_spi *mpc83xx_spi;
402 struct fsl_spi_platform_data *pdata;
403 struct resource *r;
404 u32 regval;
405 int ret = 0;
406
407 /* Get resources(memory, IRQ) associated with the device */
408 master = spi_alloc_master(&dev->dev, sizeof(struct mpc83xx_spi));
409
410 if (master == NULL) {
411 ret = -ENOMEM;
412 goto err;
413 }
414
415 platform_set_drvdata(dev, master);
416 pdata = dev->dev.platform_data;
417
418 if (pdata == NULL) {
419 ret = -ENODEV;
420 goto free_master;
421 }
422
423 r = platform_get_resource(dev, IORESOURCE_MEM, 0);
424 if (r == NULL) {
425 ret = -ENODEV;
426 goto free_master;
427 }
Kumar Galaccf06992006-05-20 15:00:15 -0700428 mpc83xx_spi = spi_master_get_devdata(master);
429 mpc83xx_spi->bitbang.master = spi_master_get(master);
430 mpc83xx_spi->bitbang.chipselect = mpc83xx_spi_chipselect;
431 mpc83xx_spi->bitbang.setup_transfer = mpc83xx_spi_setup_transfer;
432 mpc83xx_spi->bitbang.txrx_bufs = mpc83xx_spi_bufs;
Kumar Galaccf06992006-05-20 15:00:15 -0700433 mpc83xx_spi->activate_cs = pdata->activate_cs;
434 mpc83xx_spi->deactivate_cs = pdata->deactivate_cs;
Joakim Tjernlundf29ba282007-07-17 04:04:12 -0700435 mpc83xx_spi->qe_mode = pdata->qe_mode;
Kumar Galaccf06992006-05-20 15:00:15 -0700436 mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u8;
437 mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u8;
438
Anton Vorontsove24a4d12007-08-10 13:01:01 -0700439 if (mpc83xx_spi->qe_mode)
440 mpc83xx_spi->spibrg = pdata->sysclk / 2;
441 else
442 mpc83xx_spi->spibrg = pdata->sysclk;
443
Joakim Tjernlundf29ba282007-07-17 04:04:12 -0700444 mpc83xx_spi->rx_shift = 0;
445 mpc83xx_spi->tx_shift = 0;
446 if (mpc83xx_spi->qe_mode) {
447 mpc83xx_spi->rx_shift = 16;
448 mpc83xx_spi->tx_shift = 24;
449 }
450
Kumar Galaccf06992006-05-20 15:00:15 -0700451 mpc83xx_spi->bitbang.master->setup = mpc83xx_spi_setup;
452 init_completion(&mpc83xx_spi->done);
453
454 mpc83xx_spi->base = ioremap(r->start, r->end - r->start + 1);
455 if (mpc83xx_spi->base == NULL) {
456 ret = -ENOMEM;
457 goto put_master;
458 }
459
460 mpc83xx_spi->irq = platform_get_irq(dev, 0);
461
462 if (mpc83xx_spi->irq < 0) {
463 ret = -ENXIO;
464 goto unmap_io;
465 }
466
467 /* Register for SPI Interrupt */
468 ret = request_irq(mpc83xx_spi->irq, mpc83xx_spi_irq,
469 0, "mpc83xx_spi", mpc83xx_spi);
470
471 if (ret != 0)
472 goto unmap_io;
473
474 master->bus_num = pdata->bus_num;
475 master->num_chipselect = pdata->max_chipselect;
476
477 /* SPI controller initializations */
478 mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, 0);
479 mpc83xx_spi_write_reg(&mpc83xx_spi->base->mask, 0);
480 mpc83xx_spi_write_reg(&mpc83xx_spi->base->command, 0);
481 mpc83xx_spi_write_reg(&mpc83xx_spi->base->event, 0xffffffff);
482
483 /* Enable SPI interface */
484 regval = pdata->initial_spmode | SPMODE_INIT_VAL | SPMODE_ENABLE;
Joakim Tjernlundf29ba282007-07-17 04:04:12 -0700485 if (pdata->qe_mode)
486 regval |= SPMODE_OP;
487
Kumar Galaccf06992006-05-20 15:00:15 -0700488 mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, regval);
489
490 ret = spi_bitbang_start(&mpc83xx_spi->bitbang);
491
492 if (ret != 0)
493 goto free_irq;
494
495 printk(KERN_INFO
496 "%s: MPC83xx SPI Controller driver at 0x%p (irq = %d)\n",
497 dev->dev.bus_id, mpc83xx_spi->base, mpc83xx_spi->irq);
498
499 return ret;
500
501free_irq:
502 free_irq(mpc83xx_spi->irq, mpc83xx_spi);
503unmap_io:
504 iounmap(mpc83xx_spi->base);
505put_master:
506 spi_master_put(master);
507free_master:
508 kfree(master);
509err:
510 return ret;
511}
512
513static int __devexit mpc83xx_spi_remove(struct platform_device *dev)
514{
515 struct mpc83xx_spi *mpc83xx_spi;
516 struct spi_master *master;
517
518 master = platform_get_drvdata(dev);
519 mpc83xx_spi = spi_master_get_devdata(master);
520
521 spi_bitbang_stop(&mpc83xx_spi->bitbang);
522 free_irq(mpc83xx_spi->irq, mpc83xx_spi);
523 iounmap(mpc83xx_spi->base);
524 spi_master_put(mpc83xx_spi->bitbang.master);
525
526 return 0;
527}
528
529static struct platform_driver mpc83xx_spi_driver = {
530 .probe = mpc83xx_spi_probe,
531 .remove = __devexit_p(mpc83xx_spi_remove),
532 .driver = {
533 .name = "mpc83xx_spi",
534 },
535};
536
537static int __init mpc83xx_spi_init(void)
538{
539 return platform_driver_register(&mpc83xx_spi_driver);
540}
541
542static void __exit mpc83xx_spi_exit(void)
543{
544 platform_driver_unregister(&mpc83xx_spi_driver);
545}
546
547module_init(mpc83xx_spi_init);
548module_exit(mpc83xx_spi_exit);
549
550MODULE_AUTHOR("Kumar Gala");
551MODULE_DESCRIPTION("Simple MPC83xx SPI Driver");
552MODULE_LICENSE("GPL");