summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/arm/configs/rpi_defconfig3
-rw-r--r--arch/arm/dts/bcm2837-rpi-3.dts4
-rw-r--r--arch/arm/dts/imx6q-var-custom.dts2
-rw-r--r--arch/arm/dts/imx6qdl-prti6q-emmc.dtsi11
-rw-r--r--arch/arm/dts/imx6qdl-skov-imx6.dtsi4
-rw-r--r--arch/arm/dts/imx6ul-prti6g.dts11
-rw-r--r--arch/arm/dts/imx6ull-jozacp.dts11
-rw-r--r--arch/arm/include/asm/barebox-arm.h8
-rw-r--r--arch/arm/mach-imx/esdctl.c13
-rw-r--r--arch/arm/mach-rockchip/Kconfig13
-rw-r--r--arch/arm/mach-rockchip/Makefile2
-rw-r--r--arch/arm/mach-rockchip/include/mach/atf.h5
-rw-r--r--arch/arm/mach-stm32mp/ddrctrl.c13
-rw-r--r--arch/riscv/boot/start.c4
-rw-r--r--common/Kconfig9
-rw-r--r--common/deep-probe.c4
-rw-r--r--drivers/mci/arasan-sdhci.c24
-rw-r--r--drivers/mci/atmel_mci_common.c6
-rw-r--r--drivers/mci/mci-core.c118
-rw-r--r--drivers/net/bcmgenet.c6
-rw-r--r--drivers/net/designware_eqos.c22
-rw-r--r--drivers/net/e1000/main.c2
-rw-r--r--drivers/net/ksz9477.c3
-rw-r--r--drivers/of/partition.c6
-rw-r--r--drivers/pinctrl/pinctrl-stm32.c10
-rw-r--r--drivers/regulator/rk808-regulator.c7
-rw-r--r--drivers/regulator/scmi-regulator.c6
-rw-r--r--drivers/video/vpl.c1
-rw-r--r--firmware/Kconfig12
-rw-r--r--include/asm-generic/io.h4
-rw-r--r--include/linux/iopoll.h4
-rw-r--r--include/mci.h43
-rw-r--r--pbl/Kconfig2
-rw-r--r--scripts/Makefile.lib4
34 files changed, 274 insertions, 123 deletions
diff --git a/arch/arm/configs/rpi_defconfig b/arch/arm/configs/rpi_defconfig
index e7d695f8ae..500c92a821 100644
--- a/arch/arm/configs/rpi_defconfig
+++ b/arch/arm/configs/rpi_defconfig
@@ -80,6 +80,7 @@ CONFIG_CMD_TIME=y
CONFIG_NET=y
CONFIG_SERIAL_AMBA_PL011=y
CONFIG_DRIVER_SERIAL_NS16550=y
+CONFIG_DRIVER_NET_BCMGENET=y
CONFIG_NET_USB=y
CONFIG_NET_USB_SMSC95XX=y
CONFIG_I2C=y
@@ -98,6 +99,7 @@ CONFIG_WATCHDOG_BCM2835=y
CONFIG_GPIO_RASPBERRYPI_EXP=y
CONFIG_PINCTRL_BCM283X=y
CONFIG_REGULATOR=y
+CONFIG_REGULATOR_FIXED=y
CONFIG_GENERIC_PHY=y
CONFIG_USB_NOP_XCEIV=y
CONFIG_FS_EXT4=y
@@ -106,3 +108,4 @@ CONFIG_FS_NFS=y
CONFIG_FS_FAT=y
CONFIG_FS_FAT_WRITE=y
CONFIG_FS_FAT_LFN=y
+CONFIG_ZLIB=y
diff --git a/arch/arm/dts/bcm2837-rpi-3.dts b/arch/arm/dts/bcm2837-rpi-3.dts
index e82d518fa5..38d673aec4 100644
--- a/arch/arm/dts/bcm2837-rpi-3.dts
+++ b/arch/arm/dts/bcm2837-rpi-3.dts
@@ -3,7 +3,3 @@
&{/memory@0} {
reg = <0x0 0x0>;
};
-
-&sdhci {
- status = "disabled";
-};
diff --git a/arch/arm/dts/imx6q-var-custom.dts b/arch/arm/dts/imx6q-var-custom.dts
index ddb220fb0a..cbfe4da7e1 100644
--- a/arch/arm/dts/imx6q-var-custom.dts
+++ b/arch/arm/dts/imx6q-var-custom.dts
@@ -83,7 +83,7 @@
fsl,data-width = <24>;
status = "okay";
display-timings {
- native-mode = &claawvga;
+ native-mode = <&claawvga>;
claawvga: claawvga {
native-mode;
clock-frequency = <35714000>;
diff --git a/arch/arm/dts/imx6qdl-prti6q-emmc.dtsi b/arch/arm/dts/imx6qdl-prti6q-emmc.dtsi
index 453bf80ea1..8ad41174d4 100644
--- a/arch/arm/dts/imx6qdl-prti6q-emmc.dtsi
+++ b/arch/arm/dts/imx6qdl-prti6q-emmc.dtsi
@@ -88,17 +88,6 @@
compatible = "ramoops";
};
};
-
- reserved-memory {
- #address-cells = <1>;
- #size-cells = <1>;
- ranges;
-
- /* Address will be determined by the bootloader */
- ramoops {
- compatible = "ramoops";
- };
- };
};
&usdhc3 {
diff --git a/arch/arm/dts/imx6qdl-skov-imx6.dtsi b/arch/arm/dts/imx6qdl-skov-imx6.dtsi
index f4610ee1e7..cb4224f1b4 100644
--- a/arch/arm/dts/imx6qdl-skov-imx6.dtsi
+++ b/arch/arm/dts/imx6qdl-skov-imx6.dtsi
@@ -146,7 +146,7 @@
};
display-timings {
- native-mode = &l2rt;
+ native-mode = <&l2rt>;
l2rt: l2rt {
native-mode;
@@ -190,7 +190,7 @@
/* power-supply = <&reg_3p3v>; */
display-timings {
- native-mode = &mi1010ait_1cp1;
+ native-mode = <&mi1010ait_1cp1>;
mi1010ait_1cp1: mi1010ait-1cp1 {
native-mode;
diff --git a/arch/arm/dts/imx6ul-prti6g.dts b/arch/arm/dts/imx6ul-prti6g.dts
index 8f17ad976f..3efbf357f1 100644
--- a/arch/arm/dts/imx6ul-prti6g.dts
+++ b/arch/arm/dts/imx6ul-prti6g.dts
@@ -23,17 +23,6 @@
compatible = "ramoops";
};
};
-
- reserved-memory {
- #address-cells = <1>;
- #size-cells = <1>;
- ranges;
-
- /* Address will be determined by the bootloader */
- ramoops {
- compatible = "ramoops";
- };
- };
};
&ecspi1 {
diff --git a/arch/arm/dts/imx6ull-jozacp.dts b/arch/arm/dts/imx6ull-jozacp.dts
index c7f05f12e8..c30ba759ee 100644
--- a/arch/arm/dts/imx6ull-jozacp.dts
+++ b/arch/arm/dts/imx6ull-jozacp.dts
@@ -23,17 +23,6 @@
compatible = "ramoops";
};
};
-
- reserved-memory {
- #address-cells = <1>;
- #size-cells = <1>;
- ranges;
-
- /* Address will be determined by the bootloader */
- ramoops {
- compatible = "ramoops";
- };
- };
};
&usdhc1 {
diff --git a/arch/arm/include/asm/barebox-arm.h b/arch/arm/include/asm/barebox-arm.h
index 2dcd415320..515525e49d 100644
--- a/arch/arm/include/asm/barebox-arm.h
+++ b/arch/arm/include/asm/barebox-arm.h
@@ -80,13 +80,7 @@ static inline const void *arm_mem_scratch_get(void)
return (const void *)__arm_mem_scratch(arm_mem_endmem_get());
}
-#define __arm_mem_stack_top(membase, endmem) ((endmem) - SZ_64K)
-
-#if defined(CONFIG_BOOTM_OPTEE) || defined(CONFIG_PBL_OPTEE)
-#define arm_mem_stack_top(membase, endmem) (__arm_mem_stack_top(membase, endmem) - OPTEE_SIZE)
-#else
-#define arm_mem_stack_top(membase, endmem) __arm_mem_stack_top(membase, endmem)
-#endif
+#define arm_mem_stack_top(membase, endmem) ((endmem) - SZ_64K - OPTEE_SIZE)
static inline unsigned long arm_mem_stack(unsigned long membase,
unsigned long endmem)
diff --git a/arch/arm/mach-imx/esdctl.c b/arch/arm/mach-imx/esdctl.c
index eb47957db0..a704250297 100644
--- a/arch/arm/mach-imx/esdctl.c
+++ b/arch/arm/mach-imx/esdctl.c
@@ -754,18 +754,7 @@ static struct driver imx_esdctl_driver = {
.id_table = imx_esdctl_ids,
.of_compatible = DRV_OF_COMPAT(imx_esdctl_dt_ids),
};
-
-static int imx_esdctl_init(void)
-{
- int ret;
-
- ret = platform_driver_register(&imx_esdctl_driver);
- if (ret)
- return ret;
-
- return of_devices_ensure_probed_by_dev_id(imx_esdctl_dt_ids);
-}
-mem_initcall(imx_esdctl_init);
+mem_platform_driver(imx_esdctl_driver);
/*
* The i.MX SoCs usually have two SDRAM chipselects. The following
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 1f3ba706ee..4ac75ab947 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -88,16 +88,25 @@ config MACH_RADXA_ROCK3
comment "select board features:"
+config ARCH_ROCKCHIP_ATF
+ bool "Build rockchip ATF binaries into barebox"
+ depends on ARCH_ROCKCHIP_V8
+ default y
+ help
+ When deselected, barebox proper will run in EL3. This can be
+ useful for debugging early startup, but for all other cases,
+ say y here.
+
config ARCH_RK3399_OPTEE
bool "Build rk3399 OP-TEE binary into barebox"
- depends on ARCH_RK3399
+ depends on ARCH_ROCKCHIP_ATF && ARCH_RK3399
help
With this option enabled the RK3399 OP-TEE binary is compiled
into barebox and started along with the BL31 trusted firmware.
config ARCH_RK3568_OPTEE
bool "Build rk3568 OP-TEE binary into barebox"
- depends on ARCH_RK3568
+ depends on ARCH_ROCKCHIP_ATF && ARCH_RK3568
help
With this option enabled the RK3568 OP-TEE binary is compiled
into barebox and started along with the BL31 trusted firmware.
diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile
index a86ee71617..2529af7c7e 100644
--- a/arch/arm/mach-rockchip/Makefile
+++ b/arch/arm/mach-rockchip/Makefile
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
obj-y += rockchip.o
-pbl-$(CONFIG_ARCH_ROCKCHIP_V8) += atf.o
+pbl-$(CONFIG_ARCH_ROCKCHIP_ATF) += atf.o
obj-$(CONFIG_ARCH_RK3188) += rk3188.o
obj-$(CONFIG_ARCH_RK3288) += rk3288.o
obj-pbl-$(CONFIG_ARCH_RK3568) += rk3568.o
diff --git a/arch/arm/mach-rockchip/include/mach/atf.h b/arch/arm/mach-rockchip/include/mach/atf.h
index d1bae5a771..e5d55af3d7 100644
--- a/arch/arm/mach-rockchip/include/mach/atf.h
+++ b/arch/arm/mach-rockchip/include/mach/atf.h
@@ -19,8 +19,13 @@
#define RK3568_BAREBOX_LOAD_ADDRESS (RK3568_DRAM_BOTTOM + 1024*1024)
#ifndef __ASSEMBLY__
+#ifdef CONFIG_ARCH_ROCKCHIP_ATF
void rk3399_atf_load_bl31(void *fdt);
void rk3568_atf_load_bl31(void *fdt);
+#else
+static inline void rk3399_atf_load_bl31(void *fdt) { }
+static inline void rk3568_atf_load_bl31(void *fdt) { }
+#endif
#endif
#endif /* __MACH_ATF_H */
diff --git a/arch/arm/mach-stm32mp/ddrctrl.c b/arch/arm/mach-stm32mp/ddrctrl.c
index ad4662c44d..ffda1ba61f 100644
--- a/arch/arm/mach-stm32mp/ddrctrl.c
+++ b/arch/arm/mach-stm32mp/ddrctrl.c
@@ -157,15 +157,4 @@ static struct driver stm32mp1_ddr_driver = {
.probe = stm32mp1_ddr_probe,
.of_compatible = DRV_OF_COMPAT(stm32mp1_ddr_dt_ids),
};
-
-static int stm32mp1_ddr_init(void)
-{
- int ret;
-
- ret = platform_driver_register(&stm32mp1_ddr_driver);
- if (ret)
- return ret;
-
- return of_devices_ensure_probed_by_dev_id(stm32mp1_ddr_dt_ids);
-}
-mem_initcall(stm32mp1_ddr_init);
+mem_platform_driver(stm32mp1_ddr_driver);
diff --git a/arch/riscv/boot/start.c b/arch/riscv/boot/start.c
index 27d9066243..92991d0f6a 100644
--- a/arch/riscv/boot/start.c
+++ b/arch/riscv/boot/start.c
@@ -3,6 +3,10 @@
#define pr_fmt(fmt) "start.c: " fmt
+#ifdef CONFIG_DEBUG_INITCALLS
+#define DEBUG
+#endif
+
#include <common.h>
#include <init.h>
#include <linux/sizes.h>
diff --git a/common/Kconfig b/common/Kconfig
index e2b810c39c..9e175d36c4 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -1571,6 +1571,15 @@ config DEBUG_INITCALLS
help
If enabled this will print initcall traces.
+config DEBUG_PBL
+ bool "Print PBL debugging information"
+ depends on PBL_CONSOLE || DEBUG_LL
+ help
+ If enabled this will enable all debug prints in the prebootloader.
+ For this to work, a console needs to be configured in the
+ board-specific entry point and configured for either DEBUG_LL
+ or PBL_CONSOLE.
+
config DEBUG_PROBES
bool "Trace driver probes/removes"
help
diff --git a/common/deep-probe.c b/common/deep-probe.c
index 1020ad93b7..931e5a1770 100644
--- a/common/deep-probe.c
+++ b/common/deep-probe.c
@@ -1,5 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
+#define pr_fmt(fmt) "deep-probe: " fmt
+
#include <common.h>
#include <deep-probe.h>
#include <of.h>
@@ -27,7 +29,7 @@ bool deep_probe_is_supported(void)
for (; matches->compatible; matches++) {
if (of_machine_is_compatible(matches->compatible)) {
boardstate = DEEP_PROBE_SUPPORTED;
- printk("Deep probe supported due to %s\n", matches->compatible);
+ pr_info("supported due to %s\n", matches->compatible);
return true;
}
}
diff --git a/drivers/mci/arasan-sdhci.c b/drivers/mci/arasan-sdhci.c
index 22389503be..00a8ceed68 100644
--- a/drivers/mci/arasan-sdhci.c
+++ b/drivers/mci/arasan-sdhci.c
@@ -136,16 +136,17 @@ static void arasan_sdhci_set_ios(struct mci_host *mci, struct mci_ios *ios)
static int arasan_sdhci_wait_for_done(struct arasan_sdhci_host *host, u32 mask)
{
u64 start = get_time_ns();
- u16 stat;
- u16 error;
+ u32 stat;
do {
- stat = sdhci_read16(&host->sdhci, SDHCI_INT_NORMAL_STATUS);
+ stat = sdhci_read32(&host->sdhci, SDHCI_INT_STATUS);
+
+ if (stat & SDHCI_INT_TIMEOUT)
+ return -ETIMEDOUT;
+
if (stat & SDHCI_INT_ERROR) {
- error = sdhci_read16(&host->sdhci,
- SDHCI_INT_ERROR_STATUS);
dev_err(host->mci.hw_dev, "SDHCI_INT_ERROR: 0x%08x\n",
- error);
+ stat);
return -EPERM;
}
@@ -159,8 +160,11 @@ static int arasan_sdhci_wait_for_done(struct arasan_sdhci_host *host, u32 mask)
return 0;
}
-static void print_error(struct arasan_sdhci_host *host, int cmdidx)
+static void print_error(struct arasan_sdhci_host *host, int cmdidx, int ret)
{
+ if (ret == -ETIMEDOUT)
+ return;
+
dev_err(host->mci.hw_dev,
"error while transferring data for command %d\n", cmdidx);
dev_err(host->mci.hw_dev, "state = 0x%08x , interrupt = 0x%08x\n",
@@ -210,10 +214,8 @@ static int arasan_sdhci_send_cmd(struct mci_host *mci, struct mci_cmd *cmd,
sdhci_write16(&host->sdhci, SDHCI_COMMAND, command);
ret = arasan_sdhci_wait_for_done(host, mask);
- if (ret == -EPERM)
+ if (ret)
goto error;
- else if (ret)
- return ret;
sdhci_read_response(&host->sdhci, cmd);
sdhci_write32(&host->sdhci, SDHCI_INT_STATUS, mask);
@@ -223,7 +225,7 @@ static int arasan_sdhci_send_cmd(struct mci_host *mci, struct mci_cmd *cmd,
error:
if (ret) {
- print_error(host, cmd->cmdidx);
+ print_error(host, cmd->cmdidx, ret);
arasan_sdhci_reset(host, BIT(1)); // SDHCI_RESET_CMD
arasan_sdhci_reset(host, BIT(2)); // SDHCI_RESET_DATA
}
diff --git a/drivers/mci/atmel_mci_common.c b/drivers/mci/atmel_mci_common.c
index c8e21933fe..ec710f1cfc 100644
--- a/drivers/mci/atmel_mci_common.c
+++ b/drivers/mci/atmel_mci_common.c
@@ -90,8 +90,8 @@ static int atmci_poll_status(struct atmel_mci *host, u32 mask)
u32 stat;
int ret;
- ret = read_poll_timeout(atmci_readl, stat, (stat & mask), SECOND, host,
- ATMCI_SR);
+ ret = read_poll_timeout(atmci_readl, stat, (stat & mask), USEC_PER_SEC,
+ host, ATMCI_SR);
if (ret < 0) {
dev_err(host->hw_dev, "timeout\n");
host->need_reset = true;
@@ -315,7 +315,7 @@ static int atmci_start_cmd(struct atmel_mci *host, struct mci_cmd *cmd,
flags |= ATMCI_CMDR_RSPTYP_NONE;
break;
default:
- dev_err(host->hw_dev, "unhandled response type 0x%x\n",
+ dev_dbg(host->hw_dev, "unhandled response type 0x%x\n",
cmd->resp_type);
return -EINVAL;
}
diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 3ad9601258..f647cae820 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -75,6 +75,28 @@ static int mci_send_cmd(struct mci *mci, struct mci_cmd *cmd, struct mci_data *d
}
/**
+ * mci_send_cmd_retry() - send a command to the mmc device, retrying on error
+ *
+ * @dev: device to receive the command
+ * @cmd: command to send
+ * @data: additional data to send/receive
+ * @retries: how many times to retry; mci_send_cmd is always called at least
+ * once
+ * Return: 0 if ok, -ve on error
+ */
+static int mci_send_cmd_retry(struct mci *mci, struct mci_cmd *cmd,
+ struct mci_data *data, unsigned retries)
+{
+ int ret;
+
+ do
+ ret = mci_send_cmd(mci, cmd, data);
+ while (ret && retries--);
+
+ return ret;
+}
+
+/**
* @param p Command definition to setup
* @param cmd Valid SD/MMC command (refer MMC_CMD_* / SD_CMD_*)
* @param arg Argument for the command (optional)
@@ -119,6 +141,67 @@ static int mci_set_blocklen(struct mci *mci, unsigned len)
static void *sector_buf;
+static int mci_send_status(struct mci *mci, unsigned int *status)
+{
+ struct mci_host *host = mci->host;
+ struct mci_cmd cmd;
+ int ret;
+
+ /*
+ * While CMD13 is defined for SPI mode, the reported status bits have
+ * different layout that SD/MMC. We skip supporting this for now.
+ */
+ if (mmc_host_is_spi(host))
+ return -ENOSYS;
+
+ cmd.cmdidx = MMC_CMD_SEND_STATUS;
+ cmd.resp_type = MMC_RSP_R1;
+ cmd.cmdarg = mci->rca << 16;
+
+ ret = mci_send_cmd_retry(mci, &cmd, NULL, 4);
+ if (!ret)
+ *status = cmd.response[0];
+
+ return ret;
+}
+
+static int mci_poll_until_ready(struct mci *mci, int timeout_ms)
+{
+ unsigned int status;
+ int err, retries = 0;
+
+ while (1) {
+ err = mci_send_status(mci, &status);
+ if (err)
+ return err;
+
+ /*
+ * Some cards mishandle the status bits, so make sure to
+ * check both the busy indication and the card state.
+ */
+ if ((status & R1_READY_FOR_DATA) &&
+ R1_CURRENT_STATE(status) != R1_STATE_PRG)
+ break;
+
+ if (status & R1_STATUS_MASK) {
+ dev_err(&mci->dev, "Status Error: 0x%08x\n", status);
+ return -EIO;
+ }
+
+ if (retries++ == timeout_ms) {
+ dev_err(&mci->dev, "Timeout awaiting card ready\n");
+ return -ETIMEDOUT;
+ }
+
+ udelay(1000);
+ }
+
+ dev_dbg(&mci->dev, "Ready polling took %ums\n", retries);
+
+ return 0;
+}
+
+
/**
* Write one or several blocks of data to the card
* @param mci_dev MCI instance
@@ -136,6 +219,17 @@ static int mci_block_write(struct mci *mci, const void *src, int blocknum,
unsigned mmccmd;
int ret;
+ /*
+ * Quoting eMMC Spec v5.1 (JEDEC Standard No. 84-B51):
+ * Due to legacy reasons, a Device may still treat CMD24/25 during
+ * prg-state (while busy is active) as a legal or illegal command.
+ * A host should not send CMD24/25 while the Device is in the prg
+ * state and busy is active.
+ */
+ ret = mci_poll_until_ready(mci, 1000 /* ms */);
+ if (ret && ret != -ENOSYS)
+ return ret;
+
if (blocks > 1)
mmccmd = MMC_CMD_WRITE_MULTIPLE_BLOCK;
else
@@ -232,6 +326,15 @@ static int mci_go_idle(struct mci *mci)
return 0;
}
+static int sdio_send_op_cond(struct mci *mci)
+{
+ struct mci_cmd cmd;
+
+ mci_setup_cmd(&cmd, SD_IO_SEND_OP_COND, 0, MMC_RSP_SPI_R4 | MMC_RSP_R4 | MMC_CMD_BCR);
+
+ return mci_send_cmd(mci, &cmd, NULL);
+}
+
/**
* FIXME
* @param mci MCI instance
@@ -1596,7 +1699,9 @@ static void mci_info(struct device *dev)
mci_print_caps(host->host_caps);
printf("Card information:\n");
- printf(" Attached is a %s card\n", IS_SD(mci) ? "SD" : "MMC");
+ printf(" Card type: %s\n", mci->sdio ? "SDIO" : IS_SD(mci) ? "SD" : "MMC");
+ if (mci->sdio)
+ return;
printf(" Version: %s\n", mci_version_string(mci));
printf(" Capacity: %u MiB\n", (unsigned)(mci->capacity >> 20));
@@ -1809,6 +1914,16 @@ static int mci_card_probe(struct mci *mci)
goto on_error;
}
+ if (!host->no_sdio) {
+ rc = sdio_send_op_cond(mci);
+ if (!rc) {
+ mci->ready_for_use = true;
+ mci->sdio = true;
+ dev_info(&mci->dev, "SDIO card detected, ignoring\n");
+ return 0;
+ }
+ }
+
/* Check if this card can handle the "SD Card Physical Layer Specification 2.0" */
if (!host->no_sd) {
rc = sd_send_if_cond(mci);
@@ -2086,6 +2201,7 @@ void mci_of_parse_node(struct mci_host *host,
host->broken_cd = of_property_read_bool(np, "broken-cd");
host->non_removable = of_property_read_bool(np, "non-removable");
host->no_sd = of_property_read_bool(np, "no-sd");
+ host->no_sdio = of_property_read_bool(np, "no-sdio");
host->disable_wp = of_property_read_bool(np, "disable-wp");
}
diff --git a/drivers/net/bcmgenet.c b/drivers/net/bcmgenet.c
index 32ec36eff6..3ae341a658 100644
--- a/drivers/net/bcmgenet.c
+++ b/drivers/net/bcmgenet.c
@@ -314,8 +314,8 @@ static int bcmgenet_gmac_eth_recv(struct eth_device *edev)
struct bcmgenet_eth_priv *priv = edev->priv;
void *desc_base = priv->mac_reg + GENET_RX_OFF + priv->rx_index * DMA_DESC_SIZE;
u32 prod_index = readl(priv->mac_reg + RDMA_PROD_INDEX);
- u32 length;
- unsigned long addr_lo, addr_hi, addr;
+ u32 length, addr_lo, addr_hi;
+ dma_addr_t addr;
if (prod_index == priv->c_index)
return -EAGAIN;
@@ -324,7 +324,7 @@ static int bcmgenet_gmac_eth_recv(struct eth_device *edev)
length = (length >> DMA_BUFLENGTH_SHIFT) & DMA_BUFLENGTH_MASK;
addr_lo = readl(desc_base + DMA_DESC_ADDRESS_LO);
addr_hi = readl(desc_base + DMA_DESC_ADDRESS_HI);
- addr = addr_hi << 32 | addr_lo;
+ addr = (u64)addr_hi << 32 | addr_lo;
dma_sync_single_for_cpu(addr, length, DMA_FROM_DEVICE);
diff --git a/drivers/net/designware_eqos.c b/drivers/net/designware_eqos.c
index c255d74eff..ee5a10a007 100644
--- a/drivers/net/designware_eqos.c
+++ b/drivers/net/designware_eqos.c
@@ -26,7 +26,8 @@
struct eqos_mac_regs {
u32 config; /* 0x000 */
u32 ext_config; /* 0x004 */
- u32 unused_004[(0x070 - 0x008) / 4]; /* 0x008 */
+ u32 packet_filter; /* 0x008 */
+ u32 unused_004[(0x070 - 0x00C) / 4]; /* 0x00C */
u32 q0_tx_flow_ctrl; /* 0x070 */
u32 unused_070[(0x090 - 0x074) / 4]; /* 0x074 */
u32 rx_flow_ctrl; /* 0x090 */
@@ -62,6 +63,9 @@ struct eqos_mac_regs {
#define EQOS_MAC_CONFIGURATION_TE BIT(1)
#define EQOS_MAC_CONFIGURATION_RE BIT(0)
+#define EQOS_MAC_PACKET_FILTER_PR BIT(0) /* Promiscuous mode */
+#define EQOS_MAC_PACKET_FILTER_PCF BIT(7) /* Pass Control Frames */
+
#define EQOS_MAC_Q0_TX_FLOW_CTRL_PT_SHIFT 16
#define EQOS_MAC_Q0_TX_FLOW_CTRL_PT_MASK 0xffff
#define EQOS_MAC_Q0_TX_FLOW_CTRL_TFE BIT(1)
@@ -357,6 +361,21 @@ int eqos_set_ethaddr(struct eth_device *edev, const unsigned char *mac)
return 0;
}
+static int eqos_set_promisc(struct eth_device *edev, bool enable)
+{
+ struct eqos *eqos = edev->priv;
+ u32 mask;
+
+ mask = EQOS_MAC_PACKET_FILTER_PR | EQOS_MAC_PACKET_FILTER_PCF;
+
+ if (enable)
+ setbits_le32(&eqos->mac_regs->packet_filter, mask);
+ else
+ clrbits_le32(&eqos->mac_regs->packet_filter, mask);
+
+ return 0;
+}
+
/* Get PHY out of power saving mode. If this is needed elsewhere then
* consider making it part of phy-core and adding a resume method to
* the phy device ops. */
@@ -856,6 +875,7 @@ int eqos_probe(struct device *dev, const struct eqos_ops *ops, void *priv)
edev->halt = eqos_stop;
edev->get_ethaddr = ops->get_ethaddr;
edev->set_ethaddr = ops->set_ethaddr;
+ edev->set_promisc = eqos_set_promisc;
miibus = &eqos->miibus;
miibus->parent = edev->parent;
diff --git a/drivers/net/e1000/main.c b/drivers/net/e1000/main.c
index 1f84cf2949..e00bc48417 100644
--- a/drivers/net/e1000/main.c
+++ b/drivers/net/e1000/main.c
@@ -3476,7 +3476,7 @@ static int e1000_transmit(struct eth_device *edev, void *txpacket, int length)
ret = readl_poll_timeout(&txp->upper.data,
stat, stat & E1000_TXD_STAT_DD,
- MSECOND / USECOND);
+ USEC_PER_MSEC);
if (ret)
dev_dbg(hw->dev, "e1000: tx timeout\n");
diff --git a/drivers/net/ksz9477.c b/drivers/net/ksz9477.c
index 99deaf6381..d9186b1177 100644
--- a/drivers/net/ksz9477.c
+++ b/drivers/net/ksz9477.c
@@ -200,7 +200,7 @@ static int ksz9477_switch_detect(struct ksz_switch *priv)
id_lo = (u8)(id32 >> 8);
if ((id_lo & 0xf) == 3) {
/* Chip is from KSZ9893 design. */
- dev_info(priv->dev, "Found KSZ9893\n");
+ dev_info(priv->dev, "Found KSZ9893 or compatible\n");
priv->features |= IS_9893;
priv->features &= ~KSZ9477_PHY_ERRATA;
@@ -552,6 +552,7 @@ static int microchip_switch_probe(struct device *dev)
}
static const struct of_device_id microchip_switch_dt_ids[] = {
+ { .compatible = "microchip,ksz8563" },
{ .compatible = "microchip,ksz9477" },
{ .compatible = "microchip,ksz9563" },
{ }
diff --git a/drivers/of/partition.c b/drivers/of/partition.c
index abbda674d6..ed11141930 100644
--- a/drivers/of/partition.c
+++ b/drivers/of/partition.c
@@ -67,11 +67,13 @@ struct cdev *of_parse_partition(struct cdev *cdev, struct device_node *node)
filename = basprintf("%s.%s", cdev->name, partname);
new = devfs_add_partition(cdev->name, offset, size, flags, filename);
- if (IS_ERR(new))
+ if (IS_ERR(new)) {
+ pr_err("Adding partition %s failed: %pe\n", filename, new);
new = NULL;
+ }
if (new)
- new->device_node = node;;
+ new->device_node = node;
if (IS_ENABLED(CONFIG_NVMEM) && of_device_is_compatible(node, "nvmem-cells")) {
struct nvmem_device *nvmem = nvmem_partition_register(new);
diff --git a/drivers/pinctrl/pinctrl-stm32.c b/drivers/pinctrl/pinctrl-stm32.c
index 5e6625072a..15d845e0ad 100644
--- a/drivers/pinctrl/pinctrl-stm32.c
+++ b/drivers/pinctrl/pinctrl-stm32.c
@@ -368,12 +368,6 @@ static int stm32_pinctrl_probe(struct device *dev)
dev_dbg(dev, "proceeding without hw spinlock support: (%d)\n",
ret);
- ret = pinctrl_register(&pinctrl->pdev);
- if (ret) {
- dev_dbg(dev, "pinctrl_register failed: (%d)\n", ret);
- return ret;
- }
-
gpio_bank = pinctrl->gpio_banks;
for_each_available_child_of_node(np, child) {
if (!of_property_read_bool(child, "gpio-controller"))
@@ -389,9 +383,7 @@ static int stm32_pinctrl_probe(struct device *dev)
gpio_bank++;
}
- dev_dbg(dev, "pinctrl/gpio driver registered\n");
-
- return 0;
+ return pinctrl_register(&pinctrl->pdev);
}
static __maybe_unused struct of_device_id stm32_pinctrl_dt_ids[] = {
diff --git a/drivers/regulator/rk808-regulator.c b/drivers/regulator/rk808-regulator.c
index 3da6cca294..8c96b99c9b 100644
--- a/drivers/regulator/rk808-regulator.c
+++ b/drivers/regulator/rk808-regulator.c
@@ -783,10 +783,9 @@ static int rk808_regulator_register(struct rk808 *rk808, int id,
cfg->rdev.regmap = rk808->regmap;
ret = of_regulator_register(&cfg->rdev, match->of_node);
- if (ret) {
- dev_err(dev, "failed to register %s regulator\n", match->name);
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to register %s regulator\n",
+ match->name);
dev_dbg(dev, "registered %s\n", match->name);
diff --git a/drivers/regulator/scmi-regulator.c b/drivers/regulator/scmi-regulator.c
index 22813ce662..2a007ac620 100644
--- a/drivers/regulator/scmi-regulator.c
+++ b/drivers/regulator/scmi-regulator.c
@@ -44,7 +44,7 @@ struct scmi_regulator {
struct scmi_device *sdev;
struct scmi_protocol_handle *ph;
struct regulator_dev rdev;
- struct device_node *device_node;
+ struct device_node *of_node;
struct scmi_reg_desc sdesc;
};
@@ -232,7 +232,7 @@ static int scmi_regulator_common_init(struct scmi_regulator *sreg)
*/
if (vinfo->negative_volts_allowed) {
dev_warn(dev, "Negative voltages NOT supported...skip %s\n",
- sreg->device_node->full_name);
+ sreg->of_node->full_name);
return -EOPNOTSUPP;
}
@@ -278,7 +278,7 @@ static int process_scmi_regulator_of_node(struct scmi_device *sdev,
rinfo->sregv[dom]->ph = ph;
/* get hold of good nodes */
- rinfo->sregv[dom]->device_node = np;
+ rinfo->sregv[dom]->of_node = np;
dev_dbg(&sdev->dev,
"Found SCMI Regulator entry -- OF node [%d] -> %s\n",
diff --git a/drivers/video/vpl.c b/drivers/video/vpl.c
index f94bd4a3e2..6d67861681 100644
--- a/drivers/video/vpl.c
+++ b/drivers/video/vpl.c
@@ -93,6 +93,7 @@ int vpl_ioctl(struct vpl *vpl, unsigned int port,
continue;
}
+ pr_debug("%s: looked up %s: %pS\n", __func__, remote->full_name, remote_vpl->ioctl);
ret = remote_vpl->ioctl(remote_vpl, remote_port_id, cmd, ptr);
if (ret)
return ret;
diff --git a/firmware/Kconfig b/firmware/Kconfig
index b4a6fd9137..1a5e1bf514 100644
--- a/firmware/Kconfig
+++ b/firmware/Kconfig
@@ -7,22 +7,22 @@ config EXTRA_FIRMWARE_DIR
default "firmware"
config FIRMWARE_IMX_LPDDR4_PMU_TRAIN
- bool
+ bool
config FIRMWARE_IMX_DDR4_PMU_TRAIN
- bool
+ bool
config FIRMWARE_IMX8MM_ATF
- bool
+ bool
config FIRMWARE_IMX8MN_ATF
- bool
+ bool
config FIRMWARE_IMX8MP_ATF
- bool
+ bool
config FIRMWARE_IMX8MQ_ATF
- bool
+ bool
config FIRMWARE_CCBV2_OPTEE
bool
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index 2beb9bb63e..acb70509d1 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -783,7 +783,11 @@ static inline void *phys_to_virt(unsigned long phys)
#endif
#ifndef IOMEM
+#ifndef __ASSEMBLY__
#define IOMEM(addr) ((void __force __iomem *)(addr))
+#else
+#define IOMEM(addr) addr
+#endif
#endif
#define __io_virt(x) ((void __force *)(x))
diff --git a/include/linux/iopoll.h b/include/linux/iopoll.h
index 8bf912e173..96b17dee48 100644
--- a/include/linux/iopoll.h
+++ b/include/linux/iopoll.h
@@ -32,13 +32,13 @@
#define read_poll_timeout(op, val, cond, timeout_us, args...) \
({ \
uint64_t start; \
- if (!IN_PBL && timeout_us) \
+ if (!IN_PBL && (timeout_us) != 0) \
start = get_time_ns(); \
for (;;) { \
(val) = op(args); \
if (cond) \
break; \
- if (!IN_PBL && timeout_us && \
+ if (!IN_PBL && (timeout_us) != 0 && \
is_timeout(start, ((timeout_us) * USECOND))) { \
(val) = op(args); \
break; \
diff --git a/include/mci.h b/include/mci.h
index 90d0a76347..d356f071f7 100644
--- a/include/mci.h
+++ b/include/mci.h
@@ -91,6 +91,8 @@
#define SD_CMD_APP_SEND_OP_COND 41
#define SD_CMD_APP_SEND_SCR 51
+#define SD_IO_SEND_OP_COND 5 /* bcr [23:0] OCR R4 */
+
/* SCR definitions in different words */
#define SD_HIGHSPEED_BUSY 0x00020000
#define SD_HIGHSPEED_SUPPORTED 0x00020000
@@ -308,8 +310,23 @@
#define EXT_CSD_DDR_BUS_WIDTH_8 6 /* Card is in 8 bit DDR mode */
#define R1_ILLEGAL_COMMAND (1 << 22)
+#define R1_STATUS(x) (x & 0xFFF9A000)
+#define R1_CURRENT_STATE(x) ((x & 0x00001E00) >> 9) /* sx, b (4 bits) */
+#define R1_READY_FOR_DATA (1 << 8) /* sx, a */
#define R1_APP_CMD (1 << 5)
+#define R1_STATUS_MASK (~0x0206BF7F)
+
+#define R1_STATE_IDLE 0
+#define R1_STATE_READY 1
+#define R1_STATE_IDENT 2
+#define R1_STATE_STBY 3
+#define R1_STATE_TRAN 4
+#define R1_STATE_DATA 5
+#define R1_STATE_RCV 6
+#define R1_STATE_PRG 7
+#define R1_STATE_DIS 8
+
#define R1_SPI_IDLE (1 << 0)
#define R1_SPI_ERASE_RESET (1 << 1)
#define R1_SPI_ILLEGAL_COMMAND (1 << 2)
@@ -326,6 +343,17 @@
#define MMC_RSP_BUSY (1 << 3) /* card may send busy */
#define MMC_RSP_OPCODE (1 << 4) /* response contains opcode */
+#define MMC_CMD_MASK (3 << 5) /* non-SPI command type */
+#define MMC_CMD_AC (0 << 5)
+#define MMC_CMD_ADTC (1 << 5)
+#define MMC_CMD_BC (2 << 5)
+#define MMC_CMD_BCR (3 << 5)
+
+#define MMC_RSP_SPI_S1 (1 << 7) /* one status byte */
+#define MMC_RSP_SPI_S2 (1 << 8) /* second byte */
+#define MMC_RSP_SPI_B4 (1 << 9) /* four data bytes */
+#define MMC_RSP_SPI_BUSY (1 << 10) /* card may send busy */
+
#define MMC_RSP_NONE (0)
#define MMC_RSP_R1 (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE)
#define MMC_RSP_R1b (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE|MMC_RSP_BUSY)
@@ -336,6 +364,19 @@
#define MMC_RSP_R6 (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE)
#define MMC_RSP_R7 (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE)
+/*
+ * These are the SPI response types for MMC, SD, and SDIO cards.
+ * Commands return R1, with maybe more info. Zero is an error type;
+ * callers must always provide the appropriate MMC_RSP_SPI_Rx flags.
+ */
+#define MMC_RSP_SPI_R1 (MMC_RSP_SPI_S1)
+#define MMC_RSP_SPI_R1B (MMC_RSP_SPI_S1|MMC_RSP_SPI_BUSY)
+#define MMC_RSP_SPI_R2 (MMC_RSP_SPI_S1|MMC_RSP_SPI_S2)
+#define MMC_RSP_SPI_R3 (MMC_RSP_SPI_S1|MMC_RSP_SPI_B4)
+#define MMC_RSP_SPI_R4 (MMC_RSP_SPI_S1|MMC_RSP_SPI_B4)
+#define MMC_RSP_SPI_R5 (MMC_RSP_SPI_S1|MMC_RSP_SPI_S2)
+#define MMC_RSP_SPI_R7 (MMC_RSP_SPI_S1|MMC_RSP_SPI_B4)
+
/** command information to be sent to the SD/MMC card */
struct mci_cmd {
unsigned cmdidx; /**< Command to be sent to the SD/MMC card */
@@ -407,6 +448,7 @@ struct mci_host {
int broken_cd; /**< card detect is broken */
bool non_removable; /**< device is non removable */
bool no_sd; /**< do not send SD commands during initialization */
+ bool no_sdio; /**< do not send SDIO commands during initialization */
bool disable_wp; /**< ignore write-protect detection logic */
struct regulator *supply;
@@ -445,6 +487,7 @@ struct mci {
struct mci_host *host; /**< the host for this card */
struct device dev; /**< the device for our disk (mcix) */
unsigned version;
+ bool sdio; /**< card is a SDIO card */
/** != 0 when a high capacity card is connected (OCR -> OCR_HCS) */
int high_capacity;
unsigned card_caps; /**< Card's capabilities */
diff --git a/pbl/Kconfig b/pbl/Kconfig
index ba809af2d5..91970c19bc 100644
--- a/pbl/Kconfig
+++ b/pbl/Kconfig
@@ -63,7 +63,7 @@ if IMAGE_COMPRESSION
choice
prompt "Compression"
- default IMAGE_COMPRESSION_LZO
+ default IMAGE_COMPRESSION_LZ4
config IMAGE_COMPRESSION_LZ4
bool "lz4"
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 85d18f07a2..6e0d92cf75 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -156,6 +156,10 @@ _c_flags += $(if $(patsubst n%,, \
PBL_CPPFLAGS += $(call cc-option,-fno-sanitize=all)
endif
+ifeq ($(CONFIG_DEBUG_PBL),y)
+PBL_CPPFLAGS += -DDEBUG
+endif
+
# If building barebox in a separate objtree expand all occurrences
# of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/').