Re: [PATCH 1/4] mkimage: also honour -B even without external data

2023-11-06 Thread Rasmus Villemoes
On 04/11/2023 20.43, Simon Glass wrote:
> Hi Rasmus,

> Are you planning a new version of this series?

No. AFAICT there's nothing to be done on my end.

Rasmus



[PATCH v1 0/5] Convert recently merged T30 boards to use DM PMIC

2023-11-06 Thread Svyatoslav Ryhel
Since the proposed PMIC patches have been accepted, I see the need
to convert boards which I maintain to use DM drivers instead of board hacks.

Svyatoslav Ryhel (5):
  board: lg-x3: convert LG Optimus 4X and Vu to use DM PMIC
  board: endeavoru: convert HTC One X to use DM PMIC
  board: transformer-t30: convert ASUS Transformers to use DM PMIC
  board: grouper: convert ASUS Google Nexus 7 (2012) to use DM PMIC
  ARM: dts: tegra30: enable USB PHY node on some devices

 arch/arm/dts/tegra30-asus-grouper-common.dtsi |   7 +
 .../dts/tegra30-asus-nexus7-grouper-E1565.dts |   1 +
 .../dts/tegra30-asus-nexus7-grouper-PM269.dts |   1 +
 .../dts/tegra30-asus-nexus7-tilapia-E1565.dts |   1 +
 arch/arm/dts/tegra30-asus-p1801-t.dts |  17 ++
 arch/arm/dts/tegra30-asus-tf600t.dts  |  15 ++
 arch/arm/dts/tegra30-asus-transformer.dtsi|   9 +
 arch/arm/dts/tegra30-htc-endeavoru.dts|   8 +
 arch/arm/dts/tegra30-lg-x3.dtsi   |   9 +
 board/asus/grouper/Kconfig|   8 -
 board/asus/grouper/Makefile   |   4 +-
 .../asus/grouper/configs/grouper_E1565.config |   6 +-
 .../asus/grouper/configs/grouper_PM269.config |   6 +-
 board/asus/grouper/configs/tilapia.config |   6 +-
 board/asus/grouper/grouper-spl-max.c  |   2 +-
 board/asus/grouper/grouper-spl-ti.c   |   2 +-
 board/asus/grouper/grouper.c  | 154 +-
 board/asus/transformer-t30/Kconfig|  10 --
 .../transformer-t30/configs/tf600t.config |   2 +-
 .../transformer-t30/transformer-t30-spl.c |   2 +-
 board/asus/transformer-t30/transformer-t30.c  | 121 +-
 board/htc/endeavoru/endeavoru-spl.c   |   2 +-
 board/htc/endeavoru/endeavoru.c   |  72 +---
 board/lg/x3-t30/x3-t30-spl.c  |   2 +-
 board/lg/x3-t30/x3-t30.c  |  97 +--
 configs/endeavoru_defconfig   |   4 +
 configs/grouper_common_defconfig  |   1 +
 configs/transformer_t30_defconfig |   5 +
 configs/x3_t30_defconfig  |   4 +
 29 files changed, 128 insertions(+), 450 deletions(-)

-- 
2.40.1



[PATCH v1 1/5] board: lg-x3: convert LG Optimus 4X and Vu to use DM PMIC

2023-11-06 Thread Svyatoslav Ryhel
Since required drivers were merged, we can safely clean up the
board and switch to DM based driver with device tree support.

Signed-off-by: Svyatoslav Ryhel 
---
 arch/arm/dts/tegra30-lg-x3.dtsi |  1 +
 board/lg/x3-t30/x3-t30-spl.c|  2 +-
 board/lg/x3-t30/x3-t30.c| 97 ++---
 configs/x3_t30_defconfig|  4 ++
 4 files changed, 11 insertions(+), 93 deletions(-)

diff --git a/arch/arm/dts/tegra30-lg-x3.dtsi b/arch/arm/dts/tegra30-lg-x3.dtsi
index 6e52fc5a53..aa207a70c7 100644
--- a/arch/arm/dts/tegra30-lg-x3.dtsi
+++ b/arch/arm/dts/tegra30-lg-x3.dtsi
@@ -110,6 +110,7 @@
regulator-name = "vdd_ddr_rx";
regulator-min-microvolt = <285>;
regulator-max-microvolt = <285>;
+   regulator-boot-on;
};
};
};
diff --git a/board/lg/x3-t30/x3-t30-spl.c b/board/lg/x3-t30/x3-t30-spl.c
index 864f2de45f..00f79dd1db 100644
--- a/board/lg/x3-t30/x3-t30-spl.c
+++ b/board/lg/x3-t30/x3-t30-spl.c
@@ -9,7 +9,7 @@
  *  Svyatoslav Ryhel 
  */
 
-#include 
+#include 
 #include 
 #include 
 
diff --git a/board/lg/x3-t30/x3-t30.c b/board/lg/x3-t30/x3-t30.c
index a08e00dd87..2eaf16ded4 100644
--- a/board/lg/x3-t30/x3-t30.c
+++ b/board/lg/x3-t30/x3-t30.c
@@ -7,60 +7,14 @@
  *  Svyatoslav Ryhel 
  */
 
-#include 
 #include 
 #include 
-#include 
-#include 
 #include 
 #include 
-#include 
-#include 
 #include 
-#include 
-#include 
-#include "pinmux-config-x3.h"
-
-#define MAX77663_I2C_ADDR  0x1C
-
-#define MAX77663_REG_SD2   0x18
-#define MAX77663_REG_LDO2  0x27
-#define MAX77663_REG_LDO3  0x29
-#define MAX77663_REG_LDO5  0x2D
-#define MAX77663_REG_ONOFF_CFG10x41
-#define   ONOFF_PWR_OFFBIT(1)
-
-#ifdef CONFIG_CMD_POWEROFF
-int do_poweroff(struct cmd_tbl *cmdtp, int flag,
-   int argc, char *const argv[])
-{
-   struct udevice *dev;
-   uchar data_buffer[1];
-   int ret;
-
-   ret = i2c_get_chip_for_busnum(0, MAX77663_I2C_ADDR, 1, &dev);
-   if (ret) {
-   log_debug("cannot find PMIC I2C chip\n");
-   return 0;
-   }
-
-   ret = dm_i2c_read(dev, MAX77663_REG_ONOFF_CFG1, data_buffer, 1);
-   if (ret)
-   return ret;
+#include 
 
-   data_buffer[0] |= ONOFF_PWR_OFF;
-
-   ret = dm_i2c_write(dev, MAX77663_REG_ONOFF_CFG1, data_buffer, 1);
-   if (ret)
-   return ret;
-
-   /* wait some time and then print error */
-   mdelay(5000);
-
-   printf("Failed to power off!!!\n");
-   return 1;
-}
-#endif
+#include "pinmux-config-x3.h"
 
 /*
  * Routine: pinmux_init
@@ -82,52 +36,11 @@ void pinmux_init(void)
 #endif
 }
 
-#ifdef CONFIG_MMC_SDHCI_TEGRA
-static void max77663_voltage_init(void)
-{
-   struct udevice *dev;
-   int ret;
-
-   ret = i2c_get_chip_for_busnum(0, MAX77663_I2C_ADDR, 1, &dev);
-   if (ret) {
-   log_debug("cannot find PMIC I2C chip\n");
-   return;
-   }
-
-   /* 0x60 for 1.8v, bit7:0 = voltage */
-   ret = dm_i2c_reg_write(dev, MAX77663_REG_SD2, 0x60);
-   if (ret)
-   log_debug("vdd_1v8_vio set failed: %d\n", ret);
-
-   /* 0xF2 for 3.30v, enabled: bit7:6 = 11 = enable, bit5:0 = voltage */
-   ret = dm_i2c_reg_write(dev, MAX77663_REG_LDO2, 0xF2);
-   if (ret)
-   log_debug("avdd_usb set failed: %d\n", ret);
-
-   /* 0xEC for 3.00v, enabled: bit7:6 = 11 = enable, bit5:0 = voltage */
-   ret = dm_i2c_reg_write(dev, MAX77663_REG_LDO3, 0xEC);
-   if (ret)
-   log_debug("vdd_usd set failed: %d\n", ret);
-
-   /* 0xE9 for 2.85v, enabled: bit7:6 = 11 = enable, bit5:0 = voltage */
-   ret = dm_i2c_reg_write(dev, MAX77663_REG_LDO5, 0xE9);
-   if (ret)
-   log_debug("vcore_emmc set failed: %d\n", ret);
-}
-
-/*
- * Routine: pin_mux_mmc
- * Description: setup the MMC muxes, power rails, etc.
- */
-void pin_mux_mmc(void)
-{
-   /* Bring up uSD and eMMC power */
-   max77663_voltage_init();
-}
-#endif /* MMC */
-
 int nvidia_board_init(void)
 {
+   /* Set up boot-on regulators */
+   regulators_enable_boot_on(true);
+
/* Set up panel bridge clocks */
clock_start_periph_pll(PERIPH_ID_EXTPERIPH3, CLOCK_ID_PERIPH,
   24 * 100);
diff --git a/configs/x3_t30_defconfig b/configs/x3_t30_defconfig
index a151f58524..90cbc2078a 100644
--- a/configs/x3_t30_defconfig
+++ b/configs/x3_t30_defconfig
@@ -45,6 +45,7 @@ CONFIG_CMD_USB_MASS_STORAGE=y
 CONFIG_CMD_UMS_ABORT_KEYED=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_PAUSE=y
+CONFIG_CMD_REGULATOR=y
 CONFIG_CMD_EXT4_WRITE=y
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_EFI_PARTITION is not set
@@ -64,11 +

[PATCH v1 2/5] board: endeavoru: convert HTC One X to use DM PMIC

2023-11-06 Thread Svyatoslav Ryhel
Since required drivers were merged, we can safely clean up the
board and switch to DM based driver with device tree support.

Signed-off-by: Svyatoslav Ryhel 
---
 arch/arm/dts/tegra30-htc-endeavoru.dts |  1 +
 board/htc/endeavoru/endeavoru-spl.c|  2 +-
 board/htc/endeavoru/endeavoru.c| 72 +++---
 configs/endeavoru_defconfig|  4 ++
 4 files changed, 12 insertions(+), 67 deletions(-)

diff --git a/arch/arm/dts/tegra30-htc-endeavoru.dts 
b/arch/arm/dts/tegra30-htc-endeavoru.dts
index 5c7b2deae5..22320de708 100644
--- a/arch/arm/dts/tegra30-htc-endeavoru.dts
+++ b/arch/arm/dts/tegra30-htc-endeavoru.dts
@@ -81,6 +81,7 @@
regulator-name = "avdd_dsi_csi";
regulator-min-microvolt = <120>;
regulator-max-microvolt = <120>;
+   regulator-boot-on;
};
};
};
diff --git a/board/htc/endeavoru/endeavoru-spl.c 
b/board/htc/endeavoru/endeavoru-spl.c
index 7921ff1a73..2525b50d3e 100644
--- a/board/htc/endeavoru/endeavoru-spl.c
+++ b/board/htc/endeavoru/endeavoru-spl.c
@@ -9,7 +9,7 @@
  *  Svyatoslav Ryhel 
  */
 
-#include 
+#include 
 #include 
 #include 
 
diff --git a/board/htc/endeavoru/endeavoru.c b/board/htc/endeavoru/endeavoru.c
index e1a0b242e2..6835b1ee70 100644
--- a/board/htc/endeavoru/endeavoru.c
+++ b/board/htc/endeavoru/endeavoru.c
@@ -7,48 +7,12 @@
  *  Svyatoslav Ryhel 
  */
 
-#include 
 #include 
 #include 
-#include 
-#include 
 #include 
-#include 
-#include 
-#include 
-#include 
-#include "pinmux-config-endeavoru.h"
-
-#define TPS80032_CTL1_I2C_ADDR 0x48
-#define TPS80032_PHOENIX_DEV_ON0x25
-#define   DEVOFF   BIT(0)
-#define TPS80032_LDO1_CFG_STATE0x9E
-#define TPS80032_LDO1_CFG_VOLTAGE  0x9F
-
-#ifdef CONFIG_CMD_POWEROFF
-int do_poweroff(struct cmd_tbl *cmdtp, int flag,
-   int argc, char *const argv[])
-{
-   struct udevice *dev;
-   int ret;
-
-   ret = i2c_get_chip_for_busnum(0, TPS80032_CTL1_I2C_ADDR, 1, &dev);
-   if (ret) {
-   log_debug("cannot find PMIC I2C chip\n");
-   return 0;
-   }
+#include 
 
-   ret = dm_i2c_reg_write(dev, TPS80032_PHOENIX_DEV_ON, DEVOFF);
-   if (ret)
-   return ret;
-
-   // wait some time and then print error
-   mdelay(5000);
-
-   printf("Failed to power off!!!\n");
-   return 1;
-}
-#endif
+#include "pinmux-config-endeavoru.h"
 
 /*
  * Routine: pinmux_init
@@ -60,37 +24,13 @@ void pinmux_init(void)
ARRAY_SIZE(endeavoru_pinmux_common));
 }
 
-#ifdef CONFIG_MMC_SDHCI_TEGRA
-static void tps80032_voltage_init(void)
+int nvidia_board_init(void)
 {
-   struct udevice *dev;
-   int ret;
-
-   ret = i2c_get_chip_for_busnum(0, TPS80032_CTL1_I2C_ADDR, 1, &dev);
-   if (ret)
-   log_debug("cannot find PMIC I2C chip\n");
-
-   /* TPS80032: LDO1_REG = 1.2v to DSI */
-   ret = dm_i2c_reg_write(dev, TPS80032_LDO1_CFG_VOLTAGE, 0x03);
-   if (ret)
-   log_debug("avdd_dsi_csi voltage set failed: %d\n", ret);
-
-   /* TPS80032: LDO1_REG enable */
-   ret = dm_i2c_reg_write(dev, TPS80032_LDO1_CFG_STATE, 0x01);
-   if (ret)
-   log_debug("avdd_dsi_csi enable failed: %d\n", ret);
-}
+   /* Set up boot-on regulators */
+   regulators_enable_boot_on(true);
 
-/*
- * Routine: pin_mux_mmc
- * Description: setup the MMC muxes, power rails, etc.
- */
-void pin_mux_mmc(void)
-{
-   /* Bring up DSI power */
-   tps80032_voltage_init();
+   return 0;
 }
-#endif /* MMC */
 
 #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
 int ft_board_setup(void *blob, struct bd_info *bd)
diff --git a/configs/endeavoru_defconfig b/configs/endeavoru_defconfig
index d605acdfc8..7212675546 100644
--- a/configs/endeavoru_defconfig
+++ b/configs/endeavoru_defconfig
@@ -44,6 +44,7 @@ CONFIG_CMD_USB_MASS_STORAGE=y
 CONFIG_CMD_UMS_ABORT_KEYED=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_PAUSE=y
+CONFIG_CMD_REGULATOR=y
 CONFIG_CMD_EXT4_WRITE=y
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_EFI_PARTITION is not set
@@ -61,10 +62,13 @@ CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_SYS_I2C_TEGRA=y
 CONFIG_BUTTON_KEYBOARD=y
 CONFIG_DM_PMIC=y
+CONFIG_DM_PMIC_TPS80031=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_REGULATOR_TPS80031=y
 CONFIG_PWM_TEGRA=y
 CONFIG_SYS_NS16550=y
+CONFIG_SYSRESET_TPS80031=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_TEGRA=y
-- 
2.40.1



[PATCH v1 5/5] ARM: dts: tegra30: enable USB PHY node on some devices

2023-11-06 Thread Svyatoslav Ryhel
Enable USB PHY nodes on ASUS Transformers, Grouper, Enadevoru
and LG X3. This is not mandatory since driver will use default
values but preferable for new devices.

Signed-off-by: Svyatoslav Ryhel 
---
 arch/arm/dts/tegra30-asus-grouper-common.dtsi |  7 +++
 arch/arm/dts/tegra30-asus-p1801-t.dts | 15 +++
 arch/arm/dts/tegra30-asus-tf600t.dts  | 11 +++
 arch/arm/dts/tegra30-asus-transformer.dtsi|  7 +++
 arch/arm/dts/tegra30-htc-endeavoru.dts|  7 +++
 arch/arm/dts/tegra30-lg-x3.dtsi   |  8 
 6 files changed, 55 insertions(+)

diff --git a/arch/arm/dts/tegra30-asus-grouper-common.dtsi 
b/arch/arm/dts/tegra30-asus-grouper-common.dtsi
index fcf31e2dd0..c9277388c9 100644
--- a/arch/arm/dts/tegra30-asus-grouper-common.dtsi
+++ b/arch/arm/dts/tegra30-asus-grouper-common.dtsi
@@ -71,6 +71,13 @@
dr_mode = "otg";
};
 
+   usb-phy@7d00 {
+   status = "okay";
+   nvidia,hssync-start-delay = <0>;
+   nvidia,xcvr-lsfslew = <2>;
+   nvidia,xcvr-lsrslew = <2>;
+   };
+
backlight: backlight {
compatible = "pwm-backlight";
 
diff --git a/arch/arm/dts/tegra30-asus-p1801-t.dts 
b/arch/arm/dts/tegra30-asus-p1801-t.dts
index d62d43268b..19de984d5f 100644
--- a/arch/arm/dts/tegra30-asus-p1801-t.dts
+++ b/arch/arm/dts/tegra30-asus-p1801-t.dts
@@ -150,17 +150,32 @@
dr_mode = "otg";
};
 
+   usb-phy@7d00 {
+   status = "okay";
+   nvidia,hssync-start-delay = <0>;
+   nvidia,xcvr-lsfslew = <2>;
+   nvidia,xcvr-lsrslew = <2>;
+   };
+
/* Mini USB port */
usb2: usb@7d004000 {
status = "okay";
nvidia,vbus-gpio = <&gpio TEGRA_GPIO(H, 7) GPIO_ACTIVE_HIGH>;
};
 
+   usb-phy@7d004000 {
+   status = "okay";
+   };
+
/* Dock's USB port */
usb3: usb@7d008000 {
status = "okay";
};
 
+   usb-phy@7d008000 {
+   status = "okay";
+   };
+
/* PMIC has a built-in 32KHz oscillator which is used by PMC */
clk32k_in: clock-32k {
compatible = "fixed-clock";
diff --git a/arch/arm/dts/tegra30-asus-tf600t.dts 
b/arch/arm/dts/tegra30-asus-tf600t.dts
index efc6a83b9d..3f11d33bc4 100644
--- a/arch/arm/dts/tegra30-asus-tf600t.dts
+++ b/arch/arm/dts/tegra30-asus-tf600t.dts
@@ -165,11 +165,22 @@
dr_mode = "otg";
};
 
+   usb-phy@7d00 {
+   status = "okay";
+   nvidia,hssync-start-delay = <0>;
+   nvidia,xcvr-lsfslew = <2>;
+   nvidia,xcvr-lsrslew = <2>;
+   };
+
/* Dock's USB port */
usb3: usb@7d008000 {
status = "okay";
};
 
+   usb-phy@7d008000 {
+   status = "okay";
+   };
+
backlight: backlight {
compatible = "pwm-backlight";
 
diff --git a/arch/arm/dts/tegra30-asus-transformer.dtsi 
b/arch/arm/dts/tegra30-asus-transformer.dtsi
index afddb83983..c4649eee79 100644
--- a/arch/arm/dts/tegra30-asus-transformer.dtsi
+++ b/arch/arm/dts/tegra30-asus-transformer.dtsi
@@ -131,6 +131,13 @@
dr_mode = "otg";
};
 
+   usb-phy@7d00 {
+   status = "okay";
+   nvidia,hssync-start-delay = <0>;
+   nvidia,xcvr-lsfslew = <2>;
+   nvidia,xcvr-lsrslew = <2>;
+   };
+
/* Dock's USB port */
usb3: usb@7d008000 {
status = "okay";
diff --git a/arch/arm/dts/tegra30-htc-endeavoru.dts 
b/arch/arm/dts/tegra30-htc-endeavoru.dts
index 22320de708..21cd0f9207 100644
--- a/arch/arm/dts/tegra30-htc-endeavoru.dts
+++ b/arch/arm/dts/tegra30-htc-endeavoru.dts
@@ -101,6 +101,13 @@
dr_mode = "otg";
};
 
+   usb-phy@7d00 {
+   status = "okay";
+   nvidia,hssync-start-delay = <0>;
+   nvidia,xcvr-lsfslew = <2>;
+   nvidia,xcvr-lsrslew = <2>;
+   };
+
backlight: backlight {
compatible = "nvidia,tegra-pwm-backlight";
 
diff --git a/arch/arm/dts/tegra30-lg-x3.dtsi b/arch/arm/dts/tegra30-lg-x3.dtsi
index aa207a70c7..01936b872e 100644
--- a/arch/arm/dts/tegra30-lg-x3.dtsi
+++ b/arch/arm/dts/tegra30-lg-x3.dtsi
@@ -153,6 +153,14 @@
dr_mode = "otg";
};
 
+   usb-phy@7d00 {
+   status = "okay";
+   nvidia,hssync-start-delay = <0>;
+   nvidia,xcvr-lsfslew = <2>;
+   nvidia,xcvr-lsrslew = <2>;
+   vbus-supply = <&avdd_3v3_periph>;
+   };
+
/* PMIC has a built-in 32KHz oscillator which is used by PMC */
clk32k_in: clock-32k {
compatible = "fixed-clock";
-- 
2.40.1



[PATCH v1 3/5] board: transformer-t30: convert ASUS Transformers to use DM PMIC

2023-11-06 Thread Svyatoslav Ryhel
Since required drivers were merged, we can safely clean up the
board and switch to DM based driver with device tree support.

Signed-off-by: Svyatoslav Ryhel 
---
 arch/arm/dts/tegra30-asus-p1801-t.dts |   2 +
 arch/arm/dts/tegra30-asus-tf600t.dts  |   4 +
 arch/arm/dts/tegra30-asus-transformer.dtsi|   2 +
 board/asus/transformer-t30/Kconfig|  10 --
 .../transformer-t30/configs/tf600t.config |   2 +-
 .../transformer-t30/transformer-t30-spl.c |   2 +-
 board/asus/transformer-t30/transformer-t30.c  | 121 +-
 configs/transformer_t30_defconfig |   5 +
 8 files changed, 21 insertions(+), 127 deletions(-)

diff --git a/arch/arm/dts/tegra30-asus-p1801-t.dts 
b/arch/arm/dts/tegra30-asus-p1801-t.dts
index 39f7caf8d0..d62d43268b 100644
--- a/arch/arm/dts/tegra30-asus-p1801-t.dts
+++ b/arch/arm/dts/tegra30-asus-p1801-t.dts
@@ -101,6 +101,7 @@
regulator-name = "vdd_emmc_core";
regulator-min-microvolt = <330>;
regulator-max-microvolt = <330>;
+   regulator-boot-on;
};
 
/* uSD slot VDD */
@@ -108,6 +109,7 @@
regulator-name = "vdd_usd";
regulator-min-microvolt = <310>;
regulator-max-microvolt = <310>;
+   regulator-boot-on;
};
 
/* uSD slot VDDIO */
diff --git a/arch/arm/dts/tegra30-asus-tf600t.dts 
b/arch/arm/dts/tegra30-asus-tf600t.dts
index fd9d11ca19..efc6a83b9d 100644
--- a/arch/arm/dts/tegra30-asus-tf600t.dts
+++ b/arch/arm/dts/tegra30-asus-tf600t.dts
@@ -84,12 +84,14 @@
regulator-name = "vdd_1v2_backlight";
regulator-min-microvolt = <120>;
regulator-max-microvolt = <120>;
+   regulator-boot-on;
};
 
vcore_lcd: vdd2 {
regulator-name = "vcore_lcd";
regulator-min-microvolt = <150>;
regulator-max-microvolt = <150>;
+   regulator-boot-on;
};
 
vdd_1v8_vio: vddio {
@@ -105,6 +107,7 @@
regulator-name = "vdd_emmc_core";
regulator-min-microvolt = <330>;
regulator-max-microvolt = <330>;
+   regulator-boot-on;
};
 
/* uSD slot VDDIO */
@@ -119,6 +122,7 @@
regulator-name = "avdd_dsi_csi";
regulator-min-microvolt = <120>;
regulator-max-microvolt = <120>;
+   regulator-boot-on;
};
};
};
diff --git a/arch/arm/dts/tegra30-asus-transformer.dtsi 
b/arch/arm/dts/tegra30-asus-transformer.dtsi
index 888f9ca74e..afddb83983 100644
--- a/arch/arm/dts/tegra30-asus-transformer.dtsi
+++ b/arch/arm/dts/tegra30-asus-transformer.dtsi
@@ -82,6 +82,7 @@
regulator-name = "vdd_emmc_core";
regulator-min-microvolt = <330>;
regulator-max-microvolt = <330>;
+   regulator-boot-on;
};
 
/* uSD slot VDD */
@@ -89,6 +90,7 @@
regulator-name = "vdd_usd";
regulator-min-microvolt = <310>;
regulator-max-microvolt = <310>;
+   regulator-boot-on;
};
 
/* uSD slot VDDIO */
diff --git a/board/asus/transformer-t30/Kconfig 
b/board/asus/transformer-t30/Kconfig
index accc999c43..915436ba6c 100644
--- a/board/asus/transformer-t30/Kconfig
+++ b/board/asus/transformer-t30/Kconfig
@@ -9,14 +9,4 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "transformer-t30"
 
-config TRANSFORMER_SPI_BOOT
-   bool "Enable support for SPI based flash"
-   select TEGRA20_SLINK
-   select DM_SPI_FLASH
-   select SPI_FLASH_WINBOND
-   help
- Tegra 3 based Transformers with Windows RT h

[PATCH v1 4/5] board: grouper: convert ASUS Google Nexus 7 (2012) to use DM PMIC

2023-11-06 Thread Svyatoslav Ryhel
Since required drivers were merged, we can safely clean up the
board and switch to DM based driver with device tree support.

Signed-off-by: Svyatoslav Ryhel 
---
 .../dts/tegra30-asus-nexus7-grouper-E1565.dts |   1 +
 .../dts/tegra30-asus-nexus7-grouper-PM269.dts |   1 +
 .../dts/tegra30-asus-nexus7-tilapia-E1565.dts |   1 +
 board/asus/grouper/Kconfig|   8 -
 board/asus/grouper/Makefile   |   4 +-
 .../asus/grouper/configs/grouper_E1565.config |   6 +-
 .../asus/grouper/configs/grouper_PM269.config |   6 +-
 board/asus/grouper/configs/tilapia.config |   6 +-
 board/asus/grouper/grouper-spl-max.c  |   2 +-
 board/asus/grouper/grouper-spl-ti.c   |   2 +-
 board/asus/grouper/grouper.c  | 154 +-
 configs/grouper_common_defconfig  |   1 +
 12 files changed, 29 insertions(+), 163 deletions(-)

diff --git a/arch/arm/dts/tegra30-asus-nexus7-grouper-E1565.dts 
b/arch/arm/dts/tegra30-asus-nexus7-grouper-E1565.dts
index 945ae404ac..bfc675ca92 100644
--- a/arch/arm/dts/tegra30-asus-nexus7-grouper-E1565.dts
+++ b/arch/arm/dts/tegra30-asus-nexus7-grouper-E1565.dts
@@ -35,6 +35,7 @@
regulator-name = "vcore_emmc";
regulator-min-microvolt = <285>;
regulator-max-microvolt = <285>;
+   regulator-boot-on;
};
};
};
diff --git a/arch/arm/dts/tegra30-asus-nexus7-grouper-PM269.dts 
b/arch/arm/dts/tegra30-asus-nexus7-grouper-PM269.dts
index 4363bfc87d..cf03011bc1 100644
--- a/arch/arm/dts/tegra30-asus-nexus7-grouper-PM269.dts
+++ b/arch/arm/dts/tegra30-asus-nexus7-grouper-PM269.dts
@@ -36,6 +36,7 @@
regulator-name = "vdd_emmc_core";
regulator-min-microvolt = <330>;
regulator-max-microvolt = <330>;
+   regulator-boot-on;
};
};
};
diff --git a/arch/arm/dts/tegra30-asus-nexus7-tilapia-E1565.dts 
b/arch/arm/dts/tegra30-asus-nexus7-tilapia-E1565.dts
index 89348fde13..ef8b2b5049 100644
--- a/arch/arm/dts/tegra30-asus-nexus7-tilapia-E1565.dts
+++ b/arch/arm/dts/tegra30-asus-nexus7-tilapia-E1565.dts
@@ -35,6 +35,7 @@
regulator-name = "vcore_emmc";
regulator-min-microvolt = <285>;
regulator-max-microvolt = <285>;
+   regulator-boot-on;
};
};
};
diff --git a/board/asus/grouper/Kconfig b/board/asus/grouper/Kconfig
index 47d9bae946..f935cce422 100644
--- a/board/asus/grouper/Kconfig
+++ b/board/asus/grouper/Kconfig
@@ -9,12 +9,4 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "grouper"
 
-config GROUPER_TPS65911
-   bool "Enable support TI TPS65911 PMIC"
-   select CMD_POWEROFF
-
-config GROUPER_MAX77663
-   bool "Enable support MAXIM MAX77663 PMIC"
-   select CMD_POWEROFF
-
 endif
diff --git a/board/asus/grouper/Makefile b/board/asus/grouper/Makefile
index e4a477a366..d041cf8087 100644
--- a/board/asus/grouper/Makefile
+++ b/board/asus/grouper/Makefile
@@ -7,8 +7,8 @@
 #  Svyatoslav Ryhel 
 
 ifdef CONFIG_SPL_BUILD
-obj-$(CONFIG_GROUPER_MAX77663) += grouper-spl-max.o
-obj-$(CONFIG_GROUPER_TPS65911) += grouper-spl-ti.o
+obj-$(CONFIG_DM_PMIC_MAX77663) += grouper-spl-max.o
+obj-$(CONFIG_DM_PMIC_TPS65910) += grouper-spl-ti.o
 endif
 
 obj-y += grouper.o
diff --git a/board/asus/grouper/configs/grouper_E1565.config 
b/board/asus/grouper/configs/grouper_E1565.config
index 4d8d5263fa..265295c8b3 100644
--- a/board/asus/grouper/configs/grouper_E1565.config
+++ b/board/asus/grouper/configs/grouper_E1565.config
@@ -1,2 +1,6 @@
 CONFIG_DEFAULT_DEVICE_TREE="tegra30-asus-nexus7-grouper-E1565"
-CONFIG_GROUPER_MAX77663=y
+CONFIG_CMD_POWEROFF=y
+# CONFIG_MAX77663_GPIO is not set
+CONFIG_DM_PMIC_MAX77663=y
+CONFIG_DM_REGULATOR_MAX77663=y
+CONFIG_SYSRESET_MAX77663=y
diff --git a/board/asus/grouper/configs/grouper_PM269.config 
b/board/asus/grouper/configs/grouper_PM269.config
index fc768b2051..a7ee3587ed 100644
--- a/board/asus/grouper/configs/grouper_PM269.config
+++ b/board/asus/grouper/configs/grouper_PM269.config
@@ -1,2 +1,6 @@
 CONFIG_DEFAULT_DEVICE_TREE="tegra30-asus-nexus7-grouper-PM269"
-CONFIG_GROUPER_TPS65911=y
+CONFIG_CMD_POWEROFF=y
+CONFIG_DM_PMIC_TPS65910=y
+# CONFIG_DM_REGULATOR_TPS65910 is not set
+CONFIG_DM_REGULATOR_TPS65911=y
+CONFIG_SYSRESET_TPS65910=y
diff --git a/board/asus/grouper/configs/tilapia.config 
b/board/asus/grouper/configs/tilapia.config
index 1fb0633e3a..d461b4752a 100644
--- a/board/asus/grouper/configs

Re: [PATCH v1 0/2] Meson A1: fix USB and NAND stack

2023-11-06 Thread Neil Armstrong
Hi,

On Wed, 01 Nov 2023 17:04:55 +0300, Alexey Romanov wrote:
> After a recent sync device tree with the Linux Kernel,
> some drivers broke. These patchset will fix that.
> 
> Alexey Romanov (1):
>   clk: a1: add new clocks for USB stack
> 
> Dmitry Rokosov (1):
>   drivers: sm: bind child sm devices in the device tree
> 
> [...]

Thanks, Applied to https://source.denx.de/u-boot/custodians/u-boot-amlogic 
(u-boot-amlogic)

[1/2] clk: a1: add new clocks for USB stack
  
https://source.denx.de/u-boot/custodians/u-boot-amlogic/-/commit/8ec790399aa88bb8d0a02282e411f34584c74950
[2/2] drivers: sm: bind child sm devices in the device tree
  
https://source.denx.de/u-boot/custodians/u-boot-amlogic/-/commit/e9f4f7789cdcda342b2f7edb82a6141f82f4c7c2

-- 
Neil



Re: [PATCH] ARM: configs: libretech-ac: enable USB_DFU like in meson64.h

2023-11-06 Thread Neil Armstrong
Hi,

On Thu, 02 Nov 2023 14:49:58 +0100, Neil Armstrong wrote:
> USB_DFU was added in meson64.h but is missing in libretech-ac.h,
> fix this to enable DFU RAM boot for libretech-ac.
> 
> Fixes 4aa027b3f8 ("configs: meson64: add alternate USB DFU boot target")
> 
> 

Thanks, Applied to https://source.denx.de/u-boot/custodians/u-boot-amlogic 
(u-boot-amlogic)

[1/1] ARM: configs: libretech-ac: enable USB_DFU like in meson64.h
  
https://source.denx.de/u-boot/custodians/u-boot-amlogic/-/commit/c550e81171940932664a85bda315a6a073aae23c

-- 
Neil



[PATCH v2 0/3] Implement GPIO cells for PALMAS and MAX77663 PMICs

2023-11-06 Thread Svyatoslav Ryhel
This patchset adds support for gpio-uclass to work with pmic gpio childrens
properly and implements MAX77663 and PALMAS GPIO cells/children as a 
reference and to be further used in devices I am currently maintaining.

All drivers are tested on actual hardware and confirmed to work as
expected. MAX77663 GPIO cell is tested on wexler qc750 tegra 3 device
and PALMAS GPIO cell is tested on tegra note 7 tegra 4 device.

---
Changes from v1:
 - isolate PMIC GPIO cells parsing behind enabling DM_PMIC
---

Svyatoslav Ryhel (3):
  drivers: gpio-uclass: support PMIC GPIO children
  drivers: gpio: implement MAX77663 GPIO cell
  drivers: gpio: implement PALMAS GPIO cell

 drivers/gpio/Kconfig|  16 +++
 drivers/gpio/Makefile   |   2 +
 drivers/gpio/gpio-uclass.c  |  19 +++
 drivers/gpio/max77663_gpio.c| 178 
 drivers/gpio/palmas_gpio.c  | 132 +
 drivers/power/pmic/max77663.c   |   9 ++
 drivers/power/pmic/palmas.c |  10 +-
 include/dt-bindings/pmic/max77663.h |  18 +++
 include/power/max77663.h|   1 +
 include/power/palmas.h  |  12 ++
 10 files changed, 396 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpio/max77663_gpio.c
 create mode 100644 drivers/gpio/palmas_gpio.c
 create mode 100644 include/dt-bindings/pmic/max77663.h

-- 
2.40.1



[PATCH v2 1/3] drivers: gpio-uclass: support PMIC GPIO children

2023-11-06 Thread Svyatoslav Ryhel
UCLASS_PMIC may have GPIO children without exposed fdt node,
in this case if requesting fails, check if uclass is PMIC.
If so, iterate through its children to find correct device.

Signed-off-by: Svyatoslav Ryhel 
---
 drivers/gpio/gpio-uclass.c | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c
index 7aece85a70..6ef7cb4b78 100644
--- a/drivers/gpio/gpio-uclass.c
+++ b/drivers/gpio/gpio-uclass.c
@@ -1143,9 +1143,28 @@ static int gpio_request_tail(int ret, const char 
*nodename,
ret = uclass_get_device_by_ofnode(UCLASS_GPIO, args->node,
  &desc->dev);
if (ret) {
+#if CONFIG_IS_ENABLED(DM_PMIC)
+   struct udevice *pmic;
+   ret = uclass_get_device_by_ofnode(UCLASS_PMIC, 
args->node,
+ &pmic);
+   if (ret) {
+   log_err("PMIC device get failed, err %d\n", 
ret);
+   goto err;
+   }
+
+   device_foreach_child(desc->dev, pmic) {
+   if (device_get_uclass_id(desc->dev) == 
UCLASS_GPIO)
+   break;
+   }
+
+   /* if loop exits without GPIO device return error */
+   if (device_get_uclass_id(desc->dev) != UCLASS_GPIO)
+   goto err;
+#else
debug("%s: uclass_get_device_by_ofnode failed\n",
  __func__);
goto err;
+#endif
}
}
ret = gpio_find_and_xlate(desc, args);
-- 
2.40.1



[PATCH v2 2/3] drivers: gpio: implement MAX77663 GPIO cell

2023-11-06 Thread Svyatoslav Ryhel
MAXIM Semiconductor's PMIC, MAX77663 has 8 GPIO pins and 3 GPIO-like
pins. It also supports interrupts from these pins.

Add GPIO driver for these pins to control via GPIO APIs.

Signed-off-by: Svyatoslav Ryhel 
---
 drivers/gpio/Kconfig|   9 ++
 drivers/gpio/Makefile   |   1 +
 drivers/gpio/max77663_gpio.c| 178 
 drivers/power/pmic/max77663.c   |   9 ++
 include/dt-bindings/pmic/max77663.h |  18 +++
 include/power/max77663.h|   1 +
 6 files changed, 216 insertions(+)
 create mode 100644 drivers/gpio/max77663_gpio.c
 create mode 100644 include/dt-bindings/pmic/max77663.h

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index ba42b0768e..250f1ebbb3 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -238,6 +238,15 @@ config MAX7320_GPIO
 original maxim device has 8 push/pull outputs,
 some clones offers 16bit.
 
+config MAX77663_GPIO
+   bool "MAX77663 GPIO cell of PMIC driver"
+   depends on DM_GPIO && DM_PMIC_MAX77663
+   help
+ GPIO driver for MAX77663 PMIC from Maxim Semiconductor.
+ MAX77663 PMIC has 8 pins that can be configured as GPIOs
+ and 3 GPIO-like pins dedicated for power/reset buttons
+ and LID sensor.
+
 config MCP230XX_GPIO
bool "MCP230XX GPIO driver"
depends on DM
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index c8b3fd7814..dab3eb93a3 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -68,6 +68,7 @@ obj-$(CONFIG_NX_GPIO) += nx_gpio.o
 obj-$(CONFIG_SIFIVE_GPIO)  += sifive-gpio.o
 obj-$(CONFIG_NOMADIK_GPIO) += nmk_gpio.o
 obj-$(CONFIG_MAX7320_GPIO) += max7320_gpio.o
+obj-$(CONFIG_$(SPL_)MAX77663_GPIO) += max77663_gpio.o
 obj-$(CONFIG_SL28CPLD_GPIO)+= sl28cpld-gpio.o
 obj-$(CONFIG_ZYNQMP_GPIO_MODEPIN)  += zynqmp_gpio_modepin.o
 obj-$(CONFIG_SLG7XL45106_I2C_GPO)  += gpio_slg7xl45106.o
diff --git a/drivers/gpio/max77663_gpio.c b/drivers/gpio/max77663_gpio.c
new file mode 100644
index 00..79b1ee7448
--- /dev/null
+++ b/drivers/gpio/max77663_gpio.c
@@ -0,0 +1,178 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ *  Copyright(C) 2023 Svyatoslav Ryhel 
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#define NUM_ENTRIES11 /* 8 GPIOs + 3 KEYs  */
+#define NUM_GPIOS  8
+
+#define MAX77663_CNFG1_GPIO0x36
+#define GPIO_REG_ADDR(offset)  (MAX77663_CNFG1_GPIO + (offset))
+
+#define MAX77663_CNFG_GPIO_DIR_MASKBIT(1)
+#define MAX77663_CNFG_GPIO_DIR_INPUT   BIT(1)
+#define MAX77663_CNFG_GPIO_DIR_OUTPUT  0
+#define MAX77663_CNFG_GPIO_INPUT_VAL_MASK  BIT(2)
+#define MAX77663_CNFG_GPIO_OUTPUT_VAL_MASK BIT(3)
+#define MAX77663_CNFG_GPIO_OUTPUT_VAL_HIGH BIT(3)
+#define MAX77663_CNFG_GPIO_OUTPUT_VAL_LOW  0
+#define MAX77663_CNFG_IRQ  GENMASK(5, 4)
+
+#define MAX77663_ONOFFSTAT_REG 0x15
+#define   EN0  BIT(2) /* KEY 2 */
+#define   ACOK BIT(1) /* KEY 1 */
+#define   LID  BIT(0) /* KEY 0 */
+
+static int max77663_gpio_direction_input(struct udevice *dev, unsigned int 
offset)
+{
+   int ret;
+
+   if (offset >= NUM_GPIOS)
+   return 0;
+
+   ret = pmic_clrsetbits(dev->parent, GPIO_REG_ADDR(offset),
+ MAX77663_CNFG_GPIO_DIR_MASK,
+ MAX77663_CNFG_GPIO_DIR_INPUT);
+   if (ret < 0)
+   log_err("CNFG_GPIOx dir update failed: %d\n", ret);
+
+   return ret;
+}
+
+static int max77663_gpio_direction_output(struct udevice *dev, unsigned int 
offset,
+ int value)
+{
+   u8 val;
+   int ret;
+
+   if (offset >= NUM_GPIOS)
+   return -EINVAL;
+
+   val = (value) ? MAX77663_CNFG_GPIO_OUTPUT_VAL_HIGH :
+   MAX77663_CNFG_GPIO_OUTPUT_VAL_LOW;
+
+   ret = pmic_clrsetbits(dev->parent, GPIO_REG_ADDR(offset),
+ MAX77663_CNFG_GPIO_OUTPUT_VAL_MASK, val);
+   if (ret < 0) {
+   log_err("CNFG_GPIOx val update failed: %d\n", ret);
+   return ret;
+   }
+
+   ret = pmic_clrsetbits(dev->parent, GPIO_REG_ADDR(offset),
+ MAX77663_CNFG_GPIO_DIR_MASK,
+ MAX77663_CNFG_GPIO_DIR_OUTPUT);
+   if (ret < 0)
+   log_err("CNFG_GPIOx dir update failed: %d\n", ret);
+
+   return ret;
+}
+
+static int max77663_gpio_get_value(struct udevice *dev, unsigned int offset)
+{
+   int ret;
+
+   if (offset >= NUM_GPIOS) {
+   ret = pmic_reg_read(dev->parent, MAX77663_ONOFFSTAT_REG);
+   if (ret < 0) {
+   log_err("ONOFFSTAT_REG read failed: %d\n", ret);
+  

[PATCH v2 3/3] drivers: gpio: implement PALMAS GPIO cell

2023-11-06 Thread Svyatoslav Ryhel
Add gpio driver for TI Palmas series PMIC. This has 8 gpio which can
work as input/output.

Signed-off-by: Svyatoslav Ryhel 
---
 drivers/gpio/Kconfig|   7 ++
 drivers/gpio/Makefile   |   1 +
 drivers/gpio/palmas_gpio.c  | 132 
 drivers/power/pmic/palmas.c |  10 ++-
 include/power/palmas.h  |  12 
 5 files changed, 161 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpio/palmas_gpio.c

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 250f1ebbb3..63e62e1acd 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -435,6 +435,13 @@ config VYBRID_GPIO
help
  Say yes here to support Vybrid vf610 GPIOs.
 
+config PALMAS_GPIO
+   bool "TI PALMAS series PMICs GPIO"
+   depends on DM_GPIO && PMIC_PALMAS
+   help
+ Select this option to enable GPIO driver for the TI PALMAS
+ series chip family.
+
 config PIC32_GPIO
bool "Microchip PIC32 GPIO driver"
depends on DM_GPIO && MACH_PIC32
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index dab3eb93a3..da3da5da2b 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -55,6 +55,7 @@ obj-$(CONFIG_VYBRID_GPIO) += vybrid_gpio.o
 obj-$(CONFIG_HIKEY_GPIO)   += hi6220_gpio.o
 obj-$(CONFIG_HSDK_CREG_GPIO)   += hsdk-creg-gpio.o
 obj-$(CONFIG_IMX_RGPIO2P)  += imx_rgpio2p.o
+obj-$(CONFIG_$(SPL_)PALMAS_GPIO)   += palmas_gpio.o
 obj-$(CONFIG_PIC32_GPIO)   += pic32_gpio.o
 obj-$(CONFIG_OCTEON_GPIO)  += octeon_gpio.o
 obj-$(CONFIG_MVEBU_GPIO)   += mvebu_gpio.o
diff --git a/drivers/gpio/palmas_gpio.c b/drivers/gpio/palmas_gpio.c
new file mode 100644
index 00..b4610cba18
--- /dev/null
+++ b/drivers/gpio/palmas_gpio.c
@@ -0,0 +1,132 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Based on mainline Linux palmas GPIO driver
+ * Copyright(C) 2023 Svyatoslav Ryhel 
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#define NUM_GPIOS  8
+
+static int palmas_gpio_set_value(struct udevice *dev, unsigned int offset,
+int value)
+{
+   struct palmas_priv *priv = dev_get_priv(dev->parent);
+   u32 reg;
+   int ret;
+
+   reg = (value) ? PALMAS_GPIO_SET_DATA_OUT : PALMAS_GPIO_CLEAR_DATA_OUT;
+
+   ret = dm_i2c_reg_write(priv->chip2, reg, BIT(offset));
+   if (ret < 0)
+   log_err("Reg 0x%02x write failed, %d\n", reg, ret);
+
+   return ret;
+}
+
+static int palmas_gpio_get_value(struct udevice *dev, unsigned int offset)
+{
+   struct palmas_priv *priv = dev_get_priv(dev->parent);
+   u32 reg;
+   int ret;
+
+   ret = dm_i2c_reg_read(priv->chip2, PALMAS_GPIO_DATA_DIR);
+   if (ret < 0) {
+   log_err("GPIO_DATA_DIR read failed, %d\n", ret);
+   return ret;
+   }
+
+   if (ret & BIT(offset))
+   reg = PALMAS_GPIO_DATA_OUT;
+   else
+   reg = PALMAS_GPIO_DATA_IN;
+
+   ret = dm_i2c_reg_read(priv->chip2, reg);
+   if (ret < 0) {
+   log_err("Reg 0x%02x read failed, %d\n", reg, ret);
+   return ret;
+   }
+
+   return !!(ret & BIT(offset));
+}
+
+static int palmas_gpio_direction_input(struct udevice *dev, unsigned int 
offset)
+{
+   struct palmas_priv *priv = dev_get_priv(dev->parent);
+   int ret;
+
+   ret = dm_i2c_reg_clrset(priv->chip2, PALMAS_GPIO_DATA_DIR,
+   BIT(offset), 0);
+   if (ret < 0)
+   log_err("GPIO_DATA_DIR val update failed: %d\n", ret);
+
+   return ret;
+}
+
+static int palmas_gpio_direction_output(struct udevice *dev, unsigned int 
offset,
+   int value)
+{
+   struct palmas_priv *priv = dev_get_priv(dev->parent);
+   int ret;
+
+   /* Set the initial value */
+   palmas_gpio_set_value(dev, offset, value);
+
+   ret = dm_i2c_reg_clrset(priv->chip2, PALMAS_GPIO_DATA_DIR,
+   BIT(offset), BIT(offset));
+   if (ret < 0)
+   log_err("GPIO_DATA_DIR val update failed: %d\n", ret);
+
+   return ret;
+}
+
+static int palmas_gpio_get_function(struct udevice *dev, unsigned int offset)
+{
+   struct palmas_priv *priv = dev_get_priv(dev->parent);
+   int ret;
+
+   ret = dm_i2c_reg_read(priv->chip2, PALMAS_GPIO_DATA_DIR);
+   if (ret < 0) {
+   log_err("GPIO_DATA_DIR read failed, %d\n", ret);
+   return ret;
+   }
+
+   if (ret & BIT(offset))
+   return GPIOF_OUTPUT;
+   else
+   return GPIOF_INPUT;
+}
+
+static const struct dm_gpio_ops palmas_gpio_ops = {
+   .direction_input= palmas_gpio_direction_input,
+   .direction_output   = palmas_gpio_direction_output,
+   .get_value  = palmas_gpio_get_value,
+   .set_value  = palmas_gpio_set_value,
+   .get_function   = palmas_gpio_get_function,
+};
+
+sta

[PATCH 1/1] .mailmap: map Pali Rohár

2023-11-06 Thread Heinrich Schuchardt
Pali expressed that he does not want to receive mails relating to his past
contributions.

Signed-off-by: Heinrich Schuchardt 
---
 .mailmap | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.mailmap b/.mailmap
index 05cb310e41..4c0b922488 100644
--- a/.mailmap
+++ b/.mailmap
@@ -80,6 +80,8 @@ Nava kishore Manne  

 Neal Frager  
 Neil Armstrong  
 Nicolas Saenz Julienne  
+This contributor prefers not to receive mails  

+This contributor prefers not to receive mails  

 Patrice Chotard  
 Patrick Delaunay  
 Paul Burton  
--
2.40.1



Re: [PATCH v6 00/25] spl: Use common function for loading/parsing images

2023-11-06 Thread Heinrich Schuchardt

On 11/5/23 23:49, Pali Rohár wrote:

What you are doing is the worst thing in the world. You have been
ignoring all my changes which I have been sending for one year, then you
wrote me that I'm not competent to do any kind of programming, later you
wrote that you would ignore all my requests and stop responding to any
questions, then you have removed all my code from u-boot and showed me
as the worst person in the world.

But seems that this is not enough for you. You have to continue
attacking on me, and making everything even worse.

WHAT YOU WANT FROM ME NOW WHY YOU ARE CONTACTING ME??? IS NOT IT
ENOUGH WHAT YOU HAVE TO ME?? Or you do think that I forgot what you have
been doing with me last years? Speak up!


I have created a patch for .mailmap to avoid sending Pali any further
"unsolicited" mail.

[PATCH 1/1] .mailmap: map Pali Rohár
https://lists.denx.de/pipermail/u-boot/2023-November/536392.html

Best regards

Heinrich


[PATCH] fs/squashfs: remove unused declarations

2023-11-06 Thread David Oberhollenzer
This patch removes a number of struct and macro declaration that
were found through `git-grep` to be unused. Most of those are
related to compressor options and super block flags.

For reading a SquashFS image, we do not need the compressor options
or the flags. Those only encode settings used for packing the image,
mksquashfs uses them when appending data to an existing image. The
kernel implementation does not touch those, and we don't need them
either.

Signed-off-by: David Oberhollenzer 
---
 fs/squashfs/sqfs_decompressor.h | 35 -
 fs/squashfs/sqfs_filesystem.h   |  2 --
 fs/squashfs/sqfs_utils.h| 21 
 3 files changed, 58 deletions(-)

diff --git a/fs/squashfs/sqfs_decompressor.h b/fs/squashfs/sqfs_decompressor.h
index 892cfb6974..c48b74fdf5 100644
--- a/fs/squashfs/sqfs_decompressor.h
+++ b/fs/squashfs/sqfs_decompressor.h
@@ -18,41 +18,6 @@
 #define SQFS_COMP_LZ4 5
 #define SQFS_COMP_ZSTD 6
 
-/* LZMA does not support any compression options */
-
-struct squashfs_gzip_opts {
-   u32 compression_level;
-   u16 window_size;
-   u16 strategies;
-};
-
-struct squashfs_xz_opts {
-   u32 dictionary_size;
-   u32 executable_filters;
-};
-
-struct squashfs_lz4_opts {
-   u32 version;
-   u32 flags;
-};
-
-struct squashfs_zstd_opts {
-   u32 compression_level;
-};
-
-struct squashfs_lzo_opts {
-   u32 algorithm;
-   u32 level;
-};
-
-union squashfs_compression_opts {
-   struct squashfs_gzip_opts *gzip;
-   struct squashfs_xz_opts *xz;
-   struct squashfs_lz4_opts *lz4;
-   struct squashfs_zstd_opts *zstd;
-   struct squashfs_lzo_opts *lzo;
-};
-
 int sqfs_decompress(struct squashfs_ctxt *ctxt, void *dest,
unsigned long *dest_len, void *source, u32 src_len);
 int sqfs_decompressor_init(struct squashfs_ctxt *ctxt);
diff --git a/fs/squashfs/sqfs_filesystem.h b/fs/squashfs/sqfs_filesystem.h
index 5440b6c0e0..be56498a5e 100644
--- a/fs/squashfs/sqfs_filesystem.h
+++ b/fs/squashfs/sqfs_filesystem.h
@@ -13,7 +13,6 @@
 #include 
 #include 
 
-#define SQFS_UNCOMPRESSED_DATA 0x0002
 #define SQFS_MAGIC_NUMBER 0x73717368
 /* The three first members of squashfs_dir_index make a total of 12 bytes */
 #define SQFS_DIR_INDEX_BASE_LENGTH 12
@@ -23,7 +22,6 @@
 #define SQFS_MAX_ENTRIES 512
 /* Metadata blocks start by a 2-byte length header */
 #define SQFS_HEADER_SIZE 2
-#define SQFS_LREG_INODE_MIN_SIZE 56
 #define SQFS_DIR_HEADER_SIZE 12
 #define SQFS_MISC_ENTRY_TYPE -1
 #define SQFS_EMPTY_FILE_SIZE 3
diff --git a/fs/squashfs/sqfs_utils.h b/fs/squashfs/sqfs_utils.h
index 1260abe22b..41f13e8a9e 100644
--- a/fs/squashfs/sqfs_utils.h
+++ b/fs/squashfs/sqfs_utils.h
@@ -15,11 +15,8 @@
 #define SQFS_FRAGMENT_INDEX_OFFSET(A) ((A) % SQFS_MAX_ENTRIES)
 #define SQFS_FRAGMENT_INDEX(A) ((A) / SQFS_MAX_ENTRIES)
 #define SQFS_BLOCK_SIZE(A) ((A) & GENMASK(23, 0))
-#define SQFS_CHECK_FLAG(flag, bit) (((flag) >> (bit)) & 1)
 /* Useful for both fragment and data blocks */
 #define SQFS_COMPRESSED_BLOCK(A) (!((A) & BIT(24)))
-/* SQFS_COMPRESSED_DATA strictly used with super block's 'flags' member */
-#define SQFS_COMPRESSED_DATA(A) (!((A) & 0x0002))
 #define SQFS_IS_FRAGMENTED(A) ((A) != 0x)
 /*
  * These two macros work as getters for a metada block header, retrieving the
@@ -28,22 +25,4 @@
 #define SQFS_COMPRESSED_METADATA(A) (!((A) & BIT(15)))
 #define SQFS_METADATA_SIZE(A) ((A) & GENMASK(14, 0))
 
-struct squashfs_super_block_flags {
-   /* check: unused
-* uncompressed_ids: not supported
-*/
-   bool uncompressed_inodes;
-   bool uncompressed_data;
-   bool check;
-   bool uncompressed_frags;
-   bool no_frags;
-   bool always_frags;
-   bool duplicates;
-   bool exportable;
-   bool uncompressed_xattrs;
-   bool no_xattrs;
-   bool compressor_options;
-   bool uncompressed_ids;
-};
-
 #endif /* SQFS_UTILS_H  */
-- 
2.41.0



Re: [PATCH v6 00/25] spl: Use common function for loading/parsing images

2023-11-06 Thread Marek Behún
On Mon, 6 Nov 2023 08:49:05 +0100
Pali Rohár  wrote:

> What you are doing is the worst thing in the world. You have been
> ignoring all my changes which I have been sending for one year, then you
> wrote me that I'm not competent to do any kind of programming, later you
> wrote that you would ignore all my requests and stop responding to any
> questions, then you have removed all my code from u-boot and showed me
> as the worst person in the world.

I am sorry this happened the way it did. I personally do not think that
you're not a competent programmer. On the contrary, I think that you're
a very good programmer, and that what happened has more to do with
an escalation of misunderstandings and relevant people being too busy at
unfortunate times. This naturally led to frustrations and harsh
language, which led to this unfortunate situation.

Just wanted to let you know that I am sorry about how this whole thing
played out, and that I feel partially responsible for a little bit of
it, since I also made you some promises ages ago which still are not
fulfilled :-(

I have finally managed to recruit two newbie kernel hackers into our
team. I am currently tutoring them, and one of the projects I have
in the tutoring plan is getting the work you did out into the open. It
will take some time, but my hopes are that it will be done.

Again, I am sorry. I hope you are doing well.

Marek


[PATCH] fs/squashfs: enable LZ4 compression support

2023-11-06 Thread David Oberhollenzer
The structure is identical to the existing compressor implementations,
trivially adding lz4 decompression to sqfs_decompress.

The changes were tested using a sandbox build. An LZ4 compressed
squashfs image was bound as a host block device.

Signed-off-by: David Oberhollenzer 
---
 fs/squashfs/sqfs_decompressor.c | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/fs/squashfs/sqfs_decompressor.c b/fs/squashfs/sqfs_decompressor.c
index 6b3e01cdad..cfd1153fd7 100644
--- a/fs/squashfs/sqfs_decompressor.c
+++ b/fs/squashfs/sqfs_decompressor.c
@@ -18,6 +18,10 @@
 #include 
 #endif
 
+#if IS_ENABLED(CONFIG_LZ4)
+#include 
+#endif
+
 #if IS_ENABLED(CONFIG_ZSTD)
 #include 
 #endif
@@ -38,6 +42,10 @@ int sqfs_decompressor_init(struct squashfs_ctxt *ctxt)
case SQFS_COMP_ZLIB:
break;
 #endif
+#if IS_ENABLED(CONFIG_LZ4)
+   case SQFS_COMP_LZ4:
+   break;
+#endif
 #if IS_ENABLED(CONFIG_ZSTD)
case SQFS_COMP_ZSTD:
ctxt->zstd_workspace = malloc(zstd_dctx_workspace_bound());
@@ -66,6 +74,10 @@ void sqfs_decompressor_cleanup(struct squashfs_ctxt *ctxt)
case SQFS_COMP_ZLIB:
break;
 #endif
+#if IS_ENABLED(CONFIG_LZ4)
+   case SQFS_COMP_LZ4:
+   break;
+#endif
 #if IS_ENABLED(CONFIG_ZSTD)
case SQFS_COMP_ZSTD:
free(ctxt->zstd_workspace);
@@ -139,6 +151,17 @@ int sqfs_decompress(struct squashfs_ctxt *ctxt, void *dest,
 
break;
 #endif
+#if IS_ENABLED(CONFIG_LZ4)
+   case SQFS_COMP_LZ4:
+   ret = LZ4_decompress_safe(source, dest, src_len, *dest_len);
+   if (ret < 0) {
+   printf("LZ4 decompression failed.\n");
+   return -EINVAL;
+   }
+
+   ret = 0;
+   break;
+#endif
 #if IS_ENABLED(CONFIG_ZSTD)
case SQFS_COMP_ZSTD:
ret = sqfs_zstd_decompress(ctxt, dest, *dest_len, source, 
src_len);
-- 
2.41.0



RE: [PATCH] mmc: renesas-sdhi: Disable clock after tuning reset when possible

2023-11-06 Thread Jaehoon Chung



> -Original Message-
> From: Marek Vasut 
> Sent: Monday, November 6, 2023 7:43 AM
> To: u-boot@lists.denx.de
> Cc: Marek Vasut ; Jaehoon Chung 
> ; Nobuhiro
> Iwamatsu ; Paul Barker ; 
> Peng Fan
> 
> Subject: [PATCH] mmc: renesas-sdhi: Disable clock after tuning reset when 
> possible
> 
> Currently the renesas_sdhi_reset_tuning() unconditionally leaves SDHI
> clock enabled after the tuning reset. This is not always necessary.
> 
> After the driver performed tuning reset at the end of probe function,
> or in the unlikely case that tuning failed during regular operation,
> the SDHI clock can be disabled after the tuning reset. The following
> set_ios call would reconfigure the clock as needed.
> 
> In case of regular set_ios call which requires a tuning reset, keep
> the clock enabled or disabled according to the mmc->clk_disable state.
> 
> With this in place, the controllers which have not been accessed via
> block subsystem after boot are left in quiescent state. However, if an
> MMC device is used e.g. for environment storage, that controller would
> be accessed during the environment load and left active, including its
> clock which would still be generated. This is due to the design of the
> MMC subsystem, which does not deinit a controller after it was started
> once, the controller is only deinited in case of mmc rescan, or before
> OS boot.
> 
> Signed-off-by: Marek Vasut 

Reviewed-by: Jaehoon Chung 

Best Regards,
Jaehoon Chung

> ---
> Note: To address the part where MMC device has been inited once and
>   is never deinited until rescan or OS boot, it would likely be
>   necessary to implement something like runtime PM, possibly
>   based on the cyclic framework. Basically, keep track of when
>   the MMC was accessed last, and if certain time elapsed, deinit
>   the MMC. This could also be used to handle card detect polling
>   at the same time.
> ---
> Cc: Jaehoon Chung 
> Cc: Nobuhiro Iwamatsu 
> Cc: Paul Barker 
> Cc: Peng Fan 
> ---
>  drivers/mmc/renesas-sdhi.c | 14 ++
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mmc/renesas-sdhi.c b/drivers/mmc/renesas-sdhi.c
> index 8cd501c5f7c..97aaf1e4ec3 100644
> --- a/drivers/mmc/renesas-sdhi.c
> +++ b/drivers/mmc/renesas-sdhi.c
> @@ -318,7 +318,7 @@ static unsigned int renesas_sdhi_init_tuning(struct 
> tmio_sd_priv *priv)
>   RENESAS_SDHI_SCC_DTCNTL_TAPNUM_MASK;
>  }
> 
> -static void renesas_sdhi_reset_tuning(struct tmio_sd_priv *priv)
> +static void renesas_sdhi_reset_tuning(struct tmio_sd_priv *priv, bool 
> clk_disable)
>  {
>   u32 reg;
> 
> @@ -350,6 +350,12 @@ static void renesas_sdhi_reset_tuning(struct 
> tmio_sd_priv *priv)
>   reg = tmio_sd_readl(priv, RENESAS_SDHI_SCC_RVSCNTL);
>   reg &= ~RENESAS_SDHI_SCC_RVSCNTL_RVSEN;
>   tmio_sd_writel(priv, reg, RENESAS_SDHI_SCC_RVSCNTL);
> +
> + if (clk_disable) {
> + reg = tmio_sd_readl(priv, TMIO_SD_CLKCTL);
> + reg &= ~TMIO_SD_CLKCTL_SCLKEN;
> + tmio_sd_writel(priv, reg, TMIO_SD_CLKCTL);
> + }
>  }
> 
>  static int renesas_sdhi_hs400(struct udevice *dev)
> @@ -629,7 +635,7 @@ int renesas_sdhi_execute_tuning(struct udevice *dev, uint 
> opcode)
>  out:
>   if (ret < 0) {
>   dev_warn(dev, "Tuning procedure failed\n");
> - renesas_sdhi_reset_tuning(priv);
> + renesas_sdhi_reset_tuning(priv, true);
>   }
> 
>   return ret;
> @@ -668,7 +674,7 @@ static int renesas_sdhi_set_ios(struct udevice *dev)
>   (mmc->selected_mode != UHS_SDR104) &&
>   (mmc->selected_mode != MMC_HS_200) &&
>   (mmc->selected_mode != MMC_HS_400)) {
> - renesas_sdhi_reset_tuning(priv);
> + renesas_sdhi_reset_tuning(priv, mmc->clk_disable);
>   }
>  #endif
> 
> @@ -1095,7 +1101,7 @@ static int renesas_sdhi_probe(struct udevice *dev)
>  CONFIG_IS_ENABLED(MMC_HS200_SUPPORT) || \
>  CONFIG_IS_ENABLED(MMC_HS400_SUPPORT)
>   if (priv->caps & TMIO_SD_CAP_RCAR_UHS)
> - renesas_sdhi_reset_tuning(priv);
> + renesas_sdhi_reset_tuning(priv, true);
>  #endif
>   return 0;
> 
> --
> 2.42.0




Re: [PATCH v3 09/12] x86: Enable SSE in 64-bit mode

2023-11-06 Thread Bin Meng
+ Tom,

Hi Simon,

On Mon, Nov 6, 2023 at 12:29 AM Simon Glass  wrote:
>
> Hi Bin,
>
> On Sun, 5 Nov 2023 at 14:05, Bin Meng  wrote:
> >
> > Hi Simon,
> >
> > On Mon, Oct 2, 2023 at 9:15 AM Simon Glass  wrote:
> > >
> > > This is needed to support Truetype fonts. In any case, the compiler
> > > expects SSE to be available in 64-bit mode. Enable it.
> > >
> > > Signed-off-by: Simon Glass 
> > > Suggested-by: Bin Meng 
> > > ---
> > >
> > > (no changes since v1)
> > >
> > >  arch/x86/config.mk|  1 -
> > >  arch/x86/cpu/x86_64/cpu.c | 11 +++
> > >  2 files changed, 11 insertions(+), 1 deletion(-)
> > >
> >
> > I didn't suggest we enable SSE for x86. This is the wrong approach.
> >
> > We should rewrite the Truetype support codes to avoid using float/double 
> > types.
> >
> > This way the Truetype codes can be used on any other architectures
> > without the need for the compiler to emit explicit floating
> > instructions.
>
> I am not aware of any such library. At present, enabling truetype on
> coreboot64 causes a hang.
>

If that's the case, we will have to either:

- Switch all U-Boot builds' to use software float (e.g. -msoft-float)
which unfortunately depends on the compiler runtime intrinsics.
- Introduce a Kconfig option for hard float enabling and let each
architecture to decide whether it implements it or not, and update
Truetype to depend on the hard float.

Regards,
Bin


Re: [PATCH] fs/squashfs: enable LZ4 compression support

2023-11-06 Thread João Marcos Costa
Hello, David

Thanks for this contribution!

Em seg., 6 de nov. de 2023 às 11:15, David Oberhollenzer <
goli...@infraroot.at> escreveu:

> The structure is identical to the existing compressor implementations,
> trivially adding lz4 decompression to sqfs_decompress.
>
> The changes were tested using a sandbox build. An LZ4 compressed
> squashfs image was bound as a host block device.
>
> Signed-off-by: David Oberhollenzer 
> ---
>
[...]

Reviewed-by: Joao Marcos Costa 

-- 
Atenciosamente,
João Marcos Costa

www.linkedin.com/in/jmarcoscosta/
https://github.com/jmarcoscosta


[PATCH v1] stm32mp1: read auth stats and boot_partition from tamp

2023-11-06 Thread Igor Opaniuk
Obtain from TAMP backup register information about image authorization
status and partition id used for booting. Store this info in
environmental variables ("boot_auth" and "boot_part" correspondingly).

Image authorization supported values:
0x0 - No authentication done
0x1 - Authentication done and failed
0x2 - Authentication done and succeeded

These values are stored to TAMP backup register by Trusted Firmware-A [1].

Testing:
STM32MP> print boot_part
boot_part=1
STM32MP> print boot_auth
boot_auth=2

[1] 
https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/commit/?h=refs/heads/integration&id=ab2b325c1ab895e626d4e11a9f26b9e7c968f8d8

Signed-off-by: Igor Opaniuk 
Co-developed-by: Oleksandr Suvorov 
Signed-off-by: Oleksandr Suvorov 

---

 arch/arm/mach-stm32mp/cpu.c   | 23 +++
 arch/arm/mach-stm32mp/include/mach/stm32.h|  4 
 .../arm/mach-stm32mp/include/mach/sys_proto.h |  3 +++
 3 files changed, 30 insertions(+)

diff --git a/arch/arm/mach-stm32mp/cpu.c b/arch/arm/mach-stm32mp/cpu.c
index e07abbe21c1..ba5942848bd 100644
--- a/arch/arm/mach-stm32mp/cpu.c
+++ b/arch/arm/mach-stm32mp/cpu.c
@@ -40,6 +40,13 @@ u32 get_bootmode(void)
TAMP_BOOT_MODE_SHIFT;
 }
 
+u32 get_bootauth(void)
+{
+   /* read boot auth status and partition from TAMP backup register */
+   return (readl(TAMP_BOOT_CONTEXT) & TAMP_BOOT_AUTH_MASK) >>
+   TAMP_BOOT_AUTH_SHIFT;
+}
+
 /*
  * weak function overidde: set the DDR/SYSRAM executable before to enable the
  * MMU and configure DACR, for early early_enable_caches (SPL or pre-reloc)
@@ -371,8 +378,24 @@ __weak void stm32mp_misc_init(void)
 {
 }
 
+static int setup_boot_auth_info(void)
+{
+   char buf[10];
+   u32 bootauth = get_bootauth();
+
+   snprintf(buf, sizeof(buf), "%d", bootauth >> 4);
+   env_set("boot_auth", buf);
+
+   snprintf(buf, sizeof(buf), "%d", bootauth &
+(u32)TAMP_BOOT_PARTITION_MASK);
+   env_set("boot_part", buf);
+
+   return 0;
+}
+
 int arch_misc_init(void)
 {
+   setup_boot_auth_info();
setup_boot_mode();
setup_mac_address();
setup_serial_number();
diff --git a/arch/arm/mach-stm32mp/include/mach/stm32.h 
b/arch/arm/mach-stm32mp/include/mach/stm32.h
index 1cdc5e3b186..ac0deced67e 100644
--- a/arch/arm/mach-stm32mp/include/mach/stm32.h
+++ b/arch/arm/mach-stm32mp/include/mach/stm32.h
@@ -139,8 +139,12 @@ enum boot_device {
 
 #define TAMP_BOOT_MODE_MASKGENMASK(15, 8)
 #define TAMP_BOOT_MODE_SHIFT   8
+#define TAMP_BOOT_AUTH_MASKGENMASK(23, 16)
+#define TAMP_BOOT_AUTH_SHIFT   16
 #define TAMP_BOOT_DEVICE_MASK  GENMASK(7, 4)
 #define TAMP_BOOT_INSTANCE_MASKGENMASK(3, 0)
+#define TAMP_BOOT_AUTH_ST_MASK GENMASK(7, 4)
+#define TAMP_BOOT_PARTITION_MASK   GENMASK(3, 0)
 #define TAMP_BOOT_FORCED_MASK  GENMASK(7, 0)
 
 enum forced_boot_mode {
diff --git a/arch/arm/mach-stm32mp/include/mach/sys_proto.h 
b/arch/arm/mach-stm32mp/include/mach/sys_proto.h
index 83fb32a45fc..52aca1e23e1 100644
--- a/arch/arm/mach-stm32mp/include/mach/sys_proto.h
+++ b/arch/arm/mach-stm32mp/include/mach/sys_proto.h
@@ -66,6 +66,9 @@ void get_soc_name(char name[SOC_NAME_SIZE]);
 /* return boot mode */
 u32 get_bootmode(void);
 
+/* return auth status and partition */
+u32 get_bootauth(void);
+
 int get_eth_nb(void);
 int setup_mac_address(void);
 
-- 
2.34.1



Re: [PATCH v9 7/9] efi_loader: support boot from URI device path

2023-11-06 Thread Masahisa Kojima
Hi Ilias,

On Thu, 2 Nov 2023 at 20:03, Ilias Apalodimas
 wrote:
>
> Hi Kojima-san
>
>
> > +
> > +/**
> > + * try_load_default_file() - try to load the default file
> > + *
> > + * Search the device having EFI_SIMPLE_FILE_SYSTEM_PROTOCOL,
> > + * then try to load with the default boot file(e.g. EFI/BOOT/BOOTAA64.EFI).
> > + *
> > + * @devpointer to the UCLASS_BLK or 
> > UCLASS_PARTITION udevice
> > + * @image_handle:  pointer to handle for newly installed image
> > + * Return: status code
> > + */
> > +static efi_status_t try_load_default_file(struct udevice *dev,
> > + efi_handle_t *image_handle)
> > +{
> > +   efi_status_t ret;
> > +   efi_handle_t handle;
> > +   struct efi_handler *handler;
> > +   struct efi_device_path *file_path;
> > +   struct efi_device_path *device_path;
> > +
> > +   if (dev_tag_get_ptr(dev, DM_TAG_EFI, (void **)&handle)) {
> > +   log_warning("DM_TAG_EFI not found\n");
> > +   return EFI_INVALID_PARAMETER;
> > +   }
> > +
> > +   ret = efi_search_protocol(handle,
> > + &efi_simple_file_system_protocol_guid, 
> > &handler);
> > +   if (ret != EFI_SUCCESS)
> > +   return ret;
> > +
> > +   ret = EFI_CALL(bs->open_protocol(handle, &efi_guid_device_path,
> > +(void **)&device_path, efi_root, 
> > NULL,
> > +EFI_OPEN_PROTOCOL_GET_PROTOCOL));
> > +   if (ret != EFI_SUCCESS)
> > +   return ret;
> > +
> > +   file_path = expand_media_path(device_path);
> > +   ret = EFI_CALL(efi_load_image(true, efi_root, file_path, NULL, 0,
> > + image_handle));
> > +   efi_free_pool(file_path);
> > +
> > +   return ret;
> > +}
> > +
> > +/**
> > + * load_default_file_from_blk_dev() - load the default file
> > + *
> > + * @blkpointer to the UCLASS_BLK udevice
> > + * @handle:pointer to handle for newly installed image
> > + * Return: status code
> > + */
> > +static efi_status_t load_default_file_from_blk_dev(struct udevice *blk,
> > +  efi_handle_t *handle)
> > +{
> > +   efi_status_t ret;
> > +   struct udevice *partition;
> > +
> > +   /* image that has no partition table but a file system */
> > +   ret = try_load_default_file(blk, handle);
> > +   if (ret == EFI_SUCCESS)
> > +   return ret;
> > +
> > +   /* try the partitions */
> > +   device_foreach_child(partition, blk) {
> > +   enum uclass_id id;
> > +
> > +   id = device_get_uclass_id(partition);
> > +   if (id != UCLASS_PARTITION)
> > +   continue;
> > +
> > +   ret = try_load_default_file(partition, handle);
> > +   if (ret == EFI_SUCCESS)
> > +   return ret;
> > +   }
> > +
> > +   return EFI_NOT_FOUND;
> > +}
> > +
> > +/**
> > + * efi_bootmgr_release_ramdisk() - release ramdisk resource
> > + *
> > + * Return: status code
> > + */
> > +efi_status_t efi_bootmgr_release_ramdisk(void)
> > +{
> > +   efi_status_t ret = EFI_SUCCESS;
> > +
> > +   if (ramdisk_blk_dev) {
> > +   ret = efi_add_memory_map(image_addr, image_size,
> > +EFI_CONVENTIONAL_MEMORY);
> > +   if (ret != EFI_SUCCESS)
> > +   log_err("Reclaiming memory failed\n");
> > +
> > +   if (blkmap_destroy(ramdisk_blk_dev->parent)) {
> > +   log_err("Destroying blkmap failed\n");
> > +   ret = EFI_DEVICE_ERROR;
> > +   }
> > +
> > +   ramdisk_blk_dev = NULL;
> > +   }
> > +
> > +   return ret;
> > +}
> > +
> > +/**
> > + * efi_bootmgr_image_return_notify() - return to efibootmgr callback
> > + *
> > + * @event: the event for which this notification function is registered
> > + * @context:   event context - not used in this function
> > + */
> > +static void EFIAPI efi_bootmgr_image_return_notify(struct efi_event *event,
> > +  void *context)
> > +{
> > +   efi_status_t ret;
> > +
> > +   EFI_ENTRY("%p, %p", event, context);
> > +   ret = efi_bootmgr_release_ramdisk();
> > +   EFI_EXIT(ret);
> > +}
> > +
> > +/**
> > + * try_load_from_uri_path() - Handle the URI device path
> > + *
> > + * @uridp: uri device path
> > + * @lo_label:  label of load option
> > + * @handle:pointer to handle for newly installed image
> > + * Return: status code
> > + */
> > +static efi_status_t try_load_from_uri_path(struct efi_device_path_uri 
> > *uridp,
> > +  u16 *lo_label,
> > +  efi_handle_t *handle)
> > +{
> >

[PATCH v10 0/9] Add EFI HTTP boot support

2023-11-06 Thread Masahisa Kojima
This series adds the EFI HTTP boot support.
User can add the URI device path with "efidebug boot add" command.
efibootmgr handles the URI device path, download the
specified file using wget, mount the downloaded image with
blkmap, then boot with the default file(e.g. EFI/BOOT/BOOTAA64.EFI)
by selecting automatically created boot option when the new disk is
detected.

This version still does not include the test.

To enable EFI HTTP boot, we need to enable the following Kconfig options.
 CONFIG_CMD_DNS
 CONFIG_CMD_WGET
 CONFIG_BLKMAP
 CONFIG_EFI_HTTP_BOOT

On the Socionext Developerbox, enter the following commands then
debian installer is downloaded into "loadaddr" and installer
automatically starts.
 => dhcp
 => setenv serverip 192.168.1.1
 => efidebug boot add -u 3 debian-netinst 
http://ftp.riken.jp/Linux/debian/debian-cd/12.1.0/arm64/iso-cd/debian-12.1.0-arm64-netinst.iso
 => efidebug boot order 3
 => bootefi bootmgr

Note that this debian installer can not proceed the installation
bacause RAM disk of installer image is not recogniged by the kernel.
I'm still investigating this issue, but drivers/nvdimm/of_pmem.c in linux
will be one of the solution to recognize RAM disk from kernel.
(In EDK2, the equivalent solution is called ACPI NFIT.)

On QEMU, I can not make DNS work from the QEMU guest.
The following commands work on qemu_arm64(manually set the http server ip in 
URI).
  => dhcp
  => setenv gatewayip 10.0.2.2
  => setenv httpserverip 134.160.38.1
  => efidebug boot add -u 3 debian-netinst 
http://134.160.38.1/Linux/debian/debian-cd/12.1.0/arm64/iso-cd/debian-12.1.0-arm64-netinst.iso
  => efidebug boot order 3
  => bootefi bootmgr

[TODO]
- add test
- stricter wget uri check
- omit the dns process if the given uri has ip address
   -> this will be supported when the lwip migration completes
- uri device path support in eficonfig
- expose ramdisk to OS

[change log]
v9 -> v10
- fix failure in erofs python test
- refactor try_load_from_uri_path(), call efi_load_image() in single location
- missing free of file_path for EFI application
- fix blkmap_create_ramdisk() size type from int to ulong

v8 -> v9
- implement new EFI event to notify that loaded image returns
  and back to the efibootmgr
- ramdisk cleanup is done in event callback
- refactor error handling

v7 -> v8
- search the default file on the fly, instead of creating
  the boot option with default file
- delete blkmap and reserved memory in case of error or
  when the EFI application returns
- update the subject "Boot var automatic management for removable medias"
  since this automatic boot option management is also applied
  for non-removable medias
- update error handling in efidebug command
- call efi_add_memory_map() instead of exposing efi_reserve_memory()

v6 -> v7
- rename the funtion name from load_default_file_boot_option()
  to load_mounted_image()
- move some fix from patch #5 "efi_loader: support boot from URI device path" to
  patch #4 "efi_loader: create default file boot option".
- fix missing free() of default_file_path

v5 -> v6
- add patch #4 "Boot var automatic management for removable medias"
- boot from automatically created boot option
  rather than searching default file on the fly
- introduce new CONFIG_EFI_HTTP_BOOT Kconfig option
- comment in one place
- use log_err() rather than printf()
- use env_get_hex("filesize", 0) instead of return value of net_loop()
- use more suitable error code
- blkmap can be build for SPL/TPL
- add CDROM short-form device path support

v4 -> v5
- add missing else statement
- add NULL check of efi_dp_find_obj() call
- update document to remove "limitation"

v3 -> v4
- patch#8 is added to simplify the bootmgr default boot process
- add function comments

v2 -> v3
- Patch#6 is added, reserve the whole ramdisk memory region
- remove .efi file extension check for PE-COFF image
- use "if IS_ENABLED(..)" as much as possible
- 1024 should be sizeof(net_boot_file_name)
- call net_set_state(NETLOOP_FAIL) when wget encounters error
- describe DNS ip address host name limitation in document

v1 -> v2
- carve out the network handling(wget and dns code) under net/wget.c
- carve out ramdisk creation code under drivers/block/blkmap_helper.c
- wget supports the valid range check to store the received blocks using lmb
- support when the downloaded image have no partiton table but a file system
- not start the .efi file in try_load_entry()
- call efi_check_pe() for .efi file to check the file is PE-COFF image
- add documentation for EFI HTTP Boot

Masahisa Kojima (8):
  net: wget: prevent overwriting reserved memory
  net: wget: add wget with dns utility function
  blk: blkmap: add ramdisk creation utility function
  efi_loader: add missing const classifier for event service
  efi_loader: add return to efibootmgr event group
  efi_loader: support boot from URI device path
  cmd: efidebug: add uri device path
  doc: uefi: add HTTP Boot support

Raymond Mao (1):
  efi_loader: Boot var automatic management

[PATCH v10 1/9] net: wget: prevent overwriting reserved memory

2023-11-06 Thread Masahisa Kojima
This introduces the valid range check to store the received
blocks using lmb. The same logic is implemented in tftp.

Signed-off-by: Masahisa Kojima 
Acked-by: Ilias Apalodimas 
Reviewed-by: Simon Glass 
Reviewed-by: Ramon Fried 
---
 net/wget.c | 80 +-
 1 file changed, 73 insertions(+), 7 deletions(-)

diff --git a/net/wget.c b/net/wget.c
index 8bb4d72db1..6f97eb1d12 100644
--- a/net/wget.c
+++ b/net/wget.c
@@ -4,16 +4,20 @@
  * Copyright Duncan Hare  2017
  */
 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 
+DECLARE_GLOBAL_DATA_PTR;
+
 static const char bootfile1[] = "GET ";
 static const char bootfile3[] = " HTTP/1.0\r\n\r\n";
 static const char http_eom[] = "\r\n\r\n";
@@ -56,6 +60,29 @@ static unsigned int retry_tcp_ack_num;   /* TCP retry 
acknowledge number*/
 static unsigned int retry_tcp_seq_num; /* TCP retry sequence number */
 static int retry_len;  /* TCP retry length */
 
+static ulong wget_load_size;
+
+/**
+ * wget_init_max_size() - initialize maximum load size
+ *
+ * Return: 0 if success, -1 if fails
+ */
+static int wget_init_load_size(void)
+{
+   struct lmb lmb;
+   phys_size_t max_size;
+
+   lmb_init_and_reserve(&lmb, gd->bd, (void *)gd->fdt_blob);
+
+   max_size = lmb_get_free_size(&lmb, image_load_addr);
+   if (!max_size)
+   return -1;
+
+   wget_load_size = max_size;
+
+   return 0;
+}
+
 /**
  * store_block() - store block in memory
  * @src: source of data
@@ -64,10 +91,25 @@ static int retry_len;   /* TCP retry 
length */
  */
 static inline int store_block(uchar *src, unsigned int offset, unsigned int 
len)
 {
+   ulong store_addr = image_load_addr + offset;
ulong newsize = offset + len;
uchar *ptr;
 
-   ptr = map_sysmem(image_load_addr + offset, len);
+   if (IS_ENABLED(CONFIG_LMB)) {
+   ulong end_addr = image_load_addr + wget_load_size;
+
+   if (!end_addr)
+   end_addr = ULONG_MAX;
+
+   if (store_addr < image_load_addr ||
+   store_addr + len > end_addr) {
+   printf("\nwget error: ");
+   printf("trying to overwrite reserved memory...\n");
+   return -1;
+   }
+   }
+
+   ptr = map_sysmem(store_addr, len);
memcpy(ptr, src, len);
unmap_sysmem(ptr);
 
@@ -248,25 +290,39 @@ static void wget_connected(uchar *pkt, unsigned int 
tcp_seq_num,
 
net_boot_file_size = 0;
 
-   if (len > hlen)
-   store_block(pkt + hlen, 0, len - hlen);
+   if (len > hlen) {
+   if (store_block(pkt + hlen, 0, len - hlen) != 
0) {
+   wget_loop_state = NETLOOP_FAIL;
+   wget_fail("wget: store error\n", 
tcp_seq_num, tcp_ack_num, action);
+   net_set_state(NETLOOP_FAIL);
+   return;
+   }
+   }
 
debug_cond(DEBUG_WGET,
   "wget: Connected Pkt %p hlen %x\n",
   pkt, hlen);
 
for (i = 0; i < pkt_q_idx; i++) {
+   int err;
+
ptr1 = map_sysmem(
(phys_addr_t)(pkt_q[i].pkt),
pkt_q[i].len);
-   store_block(ptr1,
-   pkt_q[i].tcp_seq_num -
-   initial_data_seq_num,
-   pkt_q[i].len);
+   err = store_block(ptr1,
+ pkt_q[i].tcp_seq_num -
+ initial_data_seq_num,
+ pkt_q[i].len);
unmap_sysmem(ptr1);
debug_cond(DEBUG_WGET,
   "wget: Connctd pkt Q %p len %x\n",
   pkt_q[i].pkt, pkt_q[i].len);
+   if (err) {
+   wget_loop_state = NETLOOP_FAIL;
+   wget_fail("wget: store error\n", 
tcp_seq_num, tcp_ack_num, action);
+   net_set_state(NETLOOP_FAIL);
+   return;
+   }
}
}
}
@@ -338,6 +394,7 @@ static void wget_handler(uchar *pkt, u16 dport,
len) != 0) {
  

[PATCH v10 2/9] net: wget: add wget with dns utility function

2023-11-06 Thread Masahisa Kojima
Current wget takes the target uri in this format:
 ":"  e.g.) 192.168.1.1:/bar
The http server ip address must be resolved before
calling wget.

This commit adds the utility function runs wget with dhs.
User can call wget with the uri like "http://foo/bar";.

Signed-off-by: Masahisa Kojima 
Reviewed-by: Ilias Apalodimas 
Reviewed-by: Ramon Fried 
---
 include/net.h |  9 +
 net/wget.c| 54 +++
 2 files changed, 63 insertions(+)

diff --git a/include/net.h b/include/net.h
index e254df7d7f..57889d8b7a 100644
--- a/include/net.h
+++ b/include/net.h
@@ -926,4 +926,13 @@ void eth_set_enable_bootdevs(bool enable);
 static inline void eth_set_enable_bootdevs(bool enable) {}
 #endif
 
+/**
+ * wget_with_dns() - runs dns host IP address resulution before wget
+ *
+ * @dst_addr:  destination address to download the file
+ * @uri:   uri string of target file of wget
+ * Return: downloaded file size, negative if failed
+ */
+int wget_with_dns(ulong dst_addr, char *uri);
+
 #endif /* __NET_H__ */
diff --git a/net/wget.c b/net/wget.c
index 6f97eb1d12..2087146b37 100644
--- a/net/wget.c
+++ b/net/wget.c
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -512,3 +513,56 @@ void wget_start(void)
 
wget_send(TCP_SYN, 0, 0, 0);
 }
+
+#if (IS_ENABLED(CONFIG_CMD_DNS))
+int wget_with_dns(ulong dst_addr, char *uri)
+{
+   int ret;
+   char *s, *host_name, *file_name, *str_copy;
+
+   /*
+* Download file using wget.
+*
+* U-Boot wget takes the target uri in this format.
+*  ":"  e.g.) 192.168.1.1:/sample/test.iso
+* Need to resolve the http server ip address before starting wget.
+*/
+   str_copy = strdup(uri);
+   if (!str_copy)
+   return -ENOMEM;
+
+   s = str_copy + strlen("http://";);
+   host_name = strsep(&s, "/");
+   if (!s) {
+   log_err("Error: invalied uri, no file path\n");
+   ret = -EINVAL;
+   goto out;
+   }
+   file_name = s;
+
+   /* TODO: If the given uri has ip address for the http server, skip dns 
*/
+   net_dns_resolve = host_name;
+   net_dns_env_var = "httpserverip";
+   if (net_loop(DNS) < 0) {
+   log_err("Error: dns lookup of %s failed, check setup\n", 
net_dns_resolve);
+   ret = -EINVAL;
+   goto out;
+   }
+   s = env_get("httpserverip");
+   if (!s) {
+   ret = -EINVAL;
+   goto out;
+   }
+
+   strlcpy(net_boot_file_name, s, sizeof(net_boot_file_name));
+   strlcat(net_boot_file_name, ":/", sizeof(net_boot_file_name)); /* 
append '/' which is removed by strsep() */
+   strlcat(net_boot_file_name, file_name, sizeof(net_boot_file_name));
+   image_load_addr = dst_addr;
+   ret = net_loop(WGET);
+
+out:
+   free(str_copy);
+
+   return ret;
+}
+#endif
-- 
2.34.1



[PATCH v10 3/9] blk: blkmap: add ramdisk creation utility function

2023-11-06 Thread Masahisa Kojima
User needs to call several functions to create the ramdisk
with blkmap.
This adds the utility function to create blkmap device and
mount the ramdisk.

Signed-off-by: Masahisa Kojima 
Reviewed-by: Simon Glass 
Reviewed-by: Ilias Apalodimas 
---
 drivers/block/Makefile|  3 +-
 drivers/block/blkmap.c| 15 --
 drivers/block/blkmap_helper.c | 53 +++
 include/blkmap.h  | 29 +++
 4 files changed, 84 insertions(+), 16 deletions(-)
 create mode 100644 drivers/block/blkmap_helper.c

diff --git a/drivers/block/Makefile b/drivers/block/Makefile
index a161d145fd..ec0575d135 100644
--- a/drivers/block/Makefile
+++ b/drivers/block/Makefile
@@ -14,7 +14,8 @@ obj-$(CONFIG_IDE) += ide.o
 endif
 obj-$(CONFIG_SANDBOX) += sandbox.o host-uclass.o host_dev.o
 obj-$(CONFIG_$(SPL_TPL_)BLOCK_CACHE) += blkcache.o
-obj-$(CONFIG_BLKMAP) += blkmap.o
+obj-$(CONFIG_$(SPL_TPL_)BLKMAP) += blkmap.o
+obj-$(CONFIG_$(SPL_TPL_)BLKMAP) += blkmap_helper.o
 
 obj-$(CONFIG_EFI_MEDIA) += efi-media-uclass.o
 obj-$(CONFIG_EFI_MEDIA_SANDBOX) += sb_efi_media.o
diff --git a/drivers/block/blkmap.c b/drivers/block/blkmap.c
index 149a4cac3e..21201409ed 100644
--- a/drivers/block/blkmap.c
+++ b/drivers/block/blkmap.c
@@ -66,21 +66,6 @@ struct blkmap_slice {
void (*destroy)(struct blkmap *bm, struct blkmap_slice *bms);
 };
 
-/**
- * struct blkmap - Block map
- *
- * Data associated with a blkmap.
- *
- * @label: Human readable name of this blkmap
- * @blk: Underlying block device
- * @slices: List of slices associated with this blkmap
- */
-struct blkmap {
-   char *label;
-   struct udevice *blk;
-   struct list_head slices;
-};
-
 static bool blkmap_slice_contains(struct blkmap_slice *bms, lbaint_t blknr)
 {
return (blknr >= bms->blknr) && (blknr < (bms->blknr + bms->blkcnt));
diff --git a/drivers/block/blkmap_helper.c b/drivers/block/blkmap_helper.c
new file mode 100644
index 00..bfba14110d
--- /dev/null
+++ b/drivers/block/blkmap_helper.c
@@ -0,0 +1,53 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * blkmap helper function
+ *
+ * Copyright (c) 2023, Linaro Limited
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+int blkmap_create_ramdisk(const char *label, ulong image_addr, ulong 
image_size,
+ struct udevice **devp)
+{
+   int ret;
+   lbaint_t blknum;
+   struct blkmap *bm;
+   struct blk_desc *desc;
+   struct udevice *bm_dev;
+
+   ret = blkmap_create(label, &bm_dev);
+   if (ret) {
+   log_err("failed to create blkmap\n");
+   return ret;
+   }
+
+   bm = dev_get_plat(bm_dev);
+   desc = dev_get_uclass_plat(bm->blk);
+   blknum = image_size >> desc->log2blksz;
+   ret = blkmap_map_pmem(bm_dev, 0, blknum, image_addr);
+   if (ret) {
+   log_err("Unable to map %#llx at block %d : %d\n",
+   (unsigned long long)image_addr, 0, ret);
+   goto err;
+   }
+   log_info("Block %d+0x" LBAF " mapped to %#llx\n", 0, blknum,
+(unsigned long long)image_addr);
+
+   ret = device_probe(bm->blk);
+   if (ret)
+   goto err;
+
+   if (devp)
+   *devp = bm_dev;
+
+   return 0;
+
+err:
+   blkmap_destroy(bm_dev);
+
+   return ret;
+}
diff --git a/include/blkmap.h b/include/blkmap.h
index af54583c7d..30dc84a7da 100644
--- a/include/blkmap.h
+++ b/include/blkmap.h
@@ -7,6 +7,23 @@
 #ifndef _BLKMAP_H
 #define _BLKMAP_H
 
+#include 
+
+/**
+ * struct blkmap - Block map
+ *
+ * Data associated with a blkmap.
+ *
+ * @label: Human readable name of this blkmap
+ * @blk: Underlying block device
+ * @slices: List of slices associated with this blkmap
+ */
+struct blkmap {
+   char *label;
+   struct udevice *blk;
+   struct list_head slices;
+};
+
 /**
  * blkmap_map_linear() - Map region of other block device
  *
@@ -74,4 +91,16 @@ int blkmap_create(const char *label, struct udevice **devp);
  */
 int blkmap_destroy(struct udevice *dev);
 
+/**
+ * blkmap_create_ramdisk() - Create new ramdisk with blkmap
+ *
+ * @label: Label of the new blkmap
+ * @image_addr: Target memory start address of this mapping
+ * @image_size: Target memory size of this mapping
+ * @devp: Updated with the address of the created blkmap device
+ * Returns: 0 on success, negative error code on failure
+ */
+int blkmap_create_ramdisk(const char *label, ulong image_addr, ulong 
image_size,
+ struct udevice **devp);
+
 #endif /* _BLKMAP_H */
-- 
2.34.1



Re: [PATCH v10 0/9] Add EFI HTTP boot support

2023-11-06 Thread Masahisa Kojima
Sorry but I had trouble in send-email, let me re-send this series.

Regards,
Masahisa Kojima

On Mon, 6 Nov 2023 at 20:16, Masahisa Kojima  wrote:
>
> This series adds the EFI HTTP boot support.
> User can add the URI device path with "efidebug boot add" command.
> efibootmgr handles the URI device path, download the
> specified file using wget, mount the downloaded image with
> blkmap, then boot with the default file(e.g. EFI/BOOT/BOOTAA64.EFI)
> by selecting automatically created boot option when the new disk is
> detected.
>
> This version still does not include the test.
>
> To enable EFI HTTP boot, we need to enable the following Kconfig options.
>  CONFIG_CMD_DNS
>  CONFIG_CMD_WGET
>  CONFIG_BLKMAP
>  CONFIG_EFI_HTTP_BOOT
>
> On the Socionext Developerbox, enter the following commands then
> debian installer is downloaded into "loadaddr" and installer
> automatically starts.
>  => dhcp
>  => setenv serverip 192.168.1.1
>  => efidebug boot add -u 3 debian-netinst 
> http://ftp.riken.jp/Linux/debian/debian-cd/12.1.0/arm64/iso-cd/debian-12.1.0-arm64-netinst.iso
>  => efidebug boot order 3
>  => bootefi bootmgr
>
> Note that this debian installer can not proceed the installation
> bacause RAM disk of installer image is not recogniged by the kernel.
> I'm still investigating this issue, but drivers/nvdimm/of_pmem.c in linux
> will be one of the solution to recognize RAM disk from kernel.
> (In EDK2, the equivalent solution is called ACPI NFIT.)
>
> On QEMU, I can not make DNS work from the QEMU guest.
> The following commands work on qemu_arm64(manually set the http server ip in 
> URI).
>   => dhcp
>   => setenv gatewayip 10.0.2.2
>   => setenv httpserverip 134.160.38.1
>   => efidebug boot add -u 3 debian-netinst 
> http://134.160.38.1/Linux/debian/debian-cd/12.1.0/arm64/iso-cd/debian-12.1.0-arm64-netinst.iso
>   => efidebug boot order 3
>   => bootefi bootmgr
>
> [TODO]
> - add test
> - stricter wget uri check
> - omit the dns process if the given uri has ip address
>-> this will be supported when the lwip migration completes
> - uri device path support in eficonfig
> - expose ramdisk to OS
>
> [change log]
> v9 -> v10
> - fix failure in erofs python test
> - refactor try_load_from_uri_path(), call efi_load_image() in single location
> - missing free of file_path for EFI application
> - fix blkmap_create_ramdisk() size type from int to ulong
>
> v8 -> v9
> - implement new EFI event to notify that loaded image returns
>   and back to the efibootmgr
> - ramdisk cleanup is done in event callback
> - refactor error handling
>
> v7 -> v8
> - search the default file on the fly, instead of creating
>   the boot option with default file
> - delete blkmap and reserved memory in case of error or
>   when the EFI application returns
> - update the subject "Boot var automatic management for removable medias"
>   since this automatic boot option management is also applied
>   for non-removable medias
> - update error handling in efidebug command
> - call efi_add_memory_map() instead of exposing efi_reserve_memory()
>
> v6 -> v7
> - rename the funtion name from load_default_file_boot_option()
>   to load_mounted_image()
> - move some fix from patch #5 "efi_loader: support boot from URI device path" 
> to
>   patch #4 "efi_loader: create default file boot option".
> - fix missing free() of default_file_path
>
> v5 -> v6
> - add patch #4 "Boot var automatic management for removable medias"
> - boot from automatically created boot option
>   rather than searching default file on the fly
> - introduce new CONFIG_EFI_HTTP_BOOT Kconfig option
> - comment in one place
> - use log_err() rather than printf()
> - use env_get_hex("filesize", 0) instead of return value of net_loop()
> - use more suitable error code
> - blkmap can be build for SPL/TPL
> - add CDROM short-form device path support
>
> v4 -> v5
> - add missing else statement
> - add NULL check of efi_dp_find_obj() call
> - update document to remove "limitation"
>
> v3 -> v4
> - patch#8 is added to simplify the bootmgr default boot process
> - add function comments
>
> v2 -> v3
> - Patch#6 is added, reserve the whole ramdisk memory region
> - remove .efi file extension check for PE-COFF image
> - use "if IS_ENABLED(..)" as much as possible
> - 1024 should be sizeof(net_boot_file_name)
> - call net_set_state(NETLOOP_FAIL) when wget encounters error
> - describe DNS ip address host name limitation in document
>
> v1 -> v2
> - carve out the network handling(wget and dns code) under net/wget.c
> - carve out ramdisk creation code under drivers/block/blkmap_helper.c
> - wget supports the valid range check to store the received blocks using lmb
> - support when the downloaded image have no partiton table but a file system
> - not start the .efi file in try_load_entry()
> - call efi_check_pe() for .efi file to check the file is PE-COFF image
> - add documentation for EFI HTTP Boot
>
> Masahisa Kojima (8):
>   net: wget: prevent overwriting reserved memory
>   net: wget:

[RESEND PATCH v10 1/9] net: wget: prevent overwriting reserved memory

2023-11-06 Thread Masahisa Kojima
This introduces the valid range check to store the received
blocks using lmb. The same logic is implemented in tftp.

Signed-off-by: Masahisa Kojima 
Acked-by: Ilias Apalodimas 
Reviewed-by: Simon Glass 
Reviewed-by: Ramon Fried 
---
 net/wget.c | 80 +-
 1 file changed, 73 insertions(+), 7 deletions(-)

diff --git a/net/wget.c b/net/wget.c
index 8bb4d72db1..6f97eb1d12 100644
--- a/net/wget.c
+++ b/net/wget.c
@@ -4,16 +4,20 @@
  * Copyright Duncan Hare  2017
  */
 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 
+DECLARE_GLOBAL_DATA_PTR;
+
 static const char bootfile1[] = "GET ";
 static const char bootfile3[] = " HTTP/1.0\r\n\r\n";
 static const char http_eom[] = "\r\n\r\n";
@@ -56,6 +60,29 @@ static unsigned int retry_tcp_ack_num;   /* TCP retry 
acknowledge number*/
 static unsigned int retry_tcp_seq_num; /* TCP retry sequence number */
 static int retry_len;  /* TCP retry length */
 
+static ulong wget_load_size;
+
+/**
+ * wget_init_max_size() - initialize maximum load size
+ *
+ * Return: 0 if success, -1 if fails
+ */
+static int wget_init_load_size(void)
+{
+   struct lmb lmb;
+   phys_size_t max_size;
+
+   lmb_init_and_reserve(&lmb, gd->bd, (void *)gd->fdt_blob);
+
+   max_size = lmb_get_free_size(&lmb, image_load_addr);
+   if (!max_size)
+   return -1;
+
+   wget_load_size = max_size;
+
+   return 0;
+}
+
 /**
  * store_block() - store block in memory
  * @src: source of data
@@ -64,10 +91,25 @@ static int retry_len;   /* TCP retry 
length */
  */
 static inline int store_block(uchar *src, unsigned int offset, unsigned int 
len)
 {
+   ulong store_addr = image_load_addr + offset;
ulong newsize = offset + len;
uchar *ptr;
 
-   ptr = map_sysmem(image_load_addr + offset, len);
+   if (IS_ENABLED(CONFIG_LMB)) {
+   ulong end_addr = image_load_addr + wget_load_size;
+
+   if (!end_addr)
+   end_addr = ULONG_MAX;
+
+   if (store_addr < image_load_addr ||
+   store_addr + len > end_addr) {
+   printf("\nwget error: ");
+   printf("trying to overwrite reserved memory...\n");
+   return -1;
+   }
+   }
+
+   ptr = map_sysmem(store_addr, len);
memcpy(ptr, src, len);
unmap_sysmem(ptr);
 
@@ -248,25 +290,39 @@ static void wget_connected(uchar *pkt, unsigned int 
tcp_seq_num,
 
net_boot_file_size = 0;
 
-   if (len > hlen)
-   store_block(pkt + hlen, 0, len - hlen);
+   if (len > hlen) {
+   if (store_block(pkt + hlen, 0, len - hlen) != 
0) {
+   wget_loop_state = NETLOOP_FAIL;
+   wget_fail("wget: store error\n", 
tcp_seq_num, tcp_ack_num, action);
+   net_set_state(NETLOOP_FAIL);
+   return;
+   }
+   }
 
debug_cond(DEBUG_WGET,
   "wget: Connected Pkt %p hlen %x\n",
   pkt, hlen);
 
for (i = 0; i < pkt_q_idx; i++) {
+   int err;
+
ptr1 = map_sysmem(
(phys_addr_t)(pkt_q[i].pkt),
pkt_q[i].len);
-   store_block(ptr1,
-   pkt_q[i].tcp_seq_num -
-   initial_data_seq_num,
-   pkt_q[i].len);
+   err = store_block(ptr1,
+ pkt_q[i].tcp_seq_num -
+ initial_data_seq_num,
+ pkt_q[i].len);
unmap_sysmem(ptr1);
debug_cond(DEBUG_WGET,
   "wget: Connctd pkt Q %p len %x\n",
   pkt_q[i].pkt, pkt_q[i].len);
+   if (err) {
+   wget_loop_state = NETLOOP_FAIL;
+   wget_fail("wget: store error\n", 
tcp_seq_num, tcp_ack_num, action);
+   net_set_state(NETLOOP_FAIL);
+   return;
+   }
}
}
}
@@ -338,6 +394,7 @@ static void wget_handler(uchar *pkt, u16 dport,
len) != 0) {
  

[RESEND PATCH v10 0/9] Add EFI HTTP boot support

2023-11-06 Thread Masahisa Kojima
This series adds the EFI HTTP boot support.
User can add the URI device path with "efidebug boot add" command.
efibootmgr handles the URI device path, download the
specified file using wget, mount the downloaded image with
blkmap, then boot with the default file(e.g. EFI/BOOT/BOOTAA64.EFI)
by selecting automatically created boot option when the new disk is
detected.

This version still does not include the test.

To enable EFI HTTP boot, we need to enable the following Kconfig options.
 CONFIG_CMD_DNS
 CONFIG_CMD_WGET
 CONFIG_BLKMAP
 CONFIG_EFI_HTTP_BOOT

On the Socionext Developerbox, enter the following commands then
debian installer is downloaded into "loadaddr" and installer
automatically starts.
 => dhcp
 => setenv serverip 192.168.1.1
 => efidebug boot add -u 3 debian-netinst 
http://ftp.riken.jp/Linux/debian/debian-cd/12.1.0/arm64/iso-cd/debian-12.1.0-arm64-netinst.iso
 => efidebug boot order 3
 => bootefi bootmgr

Note that this debian installer can not proceed the installation
bacause RAM disk of installer image is not recogniged by the kernel.
I'm still investigating this issue, but drivers/nvdimm/of_pmem.c in linux
will be one of the solution to recognize RAM disk from kernel.
(In EDK2, the equivalent solution is called ACPI NFIT.)

On QEMU, I can not make DNS work from the QEMU guest.
The following commands work on qemu_arm64(manually set the http server ip in 
URI).
  => dhcp
  => setenv gatewayip 10.0.2.2
  => setenv httpserverip 134.160.38.1
  => efidebug boot add -u 3 debian-netinst 
http://134.160.38.1/Linux/debian/debian-cd/12.1.0/arm64/iso-cd/debian-12.1.0-arm64-netinst.iso
  => efidebug boot order 3
  => bootefi bootmgr

[TODO]
- add test
- stricter wget uri check
- omit the dns process if the given uri has ip address
   -> this will be supported when the lwip migration completes
- uri device path support in eficonfig
- expose ramdisk to OS

[change log]
v9 -> v10
- fix failure in erofs python test
- refactor try_load_from_uri_path(), call efi_load_image() in single location
- missing free of file_path for EFI application
- fix blkmap_create_ramdisk() size type from int to ulong

v8 -> v9
- implement new EFI event to notify that loaded image returns
  and back to the efibootmgr
- ramdisk cleanup is done in event callback
- refactor error handling

v7 -> v8
- search the default file on the fly, instead of creating
  the boot option with default file
- delete blkmap and reserved memory in case of error or
  when the EFI application returns
- update the subject "Boot var automatic management for removable medias"
  since this automatic boot option management is also applied
  for non-removable medias
- update error handling in efidebug command
- call efi_add_memory_map() instead of exposing efi_reserve_memory()

v6 -> v7
- rename the funtion name from load_default_file_boot_option()
  to load_mounted_image()
- move some fix from patch #5 "efi_loader: support boot from URI device path" to
  patch #4 "efi_loader: create default file boot option".
- fix missing free() of default_file_path

v5 -> v6
- add patch #4 "Boot var automatic management for removable medias"
- boot from automatically created boot option
  rather than searching default file on the fly
- introduce new CONFIG_EFI_HTTP_BOOT Kconfig option
- comment in one place
- use log_err() rather than printf()
- use env_get_hex("filesize", 0) instead of return value of net_loop()
- use more suitable error code
- blkmap can be build for SPL/TPL
- add CDROM short-form device path support

v4 -> v5
- add missing else statement
- add NULL check of efi_dp_find_obj() call
- update document to remove "limitation"

v3 -> v4
- patch#8 is added to simplify the bootmgr default boot process
- add function comments

v2 -> v3
- Patch#6 is added, reserve the whole ramdisk memory region
- remove .efi file extension check for PE-COFF image
- use "if IS_ENABLED(..)" as much as possible
- 1024 should be sizeof(net_boot_file_name)
- call net_set_state(NETLOOP_FAIL) when wget encounters error
- describe DNS ip address host name limitation in document

v1 -> v2
- carve out the network handling(wget and dns code) under net/wget.c
- carve out ramdisk creation code under drivers/block/blkmap_helper.c
- wget supports the valid range check to store the received blocks using lmb
- support when the downloaded image have no partiton table but a file system
- not start the .efi file in try_load_entry()
- call efi_check_pe() for .efi file to check the file is PE-COFF image
- add documentation for EFI HTTP Boot

Masahisa Kojima (8):
  net: wget: prevent overwriting reserved memory
  net: wget: add wget with dns utility function
  blk: blkmap: add ramdisk creation utility function
  efi_loader: add missing const classifier for event service
  efi_loader: add return to efibootmgr event group
  efi_loader: support boot from URI device path
  cmd: efidebug: add uri device path
  doc: uefi: add HTTP Boot support

Raymond Mao (1):
  efi_loader: Boot var automatic management

[RESEND PATCH v10 2/9] net: wget: add wget with dns utility function

2023-11-06 Thread Masahisa Kojima
Current wget takes the target uri in this format:
 ":"  e.g.) 192.168.1.1:/bar
The http server ip address must be resolved before
calling wget.

This commit adds the utility function runs wget with dhs.
User can call wget with the uri like "http://foo/bar";.

Signed-off-by: Masahisa Kojima 
Reviewed-by: Ilias Apalodimas 
Reviewed-by: Ramon Fried 
---
 include/net.h |  9 +
 net/wget.c| 54 +++
 2 files changed, 63 insertions(+)

diff --git a/include/net.h b/include/net.h
index e254df7d7f..57889d8b7a 100644
--- a/include/net.h
+++ b/include/net.h
@@ -926,4 +926,13 @@ void eth_set_enable_bootdevs(bool enable);
 static inline void eth_set_enable_bootdevs(bool enable) {}
 #endif
 
+/**
+ * wget_with_dns() - runs dns host IP address resulution before wget
+ *
+ * @dst_addr:  destination address to download the file
+ * @uri:   uri string of target file of wget
+ * Return: downloaded file size, negative if failed
+ */
+int wget_with_dns(ulong dst_addr, char *uri);
+
 #endif /* __NET_H__ */
diff --git a/net/wget.c b/net/wget.c
index 6f97eb1d12..2087146b37 100644
--- a/net/wget.c
+++ b/net/wget.c
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -512,3 +513,56 @@ void wget_start(void)
 
wget_send(TCP_SYN, 0, 0, 0);
 }
+
+#if (IS_ENABLED(CONFIG_CMD_DNS))
+int wget_with_dns(ulong dst_addr, char *uri)
+{
+   int ret;
+   char *s, *host_name, *file_name, *str_copy;
+
+   /*
+* Download file using wget.
+*
+* U-Boot wget takes the target uri in this format.
+*  ":"  e.g.) 192.168.1.1:/sample/test.iso
+* Need to resolve the http server ip address before starting wget.
+*/
+   str_copy = strdup(uri);
+   if (!str_copy)
+   return -ENOMEM;
+
+   s = str_copy + strlen("http://";);
+   host_name = strsep(&s, "/");
+   if (!s) {
+   log_err("Error: invalied uri, no file path\n");
+   ret = -EINVAL;
+   goto out;
+   }
+   file_name = s;
+
+   /* TODO: If the given uri has ip address for the http server, skip dns 
*/
+   net_dns_resolve = host_name;
+   net_dns_env_var = "httpserverip";
+   if (net_loop(DNS) < 0) {
+   log_err("Error: dns lookup of %s failed, check setup\n", 
net_dns_resolve);
+   ret = -EINVAL;
+   goto out;
+   }
+   s = env_get("httpserverip");
+   if (!s) {
+   ret = -EINVAL;
+   goto out;
+   }
+
+   strlcpy(net_boot_file_name, s, sizeof(net_boot_file_name));
+   strlcat(net_boot_file_name, ":/", sizeof(net_boot_file_name)); /* 
append '/' which is removed by strsep() */
+   strlcat(net_boot_file_name, file_name, sizeof(net_boot_file_name));
+   image_load_addr = dst_addr;
+   ret = net_loop(WGET);
+
+out:
+   free(str_copy);
+
+   return ret;
+}
+#endif
-- 
2.34.1



[RESEND PATCH v10 3/9] blk: blkmap: add ramdisk creation utility function

2023-11-06 Thread Masahisa Kojima
User needs to call several functions to create the ramdisk
with blkmap.
This adds the utility function to create blkmap device and
mount the ramdisk.

Signed-off-by: Masahisa Kojima 
Reviewed-by: Simon Glass 
Reviewed-by: Ilias Apalodimas 
---
 drivers/block/Makefile|  3 +-
 drivers/block/blkmap.c| 15 --
 drivers/block/blkmap_helper.c | 53 +++
 include/blkmap.h  | 29 +++
 4 files changed, 84 insertions(+), 16 deletions(-)
 create mode 100644 drivers/block/blkmap_helper.c

diff --git a/drivers/block/Makefile b/drivers/block/Makefile
index a161d145fd..ec0575d135 100644
--- a/drivers/block/Makefile
+++ b/drivers/block/Makefile
@@ -14,7 +14,8 @@ obj-$(CONFIG_IDE) += ide.o
 endif
 obj-$(CONFIG_SANDBOX) += sandbox.o host-uclass.o host_dev.o
 obj-$(CONFIG_$(SPL_TPL_)BLOCK_CACHE) += blkcache.o
-obj-$(CONFIG_BLKMAP) += blkmap.o
+obj-$(CONFIG_$(SPL_TPL_)BLKMAP) += blkmap.o
+obj-$(CONFIG_$(SPL_TPL_)BLKMAP) += blkmap_helper.o
 
 obj-$(CONFIG_EFI_MEDIA) += efi-media-uclass.o
 obj-$(CONFIG_EFI_MEDIA_SANDBOX) += sb_efi_media.o
diff --git a/drivers/block/blkmap.c b/drivers/block/blkmap.c
index 149a4cac3e..21201409ed 100644
--- a/drivers/block/blkmap.c
+++ b/drivers/block/blkmap.c
@@ -66,21 +66,6 @@ struct blkmap_slice {
void (*destroy)(struct blkmap *bm, struct blkmap_slice *bms);
 };
 
-/**
- * struct blkmap - Block map
- *
- * Data associated with a blkmap.
- *
- * @label: Human readable name of this blkmap
- * @blk: Underlying block device
- * @slices: List of slices associated with this blkmap
- */
-struct blkmap {
-   char *label;
-   struct udevice *blk;
-   struct list_head slices;
-};
-
 static bool blkmap_slice_contains(struct blkmap_slice *bms, lbaint_t blknr)
 {
return (blknr >= bms->blknr) && (blknr < (bms->blknr + bms->blkcnt));
diff --git a/drivers/block/blkmap_helper.c b/drivers/block/blkmap_helper.c
new file mode 100644
index 00..bfba14110d
--- /dev/null
+++ b/drivers/block/blkmap_helper.c
@@ -0,0 +1,53 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * blkmap helper function
+ *
+ * Copyright (c) 2023, Linaro Limited
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+int blkmap_create_ramdisk(const char *label, ulong image_addr, ulong 
image_size,
+ struct udevice **devp)
+{
+   int ret;
+   lbaint_t blknum;
+   struct blkmap *bm;
+   struct blk_desc *desc;
+   struct udevice *bm_dev;
+
+   ret = blkmap_create(label, &bm_dev);
+   if (ret) {
+   log_err("failed to create blkmap\n");
+   return ret;
+   }
+
+   bm = dev_get_plat(bm_dev);
+   desc = dev_get_uclass_plat(bm->blk);
+   blknum = image_size >> desc->log2blksz;
+   ret = blkmap_map_pmem(bm_dev, 0, blknum, image_addr);
+   if (ret) {
+   log_err("Unable to map %#llx at block %d : %d\n",
+   (unsigned long long)image_addr, 0, ret);
+   goto err;
+   }
+   log_info("Block %d+0x" LBAF " mapped to %#llx\n", 0, blknum,
+(unsigned long long)image_addr);
+
+   ret = device_probe(bm->blk);
+   if (ret)
+   goto err;
+
+   if (devp)
+   *devp = bm_dev;
+
+   return 0;
+
+err:
+   blkmap_destroy(bm_dev);
+
+   return ret;
+}
diff --git a/include/blkmap.h b/include/blkmap.h
index af54583c7d..30dc84a7da 100644
--- a/include/blkmap.h
+++ b/include/blkmap.h
@@ -7,6 +7,23 @@
 #ifndef _BLKMAP_H
 #define _BLKMAP_H
 
+#include 
+
+/**
+ * struct blkmap - Block map
+ *
+ * Data associated with a blkmap.
+ *
+ * @label: Human readable name of this blkmap
+ * @blk: Underlying block device
+ * @slices: List of slices associated with this blkmap
+ */
+struct blkmap {
+   char *label;
+   struct udevice *blk;
+   struct list_head slices;
+};
+
 /**
  * blkmap_map_linear() - Map region of other block device
  *
@@ -74,4 +91,16 @@ int blkmap_create(const char *label, struct udevice **devp);
  */
 int blkmap_destroy(struct udevice *dev);
 
+/**
+ * blkmap_create_ramdisk() - Create new ramdisk with blkmap
+ *
+ * @label: Label of the new blkmap
+ * @image_addr: Target memory start address of this mapping
+ * @image_size: Target memory size of this mapping
+ * @devp: Updated with the address of the created blkmap device
+ * Returns: 0 on success, negative error code on failure
+ */
+int blkmap_create_ramdisk(const char *label, ulong image_addr, ulong 
image_size,
+ struct udevice **devp);
+
 #endif /* _BLKMAP_H */
-- 
2.34.1



[RESEND PATCH v10 4/9] efi_loader: Boot var automatic management

2023-11-06 Thread Masahisa Kojima
From: Raymond Mao 

Changes for complying to EFI spec §3.5.1.1
'Removable Media Boot Behavior'.
Boot variables can be automatically generated during a removable
media is probed. At the same time, unused boot variables will be
detected and removed.

Please note that currently the function 'efi_disk_remove' has no
ability to distinguish below two scenarios
a) Unplugging of a removable media under U-Boot
b) U-Boot exiting and booting an OS
Thus currently the boot variables management is not added into
'efi_disk_remove' to avoid boot options being added/erased
repeatedly under scenario b) during power cycles
See TODO comments under function 'efi_disk_remove' for more details

The original efi_secboot tests expect that BootOrder EFI variable
is not defined. With this commit, the BootOrder EFI variable is
automatically added when the disk is detected. The original
efi_secboot tests end up with unexpected failure.
The efi_secboot tests need to be modified to explicitly set
the BootOrder EFI variable.

squashfs and erofs ls tests are also affected by this modification,
need to clear the previous state before squashfs ls test starts.

Co-developed-by: Masahisa Kojima 
Signed-off-by: Masahisa Kojima 
Signed-off-by: Raymond Mao 
Reviewed-by: Heinrich Schuchardt 
Reviewed-by: Ilias Apalodimas 
Reviewed-by: Joao Marcos Costa 
---
 lib/efi_loader/efi_disk.c | 18 
 lib/efi_loader/efi_setup.c|  7 
 test/py/tests/test_efi_secboot/test_signed.py | 42 +--
 .../test_efi_secboot/test_signed_intca.py | 14 +++
 .../tests/test_efi_secboot/test_unsigned.py   | 14 +++
 test/py/tests/test_fs/test_erofs.py   |  9 
 .../test_fs/test_squashfs/test_sqfs_ls.py |  9 
 7 files changed, 78 insertions(+), 35 deletions(-)

diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
index f0d76113b0..b808a7fe62 100644
--- a/lib/efi_loader/efi_disk.c
+++ b/lib/efi_loader/efi_disk.c
@@ -690,6 +690,13 @@ int efi_disk_probe(void *ctx, struct event *event)
return -1;
}
 
+   /* only do the boot option management when UEFI sub-system is 
initialized */
+   if (IS_ENABLED(CONFIG_CMD_BOOTEFI_BOOTMGR) && efi_obj_list_initialized 
== EFI_SUCCESS) {
+   ret = efi_bootmgr_update_media_device_boot_option();
+   if (ret != EFI_SUCCESS)
+   return -1;
+   }
+
return 0;
 }
 
@@ -742,6 +749,17 @@ int efi_disk_remove(void *ctx, struct event *event)
dev_tag_del(dev, DM_TAG_EFI);
 
return 0;
+
+   /*
+* TODO A flag to distinguish below 2 different scenarios of this
+* function call is needed:
+* a) Unplugging of a removable media under U-Boot
+* b) U-Boot exiting and booting an OS
+* In case of scenario a), efi_bootmgr_update_media_device_boot_option()
+* needs to be invoked here to update the boot options and remove the
+* unnecessary ones.
+*/
+
 }
 
 /**
diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c
index ad719afd63..c02569cb6d 100644
--- a/lib/efi_loader/efi_setup.c
+++ b/lib/efi_loader/efi_setup.c
@@ -245,6 +245,13 @@ efi_status_t efi_init_obj_list(void)
if (ret != EFI_SUCCESS)
goto out;
 
+   if (IS_ENABLED(CONFIG_CMD_BOOTEFI_BOOTMGR)) {
+   /* update boot option after variable service initialized */
+   ret = efi_bootmgr_update_media_device_boot_option();
+   if (ret != EFI_SUCCESS)
+   goto out;
+   }
+
/* Define supported languages */
ret = efi_init_platform_lang();
if (ret != EFI_SUCCESS)
diff --git a/test/py/tests/test_efi_secboot/test_signed.py 
b/test/py/tests/test_efi_secboot/test_signed.py
index ca52e853d8..2f862a259a 100644
--- a/test/py/tests/test_efi_secboot/test_signed.py
+++ b/test/py/tests/test_efi_secboot/test_signed.py
@@ -29,7 +29,7 @@ class TestEfiSignedImage(object):
 output = u_boot_console.run_command_list([
 'host bind 0 %s' % disk_img,
 'efidebug boot add -b 1 HELLO1 host 0:1 /helloworld.efi.signed 
-s ""',
-'efidebug boot next 1',
+'efidebug boot order 1',
 'bootefi bootmgr'])
 assert 'Hello, world!' in ''.join(output)
 
@@ -37,7 +37,7 @@ class TestEfiSignedImage(object):
 # Test Case 1b, run unsigned image if no PK
 output = u_boot_console.run_command_list([
 'efidebug boot add -b 2 HELLO2 host 0:1 /helloworld.efi -s ""',
-'efidebug boot next 2',
+'efidebug boot order 2',
 'bootefi bootmgr'])
 assert 'Hello, world!' in ''.join(output)
 
@@ -59,13 +59,13 @@ class TestEfiSignedImage(object):
 assert 'Failed to set EFI variable' not in ''.join(output)
 output = u_boot_console.run_command_list([
  

[RESEND PATCH v10 5/9] efi_loader: add missing const classifier for event service

2023-11-06 Thread Masahisa Kojima
const classifier is missing in EventGroup parameter of
CreateEventEx(). Fix it to remove the compiler warning.

NotifyContext parameter of CreateEventEx() is also defined
with const in UEFI specification, but NotifyContext parameter
of CreateEvent() is defined without const.
Since current implementation calls the common efi_create_event()
function from both CreateEventEx() and CreateEvent() services,
NotifyContext parameter leaves as is.

Signed-off-by: Masahisa Kojima 
Reviewed-by: Ilias Apalodimas 
---
 include/efi_api.h | 2 +-
 include/efi_loader.h  | 2 +-
 lib/efi_loader/efi_boottime.c | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/efi_api.h b/include/efi_api.h
index 8f5ef5f680..c2d6964467 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -192,7 +192,7 @@ struct efi_boot_services {
struct efi_event *event,
void *context),
void *notify_context,
-   efi_guid_t *event_group,
+   const efi_guid_t *event_group,
struct efi_event **event);
 };
 
diff --git a/include/efi_loader.h b/include/efi_loader.h
index e24410505f..e164e6067d 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -685,7 +685,7 @@ efi_status_t efi_create_event(uint32_t type, efi_uintn_t 
notify_tpl,
  void (EFIAPI *notify_function) (
struct efi_event *event,
void *context),
- void *notify_context, efi_guid_t *group,
+ void *notify_context, const efi_guid_t *group,
  struct efi_event **event);
 /* Call this to set a timer */
 efi_status_t efi_set_timer(struct efi_event *event, enum efi_timer_delay type,
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 0b7579cb5a..f9b10a9763 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -712,7 +712,7 @@ efi_status_t efi_create_event(uint32_t type, efi_uintn_t 
notify_tpl,
  void (EFIAPI *notify_function) (
struct efi_event *event,
void *context),
- void *notify_context, efi_guid_t *group,
+ void *notify_context, const efi_guid_t *group,
  struct efi_event **event)
 {
struct efi_event *evt;
@@ -790,7 +790,7 @@ efi_status_t EFIAPI efi_create_event_ex(uint32_t type, 
efi_uintn_t notify_tpl,
struct efi_event *event,
void *context),
void *notify_context,
-   efi_guid_t *event_group,
+   const efi_guid_t *event_group,
struct efi_event **event)
 {
efi_status_t ret;
-- 
2.34.1



[RESEND PATCH v10 7/9] efi_loader: support boot from URI device path

2023-11-06 Thread Masahisa Kojima
This supports to boot from the URI device path.
When user selects the URI device path, bootmgr downloads
the file using wget into the address specified by loadaddr
env variable.
If the file is .iso or .img file, mount the image with blkmap
then try to boot with the default file(e.g. EFI/BOOT/BOOTAA64.EFI).
Since boot option indicating the default file is automatically
created when new disk is detected, system can boot by selecting
the automatically created blkmap boot option.
If the file is PE-COFF file, load and start the downloaded file.

The buffer used to download the ISO image file must be
reserved to avoid the unintended access to the image and
expose the ramdisk to the OS.
For PE-COFF file case, this memory reservation is done
in LoadImage Boot Service.

Signed-off-by: Masahisa Kojima 
---
 lib/efi_loader/Kconfig   |   9 +
 lib/efi_loader/efi_bootmgr.c | 337 +++
 2 files changed, 346 insertions(+)

diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index d20aaab6db..5d99206dc3 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -479,4 +479,13 @@ config EFI_RISCV_BOOT_PROTOCOL
  replace the transfer via the device-tree. The latter is not
  possible on systems using ACPI.
 
+config EFI_HTTP_BOOT
+   bool "EFI HTTP Boot support"
+   depends on CMD_DNS
+   depends on CMD_WGET
+   depends on BLKMAP
+   help
+ Enabling this option adds EFI HTTP Boot support. It allows to
+ directly boot from network.
+
 endif
diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c
index a40762c74c..e24c18215a 100644
--- a/lib/efi_loader/efi_bootmgr.c
+++ b/lib/efi_loader/efi_bootmgr.c
@@ -7,10 +7,14 @@
 
 #define LOG_CATEGORY LOGC_EFI
 
+#include 
+#include 
 #include 
 #include 
+#include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -19,6 +23,11 @@
 static const struct efi_boot_services *bs;
 static const struct efi_runtime_services *rs;
 
+static ulong image_size;
+static ulong image_addr;
+struct efi_device_path *loaded_dp;
+static struct udevice *ramdisk_blk_dev;
+
 const efi_guid_t efi_guid_bootmenu_auto_generated =
EFICONFIG_AUTO_GENERATED_ENTRY_GUID;
 
@@ -168,6 +177,327 @@ out:
return ret;
 }
 
+/**
+ * mount_image() - mount the image with blkmap
+ *
+ * @lo_label:  u16 label string of load option
+ * @addr:  image address
+ * @size:  image size
+ * Return: pointer to the UCLASS_BLK udevice, NULL if failed
+ */
+static struct udevice *mount_image(u16 *lo_label, ulong addr, ulong size)
+{
+   int err;
+   struct blkmap *bm;
+   struct udevice *bm_dev;
+   char *label = NULL, *p;
+
+   label = efi_alloc(utf16_utf8_strlen(lo_label) + 1);
+   if (!label)
+   return NULL;
+
+   p = label;
+   utf16_utf8_strcpy(&p, lo_label);
+   err = blkmap_create_ramdisk(label, addr, size, &bm_dev);
+   if (err) {
+   efi_free_pool(label);
+   return NULL;
+   }
+   bm = dev_get_plat(bm_dev);
+
+   efi_free_pool(label);
+
+   return bm->blk;
+}
+
+/**
+ * search_default_file() - search default file
+ *
+ * @dev:   pointer to the UCLASS_BLK or UCLASS_PARTITION udevice
+ * @dp:pointer to default file device path
+ * Return: status code
+ */
+static efi_status_t search_default_file(struct udevice *dev,
+   struct efi_device_path **dp)
+{
+   efi_status_t ret;
+   efi_handle_t handle;
+   u16 *default_file_name = NULL;
+   struct efi_file_handle *root, *f;
+   struct efi_device_path *full_path;
+   struct efi_device_path *device_path;
+   struct efi_device_path *file_path = NULL;
+   struct efi_simple_file_system_protocol *file_system;
+
+   if (dev_tag_get_ptr(dev, DM_TAG_EFI, (void **)&handle)) {
+   log_warning("DM_TAG_EFI not found\n");
+   return EFI_INVALID_PARAMETER;
+   }
+
+   ret = EFI_CALL(bs->open_protocol(handle, 
&efi_simple_file_system_protocol_guid,
+(void **)&file_system, efi_root, NULL,
+EFI_OPEN_PROTOCOL_GET_PROTOCOL));
+   if (ret != EFI_SUCCESS)
+   return ret;
+
+   ret = EFI_CALL(file_system->open_volume(file_system, &root));
+   if (ret != EFI_SUCCESS)
+   return ret;
+
+   file_path = efi_dp_from_file(NULL, "/EFI/BOOT/" BOOTEFI_NAME);
+   default_file_name = efi_dp_str(file_path);
+   if (!default_file_name) {
+   ret = EFI_OUT_OF_RESOURCES;
+   goto err;
+   }
+
+   ret = EFI_CALL(root->open(root, &f, default_file_name,
+ EFI_FILE_MODE_READ, 0));
+   efi_free_pool(default_file_name);
+   if (ret != EFI_SUCCESS)
+   goto err;
+
+   EFI_CALL(f->close(f));
+
+   ret = EFI_CALL(bs->open_protocol(

[RESEND PATCH v10 6/9] efi_loader: add return to efibootmgr event group

2023-11-06 Thread Masahisa Kojima
When the image loaded by efibootmgr returns, efibootmgr
needs to clean the resources. Adding the event of returning
to efibootmgr is useful to simplify the implementation.

Signed-off-by: Masahisa Kojima 
Reviewed-by: Ilias Apalodimas 
---
 cmd/bootefi.c | 12 
 include/efi_api.h |  3 +++
 include/efi_loader.h  |  2 ++
 lib/efi_loader/efi_boottime.c |  3 +++
 4 files changed, 20 insertions(+)

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 20e5c94a33..4d74969ad6 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -356,6 +356,7 @@ static efi_status_t do_bootefi_exec(efi_handle_t handle, 
void *load_options)
efi_status_t ret;
efi_uintn_t exit_data_size = 0;
u16 *exit_data = NULL;
+   struct efi_event *evt;
 
/* On ARM switch from EL3 or secure mode to EL2 or non-secure mode */
switch_to_non_secure_mode();
@@ -394,6 +395,17 @@ out:
log_err("Failed to remove loadfile2 for initrd\n");
}
 
+   /* Notify EFI_EVENT_GROUP_RETURN_TO_EFIBOOTMGR event group. */
+   list_for_each_entry(evt, &efi_events, link) {
+   if (evt->group &&
+   !guidcmp(evt->group,
+&efi_guid_event_group_return_to_efibootmgr)) {
+   efi_signal_event(evt);
+   EFI_CALL(systab.boottime->close_event(evt));
+   break;
+   }
+   }
+
/* Control is returned to U-Boot, disable EFI watchdog */
efi_set_watchdog(0);
 
diff --git a/include/efi_api.h b/include/efi_api.h
index c2d6964467..0e92cb8a7f 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -404,6 +404,9 @@ struct efi_runtime_services {
 #define EFI_EVENT_GROUP_RESET_SYSTEM \
EFI_GUID(0x62da6a56, 0x13fb, 0x485a, 0xa8, 0xda, \
 0xa3, 0xdd, 0x79, 0x12, 0xcb, 0x6b)
+#define EFI_EVENT_GROUP_RETURN_TO_EFIBOOTMGR \
+   EFI_GUID(0xb4a40fe6, 0x9149, 0x4f29, 0x94, 0x47, \
+0x49, 0x38, 0x7a, 0x7f, 0xab, 0x87)
 
 /* EFI Configuration Table and GUID definitions */
 #define NULL_GUID \
diff --git a/include/efi_loader.h b/include/efi_loader.h
index e164e6067d..31954e84c3 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -290,6 +290,8 @@ extern const efi_guid_t 
efi_guid_event_group_memory_map_change;
 extern const efi_guid_t efi_guid_event_group_ready_to_boot;
 /* event group ResetSystem() invoked (before ExitBootServices) */
 extern const efi_guid_t efi_guid_event_group_reset_system;
+/* event group return to efibootmgr */
+extern const efi_guid_t efi_guid_event_group_return_to_efibootmgr;
 /* GUID of the device tree table */
 extern const efi_guid_t efi_guid_fdt;
 extern const efi_guid_t efi_guid_loaded_image;
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index f9b10a9763..3767fa2db4 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -90,6 +90,9 @@ const efi_guid_t efi_guid_event_group_ready_to_boot =
 /* event group ResetSystem() invoked (before ExitBootServices) */
 const efi_guid_t efi_guid_event_group_reset_system =
EFI_EVENT_GROUP_RESET_SYSTEM;
+/* event group return to efibootmgr */
+const efi_guid_t efi_guid_event_group_return_to_efibootmgr =
+   EFI_EVENT_GROUP_RETURN_TO_EFIBOOTMGR;
 /* GUIDs of the Load File and Load File2 protocols */
 const efi_guid_t efi_guid_load_file_protocol = EFI_LOAD_FILE_PROTOCOL_GUID;
 const efi_guid_t efi_guid_load_file2_protocol = EFI_LOAD_FILE2_PROTOCOL_GUID;
-- 
2.34.1



[RESEND PATCH v10 8/9] cmd: efidebug: add uri device path

2023-11-06 Thread Masahisa Kojima
This adds the URI device path option for 'boot add' subcommand.
User can add the URI load option for downloading ISO image file
or EFI application through network. Currently HTTP is only supported.

Signed-off-by: Masahisa Kojima 
Acked-by: Ilias Apalodimas 
---
 cmd/efidebug.c | 51 
 include/net.h  |  8 ++
 net/wget.c | 71 ++
 3 files changed, 130 insertions(+)

diff --git a/cmd/efidebug.c b/cmd/efidebug.c
index 201531ac19..42b306e708 100644
--- a/cmd/efidebug.c
+++ b/cmd/efidebug.c
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -829,6 +830,53 @@ static int do_efi_boot_add(struct cmd_tbl *cmdtp, int flag,
argc -= 1;
argv += 1;
break;
+#if (IS_ENABLED(CONFIG_EFI_HTTP_BOOT))
+   case 'u':
+   {
+   char *pos;
+   int uridp_len;
+   struct efi_device_path_uri *uridp;
+
+   if (argc <  3 || lo.label) {
+   r = CMD_RET_USAGE;
+   goto out;
+   }
+
+   id = (int)hextoul(argv[1], &endp);
+   if (*endp != '\0' || id > 0x)
+   return CMD_RET_USAGE;
+
+   label = efi_convert_string(argv[2]);
+   if (!label)
+   return CMD_RET_FAILURE;
+
+   if (!wget_validate_uri(argv[3])) {
+   printf("ERROR: invalid URI\n");
+   r = CMD_RET_FAILURE;
+   goto out;
+   }
+
+   efi_create_indexed_name(var_name16, sizeof(var_name16),
+   "Boot", id);
+   lo.label = label;
+
+   uridp_len = sizeof(struct efi_device_path) + 
strlen(argv[3]) + 1;
+   fp_size += uridp_len + sizeof(END);
+   fp_free = efi_alloc(fp_size);
+   uridp = (struct efi_device_path_uri *)fp_free;
+   uridp->dp.type = DEVICE_PATH_TYPE_MESSAGING_DEVICE;
+   uridp->dp.sub_type = DEVICE_PATH_SUB_TYPE_MSG_URI;
+   uridp->dp.length = uridp_len;
+   strcpy(uridp->uri, argv[3]);
+   pos = (char *)uridp + uridp_len;
+   memcpy(pos, &END, sizeof(END));
+   file_path = (struct efi_device_path *)uridp;
+   argc -= 3;
+   argv += 3;
+   break;
+   }
+#endif
+
default:
r = CMD_RET_USAGE;
goto out;
@@ -1491,6 +1539,9 @@ U_BOOT_LONGHELP(efidebug,
"  -b|-B[:] \n"
"  -i|-I  [:] \n"
"  (-b, -i for short form device path)\n"
+#if (IS_ENABLED(CONFIG_EFI_HTTP_BOOT))
+   "  -u   \n"
+#endif
"  -s ''\n"
"efidebug boot rm  [ [ [...]]]\n"
"  - delete UEFI Boot variables\n"
diff --git a/include/net.h b/include/net.h
index 57889d8b7a..c748974573 100644
--- a/include/net.h
+++ b/include/net.h
@@ -935,4 +935,12 @@ static inline void eth_set_enable_bootdevs(bool enable) {}
  */
 int wget_with_dns(ulong dst_addr, char *uri);
 
+/**
+ * wget_validate_uri() - varidate the uri
+ *
+ * @uri:   uri string of target file of wget
+ * Return: true if uri is valid, false if uri is invalid
+ */
+bool wget_validate_uri(char *uri);
+
 #endif /* __NET_H__ */
diff --git a/net/wget.c b/net/wget.c
index 2087146b37..6ae2237a0a 100644
--- a/net/wget.c
+++ b/net/wget.c
@@ -566,3 +566,74 @@ out:
return ret;
 }
 #endif
+
+/**
+ * wget_validate_uri() - validate the uri for wget
+ *
+ * @uri:   uri string
+ *
+ * This function follows the current U-Boot wget implementation.
+ * scheme: only "http:" is supported
+ * authority:
+ *   - user information: not supported
+ *   - host: supported
+ *   - port: not supported(always use the default port)
+ *
+ * Uri is expected to be correctly percent encoded.
+ * This is the minimum check, control codes(0x1-0x19, 0x7F, except '\0')
+ * and space character(0x20) are not allowed.
+ *
+ * TODO: stricter uri conformance check
+ *
+ * Return: true on success, false on failure
+ */
+bool wget_validate_uri(char *uri)
+{
+   char c;
+   bool ret = true;
+   char *str_copy, *s, *authority;
+
+   for (c = 0x1; c < 0x21; c++) {
+   if (strchr(uri, c)) {
+   log_err("invalid character is used\n");
+   return false;
+   }
+   }
+   if (strchr(uri, 0x7f)) {
+   log_err("invalid character is used\n");
+   return false;
+ 

[RESEND PATCH v10 9/9] doc: uefi: add HTTP Boot support

2023-11-06 Thread Masahisa Kojima
This adds the description about HTTP Boot.

Signed-off-by: Masahisa Kojima 
Reviewed-by: Ilias Apalodimas 
---
 doc/develop/uefi/uefi.rst | 30 ++
 1 file changed, 30 insertions(+)

diff --git a/doc/develop/uefi/uefi.rst b/doc/develop/uefi/uefi.rst
index fb16ac743a..ca9a573669 100644
--- a/doc/develop/uefi/uefi.rst
+++ b/doc/develop/uefi/uefi.rst
@@ -642,6 +642,36 @@ UEFI variables. Booting according to these variables is 
possible via::
 As of U-Boot v2020.10 UEFI variables cannot be set at runtime. The U-Boot
 command 'efidebug' can be used to set the variables.
 
+UEFI HTTP Boot
+~~
+
+HTTP Boot provides the capability for system deployment and configuration
+over the network. HTTP Boot can be activated by specifying::
+
+CONFIG_CMD_DNS
+CONFIG_CMD_WGET
+CONFIG_BLKMAP
+
+Set up the load option specifying the target URI::
+
+efidebug boot add -u 1 netinst http://foo/bar
+
+When this load option is selected as boot selection, resolve the
+host ip address by dns, then download the file with wget.
+If the downloaded file extension is .iso or .img file, efibootmgr tries to
+mount the image and boot with the default file(e.g. EFI/BOOT/BOOTAA64.EFI).
+If the downloaded file is PE-COFF image, load the downloaded file and
+start it.
+
+The current implementation tries to resolve the IP address as a host name.
+If the uri is like "http://192.168.1.1/foobar";,
+the dns process tries to resolve the host "192.168.1.1" and it will
+end up with "host not found".
+
+We need to preset the "httpserverip" environment variable to proceed the wget::
+
+setenv httpserverip 192.168.1.1
+
 Executing the built in hello world application
 ~~
 
-- 
2.34.1



Re: [PATCH v1 0/5] Convert recently merged T30 boards to use DM PMIC

2023-11-06 Thread Peter Robinson
Hi Svyatoslav,

> Since the proposed PMIC patches have been accepted, I see the need
> to convert boards which I maintain to use DM drivers instead of board hacks.
>
> Svyatoslav Ryhel (5):
>   board: lg-x3: convert LG Optimus 4X and Vu to use DM PMIC
>   board: endeavoru: convert HTC One X to use DM PMIC

Is there a reason why the two above devices don't appear to have their
.dts files in the upstream kernel?

>   board: transformer-t30: convert ASUS Transformers to use DM PMIC
>   board: grouper: convert ASUS Google Nexus 7 (2012) to use DM PMIC
>   ARM: dts: tegra30: enable USB PHY node on some devices
>
>  arch/arm/dts/tegra30-asus-grouper-common.dtsi |   7 +
>  .../dts/tegra30-asus-nexus7-grouper-E1565.dts |   1 +
>  .../dts/tegra30-asus-nexus7-grouper-PM269.dts |   1 +
>  .../dts/tegra30-asus-nexus7-tilapia-E1565.dts |   1 +
>  arch/arm/dts/tegra30-asus-p1801-t.dts |  17 ++
>  arch/arm/dts/tegra30-asus-tf600t.dts  |  15 ++
>  arch/arm/dts/tegra30-asus-transformer.dtsi|   9 +
>  arch/arm/dts/tegra30-htc-endeavoru.dts|   8 +
>  arch/arm/dts/tegra30-lg-x3.dtsi   |   9 +
>  board/asus/grouper/Kconfig|   8 -
>  board/asus/grouper/Makefile   |   4 +-
>  .../asus/grouper/configs/grouper_E1565.config |   6 +-
>  .../asus/grouper/configs/grouper_PM269.config |   6 +-
>  board/asus/grouper/configs/tilapia.config |   6 +-
>  board/asus/grouper/grouper-spl-max.c  |   2 +-
>  board/asus/grouper/grouper-spl-ti.c   |   2 +-
>  board/asus/grouper/grouper.c  | 154 +-
>  board/asus/transformer-t30/Kconfig|  10 --
>  .../transformer-t30/configs/tf600t.config |   2 +-
>  .../transformer-t30/transformer-t30-spl.c |   2 +-
>  board/asus/transformer-t30/transformer-t30.c  | 121 +-
>  board/htc/endeavoru/endeavoru-spl.c   |   2 +-
>  board/htc/endeavoru/endeavoru.c   |  72 +---
>  board/lg/x3-t30/x3-t30-spl.c  |   2 +-
>  board/lg/x3-t30/x3-t30.c  |  97 +--
>  configs/endeavoru_defconfig   |   4 +
>  configs/grouper_common_defconfig  |   1 +
>  configs/transformer_t30_defconfig |   5 +
>  configs/x3_t30_defconfig  |   4 +
>  29 files changed, 128 insertions(+), 450 deletions(-)
>
> --
> 2.40.1
>


Re: [PATCH] riscv: Add support for AMD/Xilinx MicroBlaze V

2023-11-06 Thread Michal Simek

Hi Conor,

On 11/3/23 17:25, Conor Dooley wrote:

Yo,

Since you sent it to me, I may as well comment...

On Fri, Nov 03, 2023 at 05:03:25PM +0100, Michal Simek wrote:

MicroBlaze V is new AMD/Xilinx soft-core 32bit RISC-V processor IP.
It is hardware compatible with classic MicroBlaze processor.

The patch contains initial wiring and configuration for initial HW design
with memory, cpu, interrupt controller, timers and uartlite console.

Provided DT is just describing one configuration and should be taken only
as example.




@@ -0,0 +1,86 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * dts file for Xilinx MicroBlaze V
+ *
+ * (C) Copyright 2023, Advanced Micro Devices, Inc.
+ *
+ * Michal Simek 
+ */
+
+/dts-v1/;
+/ {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   model = "Xilinx MicroBlaze V 32bit";
+   compatible = "xlnx,mbv32";
+
+   cpus: cpus {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   timebase-frequency = <10200>;
+   cpu_0: cpu@0 {
+   device_type = "cpu";
+   compatible = "riscv";


You're missing a cpu specific compatible here.
"riscv" in isolation is only for {emu,simu}lators.


Will add.




+   reg = <0>;
+   status = "okay";
+   riscv,isa = "rv32imafdc";
+   clock-frequency = <1>;
+   i-cache-size = <32768>;
+   d-cache-size = <32768>;


Missing an interrupt-controller child node for the cpu-intc, no?


For u-boot interrupt controller is not needed but it is listed below that's why 
will try to wire it.





+   };
+   };
+
+   aliases {
+   serial0 = &uart0;
+   };
+
+   chosen {
+   bootargs = "earlycon";
+   stdout-path = "serial0:115200n8";
+   };
+
+   memory@2000 {
+   device_type = "memory";
+   reg = <0x2000 0x2000>;
+   };
+
+   axi: axi {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   compatible = "simple-bus";
+   ranges;
+   bootph-all;
+
+   axi_intc: interrupt-controller@4120 {
+   compatible = "xlnx.xps-intc";


This is some non-standard interrupt controller, rather than a plic,
right?


non-standard riscv interrupt controller. But standard microblaze interrrupt 
controller. And of course it is not plic compatible. Based on my discussion with 
HW designers it shouldn't be a problem to use this one.



Also, should you not also have a riscv,timer node?


It is design from Amd perspective as option to exchange microblaze with riscv 
that's why all IPs around it are the same. It means xps timer is used instead.


Thanks,
Michal




[PATCH v2] riscv: Add support for AMD/Xilinx MicroBlaze V

2023-11-06 Thread Michal Simek
MicroBlaze V is new AMD/Xilinx soft-core 32bit RISC-V processor IP.
It is hardware compatible with classic MicroBlaze processor.

The patch contains initial wiring and configuration for initial HW design
with memory, cpu, interrupt controller, timers and uartlite console
(interrupt controller is listed but U-Boot is not using it).

Provided DT is just describing one configuration and should be taken only
as example.

Signed-off-by: Michal Simek 
---

Changes in v2:
- Extend commit message
- DT changes, add interrupt controller, check agains dt schema
- The patch for amd,mbv32 compatible string is here
https://lore.kernel.org/r/d442d916204d26f82c1c3a924a4cdfb117960e1b.1699270661.git.michal.si...@amd.com
- The patch for board compatibility is here
https://lore.kernel.org/r/50c277c92c41a582ef171fb75efc6a6a4f860be2.1699271616.git.michal.si...@amd.com

xlnx,xps-intc-1.00.a driver exists in the Linux kernel but DT binding is
missing. That's something what we need to work on.
arch/arm64/boot/dts/xilinx/xilinx-mbv32.dtb: 
/axi/interrupt-controller@4120: failed to match any schema with compatible: 
['xlnx,xps-intc-1.00.a']

Public annoucement is available here if someone is interested.
https://www.xilinx.com/products/design-tools/microblaze-v.html?utm_source=marketo&utm_medium=email&utm_campaign=EN-EM-2023-11-02-New-MicroBlaze-V-Processor&utm_term=btn&mkt_tok=NDA5LVdZWC03MjQAAAGPMMJYuPPscCags7WdvOeUSWy-_mC9aOwrobFaZRf5ok_eHoQUvTLBzJdHrkcBId9tQ4a-odfnU91WjUkIxx-iSG4OKGofjK5iZcAiK_VN8_xK

---
 arch/riscv/Kconfig   |   4 +
 arch/riscv/dts/Makefile  |   2 +
 arch/riscv/dts/xilinx-mbv32.dts  | 106 +++
 board/xilinx/Kconfig |   3 +-
 board/xilinx/common/board.c  |   5 ++
 board/xilinx/mbv/Kconfig |  28 +++
 board/xilinx/mbv/MAINTAINERS |   7 ++
 board/xilinx/mbv/Makefile|   5 ++
 board/xilinx/mbv/board.c |  11 +++
 configs/xilinx_mbv32_defconfig   |  30 
 configs/xilinx_mbv32_smode_defconfig |  32 
 include/configs/xilinx_mbv.h |   6 ++
 12 files changed, 238 insertions(+), 1 deletion(-)
 create mode 100644 arch/riscv/dts/xilinx-mbv32.dts
 create mode 100644 board/xilinx/mbv/Kconfig
 create mode 100644 board/xilinx/mbv/MAINTAINERS
 create mode 100644 board/xilinx/mbv/Makefile
 create mode 100644 board/xilinx/mbv/board.c
 create mode 100644 configs/xilinx_mbv32_defconfig
 create mode 100644 configs/xilinx_mbv32_smode_defconfig
 create mode 100644 include/configs/xilinx_mbv.h

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 6d0d812ddb55..67126d96af89 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -39,6 +39,9 @@ config TARGET_TH1520_LPI4A
bool "Support Sipeed's TH1520 Lichee PI 4A Board"
select SYS_CACHE_SHIFT_6
 
+config TARGET_XILINX_MBV
+   bool "Support AMD/Xilinx MicroBlaze V"
+
 endchoice
 
 config SYS_ICACHE_OFF
@@ -82,6 +85,7 @@ source "board/sifive/unmatched/Kconfig"
 source "board/sipeed/maix/Kconfig"
 source "board/starfive/visionfive2/Kconfig"
 source "board/thead/th1520_lpi4a/Kconfig"
+source "board/xilinx/mbv/Kconfig"
 
 # platform-specific options below
 source "arch/riscv/cpu/andesv5/Kconfig"
diff --git a/arch/riscv/dts/Makefile b/arch/riscv/dts/Makefile
index be6c8a422729..b05bb5607f06 100644
--- a/arch/riscv/dts/Makefile
+++ b/arch/riscv/dts/Makefile
@@ -9,6 +9,8 @@ dtb-$(CONFIG_TARGET_SIFIVE_UNMATCHED) += 
hifive-unmatched-a00.dtb
 dtb-$(CONFIG_TARGET_SIPEED_MAIX) += k210-maix-bit.dtb
 dtb-$(CONFIG_TARGET_STARFIVE_VISIONFIVE2) += jh7110-starfive-visionfive-2.dtb
 dtb-$(CONFIG_TARGET_TH1520_LPI4A) += th1520-lichee-pi-4a.dtb
+dtb-$(CONFIG_TARGET_XILINX_MBV) += xilinx-mbv32.dtb
+
 include $(srctree)/scripts/Makefile.dts
 
 targets += $(dtb-y)
diff --git a/arch/riscv/dts/xilinx-mbv32.dts b/arch/riscv/dts/xilinx-mbv32.dts
new file mode 100644
index ..6a6b8b694bd1
--- /dev/null
+++ b/arch/riscv/dts/xilinx-mbv32.dts
@@ -0,0 +1,106 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * dts file for AMD MicroBlaze V
+ *
+ * (C) Copyright 2023, Advanced Micro Devices, Inc.
+ *
+ * Michal Simek 
+ */
+
+/dts-v1/;
+/ {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   model = "AMD MicroBlaze V 32bit";
+   compatible = "amd,mbv";
+
+   cpus: cpus {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   timebase-frequency = <10200>;
+   cpu_0: cpu@0 {
+   compatible = "amd,mbv32", "riscv";
+   device_type = "cpu";
+   reg = <0>;
+   riscv,isa = "rv32imafdc";
+   i-cache-size = <32768>;
+   d-cache-size = <32768>;
+   clock-frequency = <10200>;
+   cpu0_intc: interrupt-controller {
+   compatible = "riscv,cpu-intc";
+   interru

Re: [PATCH v1 0/5] Convert recently merged T30 boards to use DM PMIC

2023-11-06 Thread Svyatoslav Ryhel
пн, 6 лист. 2023 р. о 13:46 Peter Robinson  пише:
>
> Hi Svyatoslav,
>
> > Since the proposed PMIC patches have been accepted, I see the need
> > to convert boards which I maintain to use DM drivers instead of board hacks.
> >
> > Svyatoslav Ryhel (5):
> >   board: lg-x3: convert LG Optimus 4X and Vu to use DM PMIC
> >   board: endeavoru: convert HTC One X to use DM PMIC
>
> Is there a reason why the two above devices don't appear to have their
> .dts files in the upstream kernel?
>

Yes, there is a reason. Linux maintainers treat submitters as
existential enemies or as dirt at least. I was trying to work with
linux but I have no desire to spend any time to upstream endeavoru or
lg_x3.

> >   board: transformer-t30: convert ASUS Transformers to use DM PMIC
> >   board: grouper: convert ASUS Google Nexus 7 (2012) to use DM PMIC
> >   ARM: dts: tegra30: enable USB PHY node on some devices
> >
> >  arch/arm/dts/tegra30-asus-grouper-common.dtsi |   7 +
> >  .../dts/tegra30-asus-nexus7-grouper-E1565.dts |   1 +
> >  .../dts/tegra30-asus-nexus7-grouper-PM269.dts |   1 +
> >  .../dts/tegra30-asus-nexus7-tilapia-E1565.dts |   1 +
> >  arch/arm/dts/tegra30-asus-p1801-t.dts |  17 ++
> >  arch/arm/dts/tegra30-asus-tf600t.dts  |  15 ++
> >  arch/arm/dts/tegra30-asus-transformer.dtsi|   9 +
> >  arch/arm/dts/tegra30-htc-endeavoru.dts|   8 +
> >  arch/arm/dts/tegra30-lg-x3.dtsi   |   9 +
> >  board/asus/grouper/Kconfig|   8 -
> >  board/asus/grouper/Makefile   |   4 +-
> >  .../asus/grouper/configs/grouper_E1565.config |   6 +-
> >  .../asus/grouper/configs/grouper_PM269.config |   6 +-
> >  board/asus/grouper/configs/tilapia.config |   6 +-
> >  board/asus/grouper/grouper-spl-max.c  |   2 +-
> >  board/asus/grouper/grouper-spl-ti.c   |   2 +-
> >  board/asus/grouper/grouper.c  | 154 +-
> >  board/asus/transformer-t30/Kconfig|  10 --
> >  .../transformer-t30/configs/tf600t.config |   2 +-
> >  .../transformer-t30/transformer-t30-spl.c |   2 +-
> >  board/asus/transformer-t30/transformer-t30.c  | 121 +-
> >  board/htc/endeavoru/endeavoru-spl.c   |   2 +-
> >  board/htc/endeavoru/endeavoru.c   |  72 +---
> >  board/lg/x3-t30/x3-t30-spl.c  |   2 +-
> >  board/lg/x3-t30/x3-t30.c  |  97 +--
> >  configs/endeavoru_defconfig   |   4 +
> >  configs/grouper_common_defconfig  |   1 +
> >  configs/transformer_t30_defconfig |   5 +
> >  configs/x3_t30_defconfig  |   4 +
> >  29 files changed, 128 insertions(+), 450 deletions(-)
> >
> > --
> > 2.40.1
> >


Re: [PATCH v2 0/3] Implement GPIO cells for PALMAS and MAX77663 PMICs

2023-11-06 Thread Peter Robinson
On Mon, Nov 6, 2023 at 10:18 AM Svyatoslav Ryhel  wrote:
>
> This patchset adds support for gpio-uclass to work with pmic gpio childrens
> properly and implements MAX77663 and PALMAS GPIO cells/children as a
> reference and to be further used in devices I am currently maintaining.
>
> All drivers are tested on actual hardware and confirmed to work as
> expected. MAX77663 GPIO cell is tested on wexler qc750 tegra 3 device

Is the MAX77663 seems more related to the MAX77686 PMIC, why is it
being done as s a GPIO and not a PMIC driver or the existing driver
extended to support this chip?

> and PALMAS GPIO cell is tested on tegra note 7 tegra 4 device.
>
> ---
> Changes from v1:
>  - isolate PMIC GPIO cells parsing behind enabling DM_PMIC
> ---
>
> Svyatoslav Ryhel (3):
>   drivers: gpio-uclass: support PMIC GPIO children
>   drivers: gpio: implement MAX77663 GPIO cell
>   drivers: gpio: implement PALMAS GPIO cell
>
>  drivers/gpio/Kconfig|  16 +++
>  drivers/gpio/Makefile   |   2 +
>  drivers/gpio/gpio-uclass.c  |  19 +++
>  drivers/gpio/max77663_gpio.c| 178 
>  drivers/gpio/palmas_gpio.c  | 132 +
>  drivers/power/pmic/max77663.c   |   9 ++
>  drivers/power/pmic/palmas.c |  10 +-
>  include/dt-bindings/pmic/max77663.h |  18 +++
>  include/power/max77663.h|   1 +
>  include/power/palmas.h  |  12 ++
>  10 files changed, 396 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/gpio/max77663_gpio.c
>  create mode 100644 drivers/gpio/palmas_gpio.c
>  create mode 100644 include/dt-bindings/pmic/max77663.h
>
> --
> 2.40.1
>


Re: [PATCH 01/15] arm: mach-k3: j721e: Improve support for UDA FS

2023-11-06 Thread Nishanth Menon
On 15:54-20231104, Kumar, Udit wrote:
> 
> On 11/3/2023 6:07 AM, Nishanth Menon wrote:
> > Commit 5019170970ad ("arch: arm: mach-k3: j721e: add support for UDA
> > FS") introduced basic UDA FS support, however, we can Take approach
> > similar to commit 0f1c1e8b368b ("arm: mach-k3: am625: Add support for
> > UDA FS"). While boot partition support with EMMC boot is useful, it is
> > constrained by the size of boot hardware partition itself.
> > 
> > In the case of K3 devices, tispl images can contain OP-TEE images that
> > can substantially vary in size and the u-boot image itself can vary over
> > time as we enable various features.
> > 
> > So use the CSD information in the case of EMMC_BOOT configuration being
> > enabled to pick boot partition or UDA FS mode operation to pick.
> > 
> > If EMMC_BOOT is disabled, then depend on filesystem configuration to
> > pick data from UDA.
> 
> I am thinking, in which case we have EMMC_BOOT disabled,
> 
> Case here I am considering, updating u-boot to eMMC from u-boot shell, If
> EMMC_BOOT
> 
> is not set then , we can not set CSD information


Yes, but we cannot use boot0 mode of operation for Beagle family. the
size of u-boot and optee vary over time and SK's boot0 partition
strategy does'nt work for Beagle platforms.

> 
> > 
> > Signed-off-by: Nishanth Menon 
> > ---
> >   arch/arm/mach-k3/j721e_init.c | 9 -
> >   1 file changed, 8 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/arm/mach-k3/j721e_init.c b/arch/arm/mach-k3/j721e_init.c
> > index b1f7e25ed092..bcdfbfc79c4a 100644
> > --- a/arch/arm/mach-k3/j721e_init.c
> > +++ b/arch/arm/mach-k3/j721e_init.c
> > @@ -294,7 +294,14 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 
> > boot_device)
> >   {
> > switch (boot_device) {
> > case BOOT_DEVICE_MMC1:
> > -   return (spl_mmc_emmc_boot_partition(mmc) ? MMCSD_MODE_EMMCBOOT 
> > : MMCSD_MODE_FS);
> > +   if (IS_ENABLED(CONFIG_SUPPORT_EMMC_BOOT)) {
> > +   if (spl_mmc_emmc_boot_partition(mmc))
> > +   return MMCSD_MODE_EMMCBOOT;
> > +   return MMCSD_MODE_FS;
> > +   }
> 
> I had a view EMMC_BOOT should be needed config.
> 
> 
> > +   if (IS_ENABLED(CONFIG_SPL_FS_FAT) || 
> > IS_ENABLED(CONFIG_SPL_FS_EXT4))
> > +   return MMCSD_MODE_FS;
> > +   return MMCSD_MODE_EMMCBOOT;
> 
> If you consider, to make EMMC_BOOT as needed config, then this is not needed

EMMC_BOOT is not a mandatory config.
> 
> 
> > case BOOT_DEVICE_MMC2:
> > return MMCSD_MODE_FS;
> > default:

-- 
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 
849D 1736 249D


Re: [PATCH 03/15] board: ti: j721e: evm: Drop board check for ESM

2023-11-06 Thread Nishanth Menon
On 16:03-20231104, Kumar, Udit wrote:
> 
> On 11/3/2023 6:07 AM, Nishanth Menon wrote:
> > When config is enabled, the esm dt probe makes sense. Simplify by
> > dropping board specific checks.
> > 
> > Signed-off-by: Nishanth Menon 
> > ---
> >   board/ti/j721e/evm.c | 10 ++
> >   1 file changed, 2 insertions(+), 8 deletions(-)
> > 
> > diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c
> > index d4f7c1d9f938..75d51a0552c4 100644
> > --- a/board/ti/j721e/evm.c
> > +++ b/board/ti/j721e/evm.c
> > @@ -531,10 +531,8 @@ err_free_gpio:
> >   void spl_board_init(void)
> >   {
> > -#if defined(CONFIG_ESM_K3) || defined(CONFIG_ESM_PMIC)
> > struct udevice *dev;
> > int ret;
> > -#endif
> > if ((IS_ENABLED(CONFIG_TARGET_J721E_A72_EVM) ||
> >  IS_ENABLED(CONFIG_TARGET_J7200_A72_EVM)) &&
> > @@ -543,24 +541,20 @@ void spl_board_init(void)
> > probe_daughtercards();
> > }
> > -#ifdef CONFIG_ESM_K3
> > -   if (board_ti_k3_is("J721EX-PM2-SOM")) {
> > +   if (IS_ENABLED(CONFIG_ESM_K3)) {
> > ret = uclass_get_device_by_driver(UCLASS_MISC,
> >   DM_DRIVER_GET(k3_esm), &dev);
> > if (ret)
> > printf("ESM init failed: %d\n", ret);
> > }
> 
> Nothing related to this patch, but to get esm completely functional
> 
> Second k3_esm probing needs to be added in this file.
> 
> 
> Also, DT changes are needed, in next sync
> 
> https://lore.kernel.org/all/20231013102941.548209-1-n-fran...@ti.com/
> 
> 

Understood. no action on the current series, I assume.
-- 
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 
849D 1736 249D


Re: [PATCH 10/15] configs: j721e_evm_a72_defconfig: Switch to bootstd

2023-11-06 Thread Nishanth Menon
On 10:58-20231106, Manorit Chawdhry wrote:
> Hi Nishanth,
> 
> On 19:38-20231102, Nishanth Menon wrote:
> > Switch to using bootstd. Note with this change, we will stop using
> > distro_bootcmd and instead depend entirely on bootflow method of
> > starting the system up.
> > 
> > Signed-off-by: Nishanth Menon 
> > ---
> >  configs/j721e_evm_a72_defconfig | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/configs/j721e_evm_a72_defconfig 
> > b/configs/j721e_evm_a72_defconfig
> > index 99e0e168ebf7..98ac7ca59789 100644
> > --- a/configs/j721e_evm_a72_defconfig
> > +++ b/configs/j721e_evm_a72_defconfig
> > @@ -29,10 +29,11 @@ CONFIG_SPL_SPI=y
> >  # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
> >  CONFIG_SPL_LOAD_FIT=y
> >  CONFIG_SPL_LOAD_FIT_ADDRESS=0x8100
> > -CONFIG_DISTRO_DEFAULTS=y
> >  CONFIG_OF_BOARD_SETUP=y
> >  CONFIG_OF_SYSTEM_SETUP=y
> > -CONFIG_BOOTCOMMAND="run envboot; run distro_bootcmd;"
> > +CONFIG_BOOTSTD_FULL=y
> > +CONFIG_BOOTSTD_DEFAULTS=y
> > +CONFIG_BOOTCOMMAND="run envboot; bootflow scan -lb"
> 
> Coming back to [0], AM62x didn't have early remote procs but j721e does,
> do you have any alternatives in place before migrating J7 platforms to
> stdboot?

As I have stated before. distro boot support for remote proc has been
hacked up atm. what needs to happen is standardize it. Which is
independent of this series.

Please discuss with stdboot folks how to get it in. WORST case, envboot
is still supported, so in effect, what is achieved today can still
continue to occur with envboot.

> 
> Regards,
> Manorit
> 
> [0]: https://lore.kernel.org/u-boot/20231005171010.zvza7uqyn4mcgp5g@handsaw/
> 
> >  CONFIG_LOGLEVEL=7
> >  CONFIG_SPL_MAX_SIZE=0xc
> >  CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
> > -- 
> > 2.40.0
> > 

-- 
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 
849D 1736 249D


Re: [PATCH v6 08/25] spl: Refactor spl_load_info->read to use units of bytes

2023-11-06 Thread Xavier Drudis Ferran
Thanks for your work. I'm still reading... but...


El Sun, Nov 05, 2023 at 09:25:46PM -0500, Sean Anderson deia:
> diff --git a/include/spl.h b/include/spl.h
> index 951e136b9ea..ecfc50e0095 100644
> --- a/include/spl.h
> +++ b/include/spl.h
> @@ -297,10 +297,10 @@ struct spl_load_info {
>* read() - Read from device
>*
>* @load: Information about the load state
> -  * @sector: Sector number to read from (each @load->bl_len bytes)
> -  * @count: Number of sectors to read
> +  * @offset: Offset to read from in bytes, in multiples of @load->bl_len
> +  * @count: Number of bytes to read, in multiples of @load->bl_len

I'm no native English speaker, but would it be easier to understand? :

+* @offset: Offset to read from in bytes, a multiple of @load->bl_len
+* @count: Number of bytes to read, a multiple of @load->bl_len





Re: [PATCH v3 6/7] clk/qcom: add mnd_width to clk_rcg_set_rate_mnd()

2023-11-06 Thread Caleb Connolly



On 06/11/2023 07:06, Sumit Garg wrote:
> On Fri, 3 Nov 2023 at 21:09, Caleb Connolly  wrote:
>>
>> This property is needed on some platforms to ensure that only the
>> relevant bits are set in the M/N/D registers.
> 
> This commit broke qcs404 platform which is fixed by following add-on change:
> 
> diff --git a/drivers/clk/qcom/clock-qcs404.c b/drivers/clk/qcom/clock-qcs404.c
> index 429ff35e1d..f5b3528039 100644
> --- a/drivers/clk/qcom/clock-qcs404.c
> +++ b/drivers/clk/qcom/clock-qcs404.c
> @@ -195,7 +195,7 @@ static ulong qcs404_clk_set_rate(struct clk *clk,
> ulong rate)
> case GCC_BLSP1_UART2_APPS_CLK:
> /* UART: 115200 */
> clk_rcg_set_rate_mnd(priv->base, &uart2_regs, 0, 12, 125,
> -CFG_CLK_SRC_CXO, 8);
> +CFG_CLK_SRC_CXO, 16);
> clk_enable_cbc(priv->base + BLSP1_UART2_APPS_CBCR);
> break;
> case GCC_BLSP1_AHB_CLK:
> 
> This is needed as per Linux qcs404 clock driver too. I would suggest
> you double check if you have imported correct values from
> corresponding Linux clock drivers for other platforms too.

Ah, you're right - I think all platforms use 16 bits for the UART RCG,
Thanks a lot for testing this.

> 
> BTW, after this fix feel free to add:
> 
> Tested-by: Sumit Garg  (QCS404)
> 
> -Sumit
> 
>>
>> Signed-off-by: Caleb Connolly 
>> Reviewed-by: Sumit Garg 
>> ---
>>  drivers/clk/qcom/clock-apq8016.c |  4 ++--
>>  drivers/clk/qcom/clock-apq8096.c |  4 ++--
>>  drivers/clk/qcom/clock-qcom.c| 11 +++
>>  drivers/clk/qcom/clock-qcom.h|  2 +-
>>  drivers/clk/qcom/clock-qcs404.c  | 18 +-
>>  drivers/clk/qcom/clock-sdm845.c  |  3 +--
>>  6 files changed, 22 insertions(+), 20 deletions(-)
>>
>> diff --git a/drivers/clk/qcom/clock-apq8016.c 
>> b/drivers/clk/qcom/clock-apq8016.c
>> index 3f44252c453e..630619c83454 100644
>> --- a/drivers/clk/qcom/clock-apq8016.c
>> +++ b/drivers/clk/qcom/clock-apq8016.c
>> @@ -86,7 +86,7 @@ static int clk_init_sdc(struct msm_clk_priv *priv, int 
>> slot, uint rate)
>> clk_enable_cbc(priv->base + SDCC_AHB_CBCR(slot));
>> /* 800Mhz/div, gpll0 */
>> clk_rcg_set_rate_mnd(priv->base, &sdc_regs[slot], div, 0, 0,
>> -CFG_CLK_SRC_GPLL0);
>> +CFG_CLK_SRC_GPLL0, 8);
>> clk_enable_gpll0(priv->base, &gpll0_vote_clk);
>> clk_enable_cbc(priv->base + SDCC_APPS_CBCR(slot));
>>
>> @@ -109,7 +109,7 @@ static int clk_init_uart(struct msm_clk_priv *priv)
>>
>> /* 7372800 uart block clock @ GPLL0 */
>> clk_rcg_set_rate_mnd(priv->base, &uart2_regs, 1, 144, 15625,
>> -CFG_CLK_SRC_GPLL0);
>> +CFG_CLK_SRC_GPLL0, 8);
>>
>> /* Vote for gpll0 clock */
>> clk_enable_gpll0(priv->base, &gpll0_vote_clk);
>> diff --git a/drivers/clk/qcom/clock-apq8096.c 
>> b/drivers/clk/qcom/clock-apq8096.c
>> index 75633a7c2af8..095c1b431245 100644
>> --- a/drivers/clk/qcom/clock-apq8096.c
>> +++ b/drivers/clk/qcom/clock-apq8096.c
>> @@ -69,7 +69,7 @@ static int clk_init_sdc(struct msm_clk_priv *priv, uint 
>> rate)
>>
>> clk_enable_cbc(priv->base + SDCC2_AHB_CBCR);
>> clk_rcg_set_rate_mnd(priv->base, &sdc_regs, div, 0, 0,
>> -CFG_CLK_SRC_GPLL0);
>> +CFG_CLK_SRC_GPLL0, 8);
>> clk_enable_gpll0(priv->base, &gpll0_vote_clk);
>> clk_enable_cbc(priv->base + SDCC2_APPS_CBCR);
>>
>> @@ -91,7 +91,7 @@ static int clk_init_uart(struct msm_clk_priv *priv)
>>
>> /* 7372800 uart block clock @ GPLL0 */
>> clk_rcg_set_rate_mnd(priv->base, &uart2_regs, 1, 192, 15625,
>> -CFG_CLK_SRC_GPLL0);
>> +CFG_CLK_SRC_GPLL0, 8);
>>
>> /* Vote for gpll0 clock */
>> clk_enable_gpll0(priv->base, &gpll0_vote_clk);
>> diff --git a/drivers/clk/qcom/clock-qcom.c b/drivers/clk/qcom/clock-qcom.c
>> index 77bcaacd1583..fc478554f982 100644
>> --- a/drivers/clk/qcom/clock-qcom.c
>> +++ b/drivers/clk/qcom/clock-qcom.c
>> @@ -83,7 +83,7 @@ void clk_bcr_update(phys_addr_t apps_cmd_rcgr)
>>
>>  /* root set rate for clocks with half integer and MND divider */
>>  void clk_rcg_set_rate_mnd(phys_addr_t base, const struct bcr_regs *regs,
>> - int div, int m, int n, int source)
>> + int div, int m, int n, int source, u8 mnd_width)
>>  {
>> u32 cfg;
>> /* M value for MND divider. */
>> @@ -92,11 +92,14 @@ void clk_rcg_set_rate_mnd(phys_addr_t base, const struct 
>> bcr_regs *regs,
>> u32 n_val = ~((n) - (m)) * !!(n);
>> /* NOT 2D value for MND divider. */
>> u32 d_val = ~(n);
>> +   u32 mask = BIT(mnd_width) - 1;
>> +
>> +   debug("m %#x n %#x d %#x div %#x mask %#x\n", m_val, n_val, d_val, 
>> div, mask);
>>
>> /* Program

Re: [RESEND PATCH v2] xilinx: versal: Setup 30MHz as default spi frequency

2023-11-06 Thread Michal Simek




On 10/31/23 11:50, Michal Simek wrote:

Align default SPI configuration with ZynqMP/Versal NET.
There is no reason to run on lower frequencies.

Signed-off-by: Michal Simek 
---

Changes in v2:
- sync Kconfig location

v2 didn't land in lore.kernel.org but it is present here
https://lists.denx.de/pipermail/u-boot/2023-October/535418.html
that's why resend it to be able to have link to lore.

---
  configs/xilinx_versal_virt_defconfig | 1 +
  1 file changed, 1 insertion(+)

diff --git a/configs/xilinx_versal_virt_defconfig 
b/configs/xilinx_versal_virt_defconfig
index be86d446cf46..276ec2526ba2 100644
--- a/configs/xilinx_versal_virt_defconfig
+++ b/configs/xilinx_versal_virt_defconfig
@@ -6,6 +6,7 @@ CONFIG_ARCH_VERSAL=y
  CONFIG_TEXT_BASE=0x800
  CONFIG_SYS_MALLOC_F_LEN=0x10
  CONFIG_NR_DRAM_BANKS=36
+CONFIG_SF_DEFAULT_SPEED=3000
  CONFIG_DEFAULT_DEVICE_TREE="xilinx-versal-virt"
  CONFIG_OF_LIBFDT_OVERLAY=y
  CONFIG_DM_RESET=y


Applied.
M



Re: [PATCH] arm64: zynqmp: Fix Kconfig entry indentation

2023-11-06 Thread Michal Simek




On 10/26/23 08:34, Michal Simek wrote:

Use tabs instead of space for entry indentation which is standard coding
style.

Signed-off-by: Michal Simek 
---

  arch/arm/mach-zynqmp/Kconfig | 24 
  1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-zynqmp/Kconfig b/arch/arm/mach-zynqmp/Kconfig
index 26b80b7882c8..7e7c87d16fa9 100644
--- a/arch/arm/mach-zynqmp/Kconfig
+++ b/arch/arm/mach-zynqmp/Kconfig
@@ -100,30 +100,30 @@ config SPL_ZYNQMP_DRAM_ECC_INIT
  config SPL_ZYNQMP_DRAM_BANK1_BASE
depends on SPL_ZYNQMP_DRAM_ECC_INIT
hex "DRAM Bank1 address"
-   default 0x
-   help
- Start address of DRAM ECC bank1
+   default 0x
+   help
+ Start address of DRAM ECC bank1
  
  config SPL_ZYNQMP_DRAM_BANK1_LEN

depends on SPL_ZYNQMP_DRAM_ECC_INIT
hex "DRAM Bank1 size"
-   default 0x8000
-   help
- Size in bytes of the DRAM ECC bank1
+   default 0x8000
+   help
+ Size in bytes of the DRAM ECC bank1
  
  config SPL_ZYNQMP_DRAM_BANK2_BASE

depends on SPL_ZYNQMP_DRAM_ECC_INIT
hex "DRAM Bank2 address"
-   default 0x8
-   help
- Start address of DRAM ECC bank2
+   default 0x8
+   help
+ Start address of DRAM ECC bank2
  
  config SPL_ZYNQMP_DRAM_BANK2_LEN

depends on SPL_ZYNQMP_DRAM_ECC_INIT
hex "DRAM Bank2 size"
-   default 0x0
-   help
- Size in bytes of the DRAM ECC bank2. A null size takes no action.
+   default 0x0
+   help
+ Size in bytes of the DRAM ECC bank2. A null size takes no action.
  
  config SYS_MALLOC_F_LEN

default 0x600


Applied.
M



Re: [PATCH] arm64: versal-net: enable CONFIG_MMC_SDHCI_ADMA

2023-11-06 Thread Michal Simek




On 10/27/23 05:04, Venkatesh Yadav Abbarapu wrote:

The Standard Host Controller Interface (SDHCI) specification version
3.00 adds support for Advanced DMA (ADMA) for both 64 and 32 bit
widths of DMA. This significantly improves read and write throughput.

Signed-off-by: Venkatesh Yadav Abbarapu 
---
  configs/xilinx_versal_net_virt_defconfig | 1 +
  1 file changed, 1 insertion(+)

diff --git a/configs/xilinx_versal_net_virt_defconfig 
b/configs/xilinx_versal_net_virt_defconfig
index ccc9431ca8..0553ac6b17 100644
--- a/configs/xilinx_versal_net_virt_defconfig
+++ b/configs/xilinx_versal_net_virt_defconfig
@@ -85,6 +85,7 @@ CONFIG_MMC_IO_VOLTAGE=y
  CONFIG_MMC_UHS_SUPPORT=y
  CONFIG_MMC_HS400_SUPPORT=y
  CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_ADMA=y
  CONFIG_MMC_SDHCI_ZYNQ=y
  CONFIG_ZYNQ_SDHCI_MIN_FREQ=10
  CONFIG_MTD=y


Applied.
M



Re: [PATCH] arm64: zynqmp: Disable Tri-state for MIO38 Pin

2023-11-06 Thread Michal Simek




On 10/20/23 07:06, Tejas Bhumkar wrote:

gpio38 is used in SOM's kv260 to reset the Ethernet PHY.
At present, HW reset is not working properly as Tri-state
is enabled for MIO38, causing inappropriate PHY register reads.

Disabled Tri-state for MIO38 to make HW reset work.

Tri-state disable :
ZynqMP> md 0xFF180208 2
ff180208: 00bfe7a3 0540

Tri-state enable :
ZynqMP> md 0xFF180208 2
ff180208: 00bfe7e3 0540

Signed-off-by: Tejas Bhumkar 
---
  arch/arm/dts/zynqmp-sck-kv-g-revA.dtso | 25 +
  arch/arm/dts/zynqmp-sck-kv-g-revB.dtso | 25 +
  2 files changed, 50 insertions(+)

diff --git a/arch/arm/dts/zynqmp-sck-kv-g-revA.dtso 
b/arch/arm/dts/zynqmp-sck-kv-g-revA.dtso
index 22e7d68d02..c4f1da9218 100644
--- a/arch/arm/dts/zynqmp-sck-kv-g-revA.dtso
+++ b/arch/arm/dts/zynqmp-sck-kv-g-revA.dtso
@@ -190,6 +190,25 @@
  &pinctrl0 {
status = "okay";
  
+	pinctrl_gpio0_default: gpio0-default {

+conf {
+groups = "gpio0_38_grp";
+bias-pull-up;
+power-source = ;
+};
+
+mux {
+groups = "gpio0_38_grp";
+function = "gpio0";
+};
+
+conf-tx {
+pins = "MIO38";
+bias-disable;
+output-enable;
+};
+};
+
pinctrl_uart1_default: uart1-default {
conf {
groups = "uart1_9_grp";
@@ -345,6 +364,12 @@
};
  };
  
+&gpio {

+status = "okay";
+pinctrl-names = "default";
+pinctrl-0 = <&pinctrl_gpio0_default>;
+};
+
  &uart1 {
status = "okay";
pinctrl-names = "default";
diff --git a/arch/arm/dts/zynqmp-sck-kv-g-revB.dtso 
b/arch/arm/dts/zynqmp-sck-kv-g-revB.dtso
index eadc256306..6c5e0e5660 100644
--- a/arch/arm/dts/zynqmp-sck-kv-g-revB.dtso
+++ b/arch/arm/dts/zynqmp-sck-kv-g-revB.dtso
@@ -178,6 +178,25 @@
  &pinctrl0 {
status = "okay";
  
+	pinctrl_gpio0_default: gpio0-default {

+   conf {
+   groups = "gpio0_38_grp";
+   bias-pull-up;
+   power-source = ;
+   };
+
+   mux {
+   groups = "gpio0_38_grp";
+   function = "gpio0";
+   };
+
+   conf-tx {
+   pins = "MIO38";
+   bias-disable;
+   output-enable;
+   };
+   };
+
pinctrl_uart1_default: uart1-default {
conf {
groups = "uart1_9_grp";
@@ -333,6 +352,12 @@
};
  };
  
+&gpio {

+   status = "okay";
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_gpio0_default>;
+};
+
  &uart1 {
status = "okay";
pinctrl-names = "default";


Applied.
M



Re: [PATCH v2] arm: xilinx: Add missing dual parallel flash description

2023-11-06 Thread Michal Simek




On 10/23/23 09:21, Michal Simek wrote:

Describe flash memories based on the latest DT binding.

Signed-off-by: Michal Simek 
---

Changes in v2:
- Add missing description for zc706

  arch/arm/dts/zynq-zc706.dts | 5 +++--
  arch/arm/dts/zynq-zc770-xm013.dts   | 5 +++--
  arch/arm/dts/zynqmp-m-a2197-01-revA.dts | 4 +++-
  arch/arm/dts/zynqmp-m-a2197-02-revA.dts | 4 +++-
  arch/arm/dts/zynqmp-m-a2197-03-revA.dts | 4 +++-
  5 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/arch/arm/dts/zynq-zc706.dts b/arch/arm/dts/zynq-zc706.dts
index 03eb016ed687..18963a395156 100644
--- a/arch/arm/dts/zynq-zc706.dts
+++ b/arch/arm/dts/zynq-zc706.dts
@@ -309,10 +309,11 @@
  &qspi {
bootph-all;
status = "okay";
-   num-cs = <1>;
+   num-cs = <2>;
flash@0 {
compatible = "n25q128a11", "jedec,spi-nor";
-   reg = <0x0>;
+   reg = <0>, <1>;
+   parallel-memories = /bits/ 64 <0x100 0x100>; /* 16MB */
spi-tx-bus-width = <1>;
spi-rx-bus-width = <4>;
spi-max-frequency = <5000>;
diff --git a/arch/arm/dts/zynq-zc770-xm013.dts 
b/arch/arm/dts/zynq-zc770-xm013.dts
index 21902fbb0cc1..582aa1f1b873 100644
--- a/arch/arm/dts/zynq-zc770-xm013.dts
+++ b/arch/arm/dts/zynq-zc770-xm013.dts
@@ -61,10 +61,11 @@
  
  &qspi {

status = "okay";
-   num-cs = <1>;
+   num-cs = <2>;
flash@0 {
compatible = "n25q128a11", "jedec,spi-nor";
-   reg = <0x0>;
+   reg = <0>, <1>;
+   parallel-memories = /bits/ 64 <0x100 0x100>; /* 16MB */
spi-tx-bus-width = <1>;
spi-rx-bus-width = <4>;
spi-max-frequency = <5000>;
diff --git a/arch/arm/dts/zynqmp-m-a2197-01-revA.dts 
b/arch/arm/dts/zynqmp-m-a2197-01-revA.dts
index 25ef646c8466..83b8a98d80ca 100644
--- a/arch/arm/dts/zynqmp-m-a2197-01-revA.dts
+++ b/arch/arm/dts/zynqmp-m-a2197-01-revA.dts
@@ -71,11 +71,13 @@
  
  &qspi {

status = "okay";
+   num-cs = <2>;
flash@0 {
compatible = "m25p80", "jedec,spi-nor"; /* 32MB */
+   reg = <0>, <1>;
+   parallel-memories = /bits/ 64 <0x400 0x400>; /* 64MB */
#address-cells = <1>;
#size-cells = <1>;
-   reg = <0x0>;
spi-tx-bus-width = <4>;
spi-rx-bus-width = <4>;
spi-max-frequency = <10800>;
diff --git a/arch/arm/dts/zynqmp-m-a2197-02-revA.dts 
b/arch/arm/dts/zynqmp-m-a2197-02-revA.dts
index ece9e6914541..dd37b726d3dc 100644
--- a/arch/arm/dts/zynqmp-m-a2197-02-revA.dts
+++ b/arch/arm/dts/zynqmp-m-a2197-02-revA.dts
@@ -67,11 +67,13 @@
  
  &qspi {

status = "okay";
+   num-cs = <2>;
flash@0 {
compatible = "m25p80", "jedec,spi-nor"; /* 32MB */
+   reg = <0>, <1>;
+   parallel-memories = /bits/ 64 <0x400 0x400>; /* 64MB */
#address-cells = <1>;
#size-cells = <1>;
-   reg = <0x0>;
spi-tx-bus-width = <4>;
spi-rx-bus-width = <4>;
spi-max-frequency = <10800>;
diff --git a/arch/arm/dts/zynqmp-m-a2197-03-revA.dts 
b/arch/arm/dts/zynqmp-m-a2197-03-revA.dts
index 7372968e5734..811cebafe9e6 100644
--- a/arch/arm/dts/zynqmp-m-a2197-03-revA.dts
+++ b/arch/arm/dts/zynqmp-m-a2197-03-revA.dts
@@ -67,11 +67,13 @@
  
  &qspi {

status = "okay";
+   num-cs = <2>;
flash@0 {
compatible = "m25p80", "jedec,spi-nor"; /* 32MB */
+   reg = <0>, <1>;
+   parallel-memories = /bits/ 64 <0x400 0x400>; /* 64MB */
#address-cells = <1>;
#size-cells = <1>;
-   reg = <0x0>;
spi-tx-bus-width = <4>;
spi-rx-bus-width = <4>;
spi-max-frequency = <10800>;


Applied.
M



Re: [PATCH 0/4] xilinx: Add DTSes for mini qspi/ospi configuration

2023-11-06 Thread Michal Simek




On 10/26/23 16:04, Michal Simek wrote:

Hi,

we are using U-Boot mini configurations for years. We already upstream
configurations for mtest, single qspi/ospi or emmcs for all Xilinx SOCs.
But we didn't push configuration for different qspi/ospi configurations
which were missing upstream dt description. This has changed some time ago
by:
https://lore.kernel.org/all/20220126112608.955728-3-miquel.ray...@bootlin.com/

and we are also pushing support for it in core here:
https://lore.kernel.org/all/20231020031817.267959-1-venkatesh.abbar...@amd.com/

that's why it is good time to also upstream description for these
configurations. Functionality depends on core changes but description
itself is independent of it.

Thanks,
Michal


Michal Simek (4):
   ARM: zynq: Add DTSes for mini qspi configurations
   ARM: zynq: Add DTSes for mini qspi configurations
   arm64: versal: Add DTSes for mini qspi/ospi configuration
   arm64: versal-net: Add DTSes for mini qspi/ospi configuration

  arch/arm/dts/Makefile | 27 +++
  arch/arm/dts/versal-mini-ospi-stacked.dts | 22 +++
  arch/arm/dts/versal-mini-qspi-parallel.dts| 22 +++
  arch/arm/dts/versal-mini-qspi-stacked.dts | 22 +++
  arch/arm/dts/versal-mini-qspi-x1-single.dts   | 17 
  arch/arm/dts/versal-mini-qspi-x1-stacked.dts  | 23 
  arch/arm/dts/versal-mini-qspi-x2-single.dts   | 17 
  arch/arm/dts/versal-mini-qspi-x2-stacked.dts  | 23 
  arch/arm/dts/versal-net-mini-ospi-stacked.dts | 22 +++
  .../arm/dts/versal-net-mini-qspi-parallel.dts | 22 +++
  arch/arm/dts/versal-net-mini-qspi-stacked.dts | 22 +++
  .../dts/versal-net-mini-qspi-x1-single.dts| 17 
  .../dts/versal-net-mini-qspi-x1-stacked.dts   | 23 
  .../dts/versal-net-mini-qspi-x2-single.dts| 17 
  .../dts/versal-net-mini-qspi-x2-stacked.dts   | 23 
  arch/arm/dts/zynq-cse-qspi-parallel.dts   | 22 +++
  arch/arm/dts/zynq-cse-qspi-stacked.dts| 22 +++
  arch/arm/dts/zynq-cse-qspi-x1-single.dts  | 16 +++
  arch/arm/dts/zynq-cse-qspi-x1-stacked.dts | 22 +++
  arch/arm/dts/zynq-cse-qspi-x2-single.dts  | 16 +++
  arch/arm/dts/zynq-cse-qspi-x2-stacked.dts | 22 +++
  arch/arm/dts/zynqmp-mini-qspi-parallel.dts| 21 +++
  arch/arm/dts/zynqmp-mini-qspi-single.dts  | 12 +
  arch/arm/dts/zynqmp-mini-qspi-stacked.dts | 21 +++
  arch/arm/dts/zynqmp-mini-qspi-x1-single.dts   | 17 
  arch/arm/dts/zynqmp-mini-qspi-x1-stacked.dts  | 23 
  arch/arm/dts/zynqmp-mini-qspi-x2-single.dts   | 17 
  arch/arm/dts/zynqmp-mini-qspi-x2-stacked.dts  | 23 
  28 files changed, 573 insertions(+)
  create mode 100644 arch/arm/dts/versal-mini-ospi-stacked.dts
  create mode 100644 arch/arm/dts/versal-mini-qspi-parallel.dts
  create mode 100644 arch/arm/dts/versal-mini-qspi-stacked.dts
  create mode 100644 arch/arm/dts/versal-mini-qspi-x1-single.dts
  create mode 100644 arch/arm/dts/versal-mini-qspi-x1-stacked.dts
  create mode 100644 arch/arm/dts/versal-mini-qspi-x2-single.dts
  create mode 100644 arch/arm/dts/versal-mini-qspi-x2-stacked.dts
  create mode 100644 arch/arm/dts/versal-net-mini-ospi-stacked.dts
  create mode 100644 arch/arm/dts/versal-net-mini-qspi-parallel.dts
  create mode 100644 arch/arm/dts/versal-net-mini-qspi-stacked.dts
  create mode 100644 arch/arm/dts/versal-net-mini-qspi-x1-single.dts
  create mode 100644 arch/arm/dts/versal-net-mini-qspi-x1-stacked.dts
  create mode 100644 arch/arm/dts/versal-net-mini-qspi-x2-single.dts
  create mode 100644 arch/arm/dts/versal-net-mini-qspi-x2-stacked.dts
  create mode 100644 arch/arm/dts/zynq-cse-qspi-parallel.dts
  create mode 100644 arch/arm/dts/zynq-cse-qspi-stacked.dts
  create mode 100644 arch/arm/dts/zynq-cse-qspi-x1-single.dts
  create mode 100644 arch/arm/dts/zynq-cse-qspi-x1-stacked.dts
  create mode 100644 arch/arm/dts/zynq-cse-qspi-x2-single.dts
  create mode 100644 arch/arm/dts/zynq-cse-qspi-x2-stacked.dts
  create mode 100644 arch/arm/dts/zynqmp-mini-qspi-parallel.dts
  create mode 100644 arch/arm/dts/zynqmp-mini-qspi-single.dts
  create mode 100644 arch/arm/dts/zynqmp-mini-qspi-stacked.dts
  create mode 100644 arch/arm/dts/zynqmp-mini-qspi-x1-single.dts
  create mode 100644 arch/arm/dts/zynqmp-mini-qspi-x1-stacked.dts
  create mode 100644 arch/arm/dts/zynqmp-mini-qspi-x2-single.dts
  create mode 100644 arch/arm/dts/zynqmp-mini-qspi-x2-stacked.dts



Applied.
M



RE: uboot reports adding disk failed(EFI_NOT_FOUND) and first disk is gone in next scsi scan

2023-11-06 Thread Hongxing Zhu
Hi Heinrich:
Thanks a lot for your kindly help.
This should be final solution that I'm looking for.

Best Regards
Richard Zhu

> -Original Message-
> From: Heinrich Schuchardt 
> Sent: 2023年11月5日 4:57
> To: Simon Glass ; Hongxing Zhu 
> Cc: u-boot@lists.denx.de
> Subject: Re: uboot reports adding disk failed(EFI_NOT_FOUND) and first disk is
> gone in next scsi scan
>
>
>
> Am 4. November 2023 21:43:52 OEZ schrieb Simon Glass :
> >Hi Richard,
> >
> >+Heinrich as I think this is an EFI bug.
> >
> >On Thu, 2 Nov 2023 at 19:37, Hongxing Zhu  wrote:
> >>
> >> Hi Simon:
> >> I found that the EFI complained that the disk install path is not updated 
> >> for the
> second disk.
> >> The install path is “EFI: installed device path
> '/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/Scsi(0,0)'”
> >>
> >> when first disk is added.
>
> This should be fixed this in U-Boot v2023.10.
>
> https://github.co/
> m%2Ftrini%2Fu-boot%2Fcommit%2Fe07368ea57d224557570a6715dcffdbc88
> 3a8079&data=05%7C01%7Chongxing.zhu%40nxp.com%7C230e39d1ae0f4ca6
> 8e5908dbdd7886c7%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C
> 638347281952590225%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwM
> DAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C
> &sdata=qA0QiEsA55y99hci7ExA6qydfoxp5f7Jg1hmgtYvBUI%3D&reserved=0
>
> Best regards
>
> Heinrich
>
> >>
> >> But the path is same when the second or later disks are added, and EFI 
> >> repors
> that the path had been installed already.
> >> EFI: Path /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/Scsi(0,0)
> >> already installed
> >>
> >>
> >>
> >> That’s why the below error when run efi_disk_create_raw() function.
> >>
> >> Adding disk for ahci_scsi.id0lun0 failed
> >> (err=-9223372036854775788/0x8014)
> >>
> >>
> >>
> >> Do you have any clues about this?
> >>
> >> Thanks in advanced.
> >>
> >> Best Regards
> >>
> >> Richard Zhu
> >>
> >>
> >>
> >> From: Hongxing Zhu
> >> Sent: 2023年11月1日 10:57
> >> To: s...@chromium.org
> >> Cc: u-boot@lists.denx.de
> >> Subject: uboot reports adding disk failed(EFI_NOT_FOUND) and first
> >> disk is gone in next scsi scan
> >>
> >>
> >>
> >> Hi Simon:
> >> Nice to meet you.
> >> The u-boot I used is based on v2023.04 tagged version.
> >> Layerscape LX2160A RDB board has four SATA controllers.
> >> Based on LX2160A RDB board and two or more SATA disks connected.
> >> I encounter one “scsi scan” problem.
> >>
> >>
> >> After the first SATA disk is detected and probed properly in the first 
> >> “scsi
> scan”.
> >> The other disks would complain that “EFI_NOT_FOUND” error listed
> >> below, when run the first “scsi scan” command in uboot environment.
> >>
> >> Does this error matter?
> >> BTW, “scsi info” says that all disk info can be dumped, and all disks
> >> are works well,
> >>
> >> after the first “scsi scan”
> >>
> >> In the consecutive rescan operations issued by “scsi reset” or “scsi
> >> scan” commends, the disks would report “unable to unbind devices (-1E)”
> error.
> >> The first disk is disappeared at all after the next “scsi scan” operations 
> >> is
> finished.
> >>
> >>
> >> Did you used to encounter such kind of issue?
> >>
> >> Any suggestions and guidance are very appreciated.
> >>
> >> Logs:
> >> => scsi scan
> >>
> >> scanning bus for devices...
> >>
> >> Target spinup took 0 ms.
> >>
> >> AHCI 0001.0301 32 slots 1 ports 6 Gbps 0x1 impl SATA mode
> >>
> >> flags: 64bit ncq pm clo only pmp fbss pio slum part ccc apst
> >>
> >>   Device 0: (0:0) Vendor: ATA Prod.: ST1000DM010-2EP1 Rev: CC43
> >>
> >> Type: Hard Disk
> >>
> >> Capacity: 953869.7 MB = 931.5 GB (1953525168 x 512)
> >>
> >> Target spinup took 0 ms.
> >>
> >> AHCI 0001.0301 32 slots 1 ports 6 Gbps 0x1 impl SATA mode
> >>
> >> flags: 64bit ncq pm clo only pmp fbss pio slum part ccc apst
> >>
> >> Adding disk for ahci_scsi.id0lun0 failed
> >> (err=-9223372036854775788/0x8014)
> >>
> >> SATA link 0 timeout.
> >>
> >> AHCI 0001.0301 32 slots 1 ports 6 Gbps 0x1 impl SATA mode
> >>
> >> flags: 64bit ncq pm clo only pmp fbss pio slum part ccc apst
> >>
> >> SATA link 0 timeout.
> >>
> >> AHCI 0001.0301 32 slots 1 ports 6 Gbps 0x1 impl SATA mode
> >>
> >> flags: 64bit ncq pm clo only pmp fbss pio slum part ccc apst => scsi
> >> info
> >>
> >> Device 0: (0:0) Vendor: ATA Prod.: ST1000DM010-2EP1 Rev: CC43
> >>
> >> Type: Hard Disk
> >>
> >> Capacity: 953869.7 MB = 931.5 GB (1953525168 x 512)
> >>
> >> Device 1: (0:0) Vendor: ATA Prod.: ST500DM002-1BD14 Rev: KC45
> >>
> >> Type: Hard Disk
> >>
> >> Capacity: 476940.0 MB = 465.7 GB (976773168 x 512)
> >>
> >> => ls scsi 0:1
> >>
> >>4096 .
> >>
> >>4096 ..
> >>
> >>   16384 lost+found
> >>
> >> 
> >>
> >>4096 var
> >>
> >>  12 linuxrc
> >>
> >> => ls scsi 1:1
> >>
> >>4096 .
> >>
> >>4096 ..
> >>
> >>   16384 lost+found
> >>
> >> 
> >>
> >>4096 usr
> >>
> >>4096 var
> >>
> >>
>

Re: [PATCH v1 0/5] Convert recently merged T30 boards to use DM PMIC

2023-11-06 Thread Peter Robinson
On Mon, Nov 6, 2023 at 11:58 AM Svyatoslav Ryhel  wrote:
>
> пн, 6 лист. 2023 р. о 13:46 Peter Robinson  пише:
> >
> > Hi Svyatoslav,
> >
> > > Since the proposed PMIC patches have been accepted, I see the need
> > > to convert boards which I maintain to use DM drivers instead of board 
> > > hacks.
> > >
> > > Svyatoslav Ryhel (5):
> > >   board: lg-x3: convert LG Optimus 4X and Vu to use DM PMIC
> > >   board: endeavoru: convert HTC One X to use DM PMIC
> >
> > Is there a reason why the two above devices don't appear to have their
> > .dts files in the upstream kernel?
> >
>
> Yes, there is a reason. Linux maintainers treat submitters as
> existential enemies or as dirt at least. I was trying to work with
> linux but I have no desire to spend any time to upstream endeavoru or
> lg_x3.

The usual policy for acceptance into U-Boot is to have upstream review
in the kernel first.

> > >   board: transformer-t30: convert ASUS Transformers to use DM PMIC
> > >   board: grouper: convert ASUS Google Nexus 7 (2012) to use DM PMIC
> > >   ARM: dts: tegra30: enable USB PHY node on some devices
> > >
> > >  arch/arm/dts/tegra30-asus-grouper-common.dtsi |   7 +
> > >  .../dts/tegra30-asus-nexus7-grouper-E1565.dts |   1 +
> > >  .../dts/tegra30-asus-nexus7-grouper-PM269.dts |   1 +
> > >  .../dts/tegra30-asus-nexus7-tilapia-E1565.dts |   1 +
> > >  arch/arm/dts/tegra30-asus-p1801-t.dts |  17 ++
> > >  arch/arm/dts/tegra30-asus-tf600t.dts  |  15 ++
> > >  arch/arm/dts/tegra30-asus-transformer.dtsi|   9 +
> > >  arch/arm/dts/tegra30-htc-endeavoru.dts|   8 +
> > >  arch/arm/dts/tegra30-lg-x3.dtsi   |   9 +
> > >  board/asus/grouper/Kconfig|   8 -
> > >  board/asus/grouper/Makefile   |   4 +-
> > >  .../asus/grouper/configs/grouper_E1565.config |   6 +-
> > >  .../asus/grouper/configs/grouper_PM269.config |   6 +-
> > >  board/asus/grouper/configs/tilapia.config |   6 +-
> > >  board/asus/grouper/grouper-spl-max.c  |   2 +-
> > >  board/asus/grouper/grouper-spl-ti.c   |   2 +-
> > >  board/asus/grouper/grouper.c  | 154 +-
> > >  board/asus/transformer-t30/Kconfig|  10 --
> > >  .../transformer-t30/configs/tf600t.config |   2 +-
> > >  .../transformer-t30/transformer-t30-spl.c |   2 +-
> > >  board/asus/transformer-t30/transformer-t30.c  | 121 +-
> > >  board/htc/endeavoru/endeavoru-spl.c   |   2 +-
> > >  board/htc/endeavoru/endeavoru.c   |  72 +---
> > >  board/lg/x3-t30/x3-t30-spl.c  |   2 +-
> > >  board/lg/x3-t30/x3-t30.c  |  97 +--
> > >  configs/endeavoru_defconfig   |   4 +
> > >  configs/grouper_common_defconfig  |   1 +
> > >  configs/transformer_t30_defconfig |   5 +
> > >  configs/x3_t30_defconfig  |   4 +
> > >  29 files changed, 128 insertions(+), 450 deletions(-)
> > >
> > > --
> > > 2.40.1
> > >


Re: [PATCH v1 0/5] Convert recently merged T30 boards to use DM PMIC

2023-11-06 Thread Svyatoslav Ryhel
пн, 6 лист. 2023 р. о 15:13 Peter Robinson  пише:
>
> On Mon, Nov 6, 2023 at 11:58 AM Svyatoslav Ryhel  wrote:
> >
> > пн, 6 лист. 2023 р. о 13:46 Peter Robinson  пише:
> > >
> > > Hi Svyatoslav,
> > >
> > > > Since the proposed PMIC patches have been accepted, I see the need
> > > > to convert boards which I maintain to use DM drivers instead of board 
> > > > hacks.
> > > >
> > > > Svyatoslav Ryhel (5):
> > > >   board: lg-x3: convert LG Optimus 4X and Vu to use DM PMIC
> > > >   board: endeavoru: convert HTC One X to use DM PMIC
> > >
> > > Is there a reason why the two above devices don't appear to have their
> > > .dts files in the upstream kernel?
> > >
> >
> > Yes, there is a reason. Linux maintainers treat submitters as
> > existential enemies or as dirt at least. I was trying to work with
> > linux but I have no desire to spend any time to upstream endeavoru or
> > lg_x3.
>
> The usual policy for acceptance into U-Boot is to have upstream review
> in the kernel first.
>

May you point to a policy which clearly and explicitly states this as
a mandatory condition?

> > > >   board: transformer-t30: convert ASUS Transformers to use DM PMIC
> > > >   board: grouper: convert ASUS Google Nexus 7 (2012) to use DM PMIC
> > > >   ARM: dts: tegra30: enable USB PHY node on some devices
> > > >
> > > >  arch/arm/dts/tegra30-asus-grouper-common.dtsi |   7 +
> > > >  .../dts/tegra30-asus-nexus7-grouper-E1565.dts |   1 +
> > > >  .../dts/tegra30-asus-nexus7-grouper-PM269.dts |   1 +
> > > >  .../dts/tegra30-asus-nexus7-tilapia-E1565.dts |   1 +
> > > >  arch/arm/dts/tegra30-asus-p1801-t.dts |  17 ++
> > > >  arch/arm/dts/tegra30-asus-tf600t.dts  |  15 ++
> > > >  arch/arm/dts/tegra30-asus-transformer.dtsi|   9 +
> > > >  arch/arm/dts/tegra30-htc-endeavoru.dts|   8 +
> > > >  arch/arm/dts/tegra30-lg-x3.dtsi   |   9 +
> > > >  board/asus/grouper/Kconfig|   8 -
> > > >  board/asus/grouper/Makefile   |   4 +-
> > > >  .../asus/grouper/configs/grouper_E1565.config |   6 +-
> > > >  .../asus/grouper/configs/grouper_PM269.config |   6 +-
> > > >  board/asus/grouper/configs/tilapia.config |   6 +-
> > > >  board/asus/grouper/grouper-spl-max.c  |   2 +-
> > > >  board/asus/grouper/grouper-spl-ti.c   |   2 +-
> > > >  board/asus/grouper/grouper.c  | 154 +-
> > > >  board/asus/transformer-t30/Kconfig|  10 --
> > > >  .../transformer-t30/configs/tf600t.config |   2 +-
> > > >  .../transformer-t30/transformer-t30-spl.c |   2 +-
> > > >  board/asus/transformer-t30/transformer-t30.c  | 121 +-
> > > >  board/htc/endeavoru/endeavoru-spl.c   |   2 +-
> > > >  board/htc/endeavoru/endeavoru.c   |  72 +---
> > > >  board/lg/x3-t30/x3-t30-spl.c  |   2 +-
> > > >  board/lg/x3-t30/x3-t30.c  |  97 +--
> > > >  configs/endeavoru_defconfig   |   4 +
> > > >  configs/grouper_common_defconfig  |   1 +
> > > >  configs/transformer_t30_defconfig |   5 +
> > > >  configs/x3_t30_defconfig  |   4 +
> > > >  29 files changed, 128 insertions(+), 450 deletions(-)
> > > >
> > > > --
> > > > 2.40.1
> > > >


Re: [PATCH v6 08/25] spl: Refactor spl_load_info->read to use units of bytes

2023-11-06 Thread Sean Anderson

On 11/6/23 07:35, Xavier Drudis Ferran wrote:

Thanks for your work. I'm still reading... but...


El Sun, Nov 05, 2023 at 09:25:46PM -0500, Sean Anderson deia:

diff --git a/include/spl.h b/include/spl.h
index 951e136b9ea..ecfc50e0095 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -297,10 +297,10 @@ struct spl_load_info {
 * read() - Read from device
 *
 * @load: Information about the load state
-* @sector: Sector number to read from (each @load->bl_len bytes)
-* @count: Number of sectors to read
+* @offset: Offset to read from in bytes, in multiples of @load->bl_len
+* @count: Number of bytes to read, in multiples of @load->bl_len


I'm no native English speaker, but would it be easier to understand? :

+* @offset: Offset to read from in bytes, a multiple of @load->bl_len
+* @count: Number of bytes to read, a multiple of @load->bl_len





I think it would have to be worded

@offset: Offset to read from in bytes, as a multiple of @load->bl_len

but to me these both mean the same thing.

--Sean


Re: [PATCH v1 0/5] Convert recently merged T30 boards to use DM PMIC

2023-11-06 Thread Peter Robinson
On Mon, Nov 6, 2023 at 1:28 PM Svyatoslav Ryhel  wrote:
>
> пн, 6 лист. 2023 р. о 15:13 Peter Robinson  пише:
> >
> > On Mon, Nov 6, 2023 at 11:58 AM Svyatoslav Ryhel  wrote:
> > >
> > > пн, 6 лист. 2023 р. о 13:46 Peter Robinson  пише:
> > > >
> > > > Hi Svyatoslav,
> > > >
> > > > > Since the proposed PMIC patches have been accepted, I see the need
> > > > > to convert boards which I maintain to use DM drivers instead of board 
> > > > > hacks.
> > > > >
> > > > > Svyatoslav Ryhel (5):
> > > > >   board: lg-x3: convert LG Optimus 4X and Vu to use DM PMIC
> > > > >   board: endeavoru: convert HTC One X to use DM PMIC
> > > >
> > > > Is there a reason why the two above devices don't appear to have their
> > > > .dts files in the upstream kernel?
> > > >
> > >
> > > Yes, there is a reason. Linux maintainers treat submitters as
> > > existential enemies or as dirt at least. I was trying to work with
> > > linux but I have no desire to spend any time to upstream endeavoru or
> > > lg_x3.
> >
> > The usual policy for acceptance into U-Boot is to have upstream review
> > in the kernel first.
> >
>
> May you point to a policy which clearly and explicitly states this as
> a mandatory condition?

There have been a number of devices rejected in the past until their
DT are upstream but I'll leave Tom, who I've explicitly added on cc:,
to clarify the exact policy.

> > > > >   board: transformer-t30: convert ASUS Transformers to use DM PMIC
> > > > >   board: grouper: convert ASUS Google Nexus 7 (2012) to use DM PMIC
> > > > >   ARM: dts: tegra30: enable USB PHY node on some devices
> > > > >
> > > > >  arch/arm/dts/tegra30-asus-grouper-common.dtsi |   7 +
> > > > >  .../dts/tegra30-asus-nexus7-grouper-E1565.dts |   1 +
> > > > >  .../dts/tegra30-asus-nexus7-grouper-PM269.dts |   1 +
> > > > >  .../dts/tegra30-asus-nexus7-tilapia-E1565.dts |   1 +
> > > > >  arch/arm/dts/tegra30-asus-p1801-t.dts |  17 ++
> > > > >  arch/arm/dts/tegra30-asus-tf600t.dts  |  15 ++
> > > > >  arch/arm/dts/tegra30-asus-transformer.dtsi|   9 +
> > > > >  arch/arm/dts/tegra30-htc-endeavoru.dts|   8 +
> > > > >  arch/arm/dts/tegra30-lg-x3.dtsi   |   9 +
> > > > >  board/asus/grouper/Kconfig|   8 -
> > > > >  board/asus/grouper/Makefile   |   4 +-
> > > > >  .../asus/grouper/configs/grouper_E1565.config |   6 +-
> > > > >  .../asus/grouper/configs/grouper_PM269.config |   6 +-
> > > > >  board/asus/grouper/configs/tilapia.config |   6 +-
> > > > >  board/asus/grouper/grouper-spl-max.c  |   2 +-
> > > > >  board/asus/grouper/grouper-spl-ti.c   |   2 +-
> > > > >  board/asus/grouper/grouper.c  | 154 
> > > > > +-
> > > > >  board/asus/transformer-t30/Kconfig|  10 --
> > > > >  .../transformer-t30/configs/tf600t.config |   2 +-
> > > > >  .../transformer-t30/transformer-t30-spl.c |   2 +-
> > > > >  board/asus/transformer-t30/transformer-t30.c  | 121 +-
> > > > >  board/htc/endeavoru/endeavoru-spl.c   |   2 +-
> > > > >  board/htc/endeavoru/endeavoru.c   |  72 +---
> > > > >  board/lg/x3-t30/x3-t30-spl.c  |   2 +-
> > > > >  board/lg/x3-t30/x3-t30.c  |  97 +--
> > > > >  configs/endeavoru_defconfig   |   4 +
> > > > >  configs/grouper_common_defconfig  |   1 +
> > > > >  configs/transformer_t30_defconfig |   5 +
> > > > >  configs/x3_t30_defconfig  |   4 +
> > > > >  29 files changed, 128 insertions(+), 450 deletions(-)
> > > > >
> > > > > --
> > > > > 2.40.1
> > > > >


Re: [PATCH 03/15] board: ti: j721e: evm: Drop board check for ESM

2023-11-06 Thread Kumar, Udit



On 11/6/2023 5:49 PM, Nishanth Menon wrote:

On 16:03-20231104, Kumar, Udit wrote:

On 11/3/2023 6:07 AM, Nishanth Menon wrote:

When config is enabled, the esm dt probe makes sense. Simplify by
dropping board specific checks.

Signed-off-by: Nishanth Menon 
---
   board/ti/j721e/evm.c | 10 ++
   1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c
index d4f7c1d9f938..75d51a0552c4 100644
--- a/board/ti/j721e/evm.c
+++ b/board/ti/j721e/evm.c
@@ -531,10 +531,8 @@ err_free_gpio:
   void spl_board_init(void)
   {
-#if defined(CONFIG_ESM_K3) || defined(CONFIG_ESM_PMIC)
struct udevice *dev;
int ret;
-#endif
if ((IS_ENABLED(CONFIG_TARGET_J721E_A72_EVM) ||
 IS_ENABLED(CONFIG_TARGET_J7200_A72_EVM)) &&
@@ -543,24 +541,20 @@ void spl_board_init(void)
probe_daughtercards();
}
-#ifdef CONFIG_ESM_K3
-   if (board_ti_k3_is("J721EX-PM2-SOM")) {
+   if (IS_ENABLED(CONFIG_ESM_K3)) {
ret = uclass_get_device_by_driver(UCLASS_MISC,
  DM_DRIVER_GET(k3_esm), &dev);
if (ret)
printf("ESM init failed: %d\n", ret);
}

Nothing related to this patch, but to get esm completely functional

Second k3_esm probing needs to be added in this file.


Also, DT changes are needed, in next sync

https://lore.kernel.org/all/20231013102941.548209-1-n-fran...@ti.com/



Understood. no action on the current series, I assume.


yes, no action on current series.

Reviewed-by: Udit Kumar 




Re: [PATCH 01/15] arm: mach-k3: j721e: Improve support for UDA FS

2023-11-06 Thread Kumar, Udit



On 11/6/2023 5:48 PM, Nishanth Menon wrote:

On 15:54-20231104, Kumar, Udit wrote:

On 11/3/2023 6:07 AM, Nishanth Menon wrote:

Commit 5019170970ad ("arch: arm: mach-k3: j721e: add support for UDA
FS") introduced basic UDA FS support, however, we can Take approach
similar to commit 0f1c1e8b368b ("arm: mach-k3: am625: Add support for
UDA FS"). While boot partition support with EMMC boot is useful, it is
constrained by the size of boot hardware partition itself.

In the case of K3 devices, tispl images can contain OP-TEE images that
can substantially vary in size and the u-boot image itself can vary over
time as we enable various features.

So use the CSD information in the case of EMMC_BOOT configuration being
enabled to pick boot partition or UDA FS mode operation to pick.

If EMMC_BOOT is disabled, then depend on filesystem configuration to
pick data from UDA.

I am thinking, in which case we have EMMC_BOOT disabled,

Case here I am considering, updating u-boot to eMMC from u-boot shell, If
EMMC_BOOT

is not set then , we can not set CSD information


Yes, but we cannot use boot0 mode of operation for Beagle family. the
size of u-boot and optee vary over time and SK's boot0 partition
strategy does'nt work for Beagle platforms.



Thanks, I was not aware of this limitation of Beagle family.

Let each board chose needed config with that

Reviewed-by: Udit Kumar 


Signed-off-by: Nishanth Menon 
---
   arch/arm/mach-k3/j721e_init.c | 9 -
   1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-k3/j721e_init.c b/arch/arm/mach-k3/j721e_init.c
index b1f7e25ed092..bcdfbfc79c4a 100644
--- a/arch/arm/mach-k3/j721e_init.c
+++ b/arch/arm/mach-k3/j721e_init.c
@@ -294,7 +294,14 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 
boot_device)
   {
switch (boot_device) {
case BOOT_DEVICE_MMC1:
-   return (spl_mmc_emmc_boot_partition(mmc) ? MMCSD_MODE_EMMCBOOT 
: MMCSD_MODE_FS);
+   if (IS_ENABLED(CONFIG_SUPPORT_EMMC_BOOT)) {
+   if (spl_mmc_emmc_boot_partition(mmc))
+   return MMCSD_MODE_EMMCBOOT;
+   return MMCSD_MODE_FS;
+   }

I had a view EMMC_BOOT should be needed config.



+   if (IS_ENABLED(CONFIG_SPL_FS_FAT) || 
IS_ENABLED(CONFIG_SPL_FS_EXT4))
+   return MMCSD_MODE_FS;
+   return MMCSD_MODE_EMMCBOOT;

If you consider, to make EMMC_BOOT as needed config, then this is not needed

EMMC_BOOT is not a mandatory config.



case BOOT_DEVICE_MMC2:
return MMCSD_MODE_FS;
default:


Re: [PATCH 4/5] doc: board: Move am62x_beagleplay to it's own vendor

2023-11-06 Thread Bryan Brattlof
Hi Nishanth!

On November  4, 2023 thus sayeth Nishanth Menon:
> Move BeaglePlay documentation to beagle as a board vendor and update
> references accordingly.
> 
> Signed-off-by: Nishanth Menon 

Reviewed-by: Bryan Brattlof 

> ---
>  doc/board/{ti => beagle}/am62x_beagleplay.rst | 22 +--
>  .../{ti => beagle}/img/beagleplay_emmc.svg|  0
>  doc/board/beagle/index.rst| 13 +++
>  doc/board/index.rst   |  1 +
>  doc/board/ti/k3.rst   |  2 +-
>  5 files changed, 26 insertions(+), 12 deletions(-)
>  rename doc/board/{ti => beagle}/am62x_beagleplay.rst (96%)
>  rename doc/board/{ti => beagle}/img/beagleplay_emmc.svg (100%)
>  create mode 100644 doc/board/beagle/index.rst
> 

Looks good to me :)

~Bryan


Re: [PATCH v2] arm64: zynqmp: Introduce kria SOM defconfig

2023-11-06 Thread Michal Simek




On 11/1/23 06:34, Venkatesh Yadav Abbarapu wrote:

Enable the initial kria SOM specific configurations like pinctrl,
pinconf etc. Also add the environment file.

Signed-off-by: Venkatesh Yadav Abbarapu 
---
Changes in v2:
- Updated the CONFIG_ENV_OFFSET_REDUND
- Updated the CONFIG_SF_DEFAULT_SPEED to 3000
- Enabled the CONFIG_VIDEO_ZYNQMP_DPSUB
- Fixed minor changes in zynqmp_kria.env
---
  board/xilinx/zynqmp/zynqmp_kria.env  |  67 
  configs/xilinx_zynqmp_kria_defconfig | 227 +++
  2 files changed, 294 insertions(+)
  create mode 100644 board/xilinx/zynqmp/zynqmp_kria.env
  create mode 100644 configs/xilinx_zynqmp_kria_defconfig

diff --git a/board/xilinx/zynqmp/zynqmp_kria.env 
b/board/xilinx/zynqmp/zynqmp_kria.env
new file mode 100644
index 00..9140694d41
--- /dev/null
+++ b/board/xilinx/zynqmp/zynqmp_kria.env
@@ -0,0 +1,67 @@
+autoload=no
+baudrate=115200
+boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} 
${prefix}${script}; source ${scriptaddr}
+boot_efi_binary=if fdt addr ${fdt_addr_r}; then bootefi bootmgr 
${fdt_addr_r};else bootefi bootmgr ${fdtcontroladdr};fi;load ${devtype} 
${devnum}:${distro_bootpart} ${kernel_addr_r} efi/boot/bootaa64.efi; if fdt 
addr ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_addr_r};else bootefi 
${kernel_addr_r} ${fdtcontroladdr};fi
+boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any 
${scriptaddr} ${prefix}${boot_syslinux_conf}
+boot_net_usb_start=usb start
+boot_prefixes=/ /boot/
+boot_script_dhcp=boot.scr.uimg
+boot_scripts=boot.scr.uimg boot.scr
+boot_syslinux_conf=extlinux/extlinux.conf
+bootcmd_dhcp=run boot_net_usb_start; if dhcp ${scriptaddr} 
${boot_script_dhcp}; then source ${scriptaddr}; fi;setenv efi_fdtfile 
${fdtfile}; setenv efi_old_vci ${bootp_vci};setenv efi_old_arch 
${bootp_arch};setenv bootp_vci PXEClient:Arch:00011:UNDI:003000;setenv 
bootp_arch 0xb;if dhcp ${kernel_addr_r}; then tftpboot ${fdt_addr_r} 
dtb/${efi_fdtfile};if fdt addr ${fdt_addr_r}; then bootefi ${kernel_addr_r} 
${fdt_addr_r}; else bootefi ${kernel_addr_r} ${fdtcontroladdr};fi;fi;setenv 
bootp_vci ${efi_old_vci};setenv bootp_arch ${efi_old_arch};setenv 
efi_fdtfile;setenv efi_old_arch;setenv efi_old_vci;
+bootcmd_jtag=echo JTAG: Trying to boot script at ${scriptaddr} && source 
${scriptaddr}; echo JTAG: SCRIPT FAILED: continuing...;
+bootcmd_mmc0=devnum=0; run mmc_boot
+bootcmd_mmc1=devnum=1; run mmc_boot
+bootcmd_pxe=run boot_net_usb_start; dhcp; if pxe get; then pxe boot; fi
+bootcmd_usb0=devnum=0; run usb_boot
+bootcmd_usb1=devnum=1; run usb_boot
+bootcmd_usb2=devnum=2; run usb_boot
+bootcmd_usb3=devnum=3; run usb_boot
+bootdelay=2
+bootfstype=fat
+bootm_low=0
+bootm_size=0x8000
+distro_bootcmd=scsi_need_init=; for target in ${boot_targets}; do run 
bootcmd_${target}; done
+efi_dtb_prefixes=/ /dtb/ /dtb/current/
+fdt_addr_r=0x4000
+fdt_high=0x1000
+fileaddr=0x1800
+initrd_high=0x7900
+kernel_addr_r=0x1800
+load_efi_dtb=load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} 
${prefix}${efi_fdtfile}
+mmc_boot=if mmc dev ${devnum}; then devtype=mmc; run scan_dev_for_boot_part; fi
+pxefile_addr_r=0x1000
+ramdisk_addr_r=0x0210
+scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}...; 
for prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run 
scan_dev_for_scripts; done;run scan_dev_for_efi;
+scan_dev_for_boot_part=part list ${devtype} ${devnum} -bootable devplist; env 
exists devplist || setenv devplist 1; for distro_bootpart in ${devplist}; do if 
fstype ${devtype} ${devnum}:${distro_bootpart} bootfstype; then run 
scan_dev_for_boot; fi; done; setenv devplist
+scan_dev_for_efi=setenv efi_fdtfile ${fdtfile}; for prefix in 
${efi_dtb_prefixes}; do if test -e ${devtype} ${devnum}:${distro_bootpart} 
${prefix}${efi_fdtfile}; then run load_efi_dtb; fi;done;if test -e ${devtype} 
${devnum}:${distro_bootpart} efi/boot/bootaa64.efi; then echo Found EFI 
removable media binary efi/boot/bootaa64.efi; run boot_efi_binary; echo EFI 
LOAD FAILED: continuing...; fi; setenv efi_fdtfile
+scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} 
${prefix}${boot_syslinux_conf}; then echo Found ${prefix}${boot_syslinux_conf}; 
run boot_extlinux; echo SCRIPT FAILED: continuing...; fi
+scan_dev_for_scripts=for script in ${boot_scripts}; do if test -e ${devtype} 
${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot script 
${prefix}${script}; run boot_a_script; echo SCRIPT FAILED: continuing...; fi; 
done
+script_offset_f=0x3e8
+script_size_f=0x8
+scriptaddr=0x2000
+usb_boot=usb start; if usb dev ${devnum}; then devtype=usb; run 
scan_dev_for_boot_part; fi
+preboot=setenv boot_targets; setenv modeboot; run board_setup
+
+# SOM specific boot methods
+som_cc_boot=if test ${card1_name} = SCK-KV-G; then setenv boot_targets mmc1 usb0 usb1 usb2 usb3 pxe dhcp 
&& run distro_bootcmd; elif test ${card1_name} = SCK

Re: [PATCH 3/5] board: Move beagleplay under beagle vendor folder

2023-11-06 Thread Bryan Brattlof
Hi Nishanth!

On November  4, 2023 thus sayeth Nishanth Menon:
> Move beagleplay support away from ti/am62x to it's own beagle vendor
> folder.
> 
> This forms the starting point for new beagle platforms added under it's
> own board vendor folder.
> 
> As part of this create all the associated files with a bare minimum
> beagleplay.c file.
> 
> Suggested-by: Andrew Davis 
> Signed-off-by: Nishanth Menon 

Reviewed-by: Bryan Brattlof 


> ---
>  arch/arm/mach-k3/Kconfig  |1 +
>  board/beagle/beagleplay/Kconfig   |   60 +
>  board/beagle/beagleplay/MAINTAINERS   |6 +
>  board/beagle/beagleplay/Makefile  |9 +
>  board/beagle/beagleplay/beagleplay.c  |   29 +
>  .../beagleplay}/beagleplay.env|0
>  board/beagle/beagleplay/board-cfg.yaml|   36 +
>  board/beagle/beagleplay/pm-cfg.yaml   |   12 +
>  board/beagle/beagleplay/rm-cfg.yaml   | 1088 +
>  board/beagle/beagleplay/sec-cfg.yaml  |  379 ++
>  board/ti/am62x/MAINTAINERS|7 -
>  configs/am62x_beagleplay_a53_defconfig|3 +-
>  configs/am62x_beagleplay_r5_defconfig |3 +-
>  13 files changed, 1622 insertions(+), 11 deletions(-)
>  create mode 100644 board/beagle/beagleplay/Kconfig
>  create mode 100644 board/beagle/beagleplay/MAINTAINERS
>  create mode 100644 board/beagle/beagleplay/Makefile
>  create mode 100644 board/beagle/beagleplay/beagleplay.c
>  rename board/{ti/am62x => beagle/beagleplay}/beagleplay.env (100%)
>  create mode 100644 board/beagle/beagleplay/board-cfg.yaml
>  create mode 100644 board/beagle/beagleplay/pm-cfg.yaml
>  create mode 100644 board/beagle/beagleplay/rm-cfg.yaml
>  create mode 100644 board/beagle/beagleplay/sec-cfg.yaml
> 

~Bryan


[GIT PULL] Please pull u-boot-amlogic-20231106

2023-11-06 Thread Neil Armstrong

Hi Tom,

A little set of fix for:
- also enable DFU RAM boot for libretech-ac, since it uses a different config 
header
- SM probe fix
- A1 USB missing clocks

The CI job is at 
https://source.denx.de/u-boot/custodians/u-boot-amlogic/pipelines/18452

Thanks,
Neil

The following changes since commit a4c83bda17196bf5d1ce640844595aaeced6465e:

  Merge branch '2023-11-03-assorted-tegra-improvements' (2023-11-04 09:55:39 
-0400)

are available in the Git repository at:

  https://source.denx.de/u-boot/custodians/u-boot-amlogic.git 
tags/u-boot-amlogic-20231106

for you to fetch changes up to c550e81171940932664a85bda315a6a073aae23c:

  ARM: configs: libretech-ac: enable USB_DFU like in meson64.h (2023-11-06 
09:46:05 +0100)


- fixup to also enabled DFU RAM boot for libretech-ac
- sm fix to bind child sm devices in the device tree
- add missing A1 clocks for USB stack


Alexey Romanov (1):
  clk: a1: add new clocks for USB stack

Dmitry Rokosov (1):
  drivers: sm: bind child sm devices in the device tree

Neil Armstrong (1):
  ARM: configs: libretech-ac: enable USB_DFU like in meson64.h

 drivers/clk/meson/a1.c | 6 ++
 drivers/sm/meson-sm.c  | 1 +
 include/configs/libretech-ac.h | 1 +
 3 files changed, 8 insertions(+)


Re: [PATCH 1/5] arm: dts: k3-am625-beagleplay-u-boot/r5: Just depend on k3-binman.dtsi

2023-11-06 Thread Bryan Brattlof
Hi Nishanth!

On November  4, 2023 thus sayeth Nishanth Menon:
> With the upcoming folder separation, there is no further need to depend
> on am625-binman.dtsi. Duplicate the existing definitions to u-boot.dtsi
> and r5.dts as appropriate.
> 
> Signed-off-by: Nishanth Menon 

Reviewed-by: Bryan Brattlof 

> ---
>  arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi | 160 +--
>  arch/arm/dts/k3-am625-r5-beagleplay.dts  |  39 +
>  2 files changed, 184 insertions(+), 15 deletions(-)

...

> -&spl_am625_sk_dtb_unsigned {
> - filename = SPL_AM625_BEAGLEPLAY_DTB;
> -};
> + ti-spl_unsigned {
> + filename = "tispl.bin_unsigned";

If all of the beagle-plays are using the GP security variant shouldn't 
we remove the _unsigned?

> + pad-byte = <0xff>;
> +

...

> -&am625_sk_dtb_unsigned {
> - filename = AM625_BEAGLEPLAY_DTB;
> + u-boot_unsigned {
> + filename = "u-boot.img_unsigned";

And here? I don't really have an opinion either way. Just curious if 
we've thought about that.

> + pad-byte = <0xff>;
> +

~Bryan



Re: [PATCH 1/5] arm: dts: k3-am625-beagleplay-u-boot/r5: Just depend on k3-binman.dtsi

2023-11-06 Thread Nishanth Menon
On 08:34-20231106, Bryan Brattlof wrote:
> Hi Nishanth!
> 
> On November  4, 2023 thus sayeth Nishanth Menon:
> > With the upcoming folder separation, there is no further need to depend
> > on am625-binman.dtsi. Duplicate the existing definitions to u-boot.dtsi
> > and r5.dts as appropriate.
> > 
> > Signed-off-by: Nishanth Menon 
> 
> Reviewed-by: Bryan Brattlof 
> 
> > ---
> >  arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi | 160 +--
> >  arch/arm/dts/k3-am625-r5-beagleplay.dts  |  39 +
> >  2 files changed, 184 insertions(+), 15 deletions(-)
> 
> ...
> 
> > -&spl_am625_sk_dtb_unsigned {
> > -   filename = SPL_AM625_BEAGLEPLAY_DTB;
> > -};
> > +   ti-spl_unsigned {
> > +   filename = "tispl.bin_unsigned";
> 
> If all of the beagle-plays are using the GP security variant shouldn't 
> we remove the _unsigned?

Today, they are GP, but there is already plans being discussed for
hs-fs variants - timelines aren't very clear though.

> 
> > +   pad-byte = <0xff>;
> > +
> 
> ...
> 
> > -&am625_sk_dtb_unsigned {
> > -   filename = AM625_BEAGLEPLAY_DTB;
> > +   u-boot_unsigned {
> > +   filename = "u-boot.img_unsigned";
> 
> And here? I don't really have an opinion either way. Just curious if 
> we've thought about that.
> 
> > +   pad-byte = <0xff>;
> > +
> 
> ~Bryan
> 

-- 
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 
849D 1736 249D


Re: Need advise with u-boot on SH-7785LCR

2023-11-06 Thread John Paul Adrian Glaubitz
Hi Simon,

On Sun, 2023-11-05 at 16:29 +, Simon Glass wrote:
> No, sorry I don't have any idea about that. You could check the
> MAINTAINERS files in U-Boot and Linux for other people, perhaps, or
> check commit / blame logs?

It seems that the flash memory is mapped to block devices by the kernel:

root@tirpitz:~> dmesg|grep -i flash
[1.592000] physmap-flash physmap-flash.0: physmap platform flash device: 
[mem 0x-0x03ff]
[1.604000] physmap-flash.0: Found 2 x16 devices at 0x0 in 32-bit bank. 
Manufacturer ID 0x01 Chip ID 0x002201
[1.632000] Creating 4 MTD partitions on "physmap-flash.0":
root@tirpitz:~> ls -l /dev/mtdblock*
brw-rw 1 root disk 31, 0 Sep 30 12:35 /dev/mtdblock0
brw-rw 1 root disk 31, 1 Sep 30 12:35 /dev/mtdblock1
brw-rw 1 root disk 31, 2 Sep 30 12:35 /dev/mtdblock2
brw-rw 1 root disk 31, 3 Sep 30 12:35 /dev/mtdblock3
root@tirpitz:~>

So, I assume, I should just be able to write u-boot.bin to /dev/mtdblock0?

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913


Re: [PATCH 10/15] configs: j721e_evm_a72_defconfig: Switch to bootstd

2023-11-06 Thread Tom Rini
On Mon, Nov 06, 2023 at 06:21:16AM -0600, Nishanth Menon wrote:
> On 10:58-20231106, Manorit Chawdhry wrote:
> > Hi Nishanth,
> > 
> > On 19:38-20231102, Nishanth Menon wrote:
> > > Switch to using bootstd. Note with this change, we will stop using
> > > distro_bootcmd and instead depend entirely on bootflow method of
> > > starting the system up.
> > > 
> > > Signed-off-by: Nishanth Menon 
> > > ---
> > >  configs/j721e_evm_a72_defconfig | 5 +++--
> > >  1 file changed, 3 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/configs/j721e_evm_a72_defconfig 
> > > b/configs/j721e_evm_a72_defconfig
> > > index 99e0e168ebf7..98ac7ca59789 100644
> > > --- a/configs/j721e_evm_a72_defconfig
> > > +++ b/configs/j721e_evm_a72_defconfig
> > > @@ -29,10 +29,11 @@ CONFIG_SPL_SPI=y
> > >  # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
> > >  CONFIG_SPL_LOAD_FIT=y
> > >  CONFIG_SPL_LOAD_FIT_ADDRESS=0x8100
> > > -CONFIG_DISTRO_DEFAULTS=y
> > >  CONFIG_OF_BOARD_SETUP=y
> > >  CONFIG_OF_SYSTEM_SETUP=y
> > > -CONFIG_BOOTCOMMAND="run envboot; run distro_bootcmd;"
> > > +CONFIG_BOOTSTD_FULL=y
> > > +CONFIG_BOOTSTD_DEFAULTS=y
> > > +CONFIG_BOOTCOMMAND="run envboot; bootflow scan -lb"
> > 
> > Coming back to [0], AM62x didn't have early remote procs but j721e does,
> > do you have any alternatives in place before migrating J7 platforms to
> > stdboot?
> 
> As I have stated before. distro boot support for remote proc has been
> hacked up atm. what needs to happen is standardize it. Which is
> independent of this series.
> 
> Please discuss with stdboot folks how to get it in. WORST case, envboot
> is still supported, so in effect, what is achieved today can still
> continue to occur with envboot.

There's not "stdboot folks" to talk with about this. The first step
would be someone from TI posting some RFC patches about how exactly the
remote proc support should be handled in that case, explaining where the
what being run comes from and so forth. Maybe the answer is that
"envboot" just keeps being defined and run before hand because that's
the standard way to handle what needs doing on those processors? At
least personally I feel like there's a gap in knowledge of what the use
cases here are. Thanks.

-- 
Tom


signature.asc
Description: PGP signature


[PATCH v2 0/5] arm: mach-snapdragon: Qualcomm pinctrl driver cleanup

2023-11-06 Thread Caleb Connolly
This series moves the Qualcomm pinctrl drivers from mach-snapdragon and
mach-ipq40xx to drivers/pinctrl/qcom. It then makes the necessary changes
to enable compatibility with Linux DTs.

The pinctrl hardware on most Qualcomm platforms is made up of "tiles",
these are just banks of pins at different register addresses. The
mapping between pin number and tile is totally arbitrary, this
unfortunately means that it is necessary to have a map of pin to tile in
order to support all pins. Up until now this driver has ignored tiles,
meaning that the pin numbers and DT nodes are entirely different to the
Linux DT and only a subset of pins are addressable.

Patch 2 solves this by introducing the pin_offset map, initially
supporting SDM845. This map is used for all pin register lookups for
both the pinctrl and GPIO drivers. Similarly to the clock/reset drivers
these are both associated with a single DT node, where the pinctrl
driver is responsible for binding the GPIO drivers.

Patch 3 introduces support for gpio-reserved-ranges, this property
is used on some boards to mark pin ranges that shouldn't be touched
(else firmware will trigger a fault and reset the board).

This series loosely depends on the associated clock driver cleanup which can be
found here (Makefile and perhaps DTS conflicts):

https://lore.kernel.org/u-boot/20231103-b4-qcom-clk-v3-0-8d2d460ec...@linaro.org

---
Changes in v2:
* Drop msm -> qcom rename (will be handled in a future patch)
* Drop "handle reserved ranges" patch to be introduced alongside a user
* Re-order APQ4019 move to be the second patch
* Change driver name to pinctrl_qcom instead of qcom_pinctrl
* Add MAINTAINERS entry
* Move shared GPIO header to mach-snapdragon
* Link to v1: 
https://lore.kernel.org/r/20231025-b4-qcom-pinctrl-v1-0-9123d6a21...@linaro.org

---
Caleb Connolly (5):
  pinctrl: qcom: move out of mach-snapdragon
  pinctrl: qcom: move ipq4019 driver from mach-ipq40xx
  pinctrl: qcom: make compatible with linux DTs
  msm_gpio: use unsigned int
  fixup! pinctrl: qcom: make compatible with linux DTs

 MAINTAINERS|   1 +
 arch/arm/Kconfig   |   1 +
 arch/arm/dts/dragonboard845c-uboot.dtsi|   2 +-
 arch/arm/dts/sdm845.dtsi   |  16 +-
 arch/arm/dts/starqltechn-uboot.dtsi|   5 +-
 arch/arm/dts/starqltechn.dts   |  16 +-
 arch/arm/mach-ipq40xx/Makefile |   8 -
 arch/arm/mach-ipq40xx/pinctrl-snapdragon.c | 166 -
 arch/arm/mach-snapdragon/Kconfig   |   4 +
 arch/arm/mach-snapdragon/Makefile  |   5 -
 arch/arm/mach-snapdragon/include/mach/gpio.h   |  28 +++-
 arch/arm/mach-snapdragon/pinctrl-sdm845.c  |  44 --
 arch/arm/mach-snapdragon/pinctrl-snapdragon.h  |  33 
 drivers/gpio/msm_gpio.c|  42 +++---
 drivers/pinctrl/Kconfig|   1 +
 drivers/pinctrl/Makefile   |   1 +
 drivers/pinctrl/qcom/Kconfig   |  46 ++
 drivers/pinctrl/qcom/Makefile  |  10 ++
 .../pinctrl/qcom}/pinctrl-apq8016.c|  21 ++-
 .../pinctrl/qcom}/pinctrl-apq8096.c|  21 ++-
 .../pinctrl/qcom}/pinctrl-ipq4019.c|  25 +++-
 .../pinctrl/qcom/pinctrl-qcom.c|  70 +
 .../pinctrl/qcom/pinctrl-qcom.h|  15 +-
 .../pinctrl/qcom}/pinctrl-qcs404.c |  21 ++-
 drivers/pinctrl/qcom/pinctrl-sdm845.c  | 100 +
 25 files changed, 350 insertions(+), 352 deletions(-)
---
base-commit: 8c5e4ddf52ea3c1e85c44cdd5d5b2e2f6c892b4f

// Caleb (they/them)



[PATCH v2 2/5] pinctrl: qcom: move ipq4019 driver from mach-ipq40xx

2023-11-06 Thread Caleb Connolly
Drop the duplicated pinctrl-snapdragon driver from mach-ipq40xx and add
it to drivers/pinctrl/qcom.

Acked-by: Sumit Garg 
Signed-off-by: Caleb Connolly 
---
 arch/arm/Kconfig   |   1 +
 arch/arm/mach-ipq40xx/Makefile |   8 -
 arch/arm/mach-ipq40xx/pinctrl-snapdragon.c | 166 -
 arch/arm/mach-ipq40xx/pinctrl-snapdragon.h |  30 
 drivers/pinctrl/qcom/Kconfig   |   7 +
 drivers/pinctrl/qcom/Makefile  |   1 +
 .../pinctrl/qcom}/pinctrl-ipq4019.c|  23 ++-
 7 files changed, 27 insertions(+), 209 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 69144ff9cdab..bd48131292e3 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -767,6 +767,7 @@ config ARCH_IPQ40XX
select SMEM
select OF_CONTROL
select CLK_QCOM_IPQ4019
+   select PINCTRL_QCOM_IPQ4019
imply CMD_DM
 
 config ARCH_KEYSTONE
diff --git a/arch/arm/mach-ipq40xx/Makefile b/arch/arm/mach-ipq40xx/Makefile
deleted file mode 100644
index b36a935c6f9f..
--- a/arch/arm/mach-ipq40xx/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0+
-#
-# Copyright (c) 2019 Sartura Ltd.
-#
-# Author: Robert Marko 
-
-obj-y += pinctrl-snapdragon.o
-obj-y += pinctrl-ipq4019.o
diff --git a/arch/arm/mach-ipq40xx/pinctrl-snapdragon.c 
b/arch/arm/mach-ipq40xx/pinctrl-snapdragon.c
deleted file mode 100644
index 036fec93d727..
--- a/arch/arm/mach-ipq40xx/pinctrl-snapdragon.c
+++ /dev/null
@@ -1,166 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * TLMM driver for Qualcomm IPQ40xx
- *
- * (C) Copyright 2018 Ramon Fried 
- *
- * Copyright (c) 2020 Sartura Ltd.
- *
- * Author: Robert Marko 
- *
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include "pinctrl-snapdragon.h"
-
-struct msm_pinctrl_priv {
-   phys_addr_t base;
-   struct msm_pinctrl_data *data;
-};
-
-#define GPIO_CONFIG_OFFSET(x) ((x) * 0x1000)
-#define TLMM_GPIO_PULL_MASK GENMASK(1, 0)
-#define TLMM_FUNC_SEL_MASK GENMASK(5, 2)
-#define TLMM_DRV_STRENGTH_MASK GENMASK(8, 6)
-#define TLMM_GPIO_DISABLE BIT(9)
-
-static const struct pinconf_param msm_conf_params[] = {
-   { "drive-strength", PIN_CONFIG_DRIVE_STRENGTH, 2 },
-   { "bias-disable", PIN_CONFIG_BIAS_DISABLE, 0 },
-   { "bias-pull-up", PIN_CONFIG_BIAS_PULL_UP, 2 },
-};
-
-static int msm_get_functions_count(struct udevice *dev)
-{
-   struct msm_pinctrl_priv *priv = dev_get_priv(dev);
-
-   return priv->data->functions_count;
-}
-
-static int msm_get_pins_count(struct udevice *dev)
-{
-   struct msm_pinctrl_priv *priv = dev_get_priv(dev);
-
-   return priv->data->pin_count;
-}
-
-static const char *msm_get_function_name(struct udevice *dev,
-unsigned int selector)
-{
-   struct msm_pinctrl_priv *priv = dev_get_priv(dev);
-
-   return priv->data->get_function_name(dev, selector);
-}
-
-static int msm_pinctrl_probe(struct udevice *dev)
-{
-   struct msm_pinctrl_priv *priv = dev_get_priv(dev);
-
-   priv->base = devfdt_get_addr(dev);
-   priv->data = (struct msm_pinctrl_data *)dev->driver_data;
-
-   return priv->base == FDT_ADDR_T_NONE ? -EINVAL : 0;
-}
-
-static const char *msm_get_pin_name(struct udevice *dev, unsigned int selector)
-{
-   struct msm_pinctrl_priv *priv = dev_get_priv(dev);
-
-   return priv->data->get_pin_name(dev, selector);
-}
-
-static int msm_pinmux_set(struct udevice *dev, unsigned int pin_selector,
- unsigned int func_selector)
-{
-   struct msm_pinctrl_priv *priv = dev_get_priv(dev);
-
-   clrsetbits_le32(priv->base + GPIO_CONFIG_OFFSET(pin_selector),
-   TLMM_FUNC_SEL_MASK | TLMM_GPIO_DISABLE,
-   priv->data->get_function_mux(func_selector) << 2);
-   return 0;
-}
-
-static int msm_pinconf_set(struct udevice *dev, unsigned int pin_selector,
-  unsigned int param, unsigned int argument)
-{
-   struct msm_pinctrl_priv *priv = dev_get_priv(dev);
-
-   switch (param) {
-   case PIN_CONFIG_DRIVE_STRENGTH:
-   clrsetbits_le32(priv->base + GPIO_CONFIG_OFFSET(pin_selector),
-   TLMM_DRV_STRENGTH_MASK, argument << 6);
-   break;
-   case PIN_CONFIG_BIAS_DISABLE:
-   clrbits_le32(priv->base + GPIO_CONFIG_OFFSET(pin_selector),
-TLMM_GPIO_PULL_MASK);
-   break;
-   case PIN_CONFIG_BIAS_PULL_UP:
-   clrsetbits_le32(priv->base + GPIO_CONFIG_OFFSET(pin_selector),
-TLMM_GPIO_PULL_MASK, argument);
-   break;
-   default:
-   return 0;
-   }
-
-   return 0;
-}
-
-static int msm_pinctrl_bind(struct udevice *dev)
-{
-   ofnode node = dev_ofnode(dev);
-  

[PATCH v2 1/5] pinctrl: qcom: move out of mach-snapdragon

2023-11-06 Thread Caleb Connolly
Move the Qualcomm pinctrl drivers out of mach-snapdragon and over to the
rest of the pinctrl drivers, adjust the drivers so that support for each
platform can be enabled/disabled individually and introduce platform
specific configuration options.

Reviewed-by: Sumit Garg 
Signed-off-by: Caleb Connolly 
---
 MAINTAINERS|  1 +
 arch/arm/mach-snapdragon/Kconfig   |  4 +++
 arch/arm/mach-snapdragon/Makefile  |  5 ---
 drivers/pinctrl/Kconfig|  1 +
 drivers/pinctrl/Makefile   |  1 +
 drivers/pinctrl/qcom/Kconfig   | 39 ++
 drivers/pinctrl/qcom/Makefile  |  9 +
 .../pinctrl/qcom}/pinctrl-apq8016.c| 19 +--
 .../pinctrl/qcom}/pinctrl-apq8096.c| 19 +--
 .../pinctrl/qcom/pinctrl-qcom.c| 39 --
 .../pinctrl/qcom/pinctrl-qcom.h| 11 +++---
 .../pinctrl/qcom}/pinctrl-qcs404.c | 19 +--
 .../pinctrl/qcom}/pinctrl-sdm845.c | 19 +--
 13 files changed, 149 insertions(+), 37 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index b483fa2ea95a..f6d63c8ab563 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -576,6 +576,7 @@ F:  drivers/clk/qcom/
 F: drivers/gpio/msm_gpio.c
 F: drivers/mmc/msm_sdhci.c
 F: drivers/phy/msm8916-usbh-phy.c
+F: drivers/pinctrl/qcom/
 F: drivers/serial/serial_msm.c
 F: drivers/serial/serial_msm_geni.c
 F: drivers/smem/msm_smem.c
diff --git a/arch/arm/mach-snapdragon/Kconfig b/arch/arm/mach-snapdragon/Kconfig
index dde37eccc55e..3c9f3bee3f18 100644
--- a/arch/arm/mach-snapdragon/Kconfig
+++ b/arch/arm/mach-snapdragon/Kconfig
@@ -16,6 +16,7 @@ config SDM845
bool "Qualcomm Snapdragon 845 SoC"
select LINUX_KERNEL_IMAGE_HEADER
imply CLK_QCOM_SDM845
+   imply PINCTRL_QCOM_SDM845
 
 config LNX_KRNL_IMG_TEXT_OFFSET_BASE
default 0x8000
@@ -28,6 +29,7 @@ config TARGET_DRAGONBOARD410C
select BOARD_LATE_INIT
select ENABLE_ARM_SOC_BOOT0_HOOK
imply CLK_QCOM_APQ8016
+   imply PINCTRL_QCOM_APQ8016
help
  Support for 96Boards Dragonboard 410C. This board complies with
  96Board Open Platform Specifications. Features:
@@ -42,6 +44,7 @@ config TARGET_DRAGONBOARD410C
 config TARGET_DRAGONBOARD820C
bool "96Boards Dragonboard 820C"
imply CLK_QCOM_APQ8096
+   imply PINCTRL_QCOM_APQ8096
help
  Support for 96Boards Dragonboard 820C. This board complies with
  96Board Open Platform Specifications. Features:
@@ -76,6 +79,7 @@ config TARGET_QCS404EVB
bool "Qualcomm Technologies, Inc. QCS404 EVB"
select LINUX_KERNEL_IMAGE_HEADER
imply CLK_QCOM_QCS404
+   imply PINCTRL_QCOM_QCS404
help
  Support for Qualcomm Technologies, Inc. QCS404 evaluation board.
  Features:
diff --git a/arch/arm/mach-snapdragon/Makefile 
b/arch/arm/mach-snapdragon/Makefile
index 497ee35cf7d3..3a3a297c1768 100644
--- a/arch/arm/mach-snapdragon/Makefile
+++ b/arch/arm/mach-snapdragon/Makefile
@@ -8,9 +8,4 @@ obj-$(CONFIG_TARGET_DRAGONBOARD820C) += sysmap-apq8096.o
 obj-$(CONFIG_TARGET_DRAGONBOARD410C) += sysmap-apq8016.o
 obj-y += misc.o
 obj-y += dram.o
-obj-y += pinctrl-snapdragon.o
-obj-y += pinctrl-apq8016.o
-obj-y += pinctrl-apq8096.o
-obj-y += pinctrl-qcs404.o
-obj-y += pinctrl-sdm845.o
 obj-$(CONFIG_TARGET_QCS404EVB) += sysmap-qcs404.o
diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig
index 75b3ff47a2e8..53f32ea1612e 100644
--- a/drivers/pinctrl/Kconfig
+++ b/drivers/pinctrl/Kconfig
@@ -355,6 +355,7 @@ source "drivers/pinctrl/mvebu/Kconfig"
 source "drivers/pinctrl/nexell/Kconfig"
 source "drivers/pinctrl/nuvoton/Kconfig"
 source "drivers/pinctrl/nxp/Kconfig"
+source "drivers/pinctrl/qcom/Kconfig"
 source "drivers/pinctrl/renesas/Kconfig"
 source "drivers/pinctrl/rockchip/Kconfig"
 source "drivers/pinctrl/sunxi/Kconfig"
diff --git a/drivers/pinctrl/Makefile b/drivers/pinctrl/Makefile
index fc1f01a02cbd..603c2e0a2da2 100644
--- a/drivers/pinctrl/Makefile
+++ b/drivers/pinctrl/Makefile
@@ -17,6 +17,7 @@ obj-$(CONFIG_ARCH_RMOBILE) += renesas/
 obj-$(CONFIG_ARCH_RZN1) += renesas/
 obj-$(CONFIG_PINCTRL_SANDBOX)  += pinctrl-sandbox.o
 obj-$(CONFIG_PINCTRL_SUNXI)+= sunxi/
+obj-$(CONFIG_PINCTRL_QCOM) += qcom/
 obj-$(CONFIG_PINCTRL_UNIPHIER) += uniphier/
 obj-$(CONFIG_PINCTRL_PIC32)+= pinctrl_pic32.o
 obj-$(CONFIG_PINCTRL_EXYNOS)   += exynos/
diff --git a/drivers/pinctrl/qcom/Kconfig b/drivers/pinctrl/qcom/Kconfig
new file mode 100644
index ..412925c48788
--- /dev/null
+++ b/drivers/pinctrl/qcom/Kconfig
@@ -0,0 +1,39 @@
+if ARCH_SNAPDRAGON
+
+config PINCTRL_QCOM
+   depends on PINCTRL_GENERIC
+   def_bool n
+
+menu "Qualcomm pinctrl drivers"
+
+config PINCTRL_QCOM_APQ8016
+ 

[PATCH v2 3/5] pinctrl: qcom: make compatible with linux DTs

2023-11-06 Thread Caleb Connolly
The pinctrl and GPIO drivers are currently heavily incompatible with
upstream. Most Qualcomm pinctrl blocks feature "tiles" of pins, each at
it's own address. Introduce support for these by allowing the soc driver
to specify per-pin register offsets similarly to the Linux driver.

Adjust the GPIO driver to handle these too, and finally enable support
for all pins with the same numbering as used in Linux.

Signed-off-by: Caleb Connolly 
---
 arch/arm/dts/dragonboard845c-uboot.dtsi  |  2 +-
 arch/arm/dts/sdm845.dtsi | 16 ++
 arch/arm/dts/starqltechn-uboot.dtsi  |  5 +---
 arch/arm/dts/starqltechn.dts | 16 +-
 arch/arm/mach-snapdragon/include/mach/gpio.h | 28 ++---
 drivers/gpio/msm_gpio.c  | 36 --
 drivers/pinctrl/qcom/pinctrl-apq8016.c   |  2 +-
 drivers/pinctrl/qcom/pinctrl-apq8096.c   |  2 +-
 drivers/pinctrl/qcom/pinctrl-ipq4019.c   |  2 +-
 drivers/pinctrl/qcom/pinctrl-qcom.c  | 31 ---
 drivers/pinctrl/qcom/pinctrl-qcom.h  |  5 +++-
 drivers/pinctrl/qcom/pinctrl-qcs404.c|  2 +-
 drivers/pinctrl/qcom/pinctrl-sdm845.c| 45 ++--
 13 files changed, 130 insertions(+), 62 deletions(-)

diff --git a/arch/arm/dts/dragonboard845c-uboot.dtsi 
b/arch/arm/dts/dragonboard845c-uboot.dtsi
index 7106db8a7348..7728f4f4a3e5 100644
--- a/arch/arm/dts/dragonboard845c-uboot.dtsi
+++ b/arch/arm/dts/dragonboard845c-uboot.dtsi
@@ -19,7 +19,7 @@
bootph-all;
};
 
-   pinctrl_north@390 {
+   pinctrl@340 {
bootph-all;
};
};
diff --git a/arch/arm/dts/sdm845.dtsi b/arch/arm/dts/sdm845.dtsi
index 3b86b9328fc6..4798ace0ff8b 100644
--- a/arch/arm/dts/sdm845.dtsi
+++ b/arch/arm/dts/sdm845.dtsi
@@ -26,23 +26,13 @@
#power-domain-cells = <1>;
};
 
-   gpio_north: gpio_north@390 {
-   #gpio-cells = <2>;
+   tlmm: pinctrl@340 {
compatible = "qcom,sdm845-pinctrl";
-   reg = <0x390 0x40>;
-   gpio-count = <150>;
-   gpio-controller;
-   gpio-ranges = <&gpio_north 0 0 150>;
-   gpio-bank-name = "soc_north.";
-   };
-
-   tlmm_north: pinctrl_north@390 {
-   compatible = "qcom,sdm845-pinctrl";
-   reg = <0x390 0x40>;
+   reg = <0x340 0xc0>;
gpio-count = <150>;
gpio-controller;
#gpio-cells = <2>;
-   gpio-ranges = <&tlmm_north 0 0 150>;
+   gpio-ranges = <&tlmm 0 0 150>;
 
/* DEBUG UART */
qup_uart9: qup-uart9-default {
diff --git a/arch/arm/dts/starqltechn-uboot.dtsi 
b/arch/arm/dts/starqltechn-uboot.dtsi
index d81a22ffe492..034d5c1c07ed 100644
--- a/arch/arm/dts/starqltechn-uboot.dtsi
+++ b/arch/arm/dts/starqltechn-uboot.dtsi
@@ -19,10 +19,7 @@
clock-controller@10 {
bootph-all;
};
-   gpio_north@390 {
-   bootph-all;
-   };
-   pinctrl_north@390 {
+   pinctrl@340 {
bootph-all;
};
};
diff --git a/arch/arm/dts/starqltechn.dts b/arch/arm/dts/starqltechn.dts
index eec51d165f98..5b6372bee79a 100644
--- a/arch/arm/dts/starqltechn.dts
+++ b/arch/arm/dts/starqltechn.dts
@@ -65,15 +65,15 @@
serial@a84000 {
status = "okay";
};
+   };
+};
 
-   pinctrl_north@390 {
-   muic_i2c: muic_i2c {
-   pins = "GPIO_33", "GPIO_34";
-   drive-strength = <0x2>;
-   function = "gpio";
-   bias-disable;
-   };
-   };
+&tlmm {
+   muic_i2c: muic-i2c-n {
+   pins = "GPIO_33", "GPIO_34";
+   drive-strength = <0x2>;
+   function = "gpio";
+   bias-disable;
};
 };
 
diff --git a/arch/arm/mach-snapdragon/include/mach/gpio.h 
b/arch/arm/mach-snapdragon/include/mach/gpio.h
index bbc2bc16175d..8dac62f870b9 100644
--- a/arch/arm/mach-snapdragon/include/mach/gpio.h
+++ b/arch/arm/mach-snapdragon/include/mach/gpio.h
@@ -1,8 +1,28 @@
 /* SPDX-License-Identifier: GPL-2.0+ */
 /*
- * Empty gpio.h
+ * Qualcomm common pin control data.
  *
- * This file must stay as arch/arm/include/asm/gpio.h requires it.
- *
- * (C) Copyright 2015 Mateusz Kulikowski 
+ * Copyright (C) 2023 Linaro Ltd.
  */
+#ifndef _QCOM_GPIO_H_
+#d

[PATCH v2 5/5] fixup! pinctrl: qcom: make compatible with linux DTs

2023-11-06 Thread Caleb Connolly
---
 drivers/gpio/msm_gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/msm_gpio.c b/drivers/gpio/msm_gpio.c
index 3e4a0194b10a..80cd28bb231f 100644
--- a/drivers/gpio/msm_gpio.c
+++ b/drivers/gpio/msm_gpio.c
@@ -11,7 +11,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 

-- 
2.42.0



[PATCH v2 4/5] msm_gpio: use unsigned int

2023-11-06 Thread Caleb Connolly
Replaces the uses of "unsigned" with "unsigned int".

Reviewed-by: Sumit Garg 
Signed-off-by: Caleb Connolly 
---
 drivers/gpio/msm_gpio.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/msm_gpio.c b/drivers/gpio/msm_gpio.c
index 7d6a25fd..3e4a0194b10a 100644
--- a/drivers/gpio/msm_gpio.c
+++ b/drivers/gpio/msm_gpio.c
@@ -46,7 +46,7 @@ static int msm_gpio_direction_input(struct udevice *dev, 
unsigned int gpio)
return 0;
 }
 
-static int msm_gpio_set_value(struct udevice *dev, unsigned gpio, int value)
+static int msm_gpio_set_value(struct udevice *dev, unsigned int gpio, int 
value)
 {
struct msm_gpio_bank *priv = dev_get_priv(dev);
 
@@ -57,7 +57,7 @@ static int msm_gpio_set_value(struct udevice *dev, unsigned 
gpio, int value)
return 0;
 }
 
-static int msm_gpio_direction_output(struct udevice *dev, unsigned gpio,
+static int msm_gpio_direction_output(struct udevice *dev, unsigned int gpio,
 int value)
 {
struct msm_gpio_bank *priv = dev_get_priv(dev);
@@ -72,14 +72,14 @@ static int msm_gpio_direction_output(struct udevice *dev, 
unsigned gpio,
return 0;
 }
 
-static int msm_gpio_get_value(struct udevice *dev, unsigned gpio)
+static int msm_gpio_get_value(struct udevice *dev, unsigned int gpio)
 {
struct msm_gpio_bank *priv = dev_get_priv(dev);
 
return !!(readl(priv->base + GPIO_IN_OUT_REG(dev, gpio)) >> GPIO_IN);
 }
 
-static int msm_gpio_get_function(struct udevice *dev, unsigned gpio)
+static int msm_gpio_get_function(struct udevice *dev, unsigned int gpio)
 {
struct msm_gpio_bank *priv = dev_get_priv(dev);
 

-- 
2.42.0



Re: [PATCH 1/2] board: ti: am62x: am62x.env: Fix boot_targets

2023-11-06 Thread Tom Rini
On Mon, Nov 06, 2023 at 11:23:51AM +0530, Manorit Chawdhry wrote:
> Hi Simon,
> 
> On 11:22-20231005, Simon Glass wrote:
> > Hi Nishanth,
> > 
> > On Thu, 5 Oct 2023 at 11:16, Nishanth Menon  wrote:
> > >
> > > On 12:10-20231005, Nishanth Menon wrote:
> > > > On 12:36-20231005, Tom Rini wrote:
> > > > > On Thu, Oct 05, 2023 at 09:19:48AM -0500, Andrew Davis wrote:
> > > > > > On 10/4/23 8:54 AM, Nishanth Menon wrote:
> > > > > > > On 08:48-20231004, Andrew Davis wrote:
> > > > > > > > On 10/4/23 8:23 AM, Roger Quadros wrote:
> > > > > > > > > ti_mmc is not a valid boot_target for standard boot flow so
> > > > > > > >
> > > > > > > > Is there some way to make it into a valid boot_target? Otherwise
> > > > > > > > how do we use uEnv.txt files, or boot from FIT images with 
> > > > > > > > overlays?
> > > > > > >
> > > > > > > envboot takes care of uEnv.txt file (see
> > > > > > > https://lore.kernel.org/all/20231004132324.44198-3-rog...@kernel.org/)
> > > > > > >
> > > > > > > Early remote proc loading and FIT image is a question for stdboot 
> > > > > > > itself.
> > > > > > >
> > > > > >
> > > > > > If stdboot is missing these features then we shouldn't switch until 
> > > > > > it
> > > > > > has them. I'm all for switching to this, but only if it is complete.
> > > > >
> > > > > Depends on what you mean?  Did you mean an option to run scripts
> > > > > (exists) or an option to do what TI needs done, via
> > > > > boot/bootmeth_something.c ?  If the latter, someone from TI needs to
> > > > > figure out what that should be and do (but plumbing-wise everything it
> > > > > needs should exist).
> > > >
> > > > Andrew is generalizing here (on the wrong patch though).
> > > >
> > > > On am62x platforms, there is nothing regressing with this series. The
> > > > challenge is early remote_proc loading which is done for J7* platforms.
> > > >
> > > > How that is initiated as part of bootmethods is something of a gap.
> > > >
> > > > The other gap has been support for uEnv.txt -> which we can workaround
> > > > at the moment by using CONFIG_BOOTCOMMAND="run envboot; bootflow scan
> > > > -lb" in defconfig (This series from Roger already does that - hence I am
> > > > saying that Andrew is complaining on the wrong series).
> > > >
> > > > Ideally, we should just have CONFIG_BOOTCOMMAND="bootflow scan -lb" and
> > > > uEnv.txt remoteproc loads and the various standard bootmethods should
> > > > "just work".
> > >
> > >
> > > I forgot to add: FIT image authenticated boot flow. That is really what
> > > ti_mmc distroboot method was trying to solve.
> > >
> > > Maybe Simon or someone know how the stdboot flow handles authenticated
> > > kernel image and dtb boot flow with FIT image?
> > 
> > Yes you can use FIT configuration verification and things should work as 
> > normal.
> > 
> 
> Could you give any reference documentation for this?

I suspect you should start with doc/usage/fit/beaglebone_vboot.rst

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v3 09/12] x86: Enable SSE in 64-bit mode

2023-11-06 Thread Tom Rini
On Mon, Nov 06, 2023 at 06:26:15PM +0800, Bin Meng wrote:
> + Tom,
> 
> Hi Simon,
> 
> On Mon, Nov 6, 2023 at 12:29 AM Simon Glass  wrote:
> >
> > Hi Bin,
> >
> > On Sun, 5 Nov 2023 at 14:05, Bin Meng  wrote:
> > >
> > > Hi Simon,
> > >
> > > On Mon, Oct 2, 2023 at 9:15 AM Simon Glass  wrote:
> > > >
> > > > This is needed to support Truetype fonts. In any case, the compiler
> > > > expects SSE to be available in 64-bit mode. Enable it.
> > > >
> > > > Signed-off-by: Simon Glass 
> > > > Suggested-by: Bin Meng 
> > > > ---
> > > >
> > > > (no changes since v1)
> > > >
> > > >  arch/x86/config.mk|  1 -
> > > >  arch/x86/cpu/x86_64/cpu.c | 11 +++
> > > >  2 files changed, 11 insertions(+), 1 deletion(-)
> > > >
> > >
> > > I didn't suggest we enable SSE for x86. This is the wrong approach.
> > >
> > > We should rewrite the Truetype support codes to avoid using float/double 
> > > types.
> > >
> > > This way the Truetype codes can be used on any other architectures
> > > without the need for the compiler to emit explicit floating
> > > instructions.
> >
> > I am not aware of any such library. At present, enabling truetype on
> > coreboot64 causes a hang.
> >
> 
> If that's the case, we will have to either:
> 
> - Switch all U-Boot builds' to use software float (e.g. -msoft-float)
> which unfortunately depends on the compiler runtime intrinsics.
> - Introduce a Kconfig option for hard float enabling and let each
> architecture to decide whether it implements it or not, and update
> Truetype to depend on the hard float.

We generally do -msoft-float already, so introducing that for x86, and
some Kconfig logic to ensure that no one else steps on this particular
bug sounds reasonable.

-- 
Tom


signature.asc
Description: PGP signature


[PATCH] efi_loader: Increase default variable store size to 128K

2023-11-06 Thread Ilias Apalodimas
In commit 9fd3f881c6ed ("efi_loader: Increase default variable store size to 
64KiB")
Alper has a detailed explanation of why the size needs to be bumped to at
least 64K.  However enabling Secure boot, writing db, KEK, PK etc keys
will further increase the size so bump it to 128K.

It's worth noting that when U-Boot stores the EFI variables in an RPMB the
available storage is defined statically in StandAloneMM at build time.
The U-Boot code is detecting the available true size on the fly during
writes. When StandAloneMM is present this size defines the reserved
memory U-Boot can use to copy any runtime variables, before booting an
OS.

Signed-off-by: Ilias Apalodimas 
---
 lib/efi_loader/Kconfig | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index 4ccd26f94a93..0d024911b42e 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -133,18 +133,20 @@ endif

 config EFI_VAR_BUF_SIZE
int "Memory size of the UEFI variable store"
-   default 16384 if EFI_MM_COMM_TEE
-   default 65536
+   default 131072
range 4096 2147483647
help
  This defines the size in bytes of the memory area reserved for keeping
  UEFI variables.

- When using StandAloneMM (CONFIG_EFI_MM_COMM_TEE=y) this value should
- match the value of PcdFlashNvStorageVariableSize used to compile the
- StandAloneMM module.
+ When using StandAloneMM (CONFIG_EFI_MM_COMM_TEE=y) is used the
+ available size for storing variables is defined in
+ PcdFlashNvStorageVariableSize.
+ That value is probed at runtime from U-Boot. In that case,
+ EFI_VAR_BUF_SIZE represents the memory U-Boot reserves to present
+ runtime variables to the OS.

- Minimum 4096, default 65536, or 16384 when using StandAloneMM.
+ Minimum 4096, default 131072

 config EFI_GET_TIME
bool "GetTime() runtime service"
--
2.40.1



[PATCH] arm64: zynqmp: Do not expose usbhub nodes

2023-11-06 Thread Michal Simek
Upstream dwc3 U-Boot driver is not able to handle child nodes properly
that's why comment them in DT for now. This patch should be reverted when
dwc3 driver handles it properly.
DT node itself is aligned with dt schema.

Signed-off-by: Michal Simek 
---

 arch/arm/dts/zynqmp-sck-kd-g-revA.dtso | 3 ++-
 arch/arm/dts/zynqmp-sck-kr-g-revA.dtso | 3 ++-
 arch/arm/dts/zynqmp-sck-kr-g-revB.dtso | 3 ++-
 arch/arm/dts/zynqmp-sck-kv-g-revA.dtso | 2 ++
 arch/arm/dts/zynqmp-sck-kv-g-revB.dtso | 3 ++-
 5 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/arch/arm/dts/zynqmp-sck-kd-g-revA.dtso 
b/arch/arm/dts/zynqmp-sck-kd-g-revA.dtso
index 5a5c1efd6b96..8d0ddecdc14c 100644
--- a/arch/arm/dts/zynqmp-sck-kd-g-revA.dtso
+++ b/arch/arm/dts/zynqmp-sck-kd-g-revA.dtso
@@ -87,7 +87,7 @@
phys = <&psgtr 2 PHY_TYPE_USB3 0 2>;
reset-gpios = <&slg7xl45106 0 GPIO_ACTIVE_LOW>;
assigned-clock-rates = <25000>, <2000>;
-
+#if 0
usbhub0: usb-hub { /* u36 */
i2c-bus = <&i2c1>;
compatible = "microchip,usb5744";
@@ -98,6 +98,7 @@
compatible = "microchip,usb2244";
reset-gpios = <&slg7xl45106 2 GPIO_ACTIVE_LOW>;
};
+#endif
 };
 
 &dwc3_0 {
diff --git a/arch/arm/dts/zynqmp-sck-kr-g-revA.dtso 
b/arch/arm/dts/zynqmp-sck-kr-g-revA.dtso
index 30a0230d4767..95b1dc5aa571 100644
--- a/arch/arm/dts/zynqmp-sck-kr-g-revA.dtso
+++ b/arch/arm/dts/zynqmp-sck-kr-g-revA.dtso
@@ -139,7 +139,7 @@
phys = <&psgtr 2 PHY_TYPE_USB3 0 2>;
reset-gpios = <&slg7xl45106 0 GPIO_ACTIVE_LOW>;
assigned-clock-rates = <25000>, <2000>;
-
+#if 0
usbhub0: usb-hub { /* u43 */
i2c-bus = <&usbhub_i2c0>;
compatible = "microchip,usb5744";
@@ -150,6 +150,7 @@
compatible = "microchip,usb2244";
reset-gpios = <&slg7xl45106 2 GPIO_ACTIVE_LOW>;
};
+#endif
 };
 
 &dwc3_0 {
diff --git a/arch/arm/dts/zynqmp-sck-kr-g-revB.dtso 
b/arch/arm/dts/zynqmp-sck-kr-g-revB.dtso
index 8f4c52d6d643..e2387a2abb8f 100644
--- a/arch/arm/dts/zynqmp-sck-kr-g-revB.dtso
+++ b/arch/arm/dts/zynqmp-sck-kr-g-revB.dtso
@@ -139,7 +139,7 @@
phys = <&psgtr 2 PHY_TYPE_USB3 0 2>;
reset-gpios = <&slg7xl45106 0 GPIO_ACTIVE_LOW>;
assigned-clock-rates = <25000>, <2000>;
-
+#if 0
usbhub0: usb-hub { /* u43 */
i2c-bus = <&usbhub_i2c0>;
compatible = "microchip,usb5744";
@@ -150,6 +150,7 @@
compatible = "microchip,usb2244";
reset-gpios = <&slg7xl45106 2 GPIO_ACTIVE_LOW>;
};
+#endif
 };
 
 &dwc3_0 {
diff --git a/arch/arm/dts/zynqmp-sck-kv-g-revA.dtso 
b/arch/arm/dts/zynqmp-sck-kv-g-revA.dtso
index c4f1da92186f..f43c159cdca9 100644
--- a/arch/arm/dts/zynqmp-sck-kv-g-revA.dtso
+++ b/arch/arm/dts/zynqmp-sck-kv-g-revA.dtso
@@ -131,10 +131,12 @@
pinctrl-0 = <&pinctrl_usb0_default>;
phy-names = "usb3-phy";
phys = <&psgtr 2 PHY_TYPE_USB3 0 1>;
+#if 0
usbhub: usb5744 { /* u43 */
compatible = "microchip,usb5744";
reset-gpios = <&gpio 44 GPIO_ACTIVE_LOW>;
};
+#endif
 };
 
 &dwc3_0 {
diff --git a/arch/arm/dts/zynqmp-sck-kv-g-revB.dtso 
b/arch/arm/dts/zynqmp-sck-kv-g-revB.dtso
index 6c5e0e566061..3643569cc7c8 100644
--- a/arch/arm/dts/zynqmp-sck-kv-g-revB.dtso
+++ b/arch/arm/dts/zynqmp-sck-kv-g-revB.dtso
@@ -113,13 +113,14 @@
phy-names = "usb3-phy";
phys = <&psgtr 2 PHY_TYPE_USB3 0 1>;
assigned-clock-rates = <25000>, <2000>;
-
+#if 0
usb5744: usb-hub { /* u43 */
status = "okay";
compatible = "microchip,usb5744";
i2c-bus = <&i2c1>;
reset-gpios = <&gpio 44 GPIO_ACTIVE_LOW>;
};
+#endif
 };
 
 &dwc3_0 {
-- 
2.36.1



Re: [PATCH 01/20] m68k: Remove CONFIG_FSLDMAFEC

2023-11-06 Thread Tom Rini
On Sat, Nov 04, 2023 at 09:58:07PM +0100, Angelo Dureghello wrote:
> Hi Tom,
> 
> Reviewed by: Angelo Dureghello 
> 
> 
> Thanks for the cleanup, m68k boards build fine.
> 
> fsl_mcdmafec driver is still referenced in arch/m68k/dts/mcf54xx.dtsi,
> (from compatible field) but no board is including it.
> You can remove the dtsi too if you want.

Thanks for the review.  I'd appreciate it if you went and did the rest
of the cleaning of unused code around here as I'm not familiar with it,
I just found this one as part of looking for common.h usage.

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] net: dhcp6: Fix OPT_BOOTFILE_PARAM parsing

2023-11-06 Thread Tom Rini
On Tue, Jul 25, 2023 at 04:13:29PM -0700, seanedm...@linux.microsoft.com wrote:

> From: Sean Edmond 
> 
> RFC 5970 states that OPT_BOOTFILE_PARAM (option 60) can be
> multiple parameters that start with a 16-bit length field followed
> by the parameter. For example:
> [ param-len 1 (16-bits) ] [ parameter 1 (variable length) ]
> 
> This fix ensure we're considering "param-len 1" in the parsing.
> 
> Signed-off-by: Sean Edmond 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] net: Get pxe config file from dhcp option 209

2023-11-06 Thread Tom Rini
On Tue, Jul 25, 2023 at 04:20:30PM -0700, seanedm...@linux.microsoft.com wrote:

> From: Sean Edmond 
> 
> Allow dhcp server pass pxe config file full path by using option 209
> 
> Signed-off-by: Sean Edmond 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v2] bmips: Add Inteno XG6846 board

2023-11-06 Thread Tom Rini
On Tue, Sep 26, 2023 at 11:23:39AM +0200, Linus Walleij wrote:

> This adds support for the Inteno XG6846 board based on the
> Broadcom MIPS 6328 SoC.
> 
> The default boot will read a uImage from flash and boot it.
> 
> Reviewed-by: Daniel Schwierzeck 
> Signed-off-by: Linus Walleij 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v2] net: eth-uclass: Improve error message when MAC is not found

2023-11-06 Thread Tom Rini
On Fri, Oct 20, 2023 at 09:41:51AM -0300, Fabio Estevam wrote:

> From: Fabio Estevam 
> 
> While bringinp up a new board without the MAC fuses programmed,
> the following error message was observed:
> 
> Error: ethernet@30bf address not set.
> 
> Improve the error message to make it clearer the reason of
> the failure.
> 
> Signed-off-by: Fabio Estevam 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 1/1] .mailmap: map Pali Rohár

2023-11-06 Thread Tom Rini
On Mon, Nov 06, 2023 at 01:09:08AM -0800, Heinrich Schuchardt wrote:

> Pali expressed that he does not want to receive mails relating to his past
> contributions.
> 
> Signed-off-by: Heinrich Schuchardt 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] net: dw_eth_qos: Add 64-bit addressing

2023-11-06 Thread Tom Rini
On Fri, Dec 09, 2022 at 02:33:14PM +0800, Ley Foon Tan wrote:

> Set upper 32bit address for DMA descriptors and buffer address to support
> 64-bit addressing.
> 
> Signed-off-by: Ley Foon Tan 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] net: ftgmac100: Add reset control

2023-11-06 Thread Tom Rini
On Thu, Jul 27, 2023 at 09:58:14AM +0800, Dylan Hung wrote:

> Add optional reset control, especially for the Aspeed SOC. For the
> hardware without a reset line, the reset assertion/deassertion will be
> skipped.
> 
> Signed-off-by: Dylan Hung 
> Reviewed-by: Ryan Chen 
> Reviewed-by: Ramon Fried 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 1/2] net: mv88e6xxx: use generic bitfield macros for MDIO

2023-11-06 Thread Tom Rini
On Tue, Aug 08, 2023 at 06:05:15PM +0200, Robert Marko wrote:

> Driver is currently defining the mask and bit shifting itself,
> there is no need for that as U-Boot has generic bitfield macros that help
> us achieve the same result but in a cleaner way.
> 
> Signed-off-by: Robert Marko 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 2/2] net: mv88e6xxx: add Clause 45 support

2023-11-06 Thread Tom Rini
On Tue, Aug 08, 2023 at 06:05:16PM +0200, Robert Marko wrote:

> Marvell LinkStreet switches support Clause 45 MDIO on the internal bus.
> 
> C45 read or writes require the register address to be written first to
> the SMI PHY Data register, and then a special C45 Write Address Register
> OP is used on the SMI PHY Register before making a C45 Read Data Register
> OP and being able to actually read the register.
> 
> Signed-off-by: Robert Marko 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH RESEND v2 1/2] net: add hifemac Ethernet driver for HiSilicon platform

2023-11-06 Thread Tom Rini
On Wed, Aug 23, 2023 at 01:03:42AM +0800, Yang Xiwen via B4 Relay wrote:

> From: Yang Xiwen 
> 
> It adds the driver for HIFEMAC Ethernet controller found on HiSilicon
> SoCs like Hi3798MV200.  It's based on the mainstream linux driver, but
> quite a lot of code gets rewritten and cleaned up to adopt u-boot driver
> model.
> 
> Signed-off-by: Yang Xiwen 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH RESEND v2 2/2] net: add hifemac_mdio MDIO bus driver for HiSilicon platform

2023-11-06 Thread Tom Rini
On Wed, Aug 23, 2023 at 01:03:43AM +0800, Yang Xiwen via B4 Relay wrote:

> From: Yang Xiwen 
> 
> It adds the driver for the internal MDIO bus of HIFEMAC Ethernet
> controller.  It's based on the mainstream linux driver.
> 
> Signed-off-by: Yang Xiwen 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v2] net: eth-uclass: Setup ROM source only when ROM reading passes

2023-11-06 Thread Tom Rini
On Fri, Sep 15, 2023 at 04:10:06PM +0200, Michal Simek wrote:

> There is no reason to setup ROM source if read_rom_hwaddr hook doesn't
> exist or reading mac address fails. It is ending up with confusion about
> mac address source.
> 
> It is nicely visible if you put mac address to DT as
> local-mac-address = [ff ff ff ff ff ff];
> but also save ethaddr to variables
> setenv -f ethaddr 02:18:31:7e:3e:01
> 
> Before this patch U-Boot prints that source is ROM
> Address in ROM is ff:ff:ff:ff:ff:ff
> Address in environment is 02:18:31:7e:3e:01
> 
> After that source is DT:
> Address in DT is  ff:ff:ff:ff:ff:ff
> Address in environment is 02:18:31:7e:3e:01
> 
> Signed-off-by: Michal Simek 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


[PATCH 1/2] imx7s-warp-u-boot: Fix aliases and chosen nodes indentation

2023-11-06 Thread Fabio Estevam
From: Fabio Estevam 

The aliases and chosen nodes are currently indented using spaces.

Fix them to use the standard tab indentation.

Signed-off-by: Fabio Estevam 
---
 arch/arm/dts/imx7s-warp-u-boot.dtsi | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/arm/dts/imx7s-warp-u-boot.dtsi 
b/arch/arm/dts/imx7s-warp-u-boot.dtsi
index 49b992dcccaf..4f44598c9a27 100644
--- a/arch/arm/dts/imx7s-warp-u-boot.dtsi
+++ b/arch/arm/dts/imx7s-warp-u-boot.dtsi
@@ -1,12 +1,12 @@
 / {
-aliases {
-mmc0 = &usdhc3;
-usb0 = &usbotg1;
-};
+   aliases {
+   mmc0 = &usdhc3;
+   usb0 = &usbotg1;
+   };
 
-chosen {
-stdout-path = &uart1;
-};
+   chosen {
+   stdout-path = &uart1;
+   };
 };
 
 &aips3 {
-- 
2.34.1



[PATCH 2/2] warp7: Convert to watchdog driver model

2023-11-06 Thread Fabio Estevam
From: Fabio Estevam 

Commit 68dcbdd594d4 ("ARM: imx: Add weak default reset_cpu()") caused
the 'reset' command in U-Boot to not cause a board reset.

Fix it by switching to the watchdog driver model via sysreset, which
is the preferred method for implementing the watchdog reset.

Signed-off-by: Fabio Estevam 
---
 arch/arm/dts/imx7s-warp-u-boot.dtsi | 10 ++
 configs/warp7_defconfig |  3 +++
 2 files changed, 13 insertions(+)

diff --git a/arch/arm/dts/imx7s-warp-u-boot.dtsi 
b/arch/arm/dts/imx7s-warp-u-boot.dtsi
index 4f44598c9a27..98784fd7a2ef 100644
--- a/arch/arm/dts/imx7s-warp-u-boot.dtsi
+++ b/arch/arm/dts/imx7s-warp-u-boot.dtsi
@@ -7,6 +7,12 @@
chosen {
stdout-path = &uart1;
};
+
+   wdt-reboot {
+   compatible = "wdt-reboot";
+   wdt = <&wdog1>;
+   bootph-pre-ram;
+   };
 };
 
 &aips3 {
@@ -24,3 +30,7 @@
 &uart1 {
bootph-all;
 };
+
+&wdog1 {
+   bootph-pre-ram;
+};
diff --git a/configs/warp7_defconfig b/configs/warp7_defconfig
index 26d992d3c2d8..4ceb0a4f2917 100644
--- a/configs/warp7_defconfig
+++ b/configs/warp7_defconfig
@@ -67,6 +67,8 @@ CONFIG_DM_REGULATOR_GPIO=y
 CONFIG_SPECIFY_CONSOLE_INDEX=y
 CONFIG_DM_SERIAL=y
 CONFIG_MXC_UART=y
+CONFIG_SYSRESET=y
+CONFIG_SYSRESET_WATCHDOG=y
 CONFIG_IMX_THERMAL=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
@@ -80,5 +82,6 @@ CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_USB_ETHER=y
 CONFIG_USB_ETH_CDC=y
 CONFIG_USBNET_HOST_ADDR="de:ad:be:af:00:00"
+CONFIG_IMX_WATCHDOG=y
 CONFIG_OPTEE_TZDRAM_SIZE=0x300
 CONFIG_BOOTM_OPTEE=y
-- 
2.34.1



Re: [PATCH] net: phy: TI DP83869 fix invalid clock delay configuration

2023-11-06 Thread Tom Rini
On Fri, Oct 06, 2023 at 02:24:39PM +0200, Frank de Brabander wrote:

> Setting the clock delay from the device tree settings
> rx-internal-delay-ps and tx-internal-delay-ps was broken:
> 
>  - The expected value in the device tree is suppose to be a
>delay in picoseconds, but the driver only allowed an array index.
>  - Driver converted this array index to the actual delay in
>picoseconds and tried to apply this in the device register. This
>however is not a valid register value. The actual logic here was
>reversed, it converted an register representation of the delay to
>the device tree delay in picoseconds.
> 
> Only when the internal delays were NOT configured in the device tree
> and they default value of 7 (=2000ps) was used, a valid value was
> loaded in the register.
> 
> Signed-off-by: Frank de Brabander 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] net: Add option for tracing packets

2023-11-06 Thread Tom Rini
On Sat, Oct 07, 2023 at 09:53:12PM -0400, Sean Anderson wrote:

> Add an option to trace all packets send/received. This can be helpful when
> debugging protocol issues, as the packets can then be imported into
> wireshark [1] and analyzed further.
> 
> [1] https://www.wireshark.org/docs/wsug_html_chunked/ChIOImportSection.html
> 
> Signed-off-by: Sean Anderson 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] net: e1000: Drop e1000_eth_ids[]

2023-11-06 Thread Tom Rini
On Wed, Oct 11, 2023 at 06:58:25PM +0800, Bin Meng wrote:

> e1000_eth_ids holds compatible strings for e1000 devices, but it
> is meaningless as e1000 is a PCI device and there is no such
> compatible string assigned to e1000 by the DT bindings community.
> 
> Drop it.
> 
> Signed-off-by: Bin Meng 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] net: designware: add DMA offset awareness

2023-11-06 Thread Tom Rini
On Wed, Oct 25, 2023 at 11:08:44AM +0300, Baruch Siach wrote:

> Older DesignWare Ethernet MAC versions that this driver supports can
> only work with 32-bit DMA source/destination addresses. Some platforms
> have no physical RAM at the lowest 4GB address space. For these
> platforms the driver must translate DMA addresses to/from physical
> memory addresses.
> 
> Call translation routines so that properly configured platforms can use
> the DesignWare Ethernet MAC. For platforms using device-tree this
> usually means adding dma-ranges property to the bus the device node is
> in.
> 
> Signed-off-by: Baruch Siach 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [GIT PULL] Please pull u-boot-amlogic-20231106

2023-11-06 Thread Tom Rini
On Mon, Nov 06, 2023 at 03:34:31PM +0100, Neil Armstrong wrote:

> Hi Tom,
> 
> A little set of fix for:
> - also enable DFU RAM boot for libretech-ac, since it uses a different config 
> header
> - SM probe fix
> - A1 USB missing clocks
> 
> The CI job is at 
> https://source.denx.de/u-boot/custodians/u-boot-amlogic/pipelines/18452
> 
> Thanks,
> Neil
> 
> The following changes since commit a4c83bda17196bf5d1ce640844595aaeced6465e:
> 
>   Merge branch '2023-11-03-assorted-tegra-improvements' (2023-11-04 09:55:39 
> -0400)
> 
> are available in the Git repository at:
> 
>   https://source.denx.de/u-boot/custodians/u-boot-amlogic.git 
> tags/u-boot-amlogic-20231106
> 
> for you to fetch changes up to c550e81171940932664a85bda315a6a073aae23c:
> 
>   ARM: configs: libretech-ac: enable USB_DFU like in meson64.h (2023-11-06 
> 09:46:05 +0100)
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH V2 06/12] arm: mach-k3: Kconfig: Introduce a symbol to indicate J7200

2023-11-06 Thread Andrew Davis

On 11/4/23 2:21 AM, Nishanth Menon wrote:

J7200 shares quite a few characteristics with J721E. However a few sets
are different. Introduce a Kconfig to differentiate the two to allow for
new boards to be introduced in a seamless manner.

Signed-off-by: Nishanth Menon 
---
  arch/arm/mach-k3/Kconfig | 5 +
  1 file changed, 5 insertions(+)

diff --git a/arch/arm/mach-k3/Kconfig b/arch/arm/mach-k3/Kconfig
index 9168bf842dca..57e2dd966eb8 100644
--- a/arch/arm/mach-k3/Kconfig
+++ b/arch/arm/mach-k3/Kconfig
@@ -24,6 +24,11 @@ config SOC_K3_AM62A7
  
  endchoice
  
+if SOC_K3_J721E

+config SOC_K3_J721E_J7200


I'm sure you know how messy this is :(

We wanted to treat J7200 as a proper subset device of J721e but we
also know that didn't happen. These two SoCs ended up more different
than expected and although still very similar I believe continuing
to try to support both under one name is not the right solution.

We will split out J7200 from J721e in TF-A[0] for similar reasons,
might be time to do the same in u-boot.

Andrew

[0] https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/23970


+   bool "TI's K3 based J7200 SoC variant Family Support"
+endif
+
  config SYS_SOC
default "k3"
  


  1   2   >