diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2020-09-25 08:06:20 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2020-09-25 08:06:20 +0200 |
commit | 39bdcdfb814a22c8143c04938268378e9994b7dd (patch) | |
tree | 4eeea3247892cab65f10a25d2910fad021cbe7f0 /arch | |
parent | e083790340aa4cf1b8edaa50f6b9fbb1edfe56d0 (diff) | |
parent | 8fb0a2bf6efb67084a5d7a7f3822b4d480fca685 (diff) | |
download | barebox-39bdcdfb814a22c8143c04938268378e9994b7dd.tar.gz barebox-39bdcdfb814a22c8143c04938268378e9994b7dd.tar.xz |
Merge branch 'for-next/misc' into master
Diffstat (limited to 'arch')
88 files changed, 357 insertions, 243 deletions
diff --git a/arch/arm/boards/edb93xx/flash_cfg.c b/arch/arm/boards/edb93xx/flash_cfg.c index 6b742f967c..8400db69de 100644 --- a/arch/arm/boards/edb93xx/flash_cfg.c +++ b/arch/arm/boards/edb93xx/flash_cfg.c @@ -11,6 +11,9 @@ SMC_BCR_BLE | 2 << SMC_BCR_WST2_SHIFT | \ 1 << SMC_BCR_MW_SHIFT) +/* Called from assembly */ +void flash_cfg(void); + void flash_cfg(void) { struct smc_regs *smc = (struct smc_regs *)SMC_BASE; diff --git a/arch/arm/boards/edb93xx/pll_cfg.c b/arch/arm/boards/edb93xx/pll_cfg.c index 1f03acf915..1a1c01aba2 100644 --- a/arch/arm/boards/edb93xx/pll_cfg.c +++ b/arch/arm/boards/edb93xx/pll_cfg.c @@ -9,6 +9,9 @@ #include "pll_cfg.h" #include "early_udelay.h" +/* Called from assembly */ +void pll_cfg(void); + void pll_cfg(void) { struct syscon_regs *syscon = (struct syscon_regs *)SYSCON_BASE; diff --git a/arch/arm/boards/edb93xx/sdram_cfg.c b/arch/arm/boards/edb93xx/sdram_cfg.c index a9f591f197..3cee834910 100644 --- a/arch/arm/boards/edb93xx/sdram_cfg.c +++ b/arch/arm/boards/edb93xx/sdram_cfg.c @@ -17,6 +17,9 @@ static void precharge_all_banks(void); static void setup_refresh_timer(void); static void program_mode_registers(void); +/* Called from assembly */ +void sdram_cfg(void); + void sdram_cfg(void) { struct sdram_regs *sdram = (struct sdram_regs *)SDRAM_BASE; diff --git a/arch/arm/boards/karo-tx28/tx28-stk5.c b/arch/arm/boards/karo-tx28/tx28-stk5.c index c9b947953b..56211d7a3a 100644 --- a/arch/arm/boards/karo-tx28/tx28-stk5.c +++ b/arch/arm/boards/karo-tx28/tx28-stk5.c @@ -22,6 +22,8 @@ #include <mach/iomux.h> #include <generated/mach-types.h> +#include "tx28.h" + static struct mxs_mci_platform_data mci_pdata = { .caps = MMC_CAP_4_BIT_DATA, .voltages = MMC_VDD_32_33 | MMC_VDD_33_34, /* fixed to 3.3 V */ diff --git a/arch/arm/boards/karo-tx28/tx28.c b/arch/arm/boards/karo-tx28/tx28.c index 52f74b5f36..8bd2252410 100644 --- a/arch/arm/boards/karo-tx28/tx28.c +++ b/arch/arm/boards/karo-tx28/tx28.c @@ -15,6 +15,8 @@ #include <mach/iomux.h> #include <asm/mmu.h> +#include "tx28.h" + /* setup the CPU card internal signals */ static const uint32_t tx28_pad_setup[] = { /* NAND interface */ @@ -61,8 +63,6 @@ static const uint32_t tx28_pad_setup[] = { }; -extern void base_board_init(void); - static int tx28_devices_init(void) { int i; diff --git a/arch/arm/boards/karo-tx28/tx28.h b/arch/arm/boards/karo-tx28/tx28.h new file mode 100644 index 0000000000..5fb1e13412 --- /dev/null +++ b/arch/arm/boards/karo-tx28/tx28.h @@ -0,0 +1,3 @@ + +void base_board_init(void); + diff --git a/arch/arm/configs/at91sam9263ek_defconfig b/arch/arm/configs/at91sam9263ek_defconfig index 45c6f79de4..0cde5396af 100644 --- a/arch/arm/configs/at91sam9263ek_defconfig +++ b/arch/arm/configs/at91sam9263ek_defconfig @@ -1,4 +1,3 @@ -CONFIG_ARCH_AT91SAM9263=y CONFIG_AT91_MULTI_BOARDS=y CONFIG_MACH_AT91SAM9263EK=y CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000 diff --git a/arch/arm/configs/at91sam9x5ek_defconfig b/arch/arm/configs/at91sam9x5ek_defconfig index 11d1e4511e..7b743abfaa 100644 --- a/arch/arm/configs/at91sam9x5ek_defconfig +++ b/arch/arm/configs/at91sam9x5ek_defconfig @@ -1,4 +1,3 @@ -CONFIG_ARCH_AT91SAM9X5=y CONFIG_AT91_MULTI_BOARDS=y CONFIG_MACH_AT91SAM9X5EK=y CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000 diff --git a/arch/arm/configs/freescale-mx21-ads_defconfig b/arch/arm/configs/freescale-mx21-ads_defconfig index e1843db3e2..b1d37f76a8 100644 --- a/arch/arm/configs/freescale-mx21-ads_defconfig +++ b/arch/arm/configs/freescale-mx21-ads_defconfig @@ -1,6 +1,5 @@ CONFIG_TEXT_BASE=0xc3000000 CONFIG_ARCH_IMX=y -CONFIG_MACH_IMX21ADS=y CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y CONFIG_MALLOC_SIZE=0x2000000 CONFIG_CMDLINE_EDITING=y diff --git a/arch/arm/configs/imx_defconfig b/arch/arm/configs/imx_defconfig index 02e33e122e..e6333220b6 100644 --- a/arch/arm/configs/imx_defconfig +++ b/arch/arm/configs/imx_defconfig @@ -13,7 +13,6 @@ CONFIG_MMU=y CONFIG_MALLOC_SIZE=0x0 CONFIG_MALLOC_TLSF=y CONFIG_KALLSYMS=y -CONFIG_RELOCATABLE=y CONFIG_PANIC_HANG=y CONFIG_HUSH_FANCY_PROMPT=y CONFIG_CMDLINE_EDITING=y diff --git a/arch/arm/configs/imx_v8_defconfig b/arch/arm/configs/imx_v8_defconfig index 268770ec3f..06d79f594d 100644 --- a/arch/arm/configs/imx_v8_defconfig +++ b/arch/arm/configs/imx_v8_defconfig @@ -10,7 +10,6 @@ CONFIG_MMU=y CONFIG_MALLOC_SIZE=0x0 CONFIG_MALLOC_TLSF=y CONFIG_KALLSYMS=y -CONFIG_RELOCATABLE=y CONFIG_HUSH_FANCY_PROMPT=y CONFIG_AUTO_COMPLETE=y CONFIG_MENU=y @@ -130,7 +129,6 @@ CONFIG_RTC_CLASS=y CONFIG_RTC_DRV_DS1307=y CONFIG_GENERIC_PHY=y CONFIG_USB_NOP_XCEIV=y -CONFIG_PHY_FSL_IMX8MQ_USB=y CONFIG_FS_EXT4=y CONFIG_FS_TFTP=y CONFIG_FS_NFS=y diff --git a/arch/arm/configs/kindle-mx50_defconfig b/arch/arm/configs/kindle-mx50_defconfig index 552b2d6d33..95fafd56e6 100644 --- a/arch/arm/configs/kindle-mx50_defconfig +++ b/arch/arm/configs/kindle-mx50_defconfig @@ -9,7 +9,6 @@ CONFIG_MMU=y CONFIG_MALLOC_SIZE=0x0 CONFIG_MALLOC_TLSF=y CONFIG_KALLSYMS=y -CONFIG_RELOCATABLE=y CONFIG_HUSH_FANCY_PROMPT=y CONFIG_CMDLINE_EDITING=y CONFIG_AUTO_COMPLETE=y diff --git a/arch/arm/configs/layerscape_defconfig b/arch/arm/configs/layerscape_defconfig index b36f1944ec..394cd95c98 100644 --- a/arch/arm/configs/layerscape_defconfig +++ b/arch/arm/configs/layerscape_defconfig @@ -78,7 +78,6 @@ CONFIG_CMD_OFTREE=y CONFIG_CMD_TIME=y CONFIG_NET=y CONFIG_NET_NETCONSOLE=y -CONFIG_OFDEVICE=y CONFIG_OF_BAREBOX_DRIVERS=y CONFIG_DRIVER_SERIAL_NS16550=y CONFIG_DRIVER_NET_FSL_FMAN=y @@ -105,7 +104,6 @@ CONFIG_EEPROM_AT24=y CONFIG_WATCHDOG=y CONFIG_WATCHDOG_IMX=y CONFIG_GPIO_PCA953X=y -CONFIG_NVMEM=y CONFIG_REGULATOR=y CONFIG_REGULATOR_FIXED=y CONFIG_FS_EXT4=y diff --git a/arch/arm/configs/microchip_ksz9477_evb_defconfig b/arch/arm/configs/microchip_ksz9477_evb_defconfig index 4189b2c039..7130499490 100644 --- a/arch/arm/configs/microchip_ksz9477_evb_defconfig +++ b/arch/arm/configs/microchip_ksz9477_evb_defconfig @@ -1,4 +1,3 @@ -CONFIG_ARCH_SAMA5D3=y CONFIG_AT91_MULTI_BOARDS=y CONFIG_MACH_MICROCHIP_KSZ9477_EVB=y CONFIG_AEABI=y diff --git a/arch/arm/configs/socfpga-arria10_defconfig b/arch/arm/configs/socfpga-arria10_defconfig index e47a0ab183..a37bae6217 100644 --- a/arch/arm/configs/socfpga-arria10_defconfig +++ b/arch/arm/configs/socfpga-arria10_defconfig @@ -18,7 +18,6 @@ CONFIG_BOOTM_INITRD=y CONFIG_BOOTM_OFTREE=y CONFIG_DEFAULT_COMPRESSION_LZO=y CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y -CONFIG_POLLER=y CONFIG_STATE=y CONFIG_LONGHELP=y CONFIG_CMD_IOMEM=y diff --git a/arch/arm/configs/stm32mp_defconfig b/arch/arm/configs/stm32mp_defconfig index c98908debc..92bdf5b040 100644 --- a/arch/arm/configs/stm32mp_defconfig +++ b/arch/arm/configs/stm32mp_defconfig @@ -37,6 +37,7 @@ CONFIG_CMD_MEMINFO=y CONFIG_CMD_ARM_MMUINFO=y CONFIG_CMD_REGULATOR=y CONFIG_CMD_MMC=y +CONFIG_CMD_MMC_EXTCSD=y # CONFIG_CMD_BOOTU is not set CONFIG_CMD_GO=y CONFIG_CMD_RESET=y diff --git a/arch/arm/configs/virt2real_defconfig b/arch/arm/configs/virt2real_defconfig index 814fe69e42..62315b8cb3 100644 --- a/arch/arm/configs/virt2real_defconfig +++ b/arch/arm/configs/virt2real_defconfig @@ -36,7 +36,6 @@ CONFIG_CMD_LED=y CONFIG_CMD_OF_NODE=y CONFIG_CMD_OF_PROPERTY=y CONFIG_CMD_OFTREE=y -CONFIG_OFDEVICE=y CONFIG_OF_BAREBOX_DRIVERS=y CONFIG_DRIVER_SERIAL_NS16550=y # CONFIG_SPI is not set diff --git a/arch/arm/configs/zii_vf610_dev_defconfig b/arch/arm/configs/zii_vf610_dev_defconfig index 45c24d6df4..3ed5d37458 100644 --- a/arch/arm/configs/zii_vf610_dev_defconfig +++ b/arch/arm/configs/zii_vf610_dev_defconfig @@ -8,7 +8,6 @@ CONFIG_MMU=y CONFIG_MALLOC_SIZE=0x0 CONFIG_MALLOC_TLSF=y CONFIG_KALLSYMS=y -CONFIG_RELOCATABLE=y CONFIG_HUSH_FANCY_PROMPT=y CONFIG_AUTO_COMPLETE=y CONFIG_MENU=y diff --git a/arch/arm/cpu/smccc-call.S b/arch/arm/cpu/smccc-call.S index b6bdc8b3b5..9875e1f947 100644 --- a/arch/arm/cpu/smccc-call.S +++ b/arch/arm/cpu/smccc-call.S @@ -1,16 +1,6 @@ -/* - * Copyright (c) 2015, Linaro Limited - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* SPDX-FileCopyrightText: 2015 Linaro Limited */ + #include <linux/linkage.h> #include <asm/unwind.h> diff --git a/arch/arm/cpu/smccc-call_64.S b/arch/arm/cpu/smccc-call_64.S index 44888fb594..c2959050d2 100644 --- a/arch/arm/cpu/smccc-call_64.S +++ b/arch/arm/cpu/smccc-call_64.S @@ -1,16 +1,6 @@ -/* - * Copyright (c) 2015, Linaro Limited - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License Version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* SPDX-FileCopyrightText: 2015 Linaro Limited */ + #include <linux/linkage.h> #include <linux/arm-smccc.h> #include <asm/asm-offsets.h> diff --git a/arch/arm/dts/stm32mp151.dtsi b/arch/arm/dts/stm32mp151.dtsi index 5ff3b96fae..cc25400475 100644 --- a/arch/arm/dts/stm32mp151.dtsi +++ b/arch/arm/dts/stm32mp151.dtsi @@ -37,10 +37,6 @@ compatible = "simple-bus"; }; -&{/psci} { - compatible = "arm,psci-0.2"; -}; - &{/soc} { memory-controller@5a003000 { compatible = "st,stm32mp1-ddr"; diff --git a/arch/arm/dts/tegra20-colibri-iris.dts b/arch/arm/dts/tegra20-colibri-iris.dts index 9c615816ca..da5ef7a7e7 100644 --- a/arch/arm/dts/tegra20-colibri-iris.dts +++ b/arch/arm/dts/tegra20-colibri-iris.dts @@ -75,26 +75,22 @@ vqmmc-supply = <&vcc_sd_reg>; }; - regulators { - regulator@0 { - compatible = "regulator-fixed"; - reg = <0>; - regulator-name = "usb_host_vbus"; - regulator-min-microvolt = <5000000>; - regulator-max-microvolt = <5000000>; - regulator-boot-on; - regulator-always-on; - gpio = <&gpio TEGRA_GPIO(W, 2) GPIO_ACTIVE_HIGH>; - }; + regulator_usb_host_vbus { + compatible = "regulator-fixed"; + regulator-name = "usb_host_vbus"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + regulator-always-on; + gpio = <&gpio TEGRA_GPIO(W, 2) GPIO_ACTIVE_HIGH>; + }; - vcc_sd_reg: regulator@1 { - compatible = "regulator-fixed"; - reg = <1>; - regulator-name = "vcc_sd"; - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3300000>; - regulator-boot-on; - regulator-always-on; - }; + vcc_sd_reg: regulator_vcc_sd { + compatible = "regulator-fixed"; + regulator-name = "vcc_sd"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-boot-on; + regulator-always-on; }; }; diff --git a/arch/arm/dts/tps65217.dtsi b/arch/arm/dts/tps65217.dtsi deleted file mode 100644 index a63272422d..0000000000 --- a/arch/arm/dts/tps65217.dtsi +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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 version 2 as - * published by the Free Software Foundation. - */ - -/* - * Integrated Power Management Chip - * http://www.ti.com/lit/ds/symlink/tps65217.pdf - */ - -&tps { - compatible = "ti,tps65217"; - - regulators { - #address-cells = <1>; - #size-cells = <0>; - - dcdc1_reg: regulator@0 { - reg = <0>; - regulator-compatible = "dcdc1"; - }; - - dcdc2_reg: regulator@1 { - reg = <1>; - regulator-compatible = "dcdc2"; - }; - - dcdc3_reg: regulator@2 { - reg = <2>; - regulator-compatible = "dcdc3"; - }; - - ldo1_reg: regulator@3 { - reg = <3>; - regulator-compatible = "ldo1"; - }; - - ldo2_reg: regulator@4 { - reg = <4>; - regulator-compatible = "ldo2"; - }; - - ldo3_reg: regulator@5 { - reg = <5>; - regulator-compatible = "ldo3"; - }; - - ldo4_reg: regulator@6 { - reg = <6>; - regulator-compatible = "ldo4"; - }; - }; -}; diff --git a/arch/arm/lib32/bootm.c b/arch/arm/lib32/bootm.c index 971ebee8ac..c33ecc2ad8 100644 --- a/arch/arm/lib32/bootm.c +++ b/arch/arm/lib32/bootm.c @@ -20,7 +20,7 @@ #include <restart.h> #include <globalvar.h> #include <tee/optee.h> - +#include <image-fit.h> #include <asm/byteorder.h> #include <asm/setup.h> #include <asm/barebox-arm.h> @@ -166,6 +166,34 @@ static int optee_verify_header_request_region(struct image_data *data, struct op return ret; } +static int bootm_load_tee_from_fit(struct image_data *data) +{ + int ret = 0; + struct optee_header hdr; + + if (data->os_fit && + fit_has_image(data->os_fit, data->fit_config, "tee")) { + const void *tee; + unsigned long tee_size; + + ret = fit_open_image(data->os_fit, data->fit_config, "tee", + &tee, &tee_size); + if (ret) { + pr_err("Error opening tee fit image: %s\n", strerror(-ret)); + return ret; + } + memcpy(&hdr, tee, sizeof(hdr)); + if (optee_verify_header_request_region(data, &hdr) < 0) { + pr_err("%s", strerror(errno)); + ret = -errno; + goto out; + } + memcpy((void *)data->tee_res->start, tee + sizeof(hdr), hdr.init_size); + printf("Read optee image to %pa, size 0x%08x\n", (void *)data->tee_res->start, hdr.init_size); + } +out: + return ret; +} static int bootm_load_tee_from_file(struct image_data *data) { int fd, ret; @@ -262,10 +290,16 @@ static int __do_bootm_linux(struct image_data *data, unsigned long free_mem, return ret; } - if (IS_ENABLED(CONFIG_BOOTM_OPTEE) && data->tee_file) { - ret = bootm_load_tee_from_file(data); - if (ret) - return ret; + if (IS_ENABLED(CONFIG_BOOTM_OPTEE)) { + if (data->tee_file && !IS_ENABLED(CONFIG_BOOTM_FORCE_SIGNED_IMAGES)) { + ret = bootm_load_tee_from_file(data); + if (ret) + return ret; + } else if (IS_ENABLED(CONFIG_FITIMAGE)) { + ret = bootm_load_tee_from_fit(data); + if (ret) + return ret; + } } diff --git a/arch/arm/mach-at91/at91rm9200_time.c b/arch/arm/mach-at91/at91rm9200_time.c index 975cd956c9..f89983fe63 100644 --- a/arch/arm/mach-at91/at91rm9200_time.c +++ b/arch/arm/mach-at91/at91rm9200_time.c @@ -88,7 +88,7 @@ static void __noreturn at91rm9200_restart_soc(struct restart_handler *rst) static int restart_register_feature(void) { - restart_handler_register_fn(at91rm9200_restart_soc); + restart_handler_register_fn("soc-wdt", at91rm9200_restart_soc); return 0; } diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c index 56327a2c47..fdd8ea014e 100644 --- a/arch/arm/mach-at91/at91sam9260.c +++ b/arch/arm/mach-at91/at91sam9260.c @@ -243,7 +243,7 @@ static void at91sam9260_initialize(void) at91_add_pit(AT91SAM9260_BASE_PIT); at91_add_sam9_smc(DEVICE_ID_SINGLE, AT91SAM9260_BASE_SMC, 0x200); - restart_handler_register_fn(at91sam9260_restart); + restart_handler_register_fn("soc", at91sam9260_restart); } static int at91sam9260_setup(void) diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c index 4abc556354..0465ed9524 100644 --- a/arch/arm/mach-at91/at91sam9261.c +++ b/arch/arm/mach-at91/at91sam9261.c @@ -235,7 +235,7 @@ static void at91sam9261_initialize(void) at91_add_pit(AT91SAM9261_BASE_PIT); at91_add_sam9_smc(DEVICE_ID_SINGLE, AT91SAM9261_BASE_SMC, 0x200); - restart_handler_register_fn(at91sam9261_restart); + restart_handler_register_fn("soc", at91sam9261_restart); } static int at91sam9261_setup(void) diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c index 690f8e06bb..dc5dddfb64 100644 --- a/arch/arm/mach-at91/at91sam9263.c +++ b/arch/arm/mach-at91/at91sam9263.c @@ -256,7 +256,7 @@ static void at91sam9263_initialize(void) at91_add_sam9_smc(0, AT91SAM9263_BASE_SMC0, 0x200); at91_add_sam9_smc(1, AT91SAM9263_BASE_SMC1, 0x200); - restart_handler_register_fn(at91sam9263_restart); + restart_handler_register_fn("soc", at91sam9263_restart); } static int at91sam9263_setup(void) diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c index 569aa274fc..affc624b1d 100644 --- a/arch/arm/mach-at91/at91sam9g45.c +++ b/arch/arm/mach-at91/at91sam9g45.c @@ -270,7 +270,7 @@ static void at91sam9g45_initialize(void) at91_add_pit(AT91SAM9G45_BASE_PIT); at91_add_sam9_smc(DEVICE_ID_SINGLE, AT91SAM9G45_BASE_SMC, 0x200); - restart_handler_register_fn(at91sam9g45_restart); + restart_handler_register_fn("soc", at91sam9g45_restart); } static int at91sam9g45_setup(void) diff --git a/arch/arm/mach-at91/at91sam9n12.c b/arch/arm/mach-at91/at91sam9n12.c index 365bded56e..850d34604a 100644 --- a/arch/arm/mach-at91/at91sam9n12.c +++ b/arch/arm/mach-at91/at91sam9n12.c @@ -226,7 +226,7 @@ static void at91sam9n12_initialize(void) at91_add_pit(AT91SAM9N12_BASE_PIT); at91_add_sam9_smc(DEVICE_ID_SINGLE, AT91SAM9N12_BASE_SMC, 0x200); - restart_handler_register_fn(at91sam9n12_restart); + restart_handler_register_fn("soc", at91sam9n12_restart); } static int at91sam9n12_setup(void) diff --git a/arch/arm/mach-at91/at91sam9x5.c b/arch/arm/mach-at91/at91sam9x5.c index 40ba9ed56e..086e27a79f 100644 --- a/arch/arm/mach-at91/at91sam9x5.c +++ b/arch/arm/mach-at91/at91sam9x5.c @@ -13,7 +13,7 @@ static void at91sam9x5_restart(struct restart_handler *rst) static int at91sam9x5_initialize(void) { - restart_handler_register_fn(at91sam9x5_restart); + restart_handler_register_fn("soc", at91sam9x5_restart); return 0; } diff --git a/arch/arm/mach-at91/sama5d3.c b/arch/arm/mach-at91/sama5d3.c index a5d464eca0..b1e7b2c565 100644 --- a/arch/arm/mach-at91/sama5d3.c +++ b/arch/arm/mach-at91/sama5d3.c @@ -397,7 +397,7 @@ static void sama5d3_initialize(void) at91_add_pit(SAMA5D3_BASE_PIT); at91_add_sam9_smc(DEVICE_ID_SINGLE, SAMA5D3_BASE_HSMC + 0x600, 0xa0); - restart_handler_register_fn(sama5d3_restart); + restart_handler_register_fn("soc", sama5d3_restart); } static int sama5d3_setup(void) diff --git a/arch/arm/mach-at91/sama5d4.c b/arch/arm/mach-at91/sama5d4.c index ca09dfe425..62e466fe51 100644 --- a/arch/arm/mach-at91/sama5d4.c +++ b/arch/arm/mach-at91/sama5d4.c @@ -305,7 +305,7 @@ static void sama5d4_initialize(void) at91_add_pit(SAMA5D4_BASE_PIT); at91_add_sam9_smc(DEVICE_ID_SINGLE, SAMA5D4_BASE_HSMC + 0x600, 0xa0); - restart_handler_register_fn(sama5d4_restart); + restart_handler_register_fn("soc", sama5d4_restart); } static int sama5d4_setup(void) diff --git a/arch/arm/mach-clps711x/reset.c b/arch/arm/mach-clps711x/reset.c index 03f40b73fa..90ddb8f5d2 100644 --- a/arch/arm/mach-clps711x/reset.c +++ b/arch/arm/mach-clps711x/reset.c @@ -22,7 +22,7 @@ static void __noreturn clps711x_restart_soc(struct restart_handler *rst) static int restart_register_feature(void) { - restart_handler_register_fn(clps711x_restart_soc); + restart_handler_register_fn("vector", clps711x_restart_soc); return 0; } diff --git a/arch/arm/mach-davinci/time.c b/arch/arm/mach-davinci/time.c index 4d1b570aa0..5b57fe6192 100644 --- a/arch/arm/mach-davinci/time.c +++ b/arch/arm/mach-davinci/time.c @@ -210,7 +210,7 @@ static void __noreturn davinci_restart_soc(struct restart_handler *rst) static int restart_register_feature(void) { - restart_handler_register_fn(davinci_restart_soc); + restart_handler_register_fn("soc-wdt", davinci_restart_soc); return 0; } diff --git a/arch/arm/mach-ep93xx/clocksource.c b/arch/arm/mach-ep93xx/clocksource.c index 4fdcc36b1c..1f3ff7f8f2 100644 --- a/arch/arm/mach-ep93xx/clocksource.c +++ b/arch/arm/mach-ep93xx/clocksource.c @@ -85,7 +85,7 @@ static void __noreturn ep92xx_restart_soc(struct restart_handler *rst) static int restart_register_feature(void) { - restart_handler_register_fn(ep92xx_restart_soc); + restart_handler_register_fn("soc", ep92xx_restart_soc); return 0; } diff --git a/arch/arm/mach-ep93xx/header.c b/arch/arm/mach-ep93xx/header.c index 4e6a2e57c8..a9dde2d8b0 100644 --- a/arch/arm/mach-ep93xx/header.c +++ b/arch/arm/mach-ep93xx/header.c @@ -2,6 +2,8 @@ #include <linux/compiler.h> #include <asm/barebox-arm-head.h> +void go(void); + void __naked __section(.flash_header_start) go(void) { barebox_arm_head(); diff --git a/arch/arm/mach-highbank/reset.c b/arch/arm/mach-highbank/reset.c index d73a0a76a5..ea3908ec2b 100644 --- a/arch/arm/mach-highbank/reset.c +++ b/arch/arm/mach-highbank/reset.c @@ -33,7 +33,7 @@ static void __noreturn highbank_poweroff(struct poweroff_handler *handler) static int highbank_init(void) { - restart_handler_register_fn(highbank_restart_soc); + restart_handler_register_fn("soc", highbank_restart_soc); poweroff_handler_register_fn(highbank_poweroff); return 0; diff --git a/arch/arm/mach-mvebu/armada-370-xp.c b/arch/arm/mach-mvebu/armada-370-xp.c index 2589f4fe72..9a35c51985 100644 --- a/arch/arm/mach-mvebu/armada-370-xp.c +++ b/arch/arm/mach-mvebu/armada-370-xp.c @@ -132,7 +132,7 @@ static int armada_370_xp_init_soc(void) if (!of_machine_is_compatible("marvell,armada-370-xp")) return 0; - restart_handler_register_fn(armada_370_xp_restart_soc); + restart_handler_register_fn("soc", armada_370_xp_restart_soc); barebox_set_model("Marvell Armada 370/XP"); barebox_set_hostname("armada"); diff --git a/arch/arm/mach-mvebu/dove.c b/arch/arm/mach-mvebu/dove.c index 37fde63f18..3c6302dd2d 100644 --- a/arch/arm/mach-mvebu/dove.c +++ b/arch/arm/mach-mvebu/dove.c @@ -36,7 +36,7 @@ static int dove_init_soc(void) if (!of_machine_is_compatible("marvell,dove")) return 0; - restart_handler_register_fn(dove_restart_soc); + restart_handler_register_fn("soc", dove_restart_soc); barebox_set_model("Marvell Dove"); barebox_set_hostname("dove"); diff --git a/arch/arm/mach-mvebu/kirkwood.c b/arch/arm/mach-mvebu/kirkwood.c index 59fb95ff4a..e50d7501c8 100644 --- a/arch/arm/mach-mvebu/kirkwood.c +++ b/arch/arm/mach-mvebu/kirkwood.c @@ -34,7 +34,7 @@ static int kirkwood_init_soc(void) if (!of_machine_is_compatible("marvell,kirkwood")) return 0; - restart_handler_register_fn(kirkwood_restart_soc); + restart_handler_register_fn("soc", kirkwood_restart_soc); barebox_set_model("Marvell Kirkwood"); barebox_set_hostname("kirkwood"); diff --git a/arch/arm/mach-mxs/soc-imx23.c b/arch/arm/mach-mxs/soc-imx23.c index f25fff18c3..8c47c766cc 100644 --- a/arch/arm/mach-mxs/soc-imx23.c +++ b/arch/arm/mach-mxs/soc-imx23.c @@ -49,7 +49,7 @@ static int imx23_devices_init(void) add_generic_device("imx23-gpio", 0, NULL, IMX_IOMUXC_BASE, 0x2000, IORESOURCE_MEM, NULL); add_generic_device("imx23-gpio", 1, NULL, IMX_IOMUXC_BASE, 0x2000, IORESOURCE_MEM, NULL); add_generic_device("imx23-gpio", 2, NULL, IMX_IOMUXC_BASE, 0x2000, IORESOURCE_MEM, NULL); - restart_handler_register_fn(imx23_restart_soc); + restart_handler_register_fn("soc", imx23_restart_soc); return 0; } diff --git a/arch/arm/mach-mxs/soc-imx28.c b/arch/arm/mach-mxs/soc-imx28.c index 49f870b5bf..a214e2b7a6 100644 --- a/arch/arm/mach-mxs/soc-imx28.c +++ b/arch/arm/mach-mxs/soc-imx28.c @@ -51,7 +51,7 @@ static int imx28_init(void) HW_CLKCTRL_WDOG_POR_DISABLE; writel(reg, IMX_CCM_BASE + HW_CLKCTRL_RESET); - restart_handler_register_fn(imx28_restart_soc); + restart_handler_register_fn("soc", imx28_restart_soc); arm_add_mem_device("ram0", IMX_MEMORY_BASE, imx28_get_memsize()); diff --git a/arch/arm/mach-nomadik/reset.c b/arch/arm/mach-nomadik/reset.c index 8bdaada8a1..d5266068e2 100644 --- a/arch/arm/mach-nomadik/reset.c +++ b/arch/arm/mach-nomadik/reset.c @@ -35,7 +35,7 @@ static void __noreturn nomadik_restart_soc(struct restart_handler *rst) static int restart_register_feature(void) { - restart_handler_register_fn(nomadik_restart_soc); + restart_handler_register_fn("soc", nomadik_restart_soc); return 0; } diff --git a/arch/arm/mach-omap/am33xx_generic.c b/arch/arm/mach-omap/am33xx_generic.c index 7577df761c..3c5cdf065c 100644 --- a/arch/arm/mach-omap/am33xx_generic.c +++ b/arch/arm/mach-omap/am33xx_generic.c @@ -244,7 +244,7 @@ int am33xx_init(void) { omap_gpmc_base = (void *)AM33XX_GPMC_BASE; - restart_handler_register_fn(am33xx_restart_soc); + restart_handler_register_fn("soc", am33xx_restart_soc); am33xx_enable_per_clocks(); diff --git a/arch/arm/mach-omap/omap3_generic.c b/arch/arm/mach-omap/omap3_generic.c index cff4a4fb11..3f6a346277 100644 --- a/arch/arm/mach-omap/omap3_generic.c +++ b/arch/arm/mach-omap/omap3_generic.c @@ -540,7 +540,7 @@ int omap3_init(void) { omap_gpmc_base = (void *)OMAP3_GPMC_BASE; - restart_handler_register_fn(omap3_restart_soc); + restart_handler_register_fn("soc", omap3_restart_soc); if (IS_ENABLED(CONFIG_RESET_SOURCE)) omap3_detect_reset_reason(); diff --git a/arch/arm/mach-omap/omap4_generic.c b/arch/arm/mach-omap/omap4_generic.c index 1f71153848..848a664064 100644 --- a/arch/arm/mach-omap/omap4_generic.c +++ b/arch/arm/mach-omap/omap4_generic.c @@ -535,7 +535,7 @@ int omap4_init(void) { omap_gpmc_base = (void *)OMAP44XX_GPMC_BASE; - restart_handler_register_fn(omap4_restart_soc); + restart_handler_register_fn("soc", omap4_restart_soc); return omap4_bootsource(); } diff --git a/arch/arm/mach-pxa/common.c b/arch/arm/mach-pxa/common.c index 106ca3020e..5b980cb81b 100644 --- a/arch/arm/mach-pxa/common.c +++ b/arch/arm/mach-pxa/common.c @@ -41,7 +41,7 @@ static void __noreturn pxa_restart_soc(struct restart_handler *rst) static int restart_register_feature(void) { - restart_handler_register_fn(pxa_restart_soc); + restart_handler_register_fn("soc-wdt", pxa_restart_soc); return 0; } diff --git a/arch/arm/mach-rockchip/rk3188.c b/arch/arm/mach-rockchip/rk3188.c index e7cbf36457..572e9dc58f 100644 --- a/arch/arm/mach-rockchip/rk3188.c +++ b/arch/arm/mach-rockchip/rk3188.c @@ -29,7 +29,7 @@ static void __noreturn rockchip_restart_soc(struct restart_handler *rst) static int restart_register_feature(void) { - restart_handler_register_fn(rockchip_restart_soc); + restart_handler_register_fn("soc", rockchip_restart_soc); return 0; } diff --git a/arch/arm/mach-rockchip/rk3288.c b/arch/arm/mach-rockchip/rk3288.c index 4e8fb4a123..9076fd9227 100644 --- a/arch/arm/mach-rockchip/rk3288.c +++ b/arch/arm/mach-rockchip/rk3288.c @@ -60,7 +60,7 @@ static void rk3288_detect_reset_reason(void) static int rk3288_init(void) { - restart_handler_register_fn(rockchip_restart_soc); + restart_handler_register_fn("soc", rockchip_restart_soc); if (IS_ENABLED(CONFIG_RESET_SOURCE)) rk3288_detect_reset_reason(); diff --git a/arch/arm/mach-samsung/generic.c b/arch/arm/mach-samsung/generic.c index de38d47e21..ed3d30d995 100644 --- a/arch/arm/mach-samsung/generic.c +++ b/arch/arm/mach-samsung/generic.c @@ -44,7 +44,7 @@ static void __noreturn samsung_restart_soc(struct restart_handler *rst) static int restart_register_feature(void) { - restart_handler_register_fn(samsung_restart_soc); + restart_handler_register_fn("soc-wdt", samsung_restart_soc); return 0; } diff --git a/arch/arm/mach-socfpga/arria10-generic.c b/arch/arm/mach-socfpga/arria10-generic.c index 53ec278739..38558309f8 100644 --- a/arch/arm/mach-socfpga/arria10-generic.c +++ b/arch/arm/mach-socfpga/arria10-generic.c @@ -70,7 +70,7 @@ static int arria10_generic_init(void) arria10_init_emac(); pr_debug("Register restart handler\n"); - restart_handler_register_fn(arria10_restart_soc); + restart_handler_register_fn("soc", arria10_restart_soc); return 0; } diff --git a/arch/arm/mach-socfpga/cyclone5-reset-manager.c b/arch/arm/mach-socfpga/cyclone5-reset-manager.c index 8635806846..4ee90b1bb0 100644 --- a/arch/arm/mach-socfpga/cyclone5-reset-manager.c +++ b/arch/arm/mach-socfpga/cyclone5-reset-manager.c @@ -37,7 +37,7 @@ static void __noreturn socfpga_restart_soc(struct restart_handler *rst) static int restart_register_feature(void) { - restart_handler_register_fn(socfpga_restart_soc); + restart_handler_register_fn("soc", socfpga_restart_soc); return 0; } diff --git a/arch/arm/mach-tegra/tegra20-pmc.c b/arch/arm/mach-tegra/tegra20-pmc.c index f7c7ac918f..a252c995ea 100644 --- a/arch/arm/mach-tegra/tegra20-pmc.c +++ b/arch/arm/mach-tegra/tegra20-pmc.c @@ -246,7 +246,7 @@ static struct driver_d tegra20_pmc_driver = { static int tegra20_pmc_init(void) { - restart_handler_register_fn(tegra20_restart_soc); + restart_handler_register_fn("soc", tegra20_restart_soc); return platform_driver_register(&tegra20_pmc_driver); } coredevice_initcall(tegra20_pmc_init); diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c index 7c6e9523a2..eb94a07dc9 100644 --- a/arch/arm/mach-versatile/core.c +++ b/arch/arm/mach-versatile/core.c @@ -75,19 +75,6 @@ void clk_disable(struct clk *clk) } EXPORT_SYMBOL(clk_disable); -/* Create a clock structure with the given name */ -int vpb_clk_create(struct clk *clk, const char *dev_id) -{ - struct clk_lookup *clkdev; - - clkdev = clkdev_alloc(clk, NULL, dev_id); - if (!clkdev) - return -ENOMEM; - - clkdev_add(clkdev); - return 0; -} - /* 1Mhz / 256 */ #define TIMER_FREQ (1000000/256) @@ -205,7 +192,7 @@ static int versatile_init(void) amba_apb_device_add(NULL, "pl061_gpio", 1, 0x101e5000, 4096, NULL, 0); amba_apb_device_add(NULL, "pl061_gpio", 2, 0x101e6000, 4096, NULL, 0); amba_apb_device_add(NULL, "pl061_gpio", 3, 0x101e7000, 4096, NULL, 0); - restart_handler_register_fn(versatile_reset_soc); + restart_handler_register_fn("soc", versatile_reset_soc); return 0; } coredevice_initcall(versatile_init); diff --git a/arch/arm/mach-vexpress/reset.c b/arch/arm/mach-vexpress/reset.c index 3164ae3079..78e452936d 100644 --- a/arch/arm/mach-vexpress/reset.c +++ b/arch/arm/mach-vexpress/reset.c @@ -24,7 +24,7 @@ static void vexpress_reset_soc(struct restart_handler *rst) static int restart_register_feature(void) { - restart_handler_register_fn(vexpress_reset_soc); + restart_handler_register_fn("soc-wdt", vexpress_reset_soc); return 0; } diff --git a/arch/arm/mach-zynq/zynq.c b/arch/arm/mach-zynq/zynq.c index 79a6b908e0..806aeb9130 100644 --- a/arch/arm/mach-zynq/zynq.c +++ b/arch/arm/mach-zynq/zynq.c @@ -69,7 +69,7 @@ static int zynq_init(void) writel(val, 0xf8f00000); dmb(); - restart_handler_register_fn(zynq_restart_soc); + restart_handler_register_fn("soc", zynq_restart_soc); bootsource_set(zynq_bootsource_get()); diff --git a/arch/kvx/configs/generic_defconfig b/arch/kvx/configs/generic_defconfig index 8162171741..0d971ff3d5 100644 --- a/arch/kvx/configs/generic_defconfig +++ b/arch/kvx/configs/generic_defconfig @@ -1,15 +1,13 @@ CONFIG_AUTO_COMPLETE=y -CONFIG_BAUDRATE=115200 -CONFIG_CLOCKSOURCE_KVX=y +CONFIG_CONSOLE_RATP=y CONFIG_CMD_BOOT=y -CONFIG_CMD_BOOTM=y +CONFIG_CMD_RESET=y CONFIG_CMD_CMP=y -CONFIG_CMD_OF_DUMP=y CONFIG_CMD_POWEROFF=y -CONFIG_CMD_RESET=y CONFIG_CMD_WD=y -CONFIG_CONSOLE_RATP=y +CONFIG_CMD_OF_DUMP=y CONFIG_DRIVER_SERIAL_NS16550=y -CONFIG_PINCTRL_SINGLE=y +CONFIG_CLOCKSOURCE_KVX=y CONFIG_WATCHDOG=y CONFIG_WATCHDOG_KVX=y +CONFIG_PINCTRL_SINGLE=y diff --git a/arch/kvx/cpu/reset.c b/arch/kvx/cpu/reset.c index c7f2018e00..df36764cb6 100644 --- a/arch/kvx/cpu/reset.c +++ b/arch/kvx/cpu/reset.c @@ -60,7 +60,7 @@ static int kvx_reset_init(void) break; } - restart_handler_register_fn(kvx_restart_soc); + restart_handler_register_fn("soc", kvx_restart_soc); return 0; } diff --git a/arch/mips/configs/bcm47xx_defconfig b/arch/mips/configs/bcm47xx_defconfig index 0cd0e9e650..9cf172a70e 100644 --- a/arch/mips/configs/bcm47xx_defconfig +++ b/arch/mips/configs/bcm47xx_defconfig @@ -9,7 +9,6 @@ CONFIG_MENU=y CONFIG_BOOTM_SHOW_TYPE=y CONFIG_PARTITION=y # CONFIG_DEFAULT_ENVIRONMENT is not set -CONFIG_POLLER=y CONFIG_LONGHELP=y CONFIG_CMD_IOMEM=y CONFIG_CMD_MEMINFO=y diff --git a/arch/mips/configs/qemu-malta_defconfig b/arch/mips/configs/qemu-malta_defconfig index 2465c0260d..ac0577c217 100644 --- a/arch/mips/configs/qemu-malta_defconfig +++ b/arch/mips/configs/qemu-malta_defconfig @@ -12,7 +12,6 @@ CONFIG_BOOTM_SHOW_TYPE=y CONFIG_CONSOLE_ALLOW_COLOR=y CONFIG_PARTITION=y CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y -CONFIG_POLLER=y CONFIG_CMD_DMESG=y CONFIG_LONGHELP=y CONFIG_CMD_IOMEM=y diff --git a/arch/mips/mach-ar231x/ar231x_reset.c b/arch/mips/mach-ar231x/ar231x_reset.c index f88167ba4c..91414edd26 100644 --- a/arch/mips/mach-ar231x/ar231x_reset.c +++ b/arch/mips/mach-ar231x/ar231x_reset.c @@ -68,7 +68,7 @@ static struct driver_d ar231x_reset_driver = { static int ar231x_reset_init(void) { - restart_handler_register_fn(ar2312x_restart_soc); + restart_handler_register_fn("soc-wdt", ar2312x_restart_soc); return platform_driver_register(&ar231x_reset_driver); } coredevice_initcall(ar231x_reset_init); diff --git a/arch/mips/mach-ath79/reset.c b/arch/mips/mach-ath79/reset.c index b756c859d8..393ca00b08 100644 --- a/arch/mips/mach-ath79/reset.c +++ b/arch/mips/mach-ath79/reset.c @@ -22,7 +22,7 @@ static void __noreturn ath79_restart_soc(struct restart_handler *rst) static int restart_register_feature(void) { - restart_handler_register_fn(ath79_restart_soc); + restart_handler_register_fn("soc", ath79_restart_soc); return 0; } diff --git a/arch/mips/mach-bcm47xx/reset.c b/arch/mips/mach-bcm47xx/reset.c index 33dfb7b3b5..3ab9b0ce4b 100644 --- a/arch/mips/mach-bcm47xx/reset.c +++ b/arch/mips/mach-bcm47xx/reset.c @@ -19,7 +19,7 @@ static void __noreturn bcm47xx_restart_soc(struct restart_handler *rst) static int restart_register_feature(void) { - restart_handler_register_fn(bcm47xx_restart_soc); + restart_handler_register_fn("soc", bcm47xx_restart_soc); return 0; } diff --git a/arch/mips/mach-loongson/loongson1_reset.c b/arch/mips/mach-loongson/loongson1_reset.c index a6c05905de..85752f4ab8 100644 --- a/arch/mips/mach-loongson/loongson1_reset.c +++ b/arch/mips/mach-loongson/loongson1_reset.c @@ -20,7 +20,7 @@ static void __noreturn longhorn_restart_soc(struct restart_handler *rst) static int restart_register_feature(void) { - restart_handler_register_fn(longhorn_restart_soc); + restart_handler_register_fn("soc-wdt", longhorn_restart_soc); return 0; } diff --git a/arch/mips/mach-malta/reset.c b/arch/mips/mach-malta/reset.c index df7be0ae55..ad0de2741b 100644 --- a/arch/mips/mach-malta/reset.c +++ b/arch/mips/mach-malta/reset.c @@ -24,7 +24,7 @@ static void __noreturn malta_restart_soc(struct restart_handler *rst) static int restart_register_feature(void) { - restart_handler_register_fn(malta_restart_soc); + restart_handler_register_fn("soc", malta_restart_soc); return 0; } diff --git a/arch/nios2/cpu/cpu.c b/arch/nios2/cpu/cpu.c index 62bcf40f63..9f86c911cc 100644 --- a/arch/nios2/cpu/cpu.c +++ b/arch/nios2/cpu/cpu.c @@ -30,7 +30,7 @@ static void __noreturn nios2_restart_soc(struct restart_handler *rst) static int restart_register_feature(void) { - return restart_handler_register_fn(nios2_restart_soc); + return restart_handler_register_fn("vector", nios2_restart_soc); } coredevice_initcall(restart_register_feature); diff --git a/arch/openrisc/cpu/cache.c b/arch/openrisc/cpu/cache.c index 1da2380c03..a124d6612c 100644 --- a/arch/openrisc/cpu/cache.c +++ b/arch/openrisc/cpu/cache.c @@ -17,6 +17,7 @@ #include <common.h> #include <init.h> #include <asm/system.h> +#include <asm/cache.h> void flush_dcache_range(unsigned long addr, unsigned long stop) { @@ -130,7 +131,7 @@ void icache_disable(void) mtspr(SPR_SR, mfspr(SPR_SR) & ~SPR_SR_ICE); } -int cache_init(void) +static int cache_init(void) { if (mfspr(SPR_UPR) & SPR_UPR_ICP) { icache_disable(); diff --git a/arch/openrisc/cpu/cpu.c b/arch/openrisc/cpu/cpu.c index 8afd22bdea..47d8ab4288 100644 --- a/arch/openrisc/cpu/cpu.c +++ b/arch/openrisc/cpu/cpu.c @@ -33,6 +33,6 @@ static void __noreturn openrisc_restart_cpu(struct restart_handler *rst) static int restart_register_feature(void) { - return restart_handler_register_fn(openrisc_restart_cpu); + return restart_handler_register_fn("vector", openrisc_restart_cpu); } coredevice_initcall(restart_register_feature); diff --git a/arch/openrisc/cpu/exceptions.c b/arch/openrisc/cpu/exceptions.c index d01fbfbb1c..c69ceafe80 100644 --- a/arch/openrisc/cpu/exceptions.c +++ b/arch/openrisc/cpu/exceptions.c @@ -16,6 +16,7 @@ #include <common.h> #include <asm/system.h> +#include <asm/openrisc_exc.h> static const char * const excp_table[] = { "Unknown exception", @@ -69,6 +70,9 @@ static void exception_hang(int vect) hang(); } +/* Called from assembly */ +void exception_handler(int vect); + void exception_handler(int vect) { int exception = vect >> 8; diff --git a/arch/openrisc/lib/board.c b/arch/openrisc/lib/board.c index 67ea96fc02..9591120fee 100644 --- a/arch/openrisc/lib/board.c +++ b/arch/openrisc/lib/board.c @@ -19,6 +19,9 @@ #include <memory.h> #include <asm-generic/memory_layout.h> +/* Called from assembly */ +void openrisc_start_barebox(void); + void __noreturn openrisc_start_barebox(void) { mem_malloc_init((void *)(OPENRISC_SOPC_TEXT_BASE - MALLOC_SIZE), diff --git a/arch/openrisc/lib/cpuinfo.c b/arch/openrisc/lib/cpuinfo.c index 4c52a65421..d94178ea59 100644 --- a/arch/openrisc/lib/cpuinfo.c +++ b/arch/openrisc/lib/cpuinfo.c @@ -95,7 +95,7 @@ static void cpu_implementation(ulong vr2, char *string) } } -int checkcpu(void) +static int checkcpu(void) { ulong upr = mfspr(SPR_UPR); ulong vr = mfspr(SPR_VR); diff --git a/arch/powerpc/mach-mpc5xxx/cpu.c b/arch/powerpc/mach-mpc5xxx/cpu.c index a85e1667bc..5cf5194aa2 100644 --- a/arch/powerpc/mach-mpc5xxx/cpu.c +++ b/arch/powerpc/mach-mpc5xxx/cpu.c @@ -92,7 +92,7 @@ static void __noreturn mpc5xxx_restart_soc(struct restart_handler *rst) static int restart_register_feature(void) { - return restart_handler_register_fn(mpc5xxx_restart_soc); + return restart_handler_register_fn("soc-wdt", mpc5xxx_restart_soc); } coredevice_initcall(restart_register_feature); diff --git a/arch/powerpc/mach-mpc85xx/cpu.c b/arch/powerpc/mach-mpc85xx/cpu.c index 7c8a59edc9..efdff24e6d 100644 --- a/arch/powerpc/mach-mpc85xx/cpu.c +++ b/arch/powerpc/mach-mpc85xx/cpu.c @@ -42,7 +42,7 @@ static void __noreturn mpc85xx_restart_soc(struct restart_handler *rst) static int restart_register_feature(void) { - restart_handler_register_fn(mpc85xx_restart_soc); + restart_handler_register_fn("soc", mpc85xx_restart_soc); return 0; } diff --git a/arch/sandbox/Kconfig b/arch/sandbox/Kconfig index 81f7a96bd6..bced81f25e 100644 --- a/arch/sandbox/Kconfig +++ b/arch/sandbox/Kconfig @@ -7,6 +7,9 @@ config SANDBOX select ARCH_HAS_UBSAN_SANITIZE_ALL select HAVE_ARCH_ASAN select HAS_DMA + select BLOCK + select BLOCK_WRITE + select PARTITION_DISK default y config ARCH_TEXT_BASE @@ -24,6 +27,13 @@ config SANDBOX_UNWIND select ARCH_HAS_STACK_DUMP depends on UBSAN || ASAN +config SANDBOX_REEXEC + prompt "exec(2) reset handler" + def_bool y + help + The normal reset handler hangs barebox. On Linux, barebox + instead can exec itself to simulate a reset. + config PHYS_ADDR_T_64BIT bool diff --git a/arch/sandbox/Makefile b/arch/sandbox/Makefile index ce1fe3b672..09112c3ba8 100644 --- a/arch/sandbox/Makefile +++ b/arch/sandbox/Makefile @@ -25,7 +25,7 @@ KBUILD_CFLAGS += -Dmalloc=barebox_malloc -Dcalloc=barebox_calloc \ -Dglob=barebox_glob -Dglobfree=barebox_globfree \ -Dioctl=barebox_ioctl -Dfstat=barebox_fstat \ -Dopendir=barebox_opendir -Dreaddir=barebox_readdir \ - -Dclosedir=barebox_closedir \ + -Dclosedir=barebox_closedir -Dreadlink=barebox_readlink \ -Doptarg=barebox_optarg -Doptind=barebox_optind machdirs := $(patsubst %,arch/sandbox/mach-%/,$(machine-y)) diff --git a/arch/sandbox/board/dtb.c b/arch/sandbox/board/dtb.c index 74ecbadf42..d11bde0249 100644 --- a/arch/sandbox/board/dtb.c +++ b/arch/sandbox/board/dtb.c @@ -46,7 +46,7 @@ static int of_sandbox_init(void) if (ret) return ret; - ret = of_property_write_u32(root, "#size-cells", 1); + ret = of_property_write_u32(root, "#size-cells", 2); if (ret) return ret; } diff --git a/arch/sandbox/board/hostfile.c b/arch/sandbox/board/hostfile.c index 5f0d7e0a4b..63530bd25e 100644 --- a/arch/sandbox/board/hostfile.c +++ b/arch/sandbox/board/hostfile.c @@ -16,6 +16,8 @@ #include <common.h> #include <driver.h> +#include <block.h> +#include <disks.h> #include <malloc.h> #include <mach/linux.h> #include <init.h> @@ -27,14 +29,16 @@ #include <linux/err.h> struct hf_priv { - struct cdev cdev; + union { + struct block_device blk; + struct cdev cdev; + }; const char *filename; int fd; }; -static ssize_t hf_read(struct cdev *cdev, void *buf, size_t count, loff_t offset, ulong flags) +static ssize_t hf_read(struct hf_priv *priv, void *buf, size_t count, loff_t offset, ulong flags) { - struct hf_priv *priv= cdev->priv; int fd = priv->fd; if (linux_lseek(fd, offset) != offset) @@ -43,9 +47,8 @@ static ssize_t hf_read(struct cdev *cdev, void *buf, size_t count, loff_t offset return linux_read(fd, buf, count); } -static ssize_t hf_write(struct cdev *cdev, const void *buf, size_t count, loff_t offset, ulong flags) +static ssize_t hf_write(struct hf_priv *priv, const void *buf, size_t count, loff_t offset, ulong flags) { - struct hf_priv *priv = cdev->priv; int fd = priv->fd; if (linux_lseek(fd, offset) != offset) @@ -54,6 +57,40 @@ static ssize_t hf_write(struct cdev *cdev, const void *buf, size_t count, loff_t return linux_write(fd, buf, count); } +static ssize_t hf_cdev_read(struct cdev *cdev, void *buf, size_t count, loff_t offset, ulong flags) +{ + return hf_read(cdev->priv, buf, count, offset, flags); +} + +static ssize_t hf_cdev_write(struct cdev *cdev, const void *buf, size_t count, loff_t offset, ulong flags) +{ + return hf_write(cdev->priv, buf, count, offset, flags); +} + +static struct cdev_operations hf_cdev_ops = { + .read = hf_cdev_read, + .write = hf_cdev_write, +}; + +static int hf_blk_read(struct block_device *blk, void *buf, int block, int num_blocks) +{ + ssize_t ret = hf_read(container_of(blk, struct hf_priv, blk), buf, + num_blocks << SECTOR_SHIFT, block << SECTOR_SHIFT, 0); + return ret > 0 ? 0 : ret; +} + +static int hf_blk_write(struct block_device *blk, const void *buf, int block, int num_blocks) +{ + ssize_t ret = hf_write(container_of(blk, struct hf_priv, blk), buf, + num_blocks << SECTOR_SHIFT, block << SECTOR_SHIFT, 0); + return ret > 0 ? 0 : ret; +} + +static struct block_device_ops hf_blk_ops = { + .read = hf_blk_read, + .write = hf_blk_write, +}; + static void hf_info(struct device_d *dev) { struct hf_priv *priv = dev->priv; @@ -61,29 +98,28 @@ static void hf_info(struct device_d *dev) printf("file: %s\n", priv->filename); } -static struct cdev_operations hf_fops = { - .read = hf_read, - .write = hf_write, -}; - static int hf_probe(struct device_d *dev) { + struct device_node *np = dev->device_node; struct hf_priv *priv = xzalloc(sizeof(*priv)); struct resource *res; + struct cdev *cdev; + bool is_blockdev; + resource_size_t size; int err; res = dev_get_resource(dev, IORESOURCE_MEM, 0); if (IS_ERR(res)) return PTR_ERR(res); - priv->cdev.size = resource_size(res); + size = resource_size(res); - if (!dev->device_node) + if (!np) return -ENODEV; - of_property_read_u32(dev->device_node, "barebox,fd", &priv->fd); + of_property_read_u32(np, "barebox,fd", &priv->fd); - err = of_property_read_string(dev->device_node, "barebox,filename", + err = of_property_read_string(np, "barebox,filename", &priv->filename); if (err) return err; @@ -91,20 +127,50 @@ static int hf_probe(struct device_d *dev) if (!priv->fd) priv->fd = linux_open(priv->filename, true); - priv->cdev.name = dev->device_node->name; - priv->cdev.dev = dev; - priv->cdev.ops = &hf_fops; - priv->cdev.priv = priv; + if (priv->fd < 0) + return priv->fd; dev->info = hf_info; dev->priv = priv; - err = devfs_create(&priv->cdev); - if (err) - return err; + is_blockdev = of_property_read_bool(np, "barebox,blockdev"); + + cdev = is_blockdev ? &priv->blk.cdev : &priv->cdev; + + cdev->device_node = np; + + if (is_blockdev) { + cdev->name = np->name; + priv->blk.dev = dev; + priv->blk.ops = &hf_blk_ops; + priv->blk.blockbits = SECTOR_SHIFT; + priv->blk.num_blocks = size / SECTOR_SIZE; - of_parse_partitions(&priv->cdev, dev->device_node); - of_partitions_register_fixup(&priv->cdev); + err = blockdevice_register(&priv->blk); + if (err) + return err; + + err = parse_partition_table(&priv->blk); + if (err) + dev_warn(dev, "No partition table found\n"); + + dev_info(dev, "registered as block device\n"); + } else { + cdev->name = np->name; + cdev->dev = dev; + cdev->ops = &hf_cdev_ops; + cdev->size = size; + cdev->priv = priv; + + err = devfs_create(cdev); + if (err) + return err; + + dev_info(dev, "registered as character device\n"); + } + + of_parse_partitions(cdev, np); + of_partitions_register_fixup(cdev); return 0; } @@ -122,7 +188,7 @@ static struct driver_d hf_drv = { .of_compatible = DRV_OF_COMPAT(hostfile_dt_ids), .probe = hf_probe, }; -coredevice_platform_driver(hf_drv); +device_platform_driver(hf_drv); static int of_hostfile_fixup(struct device_node *root, void *ctx) { @@ -131,6 +197,7 @@ static int of_hostfile_fixup(struct device_node *root, void *ctx) uint32_t reg[] = { hf->base >> 32, hf->base, + hf->size >> 32, hf->size }; int ret; @@ -151,6 +218,9 @@ static int of_hostfile_fixup(struct device_node *root, void *ctx) ret = of_property_write_string(node, "barebox,filename", hf->filename); + if (hf->is_blockdev) + ret = of_property_write_bool(node, "barebox,blockdev", true); + return ret; } diff --git a/arch/sandbox/board/poweroff.c b/arch/sandbox/board/poweroff.c index 6b5a6dff15..8ce739af72 100644 --- a/arch/sandbox/board/poweroff.c +++ b/arch/sandbox/board/poweroff.c @@ -1,6 +1,7 @@ #include <common.h> #include <init.h> #include <poweroff.h> +#include <restart.h> #include <mach/linux.h> static void sandbox_poweroff(struct poweroff_handler *poweroff) @@ -8,9 +9,33 @@ static void sandbox_poweroff(struct poweroff_handler *poweroff) linux_exit(); } +static void sandbox_rst_hang(struct restart_handler *rst) +{ + linux_hang(); +} + +static struct restart_handler rst_hang = { + .name = "hang", + .restart = sandbox_rst_hang +}; + +static void sandbox_rst_reexec(struct restart_handler *rst) +{ + linux_reexec(); +} + +static struct restart_handler rst_reexec = { + .name = "reexec", .priority = 200, + .restart = sandbox_rst_reexec, +}; + static int poweroff_register_feature(void) { poweroff_handler_register_fn(sandbox_poweroff); + restart_handler_register(&rst_hang); + + if (IS_ENABLED(CONFIG_SANDBOX_REEXEC)) + restart_handler_register(&rst_reexec); return 0; } diff --git a/arch/sandbox/configs/hosttools_defconfig b/arch/sandbox/configs/hosttools_defconfig new file mode 100644 index 0000000000..72ec0fc462 --- /dev/null +++ b/arch/sandbox/configs/hosttools_defconfig @@ -0,0 +1,7 @@ +CONFIG_IMD=y +CONFIG_COMPILE_HOST_TOOLS=y +CONFIG_ARCH_IMX_USBLOADER=y +CONFIG_MVEBU_HOSTTOOLS=y +CONFIG_MXS_HOSTTOOLS=y +CONFIG_OMAP3_USB_LOADER=y +CONFIG_OMAP4_HOSTTOOL_USBBOOT=y diff --git a/arch/sandbox/dts/sandbox-state-example.dtsi b/arch/sandbox/dts/sandbox-state-example.dtsi index fc17bd0788..98640f6677 100644 --- a/arch/sandbox/dts/sandbox-state-example.dtsi +++ b/arch/sandbox/dts/sandbox-state-example.dtsi @@ -6,7 +6,7 @@ disk { compatible = "barebox,hostfile"; barebox,filename = "disk"; - reg = <0x0 0x0 0x100000>; + reg = <0x0 0x0 0x0 0x100000>; partitions { compatible = "fixed-partitions"; diff --git a/arch/sandbox/dts/skeleton.dtsi b/arch/sandbox/dts/skeleton.dtsi index 38ead821bb..8ba7663eb5 100644 --- a/arch/sandbox/dts/skeleton.dtsi +++ b/arch/sandbox/dts/skeleton.dtsi @@ -6,8 +6,8 @@ / { #address-cells = <2>; - #size-cells = <1>; + #size-cells = <2>; chosen { }; aliases { }; - memory { device_type = "memory"; reg = <0 0 0>; }; + memory { device_type = "memory"; reg = <0 0 0 0>; }; }; diff --git a/arch/sandbox/lib/unwind.c b/arch/sandbox/lib/unwind.c index 15a2798cc4..f46365ac2b 100644 --- a/arch/sandbox/lib/unwind.c +++ b/arch/sandbox/lib/unwind.c @@ -7,5 +7,5 @@ void __sanitizer_print_stack_trace(void); void dump_stack(void) { - __sanitizer_print_stack_trace(); + __sanitizer_print_stack_trace(); } diff --git a/arch/sandbox/mach-sandbox/include/mach/hostfile.h b/arch/sandbox/mach-sandbox/include/mach/hostfile.h index 54f690be5f..c3f9af97c4 100644 --- a/arch/sandbox/mach-sandbox/include/mach/hostfile.h +++ b/arch/sandbox/mach-sandbox/include/mach/hostfile.h @@ -4,9 +4,10 @@ struct hf_info { int fd; unsigned long long base; - size_t size; + unsigned long long size; const char *devname; const char *filename; + unsigned int is_blockdev:1; }; int barebox_register_filedev(struct hf_info *hf); diff --git a/arch/sandbox/mach-sandbox/include/mach/linux.h b/arch/sandbox/mach-sandbox/include/mach/linux.h index 9759a376ec..1ab48e52a0 100644 --- a/arch/sandbox/mach-sandbox/include/mach/linux.h +++ b/arch/sandbox/mach-sandbox/include/mach/linux.h @@ -17,6 +17,8 @@ ssize_t linux_write(int fd, const void *buf, size_t count); off_t linux_lseek(int fildes, off_t offset); int linux_tstc(int fd); void __attribute__((noreturn)) linux_exit(void); +void linux_hang(void); +void linux_reexec(void); int linux_execve(const char * filename, char *const argv[], char *const envp[]); diff --git a/arch/sandbox/os/common.c b/arch/sandbox/os/common.c index 9fb5faf41d..43ee95edb6 100644 --- a/arch/sandbox/os/common.c +++ b/arch/sandbox/os/common.c @@ -44,6 +44,8 @@ #include <mach/linux.h> #include <mach/hostfile.h> +#define DELETED_OFFSET (sizeof(" (deleted)") - 1) + void __sanitizer_set_death_callback(void (*callback)(void)); int sdl_xres; @@ -122,9 +124,40 @@ void __attribute__((noreturn)) linux_exit(void) exit(0); } +static char **saved_argv; + +void linux_reexec(void) +{ + char buf[4097]; + ssize_t ret; + + cookmode(); + + /* we must follow the symlink, so we can exec an updated executable */ + ret = readlink("/proc/self/exe", buf, sizeof(buf) - 1); + if (0 < ret && ret < sizeof(buf) - 1) { + buf[ret] = '\0'; + execv(buf, saved_argv); + if (!strcmp(&buf[ret - DELETED_OFFSET], " (deleted)")) { + printf("barebox image on disk changed. Loading new.\n"); + buf[ret - DELETED_OFFSET] = '\0'; + execv(buf, saved_argv); + } + } + + printf("exec(%s) failed: %d\n", buf, errno); + /* falls through to generic hang() */ +} + +void linux_hang(void) +{ + cookmode(); + /* falls through to generic hang() */ +} + int linux_open(const char *filename, int readwrite) { - return open(filename, readwrite ? O_RDWR : O_RDONLY); + return open(filename, (readwrite ? O_RDWR : O_RDONLY) | O_CLOEXEC); } int linux_read(int fd, void *buf, size_t count) @@ -212,12 +245,14 @@ int linux_execve(const char * filename, char *const argv[], char *const envp[]) extern void start_barebox(void); extern void mem_malloc_init(void *start, void *end); -static int add_image(char *str, char *devname_template, int *devname_number) +extern char * strsep_unescaped(char **s, const char *ct); + +static int add_image(const char *_str, char *devname_template, int *devname_number) { struct hf_info *hf = malloc(sizeof(struct hf_info)); - char *filename, *devname; + char *str, *filename, *devname; char tmp[16]; - int readonly = 0; + int readonly = 0, cdev = 0, blkdev = 0; struct stat s; char *opt; int fd, ret; @@ -225,15 +260,21 @@ static int add_image(char *str, char *devname_template, int *devname_number) if (!hf) return -1; - filename = strtok(str, ","); - while ((opt = strtok(NULL, ","))) { + str = strdup(_str); + + filename = strsep_unescaped(&str, ","); + while ((opt = strsep_unescaped(&str, ","))) { if (!strcmp(opt, "ro")) readonly = 1; + if (!strcmp(opt, "cdev")) + cdev = 1; + if (!strcmp(opt, "blkdev")) + blkdev = 1; } /* parses: "devname=filename" */ - devname = strtok(filename, "="); - filename = strtok(NULL, "="); + devname = strsep_unescaped(&filename, "="); + filename = strsep_unescaped(&filename, "="); if (!filename) { filename = devname; snprintf(tmp, sizeof(tmp), @@ -244,9 +285,10 @@ static int add_image(char *str, char *devname_template, int *devname_number) printf("add %s backed by file %s%s\n", devname, filename, readonly ? "(ro)" : ""); - fd = open(filename, readonly ? O_RDONLY : O_RDWR); + fd = open(filename, (readonly ? O_RDONLY : O_RDWR) | O_CLOEXEC); hf->fd = fd; hf->filename = filename; + hf->is_blockdev = blkdev; if (fd < 0) { perror("open"); @@ -266,13 +308,25 @@ static int add_image(char *str, char *devname_template, int *devname_number) perror("ioctl"); goto err_out; } + if (!cdev) + hf->is_blockdev = 1; } - hf->base = (unsigned long)mmap(NULL, hf->size, - PROT_READ | (readonly ? 0 : PROT_WRITE), - MAP_SHARED, fd, 0); + if (hf->size <= SIZE_MAX) + hf->base = (unsigned long)mmap(NULL, hf->size, + PROT_READ | (readonly ? 0 : PROT_WRITE), + MAP_SHARED, fd, 0); + else + printf("warning: %s: contiguous map failed\n", filename); + if (hf->base == (unsigned long)MAP_FAILED) printf("warning: mmapping %s failed: %s\n", filename, strerror(errno)); + if (blkdev && hf->size % 512 != 0) { + printf("warning: registering %s as block device failed: invalid block size\n", + filename); + return -EINVAL; + } + ret = barebox_register_filedev(hf); if (ret) goto err_out; @@ -291,7 +345,7 @@ static int add_dtb(const char *file) void *dtb = NULL; int fd; - fd = open(file, O_RDONLY); + fd = open(file, O_RDONLY | O_CLOEXEC); if (fd < 0) { perror("open"); goto err_out; @@ -351,6 +405,8 @@ int main(int argc, char *argv[]) __sanitizer_set_death_callback(cookmode); #endif + saved_argv = argv; + while (1) { option_index = 0; opt = getopt_long(argc, argv, optstring, @@ -422,7 +478,7 @@ int main(int argc, char *argv[]) exit(1); break; case 'O': - fd = open(optarg, O_WRONLY); + fd = open(optarg, O_WRONLY | O_CLOEXEC); if (fd < 0) { perror("open"); exit(1); @@ -431,7 +487,7 @@ int main(int argc, char *argv[]) barebox_register_console(-1, fd); break; case 'I': - fd = open(optarg, O_RDWR); + fd = open(optarg, O_RDWR | O_CLOEXEC); if (fd < 0) { perror("open"); exit(1); @@ -447,7 +503,7 @@ int main(int argc, char *argv[]) } /* open stdout file */ - fd = open(aux + 1, O_WRONLY); + fd = open(aux + 1, O_WRONLY | O_CLOEXEC); if (fd < 0) { perror("open stdout"); exit(1); @@ -455,7 +511,7 @@ int main(int argc, char *argv[]) /* open stdin file */ aux = strndup(optarg, aux - optarg); - fd2 = open(aux, O_RDWR); + fd2 = open(aux, O_RDWR | O_CLOEXEC); if (fd2 < 0) { perror("open stdin"); exit(1); diff --git a/arch/sandbox/os/tap.c b/arch/sandbox/os/tap.c index 72b7fbb5ac..83b97ffd49 100644 --- a/arch/sandbox/os/tap.c +++ b/arch/sandbox/os/tap.c @@ -30,7 +30,7 @@ int tap_alloc(const char *dev) struct ifreq ifr; int fd, err; - if ((fd = open("/dev/net/tun", O_RDWR)) < 0) { + if ((fd = open("/dev/net/tun", O_RDWR | O_CLOEXEC)) < 0) { perror("could not open /dev/net/tun"); return -1; } diff --git a/arch/x86/configs/efi_defconfig b/arch/x86/configs/efi_defconfig index 47842d10af..83794d7a07 100644 --- a/arch/x86/configs/efi_defconfig +++ b/arch/x86/configs/efi_defconfig @@ -14,7 +14,6 @@ CONFIG_BLSPEC=y CONFIG_CONSOLE_ACTIVATE_ALL=y CONFIG_PARTITION_DISK_EFI=y CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y -CONFIG_POLLER=y CONFIG_STATE=y CONFIG_DEBUG_LL=y CONFIG_LONGHELP=y @@ -66,7 +65,6 @@ CONFIG_NET=y CONFIG_NET_NFS=y CONFIG_NET_NETCONSOLE=y CONFIG_DRIVER_SERIAL_EFI_STDIO=y -CONFIG_DRIVER_SERIAL_NS16550=y CONFIG_DRIVER_NET_EFI_SNP=y # CONFIG_SPI is not set CONFIG_DISK=y |