Second set of u-boot-atmel features and fixes for 2020.01 cycle

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJdspnqAAoJEB6zHgIOrC/Ixi4IAJEEiCZPu6Z3fbkFX/Um7vCX
 eMTltJN8nz4oiSi3xdx3ejueqWdW3F8VuCkHb0j0bVAhMlUlVgwCzfd0cD+D2iwS
 jkrgzASNAr+JeYKYEdWqqfaUxOCd2qfuBu9EXlpvKQLWLt+KRfsOsHWcgR4bf095
 aGCihvd/fKhKYUvbf5cEQnsWa3UwtsKk4Web5MKjxXx3p0iVNlu4KLd/vDWfTios
 X1NqiO5ZjXNrDxyG6Aj8lgDXlE5kfeKaN/aCJU1/0U2cXm8JRu2w2dv1P/e/kU+j
 NHIGzICAG4Lk/4gQTeuohJxLyvj7K3i1H12ik9Qeh4H1/5fsyybyltGUo7H443s=
 =JYe3
 -----END PGP SIGNATURE-----

Merge tag 'u-boot-atmel-2020.01-b' of https://gitlab.denx.de/u-boot/custodians/u-boot-atmel

Second set of u-boot-atmel features and fixes for 2020.01 cycle

This feature set includes Eugen's work on a new tiny flexcom driver and
eeprom mac retrieval for the sam9x60-ek board.
This commit is contained in:
Tom Rini 2019-10-25 13:50:33 -04:00
commit c9e50bb12a
10 changed files with 152 additions and 0 deletions

View File

@ -246,6 +246,7 @@ S: Maintained
T: git https://gitlab.denx.de/u-boot/custodians/u-boot-atmel.git
F: arch/arm/mach-at91/
F: board/atmel/
F: drivers/misc/microchip_flexcom.c
ARM OWL
M: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

View File

@ -73,6 +73,16 @@
status = "disabled";
};
flx0: flexcom@f801c600 {
compatible = "atmel,sama5d2-flexcom";
reg = <0xf801c000 0x200>;
clocks = <&flx0_clk>;
#address-cells = <1>;
#size-cells = <1>;
ranges = <0x0 0xf801c000 0x800>;
status = "disabled";
};
macb0: ethernet@f802c000 {
compatible = "cdns,sam9x60-macb", "cdns,macb";
reg = <0xf802c000 0x100>;
@ -221,6 +231,11 @@
reg = <3>;
};
flx0_clk: flx0_clk {
#clock-cells = <0>;
reg = <5>;
};
pioD_clk: pioD_clk {
#clock-cells = <0>;
reg = <44>;

View File

@ -15,6 +15,7 @@
chosen {
stdout-path = &dbgu;
i2c0 = &flx0;
};
onewire_tm: onewire {
@ -45,6 +46,28 @@
};
};
flx0: flexcom@f801c600 {
atmel,flexcom-mode = <3>;
status = "okay";
i2c@600 {
compatible = "atmel,sama5d2-i2c";
reg = <0x600 0x200>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_flx0>;
#address-cells = <1>;
#size-cells = <0>;
clocks = <&flx0_clk>;
status = "okay";
eeprom@53 {
compatible = "atmel,24c32";
reg = <0x53>;
pagesize = <16>;
};
};
};
pinctrl {
pinctrl_qspi: qspi {
atmel,pins =
@ -56,6 +79,12 @@
AT91_PIOB 24 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>;
};
pinctrl_flx0: flx0_default {
atmel,pins =
<AT91_PIOA 0 AT91_PERIPH_A AT91_PINCTRL_NONE
AT91_PIOA 1 AT91_PERIPH_A AT91_PINCTRL_NONE>;
};
pinctrl_onewire_tm_default: onewire_tm_default {
atmel,pins =
<AT91_PIOD 14 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP>;

View File

@ -106,6 +106,18 @@ int board_early_init_f(void)
}
#endif
#define MAC24AA_MAC_OFFSET 0xfa
#ifdef CONFIG_MISC_INIT_R
int misc_init_r(void)
{
#ifdef CONFIG_I2C_EEPROM
at91_set_ethaddr(MAC24AA_MAC_OFFSET);
#endif
return 0;
}
#endif
int board_init(void)
{
/* address of boot parameters */

View File

@ -15,10 +15,13 @@ CONFIG_BOOTDELAY=3
CONFIG_USE_BOOTARGS=y
CONFIG_BOOTARGS="mem=256M console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait"
CONFIG_SYS_CONSOLE_IS_IN_ENV=y
CONFIG_MISC_INIT_R=y
# CONFIG_DISPLAY_BOARDINFO is not set
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PROMPT="U-Boot> "
CONFIG_CMD_BOOTZ=y
CONFIG_CMD_DM=y
CONFIG_CMD_I2C=y
CONFIG_CMD_MMC=y
# CONFIG_CMD_SETEXPR is not set
CONFIG_CMD_DHCP=y
@ -35,6 +38,10 @@ CONFIG_CLK_AT91=y
CONFIG_AT91_GENERIC_CLK=y
CONFIG_DM_GPIO=y
CONFIG_AT91_GPIO=y
CONFIG_DM_I2C=y
CONFIG_SYS_I2C_AT91=y
CONFIG_I2C_EEPROM=y
CONFIG_MICROCHIP_FLEXCOM=y
CONFIG_DM_MMC=y
CONFIG_MMC_SDHCI=y
CONFIG_MMC_SDHCI_ATMEL=y

View File

@ -14,10 +14,13 @@ CONFIG_BOOTDELAY=3
CONFIG_USE_BOOTARGS=y
CONFIG_BOOTARGS="console=ttyS0,115200 earlyprintk mtdparts=atmel_nand:256k(bootstrap)ro,768k(uboot)ro,256k(env_redundant),256k(env),512k(dtb),6M(kernel)ro,-(rootfs) rootfstype=ubifs ubi.mtd=12 root=ubi0:rootfs rw"
CONFIG_SYS_CONSOLE_IS_IN_ENV=y
CONFIG_MISC_INIT_R=y
# CONFIG_DISPLAY_BOARDINFO is not set
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PROMPT="U-Boot> "
CONFIG_CMD_BOOTZ=y
CONFIG_CMD_DM=y
CONFIG_CMD_I2C=y
# CONFIG_CMD_FLASH is not set
CONFIG_CMD_MMC=y
CONFIG_CMD_NAND=y
@ -37,6 +40,10 @@ CONFIG_CLK_AT91=y
CONFIG_AT91_GENERIC_CLK=y
CONFIG_DM_GPIO=y
CONFIG_AT91_GPIO=y
CONFIG_DM_I2C=y
CONFIG_SYS_I2C_AT91=y
CONFIG_I2C_EEPROM=y
CONFIG_MICROCHIP_FLEXCOM=y
CONFIG_DM_MMC=y
CONFIG_GENERIC_ATMEL_MCI=y
CONFIG_PHY_MICREL=y

View File

@ -16,10 +16,13 @@ CONFIG_BOOTDELAY=3
CONFIG_USE_BOOTARGS=y
CONFIG_BOOTARGS="console=ttyS0,115200 earlyprintk mtdparts=atmel_nand:256k(bootstrap)ro,768k(uboot)ro,256k(env_redundant),256k(env),512k(dtb),6M(kernel)ro,-(rootfs) rootfstype=ubifs ubi.mtd=12 root=ubi0:rootfs rw"
CONFIG_SYS_CONSOLE_IS_IN_ENV=y
CONFIG_MISC_INIT_R=y
# CONFIG_DISPLAY_BOARDINFO is not set
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PROMPT="U-Boot> "
CONFIG_CMD_BOOTZ=y
CONFIG_CMD_DM=y
CONFIG_CMD_I2C=y
# CONFIG_CMD_FLASH is not set
CONFIG_CMD_MMC=y
CONFIG_CMD_NAND=y
@ -48,6 +51,10 @@ CONFIG_CLK_AT91=y
CONFIG_AT91_GENERIC_CLK=y
CONFIG_DM_GPIO=y
CONFIG_AT91_GPIO=y
CONFIG_DM_I2C=y
CONFIG_SYS_I2C_AT91=y
CONFIG_I2C_EEPROM=y
CONFIG_MICROCHIP_FLEXCOM=y
CONFIG_DM_MMC=y
CONFIG_GENERIC_ATMEL_MCI=y
CONFIG_MTD=y

View File

@ -412,4 +412,13 @@ config IHS_FPGA
by the devices. This driver supports both CON and CPU variants of the
devices, depending on the device tree entry.
config MICROCHIP_FLEXCOM
bool "Enable Microchip Flexcom driver"
depends on MISC
help
The Atmel Flexcom is just a wrapper which embeds a SPI controller,
an I2C controller and an USART.
Only one function can be used at a time and is chosen at boot time
according to the device tree.
endmenu

View File

@ -65,3 +65,4 @@ obj-$(CONFIG_TWL4030_LED) += twl4030_led.o
obj-$(CONFIG_VEXPRESS_CONFIG) += vexpress_config.o
obj-$(CONFIG_WINBOND_W83627) += winbond_w83627.o
obj-$(CONFIG_JZ4780_EFUSE) += jz4780_efuse.o
obj-$(CONFIG_MICROCHIP_FLEXCOM) += microchip_flexcom.o

View File

@ -0,0 +1,64 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* (C) Copyright 2019, Microchip Technology, Inc.
* Author: Eugen Hristev <eugen.hristev@microchip.com>
*/
#include <common.h>
#include <dm.h>
#include <errno.h>
#include <misc.h>
#include <asm/io.h>
struct microchip_flexcom_regs {
u32 cr;
};
struct microchip_flexcom_platdata {
struct microchip_flexcom_regs *regs;
u32 flexcom_mode;
};
static int microchip_flexcom_ofdata_to_platdata(struct udevice *dev)
{
struct microchip_flexcom_platdata *plat = dev_get_platdata(dev);
int ret;
plat->regs = map_physmem(devfdt_get_addr(dev),
sizeof(struct microchip_flexcom_regs),
MAP_NOCACHE);
ret = dev_read_u32(dev, "atmel,flexcom-mode", &plat->flexcom_mode);
if (IS_ERR_VALUE(ret)) {
debug("Missing atmel,flexcom-mode property\n");
return ret;
}
/*
* The mode must have only 2 bits. If any other bits are set,
* the value is not supported.
*/
if (plat->flexcom_mode & 0xfffffffc) {
debug("Wrong atmel,flexcom-mode property\n");
return -EINVAL;
}
writel(plat->flexcom_mode, &plat->regs->cr);
return 0;
}
static const struct udevice_id microchip_flexcom_ids[] = {
{ .compatible = "atmel,sama5d2-flexcom" },
{ .compatible = "microchip,flexcom" },
{}
};
U_BOOT_DRIVER(microchip_flexcom) = {
.name = "microchip_flexcom",
.id = UCLASS_MISC,
.of_match = microchip_flexcom_ids,
.ofdata_to_platdata = microchip_flexcom_ofdata_to_platdata,
.platdata_auto_alloc_size = sizeof(struct microchip_flexcom_platdata),
};