[PATCH 7/7] clk: Make clk_free return void

2022-01-15 Thread Sean Anderson
Most callers of this function do not check the return value, and it is
unclear what action they should take if it fails. If a function is freeing
multiple clocks, it should not stop just because the first one failed.
Since the callbacks can no longer fail, just convert the return type to
void.

Signed-off-by: Sean Anderson 
---

 drivers/clk/clk-uclass.c   | 10 --
 drivers/clk/clk_sandbox_test.c |  9 +++--
 include/clk.h  |  8 
 3 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
index 61f977b661..5641709244 100644
--- a/drivers/clk/clk-uclass.c
+++ b/drivers/clk/clk-uclass.c
@@ -447,9 +447,7 @@ int clk_release_all(struct clk *clk, int count)
if (ret && ret != -ENOSYS)
return ret;
 
-   ret = clk_free([i]);
-   if (ret && ret != -ENOSYS)
-   return ret;
+   clk_free([i]);
}
 
return 0;
@@ -472,18 +470,18 @@ int clk_request(struct udevice *dev, struct clk *clk)
return ops->request(clk);
 }
 
-int clk_free(struct clk *clk)
+void clk_free(struct clk *clk)
 {
const struct clk_ops *ops;
 
debug("%s(clk=%p)\n", __func__, clk);
if (!clk_valid(clk))
-   return 0;
+   return;
ops = clk_dev_ops(clk->dev);
 
if (ops->rfree)
ops->rfree(clk);
-   return 0;
+   return;
 }
 
 ulong clk_get_rate(struct clk *clk)
diff --git a/drivers/clk/clk_sandbox_test.c b/drivers/clk/clk_sandbox_test.c
index f665fd3cc4..5807a454f3 100644
--- a/drivers/clk/clk_sandbox_test.c
+++ b/drivers/clk/clk_sandbox_test.c
@@ -137,14 +137,11 @@ int sandbox_clk_test_disable_bulk(struct udevice *dev)
 int sandbox_clk_test_free(struct udevice *dev)
 {
struct sandbox_clk_test *sbct = dev_get_priv(dev);
-   int i, ret;
+   int i;
 
devm_clk_put(dev, sbct->clkps[SANDBOX_CLK_TEST_ID_DEVM1]);
-   for (i = 0; i < SANDBOX_CLK_TEST_NON_DEVM_COUNT; i++) {
-   ret = clk_free(>clks[i]);
-   if (ret)
-   return ret;
-   }
+   for (i = 0; i < SANDBOX_CLK_TEST_NON_DEVM_COUNT; i++)
+   clk_free(>clks[i]);
 
return 0;
 }
diff --git a/include/clk.h b/include/clk.h
index 33f448eb89..79e7a9551f 100644
--- a/include/clk.h
+++ b/include/clk.h
@@ -396,9 +396,9 @@ int clk_request(struct udevice *dev, struct clk *clk);
  * @clk:   A clock struct that was previously successfully requested by
  * clk_request/get_by_*().
  *
- * Return: 0 if OK, or a negative error code.
+ * Free resources allocated by clk_request() (or any clk_get_* function).
  */
-int clk_free(struct clk *clk);
+void clk_free(struct clk *clk);
 
 /**
  * clk_get_rate() - Get current clock rate.
@@ -545,9 +545,9 @@ static inline int clk_request(struct udevice *dev, struct 
clk *clk)
return -ENOSYS;
 }
 
-static inline int clk_free(struct clk *clk)
+static inline void clk_free(struct clk *clk)
 {
-   return 0;
+   return;
 }
 
 static inline ulong clk_get_rate(struct clk *clk)
-- 
2.34.1



[PATCH 6/7] spi: dw: Don't check clk_free

2022-01-15 Thread Sean Anderson
This function always succeeds, so don't check its return value.

Signed-off-by: Sean Anderson 
---

 drivers/spi/designware_spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/designware_spi.c b/drivers/spi/designware_spi.c
index 742121140d..9b9933b439 100644
--- a/drivers/spi/designware_spi.c
+++ b/drivers/spi/designware_spi.c
@@ -718,7 +718,7 @@ static int dw_spi_remove(struct udevice *bus)
if (ret)
return ret;
 
-   ret = clk_free(>clk);
+   clk_free(>clk);
if (ret)
return ret;
 #endif
-- 
2.34.1



[PATCH 4/7] phy: bcm63xx: Don't check clk_free

2022-01-15 Thread Sean Anderson
This function always succeeds, so don't check its return value.

Signed-off-by: Sean Anderson 
---

 drivers/phy/bcm6318-usbh-phy.c | 4 +---
 drivers/phy/bcm6348-usbh-phy.c | 4 +---
 drivers/phy/bcm6368-usbh-phy.c | 8 ++--
 3 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/phy/bcm6318-usbh-phy.c b/drivers/phy/bcm6318-usbh-phy.c
index 60608a55bc..1c10853940 100644
--- a/drivers/phy/bcm6318-usbh-phy.c
+++ b/drivers/phy/bcm6318-usbh-phy.c
@@ -98,9 +98,7 @@ static int bcm6318_usbh_probe(struct udevice *dev)
if (ret < 0)
return ret;
 
-   ret = clk_free();
-   if (ret < 0)
-   return ret;
+   clk_free();
 
/* enable power domain */
ret = power_domain_get(dev, _dom);
diff --git a/drivers/phy/bcm6348-usbh-phy.c b/drivers/phy/bcm6348-usbh-phy.c
index 1b6b5ad177..ce6be3d7da 100644
--- a/drivers/phy/bcm6348-usbh-phy.c
+++ b/drivers/phy/bcm6348-usbh-phy.c
@@ -62,9 +62,7 @@ static int bcm6348_usbh_probe(struct udevice *dev)
if (ret < 0)
return ret;
 
-   ret = clk_free();
-   if (ret < 0)
-   return ret;
+   clk_free();
 
/* perform reset */
ret = reset_get_by_index(dev, 0, _ctl);
diff --git a/drivers/phy/bcm6368-usbh-phy.c b/drivers/phy/bcm6368-usbh-phy.c
index 4d3a63faad..d057f1f52e 100644
--- a/drivers/phy/bcm6368-usbh-phy.c
+++ b/drivers/phy/bcm6368-usbh-phy.c
@@ -137,9 +137,7 @@ static int bcm6368_usbh_probe(struct udevice *dev)
if (ret < 0)
return ret;
 
-   ret = clk_free();
-   if (ret < 0)
-   return ret;
+   clk_free();
 
 #if defined(CONFIG_POWER_DOMAIN)
/* enable power domain */
@@ -176,9 +174,7 @@ static int bcm6368_usbh_probe(struct udevice *dev)
if (ret < 0)
return ret;
 
-   ret = clk_free();
-   if (ret < 0)
-   return ret;
+   clk_free();
}
 
mdelay(100);
-- 
2.34.1



[PATCH 5/7] spi: bcm63xx: Don't check clk_free

2022-01-15 Thread Sean Anderson
This function always succeeds, so don't check its return value.

Signed-off-by: Sean Anderson 
---

 drivers/spi/bcm63xx_hsspi.c | 8 ++--
 drivers/spi/bcm63xx_spi.c   | 4 +---
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/spi/bcm63xx_hsspi.c b/drivers/spi/bcm63xx_hsspi.c
index 85108df565..47002f8b56 100644
--- a/drivers/spi/bcm63xx_hsspi.c
+++ b/drivers/spi/bcm63xx_hsspi.c
@@ -355,9 +355,7 @@ static int bcm63xx_hsspi_probe(struct udevice *dev)
if (ret < 0 && ret != -ENOSYS)
return ret;
 
-   ret = clk_free();
-   if (ret < 0 && ret != -ENOSYS)
-   return ret;
+   clk_free();
 
/* get clock rate */
ret = clk_get_by_name(dev, "pll", );
@@ -366,9 +364,7 @@ static int bcm63xx_hsspi_probe(struct udevice *dev)
 
priv->clk_rate = clk_get_rate();
 
-   ret = clk_free();
-   if (ret < 0 && ret != -ENOSYS)
-   return ret;
+   clk_free();
 
/* perform reset */
ret = reset_get_by_index(dev, 0, _ctl);
diff --git a/drivers/spi/bcm63xx_spi.c b/drivers/spi/bcm63xx_spi.c
index dd5e62b2fe..0600d56c69 100644
--- a/drivers/spi/bcm63xx_spi.c
+++ b/drivers/spi/bcm63xx_spi.c
@@ -391,9 +391,7 @@ static int bcm63xx_spi_probe(struct udevice *dev)
if (ret < 0)
return ret;
 
-   ret = clk_free();
-   if (ret < 0)
-   return ret;
+   clk_free();
 
/* perform reset */
ret = reset_get_by_index(dev, 0, _ctl);
-- 
2.34.1



[PATCH 3/7] net: bcm63xx: Don't check clk_free

2022-01-15 Thread Sean Anderson
This function always succeeds, so don't check its return value.

Signed-off-by: Sean Anderson 
---

 drivers/net/bcm6348-eth.c | 6 +-
 drivers/net/bcm6368-eth.c | 6 +-
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/net/bcm6348-eth.c b/drivers/net/bcm6348-eth.c
index aad7b61213..06e0dd74a5 100644
--- a/drivers/net/bcm6348-eth.c
+++ b/drivers/net/bcm6348-eth.c
@@ -461,11 +461,7 @@ static int bcm6348_eth_probe(struct udevice *dev)
return ret;
}
 
-   ret = clk_free();
-   if (ret < 0) {
-   pr_err("%s: error freeing clock %d\n", __func__, i);
-   return ret;
-   }
+   clk_free();
}
 
/* try to perform resets */
diff --git a/drivers/net/bcm6368-eth.c b/drivers/net/bcm6368-eth.c
index 29abe7fc96..c2a8b9f057 100644
--- a/drivers/net/bcm6368-eth.c
+++ b/drivers/net/bcm6368-eth.c
@@ -546,11 +546,7 @@ static int bcm6368_eth_probe(struct udevice *dev)
return ret;
}
 
-   ret = clk_free();
-   if (ret < 0) {
-   pr_err("%s: error freeing clock %d\n", __func__, i);
-   return ret;
-   }
+   clk_free();
}
 
/* try to perform resets */
-- 
2.34.1



[PATCH 1/7] clk: Make rfree return void

2022-01-15 Thread Sean Anderson
When freeing a clock there is not much we can do if there is an error, and
most callers do not actually check the return value. Even e.g. checking to
make sure that clk->id is valid should have been done in request() in the
first place (unless someone is messing with the driver behind our back).
Just return void and don't bother returning an error.

Signed-off-by: Sean Anderson 
---

 drivers/clk/clk-uclass.c  | 7 +++
 drivers/clk/clk_sandbox.c | 6 +++---
 include/clk-uclass.h  | 8 +++-
 3 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
index fca4b8321a..61f977b661 100644
--- a/drivers/clk/clk-uclass.c
+++ b/drivers/clk/clk-uclass.c
@@ -481,10 +481,9 @@ int clk_free(struct clk *clk)
return 0;
ops = clk_dev_ops(clk->dev);
 
-   if (!ops->rfree)
-   return 0;
-
-   return ops->rfree(clk);
+   if (ops->rfree)
+   ops->rfree(clk);
+   return 0;
 }
 
 ulong clk_get_rate(struct clk *clk)
diff --git a/drivers/clk/clk_sandbox.c b/drivers/clk/clk_sandbox.c
index 57acf7d855..636914db8c 100644
--- a/drivers/clk/clk_sandbox.c
+++ b/drivers/clk/clk_sandbox.c
@@ -101,15 +101,15 @@ static int sandbox_clk_request(struct clk *clk)
return 0;
 }
 
-static int sandbox_clk_free(struct clk *clk)
+static void sandbox_clk_free(struct clk *clk)
 {
struct sandbox_clk_priv *priv = dev_get_priv(clk->dev);
 
if (clk->id >= SANDBOX_CLK_ID_COUNT)
-   return -EINVAL;
+   return;
 
priv->requested[clk->id] = false;
-   return 0;
+   return;
 }
 
 static struct clk_ops sandbox_clk_ops = {
diff --git a/include/clk-uclass.h b/include/clk-uclass.h
index e44f1caf51..65ebff9ed2 100644
--- a/include/clk-uclass.h
+++ b/include/clk-uclass.h
@@ -32,7 +32,7 @@ struct clk_ops {
int (*of_xlate)(struct clk *clock,
struct ofnode_phandle_args *args);
int (*request)(struct clk *clock);
-   int (*rfree)(struct clk *clock);
+   void (*rfree)(struct clk *clock);
ulong (*round_rate)(struct clk *clk, ulong rate);
ulong (*get_rate)(struct clk *clk);
ulong (*set_rate)(struct clk *clk, ulong rate);
@@ -81,11 +81,9 @@ int request(struct clk *clock);
  * rfree() - Free a previously requested clock.
  * @clock: The clock to free.
  *
- * This is the implementation of the client clk_free() API.
- *
- * Return: 0 if OK, or a negative error code.
+ * Free any resources allocated in request().
  */
-int rfree(struct clk *clock);
+void rfree(struct clk *clock);
 
 /**
  * round_rate() - Adjust a rate to the exact rate a clock can provide.
-- 
2.34.1



[PATCH 2/7] dma: bcm6348: Don't check clk_free

2022-01-15 Thread Sean Anderson
This function always succeeds, so don't check its return value.

Signed-off-by: Sean Anderson 
---

 drivers/dma/bcm6348-iudma.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/dma/bcm6348-iudma.c b/drivers/dma/bcm6348-iudma.c
index c04aa55cb4..4fc650272d 100644
--- a/drivers/dma/bcm6348-iudma.c
+++ b/drivers/dma/bcm6348-iudma.c
@@ -596,11 +596,7 @@ static int bcm6348_iudma_probe(struct udevice *dev)
return ret;
}
 
-   ret = clk_free();
-   if (ret < 0) {
-   pr_err("error freeing clock %d\n", i);
-   return ret;
-   }
+   clk_free();
}
 
/* try to perform resets */
-- 
2.34.1



[PATCH 0/7] clk: Make clk_free return void

2022-01-15 Thread Sean Anderson
clk_free cleans up resources allocated by clk_request et. al. It returns an
error code, but it really shouldn't. Much like regular free(), there is
typically no way to handle an error, and errors from clk_free shouldn't prevent
progress in the rest of the program. Make clk_free (and rfree) return void.


Sean Anderson (7):
  clk: Make rfree return void
  dma: bcm6348: Don't check clk_free
  net: bcm63xx: Don't check clk_free
  phy: bcm63xx: Don't check clk_free
  spi: bcm63xx: Don't check clk_free
  spi: dw: Don't check clk_free
  clk: Make clk_free return void

 drivers/clk/clk-uclass.c   | 15 ++-
 drivers/clk/clk_sandbox.c  |  6 +++---
 drivers/clk/clk_sandbox_test.c |  9 +++--
 drivers/dma/bcm6348-iudma.c|  6 +-
 drivers/net/bcm6348-eth.c  |  6 +-
 drivers/net/bcm6368-eth.c  |  6 +-
 drivers/phy/bcm6318-usbh-phy.c |  4 +---
 drivers/phy/bcm6348-usbh-phy.c |  4 +---
 drivers/phy/bcm6368-usbh-phy.c |  8 ++--
 drivers/spi/bcm63xx_hsspi.c|  8 ++--
 drivers/spi/bcm63xx_spi.c  |  4 +---
 drivers/spi/designware_spi.c   |  2 +-
 include/clk-uclass.h   |  8 +++-
 include/clk.h  |  8 
 14 files changed, 30 insertions(+), 64 deletions(-)

-- 
2.34.1



Re: [PATCH 00/11] Add support for SUNIV and F1C100s.

2022-01-15 Thread Jesse Taube




On 1/10/22 00:13, Tnze Jdao wrote:

I tested this patch and tried to run it on my LicheePi Nano. It works, but I 
found there is WARNINGs when compile the code:
---
include/configs/sunxi-common.h:128:0: warning: "CONFIG_ENV_SECT_SIZE" redefined
  #define CONFIG_ENV_SECT_SIZE 0x1000
Ah I will move this it should be moved to defconfig thx for pointing 
this out.


In file included from ././include/linux/kconfig.h:4:0,
  from :0:
include/generated/autoconf.h:296:0: note: this is the location of the previous 
definition
  #define CONFIG_ENV_SECT_SIZE 0x1

Not entirely sure how it got defined here, it doesn't get defined in my
generated config.


In file included from include/configs/suniv.h:12:0,
  from include/config.h:4,
  from include/common.h:16,
  from lib/slre.c:24:

And I think the problem is the CONFIG_ENV_SECT_SIZE should be (and required to) 
defined in the config file rather than at include/configs/sunxi-common.h:128


Im sorry for the late reply the email got lost.


[PATCH v3 1/1] clk: Add clk_get_by_name_optional

2022-01-15 Thread Sean Anderson
This adds a helper function for clk_get_by_name in cases where the clock is
optional. Hopefully this helps point driver writers in the right direction.
Also convert some existing users.

Signed-off-by: Sean Anderson 
Reviewed-by: Neil Armstrong 
Reviewed-by: Simon Glass 
---

Changes in v3:
- Fix clk_get_by_name_optional recursing

 drivers/clk/clk_zynq.c  |  5 +++--
 drivers/rng/meson-rng.c |  4 ++--
 include/clk.h   | 24 
 3 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/clk_zynq.c b/drivers/clk/clk_zynq.c
index 18915c3e04..e80500e382 100644
--- a/drivers/clk/clk_zynq.c
+++ b/drivers/clk/clk_zynq.c
@@ -472,8 +472,9 @@ static int zynq_clk_probe(struct udevice *dev)
 
for (i = 0; i < 2; i++) {
sprintf(name, "gem%d_emio_clk", i);
-   ret = clk_get_by_name(dev, name, >gem_emio_clk[i]);
-   if (ret < 0 && ret != -ENODATA) {
+   ret = clk_get_by_name_optional(dev, name,
+  >gem_emio_clk[i]);
+   if (ret) {
dev_err(dev, "failed to get %s clock\n", name);
return ret;
}
diff --git a/drivers/rng/meson-rng.c b/drivers/rng/meson-rng.c
index 5a4f45ad5a..e0a1e8c7e0 100644
--- a/drivers/rng/meson-rng.c
+++ b/drivers/rng/meson-rng.c
@@ -91,8 +91,8 @@ static int meson_rng_of_to_plat(struct udevice *dev)
return -ENODEV;
 
/* Get optional "core" clock */
-   err = clk_get_by_name(dev, "core", >clk);
-   if (err && err != -ENODATA)
+   err = clk_get_by_name_optional(dev, "core", >clk);
+   if (err)
return err;
 
return 0;
diff --git a/include/clk.h b/include/clk.h
index 33f448eb89..c30a5dba97 100644
--- a/include/clk.h
+++ b/include/clk.h
@@ -292,6 +292,30 @@ static inline int clk_release_all(struct clk *clk, int 
count)
 }
 #endif
 
+/**
+ * clk_get_by_name_optional() - Get/request a optional clock by name.
+ * @dev:   The client device.
+ * @name:  The name of the clock to request, within the client's list of
+ * clocks.
+ * @clk:   A pointer to a clock struct to initialize.
+ *
+ * Behaves the same as clk_get_by_name(), except when there is no clock
+ * provider. In the latter case, return 0.
+ *
+ * Return: 0 if OK, or a negative error code.
+ */
+static inline int clk_get_by_name_optional(struct udevice *dev,
+  const char *name, struct clk *clk)
+{
+   int ret;
+
+   ret = clk_get_by_name(dev, name, clk);
+   if (ret == -ENODATA)
+   return 0;
+
+   return ret;
+}
+
 /**
  * clk_get_by_name_nodev_optional - Get/request an optinonal clock by name
  * without a device.
-- 
2.34.1



[PATCH v3 0/1] clk: Clean up optional helpers, and add API docs to HTML

2022-01-15 Thread Sean Anderson
This cleans up the various optional helpers for clocks, and adds a new one.
While we're at it, also convert the existing API docs to our HTML documentation.

The rest of this series has been applied, but the former patch 5 had an error,
so I did not apply it. I have fixed it in this revision.

Changes in v3:
- Fix clk_get_by_name_optional recursing

Changes in v2:
- Rebased onto u-boot/master

Sean Anderson (1):
  clk: Add clk_get_by_name_optional

 drivers/clk/clk_zynq.c  |  5 +++--
 drivers/rng/meson-rng.c |  4 ++--
 include/clk.h   | 24 
 3 files changed, 29 insertions(+), 4 deletions(-)

-- 
2.34.1



Re: [PATCH v2] drivers: spi-nor: Add JEDEC id for W25Q16JV

2022-01-15 Thread Dhananjay Phadke

On 1/14/2022 6:04 AM, Angus Ainslie wrote:



  },
+    {
+    INFO("w25q16jv-im/jm", 0xef7015, 0, 64 * 1024,  32,
+    SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
+    SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
+    },


Shouldn't this be w25q16jvm, which seems to be unofficial convention for
*-DTR parts? I was looking for naming convention for another Winbond 
part -


https://lore.kernel.org/u-boot/0c3e4727-0997-a4c5-dab1-b09ea8781...@linux.microsoft.com/ 





Would you like a v3 using this naming convention ?


Sure, let's try to follow this convention, I'm also doing same in my v2
patch.

Regards,
Dhananjay


Re: [PATCH v2 0/5] clk: Clean up optional helpers, and add API docs to HTML

2022-01-15 Thread Sean Anderson
On Wed, 22 Dec 2021 12:11:09 -0500, Sean Anderson wrote:
> This cleans up the various optional helpers for clocks, and adds a new one.
> While we're at it, also convert the existing API docs to our HTML 
> documentation.
> 
> Changes in v2:
> - Clean up the argument list and descriptions
> - Rebased onto u-boot/master
> 
> [...]

Applied, thanks!

[1/5] clk: Rename clk_get_optional_nodev
  commit: 80a0b4131b718f5685343a043d18949adc493df6
[2/5] clk: Inline clk_get_*_optional
  commit: 40389606194f3d603d034f756169494ad76f84ae
[3/5] clk: Add client API to HTML docs
  commit: 0c0b970cf39cf9e28d838c72e516dfbd7a5b5cb7
[4/5] clk: Add driver API to HTML docs
  commit: decee5e428ae8ab634eeef00f4e763febf1bcbda

Best regards,
-- 
Sean Anderson 


Re: (subset) [PATCH v2 1/2] clk: cdce9xx: Convert .of_xlate to .request

2022-01-15 Thread Sean Anderson
On Wed, 15 Dec 2021 11:47:17 -0500, Sean Anderson wrote:
> This xlate function just performs some checking. We can do this in
> request() instead and use the default xlate.
> 
> 

Applied, thanks!

[1/2] clk: cdce9xx: Convert .of_xlate to .request
  commit: f9489580750af51ef7214bb1937d4b1d3c00a333

Best regards,
-- 
Sean Anderson 


Re: [PATCH] clk: versaclock: Remove xlate function

2022-01-15 Thread Sean Anderson
On Wed, 1 Dec 2021 15:13:17 -0500, Sean Anderson wrote:
> This function is the same as the default xlate. Remove it.
> 
> 

Applied, thanks!

[1/1] clk: versaclock: Remove xlate function
  commit: e4e8e01a194e256f2b85b9f97b52d93dde5238f5

Best regards,
-- 
Sean Anderson 


Re: [PATCH] clk: Remove no-op request and rfree callbacks

2022-01-15 Thread Sean Anderson
On Wed, 1 Dec 2021 14:51:00 -0500, Sean Anderson wrote:
> These callbacks are optional. Remove ones which do nothing.
> 
> 

Applied, thanks!

[1/1] clk: Remove no-op request and rfree callbacks
  commit: 460970faec567f9285199140c6e5dbe2112bb843

Best regards,
-- 
Sean Anderson 


Re: [PATCH 0/3] clk: Some build infrastructure cleanups

2022-01-15 Thread Sean Anderson
On Wed, 15 Dec 2021 11:36:17 -0500, Sean Anderson wrote:
> This makes some minor clean ups to the clock build infrastructure.
> 
> 
> Sean Anderson (3):
>   clk: Alphabetize Makefile
>   clk: Alphabetize Kconfig
>   clk: Rename ICS8N3QV01 to CLK_ICS8N3QV01
> 
> [...]

Applied, thanks!

[1/3] clk: Alphabetize Makefile
  commit: ae77af01ce49135f2406797e6bf048c3ee373405
[2/3] clk: Alphabetize Kconfig
  commit: 742212fcfa8320c37126e059b08e672c9bf2ee45
[3/3] clk: Rename ICS8N3QV01 to CLK_ICS8N3QV01
  commit: 286bddaca3baaf915f0501ac52e6af6cb5eb0a29

Best regards,
-- 
Sean Anderson 


Please pull u-boot-net/next

2022-01-15 Thread Ramon Fried
Hi Tom,
Please pull the latest changes from u-boot-net/next branch which include:
* PXE label override support
* Fastboot UDP configurable port
* new phy driver: TI DP83869HM
* and few minor fixes to dsa.

The following changes since commit 0dadad6d7c5769d6258baeaf1b8db843b0dfa01f:

  Merge tag 'u-boot-amlogic-20220107' of
https://source.denx.de/u-boot/custodians/u-boot-amlogic into next
(2022-01-09 07:56:31 -0500)

are available in the Git repository at:

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

for you to fetch changes up to 046bf8d4c512ad6501fe9e77508bbe1292a29fef:

  net: fastboot: make UDP port net: configurable (2022-01-15 18:54:21 +0200)


Amjad Ouled-Ameur (1):
  cmd: pxe_utils: sysboot: add label override support

Christian Gmeiner (1):
  net: fastboot: make UDP port net: configurable

Dominic Rath (1):
  net: phy: add TI DP83869HM ethernet driver

Marek Vasut (1):
  net: eth-phy: Demote missing phy-handle log message to debug

Markus Koch (1):
  net: fsl: Fix busy flag polling register

Vladimir Oltean (2):
  net: dsa: fix phydev->speed being uninitialized for the CPU port fixed PHY
  net: dsa: sja1105: fix device id detection

 boot/pxe_utils.c |  15 ++
 doc/README.pxe   |   6 +
 drivers/fastboot/Kconfig |   7 +
 drivers/net/eth-phy-uclass.c |   2 +-
 drivers/net/fm/memac_phy.c   |   2 +-
 drivers/net/fsl_ls_mdio.c|   4 +-
 drivers/net/phy/Kconfig  |   6 +
 drivers/net/phy/Makefile |   1 +
 drivers/net/phy/dp83869.c| 507 +++
 drivers/net/phy/ti_phy_init.c|   4 +
 drivers/net/phy/ti_phy_init.h|   1 +
 drivers/net/sja1105.c|   6 -
 include/dt-bindings/net/ti-dp83869.h |  60 +
 include/fsl_memac.h  |   1 -
 net/dsa-uclass.c |  11 +
 net/fastboot.c   |   5 +-
 16 files changed, 623 insertions(+), 15 deletions(-)
 create mode 100644 drivers/net/phy/dp83869.c
 create mode 100644 include/dt-bindings/net/ti-dp83869.h

Thanks,
Ramon


[PATCH 1/1] mkimage: struct stat.st_size may not be long

2022-01-15 Thread Heinrich Schuchardt
The component st_size of struct stat is of type off_t. Depending on the
system printing it it with %ld leads to a warning:

tools/mkimage.c:438:54: warning: format '%ld' expects argument of type
'long int', but argument 5 has type
'off_t' {aka 'long long int'} [-Wformat=]
  438 | "%s: Bad size: \"%s\" is not valid image: size %ld < %u\n",
  |~~^
  |  |
  |  long int
  |%lld

When comparing an off_t value to a 32bit integer we should not convert to
uint32_t but to off_t which may be wider.

Reported-by: Milan P. Stanić 
Fixes: 331f0800f1a3 ("mkimage: allow -l to work on block devices on Linux")
Signed-off-by: Heinrich Schuchardt 
---
 tools/mkimage.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/mkimage.c b/tools/mkimage.c
index fbe883ce36..79042be828 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -433,11 +433,12 @@ int main(int argc, char **argv)
params.cmdname, params.imagefile);
exit (EXIT_FAILURE);
 #endif
-   } else if ((unsigned)sbuf.st_size < tparams->header_size) {
+   } else if (sbuf.st_size < (off_t)tparams->header_size) {
fprintf (stderr,
-   "%s: Bad size: \"%s\" is not valid image: size 
%ld < %u\n",
+   "%s: Bad size: \"%s\" is not valid image: size 
%llu < %u\n",
params.cmdname, params.imagefile,
-   sbuf.st_size, tparams->header_size);
+   (unsigned long long) sbuf.st_size,
+   tparams->header_size);
exit (EXIT_FAILURE);
} else {
size = sbuf.st_size;
-- 
2.33.1



Re: [BUG] sandbox: NO_SDL=1 gcc: error: arch/sandbox/cpu/sdl.o: No such file or directory

2022-01-15 Thread Heinrich Schuchardt

On 1/13/22 14:41, Simon Glass wrote:

Hi Heinrich,

On Mon, 10 Jan 2022 at 16:22, Heinrich Schuchardt  wrote:


Hello Simon,

compiling with SDL fails on Alpine Linux:
https://gitlab.alpinelinux.org/alpine/aports/-/issues/13411

So I tried NO_SDL:

make sandbox_defconfig NO_SDL=1
make menuconfig # CONFIG_ETH_SANDBOX_RAW=n
make -j4 NO_SDL=1

But I got an error
gcc: error: arch/sandbox/cpu/sdl.o: No such file or directory


Do you need mrproper first? I don't hit that problem.


Please, build the appended Dockerfile ("sudo docker build -t .").

It gives me:

/usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld:
/tmp/u-boot.eJeOKe.ltrans36.ltrans.o: in function `dm_test_video_bmp8':
/home/uboot/u-boot/test/dm/video.c:357: undefined reference to
`sandbox_sdl_set_bpp'
/usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld:
/tmp/u-boot.eJeOKe.ltrans36.ltrans.o: in function `dm_test_video_bmp16':
/home/uboot/u-boot/test/dm/video.c:378: undefined reference to
`sandbox_sdl_set_bpp'
/usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld:
/tmp/u-boot.eJeOKe.ltrans36.ltrans.o: in function `dm_test_video_bmp24':
/home/uboot/u-boot/test/dm/video.c:401: undefined reference to
`sandbox_sdl_set_bpp'
/usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld:
/tmp/u-boot.eJeOKe.ltrans36.ltrans.o: in function `dm_test_video_bmp24_32':
/home/uboot/u-boot/test/dm/video.c:424: undefined reference to
`sandbox_sdl_set_bpp'
/usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld:
/tmp/u-boot.eJeOKe.ltrans36.ltrans.o: in function `dm_test_video_bmp32':
/home/uboot/u-boot/test/dm/video.c:445: undefined reference to
`sandbox_sdl_set_bpp'
/usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld:
/tmp/u-boot.eJeOKe.ltrans36.ltrans.o:/home/uboot/u-boot/test/dm/video.c:479:
more undefined references to `sandbox_sdl_set_bpp' follow
collect2: error: ld returned 1 exit status
make: *** [Makefile:1799: u-boot] Error 1

Best regards

Heinrich



I see that I broke it...it needs a static inline for
sandbox_sdl_remove_display().



Can't we make CONFIG_SANDBOX_SDL a Kconfig symbol to get rid of the
command line symbol?

We already have CONFIG_SANDBOX_VIDEO_SDL. Do we need two symbols?


You mean, manually change the defconfig file? I suppose we could do
that, but it is harder for people to do.

In any case, we should add this case to CI.

Regards,
Simon
# SPDX-License-Identifier: GPL-2.0+
# This Dockerfile is used to build an image containing basic stuff to be used
# to build U-Boot and run our test suites.

FROM alpine:3.15.0
MAINTAINER Heinrich Schuchardt 
LABEL Description=" This image is for building U-Boot inside a container"

# Install packages
RUN apk update
RUN apk add \
alpine-sdk \
bash \
bc \
bison \
dtc \
flex \
git \
linux-headers \
ncurses-dev \
openssl-dev \
perl \
python3 \
py3-setuptools \
python3-dev \
sdl2-dev \
sudo 

# Create our user/group
RUN echo uboot ALL=NOPASSWD: ALL > /etc/sudoers.d/uboot
RUN adduser -D uboot
RUN addgroup uboot wheel
USER uboot:uboot
RUN bash
WORKDIR /home/uboot
RUN git clone https://source.denx.de/u-boot/u-boot.git
WORKDIR /home/uboot/u-boot
RUN make sandbox_defconfig NO_SDL=1
RUN sed -i 's/CONFIG_ETH_SANDBOX_RAW=y/# CONFIG_ETH_SANDBOX_RAW is not set/g' 
.config
RUN sed -i 's/CONFIG_VIDEO_SANDBOX_SDL=y/# CONFIG_VIDEO_SANDBOX_SDL is not 
set/g' .config
# RUN make -j$(nproc) NO_SDL=1


Re: [PATCH v2] tools: mkimage: Call verify_header after writing image to disk

2022-01-15 Thread Simon Glass
On Fri, 14 Jan 2022 at 10:35, Pali Rohár  wrote:
>
> If image backend provides verify_header callback then call it after writing
> image to disk. This ensures that written image is correct.
>
> Signed-off-by: Pali Rohár 
> ---
>  tools/mkimage.c | 41 +
>  1 file changed, 41 insertions(+)
>

Reviewed-by: Simon Glass 

Missing change log, BTW.


Re: [PATCH v4 2/6] clk: actions: Add SD/MMC clocks

2022-01-15 Thread Sean Anderson

On 11/28/21 6:32 AM, Amit Singh Tomar wrote:

From: Amit Singh Tomar 

This commit adds SD/MMC clocks, and provides .set/get_rate callbacks
for SD/MMC device present on Actions OWL S700 SoCs.

Signed-off-by: Amit Singh Tomar 
---
Changes since v3:
* No change.
Changes since v2:
* Fixed the weird div assignment.
* Moved the clock bit for SD from header file
  to driver file.
* Removed "< 0" part while comparing unsigned.
Changes since previous version:
* Removed rate *= 2 as this just overclocks.
* Separated the divide by 128 bit from divider value.
* Provided the separate routine to get sd parent rate
  based on bit 9.
* Removed unnecessary initialization.
---
  drivers/clk/owl/clk_owl.c | 73 +++
  1 file changed, 73 insertions(+)

diff --git a/drivers/clk/owl/clk_owl.c b/drivers/clk/owl/clk_owl.c
index f78e5fa3f08d..678fdd5a4540 100644
--- a/drivers/clk/owl/clk_owl.c
+++ b/drivers/clk/owl/clk_owl.c
@@ -20,6 +20,8 @@
  #include 
  #include 
  
+#define CMU_DEVCLKEN0_SD0	BIT(22)


Please define this in arch/arm/include/asm/arch-owl/regs_s[79]00.h like 
CMU_DEVCLKEN1_ETH.


  void owl_clk_init(struct owl_clk_priv *priv)
  {
u32 bus_clk = 0, core_pll, dev_pll;
@@ -92,6 +94,9 @@ int owl_clk_enable(struct clk *clk)
setbits_le32(priv->base + CMU_DEVCLKEN1, CMU_DEVCLKEN1_ETH);
setbits_le32(priv->base + CMU_ETHERNETPLL, 5);
break;
+   case CLK_SD0:
+   setbits_le32(priv->base + CMU_DEVCLKEN0, CMU_DEVCLKEN0_SD0);
+   break;
default:
return -EINVAL;
}
@@ -121,6 +126,9 @@ int owl_clk_disable(struct clk *clk)
case CLK_ETHERNET:
clrbits_le32(priv->base + CMU_DEVCLKEN1, CMU_DEVCLKEN1_ETH);
break;
+   case CLK_SD0:
+   clrbits_le32(priv->base + CMU_DEVCLKEN0, CMU_DEVCLKEN0_SD0);
+   break;
default:
return -EINVAL;
}
@@ -128,11 +136,72 @@ int owl_clk_disable(struct clk *clk)
return 0;
  }
  
+static ulong get_sd_parent_rate(struct owl_clk_priv *priv, u32 dev_index)

+{
+   ulong rate;
+   u32 reg;
+
+   reg = readl(priv->base + (CMU_SD0CLK + dev_index * 0x4));
+   /* Clock output of DEV/NAND_PLL
+* Range: 48M ~ 756M
+* Frequency= PLLCLK * 6
+*/
+   if (reg & 0x200)


Please add a define for this bit


+   rate = readl(priv->base + CMU_NANDPLL) & 0x7f;


ditto for this mask


+   else
+   rate = readl(priv->base + CMU_DEVPLL) & 0x7f;
+
+   rate *= 600;
+
+   return rate;
+}
+
+static ulong owl_get_sd_clk_rate(struct owl_clk_priv *priv, int sd_index)
+{
+   uint div, val;
+   ulong parent_rate = get_sd_parent_rate(priv, sd_index);
+
+   val = readl(priv->base + (CMU_SD0CLK + sd_index * 0x4));
+   div = (val & 0x1f) + 1;


ditto


+
+   return (parent_rate / div);
+}
+
+static ulong owl_set_sd_clk_rate(struct owl_clk_priv *priv, ulong rate,
+int sd_index)
+{
+   uint div, val;
+   ulong parent_rate = get_sd_parent_rate(priv, sd_index);
+
+   if (rate == 0)
+   return rate;
+
+   div = (parent_rate / rate);


no parentheses needed here


+
+   val = readl(priv->base + (CMU_SD0CLK + sd_index * 0x4));
+   /* Bits 4..0 is used to program div value and bit 8 to enable
+* divide by 128 circuit
+*/


The comment is good, but please use defines. Additionally, we are not
in the net subsystem, so it should be formatted like

/*
 * Bits 4..0 is used to program div value and bit 8 to enable
 * divide by 128 circuit
 */


+   val &= ~0x11f;
+   if (div >= 128) {
+   div = div / 128;
+   val |= 0x100; /* enable divide by 128 circuit */
+   }
+   val |= ((div - 1) & 0x1f);
+   writel(val, priv->base + (CMU_SD0CLK + sd_index * 0x4));
+
+   return owl_get_sd_clk_rate(priv, 0);
+}
+
  static ulong owl_clk_get_rate(struct clk *clk)
  {
+   struct owl_clk_priv *priv = dev_get_priv(clk->dev);
ulong rate;
  
  	switch (clk->id) {

+   case CLK_SD0:
+   rate = owl_get_sd_clk_rate(priv, 0);
+   break;
default:
return -ENOENT;
}
@@ -142,9 +211,13 @@ static ulong owl_clk_get_rate(struct clk *clk)
  
  static ulong owl_clk_set_rate(struct clk *clk, ulong rate)

  {
+   struct owl_clk_priv *priv = dev_get_priv(clk->dev);
ulong new_rate;
  
  	switch (clk->id) {

+   case CLK_SD0:
+   new_rate = owl_set_sd_clk_rate(priv, rate, 0);
+   break;
default:
return -ENOENT;
}





Re: [PATCH v4 1/6] clk: actions: Introduce dummy get/set_rate callbacks

2022-01-15 Thread Sean Anderson

On 11/28/21 6:32 AM, Amit Singh Tomar wrote:

From: Amit Singh Tomar 

This commit introduces get/set_rate callbacks, these are dummy at
the moment, and can be used to get/set clock for various devices
based on the clk id.

Signed-off-by: Amit Singh Tomar 
---
Changes since v3:
* No changes.
Changes since v2:
* No changes.
Changes since previous version:
* Removed premature initialization to avoid
  compiler warnings.
---
  drivers/clk/owl/clk_owl.c | 26 ++
  1 file changed, 26 insertions(+)

diff --git a/drivers/clk/owl/clk_owl.c b/drivers/clk/owl/clk_owl.c
index 96ab7fed1f37..f78e5fa3f08d 100644
--- a/drivers/clk/owl/clk_owl.c
+++ b/drivers/clk/owl/clk_owl.c
@@ -128,6 +128,30 @@ int owl_clk_disable(struct clk *clk)
return 0;
  }
  
+static ulong owl_clk_get_rate(struct clk *clk)

+{
+   ulong rate;
+
+   switch (clk->id) {
+   default:
+   return -ENOENT;


-ENOSYS please


+   }
+
+   return rate;
+}
+
+static ulong owl_clk_set_rate(struct clk *clk, ulong rate)
+{
+   ulong new_rate;
+
+   switch (clk->id) {
+   default:
+   return -ENOENT;


ditto


+   }
+
+   return new_rate;
+}
+
  static int owl_clk_probe(struct udevice *dev)
  {
struct owl_clk_priv *priv = dev_get_priv(dev);
@@ -145,6 +169,8 @@ static int owl_clk_probe(struct udevice *dev)
  static const struct clk_ops owl_clk_ops = {
.enable = owl_clk_enable,
.disable = owl_clk_disable,
+   .get_rate = owl_clk_get_rate,
+   .set_rate = owl_clk_set_rate,
  };
  
  static const struct udevice_id owl_clk_ids[] = {




With that fixed,

Reviewed-by: Sean Anderson 



Re: [PATCH v2 3/6] clk: sunxi: v3s: fix tabs / spaces

2022-01-15 Thread Sean Anderson

Hi Andre,

On 5/26/21 7:16 PM, Andre Przywara wrote:

On Sun, 23 May 2021 01:17:29 +0200
Andreas Rehn  wrote:


align CLK_USB_PHY0 with tabs

Signed-off-by: Andreas Rehn 


Reviewed-by: Andre Przywara 

Cheers,
Andre

P.S. Please send a whole v2 series next time, to make this easier to
sort out which patch still applies and which not.


It looks like this never got applied (despite being marked as "accepted"
in patchwork). Do you want me to pick it up?

--Sean


Re: [PATCH v7 07/19] rockchip: rk3066: fix assigned-clocks rk3066_clk_set_rate

2022-01-15 Thread Sean Anderson

On 1/11/22 4:18 PM, Johan Jonker wrote:

The rk3066 cru node has a number of assigned-clocks properties
that call the .set_rate() function. Add them to the list so that
they return a 0 instead of -ENOENT.

Signed-off-by: Johan Jonker 
---
  drivers/clk/rockchip/clk_rk3066.c | 9 +
  1 file changed, 9 insertions(+)

diff --git a/drivers/clk/rockchip/clk_rk3066.c 
b/drivers/clk/rockchip/clk_rk3066.c
index 804aa43b..1a45 100644
--- a/drivers/clk/rockchip/clk_rk3066.c
+++ b/drivers/clk/rockchip/clk_rk3066.c
@@ -573,6 +573,15 @@ static ulong rk3066_clk_set_rate(struct clk *clk, ulong 
rate)
case SCLK_TSADC:
new_rate = rk3066_clk_saradc_set_clk(cru, rate, clk->id);
break;
+   case PLL_CPLL:
+   case PLL_GPLL:
+   case ACLK_CPU:
+   case HCLK_CPU:
+   case PCLK_CPU:
+   case ACLK_PERI:
+   case HCLK_PERI:
+   case PCLK_PERI:
+   return 0;
default:
return -ENOENT;
}



These 3 patches look good, but I don't understand why they aren't squashed in 
with the first patch.

--Sean


Re: [PATCH v7 04/19] rockchip: rk3066: add clock driver for rk3066 soc

2022-01-15 Thread Sean Anderson

On 1/11/22 4:18 PM, Johan Jonker wrote:

From: Paweł Jarosz 

Add clock driver for rk3066 platform.


Can you comment a bit on what you support? For example, it seems like
there are some clocks which are fixed at particular frequencies. Why did
you choose those? Which clocks can be set freely? A comment on the cpu
frequency would be good as well.



Signed-off-by: Paweł Jarosz 
Signed-off-by: Johan Jonker 
---

Changed V7:
   changed function prefix
   changed #if where possible
   restyle U_BOOT_DRIVER structure
---
  .../include/asm/arch-rockchip/cru_rk3066.h| 203 +
  drivers/clk/rockchip/Makefile |   1 +
  drivers/clk/rockchip/clk_rk3066.c | 700 ++
  3 files changed, 904 insertions(+)
  create mode 100644 arch/arm/include/asm/arch-rockchip/cru_rk3066.h
  create mode 100644 drivers/clk/rockchip/clk_rk3066.c

diff --git a/arch/arm/include/asm/arch-rockchip/cru_rk3066.h 
b/arch/arm/include/asm/arch-rockchip/cru_rk3066.h
new file mode 100644
index ..711366d5
--- /dev/null
+++ b/arch/arm/include/asm/arch-rockchip/cru_rk3066.h
@@ -0,0 +1,203 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2021 Paweł Jarosz 
+ */
+
+#ifndef _ASM_ARCH_CRU_RK3066_H
+#define _ASM_ARCH_CRU_RK3066_H
+
+#define OSC_HZ(24 * 1000 * 1000)
+
+#define APLL_HZ(1416 * 100)
+#define APLL_SAFE_HZ(600 * 100)
+#define GPLL_HZ(594 * 100)
+#define CPLL_HZ(384 * 100)
+
+/* The SRAM is clocked off aclk_cpu, so we want to max it out for bootspeed */
+#define CPU_ACLK_HZ29700
+#define CPU_HCLK_HZ14850
+#define CPU_PCLK_HZ7425
+#define CPU_H2P_HZ7425
+
+#define PERI_ACLK_HZ14850
+#define PERI_HCLK_HZ14850
+#define PERI_PCLK_HZ7425
+
+/* Private data for the clock driver - used by rockchip_get_cru() */
+struct rk3066_clk_priv {
+struct rk3066_grf *grf;
+struct rk3066_cru *cru;
+ulong rate;
+bool has_bwadj;
+};
+
+struct rk3066_cru {
+struct rk3066_pll {
+u32 con0;
+u32 con1;
+u32 con2;
+u32 con3;
+} pll[4];
+u32 cru_mode_con;
+u32 cru_clksel_con[35];
+u32 cru_clkgate_con[10];
+u32 reserved1[2];
+u32 cru_glb_srst_fst_value;
+u32 cru_glb_srst_snd_value;
+u32 reserved2[2];
+u32 cru_softrst_con[9];
+u32 cru_misc_con;
+u32 reserved3[2];
+u32 cru_glb_cnt_th;
+};
+
+check_member(rk3066_cru, cru_glb_cnt_th, 0x0140);
+
+/* CRU_CLKSEL0_CON */
+enum {
+/* a9_core_div: core = core_src / (a9_core_div + 1) */
+A9_CORE_DIV_SHIFT= 9,
+A9_CORE_DIV_MASK= 0x1f << A9_CORE_DIV_SHIFT,
+CORE_PLL_SHIFT= 8,
+CORE_PLL_MASK= 1 << CORE_PLL_SHIFT,
+CORE_PLL_SELECT_APLL= 0,
+CORE_PLL_SELECT_GPLL,


Can you use GENMASK for this? e.g.

A9_CORE_DIV_MASK = GENMASK(13, 9),

this will make it easier to see which bits are being used. You can also
do e.g.

A9_CODE_DIV_SHIFT = __bf_shf(A9_CORE_DIV_MASK),

which could of course be combined to something like

#define REG(name, h, l) \
name##_MASK = GENMASK(h, l), \
name##_SHIFT = __bf_shf(name##_MASK)

if you so desire


+/* core peri div: core:core_peri = 2:1, 4:1, 8:1 or 16:1 */
+CORE_PERI_DIV_SHIFT= 6,
+CORE_PERI_DIV_MASK= 3 << CORE_PERI_DIV_SHIFT,
+
+/* aclk_cpu pll selection */
+CPU_ACLK_PLL_SHIFT= 5,
+CPU_ACLK_PLL_MASK= 1 << CPU_ACLK_PLL_SHIFT,
+CPU_ACLK_PLL_SELECT_APLL= 0,
+CPU_ACLK_PLL_SELECT_GPLL,
+
+/* a9_cpu_div: aclk_cpu = cpu_src / (a9_cpu_div + 1) */
+A9_CPU_DIV_SHIFT= 0,
+A9_CPU_DIV_MASK= 0x1f << A9_CPU_DIV_SHIFT,
+};
+
+/* CRU_CLKSEL1_CON */
+enum {
+/* ahb2apb_pclk_div: hclk_cpu:pclk_cpu = 1:1, 2:1 or 4:1 */
+AHB2APB_DIV_SHIFT= 14,
+AHB2APB_DIV_MASK= 3 << AHB2APB_DIV_SHIFT,
+
+/* cpu_pclk_div: aclk_cpu:pclk_cpu = 1:1, 2:1, 4:1 or 8:1 */
+CPU_PCLK_DIV_SHIFT= 12,
+CPU_PCLK_DIV_MASK= 3 << CPU_PCLK_DIV_SHIFT,
+
+/* cpu_hclk_div: aclk_cpu:hclk_cpu = 1:1, 2:1 or 4:1 */
+CPU_HCLK_DIV_SHIFT= 8,
+CPU_HCLK_DIV_MASK= 3 << CPU_HCLK_DIV_SHIFT,
+
+/* core_aclk_div: cire:aclk_core = 1:1, 2:1, 3:1, 4:1 or 8:1 */
+CORE_ACLK_DIV_SHIFT= 3,
+CORE_ACLK_DIV_MASK= 7 << CORE_ACLK_DIV_SHIFT,
+};
+
+/* CRU_CLKSEL10_CON */
+enum {
+PERI_SEL_PLL_SHIFT= 15,
+PERI_SEL_PLL_MASK= 1 << PERI_SEL_PLL_SHIFT,
+PERI_SEL_CPLL= 0,
+PERI_SEL_GPLL,
+
+/* peri pclk div: aclk_bus:pclk_bus = 1:1, 2:1, 4:1 or 8:1 */
+PERI_PCLK_DIV_SHIFT= 12,
+PERI_PCLK_DIV_MASK= 3 << PERI_PCLK_DIV_SHIFT,
+
+/* peripheral bus hclk div:aclk_bus: hclk_bus = 1:1, 2:1 or 4:1 */
+PERI_HCLK_DIV_SHIFT= 8,
+PERI_HCLK_DIV_MASK= 3 << PERI_HCLK_DIV_SHIFT,
+
+/* peri aclk div: aclk_peri = periph_src / (peri_aclk_div + 1) */
+PERI_ACLK_DIV_SHIFT= 0,
+PERI_ACLK_DIV_MASK= 0x1f << PERI_ACLK_DIV_SHIFT,
+};
+
+/* 

Re: [PATCH] net: fastboot: make UDP port net: configurable

2022-01-15 Thread Ramon Fried
On Sat, Jan 15, 2022 at 1:58 PM Ramon Fried  wrote:
>
> On Thu, Jan 13, 2022 at 2:02 PM Heiko Schocher  wrote:
> >
> > Hello Christian,
> >
> > On 13.01.22 08:40, Christian Gmeiner wrote:
> > > The fastboot protocol uses per default the UDP port 5554. In some cases
> > > it might be needed to change the used port. The fastboot utility provides
> > > a way to specifiy an other port number to use already.
> > >
> > >   fastboot -s udp:192.168.1.76:1234 boot fastboot.img
> > >
> > > Signed-off-by: Christian Gmeiner 
> > > ---
> > >  drivers/fastboot/Kconfig | 7 +++
> > >  net/fastboot.c   | 5 +
> > >  2 files changed, 8 insertions(+), 4 deletions(-)
> >
> > Reviewed-by: Heiko Schocher 
> >
> > bye,
> > Heiko
> > --
> > DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
> > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> > Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: h...@denx.de
> Reviewed-by: Ramon Fried 
Applied to u-boot-net/next
Thanks !


Re: [PATCH v3] net: fsl: Fix busy flag polling register

2022-01-15 Thread Ramon Fried
On Wed, Jan 12, 2022 at 12:50 PM Camelia Alexandra Groza (OSS)
 wrote:
>
> > -Original Message-
> > From: U-Boot  On Behalf Of Markus Koch
> > Sent: Tuesday, January 11, 2022 20:23
> > To: Camelia Alexandra Groza ;
> > joe.hershber...@ni.com; rfried@gmail.com
> > Cc: Madalin Bucur (OSS) ; Ioana Ciornei
> > ; u-boot@lists.denx.de; Markus Koch
> > 
> > Subject: [PATCH v3] net: fsl: Fix busy flag polling register
> >
> > NXP's mEMAC reference manual, Chapter 6.5.5 "MDIO Ethernet
> > Management
> > Interface usage", specifies to poll the BSY (0) bit in the CFG/STAT
> > register to wait until a transaction has finished, not bit 31 in the
> > data register.
> >
> > In the Linux kernel, this has already been fixed in commit 26eee0210ad7
> > ("net/fsl: fix a bug in xgmac_mdio").
> >
> > This patch changes the register in the fman_mdio and fsl_ls_mdio
> > drivers.
> >
> > As the MDIO_DATA_BSY define is no longer in use, this patch also removes
> > its definition from the fsl_memac header.
> >
> > Signed-off-by: Markus Koch 
> > ---
> > v1->v2:
> >   * Fix register
> > v2->v3:
> >   * Also apply fix to fsl_ls_mdio
> >   * Add note about define-removal in commit message
> >
> > Thanks, Camelia!
>
> Thanks for the patch.
>
> Reviewed-by: Camelia Groza 
>
Applied to u-boot-net/next
Thanks !


Re: [PATCH] net: eth-phy: Demote missing phy-handle log message to debug

2022-01-15 Thread Ramon Fried
On Sun, Jan 2, 2022 at 11:19 AM Ramon Fried  wrote:
>
> On Sat, Jan 1, 2022 at 9:12 PM Marek Vasut  wrote:
> >
> > Reduce the missing phy-handle log message to debug message. It is
> > possible for ethernet DT node to have no phy-handle e.g. in case
> > of a fixed-link connection. Furthermore, drop the FEC: prefix,
> > which is a copy-paste error and rather print the ethernet device
> > name.
> >
> > Signed-off-by: Marek Vasut 
> > Cc: Ramon Fried 
> > ---
> >  drivers/net/eth-phy-uclass.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/eth-phy-uclass.c b/drivers/net/eth-phy-uclass.c
> > index a9b358ee234..1f285f7afd2 100644
> > --- a/drivers/net/eth-phy-uclass.c
> > +++ b/drivers/net/eth-phy-uclass.c
> > @@ -103,7 +103,7 @@ struct mii_dev *eth_phy_get_mdio_bus(struct udevice 
> > *eth_dev)
> > return uc_priv->mdio_bus;
> > }
> > } else {
> > -   log_notice("FEC: can't find phy-handle\n");
> > +   log_debug("Can't find phy-handle for %s\n", eth_dev->name);
> > }
> >
> > return NULL;
> > --
> > 2.34.1
> >
> Reviewed-by: Ramon Fried 
Applied to u-boot-net/next
Thanks !


Re: [PATCH] net: phy: add TI DP83869HM ethernet driver

2022-01-15 Thread Ramon Fried
On Wed, Dec 29, 2021 at 9:26 PM Ramon Fried  wrote:
>
> On Wed, Dec 22, 2021 at 9:58 AM Christian Gmeiner
>  wrote:
> >
> > From: Dominic Rath 
> >
> > This driver is based on an older downstream TI kernel, with
> > changes and cleanups to work with mainline device-tree bindings.
> >
> > Signed-off-by: Dominic Rath 
> > Signed-off-by: Christian Gmeiner 
> > ---
> >  drivers/net/phy/Kconfig  |   6 +
> >  drivers/net/phy/Makefile |   1 +
> >  drivers/net/phy/dp83869.c| 507 +++
> >  drivers/net/phy/ti_phy_init.c|   4 +
> >  drivers/net/phy/ti_phy_init.h|   1 +
> >  include/dt-bindings/net/ti-dp83869.h |  60 
> >  6 files changed, 579 insertions(+)
> >  create mode 100644 drivers/net/phy/dp83869.c
> >  create mode 100644 include/dt-bindings/net/ti-dp83869.h
> >
> > diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
> > index 68ee7d7a2d..c6e58058d9 100644
> > --- a/drivers/net/phy/Kconfig
> > +++ b/drivers/net/phy/Kconfig
> > @@ -290,6 +290,12 @@ config PHY_TI_DP83867
> > ---help---
> >   Adds support for the TI DP83867 1Gbit PHY.
> >
> > +config PHY_TI_DP83869
> > +   select PHY_TI
> > +   bool "Texas Instruments Ethernet DP83869 PHY support"
> > +   ---help---
> > + Adds support for the TI DP83869 1Gbit PHY.
> > +
> >  config PHY_TI_GENERIC
> > select PHY_TI
> > bool "Texas Instruments Generic Ethernet PHYs support"
> > diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
> > index 218b8c7669..77f7f60621 100644
> > --- a/drivers/net/phy/Makefile
> > +++ b/drivers/net/phy/Makefile
> > @@ -29,6 +29,7 @@ obj-$(CONFIG_PHY_SMSC) += smsc.o
> >  obj-$(CONFIG_PHY_TERANETICS) += teranetics.o
> >  obj-$(CONFIG_PHY_TI) += ti_phy_init.o
> >  obj-$(CONFIG_PHY_TI_DP83867) += dp83867.o
> > +obj-$(CONFIG_PHY_TI_DP83869) += dp83869.o
> >  obj-$(CONFIG_PHY_XILINX) += xilinx_phy.o
> >  obj-$(CONFIG_PHY_XILINX_GMII2RGMII) += xilinx_gmii2rgmii.o
> >  obj-$(CONFIG_PHY_VITESSE) += vitesse.o
> > diff --git a/drivers/net/phy/dp83869.c b/drivers/net/phy/dp83869.c
> > new file mode 100644
> > index 00..c9461185cf
> > --- /dev/null
> > +++ b/drivers/net/phy/dp83869.c
> > @@ -0,0 +1,507 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/*
> > + * TI PHY drivers
> > + *
> > + */
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +#include 
> > +#include 
> > +
> > +/* TI DP83869 */
> > +#define DP83869_DEVADDR0x1f
> > +
> > +#define MII_DP83869_PHYCTRL0x10
> > +#define MII_DP83869_MICR   0x12
> > +#define MII_DP83869_CFG2   0x14
> > +#define MII_DP83869_BISCR  0x16
> > +#define DP83869_CTRL   0x1f
> > +#define DP83869_CFG4   0x1e
> > +
> > +/* Extended Registers */
> > +#define DP83869_GEN_CFG3   0x0031
> > +#define DP83869_RGMIICTL   0x0032
> > +#define DP83869_STRAP_STS1 0x006E
> > +#define DP83869_RGMIIDCTL  0x0086
> > +#define DP83869_IO_MUX_CFG 0x0170
> > +#define DP83869_OP_MODE0x01df
> > +#define DP83869_FX_CTRL0x0c00
> > +
> > +#define DP83869_SW_RESET   BIT(15)
> > +#define DP83869_SW_RESTART BIT(14)
> > +
> > +/* MICR Interrupt bits */
> > +#define MII_DP83869_MICR_AN_ERR_INT_EN BIT(15)
> > +#define MII_DP83869_MICR_SPEED_CHNG_INT_EN BIT(14)
> > +#define MII_DP83869_MICR_DUP_MODE_CHNG_INT_EN  BIT(13)
> > +#define MII_DP83869_MICR_PAGE_RXD_INT_EN   BIT(12)
> > +#define MII_DP83869_MICR_AUTONEG_COMP_INT_EN   BIT(11)
> > +#define MII_DP83869_MICR_LINK_STS_CHNG_INT_EN  BIT(10)
> > +#define MII_DP83869_MICR_FALSE_CARRIER_INT_EN  BIT(8)
> > +#define MII_DP83869_MICR_SLEEP_MODE_CHNG_INT_ENBIT(4)
> > +#define MII_DP83869_MICR_WOL_INT_ENBIT(3)
> > +#define MII_DP83869_MICR_XGMII_ERR_INT_EN  BIT(2)
> > +#define MII_DP83869_MICR_POL_CHNG_INT_EN   BIT(1)
> > +#define MII_DP83869_MICR_JABBER_INT_EN BIT(0)
> > +
> > +#define MII_DP83869_BMCR_DEFAULT   (BMCR_ANENABLE | \
> > +BMCR_FULLDPLX | \
> > +BMCR_SPEED1000)
> > +
> > +/* This is the same bit mask as the BMCR so re-use the BMCR default */
> > +#define DP83869_FX_CTRL_DEFAULT MII_DP83869_BMCR_DEFAULT
> > +
> > +/* CFG1 bits */
> > +#define DP83869_CFG1_DEFAULT   (ADVERTISE_1000HALF | \
> > +ADVERTISE_1000FULL | \
> > +CTL1000_AS_MASTER)
> > +
> > +/* RGMIICTL bits */
> > +#define DP83869_RGMII_TX_CLK_DELAY_EN  BIT(1)
> > +#define DP83869_RGMII_RX_CLK_DELAY_EN  BIT(0)
> > +
> > +/* STRAP_STS1 bits */
> > +#define DP83869_STRAP_OP_MODE_MASK GENMASK(2, 0)
> > +#define DP83869_STRAP_STS1_RESERVEDBIT(11)
> > +#define DP83869_STRAP_MIRROR_ENABLED   BIT(12)
> > +
> > +/* PHY CTRL bits */
> 

Re: [PATCH 2/2] net: dsa: sja1105: fix device id detection

2022-01-15 Thread Ramon Fried
On Sat, Jan 15, 2022 at 6:48 PM Ramon Fried  wrote:
>
> On Sun, Dec 5, 2021 at 1:01 AM Vladimir Oltean  
> wrote:
> >
> > The sja1105_check_device_id() function contains logic to work without
> > changing the device tree on reworked boards, one of which I have (the
> > NXP LS1021A-TSN normally has a SJA1105T, but I have a version with a
> > resoldered SJA1105Q which is pin compatible). This logic is taken from
> > the Linux driver.
> >
> > However this logic gets shortcircuited in U-Boot by an earlier check for
> > the exact device ID specified in the device tree. So the reworked board
> > does not probe the SJA1105Q switch. Remove this duplicated logic and let
> > the automatic device ID detection do its job.
> >
> > Fixes: f24b666b2204 ("net: dsa: add driver for NXP SJA1105 L2 switch")
> > Signed-off-by: Vladimir Oltean 
> > ---
> >  drivers/net/sja1105.c | 6 --
> >  1 file changed, 6 deletions(-)
> >
> > diff --git a/drivers/net/sja1105.c b/drivers/net/sja1105.c
> > index 17bab33eddb7..4ca8709e347c 100644
> > --- a/drivers/net/sja1105.c
> > +++ b/drivers/net/sja1105.c
> > @@ -3276,12 +3276,6 @@ static int sja1105_check_device_id(struct 
> > sja1105_private *priv)
> > sja1105_packing(packed_buf, _id, 31, 0, 
> > SJA1105_SIZE_DEVICE_ID,
> > UNPACK);
> >
> > -   if (device_id != priv->info->device_id) {
> > -   printf("Expected device ID 0x%llx but read 0x%llx\n",
> > -  priv->info->device_id, device_id);
> > -   return -ENODEV;
> > -   }
> > -
> > rc = sja1105_xfer_buf(priv, SPI_READ, regs->prod_id, packed_buf,
> >   SJA1105_SIZE_DEVICE_ID);
> > if (rc < 0)
> > --
> > 2.25.1
> >
> Reviewed-by: Ramon Fried 
Applied to u-boot-net/next
Thanks !


Re: [PATCH 2/2] net: dsa: sja1105: fix device id detection

2022-01-15 Thread Ramon Fried
On Sun, Dec 5, 2021 at 1:01 AM Vladimir Oltean  wrote:
>
> The sja1105_check_device_id() function contains logic to work without
> changing the device tree on reworked boards, one of which I have (the
> NXP LS1021A-TSN normally has a SJA1105T, but I have a version with a
> resoldered SJA1105Q which is pin compatible). This logic is taken from
> the Linux driver.
>
> However this logic gets shortcircuited in U-Boot by an earlier check for
> the exact device ID specified in the device tree. So the reworked board
> does not probe the SJA1105Q switch. Remove this duplicated logic and let
> the automatic device ID detection do its job.
>
> Fixes: f24b666b2204 ("net: dsa: add driver for NXP SJA1105 L2 switch")
> Signed-off-by: Vladimir Oltean 
> ---
>  drivers/net/sja1105.c | 6 --
>  1 file changed, 6 deletions(-)
>
> diff --git a/drivers/net/sja1105.c b/drivers/net/sja1105.c
> index 17bab33eddb7..4ca8709e347c 100644
> --- a/drivers/net/sja1105.c
> +++ b/drivers/net/sja1105.c
> @@ -3276,12 +3276,6 @@ static int sja1105_check_device_id(struct 
> sja1105_private *priv)
> sja1105_packing(packed_buf, _id, 31, 0, SJA1105_SIZE_DEVICE_ID,
> UNPACK);
>
> -   if (device_id != priv->info->device_id) {
> -   printf("Expected device ID 0x%llx but read 0x%llx\n",
> -  priv->info->device_id, device_id);
> -   return -ENODEV;
> -   }
> -
> rc = sja1105_xfer_buf(priv, SPI_READ, regs->prod_id, packed_buf,
>   SJA1105_SIZE_DEVICE_ID);
> if (rc < 0)
> --
> 2.25.1
>
Reviewed-by: Ramon Fried 


Re: [PATCH 1/2] net: dsa: fix phydev->speed being uninitialized for the CPU port fixed PHY

2022-01-15 Thread Ramon Fried
On Sat, Jan 15, 2022 at 6:46 PM Ramon Fried  wrote:
>
> On Sun, Dec 5, 2021 at 1:01 AM Vladimir Oltean  
> wrote:
> >
> > If the DSA API is going to allow drivers to do things such as:
> >
> > - phy_config in dsa_ops :: port_probe
> > - phy_startup in dsa_ops :: port_enable
> >
> > then it would actually be good if the ->port_probe() method would
> > actually be called in all cases before the ->port_enable() is.
> >
> > Currently this is true for user ports, but not true for the CPU port,
> > because the CPU port does not have a udevice registered for it (this is
> > all part of DSA's design). So the current issue is that after
> > phy_startup has finished for the CPU port, its phydev->speed is an
> > uninitialized value, because phy_config() was never called for the
> > priv->cpu_port_fixed_phy, and it is precisely phy_config() who copies
> > the speed into the phydev in the case of the fixed PHY driver.
> >
> > So we need to simulate a probing event for the CPU port by manually
> > calling the driver's ->port_probe() method for the CPU port.
> >
> > Fixes: 8a2982574854 ("net: dsa: introduce a .port_probe() method in struct 
> > dsa_ops")
> > Signed-off-by: Vladimir Oltean 
> > ---
> >  net/dsa-uclass.c | 11 +++
> >  1 file changed, 11 insertions(+)
> >
> > diff --git a/net/dsa-uclass.c b/net/dsa-uclass.c
> > index 606b1539a776..9ff55a02fb23 100644
> > --- a/net/dsa-uclass.c
> > +++ b/net/dsa-uclass.c
> > @@ -466,6 +466,8 @@ static int dsa_pre_probe(struct udevice *dev)
> >  {
> > struct dsa_pdata *pdata = dev_get_uclass_plat(dev);
> > struct dsa_priv *priv = dev_get_uclass_priv(dev);
> > +   struct dsa_ops *ops = dsa_get_ops(dev);
> > +   int err;
> >
> > priv->num_ports = pdata->num_ports;
> > priv->cpu_port = pdata->cpu_port;
> > @@ -477,6 +479,15 @@ static int dsa_pre_probe(struct udevice *dev)
> >
> > uclass_find_device_by_ofnode(UCLASS_ETH, pdata->master_node,
> >  >master_dev);
> > +
> > +   /* Simulate a probing event for the CPU port */
> > +   if (ops->port_probe) {
> > +   err = ops->port_probe(dev, priv->cpu_port,
> > + priv->cpu_port_fixed_phy);
> > +   if (err)
> > +   return err;
> > +   }
> > +
> > return 0;
> >  }
> >
> > --
> > 2.25.1
> >
> Reviewed-by: Ramon Fried 
Applied to u-boot-net/next,
Thanks !


Re: [PATCH 1/2] net: dsa: fix phydev->speed being uninitialized for the CPU port fixed PHY

2022-01-15 Thread Ramon Fried
On Sun, Dec 5, 2021 at 1:01 AM Vladimir Oltean  wrote:
>
> If the DSA API is going to allow drivers to do things such as:
>
> - phy_config in dsa_ops :: port_probe
> - phy_startup in dsa_ops :: port_enable
>
> then it would actually be good if the ->port_probe() method would
> actually be called in all cases before the ->port_enable() is.
>
> Currently this is true for user ports, but not true for the CPU port,
> because the CPU port does not have a udevice registered for it (this is
> all part of DSA's design). So the current issue is that after
> phy_startup has finished for the CPU port, its phydev->speed is an
> uninitialized value, because phy_config() was never called for the
> priv->cpu_port_fixed_phy, and it is precisely phy_config() who copies
> the speed into the phydev in the case of the fixed PHY driver.
>
> So we need to simulate a probing event for the CPU port by manually
> calling the driver's ->port_probe() method for the CPU port.
>
> Fixes: 8a2982574854 ("net: dsa: introduce a .port_probe() method in struct 
> dsa_ops")
> Signed-off-by: Vladimir Oltean 
> ---
>  net/dsa-uclass.c | 11 +++
>  1 file changed, 11 insertions(+)
>
> diff --git a/net/dsa-uclass.c b/net/dsa-uclass.c
> index 606b1539a776..9ff55a02fb23 100644
> --- a/net/dsa-uclass.c
> +++ b/net/dsa-uclass.c
> @@ -466,6 +466,8 @@ static int dsa_pre_probe(struct udevice *dev)
>  {
> struct dsa_pdata *pdata = dev_get_uclass_plat(dev);
> struct dsa_priv *priv = dev_get_uclass_priv(dev);
> +   struct dsa_ops *ops = dsa_get_ops(dev);
> +   int err;
>
> priv->num_ports = pdata->num_ports;
> priv->cpu_port = pdata->cpu_port;
> @@ -477,6 +479,15 @@ static int dsa_pre_probe(struct udevice *dev)
>
> uclass_find_device_by_ofnode(UCLASS_ETH, pdata->master_node,
>  >master_dev);
> +
> +   /* Simulate a probing event for the CPU port */
> +   if (ops->port_probe) {
> +   err = ops->port_probe(dev, priv->cpu_port,
> + priv->cpu_port_fixed_phy);
> +   if (err)
> +   return err;
> +   }
> +
> return 0;
>  }
>
> --
> 2.25.1
>
Reviewed-by: Ramon Fried 


Re: [PATCH v2] cmd: pxe_utils: sysboot: add label override support

2022-01-15 Thread Ramon Fried
On Tue, Dec 14, 2021 at 11:11 AM Ramon Fried  wrote:
>
> On Mon, Dec 13, 2021 at 1:27 PM Art Nikpal  wrote:
> >
> > On Sat, Nov 13, 2021 at 9:09 PM Amjad Ouled-Ameur
> >  wrote:
> > >
> > > This will allow consumers to choose a pxe label at runtime instead of
> > > having to prompt the user. One good use-case for this, is choosing
> > > whether or not to apply a dtbo depending on the hardware configuration.
> > > e.g: for TI's AM335x EVM, it would be convenient to apply a particular
> > > dtbo only when the J9 jumper is on PRUSS mode. To achieve this, the
> > > pxe menu should have 2 labels, one with the dtbo and the other without,
> > > then the "pxe_label_override" env variable should point to the label with
> > > the dtbo at runtime only when the jumper is on PRUSS mode.
> > >
> > > This change can be used for different use-cases and bring more
> > > flexibilty to consumers who use sysboot/pxe_utils.
> > >
> > > if "pxe_label_override" is set but does not exist in the pxe menu,
> > > the code should fallback to the default label if given, and no failure
> > > is returned but rather a warning message.
> > >
> > >
> > > Signed-off-by: Amjad Ouled-Ameur 
> >
> > Reviewed-by: Artem Lapkin 
> >
> > Good and useful idea! why still not accepted ?!
> >
> > Regards,
> > Art
> Was mistakenly assigned to trini instead of me. I will pull in to my tree.
> Thanks.
> Ramon
Applied to u-boot-net/next
Thanks.


Re: [PATCH] Revert "net: gem: Disable broadcast setting"

2022-01-15 Thread Ramon Fried
On Fri, Jan 14, 2022 at 2:15 PM Michal Simek  wrote:
>
> This reverts commit eafdcda4a854932c0319656de7bf3f017f17ae67.
>
> The main reason is that QEMU is using BOOTP protocol which is sending DHCP
> Offer to a broadcast address that's why it can't be disabled.
> DHCP protocol has no issue because it returns directly to client MAC
> address.
> Both of these options are described in RFC951
> (https://datatracker.ietf.org/doc/html/rfc951#section-4)
>
> Signed-off-by: Michal Simek 
> ---
>
>  drivers/net/zynq_gem.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
> index f238811786c6..3118d1472669 100644
> --- a/drivers/net/zynq_gem.c
> +++ b/drivers/net/zynq_gem.c
> @@ -62,7 +62,6 @@
>  #define ZYNQ_GEM_NWCFG_SPEED1000x0001 /* 100 Mbps 
> operation */
>  #define ZYNQ_GEM_NWCFG_SPEED1000   0x0400 /* 1Gbps operation */
>  #define ZYNQ_GEM_NWCFG_FDEN0x0002 /* Full Duplex mode */
> -#define ZYNQ_GEM_NWCFG_NO_BRDC BIT(5) /* No broadcast */
>  #define ZYNQ_GEM_NWCFG_FSREM   0x0002 /* FCS removal */
>  #define ZYNQ_GEM_NWCFG_SGMII_ENBL  0x0800 /* SGMII Enable */
>  #define ZYNQ_GEM_NWCFG_PCS_SEL 0x0800 /* PCS select */
> @@ -80,7 +79,6 @@
>
>  #define ZYNQ_GEM_NWCFG_INIT(ZYNQ_GEM_DBUS_WIDTH | \
> ZYNQ_GEM_NWCFG_FDEN | \
> -   ZYNQ_GEM_NWCFG_NO_BRDC | \
> ZYNQ_GEM_NWCFG_FSREM | \
> ZYNQ_GEM_NWCFG_MDCCLKDIV)
>
> --
> 2.34.1
>
Reviewed-by: Ramon Fried 


Re: [PATCH] net: gem: Workaround gmii2rgmii bridge DT node issue

2022-01-15 Thread Ramon Fried
On Fri, Jan 14, 2022 at 2:08 PM Michal Simek  wrote:
>
> From: Ashok Reddy Soma 
>
> For configurations with gmii2rgmii and external phy the DT nodes link
> should be gem->gmii2rgmii->phy. But due to limitation in Linux driver
> the DT is mentioned as gem->phy and gmii2rgmii->phy as shown in below DT.
>
> ethernet@ff0c {
> compatible = "cdns,zynqmp-gem\0cdns,gem";
> status = "okay";
> interrupt-parent = <0x04>;
> interrupts = <0x00 0x3b 0x04 0x00 0x3b 0x04>;
> reg = <0x00 0xff0c 0x00 0x1000>;
> clock-names = "pclk\0hclk\0tx_clk\0rx_clk\0tsu_clk";
> #address-cells = <0x01>;
> #size-cells = <0x00>;
> #stream-id-cells = <0x01>;
> iommus = <0x0d 0x875>;
> power-domains = <0x0c 0x1e>;
> clocks = <0x03 0x1f 0x03 0x69 0x03 0x2e 0x03 0x32 0x03 0x2c>;
> phy-handle = <0x0e>;
> phy-mode = "gmii";
> xlnx,ptp-enet-clock = <0x00>;
> local-mac-address = [ff ff ff ff ff ff];
> phandle = <0x4d>;
>
> mdio {
> #address-cells = <0x01>;
> #size-cells = <0x00>;
> phandle = <0x4e>;
>
> ethernet-phy@1 {
> reg = <0x01>;
> rxc-skew-ps = <0x708>;
> txc-skew-ps = <0x708>;
> phandle = <0x0e>;
> };
>
> gmii_to_rgmii_0@8 {
> compatible = "xlnx,gmii-to-rgmii-1.0";
> phy-handle = <0x0e>;
> reg = <0x08>;
> phandle = <0x4f>;
> };
> };
> };
>
> Since same DT is used in Linux and U-Boot we need to workaround this
> issue by using the gmii2rgmii node which points to phy and we should
> ignore the gem pointing to phy directly.
>
> Do this workaround by updating priv->phydev->node value with
> priv->phy_of_node only if it is not valid node.
>
> Signed-off-by: Ashok Reddy Soma 
> Signed-off-by: Michal Simek 
> ---
>
>  drivers/net/zynq_gem.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
> index b751d28e611f..f238811786c6 100644
> --- a/drivers/net/zynq_gem.c
> +++ b/drivers/net/zynq_gem.c
> @@ -338,7 +338,8 @@ static int zynq_phy_init(struct udevice *dev)
>   ADVERTISED_Asym_Pause;
>
> priv->phydev->advertising = priv->phydev->supported;
> -   priv->phydev->node = priv->phy_of_node;
> +   if (!ofnode_valid(priv->phydev->node))
> +   priv->phydev->node = priv->phy_of_node;
>
> return phy_config(priv->phydev);
>  }
> --
> 2.34.1
>
Reviewed-by: Ramon Fried 


Re: [PATCH v3 2/3] kconfig: Add support for conditional values

2022-01-15 Thread Simon Glass
+U-Boot Mailing List to update patchwork so 'patman status' works

On Fri, 14 Jan 2022 at 21:52, Rasmus Villemoes
 wrote:
>
> (Sorry for formatting, on phone)
>
> At present if an optional Kconfig value needs to be used it must be
> bracketed by #ifdef. For example, with this Kconfig setup:
>
> config WIBBLE
> bool "Support wibbles, the world needs more wibbles"
>
> config WIBBLE_ADDR
> hex "Address of the wibble"
> depends on WIBBLE
>
> then the following code must be used:
>
>  #ifdef CONFIG_WIBBLE
>  static void handle_wibble(void)
>  {
>  int val = CONFIG_WIBBLE_ADDR;
>
> ...
>  }
>  #endif
>
>  static void init_machine()
>  {
>  ...
>  #ifdef CONFIG_WIBBLE
> handle_wibble();
>  #endif
>  }
>
> Add a new IF_ENABLED_INT() to help with this. So now it is possible to
> write, without #ifdefs:
>
>  static void handle_wibble(void)
>  {
> int val = IF_ENABLED_INT(CONFIG_WIBBLE, CONFIG_WIBBLE_ADDR);
>
> ...
>  }
>
>  static void init_machine()
>  {
>  ...
>  if (IS_ENABLED(CONFIG_WIBBLE))
> handle_wibble();
>  }
>
> The value will be 0 if CONFIG_WIBBLE is not defined, and
> CONFIG_WIBBLE_ADDR if it is.
>
This is stale, please update.
>
>
> This allows us
> +/* Evaluates to 0 if option is not defined, int_option if it is defined */
>

Stale.
>
> +#define IF_ENABLED_INT(option, int_option) \
> +   config_opt_enabled(option, int_option, 
> invalid_use_of_IF_ENABLED_INT())
> +#endif
> +
>

Should we add a three-arg form of IS_ENABLED so this can also be a
trivial wrapper?
>
>
>  /*
>   * Count number of arguments to a variadic macro. Currently only need
>   * it for 1, 2 or 3 arguments.
> @@ -113,5 +133,17 @@
>  #define CONFIG_IS_ENABLED(option, ...)  \
>  __concat(__CONFIG_IS_ENABLED_, __count_args(option, ##__VA_ARGS__)) 
> (option, ##__VA_ARGS__)
>
> +#ifndef __ASSEMBLY__
>

Why prevent use from asm? Sure, if it expands to the function call
that gives a syntax error and not a link error, but it will still
serve its purpose. Of course the declaration of the function must be
guarded, but not the macro definition.
>
>
> Rasmus
>


Re: [PATCH] arm:dts:k3-am64-sk: EMIF tool update to 0.8.0 with 1333MTs for lpddr4

2022-01-15 Thread Tom Rini
On Mon, Nov 29, 2021 at 05:34:49PM +0530, Sinthu Raja wrote:

> From: Sinthu Raja 
> 
> EMIF tool for AM64 SK is now updated to 0.8.0 that includes
> * disabled Write DQ training
> * improve CA ODT to 60 ohms
> 
> The lpddr4 enabled with periodic WDQ training is causing periodic 26us
> stall. This makes the SoC stall without doing anything which leads to
> R5 interrupt latency in TCM memory. Due to this periodic training there
> are some outstanding CPU transactions waiting for the lpddr4 to complete.
> 
> Hence, disable the periodic write DQ training during the
> non-initialization stage of lpddr4 which results in an approximate 1us
> stall. Also, update the lpddr4 config to improve CA ODT by 60 ohms
> 
> The rationales are as follows:
> - PI_WDQLVL_EN: 2 Bits register field to support write DQ leveling,
>   disable bit 1 that supports Write DQ during non-initialization to
>   avoid ~26us stall during code execution.
> 
> - MR11_DATA_F1/F2_x register fields value changed to 0x66 that changes
>   the CA ODT from 48ohm to 60ohm to improve the eye margin on CA bus by
>   increasing the signal swing.
> 
> Signed-off-by: James Doublesin 
> Signed-off-by: Sinthu Raja 
> ---
>  arch/arm/dts/k3-am64-sk-lp4-1333MTs.dtsi | 28 

Have all of these updates been pushed to Linux?  Thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 1/1] video: mxsfb: fix pixel clock polarity

2022-01-15 Thread Fabio Estevam
Hi Sébastien,

[Adding Anatolij]

On Fri, Nov 26, 2021 at 1:49 PM Sébastien Szymanski
 wrote:
>
> DISPLAY_FLAGS_PIXDATA_NEGEDGE means the controller drives the data on
> pixel clocks falling edge. That is DOTCLK_POL=0 (default) not 1.
>
> The same change has been made on the Linux's driver:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/gpu/drm/mxsfb?h=v5.16-rc2=53990e416bb7adaa59d045f325a47f31a11b75ee
>
> Signed-off-by: Sébastien Szymanski 

Reviewed-by: Fabio Estevam 


Re: [PATCH] spi: mxc_spi: remove redundant code in spi_xchg_single()

2022-01-15 Thread Fabio Estevam
On Sat, Nov 6, 2021 at 12:11 PM  wrote:
>
> From: Haolin Li 
>
> The value of cnt is overwritten without being used.
>
> Signed-off-by: Haolin Li 

Reviewed-by: Fabio Estevam 


Re: [PATCH 1/1] configs: opos6uldev: update to have screen working at power on

2022-01-15 Thread Fabio Estevam
Hi Sébastien,

On Fri, Nov 26, 2021 at 1:49 PM Sébastien Szymanski
 wrote:
>
> Signed-off-by: Sébastien Szymanski 

Please provide a commit log.

Thanks


Re: [PATCH] ARM: imx6: dh-imx6: Add update_sf script to install U-Boot into SF

2022-01-15 Thread Fabio Estevam
On Sat, Nov 27, 2021 at 11:52 PM Marek Vasut  wrote:
>
> Add script to read U-Boot from SD card and write it to matching
> locations in the SPI NOR, thus making the SPI NOR bootable.
>
> Signed-off-by: Marek Vasut 
> Cc: Christoph Niedermaier 
> Cc: Stefano Babic 

Reviewed-by: Fabio Estevam 


Re: [PATCH v2 0/2] imx8mn-smm-s2/pro: Add iMX8MN BSH SMM S2 boards

2022-01-15 Thread Fabio Estevam
On Mon, Jan 3, 2022 at 6:11 PM Ariel D'Alessandro
 wrote:
>
> Gentle ping. Can we get this merged?

Looks good to me:

Reviewed-by: Fabio Estevam 


Re: [PATCH v2 1/2] imx8m: add regs used by GPMI

2022-01-15 Thread Fabio Estevam
On Tue, Nov 23, 2021 at 2:43 PM Ariel D'Alessandro
 wrote:
>
> From: Michael Trimarchi 
>
> Add regs used by GPMI
>
> Signed-off-by: Michael Trimarchi 
> Signed-off-by: Ariel D'Alessandro 

Reviewed-by: Fabio Estevam 


Re: [PATCH 1/1] imx8mm-cl-iot-gate-optee: add CONFIG_SPL_MMC and CONFIG_SPL_SERIAL

2022-01-15 Thread Fabio Estevam
On Mon, Nov 15, 2021 at 6:44 AM Ying-Chun Liu  wrote:
>
> From: "Ying-Chun Liu (PaulLiu)" 
>
> Previously these two options are called CONFIG_SPL_MMC_SUPPORT
> and CONFIG_SPL_SERIAL_SUPPORT. During the transition they are
> removed by accident. Thus adding them back.
>
> Signed-off-by: Ying-Chun Liu (PaulLiu) 
> Cc: uboot-imx 

Reviewed-by: Fabio Estevam 


Re: [PATCH] ARM: imx8m: support env in fat and ext4

2022-01-15 Thread Fabio Estevam
On Wed, Oct 20, 2021 at 4:16 PM Ricardo Salveti  wrote:
>
> Change boot device logic to also allow environment stored in fat and in
> ext4 when booting from SD or from eMMC.
>
> As the boot device check for SD and for eMMC was depending on
> ENV_IS_IN_MMC being defined, change the ifdef blocks at env_get_location
> to use IS_ENABLED instead for all modes, returning NOWHERE when no valid
> mode is found.
>
> Signed-off-by: Ricardo Salveti 

Reviewed-by: Fabio Estevam 


Re: [PATCH] imx: spl: Fix typo BMODE_EMI -> BMODE_EIM

2022-01-15 Thread Fabio Estevam
On Wed, Dec 1, 2021 at 6:03 AM Harald Seiler  wrote:
>
> The interface for NOR/OneNAND is called "EIM" not "EMI".  Fix this.
>
> Signed-off-by: Harald Seiler 

Reviewed-by: Fabio Estevam 


Re: [PATCH] mx6: Use imx6_src_get_boot_mode() to check boot device

2022-01-15 Thread Fabio Estevam
On Wed, Dec 1, 2021 at 6:11 AM Harald Seiler  wrote:
>
> Use imx6_src_get_boot_mode() instead of manually reading SBMR1.  The
> existing function has proper handling for software overrides of the
> bootdevice which can happen, for example, when booting from an alternate
> source using `bmode`.
>
> Signed-off-by: Harald Seiler 

Reviewed-by: Fabio Estevam 


Re: [PATCH] imx: nandbcb: Fix printf format in write_fcb

2022-01-15 Thread Fabio Estevam
On Wed, Oct 20, 2021 at 6:13 AM Pali Rohár  wrote:
>
> Correct printf format for unsigned long long is %llx and not %llxx.
>
> Signed-off-by: Pali Rohár 

Reviewed-by: Fabio Estevam 


Re: [PATCH] mxs: power: Change sequence of enabling DCDC switches

2022-01-15 Thread Fabio Estevam
On Wed, Oct 13, 2021 at 10:40 AM Lukasz Majewski  wrote:
>
> The imx28 uses following voltage supplies hierarchy:
>
> VDD_5V (VDD_BAT) -> VDDIO -> VDDA -> VDDMEM
>  \-> VDDD
>
> One shall first enable DCDC on the parent source (VDDIO) and then
> follow with its children.
>
> Signed-off-by: Lukasz Majewski 

Reviewed-by: Fabio Estevam 


Re: [PATCH] imx8mm-venice-gw7902: fix M2_RST# gpio pinmux

2022-01-15 Thread Fabio Estevam
On Wed, Oct 6, 2021 at 5:13 PM Tim Harvey  wrote:
>
> Fix the invalid gw7902 M2_RST# gpio pinmux.
>
> Signed-off-by: Tim Harvey 

Reviewed-by: Fabio Estevam 


Re: [PATCH] arm: imx: imx8mq: add support to get values for more clocks

2022-01-15 Thread Fabio Estevam
Hi Heiko,

On Thu, Sep 9, 2021 at 9:59 AM Heiko Thiery  wrote:
>
> Return the root clock values for MXC_CSPI_CLK, MXC_I2C_CLK,
> MXC_UART_CLK and MXC_QSPI_CLK.
>
> At least for the I2C clock the missing support leads to a wrong
> configured I2C frequency. The expected value is 100kHz but the resulting
> value is about 1MHz.
>
> Signed-off-by: Heiko Thiery 

Reviewed-by: Fabio Estevam 


Re: [PATCH] gpio: mxc_gpio: Fix i.MX8M GPIO output status read

2022-01-15 Thread Fabio Estevam
Hi Harm and Ye Li,

On Fri, Aug 13, 2021 at 11:35 AM Harm Berntsen  wrote:
>
> Currently the driver gets value from PSR register, but this register is
> only for input mode. For output mode, it always returns 0, not the value
> we set for output.
>
> This patch changes to use DR register, which returns the DR value for
> output mode, and PSR value for input mode.
>
> This patch is based on code from Ye Li 

Could this issue be fixed by setting the SION bit mode?


Re: [PATCH] lib: Kconfig: fix PHANDLE_CHECK_SEQ position outside of menu

2022-01-15 Thread Tom Rini
On Tue, Jan 04, 2022 at 06:20:19PM +0200, Eugen Hristev wrote:

> CONFIG_PHANDLE_CHECK_SEQ is outside of the menu 'Library routines'
> thus it's invisible in menuconfig and cannot be selected.
> Fix this by moving the 'endmenu' after the PHANDLE_CHECK_SEQ definition
> 
> Fixes: c589132a1d ("fdt: Use phandle to distinguish DT nodes with same name")
> Signed-off-by: Eugen Hristev 
> Reviewed-by: Aswath Govindraju 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] env: fat: Add new lines at the end of print statements

2022-01-15 Thread Tom Rini
On Sun, Jan 02, 2022 at 11:38:35AM +, Peter Robinson wrote:

> Add some new line feeds at the end of print messages to make things
> easier to read on the console. The other env options do this so
> this is just an omission for FAT env.
> 
> Signed-off-by: Peter Robinson 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v3] phy: Track power-on and init counts in uclass

2022-01-15 Thread Tom Rini
On Thu, Dec 30, 2021 at 10:36:51PM +0300, Alper Nebi Yasak wrote:

> On boards using the RK3399 SoC, the USB OHCI and EHCI controllers share
> the same PHY device instance. While these controllers are being stopped
> they both attempt to power-off and deinitialize it, but trying to
> power-off the deinitialized PHY device results in a hang. This usually
> happens just before booting an OS, and can be explicitly triggered by
> running "usb start; usb stop" in the U-Boot shell.
> 
> Implement a uclass-wide counting mechanism for PHY initialization and
> power state change requests, so that we don't power-off/deinitialize a
> PHY instance until all of its users want it done. The Allwinner A10 USB
> PHY driver does this counting in-driver, remove those parts in favour of
> this in-uclass implementation.
> 
> The sandbox PHY operations test needs some changes since the uclass will
> no longer call into the drivers for actions matching its tracked state
> (e.g. powering-off a powered-off PHY). Update that test, and add a new
> one which simulates multiple users of a single PHY.
> 
> The major complication here is that PHY handles aren't deduplicated per
> instance, so the obvious idea of putting the counts in the PHY handles
> don't immediately work. It seems possible to bind a child udevice per
> PHY instance to the PHY provider and deduplicate the handles in each
> child's uclass-private areas, like in the CLK framework. An alternative
> approach could be to use those bound child udevices themselves as the
> PHY handles. Instead, to avoid the architectural changes those would
> require, this patch solves things by dynamically allocating a list of
> structs (one per instance) in the provider's uclass-private area.
> 
> Signed-off-by: Alper Nebi Yasak 
> Reviewed-by: Simon Glass 
> Tested-by: Peter Robinson  - Rock960

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 1/1] ARM: qemu-arm: Fix build fail with boot devices disabled

2022-01-15 Thread Tom Rini
On Wed, Dec 29, 2021 at 02:30:04PM +0100, Piotr Kubik wrote:

> BOOT_TARGET_DEVICES should only be added if the corresponding u-boot
> command is enabled otherwise the build will fail.
> 
> Signed-off-by: Piotr Kubik 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] phy: nop-phy: Enable reset-gpios support

2022-01-15 Thread Tom Rini
On Wed, Dec 22, 2021 at 08:04:30AM -0600, Adam Ford wrote:

> Some usb-nop-xceiv devices use a gpio to put them in and
> out of reset.  Add a reset function to put them into that
> state.  This is similar to how Linux handles the
> usb-nop-xceiv driver.
> 
> Signed-off-by: Adam Ford 
> 
> diff --git a/drivers/phy/nop-phy.c b/drivers/phy/nop-phy.c
> index 9f12ebc062..be993a764f 100644

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] armv8: apple: Disable PSCI reset

2022-01-15 Thread Tom Rini
On Tue, Dec 21, 2021 at 05:31:50PM +0100, Mark Kettenis wrote:

> Apple's ARMv8 cores don't implement EL3 and therefore don't
> provide a PSCI implementation.  So don't attempt to use
> PSCI to reset on machines using Apple SoCs.
> 
> Signed-off-by: Mark Kettenis 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] BRCMNAND: Fix reporting of uncorrectable errors on subpages during page read

2022-01-15 Thread Tom Rini
On Mon, Dec 20, 2021 at 08:15:47PM -0800, Joel Peshkin wrote:

> Previously, a subpage with an uncorrectable error followed by a subpage
> with a correctable error would return an erroneous correctable status.
> 
> Signed-off-by: Joel Peshkin 
> Cc: Simon Glass 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] cmd: adc: Report return value on error

2022-01-15 Thread Tom Rini
On Mon, Dec 20, 2021 at 06:23:45PM -0500, Samuel Dionne-Riel wrote:

> Reporting the return value should always be done on error conditions,
> this way the developer can start debugging issues with more knowledge
> in-hand.
> 
> Signed-off-by: Samuel Dionne-Riel 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] lib: export vsscanf

2022-01-15 Thread Tom Rini
On Mon, Dec 20, 2021 at 06:19:16PM -0500, Samuel Dionne-Riel wrote:

> The function was missing from exports, even though it loooks like the
> intent of the implementation in sscanf.c was to have it exported.
> 
> Signed-off-by: Samuel Dionne-Riel 
> Cc: Simon Glass 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] checkpatch: report ERROR only on disabling of fdt and initrd relocation

2022-01-15 Thread Tom Rini
On Wed, Dec 15, 2021 at 02:23:52PM +0800, Zhiqiang Hou wrote:

> From: Hou Zhiqiang 
> 
> Let the check pass when patches have these patterns in their context.
> 
> Signed-off-by: Hou Zhiqiang 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] nvme: Do not allocate 8kB buffer on stack

2022-01-15 Thread Tom Rini
On Thu, Dec 09, 2021 at 11:06:39AM +0100, Pali Rohár wrote:

> Calling 'nvme scan' followed by 'nvme detail' crashes U-Boot on Turris
> Omnia with the following error:
> 
>   undefined instruction
>   pc : [<0a00>]  lr : [<7ff80bfc>]
>   reloc pc : [<8a8c>]lr : [<00840bfc>]
>   sp : 7fb2b908  ip : 002a fp : 0200
>   r10: 0400  r9 : 7fb2fed0 r8 : e100
>   r7 : 0c00  r6 : 0300 r5 : 0600  r4 : 0100
>   r3 : 7fb30928  r2 : 7fb30928 r1 :   r0 : 
>   Flags: nZCv  IRQs off  FIQs off  Mode SVC_32
>   Code: 0f0fb4f0 0f0fb4f0 0f0fb4f0 0f0fb4f0 (f0f04b0f)
>   Resetting CPU ...
> 
> This happens when nvme_print_info() tries to return to the caller. It
> looks like this error is caused by trying to allocate 8 KiB of memory
> on the stack by the two uses of ALLOC_CACHE_ALIGN_BUFFER().
> 
> Use malloc_cache_aligned() to allocate this memory dynamically instead.
> 
> This fixes 'nvme detail' on Turris Omnia.
> 
> Note that similar change was applied to file drivers/nvme/nvme.c in past by
> commit 2f83481dff9c ("nvme: use page-aligned buffer for identify command").
> 
> Signed-off-by: Pali Rohár 
> Signed-off-by: Marek Behún 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] test: test_lsblk: Mark as sandbox specific

2022-01-15 Thread Tom Rini
On Tue, Nov 30, 2021 at 03:33:53PM +0100, Patrick Delaunay wrote:

> This test checks for output specific to the sandbox blk device
> "sandbox_host_blk", mark it as sandbox specific.
> 
> Signed-off-by: Patrick Delaunay 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v3] pci: Work around PCIe link training failures

2022-01-15 Thread Tom Rini
On Sat, Nov 20, 2021 at 11:03:30PM +, Maciej W. Rozycki wrote:

> Attempt to handle cases with a downstream port of a PCIe switch where
> link training never completes and the link continues switching between 
> speeds indefinitely with the data link layer never reaching the active 
> state.
> 
> It has been observed with a downstream port of the ASMedia ASM2824 Gen 3 
> switch wired to the upstream port of the Pericom PI7C9X2G304 Gen 2 
> switch, using a Delock Riser Card PCI Express x1 > 2 x PCIe x1 device, 
> P/N 41433, wired to a SiFive HiFive Unmatched board.  In this setup the 
> switches are supposed to negotiate the link speed of preferably 5.0GT/s, 
> falling back to 2.5GT/s.
> 
> However the link continues oscillating between the two speeds, at the 
> rate of 34-35 times per second, with link training reported repeatedly 
> active ~84% of the time, e.g.:
> 
> 02:03.0 PCI bridge [0604]: ASMedia Technology Inc. ASM2824 PCIe Gen3 Packet 
> Switch [1b21:2824] (rev 01) (prog-if 00 [Normal decode])
> [...]
>   Bus: primary=02, secondary=05, subordinate=05, sec-latency=0
> [...]
>   Capabilities: [80] Express (v2) Downstream Port (Slot+), MSI 00
> [...]
>   LnkSta: Speed 5GT/s (downgraded), Width x1 (ok)
>   TrErr- Train+ SlotClk+ DLActive- BWMgmt+ ABWMgmt-
> [...]
>   LnkCtl2: Target Link Speed: 8GT/s, EnterCompliance- SpeedDis+, 
> Selectable De-emphasis: -3.5dB
>Transmit Margin: Normal Operating Range, 
> EnterModifiedCompliance- ComplianceSOS-
>Compliance De-emphasis: -6dB
> [...]
> 
> Forcibly limiting the target link speed to 2.5GT/s with the upstream 
> ASM2824 device makes the two switches communicate correctly however:
> 
> 02:03.0 PCI bridge [0604]: ASMedia Technology Inc. ASM2824 PCIe Gen3 Packet 
> Switch [1b21:2824] (rev 01) (prog-if 00 [Normal decode])
> [...]
>   Bus: primary=02, secondary=05, subordinate=09, sec-latency=0
> [...]
>   Capabilities: [80] Express (v2) Downstream Port (Slot+), MSI 00
> [...]
>   LnkSta: Speed 2.5GT/s (downgraded), Width x1 (ok)
>   TrErr- Train- SlotClk+ DLActive+ BWMgmt- ABWMgmt-
> [...]
>   LnkCtl2: Target Link Speed: 2.5GT/s, EnterCompliance- 
> SpeedDis+, Selectable De-emphasis: -3.5dB
>Transmit Margin: Normal Operating Range, 
> EnterModifiedCompliance- ComplianceSOS-
>Compliance De-emphasis: -6dB
> [...]
> 
> and then:
> 
> 05:00.0 PCI bridge [0604]: Pericom Semiconductor PI7C9X2G304 EL/SL PCIe2 
> 3-Port/4-Lane Packet Switch [12d8:2304] (rev 05) (prog-if 00 [Normal decode])
> [...]
>   Bus: primary=05, secondary=06, subordinate=09, sec-latency=0
> [...]
>   Capabilities: [c0] Express (v2) Upstream Port, MSI 00
> [...]
>   LnkSta: Speed 2.5GT/s (downgraded), Width x1 (downgraded)
>   TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
> [...]
>   LnkCtl2: Target Link Speed: 5GT/s, EnterCompliance- SpeedDis-
>Transmit Margin: Normal Operating Range, 
> EnterModifiedCompliance- ComplianceSOS-
>Compliance De-emphasis: -6dB
> [...]
> 
> Make use of this observation then and attempt to detect the inability to 
> negotiate the link speed automatically, and then handle it by hand.  Use 
> the Data Link Layer Link Active status flag as the primary indicator of 
> successful link speed negotiation, but given that the flag is optional 
> by hardware to implement (the ASM2824 does have it though), resort to 
> checking for the mandatory Link Bandwidth Management Status flag showing 
> that the link speed or width has been changed in an attempt to correct 
> unreliable link operation (the ASM2824 does set it too).
> 
> If these checks indicate that link may not operate correctly, then poll 
> the Data Link Layer Link Active status flag along with the Link Training 
> flag for the duration of 200ms to see if the link has stabilised, that 
> is either that the Data Link Layer Link Active status flag has been set 
> or that Link Training has been inactive during at least the second half 
> of the interval.
> 
> If that has indicated failure, restrict the target speed to 2.5GT/s, 
> request a link retrain and check again if the link has stabilised.  If 
> that does not work either, then restore the original speed setting and 
> claim defeat, otherwise we are done.
> 
> NB interestingly enough with the ASM2824 vs PI7C9X2G304 configuration 
> referred above asking the ASM2824 to retrain with a higher target link 
> speed once the 2.5GT/s speed has been negotiated makes the two devices 
> successfully negotiate 5.0GT/s.  Lifting the 2.5GT/s speed restriction 
> would however prevent our workaround from working with an OS that issues 
> a reset and that is unaware of the problem.  This is because the devices 
> would then try to negotiate a higher link speed from scratch and 

Re: [PATCH v4] lib: sparse: Make CHUNK_TYPE_RAW buffer aligned

2022-01-15 Thread Tom Rini
On Tue, Nov 16, 2021 at 09:35:38AM +0800, qianfangui...@qq.com wrote:

> From: qianfan Zhao 
> 
> CHUNK_TYPE_RAW buffer is not aligned, and flash sparse images by
> fastboot will report "Misaligned operation" if DCACHE is enabled.
> 
> Flashing Sparse Image
> CACHE: Misaligned operation at range [8428, 84001028]
> CACHE: Misaligned operation at range [84001034, 84002034]
> CACHE: Misaligned operation at range [8401104c, 8401304c]
> 
> Fix it
> 
> Signed-off-by: qianfan Zhao 
> Reviewed-by: Sean Anderson 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] net: fastboot: make UDP port net: configurable

2022-01-15 Thread Ramon Fried
On Thu, Jan 13, 2022 at 2:02 PM Heiko Schocher  wrote:
>
> Hello Christian,
>
> On 13.01.22 08:40, Christian Gmeiner wrote:
> > The fastboot protocol uses per default the UDP port 5554. In some cases
> > it might be needed to change the used port. The fastboot utility provides
> > a way to specifiy an other port number to use already.
> >
> >   fastboot -s udp:192.168.1.76:1234 boot fastboot.img
> >
> > Signed-off-by: Christian Gmeiner 
> > ---
> >  drivers/fastboot/Kconfig | 7 +++
> >  net/fastboot.c   | 5 +
> >  2 files changed, 8 insertions(+), 4 deletions(-)
>
> Reviewed-by: Heiko Schocher 
>
> bye,
> Heiko
> --
> DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: h...@denx.de
Reviewed-by: Ramon Fried 


Re: [PATCH] pci: pci_mvebu: Add support for Kirkwood PCIe controllers

2022-01-15 Thread Stefan Roese

On 1/13/22 14:28, Pali Rohár wrote:

Kirkwood uses macros KW_DEFADR_PCI_MEM and KW_DEFADR_PCI_IO for base
address of PCIe mappings. Size of PCIe windows is not defined in any macro
yet, so export them in new KW_DEFADR_PCI_MEM_SIZE and KW_DEFADR_PCI_IO_SIZE
macros.

Kirkwood arch code already maps mbus windows for io and mem, so avoid
calling mvebu_mbus_add_window_by_id() function which would try to do
duplicate window mapping.

Kirkwood PCIe controllers already use "marvell,kirkwood-pcie" DT compatible
string, so mark pci_mvebu.c driver as compatible for it.

Signed-off-by: Pali Rohár 


Reviewed-by: Stefan Roese 

Thanks,
Stefan


---
This patch depends on series "mvebu: Move PCIe code from serdes to PCIe driver":
https://patchwork.ozlabs.org/project/uboot/list/?series=277906=*

Tony, could you please test it in Kirwood hardware?
---
  arch/arm/mach-kirkwood/cpu.c  |  4 ++--
  arch/arm/mach-kirkwood/include/mach/cpu.h |  3 +++
  drivers/pci/Kconfig   |  6 +++---
  drivers/pci/pci_mvebu.c   | 16 
  4 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-kirkwood/cpu.c b/arch/arm/mach-kirkwood/cpu.c
index e9571298a824..80f893ab369a 100644
--- a/arch/arm/mach-kirkwood/cpu.c
+++ b/arch/arm/mach-kirkwood/cpu.c
@@ -54,11 +54,11 @@ unsigned int kw_winctrl_calcsize(unsigned int sizeval)
  
  static struct mbus_win windows[] = {

/* Window 0: PCIE MEM address space */
-   { KW_DEFADR_PCI_MEM, 1024 * 1024 * 256,
+   { KW_DEFADR_PCI_MEM, KW_DEFADR_PCI_MEM_SIZE,
  KWCPU_TARGET_PCIE, KWCPU_ATTR_PCIE_MEM },
  
  	/* Window 1: PCIE IO address space */

-   { KW_DEFADR_PCI_IO, 1024 * 64,
+   { KW_DEFADR_PCI_IO, KW_DEFADR_PCI_IO_SIZE,
  KWCPU_TARGET_PCIE, KWCPU_ATTR_PCIE_IO },
  
  	/* Window 2: NAND Flash address space */

diff --git a/arch/arm/mach-kirkwood/include/mach/cpu.h 
b/arch/arm/mach-kirkwood/include/mach/cpu.h
index ea42182cf9c6..71c546f9acf6 100644
--- a/arch/arm/mach-kirkwood/include/mach/cpu.h
+++ b/arch/arm/mach-kirkwood/include/mach/cpu.h
@@ -68,6 +68,9 @@ enum kwcpu_attrib {
  #define KW_DEFADR_SPIF0xE800
  #define KW_DEFADR_BOOTROM 0xF800
  
+#define KW_DEFADR_PCI_MEM_SIZE	(1024 * 1024 * 256)

+#define KW_DEFADR_PCI_IO_SIZE  (1024 * 64)
+
  struct mbus_win {
u32 base;
u32 size;
diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig
index 630d6e6cc5ee..69141344c869 100644
--- a/drivers/pci/Kconfig
+++ b/drivers/pci/Kconfig
@@ -262,13 +262,13 @@ config PCIE_IPROC
  Say Y here if you want to enable Broadcom iProc PCIe controller,
  
  config PCI_MVEBU

-   bool "Enable Armada XP/38x PCIe driver"
-   depends on ARCH_MVEBU
+   bool "Enable Kirkwood / Armada 370/XP/375/38x PCIe driver"
+   depends on (ARCH_KIRKWOOD || ARCH_MVEBU)
select MISC
select DM_RESET
help
  Say Y here if you want to enable PCIe controller support on
- Armada XP/38x SoCs.
+ Kirkwood and Armada 370/XP/375/38x SoCs.
  
  config PCIE_DW_COMMON

bool
diff --git a/drivers/pci/pci_mvebu.c b/drivers/pci/pci_mvebu.c
index b3ea034a2847..d99a99bae940 100644
--- a/drivers/pci/pci_mvebu.c
+++ b/drivers/pci/pci_mvebu.c
@@ -498,6 +498,13 @@ static int mvebu_pcie_probe(struct udevice *dev)
mvebu_pcie_set_local_bus_nr(pcie, 0);
mvebu_pcie_set_local_dev_nr(pcie, 1);
  
+	/*

+* Kirkwood arch code already maps mbus windows for PCIe IO and MEM.
+* So skip calling mvebu_mbus_add_window_by_id() function as it would
+* fail on error "conflicts with another window" which means conflict
+* with existing PCIe window mappings.
+*/
+#ifndef CONFIG_ARCH_KIRKWOOD
if (resource_size(>mem) &&
mvebu_mbus_add_window_by_id(pcie->mem_target, pcie->mem_attr,
(phys_addr_t)pcie->mem.start,
@@ -519,6 +526,7 @@ static int mvebu_pcie_probe(struct udevice *dev)
pcie->io.start = 0;
pcie->io.end = -1;
}
+#endif
  
  	/* Setup windows and configure host bridge */

mvebu_pcie_setup_wins(pcie);
@@ -725,10 +733,17 @@ static int mvebu_pcie_bind(struct udevice *parent)
}
ports_count = 0;
  
+#ifdef CONFIG_ARCH_KIRKWOOD

+   mem.start = KW_DEFADR_PCI_MEM;
+   mem.end = KW_DEFADR_PCI_MEM + KW_DEFADR_PCI_MEM_SIZE - 1;
+   io.start = KW_DEFADR_PCI_IO;
+   io.end = KW_DEFADR_PCI_IO + KW_DEFADR_PCI_IO_SIZE - 1;
+#else
mem.start = MBUS_PCI_MEM_BASE;
mem.end = MBUS_PCI_MEM_BASE + MBUS_PCI_MEM_SIZE - 1;
io.start = MBUS_PCI_IO_BASE;
io.end = MBUS_PCI_IO_BASE + MBUS_PCI_IO_SIZE - 1;
+#endif
  
  	/* First phase: Fill mvebu_pcie struct for each port */

ofnode_for_each_subnode(subnode, dev_ofnode(parent)) {
@@ -809,6 +824,7 @@ static int mvebu_pcie_bind(struct udevice *parent)
  static const struct udevice_id 

Re: [PATCH v2] tools: mkimage: Call verify_header after writing image to disk

2022-01-15 Thread Stefan Roese

On 1/14/22 18:34, Pali Rohár wrote:

If image backend provides verify_header callback then call it after writing
image to disk. This ensures that written image is correct.

Signed-off-by: Pali Rohár 


Reviewed-by: Stefan Roese 

Thanks,
Stefan


---
  tools/mkimage.c | 41 +
  1 file changed, 41 insertions(+)

diff --git a/tools/mkimage.c b/tools/mkimage.c
index fbe883ce3620..d5ad0925225c 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -336,6 +336,44 @@ static void process_args(int argc, char **argv)
usage("Missing output filename");
  }
  
+static void verify_image(const struct image_type_params *tparams)

+{
+   struct stat sbuf;
+   void *ptr;
+   int ifd;
+
+   ifd = open(params.imagefile, O_RDONLY | O_BINARY);
+   if (ifd < 0) {
+   fprintf(stderr, "%s: Can't open %s: %s\n",
+   params.cmdname, params.imagefile,
+   strerror(errno));
+   exit(EXIT_FAILURE);
+   }
+
+   if (fstat(ifd, ) < 0) {
+   fprintf(stderr, "%s: Can't stat %s: %s\n",
+   params.cmdname, params.imagefile, strerror(errno));
+   exit(EXIT_FAILURE);
+   }
+   params.file_size = sbuf.st_size;
+
+   ptr = mmap(0, params.file_size, PROT_READ, MAP_SHARED, ifd, 0);
+   if (ptr == MAP_FAILED) {
+   fprintf(stderr, "%s: Can't map %s: %s\n",
+   params.cmdname, params.imagefile, strerror(errno));
+   exit(EXIT_FAILURE);
+   }
+
+   if (tparams->verify_header((unsigned char *)ptr, params.file_size, 
) != 0) {
+   fprintf(stderr, "%s: Failed to verify header of %s\n",
+   params.cmdname, params.imagefile);
+   exit(EXIT_FAILURE);
+   }
+
+   (void)munmap(ptr, params.file_size);
+   (void)close(ifd);
+}
+
  int main(int argc, char **argv)
  {
int ifd = -1;
@@ -698,6 +736,9 @@ int main(int argc, char **argv)
exit (EXIT_FAILURE);
}
  
+	if (tparams->verify_header)

+   verify_image(tparams);
+
exit (EXIT_SUCCESS);
  }
  



Viele Grüße,
Stefan Roese

--
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: s...@denx.de


Re: [PATCH v9 9/9] efi: Tidy up some comments in efi header

2022-01-15 Thread Heinrich Schuchardt

On 1/4/22 11:51, Simon Glass wrote:

Document the return value in efi_init(). Fix up @sizep in efi_info_get().
Use Return: instead of @return

Signed-off-by: Simon Glass
---


Reviewed-by: Heinrich Schuchardt 


Re: [PATCH 8/9] doc: add include/dm/of*.h to the HTML documentation

2022-01-15 Thread Heinrich Schuchardt

On 1/12/22 10:53, Patrick Delaunay wrote:

Correct Sphinx style comments in include/dm/ofnode.h
and add the device tree node API to the HTML documentation;
the ofnode functions are compatible with Live tree or with flat
device tree.

Signed-off-by: Patrick Delaunay
---


Reviewed-by: Heinrich Schuchardt 


Re: [PATCH 9/9] doc: add include/dm/fdtaddr.h to the HTML documentation

2022-01-15 Thread Heinrich Schuchardt

On 1/12/22 10:55, Patrick Delaunay wrote:

Correct Sphinx style comments in include/dm/fdtaddr.h
and add the devfdt API to the HTML documentation;
these functions are NOT compatible with live tree.

Signed-off-by: Patrick Delaunay


Reviewed-by: Heinrich Schuchardt 


Re: [PATCH 7/9] doc: add include/dm/read.h to the HTML documentation

2022-01-15 Thread Heinrich Schuchardt

On 1/12/22 10:53, Patrick Delaunay wrote:

Correct Sphinx style comments in include/dm/read.h
and add the device read from device tree API to the HTML
documentation.

Signed-off-by: Patrick Delaunay


Reviewed-by: Heinrich Schuchardt 


Re: [PATCH 6/9] doc: add include/dm/devres.h to the HTML documentation

2022-01-15 Thread Heinrich Schuchardt

On 1/12/22 10:53, Patrick Delaunay wrote:

Correct Sphinx style comments in include/dm/devres.h
and add the driver model device resource API, devres_*(),
to the HTML documentation.

Signed-off-by: Patrick Delaunay
---


Reviewed-by: Heinrich Schuchardt 


Re: [PATCH 5/9] doc: add include/dm/device.h to the HTML documentation

2022-01-15 Thread Heinrich Schuchardt

On 1/12/22 10:53, Patrick Delaunay wrote:

Correct Sphinx style comments in include/dm/device.h
and add the driver model device API to the HTML documentation.

Signed-off-by: Patrick Delaunay 
---

  doc/api/dm.rst  |   5 ++
  include/dm/device.h | 209 
  2 files changed, 121 insertions(+), 93 deletions(-)

diff --git a/doc/api/dm.rst b/doc/api/dm.rst
index 6f72b0b620..7a77a91c1f 100644
--- a/doc/api/dm.rst
+++ b/doc/api/dm.rst
@@ -10,3 +10,8 @@ Uclass and Driver
  .. kernel-doc:: include/dm/root.h
  .. kernel-doc:: include/dm/lists.h
  .. kernel-doc:: include/dm/platdata.h
+
+Device
+--
+
+.. kernel-doc:: include/dm/device.h
diff --git a/include/dm/device.h b/include/dm/device.h
index cf785f7ae2..bc8da72b50 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -145,7 +145,7 @@ enum {
   * @uclass_node: Used by uclass to link its devices
   * @child_head: List of children of this device
   * @sibling_node: Next device in list of all devices
- * @flags_: Flags for this device DM_FLAG_... (do not access outside driver
+ * @flags_: Flags for this device `DM_FLAG_...` (do not access outside driver
   *model)
   * @seq_: Allocated sequence number for this device (-1 = none). This is set 
up
   * when the device is bound and is unique within the device's uclass. If the
@@ -193,14 +193,14 @@ struct udevice {
  };

  /**
- * udevice_rt - runtime information set up by U-Boot
+ * struct udevice_rt - runtime information set up by U-Boot
   *
   * This is only used with OF_PLATDATA_RT
   *
   * There is one of these for every udevice in the linker list, indexed by
   * the udevice_info idx value.
   *
- * @flags_: Flags for this device DM_FLAG_... (do not access outside driver
+ * @flags_: Flags for this device `DM_FLAG_...` (do not access outside driver
   *model)
   */
  struct udevice_rt {
@@ -239,7 +239,7 @@ static inline void dev_bic_flags(struct udevice *dev, u32 
bic)
   * dev_ofnode() - get the DT node reference associated with a udevice
   *
   * @dev:  device to check
- * @return reference of the the device's DT node
+ * Return: reference of the device's DT node
   */
  static inline ofnode dev_ofnode(const struct udevice *dev)
  {
@@ -351,7 +351,7 @@ struct udevice_id {
   * @ops: Driver-specific operations. This is typically a list of function
   * pointers defined by the driver, to implement driver functions required by
   * the uclass.
- * @flags: driver flags - see DM_FLAGS_...
+ * @flags: driver flags - see `DM_FLAGS_...`
   * @acpi_ops: Advanced Configuration and Power Interface (ACPI) operations,
   * allowing the device to add things to the ACPI tables passed to Linux
   */
@@ -378,11 +378,24 @@ struct driver {
  #endif
  };

-/* Declare a new U-Boot driver */
+/**
+ * U_BOOT_DRIVER() - Declare a new U-Boot driver
+ * @__name: name of the driver
+ */
  #define U_BOOT_DRIVER(__name) \
ll_entry_declare(struct driver, __name, driver)

-/* Get a pointer to a given driver */
+/**
+ * DM_DRIVER_GET() - Get a pointer to a given driver
+ *
+ * This is useful in code for referencing a driver at build time.
+ * Before this is used, an extern U_BOOT_DRIVER() must have been
+ * declared.
+ *
+ * @__name:Name of the driver. This must be a valid C identifier,
+ * used by the linker_list
+ * Return: struct driver * for the driver
+ */
  #define DM_DRIVER_GET(__name) \
ll_entry_get(struct driver, __name, driver)

@@ -392,60 +405,69 @@ struct driver {
   * This is useful in data structures and code for referencing a driver at
   * build time. Before this is used, an extern U_BOOT_DRIVER() must have been
   * declared.
+ * This is like DM_DRIVER_GET, but without the extra code, so it is suitable
+ * for putting into data structures.
   *
- * For example:
- *
- * extern U_BOOT_DRIVER(sandbox_fixed_clock);
+ * For example: ::
   *
- * struct driver *drvs[] = {
- * DM_DRIVER_REF(sandbox_fixed_clock),
- * };
+ *   extern U_BOOT_DRIVER(sandbox_fixed_clock);
+ *   struct driver *drvs[] = {
+ *   DM_DRIVER_REF(sandbox_fixed_clock),
+ *   };
   *
- * @_name: Name of the driver. This must be a valid C identifier, used by the
- * linker_list
- * @returns struct driver * for the driver
+ * @_name: Name of the driver. This must be a valid C identifier,
+ * used by the linker_list
+ * Return: struct driver * for the driver
   */
  #define DM_DRIVER_REF(_name)  \
ll_entry_ref(struct driver, _name, driver)

  /**
- * Declare a macro to state a alias for a driver name. This macro will


nits:
%s/a alias/an alias/


- * produce no code but its information will be parsed by tools like
- * dtoc
+ * DM_DRIVER_ALIAS() - Declare a macro to state a alias for a driver name
+ *
+ * This macro will produce no code but its information will be parsed by tools
+ * like dtoc
+ *
+ * @__name:name of driver
+ * 

Re: [PATCH 2/9] doc: add include/dm/root.h to the HTML documentation

2022-01-15 Thread Heinrich Schuchardt

On 1/12/22 10:53, Patrick Delaunay wrote:

Correct Sphinx style comments in include/dm/devres.h
and add the associated driver model API to the HTML documentation.

Signed-off-by: Patrick Delaunay 


Reviewed-by: Heinrich Schuchardt 


Re: [PATCH 1/9] doc: add include/dm/uclass.h to the HTML documentation

2022-01-15 Thread Heinrich Schuchardt

On 1/12/22 10:53, Patrick Delaunay wrote:

Correct Sphinx style comments in include/dm/uclass.h
and add the driver model UCLASS API to the HTML documentation.

Signed-off-by: Patrick Delaunay 
---

  doc/api/dm.rst  |  9 ++
  doc/api/index.rst   |  1 +
  include/dm/uclass.h | 75 ++---
  3 files changed, 47 insertions(+), 38 deletions(-)
  create mode 100644 doc/api/dm.rst

diff --git a/doc/api/dm.rst b/doc/api/dm.rst
new file mode 100644
index 00..edce25da51
--- /dev/null
+++ b/doc/api/dm.rst
@@ -0,0 +1,9 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+Driver Model
+
+
+Uclass and Driver
+-
+
+.. kernel-doc:: include/dm/uclass.h
diff --git a/doc/api/index.rst b/doc/api/index.rst
index 806c7385a6..3f36174167 100644
--- a/doc/api/index.rst
+++ b/doc/api/index.rst
@@ -7,6 +7,7 @@ U-Boot API documentation
 :maxdepth: 2

 dfu
+   dm
 efi
 getopt
 linker_lists
diff --git a/include/dm/uclass.h b/include/dm/uclass.h
index f1fd2ba246..a12a872d94 100644
--- a/include/dm/uclass.h
+++ b/include/dm/uclass.h
@@ -84,7 +84,7 @@ struct udevice;
   * its children. If non-zero this is the size of this data, to be allocated
   * in the child device's parent_plat pointer. This value is only used as
   * a fallback if this member is 0 in the driver.
- * @flags: Flags for this uclass (DM_UC_...)
+ * @flags: Flags for this uclass ``(DM_UC_...)``
   */
  struct uclass_driver {
const char *name;
@@ -127,17 +127,16 @@ struct uclass_driver {
   * build time. Before this is used, an extern UCLASS_DRIVER() must have been
   * declared.
   *
- * For example:
+ * For example: ::


Nits:
"For example::" has the same effect. I will change this when merging.

Reviewed-by: Heinrich Schuchardt 


   *
- * extern UCLASS_DRIVER(clk);
- *
- * struct uclass_driver *drvs[] = {
- * DM_UCLASS_DRIVER_REF(clk),
- * };
+ *   extern UCLASS_DRIVER(clk);
+ *   struct uclass_driver *drvs[] = {
+ *   DM_UCLASS_DRIVER_REF(clk),
+ *   };
   *
   * @_name: Name of the uclass_driver. This must be a valid C identifier, used 
by
   *the linker_list.
- * @returns struct uclass_driver * for the uclass driver
+ * Return: struct uclass_driver * for the uclass driver
   */
  #define DM_UCLASS_DRIVER_REF(_name)   \
ll_entry_ref(struct uclass_driver, _name, uclass_driver)
@@ -145,8 +144,8 @@ struct uclass_driver {
  /**
   * uclass_get_priv() - Get the private data for a uclass
   *
- * @uc Uclass to check
- * @return private data, or NULL if none
+ * @uc:Uclass to check
+ * Return: private data, or NULL if none
   */
  void *uclass_get_priv(const struct uclass *uc);

@@ -159,8 +158,8 @@ void *uclass_get_priv(const struct uclass *uc);
   *
   * @key: ID to look up
   * @ucp: Returns pointer to uclass (there is only one per ID)
- * @return 0 if OK, -EDEADLK if driver model is not yet inited, other -ve on
- * other error
+ * Return: 0 if OK, -EDEADLK if driver model is not yet inited, other -ve on
+ * other error
   */
  int uclass_get(enum uclass_id key, struct uclass **ucp);

@@ -168,16 +167,16 @@ int uclass_get(enum uclass_id key, struct uclass **ucp);
   * uclass_get_name() - Get the name of a uclass driver
   *
   * @id: ID to look up
- * @returns the name of the uclass driver for that ID, or NULL if none
+ * Return: the name of the uclass driver for that ID, or NULL if none
   */
  const char *uclass_get_name(enum uclass_id id);

  /**
- * uclass_get_by_name() - Look up a uclass by its driver name
+ * uclass_get_by_name_len() - Look up a uclass by its partial driver name
   *
   * @name: Name to look up
- * @len: Length of name
- * @returns the associated uclass ID, or UCLASS_INVALID if not found
+ * @len: Length of the partial name
+ * Return: the associated uclass ID, or UCLASS_INVALID if not found
   */
  enum uclass_id uclass_get_by_name_len(const char *name, int len);

@@ -185,7 +184,7 @@ enum uclass_id uclass_get_by_name_len(const char *name, int 
len);
   * uclass_get_by_name() - Look up a uclass by its driver name
   *
   * @name: Name to look up
- * @returns the associated uclass ID, or UCLASS_INVALID if not found
+ * Return: the associated uclass ID, or UCLASS_INVALID if not found
   */
  enum uclass_id uclass_get_by_name(const char *name);

@@ -197,7 +196,7 @@ enum uclass_id uclass_get_by_name(const char *name);
   * @id: ID to look up
   * @index: Device number within that uclass (0=first)
   * @devp: Returns pointer to device (there is only one per for each ID)
- * @return 0 if OK, -ve on error
+ * Return: 0 if OK, -ve on error
   */
  int uclass_get_device(enum uclass_id id, int index, struct udevice **devp);

@@ -211,7 +210,7 @@ int uclass_get_device(enum uclass_id id, int index, struct 
udevice **devp);
   * @id: ID to look up
   * @name: name of a device to get
   * @devp: Returns pointer to device (the first one with the name)
- * @return 0 if OK, -ve on error
+ *