summaryrefslogtreecommitdiff
path: root/target/linux
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2007-07-18 12:13:37 +0000
committerFlorian Fainelli <florian@openwrt.org>2007-07-18 12:13:37 +0000
commit6c8cf15dae1d1628a3775d33730ba9e450ad6c92 (patch)
tree8e8718700b268bc6789443ecd51077ebed5721d7 /target/linux
parent703153432567b2f5d1651831345009f4d4cd288c (diff)
downloadmtk-20170518-6c8cf15dae1d1628a3775d33730ba9e450ad6c92.zip
mtk-20170518-6c8cf15dae1d1628a3775d33730ba9e450ad6c92.tar.gz
mtk-20170518-6c8cf15dae1d1628a3775d33730ba9e450ad6c92.tar.bz2
Load the appropriate MTD driver if we were booted from NOR/NAND only, use the TRX mapping by default if bootloader unknown
SVN-Revision: 8032
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/adm5120-2.6/files/drivers/mtd/maps/adm5120_mtd.c6
-rw-r--r--target/linux/adm5120-2.6/files/drivers/mtd/nand/rbmipsnand.c14
2 files changed, 15 insertions, 5 deletions
diff --git a/target/linux/adm5120-2.6/files/drivers/mtd/maps/adm5120_mtd.c b/target/linux/adm5120-2.6/files/drivers/mtd/maps/adm5120_mtd.c
index 230fcee..3abad32 100644
--- a/target/linux/adm5120-2.6/files/drivers/mtd/maps/adm5120_mtd.c
+++ b/target/linux/adm5120-2.6/files/drivers/mtd/maps/adm5120_mtd.c
@@ -407,6 +407,10 @@ int __init init_adm5120_map(void)
struct mtd_partition *parts;
int i, parsed_nr_parts = 0;
#endif
+
+ if (adm5120_nand_boot)
+ return -ENODEV;
+
printk("adm5120 : flash init : 0x%08x 0x%08x\n", WINDOW_ADDR, adm5120_board.flash0_size);
adm5120_map.virt = ioremap_nocache(WINDOW_ADDR, adm5120_board.flash0_size);
@@ -433,7 +437,7 @@ int __init init_adm5120_map(void)
#ifdef CONFIG_MTD_PARTITIONS
- if (adm5120_boot_loader == BOOT_LOADER_CFE)
+ if (adm5120_boot_loader == BOOT_LOADER_CFE || adm5120_boot_loader == BOOT_LOADER_UNKNOWN)
{
printk(KERN_NOTICE "adm5120 : using CFE flash mapping\n");
parts = init_mtd_partitions(adm5120_mtd, size);
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 306b97c..5b98833 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 <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include <linux/delay.h>
+
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/bootinfo.h>
+#include <asm/mach-adm5120/adm5120_info.h>
+#include <asm/mach-adm5120/adm5120_defs.h>
-#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;