board: xilinx: zyqmp: add Beckhoff CX8200
Subsystems (5)
cover board: xilinx: zyqmp: add Beckhoff CX8200
From: Steffen Dirkwinkel <[email protected]>
This adds support for the Beckhoff CX8200 series of industrial embedded PCs. There is some information about the device and features here:
https://www.beckhoff.com/en-en/products/ipc/embedded-pcs/cx8200-arm-cortex-a53/
We also add the rtc rv3032 driver from linux, as it is required for mac address loading, fix usb without reset gpios on zynqmp and move the fdt loadaddr to be compatible with less memory.
Steffen Dirkwinkel (5):
drivers: rtc: add rv3032 driver
drivers/usb/dwc3: zynqmp: only free reset gpio if we have one
xilinx: zynqmp: move fdt_addr so we can use devices with less memory
xilinx: zynqmp: add Beckhoff CX8200
xilinx: zynqmp: beckhoff cx8200: setup inner cache broadcasting
arch/arm/dts/Makefile | 1 + arch/arm/dts/zynqmp-beckhoff-cx8200.dts | 247 +++ .../zynqmp-beckhoff-cx8200/psu_init_gpl.c | 1960 +++++++++++++++++ .../zynqmp/zynqmp-beckhoff-cx8200/regs.init | 1 + configs/xilinx_zynqmp_virt_defconfig | 2 +- drivers/rtc/Kconfig | 10 + drivers/rtc/Makefile | 1 + drivers/rtc/rv3032.c | 334 +++ drivers/usb/dwc3/dwc3-generic.c | 4 +- include/configs/xilinx_zynqmp.h | 2 +- 10 files changed, 2559 insertions(+), 3 deletions(-) create mode 100644 arch/arm/dts/zynqmp-beckhoff-cx8200.dts create mode 100644 board/xilinx/zynqmp/zynqmp-beckhoff-cx8200/psu_init_gpl.c create mode 100644 board/xilinx/zynqmp/zynqmp-beckhoff-cx8200/regs.init create mode 100644 drivers/rtc/rv3032.c
Signature · 1 line
2.42.0
PATCH 1/5 drivers: rtc: add rv3032 driver
From: Steffen Dirkwinkel <[email protected]>
Based on linux driver, with these differences:
- no support for trickle charger
- no support for hwmon
- no support for battery backed memory
- dm_i2c instead of regmap
- different tm_year and tm_mon
read/write access the user eeprom. The read and write functions access the user eeprom so it can be used for nvmem-cells. (like in arch/sandbox/dts/test.dts). This is currently different from linux as you'd get nvram using nvmem-cells. I'm hoping to switch the order there too (there are currently no users) or to make a more specific binding. Currently this would also just work as is if used for mac addresses, as u-boot will put these into fdt before booting linux and linux will then prefer the u-boot provided mac.
---
drivers/rtc/Kconfig | 10 ++ drivers/rtc/Makefile | 1 + drivers/rtc/rv3032.c | 334 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 345 insertions(+) create mode 100644 drivers/rtc/rv3032.c
drivers/rtc/Kconfig +10 -0
@@ -172,6 +172,16 @@ config RTC_RV3029 This driver supports reading and writing the RTC/calendar and the battery-baced SRAM section. +config RTC_RV3032 + bool "Enable RV3032 driver" + depends on DM_RTC + help + The MicroCrystal RV3032 is a I2C Real Time Clock (RTC) with a 16-byte + battery-backed SRAM and a 32-byte user eeprom. + + This driver supports reading and writing the RTC/calendar and the + user eeprom. + config RTC_RV8803 bool "Enable RV8803 driver" depends on DM_RTC
drivers/rtc/Makefile +1 -0
@@ -31,6 +31,7 @@ obj-$(CONFIG_RTC_PL031) += pl031.o obj-$(CONFIG_RTC_PT7C4338) += pt7c4338.o obj-$(CONFIG_RTC_RV3028) += rv3028.o obj-$(CONFIG_RTC_RV3029) += rv3029.o +obj-$(CONFIG_RTC_RV3032) += rv3032.o obj-$(CONFIG_RTC_RV8803) += rv8803.o obj-$(CONFIG_RTC_RX8025) += rx8025.o obj-$(CONFIG_RTC_RX8010SJ) += rx8010sj.o
drivers/rtc/rv3032.c new file +334 -0
334 lines not on this page · raw message
Signature · 1 line
2.42.0
Alexandre Belloni
maintainerRe: [PATCH 1/5] drivers: rtc: add rv3032 driver
Hello,
Quoted 9 lines · Steffen Dirkwinkel
From: Steffen Dirkwinkel <[email protected]>
Based on linux driver, with these differences:
- no support for trickle charger
- no support for hwmon
- no support for battery backed memory
-dm_i2cinstead of regmap
- differenttm_yearandtm_mon
Quoted 4 lines
read/write access the user eeprom. The read and write functions access the user eeprom so it can be used for nvmem-cells. (like in
arch/sandbox/dts/test.dts). This is currently different from linux as you'd get nvram using nvmem-cells. I'm hoping to switch the order there
I'm not sure I get this as both nvram and eeprom are exposed through nvmem. The solution is not to reorder but instead to fix the nvmem core so you can expose both using nvmem-cells as there are users that access the nvram to handle A/B updates (bootcount, rescue mode,...)
Quoted 391 lines
too (there are currently no users) or to make a more specific binding. Currently this would also just work as is if used for mac addresses, as u-boot will put these into fdt before booting linux and linux will then prefer the u-boot provided mac.
Signed-off-by Steffen Dirkwinkel <[email protected]>---
drivers/rtc/Kconfig | 10 ++ drivers/rtc/Makefile | 1 + drivers/rtc/rv3032.c | 334 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 345 insertions(+) create mode 100644 drivers/rtc/rv3032.cdrivers/rtc/Kconfig +10
-0@@ -172,6 +172,16 @@ config RTC_RV3029 This driver supports reading and writing the RTC/calendar and the battery-baced SRAM section. +config RTC_RV3032 + bool "Enable RV3032 driver" + depends on DM_RTC + help + The MicroCrystal RV3032 is a I2C Real Time Clock (RTC) with a 16-byte + battery-backed SRAM and a 32-byte user eeprom. + + This driver supports reading and writing the RTC/calendar and the + user eeprom. + config RTC_RV8803 bool "Enable RV8803 driver" depends on DM_RTCdrivers/rtc/Makefile +1
-0@@ -31,6 +31,7 @@ obj-$(CONFIG_RTC_PL031) += pl031.o obj-$(CONFIG_RTC_PT7C4338) += pt7c4338.o obj-$(CONFIG_RTC_RV3028) += rv3028.o obj-$(CONFIG_RTC_RV3029) += rv3029.o +obj-$(CONFIG_RTC_RV3032) += rv3032.o obj-$(CONFIG_RTC_RV8803) += rv8803.o obj-$(CONFIG_RTC_RX8025) += rx8025.o obj-$(CONFIG_RTC_RX8010SJ) += rx8010sj.odrivers/rtc/rv3032.c new file +334
-0@@ -0,0 +1,334 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* RTC driver for the Micro Crystal RV3032 +* +* based on linux driver from +* Copyright (C) 2020 Micro Crystal SA +* +* Alexandre Belloni <[email protected]> +* +*/ + +#include <dm.h> +#include <i2c.h> +#include <linux/delay.h> +#include <regmap.h> +#include <rtc.h> +#include <time.h> + +#define RV3032_SEC 0x01 +#define RV3032_MIN 0x02 +#define RV3032_HOUR 0x03 +#define RV3032_WDAY 0x04 +#define RV3032_DAY 0x05 +#define RV3032_MONTH 0x06 +#define RV3032_YEAR 0x07 +#define RV3032_ALARM_MIN 0x08 +#define RV3032_ALARM_HOUR 0x09 +#define RV3032_ALARM_DAY 0x0A +#define RV3032_STATUS 0x0D +#define RV3032_TLSB 0x0E +#define RV3032_TMSB 0x0F +#define RV3032_CTRL1 0x10 +#define RV3032_CTRL2 0x11 +#define RV3032_CTRL3 0x12 +#define RV3032_TS_CTRL 0x13 +#define RV3032_CLK_IRQ 0x14 +#define RV3032_EEPROM_ADDR 0x3D +#define RV3032_EEPROM_DATA 0x3E +#define RV3032_EEPROM_CMD 0x3F +#define RV3032_RAM1 0x40 +#define RV3032_PMU 0xC0 +#define RV3032_OFFSET 0xC1 +#define RV3032_CLKOUT1 0xC2 +#define RV3032_CLKOUT2 0xC3 +#define RV3032_TREF0 0xC4 +#define RV3032_TREF1 0xC5 + +#define RV3032_STATUS_VLF BIT(0) +#define RV3032_STATUS_PORF BIT(1) +#define RV3032_STATUS_EVF BIT(2) +#define RV3032_STATUS_AF BIT(3) +#define RV3032_STATUS_TF BIT(4) +#define RV3032_STATUS_UF BIT(5) +#define RV3032_STATUS_TLF BIT(6) +#define RV3032_STATUS_THF BIT(7) + +#define RV3032_TLSB_CLKF BIT(1) +#define RV3032_TLSB_EEBUSY BIT(2) +#define RV3032_TLSB_TEMP GENMASK(7, 4) + +#define RV3032_CLKOUT2_HFD_MSK GENMASK(4, 0) +#define RV3032_CLKOUT2_FD_MSK GENMASK(6, 5) +#define RV3032_CLKOUT2_OS BIT(7) + +#define RV3032_CTRL1_EERD BIT(3) +#define RV3032_CTRL1_WADA BIT(5) + +#define RV3032_CTRL2_STOP BIT(0) +#define RV3032_CTRL2_EIE BIT(2) +#define RV3032_CTRL2_AIE BIT(3) +#define RV3032_CTRL2_TIE BIT(4) +#define RV3032_CTRL2_UIE BIT(5) +#define RV3032_CTRL2_CLKIE BIT(6) +#define RV3032_CTRL2_TSE BIT(7) + +#define RV3032_PMU_TCM GENMASK(1, 0) +#define RV3032_PMU_TCR GENMASK(3, 2) +#define RV3032_PMU_BSM GENMASK(5, 4) +#define RV3032_PMU_NCLKE BIT(6) + +#define RV3032_PMU_BSM_DSM 1 +#define RV3032_PMU_BSM_LSM 2 + +#define RV3032_OFFSET_MSK GENMASK(5, 0) + +#define RV3032_EVT_CTRL_TSR BIT(2) + +#define RV3032_EEPROM_CMD_UPDATE 0x11 +#define RV3032_EEPROM_CMD_WRITE 0x21 +#define RV3032_EEPROM_CMD_READ 0x22 + +#define RV3032_EEPROM_USER 0xCB + +#define RV3032_EEBUSY_POLL 10000 +#define RV3032_EEBUSY_TIMEOUT 100000 + +#define OFFSET_STEP_PPT 238419 + +static int rv3032_update_bits (struct udevice *dev,u8 reg,u8 mask,u8 set) +{ +u8 buf; +int ret; + + ret =dm_i2c_read (dev, reg, &buf,1 ); +if (ret <0 ) +return ret; + +if ((buf & mask) == (set && mask)) +return 0 ; + + buf = (buf & ~mask) | (set & mask); + ret =dm_i2c_read (dev, reg, &buf,1 ); +if (ret <0 ) +return ret; + +return 0 ; +} + +static int rv3032_exit_eerd (struct udevice *dev,u32 eerd) +{ +if (eerd) +return 0 ; + +return rv3032_update_bits (dev,RV3032_CTRL1 ,RV3032_CTRL1_EERD ,0 ); +} + +static int rv3032_eeprom_busywait (struct udevice *dev) +{ +int ret; +u8 status; +unsigned long start =get_timer (0 ); + +for (;;) { + ret =dm_i2c_read (dev,RV3032_TLSB , &status,1 ); +if (ret <0 ) +break ; +if (!(status &RV3032_TLSB_EEBUSY )) +break ; +if (get_timer (start) >RV3032_EEBUSY_TIMEOUT ) +return -ETIMEDOUT ; +udelay (RV3032_EEBUSY_POLL ); + } + +return ret; +} + +static int rv3032_enter_eerd (struct udevice *dev,u32 *eerd) +{ +u8 ctrl1; +int ret; + + ret =dm_i2c_read (dev,RV3032_CTRL1 , &ctrl1,sizeof (ctrl1)); +if (ret) +return ret; + + *eerd = ctrl1 &RV3032_CTRL1_EERD ; +if (*eerd) +return 0 ; + + ret =rv3032_update_bits (dev,RV3032_CTRL1 , +RV3032_CTRL1_EERD ,RV3032_CTRL1_EERD ); +if (ret) +return ret; + + ret =rv3032_eeprom_busywait (dev); +if (ret) { +rv3032_exit_eerd (dev, *eerd); + +return ret; + } + +return 0 ; +} + +static int rv3032_get_time (struct udevice *dev,struct rtc_time *tm) +{ +u8 date[7 ]; +int ret; +u8 status; + + ret =dm_i2c_read (dev,RV3032_STATUS , &status,1 ); +if (ret <0 ) +return ret; + +if (status & (RV3032_STATUS_PORF |RV3032_STATUS_VLF )) +return -EINVAL ; + + ret =dm_i2c_read (dev,RV3032_SEC , date,sizeof (date)); +if (ret) +return ret; + + tm->tm_sec =bcd2bin (date[0 ] &0x7f ); + tm->tm_min =bcd2bin (date[1 ] &0x7f ); + tm->tm_hour =bcd2bin (date[2 ] &0x3f ); + tm->tm_wday = date[3 ] &0x7 ; + tm->tm_mday =bcd2bin (date[4 ] &0x3f ); + tm->tm_mon =bcd2bin (date[5 ] &0x1f ); + tm->tm_year =bcd2bin (date[6 ]) +2000 ; + +return 0 ; +} + +static int rv3032_set_time (struct udevice *dev,const struct rtc_time *tm) +{ +u8 date[7 ]; +int ret; + + date[0 ] =bin2bcd (tm->tm_sec); + date[1 ] =bin2bcd (tm->tm_min); + date[2 ] =bin2bcd (tm->tm_hour); + date[3 ] = tm->tm_wday; + date[4 ] =bin2bcd (tm->tm_mday); + date[5 ] =bin2bcd (tm->tm_mon); + date[6 ] =bin2bcd (tm->tm_year -2000 ); + + ret =dm_i2c_write (dev,RV3032_SEC , date, +sizeof (date)); +if (ret) +return ret; + + ret =rv3032_update_bits (dev,RV3032_STATUS , +RV3032_STATUS_PORF |RV3032_STATUS_VLF ,0 ); + +return ret; +} + +static int rv3032_eeprom_write (struct udevice *dev,unsigned int reg, +const u8 *buf,unsigned int len) +{ +u32 eerd; +int i, ret; +u8 cmd; + + ret =rv3032_enter_eerd (dev, &eerd); +if (ret) +return ret; + +for (i =0 ; i < len; i++) { + cmd =RV3032_EEPROM_USER + reg + i; + ret =dm_i2c_write (dev,RV3032_EEPROM_ADDR , + &cmd,1 ); +if (ret) + goto exit_eerd; + + ret =dm_i2c_write (dev,RV3032_EEPROM_DATA , &buf[i],1 ); +if (ret) + goto exit_eerd; + + cmd =RV3032_EEPROM_CMD_WRITE ; + ret =dm_i2c_write (dev,RV3032_EEPROM_CMD , + &cmd,1 ); +if (ret) + goto exit_eerd; + +udelay (RV3032_EEBUSY_POLL ); + + ret =rv3032_eeprom_busywait (dev); +if (ret) + goto exit_eerd; + } + +exit_eerd: +rv3032_exit_eerd (dev, eerd); + +return ret; +} + +static int rv3032_eeprom_read (struct udevice *dev,unsigned int reg, +u8 *buf,unsigned int len) +{ +u32 eerd; +int i, ret; +u8 cmd, data; + + ret =rv3032_enter_eerd (dev, &eerd); +if (ret) +return ret; + +for (i =0 ; i < len; i++) { + cmd =RV3032_EEPROM_USER + reg + i; + ret =dm_i2c_write (dev,RV3032_EEPROM_ADDR , + &cmd,1 ); +if (ret) + goto exit_eerd; + + cmd =RV3032_EEPROM_CMD_READ ; + ret =dm_i2c_write (dev,RV3032_EEPROM_CMD , + &cmd,1 ); +if (ret) + goto exit_eerd; + + ret =rv3032_eeprom_busywait (dev); +if (ret) + goto exit_eerd; + + ret =dm_i2c_read (dev,RV3032_EEPROM_DATA , &data,sizeof (data)); +if (ret) + goto exit_eerd; + buf[i] = data; + } + +exit_eerd: +rv3032_exit_eerd (dev, eerd); + +return ret; +} + +static int rv3032_probe (struct udevice *dev) +{ +i2c_set_chip_flags (dev,DM_I2C_CHIP_RD_ADDRESS | +DM_I2C_CHIP_WR_ADDRESS ); + +return 0 ; +} + +static const struct rtc_ops rv3032_rtc_ops = { + .get = rv3032_get_time, + .set = rv3032_set_time, + .read = rv3032_eeprom_read, + .write = rv3032_eeprom_write, +}; + +static const struct udevice_id rv3032_rtc_ids[] = { + { .compatible ="microcrystal,rv3032" , }, + { } +}; + +U_BOOT_DRIVER (rtc_rv3032) = { + .name ="rtc-rv3028" , + .id =UCLASS_RTC , + .probe = rv3032_probe, + .of_match = rv3032_rtc_ids, + .ops = &rv3032_rtc_ops, +};Signature · 1 line
2.42.0
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Re: [PATCH 1/5] drivers: rtc: add rv3032 driver
Hi,
Quoted 19 lines · Alexandre Belloni
Hello,
Quoted 9 lines · Steffen Dirkwinkel
From: Steffen Dirkwinkel <[email protected]>
Based on linux driver, with these differences:
- no support for trickle charger
- no support for hwmon
- no support for battery backed memory
-dm_i2cinstead of regmap
- differenttm_yearandtm_monQuoted 4 lines
read/write access the user eeprom. The read and write functions access the user eeprom so it can be used for nvmem-cells. (like in
arch/sandbox/dts/test.dts). This is currently different from linux as you'd get nvram using nvmem-cells. I'm hoping to switch the order there
Quoted 4 lines
I'm not sure I get this as both nvram and eeprom are exposed through nvmem. The solution is not to reorder but instead to fix the nvmem core so you can expose both using nvmem-cells as there are users that access the nvram to handle A/B updates (bootcount, rescue mode,...)
How does one set the nvmem location to be in eeprom on the linux driver? Maybe I just don’t understand the binding correctly?
Currently I have this:
rv3032: rtc@51 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "microcrystal,rv3032”;
reg = <0x51>;
interrupt-parent = <&gpio>;
interrupts = <11 IRQ_TYPE_LEVEL_LOW>;gem2_mac_address: mac-address@0 {
reg = <0x0 6>;
};
};
On Linux that would read from battery backed ram.
Is there some way to specify it is in eeprom?
Quoted 389 lines
Quoted 389 lines
too (there are currently no users) or to make a more specific binding. Currently this would also just work as is if used for mac addresses, as u-boot will put these into fdt before booting linux and linux will then prefer the u-boot provided mac.
Signed-off-by Steffen Dirkwinkel <[email protected]>---
drivers/rtc/Kconfig | 10 ++ drivers/rtc/Makefile | 1 + drivers/rtc/rv3032.c | 334 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 345 insertions(+)create mode 100644
drivers/rtc/rv3032.cdrivers/rtc/Kconfig +10
-0@@ -172,6 +172,16 @@ config RTC_RV3029 This driver supports reading and writing the RTC/calendar and the battery-baced SRAM section. +config RTC_RV3032 + bool "Enable RV3032 driver" + depends on DM_RTC + help + The MicroCrystal RV3032 is a I2C Real Time Clock (RTC) with a 16-byte + battery-backed SRAM and a 32-byte user eeprom. + + This driver supports reading and writing the RTC/calendar and the + user eeprom. +config
RTC_RV8803
bool "Enable RV8803 driver"
depends onDM_RTCdrivers/rtc/Makefile +0
-0@@ -31,6 +31,7 @@ obj-$(CONFIG_RTC_PL031) += pl031.oobj-$(CONFIG_RTC_PT7C4338) += pt7c4338.o
obj-$(CONFIG_RTC_RV3028) += rv3028.o
obj-$(CONFIG_RTC_RV3029) += rv3029.o
+obj-$(CONFIG_RTC_RV3032) += rv3032.o
obj-$(CONFIG_RTC_RV8803) += rv8803.o
obj-$(CONFIG_RTC_RX8025) += rx8025.o
obj-$(CONFIG_RTC_RX8010SJ) += rx8010sj.odrivers/rtc/rv3032.c new file +334
-0@@ -0,0 +1,334 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* RTC driver for the Micro Crystal RV3032 +* +* based on linux driver from +* Copyright (C) 2020 Micro Crystal SA +* +* Alexandre Belloni <[email protected]> +* +*/ + +#include <dm.h> +#include <i2c.h> +#include <linux/delay.h> +#include <regmap.h> +#include <rtc.h> +#include <time.h> + +#define RV3032_SEC 0x01 +#define RV3032_MIN 0x02 +#define RV3032_HOUR 0x03 +#define RV3032_WDAY 0x04 +#define RV3032_DAY 0x05 +#define RV3032_MONTH 0x06 +#define RV3032_YEAR 0x07 +#define RV3032_ALARM_MIN 0x08 +#define RV3032_ALARM_HOUR 0x09 +#define RV3032_ALARM_DAY 0x0A +#define RV3032_STATUS 0x0D +#define RV3032_TLSB 0x0E +#define RV3032_TMSB 0x0F +#define RV3032_CTRL1 0x10 +#define RV3032_CTRL2 0x11 +#define RV3032_CTRL3 0x12 +#define RV3032_TS_CTRL 0x13 +#define RV3032_CLK_IRQ 0x14 +#define RV3032_EEPROM_ADDR 0x3D +#define RV3032_EEPROM_DATA 0x3E +#define RV3032_EEPROM_CMD 0x3F +#define RV3032_RAM1 0x40 +#define RV3032_PMU 0xC0 +#define RV3032_OFFSET 0xC1 +#define RV3032_CLKOUT1 0xC2 +#define RV3032_CLKOUT2 0xC3 +#define RV3032_TREF0 0xC4 +#define RV3032_TREF1 0xC5 + +#define RV3032_STATUS_VLF BIT(0) +#define RV3032_STATUS_PORF BIT(1) +#define RV3032_STATUS_EVF BIT(2) +#define RV3032_STATUS_AF BIT(3) +#define RV3032_STATUS_TF BIT(4) +#define RV3032_STATUS_UF BIT(5) +#define RV3032_STATUS_TLF BIT(6) +#define RV3032_STATUS_THF BIT(7) + +#define RV3032_TLSB_CLKF BIT(1) +#define RV3032_TLSB_EEBUSY BIT(2) +#define RV3032_TLSB_TEMP GENMASK(7, 4) + +#define RV3032_CLKOUT2_HFD_MSK GENMASK(4, 0) +#define RV3032_CLKOUT2_FD_MSK GENMASK(6, 5) +#define RV3032_CLKOUT2_OS BIT(7) + +#define RV3032_CTRL1_EERD BIT(3) +#define RV3032_CTRL1_WADA BIT(5) + +#define RV3032_CTRL2_STOP BIT(0) +#define RV3032_CTRL2_EIE BIT(2) +#define RV3032_CTRL2_AIE BIT(3) +#define RV3032_CTRL2_TIE BIT(4) +#define RV3032_CTRL2_UIE BIT(5) +#define RV3032_CTRL2_CLKIE BIT(6) +#define RV3032_CTRL2_TSE BIT(7) + +#define RV3032_PMU_TCM GENMASK(1, 0) +#define RV3032_PMU_TCR GENMASK(3, 2) +#define RV3032_PMU_BSM GENMASK(5, 4) +#define RV3032_PMU_NCLKE BIT(6) + +#define RV3032_PMU_BSM_DSM 1 +#define RV3032_PMU_BSM_LSM 2 + +#define RV3032_OFFSET_MSK GENMASK(5, 0) + +#define RV3032_EVT_CTRL_TSR BIT(2) + +#define RV3032_EEPROM_CMD_UPDATE 0x11 +#define RV3032_EEPROM_CMD_WRITE 0x21 +#define RV3032_EEPROM_CMD_READ 0x22 + +#define RV3032_EEPROM_USER 0xCB + +#define RV3032_EEBUSY_POLL 10000 +#define RV3032_EEBUSY_TIMEOUT 100000 + +#define OFFSET_STEP_PPT 238419 + +static int rv3032_update_bits (struct udevice *dev,u8 reg,u8 mask,u8 set) +{ +u8 buf; +int ret; + + ret =dm_i2c_read (dev, reg, &buf,1 ); +if (ret <0 ) +return ret; + +if ((buf & mask) == (set && mask)) +return 0 ; + + buf = (buf & ~mask) | (set & mask); + ret =dm_i2c_read (dev, reg, &buf,1 ); +if (ret <0 ) +return ret; + +return 0 ; +} + +static int rv3032_exit_eerd (struct udevice *dev,u32 eerd) +{ +if (eerd) +return 0 ; + +return rv3032_update_bits (dev,RV3032_CTRL1 ,RV3032_CTRL1_EERD ,0 ); +} + +static int rv3032_eeprom_busywait (struct udevice *dev) +{ +int ret; +u8 status; +unsigned long start =get_timer (0 ); + +for (;;) { + ret =dm_i2c_read (dev,RV3032_TLSB , &status,1 ); +if (ret <0 ) +break ; +if (!(status &RV3032_TLSB_EEBUSY )) +break ; +if (get_timer (start) >RV3032_EEBUSY_TIMEOUT ) +return -ETIMEDOUT ; +udelay (RV3032_EEBUSY_POLL ); + } + +return ret; +} + +static int rv3032_enter_eerd (struct udevice *dev,u32 *eerd) +{ +u8 ctrl1; +int ret; + + ret =dm_i2c_read (dev,RV3032_CTRL1 , &ctrl1,sizeof (ctrl1)); +if (ret) +return ret; + + *eerd = ctrl1 &RV3032_CTRL1_EERD ; +if (*eerd) +return 0 ; + + ret =rv3032_update_bits (dev,RV3032_CTRL1 , +RV3032_CTRL1_EERD ,RV3032_CTRL1_EERD ); +if (ret) +return ret; + + ret =rv3032_eeprom_busywait (dev); +if (ret) { +rv3032_exit_eerd (dev, *eerd); + +return ret; + } + +return 0 ; +} + +static int rv3032_get_time (struct udevice *dev,struct rtc_time *tm) +{ +u8 date[7 ]; +int ret; +u8 status; + + ret =dm_i2c_read (dev,RV3032_STATUS , &status,1 ); +if (ret <0 ) +return ret; + +if (status & (RV3032_STATUS_PORF |RV3032_STATUS_VLF )) +return -EINVAL ; + + ret =dm_i2c_read (dev,RV3032_SEC , date,sizeof (date)); +if (ret) +return ret; + + tm->tm_sec =bcd2bin (date[0 ] &0x7f ); + tm->tm_min =bcd2bin (date[1 ] &0x7f ); + tm->tm_hour =bcd2bin (date[2 ] &0x3f ); + tm->tm_wday = date[3 ] &0x7 ; + tm->tm_mday =bcd2bin (date[4 ] &0x3f ); + tm->tm_mon =bcd2bin (date[5 ] &0x1f ); + tm->tm_year =bcd2bin (date[6 ]) +2000 ; + +return 0 ; +} + +static int rv3032_set_time (struct udevice *dev,const struct rtc_time *tm) +{ +u8 date[7 ]; +int ret; + + date[0 ] =bin2bcd (tm->tm_sec); + date[1 ] =bin2bcd (tm->tm_min); + date[2 ] =bin2bcd (tm->tm_hour); + date[3 ] = tm->tm_wday; + date[4 ] =bin2bcd (tm->tm_mday); + date[5 ] =bin2bcd (tm->tm_mon); + date[6 ] =bin2bcd (tm->tm_year -2000 ); + + ret =dm_i2c_write (dev,RV3032_SEC , date, +sizeof (date)); +if (ret) +return ret; + + ret =rv3032_update_bits (dev,RV3032_STATUS , +RV3032_STATUS_PORF |RV3032_STATUS_VLF ,0 ); + +return ret; +} + +static int rv3032_eeprom_write (struct udevice *dev,unsigned int reg, +const u8 *buf,unsigned int len) +{ +u32 eerd; +int i, ret; +u8 cmd; + + ret =rv3032_enter_eerd (dev, &eerd); +if (ret) +return ret; + +for (i =0 ; i < len; i++) { + cmd =RV3032_EEPROM_USER + reg + i; + ret =dm_i2c_write (dev,RV3032_EEPROM_ADDR , + &cmd,1 ); +if (ret) + goto exit_eerd; + + ret =dm_i2c_write (dev,RV3032_EEPROM_DATA , &buf[i],1 ); +if (ret) + goto exit_eerd; + + cmd =RV3032_EEPROM_CMD_WRITE ; + ret =dm_i2c_write (dev,RV3032_EEPROM_CMD , + &cmd,1 ); +if (ret) + goto exit_eerd; + +udelay (RV3032_EEBUSY_POLL ); + + ret =rv3032_eeprom_busywait (dev); +if (ret) + goto exit_eerd; + } + +exit_eerd: +rv3032_exit_eerd (dev, eerd); + +return ret; +} + +static int rv3032_eeprom_read (struct udevice *dev,unsigned int reg, +u8 *buf,unsigned int len) +{ +u32 eerd; +int i, ret; +u8 cmd, data; + + ret =rv3032_enter_eerd (dev, &eerd); +if (ret) +return ret; + +for (i =0 ; i < len; i++) { + cmd =RV3032_EEPROM_USER + reg + i; + ret =dm_i2c_write (dev,RV3032_EEPROM_ADDR , + &cmd,1 ); +if (ret) + goto exit_eerd; + + cmd =RV3032_EEPROM_CMD_READ ; + ret =dm_i2c_write (dev,RV3032_EEPROM_CMD , + &cmd,1 ); +if (ret) + goto exit_eerd; + + ret =rv3032_eeprom_busywait (dev); +if (ret) + goto exit_eerd; + + ret =dm_i2c_read (dev,RV3032_EEPROM_DATA , &data,sizeof (data)); +if (ret) + goto exit_eerd; + buf[i] = data; + } + +exit_eerd: +rv3032_exit_eerd (dev, eerd); + +return ret; +} + +static int rv3032_probe (struct udevice *dev) +{ +i2c_set_chip_flags (dev,DM_I2C_CHIP_RD_ADDRESS | +DM_I2C_CHIP_WR_ADDRESS ); + +return 0 ; +} + +static const struct rtc_ops rv3032_rtc_ops = { + .get = rv3032_get_time, + .set = rv3032_set_time, + .read = rv3032_eeprom_read, + .write = rv3032_eeprom_write, +}; + +static const struct udevice_id rv3032_rtc_ids[] = { + { .compatible ="microcrystal,rv3032" , }, + { } +}; + +U_BOOT_DRIVER (rtc_rv3032) = { + .name ="rtc-rv3028" , + .id =UCLASS_RTC , + .probe = rv3032_probe, + .of_match = rv3032_rtc_ids, + .ops = &rv3032_rtc_ops, +};
Quoted 8 lines
Quoted 3 lines
--
2.42.0--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
This email contains confidential information. If you have received it in error, you must not read, use, copy or pass on this e-mail or its attachments. If you have received the e-mail in error, please inform me immediately by reply e-mail and then delete this e-mail from your system. Thank you
Diese E-Mail enthält vertrauliche Informationen. Sollten Sie sie irrtümlich erhalten haben, dürfen Sie diese E-Mail oder ihre Anhänge nicht lesen, verwenden, kopieren oder weitergeben. Sollten Sie die Mail versehentlich erhalten haben, teilen Sie mir dies bitte umgehend per Antwort-E-Mail mit und löschen Sie diese E-Mail dann aus Ihrem System. Vielen Dank
Beckhoff Automation GmbH & Co. KG | Managing Director: Dipl. Phys. Hans Beckhoff Registered office: Verl, Germany | Register court: Guetersloh HRA 7075
PATCH 2/5 drivers/usb/dwc3: zynqmp: only free reset gpio if we have one
In reply to Steffen DirkwinkelFrom: Steffen Dirkwinkel <[email protected]>
This gpio is optional so undonditionally freeing it will crash.
---
drivers/usb/dwc3/dwc3-generic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/dwc3/dwc3-generic.c +3 -1
@@ -149,7 +149,9 @@ static int dwc3_generic_remove(struct udevice *dev, priv->ulpi_reset) {struct gpio_desc *ulpi_reset = priv->ulpi_reset; -dm_gpio_free (ulpi_reset->dev, ulpi_reset); +if (priv->ulpi_reset) { +dm_gpio_free (ulpi_reset->dev, ulpi_reset); + } }dwc3_remove (dwc3);
Signature · 1 line
2.42.0
Re: [PATCH 2/5] drivers/usb/dwc3: zynqmp: only free reset gpio if we have one
st 30. 8. 2023 v 20:16 odesílatel Steffen Dirkwinkel <[email protected]> napsal:
Quoted 27 lines
From: Steffen Dirkwinkel <[email protected]>
This gpio is optional so undonditionally freeing it will crash.
Signed-off-by Steffen Dirkwinkel <[email protected]>---
drivers/usb/dwc3/dwc3-generic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/usb/dwc3/dwc3-generic.c +3
-2@@ -149,7 +149,9 @@ static int dwc3_generic_remove(struct udevice *dev, priv->ulpi_reset) {struct gpio_desc *ulpi_reset = priv->ulpi_reset; -dm_gpio_free (ulpi_reset->dev, ulpi_reset); +if (priv->ulpi_reset) { +dm_gpio_free (ulpi_reset->dev, ulpi_reset); + } }dwc3_remove (dwc3); --
Quoted 2 lines
2.42.0
Already fixed by:
https://lore.kernel.org/all/[email protected]/
Thanks,
Michal
Signature · 5 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Xilinx Microblaze Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs
PATCH 3/5 xilinx: zynqmp: move fdt_addr so we can use devices with less memory
In reply to Steffen DirkwinkelFrom: Steffen Dirkwinkel <[email protected]>
With the current config we'd put the fdt outside of memory.
---
include/configs/xilinx_zynqmp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/configs/xilinx_zynqmp.h +1 -1
@@ -50,7 +50,7 @@#endif #define ENV_MEM_LAYOUT_SETTINGS \ - "fdt_addr_r=0x40000000\0" \ + "fdt_addr_r=0x28000000\0" \ "fdt_size_r=0x400000\0" \ "pxefile_addr_r=0x10000000\0" \ "kernel_addr_r=0x18000000\0" \
Signature · 1 line
2.42.0
Michal Simek
maintainerRe: [PATCH 3/5] xilinx: zynqmp: move fdt_addr so we can use devices with less memory
Quoted 15 lines · Steffen Dirkwinkel
From: Steffen Dirkwinkel <[email protected]>
With the current config we'd put the fdt outside of memory.
Signed-off-by Steffen Dirkwinkel <[email protected]>---
include/configs/xilinx_zynqmp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/configs/xilinx_zynqmp.h +0
-0
include/configs/xilinx_zynqmp.h line 56
Quoted 8 lines
include/configs/xilinx_zynqmp.h +1
-1@@ -50,7 +50,7 @@#endif #define ENV_MEM_LAYOUT_SETTINGS \ - "fdt_addr_r=0x40000000\0" \ + "fdt_addr_r=0x28000000\0" \ "fdt_size_r=0x400000\0" \ "pxefile_addr_r=0x10000000\0" \ "kernel_addr_r=0x18000000\0" \
This is not the right way to go.
I have started to move these variables setting to DT. You can take a look at
https://github.com/devicetree-org/dt-schema/commit/3815da51a138619f443abcf2f821ca0a6fd57949
And fdt_addr_r is the same case. It should be moved to DT and remove it from here.
Thanks,
Michal
PATCH 4/5 xilinx: zynqmp: add Beckhoff CX8200
In reply to Steffen DirkwinkelFrom: Steffen Dirkwinkel <[email protected]>
This adds support for the Beckhoff CX8200 series of industrial embedded PCs. There is some information about the device and features here:
https://www.beckhoff.com/en-en/products/ipc/embedded-pcs/cx8200-arm-cortex-a53/
Currently supported/tested:
- Boot from microSD
- Ethernet
- USB
- rtc / rtc eeprom
- tpm access
- uart
Open points:
- adding the psgtr usb phy doesn't work in linux (failed to get pll lock)
- fpga loading currently only as u-boot script or pre launch cmd (type may be stored in eeprom of rtc so this could be made generic)
---
arch/arm/dts/Makefile | 1 + arch/arm/dts/zynqmp-beckhoff-cx8200.dts | 247 +++ .../zynqmp-beckhoff-cx8200/psu_init_gpl.c | 1960 +++++++++++++++++ configs/xilinx_zynqmp_virt_defconfig | 2 +- 4 files changed, 2209 insertions(+), 1 deletion(-) create mode 100644 arch/arm/dts/zynqmp-beckhoff-cx8200.dts create mode 100644 board/xilinx/zynqmp/zynqmp-beckhoff-cx8200/psu_init_gpl.c
arch/arm/dts/Makefile +1 -0
@@ -393,6 +393,7 @@ dtb-$(CONFIG_ARCH_ZYNQ) += \ dtb-$(CONFIG_ARCH_ZYNQMP) += \ avnet-ultra96-rev1.dtb \ zynqmp-a2197-revA.dtb \ + zynqmp-beckhoff-cx8200.dtb \ zynqmp-dlc21-revA.dtb \ zynqmp-e-a2197-00-revA.dtb \ zynqmp-g-a2197-00-revA.dtb \
arch/arm/dts/zynqmp-beckhoff-cx8200.dts new file +247 -0
248 lines not on this page · raw message
board/xilinx/zynqmp/zynqmp-beckhoff-cx8200/psu_init_gpl.c new file +1960 -0
1,960 lines not on this page · raw message
configs/xilinx_zynqmp_virt_defconfig +1 -1
@@ -104,7 +104,7 @@ CONFIG_CMD_UBI=y CONFIG_PARTITION_TYPE_GUID=y CONFIG_SPL_OF_CONTROL=y CONFIG_OF_BOARD=y -CONFIG_OF_LIST="avnet-ultra96-rev1 zynqmp-a2197-revA zynqmp-e-a2197-00-revA zynqmp-g-a2197-00-revA zynqmp-m-a2197-01-revA zynqmp-m-a2197-02-revA zynqmp-m-a2197-03-revA zynqmp-p-a2197-00-revA zynqmp-zc1232-revA zynqmp-zc1254-revA zynqmp-zc1751-xm015-dc1 zynqmp-zc1751-xm016-dc2 zynqmp-zc1751-xm017-dc3 zynqmp-zc1751-xm018-dc4 zynqmp-zc1751-xm019-dc5 zynqmp-zcu100-revC zynqmp-zcu102-rev1.1 zynqmp-zcu102-rev1.0 zynqmp-zcu102-revA zynqmp-zcu102-revB zynqmp-zcu104-revA zynqmp-zcu104-revC zynqmp-zcu106-revA zynqmp-zcu106-rev1.0 zynqmp-zcu111-revA zynqmp-zcu1275-revA zynqmp-zcu1275-revB zynqmp-zcu1285-revA zynqmp-zcu208-revA zynqmp-zcu216-revA zynqmp-topic-miamimp-xilinx-xdp-v1r1 zynqmp-sm-k26-revA zynqmp-smk-k26-revA zynqmp-dlc21-revA" +CONFIG_OF_LIST="avnet-ultra96-rev1 zynqmp-a2197-revA zynqmp-beckhoff-cx8200 zynqmp-e-a2197-00-revA zynqmp-g-a2197-00-revA zynqmp-m-a2197-01-revA zynqmp-m-a2197-02-revA zynqmp-m-a2197-03-revA zynqmp-p-a2197-00-revA zynqmp-zc1232-revA zynqmp-zc1254-revA zynqmp-zc1751-xm015-dc1 zynqmp-zc1751-xm016-dc2 zynqmp-zc1751-xm017-dc3 zynqmp-zc1751-xm018-dc4 zynqmp-zc1751-xm019-dc5 zynqmp-zcu100-revC zynqmp-zcu102-rev1.1 zynqmp-zcu102-rev1.0 zynqmp-zcu102-revA zynqmp-zcu102-revB zynqmp-zcu104-revA zynqmp-zcu104-revC zynqmp-zcu106-revA zynqmp-zcu106-rev1.0 zynqmp-zcu111-revA zynqmp-zcu1275-revA zynqmp-zcu1275-revB zynqmp-zcu1285-revA zynqmp-zcu208-revA zynqmp-zcu216-revA zynqmp-topic-miamimp-xilinx-xdp-v1r1 zynqmp-sm-k26-revA zynqmp-smk-k26-revA zynqmp-dlc21-revA" CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names interrupt-parent interrupts iommus power-domains" CONFIG_ENV_IS_NOWHERE=y CONFIG_ENV_IS_IN_FAT=y
Signature · 1 line
2.42.0
Michal Simek
maintainerRe: [PATCH 4/5] xilinx: zynqmp: add Beckhoff CX8200
Quoted 23 lines · Steffen Dirkwinkel
From: Steffen Dirkwinkel <[email protected]>
This adds support for the Beckhoff CX8200 series of industrial embedded PCs. There is some information about the device and features here:
https://www.beckhoff.com/en-en/products/ipc/embedded-pcs/cx8200-arm-cortex-a53/Currently supported/tested:
- Boot from microSD
- Ethernet
- USB
- rtc / rtc eeprom
- tpm access
- uartOpen points:
- adding the psgtr usb phy doesn't work in linux (failed to get pll lock)
- fpga loading currently only as u-boot script or pre launch cmd (type may be stored in eeprom of rtc so this could be made generic)Signed-off-by Steffen Dirkwinkel <[email protected]>---
Quoted 7 lines
arch/arm/dts/Makefile | 1 + arch/arm/dts/zynqmp-beckhoff-cx8200.dts | 247 +++ .../zynqmp-beckhoff-cx8200/psu_init_gpl.c | 1960 +++++++++++++++++ configs/xilinx_zynqmp_virt_defconfig | 2 +- 4 files changed, 2209 insertions(+), 1 deletion(-)create mode 100644
arch/arm/dts/zynqmp-beckhoff-cx8200.dtscreate mode 100644board/xilinx/zynqmp/zynqmp-beckhoff-cx8200/psu_init_gpl.c
First of all xilinx folder is not the right location because Xilinx/AMD is not manufacturer of this board.
Second I am normally pushing back on adding these custom boards because it just increase time for maintaining. Your last commit was in 2019 but at least you have some commits that I can trust that you would maintain your board for some time.
My biggest question is in what category is your board unique that it should be added it to the tree?
Thanks,
Michal
Re: [PATCH 4/5] xilinx: zynqmp: add Beckhoff CX8200
Am 01.09.23 um 09:36 schrieb Michal Simek:
Quoted 34 lines · Steffen Dirkwinkel
Quoted 23 lines
From: Steffen Dirkwinkel <[email protected]>
This adds support for the Beckhoff CX8200 series of industrial embedded PCs. There is some information about the device and features here:
https://www.beckhoff.com/en-en/products/ipc/embedded-pcs/cx8200-arm-cortex-a53/Currently supported/tested:
- Boot from microSD
- Ethernet
- USB
- rtc / rtc eeprom
- tpm access
- uartOpen points:
- adding the psgtr usb phy doesn't work in linux (failed to get pll lock)
- fpga loading currently only as u-boot script or pre launch cmd (type may be stored in eeprom of rtc so this could be made generic)Signed-off-by Steffen Dirkwinkel <[email protected]>---
Quoted 7 lines
arch/arm/dts/Makefile | 1 + arch/arm/dts/zynqmp-beckhoff-cx8200.dts | 247 +++ .../zynqmp-beckhoff-cx8200/psu_init_gpl.c | 1960 +++++++++++++++++ configs/xilinx_zynqmp_virt_defconfig | 2 +-
4 files changed, 2209 insertions(+), 1 deletion(-)create mode 100644
arch/arm/dts/zynqmp-beckhoff-cx8200.dtscreate mode 100644board/xilinx/zynqmp/zynqmp-beckhoff-cx8200/psu_init_gpl.c
Quoted 1 line
First of all xilinx folder is not the right location because Xilinx/AMD is not manufacturer of this board.
Yeah, sorry. I saw the avnet board and copied that.
Quoted 3 lines
Second I am normally pushing back on adding these custom boards because it just increase time for maintaining. Your last commit was in 2019 but at least you have some commits that I can trust that you would maintain your board for some time.
Our last board [1] only had linux/u-boot support as an afterthought. Customers had to buy a special option to set the right boot fuses, so most devices don’t boot u-boot. With this board and a second similar zynqmp board (CX9240 [2]) we’ll have u-boot as default (and probably only) bootloader, so we’ll be
more active. We can also set two of us as maintainers and it would be fine to drop the boards if nobody responds.
We generally support these industrial boards for long time frames and would like to stay close to mainline instead of maintaining forks.
The alternative would be to have a downstream u-boot repository on github or somewhere. We’ll still likely have something there for build scripts / firmware builds / integration, but don’t plan to really diverge from upstream u-boot.
The main advantage of being in upstream u-boot would be that we can trigger internal CI on upstream changes. We can still do that and apply patches, but even simple patches like adding files to a makefile may fail to apply and will need fixing.
Quoted 2 lines
My biggest question is in what category is your board unique that it should be added it to the tree?
Currently the board isn’t really unique. I guess we’d be the only users of the rtc with eeprom and there might be something needed for loading the correct fpga file based on eeprom (this might be done in linux / userspace or even u-boot script though)
[1] https://www.beckhoff.com/en-en/products/ipc/embedded-pcs/cx9020-arm-cortex-a8/cx9020.html#tab_productdetails_1
[2] https://www.beckhoff.com/en-en/products/ipc/embedded-pcs/cx9240-arm-cortex-a53/cx9240.html
Quoted 3 lines
Thanks,
Michal
Michal Simek
maintainerRe: [PATCH 4/5] xilinx: zynqmp: add Beckhoff CX8200
Quoted 56 lines · Steffen Dirkwinkel
Am 01.09.23 um 09:36 schrieb Michal Simek:
Quoted 34 lines · Steffen Dirkwinkel
Quoted 23 lines
From: Steffen Dirkwinkel <[email protected]>
This adds support for the Beckhoff CX8200 series of industrial embedded PCs. There is some information about the device and features here:
https://www.beckhoff.com/en-en/products/ipc/embedded-pcs/cx8200-arm-cortex-a53/Currently supported/tested:
- Boot from microSD
- Ethernet
- USB
- rtc / rtc eeprom
- tpm access
- uartOpen points:
- adding the psgtr usb phy doesn't work in linux (failed to get pll lock)
- fpga loading currently only as u-boot script or pre launch cmd (type may be stored in eeprom of rtc so this could be made generic)Signed-off-by Steffen Dirkwinkel <[email protected]>---
Quoted 7 lines
arch/arm/dts/Makefile | 1 + arch/arm/dts/zynqmp-beckhoff-cx8200.dts | 247 +++ .../zynqmp-beckhoff-cx8200/psu_init_gpl.c | 1960 +++++++++++++++++ configs/xilinx_zynqmp_virt_defconfig | 2 +-
4 files changed, 2209 insertions(+), 1 deletion(-)create mode 100644
arch/arm/dts/zynqmp-beckhoff-cx8200.dtscreate mode 100644board/xilinx/zynqmp/zynqmp-beckhoff-cx8200/psu_init_gpl.cQuoted 1 line
First of all xilinx folder is not the right location because Xilinx/AMD is not manufacturer of this board.
Yeah, sorry. I saw the avnet board and copied that.
Quoted 3 lines
Second I am normally pushing back on adding these custom boards because it just increase time for maintaining. Your last commit was in 2019 but at least you have some commits that I can trust that you would maintain your board for some time.
Our last board [1] only had linux/u-boot support as an afterthought. Customers had to buy a special option to set the right boot fuses, so most devices don’t boot u-boot. With this board and a second similar zynqmp board (CX9240 [2]) we’ll have u-boot as default (and probably only) bootloader, so we’ll be
more active. We can also set two of us as maintainers and it would be fine to drop the boards if nobody responds.
We generally support these industrial boards for long time frames and would like to stay close to mainline instead of maintaining forks.The alternative would be to have a downstream u-boot repository on github or somewhere. We’ll still likely have something there for build scripts / firmware builds / integration, but don’t plan to really diverge from upstream u-boot.
The main advantage of being in upstream u-boot would be that we can trigger internal CI on upstream changes. We can still do that and apply patches, but even simple patches like adding files to a makefile may fail to apply and will need fixing.
Quoted 1 line
Quoted 6 lines
Quoted 1 line
My biggest question is in what category is your board unique that it should be added it to the tree?
Currently the board isn’t really unique. I guess we’d be the only users of the rtc with eeprom and there might be something needed for loading the correct fpga file based on eeprom (this might be done in linux / userspace or even u-boot script though)
[1] https://www.beckhoff.com/en-en/products/ipc/embedded-pcs/cx9020-arm-cortex-a8/cx9020.html#tab_productdetails_1
[2] https://www.beckhoff.com/en-en/products/ipc/embedded-pcs/cx9240-arm-cortex-a53/cx9240.html
Regarding board itself.
It is DTB - we use OF_SEPARATE/OF_BOARD it means building is easy. I expect you have pretty much something in PL that's why your DT is bigger if you don't use DT overlays but for fixed design there is actually no reason to use it.
psu_init_gpl. You are adding it to specific folder which match DEVICE_TREE variable when you use it. You can actually just copy it to board/xilinx/zynqmp/ folder and it will be pick up for your build.
xilinx_zynqmp_virt_defconfig - you likely don't want to use this in your product because there are things enabled which you don't use on your board. That's why you should tune it for your usage.
regs.init - that's for boot.bin generation with SPL - BOOT_INIT_FILE should be used and it can't be wired via generic defconfig anyway.
That pretty much leads to the state that make no sense for you to use xilinx_zynqmp_virt_defconfig.
I think we are still supporting defconfig fragments which is the way how to maintain your board to be close to mainline as possible.
And fdt_addr change. I think this is for me the most problematic part which should be solved. Pretty much all these variables should be moved out and that's what we started to work on. But it will take some time to get there.
Definitely there shouldn't be a problem to merge that rtc driver and I would prefer if you can stay with your board out of upstream and try to maintain it via your build scripts only. And let me know if we can improve/fix something to be able to do it in long term. But pretty much all things should be in place already to do it without pain. At least I would like you to try it and see if there is any major blocker which we can try to fix.
Thanks,
Michal
Re: [PATCH 4/5] xilinx: zynqmp: add Beckhoff CX8200
Am 01.09.23 um 13:16 schrieb Michal Simek:
Quoted 70 lines · Steffen Dirkwinkel
Quoted 57 lines
Am 01.09.23 um 09:36 schrieb Michal Simek:
Quoted 35 lines · Steffen Dirkwinkel
Quoted 23 lines
From: Steffen Dirkwinkel <[email protected]>
This adds support for the Beckhoff CX8200 series of industrial embedded PCs. There is some information about the device and features here:
https://www.beckhoff.com/en-en/products/ipc/embedded-pcs/cx8200-arm-cortex-a53/Currently supported/tested:
- Boot from microSD
- Ethernet
- USB
- rtc / rtc eeprom
- tpm access
- uartOpen points:
- adding the psgtr usb phy doesn't work in linux (failed to get pll lock)
- fpga loading currently only as u-boot script or pre launch cmd (type may be stored in eeprom of rtc so this could be made generic)Signed-off-by Steffen Dirkwinkel <[email protected]>---
Quoted 8 lines
arch/arm/dts/Makefile | 1 + arch/arm/dts/zynqmp-beckhoff-cx8200.dts | 247 +++ .../zynqmp-beckhoff-cx8200/psu_init_gpl.c | 1960
+++++++++++++++++
configs/xilinx_zynqmp_virt_defconfig | 2 +-4 files changed, 2209 insertions(+), 1 deletion(-)create mode 100644
arch/arm/dts/zynqmp-beckhoff-cx8200.dtscreate mode 100644board/xilinx/zynqmp/zynqmp-beckhoff-cx8200/psu_init_gpl.cQuoted 1 line
First of all xilinx folder is not the right location because Xilinx/AMD is not manufacturer of this board.
Yeah, sorry. I saw the avnet board and copied that.
Quoted 3 lines
Second I am normally pushing back on adding these custom boards because it just increase time for maintaining. Your last commit was in 2019 but at least you have some commits that I can trust that you would maintain your board for some time.
Our last board [1] only had linux/u-boot support as an afterthought. Customers had to buy a special option to set the right boot fuses, so most devices don’t boot u-boot. With this board and a second similar zynqmp board (CX9240 [2]) we’ll have u-boot as default (and probably only) bootloader, so we’ll be
more active. We can also set two of us as maintainers and it would be fine to drop the boards if nobody responds.
We generally support these industrial boards for long time frames and would like to stay close to mainline instead of maintaining forks.The alternative would be to have a downstream u-boot repository on github or somewhere. We’ll still likely have something there for build scripts / firmware builds / integration, but don’t plan to really diverge from upstream u-boot.
The main advantage of being in upstream u-boot would be that we can trigger internal CI on upstream changes. We can still do that and apply patches, but even simple patches like adding files to a makefile may fail to apply and will need fixing.
Quoted 1 line
Quoted 6 lines
Quoted 1 line
My biggest question is in what category is your board unique that it should be added it to the tree?
Currently the board isn’t really unique. I guess we’d be the only users of the rtc with eeprom and there might be something needed for loading the correct fpga file based on eeprom (this might be done in linux / userspace or even u-boot script though)
[1] https://www.beckhoff.com/en-en/products/ipc/embedded-pcs/cx9020-arm-cortex-a8/cx9020.html#tab_productdetails_1
[2] https://www.beckhoff.com/en-en/products/ipc/embedded-pcs/cx9240-arm-cortex-a53/cx9240.htmlRegarding board itself.
It is DTB - we use OF_SEPARATE/OF_BOARD it means building is easy. I expect you have pretty much something in PL that's why your DT is bigger if you don't use DT overlays but for fixed design there is actually no reason to use it.
Quoted 7 lines
psu_init_gpl. You are adding it to specific folder which matchDEVICE_TREEvariable when you use it. You can actually just copy it to board/xilinx/zynqmp/ folder and it will be pick up for your build.
xilinx_zynqmp_virt_defconfig- you likely don't want to use this in your product because there are things enabled which you don't use on your board. That's why you should tune it for your usage.regs.init - that's for boot.bin generation with SPL -
BOOT_INIT_FILEshould be used and it can't be wired via generic defconfig anyway.That pretty much leads to the state that make no sense for you to use
xilinx_zynqmp_virt_defconfig.
There are things in the defconfig we don't need, but size hasn't really been an issue, since we boot from relatively large sdcards. We might still do separate config for all our boards though.
We currently build virt_defconfig and set BOOT_INIT_FILE, PMUFW_INIT_FILE and ZYNQMP_SPL_PM_CFG_OBJ_FILE. If we ship this firmware somewhere (similar to linux-firmware?) we could set fixed paths for that and make rebuilding u-boot simpler. I've found reproducing images for zynqmp devboards with and without using petalinux and the xilinx fsbl to be quite annoying on the first try and this could be simpler if one just wants to support generic arm64 distros.
Quoted 5 lines
I think we are still supporting defconfig fragments which is the way how to maintain your board to be close to mainline as possible.
And
fdt_addrchange. I think this is for me the most problematic part which should be solved. Pretty much all these variables should be moved out and that's what we started to work on. But it will take some time to get there.
I agree, I can also work on that, but it will likely be in October since I'm on vacation for most of September. Maybe one of our other developers will work on it instead.
Quoted 1 line
Definitely there shouldn't be a problem to merge that rtc driver and I would prefer if you can stay with your board out of upstream and try to maintain it via your build scripts only. And let me know if we can improve/fix something to be able to do it in long term. But pretty much all things should be in place already to do it without pain. At least I would like you to try it and see if there is any major blocker which we can try to fix.
I don't really understand why the board shouldn't be upstream, once it is just a dts file + psu_init_gpl + regs. There really isn't much to maintain there that wouldn't also break out of tree.
We might be different from most other out of tree zynqmp users, since we usually also offer to sell hardware without our software and users would then either download an image from us or build their own u-boot + linux and only download the fpga bitstreams. I expect most people would look at upstream u-boot and linux before looking for our downstream repositories.
We can and will of course start with a downstream repository, I just don't understand why real (non-devboard) hardware should be out of tree.
Thanks,
Steffen
Quoted 4 lines
Thanks,
Michal
Re: [PATCH 4/5] xilinx: zynqmp: add Beckhoff CX8200
Quoted 90 lines · Steffen Dirkwinkel
Am 01.09.23 um 13:16 schrieb Michal Simek:
Quoted 69 lines · Steffen Dirkwinkel
Quoted 56 lines
Am 01.09.23 um 09:36 schrieb Michal Simek:
Quoted 34 lines · Steffen Dirkwinkel
Quoted 23 lines
From: Steffen Dirkwinkel <[email protected]>
This adds support for the Beckhoff CX8200 series of industrial embedded PCs. There is some information about the device and features here:
https://www.beckhoff.com/en-en/products/ipc/embedded-pcs/cx8200-arm-cortex-a53/Currently supported/tested:
- Boot from microSD
- Ethernet
- USB
- rtc / rtc eeprom
- tpm access
- uartOpen points:
- adding the psgtr usb phy doesn't work in linux (failed to get pll lock)
- fpga loading currently only as u-boot script or pre launch cmd (type may be stored in eeprom of rtc so this could be made generic)Signed-off-by Steffen Dirkwinkel <[email protected]>---
Quoted 7 lines
arch/arm/dts/Makefile | 1 + arch/arm/dts/zynqmp-beckhoff-cx8200.dts | 247 +++ .../zynqmp-beckhoff-cx8200/psu_init_gpl.c | 1960 +++++++++++++++++ configs/xilinx_zynqmp_virt_defconfig | 2 +-
4 files changed, 2209 insertions(+), 1 deletion(-)create mode 100644
arch/arm/dts/zynqmp-beckhoff-cx8200.dtscreate mode 100644board/xilinx/zynqmp/zynqmp-beckhoff-cx8200/psu_init_gpl.cQuoted 1 line
First of all xilinx folder is not the right location because Xilinx/AMD is not manufacturer of this board.
Yeah, sorry. I saw the avnet board and copied that.
Quoted 3 lines
Second I am normally pushing back on adding these custom boards because it just increase time for maintaining. Your last commit was in 2019 but at least you have some commits that I can trust that you would maintain your board for some time.
Our last board [1] only had linux/u-boot support as an afterthought. Customers had to buy a special option to set the right boot fuses, so most devices don’t boot u-boot. With this board and a second similar zynqmp board (CX9240 [2]) we’ll have u-boot as default (and probably only) bootloader, so we’ll be
more active. We can also set two of us as maintainers and it would be fine to drop the boards if nobody responds.
We generally support these industrial boards for long time frames and would like to stay close to mainline instead of maintaining forks.The alternative would be to have a downstream u-boot repository on github or somewhere. We’ll still likely have something there for build scripts / firmware builds / integration, but don’t plan to really diverge from upstream u-boot.
The main advantage of being in upstream u-boot would be that we can trigger internal CI on upstream changes. We can still do that and apply patches, but even simple patches like adding files to a makefile may fail to apply and will need fixing.
Quoted 1 line
Quoted 6 lines
Quoted 1 line
My biggest question is in what category is your board unique that it should be added it to the tree?
Currently the board isn’t really unique. I guess we’d be the only users of the rtc with eeprom and there might be something needed for loading the correct fpga file based on eeprom (this might be done in linux / userspace or even u-boot script though)
[1] https://www.beckhoff.com/en-en/products/ipc/embedded-pcs/cx9020-arm-cortex-a8/cx9020.html#tab_productdetails_1
[2] https://www.beckhoff.com/en-en/products/ipc/embedded-pcs/cx9240-arm-cortex-a53/cx9240.htmlRegarding board itself.
It is DTB - we use OF_SEPARATE/OF_BOARD it means building is easy. I expect you have pretty much something in PL that's why your DT is bigger if you don't use DT overlays but for fixed design there is actually no reason to use it.Quoted 7 lines
psu_init_gpl. You are adding it to specific folder which matchDEVICE_TREEvariable when you use it. You can actually just copy it to board/xilinx/zynqmp/ folder and it will be pick up for your build.
xilinx_zynqmp_virt_defconfig- you likely don't want to use this in your product because there are things enabled which you don't use on your board. That's why you should tune it for your usage.regs.init - that's for boot.bin generation with SPL -
BOOT_INIT_FILEshould be used and it can't be wired via generic defconfig anyway.That pretty much leads to the state that make no sense for you to use
xilinx_zynqmp_virt_defconfig.There are things in the defconfig we don't need, but size hasn't really been an issue, since we boot from relatively large sdcards. We might still do separate config for all our boards though.
We currently build
virt_defconfigand setBOOT_INIT_FILE,PMUFW_INIT_FILEandZYNQMP_SPL_PM_CFG_OBJ_FILE. If we ship this firmware somewhere (similar to linux-firmware?) we could set fixed paths for that and make rebuilding u-boot simpler. I've found reproducing images for zynqmp devboards with and without using petalinux and the xilinx fsbl to be quite annoying on the first try and this could be simpler if one just wants to support generic arm64 distros.Quoted 5 lines
I think we are still supporting defconfig fragments which is the way how to maintain your board to be close to mainline as possible.
And
fdt_addrchange. I think this is for me the most problematic part which should be solved. Pretty much all these variables should be moved out and that's what we started to work on. But it will take some time to get there.
Quoted 7 lines
I agree, I can also work on that, but it will likely be in October since I'm on vacation for most of September. Maybe one of our other developers will work on it instead.
Quoted 1 line
Definitely there shouldn't be a problem to merge that rtc driver and I would prefer if you can stay with your board out of upstream and try to maintain it via your build scripts only. And let me know if we can improve/fix something to be able to do it in long term. But pretty much all things should be in place already to do it without pain. At least I would like you to try it and see if there is any major blocker which we can try to fix.
I don't really understand why the board shouldn't be upstream, once it is just a dts file +
psu_init_gpl+ regs. There really isn't much to maintain there that wouldn't also break out of tree.We might be different from most other out of tree zynqmp users, since we usually also offer to sell hardware without our software and users would then either download an image from us or build their own u-boot + linux and only download the fpga bitstreams. I expect most people would look at upstream u-boot and linux before looking for our downstream repositories.
Sounds good.
Quoted 2 lines
We can and will of course start with a downstream repository, I just don't understand why real (non-devboard) hardware should be out of tree.
It can be I just want to make sure that you don't disappear after short time.
Topic's platforms are also the part of tree. It means let's figure it out that fdt part which you need to solve and we can merge your platform if you give me commitment that you will test and support it.
Thanks,
Michal
Signature · 6 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Xilinx Microblaze Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP/Versal ARM64 SoCs U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal/Versal NET SoCs TF-A maintainer - Xilinx ZynqMP/Versal/Versal NET SoCs
PATCH 5/5 xilinx: zynqmp: beckhoff cx8200: setup inner cache broadcasting
In reply to Steffen DirkwinkelFrom: Steffen Dirkwinkel <[email protected]>
We need it for coherent access between pl and ps.
From xilinx documentation:
https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18842098/Zynq+UltraScale+MPSoC+Cache+Coherency
Inner Cache Broadcasting
Linux sets up the MMU for cacheable memory to be inner shareable as that supports SMP operation. As modifying the MMU tables from kernel or userspace is not a straightforwards task, the inner cache broadcasting feature can be used to allow inner cacheble transactions be broadcasted. Outside the APU, in the outer domain, the CCI handles coherency across the system. The brdc_inner bit of the lpd_apu register within the LPD_SLCR module must be written while the APU is in reset.
The requirement to alter the register while the APU is in reset can be accomplished using the register initialization feature in the boot image.
.set. 0xFF41A040 = 0x3;
---
board/xilinx/zynqmp/zynqmp-beckhoff-cx8200/regs.init | 1 + 1 file changed, 1 insertion(+) create mode 100644 board/xilinx/zynqmp/zynqmp-beckhoff-cx8200/regs.init
board/xilinx/zynqmp/zynqmp-beckhoff-cx8200/regs.init new file +1 -0
@@ -0,0 +1 @@ +0xFF41A040 0x3
Signature · 1 line
2.42.0