usb: dwc3-generic: support i.MX flattened DT
Subsystems (2)
PATCH 1/1 usb: dwc3-generic: support i.MX flattened DT
The i.MX95 devicetree doesn't use a glue node with dwc3 as a subnode and now has a single flattened "nxp,imx95-dwc3/imx8mp-dwc3" node, with the register regions described by reg-names. The i.MX8MP devicetree too is expected to move to the same binding.
Reuse the existing glue_get_ctrl_dev op to bind dwc3 to the glue node itself, and look up the glue registers by name when using the new binding.
Tested on the i.MX95 Mecha Comet.
--- drivers/usb/dwc3/dwc3-generic.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)
drivers/usb/dwc3/dwc3-generic.c +20 -2
@@ -325,10 +325,22 @@ void dwc3_imx8mp_glue_configure(struct udevice *dev, int index,#define USB_CTRL1_OC_POLARITY BIT(16)/* 0 - HIGH / 1 - LOW */ #define USB_CTRL1_PWR_POLARITY BIT(17)/* 0 - HIGH / 1 - LOW */ -fdt_addr_t regs =dev_read_addr_index (dev,1 ); -void *base =map_physmem (regs,0x8 ,MAP_NOCACHE ); +fdt_addr_t regs; +void *base;u32 value; +if (device_is_compatible (dev,"nxp,imx8mp-dwc3" )) + regs =dev_read_addr_name (dev,"glue" ); +else + regs =dev_read_addr_index (dev,1 ); + +if (regs ==FDT_ADDR_T_NONE ) { +dev_err (dev,"missing glue registers\n" ); +return ; + } + + base =map_physmem (regs,0x8 ,MAP_NOCACHE ); + value =readl (base +USB_CTRL0 );if (dev_read_bool (dev,"fsl,permanently-attached" ))
@@ -548,6 +560,11 @@ static const struct dwc3_glue_ops rk_ops = { .glue_get_ctrl_dev = dwc3_flat_dt_get_ctrl_dev, }; +static const struct dwc3_glue_ops imx8mp_flat_dt_ops = { + .glue_configure = dwc3_imx8mp_glue_configure, + .glue_get_ctrl_dev = dwc3_flat_dt_get_ctrl_dev, +}; +static int dwc3_glue_bind_common (struct udevice *parent,ofnode node) {const char *name =ofnode_get_name (node);
@@ -758,6 +775,7 @@ static const struct udevice_id dwc3_glue_ids[] = { { .compatible = "qcom,dwc3", .data = (ulong)&qcom_ops }, { .compatible = "qcom,snps-dwc3", .data = (ulong)&qcom_flat_dt_ops }, { .compatible = "fsl,imx8mp-dwc3", .data = (ulong)&imx8mp_ops }, + { .compatible = "nxp,imx8mp-dwc3", .data = (ulong)&imx8mp_flat_dt_ops }, { .compatible = "fsl,imx8mq-dwc3" }, { .compatible = "intel,tangier-dwc3" }, { .compatible = "samsung,exynos7870-dwusb3" },
Signature · 1 line
2.56.1
Quoted 1 line · Advait Dhamorikar
The i.MX8MP devicetree too is expected to move to the same binding.
Not anymore
Due to the compatibility issue, we give up on merging this patchset at the end.
from https://lore.kernel.org/all/wsvzr6sl6xg3j7oqn24ohjoi2shftat3lxc4nl5j4gazax2ham@oz5c3jjyboxf/
Francesco
Quoted 1 line
Not anymore
I thought it was on hiatus, didn't know it was dropped altogether. The i.MX95 is supported though, I'll submit a v2 corresponding to just it then.
Best regards,
Advait