meta-somdevices: Add u-boot-somdevices-mfgtool.
authorJosep Orga <jorga@somdevices.com>
Thu, 12 Jan 2023 12:10:31 +0000 (13:10 +0100)
committerJosep Orga <jorga@somdevices.com>
Thu, 12 Jan 2023 12:10:31 +0000 (13:10 +0100)
Signed-off-by: Josep Orga <jorga@somdevices.com>
recipes-bsp/u-boot/files/0001-mfgtools-imx8mm-somdevices-Commit-to-boot-from-USB-m.patch [new file with mode: 0644]
recipes-bsp/u-boot/files/0002-mfgtools-imx8mm-somdevices-Commit-for-USB-mfgtools-c.patch [new file with mode: 0644]
recipes-bsp/u-boot/u-boot-somdevices-mfgtool_2021.04.bb [new file with mode: 0644]

diff --git a/recipes-bsp/u-boot/files/0001-mfgtools-imx8mm-somdevices-Commit-to-boot-from-USB-m.patch b/recipes-bsp/u-boot/files/0001-mfgtools-imx8mm-somdevices-Commit-to-boot-from-USB-m.patch
new file mode 100644 (file)
index 0000000..890d16c
--- /dev/null
@@ -0,0 +1,40 @@
+From 8382aa7188b6f560b1f3d8362bab923a6d0bcef8 Mon Sep 17 00:00:00 2001
+From: Josep Orga <jorga@somdevices.com>
+Date: Wed, 12 Jan 2022 13:19:02 +0100
+Subject: [PATCH 1/2] mfgtools: imx8mm-somdevices: Commit to boot from USB
+ mfgtools.
+
+Signed-off-by: Josep Orga <jorga@somdevices.com>
+---
+ drivers/usb/gadget/ci_udc.c      | 1 +
+ drivers/usb/imx/usb-mx6-common.c | 2 +-
+ 2 files changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/usb/gadget/ci_udc.c b/drivers/usb/gadget/ci_udc.c
+index 441e43cda0..f047022ada 100644
+--- a/drivers/usb/gadget/ci_udc.c
++++ b/drivers/usb/gadget/ci_udc.c
+@@ -1338,6 +1338,7 @@ static int ci_udc_otg_phy_mode(struct udevice *dev)
+               phy_status = (void __iomem *)(phy_base +
+                                             USBNC_PHY_STATUS_OFFSET);
+               val = readl(phy_status);
++              return USB_INIT_DEVICE;
+               if (val & USBNC_PHYSTATUS_ID_DIG)
+                       return USB_INIT_DEVICE;
+               else
+diff --git a/drivers/usb/imx/usb-mx6-common.c b/drivers/usb/imx/usb-mx6-common.c
+index d2dd715eaf..4968e56caf 100644
+--- a/drivers/usb/imx/usb-mx6-common.c
++++ b/drivers/usb/imx/usb-mx6-common.c
+@@ -314,7 +314,7 @@ int usb_phy_mode(int port)
+       u32 val;
+       val = readl(status);
+-
++      return USB_INIT_DEVICE;
+       if (val & USBNC_PHYSTATUS_ID_DIG)
+               return USB_INIT_DEVICE;
+       else
+-- 
+2.17.1
+
diff --git a/recipes-bsp/u-boot/files/0002-mfgtools-imx8mm-somdevices-Commit-for-USB-mfgtools-c.patch b/recipes-bsp/u-boot/files/0002-mfgtools-imx8mm-somdevices-Commit-for-USB-mfgtools-c.patch
new file mode 100644 (file)
index 0000000..8740e02
--- /dev/null
@@ -0,0 +1,76 @@
+From 6cad2856920b0311e4ea1c5efa9c5aedc1708973 Mon Sep 17 00:00:00 2001
+From: Josep Orga <jorga@somdevices.com>
+Date: Wed, 12 Jan 2022 13:21:34 +0100
+Subject: [PATCH 2/2] mfgtools: imx8mm-somdevices: Commit for USB mfgtools
+ consistency.
+
+Signed-off-by: Josep Orga <jorga@somdevices.com>
+---
+ drivers/usb/gadget/ci_udc.c      | 3 +++
+ drivers/usb/host/ehci-mx6.c      | 2 ++
+ drivers/usb/imx/usb-mx6-common.c | 1 +
+ 3 files changed, 6 insertions(+)
+
+diff --git a/drivers/usb/gadget/ci_udc.c b/drivers/usb/gadget/ci_udc.c
+index f047022ada..eb3ba57bdd 100644
+--- a/drivers/usb/gadget/ci_udc.c
++++ b/drivers/usb/gadget/ci_udc.c
+@@ -1046,6 +1046,7 @@ static int ci_udc_otg_phy_mode2(ulong phy_addr)
+       if (is_mx6() || is_mx7ulp() || is_imx8()) {
+               phy_ctrl = (void __iomem *)(phy_base + USBPHY_CTRL);
+               val = readl(phy_ctrl);
++              return USB_INIT_DEVICE;
+               if (val & USBPHY_CTRL_OTG_ID)
+                       return USB_INIT_DEVICE;
+               else
+@@ -1054,6 +1055,7 @@ static int ci_udc_otg_phy_mode2(ulong phy_addr)
+               phy_status = (void __iomem *)(phy_base +
+                                             USBNC_PHY_STATUS_OFFSET);
+               val = readl(phy_status);
++              return USB_INIT_DEVICE;
+               if (val & USBNC_PHYSTATUS_ID_DIG)
+                       return USB_INIT_DEVICE;
+               else
+@@ -1330,6 +1332,7 @@ static int ci_udc_otg_phy_mode(struct udevice *dev)
+               phy_ctrl = (void __iomem *)(phy_base + USBPHY_CTRL);
+               val = readl(phy_ctrl);
++              return USB_INIT_DEVICE;
+               if (val & USBPHY_CTRL_OTG_ID)
+                       return USB_INIT_DEVICE;
+               else
+diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c
+index 57b0e5c548..ecc5b257b2 100644
+--- a/drivers/usb/host/ehci-mx6.c
++++ b/drivers/usb/host/ehci-mx6.c
+@@ -249,6 +249,7 @@ static int ehci_usb_phy_mode(struct udevice *dev)
+                       priv->init_type = USB_INIT_DEVICE;
+               else
+                       priv->init_type = USB_INIT_HOST;
++              priv->init_type = USB_INIT_DEVICE;
+       } else if (is_mx7() || is_imx8mm() || is_imx8mn()) {
+               phy_status = (void __iomem *)(priv->phy_base +
+                                             USBNC_PHY_STATUS_OFFSET);
+@@ -258,6 +259,7 @@ static int ehci_usb_phy_mode(struct udevice *dev)
+                       priv->init_type = USB_INIT_DEVICE;
+               else
+                       priv->init_type = USB_INIT_HOST;
++              priv->init_type = USB_INIT_DEVICE;
+       } else {
+               return -EINVAL;
+       }
+diff --git a/drivers/usb/imx/usb-mx6-common.c b/drivers/usb/imx/usb-mx6-common.c
+index 4968e56caf..c8de06d7d0 100644
+--- a/drivers/usb/imx/usb-mx6-common.c
++++ b/drivers/usb/imx/usb-mx6-common.c
+@@ -240,6 +240,7 @@ int usb_phy_mode(int port)
+       val = readl(phy_ctrl);
++      return USB_INIT_DEVICE;
+       if (val & USBPHY_CTRL_OTG_ID)
+               return USB_INIT_DEVICE;
+       else
+-- 
+2.17.1
+
diff --git a/recipes-bsp/u-boot/u-boot-somdevices-mfgtool_2021.04.bb b/recipes-bsp/u-boot/u-boot-somdevices-mfgtool_2021.04.bb
new file mode 100644 (file)
index 0000000..12c5901
--- /dev/null
@@ -0,0 +1,18 @@
+require u-boot-somdevices_2021.04.bb
+require recipes-bsp/u-boot/u-boot-mfgtool.inc
+
+SRC_URI_append = " file://0001-mfgtools-imx8mm-somdevices-Commit-to-boot-from-USB-m.patch \
+                  file://0002-mfgtools-imx8mm-somdevices-Commit-for-USB-mfgtools-c.patch "
+
+SPL_IMAGE = "${SPL_BINARYNAME}-${MACHINE}-mfgtool-${PV}-${PR}"
+SPL_SYMLINK = "${SPL_BINARYNAME}-${MACHINE}-mfgtool"
+
+#README: To have flash_evk mfgtool binary:
+## Change UBOOT_CONFIG ??= "sd" to UBOOT_CONFIG ??= "mfgtool" at imx8mmsomdevices-conf file
+## Clean u-boot (with for example 'bitbake -c cleansstate u-boot-somdevices')
+## Execute 'bitbake u-boot-somdevices' with default configuration
+## Execute 'bitbake u-boot-somdevices-mfgtool'
+### Solve '** u-boot-somdevices-mfgtool ** files already exist' error removing files
+## After removing files (three files) execute 'bitbake u-boot-somdevices-mfgtool'
+## Clean imx-boot (with for example 'bitbake -c cleansstate imx-boot')
+## Execute 'bitbake imx-boot'