diff options
-rw-r--r-- | Documentation/boards/imx.rst | 2 | ||||
-rw-r--r-- | Documentation/devicetree/bindings/barebox/barebox,state.rst | 19 | ||||
-rw-r--r-- | Documentation/user/usb.rst | 2 | ||||
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | arch/arm/boards/freescale-mx53-qsb/flash-header-imx53-loco.imxcfg | 3 | ||||
-rw-r--r-- | arch/arm/cpu/start.c | 2 | ||||
-rw-r--r-- | commands/devinfo.c | 7 | ||||
-rw-r--r-- | commands/login.c | 2 | ||||
-rw-r--r-- | commands/memtest.c | 12 | ||||
-rw-r--r-- | drivers/mtd/devices/Kconfig | 3 | ||||
-rw-r--r-- | drivers/pci/pci.c | 44 | ||||
-rw-r--r-- | drivers/usb/musb/musb_core.c | 13 | ||||
-rw-r--r-- | include/asm-generic/barebox.lds.h | 3 | ||||
-rw-r--r-- | include/linux/clk.h | 2 | ||||
-rw-r--r-- | lib/gui/bmp.c | 11 | ||||
-rw-r--r-- | scripts/.gitignore | 1 | ||||
-rw-r--r-- | scripts/omap_signGP.c | 7 |
17 files changed, 85 insertions, 50 deletions
diff --git a/Documentation/boards/imx.rst b/Documentation/boards/imx.rst index ef1a6a507e..837bf5cf32 100644 --- a/Documentation/boards/imx.rst +++ b/Documentation/boards/imx.rst @@ -47,7 +47,7 @@ The images can also always be started second stage:: bootm /mnt/tftp/barebox-freescale-imx51-babbage.img Internal Boot Mode Through Internal RAM(IRAM) ---------------------------------------- +--------------------------------------------- The Internal Boot Mode Through Internal RAM is supported on: diff --git a/Documentation/devicetree/bindings/barebox/barebox,state.rst b/Documentation/devicetree/bindings/barebox/barebox,state.rst index 7156084c93..3d664f1f02 100644 --- a/Documentation/devicetree/bindings/barebox/barebox,state.rst +++ b/Documentation/devicetree/bindings/barebox/barebox,state.rst @@ -29,9 +29,6 @@ Required properties: * ``compatible``: should be ``barebox,state``; * ``magic``: A 32bit number used as a magic to identify the state - -Optional properties: - * ``backend``: describes where the data for this state is stored * ``backend-type``: should be ``raw`` or ``dtb``. @@ -42,9 +39,9 @@ These are subnodes of a state node each describing a single variable. The node name may end with ``@<ADDRESS>``, but the suffix is sripped from the variable name. -State variables have a type. Currenty supported types are: ``uint32``, -``enum32`` and ``mac`` address. Fixed length strings are planned but -not implemented. Variable length strings are not planned. +State variables have a type. Currenty supported types are: ``uint8``, +``uint32``, ``enum32`` and ``mac`` address. Fixed length strings are +planned but not implemented. Variable length strings are not planned. Required properties: @@ -52,8 +49,8 @@ Required properties: ``#size-cells = <1>``. Defines the ``offset`` and ``size`` of the variable in the ``raw`` backend. ``size`` must fit the node ``type``. Variables are not allowed to overlap. -* ``type``: Should be ``uint32``, ``enum32`` or ``mac`` for the type - of the variable +* ``type``: Should be ``uint8``, ``uint32``, ``enum32`` or ``mac`` for + the type of the variable * ``names``: For ``enum32`` values only, this specifies the values possible for ``enum32``. @@ -73,15 +70,15 @@ Example:: foo { reg = <0x00 0x4>; - type = "u32"; + type = "uint32"; default = <0x0>; }; bar { reg = <0x10 0x4>; - type = "enum32"; + type = "enum32"; names = "baz", "qux"; - default ="qux"; + default = <1>; }; }; diff --git a/Documentation/user/usb.rst b/Documentation/user/usb.rst index 0ff982bac4..9eb1437135 100644 --- a/Documentation/user/usb.rst +++ b/Documentation/user/usb.rst @@ -101,7 +101,7 @@ Android Fastboot support barebox has support for the android fastboot protocol. There is no dedicated command for initializing the fastboot protocol, instead it is integrated into the Multifunction -Composite Gadget, see :`ref:command_usbgadget` for a usage description. +Composite Gadget, see :ref:`command_usbgadget` for a usage description. The Fastboot gadget supports the following commands: @@ -1,5 +1,5 @@ VERSION = 2015 -PATCHLEVEL = 06 +PATCHLEVEL = 07 SUBLEVEL = 0 EXTRAVERSION = NAME = None diff --git a/arch/arm/boards/freescale-mx53-qsb/flash-header-imx53-loco.imxcfg b/arch/arm/boards/freescale-mx53-qsb/flash-header-imx53-loco.imxcfg index 95bcd19805..f43b484ee6 100644 --- a/arch/arm/boards/freescale-mx53-qsb/flash-header-imx53-loco.imxcfg +++ b/arch/arm/boards/freescale-mx53-qsb/flash-header-imx53-loco.imxcfg @@ -30,7 +30,7 @@ wm 32 0x63fd9090 0x4d444c44 wm 32 0x63fd907c 0x01370138 wm 32 0x63fd9080 0x013b013c wm 32 0x63fd9018 0x00011740 -wm 32 0x63fd9000 0xc3190000 +wm 32 0x63fd9000 0x83190000 wm 32 0x63fd900c 0x9f5152e3 wm 32 0x63fd9010 0xb68e8a63 wm 32 0x63fd9014 0x01ff00db @@ -43,6 +43,7 @@ wm 32 0x63fd901c 0x00008033 wm 32 0x63fd901c 0x00028031 wm 32 0x63fd901c 0x052080b0 wm 32 0x63fd901c 0x04008040 +wm 32 0x63fd9000 0xc3190000 wm 32 0x63fd901c 0x0000803a wm 32 0x63fd901c 0x0000803b wm 32 0x63fd901c 0x00028039 diff --git a/arch/arm/cpu/start.c b/arch/arm/cpu/start.c index 304ed0cee7..91fd9b987b 100644 --- a/arch/arm/cpu/start.c +++ b/arch/arm/cpu/start.c @@ -61,6 +61,8 @@ static noinline __noreturn void __start(unsigned long membase, setup_c(); + barrier(); + pr_debug("memory at 0x%08lx, size 0x%08lx\n", membase, memsize); barebox_boarddata = boarddata; diff --git a/commands/devinfo.c b/commands/devinfo.c index e61aaa24e8..3c9d6a6b9d 100644 --- a/commands/devinfo.c +++ b/commands/devinfo.c @@ -68,11 +68,8 @@ static int do_devinfo(int argc, char *argv[]) } } else { dev = get_device_by_name(argv[1]); - - if (!dev) { - printf("no such device: %s\n",argv[1]); - return -1; - } + if (!dev) + return -ENODEV; if (dev->num_resources) printf("Resources:\n"); diff --git a/commands/login.c b/commands/login.c index 210eb203ac..bf5085c854 100644 --- a/commands/login.c +++ b/commands/login.c @@ -71,7 +71,7 @@ static int do_login(int argc, char *argv[]) run_command(timeout_cmd); } - if (check_passwd(passwd, passwd_len)) + if (check_passwd(passwd, passwd_len) == 1) return 0; } while(1); diff --git a/commands/memtest.c b/commands/memtest.c index 9dec0efcba..756123001a 100644 --- a/commands/memtest.c +++ b/commands/memtest.c @@ -62,9 +62,11 @@ static int request_memtest_regions(struct list_head *list) start = PAGE_ALIGN(bank->res->start); size = PAGE_ALIGN_DOWN(bank->res->end - start + 1); - ret = alloc_memtest_region(list, start, size); - if (ret < 0) - return ret; + if (size) { + ret = alloc_memtest_region(list, start, size); + if (ret < 0) + return ret; + } continue; } @@ -95,6 +97,8 @@ static int request_memtest_regions(struct list_head *list) continue; size = PAGE_ALIGN_DOWN(end - start + 1); + if (size == 0) + continue; ret = alloc_memtest_region(list, start, size); if (ret < 0) return ret; @@ -108,7 +112,7 @@ static int request_memtest_regions(struct list_head *list) start = PAGE_ALIGN(r->end); end = bank->res->end; size = PAGE_ALIGN_DOWN(end - start + 1); - if (start < end && start > r->end) { + if (size && start < end && start > r->end) { ret = alloc_memtest_region(list, start, size); if (ret < 0) return ret; diff --git a/drivers/mtd/devices/Kconfig b/drivers/mtd/devices/Kconfig index 345c348c69..9c3925bde1 100644 --- a/drivers/mtd/devices/Kconfig +++ b/drivers/mtd/devices/Kconfig @@ -21,7 +21,8 @@ config MTD_DATAFLASH_WRITE_VERIFY config MTD_M25P80 tristate "Support most SPI Flash chips (AT26DF, M25P, W25X, ...)" - depends on MTD_SPI_NOR + depends on SPI + select MTD_SPI_NOR help This enables access to most modern SPI flash chips, used for program and data storage. Series supported include Atmel AT26DF, diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 3a0e7a5f4e..191561da03 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -129,10 +129,24 @@ static struct pci_dev *alloc_pci_dev(void) return dev; } +static u32 pci_size(u32 base, u32 maxbase, u32 mask) +{ + u32 size = maxbase & mask; + if (!size) + return 0; + + size = (size & ~(size-1)) - 1; + + if (base == maxbase && ((base | size) & mask) != mask) + return 0; + + return size + 1; +} + + static void setup_device(struct pci_dev *dev, int max_bar) { - int bar, size; - u32 mask; + int bar; u8 cmd; pci_read_config_byte(dev, PCI_COMMAND, &cmd); @@ -141,9 +155,12 @@ static void setup_device(struct pci_dev *dev, int max_bar) for (bar = 0; bar < max_bar; bar++) { resource_size_t last_addr; + u32 orig, mask, size; + pci_read_config_dword(dev, PCI_BASE_ADDRESS_0 + bar * 4, &orig); pci_write_config_dword(dev, PCI_BASE_ADDRESS_0 + bar * 4, 0xfffffffe); pci_read_config_dword(dev, PCI_BASE_ADDRESS_0 + bar * 4, &mask); + pci_write_config_dword(dev, PCI_BASE_ADDRESS_0 + bar * 4, orig); if (mask == 0 || mask == 0xffffffff) { pr_debug("pbar%d set bad mask\n", bar); @@ -151,7 +168,11 @@ static void setup_device(struct pci_dev *dev, int max_bar) } if (mask & 0x01) { /* IO */ - size = ((~(mask & 0xfffffffe)) & 0xffff) + 1; + size = pci_size(orig, mask, 0xfffffffe); + if (!size) { + pr_debug("pbar%d bad IO mask\n", bar); + continue; + } pr_debug("pbar%d: mask=%08x io %d bytes\n", bar, mask, size); if (last_io + size > dev->bus->resource[PCI_BUS_RESOURCE_IO]->end) { @@ -164,7 +185,11 @@ static void setup_device(struct pci_dev *dev, int max_bar) last_io += size; } else if ((mask & PCI_BASE_ADDRESS_MEM_PREFETCH) && last_mem_pref) /* prefetchable MEM */ { - size = (~(mask & 0xfffffff0)) + 1; + size = pci_size(orig, mask, 0xfffffff0); + if (!size) { + pr_debug("pbar%d bad P-MEM mask\n", bar); + continue; + } pr_debug("pbar%d: mask=%08x P memory %d bytes\n", bar, mask, size); if (last_mem_pref + size > @@ -178,7 +203,11 @@ static void setup_device(struct pci_dev *dev, int max_bar) last_addr = last_mem_pref; last_mem_pref += size; } else { /* non-prefetch MEM */ - size = (~(mask & 0xfffffff0)) + 1; + size = pci_size(orig, mask, 0xfffffff0); + if (!size) { + pr_debug("pbar%d bad NP-MEM mask\n", bar); + continue; + } pr_debug("pbar%d: mask=%08x NP memory %d bytes\n", bar, mask, size); if (last_mem + size > @@ -391,11 +420,6 @@ unsigned int pci_scan_bus(struct pci_bus *bus) bus->number, dev->devfn, dev->vendor, dev->device, class, hdr_type); continue; } - - if (class == PCI_CLASS_BRIDGE_HOST) { - pr_debug("skip pci host bridge\n"); - continue; - } } /* diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index ccb702980f..84a05c4f96 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -119,8 +119,6 @@ MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_LICENSE("GPL"); MODULE_ALIAS("platform:" MUSB_DRIVER_NAME); -#define MUSB_HOST_TIMEOUT 0x5fffff - /*-------------------------------------------------------------------------*/ #ifndef CONFIG_BLACKFIN @@ -1025,17 +1023,18 @@ int musb_init(struct usb_host *host) { struct musb *musb = to_musb(host); void *mbase; - int timeout = MUSB_HOST_TIMEOUT; + u64 start; u8 power; musb_start(musb); mbase = musb->mregs; - do { + start = get_time_ns(); + while (1) { if (musb_readb(mbase, MUSB_DEVCTL) & MUSB_DEVCTL_HM) break; - } while (--timeout); - if (!timeout) - return -ENODEV; + if (is_timeout(start, 4 * SECOND)) + return -ENODEV; + } power = musb_readb(mbase, MUSB_POWER); musb_writeb(mbase, MUSB_POWER, MUSB_POWER_RESET | power); diff --git a/include/asm-generic/barebox.lds.h b/include/asm-generic/barebox.lds.h index 254397ee97..00d6ecaf54 100644 --- a/include/asm-generic/barebox.lds.h +++ b/include/asm-generic/barebox.lds.h @@ -47,7 +47,8 @@ #define BAREBOX_CLK_TABLE() \ . = ALIGN(8); \ __clk_of_table_start = .; \ - KEEP(*(.__clk_of_table_*)); \ + KEEP(*(.__clk_of_table)); \ + KEEP(*(.__clk_of_table_end)); \ __clk_of_table_end = .; #define BAREBOX_DTB() \ diff --git a/include/linux/clk.h b/include/linux/clk.h index 4aeec63a84..7a0ee110e4 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h @@ -321,7 +321,7 @@ struct of_phandle_args; #define CLK_OF_DECLARE(name, compat, fn) \ const struct of_device_id __clk_of_table_##name \ -__attribute__ ((unused,section (".__clk_of_table_" __stringify(name)))) \ +__attribute__ ((unused,section (".__clk_of_table"))) \ = { .compatible = compat, .data = fn } #if defined(CONFIG_OFTREE) && defined(CONFIG_COMMON_CLK_OF_PROVIDER) diff --git a/lib/gui/bmp.c b/lib/gui/bmp.c index 6943a1c8e0..d457c01d84 100644 --- a/lib/gui/bmp.c +++ b/lib/gui/bmp.c @@ -7,6 +7,7 @@ #include <gui/graphic_utils.h> #include <init.h> #include <gui/image_renderer.h> +#include <asm/unaligned.h> struct image *bmp_open(char *inbuf, int insize) { @@ -19,9 +20,9 @@ struct image *bmp_open(char *inbuf, int insize) } img->data = inbuf; - img->height = le32_to_cpu(bmp->header.height); - img->width = le32_to_cpu(bmp->header.width); - img->bits_per_pixel = le16_to_cpu(bmp->header.bit_count); + img->height = get_unaligned_le32(&bmp->header.height); + img->width = get_unaligned_le32(&bmp->header.width); + img->bits_per_pixel = get_unaligned_le16(&bmp->header.bit_count); pr_debug("bmp: %d x %d x %d data@0x%p\n", img->width, img->height, img->bits_per_pixel, img->data); @@ -76,7 +77,7 @@ static int bmp_renderer(struct screen *sc, struct surface *s, struct image *img) for (y = 0; y < height; y++) { image = (char *)bmp + - le32_to_cpu(bmp->header.data_offset); + get_unaligned_le32(&bmp->header.data_offset); image += (img->height - y - 1) * img->width * (bits_per_pixel >> 3); adr = buf + (y + starty) * sc->info.line_length + startx * (sc->info.bits_per_pixel >> 3); @@ -98,7 +99,7 @@ static int bmp_renderer(struct screen *sc, struct surface *s, struct image *img) for (y = 0; y < height; y++) { image = (char *)bmp + - le32_to_cpu(bmp->header.data_offset); + get_unaligned_le32(&bmp->header.data_offset); image += (img->height - y - 1) * img->width * (bits_per_pixel >> 3); adr = buf + (y + starty) * sc->info.line_length + startx * (sc->info.bits_per_pixel >> 3); diff --git a/scripts/.gitignore b/scripts/.gitignore index 6203589fe3..533bffd97d 100644 --- a/scripts/.gitignore +++ b/scripts/.gitignore @@ -24,3 +24,4 @@ bareboxstate-target mk-am35xx-spi-image mxsimage mxsboot +mxs-usb-loader diff --git a/scripts/omap_signGP.c b/scripts/omap_signGP.c index 482cfac925..ac47fdf089 100644 --- a/scripts/omap_signGP.c +++ b/scripts/omap_signGP.c @@ -317,8 +317,15 @@ int main(int argc, char *argv[]) if (fwrite(&config_header, 1, 512, ofile) <= 0) pdie("fwrite"); + /* The size field in the header needs to include the + * size of the gp_header */ + len += sizeof(struct gp_header); + if (fwrite(&len, 1, 4, ofile) <= 0) pdie("fwrite"); + + len -= sizeof(struct gp_header); + if (fwrite(&loadaddr, 1, 4, ofile) <= 0) pdie("fwrite"); for (i = 0; i < len; i++) { |