[PULL] u-boot-riscv/master

2023-02-01 Thread Leo Liang
Hi Tom,

The following changes since commit 73a3f5139182a0389d505bf29b0ad4bc29424cf8:

  Merge https://source.denx.de/u-boot/custodians/u-boot-mmc (2023-01-31 
18:28:07 -0500)

are available in the Git repository at:

  https://source.denx.de/u-boot/custodians/u-boot-riscv.git

for you to fetch changes up to 2b0af9feb594b68a75e4f111bde7f55ddb14995d:

  board: sifive: unmatched: enable booting on a second NVME device (2023-02-01 
16:17:59 +0800)

CI result show no issue: 
https://source.denx.de/u-boot/custodians/u-boot-riscv/-/pipelines/15011


+ riscv lib: 
+ optimize memcpy for "dst == src" case
+ check if u-mode exists before writing mcounteren register
+ unmatched board config: enable second NVME device on unmatched board
+ ae350 board: 
+ Adjust memory layout and some CSR setting

Aurelien Jarno (1):
  board: sifive: unmatched: enable booting on a second NVME device

Nikita Shubin (1):
  riscv: cpu: check U-Mode before counteren write

Rick Chen (4):
  riscv: ae350: Enable CCTL_SUEN
  riscv: ax25: bypass malloc when spl fit boots from ram
  riscv: memcpy: check src and dst before copy
  riscv: ae350: support OpenSBI 1.0+ which enable FW_PIC

 arch/riscv/cpu/ax25/Makefile   |  1 +
 arch/riscv/cpu/ax25/cpu.c  | 18 +++---
 arch/riscv/cpu/ax25/spl.c  | 27 +++
 arch/riscv/cpu/cpu.c   | 16 
 arch/riscv/lib/memcpy.S|  2 ++
 board/AndesTech/ax25-ae350/Kconfig |  2 +-
 include/configs/sifive-unmatched.h |  1 +
 7 files changed, 51 insertions(+), 16 deletions(-)
 create mode 100644 arch/riscv/cpu/ax25/spl.c

Best regards,
Leo


Re: [PATCH v3] arm: mvebu: Add support for Thecus N2350 (Armada 385) board

2023-02-01 Thread Stefan Roese

On 2/2/23 00:13, Tony Dinh wrote:

Thecus N2350 is a NAS based on Marvell Armada 385 SoC.

Specification:

- Processor: Marvel MV88F6820 Dual Core at 1GHz
- 1 GiB DDR4 RAM
- 4MB Macronix mx25l3205d SPI flash
- 512MB Hynix H27U4G8F2DTR-BC NAND flash
- I2C
- 2x USB 3.0
- 1x GBE LAN port (PHY: Marvell 88E1510)
- 2x SATA (hot swap slots)
- 3x buttons
- 10x LEDS
- serial console

Signed-off-by: Tony Dinh 


Reviewed-by: Stefan Roese 

Thanks,
Stefan


---

Changes in v3:
- Add missing DTS file path in MAINTAINERS file
- Remove "common.h" in board file
- Remove CFG_I2C_MVTWSI_BASE0 in include header file
- Cleanup unecessary comments in include header file

Changes in v2:
- Use node pointers already defined from armada-38x.dtsi in this board DTS
- Remove extra compatible attributes in this board DTS
- Remove unnecessary armada-385-thecus-n2350-u-boot.dtsi
- Remove unnecessary check_board() function in board file
- Remove unnecessary "default false" for DDR4 in arch/arm/mach-mvebu/Kconfig
- Use "rootfs" as partition name for NAND partition
- Various DTS naming convention correction

  arch/arm/dts/Makefile|   1 +
  arch/arm/dts/armada-385-thecus-n2350.dts | 446 +++
  arch/arm/mach-mvebu/Kconfig  |  11 +
  board/thecus/n2350/MAINTAINERS   |   7 +
  board/thecus/n2350/Makefile  |   6 +
  board/thecus/n2350/n2350.c   | 126 +++
  configs/n2350_defconfig  |  93 +
  include/configs/n2350.h  |  56 +++
  8 files changed, 746 insertions(+)
  create mode 100644 arch/arm/dts/armada-385-thecus-n2350.dts
  create mode 100644 board/thecus/n2350/MAINTAINERS
  create mode 100644 board/thecus/n2350/Makefile
  create mode 100644 board/thecus/n2350/n2350.c
  create mode 100644 configs/n2350_defconfig
  create mode 100644 include/configs/n2350.h

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 3ecd6a86e9..c5d1825a3b 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -245,6 +245,7 @@ dtb-$(CONFIG_ARCH_MVEBU) += \
armada-385-atl-x530.dtb \
armada-385-atl-x530DP.dtb   \
armada-385-db-88f6820-amc.dtb   \
+   armada-385-thecus-n2350.dtb \
armada-385-turris-omnia.dtb \
armada-388-clearfog.dtb \
armada-388-gp.dtb   \
diff --git a/arch/arm/dts/armada-385-thecus-n2350.dts 
b/arch/arm/dts/armada-385-thecus-n2350.dts
new file mode 100644
index 00..fc29c4d25a
--- /dev/null
+++ b/arch/arm/dts/armada-385-thecus-n2350.dts
@@ -0,0 +1,446 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Device Tree file for Thecus N2350 board
+ *
+ * Copyright (C) 2018-2023 Tony Dinh 
+ * Copyright (C) 2018 Manuel Jung 
+ */
+
+/dts-v1/;
+#include 
+#include 
+#include "armada-385.dtsi"
+
+/ {
+   model = "Thecus N2350";
+   compatible = "thecus,n2350", "marvell,armada385";
+
+   aliases {
+   ethernet0 = ð0;
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   memory {
+   device_type = "memory";
+   reg = <0x 0x4000>; /* 1GB */
+   };
+
+   soc {
+   ranges = ;
+
+   };
+
+   usb3_0_phy: usb3_0_phy {
+   compatible = "usb-nop-xceiv";
+   vcc-supply = <&usb3_0_power>;
+   };
+
+   usb3_1_phy: usb3_1_phy {
+   compatible = "usb-nop-xceiv";
+   vcc-supply = <&usb3_1_power>;
+   };
+
+   gpio-keys {
+   compatible = "gpio-keys";
+   #address-cells = <1>;
+   #size-cells = <0>;
+   pinctrl-0 = <&pmx_power_button &pmx_copy_button 
&pmx_reset_button>;
+   pinctrl-names = "default";
+
+   button@1 {
+   label = "Power Button";
+   linux,code = ;
+   gpios = <&gpio1 17 GPIO_ACTIVE_HIGH>;
+   };
+
+   button@2 {
+   label = "Copy Button";
+   linux,code = ;
+   gpios = <&gpio1 20 GPIO_ACTIVE_HIGH>;
+   };
+
+   button@3 {
+   label = "Reset Button";
+   linux,code = ;
+   gpios = <&gpio1 18 GPIO_ACTIVE_HIGH>;
+   };
+   };
+
+   gpio-leds {
+   compatible = "gpio-leds";
+   pinctrl-0 = <&pmx_sata1_white_led
+   &pmx_sata1_red_led
+   &pmx_sata2_white_led
+   &pmx_sata2_red_led
+   &pmx_sys_white_led
+   &pmx_sys_red_led
+   &pmx_pwr_blue_led
+   &pmx_pwr_red_led
+   &pmx_usb_white_led
+

Re: [PATCH v2 07/12] reset: uniphier: Add USB glue reset support

2023-02-01 Thread Kunihiko Hayashi

Hi Marek,

On 2023/02/02 6:51, Marek Vasut wrote:

On 2/1/23 02:13, Kunihiko Hayashi wrote:

Add reset control support in USB glue logic. This needs to control
the external clocks and resets for the logic before accessing the
glue logic.

Signed-off-by: Kunihiko Hayashi 


With the very little knowledge I have of this platform:
Reviewed-by: Marek Vasut 


I see. I should make some explanation.

The dm tree for usb is the following.

  glue
+-- controller   (need controller-reset)
+-- controller-reset (need syscon-reset)
+-- phy

The controller needs to deassert "controller-reset" in the glue.
The glue needs to deassert "syscon-reset".

The glue node itself doesn't have "resets" property, so
the controller-reset controls "syscon-reset" instead.

This patch adds the reset control for "controller-reset".

Thank you,

---
Best Regards
Kunihiko Hayashi


Re: [PATCH v2 10/12] ARM: dts: uniphier: Fix node names and missing reg property in USB glue node

2023-02-01 Thread Kunihiko Hayashi

Hi Marek,

On 2023/02/02 6:55, Marek Vasut wrote:

On 2/1/23 02:13, Kunihiko Hayashi wrote:

The node name should follow the generic name list in DT specification.
This moves "reset" to "reset-controller", "hs-phy" and "ss-phy" to "phy"
in the USB glue node.

And the node should have reg property to define the register region.

Signed-off-by: Kunihiko Hayashi 
---
   arch/arm/dts/uniphier-ld20.dtsi | 15 ---
   arch/arm/dts/uniphier-pro4.dtsi |  7 ---
   arch/arm/dts/uniphier-pro5.dtsi | 15 ---
   arch/arm/dts/uniphier-pxs2.dtsi | 20 +++-
   arch/arm/dts/uniphier-pxs3.dtsi | 20 +++-
   5 files changed, 42 insertions(+), 35 deletions(-)


I don't mind this patch, but would it make sense to later, in a separate
patch, synchronize the .dtsi with Linux kernel fully ?


I see.

I also think I should to synchronize the devicetree with Linux, so
I'll separate this patch from this series in the next.

Thank you,

---
Best Regards
Kunihiko Hayashi


Re: [PATCH v2 09/12] phy: socionext: Add UniPhier USB3 PHY driver

2023-02-01 Thread Kunihiko Hayashi

Hi Marek,

Thank you for reviewing.

On 2023/02/02 6:54, Marek Vasut wrote:

On 2/1/23 02:13, Kunihiko Hayashi wrote:

Add USB3 PHY driver support to control clocks and resets for the phy.

Signed-off-by: Kunihiko Hayashi 
---
   configs/uniphier_v8_defconfig |  1 +
   drivers/phy/socionext/Kconfig |  7 ++
   drivers/phy/socionext/Makefile|  1 +
   drivers/phy/socionext/phy-uniphier-usb3.c | 89 +++
   4 files changed, 98 insertions(+)
   create mode 100644 drivers/phy/socionext/phy-uniphier-usb3.c

diff --git a/configs/uniphier_v8_defconfig b/configs/uniphier_v8_defconfig
index 6a0e2666cf..5cfa9fc01d 100644
--- a/configs/uniphier_v8_defconfig
+++ b/configs/uniphier_v8_defconfig
@@ -78,3 +78,4 @@ CONFIG_USB_DWC3=y
   CONFIG_USB_DWC3_UNIPHIER=y
   CONFIG_PANIC_HANG=y
   CONFIG_FDT_FIXUP_PARTITIONS=y
+CONFIG_PHY_UNIPHIER_USB3=y


This should be in 12/12 patch, right ?


Yes, this should be.


diff --git a/drivers/phy/socionext/Kconfig b/drivers/phy/socionext/Kconfig
index bcd579e98e..fc63f4c042 100644
--- a/drivers/phy/socionext/Kconfig
+++ b/drivers/phy/socionext/Kconfig
@@ -10,3 +10,10 @@ config PHY_UNIPHIER_PCIE
help
  Enable this to support PHY implemented in PCIe controller
  on UniPhier SoCs.
+
+config PHY_UNIPHIER_USB3
+   bool "UniPhier USB3 PHY driver"
+   depends on PHY && ARCH_UNIPHIER


Maybe 'default y if SOMETHING' here, so you won't need to adjust defconfig ?


OK. this phy is mandatory for the controller.


+   help
+ Enable this to support PHY implemented in USB3 controller
+ on UniPhier SoCs.
diff --git a/drivers/phy/socionext/Makefile
b/drivers/phy/socionext/Makefile
index 5484360b70..94d3aa68cf 100644
--- a/drivers/phy/socionext/Makefile
+++ b/drivers/phy/socionext/Makefile
@@ -4,3 +4,4 @@
   #

   obj-$(CONFIG_PHY_UNIPHIER_PCIE)  += phy-uniphier-pcie.o
+obj-$(CONFIG_PHY_UNIPHIER_USB3)+= phy-uniphier-usb3.o
diff --git a/drivers/phy/socionext/phy-uniphier-usb3.c
b/drivers/phy/socionext/phy-uniphier-usb3.c
new file mode 100644
index 00..a2e44a52c1
--- /dev/null
+++ b/drivers/phy/socionext/phy-uniphier-usb3.c
@@ -0,0 +1,89 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * phy_uniphier_usb3.c - Socionext UniPhier Usb3 PHY driver
+ * Copyright 2019-2021 Socionext, Inc.


2023 instead of 2021 .


I'll fix it.


+ */
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+struct uniphier_usb3phy_priv {
+   struct clk_bulk clks;
+   struct reset_ctl_bulk rsts;
+};
+
+static int uniphier_usb3phy_init(struct phy *phy)
+{
+   struct uniphier_usb3phy_priv *priv = dev_get_priv(phy->dev);
+   int ret;
+
+   ret = clk_enable_bulk(&priv->clks);
+   if (ret) {
+   clk_release_bulk(&priv->clks);
+   return ret;
+   }
+
+   ret = reset_deassert_bulk(&priv->rsts);
+   if (ret) {
+   reset_release_bulk(&priv->rsts);


You have to disable clock here too.


Yes. I'll add it.


+   return ret;
+   }
+
+   return 0;
+}
+
+static int uniphier_usb3phy_probe(struct udevice *dev)
+{
+   struct uniphier_usb3phy_priv *priv = dev_get_priv(dev);
+   int ret;
+
+   ret = clk_get_bulk(dev, &priv->clks);
+   if (ret) {
+   if (ret != -ENOSYS && ret != -ENOENT) {
+   printf("Failed to get clocks\n");
+   return ret;
+   }
+   }
+
+   ret = reset_get_bulk(dev, &priv->rsts);
+   if (ret) {
+   if (ret != -ENOSYS && ret != -ENOENT) {
+   printf("Failed to get resets\n");


You have to release resets here too (use fail path, i.e. goto err_clock).


I see. I'll consider adding release or using "devm" function.

Thank you,

---
Best Regards
Kunihiko Hayashi


Re: [PATCH] arm: kirkwood: Enable uart0 dm-pre-reloc for Kirkwood boards

2023-02-01 Thread Tony Dinh
Added Simon to the discussion.

On Wed, Feb 1, 2023 at 1:13 PM Tony Dinh  wrote:
>
> Hi all,
>
> On Wed, Feb 1, 2023 at 11:05 AM Pali Rohár  wrote:
> >
> > On Wednesday 01 February 2023 09:17:15 Michael Walle wrote:
> > > > > > When DM_SERIAL is enabled, the device-tree property dm-pre-reloc is
> > > > > > required to boot over UART with kwboot. Enable this in a Kirkwood
> > > > > > common u-boot dtsi.
> > > > >
> > > > > My (dev) board unfortunately, have a bootloader which can't boot over
> > > > > serial.
> > > >
> > > > This is feature of Marvell BootROM and does not require any special from
> > > > Bootloader. So you should be able to boot over UART (if you have
> > > > accessible pins).
> > >
> > > I know, but there are known versions ob the bootrom where uart boot
> > > isn't supported (correctly).
> >
> > I heard about it... maybe it is a bug in client software (kwboot)? I do
> > not have such board if you are interested in it I could try to send some
> > details how to debug it.
>
> The Kirkwood SoCs came with different BootROM versions. Version 1.1
> cannot be booted over UART, but version 1.2  can. I think there must
> be a bug in the BootROM 1.1. The older Kirkwood such as Sheevaplug,
> Dockstar, iConnect boards come with BootROM 1.1. Later version of
> Sheevaplug, GoFlex Home, GoFlex Net, Dreamplug, Pogoplug V4, Zyxel
> NSA310S, NSA320, NSA325 come with BootROM 1.2. So even though it is
> the same SoC, eg. 6281, they are actually produced at a different time
> and have different BootROM versions.
>
> When I test new u-boot images for boards such as Dockstar or iConnect,
> I run kwboot with the GoFlex Home/Net. And they boot fine to a point
> that allows me to see that the image is good enough. So in the
> development phase, most if not all Kirkwood u-boot images can be
> booted over UART. Some with real boards, some with surrogates.
>
> > > I also have another board which can boot
> > > over uart. But thats in daily use ;)
> > >
> > > > > Could you elaborate that a bit more? Why is this required for
> > > > > uart boot? kwboot will talk with the bootrom why does u-boot need
> > > > > anything? Or will there just be no output until the uart is
> > > > > initialized?
> > > >
> > > > On mvebu/armada boards this dm-pre-reloc is required to ensure that DT
> > > > nodes are present in SPL DTB file. Otherwise build process drop all
> > > > non-pre-realoc nodes from SPL version of DTB file. And because SPL use
> > > > DM serial, it is required to have uart DT nodes in DTB file. Btw, same
> > > > problem is with SPI in SPL.
> > > >
> > > > But... kirkwood does not use SPL, so I do not know what is reason for
> > > > this here.
> > >
> > > Yes thats what puzzled me, too.
>
> When u-boot,dm-pre-reloc is not specified in the uart0 DTS node, after
> the image was transferred by kwboot, the serial console is silent and
> the board is frozen.
>
> If I understand correctly, it is because before u-boot relocation, if
> DM serial is enabled, the serial uclass is present, but it has not
> been initialized (I think it is created but not "bind(?)" ). The
> dm-preloc property works because it explicitly tells DM to fully
> initialize the uclass before relocation. That was just my observation
> about DM in general, devices do not get fully initialized until the
> first use. So I tried the u-boot,dm-pre-reloc and it works. If my
> assumption is incorrect, perhaps somebody can look at the serial
> uclass and see if there is a different type of issue there.
>
> Thanks,
> Tony
>
> > >
> > > > > >
> > > > > > Signed-off-by: Tony Dinh 
> > > > > > ---
> > > > > >
> > > > > >  arch/arm/dts/kirkwood-u-boot.dtsi | 7 +++
> > > > > >  1 file changed, 7 insertions(+)
> > > > > >  create mode 100644 arch/arm/dts/kirkwood-u-boot.dtsi
> > > > >
> > > > > Is this new? AFAIK only -u-boot.dtsi is included
> > > > > automatically.
> > > >
> > > > It is not new, Tom wrote about it quite ago:
> > > > https://lore.kernel.org/u-boot/20220802121113.GG1146598@bill-the-cat/
> > >
> > > Thats relatively new for someone not following the u-boot
> > > development that closely ;) Thanks for the pointer.
> > >
> > > -michael
> > >


Re: [PATCH v3 4/8] dm: doc: Update documentation for new driver model schema

2023-02-01 Thread Simon Glass
Hi Heinrich,

On Wed, 1 Feb 2023 at 17:30, Heinrich Schuchardt  wrote:
>
>
>
> Am 1. Februar 2023 23:54:24 MEZ schrieb Simon Glass :
> >Now that Linux has accepted these tags, move U-Boot over to use them.
> >Tidy up the comments and formatting, making sure that VPL is mentioned
> >too.
> >
> >Signed-off-by: Simon Glass 
>
> Should all these documents be converted to yaml (in future) so that we can 
> test devicetrees against schemas like the kernel does?
>

Yes. I expect that we can replace the ones in U-Boot with newer yaml
ones from Linux at some point.

I've love to see a schema check, even if it fails for now.

Regards,
Simon


[PATCH V2 2/2] configs: imx: imx8mm_beacon: Add config option for QSPI booting

2023-02-01 Thread Adam Ford
The imx8mm_beacon SOM has a QSPI part attached to the FSPI controller.
Update the header and spl files to support booting from NOR flash and
add imx8mm_beacon_fspi_defconfig to support this configuration.

Signed-off-by: Adam Ford 
---
V2:  Rebase and rename  CONFIG_SYS_UBOOT_BASE to CFG_SYS_UBOOT_BASE

diff --git a/board/beacon/imx8mm/spl.c b/board/beacon/imx8mm/spl.c
index a5f337aa17..b2830c5223 100644
--- a/board/beacon/imx8mm/spl.c
+++ b/board/beacon/imx8mm/spl.c
@@ -36,6 +36,8 @@ int spl_board_boot_device(enum boot_device boot_dev_spl)
return BOOT_DEVICE_MMC2;
case USB_BOOT:
return BOOT_DEVICE_BOARD;
+   case QSPI_BOOT:
+   return BOOT_DEVICE_NOR;
default:
return BOOT_DEVICE_NONE;
}
@@ -46,6 +48,11 @@ static void spl_dram_init(void)
ddr_init(&dram_timing);
 }
 
+void spl_board_init(void)
+{
+   arch_misc_init();
+}
+
 #ifdef CONFIG_SPL_LOAD_FIT
 int board_fit_config_name_match(const char *name)
 {
diff --git a/configs/imx8mm_beacon_fspi_defconfig 
b/configs/imx8mm_beacon_fspi_defconfig
new file mode 100644
index 00..805fd3f671
--- /dev/null
+++ b/configs/imx8mm_beacon_fspi_defconfig
@@ -0,0 +1,155 @@
+CONFIG_ARM=y
+CONFIG_ARCH_IMX8M=y
+CONFIG_TEXT_BASE=0x4020
+CONFIG_SYS_MALLOC_LEN=0x200
+CONFIG_SPL_GPIO=y
+CONFIG_SPL_LIBCOMMON_SUPPORT=y
+CONFIG_SPL_LIBGENERIC_SUPPORT=y
+CONFIG_ENV_SIZE=0x2000
+CONFIG_ENV_OFFSET=0xDE00
+CONFIG_IMX_CONFIG="board/freescale/imx8mm_evk/imximage-8mm-lpddr4-fspi.cfg"
+CONFIG_DM_GPIO=y
+CONFIG_DEFAULT_DEVICE_TREE="imx8mm-beacon-kit"
+CONFIG_SPL_TEXT_BASE=0x7E2000
+CONFIG_TARGET_IMX8MM_BEACON=y
+CONFIG_SYS_PROMPT="u-boot=> "
+CONFIG_SPL_SERIAL=y
+CONFIG_SPL_DRIVERS_MISC=y
+CONFIG_SPL=y
+CONFIG_SYS_LOAD_ADDR=0x4048
+CONFIG_LTO=y
+CONFIG_SYS_MONITOR_LEN=524288
+CONFIG_FIT=y
+CONFIG_FIT_EXTERNAL_OFFSET=0x3000
+CONFIG_SPL_LOAD_FIT=y
+# CONFIG_USE_SPL_FIT_GENERATOR is not set
+CONFIG_OF_SYSTEM_SETUP=y
+CONFIG_USE_BOOTCOMMAND=y
+CONFIG_BOOTCOMMAND="mmc dev ${mmcdev}; if mmc rescan; then if run 
loadbootscript; then run bootscript; else if run loadimage; then run mmcboot; 
else run netboot; fi; fi; fi;"
+CONFIG_DEFAULT_FDT_FILE="imx8mm-beacon-kit.dtb"
+CONFIG_SPL_MAX_SIZE=0x25000
+CONFIG_SPL_PAD_TO=0x0
+CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
+CONFIG_SPL_BSS_START_ADDR=0x91
+CONFIG_SPL_BSS_MAX_SIZE=0x2000
+CONFIG_SPL_BOARD_INIT=y
+# CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
+CONFIG_SPL_STACK=0x92
+CONFIG_SYS_SPL_MALLOC=y
+CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
+CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x4220
+CONFIG_SYS_SPL_MALLOC_SIZE=0x8
+CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
+CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
+CONFIG_SPL_CRC32=y
+CONFIG_SPL_I2C=y
+CONFIG_SPL_NOR_SUPPORT=y
+CONFIG_SPL_POWER=y
+CONFIG_SPL_USB_HOST=y
+CONFIG_SPL_USB_GADGET=y
+CONFIG_SPL_USB_SDP_SUPPORT=y
+CONFIG_SPL_WATCHDOG=y
+CONFIG_HUSH_PARSER=y
+CONFIG_SYS_MAXARGS=64
+CONFIG_SYS_CBSIZE=2048
+CONFIG_SYS_PBSIZE=2074
+CONFIG_SYS_BOOTM_LEN=0x80
+# CONFIG_CMD_EXPORTENV is not set
+# CONFIG_CMD_IMPORTENV is not set
+# CONFIG_CMD_CRC32 is not set
+CONFIG_CMD_CLK=y
+CONFIG_CMD_FUSE=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_I2C=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_PART=y
+CONFIG_CMD_SPI=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_USB_SDP=y
+CONFIG_CMD_USB_MASS_STORAGE=y
+CONFIG_CMD_DHCP=y
+CONFIG_CMD_MII=y
+CONFIG_CMD_PING=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_PMIC=y
+CONFIG_CMD_REGULATOR=y
+CONFIG_CMD_EXT2=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_CMD_FAT=y
+CONFIG_OF_CONTROL=y
+CONFIG_SPL_OF_CONTROL=y
+CONFIG_ENV_OVERWRITE=y
+CONFIG_ENV_IS_IN_MMC=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=2
+CONFIG_SYS_MMC_ENV_PART=2
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
+CONFIG_USE_ETHPRIME=y
+CONFIG_ETHPRIME="FEC"
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_SPL_DM=y
+CONFIG_SPL_CLK_COMPOSITE_CCF=y
+CONFIG_CLK_COMPOSITE_CCF=y
+CONFIG_SPL_CLK_IMX8MM=y
+CONFIG_CLK_IMX8MM=y
+CONFIG_MXC_GPIO=y
+CONFIG_DM_PCA953X=y
+CONFIG_DM_I2C=y
+CONFIG_SUPPORT_EMMC_BOOT=y
+CONFIG_MMC_IO_VOLTAGE=y
+CONFIG_MMC_UHS_SUPPORT=y
+CONFIG_MMC_HS400_ES_SUPPORT=y
+CONFIG_MMC_HS400_SUPPORT=y
+CONFIG_FSL_USDHC=y
+CONFIG_MTD=y
+CONFIG_DM_MTD=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SF_DEFAULT_MODE=0
+CONFIG_SF_DEFAULT_SPEED=4000
+CONFIG_SPI_FLASH_BAR=y
+CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_MTD=y
+CONFIG_PHYLIB=y
+CONFIG_PHY_ATHEROS=y
+CONFIG_PHY_GIGE=y
+CONFIG_FEC_MXC=y
+CONFIG_MII=y
+CONFIG_SPL_PHY=y
+CONFIG_SPL_NOP_PHY=y
+CONFIG_PINCTRL=y
+CONFIG_SPL_PINCTRL=y
+CONFIG_PINCTRL_IMX8M=y
+CONFIG_POWER_DOMAIN=y
+CONFIG_IMX8M_POWER_DOMAIN=y
+CONFIG_DM_PMIC=y
+# CONFIG_SPL_PMIC_CHILDREN is not set
+CONFIG_DM_PMIC_BD71837=y
+CONFIG_SPL_DM_PMIC_BD71837=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_BD71837=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_REGULATOR_GPIO=y
+CONFIG_DM_SERIAL=y
+CONFIG_MXC_UART=y
+CONFIG_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_NXP_FSPI=y
+CONFIG_SYSRESET=y
+CONFIG_SPL_SYSRESET=y
+CONFIG_SYSRESET_PSCI=y
+CONFIG_SYSRE

[PATCH V2 1/2] imx: imx8mm-beacon: Enable FlexSPI in U-Boot

2023-02-01 Thread Adam Ford
In order to use the FlexSPI interface in U-Boot, configure
the alias to make spi0 point to flexspi.

With that enabled, sf probe detects the QSPI part as:
SF: Detected n25q256ax1 with page size 256 Bytes, erase size 4 KiB, total 32 MiB

Signed-off-by: Adam Ford 
---
V2:  No Change

diff --git a/arch/arm/dts/imx8mm-beacon-kit-u-boot.dtsi 
b/arch/arm/dts/imx8mm-beacon-kit-u-boot.dtsi
index 00ac413f36..4f5b9cd23c 100644
--- a/arch/arm/dts/imx8mm-beacon-kit-u-boot.dtsi
+++ b/arch/arm/dts/imx8mm-beacon-kit-u-boot.dtsi
@@ -6,6 +6,10 @@
 #include "imx8mm-u-boot.dtsi"
 
 / {
+   aliases {
+   spi0 = &flexspi;
+   };
+
wdt-reboot {
compatible = "wdt-reboot";
wdt = <&wdog1>;
-- 
2.34.1



[PULL] u-boot-sh/master

2023-02-01 Thread Marek Vasut

The following changes since commit 1e1cd8eb2d0c8e5b28b2dd6622ec9cbbd5eb61b8:

  Merge tag 'fsl-qoriq-2023-2-1' of 
https://source.denx.de/u-boot/custodians/u-boot-fsl-qoriq (2023-02-01 
09:31:17 -0500)


are available in the Git repository at:

  git://source.denx.de/u-boot-sh.git master

for you to fetch changes up to 1006b33b3a612acbaa66970f3bb8817216fc854e:

  net: ravb: Drop SoC-specific compatible support (2023-02-02 01:49:21 
+0100)



Hai Pham (20):
  dt-bindings: power: Pick R-Car Gen3 R8A77961 M3W+ header from 
Linux 6.1.7
  dt-bindings: clock: Pick R-Car Gen3 R8A77961 M3W+ header from 
Linux 6.1.7

  pinctrl: renesas: r8a7796: Add R8A77961 PFC support
  clk: renesas: Add dummy SDnH clock
  clk: renesas: Rename CLK_R8A7796 to CLK_R8A77960
  clk: renesas: r8a7796: Add R8A77961 CPG/MSSR support
  clk: renesas: Use pre-defined offset for RPC clocks
  mmc: renesas-sdhi: R-Car M3 r1.3 also uses 4 tuning taps
  mmc: renesas-sdhi: Filter out HS400 on M3-W r1.2, V3M, V3H r1.x, D3
  mmc: renesas-sdhi: Adjust HS400 calibration tables
  mmc: renesas-sdhi: Adjust HS400 calibration offsets for M3-W r1.3
  mmc: renesas-sdhi: Add R8A77961 M3-W+ support
  mmc: renesas-sdhi: Drop R-Car H3 ES3.0 HS400 calibration table
  mmc: renesas-sdhi: Flag non-standard SDnH handling for V3M
  clk: renesas: Introduce and use rcar_clk_get_rate64_div_table 
function

  clk: renesas: Handle E3/D3 RPCSRC clock
  clk: renesas: Switch to new SD clock handling
  clk: renesas: Add R8A77970 SD0H/SD0 clocks for SDHI
  clk: renesas: rcar-gen3: Factor out CPG library
  configs: draak: Enable I2C support for R-Car D3

Marek Vasut (30):
  ARM: dts: rmobile: Synchronize DT headers with Linux 6.1.7
  ARM: dts: rmobile: Synchronize DTs with Linux 6.1.7
  pinctrl: renesas: Synchronize PFC core with Linux 6.1.7
  pinctrl: renesas: Synchronize R8A7790 H2 PFC tables with Linux 6.1.7
  pinctrl: renesas: Synchronize R8A7791 M2-W and R8A7793 M2-N PFC 
tables with Linux 6.1.7

  pinctrl: renesas: Synchronize R8A7792 V2H PFC tables with Linux 6.1.7
  pinctrl: renesas: Synchronize R8A7794 E2 PFC tables with Linux 6.1.7
  pinctrl: renesas: Synchronize R8A7795 H3 PFC tables with Linux 6.1.7
  pinctrl: renesas: Synchronize R8A77960 M3-W and R8A77961 M3-W+ 
PFC tables with Linux 6.1.7
  pinctrl: renesas: Synchronize R8A77965 M3-N PFC tables with Linux 
6.1.7
  pinctrl: renesas: Synchronize R8A77970 V3M PFC tables with Linux 
6.1.7
  pinctrl: renesas: Synchronize R8A77980 V3H PFC tables with Linux 
6.1.7

  pinctrl: renesas: Synchronize R8A77990 E3 PFC tables with Linux 6.1.7
  pinctrl: renesas: Synchronize R8A77995 D3 PFC tables with Linux 6.1.7
  pinctrl: renesas: Synchronize R8A779A0 V3U PFC tables with Linux 
6.1.7

  clk: renesas: Synchronize R8A7795 H3 clock tables with Linux 6.1.7
  clk: renesas: Synchronize R8A77960 M3-W and R8A77961 M3-W+ clock 
tables with Linux 6.1.7

  clk: renesas: Synchronize R8A77965 M3-N clock tables with Linux 6.1.7
  clk: renesas: Synchronize R8A77980 V3H clock tables with Linux 6.1.7
  clk: renesas: Synchronize R8A77990 E3 clock tables with Linux 6.1.7
  clk: renesas: Synchronize R8A77995 D3 clock tables with Linux 6.1.7
  clk: renesas: Synchronize R8A779A0 V3U clock tables with Linux 6.1.7
  clk: renesas: Synchronize R8A774A1 RZ/G2M clock tables with Linux 
6.1.7
  clk: renesas: Synchronize R8A774B1 RZ/G2N clock tables with Linux 
6.1.7
  clk: renesas: Synchronize R8A774C0 RZ/G2E clock tables with Linux 
6.1.7
  clk: renesas: Synchronize R8A774E1 RZ/G2H clock tables with Linux 
6.1.7

  clk: renesas: Add and enable CPG reset driver
  clk: renesas: Drop core param from gen3_clk_get_rate64_pll_mul_reg
  clk: renesas: Convert Gen2/Gen3 clock tables to clk-provider 
struct clk_div_table

  net: ravb: Drop SoC-specific compatible support

 arch/arm/dts/beacon-renesom-baseboard.dtsi  |   27 +-
 arch/arm/dts/beacon-renesom-som.dtsi|9 +-
 arch/arm/dts/cat875.dtsi|5 +-
 arch/arm/dts/condor-common.dtsi |  548 
++
 arch/arm/dts/draak.dtsi |  744 
+
 arch/arm/dts/ebisu.dtsi |  869 
++

 arch/arm/dts/hihope-rev4.dtsi   |   10 +-
 arch/arm/dts/hihope-rzg2-ex.dtsi|7 +-
 arch/arm/dts/r8a774a1-beacon-rzg2m-kit.dts  |8 +
 arch/arm/dts/r8a774a1-hihope-rzg2m-ex.dts   |2 +-
 arch/arm/dts/r8a774a1-hihope-rzg2m.dts  |2 +-
 arch/arm/dts/r8a774a1.dtsi  |   66 +--
 arch/arm/dts/r8a774b1-beacon-rzg2n-kit.dts  |2 +-
 arch/arm/dts/r8a774b1.dtsi  |   42 +-
 arch/arm/dts/r8a774c0-cat874.dts 

[PATCH] drivers: usb: host: Fix the write to W1C fields in HPRT register

2023-02-01 Thread teik . heng . chong
From: Teik Heng Chong 

Fix the write to the HPRT register which treat W1C fields
as if they were mere RW. This leads to unintended clearing of such fields

Signed-off-by: Teik Heng Chong 
---
 drivers/usb/host/dwc2.c | 34 --
 drivers/usb/host/dwc2.h |  4 
 2 files changed, 12 insertions(+), 26 deletions(-)

diff --git a/drivers/usb/host/dwc2.c b/drivers/usb/host/dwc2.c
index 23060fc369..9818f9be94 100644
--- a/drivers/usb/host/dwc2.c
+++ b/drivers/usb/host/dwc2.c
@@ -315,9 +315,7 @@ static void dwc_otg_core_host_init(struct udevice *dev,
 
/* Turn on the vbus power. */
if (readl(®s->gintsts) & DWC2_GINTSTS_CURMODE_HOST) {
-   hprt0 = readl(®s->hprt0);
-   hprt0 &= ~(DWC2_HPRT0_PRTENA | DWC2_HPRT0_PRTCONNDET);
-   hprt0 &= ~(DWC2_HPRT0_PRTENCHNG | DWC2_HPRT0_PRTOVRCURRCHNG);
+   hprt0 = readl(®s->hprt0) & ~DWC2_HPRT0_W1C_MASK;
if (!(hprt0 & DWC2_HPRT0_PRTPWR)) {
hprt0 |= DWC2_HPRT0_PRTPWR;
writel(hprt0, ®s->hprt0);
@@ -748,7 +746,7 @@ static int dwc_otg_submit_rh_msg_out(struct dwc2_priv *priv,
case (USB_REQ_CLEAR_FEATURE << 8) | USB_RECIP_OTHER | USB_TYPE_CLASS:
switch (wValue) {
case USB_PORT_FEAT_C_CONNECTION:
-   setbits_le32(®s->hprt0, DWC2_HPRT0_PRTCONNDET);
+   clrsetbits_le32(®s->hprt0, DWC2_HPRT0_W1C_MASK, 
DWC2_HPRT0_PRTCONNDET);
break;
}
break;
@@ -759,21 +757,13 @@ static int dwc_otg_submit_rh_msg_out(struct dwc2_priv 
*priv,
break;
 
case USB_PORT_FEAT_RESET:
-   clrsetbits_le32(®s->hprt0, DWC2_HPRT0_PRTENA |
-   DWC2_HPRT0_PRTCONNDET |
-   DWC2_HPRT0_PRTENCHNG |
-   DWC2_HPRT0_PRTOVRCURRCHNG,
-   DWC2_HPRT0_PRTRST);
+   clrsetbits_le32(®s->hprt0, DWC2_HPRT0_W1C_MASK, 
DWC2_HPRT0_PRTRST);
mdelay(50);
-   clrbits_le32(®s->hprt0, DWC2_HPRT0_PRTRST);
+   clrbits_le32(®s->hprt0, DWC2_HPRT0_W1C_MASK | 
DWC2_HPRT0_PRTRST);
break;
 
case USB_PORT_FEAT_POWER:
-   clrsetbits_le32(®s->hprt0, DWC2_HPRT0_PRTENA |
-   DWC2_HPRT0_PRTCONNDET |
-   DWC2_HPRT0_PRTENCHNG |
-   DWC2_HPRT0_PRTOVRCURRCHNG,
-   DWC2_HPRT0_PRTRST);
+   clrsetbits_le32(®s->hprt0, DWC2_HPRT0_W1C_MASK, 
DWC2_HPRT0_PRTRST);
break;
 
case USB_PORT_FEAT_ENABLE:
@@ -1213,14 +1203,9 @@ static int dwc2_init_common(struct udevice *dev, struct 
dwc2_priv *priv)
dwc_otg_core_host_init(dev, regs);
}
 
-   clrsetbits_le32(®s->hprt0, DWC2_HPRT0_PRTENA |
-   DWC2_HPRT0_PRTCONNDET | DWC2_HPRT0_PRTENCHNG |
-   DWC2_HPRT0_PRTOVRCURRCHNG,
-   DWC2_HPRT0_PRTRST);
+   clrsetbits_le32(®s->hprt0, DWC2_HPRT0_W1C_MASK, DWC2_HPRT0_PRTRST);
mdelay(50);
-   clrbits_le32(®s->hprt0, DWC2_HPRT0_PRTENA | DWC2_HPRT0_PRTCONNDET |
-DWC2_HPRT0_PRTENCHNG | DWC2_HPRT0_PRTOVRCURRCHNG |
-DWC2_HPRT0_PRTRST);
+   clrbits_le32(®s->hprt0, DWC2_HPRT0_W1C_MASK | DWC2_HPRT0_PRTRST);
 
for (i = 0; i < MAX_DEVICE; i++) {
for (j = 0; j < MAX_ENDPOINT; j++) {
@@ -1246,10 +1231,7 @@ static int dwc2_init_common(struct udevice *dev, struct 
dwc2_priv *priv)
 static void dwc2_uninit_common(struct dwc2_core_regs *regs)
 {
/* Put everything in reset. */
-   clrsetbits_le32(®s->hprt0, DWC2_HPRT0_PRTENA |
-   DWC2_HPRT0_PRTCONNDET | DWC2_HPRT0_PRTENCHNG |
-   DWC2_HPRT0_PRTOVRCURRCHNG,
-   DWC2_HPRT0_PRTRST);
+   clrsetbits_le32(®s->hprt0, DWC2_HPRT0_W1C_MASK, DWC2_HPRT0_PRTRST);
 }
 
 #if !CONFIG_IS_ENABLED(DM_USB)
diff --git a/drivers/usb/host/dwc2.h b/drivers/usb/host/dwc2.h
index a6f562fe60..6f022e33a1 100644
--- a/drivers/usb/host/dwc2.h
+++ b/drivers/usb/host/dwc2.h
@@ -543,6 +543,10 @@ struct dwc2_core_regs {
 #define DWC2_HPRT0_PRTSPD_LOW  (2 << 17)
 #define DWC2_HPRT0_PRTSPD_MASK (0x3 << 17)
 #define DWC2_HPRT0_PRTSPD_OFFSET   17
+#define DWC2_HPRT0_W1C_MASK(DWC2_HPRT0_PRTCONNDET 
| \
+   DWC2_HPRT0_PRTENA | \
+   DWC2_HPRT0_PRTENCHNG | \
+   
DWC2_HPRT0_PR

Re: [PATCH v3 4/8] dm: doc: Update documentation for new driver model schema

2023-02-01 Thread Heinrich Schuchardt



Am 1. Februar 2023 23:54:24 MEZ schrieb Simon Glass :
>Now that Linux has accepted these tags, move U-Boot over to use them.
>Tidy up the comments and formatting, making sure that VPL is mentioned
>too.
>
>Signed-off-by: Simon Glass 

Should all these documents be converted to yaml (in future) so that we can test 
devicetrees against schemas like the kernel does?

Best regards

Heinrich 



>---
>
>(no changes since v1)
>
> doc/README.TPL|  4 +--
> doc/develop/driver-model/design.rst   | 15 +--
> .../driver-model/fs_firmware_loader.rst   |  4 +--
> doc/develop/driver-model/of-plat.rst  | 25 ++-
> doc/develop/driver-model/pci-info.rst | 10 
> doc/develop/driver-model/serial-howto.rst | 24 +-
> doc/develop/spl.rst   |  5 ++--
> 7 files changed, 45 insertions(+), 42 deletions(-)
>
>diff --git a/doc/README.TPL b/doc/README.TPL
>index 72027fd692e..95b466e4af9 100644
>--- a/doc/README.TPL
>+++ b/doc/README.TPL
>@@ -35,8 +35,8 @@ is set. Source files can be compiled for TPL with options 
>chosen in the
> board config file.
> 
> TPL use a small device tree (u-boot-tpl.dtb), containing only the nodes with
>-the pre-relocation properties: 'u-boot,dm-pre-reloc' and 'u-boot,dm-tpl'
>-(see README.SPL for details).
>+the pre-relocation properties: 'bootph-all' and 'bootph-pre-sram'
>+(see doc/develop/spl.rst for details).
> 
> For example:
> 
>diff --git a/doc/develop/driver-model/design.rst 
>b/doc/develop/driver-model/design.rst
>index 20611e85e34..8c2c81d7ac9 100644
>--- a/doc/develop/driver-model/design.rst
>+++ b/doc/develop/driver-model/design.rst
>@@ -1114,12 +1114,12 @@ Pre-Relocation Support
> --
> 
> For pre-relocation we simply call the driver model init function. Only
>-drivers marked with DM_FLAG_PRE_RELOC or the device tree 'u-boot,dm-pre-reloc'
>+drivers marked with DM_FLAG_PRE_RELOC or the device tree 'bootph-all'
> property are initialised prior to relocation. This helps to reduce the driver
> model overhead. This flag applies to SPL and TPL as well, if device tree is
> enabled (CONFIG_OF_CONTROL) there.
> 
>-Note when device tree is enabled, the device tree 'u-boot,dm-pre-reloc'
>+Note when device tree is enabled, the device tree 'bootph-all'
> property can provide better control granularity on which device is bound
> before relocation. While with DM_FLAG_PRE_RELOC flag of the driver all
> devices with the same driver are bound, which requires allocation a large
>@@ -1128,14 +1128,15 @@ only way for statically declared devices via 
>U_BOOT_DRVINFO() to be bound
> prior to relocation.
> 
> It is possible to limit this to specific relocation steps, by using
>-the more specialized 'u-boot,dm-spl' and 'u-boot,dm-tpl' flags
>-in the device tree node. For U-Boot proper you can use 'u-boot,dm-pre-proper'
>+the more specialized 'bootph-pre-ram' and 'bootph-pre-sram' flags
>+in the device tree node. For U-Boot proper you can use 'bootph-some-ram'
> which means that it will be processed (and a driver bound) in U-Boot proper
> prior to relocation, but will not be available in SPL or TPL.
> 
>-To reduce the size of SPL and TPL, only the nodes with pre-relocation 
>properties
>-('u-boot,dm-pre-reloc', 'u-boot,dm-spl' or 'u-boot,dm-tpl') are keept in their
>-device trees (see README.SPL for details); the remaining nodes are always 
>bound.
>+To reduce the size of SPL and TPL, only the nodes with pre-relocation
>+properties ('bootph-all', 'bootph-pre-ram' or 'bootph-pre-sram') are kept in
>+their device trees (see README.SPL for details); the remaining nodes are
>+always bound.
> 
> Then post relocation we throw that away and re-init driver model again.
> For drivers which require some sort of continuity between pre- and
>diff --git a/doc/develop/driver-model/fs_firmware_loader.rst 
>b/doc/develop/driver-model/fs_firmware_loader.rst
>index a44708cb4c5..b0823700a90 100644
>--- a/doc/develop/driver-model/fs_firmware_loader.rst
>+++ b/doc/develop/driver-model/fs_firmware_loader.rst
>@@ -28,7 +28,7 @@ defined in fs-loader node as shown in below:
> Example for block device::
> 
>   fs_loader0: fs-loader {
>-  u-boot,dm-pre-reloc;
>+  bootph-all;
>   compatible = "u-boot,fs-loader";
>   phandlepart = <&mmc 1>;
>   };
>@@ -41,7 +41,7 @@ device, it can be described in FDT as shown in below:
> Example for ubi::
> 
>   fs_loader1: fs-loader {
>-  u-boot,dm-pre-reloc;
>+  bootph-all;
>   compatible = "u-boot,fs-loader";
>   mtdpart = "UBI",
>   ubivol = "ubi0";
>diff --git a/doc/develop/driver-model/of-plat.rst 
>b/doc/develop/driver-model/of-plat.rst
>index b454f7be85e..01724ba72ce 100644
>--- a/doc/develop/driver-model/of-plat.rst
>+++ b/doc/develop/driver-model/of-plat.rst
>@@ -67,7 +67,7 @@ device. As an example, consider this MMC node:
>

[PATCH 1/2] net: dhcp6: Add DHCPv6 (DHCP for IPv6)

2023-02-01 Thread seanedmond
From: Sean Edmond 

Adds DHCPv6 protocol to u-boot.

Allows for address assignement with DHCPv6 4-message exchange
(SOLICIT->ADVERTISE->REQUEST->REPLY).  Includes DHCPv6 options
required by RFC 8415.  Also adds DHCPv6 options required
for PXE boot.

New configs added:
- CMD_DHCP6
- DHCP6_PXE_CLIENTARCH
- DHCP6_PXE_DHCP_OPTION
- DHCP6_ENTERPRISE_ID

Possible enhancements:
- Duplicate address detection on DHCPv6 assigned address
- IPv6 address assignement through SLAAC
- Sending/parsing other DHCPv6 options (NTP, DNS, etc...)

Signed-off-by: Sean Edmond 
---
 cmd/Kconfig   |  26 ++
 include/net.h |   8 +-
 net/Makefile  |   1 +
 net/dhcpv6.c  | 741 ++
 net/dhcpv6.h  | 212 +++
 net/net.c |  12 +
 6 files changed, 998 insertions(+), 2 deletions(-)
 create mode 100644 net/dhcpv6.c
 create mode 100644 net/dhcpv6.h

diff --git a/cmd/Kconfig b/cmd/Kconfig
index dc0446e02e..87813ddbb4 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1645,6 +1645,15 @@ config CMD_DHCP
help
  Boot image via network using DHCP/TFTP protocol
 
+config CMD_DHCP6
+   bool "dhcp6"
+   depends on IPV6
+   help
+ Boot image via network using DHCPv6/TFTP protocol using IPv6.
+
+ Will perform 4-message exchange with DHCPv6 server, requesting
+ the minimum required options to TFTP boot. Complies with RFC 8415.
+ 
 config BOOTP_MAY_FAIL
bool "Allow for the BOOTP/DHCP server to not be found"
depends on CMD_BOOTP
@@ -1758,6 +1767,23 @@ config BOOTP_VCI_STRING
default "U-Boot.arm" if ARM
default "U-Boot"
 
+if CMD_DHCP6
+
+config DHCP6_PXE_CLIENTARCH
+   hex
+   default 0x16 if ARM64
+   default 0x15 if ARM
+   default 0xFF
+
+config DHCP6_PXE_DHCP_OPTION
+   bool "Request & store 'pxe_configfile' from DHCP6 server"
+
+config DHCP6_ENTERPRISE_ID
+   int "Enterprise ID to send in DHCPv6 Vendor Class Option"
+   default 0
+
+endif
+
 config CMD_TFTPBOOT
bool "tftpboot"
default y
diff --git a/include/net.h b/include/net.h
index 399af5e064..cac818e292 100644
--- a/include/net.h
+++ b/include/net.h
@@ -484,6 +484,10 @@ extern charnet_hostname[32];   /* Our hostname 
*/
 #ifdef CONFIG_NET
 extern charnet_root_path[CONFIG_BOOTP_MAX_ROOT_PATH_LEN];  /* Our root 
path */
 #endif
+#if defined(CONFIG_DHCP6_PXE_DHCP_OPTION)
+/* Indicates whether the pxe path prefix / config file was specified in dhcp 
option */
+extern char *pxelinux_configfile;
+#endif
 /** END OF BOOTP EXTENTIONS **/
 extern u8  net_ethaddr[ARP_HLEN];  /* Our ethernet address 
*/
 extern u8  net_server_ethaddr[ARP_HLEN];   /* Boot server enet 
address */
@@ -504,8 +508,8 @@ extern ushort   net_native_vlan;/* Our 
Native VLAN */
 extern int net_restart_wrap;   /* Tried all network devices */
 
 enum proto_t {
-   BOOTP, RARP, ARP, TFTPGET, DHCP, PING, PING6, DNS, NFS, CDP, NETCONS,
-   SNTP, TFTPSRV, TFTPPUT, LINKLOCAL, FASTBOOT, WOL, UDP, NCSI, WGET
+   BOOTP, RARP, ARP, TFTPGET, DHCP, DHCP6, PING, PING6, DNS, NFS, CDP,
+   NETCONS, SNTP, TFTPSRV, TFTPPUT, LINKLOCAL, FASTBOOT, WOL, UDP, NCSI, 
WGET
 };
 
 extern charnet_boot_file_name[1024];/* Boot File name */
diff --git a/net/Makefile b/net/Makefile
index bea000b206..5968110170 100644
--- a/net/Makefile
+++ b/net/Makefile
@@ -22,6 +22,7 @@ obj-$(CONFIG_IPV6) += net6.o
 obj-$(CONFIG_CMD_NFS)  += nfs.o
 obj-$(CONFIG_CMD_PING) += ping.o
 obj-$(CONFIG_CMD_PING6) += ping6.o
+obj-$(CONFIG_CMD_DHCP6) += dhcpv6.o
 obj-$(CONFIG_CMD_PCAP) += pcap.o
 obj-$(CONFIG_CMD_RARP) += rarp.o
 obj-$(CONFIG_CMD_SNTP) += sntp.o
diff --git a/net/dhcpv6.c b/net/dhcpv6.c
new file mode 100644
index 00..0f0fa291d3
--- /dev/null
+++ b/net/dhcpv6.c
@@ -0,0 +1,741 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) Microsoft Corporation
+ * Author: Sean Edmond 
+ *
+ */
+
+/* Simple DHCP6 network layer implementation. */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "dhcpv6.h"
+#include 
+#include 
+#include "net_rand.h"
+
+/* Copied from bootp */
+#ifndef CONFIG_NET_RETRY_COUNT
+# define TIMEOUT_COUNT 5   /* # of timeouts before giving up */
+#else
+# define TIMEOUT_COUNT (CONFIG_NET_RETRY_COUNT)
+#endif
+
+#define PORT_DHCP6_S   547 /* DHCP6 server UDP port */
+#define PORT_DHCP6_C   546 /* DHCP6 client UDP port */
+
+//default timeout parameters (in ms)
+#define SOL_MAX_DELAY_MS   1000
+#define SOL_TIMEOUT_MS 1000
+#define SOL_MAX_RT_MS  360
+#define REQ_TIMEOUT_MS 1000
+#define REQ_MAX_RT_MS  3
+#define REQ_MAX_RC 10
+#define MAX_WAIT_TIME_MS   6
+
+//global variable to track any updates from DHCP6 server
+int updated_sol_max_rt_ms = SOL_MAX_RT_MS;
+
+static void dhcp6_timeout_handler(v

[PATCH 2/2] net: dhcp6: pxe: Add DHCP/PXE commands for IPv6

2023-02-01 Thread seanedmond
From: Sean Edmond 

Adds commands to support DHCP and PXE with IPv6.

New commands added (when IPv6 is enabled):
- dhcp6
- pxe get -ipv6
- pxe boot -ipv6

Signed-off-by: Sean Edmond 
---
 boot/bootmeth_distro.c |  2 +-
 boot/bootmeth_pxe.c|  4 +-
 boot/pxe_utils.c   |  3 +-
 cmd/net.c  | 22 +++
 cmd/pxe.c  | 86 +-
 cmd/sysboot.c  |  2 +-
 include/net.h  |  2 +
 include/net6.h |  2 -
 include/pxe_utils.h| 10 -
 9 files changed, 115 insertions(+), 18 deletions(-)

diff --git a/boot/bootmeth_distro.c b/boot/bootmeth_distro.c
index 356929828b..b4b73ecbf5 100644
--- a/boot/bootmeth_distro.c
+++ b/boot/bootmeth_distro.c
@@ -150,7 +150,7 @@ static int distro_boot(struct udevice *dev, struct bootflow 
*bflow)
info.dev = dev;
info.bflow = bflow;
ret = pxe_setup_ctx(&ctx, &cmdtp, distro_getfile, &info, true,
-   bflow->subdir);
+   bflow->subdir, false);
if (ret)
return log_msg_ret("ctx", -EINVAL);
 
diff --git a/boot/bootmeth_pxe.c b/boot/bootmeth_pxe.c
index ecf8557af8..5a8af2bbd0 100644
--- a/boot/bootmeth_pxe.c
+++ b/boot/bootmeth_pxe.c
@@ -70,7 +70,7 @@ static int distro_pxe_read_bootflow(struct udevice *dev, 
struct bootflow *bflow)
addr = simple_strtoul(addr_str, NULL, 16);
 
log_debug("calling pxe_get()\n");
-   ret = pxe_get(addr, &bootdir, &size);
+   ret = pxe_get(addr, &bootdir, &size, false);
log_debug("pxe_get() returned %d\n", ret);
if (ret)
return log_msg_ret("pxeb", ret);
@@ -146,7 +146,7 @@ static int distro_pxe_boot(struct udevice *dev, struct 
bootflow *bflow)
info.bflow = bflow;
info.cmdtp = &cmdtp;
ret = pxe_setup_ctx(ctx, &cmdtp, distro_pxe_getfile, &info, false,
-   bflow->subdir);
+   bflow->subdir, false);
if (ret)
return log_msg_ret("ctx", -EINVAL);
 
diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c
index 3a1e50f2b1..d13c47dd94 100644
--- a/boot/pxe_utils.c
+++ b/boot/pxe_utils.c
@@ -1578,7 +1578,7 @@ void handle_pxe_menu(struct pxe_context *ctx, struct 
pxe_menu *cfg)
 
 int pxe_setup_ctx(struct pxe_context *ctx, struct cmd_tbl *cmdtp,
  pxe_getfile_func getfile, void *userdata,
- bool allow_abs_path, const char *bootfile)
+ bool allow_abs_path, const char *bootfile, bool use_ipv6)
 {
const char *last_slash;
size_t path_len = 0;
@@ -1588,6 +1588,7 @@ int pxe_setup_ctx(struct pxe_context *ctx, struct cmd_tbl 
*cmdtp,
ctx->getfile = getfile;
ctx->userdata = userdata;
ctx->allow_abs_path = allow_abs_path;
+   ctx->use_ipv6 = use_ipv6;
 
/* figure out the boot directory, if there is one */
if (bootfile && strlen(bootfile) >= MAX_TFTP_PATH_LEN)
diff --git a/cmd/net.c b/cmd/net.c
index 4227321871..88d53d14d5 100644
--- a/cmd/net.c
+++ b/cmd/net.c
@@ -111,6 +111,28 @@ U_BOOT_CMD(
 );
 #endif
 
+#if defined(CONFIG_CMD_DHCP6)
+static int do_dhcp6(struct cmd_tbl *cmdtp, int flag, int argc,
+   char *const argv[])
+{
+   int i;
+   int dhcp_argc;
+   char *dhcp_argv[] = {NULL, NULL, NULL, NULL};
+
+   /* Add -ipv6 flag for autoload */
+   for (i = 0; i < argc; i++)
+   dhcp_argv[i] = argv[i];
+   dhcp_argc = argc + 1;
+   dhcp_argv[dhcp_argc - 1] =  USE_IP6_CMD_PARAM;
+
+   return netboot_common(DHCP6, cmdtp, dhcp_argc, dhcp_argv);
+}
+
+U_BOOT_CMD(dhcp6,  3,  1,  do_dhcp6,
+  "boot image via network using DHCPv6/TFTP protocol",
+  "[loadAddress] [[hostIPaddr:]bootfilename]");
+#endif
+
 #if defined(CONFIG_CMD_DHCP)
 static int do_dhcp(struct cmd_tbl *cmdtp, int flag, int argc,
   char *const argv[])
diff --git a/cmd/pxe.c b/cmd/pxe.c
index db8e4697f2..ebc44fd661 100644
--- a/cmd/pxe.c
+++ b/cmd/pxe.c
@@ -11,6 +11,10 @@
 
 #include "pxe_utils.h"
 
+#if IS_ENABLED(CONFIG_IPV6)
+#include 
+#endif
+
 #ifdef CONFIG_CMD_NET
 const char *pxe_default_paths[] = {
 #ifdef CONFIG_SYS_SOC
@@ -29,12 +33,20 @@ static int do_get_tftp(struct pxe_context *ctx, const char 
*file_path,
 {
char *tftp_argv[] = {"tftp", NULL, NULL, NULL};
int ret;
+   int num_args;
 
tftp_argv[1] = file_addr;
tftp_argv[2] = (void *)file_path;
+   if (ctx->use_ipv6) {
+   tftp_argv[3] = USE_IP6_CMD_PARAM;
+   num_args = 4;
+   } else {
+   num_args = 3;
+   }
 
-   if (do_tftpb(ctx->cmdtp, 0, 3, tftp_argv))
+   if (do_tftpb(ctx->cmdtp, 0, num_args, tftp_argv))
return -ENOENT;
+
ret = pxe_get_file_size(sizep);
if (ret)
return log_msg_ret("tftp", ret);
@@ -43,6 +55,22 @@ static int do_get_tftp(struct pxe_context *ctx, const char 
*file_path,

[PATCH 0/2] net: DHCPv6 protocol and commands

2023-02-01 Thread seanedmond
From: Sean Edmond 

The recently integrated IPv6 patch series relies on the link-local address,
or a statically assigned IPv6 address for network operations.  This patch
series adds IPv6 address assignment through DHCPv6.

The implementation meets the requirements in RFC 8415 for "Client/Server
Exchanges Involving Four Messages":
https://www.rfc-editor.org/rfc/rfc8415

The implementation sends/receives the minimum required DHCPv6 options to 
network boot.

A new command (dhcp6) will execute the protocol.  In addition, IPv6
functionality has been extended to the existing pxe commands ("pxe get"
and "pxe boot").

Sean Edmond (2):
  net: dhcp6: Add DHCPv6 (DHCP for IPv6)
  net: dhcp6: pxe: Add DHCP/PXE commands for IPv6

 boot/bootmeth_distro.c |   2 +-
 boot/bootmeth_pxe.c|   4 +-
 boot/pxe_utils.c   |   3 +-
 cmd/Kconfig|  26 ++
 cmd/net.c  |  22 ++
 cmd/pxe.c  |  86 -
 cmd/sysboot.c  |   2 +-
 include/net.h  |  10 +-
 include/net6.h |   2 -
 include/pxe_utils.h|  10 +-
 net/Makefile   |   1 +
 net/dhcpv6.c   | 741 +
 net/dhcpv6.h   | 212 
 net/net.c  |  12 +
 14 files changed, 1113 insertions(+), 20 deletions(-)
 create mode 100644 net/dhcpv6.c
 create mode 100644 net/dhcpv6.h

-- 
2.39.0



[PATCH 3/3] board: Add new Broadcom Northstar board

2023-02-01 Thread Linus Walleij
This adds a simple Northstar "BRCMNS" board to be used with
the BCM4709x and BCM5301x chips.

The main intention is to use this with the D-Link DIR-890L
and DIR-885L routers for loading the kernel into RAM from
NAND memory using the BCH-1 ECC and using the separately
submitted SEAMA load command, so we are currently not adding
support for things such as networking.

If other board need other ECC for example, they need to
create a separate DTS file and augment the code, but I don't
know if any other users will turn up.

Cc: Rafał Miłecki 
Signed-off-by: Linus Walleij 
---
 arch/arm/Kconfig |  1 +
 arch/arm/dts/Makefile|  2 ++
 arch/arm/dts/ns-board.dts| 57 ++
 board/broadcom/bcmns/Kconfig | 12 +++
 board/broadcom/bcmns/MAINTAINERS |  6 
 board/broadcom/bcmns/Makefile|  2 ++
 board/broadcom/bcmns/ns.c| 60 
 configs/bcmns_defconfig  | 41 ++
 include/configs/bcmns.h  | 49 ++
 9 files changed, 230 insertions(+)
 create mode 100644 arch/arm/dts/ns-board.dts
 create mode 100644 board/broadcom/bcmns/Kconfig
 create mode 100644 board/broadcom/bcmns/MAINTAINERS
 create mode 100644 board/broadcom/bcmns/Makefile
 create mode 100644 board/broadcom/bcmns/ns.c
 create mode 100644 configs/bcmns_defconfig
 create mode 100644 include/configs/bcmns.h

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 312f1411f85b..7c6fdff2692f 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -2284,6 +2284,7 @@ source "board/Marvell/octeontx2/Kconfig"
 source "board/armltd/vexpress/Kconfig"
 source "board/armltd/vexpress64/Kconfig"
 source "board/cortina/presidio-asic/Kconfig"
+source "board/broadcom/bcmns/Kconfig"
 source "board/broadcom/bcmns3/Kconfig"
 source "board/cavium/thunderx/Kconfig"
 source "board/eets/pdu001/Kconfig"
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 3ecd6a86e95e..d045511cd1ee 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -1173,6 +1173,8 @@ dtb-$(CONFIG_ARCH_BCM283X) += \
bcm2837-rpi-cm3-io3.dtb \
bcm2711-rpi-4-b.dtb
 
+dtb-$(CONFIG_TARGET_BCMNS) += ns-board.dtb
+
 dtb-$(CONFIG_TARGET_BCMNS3) += ns3-board.dtb
 
 dtb-$(CONFIG_ARCH_BCMSTB) += bcm7xxx.dtb
diff --git a/arch/arm/dts/ns-board.dts b/arch/arm/dts/ns-board.dts
new file mode 100644
index ..bc2a0dd1c961
--- /dev/null
+++ b/arch/arm/dts/ns-board.dts
@@ -0,0 +1,57 @@
+// SPDX-License-Identifier:  GPL-2.0+
+
+/dts-v1/;
+
+#include "bcm5301x.dtsi"
+
+/ {
+   /*
+* The Northstar does not have a proper fallback compatible, but
+* these basic chips will suffice.
+*/
+   model = "Northstar model";
+   compatible = "brcm,bcm47094", "brcm,bcm4708";
+   #address-cells = <1>;
+   #size-cells = <1>;
+   interrupt-parent = <&gic>;
+
+   memory {
+   device_type = "memory";
+   reg = <0x 0x0800>,
+ <0x8800 0x0800>;
+   };
+
+   aliases {
+   serial0 = &uart0;
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   nand-controller@18028000 {
+   nandcs: nand@0 {
+   compatible = "brcm,nandcs";
+   reg = <0>;
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   /*
+* Same as using the bcm5301x-nand-cs0-bch1.dtsi
+* include from the Linux kernel.
+*/
+   nand-ecc-algo = "bch";
+   nand-ecc-strength = <1>;
+   nand-ecc-step-size = <512>;
+
+   partitions {
+   compatible = "brcm,bcm947xx-cfe-partitions";
+   };
+   };
+   };
+};
+
+&uart0 {
+   clock-frequency = <12500>;
+   status = "okay";
+};
diff --git a/board/broadcom/bcmns/Kconfig b/board/broadcom/bcmns/Kconfig
new file mode 100644
index ..82f4709e2d2d
--- /dev/null
+++ b/board/broadcom/bcmns/Kconfig
@@ -0,0 +1,12 @@
+if TARGET_BCMNS
+
+config SYS_BOARD
+   default "bcmns"
+
+config SYS_VENDOR
+   default "broadcom"
+
+config SYS_CONFIG_NAME
+   default "bcmns"
+
+endif
diff --git a/board/broadcom/bcmns/MAINTAINERS b/board/broadcom/bcmns/MAINTAINERS
new file mode 100644
index ..fd37c334a5b1
--- /dev/null
+++ b/board/broadcom/bcmns/MAINTAINERS
@@ -0,0 +1,6 @@
+BCMNS BOARD
+M: Linus Walleij 
+S: Maintained
+F: board/broadcom/bcmnsp/
+F: configs/bcmnsp_defconfig
+F: include/configs/bcmnsp.h
diff --git a/board/broadcom/bcmns/Makefile b/board/broadcom/bcmns/Makefile
new file mode 100644
index ..8a6a8543a90b
--- /dev/null
+++ b/board/broadcom/bcmns/Makefile
@@ -0,0 +1,2 @@
+# SPDX-License-Ident

[PATCH 1/3] arm: dts: Import device tree for Broadcom Northstar

2023-02-01 Thread Linus Walleij
This brings in the main SoC device tree used by the
Broadcom Northstar chipset, i.e. BCM4709x and BCM5301x.
This is taken from the latest Linux kernel.

Cc: Rafał Miłecki 
Signed-off-by: Linus Walleij 
---
 arch/arm/dts/bcm5301x.dtsi  | 581 
 include/dt-bindings/clock/bcm-nsp.h |  51 +++
 2 files changed, 632 insertions(+)
 create mode 100644 arch/arm/dts/bcm5301x.dtsi
 create mode 100644 include/dt-bindings/clock/bcm-nsp.h

diff --git a/arch/arm/dts/bcm5301x.dtsi b/arch/arm/dts/bcm5301x.dtsi
new file mode 100644
index ..5fc1b847f4aa
--- /dev/null
+++ b/arch/arm/dts/bcm5301x.dtsi
@@ -0,0 +1,581 @@
+/*
+ * Broadcom BCM470X / BCM5301X ARM platform code.
+ * Generic DTS part for all BCM53010, BCM53011, BCM53012, BCM53014, BCM53015,
+ * BCM53016, BCM53017, BCM53018, BCM4707, BCM4708 and BCM4709 SoCs
+ *
+ * Copyright 2013-2014 Hauke Mehrtens 
+ *
+ * Licensed under the GNU/GPL. See COPYING for details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/ {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   interrupt-parent = <&gic>;
+
+   chipcommon-a-bus@1800 {
+   compatible = "simple-bus";
+   ranges = <0x 0x1800 0x1000>;
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   uart0: serial@300 {
+   compatible = "ns16550";
+   reg = <0x0300 0x100>;
+   interrupts = ;
+   clocks = <&iprocslow>;
+   status = "disabled";
+   };
+
+   uart1: serial@400 {
+   compatible = "ns16550";
+   reg = <0x0400 0x100>;
+   interrupts = ;
+   clocks = <&iprocslow>;
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinmux_uart1>;
+   status = "disabled";
+   };
+   };
+
+   mpcore-bus@1900 {
+   compatible = "simple-bus";
+   ranges = <0x 0x1900 0x00023000>;
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   a9pll: arm_clk@0 {
+   #clock-cells = <0>;
+   compatible = "brcm,nsp-armpll";
+   clocks = <&osc>;
+   reg = <0x0 0x1000>;
+   };
+
+   scu@2 {
+   compatible = "arm,cortex-a9-scu";
+   reg = <0x2 0x100>;
+   };
+
+   timer@20200 {
+   compatible = "arm,cortex-a9-global-timer";
+   reg = <0x20200 0x100>;
+   interrupts = ;
+   clocks = <&periph_clk>;
+   };
+
+   timer@20600 {
+   compatible = "arm,cortex-a9-twd-timer";
+   reg = <0x20600 0x20>;
+   interrupts = ;
+   clocks = <&periph_clk>;
+   };
+
+   watchdog@20620 {
+   compatible = "arm,cortex-a9-twd-wdt";
+   reg = <0x20620 0x20>;
+   interrupts = ;
+   clocks = <&periph_clk>;
+   };
+
+   gic: interrupt-controller@21000 {
+   compatible = "arm,cortex-a9-gic";
+   #interrupt-cells = <3>;
+   #address-cells = <0>;
+   interrupt-controller;
+   reg = <0x21000 0x1000>,
+ <0x20100 0x100>;
+   };
+
+   L2: cache-controller@22000 {
+   compatible = "arm,pl310-cache";
+   reg = <0x22000 0x1000>;
+   cache-unified;
+   arm,shared-override;
+   prefetch-data = <1>;
+   prefetch-instr = <1>;
+   cache-level = <2>;
+   };
+   };
+
+   pmu {
+   compatible = "arm,cortex-a9-pmu";
+   interrupts =
+   ,
+   ;
+   };
+
+   clocks {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   ranges;
+
+   osc: oscillator {
+   #clock-cells = <0>;
+   compatible = "fixed-clock";
+   clock-frequency = <2500>;
+   };
+
+   iprocmed: iprocmed {
+   #clock-cells = <0>;
+   compatible = "fixed-factor-clock";
+   clocks = <&genpll BCM_NSP_GENPLL_IPROCFAST_CLK>;
+   clock-div = <2>;
+   clock-mult = <1>;
+   };
+
+   iprocslow: iprocslow {
+   #cl

[PATCH 2/3] arm: Add support for the Broadcom Northstar SoCs

2023-02-01 Thread Linus Walleij
The original Northstar is an ARM SoC series that comprise
BCM4709x and BCM5301x and uses a dual-core Cortex A9, the
global timer and a few other things.

This series should not be confused with North Star Plus
(NSP) which is partly supported by U-Boot already.

The SoC is well supported by the Linux kernel and OpenWrt
as it is used in many routers.

Since we currently don't need any chip-specific quirks
and can get the system up from just the device tree, a
mach-* directory doesn't even need to be added, just
some small Kconfig fragments.

Cc: Rafał Miłecki 
Signed-off-by: Linus Walleij 
---
 arch/arm/Kconfig | 21 -
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 5e112e6a03d6..312f1411f85b 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -357,7 +357,7 @@ config SYS_ARM_ARCH
 
 choice
prompt "Select the ARM data write cache policy"
-   default SYS_ARM_CACHE_WRITETHROUGH if TARGET_BCMCYGNUS || RZA1
+   default SYS_ARM_CACHE_WRITETHROUGH if TARGET_BCMCYGNUS || TARGET_BCMNS 
|| RZA1
default SYS_ARM_CACHE_WRITEBACK
 
 config SYS_ARM_CACHE_WRITEBACK
@@ -670,6 +670,25 @@ config TARGET_BCMCYGNUS
imply HASH_VERIFY
imply NETDEVICES
 
+config TARGET_BCMNS
+   bool "Support Broadcom Northstar"
+   select CPU_V7A
+   select DM
+   select DM_GPIO
+   select DM_SERIAL
+   select OF_CONTROL
+   select TIMER
+   select SYS_NS16550
+   select ARM_GLOBAL_TIMER
+   imply SYS_THUMB_BUILD
+   imply MTD_RAW_NAND
+   imply NAND_BRCMNAND
+   imply NAND_BRCMNAND_IPROC
+   help
+ Support for Broadcom Northstar SoCs. NS is a dual-core 32-bit
+ ARMv7 Cortex-A9 SoC family including BCM4708, BCM47094,
+ BCM5301x etc.
+
 config TARGET_BCMNS2
bool "Support Broadcom Northstar2"
select ARM64
-- 
2.39.1



[PATCH 0/3] Add Broadcom Northstar basic support

2023-02-01 Thread Linus Walleij
This adds the device trees and minimal code needed to run
U-Boot on Broadcom Northstar SoCs.

This is needed to properly boot the D-Link DIR-890L router
as it refuse to directly boot compressed kernels bigger
than 2MB, and well our compressed kernel is bigger than
2MB so let's put in U-Boot.

While it is a bit tailored to this usecase (it can probably
also be used with the DIR-885L without modifications) it
forms a base that can be used to support more Northstar
boards.

I have this working with DIR-890L and OpenWrt:
https://dflund.se/~triad/krad/dlink-dir-890l/


Linus Walleij (3):
  arm: dts: Import device tree for Broadcom Northstar
  arm: Add support for the Broadcom Northstar SoCs
  board: Add new Broadcom Northstar board

 arch/arm/Kconfig|  22 +-
 arch/arm/dts/Makefile   |   2 +
 arch/arm/dts/bcm5301x.dtsi  | 581 
 arch/arm/dts/ns-board.dts   |  57 +++
 board/broadcom/bcmns/Kconfig|  12 +
 board/broadcom/bcmns/MAINTAINERS|   6 +
 board/broadcom/bcmns/Makefile   |   2 +
 board/broadcom/bcmns/ns.c   |  60 +++
 configs/bcmns_defconfig |  41 ++
 include/configs/bcmns.h |  49 +++
 include/dt-bindings/clock/bcm-nsp.h |  51 +++
 11 files changed, 882 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/bcm5301x.dtsi
 create mode 100644 arch/arm/dts/ns-board.dts
 create mode 100644 board/broadcom/bcmns/Kconfig
 create mode 100644 board/broadcom/bcmns/MAINTAINERS
 create mode 100644 board/broadcom/bcmns/Makefile
 create mode 100644 board/broadcom/bcmns/ns.c
 create mode 100644 configs/bcmns_defconfig
 create mode 100644 include/configs/bcmns.h
 create mode 100644 include/dt-bindings/clock/bcm-nsp.h

-- 
2.39.1



[PATCH v3] arm: mvebu: Add support for Thecus N2350 (Armada 385) board

2023-02-01 Thread Tony Dinh
Thecus N2350 is a NAS based on Marvell Armada 385 SoC.

Specification:

- Processor: Marvel MV88F6820 Dual Core at 1GHz
- 1 GiB DDR4 RAM
- 4MB Macronix mx25l3205d SPI flash
- 512MB Hynix H27U4G8F2DTR-BC NAND flash
- I2C
- 2x USB 3.0
- 1x GBE LAN port (PHY: Marvell 88E1510)
- 2x SATA (hot swap slots)
- 3x buttons
- 10x LEDS
- serial console

Signed-off-by: Tony Dinh 
---

Changes in v3:
- Add missing DTS file path in MAINTAINERS file
- Remove "common.h" in board file
- Remove CFG_I2C_MVTWSI_BASE0 in include header file
- Cleanup unecessary comments in include header file

Changes in v2:
- Use node pointers already defined from armada-38x.dtsi in this board DTS
- Remove extra compatible attributes in this board DTS
- Remove unnecessary armada-385-thecus-n2350-u-boot.dtsi
- Remove unnecessary check_board() function in board file
- Remove unnecessary "default false" for DDR4 in arch/arm/mach-mvebu/Kconfig
- Use "rootfs" as partition name for NAND partition
- Various DTS naming convention correction

 arch/arm/dts/Makefile|   1 +
 arch/arm/dts/armada-385-thecus-n2350.dts | 446 +++
 arch/arm/mach-mvebu/Kconfig  |  11 +
 board/thecus/n2350/MAINTAINERS   |   7 +
 board/thecus/n2350/Makefile  |   6 +
 board/thecus/n2350/n2350.c   | 126 +++
 configs/n2350_defconfig  |  93 +
 include/configs/n2350.h  |  56 +++
 8 files changed, 746 insertions(+)
 create mode 100644 arch/arm/dts/armada-385-thecus-n2350.dts
 create mode 100644 board/thecus/n2350/MAINTAINERS
 create mode 100644 board/thecus/n2350/Makefile
 create mode 100644 board/thecus/n2350/n2350.c
 create mode 100644 configs/n2350_defconfig
 create mode 100644 include/configs/n2350.h

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 3ecd6a86e9..c5d1825a3b 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -245,6 +245,7 @@ dtb-$(CONFIG_ARCH_MVEBU) += \
armada-385-atl-x530.dtb \
armada-385-atl-x530DP.dtb   \
armada-385-db-88f6820-amc.dtb   \
+   armada-385-thecus-n2350.dtb \
armada-385-turris-omnia.dtb \
armada-388-clearfog.dtb \
armada-388-gp.dtb   \
diff --git a/arch/arm/dts/armada-385-thecus-n2350.dts 
b/arch/arm/dts/armada-385-thecus-n2350.dts
new file mode 100644
index 00..fc29c4d25a
--- /dev/null
+++ b/arch/arm/dts/armada-385-thecus-n2350.dts
@@ -0,0 +1,446 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Device Tree file for Thecus N2350 board
+ *
+ * Copyright (C) 2018-2023 Tony Dinh 
+ * Copyright (C) 2018 Manuel Jung 
+ */
+
+/dts-v1/;
+#include 
+#include 
+#include "armada-385.dtsi"
+
+/ {
+   model = "Thecus N2350";
+   compatible = "thecus,n2350", "marvell,armada385";
+
+   aliases {
+   ethernet0 = ð0;
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   memory {
+   device_type = "memory";
+   reg = <0x 0x4000>; /* 1GB */
+   };
+
+   soc {
+   ranges = ;
+
+   };
+
+   usb3_0_phy: usb3_0_phy {
+   compatible = "usb-nop-xceiv";
+   vcc-supply = <&usb3_0_power>;
+   };
+
+   usb3_1_phy: usb3_1_phy {
+   compatible = "usb-nop-xceiv";
+   vcc-supply = <&usb3_1_power>;
+   };
+
+   gpio-keys {
+   compatible = "gpio-keys";
+   #address-cells = <1>;
+   #size-cells = <0>;
+   pinctrl-0 = <&pmx_power_button &pmx_copy_button 
&pmx_reset_button>;
+   pinctrl-names = "default";
+
+   button@1 {
+   label = "Power Button";
+   linux,code = ;
+   gpios = <&gpio1 17 GPIO_ACTIVE_HIGH>;
+   };
+
+   button@2 {
+   label = "Copy Button";
+   linux,code = ;
+   gpios = <&gpio1 20 GPIO_ACTIVE_HIGH>;
+   };
+
+   button@3 {
+   label = "Reset Button";
+   linux,code = ;
+   gpios = <&gpio1 18 GPIO_ACTIVE_HIGH>;
+   };
+   };
+
+   gpio-leds {
+   compatible = "gpio-leds";
+   pinctrl-0 = <&pmx_sata1_white_led
+   &pmx_sata1_red_led
+   &pmx_sata2_white_led
+   &pmx_sata2_red_led
+   &pmx_sys_white_led
+   &pmx_sys_red_led
+   &pmx_pwr_blue_led
+   &pmx_pwr_red_led
+   &pmx_usb_white_led
+   &pmx_usb_red_led>;
+
+   pinctrl-names = "default";
+
+

[PATCH v3 56/76] rmobile: Drop CONFIG_SH73A0 and associated code

2023-02-01 Thread Simon Glass
This option does not exist, so the code attached to it is not used. Drop
it.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 arch/arm/mach-rmobile/Makefile|1 -
 arch/arm/mach-rmobile/cpu_info-sh73a0.c   |   43 -
 arch/arm/mach-rmobile/cpu_info.c  |1 -
 arch/arm/mach-rmobile/include/mach/gpio.h |5 +-
 arch/arm/mach-rmobile/include/mach/rmobile.h  |5 +-
 .../mach-rmobile/include/mach/sh73a0-gpio.h   |  553 
 arch/arm/mach-rmobile/include/mach/sh73a0.h   |  289 --
 arch/arm/mach-rmobile/pfc-sh73a0.c| 2807 -
 drivers/i2c/sh_i2c.c  |5 -
 drivers/serial/serial_sh.h|   10 +-
 10 files changed, 4 insertions(+), 3715 deletions(-)
 delete mode 100644 arch/arm/mach-rmobile/cpu_info-sh73a0.c
 delete mode 100644 arch/arm/mach-rmobile/include/mach/sh73a0-gpio.h
 delete mode 100644 arch/arm/mach-rmobile/include/mach/sh73a0.h
 delete mode 100644 arch/arm/mach-rmobile/pfc-sh73a0.c

diff --git a/arch/arm/mach-rmobile/Makefile b/arch/arm/mach-rmobile/Makefile
index 3f77760e50d..5b86221bc25 100644
--- a/arch/arm/mach-rmobile/Makefile
+++ b/arch/arm/mach-rmobile/Makefile
@@ -8,7 +8,6 @@ obj-y += emac.o
 
 obj-$(CONFIG_DISPLAY_BOARDINFO) += board.o
 obj-$(CONFIG_TMU_TIMER) += ../../sh/lib/time.o
-obj-$(CONFIG_SH73A0) += lowlevel_init.o cpu_info-sh73a0.o pfc-sh73a0.o
 obj-$(CONFIG_R8A7740) += lowlevel_init.o cpu_info-r8a7740.o pfc-r8a7740.o
 obj-$(CONFIG_RCAR_GEN2) += lowlevel_init_ca15.o cpu_info-rcar.o
 obj-$(CONFIG_RCAR_GEN3) += lowlevel_init_gen3.o cpu_info-rcar.o memmap-gen3.o
diff --git a/arch/arm/mach-rmobile/cpu_info-sh73a0.c 
b/arch/arm/mach-rmobile/cpu_info-sh73a0.c
deleted file mode 100644
index 0c7ee8acf5a..000
--- a/arch/arm/mach-rmobile/cpu_info-sh73a0.c
+++ /dev/null
@@ -1,43 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2012 Nobuhiro Iwamatsu 
- * (C) Copyright 2012 Renesas Solutions Corp.
- */
-#include 
-#include 
-
-u32 rmobile_get_cpu_type(void)
-{
-   u32 id;
-   u32 type;
-   struct sh73a0_hpb *hpb = (struct sh73a0_hpb *)HPB_BASE;
-
-   id = readl(&hpb->cccr);
-   type = (id >> 8) & 0xFF;
-
-   return type;
-}
-
-u32 rmobile_get_cpu_rev_integer(void)
-{
-   u32 id;
-   u32 rev;
-   struct sh73a0_hpb *hpb = (struct sh73a0_hpb *)HPB_BASE;
-
-   id = readl(&hpb->cccr);
-   rev = ((id >> 4) & 0xF) + 1;
-
-   return rev;
-}
-
-u32 rmobile_get_cpu_rev_fraction(void)
-{
-   u32 id;
-   u32 rev;
-   struct sh73a0_hpb *hpb = (struct sh73a0_hpb *)HPB_BASE;
-
-   id = readl(&hpb->cccr);
-   rev = id & 0xF;
-
-   return rev;
-}
diff --git a/arch/arm/mach-rmobile/cpu_info.c b/arch/arm/mach-rmobile/cpu_info.c
index bd9e71707f5..246029ac294 100644
--- a/arch/arm/mach-rmobile/cpu_info.c
+++ b/arch/arm/mach-rmobile/cpu_info.c
@@ -62,7 +62,6 @@ static const struct {
u16 cpu_type;
u8 cpu_name[10];
 } rmobile_cpuinfo[] = {
-   { RMOBILE_CPU_TYPE_SH73A0, "SH73A0" },
{ RMOBILE_CPU_TYPE_R8A7740, "R8A7740" },
{ RMOBILE_CPU_TYPE_R8A7790, "R8A7790" },
{ RMOBILE_CPU_TYPE_R8A7791, "R8A7791" },
diff --git a/arch/arm/mach-rmobile/include/mach/gpio.h 
b/arch/arm/mach-rmobile/include/mach/gpio.h
index 6b5e4ed4eb5..150aa46034d 100644
--- a/arch/arm/mach-rmobile/include/mach/gpio.h
+++ b/arch/arm/mach-rmobile/include/mach/gpio.h
@@ -1,10 +1,7 @@
 #ifndef __ASM_ARCH_GPIO_H
 #define __ASM_ARCH_GPIO_H
 
-#if defined(CONFIG_SH73A0)
-#include "sh73a0-gpio.h"
-void sh73a0_pinmux_init(void);
-#elif defined(CONFIG_R8A7740)
+#if defined(CONFIG_R8A7740)
 #include "r8a7740-gpio.h"
 void r8a7740_pinmux_init(void);
 #endif
diff --git a/arch/arm/mach-rmobile/include/mach/rmobile.h 
b/arch/arm/mach-rmobile/include/mach/rmobile.h
index dc6f87631bc..53f9a80ecfe 100644
--- a/arch/arm/mach-rmobile/include/mach/rmobile.h
+++ b/arch/arm/mach-rmobile/include/mach/rmobile.h
@@ -2,9 +2,7 @@
 #define __ASM_ARCH_RMOBILE_H
 
 #if defined(CONFIG_ARCH_RMOBILE)
-#if defined(CONFIG_SH73A0)
-#include 
-#elif defined(CONFIG_R8A7740)
+#if defined(CONFIG_R8A7740)
 #include 
 #elif defined(CONFIG_R8A7790)
 #include 
@@ -25,7 +23,6 @@
 #endif /* CONFIG_ARCH_RMOBILE */
 
 /* PRR CPU IDs */
-#define RMOBILE_CPU_TYPE_SH73A00x37
 #define RMOBILE_CPU_TYPE_R8A7740   0x40
 #define RMOBILE_CPU_TYPE_R8A7790   0x45
 #define RMOBILE_CPU_TYPE_R8A7791   0x47
diff --git a/arch/arm/mach-rmobile/include/mach/sh73a0-gpio.h 
b/arch/arm/mach-rmobile/include/mach/sh73a0-gpio.h
deleted file mode 100644
index 398e2c10913..000
--- a/arch/arm/mach-rmobile/include/mach/sh73a0-gpio.h
+++ /dev/null
@@ -1,553 +0,0 @@
-#ifndef __ASM_SH73A0_H__
-#define __ASM_SH73A0_H__
-
-/* Pin Function Controller:
- * GPIO_FN_xx - GPIO used to select pin function and MSEL switch
- * GPIO_PORTxx - GPIO mapped to real I/O pin on CPU
- */
-enum {
-   /* Hardware manual Table 25-1 (GPIO) */
-   GPI

Re: [PATCH] RFC: CI: add test/usage_of_is_enabled_check.sh

2023-02-01 Thread Troy Kisky
Hi Simon

On Wed, Feb 1, 2023 at 12:21 PM Simon Glass  wrote:

> Hi Troy,
>
> On Tue, 31 Jan 2023 at 12:57, Troy Kisky 
> wrote:
> >
> > Add script usage_of_is_enabled_check to print any configs that
> > use CONFIG_IS_ENABLED instead of IS_ENABLED and vice versa.
> >
> > Add usage_of_is_enabled_commit.sh to generate commits to fix the above
> > issues.
> >
> > Signed-off-by: Troy Kisky 
> > ---
> >  .azure-pipelines.yml   | 11 
> >  .gitlab-ci.yml |  5 
> >  test/usage_of_is_enabled_check.sh  | 41 ++
> >  test/usage_of_is_enabled_commit.sh | 38 +++
> >  4 files changed, 95 insertions(+)
> >  create mode 100755 test/usage_of_is_enabled_check.sh
> >  create mode 100755 test/usage_of_is_enabled_commit.sh
>
> This looks reasonable to me. I would of course prefer to just fix all
> these problems, since they make it impossible to move to split config.
>

So, this might help your effort ?
Do I need to have a body in these 200 commits  or is only a subject enough ?
Are you happy with the subject, or do I need to edit each individually ?

Currently I have
CONFIG_ZSTD: change IS_ENABLED to CONFIG_IS_ENABLED

Is there an easy way for "git send-email" to send each commit only to the
proper maintainer ?


>
> But we need this sort of check in CI to stop it happening again.
>
> >
> > diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
> > index 5673bb76afb..8e227512765 100644
> > --- a/.azure-pipelines.yml
> > +++ b/.azure-pipelines.yml
> > @@ -67,6 +67,17 @@ stages:
> >:^doc/ :^arch/arm/dts/ :^scripts/kconfig/lkc.h
> >:^include/linux/kconfig.h :^tools/ && exit 1 || exit 0
> >
> > +  - job: check_usage_of_is_enabled
> > +displayName: 'Check usage of CONFIG_IS_ENABLED vs IS_ENABLED'
> > +pool:
> > +  vmImage: $(ubuntu_vm)
> > +container:
> > +  image: $(ci_runner_image)
> > +  options: $(container_option)
> > +steps:
> > +  # generate list of SPL configs
> > +  - script: test/usage_of_is_enabled_check.sh
> > +
> >- job: cppcheck
> >  displayName: 'Static code analysis with cppcheck'
> >  pool:
> > diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
> > index aaf9d25abfc..6bb8efef258 100644
> > --- a/.gitlab-ci.yml
> > +++ b/.gitlab-ci.yml
> > @@ -134,6 +134,11 @@ check for new CONFIG symbols outside Kconfig:
> >  :^doc/ :^arch/arm/dts/ :^scripts/kconfig/lkc.h
> >  :^include/linux/kconfig.h :^tools/ && exit 1 || exit 0
> >
> > +check usage of CONFIG_IS_ENABLED vs IS_ENABLED:
> > +  stage: testsuites
> > +  script:
> > +- ./test/usage_of_is_enabled_check.sh
> > +
> >  # QA jobs for code analytics
> >  # static code analysis with cppcheck (we can add --enable=all later)
> >  cppcheck:
> > diff --git a/test/usage_of_is_enabled_check.sh
> b/test/usage_of_is_enabled_check.sh
> > new file mode 100755
> > index 000..0bc9bff8bd1
> > --- /dev/null
> > +++ b/test/usage_of_is_enabled_check.sh
> > @@ -0,0 +1,41 @@
> > +#!/bin/bash
> > +# generate list of CONFIGs that should use CONFIG_IS_ENABLED
>
> Could you add a few comments about the steps in here?
>

+# 1. all obj-$(CONFIG_$(SPL_)xxx in Makefiles
+# 2. all SPL_xxx in Kconfig files
+# 3. all CONFIG_CMD_xxx which already use CONFIG_IS_ENABLED
+#The Makefile for most if these use ifndef CONFIG_SPL_BUILD
+#instead of obj-$(CONFIG_$(SPL_)xxx
+# 4. A list of other configs that should use CONFIG_IS_ENABLED
+#Note: CONFIG_CLK was included to prevent a change in
test_checkpatch.py
+#which is checking for an error.
+#This list could be reduced if obj-$(CONFIG_$(SPL_)xxx was used
instead of
+#ifndef CONFIG_SPL_BUILD in Makefiles


>
> > +{ { git grep 'obj-$(CONFIG_$(SPL_'|grep Makefile|sed -e
> "s/SPL_TPL_/SPL_/"| \
> > +sed -n -r
> 's/obj\-\$\(CONFIG_\$\(SPL_\)([0-9a-zA-Z_]+)\)/\n\{\1\}\n/gp'| \
> > +sed -n -r 's/\{([0-9a-zA-Z_]+)\}/\1/p'; } ;\
> > +{ git grep -E 'config [ST]PL_'|grep Kconfig| \
> > +sed -n -r "s/config [ST]PL_([0-9a-zA-Z_]+)/\n\{\1\}\n/p" |
> > +sed -n -r 's/\{([0-9a-zA-Z_]+)\}/\1/p'; } ; \
> > +git grep -E 'CONFIG_IS_ENABLED\(CMD_'|sed -n -e
> "s/\(CONFIG_IS_ENABLED(CMD_[0-9a-zA-Z_]*)\)/\n\1\n/gp"| \
> > +sed -n -r "s/CONFIG_IS_ENABLED\((CMD_[0-9a-zA-Z_]+)\)/\1/p"; \
> > +echo -e "\
> > +BZIP2\n\
> > +CONFIG_CLK\n\
>
> CLK ?
>
>
Addressed above


> > +DM_EVENT\n\
> > +EFI_DEVICE_PATH_TO_TEXT\n\
> > +EFI_LOADER\n\
> > +ERRNO_STR\n\
> > +GENERATE_SMBIOS_TABLE\n\
> > +";\
>
> What is the above list for? Can you add a comment?
>
>
Addressed above


> > +} | sort -u >splcfg.tmp
> > +
> > +{
> > +# generate list of CONFIGs that incorrectly use CONFIG_IS_ENABLED
> > +git grep CONFIG_IS_ENABLED|sed -n -e
> "s/\(CONFIG_IS_ENABLED([0-9a-zA-Z_]*)\)/\n\1\n/gp"| \
> > +sed -n -r "s/CONFIG_IS_ENABLED\(([0-9a-zA-Z_]+)\)/\1/p" |sort -u| comm
> -23 - splcfg.tmp ;
> > +
> > +# generate list of CONFIGs that incorrectly use IS_ENABLED
> > +git grep -w IS_ENABL

[PATCH v3 6/8] dm: treewide: Complete migration to new driver model schema

2023-02-01 Thread Simon Glass
Update various build and test components to use the new schema.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 drivers/core/ofnode.c| 10 +-
 drivers/video/video-uclass.c |  4 ++--
 dts/Kconfig  |  2 +-
 include/dm/device.h  |  2 +-
 include/dm/ofnode.h  | 10 +-
 scripts/Makefile.lib | 12 ++--
 test/dm/test-fdt.c   |  2 +-
 test/py/tests/test_ofplatdata.py |  8 
 tools/binman/binman.rst  |  3 +--
 tools/dtoc/test_fdt.py   |  8 
 10 files changed, 30 insertions(+), 31 deletions(-)

diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index 4d56b1a7675..5249a60639b 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -1265,22 +1265,22 @@ bool ofnode_pre_reloc(ofnode node)
 {
 #if defined(CONFIG_SPL_BUILD) || defined(CONFIG_TPL_BUILD)
/* for SPL and TPL the remaining nodes after the fdtgrep 1st pass
-* had property dm-pre-reloc or u-boot,dm-spl/tpl.
+* had property bootph-all or bootph-pre-sram/bootph-pre-ram.
 * They are removed in final dtb (fdtgrep 2nd pass)
 */
return true;
 #else
-   if (ofnode_read_bool(node, "u-boot,dm-pre-reloc"))
+   if (ofnode_read_bool(node, "bootph-all"))
return true;
-   if (ofnode_read_bool(node, "u-boot,dm-pre-proper"))
+   if (ofnode_read_bool(node, "bootph-some-ram"))
return true;
 
/*
 * In regular builds individual spl and tpl handling both
 * count as handled pre-relocation for later second init.
 */
-   if (ofnode_read_bool(node, "u-boot,dm-spl") ||
-   ofnode_read_bool(node, "u-boot,dm-tpl"))
+   if (ofnode_read_bool(node, "bootph-pre-ram") ||
+   ofnode_read_bool(node, "bootph-pre-sram"))
return true;
 
return false;
diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
index 0ce376ca3f1..17c47f546a1 100644
--- a/drivers/video/video-uclass.c
+++ b/drivers/video/video-uclass.c
@@ -529,8 +529,8 @@ static int video_post_bind(struct udevice *dev)
addr = uc_priv->video_ptr;
size = alloc_fb(dev, &addr);
if (addr < gd->video_bottom) {
-   /* Device tree node may need the 'u-boot,dm-pre-reloc' or
-* 'u-boot,dm-pre-proper' tag
+   /* Device tree node may need the 'bootph-all' or
+* 'bootph-some-ram' tag
 */
printf("Video device '%s' cannot allocate frame buffer memory 
-ensure the device is set up before relocation\n",
   dev->name);
diff --git a/dts/Kconfig b/dts/Kconfig
index bc5f22029ff..d7206641c34 100644
--- a/dts/Kconfig
+++ b/dts/Kconfig
@@ -352,7 +352,7 @@ config OF_SPL_REMOVE_PROPS
help
  Since SPL normally runs in a reduced memory space, the device tree
  is cut down to only what is needed to load and start U-Boot. Only
- nodes marked with the property "u-boot,dm-pre-reloc" will be
+ nodes marked with the property "bootph-all" will be
  included. In addition, some properties are not used by U-Boot and
  can be discarded. This option defines the list of properties to
  discard.
diff --git a/include/dm/device.h b/include/dm/device.h
index e9460386ca9..b86bf90609b 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -1070,7 +1070,7 @@ static inline bool device_is_on_pci_bus(const struct 
udevice *dev)
  * sub-nodes and binds drivers for each node where a driver can be found.
  *
  * If this is called prior to relocation, only pre-relocation devices will be
- * bound (those marked with u-boot,dm-pre-reloc in the device tree, or where
+ * bound (those marked with bootph-all in the device tree, or where
  * the driver has the DM_FLAG_PRE_RELOC flag set). Otherwise, all devices will
  * be bound.
  *
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index fa9865602d8..793ad37ff2c 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -1176,12 +1176,12 @@ int ofnode_read_simple_size_cells(ofnode node);
  * determine if a node was bound in one of SPL/TPL stages.
  *
  * There are 4 settings currently in use
- * - u-boot,dm-pre-proper: U-Boot proper pre-relocation only
- * - u-boot,dm-pre-reloc: legacy and indicates any of TPL or SPL
+ * - bootph-some-ram: U-Boot proper pre-relocation only
+ * - bootph-all: all phases
  * Existing platforms only use it to indicate nodes needed in
- * SPL. Should probably be replaced by u-boot,dm-spl for new platforms.
- * - u-boot,dm-spl: SPL and U-Boot pre-relocation
- * - u-boot,dm-tpl: TPL and U-Boot pre-relocation
+ * SPL. Should probably be replaced by bootph-pre-ram for new platforms.
+ * - bootph-pre-ram: SPL and U-Boot pre-relocation
+ * - bootph-pre-sram: TPL and U-Boot pre-relocation
  *
  * @node: node to check
  * Return: true if node is needed in SPL/TL, false ot

[PATCH v3 8/8] CI: Add a check for pre-schema driver model tags

2023-02-01 Thread Simon Glass
These should not be used anymore. Add a check to ensure they don't creek
back into U-Boot. Use bootph-... instead.

Signed-off-by: Simon Glass 
---

Changes in v3:
- Add a new patch to check for pre-schema driver model tags in CI

 .azure-pipelines.yml | 12 
 .gitlab-ci.yml   |  9 +
 2 files changed, 21 insertions(+)

diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index 5673bb76afb..7e1d0ffc960 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -213,6 +213,18 @@ stages:
   export PYTHONPATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt
   make pylint_err
 
+  - job: check_for_pre_schema_tags
+displayName: 'Check for pre-schema driver model tags'
+pool:
+  vmImage: $(ubuntu_vm)
+container:
+  image: $(ci_runner_image)
+  options: $(container_option)
+steps:
+  # If grep succeeds and finds a match the test fails as we should
+  # have no matches.
+  - script: git grep u-boot,dm- -- '*.dts*' && exit 1 || exit 0
+
 - stage: test_py
   jobs:
   - job: test_py
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index aaf9d25abfc..88598747d57 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -232,6 +232,15 @@ Run pylint:
 - export PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt"
 - make pylint_err
 
+# Check for pre-schema driver model tags
+Check for pre-schema tags:
+  stage: testsuites
+  script:
+- git config --global --add safe.directory "${CI_PROJECT_DIR}";
+# If grep succeeds and finds a match the test fails as we should
+# have no matches.
+- git grep u-boot,dm- -- '*.dts*' && exit 1 || exit 0
+
 # Test sandbox with test.py
 sandbox test.py:
   variables:
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 5/8] dm: doc: Move to new driver model schema

2023-02-01 Thread Simon Glass
Now that Linux has accepted these tags, update the dtoc tool to use them.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 tools/dtoc/dtb_platdata.py | 10 +-
 tools/dtoc/test/dtoc_test_add_prop.dts |  4 ++--
 tools/dtoc/test/dtoc_test_addr32.dts   |  4 ++--
 tools/dtoc/test/dtoc_test_addr32_64.dts|  6 +++---
 tools/dtoc/test/dtoc_test_addr64.dts   |  6 +++---
 tools/dtoc/test/dtoc_test_addr64_32.dts|  6 +++---
 tools/dtoc/test/dtoc_test_alias_bad.dts|  6 +++---
 tools/dtoc/test/dtoc_test_alias_bad_path.dts   |  6 +++---
 tools/dtoc/test/dtoc_test_alias_bad_uc.dts |  6 +++---
 tools/dtoc/test/dtoc_test_aliases.dts  |  4 ++--
 tools/dtoc/test/dtoc_test_driver_alias.dts |  2 +-
 tools/dtoc/test/dtoc_test_inst.dts |  6 +++---
 tools/dtoc/test/dtoc_test_invalid_driver.dts   |  2 +-
 tools/dtoc/test/dtoc_test_noparent.dts |  6 +++---
 tools/dtoc/test/dtoc_test_noprops.dts  |  2 +-
 tools/dtoc/test/dtoc_test_phandle.dts  | 10 +-
 tools/dtoc/test/dtoc_test_phandle_bad.dts  |  2 +-
 tools/dtoc/test/dtoc_test_phandle_bad2.dts |  4 ++--
 tools/dtoc/test/dtoc_test_phandle_cd_gpios.dts | 10 +-
 tools/dtoc/test/dtoc_test_phandle_reorder.dts  |  4 ++--
 tools/dtoc/test/dtoc_test_phandle_single.dts   |  4 ++--
 tools/dtoc/test/dtoc_test_simple.dts   | 10 +-
 tools/dtoc/test/dtoc_test_single_reg.dts   |  4 ++--
 tools/dtoc/test_fdt.py |  2 +-
 24 files changed, 63 insertions(+), 63 deletions(-)

diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py
index a69a7889ce1..39f416cfd80 100644
--- a/tools/dtoc/dtb_platdata.py
+++ b/tools/dtoc/dtb_platdata.py
@@ -35,9 +35,9 @@ PROP_IGNORE_LIST = [
 'linux,phandle',
 "status",
 'phandle',
-'u-boot,dm-pre-reloc',
-'u-boot,dm-tpl',
-'u-boot,dm-spl',
+'bootph-all',
+'bootph-pre-sram',
+'bootph-pre-ram',
 ]
 
 # C type declarations for the types we support
@@ -442,7 +442,7 @@ class DtbPlatdata():
 """
 parent = node.parent
 if parent and not parent.props:
-raise ValueError("Parent node '%s' has no properties - do you need 
u-boot,dm-spl or similar?" %
+raise ValueError("Parent node '%s' has no properties - do you need 
bootph-pre-ram or similar?" %
  parent.path)
 num_addr, num_size = 2, 2
 if parent:
@@ -754,7 +754,7 @@ class DtbPlatdata():
 # This might indicate that the parent node is not in the
 # SPL/TPL devicetree but the child is. For example if we are
 # dealing with of-platdata in TPL, the parent has a
-# u-boot,dm-tpl tag but the child has u-boot,dm-pre-reloc. In
+# bootph-pre-sram tag but the child has bootph-all. In
 # this case the child node exists in TPL but the parent does
 # not.
 raise ValueError("Node '%s' requires parent node '%s' but it 
is not in the valid list" %
diff --git a/tools/dtoc/test/dtoc_test_add_prop.dts 
b/tools/dtoc/test/dtoc_test_add_prop.dts
index fa296e55527..8225de36d27 100644
--- a/tools/dtoc/test/dtoc_test_add_prop.dts
+++ b/tools/dtoc/test/dtoc_test_add_prop.dts
@@ -11,13 +11,13 @@
#address-cells = <1>;
#size-cells = <1>;
spl-test {
-   u-boot,dm-pre-reloc;
+   bootph-all;
compatible = "sandbox,spl-test";
intval = <1>;
};
 
spl-test2 {
-   u-boot,dm-pre-reloc;
+   bootph-all;
compatible = "sandbox,spl-test";
intarray = <5>;
};
diff --git a/tools/dtoc/test/dtoc_test_addr32.dts 
b/tools/dtoc/test/dtoc_test_addr32.dts
index 239045497c6..3e7dc567292 100644
--- a/tools/dtoc/test/dtoc_test_addr32.dts
+++ b/tools/dtoc/test/dtoc_test_addr32.dts
@@ -12,13 +12,13 @@
#size-cells = <1>;
 
test1 {
-   u-boot,dm-pre-reloc;
+   bootph-all;
compatible = "test1";
reg = <0x1234 0x5678>;
};
 
test2 {
-   u-boot,dm-pre-reloc;
+   bootph-all;
compatible = "test2";
reg = <0x12345678 0x98765432 2 3>;
};
diff --git a/tools/dtoc/test/dtoc_test_addr32_64.dts 
b/tools/dtoc/test/dtoc_test_addr32_64.dts
index 7599d5b0a59..7ce16feef1a 100644
--- a/tools/dtoc/test/dtoc_test_addr32_64.dts
+++ b/tools/dtoc/test/dtoc_test_addr32_64.dts
@@ -12,19 +12,19 @@
#size-cells = <2>;
 
test1 {
-   u-boot,dm-pre-reloc;
+   bootph-all;
compatible = "test1";
reg = <0x1234 0x5678 0x0>;
};
 
test2 {
-   u-boot,dm-pre-reloc;
+   bootph-all;
compatible = "test2";
reg = <0x12345678 

[PATCH v3 4/8] dm: doc: Update documentation for new driver model schema

2023-02-01 Thread Simon Glass
Now that Linux has accepted these tags, move U-Boot over to use them.
Tidy up the comments and formatting, making sure that VPL is mentioned
too.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 doc/README.TPL|  4 +--
 doc/develop/driver-model/design.rst   | 15 +--
 .../driver-model/fs_firmware_loader.rst   |  4 +--
 doc/develop/driver-model/of-plat.rst  | 25 ++-
 doc/develop/driver-model/pci-info.rst | 10 
 doc/develop/driver-model/serial-howto.rst | 24 +-
 doc/develop/spl.rst   |  5 ++--
 7 files changed, 45 insertions(+), 42 deletions(-)

diff --git a/doc/README.TPL b/doc/README.TPL
index 72027fd692e..95b466e4af9 100644
--- a/doc/README.TPL
+++ b/doc/README.TPL
@@ -35,8 +35,8 @@ is set. Source files can be compiled for TPL with options 
chosen in the
 board config file.
 
 TPL use a small device tree (u-boot-tpl.dtb), containing only the nodes with
-the pre-relocation properties: 'u-boot,dm-pre-reloc' and 'u-boot,dm-tpl'
-(see README.SPL for details).
+the pre-relocation properties: 'bootph-all' and 'bootph-pre-sram'
+(see doc/develop/spl.rst for details).
 
 For example:
 
diff --git a/doc/develop/driver-model/design.rst 
b/doc/develop/driver-model/design.rst
index 20611e85e34..8c2c81d7ac9 100644
--- a/doc/develop/driver-model/design.rst
+++ b/doc/develop/driver-model/design.rst
@@ -1114,12 +1114,12 @@ Pre-Relocation Support
 --
 
 For pre-relocation we simply call the driver model init function. Only
-drivers marked with DM_FLAG_PRE_RELOC or the device tree 'u-boot,dm-pre-reloc'
+drivers marked with DM_FLAG_PRE_RELOC or the device tree 'bootph-all'
 property are initialised prior to relocation. This helps to reduce the driver
 model overhead. This flag applies to SPL and TPL as well, if device tree is
 enabled (CONFIG_OF_CONTROL) there.
 
-Note when device tree is enabled, the device tree 'u-boot,dm-pre-reloc'
+Note when device tree is enabled, the device tree 'bootph-all'
 property can provide better control granularity on which device is bound
 before relocation. While with DM_FLAG_PRE_RELOC flag of the driver all
 devices with the same driver are bound, which requires allocation a large
@@ -1128,14 +1128,15 @@ only way for statically declared devices via 
U_BOOT_DRVINFO() to be bound
 prior to relocation.
 
 It is possible to limit this to specific relocation steps, by using
-the more specialized 'u-boot,dm-spl' and 'u-boot,dm-tpl' flags
-in the device tree node. For U-Boot proper you can use 'u-boot,dm-pre-proper'
+the more specialized 'bootph-pre-ram' and 'bootph-pre-sram' flags
+in the device tree node. For U-Boot proper you can use 'bootph-some-ram'
 which means that it will be processed (and a driver bound) in U-Boot proper
 prior to relocation, but will not be available in SPL or TPL.
 
-To reduce the size of SPL and TPL, only the nodes with pre-relocation 
properties
-('u-boot,dm-pre-reloc', 'u-boot,dm-spl' or 'u-boot,dm-tpl') are keept in their
-device trees (see README.SPL for details); the remaining nodes are always 
bound.
+To reduce the size of SPL and TPL, only the nodes with pre-relocation
+properties ('bootph-all', 'bootph-pre-ram' or 'bootph-pre-sram') are kept in
+their device trees (see README.SPL for details); the remaining nodes are
+always bound.
 
 Then post relocation we throw that away and re-init driver model again.
 For drivers which require some sort of continuity between pre- and
diff --git a/doc/develop/driver-model/fs_firmware_loader.rst 
b/doc/develop/driver-model/fs_firmware_loader.rst
index a44708cb4c5..b0823700a90 100644
--- a/doc/develop/driver-model/fs_firmware_loader.rst
+++ b/doc/develop/driver-model/fs_firmware_loader.rst
@@ -28,7 +28,7 @@ defined in fs-loader node as shown in below:
 Example for block device::
 
fs_loader0: fs-loader {
-   u-boot,dm-pre-reloc;
+   bootph-all;
compatible = "u-boot,fs-loader";
phandlepart = <&mmc 1>;
};
@@ -41,7 +41,7 @@ device, it can be described in FDT as shown in below:
 Example for ubi::
 
fs_loader1: fs-loader {
-   u-boot,dm-pre-reloc;
+   bootph-all;
compatible = "u-boot,fs-loader";
mtdpart = "UBI",
ubivol = "ubi0";
diff --git a/doc/develop/driver-model/of-plat.rst 
b/doc/develop/driver-model/of-plat.rst
index b454f7be85e..01724ba72ce 100644
--- a/doc/develop/driver-model/of-plat.rst
+++ b/doc/develop/driver-model/of-plat.rst
@@ -67,7 +67,7 @@ device. As an example, consider this MMC node:
 pinctrl-0 = <&sdmmc_clk>, <&sdmmc_cmd>, <&sdmmc_cd>, <&sdmmc_bus4>;
 vmmc-supply = <&vcc_sd>;
 status = "okay";
-u-boot,dm-pre-reloc;
+bootph-all;
 };
 
 
@@ -632,7 +632,7 @@ the devicetree. For example, if the devicetree has::
grf: grf

[PATCH v3 3/8] dm: doc: Update device tree binding docs for new schema

2023-02-01 Thread Simon Glass
Now that Linux has accepted these tags, move U-Boot over to use them.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 doc/device-tree-bindings/chosen.txt   |  2 +-
 .../clock/rockchip,rk3368-dmc.txt |  2 +-
 .../clock/rockchip,rk3399-dmc.txt |  2 +-
 .../clock/st,stm32mp1.txt | 22 +--
 doc/device-tree-bindings/device.txt   |  6 ++---
 .../fsp/fsp2/apollolake/fsp-s.txt |  2 +-
 .../memory-controller/k3-j721e-ddrss.txt  |  2 +-
 .../memory-controllers/k3-am654-ddrss.txt |  2 +-
 doc/device-tree-bindings/misc/fs_loader.txt   |  8 +++
 doc/device-tree-bindings/net/mdio-mux-reg.txt |  2 +-
 doc/device-tree-bindings/pci/x86-pci.txt  |  4 ++--
 .../pinctrl/nexell,s5pxx18-pinctrl.txt|  2 +-
 .../ram/fsl,mpc83xx-mem-controller.txt|  2 +-
 .../video/atmel-hlcdc.txt |  2 +-
 14 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/doc/device-tree-bindings/chosen.txt 
b/doc/device-tree-bindings/chosen.txt
index e5ba6720ce1..c8312540f57 100644
--- a/doc/device-tree-bindings/chosen.txt
+++ b/doc/device-tree-bindings/chosen.txt
@@ -129,7 +129,7 @@ Example
};
 
fs_loader0: fs-loader@0 {
-   u-boot,dm-pre-reloc;
+   bootph-all;
compatible = "u-boot,fs-loader";
phandlepart = <&mmc 1>;
};
diff --git a/doc/device-tree-bindings/clock/rockchip,rk3368-dmc.txt 
b/doc/device-tree-bindings/clock/rockchip,rk3368-dmc.txt
index 8e7357d53d3..da474fbabde 100644
--- a/doc/device-tree-bindings/clock/rockchip,rk3368-dmc.txt
+++ b/doc/device-tree-bindings/clock/rockchip,rk3368-dmc.txt
@@ -54,7 +54,7 @@ Example (for DDR3-1600K and 800MHz)
#include 
 
dmc: dmc@ff61 {
-   u-boot,dm-pre-reloc;
+   bootph-all;
compatible = "rockchip,rk3368-dmc";
reg = <0 0xff61 0 0x400
   0 0xff62 0 0x400>;
diff --git a/doc/device-tree-bindings/clock/rockchip,rk3399-dmc.txt 
b/doc/device-tree-bindings/clock/rockchip,rk3399-dmc.txt
index a15dc5d1f85..4a56f78f555 100644
--- a/doc/device-tree-bindings/clock/rockchip,rk3399-dmc.txt
+++ b/doc/device-tree-bindings/clock/rockchip,rk3399-dmc.txt
@@ -16,7 +16,7 @@ Required properties:
 
 Example:
dmc: dmc {
-   u-boot,dm-pre-reloc;
+   bootph-all;
compatible = "rockchip,rk3399-dmc";
devfreq-events = <&dfi>;
interrupts = ;
diff --git a/doc/device-tree-bindings/clock/st,stm32mp1.txt 
b/doc/device-tree-bindings/clock/st,stm32mp1.txt
index 4d4136d2fce..e638bcef7bc 100644
--- a/doc/device-tree-bindings/clock/st,stm32mp1.txt
+++ b/doc/device-tree-bindings/clock/st,stm32mp1.txt
@@ -251,9 +251,9 @@ Example of clock tree initialization
 
 / {
clocks {
-   u-boot,dm-pre-reloc;
+   bootph-all;
clk_hse: clk-hse {
-   u-boot,dm-pre-reloc;
+   bootph-all;
#clock-cells = <0>;
compatible = "fixed-clock";
clock-frequency = <2400>;
@@ -261,28 +261,28 @@ Example of clock tree initialization
};
 
clk_hsi: clk-hsi {
-   u-boot,dm-pre-reloc;
+   bootph-all;
#clock-cells = <0>;
compatible = "fixed-clock";
clock-frequency = <6400>;
};
 
clk_lse: clk-lse {
-   u-boot,dm-pre-reloc;
+   bootph-all;
#clock-cells = <0>;
compatible = "fixed-clock";
clock-frequency = <32768>;
};
 
clk_lsi: clk-lsi {
-   u-boot,dm-pre-reloc;
+   bootph-all;
#clock-cells = <0>;
compatible = "fixed-clock";
clock-frequency = <32000>;
};
 
clk_csi: clk-csi {
-   u-boot,dm-pre-reloc;
+   bootph-all;
#clock-cells = <0>;
compatible = "fixed-clock";
clock-frequency = <400>;
@@ -292,7 +292,7 @@ Example of clock tree initialization
soc {
 
rcc: rcc@5000 {
-   u-boot,dm-pre-reloc;
+   bootph-all;
compatible = "st,stm32mp1-rcc", "syscon";
reg = <0x5000 0x1000>;
#address-cells = <1>;
@@ -371,7 +371,7 @@ Example of clock tree initialization
reg = <0>;
cfg = < 2 80 0 0 0 PQR(1,0,0) >;
frac = < 0x800 

[PATCH v3 7/8] checkpatch: Add a warning for pre-schema driver model tags

2023-02-01 Thread Simon Glass
Help ensure that these don't creep into development by adding a check in
checkpatch for them.

Signed-off-by: Simon Glass 
---

Changes in v3:
- Add a new patch to warn about pre-schema driver model tags

 scripts/checkpatch.pl   | 6 ++
 tools/patman/test_checkpatch.py | 6 ++
 2 files changed, 12 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index ccfcbb3e125..62b764f6c38 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2680,6 +2680,12 @@ sub u_boot_line {
"DEVICE_PRIV_AUTO", $herecurr);
u_boot_struct_name($line, "per_device_plat_auto", "_plat",
"DEVICE_PLAT_AUTO", $herecurr);
+
+   # Avoid using the pre-schema driver model tags
+   if ($line =~ /^\+.*u-boot,dm-.*/) {
+   ERROR("PRE_SCHEMA",
+ "Driver model schema uses 'bootph-...' tags now\n" . 
$herecurr);
+   }
 }
 
 sub exclude_global_initialisers {
diff --git a/tools/patman/test_checkpatch.py b/tools/patman/test_checkpatch.py
index 4c2ab6e590e..a8bb364e42b 100644
--- a/tools/patman/test_checkpatch.py
+++ b/tools/patman/test_checkpatch.py
@@ -452,6 +452,12 @@ index 000..2234c87
 self.check_strl("cat");
 self.check_strl("cpy");
 
+def test_schema(self):
+"""Check for uses of strn(cat|cpy)"""
+pm = PatchMaker()
+pm.add_line('arch/sandbox/dts/sandbox.dtsi', '\tu-boot,dm-pre-proper;')
+self.check_single_message(pm, 'PRE_SCHEMA', 'error')
+
 if __name__ == "__main__":
 unittest.main()
 gitutil.RunTests()
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 1/8] schemas: Add schema for U-Boot driver model 'phase tags'

2023-02-01 Thread Simon Glass
U-Boot has some particular challenges with device tree and devices:

- U-Boot has multiple build phases, such as a Secondary Program Loader
  (SPL) phase which typically runs in a pre-SDRAM environment where code
  and data space are limited. In particular, there may not be enough
  space for the full device tree blob. U-Boot uses various automated
  techniques to reduce the size from perhaps 40KB to 3KB. It is not
  always possible to handle these tags entirely at build time, since
  U-Boot proper must have the full device tree, even though we do not
  want it to process all nodes until after relocation.
- Some U-Boot phases needs to run before the clocks are properly set up,
  where the CPU may be running very slowly. Therefore it is important to
  bind only those devices which are actually needed in that phase
- U-Boot uses lazy initialisation for its devices, with 'bind' and
  'probe' being separate steps. Even if a device is bound, it is not
  actually probed until it is used. This is necessary to keep the boot
  time reasonable, e.g. to under a second

The phases of U-Boot in order are: TPL, VPL, SPL, U-Boot (first
pre-relocation, then post-relocation). ALl but the last two are optional.

For the above reasons, U-Boot only includes the full device tree in the
final 'U-Boot proper' build. Even then, before relocation U-Boot only
processes nodes which are marked as being needed.

For this to work, U-Boot's driver model[1] provides a way to mark device
tree nodes as applicable for a particular phase. This works by adding a
tag to the node, e.g.:

   cru: clock-controller@ff76 {
  bootph-all;
  compatible = "rockchip,rk3399-cru";
  reg = <0x0 0xff76 0x0 0x1000>;
  rockchip,grf = <&grf>;
  #clock-cells = <1>;
  #reset-cells = <1>;
  ...
   };

Here the "bootph-all" tag indicates that the node must be present in all
phases, since the clock driver is required.

There has been discussion over the years about whether this could be done
in a property instead, e.g.

   options {
  bootph-all = <&cru> <&gpio_a> ...;
  ...
   };

Some problems with this:

- we need to be able to merge several such tags from different .dtsi files
  since many boards have their own specific requirements
- it is hard to find and cross-reference the affected nodes
- it is more error-prone
- it requires significant tool rework in U-Boot, including fdtgrep and
  the build system
- is harder (slower, more code) to process since it involves scanning
  another node/property to find out what to do with a particular node
- we don't want to add phandle arguments to the above since we are
  referring, e.g., to the clock device as a whole, not a paricular clock
- the of-platdata feature[2], which converts device tree to C for even
  more constrained environments, would need to become aware of the
  /options node

There is also the question about whether this needs to be U-Boot-specific,
or whether the tags could be generic. From what I can tell, U-Boot is the
only bootloader which seriously attempts to use a runtime device tree in
all cases. For this version, an attempt is made to name the phases in a
generic manner.

It should also be noted that the approach provided here has stood the test
of time, used in U-Boot for 8 years so far.

So add the schema for this. This will allow a major class of schema
exceptions to be dropped from the U-Boot source tree.

This has been applied upstream[3]

[1] https://u-boot.readthedocs.io/en/latest/develop/driver-model/index.html
[2] https://u-boot.readthedocs.io/en/latest/develop/driver-model/of-plat.html
[3] https://github.com/devicetree-org/dt-schema/commit/63bd847

Signed-off-by: Simon Glass 
---

(no changes since v2)

Changes in v2:
- Add binding document

 doc/device-tree-bindings/bootph.yaml | 88 
 1 file changed, 88 insertions(+)
 create mode 100644 doc/device-tree-bindings/bootph.yaml

diff --git a/doc/device-tree-bindings/bootph.yaml 
b/doc/device-tree-bindings/bootph.yaml
new file mode 100644
index 000..a3ccf06efa7
--- /dev/null
+++ b/doc/device-tree-bindings/bootph.yaml
@@ -0,0 +1,88 @@
+# SPDX-License-Identifier: BSD-2-Clause
+# Copyright 2022 Google LLC
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/bootph.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Boot-phase-specific device nodes
+
+maintainers:
+  - Simon Glass 
+
+description: |
+  Some programs run in memory-constrained environments yet want to make use
+  of device tree.
+
+  The full device tree is often quite large relative to the available memory
+  of a boot phase, so cannot fit into every phase of the boot process. Even
+  when memory is not a problem, some phases may wish to limit which device
+  nodes are present, so as to reduce execution time.
+
+  This binding supports adding tags to device tree nodes to allow them to be
+  marked according to the phases where they should be included.
+
+  Without any tags, nodes are

[PATCH v3 0/8] dm: Move to new driver model schema for device tree tags

2023-02-01 Thread Simon Glass
Now that a new schema has been accepted upstream, press it into service in
U-Boot.

Changes in v3:
- Add a new patch to warn about pre-schema driver model tags
- Add a new patch to check for pre-schema driver model tags in CI

Changes in v2:
- Add binding document
- Convert k3-am68-sk boards also

Simon Glass (8):
  schemas: Add schema for U-Boot driver model 'phase tags'
  dm: dts: Convert driver model tags to use new schema
  dm: doc: Update device tree binding docs for new schema
  dm: doc: Update documentation for new driver model schema
  dm: doc: Move to new driver model schema
  dm: treewide: Complete migration to new driver model schema
  checkpatch: Add a warning for pre-schema driver model tags
  CI: Add a check for pre-schema driver model tags

 .azure-pipelines.yml  | 12 +++
 .gitlab-ci.yml|  9 ++
 arch/arc/dts/abilis_tb100.dts |  2 +-
 arch/arc/dts/axc001.dtsi  |  2 +-
 arch/arc/dts/axc003.dtsi  |  2 +-
 arch/arc/dts/axs10x_mb.dtsi   |  6 +-
 arch/arc/dts/emsdp.dts|  2 +-
 arch/arc/dts/hsdk-common.dtsi |  2 +-
 arch/arc/dts/iot_devkit.dts   |  2 +-
 arch/arc/dts/nsim.dts |  2 +-
 arch/arc/dts/skeleton.dtsi|  2 +-
 arch/arm/dts/am335x-brppt1-mmc-u-boot.dtsi| 48 +-
 arch/arm/dts/am335x-brsmarc1.dts  | 28 +++---
 arch/arm/dts/am335x-brxre1.dts| 22 ++---
 arch/arm/dts/am335x-evm-u-boot.dtsi   | 22 ++---
 arch/arm/dts/am335x-evmsk-u-boot.dtsi |  4 +-
 arch/arm/dts/am335x-guardian-u-boot.dtsi  | 28 +++---
 arch/arm/dts/am335x-pdu001-u-boot.dtsi| 30 +++
 arch/arm/dts/am335x-pxm50-u-boot.dtsi |  4 +-
 arch/arm/dts/am335x-regor-rdk-u-boot.dtsi |  8 +-
 arch/arm/dts/am335x-rut-u-boot.dtsi   |  4 +-
 .../dts/am335x-sancloud-bbe-lite-u-boot.dtsi  | 18 ++--
 arch/arm/dts/am335x-shc-u-boot.dtsi   | 20 ++---
 arch/arm/dts/am335x-wega-rdk-u-boot.dtsi  | 14 +--
 arch/arm/dts/am33xx-u-boot.dtsi   |  2 +-
 arch/arm/dts/am3517-evm-u-boot.dtsi   | 18 ++--
 arch/arm/dts/am4372-generic-u-boot.dtsi   |  4 +-
 arch/arm/dts/am4372-u-boot.dtsi   | 20 ++---
 arch/arm/dts/am437x-gp-evm-u-boot.dtsi| 24 ++---
 arch/arm/dts/am437x-idk-evm-u-boot.dtsi   |  8 +-
 arch/arm/dts/am437x-sk-evm-u-boot.dtsi|  8 +-
 arch/arm/dts/armada-3720-eDPU-u-boot.dtsi |  6 +-
 arch/arm/dts/armada-3720-uDPU-u-boot.dtsi |  6 +-
 arch/arm/dts/armada-385-atl-x530-u-boot.dtsi  |  2 +-
 .../dts/armada-385-turris-omnia-u-boot.dtsi   | 12 +--
 arch/arm/dts/armada-388-clearfog-u-boot.dtsi  | 18 ++--
 arch/arm/dts/armada-388-helios4-u-boot.dtsi   | 20 ++---
 .../armada-38x-controlcenterdc-u-boot.dtsi| 12 +--
 arch/arm/dts/armada-ap80x-quad.dtsi   |  8 +-
 .../arm/dts/armada-xp-theadorable-u-boot.dtsi |  2 +-
 arch/arm/dts/ast2500-evb.dts  |  8 +-
 arch/arm/dts/ast2500-u-boot.dtsi  |  8 +-
 arch/arm/dts/ast2600-evb.dts  |  6 +-
 arch/arm/dts/ast2600-u-boot.dtsi  | 10 +--
 .../dts/at91-sam9x60_curiosity-u-boot.dtsi| 34 +++
 arch/arm/dts/at91-sama5d27_giantboard.dts | 16 ++--
 arch/arm/dts/at91-sama5d27_som1_ek.dts| 24 ++---
 .../dts/at91-sama5d27_wlsom1_ek-u-boot.dtsi   | 20 ++---
 arch/arm/dts/at91-sama5d2_icp-u-boot.dtsi | 18 ++--
 arch/arm/dts/at91-sama5d2_ptc_ek.dts  | 18 ++--
 arch/arm/dts/at91-sama5d2_xplained.dts| 38 
 arch/arm/dts/at91-sama5d3_xplained.dts| 14 +--
 arch/arm/dts/at91-sama5d4_xplained.dts| 20 ++---
 arch/arm/dts/at91-sama5d4ek.dts   | 20 ++---
 arch/arm/dts/at91-sama7g5ek-u-boot.dtsi   | 24 ++---
 arch/arm/dts/at91sam9260-smartweb.dts |  4 +-
 arch/arm/dts/at91sam9260.dtsi | 26 +++---
 arch/arm/dts/at91sam9260ek.dts|  4 +-
 arch/arm/dts/at91sam9261.dtsi | 26 +++---
 arch/arm/dts/at91sam9263.dtsi | 26 +++---
 arch/arm/dts/at91sam9263ek.dts|  4 +-
 arch/arm/dts/at91sam9g15ek.dts|  2 +-
 arch/arm/dts/at91sam9g20-taurus.dts   |  6 +-
 arch/arm/dts/at91sam9g20ek_common.dtsi|  4 +-
 ...1sam9g25-gardena-smart-gateway-u-boot.dtsi |  2 +-
 arch/arm/dts/at91sam9g35ek.dts|  2 +-
 arch/arm/dts/at91sam9g45-corvus.dts   |  4 +-
 arch/arm/dts/at91sam9g45-gurnard.dts  |  4 +-
 arch/arm/dts/at91sam9g45.dtsi | 12 +--
 arch/arm/dts/at91sam9m10g45ek.dts |  4 +-
 arch/arm/dts/at91sam9n12.dtsi | 26 +++---
 arch/arm/dts/at91sam9n12ek.dts|  4 +-
 arch/arm/dts/at91sam9rl.dtsi  | 30 +++
 arch/arm/dts/at91sam9rlek.dts |  4 +-
 arch/arm/dts/at91sam9x35ek.dts|  2 +-
 ar

Re: [PATCH 3/8] blk: blkmap: Add basic infrastructure

2023-02-01 Thread Simon Glass
Hi Tobias,

On Wed, 1 Feb 2023 at 11:10, Tobias Waldekranz  wrote:
>
> blkmaps are loosely modeled on Linux's device mapper subsystem. The
> basic idea is that you can create virtual block devices whose blocks
> can be backed by a plethora of sources that are user configurable.
>
> This change just adds the basic infrastructure for creating and
> removing blkmap devices. Subsequent changes will extend this to add
> support for actual mappings.
>
> Signed-off-by: Tobias Waldekranz 
> ---
>  MAINTAINERS  |   6 +
>  disk/part.c  |   1 +
>  drivers/block/Kconfig|  18 ++
>  drivers/block/Makefile   |   1 +
>  drivers/block/blk-uclass.c   |   1 +
>  drivers/block/blkmap.c   | 275 +++
>  include/blkmap.h |  15 ++
>  include/dm/uclass-id.h   |   1 +
>  include/efi_loader.h |   4 +
>  lib/efi_loader/efi_device_path.c |  30 
>  10 files changed, 352 insertions(+)
>  create mode 100644 drivers/block/blkmap.c
>  create mode 100644 include/blkmap.h
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 3e8e193ecc..28a34231bf 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -786,6 +786,12 @@ M: Alper Nebi Yasak 
>  S: Maintained
>  F: tools/binman/
>
> +BLKMAP
> +M: Tobias Waldekranz 
> +S: Maintained
> +F: drivers/block/blkmap.c
> +F: include/blkmap.h
> +
>  BOOTDEVICE
>  M: Simon Glass 
>  S: Maintained
> diff --git a/disk/part.c b/disk/part.c
> index d449635254..35300df590 100644
> --- a/disk/part.c
> +++ b/disk/part.c
> @@ -140,6 +140,7 @@ void dev_print(struct blk_desc *dev_desc)
> case UCLASS_NVME:
> case UCLASS_PVBLOCK:
> case UCLASS_HOST:
> +   case UCLASS_BLKMAP:
> printf ("Vendor: %s Rev: %s Prod: %s\n",
> dev_desc->vendor,
> dev_desc->revision,
> diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
> index e95da48bdc..5a1aeb3d2b 100644
> --- a/drivers/block/Kconfig
> +++ b/drivers/block/Kconfig
> @@ -67,6 +67,24 @@ config BLOCK_CACHE
>   it will prevent repeated reads from directory structures and other
>   filesystem data structures.
>
> +config BLKMAP
> +   bool "Composable virtual block devices (blkmap)"
> +   depends on BLK
> +   help
> + Create virtual block devices that are backed by various sources,
> + e.g. RAM, or parts of an existing block device. Though much more
> + rudimentary, it borrows a lot of ideas from Linux's device mapper
> + subsystem.
> +
> + Example use-cases:
> + - Treat a region of RAM as a block device, i.e. a RAM disk. This 
> let's
> +you extract files from filesystem images stored in RAM (perhaps 
> as a
> +result of a TFTP transfer).
> + - Create a virtual partition on an existing device. This let's you
> +access filesystems that aren't stored at an exact partition
> +boundary. A common example is a filesystem image embedded in an 
> FIT
> +image.
> +
>  config SPL_BLOCK_CACHE
> bool "Use block device cache in SPL"
> depends on SPL_BLK
> diff --git a/drivers/block/Makefile b/drivers/block/Makefile
> index f12447d78d..a161d145fd 100644
> --- a/drivers/block/Makefile
> +++ b/drivers/block/Makefile
> @@ -14,6 +14,7 @@ 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_EFI_MEDIA) += efi-media-uclass.o
>  obj-$(CONFIG_EFI_MEDIA_SANDBOX) += sb_efi_media.o
> diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c
> index c69fc4d518..cb73faaeda 100644
> --- a/drivers/block/blk-uclass.c
> +++ b/drivers/block/blk-uclass.c
> @@ -32,6 +32,7 @@ static struct {
> { UCLASS_EFI_LOADER, "efiloader" },
> { UCLASS_VIRTIO, "virtio" },
> { UCLASS_PVBLOCK, "pvblock" },
> +   { UCLASS_BLKMAP, "blkmap" },
>  };
>
>  static enum uclass_id uclass_name_to_iftype(const char *uclass_idname)
> diff --git a/drivers/block/blkmap.c b/drivers/block/blkmap.c
> new file mode 100644
> index 00..a6ba07404c
> --- /dev/null
> +++ b/drivers/block/blkmap.c
> @@ -0,0 +1,275 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright (c) 2023 Addiva Elektronik
> + * Author: Tobias Waldekranz 
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 

The three above should go at the end:

https://u-boot.readthedocs.io/en/latest/develop/codingstyle.html#include-files

> +#include 
> +#include 
> +
> +struct blkmap;
> +
> +struct blkmap_slice {
> +   struct list_head node;
> +
> +   lbaint_t blknr;
> +   lbaint_t blkcnt;
> +
> +   ulong (*read)(struct blkmap *bm, struct blkmap_slice *bms,
> + lbaint_t blknr, lbaint_t b

Re: [GIT PULL] Please merge tags/fsl-qoriq-2023-2-1

2023-02-01 Thread Tom Rini
On Wed, Feb 01, 2023 at 12:56:16PM +, Peng Fan wrote:

> Hi Tom,
> 
> Please merge tags/fsl-qoriq-2023-2-1
> 
> CI: 
> https://source.denx.de/u-boot/custodians/u-boot-fsl-qoriq/-/pipelines/14973
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: Pull request: u-boot-imx u-boot-imx-20230201

2023-02-01 Thread Tom Rini
On Wed, Feb 01, 2023 at 10:40:42AM +0100, Stefano Babic wrote:

> Hi Tom,
> 
> this is the main PR for i.MX for 2023.04. Still open for me is the series
> related to i.MX9 sent recently by Peng. Please pull from u-boot-imx, thanks
> !
> 
> 
> The following changes since commit f147aa80f52989c7455022ca1ab959e8545feccc:
> 
>   Merge branch '2023-01-27-apple-soc-updates' (2023-01-27 14:48:22 -0500)
> 
> are available in the Git repository at:
> 
>   https://gitlab.denx.de/u-boot/custodians/u-boot-imx.git
> tags/u-boot-imx-20230201
> 
> for you to fetch changes up to f42c0726fd02e978a524ab35b060382d317ef438:
> 
>   arm: dts: imx8mn-u-boot: use versioned ddr4 firmware (2023-01-31 19:44:23
> +0100)
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v2 10/12] ARM: dts: uniphier: Fix node names and missing reg property in USB glue node

2023-02-01 Thread Marek Vasut

On 2/1/23 02:13, Kunihiko Hayashi wrote:

The node name should follow the generic name list in DT specification.
This moves "reset" to "reset-controller", "hs-phy" and "ss-phy" to "phy"
in the USB glue node.

And the node should have reg property to define the register region.

Signed-off-by: Kunihiko Hayashi 
---
  arch/arm/dts/uniphier-ld20.dtsi | 15 ---
  arch/arm/dts/uniphier-pro4.dtsi |  7 ---
  arch/arm/dts/uniphier-pro5.dtsi | 15 ---
  arch/arm/dts/uniphier-pxs2.dtsi | 20 +++-
  arch/arm/dts/uniphier-pxs3.dtsi | 20 +++-
  5 files changed, 42 insertions(+), 35 deletions(-)


I don't mind this patch, but would it make sense to later, in a separate 
patch, synchronize the .dtsi with Linux kernel fully ?


Re: [PATCH v2 09/12] phy: socionext: Add UniPhier USB3 PHY driver

2023-02-01 Thread Marek Vasut

On 2/1/23 02:13, Kunihiko Hayashi wrote:

Add USB3 PHY driver support to control clocks and resets for the phy.

Signed-off-by: Kunihiko Hayashi 
---
  configs/uniphier_v8_defconfig |  1 +
  drivers/phy/socionext/Kconfig |  7 ++
  drivers/phy/socionext/Makefile|  1 +
  drivers/phy/socionext/phy-uniphier-usb3.c | 89 +++
  4 files changed, 98 insertions(+)
  create mode 100644 drivers/phy/socionext/phy-uniphier-usb3.c

diff --git a/configs/uniphier_v8_defconfig b/configs/uniphier_v8_defconfig
index 6a0e2666cf..5cfa9fc01d 100644
--- a/configs/uniphier_v8_defconfig
+++ b/configs/uniphier_v8_defconfig
@@ -78,3 +78,4 @@ CONFIG_USB_DWC3=y
  CONFIG_USB_DWC3_UNIPHIER=y
  CONFIG_PANIC_HANG=y
  CONFIG_FDT_FIXUP_PARTITIONS=y
+CONFIG_PHY_UNIPHIER_USB3=y


This should be in 12/12 patch, right ?


diff --git a/drivers/phy/socionext/Kconfig b/drivers/phy/socionext/Kconfig
index bcd579e98e..fc63f4c042 100644
--- a/drivers/phy/socionext/Kconfig
+++ b/drivers/phy/socionext/Kconfig
@@ -10,3 +10,10 @@ config PHY_UNIPHIER_PCIE
help
  Enable this to support PHY implemented in PCIe controller
  on UniPhier SoCs.
+
+config PHY_UNIPHIER_USB3
+   bool "UniPhier USB3 PHY driver"
+   depends on PHY && ARCH_UNIPHIER


Maybe 'default y if SOMETHING' here, so you won't need to adjust defconfig ?


+   help
+ Enable this to support PHY implemented in USB3 controller
+ on UniPhier SoCs.
diff --git a/drivers/phy/socionext/Makefile b/drivers/phy/socionext/Makefile
index 5484360b70..94d3aa68cf 100644
--- a/drivers/phy/socionext/Makefile
+++ b/drivers/phy/socionext/Makefile
@@ -4,3 +4,4 @@
  #
  
  obj-$(CONFIG_PHY_UNIPHIER_PCIE)	+= phy-uniphier-pcie.o

+obj-$(CONFIG_PHY_UNIPHIER_USB3)+= phy-uniphier-usb3.o
diff --git a/drivers/phy/socionext/phy-uniphier-usb3.c 
b/drivers/phy/socionext/phy-uniphier-usb3.c
new file mode 100644
index 00..a2e44a52c1
--- /dev/null
+++ b/drivers/phy/socionext/phy-uniphier-usb3.c
@@ -0,0 +1,89 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * phy_uniphier_usb3.c - Socionext UniPhier Usb3 PHY driver
+ * Copyright 2019-2021 Socionext, Inc.


2023 instead of 2021 .


+ */
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+struct uniphier_usb3phy_priv {
+   struct clk_bulk clks;
+   struct reset_ctl_bulk rsts;
+};
+
+static int uniphier_usb3phy_init(struct phy *phy)
+{
+   struct uniphier_usb3phy_priv *priv = dev_get_priv(phy->dev);
+   int ret;
+
+   ret = clk_enable_bulk(&priv->clks);
+   if (ret) {
+   clk_release_bulk(&priv->clks);
+   return ret;
+   }
+
+   ret = reset_deassert_bulk(&priv->rsts);
+   if (ret) {
+   reset_release_bulk(&priv->rsts);


You have to disable clock here too.


+   return ret;
+   }
+
+   return 0;
+}
+
+static int uniphier_usb3phy_probe(struct udevice *dev)
+{
+   struct uniphier_usb3phy_priv *priv = dev_get_priv(dev);
+   int ret;
+
+   ret = clk_get_bulk(dev, &priv->clks);
+   if (ret) {
+   if (ret != -ENOSYS && ret != -ENOENT) {
+   printf("Failed to get clocks\n");
+   return ret;
+   }
+   }
+
+   ret = reset_get_bulk(dev, &priv->rsts);
+   if (ret) {
+   if (ret != -ENOSYS && ret != -ENOENT) {
+   printf("Failed to get resets\n");


You have to release resets here too (use fail path, i.e. goto err_clock).


+   return ret;
+   }
+   }
+
+   return 0;
+}


[...]


Re: [PATCH v2 07/12] reset: uniphier: Add USB glue reset support

2023-02-01 Thread Marek Vasut

On 2/1/23 02:13, Kunihiko Hayashi wrote:

Add reset control support in USB glue logic. This needs to control
the external clocks and resets for the logic before accessing the
glue logic.

Signed-off-by: Kunihiko Hayashi 


With the very little knowledge I have of this platform:
Reviewed-by: Marek Vasut 


Re: [PATCH v2 03/12] usb: dwc3-generic: Add clock initialization in child DT node

2023-02-01 Thread Marek Vasut

On 2/1/23 02:13, Kunihiko Hayashi wrote:

Same as the reset cotnrol, should add a clock initialization in child DT
node, if the glue node doesn't have any clocks.

Signed-off-by: Kunihiko Hayashi 


Reviewed-by: Marek Vasut 


Re: [PATCH v2 02/12] usb: dwc3-generic: Allow different controller DT node pattern

2023-02-01 Thread Marek Vasut

On 2/1/23 02:13, Kunihiko Hayashi wrote:

The most of devicetree has the following USB node structure.
The controller node is placed as a child node of the glue node.
Current dwc3-generic driver works on this premise.

 glue {
 /* glue node */
usb {
 /* controller node */
};
 };

However, UniPhier original devicetree has the following USB node structure.
The controller node is separately placed from the glue node.

 usb {
 /* controller node */
 };
 glue {
 /* glue node */
 };

In dwc_glue_bind(), this patch provides .glue_get_ctrl_dev() callback to
get such a controller node and binds the driver related to the node.

If this callback isn't defined, dwc_glue_bind() looks for the controller
nodes from the child nodes, as before.

Suggested-by: Marek Vasut 
Signed-off-by: Kunihiko Hayashi 


Reviewed-by: Marek Vasut 


[PATCH v3 02/76] power: Drop fg_max77693

2023-02-01 Thread Simon Glass
This is not used in U-Boot. Drop it.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 drivers/power/mfd/Makefile  |   1 -
 drivers/power/mfd/fg_max77693.c | 137 
 2 files changed, 138 deletions(-)
 delete mode 100644 drivers/power/mfd/fg_max77693.c

diff --git a/drivers/power/mfd/Makefile b/drivers/power/mfd/Makefile
index a8eb7f81e72..5dfbdbd1b0f 100644
--- a/drivers/power/mfd/Makefile
+++ b/drivers/power/mfd/Makefile
@@ -5,4 +5,3 @@
 
 obj-$(CONFIG_POWER_PMIC_MAX77693) += pmic_max77693.o
 obj-$(CONFIG_POWER_MUIC_MAX77693) += muic_max77693.o
-obj-$(CONFIG_POWER_FG_MAX77693) += fg_max77693.o
diff --git a/drivers/power/mfd/fg_max77693.c b/drivers/power/mfd/fg_max77693.c
deleted file mode 100644
index 983a6d4a2bd..000
--- a/drivers/power/mfd/fg_max77693.c
+++ /dev/null
@@ -1,137 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (C) 2013 Samsung Electronics
- * Piotr Wilczek 
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-static int max77693_get_vcell(u32 *vcell)
-{
-   u16 value;
-   u8 ret;
-
-   ret = i2c_read(MAX77693_FUEL_I2C_ADDR, MAX77693_VCELL, 1,
-  (u8 *)&value, 2);
-   if (ret)
-   return ret;
-
-   *vcell = (u32)(value >> 3);
-   *vcell = *vcell * 625;
-
-   return 0;
-}
-
-static int max77693_get_soc(u32 *soc)
-{
-   u16 value;
-   u8 ret;
-
-   ret = i2c_read(MAX77693_FUEL_I2C_ADDR, MAX77693_VFSOC, 1,
-  (u8 *)&value, 2);
-   if (ret)
-   return ret;
-
-   *soc = (u32)(value >> 8);
-
-   return 0;
-}
-
-static int power_update_battery(struct pmic *p, struct pmic *bat)
-{
-   struct power_battery *pb = bat->pbat;
-   int ret;
-
-   if (pmic_probe(p)) {
-   puts("Can't find max77693 fuel gauge\n");
-   return -ENODEV;
-   }
-
-   ret = max77693_get_soc(&pb->bat->state_of_chrg);
-   if (ret)
-   return ret;
-
-   max77693_get_vcell(&pb->bat->voltage_uV);
-
-   return 0;
-}
-
-static int power_check_battery(struct pmic *p, struct pmic *bat)
-{
-   struct power_battery *pb = bat->pbat;
-   unsigned int val;
-   int ret = 0;
-
-   if (pmic_probe(p)) {
-   puts("Can't find max77693 fuel gauge\n");
-   return -ENODEV;
-   }
-
-   ret = pmic_reg_read(p, MAX77693_STATUS, &val);
-   if (ret)
-   return ret;
-   debug("fg status: 0x%x\n", val);
-
-   ret = pmic_reg_read(p, MAX77693_VERSION, &pb->bat->version);
-   if (ret)
-   return ret;
-
-   ret = power_update_battery(p, bat);
-   if (ret)
-   return ret;
-   debug("fg ver: 0x%x\n", pb->bat->version);
-   printf("BAT: state_of_charge(SOC):%d%%\n",
-  pb->bat->state_of_chrg);
-
-   printf(" voltage: %d.%6.6d [V] (expected to be %d [mAh])\n",
-  pb->bat->voltage_uV / 100,
-  pb->bat->voltage_uV % 100,
-  pb->bat->capacity);
-
-   if (pb->bat->voltage_uV > 385)
-   pb->bat->state = EXT_SOURCE;
-   else if (pb->bat->voltage_uV < 360 || pb->bat->state_of_chrg < 5)
-   pb->bat->state = CHARGE;
-   else
-   pb->bat->state = NORMAL;
-
-   return 0;
-}
-
-static struct power_fg power_fg_ops = {
-   .fg_battery_check = power_check_battery,
-   .fg_battery_update = power_update_battery,
-};
-
-int power_fg_init(unsigned char bus)
-{
-   static const char name[] = "MAX77693_FG";
-   struct pmic *p = pmic_alloc();
-
-   if (!p) {
-   printf("%s: POWER allocation error!\n", __func__);
-   return -ENOMEM;
-   }
-
-   debug("Board Fuel Gauge init\n");
-
-   p->name = name;
-   p->interface = PMIC_I2C;
-   p->number_of_regs = FG_NUM_OF_REGS;
-   p->hw.i2c.addr = MAX77693_FUEL_I2C_ADDR;
-   p->hw.i2c.tx_num = 2;
-   p->sensor_byte_order = PMIC_SENSOR_BYTE_ORDER_BIG;
-   p->bus = bus;
-
-   p->fg = &power_fg_ops;
-
-   return 0;
-}
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 17/76] Drop CONFIG_DM644X_GPIO

2023-02-01 Thread Simon Glass
Drop this unused option.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 drivers/gpio/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 57603645c1c..07fca7bd33d 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -38,7 +38,6 @@ obj-$(CONFIG_SANDBOX_GPIO)+= sandbox.o sandbox_test.o
 obj-$(CONFIG_TEGRA_GPIO)   += tegra_gpio.o
 obj-$(CONFIG_TEGRA186_GPIO)+= tegra186_gpio.o
 obj-$(CONFIG_DA8XX_GPIO)   += da8xx_gpio.o
-obj-$(CONFIG_DM644X_GPIO)  += da8xx_gpio.o
 obj-$(CONFIG_ALTERA_PIO)   += altera_pio.o
 obj-$(CONFIG_MPC83XX_GPIO) += mpc83xx_gpio.o
 obj-$(CONFIG_MPC8XXX_GPIO) += mpc8xxx_gpio.o
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 31/76] m68k: Drop unused CONFIG_MACH_DAVINCI_DA830_EVM

2023-02-01 Thread Simon Glass
This option does not exist, so the Makefile rule does nothing. Drop it.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 board/davinci/da8xxevm/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/board/davinci/da8xxevm/Makefile b/board/davinci/da8xxevm/Makefile
index 8187c8db22e..fe043d517f2 100644
--- a/board/davinci/da8xxevm/Makefile
+++ b/board/davinci/da8xxevm/Makefile
@@ -5,6 +5,5 @@
 #
 # Copyright (C) 2007 Sergey Kubushyn 
 
-obj-$(CONFIG_MACH_DAVINCI_DA830_EVM)   += da830evm.o
 obj-$(CONFIG_MACH_DAVINCI_DA850_EVM)   += da850evm.o
 obj-$(CONFIG_TARGET_OMAPL138_LCDK) += omapl138_lcdk.o
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 09/76] arm: mvebu: Remove reference to ARMADA_370

2023-02-01 Thread Simon Glass
Drop this as it is not referenced anywhere else in the code.

Signed-off-by: Simon Glass 
---

(no changes since v2)

Changes in v2:
- Just drop the reference

 arch/arm/mach-mvebu/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile
index a23511b113b..28d3e5e1052 100644
--- a/arch/arm/mach-mvebu/Makefile
+++ b/arch/arm/mach-mvebu/Makefile
@@ -35,7 +35,7 @@ endif
 
 extra-y += kwbimage.cfg
 
-ifneq ($(CONFIG_ARMADA_370)$(CONFIG_ARMADA_XP),)
+ifneq ($(CONFIG_ARMADA_XP),)
KWB_REPLACE += CPU
KWB_CFG_CPU = SHEEVA
 else ifneq ($(CONFIG_ARMADA_375)$(CONFIG_ARMADA_38X)$(CONFIG_ARMADA_39X),)
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 29/76] video: Drop unused lg4573 driver

2023-02-01 Thread Simon Glass
This is not used since this commit:

   3cf02f5ffa4 imx6: remove not longer supported aristainetos boards

Drop the driver and Kconfig option.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 drivers/video/Makefile |   1 -
 drivers/video/lg4573.c | 331 -
 2 files changed, 332 deletions(-)
 delete mode 100644 drivers/video/lg4573.c

diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 40a871d638e..12b68cdd068 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -30,7 +30,6 @@ obj-${CONFIG_VIDEO_TEGRA124} += tegra124/
 obj-$(CONFIG_ATMEL_HLCD) += atmel_hlcdfb.o
 obj-$(CONFIG_ATMEL_LCD) += atmel_lcdfb.o
 obj-$(CONFIG_IHS_VIDEO_OUT) += ihs_video_out.o
-obj-$(CONFIG_LG4573) += lg4573.o
 obj-$(CONFIG_LOGICORE_DP_TX) += logicore_dp_tx.o
 obj-$(CONFIG_NXP_TDA19988) += tda19988.o
 obj-$(CONFIG_OSD) += video_osd-uclass.o
diff --git a/drivers/video/lg4573.c b/drivers/video/lg4573.c
deleted file mode 100644
index dd87fc461b9..000
--- a/drivers/video/lg4573.c
+++ /dev/null
@@ -1,331 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * LCD: LG4573, TFT 4.3", 480x800, RGB24
- * LCD initialization via SPI
- *
- */
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#define PWR_ON_DELAY_MSECS  120
-
-static int lb043wv_spi_write_u16(struct spi_slave *slave, u16 val)
-{
-   unsigned short buf16 = htons(val);
-   int ret = 0;
-
-   ret = spi_xfer(slave, 16, &buf16, NULL,
-  SPI_XFER_BEGIN | SPI_XFER_END);
-   if (ret)
-   debug("%s: Failed to send: %d\n", __func__, ret);
-
-   return ret;
-}
-
-static void lb043wv_spi_write_u16_array(struct spi_slave *slave, u16 *buff,
-   int size)
-{
-   int i;
-
-   for (i = 0; i < size; i++)
-   lb043wv_spi_write_u16(slave, buff[i]);
-}
-
-static void lb043wv_display_mode_settings(struct spi_slave *slave)
-{
-   static u16 display_mode_settings[] = {
- 0x703A,
- 0x7270,
- 0x70B1,
- 0x7208,
- 0x723B,
- 0x720F,
- 0x70B2,
- 0x7200,
- 0x72C8,
- 0x70B3,
- 0x7200,
- 0x70B4,
- 0x7200,
- 0x70B5,
- 0x7242,
- 0x7210,
- 0x7210,
- 0x7200,
- 0x7220,
- 0x70B6,
- 0x720B,
- 0x720F,
- 0x723C,
- 0x7213,
- 0x7213,
- 0x72E8,
- 0x70B7,
- 0x7246,
- 0x7206,
- 0x720C,
- 0x7200,
- 0x7200,
-   };
-
-   debug("transfer display mode settings\n");
-   lb043wv_spi_write_u16_array(slave, display_mode_settings,
-   ARRAY_SIZE(display_mode_settings));
-}
-
-static void lb043wv_power_settings(struct spi_slave *slave)
-{
-   static u16 power_settings[] = {
- 0x70C0,
- 0x7201,
- 0x7211,
- 0x70C3,
- 0x7207,
- 0x7203,
- 0x7204,
- 0x7204,
- 0x7204,
- 0x70C4,
- 0x7212,
- 0x7224,
- 0x7218,
- 0x7218,
- 0x7202,
- 0x7249,
- 0x70C5,
- 0x726F,
- 0x70C6,
- 0x7241,
- 0x7263,
-   };
-
-   debug("transfer power settings\n");
-   lb043wv_spi_write_u16_array(slave, power_settings,
-   ARRAY_SIZE(power_settings));
-}
-
-static void lb043wv_gamma_settings(struct spi_slave *slave)
-{
-   static u16 gamma_settings[] = {
- 0x70D0,
- 0x7203,
- 0x7207,
- 0x7273,
- 0x7235,
- 0x7200,
- 0x7201,
- 0x7220,
- 0x7200,
- 0x7203,
- 0x70D1,
- 0x7203,
- 0x7207,
- 0x7273,
- 0x7235,
- 0x7200,
- 0x7201,
- 0x7220,
- 0x7200,
- 0x7203,
- 0x70D2,
- 0x7203,
- 0x7207,
- 0x7273,
- 0x7235,
- 0x7200,
- 0x7201,
- 0x7220,
- 0x7200,
- 0x7203,
- 0x70D3,
- 0x7203,
- 0x7207,
- 0x7273,
- 0x7235,
- 0x7200,
- 0x7201,
- 0x7220,
- 0x7200,
- 0x7203,
- 0x70D4,
- 0x7203,
- 0x7207,
- 0x7273,
- 0x7235,
- 0x7200,
- 0x7201,
- 0x7220,
- 0x7200,
- 0x7203,
- 0x70D5,
- 0x7203,
- 0x7207,
- 0x7273,
- 0x7235,
- 0x7200,
- 0x7201,
- 0x7220,
- 0x7200,
- 0x7203,
-   };
-
-   debug("transfer gamma settings\n");
-   lb043wv_spi_write_u16_array(slave, gamma_settings,
-   ARRAY_SIZE(gamma_settings));
-}
-
-static void lb043wv_display_on(struct spi_slave *slave)
-{
-   static u16 sleep_out = 0x7011

Re: [PATCH 0/8] blk: blkmap: Composable virtual block devices

2023-02-01 Thread Simon Glass
Hi Tobias,

On Wed, 1 Feb 2023 at 11:10, Tobias Waldekranz  wrote:
>
> Block maps are a way of looking at various sources of data through the
> lens of a regular block device. It lets you treat devices that are not
> block devices, like RAM, as if they were. It also lets you export a
> slice of an existing block device, which does not have to correspond to
> a partition boundary, as a new block device.
>
> This is primarily useful because U-Boot's filesystem drivers only
> operate on block devices, so a block map lets you access filesystems
> wherever they might be located.
>
> The implementation is loosely modeled on Linux's "Device Mapper"
> subsystem, see the kernel documentation [1] for more information.
>
> The primary use-cases are to access filesystem images stored in RAM, and
> within FIT images stored on disk. See doc/usage/blkmap.rst for more
> details.
>
> The architecture is pluggable, so adding other types of mappings should
> be quite easy.
>
> [1]: https://docs.kernel.org/admin-guide/device-mapper/index.html
>
> Tobias Waldekranz (8):
>   image: Fix script execution from FIT images with external data
>   cmd: blk: Allow generic read/write operations to work in sandbox
>   blk: blkmap: Add basic infrastructure
>   blk: blkmap: Add memory mapping support
>   blk: blkmap: Add linear device mapping support
>   cmd: blkmap: Add blkmap command
>   test: blkmap: Add test suite
>   doc: blkmap: Add introduction and examples
>
>  MAINTAINERS  |   9 +
>  boot/image-board.c   |   3 +-
>  cmd/Kconfig  |  19 ++
>  cmd/Makefile |   1 +
>  cmd/blk_common.c |  15 +-
>  cmd/blkmap.c | 181 +
>  configs/sandbox_defconfig|   1 +
>  disk/part.c  |   1 +
>  doc/usage/blkmap.rst | 109 
>  doc/usage/index.rst  |   1 +
>  drivers/block/Kconfig|  18 ++
>  drivers/block/Makefile   |   1 +
>  drivers/block/blk-uclass.c   |   1 +
>  drivers/block/blkmap.c   | 452 +++
>  include/blkmap.h |  21 ++
>  include/dm/uclass-id.h   |   1 +
>  include/efi_loader.h |   4 +
>  lib/efi_loader/efi_device_path.c |  30 ++
>  test/py/tests/test_blkmap.py | 164 +++
>  19 files changed, 1027 insertions(+), 5 deletions(-)
>  create mode 100644 cmd/blkmap.c
>  create mode 100644 doc/usage/blkmap.rst
>  create mode 100644 drivers/block/blkmap.c
>  create mode 100644 include/blkmap.h
>  create mode 100644 test/py/tests/test_blkmap.py
>
> --
> 2.34.1
>

Overall this looks good to me. I'll make suggestions on the individual patches.

The main thing to note is that device numbers are an internal thing
that I'd like to move away from, so labels are better.

Regards,
Simon


[PATCH v3 10/76] arm: mvebu: Drop reference to CONFIG_ARMADA_39X

2023-02-01 Thread Simon Glass
This is not defined anywhere. Drop it.

Signed-off-by: Simon Glass 
Reviewed-by: Stefan Roese 
---

(no changes since v1)

 arch/arm/mach-mvebu/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile
index 28d3e5e1052..a9f506cf2fb 100644
--- a/arch/arm/mach-mvebu/Makefile
+++ b/arch/arm/mach-mvebu/Makefile
@@ -38,7 +38,7 @@ extra-y += kwbimage.cfg
 ifneq ($(CONFIG_ARMADA_XP),)
KWB_REPLACE += CPU
KWB_CFG_CPU = SHEEVA
-else ifneq ($(CONFIG_ARMADA_375)$(CONFIG_ARMADA_38X)$(CONFIG_ARMADA_39X),)
+else ifneq ($(CONFIG_ARMADA_375)$(CONFIG_ARMADA_38X),)
KWB_REPLACE += CPU
KWB_CFG_CPU = A9
 endif
-- 
2.39.1.456.gfc5497dd1b-goog



Re: [PATCH 8/8] doc: blkmap: Add introduction and examples

2023-02-01 Thread Heinrich Schuchardt



Am 1. Februar 2023 19:10:16 MEZ schrieb Tobias Waldekranz 
:
>Explain block maps by going through two common use-cases.
>
>Signed-off-by: Tobias Waldekranz 
>---
> MAINTAINERS  |   1 +
> doc/usage/blkmap.rst | 109 +++
> doc/usage/index.rst  |   1 +
> 3 files changed, 111 insertions(+)
> create mode 100644 doc/usage/blkmap.rst
>
>diff --git a/MAINTAINERS b/MAINTAINERS
>index c420c8e1f9..de0e41487d 100644
>--- a/MAINTAINERS
>+++ b/MAINTAINERS
>@@ -790,6 +790,7 @@ BLKMAP
> M:Tobias Waldekranz 
> S:Maintained
> F:cmd/blkmap.c
>+F:doc/usage/blkmap.rst
> F:drivers/block/blkmap.c
> F:include/blkmap.h
> F:test/py/tests/test_blkmap.py
>diff --git a/doc/usage/blkmap.rst b/doc/usage/blkmap.rst
>new file mode 100644
>index 00..1cf6d97c1b
>--- /dev/null
>+++ b/doc/usage/blkmap.rst
>@@ -0,0 +1,109 @@
>+.. SPDX-License-Identifier: GPL-2.0+
>+..
>+.. Copyright (c) 2023 Addiva Elektronik
>+.. Author: Tobias Waldekranz 
>+
>+Block Maps (blkmap)
>+===
>+
>+Block maps are a way of looking at various sources of data through the
>+lens of a regular block device. It lets you treat devices that are not
>+block devices, like RAM, as if they were. It also lets you export a
>+slice of an existing block device, which does not have to correspond
>+to a partition boundary, as a new block device.
>+
>+This is primarily useful because U-Boot's filesystem drivers only
>+operate on block devices, so a block map lets you access filesystems
>+wherever they might be located.
>+
>+The implementation is loosely modeled on Linux's "Device Mapper"
>+subsystem, see `kernel documentation`_ for more information.
>+
>+.. _kernel documentation: 
>https://docs.kernel.org/admin-guide/device-mapper/index.html
>+
>+
>+Example: Netbooting an Ext4 Image
>+-
>+
>+Say that our system is using an Ext4 filesystem as its rootfs, where
>+the kernel is stored in ``/boot``. This image is then typically stored
>+in an eMMC partition. In this configuration, we can use something like
>+``load mmc 0 ${kernel_addr_r} /boot/Image`` to load the kernel image
>+into the expected location, and then boot the system. No problems.
>+
>+Now imagine that during development, or as a recovery mechanism, we
>+want to boot the same type of image by downloading it over the
>+network. Getting the image to the target is easy enough:
>+
>+::
>+
>+   dhcp ${ramdisk_addr_r} rootfs.ext4
>+
>+But now we are faced with a predicament: how to we extract the kernel
>+image? Block maps to the rescue!
>+
>+We start by creating a new device:
>+
>+::
>+
>+   blkmap create 0
>+
>+Before setting up the mapping, we figure out the size of the
>+downloaded file, in blocks:
>+
>+::
>+
>+   setexpr fileblks ${filesize} + 0x1ff
>+   setexpr fileblks ${filesize} / 0x200
>+
>+Then we can add a mapping to the start of our device, backed by the
>+memory at `${loadaddr}`:
>+
>+::
>+
>+   blkmap map 0 0 ${fileblks} mem ${fileaddr}

This is way too complicated. Just accept the file size here.

How can we handle images assuming a different block size then?

>+
>+Now we can access the filesystem via the virtual device:
>+
>+::
>+
>+   load blkmap 0 ${kernel_addr_r} /boot/Image
>+
>+
>+Example: Accessing a filesystem inside an FIT image
>+---
>+
>+In this example, an FIT image is stored in an eMMC partition. We would
>+like to read the file ``/etc/version``, stored inside a Squashfs image
>+in the FIT. Since the Squashfs image is not stored on a partition
>+boundary, there is no way of accessing it via ``load mmc ...``.
>+
>+What we can to instead is to first figure out the offset and size of
>+the filesystem:
>+
>+::
>+
>+   mmc dev 0
>+   mmc read ${loadaddr} 0 0x100
>+
>+   fdt addr ${loadaddr}
>+   fdt get value squashaddr /images/ramdisk data-position
>+   fdt get value squashsize /images/ramdisk data-size
>+
>+   setexpr squashblk  ${squashaddr} / 0x200
>+   setexpr squashsize ${squashsize} + 0x1ff
>+   setexpr squashsize ${squashsize} / 0x200
>+
>+Then we can create a block map that maps to that slice of the full
>+partition:
>+
>+::
>+
>+   blkmap create 0
>+   blkmap map 0 0 ${squashsize} linear mmc 0 ${squashblk}

We are the requirements on alignment?

Best regards

Heinrich

>+
>+Now we can access the filesystem:
>+
>+::
>+
>+   load blkmap 0 ${loadaddr} /etc/version
>diff --git a/doc/usage/index.rst b/doc/usage/index.rst
>index 3804046835..856a3da28e 100644
>--- a/doc/usage/index.rst
>+++ b/doc/usage/index.rst
>@@ -4,6 +4,7 @@ Use U-Boot
> .. toctree::
>:maxdepth: 1
> 
>+   blkmap
>dfu
>environment
>fdt_overlays


Re: [PATCH] arm: kirkwood: Enable uart0 dm-pre-reloc for Kirkwood boards

2023-02-01 Thread Tony Dinh
Hi all,

On Wed, Feb 1, 2023 at 11:05 AM Pali Rohár  wrote:
>
> On Wednesday 01 February 2023 09:17:15 Michael Walle wrote:
> > > > > When DM_SERIAL is enabled, the device-tree property dm-pre-reloc is
> > > > > required to boot over UART with kwboot. Enable this in a Kirkwood
> > > > > common u-boot dtsi.
> > > >
> > > > My (dev) board unfortunately, have a bootloader which can't boot over
> > > > serial.
> > >
> > > This is feature of Marvell BootROM and does not require any special from
> > > Bootloader. So you should be able to boot over UART (if you have
> > > accessible pins).
> >
> > I know, but there are known versions ob the bootrom where uart boot
> > isn't supported (correctly).
>
> I heard about it... maybe it is a bug in client software (kwboot)? I do
> not have such board if you are interested in it I could try to send some
> details how to debug it.

The Kirkwood SoCs came with different BootROM versions. Version 1.1
cannot be booted over UART, but version 1.2  can. I think there must
be a bug in the BootROM 1.1. The older Kirkwood such as Sheevaplug,
Dockstar, iConnect boards come with BootROM 1.1. Later version of
Sheevaplug, GoFlex Home, GoFlex Net, Dreamplug, Pogoplug V4, Zyxel
NSA310S, NSA320, NSA325 come with BootROM 1.2. So even though it is
the same SoC, eg. 6281, they are actually produced at a different time
and have different BootROM versions.

When I test new u-boot images for boards such as Dockstar or iConnect,
I run kwboot with the GoFlex Home/Net. And they boot fine to a point
that allows me to see that the image is good enough. So in the
development phase, most if not all Kirkwood u-boot images can be
booted over UART. Some with real boards, some with surrogates.

> > I also have another board which can boot
> > over uart. But thats in daily use ;)
> >
> > > > Could you elaborate that a bit more? Why is this required for
> > > > uart boot? kwboot will talk with the bootrom why does u-boot need
> > > > anything? Or will there just be no output until the uart is
> > > > initialized?
> > >
> > > On mvebu/armada boards this dm-pre-reloc is required to ensure that DT
> > > nodes are present in SPL DTB file. Otherwise build process drop all
> > > non-pre-realoc nodes from SPL version of DTB file. And because SPL use
> > > DM serial, it is required to have uart DT nodes in DTB file. Btw, same
> > > problem is with SPI in SPL.
> > >
> > > But... kirkwood does not use SPL, so I do not know what is reason for
> > > this here.
> >
> > Yes thats what puzzled me, too.

When u-boot,dm-pre-reloc is not specified in the uart0 DTS node, after
the image was transferred by kwboot, the serial console is silent and
the board is frozen.

If I understand correctly, it is because before u-boot relocation, if
DM serial is enabled, the serial uclass is present, but it has not
been initialized (I think it is created but not "bind(?)" ). The
dm-preloc property works because it explicitly tells DM to fully
initialize the uclass before relocation. That was just my observation
about DM in general, devices do not get fully initialized until the
first use. So I tried the u-boot,dm-pre-reloc and it works. If my
assumption is incorrect, perhaps somebody can look at the serial
uclass and see if there is a different type of issue there.

Thanks,
Tony

> >
> > > > >
> > > > > Signed-off-by: Tony Dinh 
> > > > > ---
> > > > >
> > > > >  arch/arm/dts/kirkwood-u-boot.dtsi | 7 +++
> > > > >  1 file changed, 7 insertions(+)
> > > > >  create mode 100644 arch/arm/dts/kirkwood-u-boot.dtsi
> > > >
> > > > Is this new? AFAIK only -u-boot.dtsi is included
> > > > automatically.
> > >
> > > It is not new, Tom wrote about it quite ago:
> > > https://lore.kernel.org/u-boot/20220802121113.GG1146598@bill-the-cat/
> >
> > Thats relatively new for someone not following the u-boot
> > development that closely ;) Thanks for the pointer.
> >
> > -michael
> >


Re: [PATCH] RFC: CI: add test/usage_of_is_enabled_check.sh

2023-02-01 Thread Simon Glass
Hi Troy,

On Tue, 31 Jan 2023 at 12:57, Troy Kisky  wrote:
>
> Add script usage_of_is_enabled_check to print any configs that
> use CONFIG_IS_ENABLED instead of IS_ENABLED and vice versa.
>
> Add usage_of_is_enabled_commit.sh to generate commits to fix the above
> issues.
>
> Signed-off-by: Troy Kisky 
> ---
>  .azure-pipelines.yml   | 11 
>  .gitlab-ci.yml |  5 
>  test/usage_of_is_enabled_check.sh  | 41 ++
>  test/usage_of_is_enabled_commit.sh | 38 +++
>  4 files changed, 95 insertions(+)
>  create mode 100755 test/usage_of_is_enabled_check.sh
>  create mode 100755 test/usage_of_is_enabled_commit.sh

This looks reasonable to me. I would of course prefer to just fix all
these problems, since they make it impossible to move to split config.

But we need this sort of check in CI to stop it happening again.

>
> diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
> index 5673bb76afb..8e227512765 100644
> --- a/.azure-pipelines.yml
> +++ b/.azure-pipelines.yml
> @@ -67,6 +67,17 @@ stages:
>:^doc/ :^arch/arm/dts/ :^scripts/kconfig/lkc.h
>:^include/linux/kconfig.h :^tools/ && exit 1 || exit 0
>
> +  - job: check_usage_of_is_enabled
> +displayName: 'Check usage of CONFIG_IS_ENABLED vs IS_ENABLED'
> +pool:
> +  vmImage: $(ubuntu_vm)
> +container:
> +  image: $(ci_runner_image)
> +  options: $(container_option)
> +steps:
> +  # generate list of SPL configs
> +  - script: test/usage_of_is_enabled_check.sh
> +
>- job: cppcheck
>  displayName: 'Static code analysis with cppcheck'
>  pool:
> diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
> index aaf9d25abfc..6bb8efef258 100644
> --- a/.gitlab-ci.yml
> +++ b/.gitlab-ci.yml
> @@ -134,6 +134,11 @@ check for new CONFIG symbols outside Kconfig:
>  :^doc/ :^arch/arm/dts/ :^scripts/kconfig/lkc.h
>  :^include/linux/kconfig.h :^tools/ && exit 1 || exit 0
>
> +check usage of CONFIG_IS_ENABLED vs IS_ENABLED:
> +  stage: testsuites
> +  script:
> +- ./test/usage_of_is_enabled_check.sh
> +
>  # QA jobs for code analytics
>  # static code analysis with cppcheck (we can add --enable=all later)
>  cppcheck:
> diff --git a/test/usage_of_is_enabled_check.sh 
> b/test/usage_of_is_enabled_check.sh
> new file mode 100755
> index 000..0bc9bff8bd1
> --- /dev/null
> +++ b/test/usage_of_is_enabled_check.sh
> @@ -0,0 +1,41 @@
> +#!/bin/bash
> +# generate list of CONFIGs that should use CONFIG_IS_ENABLED

Could you add a few comments about the steps in here?

> +{ { git grep 'obj-$(CONFIG_$(SPL_'|grep Makefile|sed -e "s/SPL_TPL_/SPL_/"| \
> +sed -n -r 's/obj\-\$\(CONFIG_\$\(SPL_\)([0-9a-zA-Z_]+)\)/\n\{\1\}\n/gp'| \
> +sed -n -r 's/\{([0-9a-zA-Z_]+)\}/\1/p'; } ;\
> +{ git grep -E 'config [ST]PL_'|grep Kconfig| \
> +sed -n -r "s/config [ST]PL_([0-9a-zA-Z_]+)/\n\{\1\}\n/p" |
> +sed -n -r 's/\{([0-9a-zA-Z_]+)\}/\1/p'; } ; \
> +git grep -E 'CONFIG_IS_ENABLED\(CMD_'|sed -n -e 
> "s/\(CONFIG_IS_ENABLED(CMD_[0-9a-zA-Z_]*)\)/\n\1\n/gp"| \
> +sed -n -r "s/CONFIG_IS_ENABLED\((CMD_[0-9a-zA-Z_]+)\)/\1/p"; \
> +echo -e "\
> +BZIP2\n\
> +CONFIG_CLK\n\

CLK ?

> +DM_EVENT\n\
> +EFI_DEVICE_PATH_TO_TEXT\n\
> +EFI_LOADER\n\
> +ERRNO_STR\n\
> +GENERATE_SMBIOS_TABLE\n\
> +";\

What is the above list for? Can you add a comment?

> +} | sort -u >splcfg.tmp
> +
> +{
> +# generate list of CONFIGs that incorrectly use CONFIG_IS_ENABLED
> +git grep CONFIG_IS_ENABLED|sed -n -e 
> "s/\(CONFIG_IS_ENABLED([0-9a-zA-Z_]*)\)/\n\1\n/gp"| \
> +sed -n -r "s/CONFIG_IS_ENABLED\(([0-9a-zA-Z_]+)\)/\1/p" |sort -u| comm -23 - 
> splcfg.tmp ;
> +
> +# generate list of CONFIGs that incorrectly use IS_ENABLED
> +git grep -w IS_ENABLED|sed -n -e 
> "s/\(IS_ENABLED(CONFIG_[0-9a-zA-Z_]*)\)/\n\1\n/gp"| \
> +sed -n -r "s/IS_ENABLED\(CONFIG_([0-9a-zA-Z_]+)\)/\1/p" |sort -u| join - 
> splcfg.tmp;
> +} | grep -vw FOO;
> +if [ $? -eq 0 ] ; then
> +   echo "The above may have incorrect usage of 
> IS_ENABLED/CONFIG_IS_ENABLED"
> +   echo "Run test/usage_of_is_enabled_commit.sh and squash with 
> appropriate commit"
> +   ret=1;
> +else
> +   ret=0;
> +fi
> +
> +rm splcfg.tmp
> +exit ${ret}
> +
> diff --git a/test/usage_of_is_enabled_commit.sh 
> b/test/usage_of_is_enabled_commit.sh
> new file mode 100755
> index 000..f776d0c69ab
> --- /dev/null
> +++ b/test/usage_of_is_enabled_commit.sh
> @@ -0,0 +1,38 @@
> +#!/bin/bash
> +# generate list of CONFIGs that should use CONFIG_IS_ENABLED

Same thing, could use some comments

> +{ { git grep 'obj-$(CONFIG_$(SPL_'|grep Makefile|sed -e "s/SPL_TPL_/SPL_/"| \
> +sed -n -r 's/obj\-\$\(CONFIG_\$\(SPL_\)([0-9a-zA-Z_]+)\)/\n\{\1\}\n/gp'| \
> +sed -n -r 's/\{([0-9a-zA-Z_]+)\}/\1/p'; } ;\
> +{ git grep -E 'config [ST]PL_'|grep Kconfig| \
> +sed -n -r "s/config [ST]PL_([0-9a-zA-Z_]+)/\n\{\1\}\n/p" |
> +sed -n -r 's/\{([0-9a-zA-Z_]+)\}/\1/p'; } ; \
> +git grep -E 'CONFIG_IS_ENABLED\

[PATCH v3 22/76] fpga: Add a FPGA_STRATIX_II option

2023-02-01 Thread Simon Glass
There is no Kconfig option for this code, but it seems to be useful. Add
one.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 drivers/fpga/Kconfig | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/fpga/Kconfig b/drivers/fpga/Kconfig
index 2034d0ebd9c..61490d6d8de 100644
--- a/drivers/fpga/Kconfig
+++ b/drivers/fpga/Kconfig
@@ -21,6 +21,12 @@ config FPGA_SOCFPGA
 
  This provides common functionality for Gen5 and Arria10 devices.
 
+config FPGA_STRATIX_II
+   bool "Enable Stratix II FPGA drivers"
+   depends on FPGA_ALTERA
+   help
+ Say Y here to enable the Altera Stratix II FPGA-specific driver.
+
 config FPGA_STRATIX_V
bool "Enable Stratix V FPGA drivers"
depends on FPGA_ALTERA
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 53/76] rtc: Drop old and unused drivers

2023-02-01 Thread Simon Glass
These drivers are not used and have not been converted to driver model.
Drop them and references to the non-existent CONFIG options they use.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 drivers/rtc/Makefile   |  14 --
 drivers/rtc/at91sam9_rtt.c |  78 ---
 drivers/rtc/ds1302.c   | 329 
 drivers/rtc/ds1306.c   | 438 -
 drivers/rtc/ftrtc010.c | 122 ---
 drivers/rtc/imxdi.c| 223 ---
 drivers/rtc/max6900.c  | 105 -
 drivers/rtc/mk48t59.c  | 175 ---
 drivers/rtc/mx27rtc.c  |  64 --
 drivers/rtc/rs5c372.c  | 256 --
 drivers/rtc/s3c24x0_rtc.c  | 149 -
 drivers/rtc/x1205.c| 161 --
 12 files changed, 2114 deletions(-)
 delete mode 100644 drivers/rtc/at91sam9_rtt.c
 delete mode 100644 drivers/rtc/ds1302.c
 delete mode 100644 drivers/rtc/ds1306.c
 delete mode 100644 drivers/rtc/ftrtc010.c
 delete mode 100644 drivers/rtc/imxdi.c
 delete mode 100644 drivers/rtc/max6900.c
 delete mode 100644 drivers/rtc/mk48t59.c
 delete mode 100644 drivers/rtc/mx27rtc.c
 delete mode 100644 drivers/rtc/rs5c372.c
 delete mode 100644 drivers/rtc/s3c24x0_rtc.c
 delete mode 100644 drivers/rtc/x1205.c

diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index acfd130bbc9..447551e15aa 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -6,49 +6,35 @@
 
 obj-$(CONFIG_$(SPL_TPL_)DM_RTC) += rtc-uclass.o
 
-obj-$(CONFIG_RTC_AT91SAM9_RTT) += at91sam9_rtt.o
 obj-$(CONFIG_RTC_ARMADA38X) += armada38x.o
 obj-$(CONFIG_RTC_DAVINCI) += davinci.o
-obj-$(CONFIG_RTC_DS1302) += ds1302.o
-obj-$(CONFIG_RTC_DS1306) += ds1306.o
 obj-$(CONFIG_RTC_DS1307) += ds1307.o
 obj-$(CONFIG_RTC_DS1338) += ds1307.o
-obj-$(CONFIG_RTC_DS1339) += ds1307.o
 obj-$(CONFIG_RTC_DS1337) += ds1337.o
 obj-$(CONFIG_RTC_DS1374) += ds1374.o
-obj-$(CONFIG_RTC_DS1388) += ds1337.o
 obj-$(CONFIG_RTC_DS3231) += ds3231.o
 obj-$(CONFIG_RTC_DS3232) += ds3232.o
 obj-$(CONFIG_RTC_EMULATION) += emul_rtc.o
-obj-$(CONFIG_RTC_FTRTC010) += ftrtc010.o
 obj-$(CONFIG_RTC_HT1380) += ht1380.o
 obj-$(CONFIG_SANDBOX) += i2c_rtc_emul.o
-obj-$(CONFIG_RTC_IMXDI) += imxdi.o
 obj-$(CONFIG_RTC_ISL1208) += isl1208.o
 obj-$(CONFIG_RTC_M41T62) += m41t62.o
-obj-$(CONFIG_RTC_MAX6900) += max6900.o
 obj-$(CONFIG_RTC_MC13XXX) += mc13xxx-rtc.o
 obj-$(CONFIG_RTC_MC146818) += mc146818.o
-obj-$(CONFIG_RTC_MCP79411) += ds1307.o
 obj-$(CONFIG_MCFRTC) += mcfrtc.o
-obj-$(CONFIG_RTC_MK48T59) += mk48t59.o
 obj-$(CONFIG_RTC_MV) += mvrtc.o
-obj-$(CONFIG_RTC_MX27) += mx27rtc.o
 obj-$(CONFIG_RTC_MXS) += mxsrtc.o
 obj-$(CONFIG_RTC_PCF8563) += pcf8563.o
 obj-$(CONFIG_RTC_PCF2127) += pcf2127.o
 obj-$(CONFIG_RTC_PL031) += pl031.o
 obj-$(CONFIG_RTC_PT7C4338) += pt7c4338.o
-obj-$(CONFIG_RTC_RS5C372A) += rs5c372.o
 obj-$(CONFIG_RTC_RV3028) += rv3028.o
 obj-$(CONFIG_RTC_RV3029) += rv3029.o
 obj-$(CONFIG_RTC_RV8803) += rv8803.o
 obj-$(CONFIG_RTC_RX8025) += rx8025.o
 obj-$(CONFIG_RTC_RX8010SJ) += rx8010sj.o
-obj-$(CONFIG_RTC_S3C24X0) += s3c24x0_rtc.o
 obj-$(CONFIG_RTC_S35392A) += s35392a.o
 obj-$(CONFIG_RTC_STM32) += stm32_rtc.o
 obj-$(CONFIG_SANDBOX) += sandbox_rtc.o
-obj-$(CONFIG_RTC_X1205) += x1205.o
 obj-$(CONFIG_RTC_ABX80X) += abx80x.o
 obj-$(CONFIG_RTC_ZYNQMP) += zynqmp_rtc.o
diff --git a/drivers/rtc/at91sam9_rtt.c b/drivers/rtc/at91sam9_rtt.c
deleted file mode 100644
index 6f92660ef1d..000
--- a/drivers/rtc/at91sam9_rtt.c
+++ /dev/null
@@ -1,78 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2010
- * Reinhard Meyer, reinhard.me...@emk-elektronik.de
- */
-
-/*
- * Date & Time support for the internal Real-time Timer
- * of AT91SAM9260 and compatibles.
- * Compatible with the LinuX rtc driver workaround:
- * The RTT cannot be written to, but only reset.
- * The actual time is the sum of RTT and one of
- * the four GPBR registers.
- *
- * The at91sam9260 has 4 GPBR (0-3).
- * For their typical use see at91_gpbr.h !
- *
- * make sure u-boot and kernel use the same GPBR !
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-int rtc_get (struct rtc_time *tmp)
-{
-   at91_rtt_t *rtt = (at91_rtt_t *) ATMEL_BASE_RTT;
-   at91_gpbr_t *gpbr = (at91_gpbr_t *) ATMEL_BASE_GPBR;
-   ulong tim;
-   ulong tim2;
-   ulong off;
-
-   do {
-   tim = readl(&rtt->vr);
-   tim2 = readl(&rtt->vr);
-   } while (tim!=tim2);
-   off = readl(&gpbr->reg[AT91_GPBR_INDEX_TIMEOFF]);
-   /* off==0 means time is invalid, but we ignore that */
-   rtc_to_tm(tim+off, tmp);
-   return 0;
-}
-
-int rtc_set (struct rtc_time *tmp)
-{
-   at91_rtt_t *rtt = (at91_rtt_t *) ATMEL_BASE_RTT;
-   at91_gpbr_t *gpbr = (at91_gpbr_t *) ATMEL_BASE_GPBR;
-   ulong tim;
-
-   tim = rtc_mktime(tmp);
-
-   /* clear alarm, set prescaler to 32768, clear counter */
-   writel(32768+AT91_RTT_RTTRST, &rt

[PATCH v3 68/76] usb: Drop unused fotg210 gadget

2023-02-01 Thread Simon Glass
This is not used and appears to be associated with the faraday board which
has been removed. Drop the driver and Kconfig options.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 drivers/usb/gadget/Makefile   |   3 +-
 drivers/usb/gadget/fotg210.c  | 964 --
 drivers/usb/gadget/gadget_chips.h |   8 -
 include/usb/fotg210.h | 362 ---
 4 files changed, 1 insertion(+), 1336 deletions(-)
 delete mode 100644 drivers/usb/gadget/fotg210.c
 delete mode 100644 include/usb/fotg210.h

diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile
index 9c04403da30..b04b6bcd779 100644
--- a/drivers/usb/gadget/Makefile
+++ b/drivers/usb/gadget/Makefile
@@ -19,8 +19,7 @@ obj-$(CONFIG_USB_GADGET_ATMEL_USBA) += atmel_usba_udc.o
 obj-$(CONFIG_USB_GADGET_BCM_UDC_OTG_PHY) += bcm_udc_otg_phy.o
 obj-$(CONFIG_USB_GADGET_DWC2_OTG) += dwc2_udc_otg.o
 obj-$(CONFIG_USB_GADGET_DWC2_OTG_PHY) += dwc2_udc_otg_phy.o
-obj-$(CONFIG_USB_GADGET_FOTG210) += fotg210.o
-obj-$(CONFIG_USB_GADGET_MAX3420) += max3420_udc.o
+0obj-$(CONFIG_USB_GADGET_MAX3420) += max3420_udc.o
 ifndef CONFIG_SPL_BUILD
 obj-$(CONFIG_USB_GADGET_DOWNLOAD) += g_dnl.o
 obj-$(CONFIG_USB_FUNCTION_THOR) += f_thor.o
diff --git a/drivers/usb/gadget/fotg210.c b/drivers/usb/gadget/fotg210.c
deleted file mode 100644
index af43433d88d..000
--- a/drivers/usb/gadget/fotg210.c
+++ /dev/null
@@ -1,964 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Faraday USB 2.0 OTG Controller
- *
- * (C) Copyright 2010 Faraday Technology
- * Dante Su 
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-
-#define CFG_NUM_ENDPOINTS  4
-#define CFG_EP0_MAX_PACKET_SIZE64
-#define CFG_EPX_MAX_PACKET_SIZE512
-
-#define CFG_CMD_TIMEOUT (CONFIG_SYS_HZ >> 2) /* 250 ms */
-
-struct fotg210_chip;
-
-struct fotg210_ep {
-   struct usb_ep ep;
-
-   uint maxpacket;
-   uint id;
-   uint stopped;
-
-   struct list_head  queue;
-   struct fotg210_chip  *chip;
-   const struct usb_endpoint_descriptor *desc;
-};
-
-struct fotg210_request {
-   struct usb_request req;
-   struct list_head   queue;
-   struct fotg210_ep *ep;
-};
-
-struct fotg210_chip {
-   struct usb_gadget gadget;
-   struct usb_gadget_driver *driver;
-   struct fotg210_regs  *regs;
-   uint8_t   irq;
-   uint16_t  addr;
-   int   pullup;
-   enum usb_device_state state;
-   struct fotg210_ep ep[1 + CFG_NUM_ENDPOINTS];
-};
-
-static struct usb_endpoint_descriptor ep0_desc = {
-   .bLength = sizeof(struct usb_endpoint_descriptor),
-   .bDescriptorType = USB_DT_ENDPOINT,
-   .bEndpointAddress = USB_DIR_IN,
-   .bmAttributes = USB_ENDPOINT_XFER_CONTROL,
-};
-
-static inline int fifo_to_ep(struct fotg210_chip *chip, int id, int in)
-{
-   return (id < 0) ? 0 : ((id & 0x03) + 1);
-}
-
-static inline int ep_to_fifo(struct fotg210_chip *chip, int id)
-{
-   return (id <= 0) ? -1 : ((id - 1) & 0x03);
-}
-
-static inline int ep_reset(struct fotg210_chip *chip, uint8_t ep_addr)
-{
-   int ep = ep_addr & USB_ENDPOINT_NUMBER_MASK;
-   struct fotg210_regs *regs = chip->regs;
-
-   if (ep_addr & USB_DIR_IN) {
-   /* reset endpoint */
-   setbits_le32(®s->iep[ep - 1], IEP_RESET);
-   mdelay(1);
-   clrbits_le32(®s->iep[ep - 1], IEP_RESET);
-   /* clear endpoint stall */
-   clrbits_le32(®s->iep[ep - 1], IEP_STALL);
-   } else {
-   /* reset endpoint */
-   setbits_le32(®s->oep[ep - 1], OEP_RESET);
-   mdelay(1);
-   clrbits_le32(®s->oep[ep - 1], OEP_RESET);
-   /* clear endpoint stall */
-   clrbits_le32(®s->oep[ep - 1], OEP_STALL);
-   }
-
-   return 0;
-}
-
-static int fotg210_reset(struct fotg210_chip *chip)
-{
-   struct fotg210_regs *regs = chip->regs;
-   uint32_t i;
-
-   chip->state = USB_STATE_POWERED;
-
-   /* chip enable */
-   writel(DEVCTRL_EN, ®s->dev_ctrl);
-
-   /* device address reset */
-   chip->addr = 0;
-   writel(0, ®s->dev_addr);
-
-   /* set idle counter to 7ms */
-   writel(7, ®s->idle);
-
-   /* disable all interrupts */
-   writel(IMR_MASK, ®s->imr);
-   writel(GIMR_MASK, ®s->gimr);
-   writel(GIMR0_MASK, ®s->gimr0);
-   writel(GIMR1_MASK, ®s->gimr1);
-   writel(GIMR2_MASK, ®s->gimr2);
-
-   /* clear interrupts */
-   writel(ISR_MASK, ®s->isr);
-   writel(0, ®s->gisr);
-   writel(0, ®s->gisr0);
-   writel(0, ®s->gisr1);
-   writel(0, ®s->gisr2);
-
-   /* chip reset */
-   setbits_le32(®s->dev_ctrl, DEVCTRL_RESET);
-   mdelay(10);
-   if (readl(®

[PATCH v3 71/76] usb: Drop unused sl811-hcd driver

2023-02-01 Thread Simon Glass
This is not used. Drop the driver and Kconfig option.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 drivers/usb/host/Makefile|   1 -
 drivers/usb/host/sl811-hcd.c | 714 ---
 drivers/usb/host/sl811.h | 104 -
 3 files changed, 819 deletions(-)
 delete mode 100644 drivers/usb/host/sl811-hcd.c
 delete mode 100644 drivers/usb/host/sl811.h

diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index 3e5ba2bd0ba..8dad36f9369 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -17,7 +17,6 @@ obj-$(CONFIG_USB_OHCI_NEW) += ohci-hcd.o
 obj-$(CONFIG_USB_ATMEL) += ohci-at91.o
 obj-$(CONFIG_USB_OHCI_DA8XX) += ohci-da8xx.o
 obj-$(CONFIG_USB_R8A66597_HCD) += r8a66597-hcd.o
-obj-$(CONFIG_USB_SL811HS) += sl811-hcd.o
 obj-$(CONFIG_USB_OHCI_LPC32XX) += ohci-lpc32xx.o
 obj-$(CONFIG_USB_OHCI_PCI) += ohci-pci.o
 obj-$(CONFIG_USB_OHCI_GENERIC) += ohci-generic.o
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
deleted file mode 100644
index 7c823f241a8..000
--- a/drivers/usb/host/sl811-hcd.c
+++ /dev/null
@@ -1,714 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2004
- * Wolfgang Denk, DENX Software Engineering, w...@denx.de.
- *
- * This code is based on linux driver for sl811hs chip, source at
- * drivers/usb/host/sl811.c:
- *
- * SL811 Host Controller Interface driver for USB.
- *
- * Copyright (c) 2003/06, Courage Co., Ltd.
- *
- * Based on:
- * 1.uhci.c by Linus Torvalds, Johannes Erdfelt, Randy Dunlap,
- *   Georg Acher, Deti Fliegl, Thomas Sailer, Roman Weissgaerber,
- *   Adam Richter, Gregory P. Smith;
- * 2.Original SL811 driver (hc_sl811.o) by Pei Liu 
- * 3.Rewrited as sl811.o by Yin Aihua 
- */
-
-#include 
-#include 
-#include 
-#include 
-#include "sl811.h"
-
-#include "../../../board/kup/common/kup.h"
-
-#ifdef __PPC__
-# define EIEIO __asm__ volatile ("eieio")
-#else
-# define EIEIO /* nothing */
-#endif
-
-#define SL811_ADR (0x5000)
-#define SL811_DAT (0x5001)
-
-#ifdef SL811_DEBUG
-static int debug = 9;
-#endif
-
-static int root_hub_devnum = 0;
-static struct usb_port_status rh_status = { 0 };/* root hub port status */
-
-static int sl811_rh_submit_urb(struct usb_device *usb_dev, unsigned long pipe,
-  void *data, int buf_len, struct devrequest *cmd);
-
-static void sl811_write (__u8 index, __u8 data)
-{
-   *(volatile unsigned char *) (SL811_ADR) = index;
-   EIEIO;
-   *(volatile unsigned char *) (SL811_DAT) = data;
-   EIEIO;
-}
-
-static __u8 sl811_read (__u8 index)
-{
-   __u8 data;
-
-   *(volatile unsigned char *) (SL811_ADR) = index;
-   EIEIO;
-   data = *(volatile unsigned char *) (SL811_DAT);
-   EIEIO;
-   return (data);
-}
-
-/*
- * Read consecutive bytes of data from the SL811H/SL11H buffer
- */
-static void inline sl811_read_buf(__u8 offset, __u8 *buf, __u8 size)
-{
-   *(volatile unsigned char *) (SL811_ADR) = offset;
-   EIEIO;
-   while (size--) {
-   *buf++ = *(volatile unsigned char *) (SL811_DAT);
-   EIEIO;
-   }
-}
-
-/*
- * Write consecutive bytes of data to the SL811H/SL11H buffer
- */
-static void inline sl811_write_buf(__u8 offset, __u8 *buf, __u8 size)
-{
-   *(volatile unsigned char *) (SL811_ADR) = offset;
-   EIEIO;
-   while (size--) {
-   *(volatile unsigned char *) (SL811_DAT) = *buf++;
-   EIEIO;
-   }
-}
-
-int usb_init_kup4x (void)
-{
-   volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
-   volatile memctl8xx_t *memctl = &immap->im_memctl;
-   int i;
-   unsigned char tmp;
-
-   memctl = &immap->im_memctl;
-   memctl->memc_or7 = 0x8726;
-   memctl->memc_br7 = 0x5401;  /* start at 0x5000 */
-   /* BP 14 low = USB ON */
-   immap->im_cpm.cp_pbdat &= ~(BP_USB_VCC);
-   /* PB 14 nomal port */
-   immap->im_cpm.cp_pbpar &= ~(BP_USB_VCC);
-   /* output */
-   immap->im_cpm.cp_pbdir |= (BP_USB_VCC);
-
-   puts ("USB:   ");
-
-   for (i = 0x10; i < 0xff; i++) {
-   sl811_write(i, i);
-   tmp = (sl811_read(i));
-   if (tmp != i) {
-   printf ("SL811 compare error index=0x%02x 
read=0x%02x\n", i, tmp);
-   return (-1);
-   }
-   }
-   printf ("SL811 ready\n");
-   return (0);
-}
-
-/*
- * This function resets SL811HS controller and detects the speed of
- * the connecting device
- *
- * Return: 0 = no device attached; 1 = USB device attached
- */
-static int sl811_hc_reset(void)
-{
-   int status ;
-
-   sl811_write(SL811_CTRL2, SL811_CTL2_HOST | SL811_12M_HI);
-   sl811_write(SL811_CTRL1, SL811_CTRL1_RESET);
-
-   mdelay(20);
-
-   /* Disable hardware SOF generation, clear all irq status. */
-   sl811_write(SL811_CTRL1, 0);
-   mdelay(2);

[PATCH v3 57/76] sh4: Drop unused pci_sh7780 driver

2023-02-01 Thread Simon Glass
This is not used. Drop the driver and Kconfig option.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 arch/sh/include/asm/pci.h |  2 -
 drivers/pci/Makefile  |  1 -
 drivers/pci/pci_sh7780.c  | 92 ---
 3 files changed, 95 deletions(-)
 delete mode 100644 drivers/pci/pci_sh7780.c

diff --git a/arch/sh/include/asm/pci.h b/arch/sh/include/asm/pci.h
index 5d79d0ec58e..18b95ff5cfb 100644
--- a/arch/sh/include/asm/pci.h
+++ b/arch/sh/include/asm/pci.h
@@ -13,8 +13,6 @@
 #include 
 #if defined(CONFIG_SH7751_PCI)
 int pci_sh7751_init(struct pci_controller *hose);
-#elif defined(CONFIG_SH7780_PCI)
-int pci_sh7780_init(struct pci_controller *hose);
 #else
 #error "Not support PCI."
 #endif
diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile
index d393f1ba031..49506e7ba59 100644
--- a/drivers/pci/Makefile
+++ b/drivers/pci/Makefile
@@ -22,7 +22,6 @@ obj-$(CONFIG_PCI_MVEBU) += pci_mvebu.o
 obj-$(CONFIG_PCI_RCAR_GEN2) += pci-rcar-gen2.o
 obj-$(CONFIG_PCI_RCAR_GEN3) += pci-rcar-gen3.o
 obj-$(CONFIG_SH7751_PCI) +=pci_sh7751.o
-obj-$(CONFIG_SH7780_PCI) +=pci_sh7780.o
 obj-$(CONFIG_PCI_TEGRA) += pci_tegra.o
 obj-$(CONFIG_PCIE_IPROC) += pcie_iproc.o
 obj-$(CONFIG_PCI_AARDVARK) += pci-aardvark.o
diff --git a/drivers/pci/pci_sh7780.c b/drivers/pci/pci_sh7780.c
deleted file mode 100644
index 7533286c015..000
--- a/drivers/pci/pci_sh7780.c
+++ /dev/null
@@ -1,92 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * SH7780 PCI Controller (PCIC) for U-Boot.
- * (C) Dustin McIntire (dus...@sensoria.com)
- * (C) 2007,2008 Nobuhiro Iwamatsu 
- * (C) 2008 Yusuke Goda 
- */
-
-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-
-#define SH7780_VENDOR_ID   0x1912
-#define SH7780_DEVICE_ID   0x0002
-#define SH7780_PCICR_PREFIX0xA500
-#define SH7780_PCICR_PFCS  0x0800
-#define SH7780_PCICR_FTO   0x0400
-#define SH7780_PCICR_PFE   0x0200
-#define SH7780_PCICR_TBS   0x0100
-#define SH7780_PCICR_ARBM  0x0040
-#define SH7780_PCICR_IOCS  0x0004
-#define SH7780_PCICR_PRST  0x0002
-#define SH7780_PCICR_CFIN  0x0001
-
-#define p4_in(addr)(*(vu_long *)addr)
-#define p4_out(data, addr) (*(vu_long *)addr) = (data)
-#define p4_inw(addr)   (*(vu_short *)addr)
-#define p4_outw(data, addr)(*(vu_short *)addr) = (data)
-
-int pci_sh4_read_config_dword(struct pci_controller *hose,
-   pci_dev_t dev, int offset, u32 *value)
-{
-   u32 par_data = PCI_CONF1_ADDRESS(PCI_BUS(dev), PCI_DEV(dev), 
PCI_FUNC(dev), offset);
-
-   p4_out(par_data, SH7780_PCIPAR);
-   *value = p4_in(SH7780_PCIPDR);
-
-   return 0;
-}
-
-int pci_sh4_write_config_dword(struct pci_controller *hose,
-pci_dev_t dev, int offset, u32 value)
-{
-   u32 par_data = PCI_CONF1_ADDRESS(PCI_BUS(dev), PCI_DEV(dev), 
PCI_FUNC(dev), offset);
-
-   p4_out(par_data, SH7780_PCIPAR);
-   p4_out(value, SH7780_PCIPDR);
-   return 0;
-}
-
-int pci_sh7780_init(struct pci_controller *hose)
-{
-   p4_out(0x01, SH7780_PCIECR);
-
-   if (p4_inw(SH7780_PCIVID) != SH7780_VENDOR_ID
-   && p4_inw(SH7780_PCIDID) != SH7780_DEVICE_ID) {
-   printf("PCI: Unknown PCI host bridge.\n");
-   return -1;
-   }
-   printf("PCI: SH7780 PCI host bridge found.\n");
-
-   /* Toggle PCI reset pin */
-   p4_out((SH7780_PCICR_PREFIX | SH7780_PCICR_PRST), SH7780_PCICR);
-   udelay(10);
-   p4_out(SH7780_PCICR_PREFIX, SH7780_PCICR);
-   p4_outw(0x0047, SH7780_PCICMD);
-
-   p4_out(CONFIG_SH7780_PCI_LSR, SH7780_PCILSR0);
-   p4_out(CONFIG_SH7780_PCI_LAR, SH7780_PCILAR0);
-   p4_out(0x, SH7780_PCILSR1);
-   p4_out(0, SH7780_PCILAR1);
-   p4_out(CONFIG_SH7780_PCI_BAR, SH7780_PCIMBAR0);
-   p4_out(0x, SH7780_PCIMBAR1);
-
-   p4_out(0xFD00, SH7780_PCIMBR0);
-   p4_out(0x00FC, SH7780_PCIMBMR0);
-
-   /* if use Operand Cache then enable PCICSCR Soonp bits. */
-   p4_out(0x0800, SH7780_PCICSAR0);
-   p4_out(0x001B, SH7780_PCICSCR0);/* Snoop bit :On */
-
-   p4_out((SH7780_PCICR_PREFIX | SH7780_PCICR_CFIN | SH7780_PCICR_ARBM
- | SH7780_PCICR_FTO | SH7780_PCICR_PFCS | SH7780_PCICR_PFE),
-SH7780_PCICR);
-
-   pci_sh4_init(hose);
-   return 0;
-}
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 59/76] sysreset: at91: Correct Makefile rule for SYSRESET_AT91

2023-02-01 Thread Simon Glass
The SPL_TPL part is in the wrong place. Fix it.

Signed-off-by: Simon Glass 
Fixes: 71d4393f846 ("sysreset: Add Atmel/Microchip sysreset driver")
Reviewed-by: Claudiu Beznea 
---

(no changes since v1)

 drivers/sysreset/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/sysreset/Makefile b/drivers/sysreset/Makefile
index 0ed3bbf356a..40c876764af 100644
--- a/drivers/sysreset/Makefile
+++ b/drivers/sysreset/Makefile
@@ -20,6 +20,6 @@ obj-$(CONFIG_SYSRESET_TI_SCI) += sysreset-ti-sci.o
 obj-$(CONFIG_SYSRESET_SYSCON) += sysreset_syscon.o
 obj-$(CONFIG_SYSRESET_WATCHDOG) += sysreset_watchdog.o
 obj-$(CONFIG_SYSRESET_RESETCTL) += sysreset_resetctl.o
-obj-$(CONFIG_SYSRESET_$(SPL_TPL_)AT91) += sysreset_at91.o
+obj-$(CONFIG_$(SPL_TPL_)SYSRESET_AT91) += sysreset_at91.o
 obj-$(CONFIG_$(SPL_TPL_)SYSRESET_X86) += sysreset_x86.o
 obj-$(CONFIG_TARGET_XTFPGA) += sysreset_xtfpga.o
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 46/76] samsung: Rename PINCTRL_EXYNOS78x0

2023-02-01 Thread Simon Glass
CONFIG options must not use lower-case letter. Convert this to upper case.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 arch/arm/mach-exynos/Kconfig| 6 +++---
 drivers/pinctrl/exynos/Kconfig  | 2 +-
 drivers/pinctrl/exynos/Makefile | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index 8f3aee052c8..1a1fd7261b1 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -204,7 +204,7 @@ config  TARGET_A5Y17LTE
select CLK_EXYNOS
select OF_CONTROL
select PINCTRL
-   select PINCTRL_EXYNOS78x0
+   select PINCTRL_EXYNOS78X0
select SUPPORT_SPL
 
 config  TARGET_A7Y17LTE
@@ -213,7 +213,7 @@ config  TARGET_A7Y17LTE
select CLK_EXYNOS
select OF_CONTROL
select PINCTRL
-   select PINCTRL_EXYNOS78x0
+   select PINCTRL_EXYNOS78X0
select SUPPORT_SPL
 
 config  TARGET_A3Y17LTE
@@ -222,7 +222,7 @@ config  TARGET_A3Y17LTE
select CLK_EXYNOS
select OF_CONTROL
select PINCTRL
-   select PINCTRL_EXYNOS78x0
+   select PINCTRL_EXYNOS78X0
select SUPPORT_SPL
 
 endchoice
diff --git a/drivers/pinctrl/exynos/Kconfig b/drivers/pinctrl/exynos/Kconfig
index a60f49869b4..821bdd14072 100644
--- a/drivers/pinctrl/exynos/Kconfig
+++ b/drivers/pinctrl/exynos/Kconfig
@@ -9,7 +9,7 @@ config PINCTRL_EXYNOS7420
  Support pin multiplexing and pin configuration control on
  Samsung's Exynos7420 SoC.
 
-config PINCTRL_EXYNOS78x0
+config PINCTRL_EXYNOS78X0
bool "Samsung Exynos78x0 pinctrl driver"
depends on ARCH_EXYNOS && PINCTRL_FULL
select PINCTRL_EXYNOS
diff --git a/drivers/pinctrl/exynos/Makefile b/drivers/pinctrl/exynos/Makefile
index 07db970ca94..445c8e17aea 100644
--- a/drivers/pinctrl/exynos/Makefile
+++ b/drivers/pinctrl/exynos/Makefile
@@ -5,4 +5,4 @@
 
 obj-$(CONFIG_PINCTRL_EXYNOS)   += pinctrl-exynos.o
 obj-$(CONFIG_PINCTRL_EXYNOS7420)   += pinctrl-exynos7420.o
-obj-$(CONFIG_PINCTRL_EXYNOS78x0)   += pinctrl-exynos78x0.o
+obj-$(CONFIG_PINCTRL_EXYNOS78X0)   += pinctrl-exynos78x0.o
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 32/76] arm: Drop CONFIG_MMU

2023-02-01 Thread Simon Glass
This option does not exist, so the #ifdefs do nothing. Drop this code.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 arch/arm/lib/debug.S | 21 -
 1 file changed, 21 deletions(-)

diff --git a/arch/arm/lib/debug.S b/arch/arm/lib/debug.S
index 5983f2c04ce..af4beb4d9d2 100644
--- a/arch/arm/lib/debug.S
+++ b/arch/arm/lib/debug.S
@@ -21,22 +21,10 @@
 #include CONFIG_DEBUG_LL_INCLUDE
 #endif
 
-#ifdef CONFIG_MMU
-   .macro  addruart_current, rx, tmp1, tmp2
-   addruart\tmp1, \tmp2, \rx
-   mrc p15, 0, \rx, c1, c0
-   tst \rx, #1
-   moveq   \rx, \tmp1
-   movne   \rx, \tmp2
-   .endm
-
-#else /* !CONFIG_MMU */
.macro  addruart_current, rx, tmp1, tmp2
addruart\rx, \tmp1, \tmp2
.endm
 
-#endif /* CONFIG_MMU */
-
 /*
  * Useful debugging routines
  */
@@ -97,15 +85,6 @@ ENTRY(printch)
b   1b
 ENDPROC(printch)
 
-#ifdef CONFIG_MMU
-ENTRY(debug_ll_addr)
-   addruart r2, r3, ip
-   str r2, [r0]
-   str r3, [r1]
-   mov pc, lr
-ENDPROC(debug_ll_addr)
-#endif
-
 #else
 
 ENTRY(printascii)
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 55/76] mtd: Drop unused scf0403_lcd driver

2023-02-01 Thread Simon Glass
This is not used since this commit:

   76386d6195a arm: Remove cm_t35 board

Drop the driver and Kconfig option.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 drivers/video/Makefile  |   1 -
 drivers/video/scf0403_lcd.c | 297 
 include/scf0403_lcd.h   |  10 --
 3 files changed, 308 deletions(-)
 delete mode 100644 drivers/video/scf0403_lcd.c
 delete mode 100644 include/scf0403_lcd.h

diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 12b68cdd068..ce2d61d56bc 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -34,7 +34,6 @@ obj-$(CONFIG_LOGICORE_DP_TX) += logicore_dp_tx.o
 obj-$(CONFIG_NXP_TDA19988) += tda19988.o
 obj-$(CONFIG_OSD) += video_osd-uclass.o
 obj-$(CONFIG_SANDBOX_OSD) += sandbox_osd.o
-obj-$(CONFIG_SCF0403_LCD) += scf0403_lcd.o
 obj-$(CONFIG_VIDEO_ARM_MALIDP) += mali_dp.o
 obj-$(CONFIG_VIDEO_BCM2835) += bcm2835.o
 obj-$(CONFIG_VIDEO_BROADWELL_IGD) += broadwell_igd.o
diff --git a/drivers/video/scf0403_lcd.c b/drivers/video/scf0403_lcd.c
deleted file mode 100644
index 54f0f88b4c9..000
--- a/drivers/video/scf0403_lcd.c
+++ /dev/null
@@ -1,297 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * scf0403.c -- support for DataImage SCF0403 LCD
- *
- * Copyright (c) 2013 Adapted from Linux driver:
- * Copyright (c) 2012 Anders Electronics plc. All Rights Reserved.
- * Copyright (c) 2012 CompuLab, Ltd
- *   Dmitry Lifshitz 
- *   Ilya Ledvich 
- * Inspired by Alberto Panizzo  &
- * Marek Vasut work in l4f00242t03.c
- *
- * U-Boot port: Nikita Kiryanov 
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-
-struct scf0403_cmd {
-   u16 cmd;
-   u16 *params;
-   int count;
-};
-
-struct scf0403_initseq_entry {
-   struct scf0403_cmd cmd;
-   int delay_ms;
-};
-
-struct scf0403_priv {
-   struct spi_slave *spi;
-   unsigned int reset_gpio;
-   u32 rddid;
-   struct scf0403_initseq_entry *init_seq;
-   int seq_size;
-};
-
-struct scf0403_priv priv;
-
-#define SCF0403852GGU04_ID 0x80
-
-/* SCF0403526GGU20 model commands parameters */
-static u16 extcmd_params_sn20[]= {0xff, 0x98, 0x06};
-static u16 spiinttype_params_sn20[]= {0x60};
-static u16 bc_params_sn20[]= {
-   0x01, 0x10, 0x61, 0x74, 0x01, 0x01, 0x1B,
-   0x12, 0x71, 0x00, 0x00, 0x00, 0x01, 0x01,
-   0x05, 0x00, 0xFF, 0xF2, 0x01, 0x00, 0x40,
-};
-static u16 bd_params_sn20[] = {0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45, 0x67};
-static u16 be_params_sn20[] = {
-   0x01, 0x22, 0x22, 0xBA, 0xDC, 0x26, 0x28, 0x22, 0x22,
-};
-static u16 vcom_params_sn20[]  = {0x74};
-static u16 vmesur_params_sn20[]= {0x7F, 0x0F, 0x00};
-static u16 powerctl_params_sn20[]  = {0x03, 0x0b, 0x00};
-static u16 lvglvolt_params_sn20[]  = {0x08};
-static u16 engsetting_params_sn20[]= {0x00, 0x00, 0x00, 0x00, 0x00, 0x20};
-static u16 dispfunc_params_sn20[]  = {0xa0};
-static u16 dvddvolt_params_sn20[]  = {0x74};
-static u16 dispinv_params_sn20[]   = {0x00, 0x00, 0x00};
-static u16 panelres_params_sn20[]  = {0x82};
-static u16 framerate_params_sn20[] = {0x00, 0x13, 0x13};
-static u16 timing_params_sn20[]= {0x80, 0x05, 0x40, 0x28};
-static u16 powerctl2_params_sn20[] = {0x17, 0x75, 0x79, 0x20};
-static u16 memaccess_params_sn20[] = {0x00};
-static u16 pixfmt_params_sn20[]= {0x66};
-static u16 pgamma_params_sn20[]= {
-   0x00, 0x03, 0x0b, 0x0c, 0x0e, 0x08, 0xc5, 0x04,
-   0x08, 0x0c, 0x13, 0x11, 0x11, 0x14, 0x0c, 0x10,
-};
-static u16 ngamma_params_sn20[] = {
-   0x00, 0x0d, 0x11, 0x0c, 0x0c, 0x04, 0x76, 0x03,
-   0x08, 0x0b, 0x16, 0x10, 0x0d, 0x16, 0x0a, 0x00,
-};
-static u16 tearing_params_sn20[] = {0x00};
-
-/* SCF0403852GGU04 model commands parameters */
-static u16 memaccess_params_sn04[] = {0x08};
-static u16 pixfmt_params_sn04[]= {0x66};
-static u16 modectl_params_sn04[]   = {0x01};
-static u16 dispfunc_params_sn04[]  = {0x22, 0xe2, 0xFF, 0x04};
-static u16 vcom_params_sn04[]  = {0x00, 0x6A};
-static u16 pgamma_params_sn04[]= {
-   0x00, 0x07, 0x0d, 0x10, 0x13, 0x19, 0x0f, 0x0c,
-   0x05, 0x08, 0x06, 0x13, 0x0f, 0x30, 0x20, 0x1f,
-};
-static u16 ngamma_params_sn04[]= {
-   0x1F, 0x20, 0x30, 0x0F, 0x13, 0x06, 0x08, 0x05,
-   0x0C, 0x0F, 0x19, 0x13, 0x10, 0x0D, 0x07, 0x00,
-};
-static u16 dispinv_params_sn04[]   = {0x02};
-
-/* Common commands */
-static struct scf0403_cmd scf0403_cmd_slpout   = {0x11, NULL, 0};
-static struct scf0403_cmd scf0403_cmd_dison= {0x29, NULL, 0};
-
-/* SCF0403852GGU04 init sequence */
-static struct scf0403_initseq_entry scf0403_initseq_sn04[] = {
-   {{0x36, memaccess_params_sn04,  ARRAY_SIZE(memaccess_params_sn04)}, 0},
- 

[PATCH v3 44/76] ppc: Drop unused CONFIG_P2020DS

2023-02-01 Thread Simon Glass
This option does not exist, so the Makefile rule does nothing. Drop it.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 board/freescale/common/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/board/freescale/common/Makefile b/board/freescale/common/Makefile
index fc51d6d3e18..9d5f38bb225 100644
--- a/board/freescale/common/Makefile
+++ b/board/freescale/common/Makefile
@@ -54,7 +54,6 @@ obj-$(CONFIG_TARGET_MPC8548CDS)   += cds_pci_ft.o
 
 obj-$(CONFIG_TARGET_MPC8536DS) += ics307_clk.o
 obj-$(CONFIG_TARGET_P1022DS)   += ics307_clk.o
-obj-$(CONFIG_P2020DS)  += ics307_clk.o
 obj-$(CONFIG_TARGET_P3041DS)   += ics307_clk.o
 obj-$(CONFIG_TARGET_P4080DS)   += ics307_clk.o
 obj-$(CONFIG_TARGET_P5040DS)   += ics307_clk.o
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 67/76] usb: Drop unused ehci-faraday driver

2023-02-01 Thread Simon Glass
This is not used. Drop the driver and Kconfig option.

Signed-off-by: Simon Glass 
---

(no changes since v2)

Changes in v2:
- Reinstate usb_hub code removed by accident

 common/usb_hub.c|   6 --
 drivers/usb/host/Makefile   |   1 -
 drivers/usb/host/ehci-faraday.c | 144 
 drivers/usb/host/ehci-hcd.c |   5 --
 include/usb/fusbh200.h  |  59 -
 5 files changed, 215 deletions(-)
 delete mode 100644 drivers/usb/host/ehci-faraday.c
 delete mode 100644 include/usb/fusbh200.h

diff --git a/common/usb_hub.c b/common/usb_hub.c
index f7fd12c0450..85c0822d8b7 100644
--- a/common/usb_hub.c
+++ b/common/usb_hub.c
@@ -506,11 +506,6 @@ static int usb_scan_port(struct usb_device_scan *usb_scan)
if (portchange & USB_PORT_STAT_C_ENABLE) {
debug("port %d enable change, status %x\n", i + 1, portstatus);
usb_clear_port_feature(dev, i + 1, USB_PORT_FEAT_C_ENABLE);
-   /*
-* The following hack causes a ghost device problem
-* to Faraday EHCI
-*/
-#ifndef CONFIG_USB_EHCI_FARADAY
/*
 * EM interference sometimes causes bad shielded USB
 * devices to be shutdown by the hub, this hack enables
@@ -523,7 +518,6 @@ static int usb_scan_port(struct usb_device_scan *usb_scan)
  i + 1);
usb_hub_port_connect_change(dev, i);
}
-#endif
}
 
if (portstatus & USB_PORT_STAT_SUSPEND) {
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index 1f59e910d3b..cce78846d98 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -27,7 +27,6 @@ obj-$(CONFIG_USB_OHCI_NPCM) += ohci-npcm.o
 obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o
 obj-$(CONFIG_USB_EHCI_ATMEL) += ehci-atmel.o
 obj-$(CONFIG_USB_EHCI_FSL) += ehci-fsl.o
-obj-$(CONFIG_USB_EHCI_FARADAY) += ehci-faraday.o
 obj-$(CONFIG_USB_EHCI_GENERIC) += ehci-generic.o
 obj-$(CONFIG_USB_EHCI_EXYNOS) += ehci-exynos.o
 obj-$(CONFIG_USB_EHCI_MXS) += ehci-mxs.o
diff --git a/drivers/usb/host/ehci-faraday.c b/drivers/usb/host/ehci-faraday.c
deleted file mode 100644
index 85a35269601..000
--- a/drivers/usb/host/ehci-faraday.c
+++ /dev/null
@@ -1,144 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Faraday USB 2.0 EHCI Controller
- *
- * (C) Copyright 2010 Faraday Technology
- * Dante Su 
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "ehci.h"
-
-#ifndef CFG_USB_EHCI_BASE_LIST
-#define CFG_USB_EHCI_BASE_LIST { CONFIG_USB_EHCI_BASE }
-#endif
-
-union ehci_faraday_regs {
-   struct fusbh200_regs usb;
-   struct fotg210_regs  otg;
-};
-
-static inline int ehci_is_fotg2xx(union ehci_faraday_regs *regs)
-{
-   return !readl(®s->usb.easstr);
-}
-
-void faraday_ehci_set_usbmode(struct ehci_ctrl *ctrl)
-{
-   /* nothing needs to be done */
-}
-
-int faraday_ehci_get_port_speed(struct ehci_ctrl *ctrl, uint32_t reg)
-{
-   int spd, ret = PORTSC_PSPD_HS;
-   union ehci_faraday_regs *regs;
-
-   ret = (void __iomem *)((ulong)ctrl->hcor - 0x10);
-   if (ehci_is_fotg2xx(regs))
-   spd = OTGCSR_SPD(readl(®s->otg.otgcsr));
-   else
-   spd = BMCSR_SPD(readl(®s->usb.bmcsr));
-
-   switch (spd) {
-   case 0:/* full speed */
-   ret = PORTSC_PSPD_FS;
-   break;
-   case 1:/* low  speed */
-   ret = PORTSC_PSPD_LS;
-   break;
-   case 2:/* high speed */
-   ret = PORTSC_PSPD_HS;
-   break;
-   default:
-   printf("ehci-faraday: invalid device speed\n");
-   break;
-   }
-
-   return ret;
-}
-
-uint32_t *faraday_ehci_get_portsc_register(struct ehci_ctrl *ctrl, int port)
-{
-   /* Faraday EHCI has one and only one portsc register */
-   if (port) {
-   /* Printing the message would cause a scan failure! */
-   debug("The request port(%d) is not configured\n", port);
-   return NULL;
-   }
-
-   /* Faraday EHCI PORTSC register offset is 0x20 from hcor */
-   return (uint32_t *)((uint8_t *)ctrl->hcor + 0x20);
-}
-
-static const struct ehci_ops faraday_ehci_ops = {
-   .set_usb_mode   = faraday_ehci_set_usbmode,
-   .get_port_speed = faraday_ehci_get_port_speed,
-   .get_portsc_register= faraday_ehci_get_portsc_register,
-};
-
-/*
- * Create the appropriate control structures to manage
- * a new EHCI host controller.
- */
-int ehci_hcd_init(int index, enum usb_init_type init,
-   struct ehci_hccr **ret_hccr, struct ehci_hcor **ret_hcor)
-{
-   struct ehci_hccr *hccr;
-   struct ehci_hcor *hcor;
-   union ehci_faraday_regs *regs;
-   uint32_t base_list[] = CFG_USB_EHCI_BASE_LIST;
-
-   if (index < 0 || index >= ARRAY_SIZE(base_list))
-

[PATCH v3 66/76] armada: usb: net: Drop unused USB drivers

2023-02-01 Thread Simon Glass
These are not used. Drop the drivers and Kconfig option. Also drop an
old declaration in the netdev.h header.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 drivers/usb/host/Makefile |  1 -
 drivers/usb/host/ehci-armada100.c | 48 ---
 drivers/usb/host/utmi-armada100.c | 80 ---
 include/netdev.h  |  1 -
 4 files changed, 130 deletions(-)
 delete mode 100644 drivers/usb/host/ehci-armada100.c
 delete mode 100644 drivers/usb/host/utmi-armada100.c

diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index ddc36632069..1f59e910d3b 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -25,7 +25,6 @@ obj-$(CONFIG_USB_OHCI_NPCM) += ohci-npcm.o
 
 # echi
 obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o
-obj-$(CONFIG_USB_EHCI_ARMADA100) += ehci-armada100.o utmi-armada100.o
 obj-$(CONFIG_USB_EHCI_ATMEL) += ehci-atmel.o
 obj-$(CONFIG_USB_EHCI_FSL) += ehci-fsl.o
 obj-$(CONFIG_USB_EHCI_FARADAY) += ehci-faraday.o
diff --git a/drivers/usb/host/ehci-armada100.c 
b/drivers/usb/host/ehci-armada100.c
deleted file mode 100644
index 2ce9f27b862..000
--- a/drivers/usb/host/ehci-armada100.c
+++ /dev/null
@@ -1,48 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2012
- * eInfochips Ltd. 
- * Written-by: Ajay Bhargav 
- *
- * This driver is based on Kirkwood echi driver
- * (C) Copyright 2009
- * Marvell Semiconductor 
- * Written-by: Prafulla Wadaskar 
- */
-
-#include 
-#include 
-#include 
-#include 
-#include "ehci.h"
-#include 
-#include 
-#include 
-
-/*
- * EHCI host controller init
- */
-int ehci_hcd_init(int index, enum usb_init_type init,
-   struct ehci_hccr **hccr, struct ehci_hcor **hcor)
-{
-   if (utmi_init() < 0)
-   return -1;
-
-   *hccr = (struct ehci_hccr *)(ARMD1_USB_HOST_BASE + 0x100);
-   *hcor = (struct ehci_hcor *)((uint32_t) *hccr
-   + HC_LENGTH(ehci_readl(&(*hccr)->cr_capbase)));
-
-   debug("armada100-ehci: init hccr %x and hcor %x hc_length %d\n",
-   (uint32_t)*hccr, (uint32_t)*hcor,
-   (uint32_t)HC_LENGTH(ehci_readl(&(*hccr)->cr_capbase)));
-
-   return 0;
-}
-
-/*
- * EHCI host controller stop
- */
-int ehci_hcd_stop(int index)
-{
-   return 0;
-}
diff --git a/drivers/usb/host/utmi-armada100.c 
b/drivers/usb/host/utmi-armada100.c
deleted file mode 100644
index 5d66e5881f3..000
--- a/drivers/usb/host/utmi-armada100.c
+++ /dev/null
@@ -1,80 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2012
- * eInfochips Ltd. 
- * Written-by: Ajay Bhargav 
- *
- * (C) Copyright 2009
- * Marvell Semiconductor 
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-static int utmi_phy_init(void)
-{
-   struct armd1usb_phy_reg *phy_regs =
-   (struct armd1usb_phy_reg *)UTMI_PHY_BASE;
-   int timeout;
-
-   setbits_le32(&phy_regs->utmi_ctrl, INPKT_DELAY_SOF | PLL_PWR_UP);
-   udelay(1000);
-   setbits_le32(&phy_regs->utmi_ctrl, PHY_PWR_UP);
-
-   clrbits_le32(&phy_regs->utmi_pll, PLL_FBDIV_MASK | PLL_REFDIV_MASK);
-   setbits_le32(&phy_regs->utmi_pll, N_DIVIDER << PLL_FBDIV | M_DIVIDER);
-
-   setbits_le32(&phy_regs->utmi_tx, PHSEL_VAL << CK60_PHSEL);
-
-   /* Calibrate pll */
-   timeout = 1;
-   while (--timeout && ((readl(&phy_regs->utmi_pll) & PLL_READY) == 0))
-   ;
-   if (!timeout)
-   return -1;
-
-   udelay(200);
-   setbits_le32(&phy_regs->utmi_pll, VCOCAL_START);
-   udelay(400);
-   clrbits_le32(&phy_regs->utmi_pll, VCOCAL_START);
-
-   udelay(200);
-   setbits_le32(&phy_regs->utmi_tx, RCAL_START);
-   udelay(400);
-   clrbits_le32(&phy_regs->utmi_tx, RCAL_START);
-
-   timeout = 1;
-   while (--timeout && ((readl(&phy_regs->utmi_pll) & PLL_READY) == 0))
-   ;
-   if (!timeout)
-   return -1;
-
-   return 0;
-}
-
-/*
- * Initialize USB host controller's UTMI Physical interface
- */
-int utmi_init(void)
-{
-   struct armd1mpmu_registers *mpmu_regs =
-   (struct armd1mpmu_registers *)ARMD1_MPMU_BASE;
-
-   struct armd1apmu_registers *apmu_regs =
-   (struct armd1apmu_registers *)ARMD1_APMU_BASE;
-
-   /* Turn on 26Mhz ref clock for UTMI PLL */
-   setbits_le32(&mpmu_regs->acgr, APB2_26M_EN | AP_26M);
-
-   /* USB Clock reset */
-   writel(USB_SPH_AXICLK_EN, &apmu_regs->usbcrc);
-   writel(USB_SPH_AXICLK_EN | USB_SPH_AXI_RST, &apmu_regs->usbcrc);
-
-   /* Initialize UTMI transceiver */
-   return utmi_phy_init();
-}
diff --git a/include/netdev.h b/include/netdev.h
index 2b4e474ed08..2a7f40e5040 100644
--- a/include/netdev.h
+++ b/include/netdev.h
@@ -71,7 +71,6 @@ int skge_initialize(struct bd_info *bis);
 int smc9_initialize(u8 dev_num, phys_addr_t base_addr);
 int smc911x_initialize(u8 dev_num, phys_addr

[PATCH v3 60/76] gdsys: Drop unused fpga file

2023-02-01 Thread Simon Glass
This is not used since CONFIG_SYS_FPGA_COMMON is not defined anywhere.
Drop the code and the Makefile rule.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 board/gdsys/common/Makefile |  1 -
 board/gdsys/common/fpga.c   | 28 
 2 files changed, 29 deletions(-)
 delete mode 100644 board/gdsys/common/fpga.c

diff --git a/board/gdsys/common/Makefile b/board/gdsys/common/Makefile
index 553e2ca50ed..94cbf3c5cc1 100644
--- a/board/gdsys/common/Makefile
+++ b/board/gdsys/common/Makefile
@@ -3,7 +3,6 @@
 # (C) Copyright 2007
 # Stefan Roese, DENX Software Engineering, s...@denx.de.
 
-obj-$(CONFIG_SYS_FPGA_COMMON) += fpga.o
 obj-$(CONFIG_CMD_IOLOOP) += cmd_ioloop.o
 obj-$(CONFIG_TARGET_CONTROLCENTERDC) += dp501.o
 obj-$(CONFIG_TARGET_GAZERBEAM) += osd.o ihs_mdio.o ioep-fpga.o
diff --git a/board/gdsys/common/fpga.c b/board/gdsys/common/fpga.c
deleted file mode 100644
index 5ba6613ed56..000
--- a/board/gdsys/common/fpga.c
+++ /dev/null
@@ -1,28 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2013
- * Dirk Eibach,  Guntermann & Drunck GmbH, dirk.eib...@gdsys.cc
- */
-
-#ifdef CONFIG_GDSYS_LEGACY_DRIVERS
-
-#include 
-#include 
-
-#include 
-
-int fpga_set_reg(u32 fpga, u16 *reg, off_t regoff, u16 data)
-{
-   out_le16(reg, data);
-
-   return 0;
-}
-
-int fpga_get_reg(u32 fpga, u16 *reg, off_t regoff, u16 *data)
-{
-   *data = in_le16(reg);
-
-   return 0;
-}
-
-#endif /* CONFIG_GDSYS_LEGACY_DRIVERS */
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 58/76] Drop ubsha1 tool

2023-02-01 Thread Simon Glass
This seems to have been used by ppc4xx which was removed a while back.
The Kconfig does not exist so it is never built. Drop it.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 Makefile |  3 --
 tools/.gitignore |  1 -
 tools/Makefile   |  6 
 tools/ubsha1.c   | 83 
 4 files changed, 93 deletions(-)
 delete mode 100644 tools/ubsha1.c

diff --git a/Makefile b/Makefile
index 73a562a26de..2c9e27ac5c2 100644
--- a/Makefile
+++ b/Makefile
@@ -1450,9 +1450,6 @@ u-boot-with-spl.kwb: u-boot.bin spl/u-boot-spl.bin FORCE
$(call if_changed,mkimage)
$(BOARD_SIZE_CHECK)
 
-u-boot.sha1:   u-boot.bin
-   tools/ubsha1 u-boot.bin
-
 u-boot.dis:u-boot
$(OBJDUMP) -d $< > $@
 
diff --git a/tools/.gitignore b/tools/.gitignore
index 28e8ce2a07a..788ea260a07 100644
--- a/tools/.gitignore
+++ b/tools/.gitignore
@@ -33,7 +33,6 @@
 /relocate-rela
 /spl_size_limit
 /sunxi-spl-image-builder
-/ubsha1
 /update_octeon_header
 /version.h
 /xway-swap-bytes
diff --git a/tools/Makefile b/tools/Makefile
index 2ee43dff542..0eadd8154a7 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -29,7 +29,6 @@ CONFIG_CMD_LOADS = y
 CONFIG_CMD_NET = y
 CONFIG_XWAY_SWAP_BYTES = y
 CONFIG_NETCONSOLE = y
-CONFIG_SHA1_CHECK_UB_IMG = y
 CONFIG_ARCH_SUNXI = y
 endif
 
@@ -217,11 +216,6 @@ hostprogs-$(CONFIG_ARCH_SUNXI) += sunxi-spl-image-builder
 sunxi-spl-image-builder-objs := sunxi-spl-image-builder.o lib/bch.o
 
 hostprogs-$(CONFIG_NETCONSOLE) += ncb
-hostprogs-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1
-
-ubsha1-objs := os_support.o ubsha1.o lib/sha1.o
-
-HOSTCFLAGS_ubsha1.o := -pedantic
 
 hostprogs-$(CONFIG_ARCH_KIRKWOOD) += kwboot
 hostprogs-$(CONFIG_ARCH_MVEBU) += kwboot
diff --git a/tools/ubsha1.c b/tools/ubsha1.c
deleted file mode 100644
index 90a6f3f59d2..000
--- a/tools/ubsha1.c
+++ /dev/null
@@ -1,83 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2007
- * Heiko Schocher, DENX Software Engineering, 
- */
-
-#include "os_support.h"
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-int main (int argc, char **argv)
-{
-   unsigned char output[20];
-   int i, len;
-
-   char*imagefile;
-   char*cmdname = *argv;
-   unsigned char   *ptr;
-   unsigned char   *data;
-   struct stat sbuf;
-   unsigned char   *ptroff;
-   int ifd;
-   int off;
-
-   if (argc > 1) {
-   imagefile = argv[1];
-   ifd = open (imagefile, O_RDWR|O_BINARY);
-   if (ifd < 0) {
-   fprintf (stderr, "%s: Can't open %s: %s\n",
-   cmdname, imagefile, strerror(errno));
-   exit (EXIT_FAILURE);
-   }
-   if (fstat (ifd, &sbuf) < 0) {
-   fprintf (stderr, "%s: Can't stat %s: %s\n",
-   cmdname, imagefile, strerror(errno));
-   exit (EXIT_FAILURE);
-   }
-   len = sbuf.st_size;
-   ptr = (unsigned char *)mmap(0, len,
-   PROT_READ, MAP_SHARED, ifd, 0);
-   if (ptr == (unsigned char *)MAP_FAILED) {
-   fprintf (stderr, "%s: Can't read %s: %s\n",
-   cmdname, imagefile, strerror(errno));
-   exit (EXIT_FAILURE);
-   }
-
-   /* create a copy, so we can blank out the sha1 sum */
-   data = malloc (len);
-   memcpy (data, ptr, len);
-   off = SHA1_SUM_POS;
-   ptroff = &data[len +  off];
-   for (i = 0; i < SHA1_SUM_LEN; i++) {
-   ptroff[i] = 0;
-   }
-
-   sha1_csum ((unsigned char *) data, len, (unsigned char 
*)output);
-
-   printf ("U-Boot sum:\n");
-   for (i = 0; i < 20 ; i++) {
-   printf ("%02X ", output[i]);
-   }
-   printf ("\n");
-   /* overwrite the sum in the bin file, with the actual */
-   lseek (ifd, SHA1_SUM_POS, SEEK_END);
-   if (write (ifd, output, SHA1_SUM_LEN) != SHA1_SUM_LEN) {
-   fprintf (stderr, "%s: Can't write %s: %s\n",
-   cmdname, imagefile, strerror(errno));
-   exit (EXIT_FAILURE);
-   }
-
-   free (data);
-   (void) munmap((void *)ptr, len);
-   (void) close (ifd);
-   }
-
-   return EXIT_SUCCESS;
-}
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 76/76] fdt: Drop use of non-existent OF_PLATDATA option

2023-02-01 Thread Simon Glass
These are only present in SPL. Drop the references to non-SPL versions.

Signed-off-by: Simon Glass 
---

Changes in v3:
- Drop the 10 patches that rename lower-case Kconfig options

Changes in v2:
- Drop patch "treewide: Correct invalid Kconfig syntax and warnings"

 dts/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dts/Kconfig b/dts/Kconfig
index bc5f22029ff..44cc6bf1f6f 100644
--- a/dts/Kconfig
+++ b/dts/Kconfig
@@ -21,8 +21,8 @@ menu "Device Tree Control"
 
 config OF_CONTROL
bool "Run-time configuration via Device Tree"
-   select OF_LIBFDT if !OF_PLATDATA
-   select OF_REAL if !OF_PLATDATA
+   select OF_LIBFDT
+   select OF_REAL
help
  This feature provides for run-time configuration of U-Boot
  via a flattened device tree.
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 54/76] mtd: Drop unused CONFIG_S32V234

2023-02-01 Thread Simon Glass
This option does not exist, so the Makefile rule does nothing. Drop it.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 arch/arm/cpu/armv8/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/cpu/armv8/Makefile b/arch/arm/cpu/armv8/Makefile
index 2e4bf9e038c..bba4f570dbb 100644
--- a/arch/arm/cpu/armv8/Makefile
+++ b/arch/arm/cpu/armv8/Makefile
@@ -39,7 +39,6 @@ obj-$(CONFIG_SPL_RECOVER_DATA_SECTION) += spl_data.o
 endif
 
 obj-$(CONFIG_FSL_LAYERSCAPE) += fsl-layerscape/
-obj-$(CONFIG_S32V234) += s32v234/
 obj-$(CONFIG_TARGET_HIKEY) += hisilicon/
 obj-$(CONFIG_ARMV8_PSCI) += psci.o
 obj-$(CONFIG_TARGET_BCMNS3) += bcmns3/
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 23/76] misc: Drop mc9sdz60 driver

2023-02-01 Thread Simon Glass
Drop this unused driver.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 drivers/misc/Makefile   |  1 -
 drivers/misc/mc9sdz60.c | 34 --
 2 files changed, 35 deletions(-)
 delete mode 100644 drivers/misc/mc9sdz60.c

diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 2de510329d8..3b792f2a14c 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -36,7 +36,6 @@ obj-$(CONFIG_DS4510)  += ds4510.o
 obj-$(CONFIG_FSL_DEVICE_DISABLE) += fsl_devdis.o
 obj-$(CONFIG_FSL_IFC) += fsl_ifc.o
 obj-$(CONFIG_FSL_IIM) += fsl_iim.o
-obj-$(CONFIG_FSL_MC9SDZ60) += mc9sdz60.o
 obj-$(CONFIG_FSL_SEC_MON) += fsl_sec_mon.o
 obj-$(CONFIG_$(SPL_)FS_LOADER) += fs_loader.o
 obj-$(CONFIG_GATEWORKS_SC) += gsc.o
diff --git a/drivers/misc/mc9sdz60.c b/drivers/misc/mc9sdz60.c
deleted file mode 100644
index e68a056a559..000
--- a/drivers/misc/mc9sdz60.c
+++ /dev/null
@@ -1,34 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2010 Stefano Babic 
- */
-
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#ifndef CONFIG_SYS_FSL_MC9SDZ60_I2C_ADDR
-#error "You have to configure I2C address for MC9SDZ60"
-#endif
-
-
-u8 mc9sdz60_reg_read(enum mc9sdz60_reg reg)
-{
-   u8 val;
-
-   if (i2c_read(CONFIG_SYS_FSL_MC9SDZ60_I2C_ADDR, reg, 1, &val, 1)) {
-   puts("Error reading MC9SDZ60 register\n");
-   return -1;
-   }
-
-   return val;
-}
-
-void mc9sdz60_reg_write(enum mc9sdz60_reg reg, u8 val)
-{
-   i2c_write(CONFIG_SYS_FSL_MC9SDZ60_I2C_ADDR, reg, 1, &val, 1);
-}
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 12/76] rockchip: Correct a reference to CONFIG_BOOT_MODE_REG

2023-02-01 Thread Simon Glass
This option does not exist and should refer to
CONFIG_ROCKCHIP_BOOT_MODE_REG instead. Fix it.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 arch/arm/mach-rockchip/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile
index 32138fa723f..e3d4a8b42e4 100644
--- a/arch/arm/mach-rockchip/Makefile
+++ b/arch/arm/mach-rockchip/Makefile
@@ -18,7 +18,7 @@ obj-spl-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board-spl.o
 ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),)
 
 # Always include boot_mode.o, as we bypass it (i.e. turn it off)
-# inside of boot_mode.c when CONFIG_BOOT_MODE_REG is 0.  This way,
+# inside of boot_mode.c when CONFIG_ROCKCHIP_BOOT_MODE_REG is 0.  This way,
 # we can have the preprocessor correctly recognise both 0x0 and 0
 # meaning "turn it off".
 obj-y += boot_mode.o
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 61/76] sh4: Drop unused kona_i2c driver

2023-02-01 Thread Simon Glass
This is not used. Drop the driver and Kconfig option.

Signed-off-by: Simon Glass 
Reviewed-by: Heiko Schocher 
---

(no changes since v1)

 drivers/i2c/Makefile   |   1 -
 drivers/i2c/kona_i2c.c | 728 -
 2 files changed, 729 deletions(-)
 delete mode 100644 drivers/i2c/kona_i2c.c

diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile
index 920aafb91c5..cde0597290c 100644
--- a/drivers/i2c/Makefile
+++ b/drivers/i2c/Makefile
@@ -25,7 +25,6 @@ obj-$(CONFIG_SYS_I2C_IHS) += ihs_i2c.o
 obj-$(CONFIG_SYS_I2C_INTEL) += intel_i2c.o
 obj-$(CONFIG_SYS_I2C_IMX_LPI2C) += imx_lpi2c.o
 obj-$(CONFIG_SYS_I2C_IPROC) += iproc_i2c.o
-obj-$(CONFIG_SYS_I2C_KONA) += kona_i2c.o
 obj-$(CONFIG_SYS_I2C_LPC32XX) += lpc32xx_i2c.o
 obj-$(CONFIG_SYS_I2C_MESON) += meson_i2c.o
 obj-$(CONFIG_SYS_I2C_MICROCHIP) += i2c-microchip.o
diff --git a/drivers/i2c/kona_i2c.c b/drivers/i2c/kona_i2c.c
deleted file mode 100644
index b9b0ff1c39e..000
--- a/drivers/i2c/kona_i2c.c
+++ /dev/null
@@ -1,728 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright 2013 Broadcom Corporation.
- *
- * NOTE: This driver should be converted to driver model before June 2017.
- * Please see doc/driver-model/i2c-howto.rst for instructions.
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-/* Hardware register offsets and field defintions */
-#define CS_OFFSET  0x0020
-#define CS_ACK_SHIFT   3
-#define CS_ACK_MASK0x0008
-#define CS_ACK_CMD_GEN_START   0x
-#define CS_ACK_CMD_GEN_RESTART 0x0001
-#define CS_CMD_SHIFT   1
-#define CS_CMD_CMD_NO_ACTION   0x
-#define CS_CMD_CMD_START_RESTART   0x0001
-#define CS_CMD_CMD_STOP0x0002
-#define CS_EN_SHIFT0
-#define CS_EN_CMD_ENABLE_BSC   0x0001
-
-#define TIM_OFFSET 0x0024
-#define TIM_PRESCALE_SHIFT 6
-#define TIM_P_SHIFT3
-#define TIM_NO_DIV_SHIFT   2
-#define TIM_DIV_SHIFT  0
-
-#define DAT_OFFSET 0x0028
-
-#define TOUT_OFFSET0x002c
-
-#define TXFCR_OFFSET   0x003c
-#define TXFCR_FIFO_FLUSH_MASK  0x0080
-#define TXFCR_FIFO_EN_MASK 0x0040
-
-#define IER_OFFSET 0x0044
-#define IER_READ_COMPLETE_INT_MASK 0x0010
-#define IER_I2C_INT_EN_MASK0x0008
-#define IER_FIFO_INT_EN_MASK   0x0002
-#define IER_NOACK_EN_MASK  0x0001
-
-#define ISR_OFFSET 0x0048
-#define ISR_RESERVED_MASK  0xff60
-#define ISR_CMDBUSY_MASK   0x0080
-#define ISR_READ_COMPLETE_MASK 0x0010
-#define ISR_SES_DONE_MASK  0x0008
-#define ISR_ERR_MASK   0x0004
-#define ISR_TXFIFOEMPTY_MASK   0x0002
-#define ISR_NOACK_MASK 0x0001
-
-#define CLKEN_OFFSET   0x004c
-#define CLKEN_AUTOSENSE_OFF_MASK   0x0080
-#define CLKEN_M_SHIFT  4
-#define CLKEN_N_SHIFT  1
-#define CLKEN_CLKEN_MASK   0x0001
-
-#define FIFO_STATUS_OFFSET 0x0054
-#define FIFO_STATUS_RXFIFO_EMPTY_MASK  0x0004
-#define FIFO_STATUS_TXFIFO_EMPTY_MASK  0x0010
-
-#define HSTIM_OFFSET   0x0058
-#define HSTIM_HS_MODE_MASK 0x8000
-#define HSTIM_HS_HOLD_SHIFT10
-#define HSTIM_HS_HIGH_PHASE_SHIFT  5
-#define HSTIM_HS_SETUP_SHIFT   0
-
-#define PADCTL_OFFSET  0x005c
-#define PADCTL_PAD_OUT_EN_MASK 0x0004
-
-#define RXFCR_OFFSET   0x0068
-#define RXFCR_NACK_EN_SHIFT7
-#define RXFCR_READ_COUNT_SHIFT 0
-#define RXFIFORDOUT_OFFSET 0x006c
-
-/* Locally used constants */
-#define MAX_RX_FIFO_SIZE   64U /* bytes */
-#define MAX_TX_FIFO_SIZE   64U /* bytes */
-
-#define I2C_TIMEOUT10  /* usecs */
-
-#define WAIT_INT_CHK   100 /* usecs */
-#if I2C_TIMEOUT % WAIT_INT_CHK
-#error I2C_TIMEOUT must be a multiple of WAIT_INT_CHK
-#endif
-
-/* Operations that can be commanded to the controller */
-enum bcm_kona_cmd_t {
-   BCM_CMD_NOACTION = 0,
-   BCM_CMD_START,
-   BCM_CMD_RESTART,
-   BCM_CMD_STOP,
-};
-

[PATCH v3 47/76] power: Drop unused bat_trats driver and battery code

2023-02-01 Thread Simon Glass
This driver and bat_trats2 are not used. Drop them and the entire battery
directory, since there is nothing left.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 drivers/power/Makefile |  1 -
 drivers/power/battery/Makefile |  7 ---
 drivers/power/battery/bat_trats.c  | 91 --
 drivers/power/battery/bat_trats2.c | 65 -
 4 files changed, 164 deletions(-)
 delete mode 100644 drivers/power/battery/Makefile
 delete mode 100644 drivers/power/battery/bat_trats.c
 delete mode 100644 drivers/power/battery/bat_trats2.c

diff --git a/drivers/power/Makefile b/drivers/power/Makefile
index 34a84808a9c..efdae3655ac 100644
--- a/drivers/power/Makefile
+++ b/drivers/power/Makefile
@@ -4,7 +4,6 @@
 # Tom Rix 
 
 obj-$(CONFIG_$(SPL_TPL_)ACPI_PMC) += acpi_pmc/
-obj-y += battery/
 obj-$(CONFIG_$(SPL_TPL_)POWER_DOMAIN) += domain/
 obj-y += fuel_gauge/
 obj-y += mfd/
diff --git a/drivers/power/battery/Makefile b/drivers/power/battery/Makefile
deleted file mode 100644
index 370923a6ed9..000
--- a/drivers/power/battery/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0+
-#
-# Copyright (C) 2012 Samsung Electronics
-# Lukasz Majewski 
-
-obj-$(CONFIG_POWER_BATTERY_TRATS) += bat_trats.o
-obj-$(CONFIG_POWER_BATTERY_TRATS2) += bat_trats2.o
diff --git a/drivers/power/battery/bat_trats.c 
b/drivers/power/battery/bat_trats.c
deleted file mode 100644
index 54b2bf91e5c..000
--- a/drivers/power/battery/bat_trats.c
+++ /dev/null
@@ -1,91 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- *  Copyright (C) 2012 Samsung Electronics
- *  Lukasz Majewski 
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-static struct battery battery_trats;
-
-static int power_battery_charge(struct pmic *bat)
-{
-   struct power_battery *p_bat = bat->pbat;
-   struct battery *battery = p_bat->bat;
-   int k;
-
-   if (bat->chrg->chrg_state(p_bat->chrg, PMIC_CHARGER_ENABLE, 450))
-   return -1;
-
-   for (k = 0; bat->chrg->chrg_bat_present(p_bat->chrg) &&
-bat->chrg->chrg_type(p_bat->muic) &&
-battery->state_of_chrg < 100; k++) {
-   udelay(200);
-   if (!(k % 5))
-   puts(".");
-   bat->fg->fg_battery_update(p_bat->fg, bat);
-
-   if (k == 200) {
-   debug(" %d [V]", battery->voltage_uV);
-   puts("\n");
-   k = 0;
-   }
-
-   if (ctrlc()) {
-   printf("\nCharging disabled on request.\n");
-   goto exit;
-   }
-   }
- exit:
-   bat->chrg->chrg_state(p_bat->chrg, PMIC_CHARGER_DISABLE, 0);
-
-   return 0;
-}
-
-static int power_battery_init_trats(struct pmic *bat_,
-   struct pmic *fg_,
-   struct pmic *chrg_,
-   struct pmic *muic_)
-{
-   bat_->pbat->fg = fg_;
-   bat_->pbat->chrg = chrg_;
-   bat_->pbat->muic = muic_;
-
-   bat_->fg = fg_->fg;
-   bat_->chrg = chrg_->chrg;
-   bat_->chrg->chrg_type = muic_->chrg->chrg_type;
-   return 0;
-}
-
-static struct power_battery power_bat_trats = {
-   .bat = &battery_trats,
-   .battery_init = power_battery_init_trats,
-   .battery_charge = power_battery_charge,
-};
-
-int power_bat_init(unsigned char bus)
-{
-   static const char name[] = "BAT_TRATS";
-   struct pmic *p = pmic_alloc();
-
-   if (!p) {
-   printf("%s: POWER allocation error!\n", __func__);
-   return -ENOMEM;
-   }
-
-   debug("Board BAT init\n");
-
-   p->interface = PMIC_NONE;
-   p->name = name;
-   p->bus = bus;
-
-   p->pbat = &power_bat_trats;
-   return 0;
-}
diff --git a/drivers/power/battery/bat_trats2.c 
b/drivers/power/battery/bat_trats2.c
deleted file mode 100644
index 1172970d1e0..000
--- a/drivers/power/battery/bat_trats2.c
+++ /dev/null
@@ -1,65 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- *  Copyright (C) 2013 Samsung Electronics
- *  Piotr Wilczek 
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-static struct battery battery_trats;
-
-static int power_battery_charge(struct pmic *bat)
-{
-   struct power_battery *p_bat = bat->pbat;
-
-   if (bat->chrg->chrg_state(p_bat->chrg, PMIC_CHARGER_ENABLE, 450))
-   return -EINVAL;
-
-   return 0;
-}
-
-static int power_battery_init_trats2(struct pmic *bat_,
-   struct pmic *fg_,
-   struct pmic *chrg_,
-   struct pmic *muic_)
-{
-   bat_->pbat->fg = fg_;
-   bat_->pbat->chrg = chrg_;
-   bat_->pbat->muic = muic_;
-
-   bat_->fg = fg_->fg;
-   bat_->chrg = chrg_->chrg;
-

[PATCH v3 74/76] tools: Drop xway-swap-bytes tool

2023-02-01 Thread Simon Glass
This is very old and does not appear to be used. The CONFIG option
enabling it is no-longer present. Drop it.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 README  |  7 ---
 tools/Makefile  |  4 
 tools/xway-swap-bytes.c | 38 --
 3 files changed, 49 deletions(-)
 delete mode 100644 tools/xway-swap-bytes.c

diff --git a/README b/README
index edce7890c0f..dee0332b0a8 100644
--- a/README
+++ b/README
@@ -286,13 +286,6 @@ The following options need to be configured:
same as CFG_SYS_DDR_SDRAM_BASE for  all Power SoCs. But
it could be different for ARM SoCs.
 
-- MIPS CPU options:
-   CONFIG_XWAY_SWAP_BYTES
-
-   Enable compilation of tools/xway-swap-bytes needed for Lantiq
-   XWAY SoCs for booting from NOR flash. The U-Boot image needs to
-   be swapped if a flash programmer is used.
-
 - ARM options:
CFG_SYS_EXCEPTION_VECTORS_HIGH
 
diff --git a/tools/Makefile b/tools/Makefile
index 0eadd8154a7..041c437e65b 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -27,7 +27,6 @@ ifneq ($(HOST_TOOLS_ALL),)
 CONFIG_ARCH_KIRKWOOD = y
 CONFIG_CMD_LOADS = y
 CONFIG_CMD_NET = y
-CONFIG_XWAY_SWAP_BYTES = y
 CONFIG_NETCONSOLE = y
 CONFIG_ARCH_SUNXI = y
 endif
@@ -61,9 +60,6 @@ HOSTCFLAGS_gen_ethaddr_crc.o := -pedantic
 hostprogs-$(CONFIG_CMD_LOADS) += img2srec
 HOSTCFLAGS_img2srec.o := -pedantic
 
-hostprogs-$(CONFIG_XWAY_SWAP_BYTES) += xway-swap-bytes
-HOSTCFLAGS_xway-swap-bytes.o := -pedantic
-
 hostprogs-y += mkenvimage
 mkenvimage-objs := mkenvimage.o os_support.o lib/crc32.o
 
diff --git a/tools/xway-swap-bytes.c b/tools/xway-swap-bytes.c
deleted file mode 100644
index 3a6d82d54a0..000
--- a/tools/xway-swap-bytes.c
+++ /dev/null
@@ -1,38 +0,0 @@
-#include 
-#include 
-#include 
-#include 
-
-#ifndef BUFSIZ
-# define BUFSIZ 4096
-#endif
-
-#undef BUFSIZ
-# define BUFSIZ 64
-int main (void)
-{
-   short ibuff[BUFSIZ], obuff[BUFSIZ];
-   int rc, i, len;
-
-   while ((rc = read (0, ibuff, sizeof (ibuff))) > 0) {
-   memset (obuff, 0, sizeof (obuff));
-   for (i = 0; i < (rc + 1) / 2; i++) {
-   obuff[i] = ibuff[i ^ 1];
-   }
-
-   len = (rc + 1) & ~1;
-
-   if (write (1, obuff, len) != len) {
-   perror ("read error");
-   return (EXIT_FAILURE);
-   }
-
-   memset (ibuff, 0, sizeof (ibuff));
-   }
-
-   if (rc < 0) {
-   perror ("read error");
-   return (EXIT_FAILURE);
-   }
-   return (EXIT_SUCCESS);
-}
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 36/76] nand: Drop unused actl_nand driver

2023-02-01 Thread Simon Glass
This is not used since this commit:

   ed7fe2bee12 ppc: Remove xpedite boards

Drop the driver and Kconfig option.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 board/xes/common/Makefile|  1 -
 board/xes/common/actl_nand.c | 49 
 2 files changed, 50 deletions(-)
 delete mode 100644 board/xes/common/actl_nand.c

diff --git a/board/xes/common/Makefile b/board/xes/common/Makefile
index 002821916c4..b00accca1be 100644
--- a/board/xes/common/Makefile
+++ b/board/xes/common/Makefile
@@ -7,4 +7,3 @@ obj-$(CONFIG_MPC86xx)   += fsl_8xxx_clk.o
 obj-$(CONFIG_ARCH_P2020)   += fsl_8xxx_clk.o
 obj-$(CONFIG_MPC85xx)  += fsl_8xxx_misc.o board.o
 obj-$(CONFIG_MPC86xx)  += fsl_8xxx_misc.o board.o
-obj-$(CONFIG_NAND_ACTL)+= actl_nand.o
diff --git a/board/xes/common/actl_nand.c b/board/xes/common/actl_nand.c
deleted file mode 100644
index 2d8a57576a6..000
--- a/board/xes/common/actl_nand.c
+++ /dev/null
@@ -1,49 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright 2008 Extreme Engineering Solutions, Inc.
- *
- * This driver support NAND devices which have address lines
- * connected as ALE and CLE inputs.
- */
-
-#include 
-#include 
-#include 
-#include 
-
-/*
- * Hardware specific access to control-lines
- */
-static void nand_addr_hwcontrol(struct mtd_info *mtd, int cmd, uint ctrl)
-{
-   struct nand_chip *this = mtd_to_nand(mtd);
-   ulong IO_ADDR_W;
-
-   if (ctrl & NAND_CTRL_CHANGE) {
-   IO_ADDR_W = (ulong)this->IO_ADDR_W;
-
-   IO_ADDR_W &= ~(CONFIG_SYS_NAND_ACTL_CLE |
-   CONFIG_SYS_NAND_ACTL_ALE |
-   CONFIG_SYS_NAND_ACTL_NCE);
-   if (ctrl & NAND_CLE)
-   IO_ADDR_W |= CONFIG_SYS_NAND_ACTL_CLE;
-   if (ctrl & NAND_ALE)
-   IO_ADDR_W |= CONFIG_SYS_NAND_ACTL_ALE;
-   if (ctrl & NAND_NCE)
-   IO_ADDR_W |= CONFIG_SYS_NAND_ACTL_NCE;
-
-   this->IO_ADDR_W = (void *)IO_ADDR_W;
-   }
-
-   if (cmd != NAND_CMD_NONE)
-   writeb(cmd, this->IO_ADDR_W);
-}
-
-int board_nand_init(struct nand_chip *nand)
-{
-   nand->ecc.mode = NAND_ECC_SOFT;
-   nand->cmd_ctrl = nand_addr_hwcontrol;
-   nand->chip_delay = CONFIG_SYS_NAND_ACTL_DELAY;
-
-   return 0;
-}
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 48/76] power: Drop unused fg_max17042 driver and fuel gauge code

2023-02-01 Thread Simon Glass
This driver is not used. Drop it and the entire fuel_gauge directory,
since there is nothing left.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 drivers/power/Makefile |   1 -
 drivers/power/fuel_gauge/Makefile  |   6 -
 drivers/power/fuel_gauge/fg_max17042.c | 287 -
 include/power/fg_battery_cell_params.h |  73 ---
 4 files changed, 367 deletions(-)
 delete mode 100644 drivers/power/fuel_gauge/Makefile
 delete mode 100644 drivers/power/fuel_gauge/fg_max17042.c
 delete mode 100644 include/power/fg_battery_cell_params.h

diff --git a/drivers/power/Makefile b/drivers/power/Makefile
index efdae3655ac..93003e97e01 100644
--- a/drivers/power/Makefile
+++ b/drivers/power/Makefile
@@ -5,7 +5,6 @@
 
 obj-$(CONFIG_$(SPL_TPL_)ACPI_PMC) += acpi_pmc/
 obj-$(CONFIG_$(SPL_TPL_)POWER_DOMAIN) += domain/
-obj-y += fuel_gauge/
 obj-y += mfd/
 obj-y += pmic/
 obj-y += regulator/
diff --git a/drivers/power/fuel_gauge/Makefile 
b/drivers/power/fuel_gauge/Makefile
deleted file mode 100644
index ca2df947585..000
--- a/drivers/power/fuel_gauge/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0+
-#
-# Copyright (C) 2012 Samsung Electronics
-# Lukasz Majewski 
-
-obj-$(CONFIG_POWER_FG_MAX17042) += fg_max17042.o
diff --git a/drivers/power/fuel_gauge/fg_max17042.c 
b/drivers/power/fuel_gauge/fg_max17042.c
deleted file mode 100644
index a395d587a86..000
--- a/drivers/power/fuel_gauge/fg_max17042.c
+++ /dev/null
@@ -1,287 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- *  Copyright (C) 2012 Samsung Electronics
- *  Lukasz Majewski 
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-static int fg_write_regs(struct pmic *p, u8 addr, u16 *data, int num)
-{
-   int ret = 0;
-   int i;
-
-   for (i = 0; i < num; i++, addr++) {
-   ret = pmic_reg_write(p, addr, *(data + i));
-   if (ret)
-   return ret;
-   }
-
-   return 0;
-}
-
-static int fg_read_regs(struct pmic *p, u8 addr, u16 *data, int num)
-{
-   unsigned int dat;
-   int ret = 0;
-   int i;
-
-   for (i = 0; i < num; i++, addr++) {
-   ret = pmic_reg_read(p, addr, &dat);
-   if (ret)
-   return ret;
-
-   *(data + i) = (u16)dat;
-   }
-
-   return 0;
-}
-
-static int fg_write_and_verify(struct pmic *p, u8 addr, u16 data)
-{
-   unsigned int val = data;
-   int ret = 0;
-
-   ret |= pmic_reg_write(p, addr, val);
-   ret |= pmic_reg_read(p, addr, &val);
-
-   if (ret)
-   return ret;
-
-   if (((u16) val) == data)
-   return 0;
-
-   return -1;
-}
-
-static void por_fuelgauge_init(struct pmic *p)
-{
-   u16 r_data0[16], r_data1[16], r_data2[16];
-   u32 rewrite_count = 5;
-   u32 check_count;
-   u32 lock_count;
-   u32 i = 0;
-   u32 val;
-   s32 ret = 0;
-   char *status_msg;
-
-   /* Delay 500 ms */
-   mdelay(500);
-   /* Initilize Configuration */
-   pmic_reg_write(p, MAX17042_CONFIG, 0x2310);
-
-rewrite_model:
-   check_count = 5;
-   lock_count = 5;
-
-   if (!rewrite_count--) {
-   status_msg = "init failed!";
-   goto error;
-   }
-
-   /* Unlock Model Access */
-   pmic_reg_write(p, MAX17042_MLOCKReg1, MODEL_UNLOCK1);
-   pmic_reg_write(p, MAX17042_MLOCKReg2, MODEL_UNLOCK2);
-
-   /* Write/Read/Verify the Custom Model */
-   ret = fg_write_regs(p, MAX17042_MODEL1, cell_character0,
-ARRAY_SIZE(cell_character0));
-   if (ret)
-   goto rewrite_model;
-
-   ret = fg_write_regs(p, MAX17042_MODEL2, cell_character1,
-ARRAY_SIZE(cell_character1));
-   if (ret)
-   goto rewrite_model;
-
-   ret = fg_write_regs(p, MAX17042_MODEL3, cell_character2,
-ARRAY_SIZE(cell_character2));
-   if (ret)
-   goto rewrite_model;
-
-check_model:
-   if (!check_count--) {
-   if (rewrite_count)
-   goto rewrite_model;
-   else
-   status_msg = "check failed!";
-
-   goto error;
-   }
-
-   ret = fg_read_regs(p, MAX17042_MODEL1, r_data0, ARRAY_SIZE(r_data0));
-   if (ret)
-   goto check_model;
-
-   ret = fg_read_regs(p, MAX17042_MODEL2, r_data1, ARRAY_SIZE(r_data1));
-   if (ret)
-   goto check_model;
-
-   ret = fg_read_regs(p, MAX17042_MODEL3, r_data2, ARRAY_SIZE(r_data2));
-   if (ret)
-   goto check_model;
-
-   for (i = 0; i < 16; i++) {
-   if ((cell_character0[i] != r_data0[i])
-   || (cell_character1[i] != r_data1[i])
-   || (cell_character2[i] != r_data2[i]))
-   got

Re: [PATCH 7/8] test: blkmap: Add test suite

2023-02-01 Thread Simon Glass
Hi Tobias,

On Wed, 1 Feb 2023 at 11:10, Tobias Waldekranz  wrote:
>
> Verify that:
>
> - Block maps can be created and destroyed
> - Mappings aren't allowed to overlap
> - Multiple mappings can be attached and be read/written from/to
>
> Signed-off-by: Tobias Waldekranz 
> ---
>  MAINTAINERS  |   1 +
>  configs/sandbox_defconfig|   1 +
>  test/py/tests/test_blkmap.py | 164 +++
>  3 files changed, 166 insertions(+)
>  create mode 100644 test/py/tests/test_blkmap.py

https://u-boot.readthedocs.io/en/latest/develop/tests_writing.html

This should be done in C...see test/dm/acpi.c for an example of how to
check console output.

>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 83c0f90a53..c420c8e1f9 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -792,6 +792,7 @@ S:  Maintained
>  F: cmd/blkmap.c
>  F: drivers/block/blkmap.c
>  F: include/blkmap.h
> +F: test/py/tests/test_blkmap.py
>
>  BOOTDEVICE
>  M: Simon Glass 
> diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
> index 34c342b6f5..06021e4902 100644
> --- a/configs/sandbox_defconfig
> +++ b/configs/sandbox_defconfig
> @@ -145,6 +145,7 @@ CONFIG_ADC=y
>  CONFIG_ADC_SANDBOX=y
>  CONFIG_AXI=y
>  CONFIG_AXI_SANDBOX=y
> +CONFIG_BLKMAP=y
>  CONFIG_SYS_IDE_MAXBUS=1
>  CONFIG_SYS_ATA_BASE_ADDR=0x100
>  CONFIG_SYS_ATA_STRIDE=4
> diff --git a/test/py/tests/test_blkmap.py b/test/py/tests/test_blkmap.py
> new file mode 100644
> index 00..5a4c770c81
> --- /dev/null
> +++ b/test/py/tests/test_blkmap.py
> @@ -0,0 +1,164 @@
> +# SPDX-License-Identifier:  GPL-2.0+
> +#
> +# Copyright (c) 2023 Addiva Elektronik
> +# Author: Tobias Waldekranz 
> +
> +""" Unit test for blkmap command
> +"""
> +
> +import pytest
> +
> +BLKSZ = 0x200
> +
> +MAPPING = [
> +((0, 1), 3),
> +((1, 3), 0),
> +((4, 2), 6),
> +((6, 2), 4),
> +]
> +
> +ORDERED   = 0x
> +UNORDERED = 0x1000
> +BUFFER= 0x2000
> +
> +def mkblob(base, mapping):
> +cmds = []
> +
> +for ((blksrc, blkcnt), blkdst) in mapping:
> +for blknr in range(blkcnt):
> +cmds.append(f"mw.b 0x{base + (blkdst + blknr) * BLKSZ:x}" +
> +f" 0x{blksrc + blknr:x} 0x{BLKSZ:x}")
> +return cmds
> +
> +class Blkmap(object):
> +def __init__(self, console, num):
> +self.console, self.num = console, num
> +
> +def __enter__(self):
> +r = self.console.run_command(f"blkmap create {self.num}")
> +assert(f"Created device {self.num}" in r)
> +
> +r = self.console.run_command(f"blkmap dev {self.num}")
> +assert("is now current device" in r)
> +
> +return self
> +
> +def __exit__(self, typ, value, traceback):
> +r = self.console.run_command(f"blkmap destroy {self.num}")
> +assert(f"Destroyed device {self.num}" in r)
> +
> +def map_mem(self, blknr, blkcnt, addr):
> +r = self.console.run_command(
> +f"blkmap map {self.num} {blknr:#x} {blkcnt:#x} mem {addr:#x}"
> +)
> +assert(" mapped to " in r)
> +
> +def read(self, addr, blknr, blkcnt):
> +r = self.console.run_command(
> +f"blkmap read {addr:#x} {blknr:#x} {blkcnt:#x}"
> +)
> +assert(" OK" in r)
> +
> +def write(self, addr, blknr, blkcnt):
> +r = self.console.run_command(
> +f"blkmap write {addr:#x} {blknr:#x} {blkcnt:#x}"
> +)
> +assert(" OK" in r)
> +
> +@pytest.mark.boardspec('sandbox')
> +@pytest.mark.buildconfigspec('cmd_blkmap')
> +def test_blkmap_creation(u_boot_console):
> +""" Verify that blkmaps can be created and destroyed
> +
> +Args:
> +u_boot_console -- U-Boot console
> +"""
> +with Blkmap(u_boot_console, 0):
> +# Can't have 2 blkmap 0's
> +with pytest.raises(AssertionError):
> +with Blkmap(u_boot_console, 0):
> +pass
> +
> +# But blkmap 1 should be fine
> +with Blkmap(u_boot_console, 1):
> +pass
> +
> +# Once blkmap 0 is destroyed, we should be able to create it again
> +with Blkmap(u_boot_console, 0):
> +pass
> +
> +@pytest.mark.boardspec('sandbox')
> +@pytest.mark.buildconfigspec('cmd_blkmap')
> +def test_blkmap_slicing(u_boot_console):
> +""" Verify that slices aren't allowed to overlap
> +
> +Args:
> +u_boot_console -- U-Boot console
> +"""
> +with Blkmap(u_boot_console, 0) as bm:
> +bm.map_mem(8, 8, 0)
> +
> +# Can't overlap on the low end
> +with pytest.raises(AssertionError):
> +bm.map_mem(4, 5, 0)
> +
> +# Can't be inside
> +with pytest.raises(AssertionError):
> +bm.map_mem(10, 2, 0)
> +
> +# Can't overlap on the high end
> +with pytest.raises(AssertionError):
> +bm.map_mem(15, 4, 0)
> +
> +# But we should be able to add slices right before and after
> +bm.map_mem( 4, 4, 0

[PATCH v3 37/76] mtd: Drop unused fsl_upm driver

2023-02-01 Thread Simon Glass
This is not used since this commit:

   8d1e3cb1400 powerpc: mpc83xx: remove MPC8360ERDK, EMPC8360EMDS support

Drop the driver and Kconfig option.

Signed-off-by: Simon Glass 
Reviewed-By: Michael Trimarchi 
---

(no changes since v1)

 drivers/mtd/nand/raw/Makefile  |   1 -
 drivers/mtd/nand/raw/fsl_upm.c | 187 -
 include/linux/mtd/fsl_upm.h|  44 
 3 files changed, 232 deletions(-)
 delete mode 100644 drivers/mtd/nand/raw/fsl_upm.c
 delete mode 100644 include/linux/mtd/fsl_upm.h

diff --git a/drivers/mtd/nand/raw/Makefile b/drivers/mtd/nand/raw/Makefile
index 4c59903aa8c..e8764cf358b 100644
--- a/drivers/mtd/nand/raw/Makefile
+++ b/drivers/mtd/nand/raw/Makefile
@@ -56,7 +56,6 @@ obj-$(CONFIG_NAND_DENALI) += denali.o
 obj-$(CONFIG_NAND_DENALI_DT) += denali_dt.o
 obj-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_nand.o
 obj-$(CONFIG_NAND_FSL_IFC) += fsl_ifc_nand.o
-obj-$(CONFIG_NAND_FSL_UPM) += fsl_upm.o
 obj-$(CONFIG_NAND_FSMC) += fsmc_nand.o
 obj-$(CONFIG_NAND_KB9202) += kb9202_nand.o
 obj-$(CONFIG_NAND_KIRKWOOD) += kirkwood_nand.o
diff --git a/drivers/mtd/nand/raw/fsl_upm.c b/drivers/mtd/nand/raw/fsl_upm.c
deleted file mode 100644
index 91cc1339537..000
--- a/drivers/mtd/nand/raw/fsl_upm.c
+++ /dev/null
@@ -1,187 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * FSL UPM NAND driver
- *
- * Copyright (C) 2007 MontaVista Software, Inc.
- *Anton Vorontsov 
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-static void fsl_upm_start_pattern(struct fsl_upm *upm, u32 pat_offset)
-{
-   clrsetbits_be32(upm->mxmr, MxMR_MAD_MSK, MxMR_OP_RUNP | pat_offset);
-   (void)in_be32(upm->mxmr);
-}
-
-static void fsl_upm_end_pattern(struct fsl_upm *upm)
-{
-   clrbits_be32(upm->mxmr, MxMR_OP_RUNP);
-
-   while (in_be32(upm->mxmr) & MxMR_OP_RUNP)
-   eieio();
-}
-
-static void fsl_upm_run_pattern(struct fsl_upm *upm, int width,
-   void __iomem *io_addr, u32 mar)
-{
-   out_be32(upm->mar, mar);
-   (void)in_be32(upm->mar);
-   switch (width) {
-   case 8:
-   out_8(io_addr, 0x0);
-   break;
-   case 16:
-   out_be16(io_addr, 0x0);
-   break;
-   case 32:
-   out_be32(io_addr, 0x0);
-   break;
-   }
-}
-
-static void fun_wait(struct fsl_upm_nand *fun)
-{
-   if (fun->dev_ready) {
-   while (!fun->dev_ready(fun->chip_nr))
-   debug("unexpected busy state\n");
-   } else {
-   /*
-* If the R/B pin is not connected,
-* a short delay is necessary.
-*/
-   udelay(1);
-   }
-}
-
-#if CONFIG_SYS_NAND_MAX_CHIPS > 1
-static void fun_select_chip(struct mtd_info *mtd, int chip_nr)
-{
-   struct nand_chip *chip = mtd_to_nand(mtd);
-   struct fsl_upm_nand *fun = nand_get_controller_data(chip);
-
-   if (chip_nr >= 0) {
-   fun->chip_nr = chip_nr;
-   chip->IO_ADDR_R = chip->IO_ADDR_W =
-   fun->upm.io_addr + fun->chip_offset * chip_nr;
-   } else if (chip_nr == -1) {
-   chip->cmd_ctrl(mtd, NAND_CMD_NONE, 0 | NAND_CTRL_CHANGE);
-   }
-}
-#endif
-
-static void fun_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
-{
-   struct nand_chip *chip = mtd_to_nand(mtd);
-   struct fsl_upm_nand *fun = nand_get_controller_data(chip);
-   void __iomem *io_addr;
-   u32 mar;
-
-   if (!(ctrl & fun->last_ctrl)) {
-   fsl_upm_end_pattern(&fun->upm);
-
-   if (cmd == NAND_CMD_NONE)
-   return;
-
-   fun->last_ctrl = ctrl & (NAND_ALE | NAND_CLE);
-   }
-
-   if (ctrl & NAND_CTRL_CHANGE) {
-   if (ctrl & NAND_ALE)
-   fsl_upm_start_pattern(&fun->upm, fun->upm_addr_offset);
-   else if (ctrl & NAND_CLE)
-   fsl_upm_start_pattern(&fun->upm, fun->upm_cmd_offset);
-   }
-
-   mar = cmd << (32 - fun->width);
-   io_addr = fun->upm.io_addr;
-#if CONFIG_SYS_NAND_MAX_CHIPS > 1
-   if (fun->chip_nr > 0) {
-   io_addr += fun->chip_offset * fun->chip_nr;
-   if (fun->upm_mar_chip_offset)
-   mar |= fun->upm_mar_chip_offset * fun->chip_nr;
-   }
-#endif
-   fsl_upm_run_pattern(&fun->upm, fun->width, io_addr, mar);
-
-   /*
-* Some boards/chips needs this.  At least the MPC8360E-RDK
-* needs it.  Probably weird chip, because I don't see any
-* need for this on MPC8555E + Samsung K9F1G08U0A.  Usually
-* here are 0-2 unexpected busy states per block read.
-*/
-   if (fun->wait_flags & FSL_UPM_WAIT_RUN_PATTERN)
-   fun_wait(fun);
-}
-
-static u8 upm_nand_read_byte(struct mtd_info *mtd)
-{
-   struct nand_chip *ch

[PATCH v3 14/76] cmd: Drop mfsl command

2023-02-01 Thread Simon Glass
This is not used anywhere. Drop it.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 cmd/Makefile |   1 -
 cmd/mfsl.c   | 387 ---
 2 files changed, 388 deletions(-)
 delete mode 100644 cmd/mfsl.c

diff --git a/cmd/Makefile b/cmd/Makefile
index 0b6a96c1d91..4adc7530a0a 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -108,7 +108,6 @@ obj-$(CONFIG_ID_EEPROM) += mac.o
 obj-$(CONFIG_CMD_MD5SUM) += md5sum.o
 obj-$(CONFIG_CMD_MEMORY) += mem.o
 obj-$(CONFIG_CMD_IO) += io.o
-obj-$(CONFIG_CMD_MFSL) += mfsl.o
 obj-$(CONFIG_CMD_MII) += mii.o
 obj-$(CONFIG_CMD_MISC) += misc.o
 obj-$(CONFIG_CMD_MDIO) += mdio.o
diff --git a/cmd/mfsl.c b/cmd/mfsl.c
deleted file mode 100644
index 0c78720ec46..000
--- a/cmd/mfsl.c
+++ /dev/null
@@ -1,387 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2007 Michal Simek
- *
- * Michal  SIMEK 
- */
-
-/*
- * Microblaze FSL support
- */
-
-#include 
-#include 
-#include 
-#include 
-
-int do_frd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
-{
-   unsigned int fslnum;
-   unsigned int num;
-   unsigned int blocking;
-
-   if (argc < 2)
-   return CMD_RET_USAGE;
-
-   fslnum = (unsigned int)hextoul(argv[1], NULL);
-   blocking = (unsigned int)hextoul(argv[2], NULL);
-   if (fslnum < 0 || fslnum >= XILINX_FSL_NUMBER) {
-   puts ("Bad number of FSL\n");
-   return CMD_RET_USAGE;
-   }
-
-   switch (fslnum) {
-#if (XILINX_FSL_NUMBER > 0)
-   case 0:
-   switch (blocking) {
-   case 0: NGET (num, 0);
-   break;
-   case 1: NCGET (num, 0);
-   break;
-   case 2: GET (num, 0);
-   break;
-   case 3: CGET (num, 0);
-   break;
-   default:
-   return 2;
-   }
-   break;
-#endif
-#if (XILINX_FSL_NUMBER > 1)
-   case 1:
-   switch (blocking) {
-   case 0: NGET (num, 1);
-   break;
-   case 1: NCGET (num, 1);
-   break;
-   case 2: GET (num, 1);
-   break;
-   case 3: CGET (num, 1);
-   break;
-   default:
-   return 2;
-   }
-   break;
-#endif
-#if (XILINX_FSL_NUMBER > 2)
-   case 2:
-   switch (blocking) {
-   case 0: NGET (num, 2);
-   break;
-   case 1: NCGET (num, 2);
-   break;
-   case 2: GET (num, 2);
-   break;
-   case 3: CGET (num, 2);
-   break;
-   default:
-   return 2;
-   }
-   break;
-#endif
-#if (XILINX_FSL_NUMBER > 3)
-   case 3:
-   switch (blocking) {
-   case 0: NGET (num, 3);
-   break;
-   case 1: NCGET (num, 3);
-   break;
-   case 2: GET (num, 3);
-   break;
-   case 3: CGET (num, 3);
-   break;
-   default:
-   return 2;
-   }
-   break;
-#endif
-#if (XILINX_FSL_NUMBER > 4)
-   case 4:
-   switch (blocking) {
-   case 0: NGET (num, 4);
-   break;
-   case 1: NCGET (num, 4);
-   break;
-   case 2: GET (num, 4);
-   break;
-   case 3: CGET (num, 4);
-   break;
-   default:
-   return 2;
-   }
-   break;
-#endif
-#if (XILINX_FSL_NUMBER > 5)
-   case 5:
-   switch (blocking) {
-   case 0: NGET (num, 5);
-   break;
-   case 1: NCGET (num, 5);
-   break;
-   case 2: GET (num, 5);
-   break;
-   case 3: CGET (num, 5);
-   break;
-   default:
-   return 2;
-   }
-   break;
-#endif
-#if (XILINX_FSL_NUMBER > 6)
-   case 6:
-   switch (blocking) {
-   case 0: NGET (num, 6);
-   break;
-   case 1: NCGET (num, 6);
-   break;
-   case 2: GET (num, 6);
-   break;
-   case 3: CGET (num, 6);
-   break;
-   default:
-   return 2;
-   }
-   break;
-#endif
-#if (XILINX_FSL_NUMBER > 7)
-   case 7:
-   switch (blocking) {
-   case 0: NGET (num, 7);
-   break;
-   case 1: NCGET (num, 7);
-  

[PATCH v3 50/76] power: Drop unused muic_max8997 driver

2023-02-01 Thread Simon Glass
This is not used. Drop the driver and Kconfig option.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 drivers/power/pmic/Makefile   |  1 -
 drivers/power/pmic/muic_max8997.c | 74 ---
 2 files changed, 75 deletions(-)
 delete mode 100644 drivers/power/pmic/muic_max8997.c

diff --git a/drivers/power/pmic/Makefile b/drivers/power/pmic/Makefile
index c3180c58208..0b3b3d62d0e 100644
--- a/drivers/power/pmic/Makefile
+++ b/drivers/power/pmic/Makefile
@@ -37,7 +37,6 @@ obj-$(CONFIG_POWER_TPS65218) += pmic_tps65218.o
 
 ifeq ($(CONFIG_$(SPL_)POWER_LEGACY),y)
 obj-$(CONFIG_POWER_LTC3676) += pmic_ltc3676.o
-obj-$(CONFIG_POWER_MUIC_MAX8997) += muic_max8997.o
 obj-$(CONFIG_POWER_PCA9450) += pmic_pca9450.o
 obj-$(CONFIG_POWER_PFUZE100) += pmic_pfuze100.o
 obj-$(CONFIG_POWER_PFUZE3000) += pmic_pfuze3000.o
diff --git a/drivers/power/pmic/muic_max8997.c 
b/drivers/power/pmic/muic_max8997.c
deleted file mode 100644
index 969ce902395..000
--- a/drivers/power/pmic/muic_max8997.c
+++ /dev/null
@@ -1,74 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- *  Copyright (C) 2012 Samsung Electronics
- *  Lukasz Majewski 
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-static int power_chrg_get_type(struct pmic *p)
-{
-   unsigned int val;
-   unsigned char charge_type, charger;
-
-   if (pmic_probe(p))
-   return CHARGER_NO;
-
-   pmic_reg_read(p, MAX8997_MUIC_STATUS2, &val);
-   charge_type = val & MAX8997_MUIC_CHG_MASK;
-
-   switch (charge_type) {
-   case MAX8997_MUIC_CHG_NO:
-   charger = CHARGER_NO;
-   break;
-   case MAX8997_MUIC_CHG_USB:
-   case MAX8997_MUIC_CHG_USB_D:
-   charger = CHARGER_USB;
-   break;
-   case MAX8997_MUIC_CHG_TA:
-   case MAX8997_MUIC_CHG_TA_1A:
-   charger = CHARGER_TA;
-   break;
-   case MAX8997_MUIC_CHG_TA_500:
-   charger = CHARGER_TA_500;
-   break;
-   default:
-   charger = CHARGER_UNKNOWN;
-   break;
-   }
-
-   return charger;
-}
-
-static struct power_chrg power_chrg_muic_ops = {
-   .chrg_type = power_chrg_get_type,
-};
-
-int power_muic_init(unsigned int bus)
-{
-   static const char name[] = "MAX8997_MUIC";
-   struct pmic *p = pmic_alloc();
-
-   if (!p) {
-   printf("%s: POWER allocation error!\n", __func__);
-   return -ENOMEM;
-   }
-
-   debug("Board Micro USB Interface Controller init\n");
-
-   p->name = name;
-   p->interface = PMIC_I2C;
-   p->number_of_regs = MUIC_NUM_OF_REGS;
-   p->hw.i2c.addr = MAX8997_MUIC_I2C_ADDR;
-   p->hw.i2c.tx_num = 1;
-   p->bus = bus;
-
-   p->chrg = &power_chrg_muic_ops;
-   return 0;
-}
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 42/76] omap: Drop unused CONFIG_OMAP_USB_PHY

2023-02-01 Thread Simon Glass
This option does not exist, so the Makefile rule does nothing. Drop it.

Signed-off-by: Simon Glass 
Reviewed-by: Tom Rini 
---

(no changes since v1)

 drivers/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/Makefile b/drivers/Makefile
index 83b14ef1fd3..15d19d0c8a3 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -59,7 +59,6 @@ obj-$(CONFIG_SPL_USB_GADGET) += usb/common/
 obj-$(CONFIG_SPL_USB_GADGET) += usb/gadget/udc/
 obj-$(CONFIG_SPL_WATCHDOG) += watchdog/
 obj-$(CONFIG_SPL_USB_HOST) += usb/host/
-obj-$(CONFIG_OMAP_USB_PHY) += usb/phy/
 obj-$(CONFIG_SPL_SATA) += ata/ scsi/
 obj-$(CONFIG_SPL_LEGACY_BLOCK) += block/
 obj-$(CONFIG_SPL_THERMAL) += thermal/
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 72/76] imx: Drop CONFIG_USE_PLUGIN

2023-02-01 Thread Simon Glass
This option is not defined anywhere. Drop it.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 board/freescale/mx7ulp_evk/Makefile | 4 
 1 file changed, 4 deletions(-)

diff --git a/board/freescale/mx7ulp_evk/Makefile 
b/board/freescale/mx7ulp_evk/Makefile
index 686763d6744..9f33c61f03b 100644
--- a/board/freescale/mx7ulp_evk/Makefile
+++ b/board/freescale/mx7ulp_evk/Makefile
@@ -2,7 +2,3 @@
 # (C) Copyright 2016 Freescale Semiconductor, Inc.
 
 obj-y  := mx7ulp_evk.o
-
-extra-$(CONFIG_USE_PLUGIN) :=  plugin.bin
-$(obj)/plugin.bin: $(obj)/plugin.o
-   $(OBJCOPY) -O binary --gap-fill 0xff $< $@
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 51/76] freescale: Drop unused pq-mds-pib driver

2023-02-01 Thread Simon Glass
This is not used. Drop the driver and Kconfig option.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 board/freescale/common/Makefile |  1 -
 board/freescale/common/pq-mds-pib.c | 60 -
 board/freescale/common/pq-mds-pib.h |  9 -
 3 files changed, 70 deletions(-)
 delete mode 100644 board/freescale/common/pq-mds-pib.c
 delete mode 100644 board/freescale/common/pq-mds-pib.h

diff --git a/board/freescale/common/Makefile b/board/freescale/common/Makefile
index 9d5f38bb225..bd035d60a58 100644
--- a/board/freescale/common/Makefile
+++ b/board/freescale/common/Makefile
@@ -36,7 +36,6 @@ obj-$(I2C_COMMON) += i2c_common.o
 obj-$(CONFIG_FSL_USE_PCA9547_MUX)  += i2c_mux.o
 obj-$(CONFIG_$(SPL_)VID)   += vid.o
 obj-$(CONFIG_FSL_QIXIS)+= qixis.o
-obj-$(CONFIG_PQ_MDS_PIB)   += pq-mds-pib.o
 ifndef CONFIG_SPL_BUILD
 obj-$(CONFIG_ID_EEPROM)+= sys_eeprom.o
 endif
diff --git a/board/freescale/common/pq-mds-pib.c 
b/board/freescale/common/pq-mds-pib.c
deleted file mode 100644
index 162c8a954f0..000
--- a/board/freescale/common/pq-mds-pib.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2007 Freescale Semiconductor, Inc.
- *
- * Tony Li 
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- */
-
-#include 
-#include 
-#include 
-
-#include "pq-mds-pib.h"
-
-int pib_init(void)
-{
-   u8 val8;
-   u8 orig_i2c_bus;
-
-   /* Switch temporarily to I2C bus #2 */
-   orig_i2c_bus = i2c_get_bus_num();
-   i2c_set_bus_num(1);
-
-   val8 = 0;
-#if defined(CONFIG_PCI) && !defined(CONFIG_PCISLAVE)
-   /* Assign PIB PMC slot to desired PCI bus */
-   i2c_write(0x23, 0x6, 1, &val8, 1);
-   i2c_write(0x23, 0x7, 1, &val8, 1);
-   val8 = 0xff;
-   i2c_write(0x23, 0x2, 1, &val8, 1);
-   i2c_write(0x23, 0x3, 1, &val8, 1);
-
-   val8 = 0;
-   i2c_write(0x26, 0x6, 1, &val8, 1);
-   val8 = 0x34;
-   i2c_write(0x26, 0x7, 1, &val8, 1);
-   val8 = 0xf3;/* PMC1, PMC2, PMC3 slot to PCI bus */
-   i2c_write(0x26, 0x2, 1, &val8, 1);
-   val8 = 0xff;
-   i2c_write(0x26, 0x3, 1, &val8, 1);
-
-   val8 = 0;
-   i2c_write(0x27, 0x6, 1, &val8, 1);
-   i2c_write(0x27, 0x7, 1, &val8, 1);
-   val8 = 0xff;
-   i2c_write(0x27, 0x2, 1, &val8, 1);
-   val8 = 0xef;
-   i2c_write(0x27, 0x3, 1, &val8, 1);
-
-   eieio();
-
-   printf("PCI 32bit bus on PMC1 & PMC2 &PMC3\n");
-#endif
-
-   /* Reset to original I2C bus */
-   i2c_set_bus_num(orig_i2c_bus);
-   return 0;
-}
diff --git a/board/freescale/common/pq-mds-pib.h 
b/board/freescale/common/pq-mds-pib.h
deleted file mode 100644
index 67066fd118d..000
--- a/board/freescale/common/pq-mds-pib.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/*
- * Copyright (C) 2007 Freescale Semiconductor, Inc.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- */
-
-extern int pib_init(void);
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 35/76] imx: Rename CONFIG_MXS to CFG_MXS

2023-02-01 Thread Simon Glass
This is not a Kconfig option so we should not be setting it in the
Makefile. Rename it to use a CFS_ prefix, since this is still used in
mxsimage.c

In general tools should support all the features without reference to
CONFIG options, but this is left to the maintainer to look at.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 tools/Makefile   | 4 ++--
 tools/mxsimage.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/Makefile b/tools/Makefile
index edfa40903d9..2ee43dff542 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -158,9 +158,9 @@ fit_check_sign-objs   := $(dumpimage-mkimage-objs) 
fit_check_sign.o
 file2include-objs := file2include.o
 
 ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_TOOLS_LIBCRYPTO),)
-# Add CONFIG_MXS into host CFLAGS, so we can check whether or not register
+# Add CFG_MXS into host CFLAGS, so we can check whether or not register
 # the mxsimage support within tools/mxsimage.c .
-HOSTCFLAGS_mxsimage.o += -DCONFIG_MXS
+HOSTCFLAGS_mxsimage.o += -DCFG_MXS
 endif
 
 ifdef CONFIG_TOOLS_LIBCRYPTO
diff --git a/tools/mxsimage.c b/tools/mxsimage.c
index fee022aab46..fbe46c47fae 100644
--- a/tools/mxsimage.c
+++ b/tools/mxsimage.c
@@ -5,7 +5,7 @@
  * Copyright (C) 2012-2013 Marek Vasut 
  */
 
-#ifdef CONFIG_MXS
+#ifdef CFG_MXS
 
 #include 
 #include 
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 27/76] imx: Drop unused CONFIG_IMX

2023-02-01 Thread Simon Glass
This option does not exist, so the Makefile rule does nothing. Drop it.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 arch/arm/cpu/arm920t/Makefile | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/arm/cpu/arm920t/Makefile b/arch/arm/cpu/arm920t/Makefile
index b70822c67ab..5ac3740621c 100644
--- a/arch/arm/cpu/arm920t/Makefile
+++ b/arch/arm/cpu/arm920t/Makefile
@@ -7,8 +7,6 @@ extra-y = start.o
 
 obj-y  += cpu.o
 
-obj-$(CONFIG_IMX) += imx/
-
 # some files can only build in ARM mode
 
 ifdef CONFIG_$(SPL_)SYS_THUMB_BUILD
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 52/76] rmobile: Drop CONFIG_RMOBILE

2023-02-01 Thread Simon Glass
This has been renamed to CONFIG_ARCH_RMOBILE but this one was left behind.
It doesn't point to a directory that exists, so just drop it.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 arch/arm/cpu/armv7/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/cpu/armv7/Makefile b/arch/arm/cpu/armv7/Makefile
index 7d7907601ec..653eef8ad79 100644
--- a/arch/arm/cpu/armv7/Makefile
+++ b/arch/arm/cpu/armv7/Makefile
@@ -37,7 +37,6 @@ obj-$(if $(filter bcm281xx,$(SOC)),y) += bcm281xx/
 obj-$(if $(filter bcmcygnus,$(SOC)),y) += bcmcygnus/
 obj-$(if $(filter bcmnsp,$(SOC)),y) += bcmnsp/
 obj-$(if $(filter ls102xa,$(SOC)),y) += ls102xa/
-obj-$(CONFIG_RMOBILE) += rmobile/
 obj-$(if $(filter stv0991,$(SOC)),y) += stv0991/
 obj-$(CONFIG_ARCH_SUNXI) += sunxi/
 obj-$(CONFIG_VF610) += vf610/
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 49/76] power: Drop unused muic_max77693 driver and mfd code

2023-02-01 Thread Simon Glass
This driver is not used and has lain unconverted since:

   fc47cf9d054 arm: exynos: i2c: Convert exynos boards to use DM_I2C

Drop it and the entire mfd directory, since there is nothing left.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 drivers/power/Makefile|  1 -
 drivers/power/mfd/Makefile|  6 ---
 drivers/power/mfd/muic_max77693.c | 77 ---
 3 files changed, 84 deletions(-)
 delete mode 100644 drivers/power/mfd/Makefile
 delete mode 100644 drivers/power/mfd/muic_max77693.c

diff --git a/drivers/power/Makefile b/drivers/power/Makefile
index 93003e97e01..ba64b2c5938 100644
--- a/drivers/power/Makefile
+++ b/drivers/power/Makefile
@@ -5,7 +5,6 @@
 
 obj-$(CONFIG_$(SPL_TPL_)ACPI_PMC) += acpi_pmc/
 obj-$(CONFIG_$(SPL_TPL_)POWER_DOMAIN) += domain/
-obj-y += mfd/
 obj-y += pmic/
 obj-y += regulator/
 
diff --git a/drivers/power/mfd/Makefile b/drivers/power/mfd/Makefile
deleted file mode 100644
index b5ec8f00bb0..000
--- a/drivers/power/mfd/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0+
-#
-# Copyright (C) 2013 Samsung Electronics
-# Piotr Wilczek 
-
-obj-$(CONFIG_POWER_MUIC_MAX77693) += muic_max77693.o
diff --git a/drivers/power/mfd/muic_max77693.c 
b/drivers/power/mfd/muic_max77693.c
deleted file mode 100644
index 36ee44b9a2c..000
--- a/drivers/power/mfd/muic_max77693.c
+++ /dev/null
@@ -1,77 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (C) 2013 Samsung Electronics
- * Piotr Wilczek 
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-static int power_chrg_get_type(struct pmic *p)
-{
-   unsigned int val;
-   unsigned int charge_type, charger;
-
-   /* if probe failed, return cable none */
-   if (pmic_probe(p))
-   return CHARGER_NO;
-
-   pmic_reg_read(p, MAX77693_MUIC_STATUS2, &val);
-
-   charge_type = val & MAX77693_MUIC_CHG_MASK;
-
-   switch (charge_type) {
-   case MAX77693_MUIC_CHG_NO:
-   charger = CHARGER_NO;
-   break;
-   case MAX77693_MUIC_CHG_USB:
-   case MAX77693_MUIC_CHG_USB_D:
-   charger = CHARGER_USB;
-   break;
-   case MAX77693_MUIC_CHG_TA:
-   case MAX77693_MUIC_CHG_TA_1A:
-   charger = CHARGER_TA;
-   break;
-   case MAX77693_MUIC_CHG_TA_500:
-   charger = CHARGER_TA_500;
-   break;
-   default:
-   charger = CHARGER_UNKNOWN;
-   break;
-   }
-
-   return charger;
-}
-
-static struct power_chrg power_chrg_muic_ops = {
-   .chrg_type = power_chrg_get_type,
-};
-
-int power_muic_init(unsigned int bus)
-{
-   static const char name[] = "MAX77693_MUIC";
-   struct pmic *p = pmic_alloc();
-
-   if (!p) {
-   printf("%s: POWER allocation error!\n", __func__);
-   return -ENOMEM;
-   }
-
-   debug("Board Micro USB Interface Controller init\n");
-
-   p->name = name;
-   p->interface = PMIC_I2C;
-   p->number_of_regs = MUIC_NUM_OF_REGS;
-   p->hw.i2c.addr = MAX77693_MUIC_I2C_ADDR;
-   p->hw.i2c.tx_num = 1;
-   p->bus = bus;
-
-   p->chrg = &power_chrg_muic_ops;
-
-   return 0;
-}
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 20/76] samsung: Drop CONFIG_EXYNOS_PWM_BL

2023-02-01 Thread Simon Glass
This is not defined anywhere. Drop it.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 drivers/video/exynos/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/video/exynos/Makefile b/drivers/video/exynos/Makefile
index 0f58954e49c..45067f562cb 100644
--- a/drivers/video/exynos/Makefile
+++ b/drivers/video/exynos/Makefile
@@ -7,4 +7,3 @@ obj-$(CONFIG_EXYNOS_DP) += exynos_dp.o exynos_dp_lowlevel.o
 obj-$(CONFIG_EXYNOS_FB) += exynos_fb.o
 obj-$(CONFIG_EXYNOS_MIPI_DSIM) += exynos_mipi_dsi.o exynos_mipi_dsi_common.o \
exynos_mipi_dsi_lowlevel.o
-obj-$(CONFIG_EXYNOS_PWM_BL) += exynos_pwm_bl.o
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 08/76] sandbox: Drop reference to CONFIG_ARCH_DEVICE_TREE

2023-02-01 Thread Simon Glass
This is not used anywhere. Drop it.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 arch/sandbox/config.mk | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/sandbox/config.mk b/arch/sandbox/config.mk
index 1284ef390b5..2d184c5f652 100644
--- a/arch/sandbox/config.mk
+++ b/arch/sandbox/config.mk
@@ -44,8 +44,6 @@ cmd_u-boot-spl = (cd $(obj) && $(CC) -o $(SPL_BIN) -Wl,-T 
u-boot-spl.lds \
-Wl,--no-whole-archive \
$(PLATFORM_LIBS) -Wl,-Map -Wl,u-boot-spl.map -Wl,--gc-sections)
 
-CONFIG_ARCH_DEVICE_TREE := sandbox
-
 ifeq ($(HOST_ARCH),$(HOST_ARCH_X86_64))
 EFI_LDS := ${SRCDIR}/../../../arch/x86/lib/elf_x86_64_efi.lds
 EFI_TARGET := --target=efi-app-x86_64
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 11/76] ppc: Drop bat_rw

2023-02-01 Thread Simon Glass
Drop this unused driver.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 arch/powerpc/lib/Makefile |   1 -
 arch/powerpc/lib/bat_rw.c | 244 --
 2 files changed, 245 deletions(-)
 delete mode 100644 arch/powerpc/lib/bat_rw.c

diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index 066d7f408e0..bb819dcbb6c 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -34,7 +34,6 @@ obj-y += ticks.o
 endif
 obj-y  += reloc.o
 
-obj-$(CONFIG_BAT_RW) += bat_rw.o
 obj-$(CONFIG_CMD_BOOTM) += bootm.o
 obj-y  += cache.o
 obj-y  += extable.o
diff --git a/arch/powerpc/lib/bat_rw.c b/arch/powerpc/lib/bat_rw.c
deleted file mode 100644
index 24dd30615bd..000
--- a/arch/powerpc/lib/bat_rw.c
+++ /dev/null
@@ -1,244 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2002
- * Rich Ireland, Enterasys Networks, rirel...@enterasys.com.
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#ifdef CONFIG_ADDR_MAP
-#include 
-#endif
-
-DECLARE_GLOBAL_DATA_PTR;
-
-int write_bat (ppc_bat_t bat, unsigned long upper, unsigned long lower)
-{
-   __maybe_unused int batn = -1;
-
-   sync();
-
-   switch (bat) {
-   case DBAT0:
-   mtspr (DBAT0L, lower);
-   mtspr (DBAT0U, upper);
-   batn = 0;
-   break;
-   case IBAT0:
-   mtspr (IBAT0L, lower);
-   mtspr (IBAT0U, upper);
-   break;
-   case DBAT1:
-   mtspr (DBAT1L, lower);
-   mtspr (DBAT1U, upper);
-   batn = 1;
-   break;
-   case IBAT1:
-   mtspr (IBAT1L, lower);
-   mtspr (IBAT1U, upper);
-   break;
-   case DBAT2:
-   mtspr (DBAT2L, lower);
-   mtspr (DBAT2U, upper);
-   batn = 2;
-   break;
-   case IBAT2:
-   mtspr (IBAT2L, lower);
-   mtspr (IBAT2U, upper);
-   break;
-   case DBAT3:
-   mtspr (DBAT3L, lower);
-   mtspr (DBAT3U, upper);
-   batn = 3;
-   break;
-   case IBAT3:
-   mtspr (IBAT3L, lower);
-   mtspr (IBAT3U, upper);
-   break;
-#ifdef CONFIG_HIGH_BATS
-   case DBAT4:
-   mtspr (DBAT4L, lower);
-   mtspr (DBAT4U, upper);
-   batn = 4;
-   break;
-   case IBAT4:
-   mtspr (IBAT4L, lower);
-   mtspr (IBAT4U, upper);
-   break;
-   case DBAT5:
-   mtspr (DBAT5L, lower);
-   mtspr (DBAT5U, upper);
-   batn = 5;
-   break;
-   case IBAT5:
-   mtspr (IBAT5L, lower);
-   mtspr (IBAT5U, upper);
-   break;
-   case DBAT6:
-   mtspr (DBAT6L, lower);
-   mtspr (DBAT6U, upper);
-   batn = 6;
-   break;
-   case IBAT6:
-   mtspr (IBAT6L, lower);
-   mtspr (IBAT6U, upper);
-   break;
-   case DBAT7:
-   mtspr (DBAT7L, lower);
-   mtspr (DBAT7U, upper);
-   batn = 7;
-   break;
-   case IBAT7:
-   mtspr (IBAT7L, lower);
-   mtspr (IBAT7U, upper);
-   break;
-#endif
-   default:
-   return (-1);
-   }
-
-#ifdef CONFIG_ADDR_MAP
-   if ((gd->flags & GD_FLG_RELOC) && (batn >= 0)) {
-   phys_size_t size;
-   if (!BATU_VALID(upper))
-   size = 0;
-   else
-   size = BATU_SIZE(upper);
-   addrmap_set_entry(BATU_VADDR(upper), BATL_PADDR(lower),
- size, batn);
-   }
-#endif
-
-   sync();
-   isync();
-
-   return (0);
-}
-
-int read_bat (ppc_bat_t bat, unsigned long *upper, unsigned long *lower)
-{
-   unsigned long register u;
-   unsigned long register l;
-
-   switch (bat) {
-   case DBAT0:
-   l = mfspr (DBAT0L);
-   u = mfspr (DBAT0U);
-   break;
-   case IBAT0:
-   l = mfspr (IBAT0L);
-   u = mfspr (IBAT0U);
-   break;
-   case DBAT1:
-   l = mfspr (DBAT1L);
-   u = mfspr (DBAT1U);
-   break;
-   case IBAT1:
-   l = mfspr (IBAT1L);
-   u = mfspr (IBAT1U);
-   break;
-   case DBAT2:
-   l = mfspr (DBAT2L);
-   u = mfspr (DBAT2U);
-   break;
-   case IBAT2:
-   l = mfspr (IBAT2L);
-   u = mfspr (IBAT2U);
-   break;
-   case DBAT3:
-   l = mfspr (DBAT3L);
-   u = mfspr (DBAT3U);
-   break;
-   case IBAT3:
-   l = mfspr (IBAT3L);
-   u = mfspr (IBAT3U);
-  

[PATCH v3 26/76] rcar: Drop timer

2023-02-01 Thread Simon Glass
Drop this unused driver.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 arch/arm/mach-rmobile/Makefile |  1 -
 arch/arm/mach-rmobile/timer.c  | 87 --
 2 files changed, 88 deletions(-)
 delete mode 100644 arch/arm/mach-rmobile/timer.c

diff --git a/arch/arm/mach-rmobile/Makefile b/arch/arm/mach-rmobile/Makefile
index 195bbeb5c88..3f77760e50d 100644
--- a/arch/arm/mach-rmobile/Makefile
+++ b/arch/arm/mach-rmobile/Makefile
@@ -7,7 +7,6 @@ obj-y = cpu_info.o
 obj-y += emac.o
 
 obj-$(CONFIG_DISPLAY_BOARDINFO) += board.o
-obj-$(CONFIG_GLOBAL_TIMER) += timer.o
 obj-$(CONFIG_TMU_TIMER) += ../../sh/lib/time.o
 obj-$(CONFIG_SH73A0) += lowlevel_init.o cpu_info-sh73a0.o pfc-sh73a0.o
 obj-$(CONFIG_R8A7740) += lowlevel_init.o cpu_info-r8a7740.o pfc-r8a7740.o
diff --git a/arch/arm/mach-rmobile/timer.c b/arch/arm/mach-rmobile/timer.c
deleted file mode 100644
index 293c23b5e25..000
--- a/arch/arm/mach-rmobile/timer.c
+++ /dev/null
@@ -1,87 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2012 Nobuhiro Iwamatsu 
- * (C) Copyright 2012 Renesas Solutions Corp.
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-static struct globaltimer *global_timer = \
-   (struct globaltimer *)GLOBAL_TIMER_BASE_ADDR;
-
-#define CLK2MHZ(clk)   (clk / 1000 / 1000)
-static u64 get_cpu_global_timer(void)
-{
-   u32 low, high;
-   u64 timer;
-
-   u32 old = readl(&global_timer->cnt_h);
-   while (1) {
-   low = readl(&global_timer->cnt_l);
-   high = readl(&global_timer->cnt_h);
-   if (old == high)
-   break;
-   else
-   old = high;
-   }
-
-   timer = high;
-   return (u64)((timer << 32) | low);
-}
-
-static u64 get_time_us(void)
-{
-   u64 timer = get_cpu_global_timer();
-
-   timer = ((timer << 2) + (CLK2MHZ(CFG_SYS_CPU_CLK) >> 1));
-   do_div(timer, CLK2MHZ(CFG_SYS_CPU_CLK));
-   return timer;
-}
-
-static ulong get_time_ms(void)
-{
-   u64 us = get_time_us();
-
-   do_div(us, 1000);
-   return us;
-}
-
-int timer_init(void)
-{
-   writel(0x01, &global_timer->ctl);
-   return 0;
-}
-
-void __udelay(unsigned long usec)
-{
-   u64 start, current;
-   u64 wait;
-
-   start = get_cpu_global_timer();
-   wait = (u64)((usec * CLK2MHZ(CFG_SYS_CPU_CLK)) >> 2);
-   do {
-   current = get_cpu_global_timer();
-   } while ((current - start) < wait);
-}
-
-ulong get_timer(ulong base)
-{
-   return get_time_ms() - base;
-}
-
-unsigned long long get_ticks(void)
-{
-   return get_cpu_global_timer();
-}
-
-ulong get_tbclk(void)
-{
-   return (ulong)(CFG_SYS_CPU_CLK >> 2);
-}
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 70/76] usb: Drop unused ehci-vct driver

2023-02-01 Thread Simon Glass
This is not used. Drop the driver and Kconfig option.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 drivers/usb/host/Makefile   |  1 -
 drivers/usb/host/ehci-vct.c | 44 -
 2 files changed, 45 deletions(-)
 delete mode 100644 drivers/usb/host/ehci-vct.c

diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index 3d3dd5f279f..3e5ba2bd0ba 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -39,7 +39,6 @@ obj-$(CONFIG_USB_EHCI_MARVELL) += ehci-marvell.o
 obj-$(CONFIG_USB_EHCI_MSM) += ehci-msm.o
 obj-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o
 obj-$(CONFIG_USB_EHCI_TEGRA) += ehci-tegra.o
-obj-$(CONFIG_USB_EHCI_VCT) += ehci-vct.o
 obj-$(CONFIG_USB_EHCI_VF) += ehci-vf.o
 obj-$(CONFIG_USB_EHCI_ZYNQ) += ehci-zynq.o
 
diff --git a/drivers/usb/host/ehci-vct.c b/drivers/usb/host/ehci-vct.c
deleted file mode 100644
index 7167f82b481..000
--- a/drivers/usb/host/ehci-vct.c
+++ /dev/null
@@ -1,44 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2009 Stefan Roese , DENX Software Engineering
- */
-
-#include 
-#include 
-
-#include "ehci.h"
-
-int vct_ehci_hcd_init(u32 *hccr, u32 *hcor);
-
-/*
- * Create the appropriate control structures to manage
- * a new EHCI host controller.
- */
-int ehci_hcd_init(int index, enum usb_init_type init,
-   struct ehci_hccr **hccr, struct ehci_hcor **hcor)
-{
-   int ret;
-   u32 vct_hccr;
-   u32 vct_hcor;
-
-   /*
-* Init VCT specific stuff
-*/
-   ret = vct_ehci_hcd_init(&vct_hccr, &vct_hcor);
-   if (ret)
-   return ret;
-
-   *hccr = (struct ehci_hccr *)vct_hccr;
-   *hcor = (struct ehci_hcor *)vct_hcor;
-
-   return 0;
-}
-
-/*
- * Destroy the appropriate control structures corresponding
- * the the EHCI host controller.
- */
-int ehci_hcd_stop(int index)
-{
-   return 0;
-}
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 63/76] freescale: Drop CONFIG_TARGET_MPC8536DS et al

2023-02-01 Thread Simon Glass
This option as well as CONFIG_TARGET_P1022DS and CONFIG_TARGET_P5020DS
are not defined anywhere. Drop them.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 board/freescale/common/Makefile | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/board/freescale/common/Makefile b/board/freescale/common/Makefile
index bd035d60a58..5f0503faf8d 100644
--- a/board/freescale/common/Makefile
+++ b/board/freescale/common/Makefile
@@ -51,8 +51,6 @@ endif
 
 obj-$(CONFIG_TARGET_MPC8548CDS)+= cds_pci_ft.o
 
-obj-$(CONFIG_TARGET_MPC8536DS) += ics307_clk.o
-obj-$(CONFIG_TARGET_P1022DS)   += ics307_clk.o
 obj-$(CONFIG_TARGET_P3041DS)   += ics307_clk.o
 obj-$(CONFIG_TARGET_P4080DS)   += ics307_clk.o
 obj-$(CONFIG_TARGET_P5040DS)   += ics307_clk.o
@@ -75,7 +73,6 @@ obj-$(CONFIG_EMC2305)  += emc2305.o
 obj-$(CONFIG_TARGET_P2041RDB)  += p_corenet/
 obj-$(CONFIG_TARGET_P3041DS)   += p_corenet/
 obj-$(CONFIG_TARGET_P4080DS)   += p_corenet/
-obj-$(CONFIG_TARGET_P5020DS)   += p_corenet/
 obj-$(CONFIG_TARGET_P5040DS)   += p_corenet/
 
 obj-$(CONFIG_LAYERSCAPE_NS_ACCESS) += ns_access.o
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 45/76] gpio: Drop unused pca9698 driver

2023-02-01 Thread Simon Glass
This is not used. Drop the driver and Kconfig option.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 arch/mips/mach-octeon/octeon_fdt.c |  43 +-
 board/gdsys/a38x/hre.c |   1 -
 drivers/gpio/Makefile  |   1 -
 drivers/gpio/pca9698.c | 127 -
 include/pca9698.h  |  17 
 5 files changed, 1 insertion(+), 188 deletions(-)
 delete mode 100644 drivers/gpio/pca9698.c
 delete mode 100644 include/pca9698.h

diff --git a/arch/mips/mach-octeon/octeon_fdt.c 
b/arch/mips/mach-octeon/octeon_fdt.c
index 0ccfe149dcc..c74fe9d9fb8 100644
--- a/arch/mips/mach-octeon/octeon_fdt.c
+++ b/arch/mips/mach-octeon/octeon_fdt.c
@@ -30,9 +30,6 @@
 #ifdef CONFIG_PCF857X
 #include 
 #endif
-#ifdef CONFIG_PCA9698
-#include 
-#endif
 #ifdef CONFIG_PCA9554
 #include 
 #endif
@@ -59,13 +56,6 @@ static const char * const pca9555_gpio_list[] = {
 };
 #endif
 
-#ifdef CONFIG_PCA9698
-/** List of compatible strings supported by pca9698 driver */
-static const char * const pca9698_gpio_list[] = {
-   "nxp,pca9505", "pca9505", "nxp,pca9698", "pca9698", NULL,
-};
-#endif
-
 #ifdef CONFIG_PCA953X
 /** List of compatible strings supported by pca953x driver */
 static const char * const pca953x_gpio_list[] = {
@@ -807,19 +797,6 @@ int octeon_fdt_read_gpio(const void *fdt, int phandle, int 
pin)
}
value = (value >> pin) & 1;
break;
-#endif
-#ifdef CONFIG_PCA9698
-   case CVMX_GPIO_PIN_PCA9698:
-   node = fdt_node_offset_by_phandle(fdt, phandle);
-   if (octeon_fdt_get_i2c_bus_addr(fdt, node, &bus, &addr)) {
-   printf("%s: Could not get gpio bus and/or address\n", 
__func__);
-   return -1;
-   }
-   old_bus = i2c_get_bus_num();
-   i2c_set_bus_num(bus);
-   value = pca9698_get_value(addr, pin);
-   i2c_set_bus_num(old_bus);
-   break;
 #endif
case CVMX_GPIO_PIN_OCTEON:
value = gpio_get_value(pin);
@@ -880,18 +857,6 @@ int octeon_fdt_set_gpio(const void *fdt, int phandle, int 
pin, int val)
return -1;
}
return pcf957x_set_val(bus, addr, 1 << pin, val << pin);
-#endif
-#ifdef CONFIG_PCA9698
-   case CVMX_GPIO_PIN_PCA9698:
-   if (octeon_fdt_get_i2c_bus_addr(fdt, node, &bus, &addr)) {
-   printf("%s: Could not get gpio bus and/or address\n", 
__func__);
-   return -1;
-   }
-   old_bus = i2c_get_bus_num();
-   i2c_set_bus_num(bus);
-   rc = pca9698_set_value(addr, pin, val);
-   i2c_set_bus_num(old_bus);
-   return rc;
 #endif
case CVMX_GPIO_PIN_OCTEON:
return gpio_set_value(pin, val);
@@ -951,13 +916,7 @@ int octeon_fdt_get_gpio_info(int fdt_node, enum 
octeon_gpio_type *type,
*type = GPIO_TYPE_PCA953X;
}
 #endif
-#ifdef CONFIG_PCA9698
-   if (!octeon_fdt_node_check_compatible(fdt, fdt_node, 
pca9698_gpio_list)) {
-   debug("%s: Found PCA9698 compatible GPIO", __func__);
-   *type = GPIO_TYPE_PCA9698;
-   }
-#endif
-#if defined(CONFIG_PCA953X) || defined(CONFIG_PCA9698) || \
+#if defined(CONFIG_PCA953X) || \
defined(CONFIG_PCA9555) || defined(CONFIG_PCA9554)
if (!i2c_addr || !i2c_bus) {
printf("%s: Error: i2c_addr or i2c_bus is NULL\n", __func__);
diff --git a/board/gdsys/a38x/hre.c b/board/gdsys/a38x/hre.c
index 2f16a4d3e11..d16233ed78e 100644
--- a/board/gdsys/a38x/hre.c
+++ b/board/gdsys/a38x/hre.c
@@ -15,7 +15,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include "hre.h"
 
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 889a88dc885..fcd136367ac 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -28,7 +28,6 @@ obj-$(CONFIG_MXC_GPIO)+= mxc_gpio.o
 obj-$(CONFIG_MXS_GPIO) += mxs_gpio.o
 obj-$(CONFIG_NPCM_GPIO)+= npcm_gpio.o
 obj-$(CONFIG_PCA953X)  += pca953x.o
-obj-$(CONFIG_PCA9698)  += pca9698.o
 obj-$(CONFIG_ROCKCHIP_GPIO)+= rk_gpio.o
 obj-$(CONFIG_RCAR_GPIO)+= gpio-rcar.o
 obj-$(CONFIG_RZA1_GPIO)+= gpio-rza1.o
diff --git a/drivers/gpio/pca9698.c b/drivers/gpio/pca9698.c
deleted file mode 100644
index 11274c78101..000
--- a/drivers/gpio/pca9698.c
+++ /dev/null
@@ -1,127 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2011
- * Dirk Eibach,  Guntermann & Drunck GmbH, dirk.eib...@gdsys.cc
- */
-
-/*
- * Driver for NXP's pca9698 40 bit I2C gpio expander
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-
-/*
- * The pca9698 registers
- */
-
-#define PCA9698_REG_INPUT  0x00
-#define PCA9698_REG_OUTPUT 0x08
-#define PCA9698_REG_POLARITY   0x10
-#define PCA9698_REG_CONFIG

[PATCH v3 65/76] ppc: Makefile: Drop unused ppc4xx code

2023-02-01 Thread Simon Glass
CONFIG_UBOOT_PAD_TO is not defined anywhere. Drop this dead code.

Signed-off-by: Simon Glass 
Reviewed-by: Stefan Roese 
---

(no changes since v1)

 Makefile | 11 ---
 1 file changed, 11 deletions(-)

diff --git a/Makefile b/Makefile
index 2c9e27ac5c2..815ee0333d8 100644
--- a/Makefile
+++ b/Makefile
@@ -1648,17 +1648,6 @@ OBJCOPYFLAGS_u-boot-with-spl-pbl.bin = -I binary -O 
binary --pad-to=$(CONFIG_SPL
 u-boot-with-spl-pbl.bin: spl/u-boot-spl.pbl $(UBOOT_BINLOAD) FORCE
$(call if_changed,pad_cat)
 
-# PPC4xx needs the SPL at the end of the image, since the reset vector
-# is located at 0xfffc. So we can't use the "u-boot-img.bin" target
-# and need to introduce a new build target with the full blown U-Boot
-# at the start padded up to the start of the SPL image. And then concat
-# the SPL image to the end.
-
-OBJCOPYFLAGS_u-boot-img-spl-at-end.bin := -I binary -O binary \
-   --pad-to=$(CONFIG_UBOOT_PAD_TO) --gap-fill=0xff
-u-boot-img-spl-at-end.bin: u-boot.img spl/u-boot-spl.bin FORCE
-   $(call if_changed,pad_cat)
-
 quiet_cmd_u-boot-elf ?= LD  $@
cmd_u-boot-elf ?= $(LD) u-boot-elf.o -o $@ \
$(if $(CONFIG_SYS_BIG_ENDIAN),-EB,-EL) \
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 41/76] Makefile: Drop CONFIG_OF_EARLY_FLATTREE

2023-02-01 Thread Simon Glass
This option does not exist, so drop the dead code.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 Makefile | 4 
 1 file changed, 4 deletions(-)

diff --git a/Makefile b/Makefile
index 2648fd5d8f9..5ef572e5177 100644
--- a/Makefile
+++ b/Makefile
@@ -2004,10 +2004,6 @@ dtbs: prepare3 scripts_dtc
 dtbs_install:
$(Q)$(MAKE) $(dtbinst)=$(dtstree)
 
-ifdef CONFIG_OF_EARLY_FLATTREE
-all: dtbs
-endif
-
 endif
 
 # Check dtc and pylibfdt, if DTC is provided, else build them
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 62/76] compulab: Drop CONFIG_TARGET_MCM_IMX8M_MINI

2023-02-01 Thread Simon Glass
This option is not defined anywhere. Drop it.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 board/compulab/imx8mm-cl-iot-gate/ddr/Makefile | 4 
 1 file changed, 4 deletions(-)

diff --git a/board/compulab/imx8mm-cl-iot-gate/ddr/Makefile 
b/board/compulab/imx8mm-cl-iot-gate/ddr/Makefile
index 5914796628d..f73f35cd664 100644
--- a/board/compulab/imx8mm-cl-iot-gate/ddr/Makefile
+++ b/board/compulab/imx8mm-cl-iot-gate/ddr/Makefile
@@ -1,8 +1,4 @@
 obj-y += ddr.o
 obj-y += lpddr4_timing_ff020008.o
 obj-y += lpddr4_timing_ff000110.o
-ifdef CONFIG_TARGET_MCM_IMX8M_MINI
-obj-y += lpddr4_timing_01061010.o
-else
 obj-y += lpddr4_timing_01061010.1_2.o
-endif
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 40/76] mtd: Drop unused nand_plat driver

2023-02-01 Thread Simon Glass
This is not used since this commit:

   936478e797a SPARC: Remove

Drop the driver and Kconfig option.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 drivers/mtd/nand/raw/Makefile|  1 -
 drivers/mtd/nand/raw/nand_plat.c | 65 
 2 files changed, 66 deletions(-)
 delete mode 100644 drivers/mtd/nand/raw/nand_plat.c

diff --git a/drivers/mtd/nand/raw/Makefile b/drivers/mtd/nand/raw/Makefile
index c25acb11804..add2b4cf655 100644
--- a/drivers/mtd/nand/raw/Makefile
+++ b/drivers/mtd/nand/raw/Makefile
@@ -70,7 +70,6 @@ obj-$(CONFIG_NAND_PXA3XX) += pxa3xx_nand.o
 obj-$(CONFIG_TEGRA_NAND) += tegra_nand.o
 obj-$(CONFIG_NAND_OMAP_GPMC) += omap_gpmc.o
 obj-$(CONFIG_NAND_OMAP_ELM) += omap_elm.o
-obj-$(CONFIG_NAND_PLAT) += nand_plat.o
 obj-$(CONFIG_NAND_SUNXI) += sunxi_nand.o
 obj-$(CONFIG_NAND_MXIC) += mxic_nand.o
 obj-$(CONFIG_NAND_ZYNQ) += zynq_nand.o
diff --git a/drivers/mtd/nand/raw/nand_plat.c b/drivers/mtd/nand/raw/nand_plat.c
deleted file mode 100644
index 81e7aa218d5..000
--- a/drivers/mtd/nand/raw/nand_plat.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Genericish driver for memory mapped NAND devices
- *
- * Copyright (c) 2006-2009 Analog Devices Inc.
- * Licensed under the GPL-2 or later.
- */
-
-/* Your board must implement the following macros:
- *  NAND_PLAT_WRITE_CMD(chip, cmd)
- *  NAND_PLAT_WRITE_ADR(chip, cmd)
- *  NAND_PLAT_INIT()
- *
- * It may also implement the following:
- *  NAND_PLAT_DEV_READY(chip)
- */
-
-#include 
-#include 
-#include 
-#ifdef NAND_PLAT_GPIO_DEV_READY
-# include 
-# define NAND_PLAT_DEV_READY(chip) gpio_get_value(NAND_PLAT_GPIO_DEV_READY)
-#endif
-
-#include 
-
-static void plat_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
-{
-   struct nand_chip *this = mtd_to_nand(mtd);
-
-   if (cmd == NAND_CMD_NONE)
-   return;
-
-   if (ctrl & NAND_CLE)
-   NAND_PLAT_WRITE_CMD(this, cmd);
-   else
-   NAND_PLAT_WRITE_ADR(this, cmd);
-}
-
-#ifdef NAND_PLAT_DEV_READY
-static int plat_dev_ready(struct mtd_info *mtd)
-{
-   return NAND_PLAT_DEV_READY((struct nand_chip *)mtd_to_nand(mtd));
-}
-#else
-# define plat_dev_ready NULL
-#endif
-
-int board_nand_init(struct nand_chip *nand)
-{
-#ifdef NAND_PLAT_GPIO_DEV_READY
-   gpio_request(NAND_PLAT_GPIO_DEV_READY, "nand-plat");
-   gpio_direction_input(NAND_PLAT_GPIO_DEV_READY);
-#endif
-
-#ifdef NAND_PLAT_INIT
-   NAND_PLAT_INIT();
-#endif
-
-   nand->cmd_ctrl = plat_cmd_ctrl;
-   nand->dev_ready = plat_dev_ready;
-   nand->ecc.mode = NAND_ECC_SOFT;
-
-   return 0;
-}
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 38/76] mtd: Drop unused fsmc_nand driver

2023-02-01 Thread Simon Glass
This is not used since this commit:

   570c3dcfc15 arm: Remove spear600 boards and the rest of SPEAr support

Drop the driver and Kconfig option.

Signed-off-by: Simon Glass 
Reviewed-by: Michael Trimarchi 
---

(no changes since v1)

 drivers/mtd/nand/raw/Makefile|   1 -
 drivers/mtd/nand/raw/fsmc_nand.c | 470 ---
 include/linux/mtd/fsmc_nand.h|  84 --
 3 files changed, 555 deletions(-)
 delete mode 100644 drivers/mtd/nand/raw/fsmc_nand.c
 delete mode 100644 include/linux/mtd/fsmc_nand.h

diff --git a/drivers/mtd/nand/raw/Makefile b/drivers/mtd/nand/raw/Makefile
index e8764cf358b..f004eb39f3b 100644
--- a/drivers/mtd/nand/raw/Makefile
+++ b/drivers/mtd/nand/raw/Makefile
@@ -56,7 +56,6 @@ obj-$(CONFIG_NAND_DENALI) += denali.o
 obj-$(CONFIG_NAND_DENALI_DT) += denali_dt.o
 obj-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_nand.o
 obj-$(CONFIG_NAND_FSL_IFC) += fsl_ifc_nand.o
-obj-$(CONFIG_NAND_FSMC) += fsmc_nand.o
 obj-$(CONFIG_NAND_KB9202) += kb9202_nand.o
 obj-$(CONFIG_NAND_KIRKWOOD) += kirkwood_nand.o
 obj-$(CONFIG_NAND_KMETER1) += kmeter1_nand.o
diff --git a/drivers/mtd/nand/raw/fsmc_nand.c b/drivers/mtd/nand/raw/fsmc_nand.c
deleted file mode 100644
index d795864949c..000
--- a/drivers/mtd/nand/raw/fsmc_nand.c
+++ /dev/null
@@ -1,470 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2010
- * Vipin Kumar, STMicroelectronics, vipin.ku...@st.com.
- *
- * (C) Copyright 2012
- * Amit Virdi, STMicroelectronics, amit.vi...@st.com.
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-static u32 fsmc_version;
-static struct fsmc_regs *const fsmc_regs_p = (struct fsmc_regs *)
-   CONFIG_SYS_FSMC_BASE;
-
-/*
- * ECC4 and ECC1 have 13 bytes and 3 bytes of ecc respectively for 512 bytes of
- * data. ECC4 can correct up to 8 bits in 512 bytes of data while ECC1 can
- * correct 1 bit in 512 bytes
- */
-
-static struct nand_ecclayout fsmc_ecc4_lp_layout = {
-   .eccbytes = 104,
-   .eccpos = {  2,   3,   4,   5,   6,   7,   8,
-   9,  10,  11,  12,  13,  14,
-   18,  19,  20,  21,  22,  23,  24,
-   25,  26,  27,  28,  29,  30,
-   34,  35,  36,  37,  38,  39,  40,
-   41,  42,  43,  44,  45,  46,
-   50,  51,  52,  53,  54,  55,  56,
-   57,  58,  59,  60,  61,  62,
-   66,  67,  68,  69,  70,  71,  72,
-   73,  74,  75,  76,  77,  78,
-   82,  83,  84,  85,  86,  87,  88,
-   89,  90,  91,  92,  93,  94,
-   98,  99, 100, 101, 102, 103, 104,
-   105, 106, 107, 108, 109, 110,
-   114, 115, 116, 117, 118, 119, 120,
-   121, 122, 123, 124, 125, 126
-   },
-   .oobfree = {
-   {.offset = 15, .length = 3},
-   {.offset = 31, .length = 3},
-   {.offset = 47, .length = 3},
-   {.offset = 63, .length = 3},
-   {.offset = 79, .length = 3},
-   {.offset = 95, .length = 3},
-   {.offset = 111, .length = 3},
-   {.offset = 127, .length = 1}
-   }
-};
-
-/*
- * ECC4 layout for NAND of pagesize 4096 bytes & OOBsize 224 bytes. 13*8 bytes
- * of OOB size is reserved for ECC, Byte no. 0 & 1 reserved for bad block & 118
- * bytes are free for use.
- */
-static struct nand_ecclayout fsmc_ecc4_224_layout = {
-   .eccbytes = 104,
-   .eccpos = {  2,   3,   4,   5,   6,   7,   8,
-   9,  10,  11,  12,  13,  14,
-   18,  19,  20,  21,  22,  23,  24,
-   25,  26,  27,  28,  29,  30,
-   34,  35,  36,  37,  38,  39,  40,
-   41,  42,  43,  44,  45,  46,
-   50,  51,  52,  53,  54,  55,  56,
-   57,  58,  59,  60,  61,  62,
-   66,  67,  68,  69,  70,  71,  72,
-   73,  74,  75,  76,  77,  78,
-   82,  83,  84,  85,  86,  87,  88,
-   89,  90,  91,  92,  93,  94,
-   98,  99, 100, 101, 102, 103, 104,
-   105, 106, 107, 108, 109, 110,
-   114, 115, 116, 117, 118, 119, 120,
-   121, 122, 123, 124, 125, 126
-   },
-   .oobfree = {
-   {.offset = 15, .length = 3},
-   {.offset = 31, .length = 3},
-   {.offset = 47, .length = 3},
-   {.offset = 63, .length = 3},
-   {.offset = 79, .length = 3},
-   {.offset = 95, .length = 3},
-   {.offset = 111, .length = 3},
-   {.offset = 127, .length = 97}
-   }
-};
-
-/*
- * ECC placement definitions in oobfree type format
- * There are 13 bytes of ecc for every 512 byte block and it has to be read
- * consecutively and immediately after the 512 byte data block for hardware to
- * generate the error bit offsets in 512 byte data
- * Managing the ecc bytes in the following way makes it easier for software to
- * read 

[PATCH v3 69/76] rmobile: Drop unused ehci-rmobile driver

2023-02-01 Thread Simon Glass
This is not used. Drop the driver and Kconfig option.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 .../mach-rmobile/include/mach/ehci-rmobile.h  | 146 --
 drivers/usb/host/Makefile |   1 -
 drivers/usb/host/ehci-rmobile.c   | 129 
 3 files changed, 276 deletions(-)
 delete mode 100644 arch/arm/mach-rmobile/include/mach/ehci-rmobile.h
 delete mode 100644 drivers/usb/host/ehci-rmobile.c

diff --git a/arch/arm/mach-rmobile/include/mach/ehci-rmobile.h 
b/arch/arm/mach-rmobile/include/mach/ehci-rmobile.h
deleted file mode 100644
index ca8c5f37063..000
--- a/arch/arm/mach-rmobile/include/mach/ehci-rmobile.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- *  Copyright (C) 2013,2014 Renesas Electronics Corporation
- *  Copyright (C) 2014 Nobuhiro Iwamatsu 
- */
-
-#ifndef __EHCI_RMOBILE_H__
-#define __EHCI_RMOBILE_H__
-
-/* Register offset */
-#define OHCI_OFFSET0x00
-#define OHCI_SIZE  0x1000
-#define EHCI_OFFSET0x1000
-#define EHCI_SIZE  0x1000
-
-#define EHCI_USBCMD(EHCI_OFFSET + 0x0020)
-
-/* USBCTR */
-#define DIRPD  (1 << 8)
-#define PLL_RST(1 << 2)
-#define PCICLK_MASK(1 << 1)
-#define USBH_RST   (1 << 0)
-
-/* CMND_STS */
-#define SERREN (1 << 8)
-#define PERREN (1 << 6)
-#define MASTEREN   (1 << 2)
-#define MEMEN  (1 << 1)
-
-/* PCIAHB_WIN1_CTR and PCIAHB_WIN2_CTR */
-#define PCIAHB_WIN_PREFETCH((1 << 1)|(1 << 0))
-
-/* AHBPCI_WIN1_CTR */
-#define PCIWIN1_PCICMD ((1 << 3)|(1 << 1))
-#define AHB_CFG_AHBPCI 0x4000
-#define AHB_CFG_HOST   0x8000
-
-/* AHBPCI_WIN2_CTR */
-#define PCIWIN2_PCICMD ((1 << 2)|(1 << 1))
-
-/* PCI_INT_ENABLE */
-#define USBH_PMEEN (1 << 19)
-#define USBH_INTBEN(1 << 17)
-#define USBH_INTAEN(1 << 16)
-
-/* AHB_BUS_CTR */
-#define SMODE_READY_CTR(1 << 17)
-#define SMODE_READ_BURST   (1 << 16)
-#define MMODE_HBUSREQ  (1 << 7)
-#define MMODE_BOUNDARY ((1 << 6)|(1 << 5))
-#define MMODE_BURST_WIDTH  ((1 << 4)|(1 << 3))
-#define MMODE_SINGLE_MODE  ((1 << 4)|(1 << 3))
-#define MMODE_WR_INCR  (1 << 2)
-#define MMODE_BYTE_BURST   (1 << 1)
-#define MMODE_HTRANS   (1 << 0)
-
-/* PCI_ARBITER_CTR */
-#define PCIBUS_PARK_TIMER   0x00FF
-#define PCIBUS_PARK_TIMER_SET   0x0007
-#define PCIBP_MODE (1 << 12)
-#define PCIREQ7 (1 << 7)
-#define PCIREQ6 (1 << 6)
-#define PCIREQ5 (1 << 5)
-#define PCIREQ4 (1 << 4)
-#define PCIREQ3 (1 << 3)
-#define PCIREQ2 (1 << 2)
-#define PCIREQ1 (1 << 1)
-#define PCIREQ0 (1 << 0)
-
-#define SMSTPCR70xE615014C
-#define SMSTPCR703  (1 << 3)
-
-/* Init AHB master and slave functions of the host logic */
-#define AHB_BUS_CTR_INIT \
-   (SMODE_READY_CTR | MMODE_HBUSREQ | MMODE_WR_INCR | \
-MMODE_BYTE_BURST | MMODE_HTRANS)
-
-#define USBCTR_WIN_SIZE_1GB0x800
-
-/* PCI Configuration Registers */
-#define PCI_CONF_OHCI_OFFSET   0x1
-#define PCI_CONF_EHCI_OFFSET   0x10100
-struct ahb_pciconf {
-   u32 vid_did;
-   u32 cmnd_sts;
-   u32 rev;
-   u32 cache_line;
-   u32 basead;
-};
-
-/* PCI Configuration Registers for AHB-PCI Bridge Registers */
-#define PCI_CONF_AHBPCI_OFFSET 0x1
-struct ahbconf_pci_bridge {
-   u32 vid_did;/* 0x00 */
-   u32 cmnd_sts;
-   u32 revid_cc;
-   u32 cls_lt_ht_bist;
-   u32 basead; /* 0x10 */
-   u32 win1_basead;
-   u32 win2_basead;
-   u32 dummy0[5];
-   u32 ssvdi_ssid; /* 0x2C */
-   u32 dummy1[4];
-   u32 intr_line_pin;
-};
-
-/* AHB-PCI Bridge PCI Communication Registers */
-#define AHBPCI_OFFSET  0x10800
-struct ahbcom_pci_bridge {
-   u32 pciahb_win1_ctr;/* 0x00 */
-   u32 pciahb_win2_ctr;
-   u32 pciahb_dct_ctr;
-   u32 dummy0;
-   u32 ahbpci_win1_ctr;/* 0x10 */
-   u32 ahbpci_win2_ctr;
-   u32 dummy1;
-   u32 ahbpci_dct_ctr;
-   u32 pci_int_enable; /* 0x20 */
-   u32 pci_int_status;
-   u32 dummy2[2];
-   u32 ahb_bus_ctr;/* 0x30 */
-   u32 usbctr;
-   u32 dummy3[2];
-   u32 pci_arbiter_ctr;/* 0x40 */
-   u32 dummy4;
-   u32 pci_unit_rev;   /* 0x48 */
-};
-
-struct rmobile_ehci_reg {
-   u32 hciversion; /* hciversion/caplength */
-   u32 hcsparams;  /* hcsparams */
-   u32 hccparams;  /* hccparams */
-   u32 hcsp_portroute; /* hcsp_portroute */
-   u32 usbcmd; /* usbcmd */
-   u32 usbsts; /* usbsts */
-   u32 usbintr;/* usbintr */
-   u32 frindex;/* frindex */
-   u32 ctrldssegment;  /* ctrldssegment */
-   u32 periodic

[PATCH v3 13/76] cmd: Add an option to enable the ini command

2023-02-01 Thread Simon Glass
This command has no Kconfig option at present, but seems useful enough to
keep around. Add one.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 cmd/Kconfig | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 4fe2c75de25..b697469a4cb 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -2015,6 +2015,13 @@ config CMD_LED
  with led on/off/togle/blink. Any LED drivers can be controlled with
  this command, e.g. led_gpio.
 
+config CMD_INI
+   bool "ini"
+   help
+ Enable the 'ini' command which allows a .ini file to be parsed and
+ placed into environment variables. Please check the source code for
+ this as there is no documentation.
+
 config CMD_DATE
bool "date"
default y if DM_RTC
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 15/76] Correct CONFIG_CONTROLCENTERDC

2023-02-01 Thread Simon Glass
This option does not exist but presumably means to point to
CONFIG_TARGET_CONTROLCENTERDC. Fix it.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 board/gdsys/common/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/gdsys/common/Makefile b/board/gdsys/common/Makefile
index dd6d5e69de5..553e2ca50ed 100644
--- a/board/gdsys/common/Makefile
+++ b/board/gdsys/common/Makefile
@@ -5,7 +5,7 @@
 
 obj-$(CONFIG_SYS_FPGA_COMMON) += fpga.o
 obj-$(CONFIG_CMD_IOLOOP) += cmd_ioloop.o
-obj-$(CONFIG_CONTROLCENTERD) += dp501.o
+obj-$(CONFIG_TARGET_CONTROLCENTERDC) += dp501.o
 obj-$(CONFIG_TARGET_GAZERBEAM) += osd.o ihs_mdio.o ioep-fpga.o
 
 ifdef CONFIG_OSD
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 33/76] arc: Drop CONFIG_MMU

2023-02-01 Thread Simon Glass
This option is set in the Makefile but has no effect in the assembly
code, i.e. the #ifdef branch is never used. Drop it.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 arch/arc/config.mk  | 4 
 arch/arc/lib/ints_low.S | 5 -
 2 files changed, 9 deletions(-)

diff --git a/arch/arc/config.mk b/arch/arc/config.mk
index b713fa3054c..b110f7deaf6 100644
--- a/arch/arc/config.mk
+++ b/arch/arc/config.mk
@@ -12,10 +12,6 @@ KBUILD_LDFLAGS += -EB
 PLATFORM_CPPFLAGS += -mbig-endian
 endif
 
-ifdef CONFIG_ARC_MMU_VER
-CONFIG_MMU = 1
-endif
-
 PLATFORM_CPPFLAGS += -ffixed-r25 -D__ARC__ -gdwarf-2 -mno-sdata
 PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections -fno-common
 
diff --git a/arch/arc/lib/ints_low.S b/arch/arc/lib/ints_low.S
index 38c45c60a95..fb283f239ea 100644
--- a/arch/arc/lib/ints_low.S
+++ b/arch/arc/lib/ints_low.S
@@ -76,13 +76,8 @@
 .endm
 
 .macro SAVE_EXCEPTION_SOURCE
-#ifdef CONFIG_MMU
-   /* If MMU exists exception faulting address is loaded in EFA reg */
-   lr  %r0, [%efa]
-#else
/* Otherwise in ERET (exception return) reg */
lr  %r0, [%eret]
-#endif
 .endm
 
 ENTRY(memory_error)
-- 
2.39.1.456.gfc5497dd1b-goog



[PATCH v3 73/76] freescale: Drop unused vsc3316_3308 driver

2023-02-01 Thread Simon Glass
This is not used. Drop the driver and Kconfig option.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 board/freescale/common/Makefile   |   1 -
 board/freescale/common/vsc3316_3308.c | 530 --
 2 files changed, 531 deletions(-)
 delete mode 100644 board/freescale/common/vsc3316_3308.c

diff --git a/board/freescale/common/Makefile b/board/freescale/common/Makefile
index 5f0503faf8d..c200cf4d403 100644
--- a/board/freescale/common/Makefile
+++ b/board/freescale/common/Makefile
@@ -54,7 +54,6 @@ obj-$(CONFIG_TARGET_MPC8548CDS)   += cds_pci_ft.o
 obj-$(CONFIG_TARGET_P3041DS)   += ics307_clk.o
 obj-$(CONFIG_TARGET_P4080DS)   += ics307_clk.o
 obj-$(CONFIG_TARGET_P5040DS)   += ics307_clk.o
-obj-$(CONFIG_VSC_CROSSBAR)+= vsc3316_3308.o
 obj-$(CONFIG_ZM7300)   += zm7300.o
 ifeq ($(CONFIG_$(SPL_)POWER_LEGACY),y)
 obj-$(CONFIG_POWER_PFUZE100)   += pfuze.o
diff --git a/board/freescale/common/vsc3316_3308.c 
b/board/freescale/common/vsc3316_3308.c
deleted file mode 100644
index c51f3c5aca2..000
--- a/board/freescale/common/vsc3316_3308.c
+++ /dev/null
@@ -1,530 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright 2012 Freescale Semiconductor, Inc.
- * Copyright 2020 NXP
- */
-
-#include "vsc3316_3308.h"
-#include 
-
-#define REVISION_ID_REG0x7E
-#define INTERFACE_MODE_REG 0x79
-#define CURRENT_PAGE_REGISTER  0x7F
-#define CONNECTION_CONFIG_PAGE 0x00
-#define INPUT_STATE_REG0x13
-#define GLOBAL_INPUT_ISE1  0x51
-#define GLOBAL_INPUT_ISE2  0x52
-#define GLOBAL_INPUT_GAIN  0x53
-#define GLOBAL_INPUT_LOS   0x55
-#define GLOBAL_OUTPUT_PE1  0x56
-#define GLOBAL_OUTPUT_PE2  0x57
-#define GLOBAL_OUTPUT_LEVEL0x58
-#define GLOBAL_OUTPUT_TERMINATION  0x5A
-#define GLOBAL_CORE_CNTRL  0x5D
-#define OUTPUT_MODE_PAGE   0x23
-#define CORE_CONTROL_PAGE  0x25
-#define CORE_CONFIG_REG0x75
-
-int vsc_if_enable(unsigned int vsc_addr)
-{
-   u8 data;
-
-   debug("VSC:Configuring VSC at I2C address 0x%2x"
-   " for 2-wire interface\n", vsc_addr);
-
-   /* enable 2-wire Serial InterFace (I2C) */
-   data = 0x02;
-#if CONFIG_IS_ENABLED(DM_I2C)
-   int ret, bus_num = 0;
-   struct udevice *dev;
-
-   ret = i2c_get_chip_for_busnum(bus_num, vsc_addr,
- 1, &dev);
-   if (ret) {
-   printf("%s: Cannot find udev for a bus %d\n", __func__,
-  bus_num);
-   return ret;
-   }
-
-   return dm_i2c_write(dev, INTERFACE_MODE_REG, &data, 1);
-#else
-   return i2c_write(vsc_addr, INTERFACE_MODE_REG, 1, &data, 1);
-#endif
-}
-
-int vsc3316_config(unsigned int vsc_addr, int8_t con_arr[][2],
-   unsigned int num_con)
-{
-   unsigned int i;
-   u8 rev_id = 0;
-   int ret;
-
-   debug("VSC:Initializing VSC3316 at I2C address 0x%2x"
-   " for Tx\n", vsc_addr);
-
-#if CONFIG_IS_ENABLED(DM_I2C)
-   int bus_num = 0;
-   struct udevice *dev;
-
-   ret = i2c_get_chip_for_busnum(bus_num, vsc_addr,
- 1, &dev);
-   if (ret) {
-   printf("%s: Cannot find udev for a bus %d\n", __func__,
-  bus_num);
-   return ret;
-   }
-
-   ret = dm_i2c_read(dev, REVISION_ID_REG, &rev_id, 1);
-   if (ret < 0) {
-   printf("VSC:0x%x could not read REV_ID from device.\n",
-  vsc_addr);
-   return ret;
-   }
-
-   if (rev_id != 0xab) {
-   printf("VSC: device at address 0x%x is not VSC3316/3308.\n",
-  vsc_addr);
-   return -ENODEV;
-   }
-
-   ret = vsc_if_enable(vsc_addr);
-   if (ret) {
-   printf("VSC:0x%x could not configured for 2-wire I/F.\n",
-  vsc_addr);
-   return ret;
-   }
-
-   /* config connections - page 0x00 */
-   dm_i2c_reg_write(dev, CURRENT_PAGE_REGISTER, CONNECTION_CONFIG_PAGE);
-
-   /* Making crosspoint connections, by connecting required
-* input to output
-*/
-   for (i = 0; i < num_con ; i++)
-   dm_i2c_reg_write(dev, con_arr[i][1], con_arr[i][0]);
-
-   /* input state - page 0x13 */
-   dm_i2c_reg_write(dev, CURRENT_PAGE_REGISTER, INPUT_STATE_REG);
-   /* Configuring the required input of the switch */
-   for (i = 0; i < num_con ; i++)
-   dm_i2c_reg_write(dev, con_arr[i][0], 0x80);
-
-   /* Setting Global Input LOS threshold value */
-   dm_i2c_reg_write(dev, GLOBAL_INPUT_LOS, 0x60);
-
-   /* config output mode - page 0x23 */
-   dm_i2c_reg_write(dev, CURRENT_PAGE_REGISTER, OUTPUT_MODE_PAGE);
-   /* Turn ON the Output driver correspond to req

[PATCH v3 75/76] freescale: Drop unused zm7300 driver

2023-02-01 Thread Simon Glass
This is not used anymore. Drop the driver and Kconfig option.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 board/freescale/common/Makefile |   1 -
 board/freescale/common/zm7300.c | 232 
 board/freescale/common/zm7300.h |  21 ---
 3 files changed, 254 deletions(-)
 delete mode 100644 board/freescale/common/zm7300.c
 delete mode 100644 board/freescale/common/zm7300.h

diff --git a/board/freescale/common/Makefile b/board/freescale/common/Makefile
index c200cf4d403..b4faf6f9e0a 100644
--- a/board/freescale/common/Makefile
+++ b/board/freescale/common/Makefile
@@ -54,7 +54,6 @@ obj-$(CONFIG_TARGET_MPC8548CDS)   += cds_pci_ft.o
 obj-$(CONFIG_TARGET_P3041DS)   += ics307_clk.o
 obj-$(CONFIG_TARGET_P4080DS)   += ics307_clk.o
 obj-$(CONFIG_TARGET_P5040DS)   += ics307_clk.o
-obj-$(CONFIG_ZM7300)   += zm7300.o
 ifeq ($(CONFIG_$(SPL_)POWER_LEGACY),y)
 obj-$(CONFIG_POWER_PFUZE100)   += pfuze.o
 endif
diff --git a/board/freescale/common/zm7300.c b/board/freescale/common/zm7300.c
deleted file mode 100644
index e8c2fc85c84..000
--- a/board/freescale/common/zm7300.c
+++ /dev/null
@@ -1,232 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright 2013 Freescale Semiconductor, Inc.
- */
-
-/* Power-One ZM7300 DPM */
-#include "zm7300.h"
-#include 
-
-#define DPM_WP 0x96
-#define WRP_OPCODE 0x01
-#define WRM_OPCODE 0x02
-#define RRP_OPCODE 0x11
-
-#define DPM_SUCCESS 0x01
-#define DPM_EXEC_FAIL 0x00
-
-static const uint16_t hex_to_1_10mv[] = {
-   5000,
-   5125,
-   5250,
-   5375,
-   5500,
-   5625,
-   5750,
-   5875,
-   6000,
-   6125,
-   6250,
-   6375,
-   6500,
-   6625,
-   6750,
-   6875,
-   7000,
-   7125,
-   7250,
-   7375,
-   7500,
-   7625,
-   7750,
-   7875,
-   8000,
-   8125,
-   8250,
-   8375,
-   8500,
-   8625,
-   8750,
-   8875,
-   9000,
-   9125,
-   9250,
-   9375,
-   9500,  /* 0.95mV */
-   9625,
-   9750,
-   9875,
-   1,  /* 1.0V */
-   10125,
-   10250,
-   10375,
-   10500,
-   10625,
-   10750,
-   10875,
-   11000,
-   11125,
-   11250,
-   11375,
-   11500,
-   11625,
-   11750,
-   11875,
-   12000,
-   12125,
-   12250,
-   12375,
-   0,  /* reserved */
-};
-
-
-/* Read Data d from Register r of POL p */
-u8 dpm_rrp(uchar r)
-{
-   u8 ret[5];
-
-   ret[0] = RRP_OPCODE;
-   /* POL is 0 */
-   ret[1] = 0;
-   ret[2] = r;
-   i2c_read(I2C_DPM_ADDR, 0, -3, ret, 2);
-   if (ret[1] == DPM_SUCCESS) { /* the DPM returned success as status */
-   debug("RRP_OPCODE returned success data is %x\n", ret[0]);
-   return ret[0];
-   } else {
-   return -1;
-   }
-}
-
-/* Write Data d into DPM register r (RAM) */
-int dpm_wrm(u8 r, u8 d)
-{
-   u8 ret[5];
-
-   ret[0] = WRM_OPCODE;
-   ret[1] = r;
-   ret[2] = d;
-   i2c_read(I2C_DPM_ADDR, 0, -3, ret, 1);
-   if (ret[0] == DPM_SUCCESS) { /* the DPM returned success as status */
-   debug("WRM_OPCODE returned success data is %x\n", ret[0]);
-   return ret[0];
-   } else {
-   return -1;
-   }
-}
-
-/* Write Data d into Register r of POL(s) a */
-int dpm_wrp(u8 r, u8 d)
-{
-   u8 ret[7];
-
-   ret[0] = WRP_OPCODE;
-   /* only POL0 is present */
-   ret[1] = 0x01;
-   ret[2] = 0x00;
-   ret[3] = 0x00;
-   ret[4] = 0x00;
-   ret[5] = r;
-   ret[6] = d;
-   i2c_read(I2C_DPM_ADDR, 0, -7, ret, 1);
-   if (ret[0] == DPM_SUCCESS) { /* the DPM returned success as status */
-   debug("WRP_OPCODE returned success data is %x\n", ret[0]);
-   return 0;
-   } else {
-   return -1;
-   }
-}
-
-/* Uses the DPM command RRP */
-u8 zm_read(uchar reg)
-{
-   return dpm_rrp(reg);
-}
-
-/* ZM_write --
-   Steps:
-   a. Write data to the register
-   b. Read data from register and compare to written value
-   c. Return return_code & voltage_read
-*/
-u8 zm_write(u8 reg, u8 data)
-{
-   u8 d;
-
-   /* write data to register */
-   dpm_wrp(reg, data);
-
-   /* read register and compare to written value */
-   d = dpm_rrp(reg);
-   if (d != data) {
-   printf("zm_write : Comparison register data failed\n");
-   return -1;
-   }
-
-   return d;
-}
-
-/* zm_write_out_voltage
- * voltage in 1/10 mV
- */
-int zm_write_voltage(int voltage)
-{
-   u8 reg = 0x7, vid;
-   uint16_t voltage_read;
-   u8 ret;
-
-   vid =  (voltage - 5000) / ZM_STEP;
-
-   ret = zm_write(reg, vid);
-   if (ret != -1) {
-   voltage_read = hex_to_1_10mv[ret];
-   debug("voltage set to %dmV\n", voltage_read/10);
-   

  1   2   >