diff options
author | blogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2008-07-05 23:06:07 +0000 |
---|---|---|
committer | blogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2008-07-05 23:06:07 +0000 |
commit | c223e82fd455290ae2db23503c1197bc25981548 (patch) | |
tree | 81fb17362cf107668648d5ae2db7e40b86b14286 /target/linux/ifxmips/files/drivers | |
parent | c4b8e2f0b84b5f0e845e696f7ac12144dfafa66b (diff) |
lots of ifxmips fixes and features
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@11673 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ifxmips/files/drivers')
-rw-r--r-- | target/linux/ifxmips/files/drivers/mtd/maps/ifxmips.c | 37 | ||||
-rw-r--r-- | target/linux/ifxmips/files/drivers/net/ifxmips_mii0.c | 12 | ||||
-rw-r--r-- | target/linux/ifxmips/files/drivers/serial/ifxmips_asc.c | 13 |
3 files changed, 46 insertions, 16 deletions
diff --git a/target/linux/ifxmips/files/drivers/mtd/maps/ifxmips.c b/target/linux/ifxmips/files/drivers/mtd/maps/ifxmips.c index 98359eb9fa..b3692e72a0 100644 --- a/target/linux/ifxmips/files/drivers/mtd/maps/ifxmips.c +++ b/target/linux/ifxmips/files/drivers/mtd/maps/ifxmips.c @@ -27,6 +27,7 @@ #include <linux/mtd/partitions.h> #include <linux/mtd/cfi.h> #include <asm/ifxmips/ifxmips.h> +#include <asm/ifxmips/ifxmips_prom.h> #include <asm/ifxmips/ifxmips_ebu.h> #include <linux/magic.h> #include <linux/platform_device.h> @@ -90,14 +91,14 @@ ifxmips_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_ } static struct mtd_partition -ifxmips_partitions[4] = { +ifxmips_partitions[] = { { - name:"U-Boot", + name:"uboot", offset:0x00000000, size:0x00020000, }, { - name:"U-Boot-Env", + name:"uboot_env", offset:0x00020000, size:0x00010000, }, @@ -111,6 +112,11 @@ ifxmips_partitions[4] = { offset:0x0, size:0x0, }, + { + name:"board_config", + offset:0x0, + size:0x0, + }, }; int @@ -122,6 +128,18 @@ find_uImage_size(unsigned long start_offset){ } int +find_brn_block(unsigned long start_offset){ + unsigned char temp[9]; + ifxmips_copy_from(&ifxmips_map, &temp, start_offset, 8); + temp[8] = '\0'; + printk(KERN_INFO "data in brn block %s\n", temp); + if(memcmp(temp, "BRN-BOOT", 8) == 0) + return 1; + else + return 0; +} + +int detect_squashfs_partition(unsigned long start_offset){ unsigned long temp; ifxmips_copy_from(&ifxmips_map, &temp, start_offset, 4); @@ -170,12 +188,19 @@ ifxmips_mtd_probe(struct platform_device *dev) uimage_size += 0x10000; } + parts = &ifxmips_partitions[0]; ifxmips_partitions[2].size = uimage_size; ifxmips_partitions[3].offset = ifxmips_partitions[2].offset + ifxmips_partitions[2].size; ifxmips_partitions[3].size = ((ifxmips_mtd->size >> 20) * 1024 * 1024) - ifxmips_partitions[3].offset; - - parts = &ifxmips_partitions[0]; - add_mtd_partitions(ifxmips_mtd, parts, 4); + if(ifxmips_has_brn_block()) + { + ifxmips_partitions[3].size -= ifxmips_mtd->erasesize; + ifxmips_partitions[4].offset = ifxmips_mtd->size - ifxmips_mtd->erasesize; + ifxmips_partitions[4].size = ifxmips_mtd->erasesize; + add_mtd_partitions(ifxmips_mtd, parts, 5); + } else { + add_mtd_partitions(ifxmips_mtd, parts, 4); + } printk(KERN_INFO "ifxmips_mtd: added ifxmips flash with %dMB\n", ifxmips_mtd->size >> 20); return 0; diff --git a/target/linux/ifxmips/files/drivers/net/ifxmips_mii0.c b/target/linux/ifxmips/files/drivers/net/ifxmips_mii0.c index cc3b9d46a7..fe7f25ec2a 100644 --- a/target/linux/ifxmips/files/drivers/net/ifxmips_mii0.c +++ b/target/linux/ifxmips/files/drivers/net/ifxmips_mii0.c @@ -36,10 +36,15 @@ #include <linux/init.h> #include <asm/delay.h> #include <asm/ifxmips/ifxmips.h> -#include <asm/ifxmips/ifxmips_mii0.h> #include <asm/ifxmips/ifxmips_dma.h> #include <asm/ifxmips/ifxmips_pmu.h> +struct ifxmips_mii_priv { + struct net_device_stats stats; + struct dma_device_info *dma_device; + struct sk_buff *skb; +}; + static struct net_device *ifxmips_mii0_dev; static unsigned char mac_addr[MAX_ADDR_LEN]; @@ -63,6 +68,7 @@ ifxmips_read_mdio(u32 phy_addr, u32 phy_reg) ((phy_addr & MDIO_ACC_ADDR_MASK) << MDIO_ACC_ADDR_OFFSET) | ((phy_reg & MDIO_ACC_REG_MASK) << MDIO_ACC_REG_OFFSET); + while(ifxmips_r32(IFXMIPS_PPE32_MDIO_ACC) & MDIO_ACC_REQUEST); ifxmips_w32(val, IFXMIPS_PPE32_MDIO_ACC); while(ifxmips_r32(IFXMIPS_PPE32_MDIO_ACC) & MDIO_ACC_REQUEST){}; val = ifxmips_r32(IFXMIPS_PPE32_MDIO_ACC) & MDIO_ACC_VAL_MASK; @@ -343,10 +349,10 @@ static int ifxmips_mii_probe(struct platform_device *dev) { int result = 0; - struct ifxmips_mac *mac = (struct ifxmips_mac*)dev->dev.platform_data; + unsigned char *mac = (unsigned char*)dev->dev.platform_data; ifxmips_mii0_dev = alloc_etherdev(sizeof(struct ifxmips_mii_priv)); ifxmips_mii0_dev->init = ifxmips_mii_dev_init; - memcpy(mac_addr, mac->mac, 6); + memcpy(mac_addr, mac, 6); strcpy(ifxmips_mii0_dev->name, "eth%d"); ifxmips_mii_chip_init(REV_MII_MODE); result = register_netdev(ifxmips_mii0_dev); diff --git a/target/linux/ifxmips/files/drivers/serial/ifxmips_asc.c b/target/linux/ifxmips/files/drivers/serial/ifxmips_asc.c index 17d933c20b..2dc8917fe1 100644 --- a/target/linux/ifxmips/files/drivers/serial/ifxmips_asc.c +++ b/target/linux/ifxmips/files/drivers/serial/ifxmips_asc.c @@ -48,7 +48,6 @@ #include <asm/bitops.h> #include <asm/ifxmips/ifxmips.h> #include <asm/ifxmips/ifxmips_irq.h> -#include <asm/ifxmips/ifxmips_serial.h> #define PORT_IFXMIPSASC 111 @@ -161,7 +160,7 @@ ifxmipsasc_tx_chars(struct uart_port *port) } while(((ifxmips_r32(port->membase + IFXMIPS_ASC_FSTAT) & ASCFSTAT_TXFFLMASK) - >> ASCFSTAT_TXFFLOFF) != IFXMIPSASC_TXFIFO_FULL) + >> ASCFSTAT_TXFFLOFF) != TXFIFO_FULL) { if(port->x_char) { @@ -248,8 +247,8 @@ ifxmipsasc_startup(struct uart_port *port) ifxmips_w32(ifxmips_r32(port->membase + IFXMIPS_ASC_CLC) & ~IFXMIPS_ASC_CLC_DISS, port->membase + IFXMIPS_ASC_CLC); ifxmips_w32(((ifxmips_r32(port->membase + IFXMIPS_ASC_CLC) & ~ASCCLC_RMCMASK)) | (1 << ASCCLC_RMCOFFSET), port->membase + IFXMIPS_ASC_CLC); ifxmips_w32(0, port->membase + IFXMIPS_ASC_PISEL); - ifxmips_w32(((IFXMIPSASC_TXFIFO_FL << ASCTXFCON_TXFITLOFF) & ASCTXFCON_TXFITLMASK) | ASCTXFCON_TXFEN | ASCTXFCON_TXFFLU, port->membase + IFXMIPS_ASC_TXFCON); - ifxmips_w32(((IFXMIPSASC_RXFIFO_FL << ASCRXFCON_RXFITLOFF) & ASCRXFCON_RXFITLMASK) | ASCRXFCON_RXFEN | ASCRXFCON_RXFFLU, port->membase + IFXMIPS_ASC_RXFCON); + ifxmips_w32(((TXFIFO_FL << ASCTXFCON_TXFITLOFF) & ASCTXFCON_TXFITLMASK) | ASCTXFCON_TXFEN | ASCTXFCON_TXFFLU, port->membase + IFXMIPS_ASC_TXFCON); + ifxmips_w32(((RXFIFO_FL << ASCRXFCON_RXFITLOFF) & ASCRXFCON_RXFITLMASK) | ASCRXFCON_RXFEN | ASCRXFCON_RXFFLU, port->membase + IFXMIPS_ASC_RXFCON); wmb (); ifxmips_w32(ifxmips_r32(port->membase + IFXMIPS_ASC_CON) | ASCCON_M_8ASYNC | ASCCON_FEN | ASCCON_TOEN | ASCCON_ROEN, port->membase + IFXMIPS_ASC_CON); @@ -399,7 +398,7 @@ ifxmipsasc_type(struct uart_port *port) { if(port->type == PORT_IFXMIPSASC) { - if(port->membase == IFXMIPS_ASC_BASE_ADDR) + if(port->membase == (void*)IFXMIPS_ASC_BASE_ADDR) return "asc0"; else return "asc1"; @@ -501,7 +500,7 @@ ifxmipsasc_console_write(struct console *co, const char *s, u_int count) do { fifocnt = (ifxmips_r32((u32*)(IFXMIPS_ASC_BASE_ADDR + (port * IFXMIPS_ASC_BASE_DIFF) + IFXMIPS_ASC_FSTAT)) & ASCFSTAT_TXFFLMASK) >> ASCFSTAT_TXFFLOFF; - } while(fifocnt == IFXMIPSASC_TXFIFO_FULL); + } while(fifocnt == TXFIFO_FULL); if(s[i] == '\0') break; @@ -512,7 +511,7 @@ ifxmipsasc_console_write(struct console *co, const char *s, u_int count) do { fifocnt = (ifxmips_r32((u32*)(IFXMIPS_ASC_BASE_ADDR + (port * IFXMIPS_ASC_BASE_DIFF) + IFXMIPS_ASC_FSTAT)) & ASCFSTAT_TXFFLMASK) >> ASCFSTAT_TXFFLOFF; - } while(fifocnt == IFXMIPSASC_TXFIFO_FULL); + } while(fifocnt == TXFIFO_FULL); } ifxmips_w32(s[i], (u32*)(IFXMIPS_ASC_BASE_ADDR + (port * IFXMIPS_ASC_BASE_DIFF) + IFXMIPS_ASC_TBUF)); } |