summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2020-08-18 11:23:21 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-08-18 11:23:21 +0200
commitdb6394231e8f10d0d7677e3a239dc700ad4a8036 (patch)
tree8954b4141a2694d50b27b2298fe155d5db5d7d96
parent765d071a9869a47fa92fcfc9e842492b41ffeff8 (diff)
parent47c66a2a28c5fc785f332cf7384c6303dd49dd54 (diff)
downloadbarebox-db6394231e8f10d0d7677e3a239dc700ad4a8036.tar.gz
barebox-db6394231e8f10d0d7677e3a239dc700ad4a8036.tar.xz
Merge branch 'for-next/misc' into master
-rw-r--r--arch/arm/boards/tqmls1046a/lowlevel.c145
-rw-r--r--arch/arm/boards/vscom-baltos/board.c42
-rw-r--r--arch/arm/configs/vexpress_defconfig1
-rw-r--r--arch/arm/dts/am335x-baltos-minimal.dts11
-rw-r--r--arch/arm/dts/socfpga_arria10_achilles.dts18
-rw-r--r--arch/arm/dts/vexpress-v2p-ca15.dts4
-rw-r--r--arch/arm/dts/vexpress-v2p-ca9.dts4
-rw-r--r--arch/riscv/Makefile5
-rw-r--r--common/bootm.c29
-rw-r--r--common/console_countdown.c2
-rw-r--r--common/image-fit.c91
-rw-r--r--common/ratp/ratp.c5
-rw-r--r--drivers/crypto/caam/intern.h5
-rw-r--r--drivers/crypto/caam/jr.h2
-rw-r--r--drivers/gpio/gpio-sx150x.c1
-rw-r--r--drivers/usb/gadget/multi.c2
-rw-r--r--drivers/usb/gadget/udc-core.c3
-rw-r--r--drivers/usb/musb/musb_gadget.c9
-rw-r--r--drivers/video/ssd1307fb.c18
-rw-r--r--include/image-fit.h3
-rw-r--r--include/image.h188
-rw-r--r--include/spi/spi.h2
-rw-r--r--include/usb/gadget.h1
-rw-r--r--lib/string.c4
-rw-r--r--scripts/Makefile.lib1
25 files changed, 330 insertions, 266 deletions
diff --git a/arch/arm/boards/tqmls1046a/lowlevel.c b/arch/arm/boards/tqmls1046a/lowlevel.c
index f79f491ecc..99dcf1eff7 100644
--- a/arch/arm/boards/tqmls1046a/lowlevel.c
+++ b/arch/arm/boards/tqmls1046a/lowlevel.c
@@ -14,152 +14,8 @@
#include <mach/xload.h>
#include <mach/layerscape.h>
-struct board_specific_parameters {
- u32 n_ranks;
- u32 datarate_mhz_high;
- u32 rank_gb;
- u32 clk_adjust;
- u32 wrlvl_start;
- u32 wrlvl_ctl_2;
- u32 wrlvl_ctl_3;
-};
-
-/*
- * These tables contain all valid speeds we want to override with board
- * specific parameters. datarate_mhz_high values need to be in ascending order
- * for each n_ranks group.
- */
-static const struct board_specific_parameters udimm0[] = {
- /*
- * memory controller 0
- * num| hi| rank| clk| wrlvl | wrlvl | wrlvl | cpo |wrdata|2T
- * ranks| mhz| GB |adjst| start | ctl2 | ctl3 | |delay |
- */
- {1, 2100, 0, 8, 9, 0x09080806, 0x07060606,},
- {}
-};
-
-static const struct board_specific_parameters *udimms[] = {
- udimm0,
-};
-
-static void ddr_board_options(memctl_options_t *popts,
- struct dimm_params *pdimm,
- struct fsl_ddr_controller *c)
-{
- const struct board_specific_parameters *pbsp, *pbsp_highest = NULL;
- unsigned long ddr_freq;
-
- if (!pdimm->n_ranks)
- return;
-
- pbsp = udimms[0];
-
- /*
- * Get clk_adjust, wrlvl_start, wrlvl_ctl, according to the board ddr
- * freqency and n_banks specified in board_specific_parameters table.
- */
- ddr_freq = c->ddr_freq / 1000000;
- while (pbsp->datarate_mhz_high) {
- if (pbsp->n_ranks == pdimm->n_ranks) {
- if (ddr_freq <= pbsp->datarate_mhz_high) {
- popts->clk_adjust = pbsp->clk_adjust;
- popts->wrlvl_start = pbsp->wrlvl_start;
- popts->wrlvl_ctl_2 = pbsp->wrlvl_ctl_2;
- popts->wrlvl_ctl_3 = pbsp->wrlvl_ctl_3;
- goto found;
- }
- pbsp_highest = pbsp;
- }
- pbsp++;
- }
-
- if (pbsp_highest) {
- printf("Error: board specific timing not found for %lu MT/s\n",
- ddr_freq);
- printf("Trying to use the highest speed (%u) parameters\n",
- pbsp_highest->datarate_mhz_high);
- popts->clk_adjust = pbsp_highest->clk_adjust;
- popts->wrlvl_start = pbsp_highest->wrlvl_start;
- popts->wrlvl_ctl_2 = pbsp->wrlvl_ctl_2;
- popts->wrlvl_ctl_3 = pbsp->wrlvl_ctl_3;
- } else {
- panic("DIMM is not supported by this board");
- }
-found:
- debug("Found timing match: n_ranks %d, data rate %d, rank_gb %d\n",
- pbsp->n_ranks, pbsp->datarate_mhz_high, pbsp->rank_gb);
-
- popts->data_bus_width = 0; /* 64-bit data bus */
- popts->bstopre = 0; /* enable auto precharge */
-
- /*
- * Factors to consider for half-strength driver enable:
- * - number of DIMMs installed
- */
- popts->half_strength_driver_enable = 0;
- /*
- * Write leveling override
- */
- popts->wrlvl_override = 1;
- popts->wrlvl_sample = 0xf;
-
- /*
- * Rtt and Rtt_WR override
- */
- popts->rtt_override = 0;
-
- /* Enable ZQ calibration */
- popts->zq_en = 1;
-
- popts->ddr_cdr1 = DDR_CDR1_DHC_EN | DDR_CDR1_ODT(DDR4_CDR_ODT_60ohm);
- popts->ddr_cdr2 = DDR_CDR2_ODT(DDR4_CDR_ODT_60ohm) |
- DDR_CDR2_VREF_TRAIN_EN | DDR_CDR2_VREF_RANGE_2;
-
- /* optimize cpo for erratum A-009942 */
- popts->cpo_sample = 0x48;
-}
-
-static struct dimm_params dimm_params[] = {
- {
- .n_ranks = 1,
- .rank_density = 2147483648u,
- .capacity = 2147483648u,
- .primary_sdram_width = 64,
- .ec_sdram_width = 8,
- .registered_dimm = 0,
- .mirrored_dimm = 0,
- .n_row_addr = 15,
- .n_col_addr = 10,
- .bank_addr_bits = 2,
- .bank_group_bits = 0,
- .edc_config = 2,
- .burst_lengths_bitmask = 0x0c,
-
- .tckmin_x_ps = 833,
- .tckmax_ps = 1900,
- .caslat_x = 0x000DFA00, //
- .taa_ps = 13320,
- .trcd_ps = 13320,
- .trp_ps = 13320,
- .tras_ps = 32000,
- .trc_ps = 45320,
- .trfc1_ps = 260000,
- .trfc2_ps = 160000,
- .trfc4_ps = 110000,
- .tfaw_ps = 21000,
- .trrds_ps = 3300,
- .trrdl_ps = 4900,
- .tccdl_ps = 5000,
- .trfc_slr_ps = 3500000,
- .refresh_rate_ps = 7800000,
- },
-};
-
static struct fsl_ddr_controller ddrc[] = {
{
- .dimm_slots_per_ctrl = ARRAY_SIZE(dimm_params),
- .dimm_params = dimm_params,
.memctl_opts.ddrtype = SDRAM_TYPE_DDR4,
.base = IOMEM(LSCH2_DDR_ADDR),
.ddr_freq = LS1046A_DDR_FREQ,
@@ -169,7 +25,6 @@ static struct fsl_ddr_controller ddrc[] = {
.erratum_A009801 = 1,
.erratum_A009942 = 1,
.chip_selects_per_ctrl = 4,
- .board_options = ddr_board_options,
.fsl_ddr_config_reg = {
.cs[0].bnds = 0x0000007F,
.cs[0].config = 0x80010312,
diff --git a/arch/arm/boards/vscom-baltos/board.c b/arch/arm/boards/vscom-baltos/board.c
index 800f42df3a..59782d2990 100644
--- a/arch/arm/boards/vscom-baltos/board.c
+++ b/arch/arm/boards/vscom-baltos/board.c
@@ -45,6 +45,43 @@ struct bsp_vs_hwparam {
uint8_t MAC3[6];
} __attribute__ ((packed));
+static uint8_t get_dip_switch(uint16_t id, uint32_t rev)
+{
+ uint16_t maj, min;
+ uint8_t dip = 0;
+
+ maj = rev >> 16;
+ min = rev & 0xffff;
+
+ if ((id == 220 || id == 222) && (maj == 1 && min == 2))
+ id = 214;
+
+ switch(id) {
+ case 214:
+ case 215:
+ dip = !gpio_get_value(44);
+ dip += !gpio_get_value(45) << 1;
+ dip += !gpio_get_value(46) << 2;
+ dip += !gpio_get_value(47) << 3;
+ break;
+ case 212:
+ case 221:
+ case 223:
+ case 224:
+ case 225:
+ case 226:
+ case 227:
+ case 230:
+ dip = !gpio_get_value(82);
+ dip += !gpio_get_value(83) << 1;
+ dip += !gpio_get_value(105) << 2;
+ dip += !gpio_get_value(106) << 3;
+ break;
+ }
+
+ return dip;
+}
+
static int baltos_read_eeprom(void)
{
struct bsp_vs_hwparam hw_param;
@@ -52,6 +89,7 @@ static int baltos_read_eeprom(void)
char *buf, var_buf[32];
int rc;
unsigned char mac_addr[6];
+ uint8_t dip;
if (!of_machine_is_compatible("vscom,onrisc"))
return 0;
@@ -109,6 +147,10 @@ static int baltos_read_eeprom(void)
gpio_direction_output(135, 0);
}
+ dip = get_dip_switch(hw_param.SystemId, hw_param.HwRev);
+ sprintf(var_buf, "%02x", dip);
+ globalvar_add_simple("board.dip", var_buf);
+
return 0;
}
environment_initcall(baltos_read_eeprom);
diff --git a/arch/arm/configs/vexpress_defconfig b/arch/arm/configs/vexpress_defconfig
index 149ba17321..caa9f512d6 100644
--- a/arch/arm/configs/vexpress_defconfig
+++ b/arch/arm/configs/vexpress_defconfig
@@ -3,6 +3,7 @@ CONFIG_AEABI=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
+CONFIG_KALLSYMS=y
CONFIG_PROMPT="vexpress: "
CONFIG_HUSH_FANCY_PROMPT=y
CONFIG_CMDLINE_EDITING=y
diff --git a/arch/arm/dts/am335x-baltos-minimal.dts b/arch/arm/dts/am335x-baltos-minimal.dts
index 137c177b2f..a57bb6c802 100644
--- a/arch/arm/dts/am335x-baltos-minimal.dts
+++ b/arch/arm/dts/am335x-baltos-minimal.dts
@@ -22,6 +22,11 @@
chosen {
stdout-path = &uart0;
+
+ environment-nand {
+ compatible = "barebox,environment";
+ device-path = &environment_nand;
+ };
};
cpus {
@@ -179,7 +184,7 @@
ranges = <0 0 0x08000000 0x10000000>; /* CS0: NAND */
status = "okay";
- nand@0,0 {
+ nand: nand@0,0 {
reg = <0 0 0>; /* CS0, offset 0 */
nand-bus-width = <8>;
ti,nand-ecc-opt = "bch8";
@@ -226,8 +231,8 @@
label = "SPL.backup2";
reg = <0x40000 0x20000>;
};
- boot@60000 {
- label = "SPL.backup3";
+ environment_nand: boot@60000 {
+ label = "bareboxenv";
reg = <0x60000 0x20000>;
};
boot@80000 {
diff --git a/arch/arm/dts/socfpga_arria10_achilles.dts b/arch/arm/dts/socfpga_arria10_achilles.dts
index 2fce0114c8..6071dbfb49 100644
--- a/arch/arm/dts/socfpga_arria10_achilles.dts
+++ b/arch/arm/dts/socfpga_arria10_achilles.dts
@@ -106,24 +106,6 @@
};
};
};
-
- bootstate: bootstate {
- compatible = "barebox,bootstate";
- backend-type = "state"; // or "nv", or "efivar"
- backend = <&state>;
-
- system0 {
- default_attempts = <3>;
- };
-
- system1 {
- default_attempts = <3>;
- };
-
- factory {
- default_attempts = <3>;
- };
- };
};
&{/soc/clkmgr@ffd04000/clocks/osc1} {
diff --git a/arch/arm/dts/vexpress-v2p-ca15.dts b/arch/arm/dts/vexpress-v2p-ca15.dts
index 69e93ee7b2..78d0025909 100644
--- a/arch/arm/dts/vexpress-v2p-ca15.dts
+++ b/arch/arm/dts/vexpress-v2p-ca15.dts
@@ -5,6 +5,10 @@
compatible = "barebox,environment";
device-path = &barebox_env;
};
+
+ chosen {
+ stdout-path = &v2m_serial0;
+ };
};
&nor_flash {
diff --git a/arch/arm/dts/vexpress-v2p-ca9.dts b/arch/arm/dts/vexpress-v2p-ca9.dts
index cb4afef185..8be04b174b 100644
--- a/arch/arm/dts/vexpress-v2p-ca9.dts
+++ b/arch/arm/dts/vexpress-v2p-ca9.dts
@@ -10,6 +10,10 @@
state = &state;
};
+ chosen {
+ stdout-path = &v2m_serial0;
+ };
+
/* State: mutable part */
state: state {
magic = <0x4d433230>;
diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
index c71319507c..8cd5f51e30 100644
--- a/arch/riscv/Makefile
+++ b/arch/riscv/Makefile
@@ -3,7 +3,8 @@ KBUILD_DEFCONFIG := erizo_generic_defconfig
KBUILD_CPPFLAGS += -fno-strict-aliasing
ifeq ($(CONFIG_ARCH_RV32I),y)
- cflags-y += -march=rv32im
+ cflags-y += -march=rv32im -mabi=ilp32
+ riscv-ldflags-y += -melf32lriscv
endif
cflags-y += -fno-pic -pipe
@@ -14,6 +15,8 @@ LDFLAGS_barebox += -nostdlib
machine-$(CONFIG_MACH_ERIZO) := erizo
+LDFLAGS_barebox += $(riscv-ldflags-y)
+
TEXT_BASE = $(CONFIG_TEXT_BASE)
KBUILD_CPPFLAGS += -DTEXT_BASE=$(CONFIG_TEXT_BASE)
diff --git a/common/bootm.c b/common/bootm.c
index bea73fac36..7f22ca5ced 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -58,6 +58,7 @@ void bootm_data_init_defaults(struct bootm_data *data)
{
data->initrd_address = UIMAGE_INVALID_ADDRESS;
data->os_address = UIMAGE_SOME_ADDRESS;
+ data->os_entry = UIMAGE_SOME_ADDRESS;
data->oftree_file = getenv_nonempty("global.bootm.oftree");
data->tee_file = getenv_nonempty("global.bootm.tee");
data->os_file = getenv_nonempty("global.bootm.image");
@@ -638,6 +639,7 @@ int bootm_boot(struct bootm_data *bootm_data)
if (IS_ENABLED(CONFIG_FITIMAGE) && os_type == filetype_oftree) {
struct fit_handle *fit;
+ static const char *kernel_img = "kernel";
fit = fit_open(data->os_file, data->verbose, data->verify);
if (IS_ERR(fit)) {
@@ -658,10 +660,33 @@ int bootm_boot(struct bootm_data *bootm_data)
goto err_out;
}
- ret = fit_open_image(data->os_fit, data->fit_config, "kernel",
+ ret = fit_open_image(data->os_fit, data->fit_config, kernel_img,
&data->fit_kernel, &data->fit_kernel_size);
if (ret)
goto err_out;
+ if (data->os_address == UIMAGE_SOME_ADDRESS) {
+ ret = fit_get_image_address(data->os_fit,
+ data->fit_config,
+ kernel_img,
+ "load", &data->os_address);
+ if (!ret)
+ printf("Load address from FIT '%s': 0x%lx\n",
+ kernel_img, data->os_address);
+ /* Note: Error case uses default value. */
+ }
+ if (data->os_entry == UIMAGE_SOME_ADDRESS) {
+ unsigned long entry;
+ ret = fit_get_image_address(data->os_fit,
+ data->fit_config,
+ kernel_img,
+ "entry", &entry);
+ if (!ret) {
+ data->os_entry = entry - data->os_address;
+ printf("Entry address from FIT '%s': 0x%lx\n",
+ kernel_img, entry);
+ }
+ /* Note: Error case uses default value. */
+ }
}
if (os_type == filetype_uimage) {
@@ -719,6 +744,8 @@ int bootm_boot(struct bootm_data *bootm_data)
if (data->os_address == UIMAGE_SOME_ADDRESS)
data->os_address = UIMAGE_INVALID_ADDRESS;
+ if (data->os_entry == UIMAGE_SOME_ADDRESS)
+ data->os_entry = 0;
handler = bootm_find_handler(os_type, data);
if (!handler) {
diff --git a/common/console_countdown.c b/common/console_countdown.c
index 74dc382795..b92948f503 100644
--- a/common/console_countdown.c
+++ b/common/console_countdown.c
@@ -64,7 +64,7 @@ int console_countdown(int timeout_s, unsigned flags, const char *keys,
goto out;
if (flags & CONSOLE_COUNTDOWN_ANYKEY)
goto out;
- if (flags & CONSOLE_COUNTDOWN_RETURN && key == '\n')
+ if (flags & CONSOLE_COUNTDOWN_RETURN && (key == '\n' || key == '\r'))
goto out;
if (flags & CONSOLE_COUNTDOWN_CTRLC && key == 3)
goto out;
diff --git a/common/image-fit.c b/common/image-fit.c
index 2681d62a9a..658f09b04d 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -517,6 +517,77 @@ int fit_has_image(struct fit_handle *handle, void *configuration,
return 1;
}
+static int fit_get_address(struct device_node *image, const char *property,
+ unsigned long *addr)
+{
+ const __be32 *cell;
+ int len = 0;
+
+ cell = of_get_property(image, property, &len);
+ if (!cell)
+ return -EINVAL;
+ if (len > sizeof(*addr))
+ return -ENOTSUPP;
+
+ *addr = (unsigned long)of_read_number(cell, len / sizeof(*cell));
+ return 0;
+}
+
+static int
+fit_get_image(struct fit_handle *handle, void *configuration,
+ const char **unit, struct device_node **image)
+{
+ struct device_node *conf_node = configuration;
+
+ if (conf_node) {
+ if (of_property_read_string(conf_node, *unit, unit)) {
+ pr_err("No image named '%s'\n", *unit);
+ return -ENOENT;
+ }
+ }
+
+ *image = of_get_child_by_name(handle->images, *unit);
+ if (!*image)
+ return -ENOENT;
+
+ return 0;
+}
+
+/**
+ * fit_get_image_address - Get an address from an image in a FIT image
+ * @handle: The FIT image handle
+ * @name: The name of the image to open
+ * @property: The name of the address to get (for example "load" or "entry")
+ * @address: The address given by the image
+ *
+ * Try to parse the @property in the image @name as an address. @configuration
+ * holds the cookie returned from fit_open_configuration() if the image is
+ * opened as part of a configuration, or NULL if the image is opened without a
+ * configuration. If it exists the value will be returned in @address. Otherwise
+ * @address won't be changed.
+ *
+ * Return: 0 for success, negative error code otherwise
+ */
+int fit_get_image_address(struct fit_handle *handle, void *configuration,
+ const char *name, const char *property,
+ unsigned long *address)
+{
+ struct device_node *image;
+ const char *unit = name;
+ int ret;
+
+ if (!address || !property || !name)
+ return -EINVAL;
+
+ ret = fit_get_image(handle, configuration, &unit, &image);
+ if (ret)
+ return ret;
+
+ ret = fit_get_address(image, property, address);
+
+ return ret;
+}
+
/**
* fit_open_image - Open an image in a FIT image
* @handle: The FIT image handle
@@ -539,24 +610,14 @@ int fit_open_image(struct fit_handle *handle, void *configuration,
unsigned long *outsize)
{
struct device_node *image;
- const char *unit, *type = NULL, *desc= "(no description)";
+ const char *unit = name, *type = NULL, *desc= "(no description)";
const void *data;
int data_len;
int ret = 0;
- struct device_node *conf_node = configuration;
-
- if (conf_node) {
- if (of_property_read_string(conf_node, name, &unit)) {
- pr_err("No image named '%s'\n", name);
- return -ENOENT;
- }
- } else {
- unit = name;
- }
- image = of_get_child_by_name(handle->images, unit);
- if (!image)
- return -ENOENT;
+ ret = fit_get_image(handle, configuration, &unit, &image);
+ if (ret)
+ return ret;
of_property_read_string(image, "description", &desc);
pr_info("image '%s': '%s'\n", unit, desc);
@@ -573,7 +634,7 @@ int fit_open_image(struct fit_handle *handle, void *configuration,
return -EINVAL;
}
- if (conf_node)
+ if (configuration)
ret = fit_verify_hash(handle, image, data, data_len);
else
ret = fit_image_verify_signature(handle, image, data, data_len);
diff --git a/common/ratp/ratp.c b/common/ratp/ratp.c
index b8043fe5c7..9ca299eef2 100644
--- a/common/ratp/ratp.c
+++ b/common/ratp/ratp.c
@@ -15,11 +15,9 @@
#include <common.h>
#include <command.h>
-#include <kfifo.h>
#include <malloc.h>
#include <init.h>
#include <ratp.h>
-#include <command.h>
#include <byteorder.h>
#include <environment.h>
#include <kfifo.h>
@@ -27,6 +25,7 @@
#include <linux/sizes.h>
#include <ratp_bb.h>
#include <fs.h>
+#include <console_countdown.h>
LIST_HEAD(ratp_command_list);
EXPORT_SYMBOL(ratp_command_list);
@@ -473,6 +472,8 @@ int barebox_ratp(struct console_device *cdev)
ctx->poller_registered = true;
+ console_countdown_abort();
+
console_set_active(&ctx->ratp_console, CONSOLE_STDOUT | CONSOLE_STDERR |
CONSOLE_STDIN);
diff --git a/drivers/crypto/caam/intern.h b/drivers/crypto/caam/intern.h
index 6dfcea26ac..b13b7e08bc 100644
--- a/drivers/crypto/caam/intern.h
+++ b/drivers/crypto/caam/intern.h
@@ -53,8 +53,6 @@ struct caam_drv_private_jr {
*/
struct caam_drv_private {
- struct device *dev;
- struct device *smdev;
struct device_d **jrpdev; /* Alloc'ed array per sub-device */
struct device_d *pdev;
@@ -89,9 +87,6 @@ struct caam_drv_private {
struct clk *caam_emi_slow;
};
-void caam_jr_algapi_init(struct device *dev);
-void caam_jr_algapi_remove(struct device *dev);
-
int caam_rng_probe(struct device_d *dev, struct device_d *jrdev);
int caam_blob_gen_probe(struct device_d *dev, struct device_d *jrdev);
int caam_jr_probe(struct device_d *dev);
diff --git a/drivers/crypto/caam/jr.h b/drivers/crypto/caam/jr.h
index e0e53c0f6c..85aca6d88c 100644
--- a/drivers/crypto/caam/jr.h
+++ b/drivers/crypto/caam/jr.h
@@ -8,8 +8,6 @@
#define JR_H
/* Prototypes for backend-level services exposed to APIs */
-struct device *caam_jr_alloc(void);
-void caam_jr_free(struct device *rdev);
int caam_jr_enqueue(struct device_d *dev, u32 *desc,
void (*cbk)(struct device_d *dev, u32 *desc, u32 status,
void *areq),
diff --git a/drivers/gpio/gpio-sx150x.c b/drivers/gpio/gpio-sx150x.c
index 76535187b0..cf166f3c28 100644
--- a/drivers/gpio/gpio-sx150x.c
+++ b/drivers/gpio/gpio-sx150x.c
@@ -45,7 +45,6 @@ struct sx150x_device_data {
};
struct sx150x_gpio {
- struct device *dev;
struct i2c_client *client;
struct gpio_chip gpio;
struct regmap *regmap;
diff --git a/drivers/usb/gadget/multi.c b/drivers/usb/gadget/multi.c
index 445cc32420..95f5b90c88 100644
--- a/drivers/usb/gadget/multi.c
+++ b/drivers/usb/gadget/multi.c
@@ -179,8 +179,10 @@ static int multi_bind(struct usb_composite_dev *cdev)
strings_dev[USB_GADGET_MANUFACTURER_IDX].s = gadget->manufacturer;
strings_dev[USB_GADGET_PRODUCT_IDX].s = gadget->productname;
+ strings_dev[USB_GADGET_SERIAL_IDX].s = gadget->serialnumber;
device_desc.iProduct = strings_dev[USB_GADGET_PRODUCT_IDX].id;
+ device_desc.iSerialNumber = strings_dev[USB_GADGET_SERIAL_IDX].id;
config.label = strings_dev[STRING_DESCRIPTION_IDX].s;
config.iConfiguration = strings_dev[STRING_DESCRIPTION_IDX].id;
diff --git a/drivers/usb/gadget/udc-core.c b/drivers/usb/gadget/udc-core.c
index 126d76e8bb..2516676f86 100644
--- a/drivers/usb/gadget/udc-core.c
+++ b/drivers/usb/gadget/udc-core.c
@@ -212,6 +212,9 @@ int usb_add_gadget_udc_release(struct device_d *parent, struct usb_gadget *gadge
gadget->productname = xstrdup(barebox_get_model());
dev_add_param_string(&gadget->dev, "productname", NULL, NULL,
&gadget->productname, NULL);
+ gadget->serialnumber = xstrdup("");
+ dev_add_param_string(&gadget->dev, "serialnumber", NULL, NULL,
+ &gadget->serialnumber, NULL);
dev_set_name(&udc->dev, "udc");
udc->dev.id = DEVICE_ID_DYNAMIC;
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index fc5cfb13f5..87f7e78e66 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -653,15 +653,6 @@ void musb_free_request(struct usb_ep *ep, struct usb_request *req)
kfree(to_musb_request(req));
}
-static LIST_HEAD(buffers);
-
-struct free_record {
- struct list_head list;
- struct device *dev;
- unsigned bytes;
- dma_addr_t dma;
-};
-
/*
* Context: controller locked, IRQs blocked.
*/
diff --git a/drivers/video/ssd1307fb.c b/drivers/video/ssd1307fb.c
index 45f479b0ef..0709399358 100644
--- a/drivers/video/ssd1307fb.c
+++ b/drivers/video/ssd1307fb.c
@@ -396,6 +396,7 @@ static int ssd1307fb_probe(struct device_d *dev)
struct ssd1307fb_par *par;
struct ssd1307fb_array *array;
u8 *vmem = NULL;
+ enum of_gpio_flags of_flags;
int ret;
int i, j;
@@ -413,8 +414,8 @@ static int ssd1307fb_probe(struct device_d *dev)
par->device_info = (struct ssd1307fb_deviceinfo *)match->data;
- par->reset = of_get_named_gpio(node,
- "reset-gpios", 0);
+ par->reset = of_get_named_gpio_flags(node,
+ "reset-gpios", 0, &of_flags);
if (!gpio_is_valid(par->reset) && par->reset == -EPROBE_DEFER) {
ret = -EPROBE_DEFER;
goto fb_alloc_error;
@@ -500,9 +501,12 @@ static int ssd1307fb_probe(struct device_d *dev)
info->screen_base = (u8 __force __iomem *)vmem;
if (par->reset >= 0) {
- ret = gpio_request_one(par->reset,
- GPIOF_OUT_INIT_HIGH,
- "oled-reset");
+ unsigned long flags = GPIOF_OUT_INIT_ACTIVE;
+
+ if (of_flags & OF_GPIO_ACTIVE_LOW)
+ flags |= GPIOF_ACTIVE_LOW;
+
+ ret = gpio_request_one(par->reset, flags, "oled-reset");
if (ret) {
dev_err(&client->dev,
"failed to request gpio %d: %d\n",
@@ -519,7 +523,7 @@ static int ssd1307fb_probe(struct device_d *dev)
if (par->reset > 0) {
/* Reset the screen */
- gpio_set_value(par->reset, 0);
+ gpio_set_active(par->reset, 1);
udelay(4);
}
@@ -531,7 +535,7 @@ static int ssd1307fb_probe(struct device_d *dev)
mdelay(100);
if (par->reset > 0) {
- gpio_set_value(par->reset, 1);
+ gpio_set_active(par->reset, 0);
udelay(4);
}
diff --git a/include/image-fit.h b/include/image-fit.h
index 27c9e83519..f21545988e 100644
--- a/include/image-fit.h
+++ b/include/image-fit.h
@@ -32,6 +32,9 @@ int fit_has_image(struct fit_handle *handle, void *configuration,
int fit_open_image(struct fit_handle *handle, void *configuration,
const char *name, const void **outdata,
unsigned long *outsize);
+int fit_get_image_address(struct fit_handle *handle, void *configuration,
+ const char *name, const char *property,
+ unsigned long *address);
void fit_close(struct fit_handle *handle);
diff --git a/include/image.h b/include/image.h
index 0a7832f139..963ea96863 100644
--- a/include/image.h
+++ b/include/image.h
@@ -23,55 +23,83 @@
/*
* Operating System Codes
+ *
+ * The following are exposed to uImage header.
+ * New IDs *MUST* be appended at the end of the list and *NEVER*
+ * inserted for backward compatibility.
*/
-#define IH_OS_INVALID 0 /* Invalid OS */
-#define IH_OS_OPENBSD 1 /* OpenBSD */
-#define IH_OS_NETBSD 2 /* NetBSD */
-#define IH_OS_FREEBSD 3 /* FreeBSD */
-#define IH_OS_4_4BSD 4 /* 4.4BSD */
-#define IH_OS_LINUX 5 /* Linux */
-#define IH_OS_SVR4 6 /* SVR4 */
-#define IH_OS_ESIX 7 /* Esix */
-#define IH_OS_SOLARIS 8 /* Solaris */
-#define IH_OS_IRIX 9 /* Irix */
-#define IH_OS_SCO 10 /* SCO */
-#define IH_OS_DELL 11 /* Dell */
-#define IH_OS_NCR 12 /* NCR */
-#define IH_OS_LYNXOS 13 /* LynxOS */
-#define IH_OS_VXWORKS 14 /* VxWorks */
-#define IH_OS_PSOS 15 /* pSOS */
-#define IH_OS_QNX 16 /* QNX */
-#define IH_OS_BAREBOX 17 /* Firmware */
-#define IH_OS_RTEMS 18 /* RTEMS */
-#define IH_OS_ARTOS 19 /* ARTOS */
-#define IH_OS_UNITY 20 /* Unity OS */
+enum {
+ IH_OS_INVALID = 0, /* Invalid OS */
+ IH_OS_OPENBSD, /* OpenBSD */
+ IH_OS_NETBSD, /* NetBSD */
+ IH_OS_FREEBSD, /* FreeBSD */
+ IH_OS_4_4BSD, /* 4.4BSD */
+ IH_OS_LINUX, /* Linux */
+ IH_OS_SVR4, /* SVR4 */
+ IH_OS_ESIX, /* Esix */
+ IH_OS_SOLARIS, /* Solaris */
+ IH_OS_IRIX, /* Irix */
+ IH_OS_SCO, /* SCO */
+ IH_OS_DELL, /* Dell */
+ IH_OS_NCR, /* NCR */
+ IH_OS_LYNXOS, /* LynxOS */
+ IH_OS_VXWORKS, /* VxWorks */
+ IH_OS_PSOS, /* pSOS */
+ IH_OS_QNX, /* QNX */
+ IH_OS_BAREBOX, /* Firmware */
+ IH_OS_RTEMS, /* RTEMS */
+ IH_OS_ARTOS, /* ARTOS */
+ IH_OS_UNITY, /* Unity OS */
+ IH_OS_INTEGRITY, /* INTEGRITY */
+ IH_OS_OSE, /* OSE */
+ IH_OS_PLAN9, /* Plan 9 */
+ IH_OS_OPENRTOS, /* OpenRTOS */
+ IH_OS_ARM_TRUSTED_FIRMWARE, /* ARM Trusted Firmware */
+ IH_OS_TEE, /* Trusted Execution Environment */
+ IH_OS_OPENSBI, /* RISC-V OpenSBI */
+ IH_OS_EFI, /* EFI Firmware (e.g. GRUB2) */
+
+ IH_OS_COUNT,
+};
/*
* CPU Architecture Codes (supported by Linux)
+ *
+ * The following are exposed to uImage header.
+ * New IDs *MUST* be appended at the end of the list and *NEVER*
+ * inserted for backward compatibility.
*/
-#define IH_ARCH_INVALID 0 /* Invalid CPU */
-#define IH_ARCH_ALPHA 1 /* Alpha */
-#define IH_ARCH_ARM 2 /* ARM */
-#define IH_ARCH_I386 3 /* Intel x86 */
-#define IH_ARCH_IA64 4 /* IA64 */
-#define IH_ARCH_MIPS 5 /* MIPS */
-#define IH_ARCH_MIPS64 6 /* MIPS 64 Bit */
-#define IH_ARCH_PPC 7 /* PowerPC */
-#define IH_ARCH_S390 8 /* IBM S390 */
-#define IH_ARCH_SH 9 /* SuperH */
-#define IH_ARCH_SPARC 10 /* Sparc */
-#define IH_ARCH_SPARC64 11 /* Sparc 64 Bit */
-#define IH_ARCH_M68K 12 /* M68K */
-#define IH_ARCH_NIOS 13 /* Nios-32 */
-#define IH_ARCH_MICROBLAZE 14 /* MicroBlaze */
-#define IH_ARCH_NIOS2 15 /* Nios-II */
-#define IH_ARCH_BLACKFIN 16 /* Blackfin */
-#define IH_ARCH_AVR32 17 /* AVR32 */
-#define IH_ARCH_LINUX 18 /* Linux */
-#define IH_ARCH_SANDBOX 19 /* Sandbox architecture (test only) */
-#define IH_ARCH_NDS32 20 /* ANDES Technology - NDS32 */
-#define IH_ARCH_OPENRISC 21 /* OpenRISC 1000 */
-#define IH_ARCH_ARM64 22 /* ARM64 */
+enum {
+ IH_ARCH_INVALID = 0, /* Invalid CPU */
+ IH_ARCH_ALPHA, /* Alpha */
+ IH_ARCH_ARM, /* ARM */
+ IH_ARCH_I386, /* Intel x86 */
+ IH_ARCH_IA64, /* IA64 */
+ IH_ARCH_MIPS, /* MIPS */
+ IH_ARCH_MIPS64, /* MIPS 64 Bit */
+ IH_ARCH_PPC, /* PowerPC */
+ IH_ARCH_S390, /* IBM S390 */
+ IH_ARCH_SH, /* SuperH */
+ IH_ARCH_SPARC, /* Sparc */
+ IH_ARCH_SPARC64, /* Sparc 64 Bit */
+ IH_ARCH_M68K, /* M68K */
+ IH_ARCH_NIOS, /* Nios-32 */
+ IH_ARCH_MICROBLAZE, /* MicroBlaze */
+ IH_ARCH_NIOS2, /* Nios-II */
+ IH_ARCH_BLACKFIN, /* Blackfin */
+ IH_ARCH_AVR32, /* AVR32 */
+ IH_ARCH_ST200, /* STMicroelectronics ST200 */
+ IH_ARCH_SANDBOX, /* Sandbox architecture (test only) */
+ IH_ARCH_NDS32, /* ANDES Technology - NDS32 */
+ IH_ARCH_OPENRISC, /* OpenRISC 1000 */
+ IH_ARCH_ARM64, /* ARM64 */
+ IH_ARCH_ARC, /* Synopsys DesignWare ARC */
+ IH_ARCH_X86_64, /* AMD x86_64, Intel and Via */
+ IH_ARCH_XTENSA, /* Xtensa */
+ IH_ARCH_RISCV, /* RISC-V */
+
+ IH_ARCH_COUNT,
+};
#if defined(__PPC__)
#define IH_ARCH IH_ARCH_PPC
@@ -142,24 +170,72 @@
* barebox's command interpreter; this feature is especially
* useful when you configure barebox to use a real shell (hush)
* as command interpreter (=> Shell Scripts).
+ *
+ * The following are exposed to uImage header.
+ * New IDs *MUST* be appended at the end of the list and *NEVER*
+ * inserted for backward compatibility.
*/
-#define IH_TYPE_INVALID 0 /* Invalid Image */
-#define IH_TYPE_STANDALONE 1 /* Standalone Program */
-#define IH_TYPE_KERNEL 2 /* OS Kernel Image */
-#define IH_TYPE_RAMDISK 3 /* RAMDisk Image */
-#define IH_TYPE_MULTI 4 /* Multi-File Image */
-#define IH_TYPE_FIRMWARE 5 /* Firmware Image */
-#define IH_TYPE_SCRIPT 6 /* Script file */
-#define IH_TYPE_FILESYSTEM 7 /* Filesystem Image (any type) */
-#define IH_TYPE_FLATDT 8 /* Binary Flat Device Tree Blob */
+enum {
+ IH_TYPE_INVALID = 0, /* Invalid Image */
+ IH_TYPE_STANDALONE, /* Standalone Program */
+ IH_TYPE_KERNEL, /* OS Kernel Image */
+ IH_TYPE_RAMDISK, /* RAMDisk Image */
+ IH_TYPE_MULTI, /* Multi-File Image */
+ IH_TYPE_FIRMWARE, /* Firmware Image */
+ IH_TYPE_SCRIPT, /* Script file */
+ IH_TYPE_FILESYSTEM, /* Filesystem Image (any type) */
+ IH_TYPE_FLATDT, /* Binary Flat Device Tree Blob */
+ IH_TYPE_KWBIMAGE, /* Kirkwood Boot Image */
+ IH_TYPE_IMXIMAGE, /* Freescale IMXBoot Image */
+ IH_TYPE_UBLIMAGE, /* Davinci UBL Image */
+ IH_TYPE_OMAPIMAGE, /* TI OMAP Config Header Image */
+ IH_TYPE_AISIMAGE, /* TI Davinci AIS Image */
+ /* OS Kernel Image, can run from any load address */
+ IH_TYPE_KERNEL_NOLOAD,
+ IH_TYPE_PBLIMAGE, /* Freescale PBL Boot Image */
+ IH_TYPE_MXSIMAGE, /* Freescale MXSBoot Image */
+ IH_TYPE_GPIMAGE, /* TI Keystone GPHeader Image */
+ IH_TYPE_ATMELIMAGE, /* ATMEL ROM bootable Image */
+ IH_TYPE_SOCFPGAIMAGE, /* Altera SOCFPGA CV/AV Preloader */
+ IH_TYPE_X86_SETUP, /* x86 setup.bin Image */
+ IH_TYPE_LPC32XXIMAGE, /* x86 setup.bin Image */
+ IH_TYPE_LOADABLE, /* A list of typeless images */
+ IH_TYPE_RKIMAGE, /* Rockchip Boot Image */
+ IH_TYPE_RKSD, /* Rockchip SD card */
+ IH_TYPE_RKSPI, /* Rockchip SPI image */
+ IH_TYPE_ZYNQIMAGE, /* Xilinx Zynq Boot Image */
+ IH_TYPE_ZYNQMPIMAGE, /* Xilinx ZynqMP Boot Image */
+ IH_TYPE_ZYNQMPBIF, /* Xilinx ZynqMP Boot Image (bif) */
+ IH_TYPE_FPGA, /* FPGA Image */
+ IH_TYPE_VYBRIDIMAGE, /* VYBRID .vyb Image */
+ IH_TYPE_TEE, /* Trusted Execution Environment OS Image */
+ IH_TYPE_FIRMWARE_IVT, /* Firmware Image with HABv4 IVT */
+ IH_TYPE_PMMC, /* TI Power Management Micro-Controller Firmware */
+ IH_TYPE_STM32IMAGE, /* STMicroelectronics STM32 Image */
+ IH_TYPE_SOCFPGAIMAGE_V1, /* Altera SOCFPGA A10 Preloader */
+ IH_TYPE_MTKIMAGE, /* MediaTek BootROM loadable Image */
+ IH_TYPE_IMX8MIMAGE, /* Freescale IMX8MBoot Image */
+ IH_TYPE_IMX8IMAGE, /* Freescale IMX8Boot Image */
+ IH_TYPE_COPRO, /* Coprocessor Image for remoteproc*/
+
+ IH_TYPE_COUNT, /* Number of image types */
+};
/*
* Compression Types
+ *
+ * The following are exposed to uImage header.
+ * New IDs *MUST* be appended at the end of the list and *NEVER*
+ * inserted for backward compatibility.
*/
-#define IH_COMP_NONE 0 /* No Compression Used */
-#define IH_COMP_GZIP 1 /* gzip Compression Used */
-#define IH_COMP_BZIP2 2 /* bzip2 Compression Used */
+enum {
+ IH_COMP_NONE = 0, /* No Compression Used */
+ IH_COMP_GZIP, /* gzip Compression Used */
+ IH_COMP_BZIP2, /* bzip2 Compression Used */
+
+ IH_COMP_COUNT,
+};
#define IH_MAGIC 0x27051956 /* Image Magic Number */
#define IH_NMLEN 32 /* Image Name Length */
diff --git a/include/spi/spi.h b/include/spi/spi.h
index 66e0500d04..c5efca1cc3 100644
--- a/include/spi/spi.h
+++ b/include/spi/spi.h
@@ -515,6 +515,8 @@ static inline int spi_driver_register(struct driver_d *drv)
return register_driver(drv);
}
+#define coredevice_spi_driver(drv) \
+ register_driver_macro(coredevice,spi,drv)
#define device_spi_driver(drv) \
register_driver_macro(device,spi,drv)
diff --git a/include/usb/gadget.h b/include/usb/gadget.h
index afa11b2d9d..3e1d7153dc 100644
--- a/include/usb/gadget.h
+++ b/include/usb/gadget.h
@@ -561,6 +561,7 @@ struct usb_gadget {
uint32_t product_id;
char *manufacturer;
char *productname;
+ char *serialnumber;
};
#define work_to_gadget(w) (container_of((w), struct usb_gadget, work))
diff --git a/lib/string.c b/lib/string.c
index 717b59aa50..7548fd3581 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -208,6 +208,8 @@ int strcmp(const char * cs,const char * ct)
{
register signed char __res;
+ BUG_ON(!cs || !ct);
+
while (1) {
if ((__res = *cs - *ct++) != 0 || !*cs++)
break;
@@ -229,6 +231,8 @@ int strncmp(const char * cs, const char * ct, size_t count)
{
register signed char __res = 0;
+ BUG_ON(!cs || !ct);
+
while (count) {
if ((__res = *cs - *ct++) != 0 || !*cs++)
break;
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 3799e777cd..337430cd00 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -184,6 +184,7 @@ dtc_cpp_flags = -Wp,-MD,$(depfile).pre -nostdinc \
-I$(srctree)/dts/include \
-I$(srctree)/include \
-I$(srctree)/dts/src/ \
+ $(DTC_CPP_FLAGS_$(basetarget).dtb) \
-undef -D__DTS__
ifdef CONFIG_BOOTM_FITIMAGE_PUBKEY