summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2020-10-14 12:46:41 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-10-14 12:46:41 +0200
commitd2bb6342d6a812f3ff0dcf17180c0b01b85cacfb (patch)
tree662664ac398af8749af7f3c69bb298394a0fc057
parente9299c644a17b7ae6a91d3a4b6ccdd9acba443fe (diff)
parent8fc0a99f32ea083b2e0eee217c813cf36aa8c521 (diff)
downloadbarebox-d2bb6342d6a812f3ff0dcf17180c0b01b85cacfb.tar.gz
barebox-d2bb6342d6a812f3ff0dcf17180c0b01b85cacfb.tar.xz
Merge branch 'for-next/misc' into master
-rw-r--r--Documentation/boards/stm32mp.rst2
-rw-r--r--Makefile20
-rw-r--r--arch/arm/boards/Makefile2
-rw-r--r--arch/arm/boards/lxa-mc1/board.c17
-rw-r--r--arch/arm/boards/seeed-odyssey/board.c18
-rw-r--r--arch/arm/boards/stm32mp157c-dk2/board.c18
-rw-r--r--arch/arm/boards/stm32mp157c-dk2/lowlevel.c26
-rw-r--r--arch/arm/boards/stm32mp15xx-dkx/Makefile (renamed from arch/arm/boards/stm32mp157c-dk2/Makefile)0
-rw-r--r--arch/arm/boards/stm32mp15xx-dkx/board.c32
-rw-r--r--arch/arm/boards/stm32mp15xx-dkx/lowlevel.c34
-rw-r--r--arch/arm/configs/stm32mp_defconfig16
-rw-r--r--arch/arm/dts/Makefile2
-rw-r--r--arch/arm/dts/am335x-boneblack.dts10
-rw-r--r--arch/arm/dts/stm32mp157a-dk1.dts2
-rw-r--r--arch/arm/dts/stm32mp157c-dk2.dts2
-rw-r--r--arch/arm/dts/stm32mp15xx-dkx.dtsi (renamed from arch/arm/dts/stm32mp157a-dk1.dtsi)0
-rw-r--r--arch/arm/mach-at91/at91_pmc_ll.c2
-rw-r--r--arch/arm/mach-at91/include/mach/at91_pmc_ll.h5
-rw-r--r--arch/arm/mach-at91/include/mach/at91_wdt.h2
-rw-r--r--arch/arm/mach-omap/am33xx_clock.c4
-rw-r--r--arch/arm/mach-omap/boot_order.c4
-rw-r--r--arch/arm/mach-omap/include/mach/am33xx-clock.h1
-rw-r--r--arch/arm/mach-stm32mp/Kconfig7
-rw-r--r--arch/arm/mach-stm32mp/include/mach/revision.h51
-rw-r--r--arch/arm/mach-stm32mp/init.c55
-rw-r--r--arch/arm/mach-stm32mp/stm32image.c4
-rw-r--r--arch/arm/mach-zynq/bootm-zynqimg.c4
-rw-r--r--arch/mips/include/asm/debug_ll_ns16550.h4
-rw-r--r--arch/riscv/include/asm/debug_ll_ns16550.h4
-rw-r--r--arch/sandbox/board/devices.c3
-rw-r--r--arch/sandbox/include/asm/io.h6
-rw-r--r--commands/Kconfig4
-rw-r--r--common/Kconfig1
-rw-r--r--common/kallsyms.c4
-rw-r--r--common/misc.c3
-rw-r--r--common/startup.c2
-rw-r--r--crypto/rsa.c2
-rw-r--r--drivers/aiodev/Kconfig8
-rw-r--r--drivers/aiodev/Makefile1
-rw-r--r--drivers/aiodev/am335x_adc.c183
-rw-r--r--drivers/aiodev/core.c4
-rw-r--r--drivers/aiodev/ti_am335x_tscadc.h163
-rw-r--r--drivers/of/base.c48
-rw-r--r--drivers/usb/dwc2/dwc2.c16
-rw-r--r--drivers/usb/dwc2/dwc2.h4
-rw-r--r--drivers/usb/dwc2/gadget.c6
-rw-r--r--drivers/usb/dwc2/host.c13
-rw-r--r--drivers/usb/musb/musb_host.c4
-rw-r--r--images/Makefile.stm32mp8
-rw-r--r--include/aiodev.h3
-rw-r--r--include/asm-generic/bitio.h2
-rw-r--r--include/linux/string.h1
-rw-r--r--include/of.h2
-rw-r--r--include/regulator.h2
-rw-r--r--include/string.h2
-rw-r--r--lib/Kconfig2
-rw-r--r--lib/string.c13
-rw-r--r--scripts/dtc/Makefile2
-rw-r--r--scripts/kwboot.c2
59 files changed, 699 insertions, 163 deletions
diff --git a/Documentation/boards/stm32mp.rst b/Documentation/boards/stm32mp.rst
index b235c39927..a06578602d 100644
--- a/Documentation/boards/stm32mp.rst
+++ b/Documentation/boards/stm32mp.rst
@@ -29,7 +29,7 @@ The resulting images will be placed under ``images/``:
::
- barebox-stm32mp157c-dk2.img
+ barebox-stm32mp15xx-dkx.img # both DK1 and DK2
barebox-stm32mp157c-lxa-mc1.img
barebox-stm32mp157c-seeed-odyssey.img
diff --git a/Makefile b/Makefile
index 9434405df4..c8e84575b6 100644
--- a/Makefile
+++ b/Makefile
@@ -1004,6 +1004,22 @@ include/generated/utsrelease.h: include/config/kernel.release FORCE
$(call filechk,utsrelease.h)
# ---------------------------------------------------------------------------
+# Devicetree files
+
+ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/dts/),)
+dtstree := arch/$(SRCARCH)/dts
+endif
+
+ifneq ($(dtstree),)
+
+PHONY += dtbs
+all_dtbs += $(patsubst $(srctree)/%.dts,$(objtree)/%.dtb,$(wildcard $(srctree)/$(dtstree)/*.dts))
+targets += $(all_dtbs)
+dtbs: $(all_dtbs)
+
+endif
+
+# ---------------------------------------------------------------------------
# Modules
ifdef CONFIG_MODULES
@@ -1178,6 +1194,10 @@ help:
@$(if $(archhelp),$(archhelp),\
echo ' No architecture specific help defined for $(SRCARCH)')
@echo ''
+ @$(if $(dtstree), \
+ echo ' Devicetree:'; \
+ echo ' * dtbs - Build device tree blobs for all boards'; \
+ echo '')
@$(if $(boards), \
$(foreach b, $(boards), \
printf " %-24s - Build for %s\\n" $(b) $(subst _defconfig,,$(b));) \
diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
index 5438236af4..a02d80d2da 100644
--- a/arch/arm/boards/Makefile
+++ b/arch/arm/boards/Makefile
@@ -132,7 +132,7 @@ obj-$(CONFIG_MACH_SOCFPGA_TERASIC_DE0_NANO_SOC) += terasic-de0-nano-soc/
obj-$(CONFIG_MACH_SOCFPGA_TERASIC_SOCKIT) += terasic-sockit/
obj-$(CONFIG_MACH_SOLIDRUN_CUBOX) += solidrun-cubox/
obj-$(CONFIG_MACH_SOLIDRUN_MICROSOM) += solidrun-microsom/
-obj-$(CONFIG_MACH_STM32MP157C_DK2) += stm32mp157c-dk2/
+obj-$(CONFIG_MACH_STM32MP15XX_DKX) += stm32mp15xx-dkx/
obj-$(CONFIG_MACH_LXA_MC1) += lxa-mc1/
obj-$(CONFIG_MACH_TECHNEXION_PICO_HOBBIT) += technexion-pico-hobbit/
obj-$(CONFIG_MACH_TECHNEXION_WANDBOARD) += technexion-wandboard/
diff --git a/arch/arm/boards/lxa-mc1/board.c b/arch/arm/boards/lxa-mc1/board.c
index 7f1f3ccd7e..9126973dcb 100644
--- a/arch/arm/boards/lxa-mc1/board.c
+++ b/arch/arm/boards/lxa-mc1/board.c
@@ -28,11 +28,9 @@ static int of_fixup_regulator_supply_disable(struct device_node *root, void *pat
return 0;
}
-static int mc1_device_init(void)
+static int mc1_probe(struct device_d *dev)
{
int flags;
- if (!of_machine_is_compatible("lxa,stm32mp157c-mc1"))
- return 0;
flags = bootsource_get_instance() == 0 ? BBU_HANDLER_FLAG_DEFAULT : 0;
stm32mp_bbu_mmc_register_handler("sd", "/dev/mmc0.ssbl", flags);
@@ -55,4 +53,15 @@ static int mc1_device_init(void)
*/
return of_register_fixup(of_fixup_regulator_supply_disable, "/regulator_3v3");
}
-device_initcall(mc1_device_init);
+
+static const struct of_device_id mc1_of_match[] = {
+ { .compatible = "lxa,stm32mp157c-mc1" },
+ { /* sentinel */ },
+};
+
+static struct driver_d mc1_board_driver = {
+ .name = "board-lxa-mc1",
+ .probe = mc1_probe,
+ .of_compatible = mc1_of_match,
+};
+device_platform_driver(mc1_board_driver);
diff --git a/arch/arm/boards/seeed-odyssey/board.c b/arch/arm/boards/seeed-odyssey/board.c
index e3fe536873..8c011898a3 100644
--- a/arch/arm/boards/seeed-odyssey/board.c
+++ b/arch/arm/boards/seeed-odyssey/board.c
@@ -7,14 +7,11 @@
#include <bootsource.h>
#include <of.h>
-static int odyssey_device_init(void)
+static int odyssey_som_probe(struct device_d *dev)
{
int flags;
int instance = bootsource_get_instance();
- if (!of_machine_is_compatible("seeed,stm32mp157c-odyssey-som"))
- return 0;
-
flags = instance == 0 ? BBU_HANDLER_FLAG_DEFAULT : 0;
stm32mp_bbu_mmc_register_handler("sd", "/dev/mmc0.ssbl", flags);
@@ -29,4 +26,15 @@ static int odyssey_device_init(void)
return 0;
}
-device_initcall(odyssey_device_init);
+
+static const struct of_device_id odyssey_som_of_match[] = {
+ { .compatible = "seeed,stm32mp157c-odyssey-som" },
+ { /* sentinel */ },
+};
+
+static struct driver_d odyssey_som_driver = {
+ .name = "odyssey-som",
+ .probe = odyssey_som_probe,
+ .of_compatible = odyssey_som_of_match,
+};
+device_platform_driver(odyssey_som_driver);
diff --git a/arch/arm/boards/stm32mp157c-dk2/board.c b/arch/arm/boards/stm32mp157c-dk2/board.c
deleted file mode 100644
index 4636603121..0000000000
--- a/arch/arm/boards/stm32mp157c-dk2/board.c
+++ /dev/null
@@ -1,18 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-#include <common.h>
-#include <init.h>
-#include <mach/bbu.h>
-
-static int dk2_postcore_init(void)
-{
- if (!of_machine_is_compatible("st,stm32mp157c-dk2"))
- return 0;
-
- stm32mp_bbu_mmc_register_handler("sd", "/dev/mmc0.ssbl",
- BBU_HANDLER_FLAG_DEFAULT);
-
- barebox_set_model("STM32MP157C-DK2");
-
- return 0;
-}
-postcore_initcall(dk2_postcore_init);
diff --git a/arch/arm/boards/stm32mp157c-dk2/lowlevel.c b/arch/arm/boards/stm32mp157c-dk2/lowlevel.c
deleted file mode 100644
index 7261d7a8bc..0000000000
--- a/arch/arm/boards/stm32mp157c-dk2/lowlevel.c
+++ /dev/null
@@ -1,26 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-#include <common.h>
-#include <mach/entry.h>
-#include <debug_ll.h>
-
-extern char __dtb_z_stm32mp157c_dk2_start[];
-
-static void setup_uart(void)
-{
- /* first stage has set up the UART, so nothing to do here */
- putc_ll('>');
-}
-
-ENTRY_FUNCTION(start_stm32mp157c_dk2, r0, r1, r2)
-{
- void *fdt;
-
- stm32mp_cpu_lowlevel_init();
-
- if (IS_ENABLED(CONFIG_DEBUG_LL))
- setup_uart();
-
- fdt = __dtb_z_stm32mp157c_dk2_start + get_runtime_offset();
-
- stm32mp1_barebox_entry(fdt);
-}
diff --git a/arch/arm/boards/stm32mp157c-dk2/Makefile b/arch/arm/boards/stm32mp15xx-dkx/Makefile
index 092c31d6b2..092c31d6b2 100644
--- a/arch/arm/boards/stm32mp157c-dk2/Makefile
+++ b/arch/arm/boards/stm32mp15xx-dkx/Makefile
diff --git a/arch/arm/boards/stm32mp15xx-dkx/board.c b/arch/arm/boards/stm32mp15xx-dkx/board.c
new file mode 100644
index 0000000000..1ddfee698d
--- /dev/null
+++ b/arch/arm/boards/stm32mp15xx-dkx/board.c
@@ -0,0 +1,32 @@
+// SPDX-License-Identifier: GPL-2.0+
+#include <common.h>
+#include <init.h>
+#include <mach/bbu.h>
+
+static int dkx_probe(struct device_d *dev)
+{
+ const void *model;
+
+ stm32mp_bbu_mmc_register_handler("sd", "/dev/mmc0.ssbl",
+ BBU_HANDLER_FLAG_DEFAULT);
+
+ if (dev_get_drvdata(dev, &model) == 0)
+ barebox_set_model(model);
+
+ barebox_set_hostname("stm32mp15xx-dkx");
+
+ return 0;
+}
+
+static const struct of_device_id dkx_of_match[] = {
+ { .compatible = "st,stm32mp157a-dk1", .data = "STM32MP157A-DK1" },
+ { .compatible = "st,stm32mp157c-dk2", .data = "STM32MP157C-DK2" },
+ { /* sentinel */ },
+};
+
+static struct driver_d dkx_board_driver = {
+ .name = "board-stm32mp15xx-dkx",
+ .probe = dkx_probe,
+ .of_compatible = dkx_of_match,
+};
+postcore_platform_driver(dkx_board_driver);
diff --git a/arch/arm/boards/stm32mp15xx-dkx/lowlevel.c b/arch/arm/boards/stm32mp15xx-dkx/lowlevel.c
new file mode 100644
index 0000000000..65f4bbb4da
--- /dev/null
+++ b/arch/arm/boards/stm32mp15xx-dkx/lowlevel.c
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: GPL-2.0+
+#include <common.h>
+#include <mach/entry.h>
+#include <debug_ll.h>
+#include <mach/revision.h>
+
+extern char __dtb_z_stm32mp157c_dk2_start[];
+extern char __dtb_z_stm32mp157a_dk1_start[];
+
+static void setup_uart(void)
+{
+ /* first stage has set up the UART, so nothing to do here */
+ putc_ll('>');
+}
+
+ENTRY_FUNCTION(start_stm32mp15xx_dkx, r0, r1, r2)
+{
+ void *fdt;
+ u32 cputype;
+ int err;
+
+ stm32mp_cpu_lowlevel_init();
+
+ if (IS_ENABLED(CONFIG_DEBUG_LL))
+ setup_uart();
+
+ err = __stm32mp_get_cpu_type(&cputype);
+ if (!err && cputype == CPU_STM32MP157Axx)
+ fdt = __dtb_z_stm32mp157a_dk1_start;
+ else
+ fdt = __dtb_z_stm32mp157c_dk2_start;
+
+ stm32mp1_barebox_entry(fdt + get_runtime_offset());
+}
diff --git a/arch/arm/configs/stm32mp_defconfig b/arch/arm/configs/stm32mp_defconfig
index 92bdf5b040..e9f89e69d9 100644
--- a/arch/arm/configs/stm32mp_defconfig
+++ b/arch/arm/configs/stm32mp_defconfig
@@ -1,5 +1,5 @@
CONFIG_ARCH_STM32MP=y
-CONFIG_MACH_STM32MP157C_DK2=y
+CONFIG_MACH_STM32MP15XX_DKX=y
CONFIG_MACH_LXA_MC1=y
CONFIG_MACH_SEEED_ODYSSEY=y
CONFIG_THUMB2_BAREBOX=y
@@ -12,7 +12,6 @@ CONFIG_MALLOC_TLSF=y
CONFIG_KALLSYMS=y
CONFIG_RELOCATABLE=y
CONFIG_HUSH_FANCY_PROMPT=y
-CONFIG_CMDLINE_EDITING=y
CONFIG_AUTO_COMPLETE=y
CONFIG_MENU=y
CONFIG_BOOTM_SHOW_TYPE=y
@@ -24,10 +23,14 @@ CONFIG_BLSPEC=y
CONFIG_CONSOLE_ACTIVATE_NONE=y
CONFIG_CONSOLE_ALLOW_COLOR=y
CONFIG_PBL_CONSOLE=y
+CONFIG_CONSOLE_RATP=y
+CONFIG_RATP_CMD_I2C=y
+CONFIG_RATP_CMD_GPIO=y
CONFIG_PARTITION_DISK_EFI=y
# CONFIG_PARTITION_DISK_EFI_GPT_NO_FORCE is not set
# CONFIG_PARTITION_DISK_EFI_GPT_COMPARE is not set
CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
+CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW_REBOOT_MODE=y
CONFIG_RESET_SOURCE=y
CONFIG_CMD_DMESG=y
CONFIG_LONGHELP=y
@@ -83,10 +86,12 @@ CONFIG_CMD_BAREBOX_UPDATE=y
CONFIG_CMD_OF_DIFF=y
CONFIG_CMD_OF_NODE=y
CONFIG_CMD_OF_PROPERTY=y
+CONFIG_CMD_OF_OVERLAY=y
CONFIG_CMD_OFTREE=y
CONFIG_CMD_TIME=y
CONFIG_NET=y
CONFIG_NET_NETCONSOLE=y
+CONFIG_NET_FASTBOOT=y
CONFIG_OFDEVICE=y
CONFIG_OF_BAREBOX_DRIVERS=y
CONFIG_DRIVER_SERIAL_STM32=y
@@ -111,6 +116,7 @@ CONFIG_LED=y
CONFIG_LED_GPIO=y
CONFIG_LED_PWM=y
CONFIG_LED_GPIO_OF=y
+CONFIG_LED_TRIGGERS=y
CONFIG_EEPROM_AT24=y
CONFIG_KEYBOARD_GPIO=y
CONFIG_INPUT_SPECIALKEYS=y
@@ -132,11 +138,17 @@ CONFIG_STM32_REMOTEPROC=y
CONFIG_RESET_STM32=y
CONFIG_GENERIC_PHY=y
CONFIG_PHY_STM32_USBPHYC=y
+CONFIG_SYSCON_REBOOT_MODE=y
CONFIG_FS_EXT4=y
CONFIG_FS_TFTP=y
CONFIG_FS_NFS=y
CONFIG_FS_FAT=y
CONFIG_FS_FAT_WRITE=y
CONFIG_FS_FAT_LFN=y
+CONFIG_FS_PSTORE=y
+CONFIG_FS_PSTORE_CONSOLE=y
+CONFIG_FS_PSTORE_RAMOOPS=y
+CONFIG_FS_SQUASHFS=y
+CONFIG_FS_RATP=y
CONFIG_ZLIB=y
CONFIG_CRC8=y
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index bd53d68211..a1e0bb6a41 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -111,7 +111,7 @@ lwl-$(CONFIG_MACH_SOLIDRUN_MICROSOM) += imx6dl-hummingboard.dtb.o imx6q-hummingb
imx6dl-hummingboard2.dtb.o imx6q-hummingboard2.dtb.o \
imx6q-h100.dtb.o
lwl-$(CONFIG_MACH_SEEED_ODYSSEY) += stm32mp157c-odyssey.dtb.o
-lwl-$(CONFIG_MACH_STM32MP157C_DK2) += stm32mp157c-dk2.dtb.o
+lwl-$(CONFIG_MACH_STM32MP15XX_DKX) += stm32mp157c-dk2.dtb.o stm32mp157a-dk1.dtb.o
lwl-$(CONFIG_MACH_LXA_MC1) += stm32mp157c-lxa-mc1.dtb.o
lwl-$(CONFIG_MACH_SCB9328) += imx1-scb9328.dtb.o
lwl-$(CONFIG_MACH_TECHNEXION_WANDBOARD) += imx6q-wandboard.dtb.o imx6dl-wandboard.dtb.o
diff --git a/arch/arm/dts/am335x-boneblack.dts b/arch/arm/dts/am335x-boneblack.dts
index 80d710b924..c06a532e48 100644
--- a/arch/arm/dts/am335x-boneblack.dts
+++ b/arch/arm/dts/am335x-boneblack.dts
@@ -85,3 +85,13 @@
status = "okay";
};
};
+
+&tscadc {
+ status = "okay";
+ adc {
+ /* Ch 0-6 are on connector P9. Ch 7 measures the 3.3V rail
+ * divided by 2 (e.g., it should read 1650).
+ */
+ ti,adc-channels = <0>, <1>, <2>, <3>, <4>, <5>, <6>, <7>;
+ };
+};
diff --git a/arch/arm/dts/stm32mp157a-dk1.dts b/arch/arm/dts/stm32mp157a-dk1.dts
index f2cafae66b..7a907cc314 100644
--- a/arch/arm/dts/stm32mp157a-dk1.dts
+++ b/arch/arm/dts/stm32mp157a-dk1.dts
@@ -5,4 +5,4 @@
*/
#include <arm/stm32mp157a-dk1.dts>
-#include "stm32mp157a-dk1.dtsi"
+#include "stm32mp15xx-dkx.dtsi"
diff --git a/arch/arm/dts/stm32mp157c-dk2.dts b/arch/arm/dts/stm32mp157c-dk2.dts
index 6e73162ea4..98525abd71 100644
--- a/arch/arm/dts/stm32mp157c-dk2.dts
+++ b/arch/arm/dts/stm32mp157c-dk2.dts
@@ -5,4 +5,4 @@
*/
#include <arm/stm32mp157c-dk2.dts>
-#include "stm32mp157a-dk1.dtsi"
+#include "stm32mp15xx-dkx.dtsi"
diff --git a/arch/arm/dts/stm32mp157a-dk1.dtsi b/arch/arm/dts/stm32mp15xx-dkx.dtsi
index 173e64e04c..173e64e04c 100644
--- a/arch/arm/dts/stm32mp157a-dk1.dtsi
+++ b/arch/arm/dts/stm32mp15xx-dkx.dtsi
diff --git a/arch/arm/mach-at91/at91_pmc_ll.c b/arch/arm/mach-at91/at91_pmc_ll.c
index 9205322db9..e561f20755 100644
--- a/arch/arm/mach-at91/at91_pmc_ll.c
+++ b/arch/arm/mach-at91/at91_pmc_ll.c
@@ -88,6 +88,8 @@ void at91_pmc_init(void __iomem *pmc_base, unsigned int flags)
tmp &= ~AT91_PMC_OSCBYPASS;
tmp &= ~AT91_PMC_KEY_MASK;
tmp |= AT91_PMC_KEY;
+ if (flags & AT91_PMC_LL_FLAG_MCK_BYPASS)
+ tmp |= AT91_PMC_OSCBYPASS;
at91_pmc_write(AT91_CKGR_MOR, tmp);
tmp = at91_pmc_read(AT91_CKGR_MOR);
diff --git a/arch/arm/mach-at91/include/mach/at91_pmc_ll.h b/arch/arm/mach-at91/include/mach/at91_pmc_ll.h
index 6ec3ae0852..85896a01d5 100644
--- a/arch/arm/mach-at91/include/mach/at91_pmc_ll.h
+++ b/arch/arm/mach-at91/include/mach/at91_pmc_ll.h
@@ -16,6 +16,7 @@
#define AT91_PMC_LL_FLAG_H32MXDIV (1 << 3)
#define AT91_PMC_LL_FLAG_PMC_UTMI (1 << 4)
#define AT91_PMC_LL_FLAG_GCSR (1 << 5)
+#define AT91_PMC_LL_FLAG_MCK_BYPASS (1 << 6)
#define AT91_PMC_LL_AT91RM9200 (0)
#define AT91_PMC_LL_AT91SAM9260 (0)
@@ -30,6 +31,10 @@
#define AT91_PMC_LL_SAMA5D2 (AT91_PMC_LL_FLAG_SAM9X5_PMC | \
AT91_PMC_LL_FLAG_MEASURE_XTAL | \
AT91_PMC_LL_FLAG_PMC_UTMI)
+/* This assumes a crystal on both XIN and XOUT. If your board
+ * instead has an extenal oscillator on XIN only,
+ * AT91_PMC_LL_FLAG_MCK_BYPASS needs to be OR`ed in as well
+ */
#define AT91_PMC_LL_SAMA5D3 (AT91_PMC_LL_FLAG_SAM9X5_PMC | \
AT91_PMC_LL_FLAG_DISABLE_RC | \
AT91_PMC_LL_FLAG_PMC_UTMI)
diff --git a/arch/arm/mach-at91/include/mach/at91_wdt.h b/arch/arm/mach-at91/include/mach/at91_wdt.h
index d295d35d1b..04924742a5 100644
--- a/arch/arm/mach-at91/include/mach/at91_wdt.h
+++ b/arch/arm/mach-at91/include/mach/at91_wdt.h
@@ -41,7 +41,7 @@
* Copyright (c) 2006, Atmel Corporation
*/
-#include <asm-generic/io.h>
+#include <asm/io.h>
static inline void at91_wdt_disable(void __iomem *wdt_base)
{
diff --git a/arch/arm/mach-omap/am33xx_clock.c b/arch/arm/mach-omap/am33xx_clock.c
index 0a49038270..8fa2c70aa2 100644
--- a/arch/arm/mach-omap/am33xx_clock.c
+++ b/arch/arm/mach-omap/am33xx_clock.c
@@ -165,6 +165,10 @@ void am33xx_enable_per_clocks(void)
__raw_writel(PRCM_MOD_EN, CM_PER_USB0_CLKCTRL);
while ((__raw_readl(CM_PER_USB0_CLKCTRL) & 0x30000) != 0x0);
+ /* TSC & ADC */
+ __raw_writel(PRCM_MOD_EN, CM_WKUP_ADC_TSC_CLKCTRL);
+ while (__raw_readl(CM_WKUP_ADC_TSC_CLKCTRL) != PRCM_MOD_EN);
+
clkdcoldo = __raw_readl(CM_CLKDCOLDO_DPLL_PER);
clkdcoldo = clkdcoldo | 0x100;
__raw_writel(clkdcoldo, CM_CLKDCOLDO_DPLL_PER);
diff --git a/arch/arm/mach-omap/boot_order.c b/arch/arm/mach-omap/boot_order.c
index db22513bde..4b74fdba66 100644
--- a/arch/arm/mach-omap/boot_order.c
+++ b/arch/arm/mach-omap/boot_order.c
@@ -70,13 +70,13 @@ static int cmd_boot_order(int argc, char *argv[])
}
BAREBOX_CMD_HELP_START(boot_order)
-BAREBOX_CMD_HELP_TEXT("Set warm boot order of up to four devices. Each device can be one of:")
+BAREBOX_CMD_HELP_TEXT("Set OMAP warm boot order of up to four devices. Each device can be one of:")
BAREBOX_CMD_HELP_TEXT("xip xipwait nand onenand mmc1 mmc2_1 mmc2_2 uart usb_1 usb_ulpi usb_2")
BAREBOX_CMD_HELP_END
BAREBOX_CMD_START(boot_order)
.cmd = cmd_boot_order,
- BAREBOX_CMD_DESC("set warm boot order")
+ BAREBOX_CMD_DESC("set OMAP warm boot order")
BAREBOX_CMD_OPTS("DEVICE...")
BAREBOX_CMD_GROUP(CMD_GRP_BOOT)
BAREBOX_CMD_HELP(cmd_boot_order_help)
diff --git a/arch/arm/mach-omap/include/mach/am33xx-clock.h b/arch/arm/mach-omap/include/mach/am33xx-clock.h
index 284d5f8cf6..e71ecbcd24 100644
--- a/arch/arm/mach-omap/include/mach/am33xx-clock.h
+++ b/arch/arm/mach-omap/include/mach/am33xx-clock.h
@@ -138,6 +138,7 @@
#define CM_PER_I2C1_CLKCTRL (CM_PER + 0x48) /* I2C1 */
#define CM_PER_I2C2_CLKCTRL (CM_PER + 0x44) /* I2C2 */
#define CM_WKUP_GPIO0_CLKCTRL (CM_WKUP + 0x8) /* GPIO0 */
+#define CM_WKUP_ADC_TSC_CLKCTRL (CM_WKUP + 0xbc)/* TSCADC */
#define CM_PER_MMC0_CLKCTRL (CM_PER + 0x3C)
#define CM_PER_MMC1_CLKCTRL (CM_PER + 0xF4)
diff --git a/arch/arm/mach-stm32mp/Kconfig b/arch/arm/mach-stm32mp/Kconfig
index f064a38088..b8ccbaab67 100644
--- a/arch/arm/mach-stm32mp/Kconfig
+++ b/arch/arm/mach-stm32mp/Kconfig
@@ -8,9 +8,12 @@ config ARCH_STM32MP157
select ARM_PSCI_CLIENT
bool
-config MACH_STM32MP157C_DK2
+config MACH_STM32MP15XX_DKX
select ARCH_STM32MP157
- bool "STM32MP157C-DK2 board"
+ bool "STM32MP157 DK1 and DK2 boards"
+ help
+ builds a single barebox-stm32mp15xx-dkx.img that can be deployed
+ as SSBL on both the stm32mp157a-dk1 and stm32mp157c-dk2
config MACH_LXA_MC1
select ARCH_STM32MP157
diff --git a/arch/arm/mach-stm32mp/include/mach/revision.h b/arch/arm/mach-stm32mp/include/mach/revision.h
index 2eb4d44b33..2ef8ef30c3 100644
--- a/arch/arm/mach-stm32mp/include/mach/revision.h
+++ b/arch/arm/mach-stm32mp/include/mach/revision.h
@@ -6,6 +6,9 @@
#ifndef __MACH_CPUTYPE_H__
#define __MACH_CPUTYPE_H__
+#include <mach/bsec.h>
+#include <asm/io.h>
+#include <mach/stm32.h>
/* ID = Device Version (bit31:16) + Device Part Number (RPN) (bit7:0)
* 157X: 2x Cortex-A7, Cortex-M4, CAN FD, GPU, DSI
@@ -45,4 +48,52 @@ int stm32mp_package(void);
#define cpu_is_stm32mp151c() (stm32mp_cputype() == CPU_STM32MP151Cxx)
#define cpu_is_stm32mp151a() (stm32mp_cputype() == CPU_STM32MP151Axx)
+/* DBGMCU register */
+#define DBGMCU_APB4FZ1 (STM32_DBGMCU_BASE + 0x2C)
+#define DBGMCU_IDC (STM32_DBGMCU_BASE + 0x00)
+#define DBGMCU_IDC_DEV_ID_MASK GENMASK(11, 0)
+#define DBGMCU_IDC_DEV_ID_SHIFT 0
+#define DBGMCU_IDC_REV_ID_MASK GENMASK(31, 16)
+#define DBGMCU_IDC_REV_ID_SHIFT 16
+
+#define RCC_DBGCFGR (STM32_RCC_BASE + 0x080C)
+#define RCC_DBGCFGR_DBGCKEN BIT(8)
+
+/* BSEC OTP index */
+#define BSEC_OTP_RPN 1
+#define BSEC_OTP_PKG 16
+
+/* Device Part Number (RPN) = OTP_DATA1 lower 8 bits */
+#define RPN_SHIFT 0
+#define RPN_MASK GENMASK(7, 0)
+
+static inline u32 stm32mp_read_idc(void)
+{
+ setbits_le32(RCC_DBGCFGR, RCC_DBGCFGR_DBGCKEN);
+ return readl(IOMEM(DBGMCU_IDC));
+}
+
+/* Get Device Part Number (RPN) from OTP */
+static inline int __stm32mp_get_cpu_rpn(u32 *rpn)
+{
+ int ret = bsec_read_field(BSEC_OTP_RPN, rpn);
+ if (ret)
+ return ret;
+
+ *rpn = (*rpn >> RPN_SHIFT) & RPN_MASK;
+ return 0;
+}
+
+static inline int __stm32mp_get_cpu_type(u32 *type)
+{
+ u32 id;
+ int ret = __stm32mp_get_cpu_rpn(type);
+ if (ret)
+ return ret;
+
+ id = (stm32mp_read_idc() & DBGMCU_IDC_DEV_ID_MASK) >> DBGMCU_IDC_DEV_ID_SHIFT;
+ *type |= id << 16;
+ return 0;
+}
+
#endif /* __MACH_CPUTYPE_H__ */
diff --git a/arch/arm/mach-stm32mp/init.c b/arch/arm/mach-stm32mp/init.c
index 7f687fa4f2..e77e99f8fa 100644
--- a/arch/arm/mach-stm32mp/init.c
+++ b/arch/arm/mach-stm32mp/init.c
@@ -15,26 +15,6 @@
#include <bootsource.h>
#include <dt-bindings/pinctrl/stm32-pinfunc.h>
-/* DBGMCU register */
-#define DBGMCU_IDC (STM32_DBGMCU_BASE + 0x00)
-#define DBGMCU_APB4FZ1 (STM32_DBGMCU_BASE + 0x2C)
-#define DBGMCU_APB4FZ1_IWDG2 BIT(2)
-#define DBGMCU_IDC_DEV_ID_MASK GENMASK(11, 0)
-#define DBGMCU_IDC_DEV_ID_SHIFT 0
-#define DBGMCU_IDC_REV_ID_MASK GENMASK(31, 16)
-#define DBGMCU_IDC_REV_ID_SHIFT 16
-
-#define RCC_DBGCFGR (STM32_RCC_BASE + 0x080C)
-#define RCC_DBGCFGR_DBGCKEN BIT(8)
-
-/* BSEC OTP index */
-#define BSEC_OTP_RPN 1
-#define BSEC_OTP_PKG 16
-
-/* Device Part Number (RPN) = OTP_DATA1 lower 8 bits */
-#define RPN_SHIFT 0
-#define RPN_MASK GENMASK(7, 0)
-
/* Package = bit 27:29 of OTP16
* - 100: LBGA448 (FFI) => AA = LFBGA 18x18mm 448 balls p. 0.8mm
* - 011: LBGA354 (LCI) => AB = LFBGA 16x16mm 359 balls p. 0.8mm
@@ -152,38 +132,9 @@ int stm32mp_package(void)
return __stm32mp_package;
}
-static inline u32 read_idc(void)
-{
- setbits_le32(RCC_DBGCFGR, RCC_DBGCFGR_DBGCKEN);
- return readl(IOMEM(DBGMCU_IDC));
-}
-
-/* Get Device Part Number (RPN) from OTP */
-static int get_cpu_rpn(u32 *rpn)
-{
- int ret = bsec_read_field(BSEC_OTP_RPN, rpn);
- if (ret)
- return ret;
-
- *rpn = (*rpn >> RPN_SHIFT) & RPN_MASK;
- return 0;
-}
-
static u32 get_cpu_revision(void)
{
- return (read_idc() & DBGMCU_IDC_REV_ID_MASK) >> DBGMCU_IDC_REV_ID_SHIFT;
-}
-
-static int get_cpu_type(u32 *type)
-{
- u32 id;
- int ret = get_cpu_rpn(type);
- if (ret)
- return ret;
-
- id = (read_idc() & DBGMCU_IDC_DEV_ID_MASK) >> DBGMCU_IDC_DEV_ID_SHIFT;
- *type |= id << 16;
- return 0;
+ return (stm32mp_read_idc() & DBGMCU_IDC_REV_ID_MASK) >> DBGMCU_IDC_REV_ID_SHIFT;
}
static int get_cpu_package(u32 *pkg)
@@ -250,7 +201,7 @@ static int setup_cpu_type(void)
u32 pkg;
int ret;
- get_cpu_type(&__stm32mp_cputype);
+ __stm32mp_get_cpu_type(&__stm32mp_cputype);
switch (__stm32mp_cputype) {
case CPU_STM32MP157Fxx:
cputypestr = "157F";
@@ -366,4 +317,4 @@ static int stm32mp_init(void)
return 0;
}
-postcore_initcall(stm32mp_init);
+core_initcall(stm32mp_init);
diff --git a/arch/arm/mach-stm32mp/stm32image.c b/arch/arm/mach-stm32mp/stm32image.c
index 84975c5c3b..207df6894d 100644
--- a/arch/arm/mach-stm32mp/stm32image.c
+++ b/arch/arm/mach-stm32mp/stm32image.c
@@ -43,8 +43,6 @@ static struct image_handler image_handler_stm32_image_v1_handler = {
static int stm32mp_register_stm32image_image_handler(void)
{
- register_image_handler(&image_handler_stm32_image_v1_handler);
-
- return 0;
+ return register_image_handler(&image_handler_stm32_image_v1_handler);
}
late_initcall(stm32mp_register_stm32image_image_handler);
diff --git a/arch/arm/mach-zynq/bootm-zynqimg.c b/arch/arm/mach-zynq/bootm-zynqimg.c
index e903ab6679..77ed6880e4 100644
--- a/arch/arm/mach-zynq/bootm-zynqimg.c
+++ b/arch/arm/mach-zynq/bootm-zynqimg.c
@@ -42,8 +42,6 @@ static struct image_handler zynq_image_handler = {
static int zynq_register_image_handler(void)
{
- register_image_handler(&zynq_image_handler);
-
- return 0;
+ return register_image_handler(&zynq_image_handler);
}
late_initcall(zynq_register_image_handler);
diff --git a/arch/mips/include/asm/debug_ll_ns16550.h b/arch/mips/include/asm/debug_ll_ns16550.h
index df58c4cf0d..703bfaee77 100644
--- a/arch/mips/include/asm/debug_ll_ns16550.h
+++ b/arch/mips/include/asm/debug_ll_ns16550.h
@@ -58,14 +58,14 @@ static inline void PUTC_LL(char ch)
* Macros for use in assembly language code
*/
-.macro debug_ll_ns16550_init
+.macro debug_ll_ns16550_init divisor=DEBUG_LL_UART_DIVISOR
#ifdef CONFIG_DEBUG_LL
la t0, DEBUG_LL_UART_ADDR
li t1, UART_LCR_DLAB /* DLAB on */
sb t1, UART_LCR(t0) /* Write it out */
- li t1, DEBUG_LL_UART_DIVISOR
+ li t1, \divisor
sb t1, UART_DLL(t0) /* write low order byte */
srl t1, t1, 8
sb t1, UART_DLM(t0) /* write high order byte */
diff --git a/arch/riscv/include/asm/debug_ll_ns16550.h b/arch/riscv/include/asm/debug_ll_ns16550.h
index e891cbda25..f1c2ccbd0a 100644
--- a/arch/riscv/include/asm/debug_ll_ns16550.h
+++ b/arch/riscv/include/asm/debug_ll_ns16550.h
@@ -88,14 +88,14 @@ static inline void debug_ll_ns16550_init(void)
* Macros for use in assembly language code
*/
-.macro debug_ll_ns16550_init
+.macro debug_ll_ns16550_init divisor=DEBUG_LL_UART_DIVISOR
#ifdef CONFIG_DEBUG_LL
li t0, DEBUG_LL_UART_ADDR
li t1, UART_LCR_DLAB /* DLAB on */
UART_REG_S t1, UART_LCR(t0) /* Write it out */
- li t1, DEBUG_LL_UART_DIVISOR
+ li t1, \divisor
UART_REG_S t1, UART_DLL(t0) /* write low order byte */
srl t1, t1, 8
UART_REG_S t1, UART_DLM(t0) /* write high order byte */
diff --git a/arch/sandbox/board/devices.c b/arch/sandbox/board/devices.c
index 72e62552a3..1fd1913ae6 100644
--- a/arch/sandbox/board/devices.c
+++ b/arch/sandbox/board/devices.c
@@ -9,6 +9,9 @@
#include <mach/linux.h>
#include <init.h>
#include <mach/linux.h>
+#include <asm/io.h>
+
+unsigned char __pci_iobase[IO_SPACE_LIMIT];
static LIST_HEAD(sandbox_device_list);
diff --git a/arch/sandbox/include/asm/io.h b/arch/sandbox/include/asm/io.h
index 6a0e77aead..9f9cd3a42a 100644
--- a/arch/sandbox/include/asm/io.h
+++ b/arch/sandbox/include/asm/io.h
@@ -1,7 +1,11 @@
#ifndef __ASM_SANDBOX_IO_H
#define __ASM_SANDBOX_IO_H
-#define IO_SPACE_LIMIT 0
+#define IO_SPACE_LIMIT 0xffff
+/* pacify static analyzers */
+#define PCI_IOBASE ((void __iomem *)__pci_iobase)
+
+extern unsigned char __pci_iobase[IO_SPACE_LIMIT];
#include <asm-generic/io.h>
#include <asm-generic/bitio.h>
diff --git a/commands/Kconfig b/commands/Kconfig
index 9114d3cb31..df18715f20 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -285,9 +285,9 @@ config CMD_AT91_BOOT_TEST
config CMD_BOOT_ORDER
tristate
depends on ARCH_OMAP4
- prompt "boot_order"
+ prompt "OMAP boot_order"
help
- Set warm boot order (the next boot device on a warm reset).
+ Set OMAP warm boot order (the next boot device on a warm reset).
Usage: boot_order DEVICE...
diff --git a/common/Kconfig b/common/Kconfig
index 1a5bb53182..8c9fe8e788 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -1292,7 +1292,6 @@ config DEBUG_IMX_UART_PORT
DEBUG_IMX51_UART || \
DEBUG_IMX53_UART || \
DEBUG_IMX6Q_UART || \
- DEBUG_IMX6SL_UART || \
DEBUG_IMX7D_UART || \
DEBUG_IMX8M_UART || \
DEBUG_VF610_UART
diff --git a/common/kallsyms.c b/common/kallsyms.c
index 2c16ab2884..f641903147 100644
--- a/common/kallsyms.c
+++ b/common/kallsyms.c
@@ -15,8 +15,8 @@ extern const unsigned long kallsyms_markers[] __attribute__((weak));
static inline int is_kernel_text(unsigned long addr)
{
- if (addr >= (unsigned long)_stext && addr <= (unsigned long)_end)
- return 1;
+ if (addr >= (unsigned long)_stext && addr <= (unsigned long)_end)
+ return 1;
return 0;
}
diff --git a/common/misc.c b/common/misc.c
index cbee3b6e3e..323500dfa8 100644
--- a/common/misc.c
+++ b/common/misc.c
@@ -22,6 +22,7 @@
#include <led.h>
#include <of.h>
#include <restart.h>
+#include <linux/stringify.h>
int errno;
EXPORT_SYMBOL(errno);
@@ -29,7 +30,7 @@ EXPORT_SYMBOL(errno);
const char *strerror(int errnum)
{
- static char errno_string[10];
+ static char errno_string[sizeof("error -2147483648")];
#ifdef CONFIG_ERRNO_MESSAGES
char *str;
diff --git a/common/startup.c b/common/startup.c
index 848c0806e6..d9d79aef89 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -436,6 +436,8 @@ void shutdown_barebox(void)
pr_debug("exitcall-> %pS\n", *exitcall);
(*exitcall)();
}
+
+ console_flush();
}
BAREBOX_MAGICVAR(global.autoboot,
diff --git a/crypto/rsa.c b/crypto/rsa.c
index 64241854c8..1aea738e52 100644
--- a/crypto/rsa.c
+++ b/crypto/rsa.c
@@ -317,7 +317,7 @@ int rsa_verify(const struct rsa_public_key *key, const uint8_t *sig,
return -EOPNOTSUPP;
if (sig_len != (key->len * sizeof(uint32_t))) {
- debug("Signature is of incorrect length %d, should be %d\n", sig_len,
+ debug("Signature is of incorrect length %u, should be %zu\n", sig_len,
key->len * sizeof(uint32_t));
ret = -EINVAL;
goto out_free_digest;
diff --git a/drivers/aiodev/Kconfig b/drivers/aiodev/Kconfig
index a4909d8ecd..5fb445c096 100644
--- a/drivers/aiodev/Kconfig
+++ b/drivers/aiodev/Kconfig
@@ -35,4 +35,12 @@ config MC13XXX_ADC
help
Support for MC13783, MC13892, MC34708 ADC
+config AM335X_ADC
+ tristate "AM335X ADC driver"
+ depends on ARCH_AM33XX
+ help
+ Support for ADC on TI AM335X SoCs. Supports simple one-shot readings
+ rather than continuous sampling with DMA, etc. ADC channels should be
+ configured via device tree, using the kernel bindings.
+
endif
diff --git a/drivers/aiodev/Makefile b/drivers/aiodev/Makefile
index d5318deeb0..5f48b2022a 100644
--- a/drivers/aiodev/Makefile
+++ b/drivers/aiodev/Makefile
@@ -4,3 +4,4 @@ obj-$(CONFIG_IMX_THERMAL) += imx_thermal.o
obj-$(CONFIG_LM75) += lm75.o
obj-$(CONFIG_MC13XXX_ADC) += mc13xxx_adc.o
obj-$(CONFIG_QORIQ_THERMAL) += qoriq_thermal.o
+obj-$(CONFIG_AM335X_ADC) += am335x_adc.o
diff --git a/drivers/aiodev/am335x_adc.c b/drivers/aiodev/am335x_adc.c
new file mode 100644
index 0000000000..0d6cc426eb
--- /dev/null
+++ b/drivers/aiodev/am335x_adc.c
@@ -0,0 +1,183 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/* am335x_adc.c
+ *
+ * Copyright © 2019 Synapse Product Development
+ *
+ * Author: Trent Piepho <trent.piepho@synapse.com>
+ *
+ * This is a simple driver for the ADC in TI's AM335x SoCs. It's designed to
+ * produce one-shot readings and doesn't use the more advanced features, like
+ * the FIFO, triggering, DMA, multi-channel scan programs, etc.
+ */
+
+#include <common.h>
+#include <init.h>
+#include <malloc.h>
+#include <driver.h>
+#include <xfuncs.h>
+#include <errno.h>
+#include <io.h>
+#include <linux/log2.h>
+#include <aiodev.h>
+#include <mach/am33xx-clock.h>
+#include "ti_am335x_tscadc.h"
+
+struct am335x_adc_data {
+ struct aiodevice aiodev;
+ void __iomem *base;
+ struct aiochannel *channels;
+};
+
+static inline void tiadc_write(const struct am335x_adc_data *data, u32 value,
+ u32 reg)
+{
+ writel(value, data->base + reg);
+}
+
+static inline u32 tiadc_read(const struct am335x_adc_data *data, u32 reg)
+{
+ return readl(data->base + reg);
+}
+
+static int am335x_adc_read(struct aiochannel *chan, int *val)
+{
+ struct am335x_adc_data *data =
+ container_of(chan->aiodev, struct am335x_adc_data, aiodev);
+ int timeout = IDLE_TIMEOUT;
+ /* This assumes VREFN = 0V and VREFP = 1.8V */
+ const u32 vrefp = 1800; /* ceil(log2(vrefp)) = 11 */
+ /* Left shift vrefp/4095 by as much as possible without overflowing 32 bits */
+ const u32 shift = 32 - (const_ilog2(vrefp) + 1);
+ const u32 factor = (vrefp << shift) / 4095u;
+ u32 counts;
+
+ /* Make sure FIFO is empty before we start, so we don't get old data */
+ while ((tiadc_read(data, REG_FIFO1CNT) & 0x7f) > 0)
+ tiadc_read(data, REG_FIFO1);
+
+ tiadc_write(data, ENB(chan->index + 1), REG_SE); /* ENB(1) is 1st channel */
+ tiadc_write(data, CNTRLREG_TSCSSENB, REG_CTRL);
+
+ while ((tiadc_read(data, REG_FIFO1CNT) & 0x7f) == 0) {
+ if (--timeout == 0)
+ return -ETIMEDOUT;
+ mdelay(1);
+ }
+
+ counts = tiadc_read(data, REG_FIFO1) & FIFOREAD_DATA_MASK;
+ *val = (counts * factor) >> shift;
+
+ tiadc_write(data, 0, REG_CTRL);
+
+ return 0;
+}
+
+static int am335x_adc_probe(struct device_d *dev)
+{
+ struct device_node *node;
+ struct am335x_adc_data *data;
+ int i, ret;
+
+ data = xzalloc(sizeof(*data));
+ data->aiodev.hwdev = dev;
+ data->aiodev.read = am335x_adc_read;
+ data->base = dev_request_mem_region(dev, 0);
+ if (IS_ERR(data->base)) {
+ ret = PTR_ERR(data->base);
+ goto fail_data;
+ }
+
+ node = of_find_compatible_node(dev->device_node, NULL, "ti,am3359-adc");
+ if (!node) {
+ ret = -EINVAL;
+ goto fail_data;
+ }
+
+ if (!of_find_property(node, "ti,adc-channels",
+ &data->aiodev.num_channels))
+ return -EINVAL;
+ data->aiodev.num_channels /= sizeof(u32);
+
+ data->channels = xzalloc(sizeof(*data->channels) *
+ data->aiodev.num_channels);
+ data->aiodev.channels = xmalloc(sizeof(*data->aiodev.channels) *
+ data->aiodev.num_channels);
+
+ /* Max ADC clock is 24 MHz or 3 MHz, depending on if one looks at the
+ * reference manual or data sheet.
+ */
+ tiadc_write(data, DIV_ROUND_UP(am33xx_get_osc_clock(), ADC_CLK) - 1,
+ REG_CLKDIV);
+ tiadc_write(data, ~0, REG_IRQCLR);
+ tiadc_write(data, ~0, REG_IRQSTATUS);
+ tiadc_write(data, 0x3, REG_DMAENABLE_CLEAR);
+ tiadc_write(data, CNTRLREG_STEPCONFIGWRT, REG_CTRL);
+ tiadc_write(data,
+ STEPCONFIG_RFP_VREFP | STEPCONFIG_RFM_VREFN |
+ STEPCONFIG_INM_ADCREFM | STEPCONFIG_INP_ADCREFM,
+ REG_IDLECONFIG);
+
+
+ for (i = 0; i < data->aiodev.num_channels; i++) {
+ u32 config, delay, ain, odelay, sdelay, avg;
+
+ data->aiodev.channels[i] = &data->channels[i];
+ data->channels[i].unit = "mV";
+ ret = of_property_read_u32_index(node, "ti,adc-channels",
+ i, &ain);
+ if (ret)
+ goto fail_channels;
+
+ ret = of_property_read_u32_index(node, "ti,chan-step-opendelay",
+ i, &odelay);
+ odelay = ret ? STEPCONFIG_OPENDLY : STEPDELAY_OPEN(odelay);
+
+ ret = of_property_read_u32_index(node, "ti,chan-step-sampledelay",
+ i, &sdelay);
+ sdelay = ret ? STEPCONFIG_SAMPLEDLY : STEPDELAY_SAMPLE(sdelay);
+
+ ret = of_property_read_u32_index(node, "ti,chan-step-avg",
+ i, &avg);
+ avg = ret ? STEPCONFIG_AVG_16 : STEPCONFIG_AVG(ilog2(avg ? : 1));
+
+ /* We program each step with one of the channels in the DT */
+ config = STEPCONFIG_RFP_VREFP | STEPCONFIG_RFM_VREFN | /* External refs */
+ /* Internal reference, use STEPCONFIG_RFP(0) | STEPCONFIG_RFM(0) */
+ STEPCONFIG_INM_ADCREFM | /* Not important, SE rather than diff */
+ STEPCONFIG_MODE(0) | STEPCONFIG_FIFO1 | /* One-shot and data to FIFO1 */
+ avg | STEPCONFIG_INP(ain);
+ delay = odelay | sdelay;
+
+ tiadc_write(data, config, REG_STEPCONFIG(i));
+ tiadc_write(data, delay, REG_STEPDELAY(i));
+ }
+ tiadc_write(data, 0, REG_CTRL);
+
+ ret = aiodevice_register(&data->aiodev);
+ if (ret)
+ goto fail_channels;
+
+ dev_info(dev, "TI AM335x ADC (%d ch) registered as %s\n",
+ data->aiodev.num_channels, dev_name(&data->aiodev.dev));
+ return 0;
+
+ fail_channels:
+ kfree(data->channels);
+ kfree(data->aiodev.channels);
+
+ fail_data:
+ kfree(data);
+ return ret;
+}
+
+static const struct of_device_id of_am335x_adc_match[] = {
+ { .compatible = "ti,am3359-tscadc", },
+ { /* end */ }
+};
+
+static struct driver_d am335x_adc_driver = {
+ .name = "am335x_adc",
+ .probe = am335x_adc_probe,
+ .of_compatible = DRV_OF_COMPAT(of_am335x_adc_match),
+};
+device_platform_driver(am335x_adc_driver);
diff --git a/drivers/aiodev/core.c b/drivers/aiodev/core.c
index b8428346a3..7240de2c40 100644
--- a/drivers/aiodev/core.c
+++ b/drivers/aiodev/core.c
@@ -24,7 +24,7 @@
LIST_HEAD(aiodevices);
EXPORT_SYMBOL(aiodevices);
-struct aiochannel *aiochannel_get_by_name(const char *name)
+struct aiochannel *aiochannel_by_name(const char *name)
{
struct aiodevice *aiodev;
int i;
@@ -131,7 +131,7 @@ int aiodevice_register(struct aiodevice *aiodev)
aiochannel_param_get_value,
&aiochan->value, "%d", aiochan);
- aiochan->name = xasprintf("%s.%s", aiodev->name, name);
+ aiochan->name = xasprintf("%s.%s", dev_name(&aiodev->dev), name);
free(name);
}
diff --git a/drivers/aiodev/ti_am335x_tscadc.h b/drivers/aiodev/ti_am335x_tscadc.h
new file mode 100644
index 0000000000..36f3c17ac0
--- /dev/null
+++ b/drivers/aiodev/ti_am335x_tscadc.h
@@ -0,0 +1,163 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef __LINUX_TI_AM335X_TSCADC_MFD_H
+#define __LINUX_TI_AM335X_TSCADC_MFD_H
+
+/*
+ * TI Touch Screen / ADC MFD driver
+ *
+ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * 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.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#define REG_RAWIRQSTATUS 0x024
+#define REG_IRQSTATUS 0x028
+#define REG_IRQENABLE 0x02C
+#define REG_IRQCLR 0x030
+#define REG_IRQWAKEUP 0x034
+#define REG_DMAENABLE_SET 0x038
+#define REG_DMAENABLE_CLEAR 0x03c
+#define REG_CTRL 0x040
+#define REG_ADCFSM 0x044
+#define REG_CLKDIV 0x04C
+#define REG_SE 0x054
+#define REG_IDLECONFIG 0x058
+#define REG_CHARGECONFIG 0x05C
+#define REG_CHARGEDELAY 0x060
+#define REG_STEPCONFIG(n) (0x64 + ((n) * 8))
+#define REG_STEPDELAY(n) (0x68 + ((n) * 8))
+#define REG_FIFO0CNT 0xE4
+#define REG_FIFO0THR 0xE8
+#define REG_FIFO1CNT 0xF0
+#define REG_FIFO1THR 0xF4
+#define REG_DMA1REQ 0xF8
+#define REG_FIFO0 0x100
+#define REG_FIFO1 0x200
+
+/* Register Bitfields */
+/* IRQ wakeup enable */
+#define IRQWKUP_ENB BIT(0)
+
+/* Step Enable */
+#define STEPENB_MASK (0x1FFFF << 0)
+#define STEPENB(val) ((val) << 0)
+#define ENB(val) (1 << (val))
+#define STPENB_STEPENB STEPENB(0x1FFFF)
+#define STPENB_STEPENB_TC STEPENB(0x1FFF)
+
+/* IRQ enable */
+#define IRQENB_HW_PEN BIT(0)
+#define IRQENB_EOS BIT(1)
+#define IRQENB_FIFO0THRES BIT(2)
+#define IRQENB_FIFO0OVRRUN BIT(3)
+#define IRQENB_FIFO0UNDRFLW BIT(4)
+#define IRQENB_FIFO1THRES BIT(5)
+#define IRQENB_FIFO1OVRRUN BIT(6)
+#define IRQENB_FIFO1UNDRFLW BIT(7)
+#define IRQENB_PENUP BIT(9)
+
+/* Step Configuration */
+#define STEPCONFIG_MODE_MASK (3 << 0)
+#define STEPCONFIG_MODE(val) ((val) << 0)
+#define STEPCONFIG_MODE_SWCNT STEPCONFIG_MODE(1)
+#define STEPCONFIG_MODE_HWSYNC STEPCONFIG_MODE(2)
+#define STEPCONFIG_AVG_MASK (7 << 2)
+#define STEPCONFIG_AVG(val) ((val) << 2)
+#define STEPCONFIG_AVG_16 STEPCONFIG_AVG(4)
+#define STEPCONFIG_XPP BIT(5)
+#define STEPCONFIG_XNN BIT(6)
+#define STEPCONFIG_YPP BIT(7)
+#define STEPCONFIG_YNN BIT(8)
+#define STEPCONFIG_XNP BIT(9)
+#define STEPCONFIG_YPN BIT(10)
+#define STEPCONFIG_RFP(val) ((val) << 12)
+#define STEPCONFIG_RFP_VREFP (0x3 << 12)
+#define STEPCONFIG_INM_MASK (0xF << 15)
+#define STEPCONFIG_INM(val) ((val) << 15)
+#define STEPCONFIG_INM_ADCREFM STEPCONFIG_INM(8)
+#define STEPCONFIG_INP_MASK (0xF << 19)
+#define STEPCONFIG_INP(val) ((val) << 19)
+#define STEPCONFIG_INP_AN4 STEPCONFIG_INP(4)
+#define STEPCONFIG_INP_ADCREFM STEPCONFIG_INP(8)
+#define STEPCONFIG_FIFO1 BIT(26)
+#define STEPCONFIG_RFM(val) ((val) << 23)
+#define STEPCONFIG_RFM_VREFN (0x3 << 23)
+
+/* Delay register */
+#define STEPDELAY_OPEN_MASK (0x3FFFF << 0)
+#define STEPDELAY_OPEN(val) ((val) << 0)
+#define STEPCONFIG_OPENDLY STEPDELAY_OPEN(0x098)
+#define STEPDELAY_SAMPLE_MASK (0xFF << 24)
+#define STEPDELAY_SAMPLE(val) ((val) << 24)
+#define STEPCONFIG_SAMPLEDLY STEPDELAY_SAMPLE(0)
+
+/* Charge Config */
+#define STEPCHARGE_RFP_MASK (7 << 12)
+#define STEPCHARGE_RFP(val) ((val) << 12)
+#define STEPCHARGE_RFP_XPUL STEPCHARGE_RFP(1)
+#define STEPCHARGE_INM_MASK (0xF << 15)
+#define STEPCHARGE_INM(val) ((val) << 15)
+#define STEPCHARGE_INM_AN1 STEPCHARGE_INM(1)
+#define STEPCHARGE_INP_MASK (0xF << 19)
+#define STEPCHARGE_INP(val) ((val) << 19)
+#define STEPCHARGE_RFM_MASK (3 << 23)
+#define STEPCHARGE_RFM(val) ((val) << 23)
+#define STEPCHARGE_RFM_XNUR STEPCHARGE_RFM(1)
+
+/* Charge delay */
+#define CHARGEDLY_OPEN_MASK (0x3FFFF << 0)
+#define CHARGEDLY_OPEN(val) ((val) << 0)
+#define CHARGEDLY_OPENDLY CHARGEDLY_OPEN(0x400)
+
+/* Control register */
+#define CNTRLREG_TSCSSENB BIT(0)
+#define CNTRLREG_STEPID BIT(1)
+#define CNTRLREG_STEPCONFIGWRT BIT(2)
+#define CNTRLREG_POWERDOWN BIT(4)
+#define CNTRLREG_AFE_CTRL_MASK (3 << 5)
+#define CNTRLREG_AFE_CTRL(val) ((val) << 5)
+#define CNTRLREG_4WIRE CNTRLREG_AFE_CTRL(1)
+#define CNTRLREG_5WIRE CNTRLREG_AFE_CTRL(2)
+#define CNTRLREG_8WIRE CNTRLREG_AFE_CTRL(3)
+#define CNTRLREG_TSCENB BIT(7)
+
+/* FIFO READ Register */
+#define FIFOREAD_DATA_BITS 12
+#define FIFOREAD_DATA_MASK (BIT(FIFOREAD_DATA_BITS) - 1)
+#define FIFOREAD_CHNLID_MASK (0xf << 16)
+
+/* DMA ENABLE/CLEAR Register */
+#define DMA_FIFO0 BIT(0)
+#define DMA_FIFO1 BIT(1)
+
+/* Sequencer Status */
+#define SEQ_STATUS BIT(5)
+#define CHARGE_STEP 0x11
+
+#define ADC_CLK 3000000
+#define TOTAL_STEPS 16
+#define TOTAL_CHANNELS 8
+#define FIFO1_THRESHOLD 19
+
+/*
+ * time in us for processing a single channel, calculated as follows:
+ *
+ * max num cycles = open delay + (sample delay + conv time) * averaging
+ *
+ * max num cycles: 262143 + (255 + 13) * 16 = 266431
+ *
+ * clock frequency: 26MHz / 8 = 3.25MHz
+ * clock period: 1 / 3.25MHz = 308ns
+ *
+ * max processing time: 266431 * 308ns = 83ms(approx)
+ */
+#define IDLE_TIMEOUT 83 /* milliseconds */
+
+#endif
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 0a2632f963..63cc2e586c 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -23,6 +23,7 @@
#include <memory.h>
#include <linux/sizes.h>
#include <of_graph.h>
+#include <string.h>
#include <linux/ctype.h>
#include <linux/amba/bus.h>
#include <linux/err.h>
@@ -1183,6 +1184,53 @@ int of_property_write_u64_array(struct device_node *np,
}
/**
+ * of_property_write_strings - Write strings to a property. If
+ * the property does not exist, it will be created and appended to the given
+ * device node.
+ *
+ * @np: device node to which the property value is to be written.
+ * @propname: name of the property to be written.
+ * @...: pointers to strings to write
+ *
+ * Search for a property in a device node and write a string to
+ * it. If the property does not exist, it will be created and appended to
+ * the device node. Returns 0 on success, -ENOMEM if the property or array
+ * of elements cannot be created, -EINVAL if no strings specified.
+ */
+int of_property_write_strings(struct device_node *np,
+ const char *propname, ...)
+{
+ const char *val;
+ char *buf = NULL, *next;
+ size_t len = 0;
+ va_list ap;
+ int ret = 0;
+
+ va_start(ap, propname);
+ for (val = va_arg(ap, char *); val; val = va_arg(ap, char *))
+ len += strlen(val) + 1;
+ va_end(ap);
+
+ if (!len)
+ return -EINVAL;
+
+ buf = malloc(len);
+ if (!buf)
+ return -ENOMEM;
+
+ next = buf;
+
+ va_start(ap, propname);
+ for (val = va_arg(ap, char *); val; val = va_arg(ap, char *))
+ next = stpcpy(next, val) + 1;
+ va_end(ap);
+
+ ret = of_set_property(np, propname, buf, len, 1);
+ free(buf);
+ return ret;
+}
+
+/**
* of_property_write_string - Write a string to a property. If
* the property does not exist, it will be created and appended to the given
* device node.
diff --git a/drivers/usb/dwc2/dwc2.c b/drivers/usb/dwc2/dwc2.c
index 908d624794..282e6754b0 100644
--- a/drivers/usb/dwc2/dwc2.c
+++ b/drivers/usb/dwc2/dwc2.c
@@ -15,19 +15,6 @@
#include "dwc2.h"
-static void dwc2_uninit_common(struct dwc2 *dwc2)
-{
- uint32_t hprt0;
-
- hprt0 = dwc2_readl(dwc2, HPRT0);
-
- /* Put everything in reset. */
- hprt0 &= ~(HPRT0_ENA | HPRT0_ENACHG | HPRT0_CONNDET | HPRT0_OVRCURRCHG);
- hprt0 |= HPRT0_RST;
-
- dwc2_writel(dwc2, hprt0, HPRT0);
-}
-
static int dwc2_set_mode(void *ctx, enum usb_dr_mode mode)
{
struct dwc2 *dwc2 = ctx;
@@ -98,7 +85,8 @@ static void dwc2_remove(struct device_d *dev)
{
struct dwc2 *dwc2 = dev->priv;
- dwc2_uninit_common(dwc2);
+ dwc2_host_uninit(dwc2);
+ dwc2_gadget_uninit(dwc2);
}
static const struct of_device_id dwc2_platform_dt_ids[] = {
diff --git a/drivers/usb/dwc2/dwc2.h b/drivers/usb/dwc2/dwc2.h
index 5e845f3491..30ad906656 100644
--- a/drivers/usb/dwc2/dwc2.h
+++ b/drivers/usb/dwc2/dwc2.h
@@ -34,13 +34,17 @@ int dwc2_submit_roothub(struct dwc2 *dwc2, struct usb_device *dev,
unsigned long pipe, void *buf, int len,
struct devrequest *setup);
int dwc2_register_host(struct dwc2 *dwc2);
+void dwc2_host_uninit(struct dwc2 *dwc2);
#else
static inline int dwc2_register_host(struct dwc2 *dwc2) { return -ENODEV; }
+static inline void dwc2_host_uninit(struct dwc2 *dwc2) {};
#endif
/* Gadget functions */
#ifdef CONFIG_USB_DWC2_GADGET
int dwc2_gadget_init(struct dwc2 *dwc2);
+void dwc2_gadget_uninit(struct dwc2 *dwc2);
#else
static inline int dwc2_gadget_init(struct dwc2 *dwc2) { return -ENODEV; }
+static inline void dwc2_gadget_uninit(struct dwc2 *dwc2) {};
#endif
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 6a65b9b117..aa7447c9b4 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -2734,3 +2734,9 @@ int dwc2_gadget_init(struct dwc2 *dwc2)
return 0;
}
+
+void dwc2_gadget_uninit(struct dwc2 *dwc2)
+{
+ dwc2_core_disconnect(dwc2);
+ dwc2_gadget_disconnect(dwc2);
+}
diff --git a/drivers/usb/dwc2/host.c b/drivers/usb/dwc2/host.c
index 13cb3472d7..510a07dfb9 100644
--- a/drivers/usb/dwc2/host.c
+++ b/drivers/usb/dwc2/host.c
@@ -788,3 +788,16 @@ int dwc2_register_host(struct dwc2 *dwc2)
return usb_register_host(host);
}
+
+void dwc2_host_uninit(struct dwc2 *dwc2)
+{
+ uint32_t hprt0;
+
+ hprt0 = dwc2_readl(dwc2, HPRT0);
+
+ /* Put everything in reset. */
+ hprt0 &= ~(HPRT0_ENA | HPRT0_ENACHG | HPRT0_CONNDET | HPRT0_OVRCURRCHG);
+ hprt0 |= HPRT0_RST;
+
+ dwc2_writel(dwc2, hprt0, HPRT0);
+}
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
index 68d819af2c..be9651b049 100644
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
@@ -1189,8 +1189,8 @@ void musb_host_rx(struct musb *musb, u8 epnum)
pipe = urb->pipe;
- dev_dbg(musb->controller, "<== hw %d rxcsr %04x, urb actual %d (+dma %zu)\n",
- epnum, rx_csr, urb->actual_length, 0);
+ dev_dbg(musb->controller, "<== hw %d rxcsr %04x, urb actual %d (+dma 0)\n",
+ epnum, rx_csr, urb->actual_length);
/* check for errors, concurrent stall & unlink is not really
* handled yet! */
diff --git a/images/Makefile.stm32mp b/images/Makefile.stm32mp
index 1330a7ef3d..eafe84a721 100644
--- a/images/Makefile.stm32mp
+++ b/images/Makefile.stm32mp
@@ -13,10 +13,10 @@ STM32MP1_OPTS = -a 0xc0100000 -e 0xc0100000 -v1
# --------------------------------------
-pblb-$(CONFIG_MACH_STM32MP157C_DK2) += start_stm32mp157c_dk2
-FILE_barebox-stm32mp157c-dk2.img = start_stm32mp157c_dk2.pblb.stm32
-OPTS_start_stm32mp157c_dk2.pblb.stm32 = $(STM32MP1_OPTS)
-image-$(CONFIG_MACH_STM32MP157C_DK2) += barebox-stm32mp157c-dk2.img
+pblb-$(CONFIG_MACH_STM32MP15XX_DKX) += start_stm32mp15xx_dkx
+FILE_barebox-stm32mp15xx-dkx.img = start_stm32mp15xx_dkx.pblb.stm32
+OPTS_start_stm32mp15xx_dkx.pblb.stm32 = $(STM32MP1_OPTS)
+image-$(CONFIG_MACH_STM32MP15XX_DKX) += barebox-stm32mp15xx-dkx.img
pblb-$(CONFIG_MACH_LXA_MC1) += start_stm32mp157c_lxa_mc1
FILE_barebox-stm32mp157c-lxa-mc1.img = start_stm32mp157c_lxa_mc1.pblb.stm32
diff --git a/include/aiodev.h b/include/aiodev.h
index 65d817f296..d557715671 100644
--- a/include/aiodev.h
+++ b/include/aiodev.h
@@ -31,7 +31,8 @@ struct aiodevice {
int aiodevice_register(struct aiodevice *aiodev);
struct aiochannel *aiochannel_get(struct device_d *dev, int index);
-struct aiochannel *aiochannel_get_by_name(const char *name);
+/* Find aiochannel by channel name, e.g. "aiodev0.in_value0_mV" */
+struct aiochannel *aiochannel_by_name(const char *name);
int aiochannel_get_value(struct aiochannel *aiochan, int *value);
int aiochannel_get_index(struct aiochannel *aiochan);
diff --git a/include/asm-generic/bitio.h b/include/asm-generic/bitio.h
index e88dbd7b85..99b85da59c 100644
--- a/include/asm-generic/bitio.h
+++ b/include/asm-generic/bitio.h
@@ -3,7 +3,7 @@
#ifndef __ASM_GENERIC_BITIO_H
#define __ASM_GENERIC_BITIO_H
-#include <asm-generic/io.h>
+#include <asm/io.h>
/*
* Clear and set bits in one shot. These macros can be used to clear and
diff --git a/include/linux/string.h b/include/linux/string.h
index 2b699957e8..85c3eb1de3 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -10,7 +10,6 @@ extern "C" {
extern char * strpbrk(const char *,const char *);
extern char * strsep(char **,const char *);
-extern char * strsep_unescaped(char **,const char *);
extern __kernel_size_t strspn(const char *,const char *);
diff --git a/include/of.h b/include/of.h
index d548e51789..e60cb5307d 100644
--- a/include/of.h
+++ b/include/of.h
@@ -231,6 +231,8 @@ extern int of_property_write_u64_array(struct device_node *np,
size_t sz);
extern int of_property_write_string(struct device_node *np, const char *propname,
const char *value);
+extern int of_property_write_strings(struct device_node *np, const char *propname,
+ ...) __attribute__((__sentinel__));
extern struct device_node *of_parse_phandle(const struct device_node *np,
const char *phandle_name,
diff --git a/include/regulator.h b/include/regulator.h
index 44eee7b0ad..7c2a01b687 100644
--- a/include/regulator.h
+++ b/include/regulator.h
@@ -2,6 +2,8 @@
#ifndef __REGULATOR_H
#define __REGULATOR_H
+struct device_d;
+
/* struct regulator is an opaque object for consumers */
struct regulator;
diff --git a/include/string.h b/include/string.h
index 727bc51934..b51566fd00 100644
--- a/include/string.h
+++ b/include/string.h
@@ -5,6 +5,8 @@
#include <linux/string.h>
int strtobool(const char *str, int *val);
+char *strsep_unescaped(char **, const char *);
+char *stpcpy(char *dest, const char *src);
void *__default_memset(void *, int, __kernel_size_t);
void *__nokasan_default_memset(void *, int, __kernel_size_t);
diff --git a/lib/Kconfig b/lib/Kconfig
index 90552f3c27..887f50ff00 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -111,7 +111,7 @@ config LIBFDT
config RATP
select CRC_ITU_T
- select COMPILE_MEMORY
+ select DEV_MEM
select COMMAND_SUPPORT
select POLLER
depends on CONSOLE_FULL
diff --git a/lib/string.c b/lib/string.c
index 003070fa53..d250e58643 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -100,6 +100,19 @@ char * strcpy(char * dest,const char *src)
#endif
EXPORT_SYMBOL(strcpy);
+/**
+ * stpcpy - Copy a %NUL terminated string, but return pointer to %NUL
+ * @dest: Where to copy the string to
+ * @src: Where to copy the string from
+ */
+char *stpcpy(char *dest, const char *src)
+{
+ while ((*dest++ = *src++) != '\0')
+ /* nothing */;
+ return dest - 1;
+}
+EXPORT_SYMBOL(stpcpy);
+
#ifndef __HAVE_ARCH_STRNCPY
/**
* strncpy - Copy a length-limited, %NUL-terminated string
diff --git a/scripts/dtc/Makefile b/scripts/dtc/Makefile
index 06a265cf7b..721e8e2b8c 100644
--- a/scripts/dtc/Makefile
+++ b/scripts/dtc/Makefile
@@ -14,7 +14,7 @@ libfdt-objs := $(libfdt-objs:%.o=libfdt/%.o)
fdtget-objs += fdtget.o $(libfdt-objs) util.o
# Source files need to get at the userspace version of libfdt_env.h to compile
-HOST_EXTRACFLAGS := -I$(src)/libfdt
+HOST_EXTRACFLAGS += -I$(src)/libfdt
ifeq ($(wildcard /usr/include/yaml.h),)
ifneq ($(CHECK_DTBS),)
diff --git a/scripts/kwboot.c b/scripts/kwboot.c
index 43b8b8cbcd..60e8a69d18 100644
--- a/scripts/kwboot.c
+++ b/scripts/kwboot.c
@@ -504,7 +504,7 @@ kwboot_term_pipe(int in, int out, char *quit, int *s)
ssize_t nin, nout;
char _buf[128], *buf = _buf;
- nin = read(in, buf, sizeof(buf));
+ nin = read(in, _buf, sizeof(_buf));
if (nin < 0)
return -1;