aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/mach-bcm283x
diff options
context:
space:
mode:
authorVincent Fazio <vfazio@xes-inc.com>2021-09-14 13:19:18 -0500
committerPeter Robinson <pbrobinson@gmail.com>2023-03-24 14:43:20 +0000
commit0a36afa82356b89ffc66ed7557d115186c5bd7f1 (patch)
tree076a90713b5faf285461e6b17ba16a9491cc429b /arch/arm/mach-bcm283x
parent0e8c94054fd80535e868900deb978a9a1ebcab67 (diff)
downloadu-boot-0a36afa82356b89ffc66ed7557d115186c5bd7f1.zip
u-boot-0a36afa82356b89ffc66ed7557d115186c5bd7f1.tar.gz
u-boot-0a36afa82356b89ffc66ed7557d115186c5bd7f1.tar.bz2
arm: rpi: fallback to max clock rate for MMC clock
In rpi-firmware 25e2b597ebfb2495eab4816a276758dcc6ea21f1, the GET_CLOCK_RATE mailbox property was changed to return the last value set by SET_CLOCK_RATE. https://github.com/raspberrypi/firmware/issues/1619#issuecomment-917025502 Due to this change in firmware behavior, bcm2835_get_mmc_clock now returns a clock rate of zero since we do not issue SET_CLOCK_RATE. This results in degraded MMC performance. SET_CLOCK_RATE fixes the clock to a specific value and disables scaling so is not an ideal solution. Instead, fallback to GET_MAX_CLOCK_RATE in bcm2835_get_mmc_clock if GET_CLOCK_RATE returns zero. Signed-off-by: Vincent Fazio <vfazio@xes-inc.com> Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Diffstat (limited to 'arch/arm/mach-bcm283x')
-rw-r--r--arch/arm/mach-bcm283x/include/mach/mbox.h2
-rw-r--r--arch/arm/mach-bcm283x/msg.c19
2 files changed, 20 insertions, 1 deletions
diff --git a/arch/arm/mach-bcm283x/include/mach/mbox.h b/arch/arm/mach-bcm283x/include/mach/mbox.h
index 2ae2d3d..7dcac58 100644
--- a/arch/arm/mach-bcm283x/include/mach/mbox.h
+++ b/arch/arm/mach-bcm283x/include/mach/mbox.h
@@ -224,6 +224,8 @@ struct bcm2835_mbox_tag_set_power_state {
};
#define BCM2835_MBOX_TAG_GET_CLOCK_RATE 0x00030002
+#define BCM2835_MBOX_TAG_GET_MAX_CLOCK_RATE 0x00030004
+#define BCM2835_MBOX_TAG_GET_MIN_CLOCK_RATE 0x00030007
#define BCM2835_MBOX_CLOCK_ID_EMMC 1
#define BCM2835_MBOX_CLOCK_ID_UART 2
diff --git a/arch/arm/mach-bcm283x/msg.c b/arch/arm/mach-bcm283x/msg.c
index fe243e2..68b2773 100644
--- a/arch/arm/mach-bcm283x/msg.c
+++ b/arch/arm/mach-bcm283x/msg.c
@@ -75,6 +75,7 @@ int bcm2835_get_mmc_clock(u32 clock_id)
{
ALLOC_CACHE_ALIGN_BUFFER(struct msg_get_clock_rate, msg_clk, 1);
int ret;
+ u32 clock_rate = 0;
ret = bcm2835_power_on_module(BCM2835_MBOX_POWER_DEVID_SDHCI);
if (ret)
@@ -90,7 +91,23 @@ int bcm2835_get_mmc_clock(u32 clock_id)
return -EIO;
}
- return msg_clk->get_clock_rate.body.resp.rate_hz;
+ clock_rate = msg_clk->get_clock_rate.body.resp.rate_hz;
+
+ if (clock_rate == 0) {
+ BCM2835_MBOX_INIT_HDR(msg_clk);
+ BCM2835_MBOX_INIT_TAG(&msg_clk->get_clock_rate, GET_MAX_CLOCK_RATE);
+ msg_clk->get_clock_rate.body.req.clock_id = clock_id;
+
+ ret = bcm2835_mbox_call_prop(BCM2835_MBOX_PROP_CHAN, &msg_clk->hdr);
+ if (ret) {
+ printf("bcm2835: Could not query max eMMC clock rate\n");
+ return -EIO;
+ }
+
+ clock_rate = msg_clk->get_clock_rate.body.resp.rate_hz;
+ }
+
+ return clock_rate;
}
int bcm2835_get_video_size(int *widthp, int *heightp)