Improvements for Raspberry Pi, AllWinner MMC perf, mvebu devices

This commit is contained in:
Peter Robinson 2018-04-06 16:34:45 +01:00
parent 7cac5dd637
commit ffcc253f44
6 changed files with 333 additions and 3 deletions

View File

@ -0,0 +1,35 @@
From patchwork Tue Mar 27 17:53:55 2018
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: [U-Boot] mmc: mv_sdhci: zero out sdhci_host structure
X-Patchwork-Submitter: Matt Pelland <mpelland@starry.com>
X-Patchwork-Id: 891784
Message-Id: <20180327175355.29633-1-mpelland@starry.com>
To: u-boot@lists.denx.de
Date: Tue, 27 Mar 2018 13:53:55 -0400
From: Matt Pelland <mpelland@starry.com>
List-Id: U-Boot discussion <u-boot.lists.denx.de>
The mv_sdhci driver was not zeroing the sdhci_host structure it
allocates causing random access violations in parts of the mmc core
where the "ops" member pointers are checked and called if not NULL.
Signed-off-by: Matt Pelland <mpelland@starry.com>
---
drivers/mmc/mv_sdhci.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/mmc/mv_sdhci.c b/drivers/mmc/mv_sdhci.c
index 69aa87babe..afc03f75a0 100644
--- a/drivers/mmc/mv_sdhci.c
+++ b/drivers/mmc/mv_sdhci.c
@@ -74,6 +74,8 @@ int mv_sdh_init(unsigned long regbase, u32 max_clk, u32 min_clk, u32 quirks)
return -ENOMEM;
}
+ memset(host, 0, sizeof(struct sdhci_host));
+
host->name = MVSDH_NAME;
host->ioaddr = (void *)regbase;
host->quirks = quirks;

View File

@ -0,0 +1,53 @@
From patchwork Tue Mar 27 17:18:25 2018
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: [U-Boot] net: mvneta: support setting hardware address
X-Patchwork-Submitter: Matt Pelland <mpelland@starry.com>
X-Patchwork-Id: 891783
Message-Id: <20180327171825.12742-1-mpelland@starry.com>
To: u-boot@lists.denx.de
Date: Tue, 27 Mar 2018 13:18:25 -0400
From: Matt Pelland <mpelland@starry.com>
List-Id: U-Boot discussion <u-boot.lists.denx.de>
mvneta already supports setting the MAC address but this was only done
internally when some other part of U-Boot tries to actually use the
interface. This commit exposes this functionality to the ethernet core
code so that the MAC addresses of all interfaces are configured
correctly even if they are not used before loading Linux.
Signed-off-by: Matt Pelland <mpelland@starry.com>
---
drivers/net/mvneta.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/net/mvneta.c b/drivers/net/mvneta.c
index 83e3153768..fdff772178 100644
--- a/drivers/net/mvneta.c
+++ b/drivers/net/mvneta.c
@@ -890,6 +890,16 @@ static void mvneta_mac_addr_set(struct mvneta_port *pp, unsigned char *addr,
mvneta_set_ucast_addr(pp, addr[5], queue);
}
+static int mvneta_write_hwaddr(struct udevice *dev)
+{
+ mvneta_mac_addr_set(
+ dev_get_priv(dev),
+ ((struct eth_pdata *)dev_get_platdata(dev))->enetaddr,
+ rxq_def);
+
+ return 0;
+}
+
/* Handle rx descriptor fill by setting buf_cookie and buf_phys_addr */
static void mvneta_rx_desc_fill(struct mvneta_rx_desc *rx_desc,
u32 phys_addr, u32 cookie)
@@ -1753,6 +1763,7 @@ static const struct eth_ops mvneta_ops = {
.send = mvneta_send,
.recv = mvneta_recv,
.stop = mvneta_stop,
+ .write_hwaddr = mvneta_write_hwaddr,
};
static int mvneta_ofdata_to_platdata(struct udevice *dev)

View File

@ -0,0 +1,53 @@
From patchwork Thu Apr 5 09:37:52 2018
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: [U-Boot] rpi: Allow to boot without serial
X-Patchwork-Submitter: Alexander Graf <agraf@suse.de>
X-Patchwork-Id: 895325
X-Patchwork-Delegate: agraf@suse.de
Message-Id: <20180405093752.32985-1-agraf@suse.de>
To: u-boot@lists.denx.de
Date: Thu, 5 Apr 2018 11:37:52 +0200
From: Alexander Graf <agraf@suse.de>
List-Id: U-Boot discussion <u-boot.lists.denx.de>
When we enable CONFIG_OF_BOARD on Raspberry Pis, we may end up without
serial console support in early boot. Hence we need to make the serial
port optional, otherwise we will never get to the point where serial
would be probed.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
configs/rpi_0_w_defconfig | 1 +
configs/rpi_2_defconfig | 1 +
configs/rpi_defconfig | 1 +
3 files changed, 3 insertions(+)
diff --git a/configs/rpi_0_w_defconfig b/configs/rpi_0_w_defconfig
index 04717d5e50..6e02cf34e9 100644
--- a/configs/rpi_0_w_defconfig
+++ b/configs/rpi_0_w_defconfig
@@ -34,3 +34,4 @@ CONFIG_SYS_WHITE_ON_BLACK=y
CONFIG_CONSOLE_SCROLL_LINES=10
CONFIG_PHYS_TO_BUS=y
CONFIG_OF_LIBFDT_OVERLAY=y
+# CONFIG_REQUIRE_SERIAL_CONSOLE is not set
diff --git a/configs/rpi_2_defconfig b/configs/rpi_2_defconfig
index f8203c9d47..dd3c60cc93 100644
--- a/configs/rpi_2_defconfig
+++ b/configs/rpi_2_defconfig
@@ -34,3 +34,4 @@ CONFIG_SYS_WHITE_ON_BLACK=y
CONFIG_CONSOLE_SCROLL_LINES=10
CONFIG_PHYS_TO_BUS=y
CONFIG_OF_LIBFDT_OVERLAY=y
+# CONFIG_REQUIRE_SERIAL_CONSOLE is not set
diff --git a/configs/rpi_defconfig b/configs/rpi_defconfig
index d13d3d3e2e..2c0412d8ea 100644
--- a/configs/rpi_defconfig
+++ b/configs/rpi_defconfig
@@ -34,3 +34,4 @@ CONFIG_SYS_WHITE_ON_BLACK=y
CONFIG_CONSOLE_SCROLL_LINES=10
CONFIG_PHYS_TO_BUS=y
CONFIG_OF_LIBFDT_OVERLAY=y
+# CONFIG_REQUIRE_SERIAL_CONSOLE is not set

View File

@ -0,0 +1,52 @@
From e8df52eda084c1610a2a3569960905e3aa2557c2 Mon Sep 17 00:00:00 2001
From: Peter Robinson <pbrobinson@gmail.com>
Date: Fri, 6 Apr 2018 16:27:26 +0100
Subject: [PATCH] rpi: Enable using the DT provided by the Raspberry Pi
firmware
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
---
configs/rpi_2_defconfig | 1 +
configs/rpi_3_32b_defconfig | 1 +
configs/rpi_3_defconfig | 1 +
3 files changed, 3 insertions(+)
diff --git a/configs/rpi_2_defconfig b/configs/rpi_2_defconfig
index dd3c60cc93..05aff1d700 100644
--- a/configs/rpi_2_defconfig
+++ b/configs/rpi_2_defconfig
@@ -13,6 +13,7 @@ CONFIG_CMD_GPIO=y
CONFIG_CMD_MMC=y
CONFIG_CMD_USB=y
CONFIG_OF_EMBED=y
+CONFIG_OF_BOARD=y
CONFIG_ENV_FAT_INTERFACE="mmc"
CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
CONFIG_DM_KEYBOARD=y
diff --git a/configs/rpi_3_32b_defconfig b/configs/rpi_3_32b_defconfig
index 4e59c14fdf..38704f67c9 100644
--- a/configs/rpi_3_32b_defconfig
+++ b/configs/rpi_3_32b_defconfig
@@ -14,6 +14,7 @@ CONFIG_CMD_GPIO=y
CONFIG_CMD_MMC=y
CONFIG_CMD_USB=y
CONFIG_OF_EMBED=y
+CONFIG_OF_BOARD=y
CONFIG_ENV_FAT_INTERFACE="mmc"
CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
CONFIG_DM_KEYBOARD=y
diff --git a/configs/rpi_3_defconfig b/configs/rpi_3_defconfig
index 810b60344f..4f1509f4ee 100644
--- a/configs/rpi_3_defconfig
+++ b/configs/rpi_3_defconfig
@@ -14,6 +14,7 @@ CONFIG_CMD_GPIO=y
CONFIG_CMD_MMC=y
CONFIG_CMD_USB=y
CONFIG_OF_EMBED=y
+CONFIG_OF_BOARD=y
CONFIG_ENV_FAT_INTERFACE="mmc"
CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
CONFIG_DM_KEYBOARD=y
--
2.17.0

View File

@ -0,0 +1,128 @@
From patchwork Wed Mar 21 11:18:58 2018
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [U-Boot] sunxi: improve throughput in the sunxi_mmc driver
X-Patchwork-Submitter: Maxime Ripard <maxime.ripard@bootlin.com>
X-Patchwork-Id: 888703
X-Patchwork-Delegate: jagannadh.teki@gmail.com
Message-Id: <20180321111858.16576-1-maxime.ripard@bootlin.com>
To: Jaehoon Chung <jh80.chung@samsung.com>
Cc: Mylene Josserand <mylene.josserand@bootlin.com>,
Maxime Ripard <maxime.ripard@bootlin.com>, u-boot@lists.denx.de,
Jagan Teki <jagan@openedev.com>
Date: Wed, 21 Mar 2018 12:18:58 +0100
From: Maxime Ripard <maxime.ripard@bootlin.com>
List-Id: U-Boot discussion <u-boot.lists.denx.de>
From: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Throughput tests have shown the sunxi_mmc driver to take over 10s to
read 10MB from a fast eMMC device due to excessive delays in polling
loops.
This commit restructures the main polling loops to use get_timer(...)
to determine whether a (millisecond) timeout has expired. We choose
not to use the wait_bit function, as we don't need interruptability
with ctrl-c and have at least one case where two bits (one for an
error condition and another one for completion) need to be read and
using wait_bit would have not added to the clarity.
The observed speedup in testing on a A31 is greater than 10x (e.g. a
10MB write decreases from 9.302s to 0.884s).
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Tested-by: Mylène Josserand <mylene.josserand@bootlin.com>
---
drivers/mmc/sunxi_mmc.c | 27 ++++++++++++++++-----------
1 file changed, 16 insertions(+), 11 deletions(-)
diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c
index 4edb4be46c81..d36c1689e7b1 100644
--- a/drivers/mmc/sunxi_mmc.c
+++ b/drivers/mmc/sunxi_mmc.c
@@ -187,15 +187,16 @@ static int mmc_update_clk(struct sunxi_mmc_priv *priv)
{
unsigned int cmd;
unsigned timeout_msecs = 2000;
+ unsigned long start = get_timer(0);
cmd = SUNXI_MMC_CMD_START |
SUNXI_MMC_CMD_UPCLK_ONLY |
SUNXI_MMC_CMD_WAIT_PRE_OVER;
+
writel(cmd, &priv->reg->cmd);
while (readl(&priv->reg->cmd) & SUNXI_MMC_CMD_START) {
- if (!timeout_msecs--)
+ if (get_timer(start) > timeout_msecs)
return -1;
- udelay(1000);
}
/* clock update sets various irq status bits, clear these */
@@ -276,18 +277,21 @@ static int mmc_trans_data_by_cpu(struct sunxi_mmc_priv *priv, struct mmc *mmc,
unsigned i;
unsigned *buff = (unsigned int *)(reading ? data->dest : data->src);
unsigned byte_cnt = data->blocksize * data->blocks;
- unsigned timeout_usecs = (byte_cnt >> 8) * 1000;
- if (timeout_usecs < 2000000)
- timeout_usecs = 2000000;
+ unsigned timeout_msecs = byte_cnt >> 8;
+ unsigned long start;
+
+ if (timeout_msecs < 2000)
+ timeout_msecs = 2000;
/* Always read / write data through the CPU */
setbits_le32(&priv->reg->gctrl, SUNXI_MMC_GCTRL_ACCESS_BY_AHB);
+ start = get_timer(0);
+
for (i = 0; i < (byte_cnt >> 2); i++) {
while (readl(&priv->reg->status) & status_bit) {
- if (!timeout_usecs--)
+ if (get_timer(start) > timeout_msecs)
return -1;
- udelay(1);
}
if (reading)
@@ -303,16 +307,16 @@ static int mmc_rint_wait(struct sunxi_mmc_priv *priv, struct mmc *mmc,
uint timeout_msecs, uint done_bit, const char *what)
{
unsigned int status;
+ unsigned long start = get_timer(0);
do {
status = readl(&priv->reg->rint);
- if (!timeout_msecs-- ||
+ if ((get_timer(start) > timeout_msecs) ||
(status & SUNXI_MMC_RINT_INTERRUPT_ERROR_BIT)) {
debug("%s timeout %x\n", what,
status & SUNXI_MMC_RINT_INTERRUPT_ERROR_BIT);
return -ETIMEDOUT;
}
- udelay(1000);
} while (!(status & done_bit));
return 0;
@@ -404,15 +408,16 @@ static int sunxi_mmc_send_cmd_common(struct sunxi_mmc_priv *priv,
}
if (cmd->resp_type & MMC_RSP_BUSY) {
+ unsigned long start = get_timer(0);
timeout_msecs = 2000;
+
do {
status = readl(&priv->reg->status);
- if (!timeout_msecs--) {
+ if (get_timer(start) > timeout_msecs) {
debug("busy timeout\n");
error = -ETIMEDOUT;
goto out;
}
- udelay(1000);
} while (status & SUNXI_MMC_STATUS_CARD_DATA_BUSY);
}

View File

@ -2,7 +2,7 @@
Name: uboot-tools
Version: 2018.03
Release: 3%{?candidate:.%{candidate}}%{?dist}
Release: 4%{?candidate:.%{candidate}}%{?dist}
Summary: U-Boot utilities
License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+
URL: http://www.denx.de/wiki/U-Boot
@ -30,8 +30,14 @@ Patch10: dragonboard-fixes.patch
Patch11: BeagleBoard.org-PocketBeagle.patch
Patch12: mx6cuboxi-add-support-for-detecting-Revision-1.5-SoM.patch
Patch13: rpi-3-plus-support.patch
Patch14: mmc-use-core-clock-frequency-in-bcm2835-sdhost.patch
# Patch19: mvebu-enable-generic-distro-boot-config.patch
Patch14: rpi-Allow-to-boot-without-serial.patch
Patch15: rpi-Enable-using-the-DT-provided-by-the-Raspberry-Pi.patch
Patch16: mmc-use-core-clock-frequency-in-bcm2835-sdhost.patch
Patch19: mmc-mv_sdhci-zero-out-sdhci_host-structure.patch
Patch20: mvneta-support-setting-hardware-address.patch
Patch21: sunxi-improve-throughput-in-the-sunxi_mmc-driver.patch
# Patch99: mvebu-enable-generic-distro-boot-config.patch
BuildRequires: bc
BuildRequires: dtc
@ -290,6 +296,9 @@ cp -p board/warp7/README builds/docs/README.warp7
%endif
%changelog
* Fri Apr 6 2018 Peter Robinson <pbrobinson@fedoraproject.org> 2018.03-4
- Improvements for Raspberry Pi, AllWinner MMC perf, mvebu devices
* Tue Mar 20 2018 Peter Robinson <pbrobinson@fedoraproject.org> 2018.03-3
- Fix issue with certain MMC cards on Raspberry Pi