summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Crispin <john@openwrt.org>2011-07-03 17:38:11 +0000
committerJohn Crispin <john@openwrt.org>2011-07-03 17:38:11 +0000
commit43771202d35da68615a4af0743816aabe97a85e4 (patch)
tree8f97e9402a68032268cfe93b3189b6ed16c60bc5
parentd43cbe24a5397078d936f85b2afed3b2490dfc2c (diff)
downloadmtk-20170518-43771202d35da68615a4af0743816aabe97a85e4.zip
mtk-20170518-43771202d35da68615a4af0743816aabe97a85e4.tar.gz
mtk-20170518-43771202d35da68615a4af0743816aabe97a85e4.tar.bz2
update lantiq/falcon patches
SVN-Revision: 27406
-rw-r--r--target/linux/lantiq/falcon-stable/config-default1
-rw-r--r--target/linux/lantiq/falcon-stable/profiles1
-rw-r--r--target/linux/lantiq/falcon-stable/target.mk11
-rw-r--r--target/linux/lantiq/falcon/config-default10
-rw-r--r--target/linux/lantiq/image/Makefile2
-rw-r--r--target/linux/lantiq/patches-2.6.32/110-falcon_board.patch354
-rw-r--r--target/linux/lantiq/patches-2.6.32/140-falcon-easy98000-cpld-led.patch6
-rw-r--r--target/linux/lantiq/patches-2.6.32/150-falcon-easy98020.patch30
-rw-r--r--target/linux/lantiq/patches-2.6.32/160-falcon-95C3AM1.patch12
-rw-r--r--target/linux/lantiq/patches-2.6.32/230-cmdline_hack.patch15
-rw-r--r--target/linux/lantiq/patches-2.6.32/350-dm9000-polling.patch119
-rw-r--r--target/linux/lantiq/patches-2.6.39/110-falcon_board.patch320
-rw-r--r--target/linux/lantiq/patches-2.6.39/140-falcon-easy98000-cpld-led.patch6
-rw-r--r--target/linux/lantiq/patches-2.6.39/150-falcon-easy98020.patch22
-rw-r--r--target/linux/lantiq/patches-2.6.39/350-dm9000-polling.patch116
15 files changed, 960 insertions, 65 deletions
diff --git a/target/linux/lantiq/falcon-stable/config-default b/target/linux/lantiq/falcon-stable/config-default
new file mode 100644
index 0000000..1b7582f
--- /dev/null
+++ b/target/linux/lantiq/falcon-stable/config-default
@@ -0,0 +1 @@
+../falcon/config-2.6.32 \ No newline at end of file
diff --git a/target/linux/lantiq/falcon-stable/profiles b/target/linux/lantiq/falcon-stable/profiles
new file mode 100644
index 0000000..72ebc8e
--- /dev/null
+++ b/target/linux/lantiq/falcon-stable/profiles
@@ -0,0 +1 @@
+../falcon/profiles \ No newline at end of file
diff --git a/target/linux/lantiq/falcon-stable/target.mk b/target/linux/lantiq/falcon-stable/target.mk
new file mode 100644
index 0000000..3f007a6
--- /dev/null
+++ b/target/linux/lantiq/falcon-stable/target.mk
@@ -0,0 +1,11 @@
+
+include $(PLATFORM_SUBDIR)/../falcon/target.mk
+
+LINUX_VERSION:=2.6.32.33
+
+SUBTARGET:=falcon-stable
+BOARDNAME:=Falcon-Stable
+
+define Target/Description
+ Lantiq Falcon (Stable Kernel)
+endef
diff --git a/target/linux/lantiq/falcon/config-default b/target/linux/lantiq/falcon/config-default
index 3ab44e2..91d1f3a 100644
--- a/target/linux/lantiq/falcon/config-default
+++ b/target/linux/lantiq/falcon/config-default
@@ -1,4 +1,3 @@
-# CONFIG_ALTERA_STAPL is not set
# CONFIG_ARCH_DMA_ADDR_T_64BIT is not set
# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set
# CONFIG_ATH79 is not set
@@ -30,18 +29,20 @@ CONFIG_IFX_VPE_EXT=y
CONFIG_LANTIQ_MACH_95C3AM1=y
CONFIG_LANTIQ_MACH_EASY98000=y
CONFIG_LANTIQ_MACH_EASY98020=y
-# CONFIG_LEDS_LM3530 is not set
CONFIG_M25PXX_USE_FAST_READ=y
CONFIG_MACH_NO_WESTBRIDGE=y
# CONFIG_MFD_MAX8997 is not set
-# CONFIG_MFD_WL1273_CORE is not set
# CONFIG_MINIX_FS_NATIVE_ENDIAN is not set
CONFIG_MIPS_MT=y
# CONFIG_MIPS_VPE_APSP_API is not set
CONFIG_MIPS_VPE_LOADER=y
CONFIG_MIPS_VPE_LOADER_TOM=y
-# CONFIG_MTD_LATCH_ADDR is not set
CONFIG_MTD_M25P80=y
+CONFIG_MTD_NAND=y
+CONFIG_MTD_NAND_ECC=y
+# CONFIG_MTD_NAND_ECC_BCH is not set
+CONFIG_MTD_NAND_PLATFORM=y
+# CONFIG_MTD_SM_COMMON is not set
CONFIG_MTSCHED=y
CONFIG_NEED_DMA_MAP_STATE=y
CONFIG_NEED_PER_CPU_KM=y
@@ -58,5 +59,4 @@ CONFIG_SPI=y
CONFIG_SPI_FALCON=y
# CONFIG_SPI_GPIO is not set
CONFIG_SPI_MASTER=y
-# CONFIG_TPS6105X is not set
CONFIG_XZ_DEC=y
diff --git a/target/linux/lantiq/image/Makefile b/target/linux/lantiq/image/Makefile
index 81291cc..b1ef0a5 100644
--- a/target/linux/lantiq/image/Makefile
+++ b/target/linux/lantiq/image/Makefile
@@ -190,7 +190,7 @@ define Image/Build/Profile/Generic
endef
endif
-ifeq ($(CONFIG_TARGET_lantiq_falcon),y)
+ifeq ($(CONFIG_TARGET_lantiq_falcon)$(CONFIG_TARGET_lantiq_falcon_stable),y)
define Image/BuildKernel/Profile/Generic
$(call Image/BuildKernel/Template,EASY98000,$(falcon_cmdline))
$(call Image/BuildKernel/Template,EASY98020,$(falcon_cmdline))
diff --git a/target/linux/lantiq/patches-2.6.32/110-falcon_board.patch b/target/linux/lantiq/patches-2.6.32/110-falcon_board.patch
index 9151463..db33d5a 100644
--- a/target/linux/lantiq/patches-2.6.32/110-falcon_board.patch
+++ b/target/linux/lantiq/patches-2.6.32/110-falcon_board.patch
@@ -14,9 +14,10 @@
+endif
--- /dev/null
+++ b/arch/mips/lantiq/falcon/Makefile
-@@ -0,0 +1,3 @@
+@@ -0,0 +1,4 @@
+obj-y := clk-falcon.o devices.o gpio.o prom.o sysctrl.o reset.o
+obj-y += softdog_vpe.o
++obj-$(CONFIG_LANTIQ_MACH_EASY98000) += addon-easy98000.o
+obj-$(CONFIG_LANTIQ_MACH_EASY98000) += mach-easy98000.o
--- /dev/null
+++ b/arch/mips/lantiq/falcon/clk-falcon.c
@@ -71,7 +72,7 @@
+EXPORT_SYMBOL(ltq_get_fpi_hz);
--- /dev/null
+++ b/arch/mips/lantiq/falcon/devices.c
-@@ -0,0 +1,180 @@
+@@ -0,0 +1,254 @@
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/types.h>
@@ -88,6 +89,7 @@
+#include <linux/gpio.h>
+#include <linux/leds.h>
+#include <linux/spi/spi.h>
++#include <linux/mtd/nand.h>
+
+#include <asm/bootinfo.h>
+#include <asm/irq.h>
@@ -96,6 +98,7 @@
+
+#include <falcon/falcon_irq.h>
+#include <falcon/gpon_reg_base.h>
++#include <falcon/ebu_reg.h>
+#include <falcon/sys1_reg.h>
+#include <falcon/sys_eth_reg.h>
+
@@ -183,6 +186,78 @@
+ platform_device_register(&ltq_spi);
+}
+
++/* nand flash */
++static struct gpon_reg_ebu __iomem *membase_ebu;
++static const char *part_probes[] = { "cmdlinepart", NULL };
++
++static int falcon_nand_ready(struct mtd_info *mtd)
++{
++ u32 modcon = __raw_readl(&membase_ebu->modcon);
++
++ return (((modcon & (MODCON_STS|MODCON_STSEDGE)) ==
++ (MODCON_STS|MODCON_STSEDGE)));
++}
++
++/* address lines used for NAND control signals */
++#define NAND_ADDR_ALE (1<<16)
++#define NAND_ADDR_CLE (1<<17)
++
++static void falcon_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl)
++{
++ struct nand_chip *this = mtd->priv;
++ unsigned long nandaddr = (unsigned long) this->IO_ADDR_W;
++
++ if (ctrl & NAND_CTRL_CHANGE) {
++ nandaddr &= ~(NAND_ADDR_ALE | NAND_ADDR_CLE);
++
++ if (ctrl & NAND_CLE)
++ nandaddr |= NAND_ADDR_CLE;
++ if (ctrl & NAND_ALE)
++ nandaddr |= NAND_ADDR_ALE;
++
++ this->IO_ADDR_W = (void __iomem *) nandaddr;
++ }
++
++ if (cmd != NAND_CMD_NONE)
++ writeb(cmd, this->IO_ADDR_W);
++}
++
++static struct platform_nand_data falcon_flash_nand_data = {
++ .chip = {
++ .nr_chips = 1,
++ .chip_delay = 25,
++ .part_probe_types = part_probes,
++ },
++ .ctrl = {
++ .cmd_ctrl = falcon_hwcontrol,
++ .dev_ready = falcon_nand_ready,
++ }
++};
++
++static struct resource ltq_nand_resources[] = {
++ MEM_RES("nand", LTQ_FLASH_START, LTQ_FLASH_START + LTQ_FLASH_MAX - 1),
++ MEM_RES("ebu", GPON_EBU_BASE, GPON_EBU_END),
++};
++
++static struct platform_device ltq_flash_nand = {
++ .name = "gen_nand",
++ .id = -1,
++ .num_resources = ARRAY_SIZE(ltq_nand_resources),
++ .resource = ltq_nand_resources,
++ .dev = {
++ .platform_data = &falcon_flash_nand_data,
++ },
++};
++
++void __init falcon_register_nand(void)
++{
++ membase_ebu = ioremap_nocache(ltq_nand_resources[1].start,
++ resource_size(&ltq_nand_resources[1]));
++
++ if (membase_ebu)
++ platform_device_register(&ltq_flash_nand);
++}
++
+/* watchdog */
+static struct resource falcon_wdt_resource =
+ MEM_RES("watchdog",GPON_WDT_BASE,GPON_WDT_END);
@@ -254,7 +329,7 @@
+}
--- /dev/null
+++ b/arch/mips/lantiq/falcon/devices.h
-@@ -0,0 +1,21 @@
+@@ -0,0 +1,22 @@
+#ifndef _FALCON_DEVICES_H__
+#define _FALCON_DEVICES_H__
+
@@ -267,6 +342,7 @@
+extern void __init falcon_register_spi_flash(struct spi_board_info *data);
+extern void __init falcon_register_gpio(void);
+extern void __init falcon_register_nor(struct physmap_flash_data *data);
++extern void __init falcon_register_nand(void);
+extern void __init falcon_register_wdt(void);
+extern void __init falcon_register_crypto(void);
+
@@ -333,7 +409,7 @@
+}
--- /dev/null
+++ b/arch/mips/lantiq/falcon/sysctrl.c
-@@ -0,0 +1,381 @@
+@@ -0,0 +1,380 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
@@ -581,10 +657,9 @@
+ /* clock already active, no need to change here */
+ return;
+
-+ if (status_r32(config) == 0)
-+ aeFreq = 1; /* use 625MHz on unfused chip */
-+ else
-+ aeFreq = (status_r32(config) & STATUS_CONFIG_GPEFREQ_MASK) >> STATUS_CONFIG_GPEFREQ_OFFSET;
++ aeFreq = (status_r32(config) & STATUS_CONFIG_GPEFREQ_MASK) >> STATUS_CONFIG_GPEFREQ_OFFSET;
++ if (aeFreq == 0)
++ aeFreq = 1; /* use 625MHz on invalid value 0 */
+ rd_data = sys1_r32(infrac);
+ /* clear gpe-fsel and enable bits */
+ rd_data_to_keep = rd_data & ~(7<<(INFRAC_GP_OFFSET+1));
@@ -1202,7 +1277,7 @@
+#endif
--- /dev/null
+++ b/arch/mips/lantiq/falcon/reset.c
-@@ -0,0 +1,80 @@
+@@ -0,0 +1,65 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
@@ -1225,10 +1300,6 @@
+
+static struct gpon_reg_sys1 * const pSYS1 = (struct gpon_reg_sys1 *)GPON_SYS1_BASE;
+
-+#define WDT_PW1 0x00BE0000
-+#define WDT_PW2 0x00DC0000
-+#define WDT_REG_BASE (KSEG1 | 0x1F8803F0)
-+
+/* This function is used by the watchdog driver */
+int ltq_reset_cause(void)
+{
@@ -1242,18 +1313,7 @@
+ printk(KERN_NOTICE "System restart\n");
+ local_irq_disable();
+ ltq_w32(0, (void*)0xBF200000); /* reset Bootreg RVEC */
-+#if 0
+ ltq_w32(RBT_CPU_TRIG, &pSYS1->rbt);
-+#else
-+ /* use workaround via watchdog timer */
-+ ltq_w32(WDT_PW1, (void*)WDT_REG_BASE);
-+ ltq_w32(WDT_PW2 |
-+ (0x3 << 26) | /* PWL */
-+ (0x2 << 24) | /* CLKDIV */
-+ (0x1 << 31) | /* enable */
-+ (1), /* reload */
-+ (void*)WDT_REG_BASE);
-+#endif
+ for(;;);
+}
+
@@ -1285,7 +1345,7 @@
+arch_initcall(mips_reboot_setup);
--- /dev/null
+++ b/arch/mips/lantiq/falcon/mach-easy98000.c
-@@ -0,0 +1,247 @@
+@@ -0,0 +1,263 @@
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/leds.h>
@@ -1423,8 +1483,12 @@
+ }
+};
+
++extern int easy98000_addon_has_dm9000(void);
+static void __init register_davicom(void)
+{
++ if (!easy98000_addon_has_dm9000())
++ return;
++
+ if (!is_valid_ether_addr(ltq_ethaddr))
+ random_ether_addr(dm9000_plat_data.dev_addr);
+ else {
@@ -1448,9 +1512,10 @@
+ }
+};
+
-+void __init register_easy98000_cpld_led(void)
++void __init register_easy98000_cpld(void)
+{
+ platform_device_register_simple("easy98000_cpld_led", 0, NULL, 0);
++ platform_device_register_simple("easy98000_addon", 0, NULL, 0);
+}
+
+/* setup gpio based spi bus/device for access to the eeprom on the board */
@@ -1507,7 +1572,7 @@
+ register_davicom();
+ ltq_add_device_leds_gpio(-1, ARRAY_SIZE(easy98000_leds_gpio),
+ easy98000_leds_gpio);
-+ register_easy98000_cpld_led();
++ register_easy98000_cpld();
+ falcon_register_crypto();
+ easy98000_spi_gpio_init();
+}
@@ -1524,6 +1589,12 @@
+ falcon_register_spi_flash(&easy98000_spi_flash_data);
+}
+
++static void __init easy98000nand_init(void)
++{
++ easy98000_init_common();
++ falcon_register_nand();
++}
++
+MIPS_MACHINE(LANTIQ_MACH_EASY98000,
+ "EASY98000",
+ "EASY98000 Eval Board",
@@ -1533,6 +1604,11 @@
+ "EASY98000SF",
+ "EASY98000 Eval Board (Serial Flash)",
+ easy98000sf_init);
++
++MIPS_MACHINE(LANTIQ_MACH_EASY98000NAND,
++ "EASY98000NAND",
++ "EASY98000 Eval Board (NAND Flash)",
++ easy98000nand_init);
--- /dev/null
+++ b/arch/mips/lantiq/falcon/softdog_vpe.c
@@ -0,0 +1,109 @@
@@ -1694,7 +1770,7 @@
+#endif
--- a/arch/mips/lantiq/Kconfig
+++ b/arch/mips/lantiq/Kconfig
-@@ -16,8 +16,12 @@
+@@ -16,8 +16,12 @@ config SOC_XWAY
bool "XWAY"
select SOC_TYPE_XWAY
select HW_HAS_PCI
@@ -1709,21 +1785,21 @@
endif
--- a/arch/mips/lantiq/Makefile
+++ b/arch/mips/lantiq/Makefile
-@@ -9,3 +9,4 @@
+@@ -9,3 +9,4 @@ obj-y := irq.o setup.o clk.o prom.o devi
obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
obj-$(CONFIG_SOC_TYPE_XWAY) += xway/
+obj-$(CONFIG_SOC_FALCON) += falcon/
--- a/arch/mips/lantiq/Platform
+++ b/arch/mips/lantiq/Platform
-@@ -6,3 +6,4 @@
+@@ -6,3 +6,4 @@ platform-$(CONFIG_LANTIQ) += lantiq/
cflags-$(CONFIG_LANTIQ) += -I$(srctree)/arch/mips/include/asm/mach-lantiq
load-$(CONFIG_LANTIQ) = 0xffffffff80002000
cflags-$(CONFIG_SOC_TYPE_XWAY) += -I$(srctree)/arch/mips/include/asm/mach-lantiq/xway
+cflags-$(CONFIG_SOC_FALCON) += -I$(srctree)/arch/mips/include/asm/mach-lantiq/falcon
--- a/arch/mips/lantiq/machtypes.h
+++ b/arch/mips/lantiq/machtypes.h
-@@ -15,6 +15,11 @@
+@@ -15,6 +15,12 @@ enum lantiq_mach_type {
LTQ_MACH_GENERIC = 0,
LTQ_MACH_EASY50712, /* Danube evaluation board */
LTQ_MACH_EASY50601, /* Amazon SE evaluation board */
@@ -1731,7 +1807,223 @@
+ /* FALCON */
+ LANTIQ_MACH_EASY98000, /* Falcon Eval Board, NOR Flash */
+ LANTIQ_MACH_EASY98000SF, /* Falcon Eval Board, Serial Flash */
++ LANTIQ_MACH_EASY98000NAND, /* Falcon Eval Board, NAND Flash */
+ LANTIQ_MACH_EASY98020, /* Falcon Reference Board */
};
#endif
+--- /dev/null
++++ b/arch/mips/lantiq/falcon/addon-easy98000.c
+@@ -0,0 +1,212 @@
++/*
++ * EASY98000 CPLD Addon driver
++ *
++ * Copyright (C) 2011 Thomas Langer <thomas.langer@lantiq.com>
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License version 2 as published
++ * by the Free Software Foundation.
++ *
++ */
++
++#include <linux/kernel.h>
++#include <linux/version.h>
++#include <linux/types.h>
++#include <linux/init.h>
++#include <linux/platform_device.h>
++#include <linux/errno.h>
++#include <linux/slab.h>
++#include <linux/proc_fs.h>
++#include <linux/seq_file.h>
++
++struct easy98000_reg_cpld {
++ u16 cmdreg1; /* 0x1 */
++ u16 cmdreg0; /* 0x0 */
++ u16 idreg0; /* 0x3 */
++ u16 resreg; /* 0x2 */
++ u16 intreg; /* 0x5 */
++ u16 idreg1; /* 0x4 */
++ u16 ledreg; /* 0x7 */
++ u16 pcmconconfig; /* 0x6 */
++ u16 res0; /* 0x9 */
++ u16 ethledreg; /* 0x8 */
++ u16 res1[4]; /* 0xa-0xd */
++ u16 cpld1v; /* 0xf */
++ u16 cpld2v; /* 0xe */
++};
++static struct easy98000_reg_cpld * const cpld =
++ (struct easy98000_reg_cpld *)(KSEG1 | 0x17c00000);
++#define cpld_r8(reg) (__raw_readw(&cpld->reg) & 0xFF)
++#define cpld_w8(val, reg) __raw_writew((val) & 0xFF, &cpld->reg)
++
++int easy98000_addon_has_dm9000(void)
++{
++ if ((cpld_r8(idreg0) & 0xF) == 1)
++ return 1;
++ return 0;
++}
++
++#if defined(CONFIG_PROC_FS)
++typedef void (*cpld_dump) (struct seq_file *s);
++struct proc_entry {
++ char *name;
++ void *callback;
++};
++
++static int cpld_proc_show ( struct seq_file *s, void *p )
++{
++ cpld_dump dump = s->private;
++
++ if ( dump != NULL )
++ dump(s);
++
++ return 0;
++}
++
++static int cpld_proc_open ( struct inode *inode, struct file *file )
++{
++ return single_open ( file, cpld_proc_show, PDE(inode)->data );
++}
++
++static void cpld_versions_get ( struct seq_file *s )
++{
++ seq_printf(s, "CPLD1: V%d\n", cpld_r8(cpld1v));
++ seq_printf(s, "CPLD2: V%d\n", cpld_r8(cpld2v));
++}
++
++static void cpld_ebu_module_get ( struct seq_file *s )
++{
++ u8 addon_id;
++
++ addon_id = cpld_r8(idreg0) & 0xF;
++ switch (addon_id) {
++ case 0xF: /* nothing connected */
++ break;
++ case 1:
++ seq_printf(s, "Ethernet Controller module (dm9000)\n");
++ break;
++ default:
++ seq_printf(s, "Unknown EBU module (EBU_ID=0x%02X)\n", addon_id);
++ break;
++ }
++}
++
++static void cpld_xmii_module_get ( struct seq_file *s )
++{
++ u8 addon_id;
++ char *mod = NULL;
++
++ addon_id = cpld_r8(idreg1) & 0xF;
++ switch (addon_id) {
++ case 0xF:
++ mod = "no module";
++ break;
++ case 0x1:
++ mod = "RGMII module";
++ break;
++ case 0x4:
++ mod = "GMII MAC Mode (XWAY TANTOS-3G)";
++ break;
++ case 0x6:
++ mod = "TMII MAC Mode (XWAY TANTOS-3G)";
++ break;
++ case 0x8:
++ mod = "GMII PHY module";
++ break;
++ case 0x9:
++ mod = "MII PHY module";
++ break;
++ case 0xA:
++ mod = "RMII PHY module";
++ break;
++ default:
++ break;
++ }
++ if (mod)
++ seq_printf(s, "%s\n", mod);
++ else
++ seq_printf(s, "unknown xMII module (xMII_ID=0x%02X)\n", addon_id);
++}
++
++static struct proc_entry proc_entries[] = {
++ {"versions", cpld_versions_get},
++ {"ebu", cpld_ebu_module_get},
++ {"xmii", cpld_xmii_module_get},
++};
++
++static struct file_operations ops = {
++ .owner = THIS_MODULE,
++ .open = cpld_proc_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
++static void cpld_proc_entry_create(struct proc_dir_entry *parent_node,
++ struct proc_entry *proc_entry)
++{
++ proc_create_data ( proc_entry->name, (S_IFREG | S_IRUGO), parent_node,
++ &ops, proc_entry->callback);
++}
++
++static int cpld_proc_install(void)
++{
++ struct proc_dir_entry *driver_proc_node;
++
++ driver_proc_node = proc_mkdir("cpld", NULL);
++ if (driver_proc_node != NULL) {
++ int i;
++ for (i = 0; i < ARRAY_SIZE(proc_entries); i++)
++ cpld_proc_entry_create(driver_proc_node,
++ &proc_entries[i]);
++ } else {
++ printk("cannot create proc entry");
++ return -1;
++ }
++ return 0;
++}
++#else
++static inline int cpld_proc_install(void) {}
++#endif
++
++static int easy98000_addon_probe(struct platform_device *pdev)
++{
++ return cpld_proc_install();
++}
++
++static int easy98000_addon_remove(struct platform_device *pdev)
++{
++#if defined(CONFIG_PROC_FS)
++ char buf[64];
++ int i;
++
++ for (i = 0; i < sizeof(proc_entries) / sizeof(proc_entries[0]); i++) {
++ sprintf(buf, "cpld/%s", proc_entries[i].name);
++ remove_proc_entry(buf, 0);
++ }
++ remove_proc_entry("cpld", 0);
++#endif
++ return 0;
++}
++
++static struct platform_driver easy98000_addon_driver = {
++ .probe = easy98000_addon_probe,
++ .remove = __devexit_p(easy98000_addon_remove),
++ .driver = {
++ .name = "easy98000_addon",
++ .owner = THIS_MODULE,
++ },
++};
++
++int __init easy98000_addon_init(void)
++{
++ return platform_driver_register(&easy98000_addon_driver);
++}
++
++void __exit easy98000_addon_exit(void)
++{
++ platform_driver_unregister(&easy98000_addon_driver);
++}
++
++module_init(easy98000_addon_init);
++module_exit(easy98000_addon_exit);
diff --git a/target/linux/lantiq/patches-2.6.32/140-falcon-easy98000-cpld-led.patch b/target/linux/lantiq/patches-2.6.32/140-falcon-easy98000-cpld-led.patch
index f623b2e..c93c3e7 100644
--- a/target/linux/lantiq/patches-2.6.32/140-falcon-easy98000-cpld-led.patch
+++ b/target/linux/lantiq/patches-2.6.32/140-falcon-easy98000-cpld-led.patch
@@ -1,8 +1,8 @@
--- a/arch/mips/lantiq/falcon/Makefile
+++ b/arch/mips/lantiq/falcon/Makefile
-@@ -1,3 +1,4 @@
- obj-y := clk-falcon.o devices.o gpio.o prom.o sysctrl.o reset.o
+@@ -2,3 +2,4 @@ obj-y := clk-falcon.o devices.o gpio.o p
obj-y += softdog_vpe.o
+ obj-$(CONFIG_LANTIQ_MACH_EASY98000) += addon-easy98000.o
obj-$(CONFIG_LANTIQ_MACH_EASY98000) += mach-easy98000.o
+obj-$(CONFIG_LANTIQ_MACH_EASY98000) += dev-leds-easy98000-cpld.o
--- /dev/null
@@ -141,7 +141,7 @@
+
+static struct platform_driver led_driver = {
+ .probe = led_probe,
-+ .remove = led_remove,
++ .remove = __devexit_p(led_remove),
+ .driver = {
+ .name = LED_NAME,
+ .owner = THIS_MODULE,
diff --git a/target/linux/lantiq/patches-2.6.32/150-falcon-easy98020.patch b/target/linux/lantiq/patches-2.6.32/150-falcon-easy98020.patch
index e9593c5..6b0c5fe 100644
--- a/target/linux/lantiq/patches-2.6.32/150-falcon-easy98020.patch
+++ b/target/linux/lantiq/patches-2.6.32/150-falcon-easy98020.patch
@@ -1,6 +1,6 @@
--- /dev/null
+++ b/arch/mips/lantiq/falcon/mach-easy98020.c
-@@ -0,0 +1,97 @@
+@@ -0,0 +1,115 @@
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/leds.h>
@@ -21,8 +21,10 @@
+#define EASY98020_GPIO_LED_1 10
+#define EASY98020_GPIO_LED_2 11
+#define EASY98020_GPIO_LED_3 12
-+
-+extern unsigned char ltq_ethaddr[6];
++#define EASY98020_GPIO_LED_GE0_ACT 110
++#define EASY98020_GPIO_LED_GE0_LINK 109
++#define EASY98020_GPIO_LED_GE1_ACT 106
++#define EASY98020_GPIO_LED_GE1_LINK 105
+
+#ifdef CONFIG_MTD_PARTITIONS
+static struct mtd_partition easy98020_spi_partitions[] =
@@ -79,6 +81,22 @@
+ .name = "easy98020:green:3",
+ .gpio = EASY98020_GPIO_LED_3,
+ .active_low = 0,
++ }, {
++ .name = "easy98020:ge0_act",
++ .gpio = EASY98020_GPIO_LED_GE0_ACT,
++ .active_low = 0,
++ }, {
++ .name = "easy98020:ge0_link",
++ .gpio = EASY98020_GPIO_LED_GE0_LINK,
++ .active_low = 0,
++ }, {
++ .name = "easy98020:ge1_act",
++ .gpio = EASY98020_GPIO_LED_GE1_ACT,
++ .active_low = 0,
++ }, {
++ .name = "easy98020:ge1_link",
++ .gpio = EASY98020_GPIO_LED_GE1_LINK,
++ .active_low = 0,
+ }
+};
+
@@ -100,7 +118,7 @@
+ easy98020_init);
--- a/arch/mips/lantiq/falcon/Kconfig
+++ b/arch/mips/lantiq/falcon/Kconfig
-@@ -6,6 +6,10 @@
+@@ -6,6 +6,10 @@ config LANTIQ_MACH_EASY98000
bool "Easy98000"
default y
@@ -113,8 +131,8 @@
endif
--- a/arch/mips/lantiq/falcon/Makefile
+++ b/arch/mips/lantiq/falcon/Makefile
-@@ -2,3 +2,4 @@
- obj-y += softdog_vpe.o
+@@ -3,3 +3,4 @@ obj-y += softdog_vpe.o
+ obj-$(CONFIG_LANTIQ_MACH_EASY98000) += addon-easy98000.o
obj-$(CONFIG_LANTIQ_MACH_EASY98000) += mach-easy98000.o
obj-$(CONFIG_LANTIQ_MACH_EASY98000) += dev-leds-easy98000-cpld.o
+obj-$(CONFIG_LANTIQ_MACH_EASY98020) += mach-easy98020.o
diff --git a/target/linux/lantiq/patches-2.6.32/160-falcon-95C3AM1.patch b/target/linux/lantiq/patches-2.6.32/160-falcon-95C3AM1.patch
index 0347037..37e57c2 100644
--- a/target/linux/lantiq/patches-2.6.32/160-falcon-95C3AM1.patch
+++ b/target/linux/lantiq/patches-2.6.32/160-falcon-95C3AM1.patch
@@ -1,6 +1,6 @@
--- /dev/null
+++ b/arch/mips/lantiq/falcon/mach-95C3AM1.c
-@@ -0,0 +1,103 @@
+@@ -0,0 +1,101 @@
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/i2c-gpio.h>
@@ -14,8 +14,6 @@
+#define BOARD_95C3AM1_GPIO_LED_2 12
+#define BOARD_95C3AM1_GPIO_LED_3 13
+
-+extern unsigned char ltq_ethaddr[6];
-+
+#ifdef CONFIG_MTD_PARTITIONS
+static struct mtd_partition board_95C3AM1_partitions[] =
+{
@@ -106,7 +104,7 @@
+ board_95C3AM1_init);
--- a/arch/mips/lantiq/falcon/Kconfig
+++ b/arch/mips/lantiq/falcon/Kconfig
-@@ -10,6 +10,10 @@
+@@ -10,6 +10,10 @@ config LANTIQ_MACH_EASY98020
bool "Easy98020"
default y
@@ -119,16 +117,16 @@
endif
--- a/arch/mips/lantiq/falcon/Makefile
+++ b/arch/mips/lantiq/falcon/Makefile
-@@ -3,3 +3,4 @@
+@@ -4,3 +4,4 @@ obj-$(CONFIG_LANTIQ_MACH_EASY98000) += a
obj-$(CONFIG_LANTIQ_MACH_EASY98000) += mach-easy98000.o
obj-$(CONFIG_LANTIQ_MACH_EASY98000) += dev-leds-easy98000-cpld.o
obj-$(CONFIG_LANTIQ_MACH_EASY98020) += mach-easy98020.o
+obj-$(CONFIG_LANTIQ_MACH_95C3AM1) += mach-95C3AM1.o
--- a/arch/mips/lantiq/machtypes.h
+++ b/arch/mips/lantiq/machtypes.h
-@@ -20,6 +20,7 @@
- LANTIQ_MACH_EASY98000, /* Falcon Eval Board, NOR Flash */
+@@ -21,6 +21,7 @@ enum lantiq_mach_type {
LANTIQ_MACH_EASY98000SF, /* Falcon Eval Board, Serial Flash */
+ LANTIQ_MACH_EASY98000NAND, /* Falcon Eval Board, NAND Flash */
LANTIQ_MACH_EASY98020, /* Falcon Reference Board */
+ LANTIQ_MACH_95C3AM1, /* Board 95C3AM1 */
};
diff --git a/target/linux/lantiq/patches-2.6.32/230-cmdline_hack.patch b/target/linux/lantiq/patches-2.6.32/230-cmdline_hack.patch
index df23286..f5a5704 100644
--- a/target/linux/lantiq/patches-2.6.32/230-cmdline_hack.patch
+++ b/target/linux/lantiq/patches-2.6.32/230-cmdline_hack.patch
@@ -1,6 +1,6 @@
--- a/arch/mips/lantiq/prom.c
+++ b/arch/mips/lantiq/prom.c
-@@ -39,6 +39,34 @@
+@@ -39,20 +39,51 @@ void prom_free_prom_memory(void)
{
}
@@ -35,7 +35,18 @@
static void __init prom_init_cmdline(void)
{
int argc = fw_arg0;
-@@ -53,6 +81,7 @@
+ char **argv = (char **) KSEG1ADDR(fw_arg1);
+ int i;
+
++ arcs_cmdline[0] = '\0';
++
+ for (i = 0; i < argc; i++) {
+- char *p = (char *) KSEG1ADDR(argv[i]);
++ char *p = (char *) KSEG1ADDR(argv[i]);
+
+- if (p && *p) {
++ if (CPHYSADDR(p) && *p) {
+ strlcat(arcs_cmdline, p, sizeof(arcs_cmdline));
strlcat(arcs_cmdline, " ", sizeof(arcs_cmdline));
}
}
diff --git a/target/linux/lantiq/patches-2.6.32/350-dm9000-polling.patch b/target/linux/lantiq/patches-2.6.32/350-dm9000-polling.patch
new file mode 100644
index 0000000..9f60f6f
--- /dev/null
+++ b/target/linux/lantiq/patches-2.6.32/350-dm9000-polling.patch
@@ -0,0 +1,119 @@
+--- a/drivers/net/dm9000.c
++++ b/drivers/net/dm9000.c
+@@ -19,6 +19,7 @@
+ * Sascha Hauer <s.hauer@pengutronix.de>
+ */
+
++#define DEBUG
+ #include <linux/module.h>
+ #include <linux/ioport.h>
+ #include <linux/netdevice.h>
+@@ -121,6 +122,8 @@ typedef struct board_info {
+ struct delayed_work phy_poll;
+ struct net_device *ndev;
+
++ struct delayed_work irq_poll; /* for use in irq polling mode */
++
+ spinlock_t lock;
+
+ struct mii_if_info mii;
+@@ -790,12 +793,14 @@ static void dm9000_timeout(struct net_de
+ unsigned long flags;
+
+ /* Save previous register address */
+- reg_save = readb(db->io_addr);
+ spin_lock_irqsave(&db->lock, flags);
++ reg_save = readb(db->io_addr);
+
+ netif_stop_queue(dev);
+ dm9000_reset(db);
+ dm9000_init_dm9000(dev);
++ dm9000_reset(db);
++ dm9000_init_dm9000(dev);
+ /* We can accept TX packets again */
+ dev->trans_start = jiffies;
+ netif_wake_queue(dev);
+@@ -867,6 +872,12 @@ dm9000_start_xmit(struct sk_buff *skb, s
+ /* free this SKB */
+ dev_kfree_skb(skb);
+
++ /* directly poll afterwards */
++ if (dev->irq == -1) {
++ cancel_delayed_work(&db->irq_poll);
++ schedule_delayed_work(&db->irq_poll, 1);
++ }
++
+ return NETDEV_TX_OK;
+ }
+
+@@ -1073,6 +1084,18 @@ static void dm9000_poll_controller(struc
+ }
+ #endif
+
++static void dm9000_poll_irq(struct work_struct *w)
++{
++ struct delayed_work *dw = to_delayed_work(w);
++ board_info_t *db = container_of(dw, board_info_t, irq_poll);
++ struct net_device *ndev = db->ndev;
++
++ dm9000_interrupt(0, ndev);
++
++ if (netif_running(ndev))
++ schedule_delayed_work(&db->irq_poll, HZ /100);
++}
++
+ /*
+ * Open the interface.
+ * The interface is opened whenever "ifconfig" actives it.
+@@ -1086,27 +1109,35 @@ dm9000_open(struct net_device *dev)
+ if (netif_msg_ifup(db))
+ dev_dbg(db->dev, "enabling %s\n", dev->name);
+
+- /* If there is no IRQ type specified, default to something that
+- * may work, and tell the user that this is a problem */
++ if (dev->irq != -1) {
++ /* If there is no IRQ type specified, default to something that
++ * may work, and tell the user that this is a problem */
+
+- if (irqflags == IRQF_TRIGGER_NONE)
+- dev_warn(db->dev, "WARNING: no IRQ resource flags set.\n");
++ if (irqflags == IRQF_TRIGGER_NONE)
++ dev_warn(db->dev, "WARNING: no IRQ resource flags set.\n");
+
+- irqflags |= IRQF_SHARED;
++ irqflags |= IRQF_SHARED;
+
+- if (request_irq(dev->irq, &dm9000_interrupt, irqflags, dev->name, dev))
+- return -EAGAIN;
++ if (request_irq(dev->irq, dm9000_interrupt, irqflags, dev->name, dev))
++ return -EAGAIN;
++ }
+
+ /* Initialize DM9000 board */
+ dm9000_reset(db);
+ dm9000_init_dm9000(dev);
++ /* workaround: init a second time */
++ dm9000_reset(db);
++ dm9000_init_dm9000(dev);
+
+ /* Init driver variable */
+ db->dbug_cnt = 0;
+
+ mii_check_media(&db->mii, netif_msg_link(db), 1);
+ netif_start_queue(dev);
+-
++
++ if (dev->irq == -1)
++ schedule_delayed_work(&db->irq_poll, HZ / 100);
++
+ dm9000_schedule_poll(db);
+
+ return 0;
+@@ -1303,6 +1334,7 @@ dm9000_probe(struct platform_device *pde
+ mutex_init(&db->addr_lock);
+
+ INIT_DELAYED_WORK(&db->phy_poll, dm9000_poll_work);
++ INIT_DELAYED_WORK(&db->irq_poll, dm9000_poll_irq);
+
+ db->addr_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ db->data_res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
diff --git a/target/linux/lantiq/patches-2.6.39/110-falcon_board.patch b/target/linux/lantiq/patches-2.6.39/110-falcon_board.patch
index 9355dc6..58f1479 100644
--- a/target/linux/lantiq/patches-2.6.39/110-falcon_board.patch
+++ b/target/linux/lantiq/patches-2.6.39/110-falcon_board.patch
@@ -14,9 +14,10 @@
+endif
--- /dev/null
+++ b/arch/mips/lantiq/falcon/Makefile
-@@ -0,0 +1,3 @@
+@@ -0,0 +1,4 @@
+obj-y := clk-falcon.o devices.o gpio.o prom.o sysctrl.o reset.o
+obj-y += softdog_vpe.o
++obj-$(CONFIG_LANTIQ_MACH_EASY98000) += addon-easy98000.o
+obj-$(CONFIG_LANTIQ_MACH_EASY98000) += mach-easy98000.o
--- /dev/null
+++ b/arch/mips/lantiq/falcon/clk-falcon.c
@@ -71,7 +72,7 @@
+EXPORT_SYMBOL(ltq_get_fpi_hz);
--- /dev/null
+++ b/arch/mips/lantiq/falcon/devices.c
-@@ -0,0 +1,180 @@
+@@ -0,0 +1,254 @@
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/types.h>
@@ -88,6 +89,7 @@
+#include <linux/gpio.h>
+#include <linux/leds.h>
+#include <linux/spi/spi.h>
++#include <linux/mtd/nand.h>
+
+#include <asm/bootinfo.h>
+#include <asm/irq.h>
@@ -96,6 +98,7 @@
+
+#include <falcon/falcon_irq.h>
+#include <falcon/gpon_reg_base.h>
++#include <falcon/ebu_reg.h>
+#include <falcon/sys1_reg.h>
+#include <falcon/sys_eth_reg.h>
+
@@ -183,6 +186,78 @@
+ platform_device_register(&ltq_spi);
+}
+
++/* nand flash */
++static struct gpon_reg_ebu __iomem *membase_ebu;
++static const char *part_probes[] = { "cmdlinepart", NULL };
++
++static int falcon_nand_ready(struct mtd_info *mtd)
++{
++ u32 modcon = __raw_readl(&membase_ebu->modcon);
++
++ return (((modcon & (MODCON_STS|MODCON_STSEDGE)) ==
++ (MODCON_STS|MODCON_STSEDGE)));
++}
++
++/* address lines used for NAND control signals */
++#define NAND_ADDR_ALE (1<<16)
++#define NAND_ADDR_CLE (1<<17)
++
++static void falcon_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl)
++{
++ struct nand_chip *this = mtd->priv;
++ unsigned long nandaddr = (unsigned long) this->IO_ADDR_W;
++
++ if (ctrl & NAND_CTRL_CHANGE) {
++ nandaddr &= ~(NAND_ADDR_ALE | NAND_ADDR_CLE);
++
++ if (ctrl & NAND_CLE)
++ nandaddr |= NAND_ADDR_CLE;
++ if (ctrl & NAND_ALE)
++ nandaddr |= NAND_ADDR_ALE;
++
++ this->IO_ADDR_W = (void __iomem *) nandaddr;
++ }
++
++ if (cmd != NAND_CMD_NONE)
++ writeb(cmd, this->IO_ADDR_W);
++}
++
++static struct platform_nand_data falcon_flash_nand_data = {
++ .chip = {
++ .nr_chips = 1,
++ .chip_delay = 25,
++ .part_probe_types = part_probes,
++ },
++ .ctrl = {
++ .cmd_ctrl = falcon_hwcontrol,
++ .dev_ready = falcon_nand_ready,
++ }
++};
++
++static struct resource ltq_nand_resources[] = {
++ MEM_RES("nand", LTQ_FLASH_START, LTQ_FLASH_START + LTQ_FLASH_MAX - 1),
++ MEM_RES("ebu", GPON_EBU_BASE, GPON_EBU_END),
++};
++
++static struct platform_device ltq_flash_nand = {
++ .name = "gen_nand",
++ .id = -1,
++ .num_resources = ARRAY_SIZE(ltq_nand_resources),
++ .resource = ltq_nand_resources,
++ .dev = {
++ .platform_data = &falcon_flash_nand_data,
++ },
++};
++
++void __init falcon_register_nand(void)
++{
++ membase_ebu = ioremap_nocache(ltq_nand_resources[1].start,
++ resource_size(&ltq_nand_resources[1]));
++
++ if (membase_ebu)
++ platform_device_register(&ltq_flash_nand);
++}
++
+/* watchdog */
+static struct resource falcon_wdt_resource =
+ MEM_RES("watchdog",GPON_WDT_BASE,GPON_WDT_END);
@@ -254,7 +329,7 @@
+}
--- /dev/null
+++ b/arch/mips/lantiq/falcon/devices.h
-@@ -0,0 +1,21 @@
+@@ -0,0 +1,22 @@
+#ifndef _FALCON_DEVICES_H__
+#define _FALCON_DEVICES_H__
+
@@ -267,6 +342,7 @@
+extern void __init falcon_register_spi_flash(struct spi_board_info *data);
+extern void __init falcon_register_gpio(void);
+extern void __init falcon_register_nor(struct physmap_flash_data *data);
++extern void __init falcon_register_nand(void);
+extern void __init falcon_register_wdt(void);
+extern void __init falcon_register_crypto(void);
+
@@ -1285,7 +1361,7 @@
+arch_initcall(mips_reboot_setup);
--- /dev/null
+++ b/arch/mips/lantiq/falcon/mach-easy98000.c
-@@ -0,0 +1,247 @@
+@@ -0,0 +1,263 @@
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/leds.h>
@@ -1423,8 +1499,12 @@
+ }
+};
+
++extern int easy98000_addon_has_dm9000(void);
+static void __init register_davicom(void)
+{
++ if (!easy98000_addon_has_dm9000())
++ return;
++
+ if (!is_valid_ether_addr(ltq_ethaddr))
+ random_ether_addr(dm9000_plat_data.dev_addr);
+ else {
@@ -1448,9 +1528,10 @@
+ }
+};
+
-+void __init register_easy98000_cpld_led(void)
++void __init register_easy98000_cpld(void)
+{
+ platform_device_register_simple("easy98000_cpld_led", 0, NULL, 0);
++ platform_device_register_simple("easy98000_addon", 0, NULL, 0);
+}
+
+/* setup gpio based spi bus/device for access to the eeprom on the board */
@@ -1507,7 +1588,7 @@
+ register_davicom();
+ ltq_add_device_leds_gpio(-1, ARRAY_SIZE(easy98000_leds_gpio),
+ easy98000_leds_gpio);
-+ register_easy98000_cpld_led();
++ register_easy98000_cpld();
+ falcon_register_crypto();
+ easy98000_spi_gpio_init();
+}
@@ -1524,6 +1605,12 @@
+ falcon_register_spi_flash(&easy98000_spi_flash_data);
+}
+
++static void __init easy98000nand_init(void)
++{
++ easy98000_init_common();
++ falcon_register_nand();
++}
++
+MIPS_MACHINE(LANTIQ_MACH_EASY98000,
+ "EASY98000",
+ "EASY98000 Eval Board",
@@ -1533,6 +1620,11 @@
+ "EASY98000SF",
+ "EASY98000 Eval Board (Serial Flash)",
+ easy98000sf_init);
++
++MIPS_MACHINE(LANTIQ_MACH_EASY98000NAND,
++ "EASY98000NAND",
++ "EASY98000 Eval Board (NAND Flash)",
++ easy98000nand_init);
--- /dev/null
+++ b/arch/mips/lantiq/falcon/softdog_vpe.c
@@ -0,0 +1,109 @@
@@ -1731,7 +1823,223 @@
+ /* FALCON */
+ LANTIQ_MACH_EASY98000, /* Falcon Eval Board, NOR Flash */
+ LANTIQ_MACH_EASY98000SF, /* Falcon Eval Board, Serial Flash */
++ LANTIQ_MACH_EASY98000NAND, /* Falcon Eval Board, NAND Flash */
+ LANTIQ_MACH_EASY98020, /* Falcon Reference Board */
};
#endif
+--- /dev/null
++++ b/arch/mips/lantiq/falcon/addon-easy98000.c
+@@ -0,0 +1,212 @@
++/*
++ * EASY98000 CPLD Addon driver
++ *
++ * Copyright (C) 2011 Thomas Langer <thomas.langer@lantiq.com>
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License version 2 as published
++ * by the Free Software Foundation.
++ *
++ */
++
++#include <linux/kernel.h>
++#include <linux/version.h>
++#include <linux/types.h>
++#include <linux/init.h>
++#include <linux/platform_device.h>
++#include <linux/errno.h>
++#include <linux/slab.h>
++#include <linux/proc_fs.h>
++#include <linux/seq_file.h>
++
++struct easy98000_reg_cpld {
++ u16 cmdreg1; /* 0x1 */
++ u16 cmdreg0; /* 0x0 */
++ u16 idreg0; /* 0x3 */
++ u16 resreg; /* 0x2 */
++ u16 intreg; /* 0x5 */
++ u16 idreg1; /* 0x4 */
++ u16 ledreg; /* 0x7 */
++ u16 pcmconconfig; /* 0x6 */
++ u16 res0; /* 0x9 */
++ u16 ethledreg; /* 0x8 */
++ u16 res1[4]; /* 0xa-0xd */
++ u16 cpld1v; /* 0xf */
++ u16 cpld2v; /* 0xe */
++};
++static struct easy98000_reg_cpld * const cpld =
++ (struct easy98000_reg_cpld *)(KSEG1 | 0x17c00000);
++#define cpld_r8(reg) (__raw_readw(&cpld->reg) & 0xFF)
++#define cpld_w8(val, reg) __raw_writew((val) & 0xFF, &cpld->reg)
++
++int easy98000_addon_has_dm9000(void)
++{
++ if ((cpld_r8(idreg0) & 0xF) == 1)
++ return 1;
++ return 0;
++}
++
++#if defined(CONFIG_PROC_FS)
++typedef void (*cpld_dump) (struct seq_file *s);
++struct proc_entry {
++ char *name;
++ void *callback;
++};
++
++static int cpld_proc_show ( struct seq_file *s, void *p )
++{
++ cpld_dump dump = s->private;
++
++ if ( dump != NULL )
++ dump(s);
++
++ return 0;
++}
++
++static int cpld_proc_open ( struct inode *inode, struct file *file )
++{
++ return single_open ( file, cpld_proc_show, PDE(inode)->data );
++}
++
++static void cpld_versions_get ( struct seq_file *s )
++{
++ seq_printf(s, "CPLD1: V%d\n", cpld_r8(cpld1v));
++ seq_printf(s, "CPLD2: V%d\n", cpld_r8(cpld2v));
++}
++
++static void cpld_ebu_module_get ( struct seq_file *s )
++{
++ u8 addon_id;
++
++ addon_id = cpld_r8(idreg0) & 0xF;
++ switch (addon_id) {
++ case 0xF: /* nothing connected */
++ break;
++ case 1:
++ seq_printf(s, "Ethernet Controller module (dm9000)\n");
++ break;
++ default:
++ seq_printf(s, "Unknown EBU module (EBU_ID=0x%02X)\n", addon_id);
++ break;
++ }
++}
++
++static void cpld_xmii_module_get ( struct seq_file *s )
++{
++ u8 addon_id;
++ char *mod = NULL;
++
++ addon_id = cpld_r8(idreg1) & 0xF;
++ switch (addon_id) {
++ case 0xF:
++ mod = "no module";
++ break;
++ case 0x1:
++ mod = "RGMII module";
++ break;
++ case 0x4:
++ mod = "GMII MAC Mode (XWAY TANTOS-3G)";
++ break;
++ case 0x6:
++ mod = "TMII MAC Mode (XWAY TANTOS-3G)";
++ break;
++ case 0x8:
++ mod = "GMII PHY module";
++ break;
++ case 0x9:
++ mod = "MII PHY module";
++ break;
++ case 0xA:
++ mod = "RMII PHY module";
++ break;
++ default:
++ break;
++ }
++ if (mod)
++ seq_printf(s, "%s\n", mod);
++ else
++ seq_printf(s, "unknown xMII module (xMII_ID=0x%02X)\n", addon_id);
++}
++
++static struct proc_entry proc_entries[] = {
++ {"versions", cpld_versions_get},
++ {"ebu", cpld_ebu_module_get},
++ {"xmii", cpld_xmii_module_get},
++};
++
++static struct file_operations ops = {
++ .owner = THIS_MODULE,
++ .open = cpld_proc_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
++static void cpld_proc_entry_create(struct proc_dir_entry *parent_node,
++ struct proc_entry *proc_entry)
++{
++ proc_create_data ( proc_entry->name, (S_IFREG | S_IRUGO), parent_node,
++ &ops, proc_entry->callback);
++}
++
++static int cpld_proc_install(void)
++{
++ struct proc_dir_entry *driver_proc_node;
++
++ driver_proc_node = proc_mkdir("cpld", NULL);
++ if (driver_proc_node != NULL) {
++ int i;
++ for (i = 0; i < ARRAY_SIZE(proc_entries); i++)
++ cpld_proc_entry_create(driver_proc_node,
++ &proc_entries[i]);
++ } else {
++ printk("cannot create proc entry");
++ return -1;
++ }
++ return 0;
++}
++#else
++static inline int cpld_proc_install(void) {}
++#endif
++
++static int easy98000_addon_probe(struct platform_device *pdev)
++{
++ return cpld_proc_install();
++}
++
++static int easy98000_addon_remove(struct platform_device *pdev)
++{
++#if defined(CONFIG_PROC_FS)
++ char buf[64];
++ int i;
++
++ for (i = 0; i < sizeof(proc_entries) / sizeof(proc_entries[0]); i++) {
++ sprintf(buf, "cpld/%s", proc_entries[i].name);
++ remove_proc_entry(buf, 0);
++ }
++ remove_proc_entry("cpld", 0);
++#endif
++ return 0;
++}
++
++static struct platform_driver easy98000_addon_driver = {
++ .probe = easy98000_addon_probe,
++ .remove = __devexit_p(easy98000_addon_remove),
++ .driver = {
++ .name = "easy98000_addon",
++ .owner = THIS_MODULE,
++ },
++};
++
++int __init easy98000_addon_init(void)
++{
++ return platform_driver_register(&easy98000_addon_driver);
++}
++
++void __exit easy98000_addon_exit(void)
++{
++ platform_driver_unregister(&easy98000_addon_driver);
++}
++
++module_init(easy98000_addon_init);
++module_exit(easy98000_addon_exit);
diff --git a/target/linux/lantiq/patches-2.6.39/140-falcon-easy98000-cpld-led.patch b/target/linux/lantiq/patches-2.6.39/140-falcon-easy98000-cpld-led.patch
index f623b2e..c93c3e7 100644
--- a/target/linux/lantiq/patches-2.6.39/140-falcon-easy98000-cpld-led.patch
+++ b/target/linux/lantiq/patches-2.6.39/140-falcon-easy98000-cpld-led.patch
@@ -1,8 +1,8 @@
--- a/arch/mips/lantiq/falcon/Makefile
+++ b/arch/mips/lantiq/falcon/Makefile
-@@ -1,3 +1,4 @@
- obj-y := clk-falcon.o devices.o gpio.o prom.o sysctrl.o reset.o
+@@ -2,3 +2,4 @@ obj-y := clk-falcon.o devices.o gpio.o p
obj-y += softdog_vpe.o
+ obj-$(CONFIG_LANTIQ_MACH_EASY98000) += addon-easy98000.o
obj-$(CONFIG_LANTIQ_MACH_EASY98000) += mach-easy98000.o
+obj-$(CONFIG_LANTIQ_MACH_EASY98000) += dev-leds-easy98000-cpld.o
--- /dev/null
@@ -141,7 +141,7 @@
+
+static struct platform_driver led_driver = {
+ .probe = led_probe,
-+ .remove = led_remove,
++ .remove = __devexit_p(led_remove),
+ .driver = {
+ .name = LED_NAME,
+ .owner = THIS_MODULE,
diff --git a/target/linux/lantiq/patches-2.6.39/150-falcon-easy98020.patch b/target/linux/lantiq/patches-2.6.39/150-falcon-easy98020.patch
index 7010d35..65557bf 100644
--- a/target/linux/lantiq/patches-2.6.39/150-falcon-easy98020.patch
+++ b/target/linux/lantiq/patches-2.6.39/150-falcon-easy98020.patch
@@ -1,6 +1,6 @@
--- /dev/null
+++ b/arch/mips/lantiq/falcon/mach-easy98020.c
-@@ -0,0 +1,97 @@
+@@ -0,0 +1,117 @@
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/leds.h>
@@ -21,6 +21,10 @@
+#define EASY98020_GPIO_LED_1 10
+#define EASY98020_GPIO_LED_2 11
+#define EASY98020_GPIO_LED_3 12
++#define EASY98020_GPIO_LED_GE0_ACT 110
++#define EASY98020_GPIO_LED_GE0_LINK 109
++#define EASY98020_GPIO_LED_GE1_ACT 106
++#define EASY98020_GPIO_LED_GE1_LINK 105
+
+extern unsigned char ltq_ethaddr[6];
+
@@ -79,6 +83,22 @@
+ .name = "easy98020:green:3",
+ .gpio = EASY98020_GPIO_LED_3,
+ .active_low = 0,
++ }, {
++ .name = "easy98020:ge0_act",
++ .gpio = EASY98020_GPIO_LED_GE0_ACT,
++ .active_low = 0,
++ }, {
++ .name = "easy98020:ge0_link",
++ .gpio = EASY98020_GPIO_LED_GE0_LINK,
++ .active_low = 0,
++ }, {
++ .name = "easy98020:ge1_act",
++ .gpio = EASY98020_GPIO_LED_GE1_ACT,
++ .active_low = 0,
++ }, {
++ .name = "easy98020:ge1_link",
++ .gpio = EASY98020_GPIO_LED_GE1_LINK,
++ .active_low = 0,
+ }
+};
+
diff --git a/target/linux/lantiq/patches-2.6.39/350-dm9000-polling.patch b/target/linux/lantiq/patches-2.6.39/350-dm9000-polling.patch
new file mode 100644
index 0000000..7abfc59
--- /dev/null
+++ b/target/linux/lantiq/patches-2.6.39/350-dm9000-polling.patch
@@ -0,0 +1,116 @@
+--- a/drivers/net/dm9000.c
++++ b/drivers/net/dm9000.c
+@@ -19,6 +19,7 @@
+ * Sascha Hauer <s.hauer@pengutronix.de>
+ */
+
++#define DEBUG
+ #include <linux/module.h>
+ #include <linux/ioport.h>
+ #include <linux/netdevice.h>
+@@ -125,6 +126,8 @@ typedef struct board_info {
+ struct delayed_work phy_poll;
+ struct net_device *ndev;
+
++ struct delayed_work irq_poll; /* for use in irq polling mode */
++
+ spinlock_t lock;
+
+ struct mii_if_info mii;
+@@ -855,6 +858,8 @@ static void dm9000_timeout(struct net_de
+ netif_stop_queue(dev);
+ dm9000_reset(db);
+ dm9000_init_dm9000(dev);
++ dm9000_reset(db);
++ dm9000_init_dm9000(dev);
+ /* We can accept TX packets again */
+ dev->trans_start = jiffies; /* prevent tx timeout */
+ netif_wake_queue(dev);
+@@ -926,6 +931,12 @@ dm9000_start_xmit(struct sk_buff *skb, s
+ /* free this SKB */
+ dev_kfree_skb(skb);
+
++ /* directly poll afterwards */
++ if (dev->irq == -1) {
++ cancel_delayed_work(&db->irq_poll);
++ schedule_delayed_work(&db->irq_poll, 1);
++ }
++
+ return NETDEV_TX_OK;
+ }
+
+@@ -1167,6 +1178,18 @@ static void dm9000_poll_controller(struc
+ }
+ #endif
+
++static void dm9000_poll_irq(struct work_struct *w)
++{
++ struct delayed_work *dw = to_delayed_work(w);
++ board_info_t *db = container_of(dw, board_info_t, irq_poll);
++ struct net_device *ndev = db->ndev;
++
++ dm9000_interrupt(0, ndev);
++
++ if (netif_running(ndev))
++ schedule_delayed_work(&db->irq_poll, HZ /100);
++}
++
+ /*
+ * Open the interface.
+ * The interface is opened whenever "ifconfig" actives it.
+@@ -1180,17 +1203,18 @@ dm9000_open(struct net_device *dev)
+ if (netif_msg_ifup(db))
+ dev_dbg(db->dev, "enabling %s\n", dev->name);
+
+- /* If there is no IRQ type specified, default to something that
+- * may work, and tell the user that this is a problem */
++ if (dev->irq != -1) {
++ /* If there is no IRQ type specified, default to something that
++ * may work, and tell the user that this is a problem */
+
+- if (irqflags == IRQF_TRIGGER_NONE)
+- dev_warn(db->dev, "WARNING: no IRQ resource flags set.\n");
++ if (irqflags == IRQF_TRIGGER_NONE)
++ dev_warn(db->dev, "WARNING: no IRQ resource flags set.\n");
+
+- irqflags |= IRQF_SHARED;
+-
+- if (request_irq(dev->irq, dm9000_interrupt, irqflags, dev->name, dev))
+- return -EAGAIN;
++ irqflags |= IRQF_SHARED;
+
++ if (request_irq(dev->irq, dm9000_interrupt, irqflags, dev->name, dev))
++ return -EAGAIN;
++ }
+ /* GPIO0 on pre-activate PHY, Reg 1F is not set by reset */
+ iow(db, DM9000_GPR, 0); /* REG_1F bit0 activate phyxcer */
+ mdelay(1); /* delay needs by DM9000B */
+@@ -1198,13 +1222,19 @@ dm9000_open(struct net_device *dev)
+ /* Initialize DM9000 board */
+ dm9000_reset(db);
+ dm9000_init_dm9000(dev);
++ /* testing: init a second time */
++ dm9000_reset(db);
++ dm9000_init_dm9000(dev);
+
+ /* Init driver variable */
+ db->dbug_cnt = 0;
+
+ mii_check_media(&db->mii, netif_msg_link(db), 1);
+ netif_start_queue(dev);
+-
++
++ if (dev->irq == -1)
++ schedule_delayed_work(&db->irq_poll, HZ / 100);
++
+ dm9000_schedule_poll(db);
+
+ return 0;
+@@ -1401,6 +1431,7 @@ dm9000_probe(struct platform_device *pde
+ mutex_init(&db->addr_lock);
+
+ INIT_DELAYED_WORK(&db->phy_poll, dm9000_poll_work);
++ INIT_DELAYED_WORK(&db->irq_poll, dm9000_poll_irq);
+
+ db->addr_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ db->data_res = platform_get_resource(pdev, IORESOURCE_MEM, 1);