13 #include <linux/slab.h>
14 #include <linux/module.h>
21 #define FPGA_NAND_CMD_MASK (0x7 << 28)
22 #define FPGA_NAND_CMD_COMMAND (0x0 << 28)
23 #define FPGA_NAND_CMD_ADDR (0x1 << 28)
24 #define FPGA_NAND_CMD_READ (0x2 << 28)
25 #define FPGA_NAND_CMD_WRITE (0x3 << 28)
26 #define FPGA_NAND_BUSY (0x1 << 15)
27 #define FPGA_NAND_ENABLE (0x1 << 31)
28 #define FPGA_NAND_DATA_SHIFT 16
43 static void socrates_nand_write_buf(
struct mtd_info *mtd,
50 for (i = 0; i < len; i++) {
73 for (i = 0; i < len; i++) {
86 socrates_nand_read_buf(mtd, &byte,
sizeof(byte));
97 socrates_nand_read_buf(mtd, (
uint8_t *)&word,
sizeof(word));
104 static void socrates_nand_cmd_ctrl(
struct mtd_info *mtd,
int cmd,
130 static int socrates_nand_device_ready(
struct mtd_info *mtd)
132 struct nand_chip *nand_chip = mtd->
priv;
147 struct nand_chip *nand_chip;
155 "socrates_nand: failed to allocate device structure.\n");
160 if (host->io_base ==
NULL) {
167 nand_chip = &host->nand_chip;
168 host->dev = &ofdev->
dev;
170 nand_chip->
priv = host;
171 mtd->
priv = nand_chip;
172 mtd->
name =
"socrates_nand";
174 mtd->
dev.parent = &ofdev->
dev;
178 nand_chip->
IO_ADDR_R = (
void *)0xdeadbeef;
179 nand_chip->
IO_ADDR_W = (
void *)0xdeadbeef;
181 nand_chip->
cmd_ctrl = socrates_nand_cmd_ctrl;
182 nand_chip->
read_byte = socrates_nand_read_byte;
183 nand_chip->
read_word = socrates_nand_read_word;
184 nand_chip->
write_buf = socrates_nand_write_buf;
185 nand_chip->
read_buf = socrates_nand_read_buf;
186 nand_chip->
dev_ready = socrates_nand_device_ready;
237 static const struct of_device_id socrates_nand_match[] =
240 .compatible =
"abb,socrates-nand",
249 .name =
"socrates_nand",
251 .of_match_table = socrates_nand_match,
253 .probe = socrates_nand_probe,