.length = RK2818_INTC_SIZE,
.type = MT_DEVICE
},
-
+
+ {
+ .virtual = RK2818_NANDC_BASE,
+ .pfn = __phys_to_pfn(RK2818_NANDC_PHYS),
+ .length = RK2818_NANDC_SIZE,
+ .type = MT_DEVICE
+ },
+
{
.virtual = RK2818_SDRAMC_BASE,
.pfn = __phys_to_pfn(RK2818_SDRAMC_PHYS),
static struct platform_device *devices[] __initdata = {
&rk2818_device_uart1,
+ &rk2818_device_dm9k,
&rk2818_device_spim,
};
#include <linux/mtd/nand.h>
#include <linux/mtd/partitions.h>
+#include <linux/dm9000.h>
+#include <mach/gpio.h>
+
static struct resource resources_i2c0[] = {
{
.start = IRQ_NR_I2C0,
.resource = resources_spim,
};
+//net device
+/* DM9000 */
+static struct resource dm9k_resource[] = {
+ [0] = {
+ .start = RK2818_NANDC_PHYS + 0x800 + 1*0x100, //nand_cs1
+ .end = RK2818_NANDC_PHYS + 0x800 + 1*0x100 + 3,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = RK2818_NANDC_PHYS + (0x800+1*0x100)+ 0x4,
+ .end = RK2818_NANDC_PHYS + (0x800+1*0x100)+ 0x4 + 3,
+ .flags = IORESOURCE_MEM,
+ },
+ [2] = {
+ .start = RK2818_PIN_PE2,//use pe2 as interrupt
+ .end = RK2818_PIN_PE2,
+ .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
+ }
+
+};
+
+/* for the moment we limit ourselves to 8bit IO until some
+ * better IO routines can be written and tested
+*/
+
+static struct dm9000_plat_data dm9k_platdata = {
+ .flags = DM9000_PLATF_8BITONLY,
+};
+
+struct platform_device rk2818_device_dm9k = {
+ .name = "dm9000",
+ .id = 0,
+ .num_resources = ARRAY_SIZE(dm9k_resource),
+ .resource = dm9k_resource,
+ .dev = {
+ .platform_data = &dm9k_platdata,
+ }
+};
extern struct platform_device rk2818_device_spim;
extern struct platform_device rk2818_device_i2c0;
extern struct platform_device rk2818_device_i2c1;
+extern struct platform_device rk2818_device_dm9k;
#endif
#define RK2818_SDMMC0_PHYS 0x100AC000
#define RK2818_SDMMC0_SIZE SZ_8K
+#define RK2818_NANDC_BASE 0xFF0AE000
#define RK2818_NANDC_PHYS 0x100AE000
-#define RK2818_NANDC_SIZE SZ_16K
+#define RK2818_NANDC_SIZE SZ_8K
#define RK2818_SDRAMC_BASE 0xFF0B0000
#define RK2818_SDRAMC_PHYS 0x100B0000
#include <asm/delay.h>
#include <asm/irq.h>
#include <asm/io.h>
+#include <mach/gpio.h>
#include "dm9000.h"
} board_info_t;
/* debug code */
-
+#define DEBUG_LEVEL 4
#define dm9000_dbg(db, lev, msg...) do { \
if ((lev) < CONFIG_DM9000_DEBUGLEVEL && \
(lev) < db->debug_level) { \
dm9000_dbg(db, 3, "%s:\n", __func__);
- if (db->tx_pkt_cnt > 1)
+ if (db->tx_pkt_cnt > 1) {
+ dev_dbg(db->dev, "netdev tx busy\n");
return NETDEV_TX_BUSY;
+ }
spin_lock_irqsave(&db->lock, flags);
db->dev = &pdev->dev;
db->ndev = ndev;
+ //db->debug_level = 5;//add by liuyx@20100511
+
spin_lock_init(&db->lock);
mutex_init(&db->addr_lock);
/* fill in parameters for net-dev structure */
ndev->base_addr = (unsigned long)db->io_addr;
- ndev->irq = db->irq_res->start;
+ #if 0
+ ndev->irq = db->irq_res->start;
+ #else//modify by liuyx@20100510
+ ndev->irq = gpio_to_irq(db->irq_res->start);
+ #endif
+
/* ensure at least we have a default set of IO routines */
dm9000_set_io(db, iosize);