xref: /rk3399_rockchip-uboot/drivers/mtd/altera_qspi.c (revision 9e957aa4ce959faa89d31bc3ff401cc08bbc1013)
138a0f36eSThomas Chou /*
238a0f36eSThomas Chou  * Copyright (C) 2015 Thomas Chou <thomas@wytron.com.tw>
338a0f36eSThomas Chou  *
438a0f36eSThomas Chou  * SPDX-License-Identifier:	GPL-2.0+
538a0f36eSThomas Chou  */
638a0f36eSThomas Chou 
738a0f36eSThomas Chou #include <common.h>
838a0f36eSThomas Chou #include <dm.h>
938a0f36eSThomas Chou #include <errno.h>
1038a0f36eSThomas Chou #include <fdt_support.h>
1138a0f36eSThomas Chou #include <flash.h>
1238a0f36eSThomas Chou #include <mtd.h>
1338a0f36eSThomas Chou #include <asm/io.h>
1438a0f36eSThomas Chou 
1538a0f36eSThomas Chou DECLARE_GLOBAL_DATA_PTR;
1638a0f36eSThomas Chou 
17421f306fSThomas Chou /* The STATUS register */
18421f306fSThomas Chou #define QUADSPI_SR_BP0				BIT(2)
19421f306fSThomas Chou #define QUADSPI_SR_BP1				BIT(3)
20421f306fSThomas Chou #define QUADSPI_SR_BP2				BIT(4)
21421f306fSThomas Chou #define QUADSPI_SR_BP2_0			GENMASK(4, 2)
22421f306fSThomas Chou #define QUADSPI_SR_BP3				BIT(6)
23421f306fSThomas Chou #define QUADSPI_SR_TB				BIT(5)
24421f306fSThomas Chou 
2538a0f36eSThomas Chou /*
2638a0f36eSThomas Chou  * The QUADSPI_MEM_OP register is used to do memory protect and erase operations
2738a0f36eSThomas Chou  */
2838a0f36eSThomas Chou #define QUADSPI_MEM_OP_BULK_ERASE		0x00000001
2938a0f36eSThomas Chou #define QUADSPI_MEM_OP_SECTOR_ERASE		0x00000002
3038a0f36eSThomas Chou #define QUADSPI_MEM_OP_SECTOR_PROTECT		0x00000003
3138a0f36eSThomas Chou 
3238a0f36eSThomas Chou /*
3338a0f36eSThomas Chou  * The QUADSPI_ISR register is used to determine whether an invalid write or
3438a0f36eSThomas Chou  * erase operation trigerred an interrupt
3538a0f36eSThomas Chou  */
3638a0f36eSThomas Chou #define QUADSPI_ISR_ILLEGAL_ERASE		BIT(0)
3738a0f36eSThomas Chou #define QUADSPI_ISR_ILLEGAL_WRITE		BIT(1)
3838a0f36eSThomas Chou 
3938a0f36eSThomas Chou struct altera_qspi_regs {
4038a0f36eSThomas Chou 	u32	rd_status;
4138a0f36eSThomas Chou 	u32	rd_sid;
4238a0f36eSThomas Chou 	u32	rd_rdid;
4338a0f36eSThomas Chou 	u32	mem_op;
4438a0f36eSThomas Chou 	u32	isr;
4538a0f36eSThomas Chou 	u32	imr;
4638a0f36eSThomas Chou 	u32	chip_select;
4738a0f36eSThomas Chou };
4838a0f36eSThomas Chou 
4938a0f36eSThomas Chou struct altera_qspi_platdata {
5038a0f36eSThomas Chou 	struct altera_qspi_regs *regs;
5138a0f36eSThomas Chou 	void *base;
5238a0f36eSThomas Chou 	unsigned long size;
5338a0f36eSThomas Chou };
5438a0f36eSThomas Chou 
5538a0f36eSThomas Chou flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS];	/* FLASH chips info */
5638a0f36eSThomas Chou 
57421f306fSThomas Chou static void altera_qspi_get_locked_range(struct mtd_info *mtd, loff_t *ofs,
58421f306fSThomas Chou 					 uint64_t *len);
59421f306fSThomas Chou 
6038a0f36eSThomas Chou void flash_print_info(flash_info_t *info)
6138a0f36eSThomas Chou {
62421f306fSThomas Chou 	struct mtd_info *mtd = info->mtd;
63421f306fSThomas Chou 	loff_t ofs;
64421f306fSThomas Chou 	u64 len;
65421f306fSThomas Chou 
6638a0f36eSThomas Chou 	printf("Altera QSPI flash  Size: %ld MB in %d Sectors\n",
6738a0f36eSThomas Chou 	       info->size >> 20, info->sector_count);
68421f306fSThomas Chou 	altera_qspi_get_locked_range(mtd, &ofs, &len);
69421f306fSThomas Chou 	printf("  %08lX +%lX", info->start[0], info->size);
70421f306fSThomas Chou 	if (len) {
71421f306fSThomas Chou 		printf(", protected %08llX +%llX",
72421f306fSThomas Chou 		       info->start[0] + ofs, len);
73421f306fSThomas Chou 	}
74421f306fSThomas Chou 	putc('\n');
7538a0f36eSThomas Chou }
7638a0f36eSThomas Chou 
7738a0f36eSThomas Chou int flash_erase(flash_info_t *info, int s_first, int s_last)
7838a0f36eSThomas Chou {
7938a0f36eSThomas Chou 	struct mtd_info *mtd = info->mtd;
8038a0f36eSThomas Chou 	struct erase_info instr;
8138a0f36eSThomas Chou 	int ret;
8238a0f36eSThomas Chou 
8338a0f36eSThomas Chou 	memset(&instr, 0, sizeof(instr));
841c0e84caSThomas Chou 	instr.mtd = mtd;
8538a0f36eSThomas Chou 	instr.addr = mtd->erasesize * s_first;
8638a0f36eSThomas Chou 	instr.len = mtd->erasesize * (s_last + 1 - s_first);
8738a0f36eSThomas Chou 	ret = mtd_erase(mtd, &instr);
8838a0f36eSThomas Chou 	if (ret)
89f118fe5cSThomas Chou 		return ERR_PROTECTED;
9038a0f36eSThomas Chou 
9138a0f36eSThomas Chou 	return 0;
9238a0f36eSThomas Chou }
9338a0f36eSThomas Chou 
9438a0f36eSThomas Chou int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt)
9538a0f36eSThomas Chou {
9638a0f36eSThomas Chou 	struct mtd_info *mtd = info->mtd;
9738a0f36eSThomas Chou 	struct udevice *dev = mtd->dev;
9838a0f36eSThomas Chou 	struct altera_qspi_platdata *pdata = dev_get_platdata(dev);
9938a0f36eSThomas Chou 	ulong base = (ulong)pdata->base;
10038a0f36eSThomas Chou 	loff_t to = addr - base;
10138a0f36eSThomas Chou 	size_t retlen;
10238a0f36eSThomas Chou 	int ret;
10338a0f36eSThomas Chou 
10438a0f36eSThomas Chou 	ret = mtd_write(mtd, to, cnt, &retlen, src);
10538a0f36eSThomas Chou 	if (ret)
106f118fe5cSThomas Chou 		return ERR_PROTECTED;
10738a0f36eSThomas Chou 
10838a0f36eSThomas Chou 	return 0;
10938a0f36eSThomas Chou }
11038a0f36eSThomas Chou 
11138a0f36eSThomas Chou unsigned long flash_init(void)
11238a0f36eSThomas Chou {
11338a0f36eSThomas Chou 	struct udevice *dev;
11438a0f36eSThomas Chou 
11538a0f36eSThomas Chou 	/* probe every MTD device */
11638a0f36eSThomas Chou 	for (uclass_first_device(UCLASS_MTD, &dev);
11738a0f36eSThomas Chou 	     dev;
11838a0f36eSThomas Chou 	     uclass_next_device(&dev)) {
11938a0f36eSThomas Chou 	}
12038a0f36eSThomas Chou 
12138a0f36eSThomas Chou 	return flash_info[0].size;
12238a0f36eSThomas Chou }
12338a0f36eSThomas Chou 
12438a0f36eSThomas Chou static int altera_qspi_erase(struct mtd_info *mtd, struct erase_info *instr)
12538a0f36eSThomas Chou {
12638a0f36eSThomas Chou 	struct udevice *dev = mtd->dev;
12738a0f36eSThomas Chou 	struct altera_qspi_platdata *pdata = dev_get_platdata(dev);
12838a0f36eSThomas Chou 	struct altera_qspi_regs *regs = pdata->regs;
12938a0f36eSThomas Chou 	size_t addr = instr->addr;
13038a0f36eSThomas Chou 	size_t len = instr->len;
13138a0f36eSThomas Chou 	size_t end = addr + len;
13238a0f36eSThomas Chou 	u32 sect;
13338a0f36eSThomas Chou 	u32 stat;
13438a0f36eSThomas Chou 
13538a0f36eSThomas Chou 	instr->state = MTD_ERASING;
13638a0f36eSThomas Chou 	addr &= ~(mtd->erasesize - 1); /* get lower aligned address */
13738a0f36eSThomas Chou 	while (addr < end) {
13838a0f36eSThomas Chou 		sect = addr / mtd->erasesize;
13938a0f36eSThomas Chou 		sect <<= 8;
14038a0f36eSThomas Chou 		sect |= QUADSPI_MEM_OP_SECTOR_ERASE;
14138a0f36eSThomas Chou 		debug("erase %08x\n", sect);
14238a0f36eSThomas Chou 		writel(sect, &regs->mem_op);
14338a0f36eSThomas Chou 		stat = readl(&regs->isr);
14438a0f36eSThomas Chou 		if (stat & QUADSPI_ISR_ILLEGAL_ERASE) {
14538a0f36eSThomas Chou 			/* erase failed, sector might be protected */
14638a0f36eSThomas Chou 			debug("erase %08x fail %x\n", sect, stat);
14738a0f36eSThomas Chou 			writel(stat, &regs->isr); /* clear isr */
14838a0f36eSThomas Chou 			instr->state = MTD_ERASE_FAILED;
149*9e957aa4SThomas Chou 			mtd_erase_callback(instr);
15038a0f36eSThomas Chou 			return -EIO;
15138a0f36eSThomas Chou 		}
15238a0f36eSThomas Chou 		addr += mtd->erasesize;
15338a0f36eSThomas Chou 	}
15438a0f36eSThomas Chou 	instr->state = MTD_ERASE_DONE;
15538a0f36eSThomas Chou 	mtd_erase_callback(instr);
15638a0f36eSThomas Chou 
15738a0f36eSThomas Chou 	return 0;
15838a0f36eSThomas Chou }
15938a0f36eSThomas Chou 
16038a0f36eSThomas Chou static int altera_qspi_read(struct mtd_info *mtd, loff_t from, size_t len,
16138a0f36eSThomas Chou 			    size_t *retlen, u_char *buf)
16238a0f36eSThomas Chou {
16338a0f36eSThomas Chou 	struct udevice *dev = mtd->dev;
16438a0f36eSThomas Chou 	struct altera_qspi_platdata *pdata = dev_get_platdata(dev);
16538a0f36eSThomas Chou 
16638a0f36eSThomas Chou 	memcpy_fromio(buf, pdata->base + from, len);
16738a0f36eSThomas Chou 	*retlen = len;
16838a0f36eSThomas Chou 
16938a0f36eSThomas Chou 	return 0;
17038a0f36eSThomas Chou }
17138a0f36eSThomas Chou 
17238a0f36eSThomas Chou static int altera_qspi_write(struct mtd_info *mtd, loff_t to, size_t len,
17338a0f36eSThomas Chou 			     size_t *retlen, const u_char *buf)
17438a0f36eSThomas Chou {
17538a0f36eSThomas Chou 	struct udevice *dev = mtd->dev;
17638a0f36eSThomas Chou 	struct altera_qspi_platdata *pdata = dev_get_platdata(dev);
17738a0f36eSThomas Chou 	struct altera_qspi_regs *regs = pdata->regs;
17838a0f36eSThomas Chou 	u32 stat;
17938a0f36eSThomas Chou 
18038a0f36eSThomas Chou 	memcpy_toio(pdata->base + to, buf, len);
18138a0f36eSThomas Chou 	/* check whether write triggered a illegal write interrupt */
18238a0f36eSThomas Chou 	stat = readl(&regs->isr);
18338a0f36eSThomas Chou 	if (stat & QUADSPI_ISR_ILLEGAL_WRITE) {
18438a0f36eSThomas Chou 		/* write failed, sector might be protected */
18538a0f36eSThomas Chou 		debug("write fail %x\n", stat);
18638a0f36eSThomas Chou 		writel(stat, &regs->isr); /* clear isr */
18738a0f36eSThomas Chou 		return -EIO;
18838a0f36eSThomas Chou 	}
18938a0f36eSThomas Chou 	*retlen = len;
19038a0f36eSThomas Chou 
19138a0f36eSThomas Chou 	return 0;
19238a0f36eSThomas Chou }
19338a0f36eSThomas Chou 
19438a0f36eSThomas Chou static void altera_qspi_sync(struct mtd_info *mtd)
19538a0f36eSThomas Chou {
19638a0f36eSThomas Chou }
19738a0f36eSThomas Chou 
198421f306fSThomas Chou static void altera_qspi_get_locked_range(struct mtd_info *mtd, loff_t *ofs,
199421f306fSThomas Chou 					 uint64_t *len)
200421f306fSThomas Chou {
201421f306fSThomas Chou 	struct udevice *dev = mtd->dev;
202421f306fSThomas Chou 	struct altera_qspi_platdata *pdata = dev_get_platdata(dev);
203421f306fSThomas Chou 	struct altera_qspi_regs *regs = pdata->regs;
204421f306fSThomas Chou 	int shift0 = ffs(QUADSPI_SR_BP2_0) - 1;
205421f306fSThomas Chou 	int shift3 = ffs(QUADSPI_SR_BP3) - 1 - 3;
206421f306fSThomas Chou 	u32 stat = readl(&regs->rd_status);
207421f306fSThomas Chou 	unsigned pow = ((stat & QUADSPI_SR_BP2_0) >> shift0) |
208421f306fSThomas Chou 		((stat & QUADSPI_SR_BP3) >> shift3);
209421f306fSThomas Chou 
210421f306fSThomas Chou 	*ofs = 0;
211421f306fSThomas Chou 	*len = 0;
212421f306fSThomas Chou 	if (pow) {
213421f306fSThomas Chou 		*len = mtd->erasesize << (pow - 1);
214421f306fSThomas Chou 		if (*len > mtd->size)
215421f306fSThomas Chou 			*len = mtd->size;
216421f306fSThomas Chou 		if (!(stat & QUADSPI_SR_TB))
217421f306fSThomas Chou 			*ofs = mtd->size - *len;
218421f306fSThomas Chou 	}
219421f306fSThomas Chou }
220421f306fSThomas Chou 
221421f306fSThomas Chou static int altera_qspi_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
222421f306fSThomas Chou {
223421f306fSThomas Chou 	struct udevice *dev = mtd->dev;
224421f306fSThomas Chou 	struct altera_qspi_platdata *pdata = dev_get_platdata(dev);
225421f306fSThomas Chou 	struct altera_qspi_regs *regs = pdata->regs;
226421f306fSThomas Chou 	u32 sector_start, sector_end;
227421f306fSThomas Chou 	u32 num_sectors;
228421f306fSThomas Chou 	u32 mem_op;
229421f306fSThomas Chou 	u32 sr_bp;
230421f306fSThomas Chou 	u32 sr_tb;
231421f306fSThomas Chou 
232421f306fSThomas Chou 	num_sectors = mtd->size / mtd->erasesize;
233421f306fSThomas Chou 	sector_start = ofs / mtd->erasesize;
234421f306fSThomas Chou 	sector_end = (ofs + len) / mtd->erasesize;
235421f306fSThomas Chou 
236421f306fSThomas Chou 	if (sector_start >= num_sectors / 2) {
237421f306fSThomas Chou 		sr_bp = fls(num_sectors - 1 - sector_start) + 1;
238421f306fSThomas Chou 		sr_tb = 0;
239421f306fSThomas Chou 	} else if (sector_end < num_sectors / 2) {
240421f306fSThomas Chou 		sr_bp = fls(sector_end) + 1;
241421f306fSThomas Chou 		sr_tb = 1;
242421f306fSThomas Chou 	} else {
243421f306fSThomas Chou 		sr_bp = 15;
244421f306fSThomas Chou 		sr_tb = 0;
245421f306fSThomas Chou 	}
246421f306fSThomas Chou 
247421f306fSThomas Chou 	mem_op = (sr_tb << 12) | (sr_bp << 8);
248421f306fSThomas Chou 	mem_op |= QUADSPI_MEM_OP_SECTOR_PROTECT;
249421f306fSThomas Chou 	debug("lock %08x\n", mem_op);
250421f306fSThomas Chou 	writel(mem_op, &regs->mem_op);
251421f306fSThomas Chou 
252421f306fSThomas Chou 	return 0;
253421f306fSThomas Chou }
254421f306fSThomas Chou 
255421f306fSThomas Chou static int altera_qspi_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
256421f306fSThomas Chou {
257421f306fSThomas Chou 	struct udevice *dev = mtd->dev;
258421f306fSThomas Chou 	struct altera_qspi_platdata *pdata = dev_get_platdata(dev);
259421f306fSThomas Chou 	struct altera_qspi_regs *regs = pdata->regs;
260421f306fSThomas Chou 	u32 mem_op;
261421f306fSThomas Chou 
262421f306fSThomas Chou 	mem_op = QUADSPI_MEM_OP_SECTOR_PROTECT;
263421f306fSThomas Chou 	debug("unlock %08x\n", mem_op);
264421f306fSThomas Chou 	writel(mem_op, &regs->mem_op);
265421f306fSThomas Chou 
266421f306fSThomas Chou 	return 0;
267421f306fSThomas Chou }
268421f306fSThomas Chou 
26938a0f36eSThomas Chou static int altera_qspi_probe(struct udevice *dev)
27038a0f36eSThomas Chou {
27138a0f36eSThomas Chou 	struct altera_qspi_platdata *pdata = dev_get_platdata(dev);
27238a0f36eSThomas Chou 	struct altera_qspi_regs *regs = pdata->regs;
27338a0f36eSThomas Chou 	unsigned long base = (unsigned long)pdata->base;
27438a0f36eSThomas Chou 	struct mtd_info *mtd;
27538a0f36eSThomas Chou 	flash_info_t *flash = &flash_info[0];
27638a0f36eSThomas Chou 	u32 rdid;
27738a0f36eSThomas Chou 	int i;
27838a0f36eSThomas Chou 
27938a0f36eSThomas Chou 	rdid = readl(&regs->rd_rdid);
28038a0f36eSThomas Chou 	debug("rdid %x\n", rdid);
28138a0f36eSThomas Chou 
28238a0f36eSThomas Chou 	mtd = dev_get_uclass_priv(dev);
28338a0f36eSThomas Chou 	mtd->dev = dev;
28438a0f36eSThomas Chou 	mtd->name		= "nor0";
28538a0f36eSThomas Chou 	mtd->type		= MTD_NORFLASH;
28638a0f36eSThomas Chou 	mtd->flags		= MTD_CAP_NORFLASH;
28738a0f36eSThomas Chou 	mtd->size		= 1 << ((rdid & 0xff) - 6);
28838a0f36eSThomas Chou 	mtd->writesize		= 1;
28938a0f36eSThomas Chou 	mtd->writebufsize	= mtd->writesize;
29038a0f36eSThomas Chou 	mtd->_erase		= altera_qspi_erase;
29138a0f36eSThomas Chou 	mtd->_read		= altera_qspi_read;
29238a0f36eSThomas Chou 	mtd->_write		= altera_qspi_write;
29338a0f36eSThomas Chou 	mtd->_sync		= altera_qspi_sync;
294421f306fSThomas Chou 	mtd->_lock		= altera_qspi_lock;
295421f306fSThomas Chou 	mtd->_unlock		= altera_qspi_unlock;
29638a0f36eSThomas Chou 	mtd->numeraseregions = 0;
29738a0f36eSThomas Chou 	mtd->erasesize = 0x10000;
29838a0f36eSThomas Chou 	if (add_mtd_device(mtd))
29938a0f36eSThomas Chou 		return -ENOMEM;
30038a0f36eSThomas Chou 
30138a0f36eSThomas Chou 	flash->mtd = mtd;
30238a0f36eSThomas Chou 	flash->size = mtd->size;
30338a0f36eSThomas Chou 	flash->sector_count = mtd->size / mtd->erasesize;
30438a0f36eSThomas Chou 	flash->flash_id = rdid;
30538a0f36eSThomas Chou 	flash->start[0] = base;
30638a0f36eSThomas Chou 	for (i = 1; i < flash->sector_count; i++)
30738a0f36eSThomas Chou 		flash->start[i] = flash->start[i - 1] + mtd->erasesize;
30838a0f36eSThomas Chou 	gd->bd->bi_flashstart = base;
30938a0f36eSThomas Chou 
31038a0f36eSThomas Chou 	return 0;
31138a0f36eSThomas Chou }
31238a0f36eSThomas Chou 
31338a0f36eSThomas Chou static int altera_qspi_ofdata_to_platdata(struct udevice *dev)
31438a0f36eSThomas Chou {
31538a0f36eSThomas Chou 	struct altera_qspi_platdata *pdata = dev_get_platdata(dev);
31638a0f36eSThomas Chou 	void *blob = (void *)gd->fdt_blob;
31738a0f36eSThomas Chou 	int node = dev->of_offset;
31838a0f36eSThomas Chou 	const char *list, *end;
31938a0f36eSThomas Chou 	const fdt32_t *cell;
32038a0f36eSThomas Chou 	void *base;
32138a0f36eSThomas Chou 	unsigned long addr, size;
32238a0f36eSThomas Chou 	int parent, addrc, sizec;
32338a0f36eSThomas Chou 	int len, idx;
32438a0f36eSThomas Chou 
32538a0f36eSThomas Chou 	/*
32638a0f36eSThomas Chou 	 * decode regs. there are multiple reg tuples, and they need to
32738a0f36eSThomas Chou 	 * match with reg-names.
32838a0f36eSThomas Chou 	 */
32938a0f36eSThomas Chou 	parent = fdt_parent_offset(blob, node);
33038a0f36eSThomas Chou 	of_bus_default_count_cells(blob, parent, &addrc, &sizec);
33138a0f36eSThomas Chou 	list = fdt_getprop(blob, node, "reg-names", &len);
33238a0f36eSThomas Chou 	if (!list)
33338a0f36eSThomas Chou 		return -ENOENT;
33438a0f36eSThomas Chou 	end = list + len;
33538a0f36eSThomas Chou 	cell = fdt_getprop(blob, node, "reg", &len);
33638a0f36eSThomas Chou 	if (!cell)
33738a0f36eSThomas Chou 		return -ENOENT;
33838a0f36eSThomas Chou 	idx = 0;
33938a0f36eSThomas Chou 	while (list < end) {
34038a0f36eSThomas Chou 		addr = fdt_translate_address((void *)blob,
34138a0f36eSThomas Chou 					     node, cell + idx);
34238a0f36eSThomas Chou 		size = fdt_addr_to_cpu(cell[idx + addrc]);
3438ed38fa5SThomas Chou 		base = map_physmem(addr, size, MAP_NOCACHE);
34438a0f36eSThomas Chou 		len = strlen(list);
34538a0f36eSThomas Chou 		if (strcmp(list, "avl_csr") == 0) {
34638a0f36eSThomas Chou 			pdata->regs = base;
34738a0f36eSThomas Chou 		} else if (strcmp(list, "avl_mem") == 0) {
34838a0f36eSThomas Chou 			pdata->base = base;
34938a0f36eSThomas Chou 			pdata->size = size;
35038a0f36eSThomas Chou 		}
35138a0f36eSThomas Chou 		idx += addrc + sizec;
35238a0f36eSThomas Chou 		list += (len + 1);
35338a0f36eSThomas Chou 	}
35438a0f36eSThomas Chou 
35538a0f36eSThomas Chou 	return 0;
35638a0f36eSThomas Chou }
35738a0f36eSThomas Chou 
35838a0f36eSThomas Chou static const struct udevice_id altera_qspi_ids[] = {
35938a0f36eSThomas Chou 	{ .compatible = "altr,quadspi-1.0" },
36038a0f36eSThomas Chou 	{}
36138a0f36eSThomas Chou };
36238a0f36eSThomas Chou 
36338a0f36eSThomas Chou U_BOOT_DRIVER(altera_qspi) = {
36438a0f36eSThomas Chou 	.name	= "altera_qspi",
36538a0f36eSThomas Chou 	.id	= UCLASS_MTD,
36638a0f36eSThomas Chou 	.of_match = altera_qspi_ids,
36738a0f36eSThomas Chou 	.ofdata_to_platdata = altera_qspi_ofdata_to_platdata,
36838a0f36eSThomas Chou 	.platdata_auto_alloc_size = sizeof(struct altera_qspi_platdata),
36938a0f36eSThomas Chou 	.probe	= altera_qspi_probe,
37038a0f36eSThomas Chou };
371