Merge branch 'master' of git://git.denx.de/u-boot-fsl-qoriq
authorTom Rini <trini@konsulko.com>
Tue, 22 Mar 2016 16:14:27 +0000 (12:14 -0400)
committerTom Rini <trini@konsulko.com>
Tue, 22 Mar 2016 16:14:27 +0000 (12:14 -0400)
32 files changed:
arch/arm/dts/exynos4210-pinctrl-uboot.dtsi
arch/arm/dts/exynos4x12-pinctrl-uboot.dtsi
arch/arm/dts/exynos5250-pinctrl-uboot.dtsi
arch/arm/dts/exynos54xx-pinctrl-uboot.dtsi
arch/arm/dts/s5pc110-pinctrl.dtsi
arch/arm/dts/socfpga_cyclone5_sr1500.dts
board/gdsys/common/dp501.c
board/gdsys/common/dp501.h
board/gdsys/common/osd.c
board/gdsys/mpc8308/strider.c
cmd/gpio.c
common/fdt_support.c
common/usb.c
common/usb_hub.c
configs/sandbox_defconfig
configs/socfpga_sr1500_defconfig
drivers/block/sandbox.c
drivers/serial/ns16550.c
drivers/usb/host/usb-uclass.c
drivers/usb/host/xhci.c
include/configs/socfpga_common.h
include/configs/socfpga_sr1500.h
include/configs/strider.h
include/ns16550.h
include/usb.h
test/dm/Makefile
test/dm/blk.c [new file with mode: 0644]
tools/buildman/README
tools/buildman/cmdline.py
tools/buildman/func_test.py
tools/buildman/toolchain.py
tools/patman/gitutil.py

index 0ff41d00287d2d23702f39bdf7a411831c0ceab6..b76c77d719459fa84d2ee6e16b91308c8b1aff90 100644 (file)
@@ -9,21 +9,21 @@
 /{
        pinctrl_0: pinctrl@11400000 {
                #address-cells = <1>;
-               #size-cells = <0>;
+               #size-cells = <1>;
                compatible = "samsung,exynos4210-pinctrl";
        };
 
        pinctrl_1: pinctrl@11000000 {
                #address-cells = <1>;
-               #size-cells = <0>;
+               #size-cells = <1>;
                gpx0: gpx0 {
-                       reg = <0xc00>;
+                       reg = <0xc00 0x20>;
                };
        };
 
        pinctrl_2: pinctrl@03860000 {
                #address-cells = <1>;
-               #size-cells = <0>;
+               #size-cells = <1>;
        };
 
 };
index 8e5a6c61180a758adc33f1fccd32e8cc78de73b6..33ecc148a79ee78e1d4a0f82005be9f09f5c5787 100644 (file)
@@ -9,37 +9,37 @@
 /{
        pinctrl_0: pinctrl@11400000 {
                #address-cells = <1>;
-               #size-cells = <0>;
+               #size-cells = <1>;
                gpf0: gpf0 {
-                       reg = <0x180>;
+                       reg = <0x180 0x20>;
                };
                gpj0: gpj0 {
-                       reg = <0x240>;
+                       reg = <0x240 0x20>;
                };
        };
 
        pinctrl_1: pinctrl@11000000 {
                #address-cells = <1>;
-               #size-cells = <0>;
+               #size-cells = <1>;
                gpk0: gpk0 {
-                       reg = <0x40>;
+                       reg = <0x40 0x20>;
                };
                gpm0: gpm0 {
-                       reg = <0x260>;
+                       reg = <0x260 0x20>;
                };
                gpx0: gpx0 {
-                       reg = <0xc00>;
+                       reg = <0xc00 0x20>;
                };
        };
 
        pinctrl_2: pinctrl@03860000 {
                #address-cells = <1>;
-               #size-cells = <0>;
+               #size-cells = <1>;
        };
 
        pinctrl_3: pinctrl@106E0000 {
                #address-cells = <1>;
-               #size-cells = <0>;
+               #size-cells = <1>;
        };
 
 };
index 068c5f696fed5e1e1e09a346efacbbcfaa50a04c..b8c0526def4a82bc2a35a85511161c15ca0837d5 100644 (file)
@@ -9,34 +9,34 @@
 /{
        pinctrl_0: pinctrl@11400000 {
                #address-cells = <1>;
-               #size-cells = <0>;
+               #size-cells = <1>;
                gpc4: gpc4 {
-                       reg = <0x2e0>;
+                       reg = <0x2e0 0x20>;
                };
                gpx0: gpx0 {
-                       reg = <0xc00>;
+                       reg = <0xc00 0x20>;
                };
        };
 
        pinctrl_1: pinctrl@13400000 {
                #address-cells = <1>;
-               #size-cells = <0>;
+               #size-cells = <1>;
        };
 
        pinctrl_2: pinctrl@10d10000 {
                #address-cells = <1>;
-               #size-cells = <0>;
+               #size-cells = <1>;
                gpv2: gpv2 {
-                       reg = <0x060>;
+                       reg = <0x060 0x20>;
                };
                gpv4: gpv4 {
-                       reg = <0xc0>;
+                       reg = <0xc0 0x20>;
                };
        };
 
        pinctrl_3: pinctrl@03860000 {
                #address-cells = <1>;
-               #size-cells = <0>;
+               #size-cells = <1>;
        };
 
 };
index 635a1b0d3a50157bc94e81e01712c6dd6f1e5ffe..341194f5a760798ec07a55352014ddfe36d7167b 100644 (file)
         */
        pinctrl@14010000 {
                #address-cells = <1>;
-               #size-cells = <0>;
+               #size-cells = <1>;
        };
        pinctrl@13400000 {
                #address-cells = <1>;
-               #size-cells = <0>;
+               #size-cells = <1>;
                gpy7 {
                };
 
                gpx0 {
-                       reg = <0xc00>;
+                       reg = <0xc00 0x0>;
                };
        };
        pinctrl@13410000 {
                #address-cells = <1>;
-               #size-cells = <0>;
+               #size-cells = <1>;
        };
        pinctrl@14000000 {
                #address-cells = <1>;
-               #size-cells = <0>;
+               #size-cells = <1>;
        };
        pinctrl@03860000 {
                #address-cells = <1>;
-               #size-cells = <0>;
+               #size-cells = <1>;
        };
 
 };
index 2e9d552daaf5fe088b51e6aafc4f00d4a624e40c..07e76c098589a276e968ade68a73f1b89bf65d61 100644 (file)
@@ -9,7 +9,7 @@
 / {
        pinctrl@e0200000 {
                #address-cells = <1>;
-               #size-cells = <0>;
+               #size-cells = <1>;
                gpa0: gpa0 {
                        gpio-controller;
                        #gpio-cells = <2>;
                };
 
                gph0: gph0 {
-                       reg = <0xc00>;
+                       reg = <0xc00 0x20>;
                        gpio-controller;
                        #gpio-cells = <2>;
                };
index 3729ca02cdd2c9c5eb837b00250b07fc531b20a1..32c6aad30d91e495cef6ba53c90b38a9d0e202eb 100644 (file)
@@ -88,7 +88,7 @@
                #size-cells = <1>;
                compatible = "n25q00", "spi-flash";
                reg = <0>;      /* chip select */
-               spi-max-frequency = <50000000>;
+               spi-max-frequency = <100000000>;
                m25p,fast-read;
                page-size = <256>;
                block-size = <16>; /* 2^16, 64KB */
index d35aee0879fc793bb0b04c2b3489bf82123430f5..54e7f63f69b060e5e6a1bd0d5891007880fd9125 100644 (file)
 #include <errno.h>
 #include <i2c.h>
 
+#define DP501_I2C_ADDR 0x08
+
+#ifdef CONFIG_SYS_DP501_I2C
+int dp501_i2c[] = CONFIG_SYS_DP501_I2C;
+#endif
+
+#ifdef CONFIG_SYS_DP501_BASE
+int dp501_base[] = CONFIG_SYS_DP501_BASE;
+#endif
+
 static void dp501_setbits(u8 addr, u8 reg, u8 mask)
 {
        u8 val;
@@ -125,3 +135,24 @@ void dp501_powerdown(u8 addr)
 {
        dp501_setbits(addr, 0x0a, 0x30); /* power down encoder, standby mode */
 }
+
+
+int dp501_probe(unsigned screen, bool power)
+{
+#ifdef CONFIG_SYS_DP501_BASE
+       uint8_t dp501_addr = dp501_base[screen];
+#else
+       uint8_t dp501_addr = DP501_I2C_ADDR;
+#endif
+
+#ifdef CONFIG_SYS_DP501_I2C
+       i2c_set_bus_num(dp501_i2c[screen]);
+#endif
+
+       if (i2c_probe(dp501_addr))
+               return -1;
+
+       dp501_powerup(dp501_addr);
+
+       return 0;
+}
index 8dc3215dcf0037af3bf3460e565cbb5b06bf375b..b98b54edc52d234220fdb5a1f6a86e2340d1648f 100644 (file)
@@ -26,5 +26,6 @@
 
 void dp501_powerup(u8 addr);
 void dp501_powerdown(u8 addr);
+int dp501_probe(unsigned screen, bool power);
 
 #endif
index 7444bee129fe21db7ed4a7b74a6516bb0dbace67..4e292f56626ad4b9affd229299b08d42f6f1cc77 100644 (file)
@@ -24,8 +24,6 @@
 #define SIL1178_MASTER_I2C_ADDRESS 0x38
 #define SIL1178_SLAVE_I2C_ADDRESS 0x39
 
-#define DP501_I2C_ADDR 0x08
-
 #define PIXCLK_640_480_60 25180000
 #define MAX_X_CHARS 53
 #define MAX_Y_CHARS 26
@@ -78,14 +76,6 @@ int ics8n3qv01_i2c[] = CONFIG_SYS_ICS8N3QV01_I2C;
 int sil1178_i2c[] = CONFIG_SYS_SIL1178_I2C;
 #endif
 
-#ifdef CONFIG_SYS_DP501_I2C
-int dp501_i2c[] = CONFIG_SYS_DP501_I2C;
-#endif
-
-#ifdef CONFIG_SYS_DP501_BASE
-int dp501_base[] = CONFIG_SYS_DP501_BASE;
-#endif
-
 #ifdef CONFIG_SYS_MPC92469AC
 static void mpc92469ac_calc_parameters(unsigned int fout,
        unsigned int *post_div, unsigned int *feedback_div)
@@ -317,13 +307,6 @@ int osd_probe(unsigned screen)
        int old_bus = i2c_get_bus_num();
        bool pixclock_present = false;
        bool output_driver_present = false;
-#ifdef CONFIG_SYS_DP501_I2C
-#ifdef CONFIG_SYS_DP501_BASE
-       uint8_t dp501_addr = dp501_base[screen];
-#else
-       uint8_t dp501_addr = DP501_I2C_ADDR;
-#endif
-#endif
 
        OSD_GET_REG(0, version, &version);
        OSD_GET_REG(0, features, &features);
@@ -393,11 +376,8 @@ int osd_probe(unsigned screen)
 #endif
 
 #ifdef CONFIG_SYS_DP501_I2C
-       i2c_set_bus_num(dp501_i2c[screen]);
-       if (!i2c_probe(dp501_addr)) {
-               dp501_powerup(dp501_addr);
+       if (!dp501_probe(screen, true))
                output_driver_present = true;
-       }
 #endif
 
        if (!output_driver_present)
index ef5b6c03f8ccc21075552087aec9ee27fa383eae..eee582bb0f7434d00519b9bc34132071a9b37bc1 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "../common/adv7611.h"
 #include "../common/ch7301.h"
+#include "../common/dp501.h"
 #include "../common/ioep-fpga.h"
 #include "../common/mclink.h"
 #include "../common/osd.h"
@@ -127,7 +128,10 @@ int last_stage_init(void)
        int slaves;
        unsigned int k;
        unsigned int mux_ch;
-       unsigned char mclink_controllers[] = { 0x3c, 0x3d, 0x3e };
+       unsigned char mclink_controllers_dvi[] = { 0x3c, 0x3d, 0x3e };
+#ifdef CONFIG_STRIDER_CPU
+       unsigned char mclink_controllers_dp[] = { 0x24, 0x25, 0x26 };
+#endif
        bool hw_type_cat = pca9698_get_value(0x20, 18);
        bool ch0_sgmii2_present = false;
 
@@ -135,17 +139,25 @@ int last_stage_init(void)
        pca9698_direction_output(0x20, 8, 0);
 
        /* Turn on Parade DP501 */
-       pca9698_direction_output(0x20, 9, 1);
+       pca9698_direction_output(0x20, 10, 1);
 
        ch0_sgmii2_present = !pca9698_get_value(0x20, 37);
 
        /* wait for FPGA done, then reset FPGA */
-       for (k = 0; k < ARRAY_SIZE(mclink_controllers); ++k) {
+       for (k = 0; k < ARRAY_SIZE(mclink_controllers_dvi); ++k) {
                unsigned int ctr = 0;
+               unsigned char *mclink_controllers = mclink_controllers_dvi;
 
+#ifdef CONFIG_STRIDER_CPU
+               if (i2c_probe(mclink_controllers[k])) {
+                       mclink_controllers = mclink_controllers_dp;
+                       if (i2c_probe(mclink_controllers[k]))
+                               continue;
+               }
+#else
                if (i2c_probe(mclink_controllers[k]))
                        continue;
-
+#endif
                while (!(pca953x_get_val(mclink_controllers[k])
                       & MCFPGA_DONE)) {
                        udelay(100000);
@@ -192,6 +204,7 @@ int last_stage_init(void)
 
 #ifdef CONFIG_STRIDER_CPU
        ch7301_probe(0, false);
+       dp501_probe(0, false);
 #endif
 
        if (slaves <= 0)
@@ -199,6 +212,14 @@ int last_stage_init(void)
 
        mclink_fpgacount = slaves;
 
+#ifdef CONFIG_STRIDER_CPU
+       /* get ADV7611 out of reset, power up DP501, give some time to wakeup */
+       for (k = 1; k <= slaves; ++k)
+               FPGA_SET_REG(k, extended_control, 0x10); /* enable video */
+
+       udelay(500000);
+#endif
+
        for (k = 1; k <= slaves; ++k) {
                ioep_fpga_print_info(k);
 #ifdef CONFIG_STRIDER_CON
@@ -206,10 +227,10 @@ int last_stage_init(void)
                        osd_probe(k);
 #endif
 #ifdef CONFIG_STRIDER_CPU
-               FPGA_SET_REG(k, extended_control, 0); /* enable video in*/
                if (!adv7611_probe(k))
                        printf("       Advantiv ADV7611 HDMI Receiver\n");
                ch7301_probe(k, false);
+               dp501_probe(k, false);
 #endif
                if (hw_type_cat) {
                        miiphy_register(bb_miiphy_buses[k].name,
index 693998e8bd5d14822504aa5806c8f9ad0f7f1010..ecdc453918f48e1e9390b20f21a8010530315f97 100644 (file)
@@ -119,7 +119,7 @@ static int do_gpio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
        unsigned int gpio;
        enum gpio_cmd sub_cmd;
-       ulong value;
+       int value;
        const char *str_cmd, *str_gpio = NULL;
        int ret;
 #ifdef CONFIG_DM_GPIO
@@ -197,15 +197,35 @@ static int do_gpio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                value = gpio_get_value(gpio);
        } else {
                switch (sub_cmd) {
-                       case GPIO_SET:    value = 1; break;
-                       case GPIO_CLEAR:  value = 0; break;
-                       case GPIO_TOGGLE: value = !gpio_get_value(gpio); break;
-                       default:          goto show_usage;
+               case GPIO_SET:
+                       value = 1;
+                       break;
+               case GPIO_CLEAR:
+                       value = 0;
+                       break;
+               case GPIO_TOGGLE:
+                       value = gpio_get_value(gpio);
+                       if (!IS_ERR_VALUE(value))
+                               value = !value;
+                       break;
+               default:
+                       goto show_usage;
                }
                gpio_direction_output(gpio, value);
        }
-       printf("gpio: pin %s (gpio %i) value is %lu\n",
-               str_gpio, gpio, value);
+       printf("gpio: pin %s (gpio %i) value is ", str_gpio, gpio);
+       if (IS_ERR_VALUE(value))
+               printf("unknown (ret=%d)\n", value);
+       else
+               printf("%d\n", value);
+       if (sub_cmd != GPIO_INPUT && !IS_ERR_VALUE(value)) {
+               int nval = gpio_get_value(gpio);
+
+               if (IS_ERR_VALUE(nval))
+                       printf("   Warning: no access to GPIO output value\n");
+               else if (nval != value)
+                       printf("   Warning: value of pin is still %d\n", nval);
+       }
 
        if (ret != -EBUSY)
                gpio_free(gpio);
index 75d0858e76317e71fb1f8839e5e8f8f0b1499653..ced119e70d9f1010b5f6945d1e44e3d5c719dd44 100644 (file)
@@ -940,7 +940,8 @@ void fdt_del_node_and_alias(void *blob, const char *alias)
 /* Max address size we deal with */
 #define OF_MAX_ADDR_CELLS      4
 #define OF_BAD_ADDR    FDT_ADDR_T_NONE
-#define OF_CHECK_COUNTS(na)    ((na) > 0 && (na) <= OF_MAX_ADDR_CELLS)
+#define OF_CHECK_COUNTS(na, ns)        ((na) > 0 && (na) <= OF_MAX_ADDR_CELLS && \
+                       (ns) > 0)
 
 /* Debug utility */
 #ifdef DEBUG
@@ -1108,7 +1109,7 @@ static u64 __of_translate_address(void *blob, int node_offset, const fdt32_t *in
 
        /* Cound address cells & copy address locally */
        bus->count_cells(blob, parent, &na, &ns);
-       if (!OF_CHECK_COUNTS(na)) {
+       if (!OF_CHECK_COUNTS(na, ns)) {
                printf("%s: Bad cell count for %s\n", __FUNCTION__,
                       fdt_get_name(blob, node_offset, NULL));
                goto bail;
@@ -1135,7 +1136,7 @@ static u64 __of_translate_address(void *blob, int node_offset, const fdt32_t *in
                /* Get new parent bus and counts */
                pbus = &of_busses[0];
                pbus->count_cells(blob, parent, &pna, &pns);
-               if (!OF_CHECK_COUNTS(pna)) {
+               if (!OF_CHECK_COUNTS(pna, pns)) {
                        printf("%s: Bad cell count for %s\n", __FUNCTION__,
                                fdt_get_name(blob, node_offset, NULL));
                        break;
index c7b8b0ee5a8d7b1f0e00455e04bf6a797a9f7f8c..45a5a0f9c73039def05eaf31362e8229ce6aeb77 100644 (file)
@@ -919,19 +919,8 @@ __weak int usb_alloc_device(struct usb_device *udev)
 
 static int usb_hub_port_reset(struct usb_device *dev, struct usb_device *hub)
 {
-       if (hub) {
-               unsigned short portstatus;
-               int err;
-
-               /* reset the port for the second time */
-               err = legacy_hub_port_reset(hub, dev->portnr - 1, &portstatus);
-               if (err < 0) {
-                       printf("\n     Couldn't reset port %i\n", dev->portnr);
-                       return err;
-               }
-       } else {
+       if (!hub)
                usb_reset_root_port(dev);
-       }
 
        return 0;
 }
index e1de813adf82225ab4f7204088a698eeb782b0e4..e6a2cdb6f86de458a828f2d220263aa7d6cf6df2 100644 (file)
@@ -30,6 +30,7 @@
 #include <asm/processor.h>
 #include <asm/unaligned.h>
 #include <linux/ctype.h>
+#include <linux/list.h>
 #include <asm/byteorder.h>
 #ifdef CONFIG_SANDBOX
 #include <asm/state.h>
@@ -46,9 +47,22 @@ DECLARE_GLOBAL_DATA_PTR;
 
 #define USB_BUFSIZ     512
 
+#define HUB_SHORT_RESET_TIME   20
+#define HUB_LONG_RESET_TIME    200
+
+#define PORT_OVERCURRENT_MAX_SCAN_COUNT                3
+
+struct usb_device_scan {
+       struct usb_device *dev;         /* USB hub device to scan */
+       struct usb_hub_device *hub;     /* USB hub struct */
+       int port;                       /* USB port to scan */
+       struct list_head list;
+};
+
 /* TODO(sjg@chromium.org): Remove this when CONFIG_DM_USB is defined */
 static struct usb_hub_device hub_dev[USB_MAX_HUB];
 static int usb_hub_index;
+static LIST_HEAD(usb_scan_list);
 
 __weak void usb_hub_reset_devices(int port)
 {
@@ -106,6 +120,15 @@ static void usb_hub_power_on(struct usb_hub_device *hub)
                debug("port %d returns %lX\n", i + 1, dev->status);
        }
 
+#ifdef CONFIG_SANDBOX
+       /*
+        * Don't set timeout / delay values here. This results
+        * in these values still being reset to 0.
+        */
+       if (state_get_skip_delays())
+               return;
+#endif
+
        /*
         * Wait for power to become stable,
         * plus spec-defined max time for device to connect
@@ -117,12 +140,30 @@ static void usb_hub_power_on(struct usb_hub_device *hub)
                pgood_delay = max(pgood_delay,
                                  (unsigned)simple_strtol(env, NULL, 0));
        debug("pgood_delay=%dms\n", pgood_delay);
-       mdelay(pgood_delay + 1000);
+
+       /*
+        * Do a minimum delay of the larger value of 100ms or pgood_delay
+        * so that the power can stablize before the devices are queried
+        */
+       hub->query_delay = get_timer(0) + max(100, (int)pgood_delay);
+
+       /*
+        * Record the power-on timeout here. The max. delay (timeout)
+        * will be done based on this value in the USB port loop in
+        * usb_hub_configure() later.
+        */
+       hub->connect_timeout = hub->query_delay + 1000;
+       debug("devnum=%d poweron: query_delay=%d connect_timeout=%d\n",
+             dev->devnum, max(100, (int)pgood_delay),
+             max(100, (int)pgood_delay) + 1000);
 }
 
 void usb_hub_reset(void)
 {
        usb_hub_index = 0;
+
+       /* Zero out global hub_dev in case its re-used again */
+       memset(hub_dev, 0, sizeof(hub_dev));
 }
 
 static struct usb_hub_device *usb_hub_allocate(void)
@@ -164,6 +205,7 @@ int legacy_hub_port_reset(struct usb_device *dev, int port,
        int err, tries;
        ALLOC_CACHE_ALIGN_BUFFER(struct usb_port_status, portsts, 1);
        unsigned short portstatus, portchange;
+       int delay = HUB_SHORT_RESET_TIME; /* start with short reset delay */
 
 #ifdef CONFIG_DM_USB
        debug("%s: resetting '%s' port %d...\n", __func__, dev->dev->name,
@@ -176,7 +218,7 @@ int legacy_hub_port_reset(struct usb_device *dev, int port,
                if (err < 0)
                        return err;
 
-               mdelay(200);
+               mdelay(delay);
 
                if (usb_get_port_status(dev, port + 1, portsts) < 0) {
                        debug("get_port_status failed status %lX\n",
@@ -215,7 +257,8 @@ int legacy_hub_port_reset(struct usb_device *dev, int port,
                if (portstatus & USB_PORT_STAT_ENABLE)
                        break;
 
-               mdelay(200);
+               /* Switch to long reset delay for the next round */
+               delay = HUB_LONG_RESET_TIME;
        }
 
        if (tries == MAX_TRIES) {
@@ -270,7 +313,6 @@ int usb_hub_port_connect_change(struct usb_device *dev, int port)
                if (!(portstatus & USB_PORT_STAT_CONNECTION))
                        return -ENOTCONN;
        }
-       mdelay(200);
 
        /* Reset the port */
        ret = legacy_hub_port_reset(dev, port, &portstatus);
@@ -280,8 +322,6 @@ int usb_hub_port_connect_change(struct usb_device *dev, int port)
                return ret;
        }
 
-       mdelay(200);
-
        switch (portstatus & USB_PORT_STAT_SPEED_MASK) {
        case USB_PORT_STAT_SUPER_SPEED:
                speed = USB_SPEED_SUPER;
@@ -330,6 +370,168 @@ int usb_hub_port_connect_change(struct usb_device *dev, int port)
        return ret;
 }
 
+static int usb_scan_port(struct usb_device_scan *usb_scan)
+{
+       ALLOC_CACHE_ALIGN_BUFFER(struct usb_port_status, portsts, 1);
+       unsigned short portstatus;
+       unsigned short portchange;
+       struct usb_device *dev;
+       struct usb_hub_device *hub;
+       int ret = 0;
+       int i;
+
+       dev = usb_scan->dev;
+       hub = usb_scan->hub;
+       i = usb_scan->port;
+
+       /*
+        * Don't talk to the device before the query delay is expired.
+        * This is needed for voltages to stabalize.
+        */
+       if (get_timer(0) < hub->query_delay)
+               return 0;
+
+       ret = usb_get_port_status(dev, i + 1, portsts);
+       if (ret < 0) {
+               debug("get_port_status failed\n");
+               if (get_timer(0) >= hub->connect_timeout) {
+                       debug("devnum=%d port=%d: timeout\n",
+                             dev->devnum, i + 1);
+                       /* Remove this device from scanning list */
+                       list_del(&usb_scan->list);
+                       free(usb_scan);
+                       return 0;
+               }
+       }
+
+       portstatus = le16_to_cpu(portsts->wPortStatus);
+       portchange = le16_to_cpu(portsts->wPortChange);
+       debug("Port %d Status %X Change %X\n", i + 1, portstatus, portchange);
+
+       /* No connection change happened, wait a bit more. */
+       if (!(portchange & USB_PORT_STAT_C_CONNECTION)) {
+               if (get_timer(0) >= hub->connect_timeout) {
+                       debug("devnum=%d port=%d: timeout\n",
+                             dev->devnum, i + 1);
+                       /* Remove this device from scanning list */
+                       list_del(&usb_scan->list);
+                       free(usb_scan);
+                       return 0;
+               }
+               return 0;
+       }
+
+       /* Test if the connection came up, and if not exit */
+       if (!(portstatus & USB_PORT_STAT_CONNECTION))
+               return 0;
+
+       /* A new USB device is ready at this point */
+       debug("devnum=%d port=%d: USB dev found\n", dev->devnum, i + 1);
+
+       usb_hub_port_connect_change(dev, i);
+
+       if (portchange & USB_PORT_STAT_C_ENABLE) {
+               debug("port %d enable change, status %x\n", i + 1, portstatus);
+               usb_clear_port_feature(dev, i + 1, USB_PORT_FEAT_C_ENABLE);
+               /*
+                * The following hack causes a ghost device problem
+                * to Faraday EHCI
+                */
+#ifndef CONFIG_USB_EHCI_FARADAY
+               /*
+                * EM interference sometimes causes bad shielded USB
+                * devices to be shutdown by the hub, this hack enables
+                * them again. Works at least with mouse driver
+                */
+               if (!(portstatus & USB_PORT_STAT_ENABLE) &&
+                   (portstatus & USB_PORT_STAT_CONNECTION) &&
+                   usb_device_has_child_on_port(dev, i)) {
+                       debug("already running port %i disabled by hub (EMI?), re-enabling...\n",
+                             i + 1);
+                       usb_hub_port_connect_change(dev, i);
+               }
+#endif
+       }
+
+       if (portstatus & USB_PORT_STAT_SUSPEND) {
+               debug("port %d suspend change\n", i + 1);
+               usb_clear_port_feature(dev, i + 1, USB_PORT_FEAT_SUSPEND);
+       }
+
+       if (portchange & USB_PORT_STAT_C_OVERCURRENT) {
+               debug("port %d over-current change\n", i + 1);
+               usb_clear_port_feature(dev, i + 1,
+                                      USB_PORT_FEAT_C_OVER_CURRENT);
+               /* Only power-on this one port */
+               usb_set_port_feature(dev, i + 1, USB_PORT_FEAT_POWER);
+               hub->overcurrent_count[i]++;
+
+               /*
+                * If the max-scan-count is not reached, return without removing
+                * the device from scan-list. This will re-issue a new scan.
+                */
+               if (hub->overcurrent_count[i] <=
+                   PORT_OVERCURRENT_MAX_SCAN_COUNT)
+                       return 0;
+
+               /* Otherwise the device will get removed */
+               printf("Port %d over-current occured %d times\n", i + 1,
+                      hub->overcurrent_count[i]);
+       }
+
+       if (portchange & USB_PORT_STAT_C_RESET) {
+               debug("port %d reset change\n", i + 1);
+               usb_clear_port_feature(dev, i + 1, USB_PORT_FEAT_C_RESET);
+       }
+
+       /*
+        * We're done with this device, so let's remove this device from
+        * scanning list
+        */
+       list_del(&usb_scan->list);
+       free(usb_scan);
+
+       return 0;
+}
+
+static int usb_device_list_scan(void)
+{
+       struct usb_device_scan *usb_scan;
+       struct usb_device_scan *tmp;
+       static int running;
+       int ret = 0;
+
+       /* Only run this loop once for each controller */
+       if (running)
+               return 0;
+
+       running = 1;
+
+       while (1) {
+               /* We're done, once the list is empty again */
+               if (list_empty(&usb_scan_list))
+                       goto out;
+
+               list_for_each_entry_safe(usb_scan, tmp, &usb_scan_list, list) {
+                       int ret;
+
+                       /* Scan this port */
+                       ret = usb_scan_port(usb_scan);
+                       if (ret)
+                               goto out;
+               }
+       }
+
+out:
+       /*
+        * This USB controller has finished scanning all its connected
+        * USB devices. Set "running" back to 0, so that other USB controllers
+        * will scan their devices too.
+        */
+       running = 0;
+
+       return ret;
+}
 
 static int usb_hub_configure(struct usb_device *dev)
 {
@@ -464,104 +666,33 @@ static int usb_hub_configure(struct usb_device *dev)
        for (i = 0; i < dev->maxchild; i++)
                usb_hub_reset_devices(i + 1);
 
+       /*
+        * Only add the connected USB devices, including potential hubs,
+        * to a scanning list. This list will get scanned and devices that
+        * are detected (either via port connected or via port timeout)
+        * will get removed from this list. Scanning of the devices on this
+        * list will continue until all devices are removed.
+        */
        for (i = 0; i < dev->maxchild; i++) {
-               ALLOC_CACHE_ALIGN_BUFFER(struct usb_port_status, portsts, 1);
-               unsigned short portstatus, portchange;
-               int ret;
-               ulong start = get_timer(0);
-               uint delay = CONFIG_SYS_HZ;
-
-#ifdef CONFIG_SANDBOX
-               if (state_get_skip_delays())
-                       delay = 0;
-#endif
-#ifdef CONFIG_DM_USB
-               debug("\n\nScanning '%s' port %d\n", dev->dev->name, i + 1);
-#else
-               debug("\n\nScanning port %d\n", i + 1);
-#endif
-               /*
-                * Wait for (whichever finishes first)
-                *  - A maximum of 10 seconds
-                *    This is a purely observational value driven by connecting
-                *    a few broken pen drives and taking the max * 1.5 approach
-                *  - connection_change and connection state to report same
-                *    state
-                */
-               do {
-                       ret = usb_get_port_status(dev, i + 1, portsts);
-                       if (ret < 0) {
-                               debug("get_port_status failed\n");
-                               break;
-                       }
-
-                       portstatus = le16_to_cpu(portsts->wPortStatus);
-                       portchange = le16_to_cpu(portsts->wPortChange);
-
-                       /* No connection change happened, wait a bit more. */
-                       if (!(portchange & USB_PORT_STAT_C_CONNECTION))
-                               continue;
-
-                       /* Test if the connection came up, and if so, exit. */
-                       if (portstatus & USB_PORT_STAT_CONNECTION)
-                               break;
-
-               } while (get_timer(start) < delay);
-
-               if (ret < 0)
-                       continue;
+               struct usb_device_scan *usb_scan;
 
-               debug("Port %d Status %X Change %X\n",
-                     i + 1, portstatus, portchange);
-
-               if (portchange & USB_PORT_STAT_C_CONNECTION) {
-                       debug("port %d connection change\n", i + 1);
-                       usb_hub_port_connect_change(dev, i);
-               }
-               if (portchange & USB_PORT_STAT_C_ENABLE) {
-                       debug("port %d enable change, status %x\n",
-                             i + 1, portstatus);
-                       usb_clear_port_feature(dev, i + 1,
-                                               USB_PORT_FEAT_C_ENABLE);
-                       /*
-                        * The following hack causes a ghost device problem
-                        * to Faraday EHCI
-                        */
-#ifndef CONFIG_USB_EHCI_FARADAY
-                       /* EM interference sometimes causes bad shielded USB
-                        * devices to be shutdown by the hub, this hack enables
-                        * them again. Works at least with mouse driver */
-                       if (!(portstatus & USB_PORT_STAT_ENABLE) &&
-                            (portstatus & USB_PORT_STAT_CONNECTION) &&
-                            usb_device_has_child_on_port(dev, i)) {
-                               debug("already running port %i "  \
-                                     "disabled by hub (EMI?), " \
-                                     "re-enabling...\n", i + 1);
-                                     usb_hub_port_connect_change(dev, i);
-                       }
-#endif
-               }
-               if (portstatus & USB_PORT_STAT_SUSPEND) {
-                       debug("port %d suspend change\n", i + 1);
-                       usb_clear_port_feature(dev, i + 1,
-                                               USB_PORT_FEAT_SUSPEND);
-               }
-
-               if (portchange & USB_PORT_STAT_C_OVERCURRENT) {
-                       debug("port %d over-current change\n", i + 1);
-                       usb_clear_port_feature(dev, i + 1,
-                                               USB_PORT_FEAT_C_OVER_CURRENT);
-                       usb_hub_power_on(hub);
+               usb_scan = calloc(1, sizeof(*usb_scan));
+               if (!usb_scan) {
+                       printf("Can't allocate memory for USB device!\n");
+                       return -ENOMEM;
                }
+               usb_scan->dev = dev;
+               usb_scan->hub = hub;
+               usb_scan->port = i;
+               list_add_tail(&usb_scan->list, &usb_scan_list);
+       }
 
-               if (portchange & USB_PORT_STAT_C_RESET) {
-                       debug("port %d reset change\n", i + 1);
-                       usb_clear_port_feature(dev, i + 1,
-                                               USB_PORT_FEAT_C_RESET);
-               }
-       } /* end for i all ports */
+       /*
+        * And now call the scanning code which loops over the generated list
+        */
+       ret = usb_device_list_scan();
 
-       return 0;
+       return ret;
 }
 
 static int usb_hub_check(struct usb_device *dev, int ifnum)
index 02534bfea76119f47a7b98467711f67ac25da1ef..d69c9fc25dec591c4be722a05fbd191b030bad59 100644 (file)
@@ -28,6 +28,7 @@ CONFIG_SPL_SYSCON=y
 CONFIG_DEVRES=y
 CONFIG_ADC=y
 CONFIG_ADC_SANDBOX=y
+CONFIG_BLK=y
 CONFIG_CLK=y
 CONFIG_SANDBOX_GPIO=y
 CONFIG_SYS_I2C_SANDBOX=y
index 59a6be497ec71ed2e6a4190ac5e62e7e11aa4a11..d499a14bac704ab7f0814e12a18edb3712a4dcb8 100644 (file)
@@ -15,7 +15,9 @@ CONFIG_SPL_DM_SEQ_ALIAS=y
 CONFIG_DWAPB_GPIO=y
 CONFIG_DM_MMC=y
 CONFIG_SPI_FLASH=y
+CONFIG_SPI_FLASH_STMICRO=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_DM_ETH=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_SYS_NS16550=y
+CONFIG_CADENCE_QSPI=y
index 6d41508d5c17c15c388e5e2baae9545db35d324c..2d340efd32b520492cc2ccfd20be140d8babd9a2 100644 (file)
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#ifndef CONFIG_BLK
-static struct host_block_dev host_devices[CONFIG_HOST_MAX_DEVICES];
-
-static struct host_block_dev *find_host_device(int dev)
-{
-       if (dev >= 0 && dev < CONFIG_HOST_MAX_DEVICES)
-               return &host_devices[dev];
-
-       return NULL;
-}
-#endif
-
-#ifdef CONFIG_BLK
 static unsigned long host_block_read(struct udevice *dev,
                                     unsigned long start, lbaint_t blkcnt,
                                     void *buffer)
@@ -37,18 +24,6 @@ static unsigned long host_block_read(struct udevice *dev,
        struct host_block_dev *host_dev = dev_get_priv(dev);
        struct blk_desc *block_dev = dev_get_uclass_platdata(dev);
 
-#else
-static unsigned long host_block_read(struct blk_desc *block_dev,
-                                    unsigned long start, lbaint_t blkcnt,
-                                    void *buffer)
-{
-       int dev = block_dev->devnum;
-       struct host_block_dev *host_dev = find_host_device(dev);
-
-       if (!host_dev)
-               return -1;
-#endif
-
        if (os_lseek(host_dev->fd, start * block_dev->blksz, OS_SEEK_SET) ==
                        -1) {
                printf("ERROR: Invalid block %lx\n", start);
@@ -60,21 +35,12 @@ static unsigned long host_block_read(struct blk_desc *block_dev,
        return -1;
 }
 
-#ifdef CONFIG_BLK
 static unsigned long host_block_write(struct udevice *dev,
                                      unsigned long start, lbaint_t blkcnt,
                                      const void *buffer)
 {
        struct host_block_dev *host_dev = dev_get_priv(dev);
        struct blk_desc *block_dev = dev_get_uclass_platdata(dev);
-#else
-static unsigned long host_block_write(struct blk_desc *block_dev,
-                                     unsigned long start, lbaint_t blkcnt,
-                                     const void *buffer)
-{
-       int dev = block_dev->devnum;
-       struct host_block_dev *host_dev = find_host_device(dev);
-#endif
 
        if (os_lseek(host_dev->fd, start * block_dev->blksz, OS_SEEK_SET) ==
                        -1) {
@@ -87,7 +53,6 @@ static unsigned long host_block_write(struct blk_desc *block_dev,
        return -1;
 }
 
-#ifdef CONFIG_BLK
 int host_dev_bind(int devnum, char *filename)
 {
        struct host_block_dev *host_dev;
@@ -150,51 +115,9 @@ err:
        free(str);
        return ret;
 }
-#else
-int host_dev_bind(int dev, char *filename)
-{
-       struct host_block_dev *host_dev = find_host_device(dev);
-
-       if (!host_dev)
-               return -1;
-       if (host_dev->blk_dev.priv) {
-               os_close(host_dev->fd);
-               host_dev->blk_dev.priv = NULL;
-       }
-       if (host_dev->filename)
-               free(host_dev->filename);
-       if (filename && *filename) {
-               host_dev->filename = strdup(filename);
-       } else {
-               host_dev->filename = NULL;
-               return 0;
-       }
-
-       host_dev->fd = os_open(host_dev->filename, OS_O_RDWR);
-       if (host_dev->fd == -1) {
-               printf("Failed to access host backing file '%s'\n",
-                      host_dev->filename);
-               return 1;
-       }
-
-       struct blk_desc *blk_dev = &host_dev->blk_dev;
-       blk_dev->if_type = IF_TYPE_HOST;
-       blk_dev->priv = host_dev;
-       blk_dev->blksz = 512;
-       blk_dev->lba = os_lseek(host_dev->fd, 0, OS_SEEK_END) / blk_dev->blksz;
-       blk_dev->block_read = host_block_read;
-       blk_dev->block_write = host_block_write;
-       blk_dev->devnum = dev;
-       blk_dev->part_type = PART_TYPE_UNKNOWN;
-       part_init(blk_dev);
-
-       return 0;
-}
-#endif
 
 int host_get_dev_err(int devnum, struct blk_desc **blk_devp)
 {
-#ifdef CONFIG_BLK
        struct udevice *dev;
        int ret;
 
@@ -202,17 +125,6 @@ int host_get_dev_err(int devnum, struct blk_desc **blk_devp)
        if (ret)
                return ret;
        *blk_devp = dev_get_uclass_platdata(dev);
-#else
-       struct host_block_dev *host_dev = find_host_device(devnum);
-
-       if (!host_dev)
-               return -ENODEV;
-
-       if (!host_dev->blk_dev.priv)
-               return -ENOENT;
-
-       *blk_devp = &host_dev->blk_dev;
-#endif
 
        return 0;
 }
@@ -227,7 +139,6 @@ struct blk_desc *host_get_dev(int dev)
        return blk_dev;
 }
 
-#ifdef CONFIG_BLK
 static const struct blk_ops sandbox_host_blk_ops = {
        .read   = host_block_read,
        .write  = host_block_write,
@@ -239,4 +150,3 @@ U_BOOT_DRIVER(sandbox_host_blk) = {
        .ops            = &sandbox_host_blk_ops,
        .priv_auto_alloc_size   = sizeof(struct host_block_dev),
 };
-#endif
index 93dad338b37597aeea3303c9b395ba1f333a6207..28da9ddfd8592ecff03c98a89a8ec6d6d1dd91a0 100644 (file)
@@ -105,7 +105,7 @@ static void ns16550_writeb(NS16550_t port, int offset, int value)
         * As far as we know it doesn't make sense to support selection of
         * these options at run-time, so use the existing CONFIG options.
         */
-       serial_out_shift(addr, plat->reg_shift, value);
+       serial_out_shift(addr + plat->reg_offset, plat->reg_shift, value);
 }
 
 static int ns16550_readb(NS16550_t port, int offset)
@@ -116,7 +116,7 @@ static int ns16550_readb(NS16550_t port, int offset)
        offset *= 1 << plat->reg_shift;
        addr = map_physmem(plat->base, 0, MAP_NOCACHE) + offset;
 
-       return serial_in_shift(addr, plat->reg_shift);
+       return serial_in_shift(addr + plat->reg_offset, plat->reg_shift);
 }
 
 /* We can clean these up once everything is moved to driver model */
@@ -401,6 +401,8 @@ int ns16550_serial_ofdata_to_platdata(struct udevice *dev)
                return -EINVAL;
 
        plat->base = addr;
+       plat->reg_offset = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+                                    "reg-offset", 0);
        plat->reg_shift = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
                                         "reg-shift", 0);
        plat->clock = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
index 50538e0bd760461342812df0a162d262e541e0a4..69c9a504ebb8ad8489523868b8991d871115c3d4 100644 (file)
@@ -159,7 +159,11 @@ int usb_stop(void)
                if (ret && !err)
                        err = ret;
        }
-
+#ifdef CONFIG_BLK
+       ret = blk_unbind_all(IF_TYPE_USB);
+       if (ret && !err)
+               err = ret;
+#endif
 #ifdef CONFIG_SANDBOX
        struct udevice *dev;
 
index ca598aa5e605a6a05f8e072e22987364bb0aadd5..cb8a04b793e692fbf4a8e5edf986ff498bf95ae9 100644 (file)
@@ -941,10 +941,12 @@ static int _xhci_submit_control_msg(struct usb_device *udev, unsigned long pipe,
        if (usb_pipedevice(pipe) == ctrl->rootdev)
                return xhci_submit_root(udev, pipe, buffer, setup);
 
-       if (setup->request == USB_REQ_SET_ADDRESS)
+       if (setup->request == USB_REQ_SET_ADDRESS &&
+          (setup->requesttype & USB_TYPE_MASK) == USB_TYPE_STANDARD)
                return xhci_address_device(udev, root_portnr);
 
-       if (setup->request == USB_REQ_SET_CONFIGURATION) {
+       if (setup->request == USB_REQ_SET_CONFIGURATION &&
+          (setup->requesttype & USB_TYPE_MASK) == USB_TYPE_STANDARD) {
                ret = xhci_set_configuration(udev);
                if (ret) {
                        puts("Failed to configure xHCI endpoint\n");
index cd48c9e1caf5da04b39d04165d05da561af77a33..56d32e6b53255c7fcf34057fb5a374df4c2436b2 100644 (file)
@@ -284,7 +284,9 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
 #define CONFIG_SYS_CONSOLE_IS_IN_ENV
 #define CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
 #define CONFIG_SYS_CONSOLE_ENV_OVERWRITE
+#if !defined(CONFIG_ENV_SIZE)
 #define CONFIG_ENV_SIZE                        4096
+#endif
 
 /* Environment for SDMMC boot */
 #if defined(CONFIG_ENV_IS_IN_MMC) && !defined(CONFIG_ENV_OFFSET)
@@ -292,6 +294,12 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
 #define CONFIG_ENV_OFFSET              512     /* just after the MBR */
 #endif
 
+/* Environment for QSPI boot */
+#if defined(CONFIG_ENV_IS_IN_SPI_FLASH) && !defined(CONFIG_ENV_OFFSET)
+#define CONFIG_ENV_OFFSET              0x00100000
+#define CONFIG_ENV_SECT_SIZE           (64 * 1024)
+#endif
+
 /*
  * mtd partitioning for serial NOR flash
  *
index fdf67ca09896867ccc46f80a5096c5cf7c73b7c7..6414eeb91475e3449306bb932a81bba4f3143897 100644 (file)
 #define CONFIG_SYS_BOOTCOUNT_ADDR      0xfffffff8
 #define CONFIG_SYS_BOOTCOUNT_BE
 
-/* The rest of the configuration is shared */
-#include <configs/socfpga_common.h>
-
-/* U-Boot payload is stored at offset 0x60000 */
-#undef CONFIG_SYS_SPI_U_BOOT_OFFS
-#define CONFIG_SYS_SPI_U_BOOT_OFFS     0x60000
-
 /* Environment setting for SPI flash */
-#undef CONFIG_ENV_SIZE
 #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
 #define CONFIG_ENV_SECT_SIZE   (64 * 1024)
 #define CONFIG_ENV_SIZE                (16 * 1024)
-#define CONFIG_ENV_OFFSET      0x00040000
+#define CONFIG_ENV_OFFSET      0x000e0000
 #define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + CONFIG_ENV_SECT_SIZE)
 #define CONFIG_ENV_SPI_BUS     0
 #define CONFIG_ENV_SPI_CS      0
 #define CONFIG_ENV_SPI_MODE    SPI_MODE_3
-#define CONFIG_ENV_SPI_MAX_HZ  CONFIG_SF_DEFAULT_SPEED
+#define CONFIG_ENV_SPI_MAX_HZ  100000000       /* Use max of 100MHz */
+#define CONFIG_SF_DEFAULT_SPEED        100000000
+
+/*
+ * The QSPI NOR flash layout on SR1500:
+ *
+ * 0000.0000 - 0003.ffff: SPL (4 times)
+ * 0004.0000 - 000d.ffff: U-Boot
+ * 000e.0000 - 000e.ffff: env1
+ * 000f.0000 - 000f.ffff: env2
+ */
+
+/* The rest of the configuration is shared */
+#include <configs/socfpga_common.h>
 
 #endif /* __CONFIG_SOCFPGA_SR1500_H__ */
index 034240016b47fb28744a3768204369a33f35c065..d5f1981c0d28a58a7f0935a4d058d1c8ba02d83d 100644 (file)
                                | BR_PS_16      /* 16 bit port */ \
                                | BR_MS_GPCM    /* MSEL = GPCM */ \
                                | BR_V)         /* valid */
-#define CONFIG_SYS_OR1_PRELIM  (MEG_TO_AM(CONFIG_SYS_FPGA0_SIZE) \
+
+#define CONFIG_SYS_OR1_PRELIM   (MEG_TO_AM(CONFIG_SYS_FPGA0_SIZE) \
                                | OR_UPM_XAM \
                                | OR_GPCM_CSNT \
-                               | OR_GPCM_ACS_DIV2 \
-                               | OR_GPCM_XACS \
-                               | OR_GPCM_SCY_15 \
-                               | OR_GPCM_TRLX_SET \
-                               | OR_GPCM_EHTR_SET)
+                               | OR_GPCM_SCY_5 \
+                               | OR_GPCM_TRLX_CLEAR \
+                               | OR_GPCM_EHTR_CLEAR)
 
 #define CONFIG_SYS_FPGA_BASE(k)                CONFIG_SYS_FPGA0_BASE
 #define CONFIG_SYS_FPGA_DONE(k)                0x0010
 #define CONFIG_SYS_FSL_I2C_OFFSET      0x3000
 
 #define CONFIG_PCA953X                 /* NXP PCA9554 */
+#define CONFIG_CMD_PCA953X
+#define CONFIG_CMD_PCA953X_INFO
+#define CONFIG_SYS_I2C_PCA953X_WIDTH    { {0x24, 16}, {0x25, 16}, {0x26, 16}, \
+                                         {0x3c, 8}, {0x3d, 8}, {0x3e, 8} }
+
 #define CONFIG_PCA9698                 /* NXP PCA9698 */
 
 #define CONFIG_SYS_I2C_IHS
index 4e620676c453c6a4e0df04332befc0a1b34da592..1311f4cb919e3dff6917a593fb390671613f5795 100644 (file)
@@ -56,6 +56,7 @@ struct ns16550_platdata {
        unsigned long base;
        int reg_shift;
        int clock;
+       int reg_offset;
 };
 
 struct udevice;
index c2fa6849f10dddaf9d50a4542f66df41ee8fcd65..19411258ec8dd17f395afa443cec2b54ad184eb4 100644 (file)
@@ -556,6 +556,10 @@ struct usb_hub_descriptor {
 struct usb_hub_device {
        struct usb_device *pusb_dev;
        struct usb_hub_descriptor desc;
+
+       ulong connect_timeout;          /* Device connection timeout in ms */
+       ulong query_delay;              /* Device query delay in ms */
+       int overcurrent_count[USB_MAXCHILDREN]; /* Over-current counter */
 };
 
 #ifdef CONFIG_DM_USB
index fd0198f1bacd2f1fec31e927ea8f567a596881bf..df2d71fdadd1c98b08571effd208c9dd19b94d19 100644 (file)
@@ -15,6 +15,7 @@ obj-$(CONFIG_UT_DM) += test-uclass.o
 # subsystem you must add sandbox tests here.
 obj-$(CONFIG_UT_DM) += core.o
 ifneq ($(CONFIG_SANDBOX),)
+obj-$(CONFIG_BLK) += blk.o
 obj-$(CONFIG_CLK) += clk.o
 obj-$(CONFIG_DM_ETH) += eth.o
 obj-$(CONFIG_DM_GPIO) += gpio.o
diff --git a/test/dm/blk.c b/test/dm/blk.c
new file mode 100644 (file)
index 0000000..f4ea32e
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2015 Google, Inc
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <usb.h>
+#include <asm/state.h>
+#include <dm/test.h>
+#include <test/ut.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* Test that block devices can be created */
+static int dm_test_blk_base(struct unit_test_state *uts)
+{
+       struct udevice *blk, *usb_blk, *dev;
+
+       /* Make sure there are no block devices */
+       ut_asserteq(-ENODEV, uclass_get_device_by_seq(UCLASS_BLK, 0, &blk));
+
+       /* Create two, one the parent of the other */
+       ut_assertok(blk_create_device(gd->dm_root, "sandbox_host_blk", "test",
+                                     IF_TYPE_HOST, 1, 512, 1024, &blk));
+       ut_assertok(blk_create_device(blk, "usb_storage_blk", "test",
+                                     IF_TYPE_USB, 3, 512, 1024, &usb_blk));
+
+       /* Check we can find them */
+       ut_asserteq(-ENODEV, blk_get_device(IF_TYPE_HOST, 0, &dev));
+       ut_assertok(blk_get_device(IF_TYPE_HOST, 1, &dev));
+       ut_asserteq_ptr(blk, dev);
+
+       ut_asserteq(-ENODEV, blk_get_device(IF_TYPE_USB, 0, &dev));
+       ut_assertok(blk_get_device(IF_TYPE_USB, 3, &dev));
+       ut_asserteq_ptr(usb_blk, dev);
+
+       /* Check we can iterate */
+       ut_assertok(blk_first_device(IF_TYPE_HOST, &dev));
+       ut_asserteq_ptr(blk, dev);
+       ut_asserteq(-ENODEV, blk_next_device(&dev));
+
+       ut_assertok(blk_first_device(IF_TYPE_USB, &dev));
+       ut_asserteq_ptr(usb_blk, dev);
+       ut_asserteq(-ENODEV, blk_next_device(&dev));
+
+       return 0;
+}
+DM_TEST(dm_test_blk_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+
+static int count_blk_devices(void)
+{
+       struct udevice *blk;
+       struct uclass *uc;
+       int count = 0;
+       int ret;
+
+       ret = uclass_get(UCLASS_BLK, &uc);
+       if (ret)
+               return ret;
+
+       uclass_foreach_dev(blk, uc)
+               count++;
+
+       return count;
+}
+
+/* Test that block devices work correctly with USB */
+static int dm_test_blk_usb(struct unit_test_state *uts)
+{
+       struct udevice *usb_dev, *dev;
+       struct blk_desc *dev_desc;
+
+       /* Get a flash device */
+       state_set_skip_delays(true);
+       ut_assertok(usb_init());
+       ut_assertok(uclass_get_device(UCLASS_MASS_STORAGE, 0, &usb_dev));
+       ut_assertok(blk_get_device_by_str("usb", "0", &dev_desc));
+
+       /* The parent should be a block device */
+       ut_assertok(blk_get_device(IF_TYPE_USB, 0, &dev));
+       ut_asserteq_ptr(usb_dev, dev_get_parent(dev));
+
+       /* Check we have one block device for each mass storage device */
+       ut_asserteq(3, count_blk_devices());
+
+       /* Now go around again, making sure the old devices were unbound */
+       ut_assertok(usb_stop());
+       ut_assertok(usb_init());
+       ut_asserteq(3, count_blk_devices());
+       ut_assertok(usb_stop());
+
+       return 0;
+}
+DM_TEST(dm_test_blk_usb, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
index 6f41008912ce81c8cded96c7414ec6d0c77d783f..4705d2644b8f075da0a83802bbb42a908fde8e0b 100644 (file)
@@ -169,6 +169,28 @@ Make sure the tags (here root: rest: and eldk:) are unique.
 The toolchain-alias section indicates that the i386 toolchain should be used
 to build x86 commits.
 
+Note that you can also specific exactly toolchain prefixes if you like:
+
+[toolchain-prefix]
+arm: /opt/arm-eabi-4.6/bin/arm-eabi-
+
+or even:
+
+[toolchain-prefix]
+arm: /opt/arm-eabi-4.6/bin/arm-eabi-gcc
+
+This tells buildman that you want to use this exact toolchain for the arm
+architecture. This will override any toolchains found by searching using the
+[toolchain] settings.
+
+Since the toolchain prefix is an explicit request, buildman will report an
+error if a toolchain is not found with that prefix. The current PATH will be
+searched, so it is possible to use:
+
+[toolchain-prefix]
+arm: arm-none-eabi-
+
+and buildman will find arm-none-eabi-gcc in /usr/bin if you have it installed.
 
 3. Make sure you have the require Python pre-requisites
 
@@ -185,124 +207,180 @@ Run this check to make sure that you have a toolchain for every architecture.
 
 $ ./tools/buildman/buildman --list-tool-chains
 Scanning for tool chains
+   - scanning prefix '/opt/gcc-4.6.3-nolibc/x86_64-linux/bin/x86_64-linux-'
+Tool chain test:  OK, arch='x86', priority 1
+   - scanning prefix '/opt/arm-eabi-4.6/bin/arm-eabi-'
+Tool chain test:  OK, arch='arm', priority 1
+   - scanning path '/toolchains/gcc-4.9.0-nolibc/i386-linux'
+      - looking in '/toolchains/gcc-4.9.0-nolibc/i386-linux/.'
+      - looking in '/toolchains/gcc-4.9.0-nolibc/i386-linux/bin'
+         - found '/toolchains/gcc-4.9.0-nolibc/i386-linux/bin/i386-linux-gcc'
+      - looking in '/toolchains/gcc-4.9.0-nolibc/i386-linux/usr/bin'
+Tool chain test:  OK, arch='i386', priority 4
+   - scanning path '/toolchains/gcc-4.9.0-nolibc/aarch64-linux'
+      - looking in '/toolchains/gcc-4.9.0-nolibc/aarch64-linux/.'
+      - looking in '/toolchains/gcc-4.9.0-nolibc/aarch64-linux/bin'
+         - found '/toolchains/gcc-4.9.0-nolibc/aarch64-linux/bin/aarch64-linux-gcc'
+      - looking in '/toolchains/gcc-4.9.0-nolibc/aarch64-linux/usr/bin'
+Tool chain test:  OK, arch='aarch64', priority 4
+   - scanning path '/toolchains/gcc-4.9.0-nolibc/microblaze-linux'
+      - looking in '/toolchains/gcc-4.9.0-nolibc/microblaze-linux/.'
+      - looking in '/toolchains/gcc-4.9.0-nolibc/microblaze-linux/bin'
+         - found '/toolchains/gcc-4.9.0-nolibc/microblaze-linux/bin/microblaze-linux-gcc'
+      - looking in '/toolchains/gcc-4.9.0-nolibc/microblaze-linux/usr/bin'
+Tool chain test:  OK, arch='microblaze', priority 4
+   - scanning path '/toolchains/gcc-4.9.0-nolibc/mips64-linux'
+      - looking in '/toolchains/gcc-4.9.0-nolibc/mips64-linux/.'
+      - looking in '/toolchains/gcc-4.9.0-nolibc/mips64-linux/bin'
+         - found '/toolchains/gcc-4.9.0-nolibc/mips64-linux/bin/mips64-linux-gcc'
+      - looking in '/toolchains/gcc-4.9.0-nolibc/mips64-linux/usr/bin'
+Tool chain test:  OK, arch='mips64', priority 4
+   - scanning path '/toolchains/gcc-4.9.0-nolibc/sparc64-linux'
+      - looking in '/toolchains/gcc-4.9.0-nolibc/sparc64-linux/.'
+      - looking in '/toolchains/gcc-4.9.0-nolibc/sparc64-linux/bin'
+         - found '/toolchains/gcc-4.9.0-nolibc/sparc64-linux/bin/sparc64-linux-gcc'
+      - looking in '/toolchains/gcc-4.9.0-nolibc/sparc64-linux/usr/bin'
+Tool chain test:  OK, arch='sparc64', priority 4
+   - scanning path '/toolchains/gcc-4.9.0-nolibc/arm-unknown-linux-gnueabi'
+      - looking in '/toolchains/gcc-4.9.0-nolibc/arm-unknown-linux-gnueabi/.'
+      - looking in '/toolchains/gcc-4.9.0-nolibc/arm-unknown-linux-gnueabi/bin'
+         - found '/toolchains/gcc-4.9.0-nolibc/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-gcc'
+      - looking in '/toolchains/gcc-4.9.0-nolibc/arm-unknown-linux-gnueabi/usr/bin'
+Tool chain test:  OK, arch='arm', priority 3
+Toolchain '/toolchains/gcc-4.9.0-nolibc/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-gcc' at priority 3 will be ignored because another toolchain for arch 'arm' has priority 1
+   - scanning path '/toolchains/gcc-4.9.0-nolibc/sparc-linux'
+      - looking in '/toolchains/gcc-4.9.0-nolibc/sparc-linux/.'
+      - looking in '/toolchains/gcc-4.9.0-nolibc/sparc-linux/bin'
+         - found '/toolchains/gcc-4.9.0-nolibc/sparc-linux/bin/sparc-linux-gcc'
+      - looking in '/toolchains/gcc-4.9.0-nolibc/sparc-linux/usr/bin'
+Tool chain test:  OK, arch='sparc', priority 4
+   - scanning path '/toolchains/gcc-4.9.0-nolibc/mips-linux'
+      - looking in '/toolchains/gcc-4.9.0-nolibc/mips-linux/.'
+      - looking in '/toolchains/gcc-4.9.0-nolibc/mips-linux/bin'
+         - found '/toolchains/gcc-4.9.0-nolibc/mips-linux/bin/mips-linux-gcc'
+      - looking in '/toolchains/gcc-4.9.0-nolibc/mips-linux/usr/bin'
+Tool chain test:  OK, arch='mips', priority 4
+   - scanning path '/toolchains/gcc-4.9.0-nolibc/x86_64-linux'
+      - looking in '/toolchains/gcc-4.9.0-nolibc/x86_64-linux/.'
+      - looking in '/toolchains/gcc-4.9.0-nolibc/x86_64-linux/bin'
+         - found '/toolchains/gcc-4.9.0-nolibc/x86_64-linux/bin/x86_64-linux-gcc'
+         - found '/toolchains/gcc-4.9.0-nolibc/x86_64-linux/bin/x86_64-linux-x86_64-linux-gcc'
+      - looking in '/toolchains/gcc-4.9.0-nolibc/x86_64-linux/usr/bin'
+Tool chain test:  OK, arch='x86_64', priority 4
+Tool chain test:  OK, arch='x86_64', priority 4
+Toolchain '/toolchains/gcc-4.9.0-nolibc/x86_64-linux/bin/x86_64-linux-x86_64-linux-gcc' at priority 4 will be ignored because another toolchain for arch 'x86_64' has priority 4
+   - scanning path '/toolchains/gcc-4.9.0-nolibc/m68k-linux'
+      - looking in '/toolchains/gcc-4.9.0-nolibc/m68k-linux/.'
+      - looking in '/toolchains/gcc-4.9.0-nolibc/m68k-linux/bin'
+         - found '/toolchains/gcc-4.9.0-nolibc/m68k-linux/bin/m68k-linux-gcc'
+      - looking in '/toolchains/gcc-4.9.0-nolibc/m68k-linux/usr/bin'
+Tool chain test:  OK, arch='m68k', priority 4
+   - scanning path '/toolchains/gcc-4.9.0-nolibc/powerpc-linux'
+      - looking in '/toolchains/gcc-4.9.0-nolibc/powerpc-linux/.'
+      - looking in '/toolchains/gcc-4.9.0-nolibc/powerpc-linux/bin'
+         - found '/toolchains/gcc-4.9.0-nolibc/powerpc-linux/bin/powerpc-linux-gcc'
+      - looking in '/toolchains/gcc-4.9.0-nolibc/powerpc-linux/usr/bin'
+Tool chain test:  OK, arch='powerpc', priority 4
+   - scanning path '/toolchains/gcc-4.6.3-nolibc/bfin-uclinux'
+      - looking in '/toolchains/gcc-4.6.3-nolibc/bfin-uclinux/.'
+      - looking in '/toolchains/gcc-4.6.3-nolibc/bfin-uclinux/bin'
+         - found '/toolchains/gcc-4.6.3-nolibc/bfin-uclinux/bin/bfin-uclinux-gcc'
+      - looking in '/toolchains/gcc-4.6.3-nolibc/bfin-uclinux/usr/bin'
+Tool chain test:  OK, arch='bfin', priority 6
+   - scanning path '/toolchains/gcc-4.6.3-nolibc/sparc-linux'
+      - looking in '/toolchains/gcc-4.6.3-nolibc/sparc-linux/.'
+      - looking in '/toolchains/gcc-4.6.3-nolibc/sparc-linux/bin'
+         - found '/toolchains/gcc-4.6.3-nolibc/sparc-linux/bin/sparc-linux-gcc'
+      - looking in '/toolchains/gcc-4.6.3-nolibc/sparc-linux/usr/bin'
+Tool chain test:  OK, arch='sparc', priority 4
+Toolchain '/toolchains/gcc-4.6.3-nolibc/sparc-linux/bin/sparc-linux-gcc' at priority 4 will be ignored because another toolchain for arch 'sparc' has priority 4
+   - scanning path '/toolchains/gcc-4.6.3-nolibc/mips-linux'
+      - looking in '/toolchains/gcc-4.6.3-nolibc/mips-linux/.'
+      - looking in '/toolchains/gcc-4.6.3-nolibc/mips-linux/bin'
+         - found '/toolchains/gcc-4.6.3-nolibc/mips-linux/bin/mips-linux-gcc'
+      - looking in '/toolchains/gcc-4.6.3-nolibc/mips-linux/usr/bin'
+Tool chain test:  OK, arch='mips', priority 4
+Toolchain '/toolchains/gcc-4.6.3-nolibc/mips-linux/bin/mips-linux-gcc' at priority 4 will be ignored because another toolchain for arch 'mips' has priority 4
+   - scanning path '/toolchains/gcc-4.6.3-nolibc/m68k-linux'
+      - looking in '/toolchains/gcc-4.6.3-nolibc/m68k-linux/.'
+      - looking in '/toolchains/gcc-4.6.3-nolibc/m68k-linux/bin'
+         - found '/toolchains/gcc-4.6.3-nolibc/m68k-linux/bin/m68k-linux-gcc'
+      - looking in '/toolchains/gcc-4.6.3-nolibc/m68k-linux/usr/bin'
+Tool chain test:  OK, arch='m68k', priority 4
+Toolchain '/toolchains/gcc-4.6.3-nolibc/m68k-linux/bin/m68k-linux-gcc' at priority 4 will be ignored because another toolchain for arch 'm68k' has priority 4
+   - scanning path '/toolchains/gcc-4.6.3-nolibc/powerpc-linux'
+      - looking in '/toolchains/gcc-4.6.3-nolibc/powerpc-linux/.'
+      - looking in '/toolchains/gcc-4.6.3-nolibc/powerpc-linux/bin'
+         - found '/toolchains/gcc-4.6.3-nolibc/powerpc-linux/bin/powerpc-linux-gcc'
+      - looking in '/toolchains/gcc-4.6.3-nolibc/powerpc-linux/usr/bin'
+Tool chain test:  OK, arch='powerpc', priority 4
+Tool chain test:  OK, arch='or32', priority 4
+   - scanning path '/toolchains/gcc-4.2.4-nolibc/avr32-linux'
+      - looking in '/toolchains/gcc-4.2.4-nolibc/avr32-linux/.'
+      - looking in '/toolchains/gcc-4.2.4-nolibc/avr32-linux/bin'
+         - found '/toolchains/gcc-4.2.4-nolibc/avr32-linux/bin/avr32-linux-gcc'
+      - looking in '/toolchains/gcc-4.2.4-nolibc/avr32-linux/usr/bin'
+Tool chain test:  OK, arch='avr32', priority 4
    - scanning path '/'
       - looking in '/.'
       - looking in '/bin'
       - looking in '/usr/bin'
-         - found '/usr/bin/gcc'
-Tool chain test:  OK
+         - found '/usr/bin/i586-mingw32msvc-gcc'
          - found '/usr/bin/c89-gcc'
-Tool chain test:  OK
-         - found '/usr/bin/c99-gcc'
-Tool chain test:  OK
          - found '/usr/bin/x86_64-linux-gnu-gcc'
-Tool chain test:  OK
-   - scanning path '/toolchains/powerpc-linux'
-      - looking in '/toolchains/powerpc-linux/.'
-      - looking in '/toolchains/powerpc-linux/bin'
-         - found '/toolchains/powerpc-linux/bin/powerpc-linux-gcc'
-Tool chain test:  OK
-      - looking in '/toolchains/powerpc-linux/usr/bin'
-   - scanning path '/toolchains/nds32le-linux-glibc-v1f'
-      - looking in '/toolchains/nds32le-linux-glibc-v1f/.'
-      - looking in '/toolchains/nds32le-linux-glibc-v1f/bin'
-         - found '/toolchains/nds32le-linux-glibc-v1f/bin/nds32le-linux-gcc'
-Tool chain test:  OK
-      - looking in '/toolchains/nds32le-linux-glibc-v1f/usr/bin'
-   - scanning path '/toolchains/nios2'
-      - looking in '/toolchains/nios2/.'
-      - looking in '/toolchains/nios2/bin'
-         - found '/toolchains/nios2/bin/nios2-linux-gcc'
-Tool chain test:  OK
-         - found '/toolchains/nios2/bin/nios2-linux-uclibc-gcc'
-Tool chain test:  OK
-      - looking in '/toolchains/nios2/usr/bin'
-         - found '/toolchains/nios2/usr/bin/nios2-linux-gcc'
-Tool chain test:  OK
-         - found '/toolchains/nios2/usr/bin/nios2-linux-uclibc-gcc'
-Tool chain test:  OK
-   - scanning path '/toolchains/microblaze-unknown-linux-gnu'
-      - looking in '/toolchains/microblaze-unknown-linux-gnu/.'
-      - looking in '/toolchains/microblaze-unknown-linux-gnu/bin'
-         - found '/toolchains/microblaze-unknown-linux-gnu/bin/microblaze-unknown-linux-gnu-gcc'
-Tool chain test:  OK
-         - found '/toolchains/microblaze-unknown-linux-gnu/bin/mb-linux-gcc'
-Tool chain test:  OK
-      - looking in '/toolchains/microblaze-unknown-linux-gnu/usr/bin'
-   - scanning path '/toolchains/mips-linux'
-      - looking in '/toolchains/mips-linux/.'
-      - looking in '/toolchains/mips-linux/bin'
-         - found '/toolchains/mips-linux/bin/mips-linux-gcc'
-Tool chain test:  OK
-      - looking in '/toolchains/mips-linux/usr/bin'
-   - scanning path '/toolchains/old'
-      - looking in '/toolchains/old/.'
-      - looking in '/toolchains/old/bin'
-      - looking in '/toolchains/old/usr/bin'
-   - scanning path '/toolchains/i386-linux'
-      - looking in '/toolchains/i386-linux/.'
-      - looking in '/toolchains/i386-linux/bin'
-         - found '/toolchains/i386-linux/bin/i386-linux-gcc'
-Tool chain test:  OK
-      - looking in '/toolchains/i386-linux/usr/bin'
-   - scanning path '/toolchains/bfin-uclinux'
-      - looking in '/toolchains/bfin-uclinux/.'
-      - looking in '/toolchains/bfin-uclinux/bin'
-         - found '/toolchains/bfin-uclinux/bin/bfin-uclinux-gcc'
-Tool chain test:  OK
-      - looking in '/toolchains/bfin-uclinux/usr/bin'
-   - scanning path '/toolchains/sparc-elf'
-      - looking in '/toolchains/sparc-elf/.'
-      - looking in '/toolchains/sparc-elf/bin'
-         - found '/toolchains/sparc-elf/bin/sparc-elf-gcc'
-Tool chain test:  OK
-      - looking in '/toolchains/sparc-elf/usr/bin'
-   - scanning path '/toolchains/arm-2010q1'
-      - looking in '/toolchains/arm-2010q1/.'
-      - looking in '/toolchains/arm-2010q1/bin'
-         - found '/toolchains/arm-2010q1/bin/arm-none-linux-gnueabi-gcc'
-Tool chain test:  OK
-      - looking in '/toolchains/arm-2010q1/usr/bin'
-   - scanning path '/toolchains/from'
-      - looking in '/toolchains/from/.'
-      - looking in '/toolchains/from/bin'
-      - looking in '/toolchains/from/usr/bin'
-   - scanning path '/toolchains/sh4-gentoo-linux-gnu'
-      - looking in '/toolchains/sh4-gentoo-linux-gnu/.'
-      - looking in '/toolchains/sh4-gentoo-linux-gnu/bin'
-         - found '/toolchains/sh4-gentoo-linux-gnu/bin/sh4-gentoo-linux-gnu-gcc'
-Tool chain test:  OK
-      - looking in '/toolchains/sh4-gentoo-linux-gnu/usr/bin'
-   - scanning path '/toolchains/avr32-linux'
-      - looking in '/toolchains/avr32-linux/.'
-      - looking in '/toolchains/avr32-linux/bin'
-         - found '/toolchains/avr32-linux/bin/avr32-gcc'
-Tool chain test:  OK
-      - looking in '/toolchains/avr32-linux/usr/bin'
-   - scanning path '/toolchains/m68k-linux'
-      - looking in '/toolchains/m68k-linux/.'
-      - looking in '/toolchains/m68k-linux/bin'
-         - found '/toolchains/m68k-linux/bin/m68k-linux-gcc'
-Tool chain test:  OK
-      - looking in '/toolchains/m68k-linux/usr/bin'
-List of available toolchains (17):
-arm       : /toolchains/arm-2010q1/bin/arm-none-linux-gnueabi-gcc
-avr32     : /toolchains/avr32-linux/bin/avr32-gcc
-bfin      : /toolchains/bfin-uclinux/bin/bfin-uclinux-gcc
+         - found '/usr/bin/gcc'
+         - found '/usr/bin/c99-gcc'
+         - found '/usr/bin/arm-linux-gnueabi-gcc'
+         - found '/usr/bin/aarch64-linux-gnu-gcc'
+         - found '/usr/bin/winegcc'
+         - found '/usr/bin/arm-linux-gnueabihf-gcc'
+Tool chain test:  OK, arch='i586', priority 11
+Tool chain test:  OK, arch='c89', priority 11
+Tool chain test:  OK, arch='x86_64', priority 4
+Toolchain '/usr/bin/x86_64-linux-gnu-gcc' at priority 4 will be ignored because another toolchain for arch 'x86_64' has priority 4
+Tool chain test:  OK, arch='sandbox', priority 11
+Tool chain test:  OK, arch='c99', priority 11
+Tool chain test:  OK, arch='arm', priority 4
+Toolchain '/usr/bin/arm-linux-gnueabi-gcc' at priority 4 will be ignored because another toolchain for arch 'arm' has priority 1
+Tool chain test:  OK, arch='aarch64', priority 4
+Toolchain '/usr/bin/aarch64-linux-gnu-gcc' at priority 4 will be ignored because another toolchain for arch 'aarch64' has priority 4
+Tool chain test:  OK, arch='sandbox', priority 11
+Toolchain '/usr/bin/winegcc' at priority 11 will be ignored because another toolchain for arch 'sandbox' has priority 11
+Tool chain test:  OK, arch='arm', priority 4
+Toolchain '/usr/bin/arm-linux-gnueabihf-gcc' at priority 4 will be ignored because another toolchain for arch 'arm' has priority 1
+List of available toolchains (34):
+aarch64   : /toolchains/gcc-4.9.0-nolibc/aarch64-linux/bin/aarch64-linux-gcc
+alpha     : /toolchains/gcc-4.9.0-nolibc/alpha-linux/bin/alpha-linux-gcc
+am33_2.0  : /toolchains/gcc-4.9.0-nolibc/am33_2.0-linux/bin/am33_2.0-linux-gcc
+arm       : /opt/arm-eabi-4.6/bin/arm-eabi-gcc
+avr32     : /toolchains/gcc-4.2.4-nolibc/avr32-linux/bin/avr32-linux-gcc
+bfin      : /toolchains/gcc-4.6.3-nolibc/bfin-uclinux/bin/bfin-uclinux-gcc
 c89       : /usr/bin/c89-gcc
 c99       : /usr/bin/c99-gcc
-i386      : /toolchains/i386-linux/bin/i386-linux-gcc
-m68k      : /toolchains/m68k-linux/bin/m68k-linux-gcc
-mb        : /toolchains/microblaze-unknown-linux-gnu/bin/mb-linux-gcc
-microblaze: /toolchains/microblaze-unknown-linux-gnu/bin/microblaze-unknown-linux-gnu-gcc
-mips      : /toolchains/mips-linux/bin/mips-linux-gcc
-nds32le   : /toolchains/nds32le-linux-glibc-v1f/bin/nds32le-linux-gcc
-nios2     : /toolchains/nios2/bin/nios2-linux-gcc
-powerpc   : /toolchains/powerpc-linux/bin/powerpc-linux-gcc
+frv       : /toolchains/gcc-4.9.0-nolibc/frv-linux/bin/frv-linux-gcc
+h8300     : /toolchains/gcc-4.9.0-nolibc/h8300-elf/bin/h8300-elf-gcc
+hppa      : /toolchains/gcc-4.9.0-nolibc/hppa-linux/bin/hppa-linux-gcc
+hppa64    : /toolchains/gcc-4.9.0-nolibc/hppa64-linux/bin/hppa64-linux-gcc
+i386      : /toolchains/gcc-4.9.0-nolibc/i386-linux/bin/i386-linux-gcc
+i586      : /usr/bin/i586-mingw32msvc-gcc
+ia64      : /toolchains/gcc-4.9.0-nolibc/ia64-linux/bin/ia64-linux-gcc
+m32r      : /toolchains/gcc-4.9.0-nolibc/m32r-linux/bin/m32r-linux-gcc
+m68k      : /toolchains/gcc-4.9.0-nolibc/m68k-linux/bin/m68k-linux-gcc
+microblaze: /toolchains/gcc-4.9.0-nolibc/microblaze-linux/bin/microblaze-linux-gcc
+mips      : /toolchains/gcc-4.9.0-nolibc/mips-linux/bin/mips-linux-gcc
+mips64    : /toolchains/gcc-4.9.0-nolibc/mips64-linux/bin/mips64-linux-gcc
+or32      : /toolchains/gcc-4.5.1-nolibc/or32-linux/bin/or32-linux-gcc
+powerpc   : /toolchains/gcc-4.9.0-nolibc/powerpc-linux/bin/powerpc-linux-gcc
+powerpc64 : /toolchains/gcc-4.9.0-nolibc/powerpc64-linux/bin/powerpc64-linux-gcc
+ppc64le   : /toolchains/gcc-4.9.0-nolibc/ppc64le-linux/bin/ppc64le-linux-gcc
+s390x     : /toolchains/gcc-4.9.0-nolibc/s390x-linux/bin/s390x-linux-gcc
 sandbox   : /usr/bin/gcc
-sh4       : /toolchains/sh4-gentoo-linux-gnu/bin/sh4-gentoo-linux-gnu-gcc
-sparc     : /toolchains/sparc-elf/bin/sparc-elf-gcc
-x86_64    : /usr/bin/x86_64-linux-gnu-gcc
+sh4       : /toolchains/gcc-4.6.3-nolibc/sh4-linux/bin/sh4-linux-gcc
+sparc     : /toolchains/gcc-4.9.0-nolibc/sparc-linux/bin/sparc-linux-gcc
+sparc64   : /toolchains/gcc-4.9.0-nolibc/sparc64-linux/bin/sparc64-linux-gcc
+tilegx    : /toolchains/gcc-4.6.2-nolibc/tilegx-linux/bin/tilegx-linux-gcc
+x86       : /opt/gcc-4.6.3-nolibc/x86_64-linux/bin/x86_64-linux-gcc
+x86_64    : /toolchains/gcc-4.9.0-nolibc/x86_64-linux/bin/x86_64-linux-gcc
 
 
 You can see that everything is covered, even some strange ones that won't
@@ -534,7 +612,8 @@ The full build output in this case is available in:
    err:  Output from stderr, if any. Errors and warnings appear here.
 
    log:  Output from stdout. Normally there isn't any since buildman runs
-         in silent mode for now.
+         in silent mode. Use -V to force a verbose build (this passes V=1
+         to 'make')
 
    toolchain: Shows information about the toolchain used for the build.
 
index 916ea57157c0ea3d4deccee0ca7a55b9f6a3ea4f..8341ab145cfa1f5eb1776ef1a821cd2ab95e8972 100644 (file)
@@ -85,7 +85,7 @@ def ParseArgs():
     parser.add_option('-v', '--verbose', action='store_true',
           default=False, help='Show build results while the build progresses')
     parser.add_option('-V', '--verbose-build', action='store_true',
-          default=False, help='Run make with V=1, showing all output')
+          default=False, help='Run make with V=1, logging all output')
     parser.add_option('-x', '--exclude', dest='exclude',
           type='string', action='append',
           help='Specify a list of boards to exclude, separated by comma')
index 75eb3a97bbee72565951843be91151dc32d43689..a0bd46cbfbed046726d9c37f69cb189d833c8d1d 100644 (file)
@@ -255,6 +255,8 @@ class TestFunctional(unittest.TestCase):
         self.assertEqual(gitutil.use_no_decorate, True)
 
     def _HandleCommandGitLog(self, args):
+        if args[-1] == '--':
+            args = args[:-1]
         if '-n0' in args:
             return command.CommandResult(return_code=0)
         elif args[-1] == 'upstream/master..%s' % self._test_branch:
index 7bcc0af3e9662f14f43271d2e3ad823b29b6aa11..3993db3a8d65f43738c52c1ed8c23f215ef33c75 100644 (file)
@@ -14,7 +14,8 @@ import urllib2
 import bsettings
 import command
 
-PRIORITY_CALC = 0
+(PRIORITY_FULL_PREFIX, PRIORITY_PREFIX_GCC, PRIORITY_PREFIX_GCC_PATH,
+    PRIORITY_CALC) = range(4)
 
 # Simple class to collect links from a page
 class MyHTMLParser(HTMLParser):
@@ -152,11 +153,17 @@ class Toolchains:
 
     Public members:
         toolchains: Dict of Toolchain objects, keyed by architecture name
+        prefixes: Dict of prefixes to check, keyed by architecture. This can
+            be a full path and toolchain prefix, for example
+            {'x86', 'opt/i386-linux/bin/i386-linux-'}, or the name of
+            something on the search path, for example
+            {'arm', 'arm-linux-gnueabihf-'}. Wildcards are not supported.
         paths: List of paths to check for toolchains (may contain wildcards)
     """
 
     def __init__(self):
         self.toolchains = {}
+        self.prefixes = {}
         self.paths = []
         self._make_flags = dict(bsettings.GetItems('make-flags'))
 
@@ -182,6 +189,7 @@ class Toolchains:
         return paths
 
     def GetSettings(self):
+      self.prefixes = bsettings.GetItems('toolchain-prefix')
       self.paths += self.GetPathList()
 
     def Add(self, fname, test=True, verbose=False, priority=PRIORITY_CALC,
@@ -228,6 +236,21 @@ class Toolchains:
                 fnames.append(fname)
         return fnames
 
+    def ScanPathEnv(self, fname):
+        """Scan the PATH environment variable for a given filename.
+
+        Args:
+            fname: Filename to scan for
+        Returns:
+            List of matching pathanames, or [] if none
+        """
+        pathname_list = []
+        for path in os.environ["PATH"].split(os.pathsep):
+            path = path.strip('"')
+            pathname = os.path.join(path, fname)
+            if os.path.exists(pathname):
+                pathname_list.append(pathname)
+        return pathname_list
 
     def Scan(self, verbose):
         """Scan for available toolchains and select the best for each arch.
@@ -240,6 +263,21 @@ class Toolchains:
             verbose: True to print out progress information
         """
         if verbose: print 'Scanning for tool chains'
+        for name, value in self.prefixes:
+            if verbose: print "   - scanning prefix '%s'" % value
+            if os.path.exists(value):
+                self.Add(value, True, verbose, PRIORITY_FULL_PREFIX, name)
+                continue
+            fname = value + 'gcc'
+            if os.path.exists(fname):
+                self.Add(fname, True, verbose, PRIORITY_PREFIX_GCC, name)
+                continue
+            fname_list = self.ScanPathEnv(fname)
+            for f in fname_list:
+                self.Add(f, True, verbose, PRIORITY_PREFIX_GCC_PATH, name)
+            if not fname_list:
+                raise ValueError, ("No tool chain found for prefix '%s'" %
+                                   value)
         for path in self.paths:
             if verbose: print "   - scanning path '%s'" % path
             fnames = self.ScanPath(path, verbose)
index 5f1b4f6e7641065766dbbe4d22b8c96ffaa8feca..e088baeb819e3895bcec5277e1f011d493904fbd 100644 (file)
@@ -44,6 +44,11 @@ def LogCmd(commit_range, git_dir=None, oneline=False, reverse=False,
         cmd.append('-n%d' % count)
     if commit_range:
         cmd.append(commit_range)
+
+    # Add this in case we have a branch with the same name as a directory.
+    # This avoids messages like this, for example:
+    #   fatal: ambiguous argument 'test': both revision and filename
+    cmd.append('--')
     return cmd
 
 def CountCommitsToBranch():