summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-01-11 19:00:03 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2017-01-11 19:00:03 +0100
commite05529dd8b582c4421938066a5ff5006452ced78 (patch)
treeb4e925b08f2f672c6331db06c4b1986e58f89a75
parent0c3f4d1da2277ac0cb88dc32ac0de48bc241e01f (diff)
parent9563a024d28c0f35db8fc459931f4909bbffe5eb (diff)
downloadbarebox-e05529dd8b582c4421938066a5ff5006452ced78.tar.gz
barebox-e05529dd8b582c4421938066a5ff5006452ced78.tar.xz
Merge branch 'for-next/misc'
-rw-r--r--Documentation/user/bootchooser.rst57
-rw-r--r--Documentation/user/remote-control.rst4
-rw-r--r--arch/arm/boards/vscom-baltos/lowlevel.c6
-rw-r--r--arch/arm/dts/imx53-guf-vincell-lt.dts2
-rw-r--r--arch/arm/dts/imx53-guf-vincell.dts2
-rw-r--r--arch/arm/dts/socfpga.dtsi11
-rw-r--r--arch/arm/mach-at91/bootstrap.c3
-rw-r--r--arch/arm/mach-omap/include/mach/am33xx-silicon.h1
-rw-r--r--arch/arm/mach-socfpga/Makefile1
-rw-r--r--arch/arm/mach-socfpga/xload.c4
-rw-r--r--arch/mips/include/asm/debug_ll_ns16550.h32
-rw-r--r--arch/mips/include/asm/pbl_nmon.h31
-rw-r--r--arch/mips/mach-ath79/include/mach/debug_ll.h32
-rw-r--r--arch/nios2/Makefile2
-rw-r--r--arch/nios2/cpu/cpu.c2
-rw-r--r--commands/i2c.c2
-rw-r--r--commands/memcmp.c4
-rw-r--r--commands/menu.c2
-rw-r--r--common/boot.c2
-rw-r--r--common/environment.c2
-rw-r--r--common/globalvar.c4
-rw-r--r--common/menu.c12
-rw-r--r--drivers/ata/ahci.c7
-rw-r--r--drivers/ata/pata-imx.c8
-rw-r--r--drivers/base/regmap/regmap.c27
-rw-r--r--drivers/gpio/Kconfig8
-rw-r--r--drivers/gpio/Makefile1
-rw-r--r--drivers/gpio/gpio-74164.c1
-rw-r--r--drivers/gpio/gpio-sx150x.c274
-rw-r--r--drivers/i2c/muxes/i2c-mux-pca954x.c7
-rw-r--r--drivers/input/input.c4
-rw-r--r--drivers/mci/omap_hsmmc.c2
-rw-r--r--drivers/mfd/da9053.c13
-rw-r--r--drivers/mtd/devices/m25p80.c2
-rw-r--r--drivers/mtd/peb.c7
-rw-r--r--drivers/mtd/spi-nor/spi-nor.c1
-rw-r--r--drivers/mtd/ubi/io.c2
-rw-r--r--drivers/of/platform.c2
-rw-r--r--include/menu.h2
-rw-r--r--include/regmap.h6
-rw-r--r--lib/int_sqrt.c1
41 files changed, 443 insertions, 150 deletions
diff --git a/Documentation/user/bootchooser.rst b/Documentation/user/bootchooser.rst
index 5baa66d9b9..cef1d4abb0 100644
--- a/Documentation/user/bootchooser.rst
+++ b/Documentation/user/bootchooser.rst
@@ -67,7 +67,7 @@ Additionally the remaining_attempts counter can be reset manually using the
:ref:`command_bootchooser` command. This allows for custom conditions under which
a system is marked as good.
In case only the booted system itself knows when it is in a good state, the
-barebox-state tool from the dt-utils_ package can used to reset the remaining_attempts
+barebox-state tool from the dt-utils_ package can be used to reset the remaining_attempts
counter from the currently running system.
.. _dt-utils: http://git.pengutronix.de/?p=tools/dt-utils.git;a=summary
@@ -79,8 +79,8 @@ Additionally to the target options described above, bootchooser has some general
options not specific to any target.
``global.bootchooser.disable_on_zero_attempts``
- Boolean flag. if 1, bootchooser disables a target (sets priority to 0) whenever the
- remaining attempts counter reaches 0.
+ Boolean flag. If set to 1, bootchooser disables a target (sets priority to 0) whenever
+ the remaining attempts counter reaches 0.
``global.bootchooser.default_attempts``
The default number of attempts that a target shall be tried starting, used when not
overwritten with the target specific variable of the same name.
@@ -89,25 +89,28 @@ options not specific to any target.
of the same name.
``global.bootchooser.reset_attempts``
A space separated list of events that cause bootchooser to reset the
- remaining_attempts counters of each target that has a non zero priority. possible values:
- * empty: counters will never be reset``
+ remaining_attempts counters of each target that has a non zero priority. Possible values:
+
+ * empty: counters will never be reset``
* power-on: counters will be reset after power-on-reset
* all-zero: counters will be reset when all targets have zero remaining attempts
``global.bootchooser.reset_priorities``
A space separated list of events that cause bootchooser to reset the priorities of
all targets. Possible values:
+
* empty: priorities will never be reset
* all-zero: priorities will be reset when all targets have zero priority
``global.bootchooser.retry``
- If 1, bootchooser retries booting until one succeeds or no more valid targets exist.
+ If set to 1, bootchooser retries booting until one succeeds or no more valid targets
+ exist.
``global.bootchooser.state_prefix``
- Variable prefix when bootchooser used with state framework as backend for storing runtime
- data, see below.
+ Variable prefix when bootchooser is used with the state framework as backend for storing
+ runtime data, see below.
``global.bootchooser.targets``
Space separated list of targets that are used. For each entry in the list a corresponding
- set of ``global.bootchooser.<name>``. variables must exist.
+ set of ``global.bootchooser.<targetname>.<variablename>`` variables must exist.
``global.bootchooser.last_chosen``
- bootchooser sets this to the target that was chosen on last boot (index)
+ bootchooser sets this to the target that was chosen on last boot (index).
Using the State Framework as Backend for Runtime Variable Data
--------------------------------------------------------------
@@ -178,7 +181,7 @@ Settings
- ``global.bootchooser.disable_on_zero_attempts=0``
- ``global.bootchooser.retry=1``
- ``global.boot.default="bootchooser recovery"``
-- Userspace marks as good
+- Userspace marks as good.
Deployment
^^^^^^^^^^
@@ -208,21 +211,22 @@ Settings
- ``global.bootchooser.disable_on_zero_attempts=0``
- ``global.bootchooser.retry=1``
- ``global.boot.default="bootchooser recovery"``
-- Userspace marks as good
+- Userspace marks as good.
Deployment
^^^^^^^^^^
-#. barebox or flash robot fills all slots with valid systems
+#. barebox or flash robot fills all slots with valid systems.
#. barebox or flash robot marks slots as good or state contains non zero
- defaults for the remaining_attempts / priorities
+ defaults for the remaining_attempts/priorities.
Recovery
^^^^^^^^
done by 'recovery' boot target which is booted after the bootchooser falls through due to
the lack of bootable targets. This target can be:
-- A system that will be booted as recovery
-- A barebox script that will be started
+
+- A system that will be booted as recovery.
+- A barebox script that will be started.
Scenario 3
##########
@@ -238,21 +242,22 @@ Settings
- ``global.bootchooser.disable_on_zero_attempts=1``
- ``global.bootchooser.retry=1``
- ``global.boot.default="bootchooser recovery"``
-- Userspace marks as good
+- Userspace marks as good.
Deployment
^^^^^^^^^^
-- barebox or flash robot fills all slots with valid systems
-- barebox or flash robot marks slots as good
+#. barebox or flash robot fills all slots with valid systems.
+#. barebox or flash robot marks slots as good.
Recovery
^^^^^^^^
Done by 'recovery' boot target which is booted after the bootchooser falls through
due to the lack of bootable targets. This target can be:
-- A system that will be booted as recovery
-- A barebox script that will be started
+
+- A system that will be booted as recovery.
+- A barebox script that will be started.
Updating systems
----------------
@@ -262,11 +267,11 @@ update is done under a running Linux system which can be one of the regular boot
slots or a dedicated recovery system. For the regular slots updating is done like:
- Set the priority of the inactive slot to 0.
-- Update the inactive slot
-- Set priority of the inactive slot to a higher value than the active slot
-- Set remaining_attempts of the inactive slot to nonzero
-- Reboot
-- If necessary update the now inactive, not yet updated slot the same way
+- Update the inactive slot.
+- Set priority of the inactive slot to a higher value than the active slot.
+- Set remaining_attempts of the inactive slot to nonzero.
+- Reboot.
+- If necessary update the now inactive, not yet updated slot the same way.
One way of updating systems is using RAUC_ which integrates well with the bootchooser
in barebox.
diff --git a/Documentation/user/remote-control.rst b/Documentation/user/remote-control.rst
index b9275cea80..99c2181dfe 100644
--- a/Documentation/user/remote-control.rst
+++ b/Documentation/user/remote-control.rst
@@ -112,10 +112,10 @@ This is especially useful for flawy serial connections.
barebox@Phytec phyFLEX-i.MX6 Quad Carrier-Board:/ ls
. .. dev env mnt
-*NOTE** To terminate resulting Barebox console session press 'Ctrl-T'
+**NOTE** To terminate resulting Barebox console session press 'Ctrl-T'
**NOTE** You can also send 'ping' request to the target without
- closing console session by pressint 'Ctrl-P'
+closing console session by pressint 'Ctrl-P'
transferring files
------------------
diff --git a/arch/arm/boards/vscom-baltos/lowlevel.c b/arch/arm/boards/vscom-baltos/lowlevel.c
index 87f2a748f3..9f829b9977 100644
--- a/arch/arm/boards/vscom-baltos/lowlevel.c
+++ b/arch/arm/boards/vscom-baltos/lowlevel.c
@@ -126,6 +126,12 @@ ENTRY_FUNCTION(start_am33xx_baltos_sdram, r0, r1, r2)
{
void *fdt;
+ /*
+ * Prolong global reset duration to the max. value (0xff)
+ * and leave power domain reset to its default value (0x10).
+ */
+ __raw_writel(0x000010ff, AM33XX_PRM_RSTTIME);
+
fdt = __dtb_am335x_baltos_minimal_start;
fdt -= get_runtime_offset();
diff --git a/arch/arm/dts/imx53-guf-vincell-lt.dts b/arch/arm/dts/imx53-guf-vincell-lt.dts
index 67a41332f5..2b1b54acc5 100644
--- a/arch/arm/dts/imx53-guf-vincell-lt.dts
+++ b/arch/arm/dts/imx53-guf-vincell-lt.dts
@@ -152,7 +152,7 @@
};
pmic: dialog@48 { /* DA9053-3HHA1 PMIC */
- compatible = "dialog,da9053-aa", "dialog,da9052";
+ compatible = "dlg,da9053-aa", "dlg,da9052";
reg = <0x48>;
interrupt-parent = <&gpio7>;
interrupts = <12 IRQ_TYPE_LEVEL_LOW>;
diff --git a/arch/arm/dts/imx53-guf-vincell.dts b/arch/arm/dts/imx53-guf-vincell.dts
index 2f0153e7b2..f743f171d6 100644
--- a/arch/arm/dts/imx53-guf-vincell.dts
+++ b/arch/arm/dts/imx53-guf-vincell.dts
@@ -102,7 +102,7 @@
status = "okay";
pmic: dialog@48 { /* DA9053-3HHA1 PMIC */
- compatible = "dialog,da9053-aa", "dialog,da9052";
+ compatible = "dlg,da9053-aa", "dlg,da9052";
reg = <0x48>;
interrupt-parent = <&gpio7>;
interrupts = <12 IRQ_TYPE_LEVEL_LOW>;
diff --git a/arch/arm/dts/socfpga.dtsi b/arch/arm/dts/socfpga.dtsi
index 5b141c2391..274c491804 100644
--- a/arch/arm/dts/socfpga.dtsi
+++ b/arch/arm/dts/socfpga.dtsi
@@ -25,17 +25,6 @@
clock-names = "qspi_clk";
status = "disabled";
};
-
- fpgamgr@ff706000 {
- compatible = "altr,socfpga-fpga-mgr";
- reg = <0xff706000 0x1000>,
- <0xffb90000 0x1000>;
- };
-
- system_mgr: sysmgr@ffd08000 {
- compatible = "altr,sys-mgr", "syscon";
- reg = <0xffd08000 0x4000>;
- };
};
};
&osc2 {
diff --git a/arch/arm/mach-at91/bootstrap.c b/arch/arm/mach-at91/bootstrap.c
index 8502bb00ff..9dd575b744 100644
--- a/arch/arm/mach-at91/bootstrap.c
+++ b/arch/arm/mach-at91/bootstrap.c
@@ -155,7 +155,8 @@ void at91_bootstrap_menu(void)
struct menu_entry *me;
m = menu_alloc();
- m->display = m->name = "boot";
+ m->name = "boot";
+ menu_add_title(m, m->name);
menu_add(m);
diff --git a/arch/arm/mach-omap/include/mach/am33xx-silicon.h b/arch/arm/mach-omap/include/mach/am33xx-silicon.h
index e17e609879..10595d5ee7 100644
--- a/arch/arm/mach-omap/include/mach/am33xx-silicon.h
+++ b/arch/arm/mach-omap/include/mach/am33xx-silicon.h
@@ -71,6 +71,7 @@
#define AM33XX_PRM_RSTCTRL (AM33XX_PRM_BASE + 0x0f00)
#define AM33XX_PRM_RSTCTRL_RESET 0x1
+#define AM33XX_PRM_RSTTIME (AM33XX_PRM_BASE + 0x0f04)
#define AM33XX_PRM_RSTST (AM33XX_PRM_BASE + 0x0f08)
/* CTRL */
diff --git a/arch/arm/mach-socfpga/Makefile b/arch/arm/mach-socfpga/Makefile
index b81d57da26..dea0e075d1 100644
--- a/arch/arm/mach-socfpga/Makefile
+++ b/arch/arm/mach-socfpga/Makefile
@@ -2,4 +2,3 @@ obj-y += generic.o nic301.o bootsource.o reset-manager.o
pbl-y += init.o freeze-controller.o scan-manager.o system-manager.o
pbl-y += clock-manager.o
obj-$(CONFIG_ARCH_SOCFPGA_XLOAD) += xload.o
-obj-$(CONFIG_ARCH_SOCFPGA_FPGA) += fpga.o
diff --git a/arch/arm/mach-socfpga/xload.c b/arch/arm/mach-socfpga/xload.c
index 993626966e..d24944bbb8 100644
--- a/arch/arm/mach-socfpga/xload.c
+++ b/arch/arm/mach-socfpga/xload.c
@@ -28,7 +28,7 @@ static struct socfpga_barebox_part default_parts[] = {
},
{ /* sentinel */ }
};
-const struct socfpga_barebox_part *barebox_parts = &default_parts;
+const struct socfpga_barebox_part *barebox_parts = default_parts;
enum socfpga_clks {
timer, mmc, qspi_clk, uart, clk_max
@@ -111,7 +111,7 @@ static void socfpga_timer_init(void)
static __noreturn int socfpga_xload(void)
{
enum bootsource bootsource = bootsource_get();
- struct socfpga_barebox_part *part;
+ const struct socfpga_barebox_part *part;
void *buf = NULL;
switch (bootsource) {
diff --git a/arch/mips/include/asm/debug_ll_ns16550.h b/arch/mips/include/asm/debug_ll_ns16550.h
index 4a6562f7c1..058814ecfd 100644
--- a/arch/mips/include/asm/debug_ll_ns16550.h
+++ b/arch/mips/include/asm/debug_ll_ns16550.h
@@ -128,38 +128,6 @@ static inline void PUTC_LL(char ch)
.endm
/*
- * output a 32-bit value in hex
- */
-.macro debug_ll_outhexw
-#ifdef CONFIG_DEBUG_LL
- .set push
- .set reorder
-
- move t6, a0
- li t5, 32
-
-202:
- addi t5, t5, -4
- srlv a0, t6, t5
-
- /* output one hex digit */
- andi a0, a0, 15
- blt a0, 10, 203f
-
- addi a0, a0, ('a' - '9' - 1)
-
-203:
- addi a0, a0, '0'
-
- debug_ll_outc_a0
-
- bgtz t5, 202b
-
- .set pop
-#endif /* CONFIG_DEBUG_LL */
-.endm
-
-/*
* check character in input buffer
* return value:
* v0 = 0 no character in input buffer
diff --git a/arch/mips/include/asm/pbl_nmon.h b/arch/mips/include/asm/pbl_nmon.h
index 90e2da8ef9..e0326bd7cd 100644
--- a/arch/mips/include/asm/pbl_nmon.h
+++ b/arch/mips/include/asm/pbl_nmon.h
@@ -43,6 +43,37 @@
.set pop
.endm
+/*
+ * output a 32-bit value in hex
+ */
+.macro debug_ll_outhexw
+#ifdef CONFIG_DEBUG_LL
+ .set push
+ .set reorder
+
+ move t6, a0
+ li t5, 32
+
+202:
+ addi t5, t5, -4
+ srlv a0, t6, t5
+
+ /* output one hex digit */
+ andi a0, a0, 15
+ blt a0, 10, 203f
+
+ addi a0, a0, ('a' - '9' - 1)
+
+203:
+ addi a0, a0, '0'
+
+ debug_ll_outc_a0
+
+ bgtz t5, 202b
+
+ .set pop
+#endif /* CONFIG_DEBUG_LL */
+.endm
.macro mips_nmon
.set push
diff --git a/arch/mips/mach-ath79/include/mach/debug_ll.h b/arch/mips/mach-ath79/include/mach/debug_ll.h
index e0c3f797b2..04bd3ea72b 100644
--- a/arch/mips/mach-ath79/include/mach/debug_ll.h
+++ b/arch/mips/mach-ath79/include/mach/debug_ll.h
@@ -123,38 +123,6 @@ static inline void PUTC_LL(int ch)
.endm
/*
- * output a 32-bit value in hex
- */
-.macro debug_ll_outhexw
-#ifdef CONFIG_DEBUG_LL
- .set push
- .set reorder
-
- move t6, a0
- li t5, 32
-
-202:
- addi t5, t5, -4
- srlv a0, t6, t5
-
- /* output one hex digit */
- andi a0, a0, 15
- blt a0, 10, 203f
-
- addi a0, a0, ('a' - '9' - 1)
-
-203:
- addi a0, a0, '0'
-
- debug_ll_outc_a0
-
- bgtz t5, 202b
-
- .set pop
-#endif /* CONFIG_DEBUG_LL */
-.endm
-
-/*
* check character in input buffer
* return value:
* v0 = 0 no character in input buffer
diff --git a/arch/nios2/Makefile b/arch/nios2/Makefile
index 681944f22d..3e97155e7c 100644
--- a/arch/nios2/Makefile
+++ b/arch/nios2/Makefile
@@ -7,7 +7,7 @@ KALLSYMS += --symbol-prefix=_
archprepare: maketools
@$(kecho) " SYMLINK include/nios_sopc.h -> arch/nios2/boards/$(board-y)/nios_sopc.h"
- @ln -fsn ../arch/nios2/boards/$(board-y)/nios_sopc.h include/nios_sopc.h
+ @ln -fsn $(src)/arch/nios2/boards/$(board-y)/nios_sopc.h $(obj)/include/nios_sopc.h
PHONY += maketools
diff --git a/arch/nios2/cpu/cpu.c b/arch/nios2/cpu/cpu.c
index b2164af812..77fde6be41 100644
--- a/arch/nios2/cpu/cpu.c
+++ b/arch/nios2/cpu/cpu.c
@@ -33,7 +33,7 @@ static void __noreturn nios2_restart_soc(struct restart_handler *rst)
static int restart_register_feature(void)
{
- restart_handler_register_fn(nios2_restart_soc);
+ return restart_handler_register_fn(nios2_restart_soc);
}
coredevice_initcall(restart_register_feature);
diff --git a/commands/i2c.c b/commands/i2c.c
index ae7f7fc6d0..573032ab15 100644
--- a/commands/i2c.c
+++ b/commands/i2c.c
@@ -32,7 +32,7 @@ static void i2c_probe_range(struct i2c_adapter *adapter, int startaddr, int stop
client.adapter = adapter;
printf("probing i2c%d range 0x%02x-0x%02x: ", adapter->nr, startaddr, stopaddr);
- for (addr = startaddr; addr <= stopaddr; addr++) {
+ for (addr = startaddr; addr <= stopaddr && !ctrlc(); addr++) {
client.addr = addr;
ret = i2c_write_reg(&client, 0x00, &reg, 0);
if (ret == 0)
diff --git a/commands/memcmp.c b/commands/memcmp.c
index ce044df0d9..7be0033f55 100644
--- a/commands/memcmp.c
+++ b/commands/memcmp.c
@@ -130,8 +130,8 @@ out:
}
BAREBOX_CMD_HELP_START(memcmp)
-BAREBOX_CMD_HELP_TEXT("Compare memory regions specified with ADDR and ADDR2")
-BAREBOX_CMD_HELP_TEXT("of size COUNT bytes. If source is a file COUNT can")
+BAREBOX_CMD_HELP_TEXT("Compare memory regions specified with ADDR1 and ADDR2")
+BAREBOX_CMD_HELP_TEXT("of size COUNT bytes. If source is a file, COUNT can")
BAREBOX_CMD_HELP_TEXT("be left unspecified, in which case the whole file is")
BAREBOX_CMD_HELP_TEXT("compared.")
BAREBOX_CMD_HELP_TEXT("")
diff --git a/commands/menu.c b/commands/menu.c
index 72db26e5d1..ddc9c3ab86 100644
--- a/commands/menu.c
+++ b/commands/menu.c
@@ -147,7 +147,7 @@ static int do_menu_add(struct cmd_menu *cm)
if (!m->name)
goto free;
- menu_add_title(m, strdup(cm->description));
+ menu_add_title(m, cm->description);
ret = menu_add(m);
diff --git a/common/boot.c b/common/boot.c
index 123b874b3c..4306319331 100644
--- a/common/boot.c
+++ b/common/boot.c
@@ -44,7 +44,7 @@ struct bootentries *bootentries_alloc(void)
if (IS_ENABLED(CONFIG_MENU)) {
bootentries->menu = menu_alloc();
- menu_add_title(bootentries->menu, basprintf("boot"));
+ menu_add_title(bootentries->menu, "boot");
}
return bootentries;
diff --git a/common/environment.c b/common/environment.c
index c9cef6322a..0edf34b661 100644
--- a/common/environment.c
+++ b/common/environment.c
@@ -382,7 +382,7 @@ EXPORT_SYMBOL(envfs_save);
static int envfs_check_super(struct envfs_super *super, size_t *size)
{
if (ENVFS_32(super->magic) != ENVFS_MAGIC) {
- printf("envfs: no envfs (magic mismatch) - envfs newer written?\n");
+ printf("envfs: no envfs (magic mismatch) - envfs never written?\n");
return -EIO;
}
diff --git a/common/globalvar.c b/common/globalvar.c
index e75cac96d7..52808f8852 100644
--- a/common/globalvar.c
+++ b/common/globalvar.c
@@ -379,10 +379,10 @@ void globalvar_set_match(const char *match, const char *val)
}
}
-int globalvar_simple_set(struct device_d *dev, struct param_d *p, const char *val)
+static int globalvar_simple_set(struct device_d *dev, struct param_d *p, const char *val)
{
struct device_d *rdev;
- const char *pname;
+ const char *pname = NULL;
int ret;
ret = nvvar_device_dispatch(p->name, &rdev, &pname);
diff --git a/common/menu.c b/common/menu.c
index 64df458e68..e757216c5a 100644
--- a/common/menu.c
+++ b/common/menu.c
@@ -526,18 +526,17 @@ EXPORT_SYMBOL(menu_add_command_entry);
* @display: NULL or pointer to the string which will be freed in this function.
* If NULL or zero length string is provided, default title will be added.
*/
-void menu_add_title(struct menu *m, char *display)
+void menu_add_title(struct menu *m, const char *display)
{
char *tmp, *src, *dst;
int lines = 1;
int i;
- if (!display || !strlen(display)) {
- free(display);
- display = xasprintf("Menu : %s", m->name ? m->name : "");
- }
+ if (!display || !strlen(display))
+ src = dst = tmp = xasprintf("Menu : %s", m->name ? m->name : "");
+ else
+ src = dst = tmp = xstrdup(display);
- src = dst = tmp = xstrdup(display);
/* Count lines and separate single string into multiple strings */
while (*src) {
if (*src == '\\') {
@@ -575,6 +574,5 @@ void menu_add_title(struct menu *m, char *display)
}
free(tmp);
- free(display);
}
EXPORT_SYMBOL(menu_add_title);
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index c31b337ba2..b416105970 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -207,7 +207,6 @@ static int ahci_read_id(struct ata_port *ata, void *buf)
{
struct ahci_port *ahci = container_of(ata, struct ahci_port, ata);
u8 fis[20];
- int ret;
memset(fis, 0, sizeof(fis));
@@ -216,11 +215,7 @@ static int ahci_read_id(struct ata_port *ata, void *buf)
fis[1] = 1 << 7; /* Command FIS. */
fis[2] = ATA_CMD_ID_ATA; /* Command byte. */
- ret = ahci_io(ahci, fis, sizeof(fis), buf, NULL, SECTOR_SIZE);
- if (ret)
- return ret;
-
- return ret;
+ return ahci_io(ahci, fis, sizeof(fis), buf, NULL, SECTOR_SIZE);
}
static int ahci_rw(struct ata_port *ata, void *rbuf, const void *wbuf,
diff --git a/drivers/ata/pata-imx.c b/drivers/ata/pata-imx.c
index c8098a537f..4f75048c12 100644
--- a/drivers/ata/pata-imx.c
+++ b/drivers/ata/pata-imx.c
@@ -158,7 +158,6 @@ static int imx_pata_probe(struct device_d *dev)
struct clk *clk;
void __iomem *base;
int ret;
- const char *devname = NULL;
ide = xzalloc(sizeof(*ide));
iores = dev_request_mem_resource(dev, 0);
@@ -182,14 +181,9 @@ static int imx_pata_probe(struct device_d *dev)
pata_imx_set_bus_timing(base, clk_get_rate(clk), 4);
- if (IS_ENABLED(CONFIG_OFDEVICE)) {
- devname = of_alias_get(dev->device_node);
- if (devname)
- devname = xstrdup(devname);
- }
ide->port.dev = dev;
- ide->port.devname = devname;
+ ide->port.devname = xstrdup(of_alias_get(dev->device_node));
dev->priv = ide;
dev->detect = pata_imx_detect;
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index a042a1a24e..52b7d88c74 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -137,6 +137,33 @@ int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val)
}
/**
+ * regmap_write_bits - write bits of a register in a map
+ *
+ * @map: The map
+ * @reg: The register offset of the register
+ * @mask: Mask indicating bits to be modified
+ * (1 - modified, 0 - untouched)
+ * @val: Bit value to be set
+ *
+ * Returns 0 for success or negative error code on failure
+ */
+int regmap_write_bits(struct regmap *map, unsigned int reg,
+ unsigned int mask, unsigned int val)
+{
+ int ret;
+ unsigned int tmp, orig;
+
+ ret = regmap_read(map, reg, &orig);
+ if (ret != 0)
+ return ret;
+
+ tmp = orig & ~mask;
+ tmp |= val & mask;
+
+ return regmap_write(map, reg, tmp);
+}
+
+/**
* regmap_bulk_read(): Read data from the device
*
* @map: Register map to read from
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index ab919c95f5..078deee4e5 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -121,6 +121,14 @@ config GPIO_DESIGNWARE
help
Say Y or M here to build support for the Synopsys DesignWare APB
GPIO block.
+
+config GPIO_SX150X
+ bool "Semtec SX150x I/O ports"
+ depends on I2C
+ help
+ Say Y here to build support for the Semtec Sx150x I2C GPIO
+ expander chip.
+
endmenu
endif
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 8767eed1e8..2d5142d41c 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -18,3 +18,4 @@ obj-$(CONFIG_GPIO_PL061) += gpio-pl061.o
obj-$(CONFIG_GPIO_STMPE) += gpio-stmpe.o
obj-$(CONFIG_GPIO_TEGRA) += gpio-tegra.o
obj-$(CONFIG_GPIO_DESIGNWARE) += gpio-dw.o
+obj-$(CONFIG_GPIO_SX150X) += gpio-sx150x.o
diff --git a/drivers/gpio/gpio-74164.c b/drivers/gpio/gpio-74164.c
index 926207aaf7..e4d413b689 100644
--- a/drivers/gpio/gpio-74164.c
+++ b/drivers/gpio/gpio-74164.c
@@ -92,6 +92,7 @@ static struct gpio_ops gpio_74164_ops = {
static struct platform_device_id gpio_74164_ids[] = {
{ "74hc164" },
+ { "74lvc594" },
{ "74hc595" },
{ }
};
diff --git a/drivers/gpio/gpio-sx150x.c b/drivers/gpio/gpio-sx150x.c
new file mode 100644
index 0000000000..7b8cfb5042
--- /dev/null
+++ b/drivers/gpio/gpio-sx150x.c
@@ -0,0 +1,274 @@
+/*
+ * Driver for SX150x I2C GPIO expanders
+ *
+ * This code was ported from linux-4.9 kernel driver by
+ * Andrey Smirnov <andrew.smirnov@gmail.com>.
+ *
+ * Orginal code with it's copyright info can be found in
+ * drivers/pinctrl/pinctrl-sx150x.c
+ *
+ * Note: That although linux driver was converted from being a GPIO
+ * subsystem to Pinctrl subsytem driver, due to Barebox's lack of
+ * similar provisions this driver is still a GPIO driver.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ */
+
+#include <common.h>
+#include <init.h>
+#include <malloc.h>
+#include <driver.h>
+#include <xfuncs.h>
+#include <errno.h>
+#include <i2c/i2c.h>
+#include <regmap.h>
+
+#include <gpio.h>
+#include <of_device.h>
+
+enum {
+ SX150X_123 = 0,
+ SX150X_456,
+ SX150X_789,
+};
+
+enum {
+ SX150X_MAX_REGISTER = 0xad,
+};
+
+struct sx150x_device_data {
+ u8 model;
+ u8 reg_dir;
+ u8 reg_data;
+ u8 ngpios;
+};
+
+struct sx150x_gpio {
+ struct device *dev;
+ struct i2c_client *client;
+ struct gpio_chip gpio;
+ struct regmap *regmap;
+ const struct sx150x_device_data *data;
+};
+
+static const struct sx150x_device_data sx1503q_device_data = {
+ .model = SX150X_123,
+ .reg_dir = 0x02,
+ .reg_data = 0x00,
+ .ngpios = 16,
+};
+
+static struct sx150x_gpio *to_sx150x_gpio(struct gpio_chip *gpio)
+{
+ return container_of(gpio, struct sx150x_gpio, gpio);
+}
+
+static int sx150x_gpio_get_direction(struct gpio_chip *gpio,
+ unsigned int offset)
+{
+ struct sx150x_gpio *sx150x = to_sx150x_gpio(gpio);
+ unsigned int value;
+ int ret;
+
+ ret = regmap_read(sx150x->regmap, sx150x->data->reg_dir, &value);
+ if (ret < 0)
+ return ret;
+
+ return !!(value & BIT(offset));
+}
+
+static int sx150x_gpio_get(struct gpio_chip *gpio, unsigned int offset)
+{
+ struct sx150x_gpio *sx150x = to_sx150x_gpio(gpio);
+ unsigned int value;
+ int ret;
+
+ ret = regmap_read(sx150x->regmap, sx150x->data->reg_data, &value);
+ if (ret < 0)
+ return ret;
+
+ return !!(value & BIT(offset));
+}
+
+static int __sx150x_gpio_set(struct sx150x_gpio *sx150x, unsigned int offset,
+ int value)
+{
+ return regmap_write_bits(sx150x->regmap, sx150x->data->reg_data,
+ BIT(offset), value ? BIT(offset) : 0);
+}
+
+
+static void sx150x_gpio_set(struct gpio_chip *gpio, unsigned int offset,
+ int value)
+{
+ __sx150x_gpio_set(to_sx150x_gpio(gpio), offset, value);
+}
+
+static int sx150x_gpio_direction_input(struct gpio_chip *gpio,
+ unsigned int offset)
+{
+ struct sx150x_gpio *sx150x = to_sx150x_gpio(gpio);
+
+ return regmap_write_bits(sx150x->regmap,
+ sx150x->data->reg_dir,
+ BIT(offset), BIT(offset));
+}
+
+static int sx150x_gpio_direction_output(struct gpio_chip *gpio,
+ unsigned int offset, int value)
+{
+ struct sx150x_gpio *sx150x = to_sx150x_gpio(gpio);
+ int ret;
+
+ ret = __sx150x_gpio_set(sx150x, offset, value);
+ if (ret < 0)
+ return ret;
+
+ return regmap_write_bits(sx150x->regmap,
+ sx150x->data->reg_dir,
+ BIT(offset), 0);
+}
+
+static int sx150x_regmap_reg_width(struct sx150x_gpio *sx150x,
+ unsigned int reg)
+{
+ return sx150x->data->ngpios;
+}
+
+/*
+ * In order to mask the differences between 16 and 8 bit expander
+ * devices we set up a sligthly ficticious regmap that pretends to be
+ * a set of 16-bit registers and transparently reconstructs those
+ * registers via multiple I2C/SMBus reads
+ *
+ * This way the rest of the driver code, interfacing with the chip via
+ * regmap API, can work assuming that each GPIO pin is represented by
+ * a group of bits at an offset proportioan to GPIO number within a
+ * given register.
+ *
+ */
+static int sx150x_regmap_reg_read(void *context, unsigned int reg,
+ unsigned int *result)
+{
+ int ret, n;
+ struct sx150x_gpio *sx150x = context;
+ struct i2c_client *i2c = sx150x->client;
+ const int width = sx150x_regmap_reg_width(sx150x, reg);
+ unsigned int idx, val;
+
+ /*
+ * There are four potential cases coverd by this function:
+ *
+ * 1) 8-pin chip, single configuration bit register
+ *
+ * This is trivial the code below just needs to read:
+ * reg [ 7 6 5 4 3 2 1 0 ]
+ *
+ * 2) 16-pin chip, single configuration bit register
+ *
+ * The read will be done as follows:
+ * reg [ f e d c b a 9 8 ]
+ * reg + 1 [ 7 6 5 4 3 2 1 0 ]
+ *
+ */
+
+ for (n = width, val = 0, idx = reg; n > 0; n -= 8, idx++) {
+ val <<= 8;
+
+ ret = i2c_smbus_read_byte_data(i2c, idx);
+ if (ret < 0)
+ return ret;
+
+ val |= ret;
+ }
+
+ *result = val;
+
+ return 0;
+}
+
+static int sx150x_regmap_reg_write(void *context, unsigned int reg,
+ unsigned int val)
+{
+ int ret, n;
+ struct sx150x_gpio *sx150x = context;
+ struct i2c_client *i2c = sx150x->client;
+ const int width = sx150x_regmap_reg_width(sx150x, reg);
+
+ n = width - 8;
+ do {
+ const u8 byte = (val >> n) & 0xff;
+
+ ret = i2c_smbus_write_byte_data(i2c, reg, byte);
+ if (ret < 0)
+ return ret;
+
+ reg++;
+ n -= 8;
+ } while (n >= 0);
+
+ return 0;
+}
+
+static const struct regmap_config sx150x_regmap_config = {
+ .reg_bits = 8,
+ .val_bits = 16,
+
+ .max_register = SX150X_MAX_REGISTER,
+};
+
+static const struct regmap_bus sx150x_regmap_bus = {
+ .reg_read = sx150x_regmap_reg_read,
+ .reg_write = sx150x_regmap_reg_write,
+};
+
+static struct gpio_ops sx150x_gpio_ops = {
+ .direction_input = sx150x_gpio_direction_input,
+ .direction_output = sx150x_gpio_direction_output,
+ .get_direction = sx150x_gpio_get_direction,
+ .get = sx150x_gpio_get,
+ .set = sx150x_gpio_set,
+};
+
+static int sx150x_probe(struct device_d *dev)
+{
+ struct i2c_client *client = to_i2c_client(dev);
+ struct sx150x_gpio *sx150x;
+ const struct sx150x_device_data *data;
+
+ data = of_device_get_match_data(dev);
+ if (!data)
+ return -EINVAL;
+
+ sx150x = xzalloc(sizeof(*sx150x));
+
+ sx150x->regmap = regmap_init(dev, &sx150x_regmap_bus,
+ sx150x, &sx150x_regmap_config);
+ sx150x->client = client;
+ sx150x->data = data;
+ sx150x->gpio.ops = &sx150x_gpio_ops;
+ sx150x->gpio.base = -1;
+ sx150x->gpio.ngpio = sx150x->data->ngpios;
+ sx150x->gpio.dev = &client->dev;
+
+ return gpiochip_add(&sx150x->gpio);
+}
+
+static __maybe_unused struct of_device_id sx150x_dt_ids[] = {
+ { .compatible = "semtech,sx1503q", .data = &sx1503q_device_data, },
+ { }
+};
+
+static struct driver_d sx150x_driver = {
+ .name = "sx150x",
+ .probe = sx150x_probe,
+ .of_compatible = sx150x_dt_ids,
+};
+
+static int __init sx150x_init(void)
+{
+ return i2c_driver_register(&sx150x_driver);
+}
+device_initcall(sx150x_init);
diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c
index baeae7bb94..0d5515b716 100644
--- a/drivers/i2c/muxes/i2c-mux-pca954x.c
+++ b/drivers/i2c/muxes/i2c-mux-pca954x.c
@@ -45,6 +45,8 @@
#include <i2c/i2c-algo-bit.h>
#include <i2c/i2c-mux.h>
#include <init.h>
+#include <gpio.h>
+#include <of_gpio.h>
#define PCA954X_MAX_NCHANS 8
@@ -179,6 +181,7 @@ static int pca954x_probe(struct device_d *dev)
int num, force;
struct pca954x *data;
int ret = -ENODEV;
+ int gpio;
data = kzalloc(sizeof(struct pca954x), GFP_KERNEL);
if (!data) {
@@ -188,6 +191,10 @@ static int pca954x_probe(struct device_d *dev)
i2c_set_clientdata(client, data);
+ gpio = of_get_named_gpio(dev->device_node, "reset-gpios", 0);
+ if (gpio_is_valid(gpio))
+ gpio_direction_output(gpio, 1);
+
/* Read the mux register at addr to verify
* that the mux is in fact present.
*/
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 31a9c22113..14e44d1378 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -43,9 +43,9 @@ void input_report_key_event(struct input_device *idev, unsigned int code, int va
return;
if (value)
- set_bit(code, &idev->keys);
+ set_bit(code, idev->keys);
else
- clear_bit(code, &idev->keys);
+ clear_bit(code, idev->keys);
event.code = code;
event.value = value;
diff --git a/drivers/mci/omap_hsmmc.c b/drivers/mci/omap_hsmmc.c
index 180afb16c9..cbc69e4083 100644
--- a/drivers/mci/omap_hsmmc.c
+++ b/drivers/mci/omap_hsmmc.c
@@ -631,6 +631,8 @@ static int omap_mmc_probe(struct device_d *dev)
hsmmc->mci.devname = xstrdup(alias);
}
+ mci_of_parse(&hsmmc->mci);
+
dev->priv = hsmmc;
dev->detect = omap_mmc_detect,
diff --git a/drivers/mfd/da9053.c b/drivers/mfd/da9053.c
index 250c0556ec..9adab8c75a 100644
--- a/drivers/mfd/da9053.c
+++ b/drivers/mfd/da9053.c
@@ -240,6 +240,10 @@ static void da9053_detect_reset_source(struct da9053_priv *da9053)
priority = of_get_reset_source_priority(da9053->dev->device_node);
reset_source_set_priority(type, priority);
+
+ ret = da9053_reg_write(da9053, DA9053_FAULTLOG_REG, val);
+ if (ret < 0)
+ return;
}
static void __noreturn da9053_force_system_reset(struct restart_handler *rst)
@@ -293,9 +297,18 @@ static int da9053_probe(struct device_d *dev)
return 0;
}
+static __maybe_unused struct of_device_id da9053_dt_ids[] = {
+ {
+ .compatible = "dlg,da9052",
+ }, {
+ /* sentinel */
+ }
+};
+
static struct driver_d da9053_driver = {
.name = DRIVERNAME,
.probe = da9053_probe,
+ .of_compatible = DRV_OF_COMPAT(da9053_dt_ids),
};
static int da9053_init(void)
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 656a7f5ef0..8a67792125 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -179,7 +179,7 @@ static const struct platform_device_id m25p_ids[] = {
{"en25f32"}, {"en25p32"}, {"en25q32b"}, {"en25p64"},
{"en25q64"}, {"en25qh128"}, {"en25qh256"},
{"f25l32pa"},
- {"mr25h256"}, {"mr25h10"},
+ {"mr25h256"}, {"mr25h10"}, {"mr25h40"},
{"gd25q32"}, {"gd25q64"},
{"160s33b"}, {"320s33b"}, {"640s33b"},
{"mx25l2005a"}, {"mx25l4005a"}, {"mx25l8005"}, {"mx25l1606e"},
diff --git a/drivers/mtd/peb.c b/drivers/mtd/peb.c
index 639dc0ee6f..66227d4ffb 100644
--- a/drivers/mtd/peb.c
+++ b/drivers/mtd/peb.c
@@ -252,7 +252,6 @@ retry:
int mtd_peb_check_all_ff(struct mtd_info *mtd, int pnum, int offset, int len,
int warn)
{
- size_t read;
int err;
void *buf;
@@ -263,8 +262,8 @@ int mtd_peb_check_all_ff(struct mtd_info *mtd, int pnum, int offset, int len,
err = mtd_peb_read(mtd, buf, pnum, offset, len);
if (err && !mtd_is_bitflip(err)) {
dev_err(&mtd->class_dev,
- "error %d while reading %d bytes from PEB %d:%d, read %zd bytes\n",
- err, len, pnum, offset, read);
+ "error %d while reading %d bytes from PEB %d:%d\n",
+ err, len, pnum, offset);
goto out;
}
@@ -398,7 +397,7 @@ int mtd_peb_write(struct mtd_info *mtd, const void *buf, int pnum, int offset,
addr = (loff_t)pnum * mtd->erasesize + offset;
err = mtd_write(mtd, addr, len, &written, buf);
if (err) {
- dev_err(&mtd->class_dev, "error %d while writing %d bytes to PEB %d:%d, written %zd bytes\n",
+ dev_err(&mtd->class_dev, "error %d while writing %d bytes to PEB %d:%d, written %zu bytes\n",
err, len, pnum, offset, written);
} else {
if (written != len)
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index 45be586238..faeafe1bfb 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -504,6 +504,7 @@ static const struct spi_device_id spi_nor_ids[] = {
/* Everspin */
{ "mr25h256", CAT25_INFO( 32 * 1024, 1, 256, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) },
{ "mr25h10", CAT25_INFO(128 * 1024, 1, 256, 3, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) },
+ { "mr25h40", CAT25_INFO(512 * 1024, 1, 256, 3, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) },
/* Fujitsu */
{ "mb85rs1mt", INFO(0x047f27, 0, 128 * 1024, 1, SPI_NOR_NO_ERASE) },
diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c
index 43af4a52df..6d08f92ea6 100644
--- a/drivers/mtd/ubi/io.c
+++ b/drivers/mtd/ubi/io.c
@@ -711,7 +711,7 @@ int ubi_io_read_vid_hdr(struct ubi_device *ubi, int pnum,
p = (char *)vid_hdr - ubi->vid_hdr_shift;
read_err = ubi_io_read(ubi, p, pnum, ubi->vid_hdr_aloffset,
- ubi->vid_hdr_alsize);
+ ubi->vid_hdr_shift + UBI_VID_HDR_SIZE);
if (read_err && read_err != UBI_IO_BITFLIPS && !mtd_is_eccerr(read_err))
return read_err;
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 3f848a4396..c9157cdd74 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -271,7 +271,7 @@ static struct device_d *of_amba_device_create(struct device_node *np)
/* Allow the HW Peripheral ID to be overridden */
of_property_read_u32(np, "arm,primecell-periphid", &dev->periphid);
- debug("register device 0x%08x\n", dev->dev.resource[0].start);
+ debug("register device %pa\n", &dev->dev.resource[0].start);
ret = amba_device_add(dev);
if (ret)
diff --git a/include/menu.h b/include/menu.h
index 3e704a8907..2fef064499 100644
--- a/include/menu.h
+++ b/include/menu.h
@@ -91,7 +91,7 @@ int menu_set_selected_entry(struct menu *m, struct menu_entry* me);
int menu_set_selected(struct menu *m, int num);
int menu_set_auto_select(struct menu *m, int delay);
struct menu* menu_get_menus(void);
-void menu_add_title(struct menu *m, char *display);
+void menu_add_title(struct menu *m, const char *display);
/*
* menu entry functions
diff --git a/include/regmap.h b/include/regmap.h
index bcbe6c1554..9675a17b96 100644
--- a/include/regmap.h
+++ b/include/regmap.h
@@ -60,4 +60,8 @@ int regmap_get_val_bytes(struct regmap *map);
int regmap_get_max_register(struct regmap *map);
int regmap_get_reg_stride(struct regmap *map);
-#endif /* __REGMAP_H */ \ No newline at end of file
+int regmap_write_bits(struct regmap *map, unsigned int reg,
+ unsigned int mask, unsigned int val);
+
+
+#endif /* __REGMAP_H */
diff --git a/lib/int_sqrt.c b/lib/int_sqrt.c
index 30ccafbf9e..bf8b18fcb4 100644
--- a/lib/int_sqrt.c
+++ b/lib/int_sqrt.c
@@ -15,6 +15,7 @@
*/
#include <common.h>
+#include <int_sqrt.h>
/**
* int_sqrt - rough approximation to sqrt