diff options
author | Jesse Gilles <jgilles@multitech.com> | 2013-02-13 11:24:42 -0600 |
---|---|---|
committer | Jesse Gilles <jgilles@multitech.com> | 2013-02-13 11:24:42 -0600 |
commit | 345816b9381d2d0d9df8047596f0bc5c03d8a8d8 (patch) | |
tree | bda0e3f18684f866e6b43e7cdf7619de0dc45a93 /multitech/recipes/u-boot | |
parent | d354a230fb5ec512ca8f7b89ffc2e8679945eade (diff) |
u-boot: add 2012.10 for mtocgd3
Diffstat (limited to 'multitech/recipes/u-boot')
4 files changed, 458 insertions, 0 deletions
diff --git a/multitech/recipes/u-boot/u-boot-2012.10/mtocgd3/u-boot-2012.10-mtocgd3.patch b/multitech/recipes/u-boot/u-boot-2012.10/mtocgd3/u-boot-2012.10-mtocgd3.patch new file mode 100644 index 0000000..dbe3247 --- /dev/null +++ b/multitech/recipes/u-boot/u-boot-2012.10/mtocgd3/u-boot-2012.10-mtocgd3.patch @@ -0,0 +1,344 @@ +Index: git/board/atmel/at91sam9x5ek/at91sam9x5ek.c +=================================================================== +--- git.orig/board/atmel/at91sam9x5ek/at91sam9x5ek.c 2013-02-11 10:22:37.000000000 -0600 ++++ git/board/atmel/at91sam9x5ek/at91sam9x5ek.c 2013-02-11 13:52:43.930054966 -0600 +@@ -60,8 +60,6 @@ + /* Enable CS3 */ + csa = readl(&matrix->ebicsa); + csa |= AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA; +- /* NAND flash on D16 */ +- csa |= AT91_MATRIX_NFD0_ON_D16; + + /* Configure IO drive */ + csa &= ~AT91_MATRIX_EBI_EBI_IOSR_NORMAL; +@@ -115,8 +113,9 @@ + + #ifdef CONFIG_MACB + if (has_emac0()) ++ /* MTOCGD3: use phy addr 5 for ethernet switch */ + rc = macb_eth_initialize(0, +- (void *)ATMEL_BASE_EMAC0, 0x00); ++ (void *)ATMEL_BASE_EMAC0, 0x05); + if (has_emac1()) + rc = macb_eth_initialize(1, + (void *)ATMEL_BASE_EMAC1, 0x00); +Index: git/include/configs/at91sam9x5ek.h +=================================================================== +--- git.orig/include/configs/at91sam9x5ek.h 2013-02-11 10:22:38.000000000 -0600 ++++ git/include/configs/at91sam9x5ek.h 2013-02-11 13:56:13.890363608 -0600 +@@ -54,6 +54,7 @@ + #define CONFIG_USART_ID ATMEL_ID_SYS + + /* LCD */ ++/* MTOCGD3 has no LCD + #define CONFIG_LCD + #define LCD_BPP LCD_COLOR16 + #define LCD_OUTPUT_BPP 24 +@@ -65,6 +66,7 @@ + #define CONFIG_ATMEL_HLCD + #define CONFIG_ATMEL_LCD_RGB565 + #define CONFIG_SYS_CONSOLE_IS_IN_ENV ++*/ + + #define CONFIG_BOOTDELAY 3 + +@@ -120,12 +122,14 @@ + /* our CLE is AD22 */ + #define CONFIG_SYS_NAND_MASK_CLE (1 << 22) + #define CONFIG_SYS_NAND_ENABLE_PIN AT91_PIN_PD4 +-#define CONFIG_SYS_NAND_READY_PIN AT91_PIN_PD5 ++/* MTOCGD3: nand ready is on PC31 */ ++#define CONFIG_SYS_NAND_READY_PIN AT91_PIN_PC31 + + /* PMECC & PMERRLOC */ + #define CONFIG_ATMEL_NAND_HWECC 1 + #define CONFIG_ATMEL_NAND_HW_PMECC 1 +-#define CONFIG_PMECC_CAP 2 ++/* MTOCGD3: 4-bit PMECC */ ++#define CONFIG_PMECC_CAP 4 + #define CONFIG_PMECC_SECTOR_SIZE 512 + #define CONFIG_PMECC_INDEX_TABLE_OFFSET 0x8000 + +@@ -140,9 +144,14 @@ + + /* Ethernet */ + #define CONFIG_MACB +-#define CONFIG_RMII ++/* MTOCGD3 is MII */ ++#undef CONFIG_RMII + #define CONFIG_NET_RETRY_COUNT 20 +-#define CONFIG_MACB_SEARCH_PHY ++/* MTOCGD3: MAC is connected to fixed-speed PHY on ethernet switch */ ++#undef CONFIG_MACB_SEARCH_PHY ++#define CONFIG_FIXED_PHY 1 ++/* enable MII command */ ++#define CONFIG_CMD_MII 1 + + #define CONFIG_SYS_LOAD_ADDR 0x22000000 /* load address */ + +@@ -155,9 +164,8 @@ + #define CONFIG_ENV_OFFSET 0xc0000 + #define CONFIG_ENV_OFFSET_REDUND 0x100000 + #define CONFIG_ENV_SIZE 0x20000 /* 1 sector = 128 kB */ +-#define CONFIG_BOOTCOMMAND "nand read " \ +- "0x22000000 0x200000 0x300000; " \ +- "bootm 0x22000000" ++/* MTOCGD3: read from env variables for boot */ ++#define CONFIG_BOOTCOMMAND "nboot.jffs2 ${loadaddr} 0 ${kernel_addr}; bootm ${loadaddr}" + #else + #ifdef CONFIG_SYS_USE_SPIFLASH + /* bootstrap + u-boot + env + linux in spi flash */ +@@ -172,11 +180,8 @@ + #endif + #endif + +-#define CONFIG_BOOTARGS "mem=128M console=ttyS0,115200 " \ +- "mtdparts=atmel_nand:" \ +- "8M(bootstrap/uboot/kernel)ro,-(rootfs) " \ +- "root=/dev/mtdblock1 rw " \ +- "rootfstype=ubifs ubi.mtd=1 root=ubi0:rootfs" ++/* MTOCGD3: rootfs is jffs2 */ ++#define CONFIG_BOOTARGS "mem=128M console=ttyS0,115200 root=/dev/mtdblock8 ro rootfstype=jffs2" + + #define CONFIG_BAUDRATE 115200 + +@@ -199,4 +204,22 @@ + #error CONFIG_USE_IRQ not supported + #endif + ++// MTOCGD3 defaults ++#define CONFIG_ENV_OVERWRITE 1 /* Allow Overwrite of serial# & ethaddr */ ++#define CONFIG_ETHADDR 00:08:00:87:00:02 ++#define CONFIG_IPADDR 192.168.2.1 ++#define CONFIG_NETMASK 255.255.255.0 ++#define CONFIG_SERVERIP 192.168.2.2 ++#define CONFIG_HOSTNAME AT91SAM9G25 ++#define CONFIG_LOADADDR 0x22000000 ++ ++// MTOCGD3 - enable watchdog ++#define CONFIG_AT91SAM9_WATCHDOG 1 ++#define CONFIG_HW_WATCHDOG 1 ++ ++#define CONFIG_EXTRA_ENV_SETTINGS \ ++ "kernel_addr=0x200000\0" \ ++ "" ++ ++ + #endif +Index: git/drivers/net/macb.c +=================================================================== +--- git.orig/drivers/net/macb.c 2013-02-11 13:52:43.930054966 -0600 ++++ git/drivers/net/macb.c 2013-02-11 13:52:43.930054966 -0600 +@@ -86,6 +86,18 @@ + #define TXBUF_WRAP 0x40000000 + #define TXBUF_USED 0x80000000 + ++#define BIT0 (1<<0) ++#define BIT1 (1<<1) ++#define BIT2 (1<<2) ++#define BIT3 (1<<3) ++#define BIT4 (1<<4) ++#define BIT5 (1<<5) ++#define BIT6 (1<<6) ++#define BIT7 (1<<7) ++#define BIT8 (1<<8) ++#define BIT9 (1<<9) ++#define BIT10 (1<<10) ++ + struct macb_device { + void *regs; + +@@ -105,6 +117,7 @@ + const struct device *dev; + struct eth_device netdev; + unsigned short phy_addr; ++ unsigned short ext_phy_addr; + }; + #define to_macb(_nd) container_of(_nd, struct macb_device, netdev) + +@@ -113,6 +126,13 @@ + unsigned long netctl; + unsigned long netstat; + unsigned long frame; ++ unsigned short phya; ++ ++ // use extended phy addr if set, else use fixed phy addr ++ if (macb->ext_phy_addr != 0) ++ phya = macb->ext_phy_addr; ++ else ++ phya = macb->phy_addr; + + netctl = macb_readl(macb, NCR); + netctl |= MACB_BIT(MPE); +@@ -120,7 +140,7 @@ + + frame = (MACB_BF(SOF, 1) + | MACB_BF(RW, 1) +- | MACB_BF(PHYA, macb->phy_addr) ++ | MACB_BF(PHYA, phya) + | MACB_BF(REGA, reg) + | MACB_BF(CODE, 2) + | MACB_BF(DATA, value)); +@@ -140,6 +160,14 @@ + unsigned long netctl; + unsigned long netstat; + unsigned long frame; ++ unsigned short phya; ++ ++ // use extended phy addr if set, else use fixed phy addr ++ if (macb->ext_phy_addr != 0) ++ phya = macb->ext_phy_addr; ++ else ++ phya = macb->phy_addr; ++ + + netctl = macb_readl(macb, NCR); + netctl |= MACB_BIT(MPE); +@@ -147,7 +175,7 @@ + + frame = (MACB_BF(SOF, 1) + | MACB_BF(RW, 2) +- | MACB_BF(PHYA, macb->phy_addr) ++ | MACB_BF(PHYA, phya) + | MACB_BF(REGA, reg) + | MACB_BF(CODE, 2)); + macb_writel(macb, MAN, frame); +@@ -167,15 +195,59 @@ + + #if defined(CONFIG_CMD_MII) + ++// Micrel switch support -- converts SMI register address to split reg and phy address fields ++void convert_smi_reg(u8 smi_reg, u8 *reg, u8 *phy_adr) ++{ ++ u8 new_phy_adr = 0; ++ ++ // lower 5 bits go in reg ++ if (reg) ++ *reg = smi_reg & 0x1f; ++ ++ // upper 3 bits go in phy_adr bits 4,3,0 ++ if (smi_reg & BIT5) ++ new_phy_adr |= BIT0; ++ if (smi_reg & BIT6) ++ new_phy_adr |= BIT3; ++ if (smi_reg & BIT7) ++ new_phy_adr |= BIT4; ++ ++ // bits 1 and 2 are always 1 ++ new_phy_adr |= BIT1; ++ new_phy_adr |= BIT2; ++ ++ if (phy_adr) ++ *phy_adr = new_phy_adr; ++} ++ + int macb_miiphy_read(const char *devname, u8 phy_adr, u8 reg, u16 *value) + { + struct eth_device *dev = eth_get_dev_by_name(devname); + struct macb_device *macb = to_macb(dev); ++ u8 smi_reg = reg; ++ u8 phy_arg = phy_adr; ++ u8 reg_arg = reg; ++ ++ if (phy_adr == 0 || phy_adr > 6) ++ return -1; ++ ++ // ---micrel switch support--- ++ // use phy_adr 0x06 to designate that reg is an SMI command and we should ++ // construct phy_adr and reg values for accessing the control registers ++ if (phy_adr == 0x06) { ++ convert_smi_reg(smi_reg, ®_arg, &phy_arg); ++ //debug("reading SMI reg %x, phy_adr %x, reg %x\n", ++ // smi_reg, phy_arg, reg_arg); ++ debug("reading SMI reg %x\n", smi_reg); ++ } + +- if ( macb->phy_addr != phy_adr ) +- return -1; ++ // allow reading any phy addr value (ethernet switch) ++ macb->ext_phy_addr = phy_arg; ++ ++ *value = macb_mdio_read(macb, reg_arg); + +- *value = macb_mdio_read(macb, reg); ++ // reset to use fixed phy for later calls ++ macb->ext_phy_addr = 0; + + return 0; + } +@@ -184,11 +256,30 @@ + { + struct eth_device *dev = eth_get_dev_by_name(devname); + struct macb_device *macb = to_macb(dev); ++ u8 smi_reg = reg; ++ u8 phy_arg = phy_adr; ++ u8 reg_arg = reg; ++ ++ if (phy_adr == 0 || phy_adr > 6) ++ return -1; ++ ++ // ---micrel switch support--- ++ // use phy_adr 0x06 to designate that reg is an SMI command and we should ++ // construct phy_adr and reg values for accessing the control registers ++ if (phy_adr == 0x06) { ++ convert_smi_reg(smi_reg, ®_arg, &phy_arg); ++ //debug("writing value %x to SMI reg %x, phy_adr %x, reg %x\n", ++ // value, smi_reg, phy_arg, reg_arg); ++ debug("writing value %x to SMI reg %x\n", value, smi_reg); ++ } + +- if ( macb->phy_addr != phy_adr ) +- return -1; ++ // allow using any phy addr value (ethernet switch) ++ macb->ext_phy_addr = phy_arg; + +- macb_mdio_write(macb, reg, value); ++ macb_mdio_write(macb, reg_arg, value); ++ ++ // reset to use fixed phy for later calls ++ macb->ext_phy_addr = 0; + + return 0; + } +@@ -396,6 +487,14 @@ + return 0; + } + ++#ifdef CONFIG_FIXED_PHY ++ ncfgr = macb_readl(macb, NCFGR); ++ // MTOCGD3: force link to 100, full duplex ++ ncfgr |= MACB_BIT(SPD); ++ ncfgr |= MACB_BIT(FD); ++ macb_writel(macb, NCFGR, ncfgr); ++ return 1; ++#else + status = macb_mdio_read(macb, MII_BMSR); + if (!(status & BMSR_LSTATUS)) { + /* Try to re-negotiate if we don't have link already. */ +@@ -428,6 +527,7 @@ + macb_writel(macb, NCFGR, ncfgr); + return 1; + } ++#endif /* CONFIG_FIXED_PHY */ + } + + static int macb_init(struct eth_device *netdev, bd_t *bd) +@@ -554,6 +654,7 @@ + + macb->regs = regs; + macb->phy_addr = phy_addr; ++ macb->ext_phy_addr = 0; + + sprintf(netdev->name, "macb%d", id); + netdev->init = macb_init; +@@ -583,6 +684,10 @@ + #if defined(CONFIG_CMD_MII) + miiphy_register(netdev->name, macb_miiphy_read, macb_miiphy_write); + #endif ++ ++ // MTOCGD3: enable micrel switch ++ macb_miiphy_write("macb0", 6, 1, 0x41); ++ + return 0; + } + diff --git a/multitech/recipes/u-boot/u-boot-2012.10/u-boot-2010.06-macb-autoneg-timeout.patch b/multitech/recipes/u-boot/u-boot-2012.10/u-boot-2010.06-macb-autoneg-timeout.patch new file mode 100644 index 0000000..5294b1a --- /dev/null +++ b/multitech/recipes/u-boot/u-boot-2012.10/u-boot-2010.06-macb-autoneg-timeout.patch @@ -0,0 +1,53 @@ +Index: u-boot-2010.06/drivers/net/macb.c +=================================================================== +--- u-boot-2010.06.orig/drivers/net/macb.c 2013-01-04 16:57:21.460051123 -0600 ++++ u-boot-2010.06/drivers/net/macb.c 2013-01-04 17:03:28.880052058 -0600 +@@ -57,7 +57,7 @@ + #define CONFIG_SYS_MACB_RX_RING_SIZE (CONFIG_SYS_MACB_RX_BUFFER_SIZE / 128) + #define CONFIG_SYS_MACB_TX_RING_SIZE 16 + #define CONFIG_SYS_MACB_TX_TIMEOUT 1000 +-#define CONFIG_SYS_MACB_AUTONEG_TIMEOUT 5000000 ++#define CONFIG_SYS_MACB_AUTONEG_TIMEOUT 3000000 + + struct macb_dma_desc { + u32 addr; +@@ -322,11 +322,12 @@ + return 0; + } + +-static void macb_phy_reset(struct macb_device *macb) ++static u16 macb_phy_reset(struct macb_device *macb) + { + struct eth_device *netdev = &macb->netdev; + int i; +- u16 status, adv; ++ u16 status = 0; ++ u16 adv; + + adv = ADVERTISE_CSMA | ADVERTISE_ALL; + macb_mdio_write(macb, MII_ADVERTISE, adv); +@@ -346,6 +347,8 @@ + else + printf("%s: Autonegotiation timed out (status=0x%04x)\n", + netdev->name, status); ++ ++ return status; + } + + #ifdef CONFIG_MACB_SEARCH_PHY +@@ -397,14 +400,7 @@ + status = macb_mdio_read(macb, MII_BMSR); + if (!(status & BMSR_LSTATUS)) { + /* Try to re-negotiate if we don't have link already. */ +- macb_phy_reset(macb); +- +- for (i = 0; i < CONFIG_SYS_MACB_AUTONEG_TIMEOUT / 100; i++) { +- status = macb_mdio_read(macb, MII_BMSR); +- if (status & BMSR_LSTATUS) +- break; +- udelay(100); +- } ++ status = macb_phy_reset(macb); + } + + if (!(status & BMSR_LSTATUS)) { diff --git a/multitech/recipes/u-boot/u-boot-2012.10/u-boot-2012.10-sam9x5-eth-mii-fix.patch b/multitech/recipes/u-boot/u-boot-2012.10/u-boot-2012.10-sam9x5-eth-mii-fix.patch new file mode 100644 index 0000000..0f41ac4 --- /dev/null +++ b/multitech/recipes/u-boot/u-boot-2012.10/u-boot-2012.10-sam9x5-eth-mii-fix.patch @@ -0,0 +1,27 @@ +Index: git/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c +=================================================================== +--- git.orig/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c 2013-02-11 10:22:35.000000000 -0600 ++++ git/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c 2013-02-11 10:32:59.652182120 -0600 +@@ -206,14 +206,14 @@ + #ifndef CONFIG_RMII + /* Only emac0 support MII */ + if (has_emac0()) { +- at91_set_b_periph(AT91_PIO_PORTB, 16, 0); /* ECRS */ +- at91_set_b_periph(AT91_PIO_PORTB, 17, 0); /* ECOL */ +- at91_set_b_periph(AT91_PIO_PORTB, 13, 0); /* ERX2 */ +- at91_set_b_periph(AT91_PIO_PORTB, 14, 0); /* ERX3 */ +- at91_set_b_periph(AT91_PIO_PORTB, 15, 0); /* ERXCK */ +- at91_set_b_periph(AT91_PIO_PORTB, 11, 0); /* ETX2 */ +- at91_set_b_periph(AT91_PIO_PORTB, 12, 0); /* ETX3 */ +- at91_set_b_periph(AT91_PIO_PORTB, 8, 0); /* ETXER */ ++ at91_set_a_periph(AT91_PIO_PORTB, 16, 0); /* ECRS */ ++ at91_set_a_periph(AT91_PIO_PORTB, 17, 0); /* ECOL */ ++ at91_set_a_periph(AT91_PIO_PORTB, 13, 0); /* ERX2 */ ++ at91_set_a_periph(AT91_PIO_PORTB, 14, 0); /* ERX3 */ ++ at91_set_a_periph(AT91_PIO_PORTB, 15, 0); /* ERXCK */ ++ at91_set_a_periph(AT91_PIO_PORTB, 11, 0); /* ETX2 */ ++ at91_set_a_periph(AT91_PIO_PORTB, 12, 0); /* ETX3 */ ++ at91_set_a_periph(AT91_PIO_PORTB, 8, 0); /* ETXER */ + } + #endif + } diff --git a/multitech/recipes/u-boot/u-boot_2012.10.bb b/multitech/recipes/u-boot/u-boot_2012.10.bb new file mode 100644 index 0000000..cd9f151 --- /dev/null +++ b/multitech/recipes/u-boot/u-boot_2012.10.bb @@ -0,0 +1,34 @@ +PR = "r0" +require recipes/u-boot/u-boot.inc + +DEFAULT_PREFERENCE = "-1" + +# U-Boot 2012.10 for AT91 +SRCREV="linux4sam_4.0" + +SRC_URI = "git://github.com/linux4sam/u-boot-at91.git;protocol=http;tag=${SRCREV} \ + file://u-boot-2012.10-sam9x5-eth-mii-fix.patch \ + " + +# add patch to speed up boot if ethernet autonegotiation fails +SRC_URI += "file://u-boot-2010.06-macb-autoneg-timeout.patch" + +SRC_URI_append_mtocgd3 = " file://u-boot-2012.10-mtocgd3.patch" + +TARGET_LDFLAGS = "" + +S = "${WORKDIR}/git" + +inherit base + +do_configure_prepend() { + mv -f tools/setlocalversion tools/setlocalversion.old + echo -e "#!/bin/sh\necho '-${MACHINE}-${PR}'" > tools/setlocalversion + chmod a+rx tools/setlocalversion +} + +do_compile () { + oe_runmake ${UBOOT_MACHINE} + oe_runmake all +} + |