Browse Source

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
Tom Rini 4 years ago
parent
commit
fe16786149

+ 8 - 0
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;
+};

+ 2 - 0
arch/arm/mach-bcm283x/Kconfig

@@ -209,4 +209,6 @@ config SYS_SOC
 config SYS_CONFIG_NAME
 	default "rpi"
 
+source "board/raspberrypi/rpi/Kconfig"
+
 endmenu

+ 10 - 0
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

+ 2 - 1
board/raspberrypi/rpi/rpi.c

@@ -489,7 +489,8 @@ int ft_board_setup(void *blob, bd_t *bd)
 
 #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;

+ 1 - 0
configs/rpi_4_32b_defconfig

@@ -24,6 +24,7 @@ CONFIG_DFU_MMC=y
 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

+ 1 - 0
configs/rpi_4_defconfig

@@ -24,6 +24,7 @@ CONFIG_DFU_MMC=y
 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

+ 2 - 0
configs/rpi_arm64_defconfig

@@ -3,6 +3,7 @@ CONFIG_ARCH_BCM283X=y
 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_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 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

+ 9 - 8
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 @@ static void sdhci_prepare_dma(struct sdhci_host *host, struct mmc_data *data,
 					  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 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data)
 				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 @@ int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host,
 	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)) {

+ 4 - 1
drivers/net/bcmgenet.c

@@ -448,7 +448,10 @@ static int bcmgenet_adjust_link(struct bcmgenet_eth_priv *priv)
 	}
 
 	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));
 

+ 9 - 12
drivers/serial/serial_bcm283x_mu.c

@@ -74,16 +74,6 @@ out:
 	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 @@ static bool bcm283x_is_serial_muxed(void)
 	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 @@ static int bcm283x_mu_serial_ofdata_to_platdata(struct udevice *dev)
 	 */
 	plat->skip_init = true;
 
+	priv->regs = (struct bcm283x_mu_regs *)plat->base;
+
 	return 0;
 }
 #endif
@@ -195,7 +193,6 @@ U_BOOT_DRIVER(serial_bcm283x_mu) = {
 	.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,

+ 8 - 4
drivers/serial/serial_bcm283x_pl011.c

@@ -33,7 +33,7 @@ static bool bcm283x_is_serial_muxed(void)
 	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 @@ static int bcm283x_pl011_serial_ofdata_to_platdata(struct udevice *dev)
 	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 @@ static int bcm283x_pl011_serial_ofdata_to_platdata(struct udevice *dev)
 	 */
 	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 @@ U_BOOT_DRIVER(bcm283x_pl011_uart) = {
 	.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,