Merge tag 'rpi-next-2020.07' of https://gitlab.denx.de/u-boot/custodians/u-boot-raspberrypi
- fix phy configuration for RPi4's bcmgenet
- sync RPi4's env size with other RPi configs
- add kconfig option to reserver more pages in the EFI mem map
- add support for SDMA which is used by RPi4
- fix corner case boot bug for RPi3 32-bit
diff --git a/arch/arm/dts/bcm283x-u-boot.dtsi b/arch/arm/dts/bcm283x-u-boot.dtsi
index 36548da..68d0362 100644
--- a/arch/arm/dts/bcm283x-u-boot.dtsi
+++ b/arch/arm/dts/bcm283x-u-boot.dtsi
@@ -19,3 +19,11 @@
&gpio {
u-boot,dm-pre-reloc;
};
+
+&uart0_gpio14 {
+ u-boot,dm-pre-reloc;
+};
+
+&uart1_gpio14 {
+ u-boot,dm-pre-reloc;
+};
diff --git a/arch/arm/mach-bcm283x/Kconfig b/arch/arm/mach-bcm283x/Kconfig
index 00419bf..e6eb904 100644
--- a/arch/arm/mach-bcm283x/Kconfig
+++ b/arch/arm/mach-bcm283x/Kconfig
@@ -209,4 +209,6 @@
config SYS_CONFIG_NAME
default "rpi"
+source "board/raspberrypi/rpi/Kconfig"
+
endmenu
diff --git a/board/raspberrypi/rpi/Kconfig b/board/raspberrypi/rpi/Kconfig
new file mode 100644
index 0000000..e40088f
--- /dev/null
+++ b/board/raspberrypi/rpi/Kconfig
@@ -0,0 +1,10 @@
+if SYS_BOARD = "rpi"
+
+config RPI_EFI_NR_SPIN_PAGES
+ int "Spin table page count"
+ default 1
+ help
+ Number of pages to reserve starting at page 0 for spin tables in the EFI
+ memory map
+
+endif
diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
index e367ba3..0206a09 100644
--- a/board/raspberrypi/rpi/rpi.c
+++ b/board/raspberrypi/rpi/rpi.c
@@ -489,7 +489,8 @@
#ifdef CONFIG_EFI_LOADER
/* Reserve the spin table */
- efi_add_memory_map(0, 1, EFI_RESERVED_MEMORY_TYPE, 0);
+ efi_add_memory_map(0, CONFIG_RPI_EFI_NR_SPIN_PAGES,
+ EFI_RESERVED_MEMORY_TYPE, 0);
#endif
return 0;
diff --git a/configs/rpi_4_32b_defconfig b/configs/rpi_4_32b_defconfig
index 8d262d8..52bdd0a 100644
--- a/configs/rpi_4_32b_defconfig
+++ b/configs/rpi_4_32b_defconfig
@@ -24,6 +24,7 @@
CONFIG_DM_KEYBOARD=y
CONFIG_DM_MMC=y
CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_SDMA=y
CONFIG_MMC_SDHCI_BCM2835=y
CONFIG_DM_ETH=y
CONFIG_BCMGENET=y
diff --git a/configs/rpi_4_defconfig b/configs/rpi_4_defconfig
index 2a0cea4..2ce1b6b 100644
--- a/configs/rpi_4_defconfig
+++ b/configs/rpi_4_defconfig
@@ -24,6 +24,7 @@
CONFIG_DM_KEYBOARD=y
CONFIG_DM_MMC=y
CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_SDMA=y
CONFIG_MMC_SDHCI_BCM2835=y
CONFIG_DM_ETH=y
CONFIG_BCMGENET=y
diff --git a/configs/rpi_arm64_defconfig b/configs/rpi_arm64_defconfig
index d2406ca..66c4a53 100644
--- a/configs/rpi_arm64_defconfig
+++ b/configs/rpi_arm64_defconfig
@@ -3,6 +3,7 @@
CONFIG_SYS_TEXT_BASE=0x00080000
CONFIG_TARGET_RPI_ARM64=y
CONFIG_SYS_MALLOC_F_LEN=0x2000
+CONFIG_ENV_SIZE=0x4000
CONFIG_NR_DRAM_BANKS=2
CONFIG_DISTRO_DEFAULTS=y
CONFIG_OF_BOARD_SETUP=y
@@ -22,6 +23,7 @@
CONFIG_DM_KEYBOARD=y
CONFIG_DM_MMC=y
CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_SDMA=y
CONFIG_MMC_SDHCI_BCM2835=y
CONFIG_DM_ETH=y
CONFIG_BCMGENET=y
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index 372dc0a..8bb4393 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -16,6 +16,7 @@
#include <sdhci.h>
#include <dm.h>
#include <linux/dma-mapping.h>
+#include <phys2bus.h>
static void sdhci_reset(struct sdhci_host *host, u8 mask)
{
@@ -150,7 +151,8 @@
mmc_get_dma_dir(data));
if (host->flags & USE_SDMA) {
- sdhci_writel(host, host->start_addr, SDHCI_DMA_ADDRESS);
+ sdhci_writel(host, phys_to_bus((ulong)host->start_addr),
+ SDHCI_DMA_ADDRESS);
} else if (host->flags & (USE_ADMA | USE_ADMA64)) {
sdhci_prepare_adma_table(host, data);
@@ -204,7 +206,7 @@
start_addr &=
~(SDHCI_DEFAULT_BOUNDARY_SIZE - 1);
start_addr += SDHCI_DEFAULT_BOUNDARY_SIZE;
- sdhci_writel(host, start_addr,
+ sdhci_writel(host, phys_to_bus((ulong)start_addr),
SDHCI_DMA_ADDRESS);
}
}
@@ -739,13 +741,12 @@
debug("%s, caps: 0x%x\n", __func__, caps);
#ifdef CONFIG_MMC_SDHCI_SDMA
- if (!(caps & SDHCI_CAN_DO_SDMA)) {
- printf("%s: Your controller doesn't support SDMA!!\n",
- __func__);
- return -EINVAL;
+ if ((caps & SDHCI_CAN_DO_SDMA)) {
+ host->flags |= USE_SDMA;
+ } else {
+ debug("%s: Your controller doesn't support SDMA!!\n",
+ __func__);
}
-
- host->flags |= USE_SDMA;
#endif
#if CONFIG_IS_ENABLED(MMC_SDHCI_ADMA)
if (!(caps & SDHCI_CAN_DO_ADMA2)) {
diff --git a/drivers/net/bcmgenet.c b/drivers/net/bcmgenet.c
index 8f4848a..e971b55 100644
--- a/drivers/net/bcmgenet.c
+++ b/drivers/net/bcmgenet.c
@@ -448,7 +448,10 @@
}
clrsetbits_32(priv->mac_reg + EXT_RGMII_OOB_CTRL, OOB_DISABLE,
- RGMII_LINK | RGMII_MODE_EN | ID_MODE_DIS);
+ RGMII_LINK | RGMII_MODE_EN);
+
+ if (phy_dev->interface == PHY_INTERFACE_MODE_RGMII)
+ setbits_32(priv->mac_reg + EXT_RGMII_OOB_CTRL, ID_MODE_DIS);
writel(speed << CMD_SPEED_SHIFT, (priv->mac_reg + UMAC_CMD));
diff --git a/drivers/serial/serial_bcm283x_mu.c b/drivers/serial/serial_bcm283x_mu.c
index a6ffc84..febb5ce 100644
--- a/drivers/serial/serial_bcm283x_mu.c
+++ b/drivers/serial/serial_bcm283x_mu.c
@@ -74,16 +74,6 @@
return 0;
}
-static int bcm283x_mu_serial_probe(struct udevice *dev)
-{
- struct bcm283x_mu_serial_platdata *plat = dev_get_platdata(dev);
- struct bcm283x_mu_priv *priv = dev_get_priv(dev);
-
- priv->regs = (struct bcm283x_mu_regs *)plat->base;
-
- return 0;
-}
-
static int bcm283x_mu_serial_getc(struct udevice *dev)
{
struct bcm283x_mu_priv *priv = dev_get_priv(dev);
@@ -165,15 +155,21 @@
return true;
}
-static int bcm283x_mu_serial_ofdata_to_platdata(struct udevice *dev)
+static int bcm283x_mu_serial_probe(struct udevice *dev)
{
struct bcm283x_mu_serial_platdata *plat = dev_get_platdata(dev);
+ struct bcm283x_mu_priv *priv = dev_get_priv(dev);
fdt_addr_t addr;
/* Don't spawn the device if it's not muxed */
if (!bcm283x_is_serial_muxed())
return -ENODEV;
+ /*
+ * Read the ofdata here rather than in an ofdata_to_platdata() method
+ * since we need the soc simple-bus to be probed so that the 'ranges'
+ * property is used.
+ */
addr = devfdt_get_addr(dev);
if (addr == FDT_ADDR_T_NONE)
return -EINVAL;
@@ -187,6 +183,8 @@
*/
plat->skip_init = true;
+ priv->regs = (struct bcm283x_mu_regs *)plat->base;
+
return 0;
}
#endif
@@ -195,7 +193,6 @@
.name = "serial_bcm283x_mu",
.id = UCLASS_SERIAL,
.of_match = of_match_ptr(bcm283x_mu_serial_id),
- .ofdata_to_platdata = of_match_ptr(bcm283x_mu_serial_ofdata_to_platdata),
.platdata_auto_alloc_size = sizeof(struct bcm283x_mu_serial_platdata),
.probe = bcm283x_mu_serial_probe,
.ops = &bcm283x_mu_serial_ops,
diff --git a/drivers/serial/serial_bcm283x_pl011.c b/drivers/serial/serial_bcm283x_pl011.c
index 7d8ab7b..923f402 100644
--- a/drivers/serial/serial_bcm283x_pl011.c
+++ b/drivers/serial/serial_bcm283x_pl011.c
@@ -33,7 +33,7 @@
return true;
}
-static int bcm283x_pl011_serial_ofdata_to_platdata(struct udevice *dev)
+static int bcm283x_pl011_serial_probe(struct udevice *dev)
{
struct pl01x_serial_platdata *plat = dev_get_platdata(dev);
int ret;
@@ -42,6 +42,11 @@
if (!bcm283x_is_serial_muxed())
return -ENODEV;
+ /*
+ * Read the ofdata here rather than in an ofdata_to_platdata() method
+ * since we need the soc simple-bus to be probed so that the 'ranges'
+ * property is used.
+ */
ret = pl01x_serial_ofdata_to_platdata(dev);
if (ret)
return ret;
@@ -52,7 +57,7 @@
*/
plat->skip_init = true;
- return 0;
+ return pl01x_serial_probe(dev);
}
static int bcm283x_pl011_serial_setbrg(struct udevice *dev, int baudrate)
@@ -86,9 +91,8 @@
.name = "bcm283x_pl011",
.id = UCLASS_SERIAL,
.of_match = of_match_ptr(bcm283x_pl011_serial_id),
- .ofdata_to_platdata = of_match_ptr(bcm283x_pl011_serial_ofdata_to_platdata),
+ .probe = bcm283x_pl011_serial_probe,
.platdata_auto_alloc_size = sizeof(struct pl01x_serial_platdata),
- .probe = pl01x_serial_probe,
.ops = &bcm283x_pl011_serial_ops,
#if !CONFIG_IS_ENABLED(OF_CONTROL) || CONFIG_IS_ENABLED(OF_BOARD)
.flags = DM_FLAG_PRE_RELOC,