summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2020-03-18 08:48:17 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2020-03-18 08:48:17 +0100
commit8c02f14d1db16068a005b9674da42f14f344ab89 (patch)
treeb57b9d55789ab59e63436ff70f569db06c228f50
parent52ef5245746cb13d1eaf9d520d9e7a36d2a70d4b (diff)
parent544bd2f460da25de41094aceadb799ca31474d97 (diff)
downloadbarebox-8c02f14d1db16068a005b9674da42f14f344ab89.tar.gz
Merge branch 'for-next/misc'
-rw-r--r--Makefile38
-rw-r--r--arch/arm/boards/vscom-baltos/lowlevel.c6
-rw-r--r--arch/arm/configs/imx23_defconfig1
-rw-r--r--arch/arm/configs/imx28_defconfig1
-rw-r--r--arch/arm/configs/imx_v7_defconfig1
-rw-r--r--arch/arm/configs/kindle-mx50_defconfig1
-rw-r--r--arch/arm/configs/omap_defconfig1
-rw-r--r--arch/arm/configs/zii_vf610_dev_defconfig1
-rw-r--r--arch/mips/Makefile6
-rw-r--r--arch/mips/pbl/Makefile2
-rw-r--r--arch/sandbox/Makefile4
-rw-r--r--arch/x86/Makefile4
-rw-r--r--common/state/backend_storage.c2
-rw-r--r--common/state/state.c7
-rw-r--r--drivers/net/designware_eqos.c33
-rw-r--r--drivers/net/designware_eqos.h1
-rw-r--r--drivers/net/designware_stm32.c1
-rw-r--r--drivers/net/designware_tegra186.c1
-rw-r--r--drivers/of/overlay.c20
-rw-r--r--drivers/usb/gadget/Kconfig11
-rw-r--r--drivers/usb/gadget/f_fastboot.c4
-rw-r--r--drivers/usb/host/ehci-hcd.c101
-rw-r--r--drivers/video/ssd1307fb.c63
-rw-r--r--firmware/Makefile3
-rw-r--r--images/Makefile4
-rw-r--r--include/linux/reset.h6
-rw-r--r--include/usb/usb.h4
-rw-r--r--scripts/bareboximd.c2
28 files changed, 178 insertions, 151 deletions
diff --git a/Makefile b/Makefile
index fe7da86..3b42769 100644
--- a/Makefile
+++ b/Makefile
@@ -583,19 +583,17 @@ export DEFAULT_COMPRESSION_SUFFIX
#
# System.map is generated to document addresses of all kernel symbols
-barebox-common := $(common-y)
-barebox-pbl-common := $(pbl-common-y)
-export barebox-pbl-common
-barebox-all := $(barebox-common)
-barebox-lds := $(lds-y)
+BAREBOX_OBJS := $(common-y)
+export BAREBOX_PBL_OBJS := $(pbl-common-y)
+BAREBOX_LDS := $(lds-y)
# Rule to link barebox
# May be overridden by arch/$(ARCH)/Makefile
quiet_cmd_barebox__ ?= LD $@
cmd_barebox__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_barebox) -o $@ \
- -T $(barebox-lds) \
- --start-group $(barebox-common) --end-group \
- $(filter-out $(barebox-lds) $(barebox-common) FORCE ,$^)
+ -T $(BAREBOX_LDS) \
+ --start-group $(BAREBOX_OBJS) --end-group \
+ $(filter-out $(BAREBOX_LDS) $(BAREBOX_OBJS) FORCE ,$^)
# Generate new barebox version
quiet_cmd_barebox_version = GEN .version
@@ -692,13 +690,13 @@ quiet_cmd_kallsyms = KSYM $@
$(call cmd,kallsyms)
# .tmp_barebox1 must be complete except kallsyms, so update barebox version
-.tmp_barebox1: $(barebox-lds) $(barebox-all) FORCE
+.tmp_barebox1: $(BAREBOX_LDS) $(BAREBOX_OBJS) FORCE
$(call if_changed_rule,ksym_ld)
-.tmp_barebox2: $(barebox-lds) $(barebox-all) .tmp_kallsyms1.o FORCE
+.tmp_barebox2: $(BAREBOX_LDS) $(BAREBOX_OBJS) .tmp_kallsyms1.o FORCE
$(call if_changed,barebox__)
-.tmp_barebox3: $(barebox-lds) $(barebox-all) .tmp_kallsyms2.o FORCE
+.tmp_barebox3: $(BAREBOX_LDS) $(BAREBOX_OBJS) .tmp_kallsyms2.o FORCE
$(call if_changed,barebox__)
# Needs to visit scripts/ before $(KALLSYMS) can be used.
@@ -716,19 +714,6 @@ debug_kallsyms: .tmp_map$(last_kallsyms)
endif # ifdef CONFIG_KALLSYMS
-# Do modpost on a prelinked vmlinux. The finally linked vmlinux has
-# relevant sections renamed as per the linker script.
-quiet_cmd_barebox-modpost = LD $@
- cmd_barebox-modpost = $(LD) $(LDFLAGS) -r -o $@ \
- $(vmlinux-init) --start-group $(barebox-main) --end-group \
- $(filter-out $(barebox-init) $(barebox-main) $(barebox-lds) FORCE ,$^)
-define rule_barebox-modpost
- :
- +$(call cmd,barebox-modpost)
- $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost $@
- $(Q)echo 'cmd_$@ := $(cmd_barebox-modpost)' > $(dot-target).cmd
-endef
-
OBJCOPYFLAGS_barebox.bin = -O binary
barebox.bin: barebox FORCE
@@ -781,8 +766,7 @@ barebox.S barebox.s: barebox FORCE
endif
# barebox image
-barebox: $(barebox-lds) $(barebox-head) $(barebox-common) $(kallsyms.o) FORCE
- $(call barebox-modpost)
+barebox: $(BAREBOX_LDS) $(BAREBOX_OBJS) $(kallsyms.o) FORCE
$(call if_changed_rule,barebox__)
$(Q)rm -f .old_version
@@ -791,7 +775,7 @@ barebox.srec: barebox
# The actual objects are generated when descending,
# make sure no implicit rule kicks in
-$(sort $(barebox-head) $(barebox-common) ) $(barebox-lds) $(barebox-pbl-common): $(barebox-dirs) ;
+$(sort $(BAREBOX_OBJS)) $(BAREBOX_LDS) $(BAREBOX_PBL_OBJS): $(barebox-dirs) ;
# Handle descending into subdirectories listed in $(barebox-dirs)
# Preset locale variables to speed up the build process. Limit locale
diff --git a/arch/arm/boards/vscom-baltos/lowlevel.c b/arch/arm/boards/vscom-baltos/lowlevel.c
index 98bbbaa..0a220f2 100644
--- a/arch/arm/boards/vscom-baltos/lowlevel.c
+++ b/arch/arm/boards/vscom-baltos/lowlevel.c
@@ -66,7 +66,7 @@ static const struct am33xx_emif_regs ddr3_regs_256mb = {
};
-extern char __dtb_am335x_baltos_minimal_start[];
+extern char __dtb_z_am335x_baltos_minimal_start[];
/**
* @brief The basic entry point for board initialization.
@@ -82,7 +82,7 @@ static noinline void baltos_sram_init(void)
uint32_t sdram_size;
void *fdt;
- fdt = __dtb_am335x_baltos_minimal_start;
+ fdt = __dtb_z_am335x_baltos_minimal_start;
/* WDT1 is already running when the bootloader gets control
* Disable it to avoid "random" resets
@@ -132,7 +132,7 @@ ENTRY_FUNCTION(start_am33xx_baltos_sdram, r0, r1, r2)
*/
__raw_writel(0x000010ff, AM33XX_PRM_RSTTIME);
- fdt = __dtb_am335x_baltos_minimal_start;
+ fdt = __dtb_z_am335x_baltos_minimal_start;
fdt += get_runtime_offset();
diff --git a/arch/arm/configs/imx23_defconfig b/arch/arm/configs/imx23_defconfig
index 26c6381..bff9c08 100644
--- a/arch/arm/configs/imx23_defconfig
+++ b/arch/arm/configs/imx23_defconfig
@@ -90,6 +90,7 @@ CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_DFU=y
CONFIG_USB_GADGET_SERIAL=y
CONFIG_USB_GADGET_FASTBOOT=y
+CONFIG_USB_GADGET_FASTBOOT_CMD_OEM=y
CONFIG_VIDEO=y
CONFIG_DRIVER_VIDEO_STM=y
CONFIG_MCI=y
diff --git a/arch/arm/configs/imx28_defconfig b/arch/arm/configs/imx28_defconfig
index 58cda93..1acc8dd 100644
--- a/arch/arm/configs/imx28_defconfig
+++ b/arch/arm/configs/imx28_defconfig
@@ -93,6 +93,7 @@ CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_DFU=y
CONFIG_USB_GADGET_SERIAL=y
CONFIG_USB_GADGET_FASTBOOT=y
+CONFIG_USB_GADGET_FASTBOOT_CMD_OEM=y
CONFIG_VIDEO=y
CONFIG_DRIVER_VIDEO_STM=y
CONFIG_MCI=y
diff --git a/arch/arm/configs/imx_v7_defconfig b/arch/arm/configs/imx_v7_defconfig
index 8b8178a..5bf908e 100644
--- a/arch/arm/configs/imx_v7_defconfig
+++ b/arch/arm/configs/imx_v7_defconfig
@@ -160,6 +160,7 @@ CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_DFU=y
CONFIG_USB_GADGET_SERIAL=y
CONFIG_USB_GADGET_FASTBOOT=y
+CONFIG_USB_GADGET_FASTBOOT_CMD_OEM=y
CONFIG_VIDEO=y
CONFIG_DRIVER_VIDEO_IMX_IPUV3=y
CONFIG_DRIVER_VIDEO_IMX_IPUV3_LVDS=y
diff --git a/arch/arm/configs/kindle-mx50_defconfig b/arch/arm/configs/kindle-mx50_defconfig
index 95b505f..855daef 100644
--- a/arch/arm/configs/kindle-mx50_defconfig
+++ b/arch/arm/configs/kindle-mx50_defconfig
@@ -50,6 +50,7 @@ CONFIG_USB_EHCI=y
CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_SERIAL=y
CONFIG_USB_GADGET_FASTBOOT=y
+CONFIG_USB_GADGET_FASTBOOT_CMD_OEM=y
CONFIG_MCI=y
CONFIG_MCI_STARTUP=y
CONFIG_MCI_MMC_BOOT_PARTITIONS=y
diff --git a/arch/arm/configs/omap_defconfig b/arch/arm/configs/omap_defconfig
index ba90158..9d71d02 100644
--- a/arch/arm/configs/omap_defconfig
+++ b/arch/arm/configs/omap_defconfig
@@ -121,6 +121,7 @@ CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_DFU=y
CONFIG_USB_GADGET_SERIAL=y
CONFIG_USB_GADGET_FASTBOOT=y
+CONFIG_USB_GADGET_FASTBOOT_CMD_OEM=y
CONFIG_USB_MUSB=y
CONFIG_USB_MUSB_AM335X=y
CONFIG_USB_MUSB_HOST=y
diff --git a/arch/arm/configs/zii_vf610_dev_defconfig b/arch/arm/configs/zii_vf610_dev_defconfig
index c9aa60c..7161d74 100644
--- a/arch/arm/configs/zii_vf610_dev_defconfig
+++ b/arch/arm/configs/zii_vf610_dev_defconfig
@@ -113,6 +113,7 @@ CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_DFU=y
CONFIG_USB_GADGET_SERIAL=y
CONFIG_USB_GADGET_FASTBOOT=y
+CONFIG_USB_GADGET_FASTBOOT_CMD_OEM=y
CONFIG_MCI=y
CONFIG_MCI_MMC_BOOT_PARTITIONS=y
CONFIG_MCI_IMX_ESDHC=y
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 486dfd8..ee3364d 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -118,9 +118,9 @@ CFLAGS += $(cflags-y)
lds-$(CONFIG_GENERIC_LINKER_SCRIPT) := arch/mips/lib/barebox.lds
cmd_barebox__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_barebox) -o $@ \
- -T $(barebox-lds) \
- --start-group $(barebox-common) --end-group \
- $(filter-out $(barebox-lds) $(barebox-common) FORCE ,$^); \
+ -T $(BAREBOX_LDS) \
+ --start-group $(BAREBOX_OBJS) --end-group \
+ $(filter-out $(BAREBOX_LDS) $(BAREBOX_OBJS) FORCE ,$^); \
$(objtree)/scripts/mips-relocs $@
diff --git a/arch/mips/pbl/Makefile b/arch/mips/pbl/Makefile
index 44ce3d1..8f9e9fe 100644
--- a/arch/mips/pbl/Makefile
+++ b/arch/mips/pbl/Makefile
@@ -25,7 +25,7 @@ $(obj)/zbarebox.S: $(obj)/zbarebox FORCE
PBL_CPPFLAGS += -fdata-sections -ffunction-sections
LDFLAGS_zbarebox := -Map $(obj)/zbarebox.map
LDFLAGS_zbarebox += -static --gc-sections
-zbarebox-common := $(barebox-pbl-common) $(obj)/$(piggy_o)
+zbarebox-common := $(BAREBOX_PBL_OBJS) $(obj)/$(piggy_o)
zbarebox-lds := $(obj)/zbarebox.lds
quiet_cmd_zbarebox__ ?= LD $@
diff --git a/arch/sandbox/Makefile b/arch/sandbox/Makefile
index b127560..b7470c3 100644
--- a/arch/sandbox/Makefile
+++ b/arch/sandbox/Makefile
@@ -56,8 +56,8 @@ ifeq ($(CONFIG_UBSAN),y)
SANITIZER_LIBS += -fsanitize=undefined
endif
-cmd_barebox__ = $(CC) -o $@ -Wl,-T,$(barebox-lds) \
- -Wl,--start-group $(barebox-common) -Wl,--end-group \
+cmd_barebox__ = $(CC) -o $@ -Wl,-T,$(BAREBOX_LDS) \
+ -Wl,--start-group $(BAREBOX_OBJS) -Wl,--end-group \
-lrt -lpthread $(SDL_LIBS) $(FTDI1_LIBS) \
$(SANITIZER_LIBS)
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 0751e63..4d471c2 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -77,9 +77,9 @@ lds-$(CONFIG_X86_64) := arch/x86/mach-efi/elf_x86_64_efi.lds
cmd_barebox__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_barebox) -o $@ \
-T $(lds-y) \
-shared -Bsymbolic -nostdlib -znocombreloc \
- --start-group $(barebox-common) \
+ --start-group $(BAREBOX_OBJS) \
--end-group \
- $(filter-out $(barebox-lds) $(barebox-common) FORCE ,$^)
+ $(filter-out $(BAREBOX_LDS) $(BAREBOX_OBJS) FORCE ,$^)
quiet_cmd_efi_image = EFI-IMG $@
cmd_efi_image = $(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic \
diff --git a/common/state/backend_storage.c b/common/state/backend_storage.c
index fca887e..fe7e89e 100644
--- a/common/state/backend_storage.c
+++ b/common/state/backend_storage.c
@@ -192,6 +192,7 @@ int state_storage_read(struct state_backend_storage *storage,
/* Free buffer from the unused buckets */
free(bucket->buf);
bucket->buf = NULL;
+ bucket->len = 0;
}
/*
@@ -204,6 +205,7 @@ int state_storage_read(struct state_backend_storage *storage,
/* buffer from the used bucket is passed to the caller, do not free */
bucket_used->buf = NULL;
+ bucket_used->len = 0;
return 0;
}
diff --git a/common/state/state.c b/common/state/state.c
index b168387..1822f37 100644
--- a/common/state/state.c
+++ b/common/state/state.c
@@ -94,7 +94,7 @@ out:
*/
static int state_do_load(struct state *state, enum state_flags flags)
{
- void *buf;
+ void *buf = NULL;
ssize_t len;
int ret;
@@ -103,7 +103,7 @@ static int state_do_load(struct state *state, enum state_flags flags)
if (ret) {
dev_err(&state->dev, "Failed to read state with format %s, %d\n",
state->format->name, ret);
- return ret;
+ goto out;
}
ret = state->format->unpack(state->format, state, buf, len);
@@ -114,9 +114,8 @@ static int state_do_load(struct state *state, enum state_flags flags)
}
state->init_from_defaults = 0;
- state->dirty = 0;
-
out:
+ state->dirty = !!ret; /* mark dirty on error */
free(buf);
return ret;
}
diff --git a/drivers/net/designware_eqos.c b/drivers/net/designware_eqos.c
index 4ae07fe..cb52f39 100644
--- a/drivers/net/designware_eqos.c
+++ b/drivers/net/designware_eqos.c
@@ -199,7 +199,7 @@ static int eqos_mdio_wait_idle(struct eqos *eqos)
static int eqos_mdio_read(struct mii_bus *bus, int addr, int reg)
{
struct eqos *eqos = bus->priv;
- u32 miiaddr;
+ u32 miiaddr = MII_BUSY;
int ret;
ret = eqos_mdio_wait_idle(eqos);
@@ -208,18 +208,13 @@ static int eqos_mdio_read(struct mii_bus *bus, int addr, int reg)
return ret;
}
- miiaddr = readl(&eqos->mac_regs->mdio_address);
- miiaddr &= EQOS_MDIO_ADDR_SKAP | EQOS_MDIO_ADDR_C45E;
- miiaddr |= EQOS_MDIO_ADDR_GOC_READ << EQOS_MDIO_ADDR_GOC_SHIFT;
-
- miiaddr |= EQOS_MDIO_CLK_CSR(eqos->ops->clk_csr);
miiaddr |= EQOS_MDIO_ADDR(addr) | EQOS_MDIO_REG(reg);
- miiaddr |= MII_BUSY;
+ miiaddr |= EQOS_MDIO_CLK_CSR(eqos->ops->clk_csr);
+ miiaddr |= EQOS_MDIO_ADDR_GOC_READ << EQOS_MDIO_ADDR_GOC_SHIFT;
+ writel(0, &eqos->mac_regs->mdio_data);
writel(miiaddr, &eqos->mac_regs->mdio_address);
- udelay(eqos->ops->mdio_wait_us);
-
ret = eqos_mdio_wait_idle(eqos);
if (ret) {
dev_err(&bus->dev, "MDIO read didn't complete\n");
@@ -232,7 +227,7 @@ static int eqos_mdio_read(struct mii_bus *bus, int addr, int reg)
static int eqos_mdio_write(struct mii_bus *bus, int addr, int reg, u16 data)
{
struct eqos *eqos = bus->priv;
- u32 miiaddr = 0;
+ u32 miiaddr = MII_BUSY;
int ret;
ret = eqos_mdio_wait_idle(eqos);
@@ -241,28 +236,18 @@ static int eqos_mdio_write(struct mii_bus *bus, int addr, int reg, u16 data)
return ret;
}
- miiaddr = readl(&eqos->mac_regs->mdio_address);
- miiaddr &= EQOS_MDIO_ADDR_SKAP | EQOS_MDIO_ADDR_C45E;
- miiaddr |= EQOS_MDIO_ADDR_GOC_WRITE << EQOS_MDIO_ADDR_GOC_SHIFT;
-
- miiaddr |= EQOS_MDIO_CLK_CSR(eqos->ops->clk_csr);
miiaddr |= EQOS_MDIO_ADDR(addr) | EQOS_MDIO_REG(reg);
- miiaddr |= MII_BUSY;
+ miiaddr |= EQOS_MDIO_CLK_CSR(eqos->ops->clk_csr);
+ miiaddr |= EQOS_MDIO_ADDR_GOC_WRITE << EQOS_MDIO_ADDR_GOC_SHIFT;
writel(data, &eqos->mac_regs->mdio_data);
writel(miiaddr, &eqos->mac_regs->mdio_address);
- udelay(eqos->ops->mdio_wait_us);
-
ret = eqos_mdio_wait_idle(eqos);
- if (ret) {
+ if (ret)
dev_err(&bus->dev, "MDIO read didn't complete\n");
- return ret;
- }
- /* Needed as a fix for ST-Phy */
- eqos_mdio_read(bus, addr, reg);
- return 0;
+ return ret;
}
diff --git a/drivers/net/designware_eqos.h b/drivers/net/designware_eqos.h
index f794195..30f4f02 100644
--- a/drivers/net/designware_eqos.h
+++ b/drivers/net/designware_eqos.h
@@ -17,7 +17,6 @@ struct eqos_ops {
unsigned long (*get_csr_clk_rate)(struct eqos *);
bool enh_desc;
- int mdio_wait_us;
#define EQOS_MAC_RXQ_CTRL0_RXQ0EN_SHIFT 0
#define EQOS_MAC_RXQ_CTRL0_RXQ0EN_MASK 3
diff --git a/drivers/net/designware_stm32.c b/drivers/net/designware_stm32.c
index 1e0cdfa..2e2af89 100644
--- a/drivers/net/designware_stm32.c
+++ b/drivers/net/designware_stm32.c
@@ -180,7 +180,6 @@ static struct eqos_ops stm32_ops = {
.adjust_link = eqos_adjust_link,
.get_csr_clk_rate = eqos_get_csr_clk_rate_stm32,
- .mdio_wait_us = 10 * USEC_PER_MSEC,
.clk_csr = EQOS_MDIO_ADDR_CR_250_300,
.config_mac = EQOS_MAC_RXQ_CTRL0_RXQ0EN_ENABLED_AV,
};
diff --git a/drivers/net/designware_tegra186.c b/drivers/net/designware_tegra186.c
index 20521db..5348f65 100644
--- a/drivers/net/designware_tegra186.c
+++ b/drivers/net/designware_tegra186.c
@@ -280,7 +280,6 @@ static const struct eqos_ops tegra186_ops = {
.adjust_link = eqos_adjust_link_tegra186,
.get_csr_clk_rate = eqos_get_csr_clk_rate_tegra186,
- .mdio_wait_us = 10,
.clk_csr = EQOS_MDIO_ADDR_CR_20_35,
.config_mac = EQOS_MAC_RXQ_CTRL0_RXQ0EN_ENABLED_DCB,
};
diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
index de79e05..a35eddf 100644
--- a/drivers/of/overlay.c
+++ b/drivers/of/overlay.c
@@ -105,7 +105,7 @@ static char *of_overlay_fix_path(struct device_node *root,
return basprintf("%s%s", target->full_name, path_tail);
}
-static int of_overlay_apply_symbols(struct device_node *root,
+static void of_overlay_apply_symbols(struct device_node *root,
struct device_node *overlay)
{
const char *old_path;
@@ -115,12 +115,12 @@ static int of_overlay_apply_symbols(struct device_node *root,
struct device_node *overlay_symbols;
root_symbols = of_get_child_by_name(root, "__symbols__");
- if (!root_symbols)
- return -EINVAL;
-
overlay_symbols = of_get_child_by_name(overlay, "__symbols__");
- if (!overlay_symbols)
- return -EINVAL;
+
+ if (!overlay_symbols || !root_symbols) {
+ pr_info("overlay/root doesn't have a __symbols__ node\n");
+ return;
+ }
list_for_each_entry(prop, &overlay_symbols->properties, list) {
if (of_prop_cmp(prop->name, "name") == 0)
@@ -133,8 +133,6 @@ static int of_overlay_apply_symbols(struct device_node *root,
prop->name, new_path);
of_property_write_string(root_symbols, prop->name, new_path);
}
-
- return 0;
}
static int of_overlay_apply_fragment(struct device_node *root,
@@ -171,15 +169,13 @@ int of_overlay_apply_tree(struct device_node *root,
return -EINVAL;
/* Copy symbols from resolved overlay to base device tree */
- err = of_overlay_apply_symbols(root, resolved);
- if (err)
- pr_warn("failed to copy symbols from overlay");
+ of_overlay_apply_symbols(root, resolved);
/* Copy nodes and properties from resolved overlay to root */
for_each_child_of_node(resolved, fragment) {
err = of_overlay_apply_fragment(root, fragment);
if (err)
- pr_warn("failed to apply %s", fragment->name);
+ pr_warn("failed to apply %s\n", fragment->name);
}
of_delete_node(resolved);
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 3c1d7e6..6e60c7a 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -61,6 +61,7 @@ config USB_GADGET_FASTBOOT
config USB_GADGET_FASTBOOT_SPARSE
bool
+ depends on USB_GADGET_FASTBOOT
select IMAGE_SPARSE
prompt "Enable Fastboot sparse image support"
help
@@ -80,4 +81,14 @@ config USB_GADGET_FASTBOOT_BUF
a buffer, then using a buffer might be better.
Say no here unless you know what you are doing.
+
+config USB_GADGET_FASTBOOT_CMD_OEM
+ bool
+ depends on USB_GADGET_FASTBOOT
+ prompt "Enable OEM commands"
+ help
+ This option enables the fastboot "oem" group of commands. They allow to
+ executing arbitrary barebox commands and may be disabled in secure
+ environments.
+
endif
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 426ee9d..cf3cc6d 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -1253,7 +1253,7 @@ static const struct cmd_dispatch_info cmd_oem_dispatch_info[] = {
},
};
-static void cb_oem(struct f_fastboot *f_fb, const char *cmd)
+static void __maybe_unused cb_oem(struct f_fastboot *f_fb, const char *cmd)
{
pr_debug("%s: \"%s\"\n", __func__, cmd);
@@ -1281,9 +1281,11 @@ static const struct cmd_dispatch_info cmd_dispatch_info[] = {
}, {
.cmd = "erase:",
.cb = cb_erase,
+#if defined(CONFIG_USB_GADGET_FASTBOOT_CMD_OEM)
}, {
.cmd = "oem ",
.cb = cb_oem,
+#endif
},
};
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 417ae5d..ead63b2 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -42,7 +42,9 @@ struct ehci_host {
struct ehci_hcor *hcor;
struct usb_host host;
struct QH *qh_list;
+ dma_addr_t qh_list_dma;
struct qTD *td;
+ dma_addr_t td_dma;
int portreset;
unsigned long flags;
@@ -51,7 +53,9 @@ struct ehci_host {
void *drvdata;
int periodic_schedules;
struct QH *periodic_queue;
+ dma_addr_t periodic_queue_dma;
uint32_t *periodic_list;
+ dma_addr_t periodic_list_dma;
};
struct int_queue {
@@ -59,9 +63,11 @@ struct int_queue {
int queuesize;
unsigned long pipe;
struct QH *first;
+ dma_addr_t first_dma;
struct QH *current;
struct QH *last;
struct qTD *tds;
+ dma_addr_t tds_dma;
};
#define to_ehci(ptr) container_of(ptr, struct ehci_host, host)
@@ -137,6 +143,29 @@ static struct descriptor {
#define ehci_is_TDI() (ehci->flags & EHCI_HAS_TT)
+#define EHCI_DMA(dma0, ptr0, ptr) \
+ ((dma0) + ((ptr) - (ptr0)) * sizeof(*(ptr)))
+
+static inline uint32_t ehci_qh_dma(struct ehci_host *ehci, struct QH *qh)
+{
+ return EHCI_DMA(ehci->qh_list_dma, ehci->qh_list, qh);
+}
+
+static inline uint32_t ehci_td_dma(struct ehci_host *ehci, struct qTD *td)
+{
+ return EHCI_DMA(ehci->td_dma, ehci->td, td);
+}
+
+static inline uint32_t ehci_int_qh_dma(struct int_queue *intq, struct QH *qh)
+{
+ return EHCI_DMA(intq->first_dma, intq->first, qh);
+}
+
+static inline uint32_t ehci_int_td_dma(struct int_queue *intq, struct qTD *td)
+{
+ return EHCI_DMA(intq->tds_dma, intq->tds, td);
+}
+
static void memzero32(void *ptr, size_t size)
{
uint32_t *ptr32 = ptr;
@@ -346,7 +375,7 @@ ehci_submit_async(struct usb_device *dev, unsigned long pipe, void *buffer,
dev_dbg(ehci->dev, "unable construct SETUP td\n");
return ret;
}
- *tdp = cpu_to_hc32((uint32_t) td);
+ *tdp = cpu_to_hc32(ehci_td_dma(ehci, td));
tdp = &td->qt_next;
toggle = 1;
@@ -385,7 +414,7 @@ ehci_submit_async(struct usb_device *dev, unsigned long pipe, void *buffer,
dev_err(ehci->dev, "unable construct DATA td\n");
return ret;
}
- *tdp = cpu_to_hc32((uint32_t) td);
+ *tdp = cpu_to_hc32(ehci_td_dma(ehci, td));
tdp = &td->qt_next;
}
@@ -399,7 +428,7 @@ ehci_submit_async(struct usb_device *dev, unsigned long pipe, void *buffer,
QT_TOKEN_PID_IN),
NULL, 0,
NULL, DMA_NONE);
- *tdp = cpu_to_hc32((uint32_t)td);
+ *tdp = cpu_to_hc32(ehci_td_dma(ehci, td));
tdp = &td->qt_next;
}
@@ -841,7 +870,7 @@ static int ehci_init(struct usb_host *host)
return ret;
}
- ehci->qh_list[0].qh_link = cpu_to_hc32((uint32_t)&ehci->qh_list[1] |
+ ehci->qh_list[0].qh_link = cpu_to_hc32(ehci_qh_dma(ehci, &ehci->qh_list[1]) |
QH_LINK_TYPE_QH);
ehci->qh_list[0].qh_endpt1 = cpu_to_hc32(QH_ENDPT1_H(1) |
QH_ENDPT1_EPS(USB_SPEED_HIGH));
@@ -850,12 +879,13 @@ static int ehci_init(struct usb_host *host)
ehci->qh_list[0].qt_altnext = cpu_to_hc32(QT_NEXT_TERMINATE);
ehci->qh_list[0].qt_token = cpu_to_hc32(QT_TOKEN_STATUS_HALTED);
- ehci->qh_list[1].qh_link = cpu_to_hc32((uint32_t)&ehci->qh_list[0] |
+ ehci->qh_list[1].qh_link = cpu_to_hc32(ehci_qh_dma(ehci,
+ &ehci->qh_list[0]) |
QH_LINK_TYPE_QH);
ehci->qh_list[1].qt_altnext = cpu_to_hc32(QT_NEXT_TERMINATE);
/* Set async. queue head pointer. */
- ehci_writel(&ehci->hcor->or_asynclistaddr, (uint32_t)ehci->qh_list);
+ ehci_writel(&ehci->hcor->or_asynclistaddr, (uint32_t)ehci->qh_list_dma);
/*
* Set up periodic list
@@ -885,15 +915,15 @@ static int ehci_init(struct usb_host *host)
* PAGE_SIZE less then 4k will break this code.
*/
ehci->periodic_list = dma_alloc_coherent(1024 * 4,
- DMA_ADDRESS_BROKEN);
+ &ehci->periodic_list_dma);
for (i = 0; i < 1024; i++) {
- ehci->periodic_list[i] = cpu_to_hc32((unsigned long)periodic
+ ehci->periodic_list[i] = cpu_to_hc32((unsigned long)ehci->periodic_queue_dma
| QH_LINK_TYPE_QH);
}
/* Set periodic list base address */
ehci_writel(&ehci->hcor->or_periodiclistbase,
- (unsigned long)ehci->periodic_list);
+ (uint32_t)ehci->periodic_list_dma);
reg = ehci_readl(&ehci->hccr->cr_hcsparams);
descriptor.hub.bNbrPorts = HCS_N_PORTS(reg);
@@ -986,7 +1016,10 @@ disable_periodic(struct ehci_host *ehci)
return 0;
}
-#define NEXT_QH(qh) (struct QH *)((unsigned long)hc32_to_cpu((qh)->qh_link) & ~0x1f)
+#define NEXT_QH(queue, qh) (struct QH *)( \
+ ((unsigned long)hc32_to_cpu((qh)->qh_link) & ~0x1f) - \
+ (queue)->first_dma + \
+ (unsigned long)(queue)->first)
static int
enable_periodic(struct ehci_host *ehci)
@@ -1051,7 +1084,7 @@ static void ehci_update_endpt2_dev_n_port(struct usb_device *udev,
static struct int_queue *ehci_create_int_queue(struct usb_device *dev,
unsigned long pipe, int queuesize, int elementsize,
- void *buffer, int interval)
+ void *buffer, dma_addr_t buffer_dma, int interval)
{
struct usb_host *host = dev->host;
struct ehci_host *ehci = to_ehci(host);
@@ -1100,22 +1133,23 @@ static struct int_queue *ehci_create_int_queue(struct usb_device *dev,
result->queuesize = queuesize;
result->pipe = pipe;
result->first = dma_alloc_coherent(sizeof(struct QH) * queuesize,
- DMA_ADDRESS_BROKEN);
+ &result->first_dma);
result->current = result->first;
result->last = result->first + queuesize - 1;
result->tds = dma_alloc_coherent(sizeof(struct qTD) * queuesize,
- DMA_ADDRESS_BROKEN);
+ &result->tds_dma);
for (i = 0; i < queuesize; i++) {
struct QH *qh = result->first + i;
struct qTD *td = result->tds + i;
void **buf = &qh->buffer;
- qh->qh_link = cpu_to_hc32((unsigned long)(qh+1) | QH_LINK_TYPE_QH);
+ qh->qh_link = cpu_to_hc32(ehci_int_qh_dma(result, qh + 1) |
+ QH_LINK_TYPE_QH);
if (i == queuesize - 1)
qh->qh_link = cpu_to_hc32(QH_LINK_TERMINATE);
- qh->qt_next = cpu_to_hc32((unsigned long)td);
+ qh->qt_next = cpu_to_hc32(ehci_int_td_dma(result, td));
qh->qt_altnext = cpu_to_hc32(QT_NEXT_TERMINATE);
qh->qh_endpt1 =
cpu_to_hc32((0 << 28) | /* No NAK reload (ehci 4.9) */
@@ -1142,15 +1176,15 @@ static struct int_queue *ehci_create_int_queue(struct usb_device *dev,
((usb_pipein(pipe) ? 1 : 0) << 8) | /* IN/OUT token */
0x80); /* active */
td->qt_buffer[0] =
- cpu_to_hc32((unsigned long)buffer + i * elementsize);
+ cpu_to_hc32(buffer_dma + i * elementsize);
td->qt_buffer[1] =
- cpu_to_hc32((td->qt_buffer[0] + 0x1000) & ~0xfff);
+ cpu_to_hc32((buffer_dma + i * elementsize + 0x1000) & ~0xfff);
td->qt_buffer[2] =
- cpu_to_hc32((td->qt_buffer[0] + 0x2000) & ~0xfff);
+ cpu_to_hc32((buffer_dma + i * elementsize + 0x2000) & ~0xfff);
td->qt_buffer[3] =
- cpu_to_hc32((td->qt_buffer[0] + 0x3000) & ~0xfff);
+ cpu_to_hc32((buffer_dma + i * elementsize + 0x3000) & ~0xfff);
td->qt_buffer[4] =
- cpu_to_hc32((td->qt_buffer[0] + 0x4000) & ~0xfff);
+ cpu_to_hc32((buffer_dma + i * elementsize + 0x4000) & ~0xfff);
*buf = buffer + i * elementsize;
}
@@ -1165,7 +1199,7 @@ static struct int_queue *ehci_create_int_queue(struct usb_device *dev,
/* hook up to periodic list */
result->last->qh_link = list->qh_link;
- list->qh_link = cpu_to_hc32((unsigned long)result->first | QH_LINK_TYPE_QH);
+ list->qh_link = cpu_to_hc32(result->first_dma | QH_LINK_TYPE_QH);
if (enable_periodic(ehci) < 0) {
dev_err(&dev->dev,
@@ -1177,8 +1211,10 @@ static struct int_queue *ehci_create_int_queue(struct usb_device *dev,
dev_dbg(&dev->dev, "Exit create_int_queue\n");
return result;
fail3:
- dma_free_coherent(result->tds, 0, sizeof(struct qTD) * queuesize);
- dma_free_coherent(result->first, 0, sizeof(struct QH) * queuesize);
+ dma_free_coherent(result->tds, result->tds_dma,
+ sizeof(struct qTD) * queuesize);
+ dma_free_coherent(result->first, result->first_dma,
+ sizeof(struct QH) * queuesize);
free(result);
return NULL;
}
@@ -1235,14 +1271,14 @@ static int ehci_destroy_int_queue(struct usb_device *dev,
dev_dbg(&dev->dev,
"considering %p, with qh_link %x\n",
cur, cur->qh_link);
- if (NEXT_QH(cur) == queue->first) {
+ if (NEXT_QH(queue, cur) == queue->first) {
dev_dbg(&dev->dev,
"found candidate. removing from chain\n");
cur->qh_link = queue->last->qh_link;
result = 0;
break;
}
- cur = NEXT_QH(cur);
+ cur = NEXT_QH(queue, cur);
}
if (ehci->periodic_schedules > 0) {
@@ -1269,14 +1305,14 @@ submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
uint64_t start;
void *backbuffer;
int result = 0, ret;
+ dma_addr_t buffer_dma;
dev_dbg(ehci->dev, "dev=%p, pipe=%lu, buffer=%p, length=%d, interval=%d",
dev, pipe, buffer, length, interval);
- dma_sync_single_for_device((unsigned long)buffer, length,
- DMA_BIDIRECTIONAL);
+ buffer_dma = dma_map_single(ehci->dev, buffer, length, DMA_BIDIRECTIONAL);
- queue = ehci_create_int_queue(dev, pipe, 1, length, buffer, interval);
+ queue = ehci_create_int_queue(dev, pipe, 1, length, buffer, buffer_dma, interval);
if (!queue)
return -EINVAL;
@@ -1298,8 +1334,7 @@ submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
result = -EINVAL;
}
- dma_sync_single_for_cpu((unsigned long)buffer, length,
- DMA_BIDIRECTIONAL);
+ dma_unmap_single(ehci->dev, buffer_dma, length, DMA_BIDIRECTIONAL);
ret = ehci_destroy_int_queue(dev, queue);
if (!result)
@@ -1335,11 +1370,11 @@ struct ehci_host *ehci_register(struct device_d *dev, struct ehci_data *data)
ehci->post_init = data->post_init;
ehci->qh_list = dma_alloc_coherent(sizeof(struct QH) * NUM_QH,
- DMA_ADDRESS_BROKEN);
+ &ehci->qh_list_dma);
ehci->periodic_queue = dma_alloc_coherent(sizeof(struct QH),
- DMA_ADDRESS_BROKEN);
+ &ehci->periodic_queue_dma);
ehci->td = dma_alloc_coherent(sizeof(struct qTD) * NUM_TD,
- DMA_ADDRESS_BROKEN);
+ &ehci->td_dma);
host->hw_dev = dev;
host->init = ehci_init;
diff --git a/drivers/video/ssd1307fb.c b/drivers/video/ssd1307fb.c
index 70077e4..835814b 100644
--- a/drivers/video/ssd1307fb.c
+++ b/drivers/video/ssd1307fb.c
@@ -405,8 +405,9 @@ static int ssd1307fb_probe(struct device_d *dev)
}
info = xzalloc(sizeof(struct fb_info));
+ par = xzalloc(sizeof(*par));
- par = info->priv;
+ info->priv = par;
par->info = info;
par->client = client;
@@ -414,12 +415,8 @@ static int ssd1307fb_probe(struct device_d *dev)
par->reset = of_get_named_gpio(node,
"reset-gpios", 0);
- if (!gpio_is_valid(par->reset)) {
- ret = par->reset;
- if (ret != -EPROBE_DEFER)
- dev_err(&client->dev,
- "Couldn't get named gpio 'reset-gpios': %s.\n",
- strerror(-ret));
+ if (!gpio_is_valid(par->reset) && par->reset == -EPROBE_DEFER) {
+ ret = -EPROBE_DEFER;
goto fb_alloc_error;
}
@@ -502,38 +499,41 @@ static int ssd1307fb_probe(struct device_d *dev)
info->screen_base = (u8 __force __iomem *)vmem;
- ret = gpio_request_one(par->reset,
- GPIOF_OUT_INIT_HIGH,
- "oled-reset");
- if (ret) {
- dev_err(&client->dev,
- "failed to request gpio %d: %d\n",
- par->reset, ret);
- goto reset_oled_error;
- }
-
- if (par->vbat) {
- ret = regulator_disable(par->vbat);
- if (ret < 0)
+ if (par->reset >= 0) {
+ ret = gpio_request_one(par->reset,
+ GPIOF_OUT_INIT_HIGH,
+ "oled-reset");
+ if (ret) {
+ dev_err(&client->dev,
+ "failed to request gpio %d: %d\n",
+ par->reset, ret);
goto reset_oled_error;
+ }
}
- i2c_set_clientdata(client, info);
+ ret = regulator_disable(par->vbat);
+ if (ret < 0)
+ goto reset_oled_error;
- /* Reset the screen */
- gpio_set_value(par->reset, 0);
- udelay(4);
+ i2c_set_clientdata(client, info);
- if (par->vbat) {
- ret = regulator_enable(par->vbat);
- if (ret < 0)
- goto reset_oled_error;
+ if (par->reset > 0) {
+ /* Reset the screen */
+ gpio_set_value(par->reset, 0);
+ udelay(4);
}
- mdelay(100);
+ ret = regulator_enable(par->vbat);
+ if (ret < 0)
+ goto reset_oled_error;
- gpio_set_value(par->reset, 1);
- udelay(4);
+ if (par->vbat)
+ mdelay(100);
+
+ if (par->reset > 0) {
+ gpio_set_value(par->reset, 1);
+ udelay(4);
+ }
ret = ssd1307fb_init(par);
if (ret)
@@ -574,6 +574,7 @@ reset_oled_error:
free(vmem);
fb_alloc_error:
regulator_disable(par->vbat);
+ free(par);
free(info);
return ret;
}
diff --git a/firmware/Makefile b/firmware/Makefile
index a0f40d3..3f2c318 100644
--- a/firmware/Makefile
+++ b/firmware/Makefile
@@ -51,6 +51,9 @@ $(patsubst %,$(obj)/%.gen.S, $(fw-external-y)): %: $(wordsize_deps) \
# The .o files depend on the binaries directly; the .S files don't.
$(patsubst %,$(obj)/%.gen.o, $(fw-external-y)): $(obj)/%.gen.o: $(fwdir)/%
+# The same for pbl:
+$(patsubst %,$(obj)/pbl-%.gen.o, $(fw-external-y)): $(obj)/pbl-%.gen.o: $(fwdir)/%
+
obj-pbl-y += $(patsubst %,%.gen.o, $(fw-external-y))
ifeq ($(KBUILD_SRC),)
diff --git a/images/Makefile b/images/Makefile
index 650baf1..fe29c75 100644
--- a/images/Makefile
+++ b/images/Makefile
@@ -57,12 +57,12 @@ quiet_cmd_elf__ ?= LD $@
cmd_elf__ ?= $(LD) $(LDFLAGS_pbl) --gc-sections \
-e $(2) -Map $@.map $(LDFLAGS_$(@F)) -o $@ \
-T $(pbl-lds) \
- --start-group $(barebox-pbl-common) $(obj)/piggy.o \
+ --start-group $(BAREBOX_PBL_OBJS) $(obj)/piggy.o \
$(obj)/sha_sum.o --end-group
PBL_CPPFLAGS += -fdata-sections -ffunction-sections
-$(obj)/%.pbl: $(pbl-lds) $(barebox-pbl-common) $(obj)/piggy.o $(obj)/sha_sum.o FORCE
+$(obj)/%.pbl: $(pbl-lds) $(BAREBOX_PBL_OBJS) $(obj)/piggy.o $(obj)/sha_sum.o FORCE
$(call if_changed,elf__,$(*F))
$(obj)/%.pblb: $(obj)/%.pbl FORCE
diff --git a/include/linux/reset.h b/include/linux/reset.h
index a22bcf9..4a92a17 100644
--- a/include/linux/reset.h
+++ b/include/linux/reset.h
@@ -55,6 +55,12 @@ static inline int device_reset_us(struct device_d *dev, int us)
return 0;
}
+static inline int device_reset(struct device_d *dev)
+{
+ WARN_ON(1);
+ return 0;
+}
+
#endif /* CONFIG_RESET_CONTROLLER */
#endif
diff --git a/include/usb/usb.h b/include/usb/usb.h
index 95dedfd..8225f6a 100644
--- a/include/usb/usb.h
+++ b/include/usb/usb.h
@@ -68,7 +68,7 @@ struct usb_interface {
struct usb_endpoint_descriptor ep_desc[USB_MAXENDPOINTS];
};
-struct usb_configuration {
+struct usb_config {
struct usb_config_descriptor desc;
unsigned char no_of_if; /* number of interfaces */
@@ -95,7 +95,7 @@ struct usb_device {
int configno; /* selected config number */
struct usb_device_descriptor *descriptor; /* Device Descriptor */
- struct usb_configuration config; /* config descriptor */
+ struct usb_config config; /* config descriptor */
struct devrequest *setup_packet;
int have_langid; /* whether string_langid is valid yet */
diff --git a/scripts/bareboximd.c b/scripts/bareboximd.c
index e5000e0..b332d43 100644
--- a/scripts/bareboximd.c
+++ b/scripts/bareboximd.c
@@ -59,7 +59,7 @@ static int write_file(const char *filename, const void *buf, size_t size)
int fd, ret;
int now;
- fd = open(filename, O_WRONLY | O_TRUNC | O_CREAT);
+ fd = open(filename, O_WRONLY | O_TRUNC | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
if (fd < 0)
return fd;