spi-mpc512x-psc.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632
  1. /*
  2. * MPC512x PSC in SPI mode driver.
  3. *
  4. * Copyright (C) 2007,2008 Freescale Semiconductor Inc.
  5. * Original port from 52xx driver:
  6. * Hongjun Chen <hong-jun.chen@freescale.com>
  7. *
  8. * Fork of mpc52xx_psc_spi.c:
  9. * Copyright (C) 2006 TOPTICA Photonics AG., Dragos Carp
  10. *
  11. * This program is free software; you can redistribute it and/or modify it
  12. * under the terms of the GNU General Public License as published by the
  13. * Free Software Foundation; either version 2 of the License, or (at your
  14. * option) any later version.
  15. */
  16. #include <linux/module.h>
  17. #include <linux/kernel.h>
  18. #include <linux/errno.h>
  19. #include <linux/interrupt.h>
  20. #include <linux/of_address.h>
  21. #include <linux/of_irq.h>
  22. #include <linux/of_platform.h>
  23. #include <linux/completion.h>
  24. #include <linux/io.h>
  25. #include <linux/delay.h>
  26. #include <linux/clk.h>
  27. #include <linux/spi/spi.h>
  28. #include <linux/fsl_devices.h>
  29. #include <linux/gpio.h>
  30. #include <asm/mpc52xx_psc.h>
  31. enum {
  32. TYPE_MPC5121,
  33. TYPE_MPC5125,
  34. };
  35. /*
  36. * This macro abstracts the differences in the PSC register layout between
  37. * MPC5121 (which uses a struct mpc52xx_psc) and MPC5125 (using mpc5125_psc).
  38. */
  39. #define psc_addr(mps, regname) ({ \
  40. void *__ret = NULL; \
  41. switch (mps->type) { \
  42. case TYPE_MPC5121: { \
  43. struct mpc52xx_psc __iomem *psc = mps->psc; \
  44. __ret = &psc->regname; \
  45. }; \
  46. break; \
  47. case TYPE_MPC5125: { \
  48. struct mpc5125_psc __iomem *psc = mps->psc; \
  49. __ret = &psc->regname; \
  50. }; \
  51. break; \
  52. } \
  53. __ret; })
  54. struct mpc512x_psc_spi {
  55. void (*cs_control)(struct spi_device *spi, bool on);
  56. /* driver internal data */
  57. int type;
  58. void __iomem *psc;
  59. struct mpc512x_psc_fifo __iomem *fifo;
  60. unsigned int irq;
  61. u8 bits_per_word;
  62. struct clk *clk_mclk;
  63. struct clk *clk_ipg;
  64. u32 mclk_rate;
  65. struct completion txisrdone;
  66. };
  67. /* controller state */
  68. struct mpc512x_psc_spi_cs {
  69. int bits_per_word;
  70. int speed_hz;
  71. };
  72. /* set clock freq, clock ramp, bits per work
  73. * if t is NULL then reset the values to the default values
  74. */
  75. static int mpc512x_psc_spi_transfer_setup(struct spi_device *spi,
  76. struct spi_transfer *t)
  77. {
  78. struct mpc512x_psc_spi_cs *cs = spi->controller_state;
  79. cs->speed_hz = (t && t->speed_hz)
  80. ? t->speed_hz : spi->max_speed_hz;
  81. cs->bits_per_word = (t && t->bits_per_word)
  82. ? t->bits_per_word : spi->bits_per_word;
  83. cs->bits_per_word = ((cs->bits_per_word + 7) / 8) * 8;
  84. return 0;
  85. }
  86. static void mpc512x_psc_spi_activate_cs(struct spi_device *spi)
  87. {
  88. struct mpc512x_psc_spi_cs *cs = spi->controller_state;
  89. struct mpc512x_psc_spi *mps = spi_master_get_devdata(spi->master);
  90. u32 sicr;
  91. u32 ccr;
  92. int speed;
  93. u16 bclkdiv;
  94. sicr = in_be32(psc_addr(mps, sicr));
  95. /* Set clock phase and polarity */
  96. if (spi->mode & SPI_CPHA)
  97. sicr |= 0x00001000;
  98. else
  99. sicr &= ~0x00001000;
  100. if (spi->mode & SPI_CPOL)
  101. sicr |= 0x00002000;
  102. else
  103. sicr &= ~0x00002000;
  104. if (spi->mode & SPI_LSB_FIRST)
  105. sicr |= 0x10000000;
  106. else
  107. sicr &= ~0x10000000;
  108. out_be32(psc_addr(mps, sicr), sicr);
  109. ccr = in_be32(psc_addr(mps, ccr));
  110. ccr &= 0xFF000000;
  111. speed = cs->speed_hz;
  112. if (!speed)
  113. speed = 1000000; /* default 1MHz */
  114. bclkdiv = (mps->mclk_rate / speed) - 1;
  115. ccr |= (((bclkdiv & 0xff) << 16) | (((bclkdiv >> 8) & 0xff) << 8));
  116. out_be32(psc_addr(mps, ccr), ccr);
  117. mps->bits_per_word = cs->bits_per_word;
  118. if (mps->cs_control && gpio_is_valid(spi->cs_gpio))
  119. mps->cs_control(spi, (spi->mode & SPI_CS_HIGH) ? 1 : 0);
  120. }
  121. static void mpc512x_psc_spi_deactivate_cs(struct spi_device *spi)
  122. {
  123. struct mpc512x_psc_spi *mps = spi_master_get_devdata(spi->master);
  124. if (mps->cs_control && gpio_is_valid(spi->cs_gpio))
  125. mps->cs_control(spi, (spi->mode & SPI_CS_HIGH) ? 0 : 1);
  126. }
  127. /* extract and scale size field in txsz or rxsz */
  128. #define MPC512x_PSC_FIFO_SZ(sz) ((sz & 0x7ff) << 2);
  129. #define EOFBYTE 1
  130. static int mpc512x_psc_spi_transfer_rxtx(struct spi_device *spi,
  131. struct spi_transfer *t)
  132. {
  133. struct mpc512x_psc_spi *mps = spi_master_get_devdata(spi->master);
  134. struct mpc512x_psc_fifo __iomem *fifo = mps->fifo;
  135. size_t tx_len = t->len;
  136. size_t rx_len = t->len;
  137. u8 *tx_buf = (u8 *)t->tx_buf;
  138. u8 *rx_buf = (u8 *)t->rx_buf;
  139. if (!tx_buf && !rx_buf && t->len)
  140. return -EINVAL;
  141. while (rx_len || tx_len) {
  142. size_t txcount;
  143. u8 data;
  144. size_t fifosz;
  145. size_t rxcount;
  146. int rxtries;
  147. /*
  148. * send the TX bytes in as large a chunk as possible
  149. * but neither exceed the TX nor the RX FIFOs
  150. */
  151. fifosz = MPC512x_PSC_FIFO_SZ(in_be32(&fifo->txsz));
  152. txcount = min(fifosz, tx_len);
  153. fifosz = MPC512x_PSC_FIFO_SZ(in_be32(&fifo->rxsz));
  154. fifosz -= in_be32(&fifo->rxcnt) + 1;
  155. txcount = min(fifosz, txcount);
  156. if (txcount) {
  157. /* fill the TX FIFO */
  158. while (txcount-- > 0) {
  159. data = tx_buf ? *tx_buf++ : 0;
  160. if (tx_len == EOFBYTE && t->cs_change)
  161. setbits32(&fifo->txcmd,
  162. MPC512x_PSC_FIFO_EOF);
  163. out_8(&fifo->txdata_8, data);
  164. tx_len--;
  165. }
  166. /* have the ISR trigger when the TX FIFO is empty */
  167. reinit_completion(&mps->txisrdone);
  168. out_be32(&fifo->txisr, MPC512x_PSC_FIFO_EMPTY);
  169. out_be32(&fifo->tximr, MPC512x_PSC_FIFO_EMPTY);
  170. wait_for_completion(&mps->txisrdone);
  171. }
  172. /*
  173. * consume as much RX data as the FIFO holds, while we
  174. * iterate over the transfer's TX data length
  175. *
  176. * only insist in draining all the remaining RX bytes
  177. * when the TX bytes were exhausted (that's at the very
  178. * end of this transfer, not when still iterating over
  179. * the transfer's chunks)
  180. */
  181. rxtries = 50;
  182. do {
  183. /*
  184. * grab whatever was in the FIFO when we started
  185. * looking, don't bother fetching what was added to
  186. * the FIFO while we read from it -- we'll return
  187. * here eventually and prefer sending out remaining
  188. * TX data
  189. */
  190. fifosz = in_be32(&fifo->rxcnt);
  191. rxcount = min(fifosz, rx_len);
  192. while (rxcount-- > 0) {
  193. data = in_8(&fifo->rxdata_8);
  194. if (rx_buf)
  195. *rx_buf++ = data;
  196. rx_len--;
  197. }
  198. /*
  199. * come back later if there still is TX data to send,
  200. * bail out of the RX drain loop if all of the TX data
  201. * was sent and all of the RX data was received (i.e.
  202. * when the transmission has completed)
  203. */
  204. if (tx_len)
  205. break;
  206. if (!rx_len)
  207. break;
  208. /*
  209. * TX data transmission has completed while RX data
  210. * is still pending -- that's a transient situation
  211. * which depends on wire speed and specific
  212. * hardware implementation details (buffering) yet
  213. * should resolve very quickly
  214. *
  215. * just yield for a moment to not hog the CPU for
  216. * too long when running SPI at low speed
  217. *
  218. * the timeout range is rather arbitrary and tries
  219. * to balance throughput against system load; the
  220. * chosen values result in a minimal timeout of 50
  221. * times 10us and thus work at speeds as low as
  222. * some 20kbps, while the maximum timeout at the
  223. * transfer's end could be 5ms _if_ nothing else
  224. * ticks in the system _and_ RX data still wasn't
  225. * received, which only occurs in situations that
  226. * are exceptional; removing the unpredictability
  227. * of the timeout either decreases throughput
  228. * (longer timeouts), or puts more load on the
  229. * system (fixed short timeouts) or requires the
  230. * use of a timeout API instead of a counter and an
  231. * unknown inner delay
  232. */
  233. usleep_range(10, 100);
  234. } while (--rxtries > 0);
  235. if (!tx_len && rx_len && !rxtries) {
  236. /*
  237. * not enough RX bytes even after several retries
  238. * and the resulting rather long timeout?
  239. */
  240. rxcount = in_be32(&fifo->rxcnt);
  241. dev_warn(&spi->dev,
  242. "short xfer, missing %zd RX bytes, FIFO level %zd\n",
  243. rx_len, rxcount);
  244. }
  245. /*
  246. * drain and drop RX data which "should not be there" in
  247. * the first place, for undisturbed transmission this turns
  248. * into a NOP (except for the FIFO level fetch)
  249. */
  250. if (!tx_len && !rx_len) {
  251. while (in_be32(&fifo->rxcnt))
  252. in_8(&fifo->rxdata_8);
  253. }
  254. }
  255. return 0;
  256. }
  257. static int mpc512x_psc_spi_msg_xfer(struct spi_master *master,
  258. struct spi_message *m)
  259. {
  260. struct spi_device *spi;
  261. unsigned cs_change;
  262. int status;
  263. struct spi_transfer *t;
  264. spi = m->spi;
  265. cs_change = 1;
  266. status = 0;
  267. list_for_each_entry(t, &m->transfers, transfer_list) {
  268. status = mpc512x_psc_spi_transfer_setup(spi, t);
  269. if (status < 0)
  270. break;
  271. if (cs_change)
  272. mpc512x_psc_spi_activate_cs(spi);
  273. cs_change = t->cs_change;
  274. status = mpc512x_psc_spi_transfer_rxtx(spi, t);
  275. if (status)
  276. break;
  277. m->actual_length += t->len;
  278. if (t->delay_usecs)
  279. udelay(t->delay_usecs);
  280. if (cs_change)
  281. mpc512x_psc_spi_deactivate_cs(spi);
  282. }
  283. m->status = status;
  284. if (m->complete)
  285. m->complete(m->context);
  286. if (status || !cs_change)
  287. mpc512x_psc_spi_deactivate_cs(spi);
  288. mpc512x_psc_spi_transfer_setup(spi, NULL);
  289. spi_finalize_current_message(master);
  290. return status;
  291. }
  292. static int mpc512x_psc_spi_prep_xfer_hw(struct spi_master *master)
  293. {
  294. struct mpc512x_psc_spi *mps = spi_master_get_devdata(master);
  295. dev_dbg(&master->dev, "%s()\n", __func__);
  296. /* Zero MR2 */
  297. in_8(psc_addr(mps, mr2));
  298. out_8(psc_addr(mps, mr2), 0x0);
  299. /* enable transmitter/receiver */
  300. out_8(psc_addr(mps, command), MPC52xx_PSC_TX_ENABLE | MPC52xx_PSC_RX_ENABLE);
  301. return 0;
  302. }
  303. static int mpc512x_psc_spi_unprep_xfer_hw(struct spi_master *master)
  304. {
  305. struct mpc512x_psc_spi *mps = spi_master_get_devdata(master);
  306. struct mpc512x_psc_fifo __iomem *fifo = mps->fifo;
  307. dev_dbg(&master->dev, "%s()\n", __func__);
  308. /* disable transmitter/receiver and fifo interrupt */
  309. out_8(psc_addr(mps, command), MPC52xx_PSC_TX_DISABLE | MPC52xx_PSC_RX_DISABLE);
  310. out_be32(&fifo->tximr, 0);
  311. return 0;
  312. }
  313. static int mpc512x_psc_spi_setup(struct spi_device *spi)
  314. {
  315. struct mpc512x_psc_spi_cs *cs = spi->controller_state;
  316. int ret;
  317. if (spi->bits_per_word % 8)
  318. return -EINVAL;
  319. if (!cs) {
  320. cs = kzalloc(sizeof *cs, GFP_KERNEL);
  321. if (!cs)
  322. return -ENOMEM;
  323. if (gpio_is_valid(spi->cs_gpio)) {
  324. ret = gpio_request(spi->cs_gpio, dev_name(&spi->dev));
  325. if (ret) {
  326. dev_err(&spi->dev, "can't get CS gpio: %d\n",
  327. ret);
  328. kfree(cs);
  329. return ret;
  330. }
  331. gpio_direction_output(spi->cs_gpio,
  332. spi->mode & SPI_CS_HIGH ? 0 : 1);
  333. }
  334. spi->controller_state = cs;
  335. }
  336. cs->bits_per_word = spi->bits_per_word;
  337. cs->speed_hz = spi->max_speed_hz;
  338. return 0;
  339. }
  340. static void mpc512x_psc_spi_cleanup(struct spi_device *spi)
  341. {
  342. if (gpio_is_valid(spi->cs_gpio))
  343. gpio_free(spi->cs_gpio);
  344. kfree(spi->controller_state);
  345. }
  346. static int mpc512x_psc_spi_port_config(struct spi_master *master,
  347. struct mpc512x_psc_spi *mps)
  348. {
  349. struct mpc512x_psc_fifo __iomem *fifo = mps->fifo;
  350. u32 sicr;
  351. u32 ccr;
  352. int speed;
  353. u16 bclkdiv;
  354. /* Reset the PSC into a known state */
  355. out_8(psc_addr(mps, command), MPC52xx_PSC_RST_RX);
  356. out_8(psc_addr(mps, command), MPC52xx_PSC_RST_TX);
  357. out_8(psc_addr(mps, command), MPC52xx_PSC_TX_DISABLE | MPC52xx_PSC_RX_DISABLE);
  358. /* Disable psc interrupts all useful interrupts are in fifo */
  359. out_be16(psc_addr(mps, isr_imr.imr), 0);
  360. /* Disable fifo interrupts, will be enabled later */
  361. out_be32(&fifo->tximr, 0);
  362. out_be32(&fifo->rximr, 0);
  363. /* Setup fifo slice address and size */
  364. /*out_be32(&fifo->txsz, 0x0fe00004);*/
  365. /*out_be32(&fifo->rxsz, 0x0ff00004);*/
  366. sicr = 0x01000000 | /* SIM = 0001 -- 8 bit */
  367. 0x00800000 | /* GenClk = 1 -- internal clk */
  368. 0x00008000 | /* SPI = 1 */
  369. 0x00004000 | /* MSTR = 1 -- SPI master */
  370. 0x00000800; /* UseEOF = 1 -- SS low until EOF */
  371. out_be32(psc_addr(mps, sicr), sicr);
  372. ccr = in_be32(psc_addr(mps, ccr));
  373. ccr &= 0xFF000000;
  374. speed = 1000000; /* default 1MHz */
  375. bclkdiv = (mps->mclk_rate / speed) - 1;
  376. ccr |= (((bclkdiv & 0xff) << 16) | (((bclkdiv >> 8) & 0xff) << 8));
  377. out_be32(psc_addr(mps, ccr), ccr);
  378. /* Set 2ms DTL delay */
  379. out_8(psc_addr(mps, ctur), 0x00);
  380. out_8(psc_addr(mps, ctlr), 0x82);
  381. /* we don't use the alarms */
  382. out_be32(&fifo->rxalarm, 0xfff);
  383. out_be32(&fifo->txalarm, 0);
  384. /* Enable FIFO slices for Rx/Tx */
  385. out_be32(&fifo->rxcmd,
  386. MPC512x_PSC_FIFO_ENABLE_SLICE | MPC512x_PSC_FIFO_ENABLE_DMA);
  387. out_be32(&fifo->txcmd,
  388. MPC512x_PSC_FIFO_ENABLE_SLICE | MPC512x_PSC_FIFO_ENABLE_DMA);
  389. mps->bits_per_word = 8;
  390. return 0;
  391. }
  392. static irqreturn_t mpc512x_psc_spi_isr(int irq, void *dev_id)
  393. {
  394. struct mpc512x_psc_spi *mps = (struct mpc512x_psc_spi *)dev_id;
  395. struct mpc512x_psc_fifo __iomem *fifo = mps->fifo;
  396. /* clear interrupt and wake up the rx/tx routine */
  397. if (in_be32(&fifo->txisr) &
  398. in_be32(&fifo->tximr) & MPC512x_PSC_FIFO_EMPTY) {
  399. out_be32(&fifo->txisr, MPC512x_PSC_FIFO_EMPTY);
  400. out_be32(&fifo->tximr, 0);
  401. complete(&mps->txisrdone);
  402. return IRQ_HANDLED;
  403. }
  404. return IRQ_NONE;
  405. }
  406. static void mpc512x_spi_cs_control(struct spi_device *spi, bool onoff)
  407. {
  408. gpio_set_value(spi->cs_gpio, onoff);
  409. }
  410. static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr,
  411. u32 size, unsigned int irq)
  412. {
  413. struct fsl_spi_platform_data *pdata = dev_get_platdata(dev);
  414. struct mpc512x_psc_spi *mps;
  415. struct spi_master *master;
  416. int ret;
  417. void *tempp;
  418. struct clk *clk;
  419. master = spi_alloc_master(dev, sizeof *mps);
  420. if (master == NULL)
  421. return -ENOMEM;
  422. dev_set_drvdata(dev, master);
  423. mps = spi_master_get_devdata(master);
  424. mps->type = (int)of_device_get_match_data(dev);
  425. mps->irq = irq;
  426. if (pdata == NULL) {
  427. mps->cs_control = mpc512x_spi_cs_control;
  428. } else {
  429. mps->cs_control = pdata->cs_control;
  430. master->bus_num = pdata->bus_num;
  431. master->num_chipselect = pdata->max_chipselect;
  432. }
  433. master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LSB_FIRST;
  434. master->setup = mpc512x_psc_spi_setup;
  435. master->prepare_transfer_hardware = mpc512x_psc_spi_prep_xfer_hw;
  436. master->transfer_one_message = mpc512x_psc_spi_msg_xfer;
  437. master->unprepare_transfer_hardware = mpc512x_psc_spi_unprep_xfer_hw;
  438. master->cleanup = mpc512x_psc_spi_cleanup;
  439. master->dev.of_node = dev->of_node;
  440. tempp = devm_ioremap(dev, regaddr, size);
  441. if (!tempp) {
  442. dev_err(dev, "could not ioremap I/O port range\n");
  443. ret = -EFAULT;
  444. goto free_master;
  445. }
  446. mps->psc = tempp;
  447. mps->fifo =
  448. (struct mpc512x_psc_fifo *)(tempp + sizeof(struct mpc52xx_psc));
  449. ret = devm_request_irq(dev, mps->irq, mpc512x_psc_spi_isr, IRQF_SHARED,
  450. "mpc512x-psc-spi", mps);
  451. if (ret)
  452. goto free_master;
  453. init_completion(&mps->txisrdone);
  454. clk = devm_clk_get(dev, "mclk");
  455. if (IS_ERR(clk)) {
  456. ret = PTR_ERR(clk);
  457. goto free_master;
  458. }
  459. ret = clk_prepare_enable(clk);
  460. if (ret)
  461. goto free_master;
  462. mps->clk_mclk = clk;
  463. mps->mclk_rate = clk_get_rate(clk);
  464. clk = devm_clk_get(dev, "ipg");
  465. if (IS_ERR(clk)) {
  466. ret = PTR_ERR(clk);
  467. goto free_mclk_clock;
  468. }
  469. ret = clk_prepare_enable(clk);
  470. if (ret)
  471. goto free_mclk_clock;
  472. mps->clk_ipg = clk;
  473. ret = mpc512x_psc_spi_port_config(master, mps);
  474. if (ret < 0)
  475. goto free_ipg_clock;
  476. ret = devm_spi_register_master(dev, master);
  477. if (ret < 0)
  478. goto free_ipg_clock;
  479. return ret;
  480. free_ipg_clock:
  481. clk_disable_unprepare(mps->clk_ipg);
  482. free_mclk_clock:
  483. clk_disable_unprepare(mps->clk_mclk);
  484. free_master:
  485. spi_master_put(master);
  486. return ret;
  487. }
  488. static int mpc512x_psc_spi_do_remove(struct device *dev)
  489. {
  490. struct spi_master *master = dev_get_drvdata(dev);
  491. struct mpc512x_psc_spi *mps = spi_master_get_devdata(master);
  492. clk_disable_unprepare(mps->clk_mclk);
  493. clk_disable_unprepare(mps->clk_ipg);
  494. return 0;
  495. }
  496. static int mpc512x_psc_spi_of_probe(struct platform_device *op)
  497. {
  498. const u32 *regaddr_p;
  499. u64 regaddr64, size64;
  500. regaddr_p = of_get_address(op->dev.of_node, 0, &size64, NULL);
  501. if (!regaddr_p) {
  502. dev_err(&op->dev, "Invalid PSC address\n");
  503. return -EINVAL;
  504. }
  505. regaddr64 = of_translate_address(op->dev.of_node, regaddr_p);
  506. return mpc512x_psc_spi_do_probe(&op->dev, (u32) regaddr64, (u32) size64,
  507. irq_of_parse_and_map(op->dev.of_node, 0));
  508. }
  509. static int mpc512x_psc_spi_of_remove(struct platform_device *op)
  510. {
  511. return mpc512x_psc_spi_do_remove(&op->dev);
  512. }
  513. static const struct of_device_id mpc512x_psc_spi_of_match[] = {
  514. { .compatible = "fsl,mpc5121-psc-spi", .data = (void *)TYPE_MPC5121 },
  515. { .compatible = "fsl,mpc5125-psc-spi", .data = (void *)TYPE_MPC5125 },
  516. {},
  517. };
  518. MODULE_DEVICE_TABLE(of, mpc512x_psc_spi_of_match);
  519. static struct platform_driver mpc512x_psc_spi_of_driver = {
  520. .probe = mpc512x_psc_spi_of_probe,
  521. .remove = mpc512x_psc_spi_of_remove,
  522. .driver = {
  523. .name = "mpc512x-psc-spi",
  524. .of_match_table = mpc512x_psc_spi_of_match,
  525. },
  526. };
  527. module_platform_driver(mpc512x_psc_spi_of_driver);
  528. MODULE_AUTHOR("John Rigby");
  529. MODULE_DESCRIPTION("MPC512x PSC SPI Driver");
  530. MODULE_LICENSE("GPL");