spi-s3c24xx.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686
  1. /*
  2. * Copyright (c) 2006 Ben Dooks
  3. * Copyright 2006-2009 Simtec Electronics
  4. * Ben Dooks <ben@simtec.co.uk>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. *
  10. */
  11. #include <linux/init.h>
  12. #include <linux/spinlock.h>
  13. #include <linux/workqueue.h>
  14. #include <linux/interrupt.h>
  15. #include <linux/delay.h>
  16. #include <linux/errno.h>
  17. #include <linux/err.h>
  18. #include <linux/clk.h>
  19. #include <linux/platform_device.h>
  20. #include <linux/gpio.h>
  21. #include <linux/io.h>
  22. #include <linux/slab.h>
  23. #include <linux/spi/spi.h>
  24. #include <linux/spi/spi_bitbang.h>
  25. #include <linux/spi/s3c24xx.h>
  26. #include <linux/module.h>
  27. #include <plat/regs-spi.h>
  28. #include <asm/fiq.h>
  29. #include "spi-s3c24xx-fiq.h"
  30. /**
  31. * s3c24xx_spi_devstate - per device data
  32. * @hz: Last frequency calculated for @sppre field.
  33. * @mode: Last mode setting for the @spcon field.
  34. * @spcon: Value to write to the SPCON register.
  35. * @sppre: Value to write to the SPPRE register.
  36. */
  37. struct s3c24xx_spi_devstate {
  38. unsigned int hz;
  39. unsigned int mode;
  40. u8 spcon;
  41. u8 sppre;
  42. };
  43. enum spi_fiq_mode {
  44. FIQ_MODE_NONE = 0,
  45. FIQ_MODE_TX = 1,
  46. FIQ_MODE_RX = 2,
  47. FIQ_MODE_TXRX = 3,
  48. };
  49. struct s3c24xx_spi {
  50. /* bitbang has to be first */
  51. struct spi_bitbang bitbang;
  52. struct completion done;
  53. void __iomem *regs;
  54. int irq;
  55. int len;
  56. int count;
  57. struct fiq_handler fiq_handler;
  58. enum spi_fiq_mode fiq_mode;
  59. unsigned char fiq_inuse;
  60. unsigned char fiq_claimed;
  61. void (*set_cs)(struct s3c2410_spi_info *spi,
  62. int cs, int pol);
  63. /* data buffers */
  64. const unsigned char *tx;
  65. unsigned char *rx;
  66. struct clk *clk;
  67. struct spi_master *master;
  68. struct spi_device *curdev;
  69. struct device *dev;
  70. struct s3c2410_spi_info *pdata;
  71. };
  72. #define SPCON_DEFAULT (S3C2410_SPCON_MSTR | S3C2410_SPCON_SMOD_INT)
  73. #define SPPIN_DEFAULT (S3C2410_SPPIN_KEEP)
  74. static inline struct s3c24xx_spi *to_hw(struct spi_device *sdev)
  75. {
  76. return spi_master_get_devdata(sdev->master);
  77. }
  78. static void s3c24xx_spi_gpiocs(struct s3c2410_spi_info *spi, int cs, int pol)
  79. {
  80. gpio_set_value(spi->pin_cs, pol);
  81. }
  82. static void s3c24xx_spi_chipsel(struct spi_device *spi, int value)
  83. {
  84. struct s3c24xx_spi_devstate *cs = spi->controller_state;
  85. struct s3c24xx_spi *hw = to_hw(spi);
  86. unsigned int cspol = spi->mode & SPI_CS_HIGH ? 1 : 0;
  87. /* change the chipselect state and the state of the spi engine clock */
  88. switch (value) {
  89. case BITBANG_CS_INACTIVE:
  90. hw->set_cs(hw->pdata, spi->chip_select, cspol^1);
  91. writeb(cs->spcon, hw->regs + S3C2410_SPCON);
  92. break;
  93. case BITBANG_CS_ACTIVE:
  94. writeb(cs->spcon | S3C2410_SPCON_ENSCK,
  95. hw->regs + S3C2410_SPCON);
  96. hw->set_cs(hw->pdata, spi->chip_select, cspol);
  97. break;
  98. }
  99. }
  100. static int s3c24xx_spi_update_state(struct spi_device *spi,
  101. struct spi_transfer *t)
  102. {
  103. struct s3c24xx_spi *hw = to_hw(spi);
  104. struct s3c24xx_spi_devstate *cs = spi->controller_state;
  105. unsigned int bpw;
  106. unsigned int hz;
  107. unsigned int div;
  108. unsigned long clk;
  109. bpw = t ? t->bits_per_word : spi->bits_per_word;
  110. hz = t ? t->speed_hz : spi->max_speed_hz;
  111. if (!bpw)
  112. bpw = 8;
  113. if (!hz)
  114. hz = spi->max_speed_hz;
  115. if (bpw != 8) {
  116. dev_err(&spi->dev, "invalid bits-per-word (%d)\n", bpw);
  117. return -EINVAL;
  118. }
  119. if (spi->mode != cs->mode) {
  120. u8 spcon = SPCON_DEFAULT | S3C2410_SPCON_ENSCK;
  121. if (spi->mode & SPI_CPHA)
  122. spcon |= S3C2410_SPCON_CPHA_FMTB;
  123. if (spi->mode & SPI_CPOL)
  124. spcon |= S3C2410_SPCON_CPOL_HIGH;
  125. cs->mode = spi->mode;
  126. cs->spcon = spcon;
  127. }
  128. if (cs->hz != hz) {
  129. clk = clk_get_rate(hw->clk);
  130. div = DIV_ROUND_UP(clk, hz * 2) - 1;
  131. if (div > 255)
  132. div = 255;
  133. dev_dbg(&spi->dev, "pre-scaler=%d (wanted %d, got %ld)\n",
  134. div, hz, clk / (2 * (div + 1)));
  135. cs->hz = hz;
  136. cs->sppre = div;
  137. }
  138. return 0;
  139. }
  140. static int s3c24xx_spi_setupxfer(struct spi_device *spi,
  141. struct spi_transfer *t)
  142. {
  143. struct s3c24xx_spi_devstate *cs = spi->controller_state;
  144. struct s3c24xx_spi *hw = to_hw(spi);
  145. int ret;
  146. ret = s3c24xx_spi_update_state(spi, t);
  147. if (!ret)
  148. writeb(cs->sppre, hw->regs + S3C2410_SPPRE);
  149. return ret;
  150. }
  151. static int s3c24xx_spi_setup(struct spi_device *spi)
  152. {
  153. struct s3c24xx_spi_devstate *cs = spi->controller_state;
  154. struct s3c24xx_spi *hw = to_hw(spi);
  155. int ret;
  156. /* allocate settings on the first call */
  157. if (!cs) {
  158. cs = kzalloc(sizeof(struct s3c24xx_spi_devstate), GFP_KERNEL);
  159. if (!cs) {
  160. dev_err(&spi->dev, "no memory for controller state\n");
  161. return -ENOMEM;
  162. }
  163. cs->spcon = SPCON_DEFAULT;
  164. cs->hz = -1;
  165. spi->controller_state = cs;
  166. }
  167. /* initialise the state from the device */
  168. ret = s3c24xx_spi_update_state(spi, NULL);
  169. if (ret)
  170. return ret;
  171. spin_lock(&hw->bitbang.lock);
  172. if (!hw->bitbang.busy) {
  173. hw->bitbang.chipselect(spi, BITBANG_CS_INACTIVE);
  174. /* need to ndelay for 0.5 clocktick ? */
  175. }
  176. spin_unlock(&hw->bitbang.lock);
  177. return 0;
  178. }
  179. static void s3c24xx_spi_cleanup(struct spi_device *spi)
  180. {
  181. kfree(spi->controller_state);
  182. }
  183. static inline unsigned int hw_txbyte(struct s3c24xx_spi *hw, int count)
  184. {
  185. return hw->tx ? hw->tx[count] : 0;
  186. }
  187. #ifdef CONFIG_SPI_S3C24XX_FIQ
  188. /* Support for FIQ based pseudo-DMA to improve the transfer speed.
  189. *
  190. * This code uses the assembly helper in spi_s3c24xx_spi.S which is
  191. * used by the FIQ core to move data between main memory and the peripheral
  192. * block. Since this is code running on the processor, there is no problem
  193. * with cache coherency of the buffers, so we can use any buffer we like.
  194. */
  195. /**
  196. * struct spi_fiq_code - FIQ code and header
  197. * @length: The length of the code fragment, excluding this header.
  198. * @ack_offset: The offset from @data to the word to place the IRQ ACK bit at.
  199. * @data: The code itself to install as a FIQ handler.
  200. */
  201. struct spi_fiq_code {
  202. u32 length;
  203. u32 ack_offset;
  204. u8 data[0];
  205. };
  206. extern struct spi_fiq_code s3c24xx_spi_fiq_txrx;
  207. extern struct spi_fiq_code s3c24xx_spi_fiq_tx;
  208. extern struct spi_fiq_code s3c24xx_spi_fiq_rx;
  209. /**
  210. * ack_bit - turn IRQ into IRQ acknowledgement bit
  211. * @irq: The interrupt number
  212. *
  213. * Returns the bit to write to the interrupt acknowledge register.
  214. */
  215. static inline u32 ack_bit(unsigned int irq)
  216. {
  217. return 1 << (irq - IRQ_EINT0);
  218. }
  219. /**
  220. * s3c24xx_spi_tryfiq - attempt to claim and setup FIQ for transfer
  221. * @hw: The hardware state.
  222. *
  223. * Claim the FIQ handler (only one can be active at any one time) and
  224. * then setup the correct transfer code for this transfer.
  225. *
  226. * This call updates all the necessary state information if successful,
  227. * so the caller does not need to do anything more than start the transfer
  228. * as normal, since the IRQ will have been re-routed to the FIQ handler.
  229. */
  230. static void s3c24xx_spi_tryfiq(struct s3c24xx_spi *hw)
  231. {
  232. struct pt_regs regs;
  233. enum spi_fiq_mode mode;
  234. struct spi_fiq_code *code;
  235. int ret;
  236. if (!hw->fiq_claimed) {
  237. /* try and claim fiq if we haven't got it, and if not
  238. * then return and simply use another transfer method */
  239. ret = claim_fiq(&hw->fiq_handler);
  240. if (ret)
  241. return;
  242. }
  243. if (hw->tx && !hw->rx)
  244. mode = FIQ_MODE_TX;
  245. else if (hw->rx && !hw->tx)
  246. mode = FIQ_MODE_RX;
  247. else
  248. mode = FIQ_MODE_TXRX;
  249. regs.uregs[fiq_rspi] = (long)hw->regs;
  250. regs.uregs[fiq_rrx] = (long)hw->rx;
  251. regs.uregs[fiq_rtx] = (long)hw->tx + 1;
  252. regs.uregs[fiq_rcount] = hw->len - 1;
  253. regs.uregs[fiq_rirq] = (long)S3C24XX_VA_IRQ;
  254. set_fiq_regs(&regs);
  255. if (hw->fiq_mode != mode) {
  256. u32 *ack_ptr;
  257. hw->fiq_mode = mode;
  258. switch (mode) {
  259. case FIQ_MODE_TX:
  260. code = &s3c24xx_spi_fiq_tx;
  261. break;
  262. case FIQ_MODE_RX:
  263. code = &s3c24xx_spi_fiq_rx;
  264. break;
  265. case FIQ_MODE_TXRX:
  266. code = &s3c24xx_spi_fiq_txrx;
  267. break;
  268. default:
  269. code = NULL;
  270. }
  271. BUG_ON(!code);
  272. ack_ptr = (u32 *)&code->data[code->ack_offset];
  273. *ack_ptr = ack_bit(hw->irq);
  274. set_fiq_handler(&code->data, code->length);
  275. }
  276. s3c24xx_set_fiq(hw->irq, true);
  277. hw->fiq_mode = mode;
  278. hw->fiq_inuse = 1;
  279. }
  280. /**
  281. * s3c24xx_spi_fiqop - FIQ core code callback
  282. * @pw: Data registered with the handler
  283. * @release: Whether this is a release or a return.
  284. *
  285. * Called by the FIQ code when another module wants to use the FIQ, so
  286. * return whether we are currently using this or not and then update our
  287. * internal state.
  288. */
  289. static int s3c24xx_spi_fiqop(void *pw, int release)
  290. {
  291. struct s3c24xx_spi *hw = pw;
  292. int ret = 0;
  293. if (release) {
  294. if (hw->fiq_inuse)
  295. ret = -EBUSY;
  296. /* note, we do not need to unroute the FIQ, as the FIQ
  297. * vector code de-routes it to signal the end of transfer */
  298. hw->fiq_mode = FIQ_MODE_NONE;
  299. hw->fiq_claimed = 0;
  300. } else {
  301. hw->fiq_claimed = 1;
  302. }
  303. return ret;
  304. }
  305. /**
  306. * s3c24xx_spi_initfiq - setup the information for the FIQ core
  307. * @hw: The hardware state.
  308. *
  309. * Setup the fiq_handler block to pass to the FIQ core.
  310. */
  311. static inline void s3c24xx_spi_initfiq(struct s3c24xx_spi *hw)
  312. {
  313. hw->fiq_handler.dev_id = hw;
  314. hw->fiq_handler.name = dev_name(hw->dev);
  315. hw->fiq_handler.fiq_op = s3c24xx_spi_fiqop;
  316. }
  317. /**
  318. * s3c24xx_spi_usefiq - return if we should be using FIQ.
  319. * @hw: The hardware state.
  320. *
  321. * Return true if the platform data specifies whether this channel is
  322. * allowed to use the FIQ.
  323. */
  324. static inline bool s3c24xx_spi_usefiq(struct s3c24xx_spi *hw)
  325. {
  326. return hw->pdata->use_fiq;
  327. }
  328. /**
  329. * s3c24xx_spi_usingfiq - return if channel is using FIQ
  330. * @spi: The hardware state.
  331. *
  332. * Return whether the channel is currently using the FIQ (separate from
  333. * whether the FIQ is claimed).
  334. */
  335. static inline bool s3c24xx_spi_usingfiq(struct s3c24xx_spi *spi)
  336. {
  337. return spi->fiq_inuse;
  338. }
  339. #else
  340. static inline void s3c24xx_spi_initfiq(struct s3c24xx_spi *s) { }
  341. static inline void s3c24xx_spi_tryfiq(struct s3c24xx_spi *s) { }
  342. static inline bool s3c24xx_spi_usefiq(struct s3c24xx_spi *s) { return false; }
  343. static inline bool s3c24xx_spi_usingfiq(struct s3c24xx_spi *s) { return false; }
  344. #endif /* CONFIG_SPI_S3C24XX_FIQ */
  345. static int s3c24xx_spi_txrx(struct spi_device *spi, struct spi_transfer *t)
  346. {
  347. struct s3c24xx_spi *hw = to_hw(spi);
  348. hw->tx = t->tx_buf;
  349. hw->rx = t->rx_buf;
  350. hw->len = t->len;
  351. hw->count = 0;
  352. init_completion(&hw->done);
  353. hw->fiq_inuse = 0;
  354. if (s3c24xx_spi_usefiq(hw) && t->len >= 3)
  355. s3c24xx_spi_tryfiq(hw);
  356. /* send the first byte */
  357. writeb(hw_txbyte(hw, 0), hw->regs + S3C2410_SPTDAT);
  358. wait_for_completion(&hw->done);
  359. return hw->count;
  360. }
  361. static irqreturn_t s3c24xx_spi_irq(int irq, void *dev)
  362. {
  363. struct s3c24xx_spi *hw = dev;
  364. unsigned int spsta = readb(hw->regs + S3C2410_SPSTA);
  365. unsigned int count = hw->count;
  366. if (spsta & S3C2410_SPSTA_DCOL) {
  367. dev_dbg(hw->dev, "data-collision\n");
  368. complete(&hw->done);
  369. goto irq_done;
  370. }
  371. if (!(spsta & S3C2410_SPSTA_READY)) {
  372. dev_dbg(hw->dev, "spi not ready for tx?\n");
  373. complete(&hw->done);
  374. goto irq_done;
  375. }
  376. if (!s3c24xx_spi_usingfiq(hw)) {
  377. hw->count++;
  378. if (hw->rx)
  379. hw->rx[count] = readb(hw->regs + S3C2410_SPRDAT);
  380. count++;
  381. if (count < hw->len)
  382. writeb(hw_txbyte(hw, count), hw->regs + S3C2410_SPTDAT);
  383. else
  384. complete(&hw->done);
  385. } else {
  386. hw->count = hw->len;
  387. hw->fiq_inuse = 0;
  388. if (hw->rx)
  389. hw->rx[hw->len-1] = readb(hw->regs + S3C2410_SPRDAT);
  390. complete(&hw->done);
  391. }
  392. irq_done:
  393. return IRQ_HANDLED;
  394. }
  395. static void s3c24xx_spi_initialsetup(struct s3c24xx_spi *hw)
  396. {
  397. /* for the moment, permanently enable the clock */
  398. clk_enable(hw->clk);
  399. /* program defaults into the registers */
  400. writeb(0xff, hw->regs + S3C2410_SPPRE);
  401. writeb(SPPIN_DEFAULT, hw->regs + S3C2410_SPPIN);
  402. writeb(SPCON_DEFAULT, hw->regs + S3C2410_SPCON);
  403. if (hw->pdata) {
  404. if (hw->set_cs == s3c24xx_spi_gpiocs)
  405. gpio_direction_output(hw->pdata->pin_cs, 1);
  406. if (hw->pdata->gpio_setup)
  407. hw->pdata->gpio_setup(hw->pdata, 1);
  408. }
  409. }
  410. static int s3c24xx_spi_probe(struct platform_device *pdev)
  411. {
  412. struct s3c2410_spi_info *pdata;
  413. struct s3c24xx_spi *hw;
  414. struct spi_master *master;
  415. struct resource *res;
  416. int err = 0;
  417. master = spi_alloc_master(&pdev->dev, sizeof(struct s3c24xx_spi));
  418. if (master == NULL) {
  419. dev_err(&pdev->dev, "No memory for spi_master\n");
  420. return -ENOMEM;
  421. }
  422. hw = spi_master_get_devdata(master);
  423. memset(hw, 0, sizeof(struct s3c24xx_spi));
  424. hw->master = master;
  425. hw->pdata = pdata = dev_get_platdata(&pdev->dev);
  426. hw->dev = &pdev->dev;
  427. if (pdata == NULL) {
  428. dev_err(&pdev->dev, "No platform data supplied\n");
  429. err = -ENOENT;
  430. goto err_no_pdata;
  431. }
  432. platform_set_drvdata(pdev, hw);
  433. init_completion(&hw->done);
  434. /* initialise fiq handler */
  435. s3c24xx_spi_initfiq(hw);
  436. /* setup the master state. */
  437. /* the spi->mode bits understood by this driver: */
  438. master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
  439. master->num_chipselect = hw->pdata->num_cs;
  440. master->bus_num = pdata->bus_num;
  441. /* setup the state for the bitbang driver */
  442. hw->bitbang.master = hw->master;
  443. hw->bitbang.setup_transfer = s3c24xx_spi_setupxfer;
  444. hw->bitbang.chipselect = s3c24xx_spi_chipsel;
  445. hw->bitbang.txrx_bufs = s3c24xx_spi_txrx;
  446. hw->master->setup = s3c24xx_spi_setup;
  447. hw->master->cleanup = s3c24xx_spi_cleanup;
  448. dev_dbg(hw->dev, "bitbang at %p\n", &hw->bitbang);
  449. /* find and map our resources */
  450. res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  451. hw->regs = devm_ioremap_resource(&pdev->dev, res);
  452. if (IS_ERR(hw->regs)) {
  453. err = PTR_ERR(hw->regs);
  454. goto err_no_pdata;
  455. }
  456. hw->irq = platform_get_irq(pdev, 0);
  457. if (hw->irq < 0) {
  458. dev_err(&pdev->dev, "No IRQ specified\n");
  459. err = -ENOENT;
  460. goto err_no_pdata;
  461. }
  462. err = devm_request_irq(&pdev->dev, hw->irq, s3c24xx_spi_irq, 0,
  463. pdev->name, hw);
  464. if (err) {
  465. dev_err(&pdev->dev, "Cannot claim IRQ\n");
  466. goto err_no_pdata;
  467. }
  468. hw->clk = devm_clk_get(&pdev->dev, "spi");
  469. if (IS_ERR(hw->clk)) {
  470. dev_err(&pdev->dev, "No clock for device\n");
  471. err = PTR_ERR(hw->clk);
  472. goto err_no_pdata;
  473. }
  474. /* setup any gpio we can */
  475. if (!pdata->set_cs) {
  476. if (pdata->pin_cs < 0) {
  477. dev_err(&pdev->dev, "No chipselect pin\n");
  478. err = -EINVAL;
  479. goto err_register;
  480. }
  481. err = devm_gpio_request(&pdev->dev, pdata->pin_cs,
  482. dev_name(&pdev->dev));
  483. if (err) {
  484. dev_err(&pdev->dev, "Failed to get gpio for cs\n");
  485. goto err_register;
  486. }
  487. hw->set_cs = s3c24xx_spi_gpiocs;
  488. gpio_direction_output(pdata->pin_cs, 1);
  489. } else
  490. hw->set_cs = pdata->set_cs;
  491. s3c24xx_spi_initialsetup(hw);
  492. /* register our spi controller */
  493. err = spi_bitbang_start(&hw->bitbang);
  494. if (err) {
  495. dev_err(&pdev->dev, "Failed to register SPI master\n");
  496. goto err_register;
  497. }
  498. return 0;
  499. err_register:
  500. clk_disable(hw->clk);
  501. err_no_pdata:
  502. spi_master_put(hw->master);
  503. return err;
  504. }
  505. static int s3c24xx_spi_remove(struct platform_device *dev)
  506. {
  507. struct s3c24xx_spi *hw = platform_get_drvdata(dev);
  508. spi_bitbang_stop(&hw->bitbang);
  509. clk_disable(hw->clk);
  510. spi_master_put(hw->master);
  511. return 0;
  512. }
  513. #ifdef CONFIG_PM
  514. static int s3c24xx_spi_suspend(struct device *dev)
  515. {
  516. struct s3c24xx_spi *hw = dev_get_drvdata(dev);
  517. if (hw->pdata && hw->pdata->gpio_setup)
  518. hw->pdata->gpio_setup(hw->pdata, 0);
  519. clk_disable(hw->clk);
  520. return 0;
  521. }
  522. static int s3c24xx_spi_resume(struct device *dev)
  523. {
  524. struct s3c24xx_spi *hw = dev_get_drvdata(dev);
  525. s3c24xx_spi_initialsetup(hw);
  526. return 0;
  527. }
  528. static const struct dev_pm_ops s3c24xx_spi_pmops = {
  529. .suspend = s3c24xx_spi_suspend,
  530. .resume = s3c24xx_spi_resume,
  531. };
  532. #define S3C24XX_SPI_PMOPS &s3c24xx_spi_pmops
  533. #else
  534. #define S3C24XX_SPI_PMOPS NULL
  535. #endif /* CONFIG_PM */
  536. MODULE_ALIAS("platform:s3c2410-spi");
  537. static struct platform_driver s3c24xx_spi_driver = {
  538. .probe = s3c24xx_spi_probe,
  539. .remove = s3c24xx_spi_remove,
  540. .driver = {
  541. .name = "s3c2410-spi",
  542. .owner = THIS_MODULE,
  543. .pm = S3C24XX_SPI_PMOPS,
  544. },
  545. };
  546. module_platform_driver(s3c24xx_spi_driver);
  547. MODULE_DESCRIPTION("S3C24XX SPI Driver");
  548. MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>");
  549. MODULE_LICENSE("GPL");