- Turris MOX and Omnia changes, mostly moving to Kconfig (Marek)
- a37xx: pci: Misc smaller fixes (Pali)
- cmd: tlv_eeprom: Fix building with DEBUG enabled (Sven)
- termios_linux.h: Fix tcsendbreak() implementation (Pali)
- mvebu: Add missing "if SPL" (Tom)
This commit is contained in:
Tom Rini 2021-10-21 07:52:15 -04:00
commit f200a4bcec
22 changed files with 109 additions and 145 deletions

View file

@ -11,7 +11,7 @@ config ARMADA_32BIT
select SPL_DM if SPL
select SPL_DM_SEQ_ALIAS if SPL
select SPL_OF_CONTROL if SPL
select SPL_SKIP_LOWLEVEL_INIT
select SPL_SKIP_LOWLEVEL_INIT if SPL
select SPL_SIMPLE_BUS if SPL
select SUPPORT_SPL
select TRANSLATION_OFFSET
@ -127,7 +127,9 @@ config TARGET_TURRIS_OMNIA
select DM_I2C
select I2C_MUX
select I2C_MUX_PCA954x
select SPL_DRIVERS_MISC
select SPL_I2C_MUX
select SPL_SYS_MALLOC_SIMPLE
select SYS_I2C_MVTWSI
select ATSHA204A

View file

@ -359,20 +359,22 @@ static int get_reset_gpio(struct gpio_desc *reset_gpio)
int misc_init_r(void)
{
int ret;
u8 mac1[6], mac2[6];
u8 mac[2][6];
int i, ret;
ret = mbox_sp_get_board_info(NULL, mac1, mac2, NULL, NULL);
ret = mbox_sp_get_board_info(NULL, mac[0], mac[1], NULL, NULL);
if (ret < 0) {
printf("Cannot read data from OTP!\n");
return 0;
}
if (is_valid_ethaddr(mac1) && !env_get("ethaddr"))
eth_env_set_enetaddr("ethaddr", mac1);
for (i = 0; i < 2; ++i) {
u8 oldmac[6];
if (is_valid_ethaddr(mac2) && !env_get("eth1addr"))
eth_env_set_enetaddr("eth1addr", mac2);
if (is_valid_ethaddr(mac[i]) &&
!eth_env_get_enetaddr_by_index("eth", i, oldmac))
eth_env_set_enetaddr_by_index("eth", i, mac[i]);
}
return 0;
}
@ -485,44 +487,34 @@ static void handle_reset_button(void)
}
}
static void mox_print_info(void)
int show_board_info(void)
{
int ret, board_version, ram_size;
u64 serial_number;
int i, ret, board_version, ram_size, is_sd;
const char *pub_key;
const u8 *topology;
u64 serial_number;
printf("Model: CZ.NIC Turris Mox Board\n");
ret = mbox_sp_get_board_info(&serial_number, NULL, NULL, &board_version,
&ram_size);
if (ret < 0)
return;
printf("Turris Mox:\n");
printf(" Board version: %i\n", board_version);
printf(" RAM size: %i MiB\n", ram_size);
printf(" Serial Number: %016llX\n", serial_number);
if (ret < 0) {
printf(" Cannot read board info: %i\n", ret);
} else {
printf(" Board version: %i\n", board_version);
printf(" RAM size: %i MiB\n", ram_size);
printf(" Serial Number: %016llX\n", serial_number);
}
pub_key = mox_sp_get_ecdsa_public_key();
if (pub_key)
printf(" ECDSA Public Key: %s\n", pub_key);
else
printf("Cannot read ECDSA Public Key\n");
}
int last_stage_init(void)
{
int ret, i;
const u8 *topology;
int is_sd;
struct mii_dev *bus;
struct gpio_desc reset_gpio = {};
mox_print_info();
printf(" Cannot read ECDSA Public Key\n");
ret = mox_get_topology(&topology, &module_count, &is_sd);
if (ret) {
if (ret)
printf("Cannot read module topology!\n");
return 0;
}
printf(" SD/eMMC version: %s\n", is_sd ? "SD" : "eMMC");
@ -554,8 +546,7 @@ int last_stage_init(void)
}
}
/* now check if modules are connected in supported mode */
/* check if modules are connected in supported mode */
for (i = 0; i < module_count; ++i) {
switch (topology[i]) {
case MOX_MODULE_SFP:
@ -616,10 +607,19 @@ int last_stage_init(void)
}
}
/* now configure modules */
if (module_count)
printf("\n");
return 0;
}
int last_stage_init(void)
{
struct gpio_desc reset_gpio = {};
/* configure modules */
if (get_reset_gpio(&reset_gpio) < 0)
return 0;
goto handle_reset_btn;
if (peridot > 0) {
if (configure_peridots(&reset_gpio) < 0) {
@ -633,16 +633,19 @@ int last_stage_init(void)
mdelay(50);
}
/*
* check if the addresses are set by reading Scratch & Misc register
* 0x70 of Peridot (and potentially Topaz) modules
*/
if (peridot || topaz) {
/*
* now check if the addresses are set by reading Scratch & Misc
* register 0x70 of Peridot (and potentially Topaz) modules
*/
struct mii_dev *bus;
bus = miiphy_get_dev_by_name("neta@30000");
if (!bus) {
printf("Cannot get MDIO bus device!\n");
} else {
int i;
for (i = 0; i < peridot; ++i)
check_switch_address(bus, 0x10 + i);
@ -653,8 +656,7 @@ int last_stage_init(void)
}
}
printf("\n");
handle_reset_btn:
handle_reset_button();
return 0;

View file

@ -468,7 +468,7 @@ static struct udevice *get_atsha204a_dev(void)
return dev;
}
int checkboard(void)
int show_board_info(void)
{
u32 version_num, serial_num;
int err = 1;
@ -496,7 +496,7 @@ int checkboard(void)
}
out:
printf("Turris Omnia:\n");
printf("Model: Turris Omnia\n");
printf(" RAM size: %i MiB\n", omnia_get_ram_size_gb() * 1024);
if (err)
printf(" Serial Number: unknown\n");
@ -518,6 +518,15 @@ static void increment_mac(u8 *mac)
}
}
static void set_mac_if_invalid(int i, u8 *mac)
{
u8 oldmac[6];
if (is_valid_ethaddr(mac) &&
!eth_env_get_enetaddr_by_index("eth", i, oldmac))
eth_env_set_enetaddr_by_index("eth", i, mac);
}
int misc_init_r(void)
{
int err;
@ -550,18 +559,11 @@ int misc_init_r(void)
mac[4] = mac1[2];
mac[5] = mac1[3];
if (is_valid_ethaddr(mac))
eth_env_set_enetaddr("eth1addr", mac);
set_mac_if_invalid(1, mac);
increment_mac(mac);
if (is_valid_ethaddr(mac))
eth_env_set_enetaddr("eth2addr", mac);
set_mac_if_invalid(2, mac);
increment_mac(mac);
if (is_valid_ethaddr(mac))
eth_env_set_enetaddr("ethaddr", mac);
set_mac_if_invalid(0, mac);
out:
return 0;

View file

@ -169,6 +169,9 @@ static void show_eeprom(u8 *eeprom)
{
int tlv_end;
int curr_tlv;
#ifdef DEBUG
int i;
#endif
struct tlvinfo_header *eeprom_hdr = to_header(eeprom);
struct tlvinfo_tlv *eeprom_tlv;

View file

@ -45,6 +45,7 @@ CONFIG_CLK=y
CONFIG_CLK_MVEBU=y
# CONFIG_MVEBU_GPIO is not set
CONFIG_DM_I2C=y
CONFIG_SYS_I2C_MV=y
CONFIG_MISC=y
CONFIG_MMC_SDHCI=y
CONFIG_MMC_SDHCI_SDMA=y

View file

@ -54,6 +54,7 @@ CONFIG_AHCI_MVEBU=y
CONFIG_CLK=y
CONFIG_CLK_MVEBU=y
CONFIG_DM_I2C=y
CONFIG_SYS_I2C_MV=y
CONFIG_MISC=y
CONFIG_MMC_SDHCI=y
CONFIG_MMC_SDHCI_SDMA=y

View file

@ -24,7 +24,9 @@ CONFIG_USE_PREBOOT=y
CONFIG_SYS_CONSOLE_INFO_QUIET=y
# CONFIG_DISPLAY_CPUINFO is not set
# CONFIG_DISPLAY_BOARDINFO is not set
CONFIG_DISPLAY_BOARDINFO_LATE=y
CONFIG_ARCH_EARLY_INIT_R=y
CONFIG_LAST_STAGE_INIT=y
CONFIG_MISC_INIT_R=y
CONFIG_CMD_SHA1SUM=y
CONFIG_CMD_CLK=y
@ -59,6 +61,7 @@ CONFIG_CLK=y
CONFIG_CLK_MVEBU=y
# CONFIG_MVEBU_GPIO is not set
CONFIG_DM_I2C=y
CONFIG_SYS_I2C_MV=y
CONFIG_LED=y
CONFIG_LED_GPIO=y
CONFIG_MISC=y

View file

@ -54,6 +54,7 @@ CONFIG_CLK=y
CONFIG_CLK_MVEBU=y
CONFIG_DM_I2C=y
CONFIG_DM_I2C_GPIO=y
CONFIG_SYS_I2C_MV=y
CONFIG_MISC=y
CONFIG_MMC_SDHCI=y
CONFIG_MMC_SDHCI_SDMA=y

View file

@ -627,6 +627,12 @@ config SYS_I2C_VERSATILE
Add support for the Arm Ltd Versatile Express I2C driver. The I2C host
controller is present in the development boards manufactured by Arm Ltd.
config SYS_I2C_MV
bool "Marvell PXA (Armada 3720) I2C driver"
help
Support for PXA based I2C controller used on Armada 3720 SoC.
In Linux, this driver is called i2c-pxa.
config SYS_I2C_MVTWSI
bool "Marvell I2C driver"
help

View file

@ -10,7 +10,6 @@ obj-$(CONFIG_$(SPL_)DM_I2C_GPIO) += i2c-gpio.o
obj-$(CONFIG_$(SPL_)I2C_CROS_EC_TUNNEL) += cros_ec_tunnel.o
obj-$(CONFIG_$(SPL_)I2C_CROS_EC_LDO) += cros_ec_ldo.o
obj-$(CONFIG_I2C_MV) += mv_i2c.o
obj-$(CONFIG_$(SPL_)SYS_I2C_LEGACY) += i2c_core.o
obj-$(CONFIG_SYS_I2C_ASPEED) += ast_i2c.o
obj-$(CONFIG_SYS_I2C_AT91) += at91_i2c.o
@ -29,6 +28,7 @@ obj-$(CONFIG_SYS_I2C_IPROC) += iproc_i2c.o
obj-$(CONFIG_SYS_I2C_KONA) += kona_i2c.o
obj-$(CONFIG_SYS_I2C_LPC32XX) += lpc32xx_i2c.o
obj-$(CONFIG_SYS_I2C_MESON) += meson_i2c.o
obj-$(CONFIG_SYS_I2C_MV) += mv_i2c.o
obj-$(CONFIG_SYS_I2C_MVTWSI) += mvtwsi.o
obj-$(CONFIG_SYS_I2C_MXC) += mxc_i2c.o
obj-$(CONFIG_SYS_I2C_NEXELL) += nx_i2c.o

View file

@ -445,7 +445,7 @@ static int pcie_advk_read_config(const struct udevice *bus, pci_dev_t bdf,
* for returning CRS, so that if U-Boot does support CRS in the future,
* it will work for Aardvark.
*/
allow_crs = pcie->cfgcrssve;
allow_crs = (offset == PCI_VENDOR_ID) && (size == PCI_SIZE_32) && pcie->cfgcrssve;
if (advk_readl(pcie, PIO_START)) {
dev_err(pcie->dev,
@ -581,6 +581,10 @@ static int pcie_advk_write_config(struct udevice *bus, pci_dev_t bdf,
if (offset >= 0x10 && offset < 0x34) {
data = pcie->cfgcache[(offset - 0x10) / 4];
data = pci_conv_size_to_32(data, value, offset, size);
/* This PCI bridge does not have configurable bars */
if ((offset & ~3) == PCI_BASE_ADDRESS_0 ||
(offset & ~3) == PCI_BASE_ADDRESS_1)
data = 0x0;
pcie->cfgcache[(offset - 0x10) / 4] = data;
} else if ((offset & ~3) == PCI_ROM_ADDRESS1) {
data = advk_readl(pcie, PCIE_CORE_EXP_ROM_BAR_REG);

View file

@ -59,11 +59,6 @@
/* There is no PHY directly connected so don't ask it for link status */
#undef CONFIG_SYS_FAULT_ECHO_LINK_DOWN
/*
* Other required minimal configurations
*/
#define CONFIG_SYS_RESET_ADDRESS 0xffff0000 /* Rst Vector Adr */
/*
* Ethernet Driver configuration
*/

View file

@ -64,11 +64,6 @@
/* There is no PHY directly connected so don't ask it for link status */
#undef CONFIG_SYS_FAULT_ECHO_LINK_DOWN
/*
* Other required minimal configurations
*/
#define CONFIG_SYS_RESET_ADDRESS 0xffff0000 /* Rst Vector Adr */
/*
* Ethernet Driver configuration
*/

View file

@ -151,12 +151,6 @@
* Environment variables configurations
*/
/*
* Other required minimal configurations
*/
#define CONFIG_SYS_RESET_ADDRESS 0xffff0000
/* Enable command line editing */
/* provide extensive help */

View file

@ -55,7 +55,6 @@
/*
* Other required minimal configurations
*/
#define CONFIG_SYS_RESET_ADDRESS 0xffff0000 /* Rst Vector Adr */
#define CONFIG_SYS_MAXARGS 32 /* max number of command args */
/* ====> Include platform Common Definitions */

View file

@ -30,17 +30,11 @@
/*
* Other required minimal configurations
*/
#define CONFIG_SYS_RESET_ADDRESS 0xffff0000 /* Rst Vector Adr */
#define CONFIG_SYS_MAXARGS 32 /* max number of command args */
/* End of 16M scrubbed by training in bootrom */
#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_TEXT_BASE + 0xFF0000)
/*
* I2C
*/
#define CONFIG_I2C_MV
/*
* Environment
*/

View file

@ -24,7 +24,6 @@
/*
* Other required minimal configurations
*/
#define CONFIG_SYS_RESET_ADDRESS 0xffff0000 /* Rst Vector Adr */
#define CONFIG_SYS_MAXARGS 32 /* max number of command args */
/* End of 16M scrubbed by training in bootrom */

View file

@ -8,20 +8,11 @@
#ifndef _CONFIG_TURRIS_MOX_H
#define _CONFIG_TURRIS_MOX_H
#define CONFIG_SYS_BOOTM_LEN (64 << 20)
#define CONFIG_LAST_STAGE_INIT
/*
* High Level Configuration Options (easy to change)
*/
#define CONFIG_DISPLAY_BOARDINFO_LATE
/* additions for new ARM relocation support */
#define CONFIG_SYS_SDRAM_BASE 0x00000000
/* auto boot */
#define CONFIG_SYS_BOOTM_LEN (64 << 20)
#define CONFIG_SYS_SDRAM_BASE 0x00000000
#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_TEXT_BASE + 0xFF0000)
#define CONFIG_SYS_CBSIZE 1024
#define CONFIG_SYS_MAXARGS 32
#define CONFIG_SYS_BAUDRATE_TABLE { 300, 600, 1200, 1800, 2400, 4800, \
9600, 19200, 38400, 57600, 115200, \
230400, 460800, 500000, 576000, \
@ -30,31 +21,10 @@
4000000, 4500000, 5000000, 5500000, \
6000000 }
#define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buff Size */
#define CONFIG_ARP_TIMEOUT 200
#define CONFIG_NET_RETRY_COUNT 50
/*
* Other required minimal configurations
*/
#define CONFIG_SYS_RESET_ADDRESS 0xffff0000 /* Rst Vector Adr */
#define CONFIG_SYS_MAXARGS 32 /* max number of command args */
/* End of 16M scrubbed by training in bootrom */
#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_TEXT_BASE + 0xFF0000)
/*
* I2C
*/
#define CONFIG_I2C_MV
/* Environment in SPI NOR flash */
/*
* Ethernet Driver configuration
*/
#define CONFIG_ARP_TIMEOUT 200
#define CONFIG_NET_RETRY_COUNT 50
#define CONFIG_USB_MAX_CONTROLLER_COUNT (3 + 3)
#define CONFIG_USB_MAX_CONTROLLER_COUNT 6
#define BOOT_TARGET_DEVICES(func) \
func(MMC, mmc, 0) \
@ -64,22 +34,22 @@
#include <config_distro_bootcmd.h>
#define TURRIS_MOX_BOOTCMD_RESCUE \
"setenv bootargs \"console=ttyMV0,115200 " \
"earlycon=ar3700_uart,0xd0012000\" && " \
"sf probe && " \
"sf read 0x5000000 0x190000 && " \
"lzmadec 0x5000000 0x5800000 && " \
#define TURRIS_MOX_BOOTCMD_RESCUE \
"setenv bootargs \"console=ttyMV0,115200 " \
"earlycon=ar3700_uart,0xd0012000\" && " \
"sf probe && " \
"sf read 0x5000000 0x190000 && " \
"lzmadec 0x5000000 0x5800000 && " \
"bootm 0x5800000"
#define CONFIG_EXTRA_ENV_SETTINGS \
"scriptaddr=0x4d00000\0" \
"pxefile_addr_r=0x4e00000\0" \
"fdt_addr_r=0x4f00000\0" \
"kernel_addr_r=0x5000000\0" \
"ramdisk_addr_r=0x8000000\0" \
"fdtfile=marvell/" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \
"bootcmd_rescue=" TURRIS_MOX_BOOTCMD_RESCUE "\0" \
#define CONFIG_EXTRA_ENV_SETTINGS \
"scriptaddr=0x4d00000\0" \
"pxefile_addr_r=0x4e00000\0" \
"fdt_addr_r=0x4f00000\0" \
"kernel_addr_r=0x5000000\0" \
"ramdisk_addr_r=0x8000000\0" \
"fdtfile=marvell/" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \
"bootcmd_rescue=" TURRIS_MOX_BOOTCMD_RESCUE "\0" \
BOOTENV
#endif /* _CONFIG_TURRIS_MOX_H */

View file

@ -33,13 +33,8 @@
#define CONFIG_SPL_BSS_START_ADDR (0x40000000 + CONFIG_SPL_SIZE)
#define CONFIG_SPL_BSS_MAX_SIZE (16 << 10)
#ifdef CONFIG_SPL_BUILD
#define CONFIG_SYS_MALLOC_SIMPLE
#endif
#define CONFIG_SPL_STACK (0x40000000 + ((192 - 16) << 10))
#define CONFIG_SPL_BOOTROM_SAVE (CONFIG_SPL_STACK + 4)
#define CONFIG_SPL_DRIVERS_MISC
#ifdef CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC
/* SPL related MMC defines */

View file

@ -58,11 +58,6 @@
#include <asm/arch/config.h>
/*
* Other required minimal configurations
*/
#define CONFIG_SYS_RESET_ADDRESS 0xffff0000 /* Rst Vector Adr */
/* Keep device tree and initrd in low memory so the kernel can access them */
#define CONFIG_EXTRA_ENV_SETTINGS \
"fdt_high=0x10000000\0" \

View file

@ -593,7 +593,6 @@ CONFIG_I2C_ENV_EEPROM_BUS
CONFIG_I2C_GSC
CONFIG_I2C_MBB_TIMEOUT
CONFIG_I2C_MULTI_BUS
CONFIG_I2C_MV
CONFIG_I2C_MVTWSI
CONFIG_I2C_MVTWSI_BASE
CONFIG_I2C_MVTWSI_BASE0

View file

@ -90,7 +90,11 @@ static inline int tcflush(int fd, int q)
static inline int tcsendbreak(int fd, int d)
{
return ioctl(fd, TCSBRK, d);
#ifdef TCSBRKP
return ioctl(fd, TCSBRKP, d);
#else
return ioctl(fd, TCSBRK, 0);
#endif
}
static inline int tcflow(int fd, int a)