X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/45bf06555383e453574d8ebb1d19b4fc4d649572..ae505386e5e915bcd43f9f178f379da4a5df9cad:/target/linux/adm5120-2.6/files/drivers/mtd/nand/rbmipsnand.c diff --git a/target/linux/adm5120-2.6/files/drivers/mtd/nand/rbmipsnand.c b/target/linux/adm5120-2.6/files/drivers/mtd/nand/rbmipsnand.c index 306b97cc7..5b98833c0 100644 --- a/target/linux/adm5120-2.6/files/drivers/mtd/nand/rbmipsnand.c +++ b/target/linux/adm5120-2.6/files/drivers/mtd/nand/rbmipsnand.c @@ -13,12 +13,14 @@ #include #include #include + #include #include #include +#include +#include -#define SMEM1_BASE 0x10000000 // from ADM5120 documentation -#define SMEM1(x) (*((volatile unsigned char *) (KSEG1ADDR(SMEM1_BASE) + x))) +#define SMEM1(x) (*((volatile unsigned char *) (KSEG1ADDR(ADM5120_SRAM1_BASE) + x))) #define NAND_RW_REG 0x0 //data register #define NAND_SET_CEn 0x1 //CE# low @@ -86,6 +88,10 @@ unsigned get_rbnand_block_size(void) { EXPORT_SYMBOL(get_rbnand_block_size); int __init rbmips_init(void) { + + if (!adm5120_nand_boot) + return -ENODEV; + memset(&rmtd, 0, sizeof(rmtd)); memset(&rnand, 0, sizeof(rnand)); printk(KERN_INFO "RB1xx nand\n"); @@ -93,11 +99,11 @@ int __init rbmips_init(void) { MEM32(0xB2000008) = 0x1; SMEM1(NAND_SET_SPn) = 0x01; SMEM1(NAND_CLR_WPn) = 0x01; - rnand.IO_ADDR_R = (unsigned char *)KSEG1ADDR(SMEM1_BASE); + rnand.IO_ADDR_R = (unsigned char *)KSEG1ADDR(ADM5120_SRAM1_BASE); rnand.IO_ADDR_W = rnand.IO_ADDR_R; rnand.cmd_ctrl = rbmips_hwcontrol100; rnand.dev_ready = rb100_dev_ready; - p_nand = (void __iomem *)ioremap(( unsigned long)SMEM1_BASE, 0x1000); + p_nand = (void __iomem *)ioremap(( unsigned long)ADM5120_SRAM1_BASE, 0x1000); if (!p_nand) { printk(KERN_WARNING "RB1xx nand Unable ioremap buffer\n"); return -ENXIO;