diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mtd/nand/nand_util.c | 2 | ||||
-rw-r--r-- | drivers/net/dc2114x.c | 4 | ||||
-rw-r--r-- | drivers/net/eepro100.c | 4 | ||||
-rw-r--r-- | drivers/net/macb.c | 4 | ||||
-rw-r--r-- | drivers/net/ne2000.c | 7 | ||||
-rw-r--r-- | drivers/net/pcnet.c | 4 | ||||
-rw-r--r-- | drivers/net/rtl8139.c | 4 | ||||
-rw-r--r-- | drivers/net/rtl8169.c | 3 | ||||
-rw-r--r-- | drivers/net/sk98lin/Makefile | 2 | ||||
-rw-r--r-- | drivers/net/tsec.c | 2 | ||||
-rw-r--r-- | drivers/net/tsi108_eth.c | 4 | ||||
-rw-r--r-- | drivers/net/uli526x.c | 6 | ||||
-rw-r--r-- | drivers/qe/qe.c | 221 | ||||
-rw-r--r-- | drivers/qe/qe.h | 56 | ||||
-rw-r--r-- | drivers/qe/uec.c | 6 | ||||
-rw-r--r-- | drivers/usb/isp116x-hcd.c | 2 | ||||
-rw-r--r-- | drivers/usb/usbdcore_mpc8xx.c | 3 | ||||
-rw-r--r-- | drivers/video/cfb_console.c | 8 |
18 files changed, 309 insertions, 33 deletions
diff --git a/drivers/mtd/nand/nand_util.c b/drivers/mtd/nand/nand_util.c index 4fd4e16..6c5624a 100644 --- a/drivers/mtd/nand/nand_util.c +++ b/drivers/mtd/nand/nand_util.c @@ -1,5 +1,5 @@ /* - * drivers/nand/nand_util.c + * drivers/mtd/nand/nand_util.c * * Copyright (C) 2006 by Weiss-Electronic GmbH. * All rights reserved. diff --git a/drivers/net/dc2114x.c b/drivers/net/dc2114x.c index d5275dc..7238922 100644 --- a/drivers/net/dc2114x.c +++ b/drivers/net/dc2114x.c @@ -332,7 +332,7 @@ static int dc21x4x_init(struct eth_device* dev, bd_t* bis) if ((INL(dev, DE4X5_STS) & (STS_TS | STS_RS)) != 0) { printf("Error: Cannot reset ethernet controller.\n"); - return 0; + return -1; } #ifdef CONFIG_TULIP_SELECT_MEDIA @@ -382,7 +382,7 @@ static int dc21x4x_init(struct eth_device* dev, bd_t* bis) send_setup_frame(dev, bis); - return 1; + return 0; } static int dc21x4x_send(struct eth_device* dev, volatile void *packet, int length) diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index 738146e..96ed271 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -485,7 +485,7 @@ int eepro100_initialize (bd_t * bis) static int eepro100_init (struct eth_device *dev, bd_t * bis) { - int i, status = 0; + int i, status = -1; int tx_cur; struct descriptor *ias_cmd, *cfg_cmd; @@ -598,7 +598,7 @@ static int eepro100_init (struct eth_device *dev, bd_t * bis) goto Done; } - status = 1; + status = 0; Done: return status; diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 95cdc49..6657d22 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -423,12 +423,12 @@ static int macb_init(struct eth_device *netdev, bd_t *bd) #endif if (!macb_phy_init(macb)) - return 0; + return -1; /* Enable TX and RX */ macb_writel(macb, NCR, MACB_BIT(TE) | MACB_BIT(RE)); - return 1; + return 0; } static void macb_halt(struct eth_device *netdev) diff --git a/drivers/net/ne2000.c b/drivers/net/ne2000.c index c978d62..b100657 100644 --- a/drivers/net/ne2000.c +++ b/drivers/net/ne2000.c @@ -839,7 +839,7 @@ void uboot_push_packet_len(int len) { } dp83902a_recv(&pbuf[0], len); - /*Just pass it to the upper layer*/ + /* Just pass it to the upper layer */ NetReceive(&pbuf[0], len); } @@ -902,7 +902,6 @@ int eth_init(bd_t *bd) { } void eth_halt() { - PRINTK("### eth_halt\n"); if(initialized) dp83902a_stop(); @@ -910,8 +909,8 @@ void eth_halt() { } int eth_rx() { -dp83902a_poll(); -return 1; + dp83902a_poll(); + return 1; } int eth_send(volatile void *packet, int length) { diff --git a/drivers/net/pcnet.c b/drivers/net/pcnet.c index 2af0e8f..4e270c9 100644 --- a/drivers/net/pcnet.c +++ b/drivers/net/pcnet.c @@ -402,7 +402,7 @@ static int pcnet_init(struct eth_device* dev, bd_t *bis) if (i <= 0) { printf("%s: TIMEOUT: controller init failed\n", dev->name); pcnet_reset (dev); - return 0; + return -1; } /* @@ -410,7 +410,7 @@ static int pcnet_init(struct eth_device* dev, bd_t *bis) */ pcnet_write_csr (dev, 0, 0x0002); - return 1; + return 0; } static int pcnet_send(struct eth_device* dev, volatile void *packet, int pkt_len) diff --git a/drivers/net/rtl8139.c b/drivers/net/rtl8139.c index 2367180..4c24805 100644 --- a/drivers/net/rtl8139.c +++ b/drivers/net/rtl8139.c @@ -273,10 +273,10 @@ static int rtl8139_probe(struct eth_device *dev, bd_t *bis) if (inb(ioaddr + MediaStatus) & MSRLinkFail) { printf("Cable not connected or other link failure\n"); - return(0); + return -1 ; } - return 1; + return 0; } /* Serial EEPROM section. */ diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c index 1d7f31c..57ccbd9 100644 --- a/drivers/net/rtl8169.c +++ b/drivers/net/rtl8169.c @@ -624,7 +624,7 @@ static void rtl8169_init_ring(struct eth_device *dev) /************************************************************************** RESET - Finish setting up the ethernet interface ***************************************************************************/ -static void rtl_reset(struct eth_device *dev, bd_t *bis) +static int rtl_reset(struct eth_device *dev, bd_t *bis) { int i; @@ -660,6 +660,7 @@ static void rtl_reset(struct eth_device *dev, bd_t *bis) #ifdef DEBUG_RTL8169 printf ("%s elapsed time : %d\n", __FUNCTION__, currticks()-stime); #endif + return 0; } /************************************************************************** diff --git a/drivers/net/sk98lin/Makefile b/drivers/net/sk98lin/Makefile index a7d4a3b..8b83fae 100644 --- a/drivers/net/sk98lin/Makefile +++ b/drivers/net/sk98lin/Makefile @@ -20,7 +20,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA # -# File: drivers/sk98lin/Makefile +# File: drivers/net/sk98lin/Makefile # # Makefile for the SysKonnect SK-98xx device driver. # diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c index 108cebd..25392f6 100644 --- a/drivers/net/tsec.c +++ b/drivers/net/tsec.c @@ -232,7 +232,7 @@ int tsec_init(struct eth_device *dev, bd_t * bd) startup_tsec(dev); /* If there's no link, fail */ - return priv->link; + return (priv->link ? 0 : -1); } diff --git a/drivers/net/tsi108_eth.c b/drivers/net/tsi108_eth.c index 524e9da..a09115e 100644 --- a/drivers/net/tsi108_eth.c +++ b/drivers/net/tsi108_eth.c @@ -792,7 +792,7 @@ static int tsi108_eth_probe (struct eth_device *dev, bd_t * bis) (dev->enetaddr[0] << 16); if (marvell_88e_phy_config(dev, &speed, &duplex) == 0) - return 0; + return -1; value = MAC_CONFIG_2_PREAMBLE_LENGTH(7) | MAC_CONFIG_2_PAD_CRC | @@ -864,7 +864,7 @@ static int tsi108_eth_probe (struct eth_device *dev, bd_t * bis) /* enable TX queue */ reg_TX_CONTROL(base) = TX_CONTROL_GO | 0x01; - return 1; + return 0; } /* diff --git a/drivers/net/uli526x.c b/drivers/net/uli526x.c index 1267c57..8460f69 100644 --- a/drivers/net/uli526x.c +++ b/drivers/net/uli526x.c @@ -279,12 +279,12 @@ static int uli526x_init_one(struct eth_device *dev, bd_t *bis) db->desc_pool_ptr = (uchar *)&desc_pool_array[0]; db->desc_pool_dma_ptr = (dma_addr_t)&desc_pool_array[0]; if (db->desc_pool_ptr == NULL) - return 0; + return -1; db->buf_pool_ptr = &buf_pool[0]; db->buf_pool_dma_ptr = (dma_addr_t)&buf_pool[0]; if (db->buf_pool_ptr == NULL) - return 0; + return -1; db->first_tx_desc = (struct tx_desc *) db->desc_pool_ptr; db->first_tx_desc_dma = db->desc_pool_dma_ptr; @@ -331,7 +331,7 @@ static int uli526x_init_one(struct eth_device *dev, bd_t *bis) db->cr6_data |= ULI526X_TXTH_256; db->cr0_data = CR0_DEFAULT; uli526x_init(dev); - return 1; + return 0; } static void uli526x_disable(struct eth_device *dev) diff --git a/drivers/qe/qe.c b/drivers/qe/qe.c index 7559e92..c802014 100644 --- a/drivers/qe/qe.c +++ b/drivers/qe/qe.c @@ -21,6 +21,7 @@ */ #include "common.h" +#include <command.h> #include "asm/errno.h" #include "asm/io.h" #include "asm/immap_qe.h" @@ -34,7 +35,7 @@ DECLARE_GLOBAL_DATA_PTR; void qe_issue_cmd(uint cmd, uint sbc, u8 mcn, u32 cmd_data) { - u32 cecr; + u32 cecr; if (cmd == QE_RESET) { out_be32(&qe_immr->cp.cecr,(u32) (cmd | QE_CR_FLG)); @@ -248,4 +249,222 @@ int qe_set_mii_clk_src(int ucc_num) return 0; } +/* The maximum number of RISCs we support */ +#define MAX_QE_RISC 2 + +/* Firmware information stored here for qe_get_firmware_info() */ +static struct qe_firmware_info qe_firmware_info; + +/* + * Set to 1 if QE firmware has been uploaded, and therefore + * qe_firmware_info contains valid data. + */ +static int qe_firmware_uploaded; + +/* + * Upload a QE microcode + * + * This function is a worker function for qe_upload_firmware(). It does + * the actual uploading of the microcode. + */ +static void qe_upload_microcode(const void *base, + const struct qe_microcode *ucode) +{ + const u32 *code = base + be32_to_cpu(ucode->code_offset); + unsigned int i; + + if (ucode->major || ucode->minor || ucode->revision) + printf("QE: uploading microcode '%s' version %u.%u.%u\n", + ucode->id, ucode->major, ucode->minor, ucode->revision); + else + printf("QE: uploading microcode '%s'\n", ucode->id); + + /* Use auto-increment */ + out_be32(&qe_immr->iram.iadd, be32_to_cpu(ucode->iram_offset) | + QE_IRAM_IADD_AIE | QE_IRAM_IADD_BADDR); + + for (i = 0; i < be32_to_cpu(ucode->count); i++) + out_be32(&qe_immr->iram.idata, be32_to_cpu(code[i])); +} + +/* + * Upload a microcode to the I-RAM at a specific address. + * + * See docs/README.qe_firmware for information on QE microcode uploading. + * + * Currently, only version 1 is supported, so the 'version' field must be + * set to 1. + * + * The SOC model and revision are not validated, they are only displayed for + * informational purposes. + * + * 'calc_size' is the calculated size, in bytes, of the firmware structure and + * all of the microcode structures, minus the CRC. + * + * 'length' is the size that the structure says it is, including the CRC. + */ +int qe_upload_firmware(const struct qe_firmware *firmware) +{ + unsigned int i; + unsigned int j; + u32 crc; + size_t calc_size = sizeof(struct qe_firmware); + size_t length; + const struct qe_header *hdr; + + if (!firmware) { + printf("Invalid address\n"); + return -EINVAL; + } + + hdr = &firmware->header; + length = be32_to_cpu(hdr->length); + + /* Check the magic */ + if ((hdr->magic[0] != 'Q') || (hdr->magic[1] != 'E') || + (hdr->magic[2] != 'F')) { + printf("Not a microcode\n"); + return -EPERM; + } + + /* Check the version */ + if (hdr->version != 1) { + printf("Unsupported version\n"); + return -EPERM; + } + + /* Validate some of the fields */ + if ((firmware->count < 1) || (firmware->count >= MAX_QE_RISC)) { + printf("Invalid data\n"); + return -EINVAL; + } + + /* Validate the length and check if there's a CRC */ + calc_size += (firmware->count - 1) * sizeof(struct qe_microcode); + + for (i = 0; i < firmware->count; i++) + /* + * For situations where the second RISC uses the same microcode + * as the first, the 'code_offset' and 'count' fields will be + * zero, so it's okay to add those. + */ + calc_size += sizeof(u32) * + be32_to_cpu(firmware->microcode[i].count); + + /* Validate the length */ + if (length != calc_size + sizeof(u32)) { + printf("Invalid length\n"); + return -EPERM; + } + + /* + * Validate the CRC. We would normally call crc32_no_comp(), but that + * function isn't available unless you turn on JFFS support. + */ + crc = be32_to_cpu(*(u32 *)((void *)firmware + calc_size)); + if (crc != (crc32(-1, (const void *) firmware, calc_size) ^ -1)) { + printf("Firmware CRC is invalid\n"); + return -EIO; + } + + /* + * If the microcode calls for it, split the I-RAM. + */ + if (!firmware->split) { + out_be16(&qe_immr->cp.cercr, + in_be16(&qe_immr->cp.cercr) | QE_CP_CERCR_CIR); + } + + if (firmware->soc.model) + printf("Firmware '%s' for %u V%u.%u\n", + firmware->id, be16_to_cpu(firmware->soc.model), + firmware->soc.major, firmware->soc.minor); + else + printf("Firmware '%s'\n", firmware->id); + + /* + * The QE only supports one microcode per RISC, so clear out all the + * saved microcode information and put in the new. + */ + memset(&qe_firmware_info, 0, sizeof(qe_firmware_info)); + strcpy(qe_firmware_info.id, firmware->id); + qe_firmware_info.extended_modes = firmware->extended_modes; + memcpy(qe_firmware_info.vtraps, firmware->vtraps, + sizeof(firmware->vtraps)); + qe_firmware_uploaded = 1; + + /* Loop through each microcode. */ + for (i = 0; i < firmware->count; i++) { + const struct qe_microcode *ucode = &firmware->microcode[i]; + + /* Upload a microcode if it's present */ + if (ucode->code_offset) + qe_upload_microcode(firmware, ucode); + + /* Program the traps for this processor */ + for (j = 0; j < 16; j++) { + u32 trap = be32_to_cpu(ucode->traps[j]); + + if (trap) + out_be32(&qe_immr->rsp[i].tibcr[j], trap); + } + + /* Enable traps */ + out_be32(&qe_immr->rsp[i].eccr, be32_to_cpu(ucode->eccr)); + } + + return 0; +} + +struct qe_firmware_info *qe_get_firmware_info(void) +{ + return qe_firmware_uploaded ? &qe_firmware_info : NULL; +} + +static int qe_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +{ + ulong addr; + + if (argc < 3) { + printf ("Usage:\n%s\n", cmdtp->usage); + return 1; + } + + if (strcmp(argv[1], "fw") == 0) { + addr = simple_strtoul(argv[2], NULL, 16); + + if (!addr) { + printf("Invalid address\n"); + return -EINVAL; + } + + /* + * If a length was supplied, compare that with the 'length' + * field. + */ + + if (argc > 3) { + ulong length = simple_strtoul(argv[3], NULL, 16); + struct qe_firmware *firmware = (void *) addr; + + if (length != be32_to_cpu(firmware->header.length)) { + printf("Length mismatch\n"); + return -EINVAL; + } + } + + return qe_upload_firmware((const struct qe_firmware *) addr); + } + + printf ("Usage:\n%s\n", cmdtp->usage); + return 1; +} + +U_BOOT_CMD( + qe, 4, 0, qe_cmd, + "qe - QUICC Engine commands\n", + "fw <addr> [<length>] - Upload firmware binary at address <addr> to " + "the QE,\n\twith optional length <length> verification.\n" + ); + #endif /* CONFIG_QE */ diff --git a/drivers/qe/qe.h b/drivers/qe/qe.h index 400b1a6..4c96c67 100644 --- a/drivers/qe/qe.h +++ b/drivers/qe/qe.h @@ -222,6 +222,60 @@ typedef enum qe_clock { #define QE_SDEBCR_BA_MASK 0x01FFFFFF +/* Communication Processor */ +#define QE_CP_CERCR_MEE 0x8000 /* Multi-user RAM ECC enable */ +#define QE_CP_CERCR_IEE 0x4000 /* Instruction RAM ECC enable */ +#define QE_CP_CERCR_CIR 0x0800 /* Common instruction RAM */ + +/* I-RAM */ +#define QE_IRAM_IADD_AIE 0x80000000 /* Auto Increment Enable */ +#define QE_IRAM_IADD_BADDR 0x00080000 /* Base Address */ + +/* Structure that defines QE firmware binary files. + * + * See doc/README.qe_firmware for a description of these fields. + */ +struct qe_firmware { + struct qe_header { + u32 length; /* Length of the entire structure, in bytes */ + u8 magic[3]; /* Set to { 'Q', 'E', 'F' } */ + u8 version; /* Version of this layout. First ver is '1' */ + } header; + u8 id[62]; /* Null-terminated identifier string */ + u8 split; /* 0 = shared I-RAM, 1 = split I-RAM */ + u8 count; /* Number of microcode[] structures */ + struct { + u16 model; /* The SOC model */ + u8 major; /* The SOC revision major */ + u8 minor; /* The SOC revision minor */ + } __attribute__ ((packed)) soc; + u8 padding[4]; /* Reserved, for alignment */ + u64 extended_modes; /* Extended modes */ + u32 vtraps[8]; /* Virtual trap addresses */ + u8 reserved[4]; /* Reserved, for future expansion */ + struct qe_microcode { + u8 id[32]; /* Null-terminated identifier */ + u32 traps[16]; /* Trap addresses, 0 == ignore */ + u32 eccr; /* The value for the ECCR register */ + u32 iram_offset; /* Offset into I-RAM for the code */ + u32 count; /* Number of 32-bit words of the code */ + u32 code_offset; /* Offset of the actual microcode */ + u8 major; /* The microcode version major */ + u8 minor; /* The microcode version minor */ + u8 revision; /* The microcode version revision */ + u8 padding; /* Reserved, for alignment */ + u8 reserved[4]; /* Reserved, for future expansion */ + } __attribute__ ((packed)) microcode[1]; + /* All microcode binaries should be located here */ + /* CRC32 should be located here, after the microcode binaries */ +} __attribute__ ((packed)); + +struct qe_firmware_info { + char id[64]; /* Firmware name */ + u32 vtraps[8]; /* Virtual trap addresses */ + u64 extended_modes; /* Extended modes */ +}; + void qe_config_iopin(u8 port, u8 pin, int dir, int open_drain, int assign); void qe_issue_cmd(uint cmd, uint sbc, u8 mcn, u32 cmd_data); uint qe_muram_alloc(uint size, uint align); @@ -233,5 +287,7 @@ void qe_reset(void); void qe_assign_page(uint snum, uint para_ram_base); int qe_set_brg(uint brg, uint rate); int qe_set_mii_clk_src(int ucc_num); +int qe_upload_firmware(const struct qe_firmware *firmware); +struct qe_firmware_info *qe_get_firmware_info(void); #endif /* __QE_H__ */ diff --git a/drivers/qe/uec.c b/drivers/qe/uec.c index a27c12a..44cbea5 100644 --- a/drivers/qe/uec.c +++ b/drivers/qe/uec.c @@ -1129,7 +1129,7 @@ static int uec_init(struct eth_device* dev, bd_t *bd) if (dev->enetaddr[0] & 0x01) { printf("%s: MacAddress is multcast address\n", __FUNCTION__); - return 0; + return -1; } uec_set_mac_address(uec, dev->enetaddr); uec->the_first_run = 1; @@ -1138,10 +1138,10 @@ static int uec_init(struct eth_device* dev, bd_t *bd) err = uec_open(uec, COMM_DIR_RX_AND_TX); if (err) { printf("%s: cannot enable UEC device\n", dev->name); - return 0; + return -1; } - return uec->mii_info->link; + return (uec->mii_info->link ? 0 : -1); } static void uec_halt(struct eth_device* dev) diff --git a/drivers/usb/isp116x-hcd.c b/drivers/usb/isp116x-hcd.c index b21af10..ac67030 100644 --- a/drivers/usb/isp116x-hcd.c +++ b/drivers/usb/isp116x-hcd.c @@ -20,7 +20,7 @@ * MA 02111-1307 USA * * - * Derived in part from the SL811 HCD driver "u-boot/drivers/sl811_usb.c" + * Derived in part from the SL811 HCD driver "u-boot/drivers/usb/sl811_usb.c" * (original copyright message follows): * * (C) Copyright 2004 diff --git a/drivers/usb/usbdcore_mpc8xx.c b/drivers/usb/usbdcore_mpc8xx.c index d4c4096..122793c 100644 --- a/drivers/usb/usbdcore_mpc8xx.c +++ b/drivers/usb/usbdcore_mpc8xx.c @@ -3,7 +3,8 @@ * bodonoghue@CodeHermit.ie * * References - * DasUBoot/drivers/usbdcore_omap1510.c, for design and implementation ideas. + * DasUBoot/drivers/usb/usbdcore_omap1510.c, for design and implementation + * ideas. * * 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 diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index bcf8771..82cc0c7 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -187,9 +187,9 @@ CONFIG_VIDEO_HW_CURSOR: - Uses the hardware cursor capability of the /*****************************************************************************/ /* Cursor definition: */ -/* CONFIG_CONSOLE_CURSOR: Uses a timer function (see drivers/i8042.c) to */ -/* let the cursor blink. Uses the macros CURSOR_OFF */ -/* and CURSOR_ON. */ +/* CONFIG_CONSOLE_CURSOR: Uses a timer function (see drivers/input/i8042.c) */ +/* to let the cursor blink. Uses the macros */ +/* CURSOR_OFF and CURSOR_ON. */ /* CONFIG_VIDEO_SW_CURSOR: Draws a cursor after the last character. No */ /* blinking is provided. Uses the macros CURSOR_SET */ /* and CURSOR_OFF. */ @@ -217,7 +217,7 @@ void console_cursor (int state); #define CURSOR_OFF console_cursor(0); #define CURSOR_SET #ifndef CONFIG_I8042_KBD -#warning Cursor drawing on/off needs timer function s.a. drivers/i8042.c +#warning Cursor drawing on/off needs timer function s.a. drivers/input/i8042.c #endif #else #ifdef CONFIG_CONSOLE_TIME |