Merge tag 'ti-v2021.04-rc2' of https://gitlab.denx.de/u-boot/custodians/u-boot-ti
- Sync DTS from Linux kernel for all K3 platforms - Add MMC higher speed nodes for AM65x, J721e, J7200 - Convert Nokia RX-51 to use CONFIG_DM_MMC - Minor fixes for LEGO MINDSTORMS
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <env.h>
|
||||
#include <i2c.h>
|
||||
#include <init.h>
|
||||
#include <spi.h>
|
||||
@@ -28,11 +29,9 @@
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
u8 board_rev;
|
||||
|
||||
#define EEPROM_I2C_ADDR 0x50
|
||||
#define EEPROM_REV_OFFSET 0x3F00
|
||||
#define EEPROM_MAC_OFFSET 0x3F06
|
||||
#define EEPROM_BDADDR_OFFSET 0x3F06
|
||||
|
||||
const struct pinmux_resource pinmuxes[] = {
|
||||
PINMUX_ITEM(spi0_pins_base),
|
||||
@@ -52,59 +51,46 @@ const struct lpsc_resource lpsc[] = {
|
||||
|
||||
const int lpsc_size = ARRAY_SIZE(lpsc);
|
||||
|
||||
u32 get_board_rev(void)
|
||||
{
|
||||
u8 buf[2];
|
||||
|
||||
if (!board_rev) {
|
||||
if (i2c_read(EEPROM_I2C_ADDR, EEPROM_REV_OFFSET, 2, buf, 2)) {
|
||||
printf("\nBoard revision read failed!\n");
|
||||
} else {
|
||||
/*
|
||||
* Board rev 3 has MAC address at EEPROM_REV_OFFSET.
|
||||
* Other revisions have checksum at EEPROM_REV_OFFSET+1
|
||||
* to detect this.
|
||||
*/
|
||||
if ((buf[0] ^ buf[1]) == 0xFF)
|
||||
board_rev = buf[0];
|
||||
else
|
||||
board_rev = 3;
|
||||
}
|
||||
}
|
||||
|
||||
return board_rev;
|
||||
}
|
||||
|
||||
/*
|
||||
* The Bluetooth MAC address serves as the board serial number.
|
||||
* The Bluetooth address serves as the board serial number.
|
||||
*/
|
||||
void get_board_serial(struct tag_serialnr *serialnr)
|
||||
static void setup_serial_number(void)
|
||||
{
|
||||
u32 offset;
|
||||
char serial_number[13];
|
||||
u8 buf[6];
|
||||
u8 eeprom_rev;
|
||||
|
||||
if (!board_rev)
|
||||
board_rev = get_board_rev();
|
||||
if (env_get("serial#"))
|
||||
return;
|
||||
|
||||
/* Board rev 3 has MAC address where rev should be */
|
||||
offset = (board_rev == 3) ? EEPROM_REV_OFFSET : EEPROM_MAC_OFFSET;
|
||||
if (i2c_read(EEPROM_I2C_ADDR, EEPROM_REV_OFFSET, 2, buf, 2)) {
|
||||
printf("\nEEPROM revision read failed!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* EEPROM rev 3 has Bluetooth address at EEPROM_REV_OFFSET.
|
||||
* Other revisions have checksum at EEPROM_REV_OFFSET+1
|
||||
* to detect this.
|
||||
*/
|
||||
if ((buf[0] ^ buf[1]) == 0xFF)
|
||||
eeprom_rev = buf[0];
|
||||
else
|
||||
eeprom_rev = 3;
|
||||
|
||||
/* EEPROM rev 3 has Bluetooth address where rev should be */
|
||||
offset = (eeprom_rev == 3) ? EEPROM_REV_OFFSET : EEPROM_BDADDR_OFFSET;
|
||||
|
||||
if (i2c_read(EEPROM_I2C_ADDR, offset, 2, buf, 6)) {
|
||||
printf("\nBoard serial read failed!\n");
|
||||
} else {
|
||||
u8 *nr;
|
||||
|
||||
nr = (u8 *)&serialnr->low;
|
||||
nr[0] = buf[5];
|
||||
nr[1] = buf[4];
|
||||
nr[2] = buf[3];
|
||||
nr[3] = buf[2];
|
||||
nr = (u8 *)&serialnr->high;
|
||||
nr[0] = buf[1];
|
||||
nr[1] = buf[0];
|
||||
nr[2] = 0;
|
||||
nr[3] = 0;
|
||||
printf("\nEEPROM serial read failed!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
sprintf(serial_number, "%02X%02X%02X%02X%02X%02X",
|
||||
buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
|
||||
|
||||
env_set("serial#", serial_number);
|
||||
}
|
||||
|
||||
int board_early_init_f(void)
|
||||
@@ -130,10 +116,6 @@ int board_init(void)
|
||||
{
|
||||
irq_init();
|
||||
|
||||
/* arch number of the board */
|
||||
/* LEGO didn't register for a unique number and uses da850evm */
|
||||
gd->bd->bi_arch_number = MACH_TYPE_DAVINCI_DA850_EVM;
|
||||
|
||||
/* address of boot parameters */
|
||||
gd->bd->bi_boot_params = LINUX_BOOT_PARAM_ADDR;
|
||||
|
||||
@@ -150,3 +132,10 @@ int board_init(void)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int board_late_init(void)
|
||||
{
|
||||
setup_serial_number();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -415,6 +415,8 @@ int misc_init_r(void)
|
||||
|
||||
/* initialize twl4030 power managment */
|
||||
twl4030_power_init();
|
||||
twl4030_power_mmc_init(0);
|
||||
twl4030_power_mmc_init(1);
|
||||
|
||||
/* set VSIM to 1.8V */
|
||||
twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VSIM_DEDICATED,
|
||||
@@ -686,22 +688,23 @@ int rx51_kp_getc(struct stdio_dev *sdev)
|
||||
return keybuf[keybuf_head++];
|
||||
}
|
||||
|
||||
/*
|
||||
* Routine: board_mmc_init
|
||||
* Description: Initialize mmc devices.
|
||||
*/
|
||||
int board_mmc_init(struct bd_info *bis)
|
||||
{
|
||||
omap_mmc_init(0, 0, 0, -1, -1);
|
||||
omap_mmc_init(1, 0, 0, -1, -1);
|
||||
return 0;
|
||||
}
|
||||
static const struct mmc_config rx51_mmc_cfg = {
|
||||
.host_caps = MMC_MODE_4BIT | MMC_MODE_HS_52MHz | MMC_MODE_HS,
|
||||
.f_min = 400000,
|
||||
.f_max = 52000000,
|
||||
.b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT,
|
||||
.voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195,
|
||||
};
|
||||
|
||||
void board_mmc_power_init(void)
|
||||
{
|
||||
twl4030_power_mmc_init(0);
|
||||
twl4030_power_mmc_init(1);
|
||||
}
|
||||
static const struct omap_hsmmc_plat rx51_mmc[] = {
|
||||
{ rx51_mmc_cfg, (struct hsmmc *)OMAP_HSMMC1_BASE },
|
||||
{ rx51_mmc_cfg, (struct hsmmc *)OMAP_HSMMC2_BASE },
|
||||
};
|
||||
|
||||
U_BOOT_DRVINFOS(rx51_mmc) = {
|
||||
{ "omap_hsmmc", &rx51_mmc[0] },
|
||||
{ "omap_hsmmc", &rx51_mmc[1] },
|
||||
};
|
||||
|
||||
static const struct omap_i2c_plat rx51_i2c[] = {
|
||||
{ I2C_BASE1, 100000, OMAP_I2C_REV_V1 },
|
||||
|
||||
Reference in New Issue
Block a user