1 // SPDX-License-Identifier: GPL-2.0-only
2 // Copyright (c) 2021 Sunplus Inc.
3 // Author: Li-hao Kuo <lhjeff911@gmail.com>
5 #include <linux/bitfield.h>
7 #include <linux/delay.h>
8 #include <linux/dma-mapping.h>
9 #include <linux/interrupt.h>
10 #include <linux/module.h>
12 #include <linux/platform_device.h>
13 #include <linux/pm_runtime.h>
14 #include <linux/reset.h>
15 #include <linux/spi/spi.h>
17 #define SP7021_DATA_RDY_REG 0x0044
18 #define SP7021_SLAVE_DMA_CTRL_REG 0x0048
19 #define SP7021_SLAVE_DMA_LENGTH_REG 0x004c
20 #define SP7021_SLAVE_DMA_ADDR_REG 0x004c
22 #define SP7021_SLAVE_DATA_RDY BIT(0)
23 #define SP7021_SLAVE_SW_RST BIT(1)
24 #define SP7021_SLA_DMA_W_INT BIT(8)
25 #define SP7021_SLAVE_CLR_INT BIT(8)
26 #define SP7021_SLAVE_DMA_EN BIT(0)
27 #define SP7021_SLAVE_DMA_RW BIT(6)
28 #define SP7021_SLAVE_DMA_CMD GENMASK(3, 2)
30 #define SP7021_FIFO_REG 0x0034
31 #define SP7021_SPI_STATUS_REG 0x0038
32 #define SP7021_SPI_CONFIG_REG 0x003c
33 #define SP7021_INT_BUSY_REG 0x004c
34 #define SP7021_DMA_CTRL_REG 0x0050
36 #define SP7021_SPI_START_FD BIT(0)
37 #define SP7021_FD_SW_RST BIT(1)
38 #define SP7021_TX_EMP_FLAG BIT(2)
39 #define SP7021_RX_EMP_FLAG BIT(4)
40 #define SP7021_RX_FULL_FLAG BIT(5)
41 #define SP7021_FINISH_FLAG BIT(6)
43 #define SP7021_TX_CNT_MASK GENMASK(11, 8)
44 #define SP7021_RX_CNT_MASK GENMASK(15, 12)
45 #define SP7021_TX_LEN_MASK GENMASK(23, 16)
46 #define SP7021_GET_LEN_MASK GENMASK(31, 24)
47 #define SP7021_SET_TX_LEN GENMASK(23, 16)
48 #define SP7021_SET_XFER_LEN GENMASK(31, 24)
50 #define SP7021_CPOL_FD BIT(0)
51 #define SP7021_CPHA_R BIT(1)
52 #define SP7021_CPHA_W BIT(2)
53 #define SP7021_LSB_SEL BIT(4)
54 #define SP7021_CS_POR BIT(5)
55 #define SP7021_FD_SEL BIT(6)
57 #define SP7021_RX_UNIT GENMASK(8, 7)
58 #define SP7021_TX_UNIT GENMASK(10, 9)
59 #define SP7021_TX_EMP_FLAG_MASK BIT(11)
60 #define SP7021_RX_FULL_FLAG_MASK BIT(14)
61 #define SP7021_FINISH_FLAG_MASK BIT(15)
62 #define SP7021_CLEAN_RW_BYTE GENMASK(10, 7)
63 #define SP7021_CLEAN_FLUG_MASK GENMASK(15, 11)
64 #define SP7021_CLK_MASK GENMASK(31, 16)
66 #define SP7021_INT_BYPASS BIT(3)
67 #define SP7021_CLR_MASTER_INT BIT(6)
69 #define SP7021_SPI_DATA_SIZE (255)
70 #define SP7021_FIFO_DATA_LEN (16)
74 SP7021_TARGET_MODE
= 1,
77 struct sp7021_spi_ctlr
{
79 struct spi_controller
*ctlr
;
87 struct reset_control
*rstc
;
89 struct mutex buf_lock
;
90 struct completion isr_done
;
91 struct completion target_isr
;
92 unsigned int rx_cur_len
;
93 unsigned int tx_cur_len
;
94 unsigned int data_unit
;
99 static irqreturn_t
sp7021_spi_target_irq(int irq
, void *dev
)
101 struct sp7021_spi_ctlr
*pspim
= dev
;
102 unsigned int data_status
;
104 data_status
= readl(pspim
->s_base
+ SP7021_DATA_RDY_REG
);
105 data_status
|= SP7021_SLAVE_CLR_INT
;
106 writel(data_status
, pspim
->s_base
+ SP7021_DATA_RDY_REG
);
107 complete(&pspim
->target_isr
);
111 static int sp7021_spi_target_abort(struct spi_controller
*ctlr
)
113 struct sp7021_spi_ctlr
*pspim
= spi_controller_get_devdata(ctlr
);
115 complete(&pspim
->target_isr
);
116 complete(&pspim
->isr_done
);
120 static int sp7021_spi_target_tx(struct spi_device
*spi
, struct spi_transfer
*xfer
)
122 struct sp7021_spi_ctlr
*pspim
= spi_controller_get_devdata(spi
->controller
);
125 reinit_completion(&pspim
->target_isr
);
126 value
= SP7021_SLAVE_DMA_EN
| SP7021_SLAVE_DMA_RW
| FIELD_PREP(SP7021_SLAVE_DMA_CMD
, 3);
127 writel(value
, pspim
->s_base
+ SP7021_SLAVE_DMA_CTRL_REG
);
128 writel(xfer
->len
, pspim
->s_base
+ SP7021_SLAVE_DMA_LENGTH_REG
);
129 writel(xfer
->tx_dma
, pspim
->s_base
+ SP7021_SLAVE_DMA_ADDR_REG
);
130 value
= readl(pspim
->s_base
+ SP7021_DATA_RDY_REG
);
131 value
|= SP7021_SLAVE_DATA_RDY
;
132 writel(value
, pspim
->s_base
+ SP7021_DATA_RDY_REG
);
133 if (wait_for_completion_interruptible(&pspim
->isr_done
)) {
134 dev_err(&spi
->dev
, "%s() wait_for_completion err\n", __func__
);
140 static int sp7021_spi_target_rx(struct spi_device
*spi
, struct spi_transfer
*xfer
)
142 struct sp7021_spi_ctlr
*pspim
= spi_controller_get_devdata(spi
->controller
);
145 reinit_completion(&pspim
->isr_done
);
146 value
= SP7021_SLAVE_DMA_EN
| FIELD_PREP(SP7021_SLAVE_DMA_CMD
, 3);
147 writel(value
, pspim
->s_base
+ SP7021_SLAVE_DMA_CTRL_REG
);
148 writel(xfer
->len
, pspim
->s_base
+ SP7021_SLAVE_DMA_LENGTH_REG
);
149 writel(xfer
->rx_dma
, pspim
->s_base
+ SP7021_SLAVE_DMA_ADDR_REG
);
150 if (wait_for_completion_interruptible(&pspim
->isr_done
)) {
151 dev_err(&spi
->dev
, "%s() wait_for_completion err\n", __func__
);
154 writel(SP7021_SLAVE_SW_RST
, pspim
->s_base
+ SP7021_SLAVE_DMA_CTRL_REG
);
158 static void sp7021_spi_host_rb(struct sp7021_spi_ctlr
*pspim
, unsigned int len
)
162 for (i
= 0; i
< len
; i
++) {
163 pspim
->rx_buf
[pspim
->rx_cur_len
] =
164 readl(pspim
->m_base
+ SP7021_FIFO_REG
);
169 static void sp7021_spi_host_wb(struct sp7021_spi_ctlr
*pspim
, unsigned int len
)
173 for (i
= 0; i
< len
; i
++) {
174 writel(pspim
->tx_buf
[pspim
->tx_cur_len
],
175 pspim
->m_base
+ SP7021_FIFO_REG
);
180 static irqreturn_t
sp7021_spi_host_irq(int irq
, void *dev
)
182 struct sp7021_spi_ctlr
*pspim
= dev
;
183 unsigned int tx_cnt
, total_len
;
184 unsigned int tx_len
, rx_cnt
;
185 unsigned int fd_status
;
186 bool isrdone
= false;
189 fd_status
= readl(pspim
->m_base
+ SP7021_SPI_STATUS_REG
);
190 tx_cnt
= FIELD_GET(SP7021_TX_CNT_MASK
, fd_status
);
191 tx_len
= FIELD_GET(SP7021_TX_LEN_MASK
, fd_status
);
192 total_len
= FIELD_GET(SP7021_GET_LEN_MASK
, fd_status
);
194 if ((fd_status
& SP7021_TX_EMP_FLAG
) && (fd_status
& SP7021_RX_EMP_FLAG
) && total_len
== 0)
197 if (tx_len
== 0 && total_len
== 0)
200 rx_cnt
= FIELD_GET(SP7021_RX_CNT_MASK
, fd_status
);
201 if (fd_status
& SP7021_RX_FULL_FLAG
)
202 rx_cnt
= pspim
->data_unit
;
204 tx_cnt
= min(tx_len
- pspim
->tx_cur_len
, pspim
->data_unit
- tx_cnt
);
205 dev_dbg(pspim
->dev
, "fd_st=0x%x rx_c:%d tx_c:%d tx_l:%d",
206 fd_status
, rx_cnt
, tx_cnt
, tx_len
);
209 sp7021_spi_host_rb(pspim
, rx_cnt
);
211 sp7021_spi_host_wb(pspim
, tx_cnt
);
213 fd_status
= readl(pspim
->m_base
+ SP7021_SPI_STATUS_REG
);
214 tx_len
= FIELD_GET(SP7021_TX_LEN_MASK
, fd_status
);
215 total_len
= FIELD_GET(SP7021_GET_LEN_MASK
, fd_status
);
217 if (fd_status
& SP7021_FINISH_FLAG
|| tx_len
== pspim
->tx_cur_len
) {
218 while (total_len
!= pspim
->rx_cur_len
) {
219 fd_status
= readl(pspim
->m_base
+ SP7021_SPI_STATUS_REG
);
220 total_len
= FIELD_GET(SP7021_GET_LEN_MASK
, fd_status
);
221 if (fd_status
& SP7021_RX_FULL_FLAG
)
222 rx_cnt
= pspim
->data_unit
;
224 rx_cnt
= FIELD_GET(SP7021_RX_CNT_MASK
, fd_status
);
227 sp7021_spi_host_rb(pspim
, rx_cnt
);
229 value
= readl(pspim
->m_base
+ SP7021_INT_BUSY_REG
);
230 value
|= SP7021_CLR_MASTER_INT
;
231 writel(value
, pspim
->m_base
+ SP7021_INT_BUSY_REG
);
232 writel(SP7021_FINISH_FLAG
, pspim
->m_base
+ SP7021_SPI_STATUS_REG
);
237 complete(&pspim
->isr_done
);
241 static void sp7021_prep_transfer(struct spi_controller
*ctlr
, struct spi_device
*spi
)
243 struct sp7021_spi_ctlr
*pspim
= spi_controller_get_devdata(ctlr
);
245 pspim
->tx_cur_len
= 0;
246 pspim
->rx_cur_len
= 0;
247 pspim
->data_unit
= SP7021_FIFO_DATA_LEN
;
250 // preliminary set CS, CPOL, CPHA and LSB
251 static int sp7021_spi_controller_prepare_message(struct spi_controller
*ctlr
,
252 struct spi_message
*msg
)
254 struct sp7021_spi_ctlr
*pspim
= spi_controller_get_devdata(ctlr
);
255 struct spi_device
*s
= msg
->spi
;
258 valus
= readl(pspim
->m_base
+ SP7021_SPI_STATUS_REG
);
259 valus
|= SP7021_FD_SW_RST
;
260 writel(valus
, pspim
->m_base
+ SP7021_SPI_STATUS_REG
);
262 if (s
->mode
& SPI_CPOL
)
263 rs
|= SP7021_CPOL_FD
;
265 if (s
->mode
& SPI_LSB_FIRST
)
266 rs
|= SP7021_LSB_SEL
;
268 if (s
->mode
& SPI_CS_HIGH
)
271 if (s
->mode
& SPI_CPHA
)
276 rs
|= FIELD_PREP(SP7021_TX_UNIT
, 0) | FIELD_PREP(SP7021_RX_UNIT
, 0);
277 pspim
->xfer_conf
= rs
;
278 if (pspim
->xfer_conf
& SP7021_CPOL_FD
)
279 writel(pspim
->xfer_conf
, pspim
->m_base
+ SP7021_SPI_CONFIG_REG
);
284 static void sp7021_spi_setup_clk(struct spi_controller
*ctlr
, struct spi_transfer
*xfer
)
286 struct sp7021_spi_ctlr
*pspim
= spi_controller_get_devdata(ctlr
);
287 u32 clk_rate
, clk_sel
, div
;
289 clk_rate
= clk_get_rate(pspim
->spi_clk
);
290 div
= max(2U, clk_rate
/ xfer
->speed_hz
);
292 clk_sel
= (div
/ 2) - 1;
293 pspim
->xfer_conf
&= ~SP7021_CLK_MASK
;
294 pspim
->xfer_conf
|= FIELD_PREP(SP7021_CLK_MASK
, clk_sel
);
295 writel(pspim
->xfer_conf
, pspim
->m_base
+ SP7021_SPI_CONFIG_REG
);
298 static int sp7021_spi_host_transfer_one(struct spi_controller
*ctlr
, struct spi_device
*spi
,
299 struct spi_transfer
*xfer
)
301 struct sp7021_spi_ctlr
*pspim
= spi_controller_get_devdata(ctlr
);
302 unsigned long timeout
= msecs_to_jiffies(1000);
303 unsigned int xfer_cnt
, xfer_len
, last_len
;
304 unsigned int i
, len_temp
;
307 xfer_cnt
= xfer
->len
/ SP7021_SPI_DATA_SIZE
;
308 last_len
= xfer
->len
% SP7021_SPI_DATA_SIZE
;
310 for (i
= 0; i
<= xfer_cnt
; i
++) {
311 mutex_lock(&pspim
->buf_lock
);
312 sp7021_prep_transfer(ctlr
, spi
);
313 sp7021_spi_setup_clk(ctlr
, xfer
);
314 reinit_completion(&pspim
->isr_done
);
319 xfer_len
= SP7021_SPI_DATA_SIZE
;
321 pspim
->tx_buf
= xfer
->tx_buf
+ i
* SP7021_SPI_DATA_SIZE
;
322 pspim
->rx_buf
= xfer
->rx_buf
+ i
* SP7021_SPI_DATA_SIZE
;
324 if (pspim
->tx_cur_len
< xfer_len
) {
325 len_temp
= min(pspim
->data_unit
, xfer_len
);
326 sp7021_spi_host_wb(pspim
, len_temp
);
328 reg_temp
= readl(pspim
->m_base
+ SP7021_SPI_CONFIG_REG
);
329 reg_temp
&= ~SP7021_CLEAN_RW_BYTE
;
330 reg_temp
&= ~SP7021_CLEAN_FLUG_MASK
;
331 reg_temp
|= SP7021_FD_SEL
| SP7021_FINISH_FLAG_MASK
|
332 SP7021_TX_EMP_FLAG_MASK
| SP7021_RX_FULL_FLAG_MASK
|
333 FIELD_PREP(SP7021_TX_UNIT
, 0) | FIELD_PREP(SP7021_RX_UNIT
, 0);
334 writel(reg_temp
, pspim
->m_base
+ SP7021_SPI_CONFIG_REG
);
336 reg_temp
= FIELD_PREP(SP7021_SET_TX_LEN
, xfer_len
) |
337 FIELD_PREP(SP7021_SET_XFER_LEN
, xfer_len
) |
339 writel(reg_temp
, pspim
->m_base
+ SP7021_SPI_STATUS_REG
);
341 if (!wait_for_completion_interruptible_timeout(&pspim
->isr_done
, timeout
)) {
342 dev_err(&spi
->dev
, "wait_for_completion err\n");
343 mutex_unlock(&pspim
->buf_lock
);
347 reg_temp
= readl(pspim
->m_base
+ SP7021_SPI_STATUS_REG
);
348 if (reg_temp
& SP7021_FINISH_FLAG
) {
349 writel(SP7021_FINISH_FLAG
, pspim
->m_base
+ SP7021_SPI_STATUS_REG
);
350 writel(readl(pspim
->m_base
+ SP7021_SPI_CONFIG_REG
) &
351 SP7021_CLEAN_FLUG_MASK
, pspim
->m_base
+ SP7021_SPI_CONFIG_REG
);
354 if (pspim
->xfer_conf
& SP7021_CPOL_FD
)
355 writel(pspim
->xfer_conf
, pspim
->m_base
+ SP7021_SPI_CONFIG_REG
);
357 mutex_unlock(&pspim
->buf_lock
);
362 static int sp7021_spi_target_transfer_one(struct spi_controller
*ctlr
, struct spi_device
*spi
,
363 struct spi_transfer
*xfer
)
365 struct sp7021_spi_ctlr
*pspim
= spi_controller_get_devdata(ctlr
);
366 struct device
*dev
= pspim
->dev
;
369 if (xfer
->tx_buf
&& !xfer
->rx_buf
) {
370 xfer
->tx_dma
= dma_map_single(dev
, (void *)xfer
->tx_buf
,
371 xfer
->len
, DMA_TO_DEVICE
);
372 if (dma_mapping_error(dev
, xfer
->tx_dma
))
374 ret
= sp7021_spi_target_tx(spi
, xfer
);
375 dma_unmap_single(dev
, xfer
->tx_dma
, xfer
->len
, DMA_TO_DEVICE
);
376 } else if (xfer
->rx_buf
&& !xfer
->tx_buf
) {
377 xfer
->rx_dma
= dma_map_single(dev
, xfer
->rx_buf
, xfer
->len
,
379 if (dma_mapping_error(dev
, xfer
->rx_dma
))
381 ret
= sp7021_spi_target_rx(spi
, xfer
);
382 dma_unmap_single(dev
, xfer
->rx_dma
, xfer
->len
, DMA_FROM_DEVICE
);
384 dev_dbg(&ctlr
->dev
, "%s() wrong command\n", __func__
);
388 spi_finalize_current_transfer(ctlr
);
392 static void sp7021_spi_disable_unprepare(void *data
)
394 clk_disable_unprepare(data
);
397 static void sp7021_spi_reset_control_assert(void *data
)
399 reset_control_assert(data
);
402 static int sp7021_spi_controller_probe(struct platform_device
*pdev
)
404 struct device
*dev
= &pdev
->dev
;
405 struct sp7021_spi_ctlr
*pspim
;
406 struct spi_controller
*ctlr
;
409 pdev
->id
= of_alias_get_id(pdev
->dev
.of_node
, "sp_spi");
411 if (device_property_read_bool(dev
, "spi-slave"))
412 mode
= SP7021_TARGET_MODE
;
414 mode
= SP7021_HOST_MODE
;
416 if (mode
== SP7021_TARGET_MODE
)
417 ctlr
= devm_spi_alloc_target(dev
, sizeof(*pspim
));
419 ctlr
= devm_spi_alloc_host(dev
, sizeof(*pspim
));
422 device_set_node(&ctlr
->dev
, dev_fwnode(dev
));
423 ctlr
->bus_num
= pdev
->id
;
424 ctlr
->mode_bits
= SPI_CPOL
| SPI_CPHA
| SPI_CS_HIGH
| SPI_LSB_FIRST
;
425 ctlr
->auto_runtime_pm
= true;
426 ctlr
->prepare_message
= sp7021_spi_controller_prepare_message
;
427 if (mode
== SP7021_TARGET_MODE
) {
428 ctlr
->transfer_one
= sp7021_spi_target_transfer_one
;
429 ctlr
->target_abort
= sp7021_spi_target_abort
;
430 ctlr
->flags
= SPI_CONTROLLER_HALF_DUPLEX
;
432 ctlr
->bits_per_word_mask
= SPI_BPW_MASK(8);
433 ctlr
->min_speed_hz
= 40000;
434 ctlr
->max_speed_hz
= 25000000;
435 ctlr
->use_gpio_descriptors
= true;
436 ctlr
->flags
= SPI_CONTROLLER_MUST_RX
| SPI_CONTROLLER_MUST_TX
;
437 ctlr
->transfer_one
= sp7021_spi_host_transfer_one
;
439 platform_set_drvdata(pdev
, ctlr
);
440 pspim
= spi_controller_get_devdata(ctlr
);
444 mutex_init(&pspim
->buf_lock
);
445 init_completion(&pspim
->isr_done
);
446 init_completion(&pspim
->target_isr
);
448 pspim
->m_base
= devm_platform_ioremap_resource_byname(pdev
, "master");
449 if (IS_ERR(pspim
->m_base
))
450 return dev_err_probe(dev
, PTR_ERR(pspim
->m_base
), "m_base get fail\n");
452 pspim
->s_base
= devm_platform_ioremap_resource_byname(pdev
, "slave");
453 if (IS_ERR(pspim
->s_base
))
454 return dev_err_probe(dev
, PTR_ERR(pspim
->s_base
), "s_base get fail\n");
456 pspim
->m_irq
= platform_get_irq_byname(pdev
, "master_risc");
457 if (pspim
->m_irq
< 0)
460 pspim
->s_irq
= platform_get_irq_byname(pdev
, "slave_risc");
461 if (pspim
->s_irq
< 0)
464 pspim
->spi_clk
= devm_clk_get(dev
, NULL
);
465 if (IS_ERR(pspim
->spi_clk
))
466 return dev_err_probe(dev
, PTR_ERR(pspim
->spi_clk
), "clk get fail\n");
468 pspim
->rstc
= devm_reset_control_get_exclusive(dev
, NULL
);
469 if (IS_ERR(pspim
->rstc
))
470 return dev_err_probe(dev
, PTR_ERR(pspim
->rstc
), "rst get fail\n");
472 ret
= clk_prepare_enable(pspim
->spi_clk
);
474 return dev_err_probe(dev
, ret
, "failed to enable clk\n");
476 ret
= devm_add_action_or_reset(dev
, sp7021_spi_disable_unprepare
, pspim
->spi_clk
);
480 ret
= reset_control_deassert(pspim
->rstc
);
482 return dev_err_probe(dev
, ret
, "failed to deassert reset\n");
484 ret
= devm_add_action_or_reset(dev
, sp7021_spi_reset_control_assert
, pspim
->rstc
);
488 ret
= devm_request_irq(dev
, pspim
->m_irq
, sp7021_spi_host_irq
,
489 IRQF_TRIGGER_RISING
, pdev
->name
, pspim
);
493 ret
= devm_request_irq(dev
, pspim
->s_irq
, sp7021_spi_target_irq
,
494 IRQF_TRIGGER_RISING
, pdev
->name
, pspim
);
498 pm_runtime_enable(dev
);
499 ret
= spi_register_controller(ctlr
);
501 pm_runtime_disable(dev
);
502 return dev_err_probe(dev
, ret
, "spi_register_controller fail\n");
507 static void sp7021_spi_controller_remove(struct platform_device
*pdev
)
509 struct spi_controller
*ctlr
= dev_get_drvdata(&pdev
->dev
);
511 spi_unregister_controller(ctlr
);
512 pm_runtime_disable(&pdev
->dev
);
513 pm_runtime_set_suspended(&pdev
->dev
);
516 static int __maybe_unused
sp7021_spi_controller_suspend(struct device
*dev
)
518 struct spi_controller
*ctlr
= dev_get_drvdata(dev
);
519 struct sp7021_spi_ctlr
*pspim
= spi_controller_get_devdata(ctlr
);
521 return reset_control_assert(pspim
->rstc
);
524 static int __maybe_unused
sp7021_spi_controller_resume(struct device
*dev
)
526 struct spi_controller
*ctlr
= dev_get_drvdata(dev
);
527 struct sp7021_spi_ctlr
*pspim
= spi_controller_get_devdata(ctlr
);
529 reset_control_deassert(pspim
->rstc
);
530 return clk_prepare_enable(pspim
->spi_clk
);
534 static int sp7021_spi_runtime_suspend(struct device
*dev
)
536 struct spi_controller
*ctlr
= dev_get_drvdata(dev
);
537 struct sp7021_spi_ctlr
*pspim
= spi_controller_get_devdata(ctlr
);
539 return reset_control_assert(pspim
->rstc
);
542 static int sp7021_spi_runtime_resume(struct device
*dev
)
544 struct spi_controller
*ctlr
= dev_get_drvdata(dev
);
545 struct sp7021_spi_ctlr
*pspim
= spi_controller_get_devdata(ctlr
);
547 return reset_control_deassert(pspim
->rstc
);
551 static const struct dev_pm_ops sp7021_spi_pm_ops
= {
552 SET_RUNTIME_PM_OPS(sp7021_spi_runtime_suspend
,
553 sp7021_spi_runtime_resume
, NULL
)
554 SET_SYSTEM_SLEEP_PM_OPS(sp7021_spi_controller_suspend
,
555 sp7021_spi_controller_resume
)
558 static const struct of_device_id sp7021_spi_controller_ids
[] = {
559 { .compatible
= "sunplus,sp7021-spi" },
562 MODULE_DEVICE_TABLE(of
, sp7021_spi_controller_ids
);
564 static struct platform_driver sp7021_spi_controller_driver
= {
565 .probe
= sp7021_spi_controller_probe
,
566 .remove
= sp7021_spi_controller_remove
,
568 .name
= "sunplus,sp7021-spi-controller",
569 .of_match_table
= sp7021_spi_controller_ids
,
570 .pm
= &sp7021_spi_pm_ops
,
573 module_platform_driver(sp7021_spi_controller_driver
);
575 MODULE_AUTHOR("Li-hao Kuo <lhjeff911@gmail.com>");
576 MODULE_DESCRIPTION("Sunplus SPI controller driver");
577 MODULE_LICENSE("GPL");