2012-08-05 16:07:22 +00:00
|
|
|
/*
|
2015-02-16 19:16:15 +00:00
|
|
|
* (C) Copyright 2012-2013,2015 Stephen Warren
|
2012-08-05 16:07:22 +00:00
|
|
|
*
|
2015-02-16 19:16:13 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0
|
2012-08-05 16:07:22 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2013-05-27 18:31:18 +00:00
|
|
|
#include <config.h>
|
2014-09-22 23:30:56 +00:00
|
|
|
#include <dm.h>
|
2014-07-13 20:01:51 +00:00
|
|
|
#include <fdt_support.h>
|
2015-02-03 11:32:31 +00:00
|
|
|
#include <fdt_simplefb.h>
|
2013-05-27 18:31:18 +00:00
|
|
|
#include <lcd.h>
|
2015-09-02 23:24:58 +00:00
|
|
|
#include <memalign.h>
|
2014-07-13 20:01:51 +00:00
|
|
|
#include <mmc.h>
|
2014-09-22 23:30:56 +00:00
|
|
|
#include <asm/gpio.h>
|
2013-01-29 16:37:37 +00:00
|
|
|
#include <asm/arch/mbox.h>
|
2013-01-29 16:37:42 +00:00
|
|
|
#include <asm/arch/sdhci.h>
|
2012-08-05 16:07:22 +00:00
|
|
|
#include <asm/global_data.h>
|
2014-11-25 04:36:34 +00:00
|
|
|
#include <dm/platform_data/serial_pl01x.h>
|
2012-08-05 16:07:22 +00:00
|
|
|
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
|
2014-09-22 23:30:56 +00:00
|
|
|
static const struct bcm2835_gpio_platdata gpio_platdata = {
|
|
|
|
.base = BCM2835_GPIO_BASE,
|
|
|
|
};
|
|
|
|
|
|
|
|
U_BOOT_DEVICE(bcm2835_gpios) = {
|
|
|
|
.name = "gpio_bcm2835",
|
|
|
|
.platdata = &gpio_platdata,
|
|
|
|
};
|
|
|
|
|
2014-11-25 04:36:34 +00:00
|
|
|
static const struct pl01x_serial_platdata serial_platdata = {
|
2015-02-16 19:16:15 +00:00
|
|
|
#ifdef CONFIG_BCM2836
|
|
|
|
.base = 0x3f201000,
|
|
|
|
#else
|
2014-11-25 04:36:34 +00:00
|
|
|
.base = 0x20201000,
|
2015-02-16 19:16:15 +00:00
|
|
|
#endif
|
2014-11-25 04:36:34 +00:00
|
|
|
.type = TYPE_PL011,
|
|
|
|
.clock = 3000000,
|
|
|
|
};
|
|
|
|
|
|
|
|
U_BOOT_DEVICE(bcm2835_serials) = {
|
|
|
|
.name = "serial_pl01x",
|
|
|
|
.platdata = &serial_platdata,
|
|
|
|
};
|
|
|
|
|
2013-01-29 16:37:37 +00:00
|
|
|
struct msg_get_arm_mem {
|
|
|
|
struct bcm2835_mbox_hdr hdr;
|
|
|
|
struct bcm2835_mbox_tag_get_arm_mem get_arm_mem;
|
|
|
|
u32 end_tag;
|
|
|
|
};
|
|
|
|
|
2014-11-19 04:40:21 +00:00
|
|
|
struct msg_get_board_rev {
|
|
|
|
struct bcm2835_mbox_hdr hdr;
|
|
|
|
struct bcm2835_mbox_tag_get_board_rev get_board_rev;
|
|
|
|
u32 end_tag;
|
|
|
|
};
|
|
|
|
|
2014-09-27 02:51:39 +00:00
|
|
|
struct msg_get_mac_address {
|
|
|
|
struct bcm2835_mbox_hdr hdr;
|
|
|
|
struct bcm2835_mbox_tag_get_mac_address get_mac_address;
|
|
|
|
u32 end_tag;
|
|
|
|
};
|
|
|
|
|
2014-01-14 02:50:11 +00:00
|
|
|
struct msg_set_power_state {
|
|
|
|
struct bcm2835_mbox_hdr hdr;
|
|
|
|
struct bcm2835_mbox_tag_set_power_state set_power_state;
|
|
|
|
u32 end_tag;
|
|
|
|
};
|
|
|
|
|
2013-01-29 16:37:42 +00:00
|
|
|
struct msg_get_clock_rate {
|
|
|
|
struct bcm2835_mbox_hdr hdr;
|
|
|
|
struct bcm2835_mbox_tag_get_clock_rate get_clock_rate;
|
|
|
|
u32 end_tag;
|
|
|
|
};
|
|
|
|
|
2015-12-05 05:07:44 +00:00
|
|
|
/*
|
|
|
|
* http://raspberryalphaomega.org.uk/2013/02/06/automatic-raspberry-pi-board-revision-detection-model-a-b1-and-b2/
|
|
|
|
* http://www.raspberrypi.org/forums/viewtopic.php?f=63&t=32733
|
2015-12-05 05:07:45 +00:00
|
|
|
* http://git.drogon.net/?p=wiringPi;a=blob;f=wiringPi/wiringPi.c;h=503151f61014418b9c42f4476a6086f75cd4e64b;hb=refs/heads/master#l922
|
2016-01-29 05:24:44 +00:00
|
|
|
*
|
|
|
|
* In http://lists.denx.de/pipermail/u-boot/2016-January/243752.html
|
|
|
|
* ("[U-Boot] [PATCH] rpi: fix up Model B entries") Dom Cobley at the RPi
|
|
|
|
* Foundation stated that the following source was accurate:
|
|
|
|
* https://github.com/AndrewFromMelbourne/raspberry_pi_revision
|
2015-12-05 05:07:44 +00:00
|
|
|
*/
|
2015-12-05 05:07:45 +00:00
|
|
|
struct rpi_model {
|
2014-11-19 04:40:21 +00:00
|
|
|
const char *name;
|
|
|
|
const char *fdtfile;
|
2014-12-06 03:56:46 +00:00
|
|
|
bool has_onboard_eth;
|
2015-12-05 05:07:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const struct rpi_model rpi_model_unknown = {
|
|
|
|
"Unknown model",
|
2015-02-16 19:16:15 +00:00
|
|
|
#ifdef CONFIG_BCM2836
|
2015-12-05 05:07:45 +00:00
|
|
|
"bcm2836-rpi-other.dtb",
|
2015-02-16 19:16:15 +00:00
|
|
|
#else
|
2015-12-05 05:07:45 +00:00
|
|
|
"bcm2835-rpi-other.dtb",
|
2015-02-16 19:16:15 +00:00
|
|
|
#endif
|
2015-12-05 05:07:45 +00:00
|
|
|
false,
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct rpi_model rpi_models_new_scheme[] = {
|
2015-12-05 05:07:44 +00:00
|
|
|
[0x4] = {
|
2015-02-16 19:16:15 +00:00
|
|
|
"2 Model B",
|
|
|
|
"bcm2836-rpi-2-b.dtb",
|
|
|
|
true,
|
|
|
|
},
|
2015-12-05 05:07:46 +00:00
|
|
|
[0x9] = {
|
|
|
|
"Zero",
|
|
|
|
"bcm2835-rpi-zero.dtb",
|
|
|
|
false,
|
|
|
|
},
|
2015-12-05 05:07:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const struct rpi_model rpi_models_old_scheme[] = {
|
2015-12-05 05:07:44 +00:00
|
|
|
[0x2] = {
|
2016-01-29 08:35:52 +00:00
|
|
|
"Model B",
|
|
|
|
"bcm2835-rpi-b.dtb",
|
2014-12-06 03:56:46 +00:00
|
|
|
true,
|
2014-11-19 04:40:21 +00:00
|
|
|
},
|
2015-12-05 05:07:44 +00:00
|
|
|
[0x3] = {
|
2016-01-29 08:35:52 +00:00
|
|
|
"Model B",
|
|
|
|
"bcm2835-rpi-b.dtb",
|
2014-12-06 03:56:46 +00:00
|
|
|
true,
|
2014-11-19 04:40:21 +00:00
|
|
|
},
|
2015-12-05 05:07:44 +00:00
|
|
|
[0x4] = {
|
2016-01-29 08:35:52 +00:00
|
|
|
"Model B rev2",
|
|
|
|
"bcm2835-rpi-b-rev2.dtb",
|
2014-12-06 03:56:46 +00:00
|
|
|
true,
|
2014-11-19 04:40:21 +00:00
|
|
|
},
|
2015-12-05 05:07:44 +00:00
|
|
|
[0x5] = {
|
2016-01-29 08:35:52 +00:00
|
|
|
"Model B rev2",
|
|
|
|
"bcm2835-rpi-b-rev2.dtb",
|
2014-12-06 03:56:46 +00:00
|
|
|
true,
|
2014-11-19 04:40:21 +00:00
|
|
|
},
|
2015-12-05 05:07:44 +00:00
|
|
|
[0x6] = {
|
2016-01-29 08:35:52 +00:00
|
|
|
"Model B rev2",
|
|
|
|
"bcm2835-rpi-b-rev2.dtb",
|
2014-12-06 03:56:46 +00:00
|
|
|
true,
|
2014-11-19 04:40:21 +00:00
|
|
|
},
|
2015-12-05 05:07:44 +00:00
|
|
|
[0x7] = {
|
2014-11-19 04:40:21 +00:00
|
|
|
"Model A",
|
|
|
|
"bcm2835-rpi-a.dtb",
|
2014-12-06 03:56:46 +00:00
|
|
|
false,
|
2014-11-19 04:40:21 +00:00
|
|
|
},
|
2015-12-05 05:07:44 +00:00
|
|
|
[0x8] = {
|
2014-11-19 04:40:21 +00:00
|
|
|
"Model A",
|
|
|
|
"bcm2835-rpi-a.dtb",
|
2014-12-06 03:56:46 +00:00
|
|
|
false,
|
2014-11-19 04:40:21 +00:00
|
|
|
},
|
2015-12-05 05:07:44 +00:00
|
|
|
[0x9] = {
|
2014-11-19 04:40:21 +00:00
|
|
|
"Model A",
|
|
|
|
"bcm2835-rpi-a.dtb",
|
2014-12-06 03:56:46 +00:00
|
|
|
false,
|
2014-11-19 04:40:21 +00:00
|
|
|
},
|
2015-12-05 05:07:44 +00:00
|
|
|
[0xd] = {
|
2014-11-19 04:40:21 +00:00
|
|
|
"Model B rev2",
|
|
|
|
"bcm2835-rpi-b-rev2.dtb",
|
2014-12-06 03:56:46 +00:00
|
|
|
true,
|
2014-11-19 04:40:21 +00:00
|
|
|
},
|
2015-12-05 05:07:44 +00:00
|
|
|
[0xe] = {
|
2014-11-19 04:40:21 +00:00
|
|
|
"Model B rev2",
|
|
|
|
"bcm2835-rpi-b-rev2.dtb",
|
2014-12-06 03:56:46 +00:00
|
|
|
true,
|
2014-11-19 04:40:21 +00:00
|
|
|
},
|
2015-12-05 05:07:44 +00:00
|
|
|
[0xf] = {
|
2014-11-19 04:40:21 +00:00
|
|
|
"Model B rev2",
|
|
|
|
"bcm2835-rpi-b-rev2.dtb",
|
2014-12-06 03:56:46 +00:00
|
|
|
true,
|
2014-11-19 04:40:21 +00:00
|
|
|
},
|
2015-12-05 05:07:44 +00:00
|
|
|
[0x10] = {
|
2014-11-19 04:40:21 +00:00
|
|
|
"Model B+",
|
|
|
|
"bcm2835-rpi-b-plus.dtb",
|
2014-12-06 03:56:46 +00:00
|
|
|
true,
|
2014-11-19 04:40:21 +00:00
|
|
|
},
|
2015-12-05 05:07:44 +00:00
|
|
|
[0x11] = {
|
2014-11-19 04:40:21 +00:00
|
|
|
"Compute Module",
|
|
|
|
"bcm2835-rpi-cm.dtb",
|
2014-12-06 03:56:46 +00:00
|
|
|
false,
|
2014-11-19 04:40:21 +00:00
|
|
|
},
|
2015-12-05 05:07:44 +00:00
|
|
|
[0x12] = {
|
2014-12-24 03:01:43 +00:00
|
|
|
"Model A+",
|
|
|
|
"bcm2835-rpi-a-plus.dtb",
|
|
|
|
false,
|
|
|
|
},
|
2015-12-05 05:07:44 +00:00
|
|
|
[0x13] = {
|
2015-04-13 03:43:25 +00:00
|
|
|
"Model B+",
|
|
|
|
"bcm2835-rpi-b-plus.dtb",
|
|
|
|
true,
|
|
|
|
},
|
2015-12-05 05:07:44 +00:00
|
|
|
[0x14] = {
|
2015-04-13 03:43:25 +00:00
|
|
|
"Compute Module",
|
|
|
|
"bcm2835-rpi-cm.dtb",
|
|
|
|
false,
|
|
|
|
},
|
2015-12-05 05:07:44 +00:00
|
|
|
[0x15] = {
|
2015-10-14 15:17:54 +00:00
|
|
|
"Model A+",
|
|
|
|
"bcm2835-rpi-a-plus.dtb",
|
|
|
|
false,
|
|
|
|
},
|
2014-11-19 04:40:21 +00:00
|
|
|
};
|
|
|
|
|
2015-12-05 05:07:45 +00:00
|
|
|
static uint32_t revision;
|
|
|
|
static uint32_t rev_scheme;
|
|
|
|
static uint32_t rev_type;
|
|
|
|
static const struct rpi_model *model;
|
2014-11-19 04:40:21 +00:00
|
|
|
|
2012-08-05 16:07:22 +00:00
|
|
|
int dram_init(void)
|
|
|
|
{
|
2015-07-24 07:22:12 +00:00
|
|
|
ALLOC_CACHE_ALIGN_BUFFER(struct msg_get_arm_mem, msg, 1);
|
2013-01-29 16:37:37 +00:00
|
|
|
int ret;
|
|
|
|
|
|
|
|
BCM2835_MBOX_INIT_HDR(msg);
|
|
|
|
BCM2835_MBOX_INIT_TAG(&msg->get_arm_mem, GET_ARM_MEMORY);
|
|
|
|
|
|
|
|
ret = bcm2835_mbox_call_prop(BCM2835_MBOX_PROP_CHAN, &msg->hdr);
|
|
|
|
if (ret) {
|
|
|
|
printf("bcm2835: Could not query ARM memory size\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
gd->ram_size = msg->get_arm_mem.body.resp.mem_size;
|
2012-08-05 16:07:22 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-11-19 04:40:21 +00:00
|
|
|
static void set_fdtfile(void)
|
|
|
|
{
|
|
|
|
const char *fdtfile;
|
|
|
|
|
|
|
|
if (getenv("fdtfile"))
|
|
|
|
return;
|
|
|
|
|
2015-12-05 05:07:45 +00:00
|
|
|
fdtfile = model->fdtfile;
|
2014-11-19 04:40:21 +00:00
|
|
|
setenv("fdtfile", fdtfile);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void set_usbethaddr(void)
|
2014-09-27 02:51:39 +00:00
|
|
|
{
|
2015-07-24 07:22:12 +00:00
|
|
|
ALLOC_CACHE_ALIGN_BUFFER(struct msg_get_mac_address, msg, 1);
|
2014-09-27 02:51:39 +00:00
|
|
|
int ret;
|
|
|
|
|
2015-12-05 05:07:45 +00:00
|
|
|
if (!model->has_onboard_eth)
|
2014-12-06 03:56:46 +00:00
|
|
|
return;
|
|
|
|
|
2014-09-27 02:51:39 +00:00
|
|
|
if (getenv("usbethaddr"))
|
2014-11-19 04:40:21 +00:00
|
|
|
return;
|
2014-09-27 02:51:39 +00:00
|
|
|
|
|
|
|
BCM2835_MBOX_INIT_HDR(msg);
|
|
|
|
BCM2835_MBOX_INIT_TAG(&msg->get_mac_address, GET_MAC_ADDRESS);
|
|
|
|
|
|
|
|
ret = bcm2835_mbox_call_prop(BCM2835_MBOX_PROP_CHAN, &msg->hdr);
|
|
|
|
if (ret) {
|
|
|
|
printf("bcm2835: Could not query MAC address\n");
|
|
|
|
/* Ignore error; not critical */
|
2014-11-19 04:40:21 +00:00
|
|
|
return;
|
2014-09-27 02:51:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
eth_setenv_enetaddr("usbethaddr", msg->get_mac_address.body.resp.mac);
|
|
|
|
|
2014-11-19 04:40:21 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-08-25 13:10:26 +00:00
|
|
|
#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
|
|
|
|
static void set_board_info(void)
|
|
|
|
{
|
2015-12-05 05:07:45 +00:00
|
|
|
char s[11];
|
|
|
|
|
|
|
|
snprintf(s, sizeof(s), "0x%X", revision);
|
|
|
|
setenv("board_revision", s);
|
|
|
|
snprintf(s, sizeof(s), "%d", rev_scheme);
|
|
|
|
setenv("board_rev_scheme", s);
|
|
|
|
/* Can't rename this to board_rev_type since it's an ABI for scripts */
|
|
|
|
snprintf(s, sizeof(s), "0x%X", rev_type);
|
|
|
|
setenv("board_rev", s);
|
|
|
|
setenv("board_name", model->name);
|
2015-08-25 13:10:26 +00:00
|
|
|
}
|
|
|
|
#endif /* CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG */
|
|
|
|
|
2014-11-19 04:40:21 +00:00
|
|
|
int misc_init_r(void)
|
|
|
|
{
|
|
|
|
set_fdtfile();
|
|
|
|
set_usbethaddr();
|
2015-08-25 13:10:26 +00:00
|
|
|
#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
|
|
|
|
set_board_info();
|
|
|
|
#endif
|
2014-09-27 02:51:39 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-01-14 02:50:11 +00:00
|
|
|
static int power_on_module(u32 module)
|
|
|
|
{
|
2015-07-24 07:22:12 +00:00
|
|
|
ALLOC_CACHE_ALIGN_BUFFER(struct msg_set_power_state, msg_pwr, 1);
|
2014-01-14 02:50:11 +00:00
|
|
|
int ret;
|
|
|
|
|
|
|
|
BCM2835_MBOX_INIT_HDR(msg_pwr);
|
|
|
|
BCM2835_MBOX_INIT_TAG(&msg_pwr->set_power_state,
|
|
|
|
SET_POWER_STATE);
|
|
|
|
msg_pwr->set_power_state.body.req.device_id = module;
|
|
|
|
msg_pwr->set_power_state.body.req.state =
|
|
|
|
BCM2835_MBOX_SET_POWER_STATE_REQ_ON |
|
|
|
|
BCM2835_MBOX_SET_POWER_STATE_REQ_WAIT;
|
|
|
|
|
|
|
|
ret = bcm2835_mbox_call_prop(BCM2835_MBOX_PROP_CHAN,
|
|
|
|
&msg_pwr->hdr);
|
|
|
|
if (ret) {
|
|
|
|
printf("bcm2835: Could not set module %u power state\n",
|
|
|
|
module);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-11-19 04:40:21 +00:00
|
|
|
static void get_board_rev(void)
|
|
|
|
{
|
2015-07-24 07:22:12 +00:00
|
|
|
ALLOC_CACHE_ALIGN_BUFFER(struct msg_get_board_rev, msg, 1);
|
2014-11-19 04:40:21 +00:00
|
|
|
int ret;
|
2015-12-05 05:07:45 +00:00
|
|
|
const struct rpi_model *models;
|
|
|
|
uint32_t models_count;
|
2014-11-19 04:40:21 +00:00
|
|
|
|
|
|
|
BCM2835_MBOX_INIT_HDR(msg);
|
|
|
|
BCM2835_MBOX_INIT_TAG(&msg->get_board_rev, GET_BOARD_REV);
|
|
|
|
|
|
|
|
ret = bcm2835_mbox_call_prop(BCM2835_MBOX_PROP_CHAN, &msg->hdr);
|
|
|
|
if (ret) {
|
|
|
|
printf("bcm2835: Could not query board revision\n");
|
|
|
|
/* Ignore error; not critical */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-02-16 19:16:15 +00:00
|
|
|
/*
|
|
|
|
* For details of old-vs-new scheme, see:
|
|
|
|
* https://github.com/pimoroni/RPi.version/blob/master/RPi/version.py
|
|
|
|
* http://www.raspberrypi.org/forums/viewtopic.php?f=63&t=99293&p=690282
|
|
|
|
* (a few posts down)
|
2015-03-24 05:00:25 +00:00
|
|
|
*
|
|
|
|
* For the RPi 1, bit 24 is the "warranty bit", so we mask off just the
|
|
|
|
* lower byte to use as the board rev:
|
|
|
|
* http://www.raspberrypi.org/forums/viewtopic.php?f=63&t=98367&start=250
|
|
|
|
* http://www.raspberrypi.org/forums/viewtopic.php?f=31&t=20594
|
2015-02-16 19:16:15 +00:00
|
|
|
*/
|
2015-12-05 05:07:45 +00:00
|
|
|
revision = msg->get_board_rev.body.resp.rev;
|
|
|
|
if (revision & 0x800000) {
|
|
|
|
rev_scheme = 1;
|
|
|
|
rev_type = (revision >> 4) & 0xff;
|
|
|
|
models = rpi_models_new_scheme;
|
|
|
|
models_count = ARRAY_SIZE(rpi_models_new_scheme);
|
|
|
|
} else {
|
|
|
|
rev_scheme = 0;
|
|
|
|
rev_type = revision & 0xff;
|
|
|
|
models = rpi_models_old_scheme;
|
|
|
|
models_count = ARRAY_SIZE(rpi_models_old_scheme);
|
2014-12-24 03:01:43 +00:00
|
|
|
}
|
2015-12-05 05:07:45 +00:00
|
|
|
if (rev_type >= models_count) {
|
|
|
|
printf("RPI: Board rev 0x%x outside known range\n", rev_type);
|
|
|
|
model = &rpi_model_unknown;
|
|
|
|
} else if (!models[rev_type].name) {
|
|
|
|
printf("RPI: Board rev 0x%x unknown\n", rev_type);
|
|
|
|
model = &rpi_model_unknown;
|
|
|
|
} else {
|
|
|
|
model = &models[rev_type];
|
2014-12-24 03:01:43 +00:00
|
|
|
}
|
2014-12-24 03:01:44 +00:00
|
|
|
|
2015-12-05 05:07:45 +00:00
|
|
|
printf("RPI %s (0x%x)\n", model->name, revision);
|
2014-11-19 04:40:21 +00:00
|
|
|
}
|
|
|
|
|
2012-08-05 16:07:22 +00:00
|
|
|
int board_init(void)
|
|
|
|
{
|
2014-11-19 04:40:21 +00:00
|
|
|
get_board_rev();
|
|
|
|
|
2012-08-05 16:07:22 +00:00
|
|
|
gd->bd->bi_boot_params = 0x100;
|
|
|
|
|
2014-01-14 02:50:11 +00:00
|
|
|
return power_on_module(BCM2835_MBOX_POWER_DEVID_USB_HCD);
|
2012-08-05 16:07:22 +00:00
|
|
|
}
|
2013-01-29 16:37:42 +00:00
|
|
|
|
2014-07-13 20:01:51 +00:00
|
|
|
int board_mmc_init(bd_t *bis)
|
2013-01-29 16:37:42 +00:00
|
|
|
{
|
2015-07-24 07:22:12 +00:00
|
|
|
ALLOC_CACHE_ALIGN_BUFFER(struct msg_get_clock_rate, msg_clk, 1);
|
2013-01-29 16:37:42 +00:00
|
|
|
int ret;
|
|
|
|
|
2014-01-14 02:50:11 +00:00
|
|
|
power_on_module(BCM2835_MBOX_POWER_DEVID_SDHCI);
|
|
|
|
|
2013-01-29 16:37:42 +00:00
|
|
|
BCM2835_MBOX_INIT_HDR(msg_clk);
|
|
|
|
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;
|
|
|
|
|
|
|
|
ret = bcm2835_mbox_call_prop(BCM2835_MBOX_PROP_CHAN, &msg_clk->hdr);
|
|
|
|
if (ret) {
|
|
|
|
printf("bcm2835: Could not query eMMC clock rate\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return bcm2835_sdhci_init(BCM2835_SDHCI_BASE,
|
|
|
|
msg_clk->get_clock_rate.body.resp.rate_hz);
|
|
|
|
}
|
2013-05-27 18:31:18 +00:00
|
|
|
|
2014-10-24 00:58:47 +00:00
|
|
|
int ft_board_setup(void *blob, bd_t *bd)
|
2013-05-27 18:31:18 +00:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* For now, we simply always add the simplefb DT node. Later, we
|
|
|
|
* should be more intelligent, and e.g. only do this if no enabled DT
|
|
|
|
* node exists for the "real" graphics driver.
|
|
|
|
*/
|
|
|
|
lcd_dt_simplefb_add_node(blob);
|
2014-10-24 00:58:47 +00:00
|
|
|
|
|
|
|
return 0;
|
2013-05-27 18:31:18 +00:00
|
|
|
}
|