mtk-quadspi.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  1. /*
  2. * Copyright (c) 2015 MediaTek Inc.
  3. * Author: Bayi Cheng <bayi.cheng@mediatek.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. */
  14. #include <linux/clk.h>
  15. #include <linux/delay.h>
  16. #include <linux/device.h>
  17. #include <linux/init.h>
  18. #include <linux/io.h>
  19. #include <linux/iopoll.h>
  20. #include <linux/ioport.h>
  21. #include <linux/math64.h>
  22. #include <linux/module.h>
  23. #include <linux/mutex.h>
  24. #include <linux/of.h>
  25. #include <linux/of_device.h>
  26. #include <linux/platform_device.h>
  27. #include <linux/slab.h>
  28. #include <linux/mtd/mtd.h>
  29. #include <linux/mtd/partitions.h>
  30. #include <linux/mtd/spi-nor.h>
  31. #define MTK_NOR_CMD_REG 0x00
  32. #define MTK_NOR_CNT_REG 0x04
  33. #define MTK_NOR_RDSR_REG 0x08
  34. #define MTK_NOR_RDATA_REG 0x0c
  35. #define MTK_NOR_RADR0_REG 0x10
  36. #define MTK_NOR_RADR1_REG 0x14
  37. #define MTK_NOR_RADR2_REG 0x18
  38. #define MTK_NOR_WDATA_REG 0x1c
  39. #define MTK_NOR_PRGDATA0_REG 0x20
  40. #define MTK_NOR_PRGDATA1_REG 0x24
  41. #define MTK_NOR_PRGDATA2_REG 0x28
  42. #define MTK_NOR_PRGDATA3_REG 0x2c
  43. #define MTK_NOR_PRGDATA4_REG 0x30
  44. #define MTK_NOR_PRGDATA5_REG 0x34
  45. #define MTK_NOR_SHREG0_REG 0x38
  46. #define MTK_NOR_SHREG1_REG 0x3c
  47. #define MTK_NOR_SHREG2_REG 0x40
  48. #define MTK_NOR_SHREG3_REG 0x44
  49. #define MTK_NOR_SHREG4_REG 0x48
  50. #define MTK_NOR_SHREG5_REG 0x4c
  51. #define MTK_NOR_SHREG6_REG 0x50
  52. #define MTK_NOR_SHREG7_REG 0x54
  53. #define MTK_NOR_SHREG8_REG 0x58
  54. #define MTK_NOR_SHREG9_REG 0x5c
  55. #define MTK_NOR_CFG1_REG 0x60
  56. #define MTK_NOR_CFG2_REG 0x64
  57. #define MTK_NOR_CFG3_REG 0x68
  58. #define MTK_NOR_STATUS0_REG 0x70
  59. #define MTK_NOR_STATUS1_REG 0x74
  60. #define MTK_NOR_STATUS2_REG 0x78
  61. #define MTK_NOR_STATUS3_REG 0x7c
  62. #define MTK_NOR_FLHCFG_REG 0x84
  63. #define MTK_NOR_TIME_REG 0x94
  64. #define MTK_NOR_PP_DATA_REG 0x98
  65. #define MTK_NOR_PREBUF_STUS_REG 0x9c
  66. #define MTK_NOR_DELSEL0_REG 0xa0
  67. #define MTK_NOR_DELSEL1_REG 0xa4
  68. #define MTK_NOR_INTRSTUS_REG 0xa8
  69. #define MTK_NOR_INTREN_REG 0xac
  70. #define MTK_NOR_CHKSUM_CTL_REG 0xb8
  71. #define MTK_NOR_CHKSUM_REG 0xbc
  72. #define MTK_NOR_CMD2_REG 0xc0
  73. #define MTK_NOR_WRPROT_REG 0xc4
  74. #define MTK_NOR_RADR3_REG 0xc8
  75. #define MTK_NOR_DUAL_REG 0xcc
  76. #define MTK_NOR_DELSEL2_REG 0xd0
  77. #define MTK_NOR_DELSEL3_REG 0xd4
  78. #define MTK_NOR_DELSEL4_REG 0xd8
  79. /* commands for mtk nor controller */
  80. #define MTK_NOR_READ_CMD 0x0
  81. #define MTK_NOR_RDSR_CMD 0x2
  82. #define MTK_NOR_PRG_CMD 0x4
  83. #define MTK_NOR_WR_CMD 0x10
  84. #define MTK_NOR_PIO_WR_CMD 0x90
  85. #define MTK_NOR_WRSR_CMD 0x20
  86. #define MTK_NOR_PIO_READ_CMD 0x81
  87. #define MTK_NOR_WR_BUF_ENABLE 0x1
  88. #define MTK_NOR_WR_BUF_DISABLE 0x0
  89. #define MTK_NOR_ENABLE_SF_CMD 0x30
  90. #define MTK_NOR_DUAD_ADDR_EN 0x8
  91. #define MTK_NOR_QUAD_READ_EN 0x4
  92. #define MTK_NOR_DUAL_ADDR_EN 0x2
  93. #define MTK_NOR_DUAL_READ_EN 0x1
  94. #define MTK_NOR_DUAL_DISABLE 0x0
  95. #define MTK_NOR_FAST_READ 0x1
  96. #define SFLASH_WRBUF_SIZE 128
  97. /* Can shift up to 48 bits (6 bytes) of TX/RX */
  98. #define MTK_NOR_MAX_RX_TX_SHIFT 6
  99. /* can shift up to 56 bits (7 bytes) transfer by MTK_NOR_PRG_CMD */
  100. #define MTK_NOR_MAX_SHIFT 7
  101. /* nor controller 4-byte address mode enable bit */
  102. #define MTK_NOR_4B_ADDR_EN BIT(4)
  103. /* Helpers for accessing the program data / shift data registers */
  104. #define MTK_NOR_PRG_REG(n) (MTK_NOR_PRGDATA0_REG + 4 * (n))
  105. #define MTK_NOR_SHREG(n) (MTK_NOR_SHREG0_REG + 4 * (n))
  106. struct mtk_nor {
  107. struct spi_nor nor;
  108. struct device *dev;
  109. void __iomem *base; /* nor flash base address */
  110. struct clk *spi_clk;
  111. struct clk *nor_clk;
  112. };
  113. static void mtk_nor_set_read_mode(struct mtk_nor *mtk_nor)
  114. {
  115. struct spi_nor *nor = &mtk_nor->nor;
  116. switch (nor->read_proto) {
  117. case SNOR_PROTO_1_1_1:
  118. writeb(nor->read_opcode, mtk_nor->base +
  119. MTK_NOR_PRGDATA3_REG);
  120. writeb(MTK_NOR_FAST_READ, mtk_nor->base +
  121. MTK_NOR_CFG1_REG);
  122. break;
  123. case SNOR_PROTO_1_1_2:
  124. writeb(nor->read_opcode, mtk_nor->base +
  125. MTK_NOR_PRGDATA3_REG);
  126. writeb(MTK_NOR_DUAL_READ_EN, mtk_nor->base +
  127. MTK_NOR_DUAL_REG);
  128. break;
  129. case SNOR_PROTO_1_1_4:
  130. writeb(nor->read_opcode, mtk_nor->base +
  131. MTK_NOR_PRGDATA4_REG);
  132. writeb(MTK_NOR_QUAD_READ_EN, mtk_nor->base +
  133. MTK_NOR_DUAL_REG);
  134. break;
  135. default:
  136. writeb(MTK_NOR_DUAL_DISABLE, mtk_nor->base +
  137. MTK_NOR_DUAL_REG);
  138. break;
  139. }
  140. }
  141. static int mtk_nor_execute_cmd(struct mtk_nor *mtk_nor, u8 cmdval)
  142. {
  143. int reg;
  144. u8 val = cmdval & 0x1f;
  145. writeb(cmdval, mtk_nor->base + MTK_NOR_CMD_REG);
  146. return readl_poll_timeout(mtk_nor->base + MTK_NOR_CMD_REG, reg,
  147. !(reg & val), 100, 10000);
  148. }
  149. static int mtk_nor_do_tx_rx(struct mtk_nor *mtk_nor, u8 op,
  150. u8 *tx, int txlen, u8 *rx, int rxlen)
  151. {
  152. int len = 1 + txlen + rxlen;
  153. int i, ret, idx;
  154. if (len > MTK_NOR_MAX_SHIFT)
  155. return -EINVAL;
  156. writeb(len * 8, mtk_nor->base + MTK_NOR_CNT_REG);
  157. /* start at PRGDATA5, go down to PRGDATA0 */
  158. idx = MTK_NOR_MAX_RX_TX_SHIFT - 1;
  159. /* opcode */
  160. writeb(op, mtk_nor->base + MTK_NOR_PRG_REG(idx));
  161. idx--;
  162. /* program TX data */
  163. for (i = 0; i < txlen; i++, idx--)
  164. writeb(tx[i], mtk_nor->base + MTK_NOR_PRG_REG(idx));
  165. /* clear out rest of TX registers */
  166. while (idx >= 0) {
  167. writeb(0, mtk_nor->base + MTK_NOR_PRG_REG(idx));
  168. idx--;
  169. }
  170. ret = mtk_nor_execute_cmd(mtk_nor, MTK_NOR_PRG_CMD);
  171. if (ret)
  172. return ret;
  173. /* restart at first RX byte */
  174. idx = rxlen - 1;
  175. /* read out RX data */
  176. for (i = 0; i < rxlen; i++, idx--)
  177. rx[i] = readb(mtk_nor->base + MTK_NOR_SHREG(idx));
  178. return 0;
  179. }
  180. /* Do a WRSR (Write Status Register) command */
  181. static int mtk_nor_wr_sr(struct mtk_nor *mtk_nor, u8 sr)
  182. {
  183. writeb(sr, mtk_nor->base + MTK_NOR_PRGDATA5_REG);
  184. writeb(8, mtk_nor->base + MTK_NOR_CNT_REG);
  185. return mtk_nor_execute_cmd(mtk_nor, MTK_NOR_WRSR_CMD);
  186. }
  187. static int mtk_nor_write_buffer_enable(struct mtk_nor *mtk_nor)
  188. {
  189. u8 reg;
  190. /* the bit0 of MTK_NOR_CFG2_REG is pre-fetch buffer
  191. * 0: pre-fetch buffer use for read
  192. * 1: pre-fetch buffer use for page program
  193. */
  194. writel(MTK_NOR_WR_BUF_ENABLE, mtk_nor->base + MTK_NOR_CFG2_REG);
  195. return readb_poll_timeout(mtk_nor->base + MTK_NOR_CFG2_REG, reg,
  196. 0x01 == (reg & 0x01), 100, 10000);
  197. }
  198. static int mtk_nor_write_buffer_disable(struct mtk_nor *mtk_nor)
  199. {
  200. u8 reg;
  201. writel(MTK_NOR_WR_BUF_DISABLE, mtk_nor->base + MTK_NOR_CFG2_REG);
  202. return readb_poll_timeout(mtk_nor->base + MTK_NOR_CFG2_REG, reg,
  203. MTK_NOR_WR_BUF_DISABLE == (reg & 0x1), 100,
  204. 10000);
  205. }
  206. static void mtk_nor_set_addr_width(struct mtk_nor *mtk_nor)
  207. {
  208. u8 val;
  209. struct spi_nor *nor = &mtk_nor->nor;
  210. val = readb(mtk_nor->base + MTK_NOR_DUAL_REG);
  211. switch (nor->addr_width) {
  212. case 3:
  213. val &= ~MTK_NOR_4B_ADDR_EN;
  214. break;
  215. case 4:
  216. val |= MTK_NOR_4B_ADDR_EN;
  217. break;
  218. default:
  219. dev_warn(mtk_nor->dev, "Unexpected address width %u.\n",
  220. nor->addr_width);
  221. break;
  222. }
  223. writeb(val, mtk_nor->base + MTK_NOR_DUAL_REG);
  224. }
  225. static void mtk_nor_set_addr(struct mtk_nor *mtk_nor, u32 addr)
  226. {
  227. int i;
  228. mtk_nor_set_addr_width(mtk_nor);
  229. for (i = 0; i < 3; i++) {
  230. writeb(addr & 0xff, mtk_nor->base + MTK_NOR_RADR0_REG + i * 4);
  231. addr >>= 8;
  232. }
  233. /* Last register is non-contiguous */
  234. writeb(addr & 0xff, mtk_nor->base + MTK_NOR_RADR3_REG);
  235. }
  236. static ssize_t mtk_nor_read(struct spi_nor *nor, loff_t from, size_t length,
  237. u_char *buffer)
  238. {
  239. int i, ret;
  240. int addr = (int)from;
  241. u8 *buf = (u8 *)buffer;
  242. struct mtk_nor *mtk_nor = nor->priv;
  243. /* set mode for fast read mode ,dual mode or quad mode */
  244. mtk_nor_set_read_mode(mtk_nor);
  245. mtk_nor_set_addr(mtk_nor, addr);
  246. for (i = 0; i < length; i++) {
  247. ret = mtk_nor_execute_cmd(mtk_nor, MTK_NOR_PIO_READ_CMD);
  248. if (ret < 0)
  249. return ret;
  250. buf[i] = readb(mtk_nor->base + MTK_NOR_RDATA_REG);
  251. }
  252. return length;
  253. }
  254. static int mtk_nor_write_single_byte(struct mtk_nor *mtk_nor,
  255. int addr, int length, u8 *data)
  256. {
  257. int i, ret;
  258. mtk_nor_set_addr(mtk_nor, addr);
  259. for (i = 0; i < length; i++) {
  260. writeb(*data++, mtk_nor->base + MTK_NOR_WDATA_REG);
  261. ret = mtk_nor_execute_cmd(mtk_nor, MTK_NOR_PIO_WR_CMD);
  262. if (ret < 0)
  263. return ret;
  264. }
  265. return 0;
  266. }
  267. static int mtk_nor_write_buffer(struct mtk_nor *mtk_nor, int addr,
  268. const u8 *buf)
  269. {
  270. int i, bufidx, data;
  271. mtk_nor_set_addr(mtk_nor, addr);
  272. bufidx = 0;
  273. for (i = 0; i < SFLASH_WRBUF_SIZE; i += 4) {
  274. data = buf[bufidx + 3]<<24 | buf[bufidx + 2]<<16 |
  275. buf[bufidx + 1]<<8 | buf[bufidx];
  276. bufidx += 4;
  277. writel(data, mtk_nor->base + MTK_NOR_PP_DATA_REG);
  278. }
  279. return mtk_nor_execute_cmd(mtk_nor, MTK_NOR_WR_CMD);
  280. }
  281. static ssize_t mtk_nor_write(struct spi_nor *nor, loff_t to, size_t len,
  282. const u_char *buf)
  283. {
  284. int ret;
  285. struct mtk_nor *mtk_nor = nor->priv;
  286. size_t i;
  287. ret = mtk_nor_write_buffer_enable(mtk_nor);
  288. if (ret < 0) {
  289. dev_warn(mtk_nor->dev, "write buffer enable failed!\n");
  290. return ret;
  291. }
  292. for (i = 0; i + SFLASH_WRBUF_SIZE <= len; i += SFLASH_WRBUF_SIZE) {
  293. ret = mtk_nor_write_buffer(mtk_nor, to, buf);
  294. if (ret < 0) {
  295. dev_err(mtk_nor->dev, "write buffer failed!\n");
  296. return ret;
  297. }
  298. to += SFLASH_WRBUF_SIZE;
  299. buf += SFLASH_WRBUF_SIZE;
  300. }
  301. ret = mtk_nor_write_buffer_disable(mtk_nor);
  302. if (ret < 0) {
  303. dev_warn(mtk_nor->dev, "write buffer disable failed!\n");
  304. return ret;
  305. }
  306. if (i < len) {
  307. ret = mtk_nor_write_single_byte(mtk_nor, to,
  308. (int)(len - i), (u8 *)buf);
  309. if (ret < 0) {
  310. dev_err(mtk_nor->dev, "write single byte failed!\n");
  311. return ret;
  312. }
  313. }
  314. return len;
  315. }
  316. static int mtk_nor_read_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len)
  317. {
  318. int ret;
  319. struct mtk_nor *mtk_nor = nor->priv;
  320. switch (opcode) {
  321. case SPINOR_OP_RDSR:
  322. ret = mtk_nor_execute_cmd(mtk_nor, MTK_NOR_RDSR_CMD);
  323. if (ret < 0)
  324. return ret;
  325. if (len == 1)
  326. *buf = readb(mtk_nor->base + MTK_NOR_RDSR_REG);
  327. else
  328. dev_err(mtk_nor->dev, "len should be 1 for read status!\n");
  329. break;
  330. default:
  331. ret = mtk_nor_do_tx_rx(mtk_nor, opcode, NULL, 0, buf, len);
  332. break;
  333. }
  334. return ret;
  335. }
  336. static int mtk_nor_write_reg(struct spi_nor *nor, u8 opcode, u8 *buf,
  337. int len)
  338. {
  339. int ret;
  340. struct mtk_nor *mtk_nor = nor->priv;
  341. switch (opcode) {
  342. case SPINOR_OP_WRSR:
  343. /* We only handle 1 byte */
  344. ret = mtk_nor_wr_sr(mtk_nor, *buf);
  345. break;
  346. default:
  347. ret = mtk_nor_do_tx_rx(mtk_nor, opcode, buf, len, NULL, 0);
  348. if (ret)
  349. dev_warn(mtk_nor->dev, "write reg failure!\n");
  350. break;
  351. }
  352. return ret;
  353. }
  354. static void mtk_nor_disable_clk(struct mtk_nor *mtk_nor)
  355. {
  356. clk_disable_unprepare(mtk_nor->spi_clk);
  357. clk_disable_unprepare(mtk_nor->nor_clk);
  358. }
  359. static int mtk_nor_enable_clk(struct mtk_nor *mtk_nor)
  360. {
  361. int ret;
  362. ret = clk_prepare_enable(mtk_nor->spi_clk);
  363. if (ret)
  364. return ret;
  365. ret = clk_prepare_enable(mtk_nor->nor_clk);
  366. if (ret) {
  367. clk_disable_unprepare(mtk_nor->spi_clk);
  368. return ret;
  369. }
  370. return 0;
  371. }
  372. static int mtk_nor_init(struct mtk_nor *mtk_nor,
  373. struct device_node *flash_node)
  374. {
  375. const struct spi_nor_hwcaps hwcaps = {
  376. .mask = SNOR_HWCAPS_READ_FAST |
  377. SNOR_HWCAPS_READ_1_1_2 |
  378. SNOR_HWCAPS_PP,
  379. };
  380. int ret;
  381. struct spi_nor *nor;
  382. /* initialize controller to accept commands */
  383. writel(MTK_NOR_ENABLE_SF_CMD, mtk_nor->base + MTK_NOR_WRPROT_REG);
  384. nor = &mtk_nor->nor;
  385. nor->dev = mtk_nor->dev;
  386. nor->priv = mtk_nor;
  387. spi_nor_set_flash_node(nor, flash_node);
  388. /* fill the hooks to spi nor */
  389. nor->read = mtk_nor_read;
  390. nor->read_reg = mtk_nor_read_reg;
  391. nor->write = mtk_nor_write;
  392. nor->write_reg = mtk_nor_write_reg;
  393. nor->mtd.name = "mtk_nor";
  394. /* initialized with NULL */
  395. ret = spi_nor_scan(nor, NULL, &hwcaps);
  396. if (ret)
  397. return ret;
  398. return mtd_device_register(&nor->mtd, NULL, 0);
  399. }
  400. static int mtk_nor_drv_probe(struct platform_device *pdev)
  401. {
  402. struct device_node *flash_np;
  403. struct resource *res;
  404. int ret;
  405. struct mtk_nor *mtk_nor;
  406. if (!pdev->dev.of_node) {
  407. dev_err(&pdev->dev, "No DT found\n");
  408. return -EINVAL;
  409. }
  410. mtk_nor = devm_kzalloc(&pdev->dev, sizeof(*mtk_nor), GFP_KERNEL);
  411. if (!mtk_nor)
  412. return -ENOMEM;
  413. platform_set_drvdata(pdev, mtk_nor);
  414. res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  415. mtk_nor->base = devm_ioremap_resource(&pdev->dev, res);
  416. if (IS_ERR(mtk_nor->base))
  417. return PTR_ERR(mtk_nor->base);
  418. mtk_nor->spi_clk = devm_clk_get(&pdev->dev, "spi");
  419. if (IS_ERR(mtk_nor->spi_clk))
  420. return PTR_ERR(mtk_nor->spi_clk);
  421. mtk_nor->nor_clk = devm_clk_get(&pdev->dev, "sf");
  422. if (IS_ERR(mtk_nor->nor_clk))
  423. return PTR_ERR(mtk_nor->nor_clk);
  424. mtk_nor->dev = &pdev->dev;
  425. ret = mtk_nor_enable_clk(mtk_nor);
  426. if (ret)
  427. return ret;
  428. /* only support one attached flash */
  429. flash_np = of_get_next_available_child(pdev->dev.of_node, NULL);
  430. if (!flash_np) {
  431. dev_err(&pdev->dev, "no SPI flash device to configure\n");
  432. ret = -ENODEV;
  433. goto nor_free;
  434. }
  435. ret = mtk_nor_init(mtk_nor, flash_np);
  436. nor_free:
  437. if (ret)
  438. mtk_nor_disable_clk(mtk_nor);
  439. return ret;
  440. }
  441. static int mtk_nor_drv_remove(struct platform_device *pdev)
  442. {
  443. struct mtk_nor *mtk_nor = platform_get_drvdata(pdev);
  444. mtk_nor_disable_clk(mtk_nor);
  445. return 0;
  446. }
  447. #ifdef CONFIG_PM_SLEEP
  448. static int mtk_nor_suspend(struct device *dev)
  449. {
  450. struct mtk_nor *mtk_nor = dev_get_drvdata(dev);
  451. mtk_nor_disable_clk(mtk_nor);
  452. return 0;
  453. }
  454. static int mtk_nor_resume(struct device *dev)
  455. {
  456. struct mtk_nor *mtk_nor = dev_get_drvdata(dev);
  457. return mtk_nor_enable_clk(mtk_nor);
  458. }
  459. static const struct dev_pm_ops mtk_nor_dev_pm_ops = {
  460. .suspend = mtk_nor_suspend,
  461. .resume = mtk_nor_resume,
  462. };
  463. #define MTK_NOR_DEV_PM_OPS (&mtk_nor_dev_pm_ops)
  464. #else
  465. #define MTK_NOR_DEV_PM_OPS NULL
  466. #endif
  467. static const struct of_device_id mtk_nor_of_ids[] = {
  468. { .compatible = "mediatek,mt8173-nor"},
  469. { /* sentinel */ }
  470. };
  471. MODULE_DEVICE_TABLE(of, mtk_nor_of_ids);
  472. static struct platform_driver mtk_nor_driver = {
  473. .probe = mtk_nor_drv_probe,
  474. .remove = mtk_nor_drv_remove,
  475. .driver = {
  476. .name = "mtk-nor",
  477. .pm = MTK_NOR_DEV_PM_OPS,
  478. .of_match_table = mtk_nor_of_ids,
  479. },
  480. };
  481. module_platform_driver(mtk_nor_driver);
  482. MODULE_LICENSE("GPL v2");
  483. MODULE_DESCRIPTION("MediaTek SPI NOR Flash Driver");