Skip to contentSkip to conversation

misc: microchip_flexcom: introduce microchip_flexcom driver

PATCH New Eugen.Hristev at microchip.com 1 participant 7 messages Oct 9, 2019 – Oct 24, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/6 misc: microchip_flexcom: introduce microchip_flexcom driver

From: Eugen Hristev <[email protected]>

The Microchip 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.
The bindings are kept as in Linux.
The driver registers to MISC_UCLASS.

---
 drivers/misc/Kconfig             |  9 ++++++
 drivers/misc/Makefile            |  1 +
 drivers/misc/microchip_flexcom.c | 64 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 74 insertions(+)
 create mode 100644 drivers/misc/microchip_flexcom.c
drivers/misc/Kconfig +9 -0
index 8037b6e..8b757c0 100644
@@ -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
drivers/misc/Makefile +1 -0
index 509c588..56d5a7a 100644
@@ -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
drivers/misc/microchip_flexcom.c new file +64 -0

64 lines not on this page · raw message

Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/6 misc: microchip_flexcom: introduce microchip_flexcom driver

Quoted 10 lines · On 09.10.2019 12:23, Eugen Hristev - M18282 wrote:

From: Eugen Hristev <[email protected]>

The Microchip 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.
The bindings are kept as in Linux.
The driver registers to MISC_UCLASS.

Applied to u-boot-atmel/master

#2 lore raw

PATCH 2/6 ARM: dts: sam9x60: add flx0 node

In reply to Eugen.Hristev at microchip.com

From: Eugen Hristev <[email protected]>

Add node for Flexcom0.

---
 arch/arm/dts/sam9x60.dtsi | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/arm/dts/sam9x60.dtsi +15 -0
index e01539e..41ac1f1 100644
@@ -73,6 +73,16 @@
 				status = "disabled";
 			};
 
+			flx0: flexcom at 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 at 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>;
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/6 ARM: dts: sam9x60ek: add i2c0 as flexcom0 subnode and eeprom memory

In reply to Eugen.Hristev at microchip.com

From: Eugen Hristev <[email protected]>

Add i2c0 bus as subnode to flx0.
Add eeprom memory as slave device to i2c0.

---
 arch/arm/dts/sam9x60ek.dts | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
arch/arm/dts/sam9x60ek.dts +29 -0
index bed59f3..8767de9 100644
@@ -15,6 +15,7 @@
 
 	chosen {
 		stdout-path = &dbgu;
+		i2c0 = &flx0;
 	};
 
 	onewire_tm: onewire {
@@ -45,6 +46,28 @@
 				};
 			};
 
+			flx0: flexcom at f801c600 {
+				atmel,flexcom-mode = <3>;
+				status = "okay";
+
+				i2c at 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 at 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>;
Signature · 1 line
2.7.4
#4 lore raw

PATCH 4/6 board: sam9x60ek: add support for MAC address retrieval

In reply to Eugen.Hristev at microchip.com

From: Eugen Hristev <[email protected]>

Retrieve mac address from i2c eeprom at boot time.

---
 board/atmel/sam9x60ek/sam9x60ek.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
board/atmel/sam9x60ek/sam9x60ek.c +12 -0
index 182b3ae..7be1dd5 100644
@@ -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 */
Signature · 1 line
2.7.4
#5 lore raw

PATCH 5/6 configs: sam9x60ek: enable microchip_flexcom, i2c and eeprom

In reply to Eugen.Hristev at microchip.com

From: Eugen Hristev <[email protected]>

enable driver model for i2c, eeprom for mac retrieval from eeprom i2c memory, and microchip_flexcom driver.

---
 configs/sam9x60ek_mmc_defconfig       | 7 +++++++
 configs/sam9x60ek_nandflash_defconfig | 7 +++++++
 configs/sam9x60ek_qspiflash_defconfig | 7 +++++++
 3 files changed, 21 insertions(+)
configs/sam9x60ek_mmc_defconfig +7 -0
index 0d3746a..7173501 100644
@@ -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
configs/sam9x60ek_nandflash_defconfig +7 -0
index cdba103..63966b5 100644
@@ -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
configs/sam9x60ek_qspiflash_defconfig +7 -0
index e1b292e..eed7b77 100644
@@ -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
Signature · 1 line
2.7.4
#6 lore raw

PATCH 6/6 MAINTAINERS: add MICRCOCHIP_FLEXCOM to at91

In reply to Eugen.Hristev at microchip.com

From: Eugen Hristev <[email protected]>

Add microchip flexcom driver to at91.

---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
index c536566..628fa6e 100644
@@ -245,6 +245,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 <[email protected]>
Signature · 1 line
2.7.4