¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: [PATCH 3/5] phy: meson-gxl-usb2: remove phy_meson_gxl_usb2_set_mode

 

On 18/06/2024 16:56, Marek Vasut wrote:
On 6/18/24 9:55 AM, Neil Armstrong wrote:
[...]

@@ -205,7 +188,7 @@ static int phy_meson_gxl_usb2_power_off(struct phy *phy)
? struct phy_ops meson_gxl_usb2_phy_ops = {
????? .power_on = phy_meson_gxl_usb2_power_on,
????? .power_off = phy_meson_gxl_usb2_power_off,
-??? .set_mode = _phy_meson_gxl_usb2_set_mode,
+??? .set_mode = phy_meson_gxl_usb2_set_mode,
Oh, I see you did rename it here, so please ignore my comment on 1/5 . Maybe just mention in the 1/5 commit message that the rename is happening in follow up patch , if you are doing V2 at all .
Sure, let me update the commit message,

Thanks,
Neil


Re: [PATCH 1/5] phy: meson-gxl-usb2: add set_mode callback

Marek Vasut
 

On 6/18/24 9:55 AM, Neil Armstrong wrote:
Implement set_mode callback by calling the current public
function.
Signed-off-by: Neil Armstrong <neil.armstrong@...>
---
drivers/phy/meson-gxl-usb2.c | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/drivers/phy/meson-gxl-usb2.c b/drivers/phy/meson-gxl-usb2.c
index 92c285103c..e051e66224 100644
--- a/drivers/phy/meson-gxl-usb2.c
+++ b/drivers/phy/meson-gxl-usb2.c
@@ -150,6 +150,28 @@ void phy_meson_gxl_usb2_set_mode(struct phy *phy, enum usb_dr_mode mode)
phy_meson_gxl_usb2_reset(priv);
}
+static int _phy_meson_gxl_usb2_set_mode(struct phy *phy, enum phy_mode mode, int submode)
+{
+ if (submode)
+ return -EOPNOTSUPP;
+
+ switch (mode) {
+ case PHY_MODE_USB_DEVICE:
+ phy_meson_gxl_usb2_set_mode(phy, USB_DR_MODE_PERIPHERAL);
+ break;
+
+ case PHY_MODE_USB_HOST:
+ case PHY_MODE_USB_OTG:
+ phy_meson_gxl_usb2_set_mode(phy, USB_DR_MODE_HOST);
+ break;
+
+ default:
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
static int phy_meson_gxl_usb2_power_on(struct phy *phy)
{
struct udevice *dev = phy->dev;
@@ -161,7 +183,7 @@ static int phy_meson_gxl_usb2_power_on(struct phy *phy)
val &= ~U2P_R0_POWER_ON_RESET;
regmap_write(priv->regmap, U2P_R0, val);
- phy_meson_gxl_usb2_set_mode(phy, USB_DR_MODE_HOST);
Could you rename this ^ to some phy_meson_gxl_usb2_set_mode_inner() and ...

+ _phy_meson_gxl_usb2_set_mode(phy, PHY_MODE_USB_HOST, 0);
... remove the leading underscore here.

return 0;
}
@@ -183,6 +205,7 @@ static int phy_meson_gxl_usb2_power_off(struct phy *phy)
struct phy_ops meson_gxl_usb2_phy_ops = {
.power_on = phy_meson_gxl_usb2_power_on,
.power_off = phy_meson_gxl_usb2_power_off,
+ .set_mode = _phy_meson_gxl_usb2_set_mode,
... and here ?

[...]


Re: [PATCH 3/5] phy: meson-gxl-usb2: remove phy_meson_gxl_usb2_set_mode

Marek Vasut
 

On 6/18/24 9:55 AM, Neil Armstrong wrote:

[...]

@@ -205,7 +188,7 @@ static int phy_meson_gxl_usb2_power_off(struct phy *phy)
struct phy_ops meson_gxl_usb2_phy_ops = {
.power_on = phy_meson_gxl_usb2_power_on,
.power_off = phy_meson_gxl_usb2_power_off,
- .set_mode = _phy_meson_gxl_usb2_set_mode,
+ .set_mode = phy_meson_gxl_usb2_set_mode,
Oh, I see you did rename it here, so please ignore my comment on 1/5 . Maybe just mention in the 1/5 commit message that the rename is happening in follow up patch , if you are doing V2 at all .


[PATCH 5/5] usb: dwc3: meson-g12a: drop usb.h and make dwc3_meson_g12a_force_mode static

 

Drop this useless usb.h and now make dwc3_meson_g12a_force_mode
static since only used in the dwc3-meson-g12a.c file.

Signed-off-by: Neil Armstrong <neil.armstrong@...>
---
arch/arm/include/asm/arch-meson/usb.h | 12 ------------
drivers/usb/dwc3/dwc3-meson-g12a.c | 2 +-
2 files changed, 1 insertion(+), 13 deletions(-)

diff --git a/arch/arm/include/asm/arch-meson/usb.h b/arch/arm/include/asm/arch-meson/usb.h
deleted file mode 100644
index b794b5ce77..0000000000
--- a/arch/arm/include/asm/arch-meson/usb.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright (C) 2019 BayLibre, SAS
- * Author: Neil Armstrong <narmstrong@...>
- */
-
-#ifndef __MESON_USB_H__
-#define __MESON_USB_H__
-
-int dwc3_meson_g12a_force_mode(struct udevice *dev, enum usb_dr_mode mode);
-
-#endif /* __MESON_USB_H__ */
diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c
index 21e4f637bb..41d15996e5 100644
--- a/drivers/usb/dwc3/dwc3-meson-g12a.c
+++ b/drivers/usb/dwc3/dwc3-meson-g12a.c
@@ -270,7 +270,7 @@ static int dwc3_meson_g12a_usb_init(struct dwc3_meson_g12a *priv)
return 0;
}

-int dwc3_meson_g12a_force_mode(struct udevice *dev, enum usb_dr_mode mode)
+static int dwc3_meson_g12a_force_mode(struct udevice *dev, enum usb_dr_mode mode)
{
struct dwc3_meson_g12a *priv = dev_get_plat(dev);


--
2.34.1


[PATCH 4/5] usb: dwc3: meson-gxl: drop usb-gx.h and make dwc3_meson_gxl_force_mode static

 

Drop this useless usb-gx.h and now make dwc3_meson_gxl_force_mode
static since only used in the dwc3-meson-gxl.c file.

Signed-off-by: Neil Armstrong <neil.armstrong@...>
---
arch/arm/include/asm/arch-meson/usb-gx.h | 14 --------------
drivers/usb/dwc3/dwc3-meson-gxl.c | 3 +--
2 files changed, 1 insertion(+), 16 deletions(-)

diff --git a/arch/arm/include/asm/arch-meson/usb-gx.h b/arch/arm/include/asm/arch-meson/usb-gx.h
deleted file mode 100644
index 966d401730..0000000000
--- a/arch/arm/include/asm/arch-meson/usb-gx.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright 2019 BayLibre SAS
- * Author: Neil Armstrong <narmstrong@...>
- */
-#ifndef _ARCH_MESON_USB_GX_H_
-#define _ARCH_MESON_USB_GX_H_
-
-#include <generic-phy.h>
-#include <linux/usb/otg.h>
-
-int dwc3_meson_gxl_force_mode(struct udevice *dev, enum usb_dr_mode mode);
-
-#endif
diff --git a/drivers/usb/dwc3/dwc3-meson-gxl.c b/drivers/usb/dwc3/dwc3-meson-gxl.c
index 290ac03a37..5fb9b477ad 100644
--- a/drivers/usb/dwc3/dwc3-meson-gxl.c
+++ b/drivers/usb/dwc3/dwc3-meson-gxl.c
@@ -26,7 +26,6 @@
#include <linux/bitfield.h>
#include <linux/bitops.h>
#include <linux/compat.h>
-#include <asm/arch/usb-gx.h>

/* USB Glue Control Registers */

@@ -193,7 +192,7 @@ static int dwc3_meson_gxl_usb_init(struct dwc3_meson_gxl *priv)
return 0;
}

-int dwc3_meson_gxl_force_mode(struct udevice *dev, enum usb_dr_mode mode)
+static int dwc3_meson_gxl_force_mode(struct udevice *dev, enum usb_dr_mode mode)
{
struct dwc3_meson_gxl *priv = dev_get_plat(dev);


--
2.34.1


[PATCH 3/5] phy: meson-gxl-usb2: remove phy_meson_gxl_usb2_set_mode

 

Remove the public phy_meson_gxl_usb2_set_mode and move
the implementation in the the set_mode callback.

Signed-off-by: Neil Armstrong <neil.armstrong@...>
---
arch/arm/include/asm/arch-meson/usb-gx.h | 3 ---
drivers/phy/meson-gxl-usb2.c | 45 ++++++++++----------------------
2 files changed, 14 insertions(+), 34 deletions(-)

diff --git a/arch/arm/include/asm/arch-meson/usb-gx.h b/arch/arm/include/asm/arch-meson/usb-gx.h
index 61f1809df9..966d401730 100644
--- a/arch/arm/include/asm/arch-meson/usb-gx.h
+++ b/arch/arm/include/asm/arch-meson/usb-gx.h
@@ -9,9 +9,6 @@
#include <generic-phy.h>
#include <linux/usb/otg.h>

-/* TOFIX add set_mode to struct phy_ops */
-void phy_meson_gxl_usb2_set_mode(struct phy *phy, enum usb_dr_mode mode);
-
int dwc3_meson_gxl_force_mode(struct udevice *dev, enum usb_dr_mode mode);

#endif
diff --git a/drivers/phy/meson-gxl-usb2.c b/drivers/phy/meson-gxl-usb2.c
index e051e66224..140e936b47 100644
--- a/drivers/phy/meson-gxl-usb2.c
+++ b/drivers/phy/meson-gxl-usb2.c
@@ -19,8 +19,6 @@
#include <linux/printk.h>
#include <linux/usb/otg.h>

-#include <asm/arch/usb-gx.h>
-
#include <linux/bitops.h>
#include <linux/compat.h>

@@ -121,54 +119,39 @@ static void phy_meson_gxl_usb2_reset(struct phy_meson_gxl_usb2_priv *priv)
udelay(RESET_COMPLETE_TIME);
}

-void phy_meson_gxl_usb2_set_mode(struct phy *phy, enum usb_dr_mode mode)
+static int phy_meson_gxl_usb2_set_mode(struct phy *phy, enum phy_mode mode, int submode)
{
struct udevice *dev = phy->dev;
struct phy_meson_gxl_usb2_priv *priv = dev_get_priv(dev);
uint val;

+ if (submode)
+ return -EOPNOTSUPP;
+
regmap_read(priv->regmap, U2P_R0, &val);

switch (mode) {
- case USB_DR_MODE_UNKNOWN:
- case USB_DR_MODE_HOST:
- case USB_DR_MODE_OTG:
- val |= U2P_R0_DM_PULLDOWN;
- val |= U2P_R0_DP_PULLDOWN;
- val &= ~U2P_R0_ID_PULLUP;
- break;
-
- case USB_DR_MODE_PERIPHERAL:
+ case PHY_MODE_USB_DEVICE:
val &= ~U2P_R0_DM_PULLDOWN;
val &= ~U2P_R0_DP_PULLDOWN;
val |= U2P_R0_ID_PULLUP;
break;
- }
-
- regmap_write(priv->regmap, U2P_R0, val);
-
- phy_meson_gxl_usb2_reset(priv);
-}
-
-static int _phy_meson_gxl_usb2_set_mode(struct phy *phy, enum phy_mode mode, int submode)
-{
- if (submode)
- return -EOPNOTSUPP;
-
- switch (mode) {
- case PHY_MODE_USB_DEVICE:
- phy_meson_gxl_usb2_set_mode(phy, USB_DR_MODE_PERIPHERAL);
- break;

case PHY_MODE_USB_HOST:
case PHY_MODE_USB_OTG:
- phy_meson_gxl_usb2_set_mode(phy, USB_DR_MODE_HOST);
+ val |= U2P_R0_DM_PULLDOWN;
+ val |= U2P_R0_DP_PULLDOWN;
+ val &= ~U2P_R0_ID_PULLUP;
break;

default:
return -EINVAL;
}

+ regmap_write(priv->regmap, U2P_R0, val);
+
+ phy_meson_gxl_usb2_reset(priv);
+
return 0;
}

@@ -183,7 +166,7 @@ static int phy_meson_gxl_usb2_power_on(struct phy *phy)
val &= ~U2P_R0_POWER_ON_RESET;
regmap_write(priv->regmap, U2P_R0, val);

- _phy_meson_gxl_usb2_set_mode(phy, PHY_MODE_USB_HOST, 0);
+ phy_meson_gxl_usb2_set_mode(phy, PHY_MODE_USB_HOST, 0);

return 0;
}
@@ -205,7 +188,7 @@ static int phy_meson_gxl_usb2_power_off(struct phy *phy)
struct phy_ops meson_gxl_usb2_phy_ops = {
.power_on = phy_meson_gxl_usb2_power_on,
.power_off = phy_meson_gxl_usb2_power_off,
- .set_mode = _phy_meson_gxl_usb2_set_mode,
+ .set_mode = phy_meson_gxl_usb2_set_mode,
};

int meson_gxl_usb2_phy_probe(struct udevice *dev)

--
2.34.1


[PATCH 2/5] usb: dwc3: meson-gxl: switch to generic_phy_set_mode

 

Use the PHY set_mode call instead of calling directly in the
PHY shared function.

Signed-off-by: Neil Armstrong <neil.armstrong@...>
---
drivers/usb/dwc3/dwc3-meson-gxl.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-meson-gxl.c b/drivers/usb/dwc3/dwc3-meson-gxl.c
index 3e693c5ff3..290ac03a37 100644
--- a/drivers/usb/dwc3/dwc3-meson-gxl.c
+++ b/drivers/usb/dwc3/dwc3-meson-gxl.c
@@ -158,9 +158,9 @@ static int dwc3_meson_gxl_usb2_init(struct dwc3_meson_gxl *priv)
if (!priv->phys[i].dev)
continue;

- phy_meson_gxl_usb2_set_mode(&priv->phys[i],
- (i == USB2_OTG_PHY) ? USB_DR_MODE_PERIPHERAL
- : USB_DR_MODE_HOST);
+ generic_phy_set_mode(&priv->phys[i],
+ (i == USB2_OTG_PHY) ? PHY_MODE_USB_DEVICE
+ : PHY_MODE_USB_HOST, 0);
}

return 0;
@@ -224,7 +224,9 @@ int dwc3_meson_gxl_force_mode(struct udevice *dev, enum usb_dr_mode mode)
#endif
priv->otg_phy_mode = mode;

- phy_meson_gxl_usb2_set_mode(&priv->phys[USB2_OTG_PHY], mode);
+ generic_phy_set_mode(&priv->phys[USB2_OTG_PHY],
+ mode == USB_DR_MODE_PERIPHERAL ? PHY_MODE_USB_DEVICE
+ : PHY_MODE_USB_HOST, 0);

dwc3_meson_gxl_usb2_set_mode(priv, mode);

@@ -361,8 +363,9 @@ static int dwc3_meson_gxl_probe(struct udevice *dev)
}

if (priv->phys[USB2_OTG_PHY].dev)
- phy_meson_gxl_usb2_set_mode(&priv->phys[USB2_OTG_PHY],
- priv->otg_phy_mode);
+ generic_phy_set_mode(&priv->phys[USB2_OTG_PHY],
+ priv->otg_phy_mode == USB_DR_MODE_PERIPHERAL ? PHY_MODE_USB_DEVICE
+ : PHY_MODE_USB_HOST, 0);

dwc3_meson_gxl_usb2_set_mode(priv, priv->otg_phy_mode);


--
2.34.1


[PATCH 1/5] phy: meson-gxl-usb2: add set_mode callback

 

Implement set_mode callback by calling the current public
function.

Signed-off-by: Neil Armstrong <neil.armstrong@...>
---
drivers/phy/meson-gxl-usb2.c | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/drivers/phy/meson-gxl-usb2.c b/drivers/phy/meson-gxl-usb2.c
index 92c285103c..e051e66224 100644
--- a/drivers/phy/meson-gxl-usb2.c
+++ b/drivers/phy/meson-gxl-usb2.c
@@ -150,6 +150,28 @@ void phy_meson_gxl_usb2_set_mode(struct phy *phy, enum usb_dr_mode mode)
phy_meson_gxl_usb2_reset(priv);
}

+static int _phy_meson_gxl_usb2_set_mode(struct phy *phy, enum phy_mode mode, int submode)
+{
+ if (submode)
+ return -EOPNOTSUPP;
+
+ switch (mode) {
+ case PHY_MODE_USB_DEVICE:
+ phy_meson_gxl_usb2_set_mode(phy, USB_DR_MODE_PERIPHERAL);
+ break;
+
+ case PHY_MODE_USB_HOST:
+ case PHY_MODE_USB_OTG:
+ phy_meson_gxl_usb2_set_mode(phy, USB_DR_MODE_HOST);
+ break;
+
+ default:
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
static int phy_meson_gxl_usb2_power_on(struct phy *phy)
{
struct udevice *dev = phy->dev;
@@ -161,7 +183,7 @@ static int phy_meson_gxl_usb2_power_on(struct phy *phy)
val &= ~U2P_R0_POWER_ON_RESET;
regmap_write(priv->regmap, U2P_R0, val);

- phy_meson_gxl_usb2_set_mode(phy, USB_DR_MODE_HOST);
+ _phy_meson_gxl_usb2_set_mode(phy, PHY_MODE_USB_HOST, 0);

return 0;
}
@@ -183,6 +205,7 @@ static int phy_meson_gxl_usb2_power_off(struct phy *phy)
struct phy_ops meson_gxl_usb2_phy_ops = {
.power_on = phy_meson_gxl_usb2_power_on,
.power_off = phy_meson_gxl_usb2_power_off,
+ .set_mode = _phy_meson_gxl_usb2_set_mode,
};

int meson_gxl_usb2_phy_probe(struct udevice *dev)

--
2.34.1


[PATCH 0/5] usb: meson: switch to set_mode callback and other cleanup

 

Switch to set_mode callback now it's available and in the same
time make public functions static and drop useless mach-meson
headers that are no more needed.

Signed-off-by: Neil Armstrong <neil.armstrong@...>
---
Neil Armstrong (5):
phy: meson-gxl-usb2: add set_mode callback
usb: dwc3: meson-gxl: switch to generic_phy_set_mode
phy: meson-gxl-usb2: remove phy_meson_gxl_usb2_set_mode
usb: dwc3: meson-gxl: drop usb-gx.h and make dwc3_meson_gxl_force_mode static
usb: dwc3: meson-g12a: drop usb.h and make dwc3_meson_g12a_force_mode static

arch/arm/include/asm/arch-meson/usb-gx.h | 17 -----------------
arch/arm/include/asm/arch-meson/usb.h | 12 ------------
drivers/phy/meson-gxl-usb2.c | 30 ++++++++++++++++++------------
drivers/usb/dwc3/dwc3-meson-g12a.c | 2 +-
drivers/usb/dwc3/dwc3-meson-gxl.c | 18 ++++++++++--------
5 files changed, 29 insertions(+), 50 deletions(-)
---
base-commit: f1de28e67aa9b66bfca0fad3dc18446a6ec0b504
change-id: 20240618-u-boot-usb-gxl-phy-set-mode-c3991c5f1da2

Best regards,
--
Neil Armstrong <neil.armstrong@...>


Re: [PATCH 00/42] labgrid: Provide an integration with Labgrid

Simon Glass
 

Hi Tom,

On Wed, 12 Jun 2024 at 10:03, Tom Rini <trini@...> wrote:

On Wed, Jun 12, 2024 at 09:08:32AM +0300, Ilias Apalodimas wrote:
Hi Simon

On Tue, 11 Jun 2024 at 23:02, Simon Glass <sjg@...> wrote:

Labgrid provides access to a hardware lab in an automated way. It is
possible to boot U-Boot on boards in the lab without physically touching
them. It relies on relays, USB UARTs and SD muxes, among other things.

By way of background, about 4 years ago I wrong a thing called Labman[1]
which allowed my lab of about 30 devices to be operated remotely, using
tbot for the console and build integration. While it worked OK and I
used it for many bisects, I didn't take it any further.

It turns out that there was already an existing program, called Labgrid,
which I did not know about at time (thank you Tom for telling me). It is
more rounded than Labman and has a number of advantages:

- does not need udev rules, mostly
- has several existing users who rely on it
- supports multiple machines exporting their devices

It lacks a 'lab check' feature and a few other things, but these can be
remedied.

On and off over the past several weeks I have been experimenting with
Labgrid. I have managed to create an initial U-Boot integration (this
series) by adding various features to Labgrid[2] and the U-Boot test
hooks.

I hope that this might inspire others to set up boards and run tests
automatically, rather than relying on infrequent, manual test. Perhaps
it may even be possible to have a number of labs available.

Included in the integration are a number of simple scripts which make it
easy to connect to boards and run tests:

ub-int <target>
Build and boot on a target, starting an interactive session

ub-cli <target>
Build and boot on a target, ensure U-Boot starts and provide an interactive
session from there

ub-smoke <target>
Smoke test U-Boot to check that it boots to a prompt on a target

ub-bisect
Bisect a git tree to locate a failure on a particular target

ub-pyt <target> <testspec>
Run U-Boot pytests on a target

Some of these help to provide the same tbot[4] workflow which I have
relied on for several years, albeit much simpler versions.

The goal here is to create some sort of script which can collect
patches from the mailing list, apply them and test them on a selection
of boards. I suspect that script already exists, so please let me know
what you suggest.

I hope you find this interesting and take a look!
Thanks this is interesting!
I only got cc'ed on the cover letter and I'll slowly have a look on
the rest. A naive question -- I saw you did integrate this on gitlab
with your internal lab. How secure is this? Could we schedule weekly
builds that run on various remote labs and get results on actual
hardware? Or do we have to rely on users for that ?
That's where this certainly gets a little tricky. Ideally, and part of
why I've been hoping to get Labgrid going with our pytest suite, since
it's good enough for kernelci (and people to be reasonably confident
about allowing not-exactly-random-user-access), it should be good enough
for us too. So my long term hope is that we can:
- Have Labgrid based labs + something know to monitor trees+branches at
X location (like I know today some people poll and test my WIP
branches).
- Have it be reasonably clear that if you maintain a lab for kernelci,
you can add testing U-Boot in too.

In the medium term, I am hopeful we can at least expose this to all
custodian trees on source.denx.de. And I'm saying "we" here as I have
two much smaller labs also going, one with Labgrid, and both a much
smaller set of targets currently.
That sounds good to me.

Regards,
Simon


Re: [PATCH 00/42] labgrid: Provide an integration with Labgrid

Simon Glass
 

Hi Ilias,

On Wed, 12 Jun 2024 at 00:09, Ilias Apalodimas
<ilias.apalodimas@...> wrote:

Hi Simon

On Tue, 11 Jun 2024 at 23:02, Simon Glass <sjg@...> wrote:

Labgrid provides access to a hardware lab in an automated way. It is
possible to boot U-Boot on boards in the lab without physically touching
them. It relies on relays, USB UARTs and SD muxes, among other things.

By way of background, about 4 years ago I wrong a thing called Labman[1]
which allowed my lab of about 30 devices to be operated remotely, using
tbot for the console and build integration. While it worked OK and I
used it for many bisects, I didn't take it any further.

It turns out that there was already an existing program, called Labgrid,
which I did not know about at time (thank you Tom for telling me). It is
more rounded than Labman and has a number of advantages:

- does not need udev rules, mostly
- has several existing users who rely on it
- supports multiple machines exporting their devices

It lacks a 'lab check' feature and a few other things, but these can be
remedied.

On and off over the past several weeks I have been experimenting with
Labgrid. I have managed to create an initial U-Boot integration (this
series) by adding various features to Labgrid[2] and the U-Boot test
hooks.

I hope that this might inspire others to set up boards and run tests
automatically, rather than relying on infrequent, manual test. Perhaps
it may even be possible to have a number of labs available.

Included in the integration are a number of simple scripts which make it
easy to connect to boards and run tests:

ub-int <target>
Build and boot on a target, starting an interactive session

ub-cli <target>
Build and boot on a target, ensure U-Boot starts and provide an interactive
session from there

ub-smoke <target>
Smoke test U-Boot to check that it boots to a prompt on a target

ub-bisect
Bisect a git tree to locate a failure on a particular target

ub-pyt <target> <testspec>
Run U-Boot pytests on a target

Some of these help to provide the same tbot[4] workflow which I have
relied on for several years, albeit much simpler versions.

The goal here is to create some sort of script which can collect
patches from the mailing list, apply them and test them on a selection
of boards. I suspect that script already exists, so please let me know
what you suggest.

I hope you find this interesting and take a look!
Thanks this is interesting!
Thanks!

I only got cc'ed on the cover letter and I'll slowly have a look on
the rest. A naive question -- I saw you did integrate this on gitlab
with your internal lab. How secure is this? Could we schedule weekly
builds that run on various remote labs and get results on actual
hardware? Or do we have to rely on users for that ?
I believe this could be done. My understanding is that any custodian
can push to a tree which runs on all available runners.

If you have any ideas on the script I mentioned, let me know!

Regards,
Simon



Thanks
/Ilias


[1]
[2]
[3]
[4]


Simon Glass (42):
trace: Update test to tolerate different trace-cmd version
binman: efi: Correct entry docs
binman: Regenerate nxp docs
binman: ti: Regenerate entry docs
binman: Update the entrydocs header
buildman: Make mrproper an argument to _reconfigure()
buildman: Make mrproper an argument to _config_and_build()
buildman: Make mrproper an argument to run_commit()
buildman: Avoid rebuilding when --mrproper is used
buildman: Add a flag to force mrproper on failure
buildman: Retry the build for current source
buildman: Add a way to limit the number of buildmans
dm: core: Enhance comments on bind_drivers_pass()
initcall: Correct use of relocation offset
am33xx: Provide a function to set up the debug UART
sunxi: Mark scp as optional
google: Disable TPMv2 on most Chromebooks
meson: Correct driver declaration for meson_axg_gpio
test: Allow signaling that U-Boot is ready
test: Make bootstd init run only on sandbox
test: Use a constant for the test timeout
test: Pass stderr to stdout
test: Release board after tests complete
log: Allow tests to pass with CONFIG_LOGF_FUNC_PAD set
test: Allow connecting to a running board
test: Decode exceptions only with sandbox
test: Avoid failing skipped tests
test: dm: Show failing driver name
test: Check help output
test: Create a common function to get the config
test: Introduce the concept of a role
test: Move the receive code into a function
test: Separate out the exception handling
test: Detect dead connections
test: Tidy up remaining exceptions
test: Introduce lab mode
test: Improve handling of sending commands
test: Fix mulptiplex_log typo
test: Avoid double echo when starting up
test: Try to shut down the lab console gracefully
test: Add a section for closing the connection
CI: Allow running tests on sjg lab

.gitlab-ci.yml | 151 +++++++++++++++++
arch/arm/dts/sunxi-u-boot.dtsi | 1 +
arch/arm/mach-omap2/am33xx/board.c | 18 +-
configs/chromebook_link64_defconfig | 1 +
configs/chromebook_link_defconfig | 1 +
configs/chromebook_samus_defconfig | 1 +
configs/chromebook_samus_tpl_defconfig | 1 +
configs/nyan-big_defconfig | 4 +-
configs/snow_defconfig | 1 +
drivers/core/lists.c | 16 ++
drivers/pinctrl/meson/pinctrl-meson-axg-pmx.c | 2 +-
drivers/pinctrl/meson/pinctrl-meson-axg.c | 4 +-
drivers/pinctrl/meson/pinctrl-meson-axg.h | 2 +-
drivers/pinctrl/meson/pinctrl-meson-g12a.c | 4 +-
lib/initcall.c | 6 +-
test/py/conftest.py | 86 ++++++++--
test/py/tests/test_dm.py | 5 +-
test/py/tests/test_help.py | 6 +-
test/py/tests/test_log.py | 11 +-
test/py/tests/test_trace.py | 6 +-
test/py/tests/test_ut.py | 1 +
test/py/u_boot_console_base.py | 154 ++++++++++++------
test/py/u_boot_console_exec_attach.py | 31 +++-
test/py/u_boot_console_sandbox.py | 2 +-
test/py/u_boot_spawn.py | 123 ++++++++++++--
test/test-main.c | 16 +-
tools/binman/entries.rst | 115 +++++++++----
tools/binman/entry.py | 2 +-
tools/binman/etype/efi_capsule.py | 40 ++---
tools/binman/etype/efi_empty_capsule.py | 22 +--
tools/binman/etype/ti_secure.py | 45 ++---
tools/buildman/builder.py | 18 +-
tools/buildman/builderthread.py | 44 +++--
tools/buildman/buildman.rst | 8 +-
tools/buildman/cmdline.py | 6 +-
tools/buildman/control.py | 141 +++++++++++++++-
tools/buildman/pyproject.toml | 6 +-
tools/buildman/test.py | 121 ++++++++++++++
tools/u_boot_pylib/terminal.py | 7 +-
39 files changed, 1003 insertions(+), 226 deletions(-)

--
2.34.1


Re: [PATCH 00/42] labgrid: Provide an integration with Labgrid

Tom Rini
 

On Wed, Jun 12, 2024 at 09:08:32AM +0300, Ilias Apalodimas wrote:
Hi Simon

On Tue, 11 Jun 2024 at 23:02, Simon Glass <sjg@...> wrote:

Labgrid provides access to a hardware lab in an automated way. It is
possible to boot U-Boot on boards in the lab without physically touching
them. It relies on relays, USB UARTs and SD muxes, among other things.

By way of background, about 4 years ago I wrong a thing called Labman[1]
which allowed my lab of about 30 devices to be operated remotely, using
tbot for the console and build integration. While it worked OK and I
used it for many bisects, I didn't take it any further.

It turns out that there was already an existing program, called Labgrid,
which I did not know about at time (thank you Tom for telling me). It is
more rounded than Labman and has a number of advantages:

- does not need udev rules, mostly
- has several existing users who rely on it
- supports multiple machines exporting their devices

It lacks a 'lab check' feature and a few other things, but these can be
remedied.

On and off over the past several weeks I have been experimenting with
Labgrid. I have managed to create an initial U-Boot integration (this
series) by adding various features to Labgrid[2] and the U-Boot test
hooks.

I hope that this might inspire others to set up boards and run tests
automatically, rather than relying on infrequent, manual test. Perhaps
it may even be possible to have a number of labs available.

Included in the integration are a number of simple scripts which make it
easy to connect to boards and run tests:

ub-int <target>
Build and boot on a target, starting an interactive session

ub-cli <target>
Build and boot on a target, ensure U-Boot starts and provide an interactive
session from there

ub-smoke <target>
Smoke test U-Boot to check that it boots to a prompt on a target

ub-bisect
Bisect a git tree to locate a failure on a particular target

ub-pyt <target> <testspec>
Run U-Boot pytests on a target

Some of these help to provide the same tbot[4] workflow which I have
relied on for several years, albeit much simpler versions.

The goal here is to create some sort of script which can collect
patches from the mailing list, apply them and test them on a selection
of boards. I suspect that script already exists, so please let me know
what you suggest.

I hope you find this interesting and take a look!
Thanks this is interesting!
I only got cc'ed on the cover letter and I'll slowly have a look on
the rest. A naive question -- I saw you did integrate this on gitlab
with your internal lab. How secure is this? Could we schedule weekly
builds that run on various remote labs and get results on actual
hardware? Or do we have to rely on users for that ?
That's where this certainly gets a little tricky. Ideally, and part of
why I've been hoping to get Labgrid going with our pytest suite, since
it's good enough for kernelci (and people to be reasonably confident
about allowing not-exactly-random-user-access), it should be good enough
for us too. So my long term hope is that we can:
- Have Labgrid based labs + something know to monitor trees+branches at
X location (like I know today some people poll and test my WIP
branches).
- Have it be reasonably clear that if you maintain a lab for kernelci,
you can add testing U-Boot in too.

In the medium term, I am hopeful we can at least expose this to all
custodian trees on source.denx.de. And I'm saying "we" here as I have
two much smaller labs also going, one with Labgrid, and both a much
smaller set of targets currently.

--
Tom


Re: [PATCH 00/42] labgrid: Provide an integration with Labgrid

Ilias Apalodimas
 

Hi Simon

On Tue, 11 Jun 2024 at 23:02, Simon Glass <sjg@...> wrote:

Labgrid provides access to a hardware lab in an automated way. It is
possible to boot U-Boot on boards in the lab without physically touching
them. It relies on relays, USB UARTs and SD muxes, among other things.

By way of background, about 4 years ago I wrong a thing called Labman[1]
which allowed my lab of about 30 devices to be operated remotely, using
tbot for the console and build integration. While it worked OK and I
used it for many bisects, I didn't take it any further.

It turns out that there was already an existing program, called Labgrid,
which I did not know about at time (thank you Tom for telling me). It is
more rounded than Labman and has a number of advantages:

- does not need udev rules, mostly
- has several existing users who rely on it
- supports multiple machines exporting their devices

It lacks a 'lab check' feature and a few other things, but these can be
remedied.

On and off over the past several weeks I have been experimenting with
Labgrid. I have managed to create an initial U-Boot integration (this
series) by adding various features to Labgrid[2] and the U-Boot test
hooks.

I hope that this might inspire others to set up boards and run tests
automatically, rather than relying on infrequent, manual test. Perhaps
it may even be possible to have a number of labs available.

Included in the integration are a number of simple scripts which make it
easy to connect to boards and run tests:

ub-int <target>
Build and boot on a target, starting an interactive session

ub-cli <target>
Build and boot on a target, ensure U-Boot starts and provide an interactive
session from there

ub-smoke <target>
Smoke test U-Boot to check that it boots to a prompt on a target

ub-bisect
Bisect a git tree to locate a failure on a particular target

ub-pyt <target> <testspec>
Run U-Boot pytests on a target

Some of these help to provide the same tbot[4] workflow which I have
relied on for several years, albeit much simpler versions.

The goal here is to create some sort of script which can collect
patches from the mailing list, apply them and test them on a selection
of boards. I suspect that script already exists, so please let me know
what you suggest.

I hope you find this interesting and take a look!
Thanks this is interesting!
I only got cc'ed on the cover letter and I'll slowly have a look on
the rest. A naive question -- I saw you did integrate this on gitlab
with your internal lab. How secure is this? Could we schedule weekly
builds that run on various remote labs and get results on actual
hardware? Or do we have to rely on users for that ?

Thanks
/Ilias


[1]
[2]
[3]
[4]


Simon Glass (42):
trace: Update test to tolerate different trace-cmd version
binman: efi: Correct entry docs
binman: Regenerate nxp docs
binman: ti: Regenerate entry docs
binman: Update the entrydocs header
buildman: Make mrproper an argument to _reconfigure()
buildman: Make mrproper an argument to _config_and_build()
buildman: Make mrproper an argument to run_commit()
buildman: Avoid rebuilding when --mrproper is used
buildman: Add a flag to force mrproper on failure
buildman: Retry the build for current source
buildman: Add a way to limit the number of buildmans
dm: core: Enhance comments on bind_drivers_pass()
initcall: Correct use of relocation offset
am33xx: Provide a function to set up the debug UART
sunxi: Mark scp as optional
google: Disable TPMv2 on most Chromebooks
meson: Correct driver declaration for meson_axg_gpio
test: Allow signaling that U-Boot is ready
test: Make bootstd init run only on sandbox
test: Use a constant for the test timeout
test: Pass stderr to stdout
test: Release board after tests complete
log: Allow tests to pass with CONFIG_LOGF_FUNC_PAD set
test: Allow connecting to a running board
test: Decode exceptions only with sandbox
test: Avoid failing skipped tests
test: dm: Show failing driver name
test: Check help output
test: Create a common function to get the config
test: Introduce the concept of a role
test: Move the receive code into a function
test: Separate out the exception handling
test: Detect dead connections
test: Tidy up remaining exceptions
test: Introduce lab mode
test: Improve handling of sending commands
test: Fix mulptiplex_log typo
test: Avoid double echo when starting up
test: Try to shut down the lab console gracefully
test: Add a section for closing the connection
CI: Allow running tests on sjg lab

.gitlab-ci.yml | 151 +++++++++++++++++
arch/arm/dts/sunxi-u-boot.dtsi | 1 +
arch/arm/mach-omap2/am33xx/board.c | 18 +-
configs/chromebook_link64_defconfig | 1 +
configs/chromebook_link_defconfig | 1 +
configs/chromebook_samus_defconfig | 1 +
configs/chromebook_samus_tpl_defconfig | 1 +
configs/nyan-big_defconfig | 4 +-
configs/snow_defconfig | 1 +
drivers/core/lists.c | 16 ++
drivers/pinctrl/meson/pinctrl-meson-axg-pmx.c | 2 +-
drivers/pinctrl/meson/pinctrl-meson-axg.c | 4 +-
drivers/pinctrl/meson/pinctrl-meson-axg.h | 2 +-
drivers/pinctrl/meson/pinctrl-meson-g12a.c | 4 +-
lib/initcall.c | 6 +-
test/py/conftest.py | 86 ++++++++--
test/py/tests/test_dm.py | 5 +-
test/py/tests/test_help.py | 6 +-
test/py/tests/test_log.py | 11 +-
test/py/tests/test_trace.py | 6 +-
test/py/tests/test_ut.py | 1 +
test/py/u_boot_console_base.py | 154 ++++++++++++------
test/py/u_boot_console_exec_attach.py | 31 +++-
test/py/u_boot_console_sandbox.py | 2 +-
test/py/u_boot_spawn.py | 123 ++++++++++++--
test/test-main.c | 16 +-
tools/binman/entries.rst | 115 +++++++++----
tools/binman/entry.py | 2 +-
tools/binman/etype/efi_capsule.py | 40 ++---
tools/binman/etype/efi_empty_capsule.py | 22 +--
tools/binman/etype/ti_secure.py | 45 ++---
tools/buildman/builder.py | 18 +-
tools/buildman/builderthread.py | 44 +++--
tools/buildman/buildman.rst | 8 +-
tools/buildman/cmdline.py | 6 +-
tools/buildman/control.py | 141 +++++++++++++++-
tools/buildman/pyproject.toml | 6 +-
tools/buildman/test.py | 121 ++++++++++++++
tools/u_boot_pylib/terminal.py | 7 +-
39 files changed, 1003 insertions(+), 226 deletions(-)

--
2.34.1


Re: [PATCH 00/42] labgrid: Provide an integration with Labgrid

Simon Glass
 

Hi,

On Tue, 11 Jun 2024 at 14:02, Simon Glass <sjg@...> wrote:

Labgrid provides access to a hardware lab in an automated way. It is
possible to boot U-Boot on boards in the lab without physically touching
them. It relies on relays, USB UARTs and SD muxes, among other things.

By way of background, about 4 years ago I wrong a thing called Labman[1]
which allowed my lab of about 30 devices to be operated remotely, using
tbot for the console and build integration. While it worked OK and I
used it for many bisects, I didn't take it any further.

It turns out that there was already an existing program, called Labgrid,
which I did not know about at time (thank you Tom for telling me). It is
more rounded than Labman and has a number of advantages:

- does not need udev rules, mostly
- has several existing users who rely on it
- supports multiple machines exporting their devices

It lacks a 'lab check' feature and a few other things, but these can be
remedied.

On and off over the past several weeks I have been experimenting with
Labgrid. I have managed to create an initial U-Boot integration (this
series) by adding various features to Labgrid[2] and the U-Boot test
hooks.

I hope that this might inspire others to set up boards and run tests
automatically, rather than relying on infrequent, manual test. Perhaps
it may even be possible to have a number of labs available.

Included in the integration are a number of simple scripts which make it
easy to connect to boards and run tests:

ub-int <target>
Build and boot on a target, starting an interactive session

ub-cli <target>
Build and boot on a target, ensure U-Boot starts and provide an interactive
session from there

ub-smoke <target>
Smoke test U-Boot to check that it boots to a prompt on a target

ub-bisect
Bisect a git tree to locate a failure on a particular target

ub-pyt <target> <testspec>
Run U-Boot pytests on a target

Some of these help to provide the same tbot[4] workflow which I have
relied on for several years, albeit much simpler versions.

The goal here is to create some sort of script which can collect
patches from the mailing list, apply them and test them on a selection
of boards. I suspect that script already exists, so please let me know
what you suggest.

I hope you find this interesting and take a look!

[1]
[2]
[3]
[4]


Simon Glass (42):
trace: Update test to tolerate different trace-cmd version
binman: efi: Correct entry docs
binman: Regenerate nxp docs
binman: ti: Regenerate entry docs
binman: Update the entrydocs header
buildman: Make mrproper an argument to _reconfigure()
buildman: Make mrproper an argument to _config_and_build()
buildman: Make mrproper an argument to run_commit()
buildman: Avoid rebuilding when --mrproper is used
buildman: Add a flag to force mrproper on failure
buildman: Retry the build for current source
buildman: Add a way to limit the number of buildmans
dm: core: Enhance comments on bind_drivers_pass()
initcall: Correct use of relocation offset
am33xx: Provide a function to set up the debug UART
sunxi: Mark scp as optional
google: Disable TPMv2 on most Chromebooks
meson: Correct driver declaration for meson_axg_gpio
test: Allow signaling that U-Boot is ready
test: Make bootstd init run only on sandbox
test: Use a constant for the test timeout
test: Pass stderr to stdout
test: Release board after tests complete
log: Allow tests to pass with CONFIG_LOGF_FUNC_PAD set
test: Allow connecting to a running board
test: Decode exceptions only with sandbox
test: Avoid failing skipped tests
test: dm: Show failing driver name
test: Check help output
test: Create a common function to get the config
test: Introduce the concept of a role
test: Move the receive code into a function
test: Separate out the exception handling
test: Detect dead connections
test: Tidy up remaining exceptions
test: Introduce lab mode
test: Improve handling of sending commands
test: Fix mulptiplex_log typo
test: Avoid double echo when starting up
test: Try to shut down the lab console gracefully
test: Add a section for closing the connection
CI: Allow running tests on sjg lab

.gitlab-ci.yml | 151 +++++++++++++++++
arch/arm/dts/sunxi-u-boot.dtsi | 1 +
arch/arm/mach-omap2/am33xx/board.c | 18 +-
configs/chromebook_link64_defconfig | 1 +
configs/chromebook_link_defconfig | 1 +
configs/chromebook_samus_defconfig | 1 +
configs/chromebook_samus_tpl_defconfig | 1 +
configs/nyan-big_defconfig | 4 +-
configs/snow_defconfig | 1 +
drivers/core/lists.c | 16 ++
drivers/pinctrl/meson/pinctrl-meson-axg-pmx.c | 2 +-
drivers/pinctrl/meson/pinctrl-meson-axg.c | 4 +-
drivers/pinctrl/meson/pinctrl-meson-axg.h | 2 +-
drivers/pinctrl/meson/pinctrl-meson-g12a.c | 4 +-
lib/initcall.c | 6 +-
test/py/conftest.py | 86 ++++++++--
test/py/tests/test_dm.py | 5 +-
test/py/tests/test_help.py | 6 +-
test/py/tests/test_log.py | 11 +-
test/py/tests/test_trace.py | 6 +-
test/py/tests/test_ut.py | 1 +
test/py/u_boot_console_base.py | 154 ++++++++++++------
test/py/u_boot_console_exec_attach.py | 31 +++-
test/py/u_boot_console_sandbox.py | 2 +-
test/py/u_boot_spawn.py | 123 ++++++++++++--
test/test-main.c | 16 +-
tools/binman/entries.rst | 115 +++++++++----
tools/binman/entry.py | 2 +-
tools/binman/etype/efi_capsule.py | 40 ++---
tools/binman/etype/efi_empty_capsule.py | 22 +--
tools/binman/etype/ti_secure.py | 45 ++---
tools/buildman/builder.py | 18 +-
tools/buildman/builderthread.py | 44 +++--
tools/buildman/buildman.rst | 8 +-
tools/buildman/cmdline.py | 6 +-
tools/buildman/control.py | 141 +++++++++++++++-
tools/buildman/pyproject.toml | 6 +-
tools/buildman/test.py | 121 ++++++++++++++
tools/u_boot_pylib/terminal.py | 7 +-
39 files changed, 1003 insertions(+), 226 deletions(-)

--
2.34.1
Here is an example run (scroll to the right):



Regards,
Simon


[PATCH 18/42] meson: Correct driver declaration for meson_axg_gpio

Simon Glass
 

This should use the driver macros so that the driver appears in the
linker list. Fix this.

Fixes: 8587839f19d ("pinctrl: meson: add axg support")

Signed-off-by: Simon Glass <sjg@...>
---

drivers/pinctrl/meson/pinctrl-meson-axg-pmx.c | 2 +-
drivers/pinctrl/meson/pinctrl-meson-axg.c | 4 ++--
drivers/pinctrl/meson/pinctrl-meson-axg.h | 2 +-
drivers/pinctrl/meson/pinctrl-meson-g12a.c | 4 ++--
4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/pinctrl/meson/pinctrl-meson-axg-pmx.c b/drivers/pinctrl/meson/pinctrl-meson-axg-pmx.c
index 52c726cf038..15ebd574ef1 100644
--- a/drivers/pinctrl/meson/pinctrl-meson-axg-pmx.c
+++ b/drivers/pinctrl/meson/pinctrl-meson-axg-pmx.c
@@ -179,7 +179,7 @@ static const struct dm_gpio_ops meson_axg_gpio_ops = {
.direction_output = meson_gpio_direction_output,
};

-const struct driver meson_axg_gpio_driver = {
+U_BOOT_DRIVER(meson_axg_gpio) = {
.name = "meson-axg-gpio",
.id = UCLASS_GPIO,
.probe = meson_gpio_probe,
diff --git a/drivers/pinctrl/meson/pinctrl-meson-axg.c b/drivers/pinctrl/meson/pinctrl-meson-axg.c
index 94e09cd3f8a..ed3f92b2d75 100644
--- a/drivers/pinctrl/meson/pinctrl-meson-axg.c
+++ b/drivers/pinctrl/meson/pinctrl-meson-axg.c
@@ -939,7 +939,7 @@ struct meson_pinctrl_data meson_axg_periphs_pinctrl_data = {
.num_groups = ARRAY_SIZE(meson_axg_periphs_groups),
.num_funcs = ARRAY_SIZE(meson_axg_periphs_functions),
.num_banks = ARRAY_SIZE(meson_axg_periphs_banks),
- .gpio_driver = &meson_axg_gpio_driver,
+ .gpio_driver = DM_DRIVER_REF(meson_axg_gpio),
.pmx_data = &meson_axg_periphs_pmx_banks_data,
};

@@ -953,7 +953,7 @@ struct meson_pinctrl_data meson_axg_aobus_pinctrl_data = {
.num_groups = ARRAY_SIZE(meson_axg_aobus_groups),
.num_funcs = ARRAY_SIZE(meson_axg_aobus_functions),
.num_banks = ARRAY_SIZE(meson_axg_aobus_banks),
- .gpio_driver = &meson_axg_gpio_driver,
+ .gpio_driver = DM_DRIVER_REF(meson_axg_gpio),
.pmx_data = &meson_axg_aobus_pmx_banks_data,
};

diff --git a/drivers/pinctrl/meson/pinctrl-meson-axg.h b/drivers/pinctrl/meson/pinctrl-meson-axg.h
index c8d2b3af036..a6581bab500 100644
--- a/drivers/pinctrl/meson/pinctrl-meson-axg.h
+++ b/drivers/pinctrl/meson/pinctrl-meson-axg.h
@@ -61,6 +61,6 @@ struct meson_pmx_axg_data {
}

extern const struct pinctrl_ops meson_axg_pinctrl_ops;
-extern const struct driver meson_axg_gpio_driver;
+extern U_BOOT_DRIVER(meson_axg_gpio);

#endif /* __PINCTRL_MESON_AXG_H__ */
diff --git a/drivers/pinctrl/meson/pinctrl-meson-g12a.c b/drivers/pinctrl/meson/pinctrl-meson-g12a.c
index 24f47f82558..67114df6824 100644
--- a/drivers/pinctrl/meson/pinctrl-meson-g12a.c
+++ b/drivers/pinctrl/meson/pinctrl-meson-g12a.c
@@ -1253,7 +1253,7 @@ static struct meson_pinctrl_data meson_g12a_periphs_pinctrl_data = {
.num_groups = ARRAY_SIZE(meson_g12a_periphs_groups),
.num_funcs = ARRAY_SIZE(meson_g12a_periphs_functions),
.num_banks = ARRAY_SIZE(meson_g12a_periphs_banks),
- .gpio_driver = &meson_axg_gpio_driver,
+ .gpio_driver = DM_DRIVER_REF(meson_axg_gpio),
.pmx_data = &meson_g12a_periphs_pmx_banks_data,
};

@@ -1267,7 +1267,7 @@ static struct meson_pinctrl_data meson_g12a_aobus_pinctrl_data = {
.num_groups = ARRAY_SIZE(meson_g12a_aobus_groups),
.num_funcs = ARRAY_SIZE(meson_g12a_aobus_functions),
.num_banks = ARRAY_SIZE(meson_g12a_aobus_banks),
- .gpio_driver = &meson_axg_gpio_driver,
+ .gpio_driver = DM_DRIVER_REF(meson_axg_gpio),
.pmx_data = &meson_g12a_aobus_pmx_banks_data,
};

--
2.34.1


[PATCH 00/42] labgrid: Provide an integration with Labgrid

Simon Glass
 

Labgrid provides access to a hardware lab in an automated way. It is
possible to boot U-Boot on boards in the lab without physically touching
them. It relies on relays, USB UARTs and SD muxes, among other things.

By way of background, about 4 years ago I wrong a thing called Labman[1]
which allowed my lab of about 30 devices to be operated remotely, using
tbot for the console and build integration. While it worked OK and I
used it for many bisects, I didn't take it any further.

It turns out that there was already an existing program, called Labgrid,
which I did not know about at time (thank you Tom for telling me). It is
more rounded than Labman and has a number of advantages:

- does not need udev rules, mostly
- has several existing users who rely on it
- supports multiple machines exporting their devices

It lacks a 'lab check' feature and a few other things, but these can be
remedied.

On and off over the past several weeks I have been experimenting with
Labgrid. I have managed to create an initial U-Boot integration (this
series) by adding various features to Labgrid[2] and the U-Boot test
hooks.

I hope that this might inspire others to set up boards and run tests
automatically, rather than relying on infrequent, manual test. Perhaps
it may even be possible to have a number of labs available.

Included in the integration are a number of simple scripts which make it
easy to connect to boards and run tests:

ub-int <target>
Build and boot on a target, starting an interactive session

ub-cli <target>
Build and boot on a target, ensure U-Boot starts and provide an interactive
session from there

ub-smoke <target>
Smoke test U-Boot to check that it boots to a prompt on a target

ub-bisect
Bisect a git tree to locate a failure on a particular target

ub-pyt <target> <testspec>
Run U-Boot pytests on a target

Some of these help to provide the same tbot[4] workflow which I have
relied on for several years, albeit much simpler versions.

The goal here is to create some sort of script which can collect
patches from the mailing list, apply them and test them on a selection
of boards. I suspect that script already exists, so please let me know
what you suggest.

I hope you find this interesting and take a look!

[1]
[2]
[3]
[4]


Simon Glass (42):
trace: Update test to tolerate different trace-cmd version
binman: efi: Correct entry docs
binman: Regenerate nxp docs
binman: ti: Regenerate entry docs
binman: Update the entrydocs header
buildman: Make mrproper an argument to _reconfigure()
buildman: Make mrproper an argument to _config_and_build()
buildman: Make mrproper an argument to run_commit()
buildman: Avoid rebuilding when --mrproper is used
buildman: Add a flag to force mrproper on failure
buildman: Retry the build for current source
buildman: Add a way to limit the number of buildmans
dm: core: Enhance comments on bind_drivers_pass()
initcall: Correct use of relocation offset
am33xx: Provide a function to set up the debug UART
sunxi: Mark scp as optional
google: Disable TPMv2 on most Chromebooks
meson: Correct driver declaration for meson_axg_gpio
test: Allow signaling that U-Boot is ready
test: Make bootstd init run only on sandbox
test: Use a constant for the test timeout
test: Pass stderr to stdout
test: Release board after tests complete
log: Allow tests to pass with CONFIG_LOGF_FUNC_PAD set
test: Allow connecting to a running board
test: Decode exceptions only with sandbox
test: Avoid failing skipped tests
test: dm: Show failing driver name
test: Check help output
test: Create a common function to get the config
test: Introduce the concept of a role
test: Move the receive code into a function
test: Separate out the exception handling
test: Detect dead connections
test: Tidy up remaining exceptions
test: Introduce lab mode
test: Improve handling of sending commands
test: Fix mulptiplex_log typo
test: Avoid double echo when starting up
test: Try to shut down the lab console gracefully
test: Add a section for closing the connection
CI: Allow running tests on sjg lab

.gitlab-ci.yml | 151 +++++++++++++++++
arch/arm/dts/sunxi-u-boot.dtsi | 1 +
arch/arm/mach-omap2/am33xx/board.c | 18 +-
configs/chromebook_link64_defconfig | 1 +
configs/chromebook_link_defconfig | 1 +
configs/chromebook_samus_defconfig | 1 +
configs/chromebook_samus_tpl_defconfig | 1 +
configs/nyan-big_defconfig | 4 +-
configs/snow_defconfig | 1 +
drivers/core/lists.c | 16 ++
drivers/pinctrl/meson/pinctrl-meson-axg-pmx.c | 2 +-
drivers/pinctrl/meson/pinctrl-meson-axg.c | 4 +-
drivers/pinctrl/meson/pinctrl-meson-axg.h | 2 +-
drivers/pinctrl/meson/pinctrl-meson-g12a.c | 4 +-
lib/initcall.c | 6 +-
test/py/conftest.py | 86 ++++++++--
test/py/tests/test_dm.py | 5 +-
test/py/tests/test_help.py | 6 +-
test/py/tests/test_log.py | 11 +-
test/py/tests/test_trace.py | 6 +-
test/py/tests/test_ut.py | 1 +
test/py/u_boot_console_base.py | 154 ++++++++++++------
test/py/u_boot_console_exec_attach.py | 31 +++-
test/py/u_boot_console_sandbox.py | 2 +-
test/py/u_boot_spawn.py | 123 ++++++++++++--
test/test-main.c | 16 +-
tools/binman/entries.rst | 115 +++++++++----
tools/binman/entry.py | 2 +-
tools/binman/etype/efi_capsule.py | 40 ++---
tools/binman/etype/efi_empty_capsule.py | 22 +--
tools/binman/etype/ti_secure.py | 45 ++---
tools/buildman/builder.py | 18 +-
tools/buildman/builderthread.py | 44 +++--
tools/buildman/buildman.rst | 8 +-
tools/buildman/cmdline.py | 6 +-
tools/buildman/control.py | 141 +++++++++++++++-
tools/buildman/pyproject.toml | 6 +-
tools/buildman/test.py | 121 ++++++++++++++
tools/u_boot_pylib/terminal.py | 7 +-
39 files changed, 1003 insertions(+), 226 deletions(-)

--
2.34.1


Re: [PATCH 18/42] meson: Correct driver declaration for meson_axg_gpio

 

On 11/06/2024 22:01, Simon Glass wrote:
This should use the driver macros so that the driver appears in the
linker list. Fix this.
Fixes: 8587839f19d ("pinctrl: meson: add axg support")
Signed-off-by: Simon Glass <sjg@...>
---
drivers/pinctrl/meson/pinctrl-meson-axg-pmx.c | 2 +-
drivers/pinctrl/meson/pinctrl-meson-axg.c | 4 ++--
drivers/pinctrl/meson/pinctrl-meson-axg.h | 2 +-
drivers/pinctrl/meson/pinctrl-meson-g12a.c | 4 ++--
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/pinctrl/meson/pinctrl-meson-axg-pmx.c b/drivers/pinctrl/meson/pinctrl-meson-axg-pmx.c
index 52c726cf038..15ebd574ef1 100644
--- a/drivers/pinctrl/meson/pinctrl-meson-axg-pmx.c
+++ b/drivers/pinctrl/meson/pinctrl-meson-axg-pmx.c
@@ -179,7 +179,7 @@ static const struct dm_gpio_ops meson_axg_gpio_ops = {
.direction_output = meson_gpio_direction_output,
};
-const struct driver meson_axg_gpio_driver = {
+U_BOOT_DRIVER(meson_axg_gpio) = {
.name = "meson-axg-gpio",
.id = UCLASS_GPIO,
.probe = meson_gpio_probe,
diff --git a/drivers/pinctrl/meson/pinctrl-meson-axg.c b/drivers/pinctrl/meson/pinctrl-meson-axg.c
index 94e09cd3f8a..ed3f92b2d75 100644
--- a/drivers/pinctrl/meson/pinctrl-meson-axg.c
+++ b/drivers/pinctrl/meson/pinctrl-meson-axg.c
@@ -939,7 +939,7 @@ struct meson_pinctrl_data meson_axg_periphs_pinctrl_data = {
.num_groups = ARRAY_SIZE(meson_axg_periphs_groups),
.num_funcs = ARRAY_SIZE(meson_axg_periphs_functions),
.num_banks = ARRAY_SIZE(meson_axg_periphs_banks),
- .gpio_driver = &meson_axg_gpio_driver,
+ .gpio_driver = DM_DRIVER_REF(meson_axg_gpio),
.pmx_data = &meson_axg_periphs_pmx_banks_data,
};
@@ -953,7 +953,7 @@ struct meson_pinctrl_data meson_axg_aobus_pinctrl_data = {
.num_groups = ARRAY_SIZE(meson_axg_aobus_groups),
.num_funcs = ARRAY_SIZE(meson_axg_aobus_functions),
.num_banks = ARRAY_SIZE(meson_axg_aobus_banks),
- .gpio_driver = &meson_axg_gpio_driver,
+ .gpio_driver = DM_DRIVER_REF(meson_axg_gpio),
.pmx_data = &meson_axg_aobus_pmx_banks_data,
};
diff --git a/drivers/pinctrl/meson/pinctrl-meson-axg.h b/drivers/pinctrl/meson/pinctrl-meson-axg.h
index c8d2b3af036..a6581bab500 100644
--- a/drivers/pinctrl/meson/pinctrl-meson-axg.h
+++ b/drivers/pinctrl/meson/pinctrl-meson-axg.h
@@ -61,6 +61,6 @@ struct meson_pmx_axg_data {
}
extern const struct pinctrl_ops meson_axg_pinctrl_ops;
-extern const struct driver meson_axg_gpio_driver;
+extern U_BOOT_DRIVER(meson_axg_gpio);
#endif /* __PINCTRL_MESON_AXG_H__ */
diff --git a/drivers/pinctrl/meson/pinctrl-meson-g12a.c b/drivers/pinctrl/meson/pinctrl-meson-g12a.c
index 24f47f82558..67114df6824 100644
--- a/drivers/pinctrl/meson/pinctrl-meson-g12a.c
+++ b/drivers/pinctrl/meson/pinctrl-meson-g12a.c
@@ -1253,7 +1253,7 @@ static struct meson_pinctrl_data meson_g12a_periphs_pinctrl_data = {
.num_groups = ARRAY_SIZE(meson_g12a_periphs_groups),
.num_funcs = ARRAY_SIZE(meson_g12a_periphs_functions),
.num_banks = ARRAY_SIZE(meson_g12a_periphs_banks),
- .gpio_driver = &meson_axg_gpio_driver,
+ .gpio_driver = DM_DRIVER_REF(meson_axg_gpio),
.pmx_data = &meson_g12a_periphs_pmx_banks_data,
};
@@ -1267,7 +1267,7 @@ static struct meson_pinctrl_data meson_g12a_aobus_pinctrl_data = {
.num_groups = ARRAY_SIZE(meson_g12a_aobus_groups),
.num_funcs = ARRAY_SIZE(meson_g12a_aobus_functions),
.num_banks = ARRAY_SIZE(meson_g12a_aobus_banks),
- .gpio_driver = &meson_axg_gpio_driver,
+ .gpio_driver = DM_DRIVER_REF(meson_axg_gpio),
.pmx_data = &meson_g12a_aobus_pmx_banks_data,
};
Reviewed-by: Neil Armstrong <neil.armstrong@...>


[PATCH v1 1/3] mtd: rawnand: nand_base: support for 'NAND_IS_BOOT_MEDIUM' flag

Arseniy Krasnov
 

Based on Linux kernel:
commit f922bd798bb9 ("mtd: rawnand: add an option to specify NAND chip as a boot device")

Allow to define a NAND chip as a boot device. This can be helpful
for the selection of the ECC algorithm and strength in case the boot
ROM supports only a subset of controller provided options.

Signed-off-by: Arseniy Krasnov <avkrasnov@...>
---
drivers/mtd/nand/raw/nand_base.c | 3 +++
include/linux/mtd/rawnand.h | 6 ++++++
2 files changed, 9 insertions(+)

diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
index c40a0f23d7..ed605b4af5 100644
--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -4458,6 +4458,9 @@ static int nand_dt_init(struct mtd_info *mtd, struct nand_chip *chip, ofnode nod
if (ret == 16)
chip->options |= NAND_BUSWIDTH_16;

+ if (ofnode_read_bool(node, "nand-is-boot-medium"))
+ chip->options |= NAND_IS_BOOT_MEDIUM;
+
if (ofnode_read_bool(node, "nand-on-flash-bbt"))
chip->bbt_options |= NAND_BBT_USE_FLASH;

diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h
index fb002ae641..4eb880d8fb 100644
--- a/include/linux/mtd/rawnand.h
+++ b/include/linux/mtd/rawnand.h
@@ -218,6 +218,12 @@ enum nand_ecc_algo {
/* Device needs 3rd row address cycle */
#define NAND_ROW_ADDR_3 0x00004000

+/*
+ * Whether the NAND chip is a boot medium. Drivers might use this information
+ * to select ECC algorithms supported by the boot ROM or similar restrictions.
+ */
+#define NAND_IS_BOOT_MEDIUM 0x00400000
+
/* Options valid for Samsung large page devices */
#define NAND_SAMSUNG_LP_OPTIONS NAND_CACHEPRG

--
2.35.0


[PATCH v1 2/3] mtd: rawnand: meson: refactor use of 'meson_nfc_cmd_access()'

Arseniy Krasnov
 

Move call 'meson_nfc_cmd_seed()' and check for 'NAND_NEED_SCRAMBLING'
to 'meson_nfc_cmd_access()', thus removing code duplication.

Signed-off-by: Arseniy Krasnov <avkrasnov@...>
---
drivers/mtd/nand/raw/meson_nand.c | 30 ++++++++++++------------------
1 file changed, 12 insertions(+), 18 deletions(-)

diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c
index 5d411c4594..19f005202b 100644
--- a/drivers/mtd/nand/raw/meson_nand.c
+++ b/drivers/mtd/nand/raw/meson_nand.c
@@ -229,14 +229,19 @@ static void meson_nfc_cmd_seed(const struct meson_nfc *nfc, u32 seed)
nfc->reg_base + NFC_REG_CMD);
}

-static void meson_nfc_cmd_access(struct nand_chip *nand, bool raw, bool dir,
- int scrambler)
+static void meson_nfc_cmd_access(struct nand_chip *nand, bool raw, bool dir, int page)
{
struct mtd_info *mtd = nand_to_mtd(nand);
const struct meson_nfc *nfc = nand_get_controller_data(mtd_to_nand(mtd));
const struct meson_nfc_nand_chip *meson_chip = to_meson_nand(nand);
u32 bch = meson_chip->bch_mode, cmd;
int len = mtd->writesize, pagesize, pages;
+ int scrambler;
+
+ if (nand->options & NAND_NEED_SCRAMBLING)
+ scrambler = NFC_CMD_SCRAMBLER_ENABLE;
+ else
+ scrambler = NFC_CMD_SCRAMBLER_DISABLE;

pagesize = nand->ecc.size;

@@ -252,6 +257,9 @@ static void meson_nfc_cmd_access(struct nand_chip *nand, bool raw, bool dir,
cmd = CMDRWGEN(DMA_DIR(dir), scrambler, bch,
NFC_CMD_SHORTMODE_DISABLE, pagesize, pages);

+ if (scrambler == NFC_CMD_SCRAMBLER_ENABLE)
+ meson_nfc_cmd_seed(nfc, page);
+
writel(cmd, nfc->reg_base + NFC_REG_CMD);
}

@@ -566,14 +574,7 @@ static int meson_nfc_write_page_sub(struct nand_chip *nand,
return ret;
}

- if (nand->options & NAND_NEED_SCRAMBLING) {
- meson_nfc_cmd_seed(nfc, page);
- meson_nfc_cmd_access(nand, raw, DIRWRITE,
- NFC_CMD_SCRAMBLER_ENABLE);
- } else {
- meson_nfc_cmd_access(nand, raw, DIRWRITE,
- NFC_CMD_SCRAMBLER_DISABLE);
- }
+ meson_nfc_cmd_access(nand, raw, DIRWRITE, page);

cmd = nfc->param.chip_select | NFC_CMD_CLE | NAND_CMD_PAGEPROG;
writel(cmd, nfc->reg_base + NFC_REG_CMD);
@@ -644,14 +645,7 @@ static int meson_nfc_read_page_sub(struct nand_chip *nand,
if (ret)
return ret;

- if (nand->options & NAND_NEED_SCRAMBLING) {
- meson_nfc_cmd_seed(nfc, page);
- meson_nfc_cmd_access(nand, raw, DIRREAD,
- NFC_CMD_SCRAMBLER_ENABLE);
- } else {
- meson_nfc_cmd_access(nand, raw, DIRREAD,
- NFC_CMD_SCRAMBLER_DISABLE);
- }
+ meson_nfc_cmd_access(nand, raw, DIRREAD, page);

meson_nfc_wait_dma_finish(nfc);
meson_nfc_check_ecc_pages_valid(nfc, nand, raw);
--
2.35.0


[PATCH v1 0/3] Meson: R/W support for pages used by boot ROM

Arseniy Krasnov
 

Patchset is based on patchset for Linux (today merged to nand-next):


Here is description from it:

> Amlogic's boot ROM code needs that some pages on NAND must be written
> in special "short" ECC mode with scrambling enabled. Such pages:
> 1) Contain some metadata about hardware.
> 2) Located with some interval starting from 0 offset, until some
> specified offset. Interval and second offset are set in the
> device tree.
>
> This patchset adds R/W support for such pages. To enable it we can setup
> it in dts:
>
> nand-is-boot-medium;
> amlogic,boot-pages = <1024>;
> amlogic,boot-page-step = <128>;
>
> It means that each 128th page in range 0 to 1024 pages will be accessed
> in special mode ("short" ECC + scrambling). In practice this feature is
> needed when we want to update first block of NAND - driver will enable
> required mode by itself using value from device tree.

The only difference is that patchset for Linux updates DT bindings, while
this adds NAND_IS_BOOT_MEDIUM flag support.

Arseniy Krasnov (3):
mtd: rawnand: nand_base: support for 'NAND_IS_BOOT_MEDIUM' flag
mtd: rawnand: meson: refactor use of 'meson_nfc_cmd_access()'
mtd: rawnand: meson: read/write access for boot ROM pages

drivers/mtd/nand/raw/meson_nand.c | 84 +++++++++++++++++++++----------
drivers/mtd/nand/raw/nand_base.c | 3 ++
include/linux/mtd/rawnand.h | 6 +++
3 files changed, 66 insertions(+), 27 deletions(-)

--
2.35.0