mirror of
https://xff.cz/git/u-boot/
synced 2025-09-02 01:02:19 +02:00
mmc: use core clock frequency in bcm2835 sdhost
In raspberrypi-firmware 7fdcd00e00a42a1c91e8bd6f5eb8352fe9358557 and later start.elf now sets the EMMC clock to 200 MHz. According to Phil Elwell in https://github.com/raspberrypi/firmware/issues/953 the SDHost controller shares the core/VPU clock and doesn't use the EMMC clock. Use the core clock id when determining the frequency to allow U-Boot to work with recent versions of raspberrypi-firmware. Otherwise U-Boot hangs at: U-Boot 2018.03 (Mar 14 2018 - 20:36:00 +1100) DRAM: 948 MiB RPI 3 Model B (0xa02082) MMC: mmc@7e202000: 0, sdhci@7e300000: 1 Loading Environment from FAT... Signed-off-by: Jonathan Gray <jsg@jsg.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
committed by
Alexander Graf
parent
79153ff0c4
commit
8ae1f82988
@@ -18,9 +18,10 @@ int bcm2835_power_on_module(u32 module);
|
|||||||
/**
|
/**
|
||||||
* bcm2835_get_mmc_clock() - get the frequency of the MMC clock
|
* bcm2835_get_mmc_clock() - get the frequency of the MMC clock
|
||||||
*
|
*
|
||||||
|
* @clock_id: ID of clock to get frequency for
|
||||||
* @return clock frequency, or -ve on error
|
* @return clock frequency, or -ve on error
|
||||||
*/
|
*/
|
||||||
int bcm2835_get_mmc_clock(void);
|
int bcm2835_get_mmc_clock(u32 clock_id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* bcm2835_get_video_size() - get the current display size
|
* bcm2835_get_video_size() - get the current display size
|
||||||
|
@@ -65,7 +65,7 @@ int bcm2835_power_on_module(u32 module)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bcm2835_get_mmc_clock(void)
|
int bcm2835_get_mmc_clock(u32 clock_id)
|
||||||
{
|
{
|
||||||
ALLOC_CACHE_ALIGN_BUFFER(struct msg_get_clock_rate, msg_clk, 1);
|
ALLOC_CACHE_ALIGN_BUFFER(struct msg_get_clock_rate, msg_clk, 1);
|
||||||
int ret;
|
int ret;
|
||||||
@@ -76,7 +76,7 @@ int bcm2835_get_mmc_clock(void)
|
|||||||
|
|
||||||
BCM2835_MBOX_INIT_HDR(msg_clk);
|
BCM2835_MBOX_INIT_HDR(msg_clk);
|
||||||
BCM2835_MBOX_INIT_TAG(&msg_clk->get_clock_rate, GET_CLOCK_RATE);
|
BCM2835_MBOX_INIT_TAG(&msg_clk->get_clock_rate, GET_CLOCK_RATE);
|
||||||
msg_clk->get_clock_rate.body.req.clock_id = BCM2835_MBOX_CLOCK_ID_EMMC;
|
msg_clk->get_clock_rate.body.req.clock_id = clock_id;
|
||||||
|
|
||||||
ret = bcm2835_mbox_call_prop(BCM2835_MBOX_PROP_CHAN, &msg_clk->hdr);
|
ret = bcm2835_mbox_call_prop(BCM2835_MBOX_PROP_CHAN, &msg_clk->hdr);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
@@ -183,7 +183,7 @@ static int bcm2835_sdhci_probe(struct udevice *dev)
|
|||||||
if (base == FDT_ADDR_T_NONE)
|
if (base == FDT_ADDR_T_NONE)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
ret = bcm2835_get_mmc_clock();
|
ret = bcm2835_get_mmc_clock(BCM2835_MBOX_CLOCK_ID_EMMC);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
debug("%s: Failed to set MMC clock (err=%d)\n", __func__, ret);
|
debug("%s: Failed to set MMC clock (err=%d)\n", __func__, ret);
|
||||||
return ret;
|
return ret;
|
||||||
|
@@ -35,6 +35,7 @@
|
|||||||
#include <dm.h>
|
#include <dm.h>
|
||||||
#include <mmc.h>
|
#include <mmc.h>
|
||||||
#include <asm/arch/msg.h>
|
#include <asm/arch/msg.h>
|
||||||
|
#include <asm/arch/mbox.h>
|
||||||
#include <asm/unaligned.h>
|
#include <asm/unaligned.h>
|
||||||
#include <linux/compat.h>
|
#include <linux/compat.h>
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
@@ -941,7 +942,7 @@ static int bcm2835_probe(struct udevice *dev)
|
|||||||
if (!host->ioaddr)
|
if (!host->ioaddr)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
host->max_clk = bcm2835_get_mmc_clock();
|
host->max_clk = bcm2835_get_mmc_clock(BCM2835_MBOX_CLOCK_ID_CORE);
|
||||||
|
|
||||||
bcm2835_add_host(host);
|
bcm2835_add_host(host);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user