diff -urN linux-2.6.18/Makefile linux-2.6.18-vpac1/Makefile --- linux-2.6.18/Makefile 2006-09-20 05:42:06.000000000 +0200 +++ linux-2.6.18-vpac1/Makefile 2006-10-17 00:17:09.000000000 +0200 @@ -173,8 +173,8 @@ # Default value for CROSS_COMPILE is not to prefix executables # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile -ARCH ?= $(SUBARCH) -CROSS_COMPILE ?= +ARCH ?= arm +CROSS_COMPILE ?= arm-linux- # Architecture as present in compile.h UTS_MACHINE := $(ARCH) diff -urN linux-2.6.18/arch/arm/mach-pxa/lubbock.c linux-2.6.18-vpac1/arch/arm/mach-pxa/lubbock.c --- linux-2.6.18/arch/arm/mach-pxa/lubbock.c 2006-09-20 05:42:06.000000000 +0200 +++ linux-2.6.18-vpac1/arch/arm/mach-pxa/lubbock.c 2006-10-17 02:25:49.000000000 +0200 @@ -343,10 +343,60 @@ }, }; +#ifdef CONFIG_ARM_AX88796 + +#define AX88796_ETH0_IRQ_GPIO 20 +#define AX88796_ETH1_IRQ_GPIO 19 + +static struct resource ax88796_resources_0[] = { + [0] = { + .start = 0x08000400, + .end = 0x080fffff, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = IRQ_GPIO(AX88796_ETH0_IRQ_GPIO), + .end = IRQ_GPIO(AX88796_ETH0_IRQ_GPIO), + .flags = IORESOURCE_IRQ, + }, +}; + +static struct platform_device ax88796_device_0 = { + .name = "ax88796", + .id = 0, + .num_resources = ARRAY_SIZE(ax88796_resources_0), + .resource = ax88796_resources_0, +}; + +static struct resource ax88796_resources_1[] = { + [0] = { + .start = 0x0c000400, + .end = 0x0c0fffff, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = IRQ_GPIO(AX88796_ETH1_IRQ_GPIO), + .end = IRQ_GPIO(AX88796_ETH1_IRQ_GPIO), + .flags = IORESOURCE_IRQ, + }, +}; + +static struct platform_device ax88796_device_1 = { + .name = "ax88796", + .id = 1, + .num_resources = ARRAY_SIZE(ax88796_resources_1), + .resource = ax88796_resources_1, +}; +#endif + static struct platform_device *devices[] __initdata = { &sa1111_device, &lub_audio_device, &smc91x_device, +#ifdef CONFIG_ARM_AX88796 + &ax88796_device_0, + &ax88796_device_1, +#endif &lubbock_flash_device[0], &lubbock_flash_device[1], &pxa_ssp, diff -urN linux-2.6.18/drivers/mtd/maps/lubbock-flash.c linux-2.6.18-vpac1/drivers/mtd/maps/lubbock-flash.c --- linux-2.6.18/drivers/mtd/maps/lubbock-flash.c 2006-09-20 05:42:06.000000000 +0200 +++ linux-2.6.18-vpac1/drivers/mtd/maps/lubbock-flash.c 2006-10-17 03:15:37.000000000 +0200 @@ -42,10 +42,6 @@ .size = WINDOW_SIZE, .phys = 0x00000000, .inval_cache = lubbock_map_inval_cache, -}, { - .size = WINDOW_SIZE, - .phys = 0x04000000, - .inval_cache = lubbock_map_inval_cache, } }; static struct mtd_partition lubbock_partitions[] = { @@ -56,12 +52,12 @@ .mask_flags = MTD_WRITEABLE /* force read-only */ },{ .name = "Kernel", - .size = 0x00100000, + .size = 0x000c0000, .offset = 0x00040000, },{ .name = "Filesystem", .size = MTDPART_SIZ_FULL, - .offset = 0x00140000 + .offset = 0x00100000 } }; @@ -73,20 +69,20 @@ static int __init init_lubbock(void) { - int flashboot = (LUB_CONF_SWITCHES & 1); + int flashboot = 0; int ret = 0, i; - lubbock_maps[0].bankwidth = lubbock_maps[1].bankwidth = + lubbock_maps[0].bankwidth = /*lubbock_maps[1].bankwidth =*/ (BOOT_DEF & 1) ? 2 : 4; + lubbock_maps[flashboot].name = "Boot Flash"; + /* Compensate for the nROMBT switch which swaps the flash banks */ - printk(KERN_NOTICE "Lubbock configured to boot from %s (bank %d)\n", - flashboot?"Flash":"ROM", flashboot); + printk(KERN_NOTICE "Device configured to boot from %s (bank %d)\n", + lubbock_maps[flashboot].name, flashboot); - lubbock_maps[flashboot^1].name = "Lubbock Application Flash"; - lubbock_maps[flashboot].name = "Lubbock Boot ROM"; - for (i = 0; i < 2; i++) { + for (i = 0; i < 1; i++) { lubbock_maps[i].virt = ioremap(lubbock_maps[i].phys, WINDOW_SIZE); if (!lubbock_maps[i].virt) { printk(KERN_WARNING "Failed to ioremap %s\n", lubbock_maps[i].name); @@ -125,7 +121,7 @@ if (!mymtds[0] && !mymtds[1]) return ret; - for (i = 0; i < 2; i++) { + for (i = 0; i < 1; i++) { if (!mymtds[i]) { printk(KERN_WARNING "%s is absent. Skipping\n", lubbock_maps[i].name); } else if (nr_parsed_parts[i]) { @@ -144,7 +140,7 @@ static void __exit cleanup_lubbock(void) { int i; - for (i = 0; i < 2; i++) { + for (i = 0; i < 1; i++) { if (!mymtds[i]) continue; diff -urN linux-2.6.18/drivers/net/8390.h linux-2.6.18-vpac1/drivers/net/8390.h --- linux-2.6.18/drivers/net/8390.h 2006-09-20 05:42:06.000000000 +0200 +++ linux-2.6.18-vpac1/drivers/net/8390.h 2006-10-17 02:12:23.000000000 +0200 @@ -86,8 +86,8 @@ /* Some generic ethernet register configurations. */ #define E8390_TX_IRQ_MASK 0xa /* For register EN0_ISR */ #define E8390_RX_IRQ_MASK 0x5 -#define E8390_RXCONFIG 0x4 /* EN0_RXCR: broadcasts, no multicast,errors */ -#define E8390_RXOFF 0x20 /* EN0_RXCR: Accept no packets */ +#define E8390_RXCONFIG 0x44 /* EN0_RXCR: broadcasts, no multicast,errors */ +#define E8390_RXOFF 0x60 /* EN0_RXCR: Accept no packets */ #define E8390_TXCONFIG 0x00 /* EN0_TXCR: Normal transmit mode */ #define E8390_TXOFF 0x02 /* EN0_TXCR: Transmitter off */ @@ -106,7 +106,7 @@ * Only generate indirect loads given a machine that needs them. * - removed AMIGA_PCMCIA from this list, handled as ISA io now */ - +/* #if defined(CONFIG_MAC) || \ defined(CONFIG_ZORRO8390) || defined(CONFIG_ZORRO8390_MODULE) || \ defined(CONFIG_HYDRA) || defined(CONFIG_HYDRA_MODULE) @@ -138,6 +138,9 @@ #else #define EI_SHIFT(x) (x) #endif +*/ + +#define EI_SHIFT(x) ((x)<<1) #define E8390_CMD EI_SHIFT(0x00) /* The command register (for all pages) */ /* Page 0 register offsets. */ diff -urN linux-2.6.18/drivers/net/arm/Kconfig linux-2.6.18-vpac1/drivers/net/arm/Kconfig --- linux-2.6.18/drivers/net/arm/Kconfig 2006-09-20 05:42:06.000000000 +0200 +++ linux-2.6.18-vpac1/drivers/net/arm/Kconfig 2006-10-17 00:11:30.000000000 +0200 @@ -39,3 +39,8 @@ help If you wish to compile a kernel for the AT91RM9200 and enable ethernet support, then you should always answer Y to this. + +config ARM_AX88796 + tristate "Asix AX88796 support" + depends on NET_ETHERNET && ARM + select NE2000 diff -urN linux-2.6.18/drivers/net/arm/Makefile linux-2.6.18-vpac1/drivers/net/arm/Makefile --- linux-2.6.18/drivers/net/arm/Makefile 2006-09-20 05:42:06.000000000 +0200 +++ linux-2.6.18-vpac1/drivers/net/arm/Makefile 2006-10-17 00:11:55.000000000 +0200 @@ -8,3 +8,4 @@ obj-$(CONFIG_ARM_ETHER3) += ether3.o obj-$(CONFIG_ARM_ETHER1) += ether1.o obj-$(CONFIG_ARM_AT91_ETHER) += at91_ether.o +obj-$(CONFIG_ARM_AX88796) += ax88796.o diff -urN linux-2.6.18/drivers/net/arm/ax88796.c linux-2.6.18-vpac1/drivers/net/arm/ax88796.c --- linux-2.6.18/drivers/net/arm/ax88796.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.6.18-vpac1/drivers/net/arm/ax88796.c 2006-10-17 03:46:16.000000000 +0200 @@ -0,0 +1,99 @@ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#define DEBUG +#define CARDNAME "ax88796" + +extern int __init do_ne_probe(struct net_device *dev); +extern struct net_device *__alloc_ei_netdev(int size); + +#define NE_IO_EXTENT 0x40 + +static int ax88796_drv_probe(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct net_device *ndev; +#ifdef DEBUG + printk("ax88796_drv_probe: %s(%d)\n", pdev->name, pdev->id); +#endif + if (pdev->num_resources < 2) + return -ENODEV; + +// if( (ndev = alloc_etherdev(0)) == 0) + if( (ndev = __alloc_ei_netdev(0)) == 0) + { + printk("%s: could not allocate device.\n", CARDNAME); + return -ENOMEM; + } + SET_MODULE_OWNER(ndev); + +// ndev->dma = (unsigned char)-1; + ndev->base_addr = (u32) ioremap( pdev->resource[0].start, NE_IO_EXTENT); + ndev->irq = pdev->resource[1].start; + set_irq_type( ndev->irq, IRQT_RISING); + + sprintf(ndev->name, "eth%d", pdev->id); + + ether_setup(ndev); + + SET_NETDEV_DEV(ndev, dev); + +#ifdef DEBUG + printk("ax88796_drv_probe: %s base=%08lx, irq=%d\n", + ndev->name, ndev->base_addr, ndev->irq); +#endif +// platform_set_drvdata(pdev, ndev); + dev_set_drvdata(dev, ndev); + + return do_ne_probe(ndev); +} + +static int ax88796_drv_remove(struct device *dev) +{ + struct net_device *ndev = dev_get_drvdata(dev); +#ifdef DEBUG + struct platform_device *pdev = to_platform_device(dev); + printk("ax88796_drv_remove: %s(%d)\n", pdev->name, pdev->id); +#endif + dev_set_drvdata(dev, NULL); + + unregister_netdev(ndev); + + free_irq(ndev->irq, ndev); + release_region(ndev->base_addr, NE_IO_EXTENT); + + kfree(ndev); + return 0; +} + +static struct device_driver ax88796_driver = { + .name = CARDNAME, + .bus = &platform_bus_type, + .probe = ax88796_drv_probe, + .remove = ax88796_drv_remove, +}; + +static int __init ax88796_init(void) +{ + return driver_register(&ax88796_driver); +} + +static void __exit ax88796_cleanup(void) +{ + driver_unregister(&ax88796_driver); +} + +module_init(ax88796_init); +module_exit(ax88796_cleanup); + diff -urN linux-2.6.18/drivers/net/ne.c linux-2.6.18-vpac1/drivers/net/ne.c --- linux-2.6.18/drivers/net/ne.c 2006-09-20 05:42:06.000000000 +0200 +++ linux-2.6.18-vpac1/drivers/net/ne.c 2006-10-17 04:24:13.000000000 +0200 @@ -78,7 +78,7 @@ /* #define PACKETBUF_MEMSIZE 0x40 */ /* A zero-terminated list of I/O addresses to be probed at boot. */ -#ifndef MODULE +#ifdef CONFIG_ISA static unsigned int netcard_portlist[] __initdata = { 0x300, 0x280, 0x320, 0x340, 0x360, 0x380, 0 }; @@ -127,10 +127,10 @@ /* ---- No user-serviceable parts below ---- */ #define NE_BASE (dev->base_addr) -#define NE_CMD 0x00 -#define NE_DATAPORT 0x10 /* NatSemi-defined port window offset. */ -#define NE_RESET 0x1f /* Issue a read to reset, a write to clear. */ -#define NE_IO_EXTENT 0x20 +#define NE_CMD EI_SHIFT(0x00) +#define NE_DATAPORT EI_SHIFT(0x10) /* NatSemi-defined port window offset. */ +#define NE_RESET EI_SHIFT(0x1f) /* Issue a read to reset, a write to clear. */ +#define NE_IO_EXTENT 0x40 #define NE1SM_START_PG 0x20 /* First page of TX buffer */ #define NE1SM_STOP_PG 0x40 /* Last page +1 of RX ring */ @@ -160,6 +160,33 @@ static void ne_block_output(struct net_device *dev, const int count, const unsigned char *buf, const int start_page); +static unsigned char configured_mac_address[2][ETH_ALEN] = { { 0x88, 0x79, 0x60, 0, 0, 0}, + { 0x88, 0x79, 0x60, 0, 0, 1}}; + +static int __init init_mac_addr(char *str) +{ + int i, c, dev; + + dev = *str++ - 0x30; + + if( dev >= 0 && dev < 2 && *str++ == '=') + { + for( i=0; i < ETH_ALEN; i++) + { + if( (c = *str++) == 0) break; + c = ((c&0x40)? (c-0x37):c)&0xf; + configured_mac_address[dev][i] = c<<4; + + if( (c = *str++) == 0) break; + c = ((c&0x40)? (c-0x37):c)&0xf; + configured_mac_address[dev][i] += c; + } + } + return 1; +} + +__setup("mac", init_mac_addr); + /* Probe for various non-shared-memory ethercards. @@ -182,10 +209,10 @@ E2010 starts at 0x100 and ends at 0x4000. E2010-x starts at 0x100 and ends at 0xffff. */ -static int __init do_ne_probe(struct net_device *dev) +int __init do_ne_probe(struct net_device *dev) { unsigned int base_addr = dev->base_addr; -#ifndef MODULE +#ifdef CONFIG_ISA int orig_irq = dev->irq; #endif @@ -196,12 +223,11 @@ return ne_probe1(dev, base_addr); else if (base_addr != 0) /* Don't probe at all. */ return -ENXIO; - +#ifdef CONFIG_ISA /* Then look for any installed ISAPnP clones */ if (isapnp_present() && (ne_probe_isapnp(dev) == 0)) return 0; -#ifndef MODULE /* Last resort. The semi-risky ISA auto-probe. */ for (base_addr = 0; netcard_portlist[base_addr] != 0; base_addr++) { int ioaddr = netcard_portlist[base_addr]; @@ -309,13 +335,13 @@ { int regd; outb_p(E8390_NODMA+E8390_PAGE1+E8390_STOP, ioaddr + E8390_CMD); - regd = inb_p(ioaddr + 0x0d); - outb_p(0xff, ioaddr + 0x0d); + regd = inb_p(ioaddr + EN0_COUNTER0); + outb_p(0xff, ioaddr + EN0_COUNTER0); outb_p(E8390_NODMA+E8390_PAGE0, ioaddr + E8390_CMD); inb_p(ioaddr + EN0_COUNTER0); /* Clear the counter by reading. */ if (inb_p(ioaddr + EN0_COUNTER0) != 0) { outb_p(reg0, ioaddr); - outb_p(regd, ioaddr + 0x0d); /* Restore the old values. */ + outb_p(regd, ioaddr + EN0_COUNTER0); /* Restore the old values. */ ret = -ENODEV; goto err_out; } @@ -390,6 +416,8 @@ wordlength = 1; } + wordlength = 2; /* Added by Mark Lee */ + if (wordlength == 2) { for (i = 0; i < 16; i++) @@ -415,6 +443,10 @@ stop_page = NE1SM_STOP_PG; } + // ax88796 no prom, fake signature + SA_prom[14] = 0x57; + SA_prom[15] = 0x57; + #if defined(CONFIG_PLAT_MAPPI) || defined(CONFIG_PLAT_OAKS32R) neX000 = ((SA_prom[14] == 0x57 && SA_prom[15] == 0x57) || (SA_prom[14] == 0x42 && SA_prom[15] == 0x42)); @@ -510,10 +542,12 @@ printk(" %2.2x", SA_prom[i]); } #else - for(i = 0; i < ETHER_ADDR_LEN; i++) { - printk(" %2.2x", SA_prom[i]); - dev->dev_addr[i] = SA_prom[i]; - } + // set mac address to configured value + i = (dev->name[3] - 0x30) & 0x01; + memcpy( dev->dev_addr, configured_mac_address[i], ETH_ALEN); + + for(i = 0; i < ETHER_ADDR_LEN; i++) + printk(" %2.2x", dev->dev_addr[i]); #endif printk("\n%s: %s found at %#x, using IRQ %d.\n",