fdtdec: match an alias to its stem only when the number follows it
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Simon Glass
Reviewed-byQuoted 15 lines · Mehmet Fide
fdtdec: match an alias to its stem only when the number follows it
fdtdec_get_alias_seq()andfdtdec_get_alias_highest_id()compare the alias name with the stem bystrncmp()over the length of the stem, so every alias that starts with the stem counts. On a Colibri VF50 the aliases usbphy0 and usbphy1 matched the "usb" stem, the two USB controllers were given the sequence numbers 2 and 3, and ehci-vf indexed its two-entry tables with them. The live tree disagrees: thereof_alias_scan()splits an alias into the stem and the number andof_alias_get_id()compares the stem exactly.Match an alias only when the stem is followed by its number, as the live tree does. A test covers both lookups with the sandbox aliases, where "test" is a prefix of testbus3 and of the testfdt aliases.
Quoted 5 lines
Signed-off-by Mehmet Fide <[email protected]>lib/fdtdec.c | 43 ++++++++++++++++++++++++++++++------------- test/dm/fdtdec.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 13 deletions(-)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Simon Glass
Reviewed-byRe: [PATCH v6 2/8] usb: ehci-vf: take the controller index from the device tree
Quoted 11 lines · Mehmet Fide
usb: ehci-vf: take the controller index from the device tree
"usb start" on a Colibri VF50 or VF61 ends in a data abort and a watchdog reset.
vf_usb_of_to_plat()takes the controller index fromdev_seq(), but the usbphy0 and usbphy1 aliases count as "usb" aliases when the uclass numbers its devices, so the two controllers get 2 and 3 and index past the two entries of phy_bases[] and nc_reg_bases[].usb_oc_config()then writes through an address read from beyond the table.
Quoted 8 lines
Follow the fsl,usbphy phandle, as ehci-mx6 does, and map the PHY node to the index of the table instead of trusting the sequence number.
Signed-off-by Mehmet Fide <[email protected]>Reviewed-by Marek Vasut <[email protected]>drivers/usb/host/ehci-vf.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Simon Glass
Reviewed-byRe: [PATCH v6 3/8] usb: ehci-vf: remove the code path for a build without DM_USB
Quoted 8 lines · Mehmet Fide
usb: ehci-vf: remove the code path for a build without
DM_USB
USB_EHCI_HCDselectsUSB_HOST, andUSB_HOSTselectsDM_USB, so the !CONFIG_IS_ENABLED(DM_USB) branch of this driver can never be selected. It also cannot compile:ehci_hcd_init()callsehci_vf_common_init()with one argument while the function takes two, so the branch has been dead since the controller was added as a second parameter.
Quoted 8 lines
Remove it, together with the
board_usb_phy_mode()hook that no board implements and nothing else calls.Signed-off-by Mehmet Fide <[email protected]>Reviewed-by Marek Vasut <[email protected]>drivers/usb/host/ehci-vf.c | 49 ---------------------------------------------- 1 file changed, 49 deletions(-)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Simon Glass
Reviewed-byRe: [PATCH v6 4/8] usb: ehci-vf: drop the empty bind hook
Quoted 7 lines · Mehmet Fide
usb: ehci-vf: drop the empty bind hook
vf_usb_bind()only returns 0. Its comment describes a hack that keeps the second controller from taking sequence number 0, but no such code is there, and an empty .bind cannot influence the numbering the uclass does. Remove it.
Quoted 5 lines
Signed-off-by Mehmet Fide <[email protected]>Reviewed-by Marek Vasut <[email protected]>drivers/usb/host/ehci-vf.c | 15 --------------- 1 file changed, 15 deletions(-)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Simon Glass
Reviewed-byRe: [PATCH v6 5/8] dm: core: add ofnode_get_alias_seq()
Quoted 20 lines · Mehmet Fide
dm: core: add
ofnode_get_alias_seq()The sequence number an aliases entry gives a node can only be looked up for a device, through
dev_read_alias_seq(). A driver that has to know the number of a node it does not own, one it reached through a phandle for instance, has no livetree call for it and is left with fdtdec.Move the body of
dev_read_alias_seq()to the ofnode level and let both of its variants call it. The flat lookup reads the tree the node belongs to instead ofgd->fdt_blob. The live lookup covered the control tree only, asof_alias_scan()builds its table from that tree; a node of another tree is now looked up in the /aliases node of its own tree. The stem must match the alias exactly, which the previous patch makes the flat lookup do as well.Tests check the lookup on the live and on the flat tree, with a stem that is only a prefix of an alias, and on another tree.
Signed-off-by Mehmet Fide <[email protected]>
Quoted 9 lines
arch/sandbox/dts/other.dts | 5 +++++ drivers/core/of_access.c | 42 +++++++++++++++++++++++++++++++++++++++ drivers/core/ofnode.c | 20 +++++++++++++++++++ drivers/core/read.c | 20 ++----------------- include/dm/of_access.h | 7 +++++-- include/dm/ofnode.h | 16 +++++++++++++++ include/dm/read.h | 8 ++------ test/dm/ofnode.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 141 insertions(+), 26 deletions(-)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Simon Glass
Reviewed-byRe: [PATCH v6 6/8] usb: ehci-vf: use usb_get_dr_mode()
Quoted 9 lines · Mehmet Fide
usb: ehci-vf: use
usb_get_dr_mode()The driver parses the
dr_modeproperty itself, through the flat tree, into an enum of its own that mirrors enumusb_dr_mode. Useusb_get_dr_mode()and USB_DR_MODE_* instead, as ehci-mx6 does, and take the ID detect GPIO through the device rather than its flat node. Adr_modevalue the driver does not know now means host, as a missing property already did.
Quoted 4 lines
Signed-off-by Mehmet Fide <[email protected]>drivers/usb/host/ehci-vf.c | 65 ++++++++++------------------------------------ 1 file changed, 14 insertions(+), 51 deletions(-)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Simon Glass
Reviewed-byRe: [PATCH v6 7/8] usb: ehci-vf: take the register bases from the device tree
Quoted 14 lines · Mehmet Fide
usb: ehci-vf: take the register bases from the device tree
The driver keeps its own tables of PHY and controller base addresses and reaches the anatop block through a hardcoded address, although the device tree describes all three: the controller points at its PHY and usbmisc nodes, and the PHY at its anatop.
Read them from there and drop the tables: the two phandles of the controller node through
dev_read_phandle_with_args(), the anatop one from the PHY node. The helpers take the private data instead of single addresses. The port number stays only for the choice between PLL3 and PLL7, which the device tree does not express, and now comes from the usbphy alias of the PHY node.
Quoted 7 lines
The usbmisc node already starts at the non-core registers, so the driver no longer adds an offset to reach them.
Signed-off-by Mehmet Fide <[email protected]>drivers/usb/host/ehci-vf.c | 132 ++++++++++++++++++++++++--------------------- 1 file changed, 72 insertions(+), 60 deletions(-)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Simon Glass
Reviewed-byRe: [PATCH v6 8/8] usb: ehci-vf: enable the vbus supply of the port
Quoted 11 lines · Mehmet Fide
usb: ehci-vf: enable the vbus supply of the port
The driver never enables the vbus-supply of its port, so on boards that switch VBUS through a regulator, such as the Colibri VF50 and VF61 carriers, the port stays unpowered and no device is found.
Do what ehci-mx6 does: look the regulator up in probe, enable it in host mode, disable it in device mode, and turn it off on remove. A missing vbus-supply or a build without
DM_REGULATORis fine; any other lookup error fails the probe instead of leaving the port dead.
Quoted 5 lines
Signed-off-by Mehmet Fide <[email protected]>Reviewed-by Marek Vasut <[email protected]>drivers/usb/host/ehci-vf.c | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-)