diff options
author | Tom Rini | 2019-10-25 13:50:33 -0400 |
---|---|---|
committer | Tom Rini | 2019-10-25 13:50:33 -0400 |
commit | c9e50bb12af19a8365ae4d3099abb8db1abee785 (patch) | |
tree | 7728da43b2f33fc558d797ffe37172bfc522acc1 | |
parent | e382713d224d6fc14cf8fe8f6bb852f24ab652a7 (diff) | |
parent | 4c49753ce2e527c6b561ca6fbbd782b4914f83e2 (diff) |
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.
-rw-r--r-- | MAINTAINERS | 1 | ||||
-rw-r--r-- | arch/arm/dts/sam9x60.dtsi | 15 | ||||
-rw-r--r-- | arch/arm/dts/sam9x60ek.dts | 29 | ||||
-rw-r--r-- | board/atmel/sam9x60ek/sam9x60ek.c | 12 | ||||
-rw-r--r-- | configs/sam9x60ek_mmc_defconfig | 7 | ||||
-rw-r--r-- | configs/sam9x60ek_nandflash_defconfig | 7 | ||||
-rw-r--r-- | configs/sam9x60ek_qspiflash_defconfig | 7 | ||||
-rw-r--r-- | drivers/misc/Kconfig | 9 | ||||
-rw-r--r-- | drivers/misc/Makefile | 1 | ||||
-rw-r--r-- | drivers/misc/microchip_flexcom.c | 64 |
10 files changed, 152 insertions, 0 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 8766a702d8f..d2b7410a9b7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -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> diff --git a/arch/arm/dts/sam9x60.dtsi b/arch/arm/dts/sam9x60.dtsi index e01539e5ce2..41ac1f164c8 100644 --- a/arch/arm/dts/sam9x60.dtsi +++ b/arch/arm/dts/sam9x60.dtsi @@ -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>; diff --git a/arch/arm/dts/sam9x60ek.dts b/arch/arm/dts/sam9x60ek.dts index bed59f3da2a..8767de98b8d 100644 --- a/arch/arm/dts/sam9x60ek.dts +++ b/arch/arm/dts/sam9x60ek.dts @@ -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>; diff --git a/board/atmel/sam9x60ek/sam9x60ek.c b/board/atmel/sam9x60ek/sam9x60ek.c index 182b3aeed74..7be1dd54f46 100644 --- a/board/atmel/sam9x60ek/sam9x60ek.c +++ b/board/atmel/sam9x60ek/sam9x60ek.c @@ -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 */ diff --git a/configs/sam9x60ek_mmc_defconfig b/configs/sam9x60ek_mmc_defconfig index 0d3746a86ed..71735014f45 100644 --- a/configs/sam9x60ek_mmc_defconfig +++ b/configs/sam9x60ek_mmc_defconfig @@ -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 diff --git a/configs/sam9x60ek_nandflash_defconfig b/configs/sam9x60ek_nandflash_defconfig index cdba103fc41..63966b5e909 100644 --- a/configs/sam9x60ek_nandflash_defconfig +++ b/configs/sam9x60ek_nandflash_defconfig @@ -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 diff --git a/configs/sam9x60ek_qspiflash_defconfig b/configs/sam9x60ek_qspiflash_defconfig index e1b292ea392..eed7b77cf35 100644 --- a/configs/sam9x60ek_qspiflash_defconfig +++ b/configs/sam9x60ek_qspiflash_defconfig @@ -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 diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index ba50893b432..4985ea033b1 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -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 diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index 0001d105bae..f61263640b8 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -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 diff --git a/drivers/misc/microchip_flexcom.c b/drivers/misc/microchip_flexcom.c new file mode 100644 index 00000000000..1bc19edfcba --- /dev/null +++ b/drivers/misc/microchip_flexcom.c @@ -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), +}; |