diff options
32 files changed, 738 insertions, 400 deletions
diff --git a/arch/arm/dts/exynos4210-pinctrl-uboot.dtsi b/arch/arm/dts/exynos4210-pinctrl-uboot.dtsi index 0ff41d00287..b76c77d7194 100644 --- a/arch/arm/dts/exynos4210-pinctrl-uboot.dtsi +++ b/arch/arm/dts/exynos4210-pinctrl-uboot.dtsi @@ -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>; }; }; diff --git a/arch/arm/dts/exynos4x12-pinctrl-uboot.dtsi b/arch/arm/dts/exynos4x12-pinctrl-uboot.dtsi index 8e5a6c61180..33ecc148a79 100644 --- a/arch/arm/dts/exynos4x12-pinctrl-uboot.dtsi +++ b/arch/arm/dts/exynos4x12-pinctrl-uboot.dtsi @@ -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>; }; }; diff --git a/arch/arm/dts/exynos5250-pinctrl-uboot.dtsi b/arch/arm/dts/exynos5250-pinctrl-uboot.dtsi index 068c5f696fe..b8c0526def4 100644 --- a/arch/arm/dts/exynos5250-pinctrl-uboot.dtsi +++ b/arch/arm/dts/exynos5250-pinctrl-uboot.dtsi @@ -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>; }; }; diff --git a/arch/arm/dts/exynos54xx-pinctrl-uboot.dtsi b/arch/arm/dts/exynos54xx-pinctrl-uboot.dtsi index 635a1b0d3a5..341194f5a76 100644 --- a/arch/arm/dts/exynos54xx-pinctrl-uboot.dtsi +++ b/arch/arm/dts/exynos54xx-pinctrl-uboot.dtsi @@ -14,29 +14,29 @@ */ 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>; }; }; diff --git a/arch/arm/dts/s5pc110-pinctrl.dtsi b/arch/arm/dts/s5pc110-pinctrl.dtsi index 2e9d552daaf..07e76c09858 100644 --- a/arch/arm/dts/s5pc110-pinctrl.dtsi +++ b/arch/arm/dts/s5pc110-pinctrl.dtsi @@ -9,7 +9,7 @@ / { pinctrl@e0200000 { #address-cells = <1>; - #size-cells = <0>; + #size-cells = <1>; gpa0: gpa0 { gpio-controller; #gpio-cells = <2>; @@ -251,7 +251,7 @@ }; gph0: gph0 { - reg = <0xc00>; + reg = <0xc00 0x20>; gpio-controller; #gpio-cells = <2>; }; diff --git a/arch/arm/dts/socfpga_cyclone5_sr1500.dts b/arch/arm/dts/socfpga_cyclone5_sr1500.dts index 3729ca02cdd..32c6aad30d9 100644 --- a/arch/arm/dts/socfpga_cyclone5_sr1500.dts +++ b/arch/arm/dts/socfpga_cyclone5_sr1500.dts @@ -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 */ diff --git a/board/gdsys/common/dp501.c b/board/gdsys/common/dp501.c index d35aee0879f..54e7f63f69b 100644 --- a/board/gdsys/common/dp501.c +++ b/board/gdsys/common/dp501.c @@ -12,6 +12,16 @@ #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; +} diff --git a/board/gdsys/common/dp501.h b/board/gdsys/common/dp501.h index 8dc3215dcf0..b98b54edc52 100644 --- a/board/gdsys/common/dp501.h +++ b/board/gdsys/common/dp501.h @@ -26,5 +26,6 @@ void dp501_powerup(u8 addr); void dp501_powerdown(u8 addr); +int dp501_probe(unsigned screen, bool power); #endif diff --git a/board/gdsys/common/osd.c b/board/gdsys/common/osd.c index 7444bee129f..4e292f56626 100644 --- a/board/gdsys/common/osd.c +++ b/board/gdsys/common/osd.c @@ -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) diff --git a/board/gdsys/mpc8308/strider.c b/board/gdsys/mpc8308/strider.c index ef5b6c03f8c..eee582bb0f7 100644 --- a/board/gdsys/mpc8308/strider.c +++ b/board/gdsys/mpc8308/strider.c @@ -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, diff --git a/cmd/gpio.c b/cmd/gpio.c index 693998e8bd5..ecdc453918f 100644 --- a/cmd/gpio.c +++ b/cmd/gpio.c @@ -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); diff --git a/common/fdt_support.c b/common/fdt_support.c index 75d0858e763..ced119e70d9 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -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; diff --git a/common/usb.c b/common/usb.c index c7b8b0ee5a8..45a5a0f9c73 100644 --- a/common/usb.c +++ b/common/usb.c @@ -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; } diff --git a/common/usb_hub.c b/common/usb_hub.c index e1de813adf8..e6a2cdb6f86 100644 --- a/common/usb_hub.c +++ b/common/usb_hub.c @@ -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) diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig index 02534bfea76..d69c9fc25de 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -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 diff --git a/configs/socfpga_sr1500_defconfig b/configs/socfpga_sr1500_defconfig index 59a6be497ec..d499a14bac7 100644 --- a/configs/socfpga_sr1500_defconfig +++ b/configs/socfpga_sr1500_defconfig @@ -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 diff --git a/drivers/block/sandbox.c b/drivers/block/sandbox.c index 6d41508d5c1..2d340efd32b 100644 --- a/drivers/block/sandbox.c +++ b/drivers/block/sandbox.c @@ -17,19 +17,6 @@ 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 diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c index 93dad338b37..28da9ddfd85 100644 --- a/drivers/serial/ns16550.c +++ b/drivers/serial/ns16550.c @@ -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, diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c index 50538e0bd76..69c9a504ebb 100644 --- a/drivers/usb/host/usb-uclass.c +++ b/drivers/usb/host/usb-uclass.c @@ -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; diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index ca598aa5e60..cb8a04b793e 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -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"); diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h index cd48c9e1caf..56d32e6b532 100644 --- a/include/configs/socfpga_common.h +++ b/include/configs/socfpga_common.h @@ -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 * diff --git a/include/configs/socfpga_sr1500.h b/include/configs/socfpga_sr1500.h index fdf67ca0989..6414eeb9147 100644 --- a/include/configs/socfpga_sr1500.h +++ b/include/configs/socfpga_sr1500.h @@ -92,23 +92,28 @@ #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__ */ diff --git a/include/configs/strider.h b/include/configs/strider.h index 034240016b4..d5f1981c0d2 100644 --- a/include/configs/strider.h +++ b/include/configs/strider.h @@ -279,14 +279,13 @@ | 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 @@ -327,6 +326,11 @@ #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 diff --git a/include/ns16550.h b/include/ns16550.h index 4e620676c45..1311f4cb919 100644 --- a/include/ns16550.h +++ b/include/ns16550.h @@ -56,6 +56,7 @@ struct ns16550_platdata { unsigned long base; int reg_shift; int clock; + int reg_offset; }; struct udevice; diff --git a/include/usb.h b/include/usb.h index c2fa6849f10..19411258ec8 100644 --- a/include/usb.h +++ b/include/usb.h @@ -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 diff --git a/test/dm/Makefile b/test/dm/Makefile index fd0198f1bac..df2d71fdadd 100644 --- a/test/dm/Makefile +++ b/test/dm/Makefile @@ -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 index 00000000000..f4ea32e83e5 --- /dev/null +++ b/test/dm/blk.c @@ -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); diff --git a/tools/buildman/README b/tools/buildman/README index 6f41008912c..4705d2644b8 100644 --- a/tools/buildman/README +++ b/tools/buildman/README @@ -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. diff --git a/tools/buildman/cmdline.py b/tools/buildman/cmdline.py index 916ea57157c..8341ab145cf 100644 --- a/tools/buildman/cmdline.py +++ b/tools/buildman/cmdline.py @@ -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') diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py index 75eb3a97bbe..a0bd46cbfbe 100644 --- a/tools/buildman/func_test.py +++ b/tools/buildman/func_test.py @@ -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: diff --git a/tools/buildman/toolchain.py b/tools/buildman/toolchain.py index 7bcc0af3e96..3993db3a8d6 100644 --- a/tools/buildman/toolchain.py +++ b/tools/buildman/toolchain.py @@ -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) diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py index 5f1b4f6e764..e088baeb819 100644 --- a/tools/patman/gitutil.py +++ b/tools/patman/gitutil.py @@ -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(): |