diff --git a/commands/state.c b/commands/state.c index 82c29d0..59d1eb8 100644 --- a/commands/state.c +++ b/commands/state.c @@ -62,16 +62,18 @@ return ret; } -static const __maybe_unused char cmd_state_help[] = -"Usage: state [OPTIONS] [STATENAME]\n" -"\n" -"options:\n" -"-s save state\n" -"-l load state\n"; +BAREBOX_CMD_HELP_START(state) +BAREBOX_CMD_HELP_TEXT("Usage: state [OPTIONS] [STATENAME]") +BAREBOX_CMD_HELP_TEXT("") +BAREBOX_CMD_HELP_TEXT("options:") +BAREBOX_CMD_HELP_OPT ("-s", "save state") +BAREBOX_CMD_HELP_OPT ("-l", "load state") +BAREBOX_CMD_HELP_END BAREBOX_CMD_START(state) .cmd = do_state, - BAREBOX_CMD_DESC("handle state information") + BAREBOX_CMD_DESC("load and save state information") + BAREBOX_CMD_OPTS("[-sl] [STATENAME]") BAREBOX_CMD_GROUP(CMD_GRP_MISC) BAREBOX_CMD_HELP(cmd_state_help) BAREBOX_CMD_END diff --git a/commands/timeout.c b/commands/timeout.c index feca714..2b99d4f 100644 --- a/commands/timeout.c +++ b/commands/timeout.c @@ -16,40 +16,35 @@ * GNU General Public License for more details. * */ -#include + #include -#include #include #include -#include #include +#include -#define TIMEOUT_RETURN (1 << 0) -#define TIMEOUT_CTRLC (1 << 1) -#define TIMEOUT_ANYKEY (1 << 2) -#define TIMEOUT_SILENT (1 << 3) +#include static int do_timeout(int argc, char *argv[]) { - int timeout = 3, ret = 1; - int flags = 0, opt, countdown; - int key = 0; - uint64_t start, second; + int timeout, ret, opt; + unsigned flags = 0; + char str[2] = { }; const char *varname = NULL; - while((opt = getopt(argc, argv, "t:crsav:")) > 0) { + while((opt = getopt(argc, argv, "crsav:")) > 0) { switch(opt) { case 'r': - flags |= TIMEOUT_RETURN; + flags |= CONSOLE_COUNTDOWN_RETURN; break; case 'c': - flags |= TIMEOUT_CTRLC; + flags |= CONSOLE_COUNTDOWN_CTRLC; break; case 'a': - flags |= TIMEOUT_ANYKEY; + flags |= CONSOLE_COUNTDOWN_ANYKEY; break; case 's': - flags |= TIMEOUT_SILENT; + flags |= CONSOLE_COUNTDOWN_SILENT; break; case 'v': varname = optarg; @@ -63,43 +58,12 @@ return COMMAND_ERROR_USAGE; timeout = simple_strtoul(argv[optind], NULL, 0); + ret = console_countdown(timeout, flags, str); - start = get_time_ns(); - second = start; - - countdown = timeout; - - if (!(flags & TIMEOUT_SILENT)) - printf("%2d", countdown--); - - do { - if (tstc()) { - key = getc(); - if (flags & TIMEOUT_CTRLC && key == 3) - goto out; - if (flags & TIMEOUT_ANYKEY) - goto out; - if (flags & TIMEOUT_RETURN && key == '\n') - goto out; - key = 0; - } - if (!(flags & TIMEOUT_SILENT) && is_timeout(second, SECOND)) { - printf("\b\b%2d", countdown--); - second += SECOND; - } - } while (!is_timeout(start, timeout * SECOND)); - - ret = 0; -out: - if (varname && key) { - char str[2] = { }; - str[0] = key; + if (varname && str[0]) setenv(varname, str); - } - if (!(flags & TIMEOUT_SILENT)) - printf("\n"); - return ret; + return ret ? 1 : 0; } BAREBOX_CMD_HELP_START(timeout) @@ -110,12 +74,13 @@ BAREBOX_CMD_HELP_OPT("-c", "interrupt on Ctrl-C") BAREBOX_CMD_HELP_OPT("-r", "interrupt on RETURN") BAREBOX_CMD_HELP_OPT("-s", "silent mode") +BAREBOX_CMD_HELP_OPT("-v ", "export pressed key to environment") BAREBOX_CMD_HELP_END BAREBOX_CMD_START(timeout) .cmd = do_timeout, BAREBOX_CMD_DESC("wait for a specified timeout") - BAREBOX_CMD_OPTS("[-acrs] SECONDS") + BAREBOX_CMD_OPTS("[-acrsv] SECONDS") BAREBOX_CMD_GROUP(CMD_GRP_CONSOLE) BAREBOX_CMD_HELP(cmd_timeout_help) BAREBOX_CMD_END diff --git a/common/Makefile b/common/Makefile index eca1e35..2738238 100644 --- a/common/Makefile +++ b/common/Makefile @@ -20,6 +20,7 @@ obj-$(CONFIG_COMMAND_SUPPORT) += command.o obj-$(CONFIG_CONSOLE_FULL) += console.o obj-$(CONFIG_CONSOLE_SIMPLE) += console_simple.o +obj-y += console_countdown.o obj-$(CONFIG_DDR_SPD) += ddr_spd.o obj-$(CONFIG_ENV_HANDLING) += environment.o obj-$(CONFIG_ENVIRONMENT_VARIABLES) += env.o diff --git a/common/console_countdown.c b/common/console_countdown.c new file mode 100644 index 0000000..ffbdb4f --- /dev/null +++ b/common/console_countdown.c @@ -0,0 +1,67 @@ +/* + * console_countdown - contdown on the console - interruptible by a keypress + * + * Copyright (c) 2007 Sascha Hauer , Pengutronix + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include +#include +#include +#include + +int console_countdown(int timeout_s, unsigned flags, char *out_key) +{ + uint64_t start, second; + int countdown, ret = -EINTR; + int key = 0; + + start = get_time_ns(); + second = start; + + countdown = timeout_s; + + if (!(flags & CONSOLE_COUNTDOWN_SILENT)) + printf("%2d", countdown--); + + do { + if (tstc()) { + key = getc(); + if (flags & CONSOLE_COUNTDOWN_ANYKEY) + goto out; + if (flags & CONSOLE_COUNTDOWN_RETURN && key == '\n') + goto out; + if (flags & CONSOLE_COUNTDOWN_CTRLC && key == 3) + goto out; + key = 0; + } + if (!(flags & CONSOLE_COUNTDOWN_SILENT) && + is_timeout(second, SECOND)) { + printf("\b\b%2d", countdown--); + second += SECOND; + } + } while (!is_timeout(start, timeout_s * SECOND)); + + ret = 0; + + out: + if (!(flags & CONSOLE_COUNTDOWN_SILENT)) + printf("\n"); + if (key && out_key) + *out_key = key; + + return ret; +} diff --git a/common/env.c b/common/env.c index 2e33eb3..c98ed73 100644 --- a/common/env.c +++ b/common/env.c @@ -218,16 +218,18 @@ *par++ = 0; dev = get_device_by_name(name); - if (dev) + if (dev) { ret = dev_set_param(dev, par, value); - else + if (ret) + eprintf("%s: set parameter %s: %s\n", + dev_name(dev), par, strerror(-ret)); + } else { ret = -ENODEV; + eprintf("set parameter: no such device %s\n", name); + } errno = -ret; - if (ret < 0) - perror("set parameter"); - goto out; } diff --git a/drivers/base/bus.c b/drivers/base/bus.c index c41e0b0..1264e40 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c @@ -58,7 +58,7 @@ return 0; if (drv->id_table) { - struct platform_device_id *id = drv->id_table; + const struct platform_device_id *id = drv->id_table; while (id->name) { if (!strcmp(id->name, dev->name)) { @@ -74,7 +74,7 @@ int device_match_of_modalias(struct device_d *dev, struct driver_d *drv) { - struct platform_device_id *id = drv->id_table; + const struct platform_device_id *id = drv->id_table; const char *of_modalias = NULL, *p; int cplen; const char *compat; diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig index 15465fe..710b500 100644 --- a/drivers/firmware/Kconfig +++ b/drivers/firmware/Kconfig @@ -13,5 +13,5 @@ config FIRMWARE_ALTERA_SOCFPGA bool "Altera SoCFPGA fpga loader" depends on ARCH_SOCFPGA - + select FIRMWARE endmenu diff --git a/drivers/firmware/socfpga.c b/drivers/firmware/socfpga.c index a5dc607..14a7a14 100644 --- a/drivers/firmware/socfpga.c +++ b/drivers/firmware/socfpga.c @@ -324,13 +324,27 @@ const uint32_t *buf32 = buf; /* write to FPGA Manager AXI data */ - while (size) { + while (size >= sizeof(uint32_t)) { writel(*buf32, mgr->regs_data); readl(mgr->regs + FPGAMGRREGS_MON_GPIO_EXT_PORTA_ADDRESS); buf32++; size -= sizeof(uint32_t); } + if (size) { + const uint8_t *buf8 = (const uint8_t *)buf32; + uint32_t word = 0; + + while (size--) { + word |= *buf8; + word <<= 8; + buf8++; + } + + writel(word, mgr->regs_data); + readl(mgr->regs + FPGAMGRREGS_MON_GPIO_EXT_PORTA_ADDRESS); + } + return 0; } diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c index 6d8c85b..4fd3a6f 100644 --- a/drivers/i2c/busses/i2c-mv64xxx.c +++ b/drivers/i2c/busses/i2c-mv64xxx.c @@ -540,8 +540,7 @@ } tclk = clk_get_rate(drv_data->clk); - rc = of_property_read_u32(np, "clock-frequency", &bus_freq); - if (rc) + if (of_property_read_u32(np, "clock-frequency", &bus_freq)) bus_freq = 100000; /* 100kHz by default */ if (!mv64xxx_find_baud_factors(bus_freq, tclk, diff --git a/drivers/misc/state.c b/drivers/misc/state.c index f066a83..3b07bb9 100644 --- a/drivers/misc/state.c +++ b/drivers/misc/state.c @@ -41,7 +41,7 @@ if (IS_ERR(state)) return PTR_ERR(state); - ret = of_find_path(np, "backend", &path); + ret = of_find_path(np, "backend", &path, 0); if (ret) return ret; diff --git a/drivers/mtd/core.c b/drivers/mtd/core.c index 431114b..1755e76 100644 --- a/drivers/mtd/core.c +++ b/drivers/mtd/core.c @@ -488,7 +488,7 @@ struct device_node *np, *part, *tmp; int ret, i = 0; - np = of_find_node_by_path(mtd->of_path); + np = of_find_node_by_path_from(root, mtd->of_path); if (!np) { dev_err(&mtd->class_dev, "Cannot find nodepath %s, cannot fixup\n", mtd->of_path); diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c index 095a4ca..efef984 100644 --- a/drivers/mtd/devices/m25p80.c +++ b/drivers/mtd/devices/m25p80.c @@ -743,6 +743,7 @@ { "w25q64", INFO(0xef4017, 0, 64 * 1024, 128, SECT_4K) }, { "w25q80", INFO(0xef5014, 0, 64 * 1024, 16, SECT_4K) }, { "w25q80bl", INFO(0xef4014, 0, 64 * 1024, 16, SECT_4K) }, + { "w25q128", INFO(0xef4018, 0, 64 * 1024, 256, SECT_4K) }, /* Catalyst / On Semiconductor -- non-JEDEC */ { "cat25c11", CAT25_INFO( 16, 8, 16, 1) }, diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c index dcd138f..90d5b2d 100644 --- a/drivers/mtd/ubi/cdev.c +++ b/drivers/mtd/ubi/cdev.c @@ -25,7 +25,7 @@ loff_t offp = offset; int usable_leb_size = vol->usable_leb_size; - ubi_debug("%s: %zd @ 0x%08llx\n", __func__, size, offset); + ubi_debug("%s: %zd @ 0x%08llx", __func__, size, offset); len = size > usable_leb_size ? usable_leb_size : size; @@ -38,7 +38,7 @@ err = ubi_eba_read_leb(ubi, vol, lnum, buf, off, len, 0); if (err) { - ubi_err("read error: %s\n", strerror(-err)); + ubi_err("read error: %s", strerror(-err)); break; } off += len; @@ -68,14 +68,14 @@ if (!priv->written) { err = ubi_start_update(ubi, vol, vol->used_bytes); if (err < 0) { - ubi_err("Cannot start volume update\n"); + ubi_err("Cannot start volume update"); return err; } } err = ubi_more_update_data(ubi, vol, buf, size); if (err < 0) { - ubi_err("Couldnt or partially wrote data \n"); + ubi_err("Couldnt or partially wrote data"); return err; } @@ -117,7 +117,7 @@ kfree(buf); if (err < 0) { - ubi_err("Couldnt or partially wrote data \n"); + ubi_err("Couldnt or partially wrote data"); return err; } } @@ -128,7 +128,7 @@ err = ubi_check_volume(ubi, vol->vol_id); if (err < 0) { - ubi_err("ubi volume check failed: %s\n", strerror(err)); + ubi_err("ubi volume check failed: %s", strerror(err)); return err; } @@ -180,7 +180,7 @@ cdev->priv = priv; cdev->size = vol->used_bytes; cdev->dev = &vol->dev; - ubi_msg("registering %s as /dev/%s\n", vol->name, cdev->name); + ubi_msg("registering %s as /dev/%s", vol->name, cdev->name); ret = devfs_create(cdev); if (ret) { kfree(priv); diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c index 875905a..28d5a7b 100644 --- a/drivers/net/fec_imx.c +++ b/drivers/net/fec_imx.c @@ -308,7 +308,10 @@ } } - if (fec->interface == PHY_INTERFACE_MODE_RGMII) + if (fec->interface == PHY_INTERFACE_MODE_RGMII || + fec->interface == PHY_INTERFACE_MODE_RGMII_ID || + fec->interface == PHY_INTERFACE_MODE_RGMII_TXID || + fec->interface == PHY_INTERFACE_MODE_RGMII_RXID) rcntl |= 1 << 6; writel(rcntl, fec->regs + FEC_R_CNTRL); diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c index 14a8c76..7cce5b9 100644 --- a/drivers/net/usb/asix.c +++ b/drivers/net/usb/asix.c @@ -846,6 +846,10 @@ // LevelOne USB Fast Ethernet Adapter USB_DEVICE(0x0b95, 0x772b), .driver_info = &ax88772b_info, +}, { + // DLink DUB-E100 H/W Ver C1 + USB_DEVICE(0x2001, 0x1a02), + .driver_info = &ax88772_info, }, { }, // END }; diff --git a/drivers/of/barebox.c b/drivers/of/barebox.c index 2246742..1b3078e 100644 --- a/drivers/of/barebox.c +++ b/drivers/of/barebox.c @@ -26,42 +26,15 @@ #include #include -struct of_partition { - struct list_head list; - char *nodepath; - struct device_d *dev; - struct device_node *of_partitions; -}; - -static LIST_HEAD(of_partition_list); - static int environment_probe(struct device_d *dev) { char *path; int ret; - ret = of_find_path(dev->device_node, "device-path", &path); + ret = of_find_path(dev->device_node, "device-path", &path, OF_FIND_PATH_FLAGS_BB); if (ret) return ret; - /* - * The environment support is not bad block aware, hence we - * have to use the .bb device. Test if we have a nand device - * and if yes, append .bb to the filename. - */ - if (!strncmp(path, "/dev/", 5)) { - struct cdev *cdev; - char *cdevname; - - cdevname = path + 5; - cdev = cdev_by_name(cdevname); - if (cdev && cdev->mtd && mtd_can_have_bb(cdev->mtd)) { - char *bbpath = asprintf("%s.bb", path); - free(path); - path = bbpath; - } - } - dev_info(dev, "setting default environment path to %s\n", path); default_environment_path_set(path); diff --git a/drivers/of/of_path.c b/drivers/of/of_path.c index df63c57..2dc7848 100644 --- a/drivers/of/of_path.c +++ b/drivers/of/of_path.c @@ -21,6 +21,8 @@ #include #include +#include + struct of_path { struct cdev *cdev; struct device_d *dev; @@ -112,6 +114,7 @@ * @propname: the property name of the path description * @outpath: if this function returns 0 outpath will contain the path belonging * to the input path description. Must be freed with free(). + * @flags: use OF_FIND_PATH_FLAGS_BB to return the .bb device if available * * paths in the devicetree have the form of a multistring property. The first * string contains the full path to the physical device containing the path. @@ -127,11 +130,12 @@ * device-path = &mmc0, "partname:0"; * device-path = &norflash, "partname:barebox-environment"; */ -int of_find_path(struct device_node *node, const char *propname, char **outpath) +int of_find_path(struct device_node *node, const char *propname, char **outpath, unsigned flags) { struct of_path op = {}; struct device_node *rnode; const char *path, *str; + bool add_bb = false; int i, ret; path = of_get_property(node, propname, NULL); @@ -166,7 +170,11 @@ if (!op.cdev) return -ENOENT; - *outpath = asprintf("/dev/%s", op.cdev->name); + if ((flags & OF_FIND_PATH_FLAGS_BB) && op.cdev->mtd && + mtd_can_have_bb(op.cdev->mtd)) + add_bb = true; + + *outpath = asprintf("/dev/%s%s", op.cdev->name, add_bb ? ".bb" : ""); return 0; } diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index d6c5496..201675b 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c @@ -27,11 +27,11 @@ { struct pci_dev *pdev = to_pci_dev(dev); struct pci_driver *pdrv = to_pci_driver(drv); - struct pci_device_id *id; + const struct pci_device_id *id; - for (id = (struct pci_device_id *)pdrv->id_table; id->vendor; id++) + for (id = pdrv->id_table; id->vendor; id++) if (pci_match_one_device(id, pdev)) { - dev->priv = id; + pdev->id = id; return 0; } @@ -43,7 +43,7 @@ struct pci_dev *pdev = to_pci_dev(dev); struct pci_driver *pdrv = to_pci_driver(dev->driver); - return pdrv->probe(pdev, dev->priv); + return pdrv->probe(pdev, pdev->id); } static void pci_remove(struct device_d *dev) diff --git a/drivers/pci/pcie-designware.c b/drivers/pci/pcie-designware.c index 4edaede..4962a19 100644 --- a/drivers/pci/pcie-designware.c +++ b/drivers/pci/pcie-designware.c @@ -350,13 +350,6 @@ dw_pcie_writel_rc(pp, PCIE_ATU_ENABLE, PCIE_ATU_CR2); } -struct pci_bus *get_parent_bus(struct pci_bus *bus) -{ - struct pci_dev *bridge = container_of(bus->parent, struct pci_dev, dev); - - return bridge->bus; -} - static int dw_pcie_rd_other_conf(struct pcie_port *pp, struct pci_bus *bus, u32 devfn, int where, int size, u32 *val) { @@ -367,7 +360,7 @@ PCIE_ATU_FUNC(PCI_FUNC(devfn)); address = where & ~0x3; - if (get_parent_bus(bus)->number == pp->root_bus_nr) { + if (bus->primary == pp->root_bus_nr) { dw_pcie_prog_viewport_cfg0(pp, busdev); ret = dw_pcie_cfg_read(pp->va_cfg0_base + address, where, size, val); @@ -392,7 +385,7 @@ PCIE_ATU_FUNC(PCI_FUNC(devfn)); address = where & ~0x3; - if (get_parent_bus(bus)->number == pp->root_bus_nr) { + if (bus->primary == pp->root_bus_nr) { dw_pcie_prog_viewport_cfg0(pp, busdev); ret = dw_pcie_cfg_write(pp->va_cfg0_base + address, where, size, val); diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index d1c3e03..9073fff 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c @@ -663,7 +663,7 @@ result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), USB_REQ_CLEAR_FEATURE, USB_RECIP_ENDPOINT, 0, - endp, NULL, 0, USB_CNTL_TIMEOUT * 3); + endp, NULL, 0, USB_CNTL_TIMEOUT); /* don't clear if failed */ if (result < 0) @@ -748,7 +748,7 @@ ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), USB_REQ_SET_INTERFACE, USB_RECIP_INTERFACE, alternate, interface, NULL, 0, - USB_CNTL_TIMEOUT * 5); + USB_CNTL_TIMEOUT); if (ret < 0) return ret; diff --git a/include/console_countdown.h b/include/console_countdown.h new file mode 100644 index 0000000..cb46964 --- /dev/null +++ b/include/console_countdown.h @@ -0,0 +1,11 @@ +#ifndef __CONSOLE_COUNTDOWN_H +#define __CONSOLE_COUNTDOWN_H + +#define CONSOLE_COUNTDOWN_SILENT (1 << 0) +#define CONSOLE_COUNTDOWN_ANYKEY (1 << 1) +#define CONSOLE_COUNTDOWN_RETURN (1 << 3) +#define CONSOLE_COUNTDOWN_CTRLC (1 << 4) + +int console_countdown(int timeout_s, unsigned flags, char *out_key); + +#endif /* __CONSOLE_COUNTDOWN_H */ diff --git a/include/driver.h b/include/driver.h index 0ee3b45..1745717 100644 --- a/include/driver.h +++ b/include/driver.h @@ -77,7 +77,7 @@ struct list_head cdevs; - struct platform_device_id *id_entry; + const struct platform_device_id *id_entry; struct device_node *device_node; const struct of_device_id *of_id_entry; @@ -107,8 +107,8 @@ struct bus_type *bus; - struct platform_device_id *id_table; - struct of_device_id *of_compatible; + const struct platform_device_id *id_table; + const struct of_device_id *of_compatible; }; /*@}*/ /* do not delete, doxygen relevant */ diff --git a/include/fdt.h b/include/fdt.h index 35278e3..1ccd4c6 100644 --- a/include/fdt.h +++ b/include/fdt.h @@ -1,6 +1,8 @@ #ifndef _FDT_H #define _FDT_H +#include + #ifndef __ASSEMBLY__ #define _B(n) ((unsigned long long)((uint8_t *)&x)[n]) diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h index a7bbae0..2ecef35 100644 --- a/include/linux/amba/bus.h +++ b/include/linux/amba/bus.h @@ -60,9 +60,6 @@ #define to_amba_device(d) container_of(d, struct amba_device, dev) -#define amba_get_drvdata(d) dev_get_drvdata(&d->dev) -#define amba_set_drvdata(d,p) dev_set_drvdata(&d->dev, p) - int amba_driver_register(struct amba_driver *); void amba_driver_unregister(struct amba_driver *); struct amba_device *amba_device_alloc(const char *, int id, resource_size_t, size_t); diff --git a/include/linux/pci.h b/include/linux/pci.h index e422055..152ba10 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -92,6 +92,7 @@ struct pci_bus *bus; /* bus this device is on */ struct pci_bus *subordinate; /* bus this device bridges to */ struct pci_slot *slot; /* Physical slot this device is in */ + const struct pci_device_id *id; /* the id this device matches */ struct device_d dev; diff --git a/include/of.h b/include/of.h index 764a2e5..2dcb613 100644 --- a/include/of.h +++ b/include/of.h @@ -3,6 +3,8 @@ #include #include +#include +#include #include /* Default string compare functions */ @@ -238,7 +240,8 @@ void of_add_memory_bank(struct device_node *node, bool dump, int r, u64 base, u64 size); struct device_d *of_find_device_by_node_path(const char *path); -int of_find_path(struct device_node *node, const char *propname, char **outpath); +#define OF_FIND_PATH_FLAGS_BB 1 /* return .bb device if available */ +int of_find_path(struct device_node *node, const char *propname, char **outpath, unsigned flags); int of_register_fixup(int (*fixup)(struct device_node *, void *), void *context); struct device_node *of_find_node_by_alias(struct device_node *root, const char *alias); diff --git a/include/state.h b/include/state.h index 95bf8d2..e96d3bf 100644 --- a/include/state.h +++ b/include/state.h @@ -1,6 +1,8 @@ #ifndef __STATE_H #define __STATE_H +#include + struct state; int state_backend_dtb_file(struct state *state, const char *path); diff --git a/include/usb/usb.h b/include/usb/usb.h index 991f3d7..8f3ce2a 100644 --- a/include/usb/usb.h +++ b/include/usb/usb.h @@ -39,7 +39,7 @@ #define USB_MAXCHILDREN 8 /* This is arbitrary */ #define USB_MAX_HUB 16 -#define USB_CNTL_TIMEOUT 100 /* 100ms timeout */ +#define USB_CNTL_TIMEOUT 5000 /* 5000ms timeout */ /* device request (setup) */ struct devrequest { diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index a40d32c..8d96434 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1466,6 +1466,41 @@ #print "is_end<$is_end> length<$length>\n"; } +# check for DT compatible documentation + if (defined $root && + (($realfile =~ /\.dtsi?$/ && $line =~ /^\+\s*compatible\s*=\s*\"/) || + ($realfile =~ /\.[ch]$/ && $line =~ /^\+.*\.compatible\s*=\s*\"/))) { + + my @compats = $rawline =~ /\"([a-zA-Z0-9\-\,\.\+_]+)\"/g; + + # linux device tree files + my $dt_path = $root . "/dts/Bindings/"; + my $vp_file = $dt_path . "vendor-prefixes.txt"; + + # barebox-specific bindings + $dt_path = $dt_path . " " . $root . "/Documentation/devicetree/bindings/"; + + foreach my $compat (@compats) { + my $compat2 = $compat; + $compat2 =~ s/\,[a-zA-Z0-9]*\-/\,<\.\*>\-/; + my $compat3 = $compat; + $compat3 =~ s/\,([a-z]*)[0-9]*\-/\,$1<\.\*>\-/; + `grep -Erq "$compat|$compat2|$compat3" $dt_path`; + if ( $? >> 8 ) { + WARN( + "DT compatible string \"$compat\" appears un-documented -- check $dt_path\n" . $herecurr); + } + + next if $compat !~ /^([a-zA-Z0-9\-]+)\,/; + my $vendor = $1; + `grep -Eq "^$vendor\\b" $vp_file`; + if ( $? >> 8 ) { + WARN( + "DT compatible string vendor \"$vendor\" appears un-documented -- check $vp_file\n" . $herecurr); + } + } + } + # check we are in a valid source file if not then ignore this hunk next if ($realfile !~ /\.(h|c|s|S|pl|sh)$/);