13 #include <lantiq_soc.h>
16 #define EBU_ADDSEL1 0x24
17 #define EBU_NAND_CON 0xB0
18 #define EBU_NAND_WAIT 0xB4
19 #define EBU_NAND_ECC0 0xB8
20 #define EBU_NAND_ECC_AC 0xBC
23 #define NAND_CMD_ALE (1 << 2)
24 #define NAND_CMD_CLE (1 << 3)
25 #define NAND_CMD_CS (1 << 4)
26 #define NAND_WRITE_CMD_RESET 0xff
27 #define NAND_WRITE_CMD (NAND_CMD_CS | NAND_CMD_CLE)
28 #define NAND_WRITE_ADDR (NAND_CMD_CS | NAND_CMD_ALE)
29 #define NAND_WRITE_DATA (NAND_CMD_CS)
30 #define NAND_READ_DATA (NAND_CMD_CS)
31 #define NAND_WAIT_WR_C (1 << 3)
32 #define NAND_WAIT_RD (0x1)
35 #define ADDSEL1_MASK(x) (x << 4)
36 #define ADDSEL1_REGEN 1
39 #define BUSCON1_SETUP (1 << 22)
40 #define BUSCON1_BCGEN_RES (0x3 << 12)
41 #define BUSCON1_WAITWRC2 (2 << 8)
42 #define BUSCON1_WAITRDC2 (2 << 6)
43 #define BUSCON1_HOLDC1 (1 << 4)
44 #define BUSCON1_RECOVC1 (1 << 2)
45 #define BUSCON1_CMULT4 1
47 #define NAND_CON_CE (1 << 20)
48 #define NAND_CON_OUT_CS1 (1 << 10)
49 #define NAND_CON_IN_CS1 (1 << 8)
50 #define NAND_CON_PRE_P (1 << 7)
51 #define NAND_CON_WP_P (1 << 6)
52 #define NAND_CON_SE_P (1 << 5)
53 #define NAND_CON_CS_P (1 << 4)
54 #define NAND_CON_CSMUX (1 << 1)
55 #define NAND_CON_NANDM 1
73 static void xway_select_chip(
struct mtd_info *mtd,
int chip)
90 static void xway_cmd_ctrl(
struct mtd_info *mtd,
int cmd,
unsigned int ctrl)
110 spin_unlock_irqrestore(&ebu_lock, flags);
114 static int xway_dev_ready(
struct mtd_info *mtd)
119 static unsigned char xway_read_byte(
struct mtd_info *mtd)
128 spin_unlock_irqrestore(&ebu_lock, flags);
135 struct nand_chip *
this = platform_get_drvdata(pdev);
142 if (cs && (*cs == 1))
158 xway_reset_chip(
this);
164 static const char *part_probes[] = {
"cmdlinepart",
"ofpart",
NULL };
170 .part_probe_types = part_probes,
173 .probe = xway_nand_probe,
174 .cmd_ctrl = xway_cmd_ctrl,
175 .dev_ready = xway_dev_ready,
176 .select_chip = xway_select_chip,
177 .read_byte = xway_read_byte,
185 static int __init xway_register_nand(
void)
196 pdev->
dev.platform_data = &xway_nand_data;