i.MX7D USB improvements, HSIC support
Subsystems (5)
cover i.MX7D USB improvements, HSIC support
This series makes significant improvements to i.MX7D USB support, including:
- Power domain support
- CONFIG_PHY support (NOP_PHY, used to hook up the power domain)
- power-active-high DT property
- A HSIC-specific workaround for an i.MX7D hardware bug
PHY and power domain support allows the HSIC interface as found on the TQMa7 to work. Without this series, running a command like usb start would attempt to put the USB controller into HSIC mode without enabling the prerequisite power domains first, resulting in a hang of the system.
For tqma7_mba7_mmc_defconfig, u-boot-with-spl.imx grows from 729K to 736K. Configurations that don't enable the newly supported regulator and power domain drivers should be largely unchanged.
Nora Schiffer (16):
phy: introduce generic_phy_get_by_phandle_args()
regulator: anatop: fix probe without vin-supply
regulator: anatop: add support for anatop-enable-bit
power: domain: rename imx8m-power-domain to imx-gpcv2-power-domain
power: domain: imx-gpcv2: do not unconditionally select CONFIG_CLK
power: domain: imx-gpcv2: set CPU domain mapping on probe
power: domain: imx-gpcv2: add support for power-supply regulator
power: domain: imx-gpcv2: add support for i.MX7D
usb: ehci-mx6: set up i.MX7D misc registers regardless of CONFIG_PHY
setting
usb: ehci-mx6: unconditionally run usb_oc_config()
usb: ehci-mx6: add support for power-active-high property
usb: ehci-mx6: handle fsl,usbphy with CONFIG_PHY
usb: ehci: allow overriding port enable operation
usb: ehci-mx6: force HSIC ports to HS mode during port enable
configs: tqma6ul: drop obsolete CONFIG_MXC_USB_OTG_HACTIVE symbol
configs: tqma7: enable PHY and power domain support for USB HSIC
configs/imx8m_data_modul.config | 2 +-
configs/imx8mm-cl-iot-gate-optee_defconfig | 2 +-
configs/imx8mm-cl-iot-gate_defconfig | 2 +-
configs/imx8mm-mx8menlo_defconfig | 2 +-
configs/imx8mm-phygate-tauri-l_defconfig | 2 +-
configs/imx8mm_evk_defconfig | 2 +-
configs/imx8mm_phg_defconfig | 2 +-
configs/imx8mm_venice_defconfig | 2 +-
configs/imx8mn_venice_defconfig | 2 +-
configs/imx8mp-libra-fpsc_defconfig | 2 +-
configs/imx8mp_dhsom.config | 2 +-
configs/imx8mp_evk_defconfig | 2 +-
configs/imx8mp_venice_defconfig | 2 +-
configs/imx8mq_evk_defconfig | 2 +-
configs/imx8mq_phanbell_defconfig | 2 +-
configs/imx8mq_reform2_defconfig | 2 +-
configs/kontron-osm-s-mx8mp.config | 2 +-
configs/kontron-sl-mx8mm_defconfig | 2 +-
configs/kontron_pitx_imx8m_defconfig | 2 +-
configs/librem5-devkit_defconfig | 2 +-
configs/librem5_defconfig | 2 +-
configs/phycore-imx8mm_defconfig | 2 +-
configs/phycore-imx8mp_defconfig | 2 +-
configs/pico-imx8mq_defconfig | 2 +-
configs/toradex-smarc-imx8mp_defconfig | 2 +-
configs/tqma6ul_common.config | 1 -
configs/tqma7_common.config | 6 +-
configs/verdin-imx8mm_defconfig | 2 +-
configs/verdin-imx8mp_defconfig | 2 +-
drivers/phy/phy-uclass.c | 35 ++--
drivers/power/domain/Kconfig | 14 +-
drivers/power/domain/Makefile | 2 +-
...ower-domain.c => imx-gpcv2-power-domain.c} | 151 ++++++++++++++---
drivers/power/regulator/anatop_regulator.c | 42 ++++-
drivers/usb/host/ehci-hcd.c | 15 +-
drivers/usb/host/ehci-mx6.c | 159 ++++++++++++------
drivers/usb/host/ehci.h | 2 +
include/generic-phy.h | 29 ++++
include/usb/ehci-ci.h | 1 +
39 files changed, 377 insertions(+), 134 deletions(-)
rename drivers/power/domain/{imx8m-power-domain.c => imx-gpcv2-power-domain.c} (76%)Signature · 1 line
2.55.0
PATCH 1/16 phy: introduce generic_phy_get_by_phandle_args()
Add a generic_phy_get_*() variant that allows the caller to resolve non-standard attributes like fsl,usbphy.
--- drivers/phy/phy-uclass.c | 35 +++++++++++++++++++++++------------ include/generic-phy.h | 29 +++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 12 deletions(-)
drivers/phy/phy-uclass.c +23 -12
@@ -137,25 +137,14 @@ static int generic_phy_xlate_offs_flags(struct phy *phy,return 0 ; } -int generic_phy_get_by_index_nodev (ofnode node,int index,struct phy *phy) +int generic_phy_get_by_phandle_args (struct ofnode_phandle_args args,struct phy *phy) { -struct ofnode_phandle_args args;struct phy_ops *ops;struct udevice *phydev, *supply =NULL ;int i, ret; -debug ("%s(node=%s, index=%d, phy=%p)\n" , - __func__,ofnode_get_name (node), index, phy); -assert (phy); phy->dev =NULL ; - ret =ofnode_parse_phandle_with_args (node,"phys" ,"#phy-cells" ,0 , - index, &args); -if (ret) { -debug ("%s: dev_read_phandle_with_args failed: err=%d\n" , - __func__, ret); -return ret; - } ret =uclass_get_device_by_ofnode (UCLASS_PHY , args.node, &phydev);if (ret) {
@@ -213,6 +202,28 @@ err:return ret; } +int generic_phy_get_by_index_nodev (ofnode node,int index,struct phy *phy) +{ +struct ofnode_phandle_args args; +int ret; + +debug ("%s(node=%s, index=%d, phy=%p)\n" , + __func__,ofnode_get_name (node), index, phy); + +assert (phy); + phy->dev =NULL ; + + ret =ofnode_parse_phandle_with_args (node,"phys" ,"#phy-cells" ,0 , + index, &args); +if (ret) { +debug ("%s: dev_read_phandle_with_args failed: err=%d\n" , + __func__, ret); +return ret; + } + +return generic_phy_get_by_phandle_args (args, phy); +} +int generic_phy_get_by_index (struct udevice *dev,int index,struct phy *phy) {
include/generic-phy.h +29 -0
@@ -360,6 +360,35 @@ int generic_phy_get_by_index_nodev(ofnode node, int index, struct phy *phy);int generic_phy_get_by_name (struct udevice *user,const char *phy_name,struct phy *phy); +/** +* generic_phy_get_by_phandle_args() - Get a PHY device by phandle arguments +* without a device +* +* @args: The resolved phandle arguments +* @phy: A pointer to the PHY port +* +* This is a version of generic_phy_get_by_*() that allows the caller to resolve +* a phandle itself, for example to handle non-standard property names. +* +* example: +* usb1: usb_otg_ss@xxx { +* compatible = "xxx"; +* reg = <xxx>; +* . +* . +* fsl,usbphy = <&usbphy>; +* . +* . +* }; +* Here, the PHY is referenced using a vendor-specific property +* rather than using the generic 'phys', so it must be resolved using +* ofnode_parse_phandle_with_args() and then passed to +* generic_phy_get_by_phandle_args(). +* +* Return: 0 if OK, or a negative error code +*/ +int generic_phy_get_by_phandle_args (struct ofnode_phandle_args args,struct phy *phy); +/** * generic_phy_get_bulk - Get all phys of a device. *
Signature · 1 line
2.55.0
PATCH 2/16 regulator: anatop: fix probe without vin-supply
In reply to Nora Schifferdevice_get_supply_regulator() returns -ENOENT, not -ENODEV when no supply exists. This fixes the probe on i.MX7D.
--- drivers/power/regulator/anatop_regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/regulator/anatop_regulator.c +1 -1
@@ -176,7 +176,7 @@ static int anatop_regulator_probe(struct udevice *dev) ret =device_get_supply_regulator (dev,"vin-supply" , &anatop_reg->supply); -if (ret != -ENODEV ) { +if (ret != -ENOENT ) {if (ret)return log_msg_ret ("get vin-supply" , ret);
Signature · 1 line
2.55.0
PATCH 3/16 regulator: anatop: add support for anatop-enable-bit
In reply to Nora SchifferSome variants of the anatop like the one found on the i.MX7D need to be enabled. Add support for the anatop-enable-bit property that is used for this purpose.
Instances without this property are considered to be always enabled, and attempting to disable them will fail.
--- drivers/power/regulator/anatop_regulator.c | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+)
drivers/power/regulator/anatop_regulator.c +40 -0
@@ -42,6 +42,7 @@ struct anatop_regulator {u32 delay_reg;u32 delay_bit_shift;u32 delay_bit_width; +u32 enable_mask; }; static u32 anatop_get_bits(struct udevice *dev, u32 addr, int bit_shift,
@@ -154,9 +155,42 @@ static int anatop_set_voltage(struct udevice *dev, int uV)return ret; } +static int anatop_set_enable (struct udevice *dev,bool enable) +{ +const struct anatop_regulator *anatop_reg =dev_get_plat (dev); + +dev_dbg (dev,"enable = %d\n" , enable); + +if (!anatop_reg->enable_mask) +return enable ?0 : -ENOSYS ; +return regmap_update_bits (anatop_reg->regmap, anatop_reg->control_reg, + anatop_reg->enable_mask, + enable ? anatop_reg->enable_mask :0 ); +} + +static int anatop_get_enable (struct udevice *dev) +{ +const struct anatop_regulator *anatop_reg =dev_get_plat (dev); +u32 val; +int err; + +if (!anatop_reg->enable_mask) +return 1 ; + + err =regmap_read (anatop_reg->regmap, anatop_reg->control_reg, &val); +if (err) { +dev_dbg (dev,"cannot read reg (%d)\n" , err); +return err; + } + +return !!(val & anatop_reg->enable_mask); +} +static const struct dm_regulator_ops anatop_regulator_ops = { .set_value = anatop_set_voltage, .get_value = anatop_get_voltage, + .get_enable = anatop_get_enable, + .set_enable = anatop_set_enable, };static int anatop_regulator_probe (struct udevice *dev)
@@ -229,6 +263,12 @@ static int anatop_regulator_probe(struct udevice *dev)dev_read_u32 (dev,"anatop-delay-bit-shift" , &anatop_reg->delay_bit_shift); + ret =dev_read_u32 (dev, +"anatop-enable-bit" , + &val); +if (!ret) + anatop_reg->enable_mask =BIT (val); + syscon =dev_get_parent (dev);if (!syscon) {dev_dbg (dev,"unable to find syscon device\n" );
Signature · 1 line
2.55.0
PATCH 4/16 power: domain: rename imx8m-power-domain to imx-gpcv2-power-domain
In reply to Nora SchifferPrepare to port i.MX7D support from the Linux kernel to the driver.
Also fix the help text incorrectly stating that the driver manipulates power domains via the ATF.
---
configs/imx8m_data_modul.config | 2 +-
configs/imx8mm-cl-iot-gate-optee_defconfig | 2 +-
configs/imx8mm-cl-iot-gate_defconfig | 2 +-
configs/imx8mm-mx8menlo_defconfig | 2 +-
configs/imx8mm-phygate-tauri-l_defconfig | 2 +-
configs/imx8mm_evk_defconfig | 2 +-
configs/imx8mm_phg_defconfig | 2 +-
configs/imx8mm_venice_defconfig | 2 +-
configs/imx8mn_venice_defconfig | 2 +-
configs/imx8mp-libra-fpsc_defconfig | 2 +-
configs/imx8mp_dhsom.config | 2 +-
configs/imx8mp_evk_defconfig | 2 +-
configs/imx8mp_venice_defconfig | 2 +-
configs/imx8mq_evk_defconfig | 2 +-
configs/imx8mq_phanbell_defconfig | 2 +-
configs/imx8mq_reform2_defconfig | 2 +-
configs/kontron-osm-s-mx8mp.config | 2 +-
configs/kontron-sl-mx8mm_defconfig | 2 +-
configs/kontron_pitx_imx8m_defconfig | 2 +-
configs/librem5-devkit_defconfig | 2 +-
configs/librem5_defconfig | 2 +-
configs/phycore-imx8mm_defconfig | 2 +-
configs/phycore-imx8mp_defconfig | 2 +-
configs/pico-imx8mq_defconfig | 2 +-
configs/toradex-smarc-imx8mp_defconfig | 2 +-
configs/verdin-imx8mm_defconfig | 2 +-
configs/verdin-imx8mp_defconfig | 2 +-
drivers/power/domain/Kconfig | 15 +++---
drivers/power/domain/Makefile | 2 +-
...ower-domain.c => imx-gpcv2-power-domain.c} | 50 +++++++++----------
30 files changed, 60 insertions(+), 61 deletions(-)
rename drivers/power/domain/{imx8m-power-domain.c => imx-gpcv2-power-domain.c} (90%)configs/imx8m_data_modul.config +1 -1
@@ -116,7 +116,7 @@ CONFIG_GPIO_HOG=y CONFIG_HASH_VERIFY=y CONFIG_HUSH_PARSER=y CONFIG_I2C_EEPROM=y -CONFIG_IMX8M_POWER_DOMAIN=y +CONFIG_IMX_GPCV2_POWER_DOMAIN=y CONFIG_IMX_BOOTAUX=y CONFIG_IMX_TMU=y CONFIG_IMX_WATCHDOG=y
configs/imx8mm-cl-iot-gate-optee_defconfig +1 -1
@@ -116,7 +116,7 @@ CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_PINCTRL_IMX8M=y CONFIG_POWER_DOMAIN=y -CONFIG_IMX8M_POWER_DOMAIN=y +CONFIG_IMX_GPCV2_POWER_DOMAIN=y CONFIG_DM_PMIC=y CONFIG_DM_PMIC_BD71837=y CONFIG_SPL_DM_PMIC_BD71837=y
configs/imx8mm-cl-iot-gate_defconfig +1 -1
@@ -119,7 +119,7 @@ CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_PINCTRL_IMX8M=y CONFIG_POWER_DOMAIN=y -CONFIG_IMX8M_POWER_DOMAIN=y +CONFIG_IMX_GPCV2_POWER_DOMAIN=y CONFIG_DM_PMIC=y CONFIG_DM_PMIC_BD71837=y CONFIG_SPL_DM_PMIC_BD71837=y
configs/imx8mm-mx8menlo_defconfig +1 -1
@@ -136,7 +136,7 @@ CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_PINCTRL_IMX8M=y CONFIG_POWER_DOMAIN=y -CONFIG_IMX8M_POWER_DOMAIN=y +CONFIG_IMX_GPCV2_POWER_DOMAIN=y CONFIG_DM_PMIC=y CONFIG_SPL_DM_PMIC_PCA9450=y CONFIG_DM_PMIC_PFUZE100=y
configs/imx8mm-phygate-tauri-l_defconfig +1 -1
@@ -93,7 +93,7 @@ CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_PINCTRL_IMX8M=y CONFIG_POWER_DOMAIN=y -CONFIG_IMX8M_POWER_DOMAIN=y +CONFIG_IMX_GPCV2_POWER_DOMAIN=y CONFIG_DM_REGULATOR=y CONFIG_DM_REGULATOR_FIXED=y CONFIG_DM_REGULATOR_GPIO=y
configs/imx8mm_evk_defconfig +1 -1
@@ -105,7 +105,7 @@ CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_PINCTRL_IMX8M=y CONFIG_POWER_DOMAIN=y -CONFIG_IMX8M_POWER_DOMAIN=y +CONFIG_IMX_GPCV2_POWER_DOMAIN=y CONFIG_DM_PMIC=y CONFIG_SPL_DM_PMIC_PCA9450=y CONFIG_DM_REGULATOR=y
configs/imx8mm_phg_defconfig +1 -1
@@ -88,7 +88,7 @@ CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_PINCTRL_IMX8M=y CONFIG_POWER_DOMAIN=y -CONFIG_IMX8M_POWER_DOMAIN=y +CONFIG_IMX_GPCV2_POWER_DOMAIN=y CONFIG_DM_PMIC=y CONFIG_DM_PMIC_PCA9450=y CONFIG_SPL_DM_PMIC_PCA9450=y
configs/imx8mm_venice_defconfig +1 -1
@@ -140,7 +140,7 @@ CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_PINCTRL_IMX8M=y CONFIG_POWER_DOMAIN=y -CONFIG_IMX8M_POWER_DOMAIN=y +CONFIG_IMX_GPCV2_POWER_DOMAIN=y CONFIG_DM_PMIC=y CONFIG_DM_PMIC_BD71837=y CONFIG_SPL_DM_PMIC_BD71837=y
configs/imx8mn_venice_defconfig +1 -1
@@ -134,7 +134,7 @@ CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_PINCTRL_IMX8M=y CONFIG_POWER_DOMAIN=y -CONFIG_IMX8M_POWER_DOMAIN=y +CONFIG_IMX_GPCV2_POWER_DOMAIN=y CONFIG_DM_PMIC=y CONFIG_DM_PMIC_BD71837=y CONFIG_SPL_DM_PMIC_BD71837=y
configs/imx8mp-libra-fpsc_defconfig +1 -1
@@ -135,7 +135,7 @@ CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_PINCTRL_IMX8M=y CONFIG_POWER_DOMAIN=y -CONFIG_IMX8M_POWER_DOMAIN=y +CONFIG_IMX_GPCV2_POWER_DOMAIN=y CONFIG_IMX8MP_HSIOMIX_BLKCTRL=y CONFIG_DM_PMIC=y CONFIG_DM_PMIC_PCA9450=y
configs/imx8mp_dhsom.config +1 -1
@@ -114,7 +114,7 @@ CONFIG_DM_PMIC_PCA9450=y CONFIG_DM_REGULATOR_GPIO=y CONFIG_DM_REGULATOR_PCA9450=y CONFIG_IMX8MP_HSIOMIX_BLKCTRL=y -CONFIG_IMX8M_POWER_DOMAIN=y +CONFIG_IMX_GPCV2_POWER_DOMAIN=y CONFIG_POWER_DOMAIN=y CONFIG_SPL_DM_PMIC_PCA9450=y CONFIG_SPL_DM_REGULATOR=y
configs/imx8mp_evk_defconfig +1 -1
@@ -126,7 +126,7 @@ CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_PINCTRL_IMX8M=y CONFIG_POWER_DOMAIN=y -CONFIG_IMX8M_POWER_DOMAIN=y +CONFIG_IMX_GPCV2_POWER_DOMAIN=y CONFIG_IMX8MP_HSIOMIX_BLKCTRL=y CONFIG_DM_PMIC=y CONFIG_DM_PMIC_PCA9450=y
configs/imx8mp_venice_defconfig +1 -1
@@ -139,7 +139,7 @@ CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_PINCTRL_IMX8M=y CONFIG_POWER_DOMAIN=y -CONFIG_IMX8M_POWER_DOMAIN=y +CONFIG_IMX_GPCV2_POWER_DOMAIN=y CONFIG_IMX8MP_HSIOMIX_BLKCTRL=y CONFIG_DM_PMIC=y CONFIG_DM_PMIC_BD71837=y
configs/imx8mq_evk_defconfig +1 -1
@@ -99,7 +99,7 @@ CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_PINCTRL_IMX8M=y CONFIG_POWER_DOMAIN=y -CONFIG_IMX8M_POWER_DOMAIN=y +CONFIG_IMX_GPCV2_POWER_DOMAIN=y CONFIG_DM_PMIC=y CONFIG_SPL_DM_PMIC_PFUZE100=y CONFIG_DM_REGULATOR=y
configs/imx8mq_phanbell_defconfig +1 -1
@@ -84,7 +84,7 @@ CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_PINCTRL_IMX8M=y CONFIG_POWER_DOMAIN=y -CONFIG_IMX8M_POWER_DOMAIN=y +CONFIG_IMX_GPCV2_POWER_DOMAIN=y CONFIG_DM_REGULATOR=y CONFIG_SPL_DM_REGULATOR=y CONFIG_DM_REGULATOR_FIXED=y
configs/imx8mq_reform2_defconfig +1 -1
@@ -87,7 +87,7 @@ CONFIG_PHY_IMX8MQ_USB=y CONFIG_PINCTRL=y CONFIG_PINCTRL_IMX8M=y CONFIG_POWER_DOMAIN=y -CONFIG_IMX8M_POWER_DOMAIN=y +CONFIG_IMX_GPCV2_POWER_DOMAIN=y CONFIG_DM_REGULATOR=y CONFIG_DM_REGULATOR_FIXED=y CONFIG_DM_REGULATOR_GPIO=y
configs/kontron-osm-s-mx8mp.config +1 -1
@@ -160,7 +160,7 @@ CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_PINCTRL_IMX8M=y CONFIG_POWER_DOMAIN=y -CONFIG_IMX8M_POWER_DOMAIN=y +CONFIG_IMX_GPCV2_POWER_DOMAIN=y CONFIG_IMX8MP_HSIOMIX_BLKCTRL=y CONFIG_DM_PMIC=y CONFIG_DM_PMIC_PCA9450=y
configs/kontron-sl-mx8mm_defconfig +1 -1
@@ -173,7 +173,7 @@ CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_PINCTRL_IMX8M=y CONFIG_POWER_DOMAIN=y -CONFIG_IMX8M_POWER_DOMAIN=y +CONFIG_IMX_GPCV2_POWER_DOMAIN=y CONFIG_DM_PMIC=y CONFIG_DM_PMIC_PCA9450=y CONFIG_SPL_DM_PMIC_PCA9450=y
configs/kontron_pitx_imx8m_defconfig +1 -1
@@ -94,7 +94,7 @@ CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_PINCTRL_IMX8M=y CONFIG_POWER_DOMAIN=y -CONFIG_IMX8M_POWER_DOMAIN=y +CONFIG_IMX_GPCV2_POWER_DOMAIN=y CONFIG_DM_PMIC=y CONFIG_DM_PMIC_PFUZE100=y CONFIG_SPL_DM_PMIC_PFUZE100=y
configs/librem5-devkit_defconfig +1 -1
@@ -150,7 +150,7 @@ CONFIG_PINCTRL=y CONFIG_PINCTRL_IMX8M=y CONFIG_POWER_LEGACY=y CONFIG_POWER_DOMAIN=y -CONFIG_IMX8M_POWER_DOMAIN=y +CONFIG_IMX_GPCV2_POWER_DOMAIN=y CONFIG_DM_REGULATOR=y CONFIG_DM_REGULATOR_FIXED=y CONFIG_DM_REGULATOR_GPIO=y
configs/librem5_defconfig +1 -1
@@ -120,7 +120,7 @@ CONFIG_PINCTRL=y CONFIG_PINCTRL_IMX8M=y CONFIG_POWER_LEGACY=y CONFIG_POWER_DOMAIN=y -CONFIG_IMX8M_POWER_DOMAIN=y +CONFIG_IMX_GPCV2_POWER_DOMAIN=y CONFIG_DM_REGULATOR=y CONFIG_DM_REGULATOR_FIXED=y CONFIG_DM_REGULATOR_GPIO=y
configs/phycore-imx8mm_defconfig +1 -1
@@ -116,7 +116,7 @@ CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_PINCTRL_IMX8M=y CONFIG_POWER_DOMAIN=y -CONFIG_IMX8M_POWER_DOMAIN=y +CONFIG_IMX_GPCV2_POWER_DOMAIN=y CONFIG_DM_REGULATOR_FIXED=y CONFIG_DM_REGULATOR_GPIO=y CONFIG_DM_RNG=y
configs/phycore-imx8mp_defconfig +1 -1
@@ -141,7 +141,7 @@ CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_PINCTRL_IMX8M=y CONFIG_POWER_DOMAIN=y -CONFIG_IMX8M_POWER_DOMAIN=y +CONFIG_IMX_GPCV2_POWER_DOMAIN=y CONFIG_IMX8MP_HSIOMIX_BLKCTRL=y CONFIG_DM_PMIC=y CONFIG_DM_PMIC_PCA9450=y
configs/pico-imx8mq_defconfig +1 -1
@@ -85,7 +85,7 @@ CONFIG_PHY_ATHEROS=y CONFIG_PINCTRL=y CONFIG_PINCTRL_IMX8M=y CONFIG_POWER_DOMAIN=y -CONFIG_IMX8M_POWER_DOMAIN=y +CONFIG_IMX_GPCV2_POWER_DOMAIN=y CONFIG_DM_REGULATOR=y CONFIG_DM_REGULATOR_FIXED=y CONFIG_DM_REGULATOR_GPIO=y
configs/toradex-smarc-imx8mp_defconfig +1 -1
@@ -146,7 +146,7 @@ CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_PINCTRL_IMX8M=y CONFIG_POWER_DOMAIN=y -CONFIG_IMX8M_POWER_DOMAIN=y +CONFIG_IMX_GPCV2_POWER_DOMAIN=y CONFIG_IMX8MP_HSIOMIX_BLKCTRL=y CONFIG_DM_PMIC=y CONFIG_DM_PMIC_PCA9450=y
configs/verdin-imx8mm_defconfig +1 -1
@@ -132,7 +132,7 @@ CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_PINCTRL_IMX8M=y CONFIG_POWER_DOMAIN=y -CONFIG_IMX8M_POWER_DOMAIN=y +CONFIG_IMX_GPCV2_POWER_DOMAIN=y CONFIG_DM_PMIC=y CONFIG_SPL_DM_PMIC_PCA9450=y CONFIG_DM_REGULATOR=y
configs/verdin-imx8mp_defconfig +1 -1
@@ -147,7 +147,7 @@ CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_PINCTRL_IMX8M=y CONFIG_POWER_DOMAIN=y -CONFIG_IMX8M_POWER_DOMAIN=y +CONFIG_IMX_GPCV2_POWER_DOMAIN=y CONFIG_IMX8MP_HSIOMIX_BLKCTRL=y CONFIG_DM_PMIC=y CONFIG_DM_PMIC_PCA9450=y
drivers/power/domain/Kconfig +7 -8
@@ -33,6 +33,13 @@ config BCM6328_POWER_DOMAIN Enable support for manipulating BCM6345 power domains via MMIO mapped registers. +config IMX_GPCV2_POWER_DOMAIN + bool "Enable i.MX8M power domain driver" + depends on POWER_DOMAIN && ARCH_IMX8M + select CLK + help + Enable support for manipulating NXP i.MX8M on-SoC power domains. + config IMX8_POWER_DOMAIN bool "Enable i.MX8 power domain driver" depends on ARCH_IMX8
@@ -40,14 +47,6 @@ config IMX8_POWER_DOMAIN Enable support for manipulating NXP i.MX8 on-SoC power domains via IPC requests to the SCU. -config IMX8M_POWER_DOMAIN - bool "Enable i.MX8M power domain driver" - depends on POWER_DOMAIN && ARCH_IMX8M - select CLK - help - Enable support for manipulating NXP i.MX8M on-SoC power domains via - requests to the ATF. - config IMX8MP_HSIOMIX_BLKCTRL bool "Enable i.MX8MP HSIOMIX domain driver" depends on POWER_DOMAIN && IMX8MP
drivers/power/domain/Makefile +1 -1
@@ -7,8 +7,8 @@ obj-$(CONFIG_$(PHASE_)POWER_DOMAIN) += power-domain-uclass.o obj-$(CONFIG_AGILEX5_PMGR_POWER_DOMAIN) += altr-pmgr-agilex5.o obj-$(CONFIG_APPLE_PMGR_POWER_DOMAIN) += apple-pmgr.o obj-$(CONFIG_BCM6328_POWER_DOMAIN) += bcm6328-power-domain.o +obj-$(CONFIG_IMX_GPCV2_POWER_DOMAIN) += imx-gpcv2-power-domain.o obj-$(CONFIG_IMX8_POWER_DOMAIN) += imx8-power-domain-legacy.o imx8-power-domain.o -obj-$(CONFIG_IMX8M_POWER_DOMAIN) += imx8m-power-domain.o obj-$(CONFIG_IMX8MP_HSIOMIX_BLKCTRL) += imx8mp-hsiomix.o obj-$(CONFIG_IMX8MP_MEDIAMIX_BLKCTRL) += imx8mp-mediamix.o obj-$(CONFIG_MESON_EE_POWER_DOMAIN) += meson-ee-pwrc.o
drivers/power/domain/imx-gpcv2-power-domain.c renamed from drivers/power/domain/imx8m-power-domain.c +25 -25
111 lines not on this page · raw message
Signature · 1 line
2.55.0
PATCH 5/16 power: domain: imx-gpcv2: do not unconditionally select CONFIG_CLK
In reply to Nora SchifferNo clock is needed on the i.MX7D, and currently no clk-imx7d driver exists, so CONFIG_CLK can't be enabled.
--- drivers/power/domain/Kconfig | 1 - drivers/power/domain/imx-gpcv2-power-domain.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/power/domain/Kconfig +0 -1
@@ -36,7 +36,6 @@ config BCM6328_POWER_DOMAIN config IMX_GPCV2_POWER_DOMAIN bool "Enable i.MX8M power domain driver" depends on POWER_DOMAIN && ARCH_IMX8M - select CLK help Enable support for manipulating NXP i.MX8M on-SoC power domains.
drivers/power/domain/imx-gpcv2-power-domain.c +1 -1
@@ -517,7 +517,7 @@ static int imx_gpcv2_power_domain_probe(struct udevice *dev)/* Grab optional power domain clock. */ ret =clk_get_bulk (dev, &pdata->clk); -if (ret && ret != -ENOENT ) { +if (ret && ret != -ENOENT && ret != -ENOSYS ) {dev_err (dev,"Failed to get domain clock (%d)\n" , ret);return ret; }
Signature · 1 line
2.55.0
PATCH 6/16 power: domain: imx-gpcv2: set CPU domain mapping on probe
In reply to Nora SchifferThe CPU domain mapping registers and bits were already defined, but they were not written to the hardware. This is necessary on the i.MX7D.
--- drivers/power/domain/imx-gpcv2-power-domain.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/power/domain/imx-gpcv2-power-domain.c +3 -0
@@ -522,6 +522,9 @@ static int imx_gpcv2_power_domain_probe(struct udevice *dev)return ret; } +if (pdata->domain->bits.map) +setbits_le32 (pdata->base + pdata->regs->map, pdata->domain->bits.map); +return 0 ; }
Signature · 1 line
2.55.0
PATCH 7/16 power: domain: imx-gpcv2: add support for power-supply regulator
In reply to Nora SchifferOn the i.MX7D, the integrated anatop regulator needs to be configured and enabled with the power domains.
--- drivers/power/domain/imx-gpcv2-power-domain.c | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-)
drivers/power/domain/imx-gpcv2-power-domain.c +35 -1
@@ -14,6 +14,7 @@#include <dm/device_compat.h> #include <imx_sip.h> #include <linux/bitmap.h> +#include <power/regulator.h> #include <wait_bit.h> #include <dt-bindings/power/imx8mm-power.h>
@@ -128,6 +129,7 @@ struct imx_pgc_domain {u32 hskack; } bits; +const int voltage;const bool keep_clocks; };
@@ -141,6 +143,7 @@ struct imx_gpcv2_power_domain_plat {struct power_domain pd;const struct imx_pgc_domain *domain;const struct imx_pgc_regs *regs; +struct udevice *regulator;struct clk_bulk clk;void __iomem *base;int resource_id;
@@ -343,11 +346,19 @@ static int imx_gpcv2_power_domain_on(struct power_domain *power_domain)u32 pgc;int ret; +if (pdata->regulator) { + ret =regulator_enable (pdata->regulator); +if (ret) { +dev_err (dev,"failed to enable regulator: %d\n" , ret); +return ret; + } + } +if (pdata->clk.count) { ret =clk_enable_bulk (&pdata->clk);if (ret) {dev_err (dev,"failed to enable reset clocks\n" ); -return ret; + goto out_regulator_disable; } }
@@ -392,6 +403,9 @@ static int imx_gpcv2_power_domain_on(struct power_domain *power_domain) out_clk_disable:if (pdata->clk.count)clk_disable_bulk (&pdata->clk); +out_regulator_disable: +if (pdata->regulator) +regulator_disable (pdata->regulator);return ret; }
@@ -450,6 +464,14 @@ static int imx_gpcv2_power_domain_off(struct power_domain *power_domain)if (pdata->clk.count)clk_disable_bulk (&pdata->clk); +if (pdata->regulator) { + ret =regulator_disable (pdata->regulator); +if (ret) { +dev_err (dev,"failed to disable regulator: %d\n" , ret); +return ret; + } + } +if (pdata->has_pd)power_domain_off (&pdata->pd);
@@ -458,6 +480,8 @@ static int imx_gpcv2_power_domain_off(struct power_domain *power_domain) out_clk_disable:if (!domain->keep_clocks && pdata->clk.count)clk_disable_bulk (&pdata->clk); +if (pdata->regulator) +regulator_disable (pdata->regulator);return ret; }
@@ -515,6 +539,16 @@ static int imx_gpcv2_power_domain_probe(struct udevice *dev)if (!strstr (dev->name,"power-domain" ))return 0 ; + ret =device_get_supply_regulator (dev,"power-supply" , &pdata->regulator); +if (ret) { +if (ret != -ENOENT && ret != -ENOSYS ) { +dev_err (dev,"Failed to get domain's regulator (%d)\n" , ret); +return ret; + } + }else if (pdata->domain->voltage) { +regulator_set_value (pdata->regulator, pdata->domain->voltage); + } +/* Grab optional power domain clock. */ ret =clk_get_bulk (dev, &pdata->clk);if (ret && ret != -ENOENT && ret != -ENOSYS ) {
Signature · 1 line
2.55.0
PATCH 8/16 power: domain: imx-gpcv2: add support for i.MX7D
In reply to Nora SchifferImport the power domain definitions for the i.MX7D from the Linux kernel.
--- drivers/power/domain/Kconfig | 6 +- drivers/power/domain/imx-gpcv2-power-domain.c | 60 ++++++++++++++++++- 2 files changed, 62 insertions(+), 4 deletions(-)
drivers/power/domain/Kconfig +3 -3
@@ -34,10 +34,10 @@ config BCM6328_POWER_DOMAIN mapped registers. config IMX_GPCV2_POWER_DOMAIN - bool "Enable i.MX8M power domain driver" - depends on POWER_DOMAIN && ARCH_IMX8M + bool "Enable i.MX7D/i.MX8M power domain driver" + depends on POWER_DOMAIN && (ARCH_IMX8M || MX7D) help - Enable support for manipulating NXP i.MX8M on-SoC power domains. + Enable support for manipulating NXP i.MX7D/i.MX8M on-SoC power domains. config IMX8_POWER_DOMAIN bool "Enable i.MX8 power domain driver"
drivers/power/domain/imx-gpcv2-power-domain.c +59 -1
102 lines not on this page · raw message
Signature · 1 line
2.55.0
PATCH 9/16 usb: ehci-mx6: set up i.MX7D misc registers regardless of CONFIG_PHY setting
In reply to Nora SchifferWhile a separate usbmisc driver could be added, no such driver currently exists, and it would not necessarily be part of the PHY subsystem. Rather than making the misc setup conditional on CONFIG_PHY, make it depend on the existence of a fsl,usbmisc property. This will allow enabling CONFIG_PHY on the i.MX7D for the NOP PHY driver's power domain support.
Also update the code that reads the usbmisc address to use the modern ofnode API and fix the portnr to be determined from the usbmisc phandle arg instead of the alias seqno.
--- drivers/usb/host/ehci-mx6.c | 65 +++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 32 deletions(-)
drivers/usb/host/ehci-mx6.c +33 -32
@@ -141,23 +141,21 @@ static void __maybe_unused usb_power_config_mx6(void *anatop, int anatop_bits_index) { }#endif -#if defined(CONFIG_MX7 ) && !defined(CONFIG_PHY ) -static void usb_power_config_mx7 (struct usbnc_regs *usbnc) +#if defined(CONFIG_MX7 ) +static void usb_misc_config_mx7 (struct usbnc_regs *usbnc) { -void __iomem *phy_cfg2 = (void __iomem *)(&usbnc->phy_cfg2); - -if (!is_mx7 ()) +if (!is_mx7 () || !usbnc)return ;/* * Clear the ACAENB to enable usb_otg_id detection, * otherwise it is the ACA detection enabled. */ -clrbits_le32 (phy_cfg2,USBNC_PHYCFG2_ACAENB ); +clrbits_le32 (&usbnc->phy_cfg2,USBNC_PHYCFG2_ACAENB ); }#else static void __maybe_unused -usb_power_config_mx7 (void *usbnc) { } +usb_misc_config_mx7 (void *usbnc) { }#endif #if defined(CONFIG_MX7ULP ) && !defined(CONFIG_PHY )
@@ -380,7 +378,7 @@ int ehci_hcd_init(int index, enum usb_init_type init,#if defined(CONFIG_MX6 ) || defined(CONFIG_IMXRT )usb_power_config_mx6 (anatop, index);#elif defined (CONFIG_MX7 ) -usb_power_config_mx7 (usbnc); +usb_misc_config_mx7 (usbnc);#elif defined (CONFIG_MX7ULP )usb_power_config_mx7ulp (usbphy);#endif
@@ -431,10 +429,10 @@ struct ehci_mx6_priv_data {struct phy phy;enum usb_init_type init_type;enum usb_phy_interface phy_type; -#if !defined(CONFIG_PHY ) +void __iomem *misc_addr;int portnr; +#if !defined(CONFIG_PHY )void __iomem *phy_addr; -void __iomem *misc_addr;void __iomem *anatop_addr;#endif };
@@ -465,7 +463,6 @@ static int mx6_init_after_reset(struct ehci_ctrl *dev)#if !defined(CONFIG_PHY )usb_power_config_mx6 (priv->anatop_addr, priv->portnr); -usb_power_config_mx7 (priv->misc_addr);usb_power_config_mx7ulp (priv->phy_addr);usb_oc_config (priv->misc_addr, priv->portnr);
@@ -476,6 +473,8 @@ static int mx6_init_after_reset(struct ehci_ctrl *dev)#endif #endif +usb_misc_config_mx7 (priv->misc_addr); +#if CONFIG_IS_ENABLED (DM_REGULATOR )if (priv->vbus_supply) {int ret;
@@ -576,12 +575,29 @@ static int ehci_usb_of_to_plat(struct udevice *dev)static int mx6_parse_dt_addrs (struct udevice *dev) { -#if !defined(CONFIG_PHY )struct ehci_mx6_priv_data *priv =dev_get_priv (dev); -int phy_off, misc_off; +struct ofnode_phandle_args misc_args; +void *__iomem addr; +int ret; + + ret =ofnode_parse_phandle_with_args (dev_ofnode (dev),"fsl,usbmisc" ,"#index-cells" ,0 ,0 , + &misc_args); +if (ret ==0 ) { +if (misc_args.args_count !=1 ) +return -EINVAL ; + + addr = (void __iomem *)ofnode_get_addr (misc_args.node); +if ((fdt_addr_t )addr ==FDT_ADDR_T_NONE ) +return -EINVAL ; + + priv->misc_addr = addr; + priv->portnr = misc_args.args[0 ]; + } + +#if !defined(CONFIG_PHY )const void *blob = gd->fdt_blob;int offset =dev_of_offset (dev); -void *__iomem addr; +int phy_off; phy_off =fdtdec_lookup_phandle (blob, offset,"fsl,usbphy" );if (phy_off <0 ) {
@@ -590,30 +606,14 @@ static int mx6_parse_dt_addrs(struct udevice *dev)return -EINVAL ; } - misc_off =fdtdec_lookup_phandle (blob, offset,"fsl,usbmisc" ); -if (misc_off <0 ) -return -EINVAL ; - addr = (void __iomem *)fdtdec_get_addr (blob, phy_off,"reg" );if ((fdt_addr_t )addr ==FDT_ADDR_T_NONE ) addr =NULL ; priv->phy_addr = addr; - addr = (void __iomem *)fdtdec_get_addr (blob, misc_off,"reg" ); -if ((fdt_addr_t )addr ==FDT_ADDR_T_NONE ) -return -EINVAL ; - - priv->misc_addr = addr; -#if defined(CONFIG_MX6 ) -int anatop_off, ret, devnump; - - ret =fdtdec_get_alias_seq (blob, dev->uclass->uc_drv->name, - phy_off, &devnump); -if (ret <0 ) -return ret; - priv->portnr = devnump; +int anatop_off;/* Resolve ANATOP offset through USB PHY node */ anatop_off =fdtdec_lookup_phandle (blob, phy_off,"fsl,anatop" );
@@ -693,7 +693,6 @@ static int ehci_usb_probe(struct udevice *dev)#if !defined(CONFIG_PHY )usb_power_config_mx6 (priv->anatop_addr, priv->portnr); -usb_power_config_mx7 (priv->misc_addr);usb_power_config_mx7ulp (priv->phy_addr);usb_oc_config (priv->misc_addr, priv->portnr);
@@ -708,6 +707,8 @@ static int ehci_usb_probe(struct udevice *dev) goto err_regulator;#endif +usb_misc_config_mx7 (priv->misc_addr); +if (priv->init_type ==USB_INIT_HOST ) {setbits_le32 (&ehci->usbmode,CM_HOST );writel (mx6_portsc (priv->phy_type), &ehci->portsc);
Signature · 1 line
2.55.0
Marek Vasut
maintainerRe: [PATCH 09/16] usb: ehci-mx6: set up i.MX7D misc registers regardless of CONFIG_PHY setting
Quoted 9 lines · Nora Schiffer
While a separate usbmisc driver could be added, no such driver currently exists, and it would not necessarily be part of the PHY subsystem. Rather than making the misc setup conditional on
CONFIG_PHY, make it depend on the existence of a fsl,usbmisc property. This will allow enablingCONFIG_PHYon the i.MX7D for the NOP PHY driver's power domain support.Also update the code that reads the usbmisc address to use the modern ofnode API and fix the portnr to be determined from the usbmisc phandle arg instead of the alias seqno.
It seems this patch does multiple things, can you please split it up ?
Thank you
Re: [PATCH 09/16] usb: ehci-mx6: set up i.MX7D misc registers regardless of CONFIG_PHY setting
Quoted 11 lines · Marek Vasut
Quoted 9 lines · Nora Schiffer
While a separate usbmisc driver could be added, no such driver currently exists, and it would not necessarily be part of the PHY subsystem. Rather than making the misc setup conditional on
CONFIG_PHY, make it depend on the existence of a fsl,usbmisc property. This will allow enablingCONFIG_PHYon the i.MX7D for the NOP PHY driver's power domain support.Also update the code that reads the usbmisc address to use the modern ofnode API and fix the portnr to be determined from the usbmisc phandle arg instead of the alias seqno.
It seems this patch does multiple things, can you please split it up ?
Okay, I can split this into two parts:
- Make the setup independent of CONFIG_PHY
- Use address/portnr from ofnode
Signature · 4 lines
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany Amtsgericht München, HRB 105018 Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider https://www.tq-group.com/
Marek Vasut
maintainerRe: [PATCH 09/16] usb: ehci-mx6: set up i.MX7D misc registers regardless of CONFIG_PHY setting
Quoted 11 lines · Nora Schiffer
Quoted 10 lines · Marek Vasut
Quoted 9 lines · Nora Schiffer
While a separate usbmisc driver could be added, no such driver currently exists, and it would not necessarily be part of the PHY subsystem. Rather than making the misc setup conditional on
CONFIG_PHY, make it depend on the existence of a fsl,usbmisc property. This will allow enablingCONFIG_PHYon the i.MX7D for the NOP PHY driver's power domain support.Also update the code that reads the usbmisc address to use the modern ofnode API and fix the portnr to be determined from the usbmisc phandle arg instead of the alias seqno.
Quoted 6 lines
Quoted 1 line
It seems this patch does multiple things, can you please split it up ?
Okay, I can split this into two parts:
- Make the setup independent of
CONFIG_PHY
- Use address/portnr from ofnode
Yes please, the clearer the separation of changes is, the better (=easier to review). Also, please split the series by subsystems, so the maintainers can pick it up through their trees. Thank you.
Re: [PATCH 09/16] usb: ehci-mx6: set up i.MX7D misc registers regardless of CONFIG_PHY setting
Quoted 14 lines · Marek Vasut
Quoted 13 lines · Nora Schiffer
Quoted 11 lines · Marek Vasut
Quoted 9 lines · Nora Schiffer
While a separate usbmisc driver could be added, no such driver currently exists, and it would not necessarily be part of the PHY subsystem. Rather than making the misc setup conditional on
CONFIG_PHY, make it depend on the existence of a fsl,usbmisc property. This will allow enablingCONFIG_PHYon the i.MX7D for the NOP PHY driver's power domain support.Also update the code that reads the usbmisc address to use the modern ofnode API and fix the portnr to be determined from the usbmisc phandle arg instead of the alias seqno.
It seems this patch does multiple things, can you please split it up ?
Quoted 7 lines
Quoted 4 lines
Okay, I can split this into two parts:
- Make the setup independent of
CONFIG_PHY
- Use address/portnr from ofnodeYes please, the clearer the separation of changes is, the better (=easier to review). Also, please split the series by subsystems, so the maintainers can pick it up through their trees. Thank you.
I get that these will need to go through different trees eventually, but I think in the current stage having the full series to show the whole picture and have something testable makes sense.
Will the ehci-mx6 patches go through the USB or the i.MX tree? I feel like pushing them through i.MX would be less of a pain due to the dependencies between the patches.
Best,
Nora
Signature · 4 lines
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany Amtsgericht München, HRB 105018 Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider https://www.tq-group.com/
Marek Vasut
maintainerRe: [PATCH 09/16] usb: ehci-mx6: set up i.MX7D misc registers regardless of CONFIG_PHY setting
Quoted 23 lines · Nora Schiffer
Quoted 14 lines · Marek Vasut
Quoted 13 lines · Nora Schiffer
Quoted 11 lines · Marek Vasut
Quoted 9 lines · Nora Schiffer
While a separate usbmisc driver could be added, no such driver currently exists, and it would not necessarily be part of the PHY subsystem. Rather than making the misc setup conditional on
CONFIG_PHY, make it depend on the existence of a fsl,usbmisc property. This will allow enablingCONFIG_PHYon the i.MX7D for the NOP PHY driver's power domain support.Also update the code that reads the usbmisc address to use the modern ofnode API and fix the portnr to be determined from the usbmisc phandle arg instead of the alias seqno.
It seems this patch does multiple things, can you please split it up ?
Quoted 7 lines
Quoted 4 lines
Okay, I can split this into two parts:
- Make the setup independent of
CONFIG_PHY
- Use address/portnr from ofnodeYes please, the clearer the separation of changes is, the better (=easier to review). Also, please split the series by subsystems, so the maintainers can pick it up through their trees. Thank you.
Quoted 7 lines
I get that these will need to go through different trees eventually, but I think in the current stage having the full series to show the whole picture and have something testable makes sense.
Will the ehci-mx6 patches go through the USB or the i.MX tree? I feel like pushing them through i.MX would be less of a pain due to the dependencies between the patches.
USB, since this is USB stuff. There do not seem to be many dependencies between patches in this series.
PATCH 10/16 usb: ehci-mx6: unconditionally run usb_oc_config()
In reply to Nora SchifferOn i.MX6/7, VBUS enable and OC polarity is configured in the usbmisc; there is no PHY driver handling this. Always run usb_oc_config() when a fsl,usbmisc exists.
--- drivers/usb/host/ehci-mx6.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-)
drivers/usb/host/ehci-mx6.c +8 -10
@@ -263,15 +263,16 @@ int usb_phy_mode(int port) }#endif -#if !defined(CONFIG_PHY ) -/* Should be done in the MXS PHY driver */ +/* Should be done in the a imx-usbmisc driver */ static void usb_oc_config (struct usbnc_regs *usbnc,int index) { -void __iomem *ctrl = (void __iomem *)(&usbnc->ctrl[index]); +void __iomem *ctrl; -setbits_le32 (ctrl,UCTRL_OVER_CUR_POL ); +if (!usbnc) +return ; -setbits_le32 (ctrl,UCTRL_OVER_CUR_DIS ); + ctrl = (void __iomem *)(&usbnc->ctrl[index]); +setbits_le32 (ctrl,UCTRL_OVER_CUR_POL |UCTRL_OVER_CUR_DIS );/* Set power polarity to high active */ #ifdef CONFIG_MXC_USB_OTG_HACTIVE
@@ -280,7 +281,6 @@ static void usb_oc_config(struct usbnc_regs *usbnc, int index)clrbits_le32 (ctrl,UCTRL_PWR_POL );#endif } -#endif #if !CONFIG_IS_ENABLED (DM_USB )/**
@@ -465,8 +465,6 @@ static int mx6_init_after_reset(struct ehci_ctrl *dev)usb_power_config_mx6 (priv->anatop_addr, priv->portnr);usb_power_config_mx7ulp (priv->phy_addr); -usb_oc_config (priv->misc_addr, priv->portnr); -#if defined(CONFIG_MX6 ) || defined(CONFIG_MX7ULP )usb_internal_phy_clock_gate (priv->phy_addr,1 );usb_phy_enable (ehci, priv->phy_addr);
@@ -474,6 +472,7 @@ static int mx6_init_after_reset(struct ehci_ctrl *dev)#endif usb_misc_config_mx7 (priv->misc_addr); +usb_oc_config (priv->misc_addr, priv->portnr);#if CONFIG_IS_ENABLED (DM_REGULATOR )if (priv->vbus_supply) {
@@ -695,8 +694,6 @@ static int ehci_usb_probe(struct udevice *dev)usb_power_config_mx6 (priv->anatop_addr, priv->portnr);usb_power_config_mx7ulp (priv->phy_addr); -usb_oc_config (priv->misc_addr, priv->portnr); -#if defined(CONFIG_MX6 ) || defined(CONFIG_MX7ULP ) || defined(CONFIG_IMXRT )usb_internal_phy_clock_gate (priv->phy_addr,1 );usb_phy_enable (ehci, priv->phy_addr);
@@ -708,6 +705,7 @@ static int ehci_usb_probe(struct udevice *dev)#endif usb_misc_config_mx7 (priv->misc_addr); +usb_oc_config (priv->misc_addr, priv->portnr);if (priv->init_type ==USB_INIT_HOST ) {setbits_le32 (&ehci->usbmode,CM_HOST );
Signature · 1 line
2.55.0
Marek Vasut
maintainerRe: [PATCH 10/16] usb: ehci-mx6: unconditionally run usb_oc_config()
Quoted 3 lines · Nora Schiffer
On i.MX6/7, VBUS enable and OC polarity is configured in the usbmisc; there is no PHY driver handling this. Always run
usb_oc_config()when a fsl,usbmisc exists.
Would it make sense to add usbmisc PHY driver ?
Re: [PATCH 10/16] usb: ehci-mx6: unconditionally run usb_oc_config()
Quoted 5 lines · Marek Vasut
Quoted 3 lines · Nora Schiffer
On i.MX6/7, VBUS enable and OC polarity is configured in the usbmisc; there is no PHY driver handling this. Always run
usb_oc_config()when a fsl,usbmisc exists.Would it make sense to add usbmisc PHY driver ?
Having a separate driver would make sense, as the usbmisc is a separate OF node with its own compatible. Thinking about this again, maybe not a PHY driver however, but a UCLASS_MISC - on Linux usbmisc_imx is a (subsystem-less) platform driver too and it doesn't really implement any features that would fit the PHY subsystem.
Best,
Nora
Signature · 4 lines
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany Amtsgericht München, HRB 105018 Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider https://www.tq-group.com/
Marek Vasut
maintainerRe: [PATCH 10/16] usb: ehci-mx6: unconditionally run usb_oc_config()
Quoted 5 lines · Nora Schiffer
Quoted 4 lines · Marek Vasut
Quoted 3 lines · Nora Schiffer
On i.MX6/7, VBUS enable and OC polarity is configured in the usbmisc; there is no PHY driver handling this. Always run
usb_oc_config()when a fsl,usbmisc exists.
Quoted 7 lines
Quoted 1 line
Would it make sense to add usbmisc PHY driver ?
Having a separate driver would make sense, as the usbmisc is a separate OF node with its own compatible. Thinking about this again, maybe not a PHY driver however, but a
UCLASS_MISC- on Linuxusbmisc_imxis a (subsystem-less) platform driver too and it doesn't really implement any features that would fit the PHY subsystem.
I assume that usbmisc driver could also be reused by VF610 , paging Mehmet on this topic.
Re: [PATCH 10/16] usb: ehci-mx6: unconditionally run usb_oc_config()
Quoted 2 lines · Marek Vasut
I assume that usbmisc driver could also be reused by VF610 , paging Mehmet on this topic.
Yes, it could. On Vybrid each controller has its own usbmisc ("fsl,vf610-usbmisc", usbmisc0 at 0x40034800, usbmisc1 at 0x400b4800, index always 0). USBCx_CTRL has PWR_POL, OVER_CUR_POL and OVER_CUR_DIS at bits 9, 8 and 7, the same as UCTRL on i.MX6, so the over-current and power polarity code can be shared. ehci-vf sets OVER_CUR_POL and OVER_CUR_DIS in that register directly today.
On the !DM_USB question: patch 3/9 of the ehci-vf v9 series removes the !DM_USB path, so VF610 would only need the DM driver.
Once the driver is in, I can switch ehci-vf over to it and test it on the Colibri VF50 and VF61.
Re: [PATCH 10/16] usb: ehci-mx6: unconditionally run usb_oc_config()
Quoted 11 lines · Mehmet Fide
Quoted 2 lines · Marek Vasut
I assume that usbmisc driver could also be reused by VF610 , paging Mehmet on this topic.
Yes, it could. On Vybrid each controller has its own usbmisc ("fsl,vf610-usbmisc", usbmisc0 at
0x40034800, usbmisc1 at0x400b4800, index always 0).USBCx_CTRLhasPWR_POL,OVER_CUR_POLandOVER_CUR_DISat bits 9, 8 and 7, the same as UCTRL on i.MX6, so the over-current and power polarity code can be shared. ehci-vf setsOVER_CUR_POLandOVER_CUR_DISin that register directly today.
Quoted 5 lines
On the !DM_USB question: patch 3/9 of the ehci-vf v9 series removes the !DM_USB path, so VF610 would only need the DM driver.
Once the driver is in, I can switch ehci-vf over to it and test it on the Colibri VF50 and VF61.
It would be nice if we could get rid of !DM_USB in ehci-mx6 as well. I may have missed a few, but I think the following are all defconfigs with 'CONFIG_USB_EHCI_MX[67]=y' and 'CONFIG_SPL_DM_USB is not set':
imx6dl_mamoj_defconfigimx8mp_data_modul_edm_sbc_defconfigimx8mn_ddr4_evk_defconfigimx8mp_dhcom_drc02_defconfigimx8mp_dhcom_pdk2_defconfigimx8mp_dhcom_pdk3_defconfigimx8mp_dhcom_picoitx_defconfig
imxrt1050-evk_defconfig
imxrt1050-evk_fspi_defconfig
kontron-osm-s-mx8mp_defconfigkp_imx6q_tpc_defconfig
I can propose a patch to drop the !DM_USB code, but out of these the imx8mn_ddr4_evk is the only one I have here for testing.
Best,
Nora
Signature · 4 lines
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany Amtsgericht München, HRB 105018 Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider https://www.tq-group.com/
Marek Vasut
maintainerRe: [PATCH 10/16] usb: ehci-mx6: unconditionally run usb_oc_config()
Quoted 34 lines · Nora Schiffer
Quoted 11 lines · Mehmet Fide
Quoted 2 lines · Marek Vasut
I assume that usbmisc driver could also be reused by VF610 , paging Mehmet on this topic.
Yes, it could. On Vybrid each controller has its own usbmisc ("fsl,vf610-usbmisc", usbmisc0 at
0x40034800, usbmisc1 at0x400b4800, index always 0).USBCx_CTRLhasPWR_POL,OVER_CUR_POLandOVER_CUR_DISat bits 9, 8 and 7, the same as UCTRL on i.MX6, so the over-current and power polarity code can be shared. ehci-vf setsOVER_CUR_POLandOVER_CUR_DISin that register directly today.Quoted 5 lines
On the !DM_USB question: patch 3/9 of the ehci-vf v9 series removes the !DM_USB path, so VF610 would only need the DM driver.
Once the driver is in, I can switch ehci-vf over to it and test it on the Colibri VF50 and VF61.
It would be nice if we could get rid of !DM_USB in ehci-mx6 as well. I may have missed a few, but I think the following are all defconfigs with 'CONFIG_USB_EHCI_MX[67]=y' and '
CONFIG_SPL_DM_USBis not set':
imx6dl_mamoj_defconfigimx8mp_data_modul_edm_sbc_defconfigimx8mn_ddr4_evk_defconfigimx8mp_dhcom_drc02_defconfigimx8mp_dhcom_pdk2_defconfigimx8mp_dhcom_pdk3_defconfigimx8mp_dhcom_picoitx_defconfig
imxrt1050-evk_defconfig
imxrt1050-evk_fspi_defconfig
kontron-osm-s-mx8mp_defconfigkp_imx6q_tpc_defconfig
Quoted 2 lines
I can propose a patch to drop the !DM_USB code, but out of these the
imx8mn_ddr4_evkis the only one I have here for testing.
I have 7 of those. Keep in mind that MX8MP is DWC3 controller and is not affected, MX8M{Q,M,N} is the chipidea EHCI.
Re: [PATCH 10/16] usb: ehci-mx6: unconditionally run usb_oc_config()
Quoted 35 lines · Marek Vasut
Quoted 34 lines · Nora Schiffer
Quoted 11 lines · Mehmet Fide
Quoted 2 lines · Marek Vasut
I assume that usbmisc driver could also be reused by VF610 , paging Mehmet on this topic.
Yes, it could. On Vybrid each controller has its own usbmisc ("fsl,vf610-usbmisc", usbmisc0 at
0x40034800, usbmisc1 at0x400b4800, index always 0).USBCx_CTRLhasPWR_POL,OVER_CUR_POLandOVER_CUR_DISat bits 9, 8 and 7, the same as UCTRL on i.MX6, so the over-current and power polarity code can be shared. ehci-vf setsOVER_CUR_POLandOVER_CUR_DISin that register directly today.Quoted 5 lines
On the !DM_USB question: patch 3/9 of the ehci-vf v9 series removes the !DM_USB path, so VF610 would only need the DM driver.
Once the driver is in, I can switch ehci-vf over to it and test it on the Colibri VF50 and VF61.
It would be nice if we could get rid of !DM_USB in ehci-mx6 as well. I may have missed a few, but I think the following are all defconfigs with 'CONFIG_USB_EHCI_MX[67]=y' and '
CONFIG_SPL_DM_USBis not set':
imx6dl_mamoj_defconfigimx8mp_data_modul_edm_sbc_defconfigimx8mn_ddr4_evk_defconfigimx8mp_dhcom_drc02_defconfigimx8mp_dhcom_pdk2_defconfigimx8mp_dhcom_pdk3_defconfigimx8mp_dhcom_picoitx_defconfig
imxrt1050-evk_defconfig
imxrt1050-evk_fspi_defconfig
kontron-osm-s-mx8mp_defconfigkp_imx6q_tpc_defconfig
Quoted 4 lines
Quoted 2 lines
I can propose a patch to drop the !DM_USB code, but out of these the
imx8mn_ddr4_evkis the only one I have here for testing.I have 7 of those. Keep in mind that MX8MP is DWC3 controller and is not affected, MX8M{Q,M,N} is the chipidea EHCI.
Ah, right - I only checked which configs enable CONFIG_USB_EHCI_MX[67], not if it actually makes sense for the configs to enable it...
What would SPL USB support even be used for on the 8NM boards? These SoCs don't support USB Host boot, and SDP is handled via BOOTROM, so what should I test if I try SPL with DM_USB? On 6Q/DL and 7D where SDP is handled by U-Boot itself, I could at least test that with some of our TQ-Systems boards.
Unlike 8MN, 8MM defconfigs enable CONFIG_SPL_USB_SDP_SUPPORT instead of CONFIG_SPL_BOOTROM_SUPPORT too, but I don't know if this has historical reasons or the 8MN and 8MM actually differ here (but in any case, none of the 8MM defconfigs build a !DM_USB SPL, so nothing that is working at the moment should break on those).
We can scratch the IMXRT platforms from the list - those don't even enable USB in the SPL.
Best,
Nora
Signature · 4 lines
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany Amtsgericht München, HRB 105018 Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider https://www.tq-group.com/
Re: [PATCH 10/16] usb: ehci-mx6: unconditionally run usb_oc_config()
Quoted 41 lines · Nora Schiffer
Quoted 35 lines · Marek Vasut
Quoted 34 lines · Nora Schiffer
Quoted 11 lines · Mehmet Fide
Quoted 2 lines · Marek Vasut
I assume that usbmisc driver could also be reused by VF610 , paging Mehmet on this topic.
Yes, it could. On Vybrid each controller has its own usbmisc ("fsl,vf610-usbmisc", usbmisc0 at
0x40034800, usbmisc1 at0x400b4800, index always 0).USBCx_CTRLhasPWR_POL,OVER_CUR_POLandOVER_CUR_DISat bits 9, 8 and 7, the same as UCTRL on i.MX6, so the over-current and power polarity code can be shared. ehci-vf setsOVER_CUR_POLandOVER_CUR_DISin that register directly today.Quoted 5 lines
On the !DM_USB question: patch 3/9 of the ehci-vf v9 series removes the !DM_USB path, so VF610 would only need the DM driver.
Once the driver is in, I can switch ehci-vf over to it and test it on the Colibri VF50 and VF61.
It would be nice if we could get rid of !DM_USB in ehci-mx6 as well. I may have missed a few, but I think the following are all defconfigs with 'CONFIG_USB_EHCI_MX[67]=y' and '
CONFIG_SPL_DM_USBis not set':
imx6dl_mamoj_defconfigimx8mp_data_modul_edm_sbc_defconfigimx8mn_ddr4_evk_defconfigimx8mp_dhcom_drc02_defconfigimx8mp_dhcom_pdk2_defconfigimx8mp_dhcom_pdk3_defconfigimx8mp_dhcom_picoitx_defconfig
imxrt1050-evk_defconfig
imxrt1050-evk_fspi_defconfig
kontron-osm-s-mx8mp_defconfigkp_imx6q_tpc_defconfigQuoted 4 lines
Quoted 2 lines
I can propose a patch to drop the !DM_USB code, but out of these the
imx8mn_ddr4_evkis the only one I have here for testing.I have 7 of those. Keep in mind that MX8MP is DWC3 controller and is not affected, MX8M{Q,M,N} is the chipidea EHCI.
Quoted 7 lines
Ah, right - I only checked which configs enable CONFIG_USB_EHCI_MX[67], not if it actually makes sense for the configs to enable it...
What would SPL USB support even be used for on the 8NM boards? These SoCs don't support USB Host boot, and SDP is handled via BOOTROM, so what should I test if I try SPL with
DM_USB? On 6Q/DL and 7D where SDP is handled by U-Boot itself, I could at least test that with some of our TQ-Systems boards.
On i.MX7D SPL is limited to 56KiB, and with CONFIG_SPL_DM enabled the build will exceed that limit. So unfortunately it doesn't look like we can drop the !DM_USB code entirely...
Quoted 13 lines
Unlike 8MN, 8MM defconfigs enable
CONFIG_SPL_USB_SDP_SUPPORTinstead ofCONFIG_SPL_BOOTROM_SUPPORTtoo, but I don't know if this has historical reasons or the 8MN and 8MM actually differ here (but in any case, none of the 8MM defconfigs build a !DM_USB SPL, so nothing that is working at the moment should break on those).We can scratch the IMXRT platforms from the list - those don't even enable USB in the SPL.
Best,
Nora
Signature · 4 lines
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany Amtsgericht München, HRB 105018 Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider https://www.tq-group.com/
Marek Vasut
maintainerRe: [PATCH 10/16] usb: ehci-mx6: unconditionally run usb_oc_config()
In reply to Nora SchifferOn 11/2/26 10:50 AM, Nora Schiffer wrote:
Hello Nora,
Quoted 5 lines
Quoted 4 lines
Quoted 2 lines
I can propose a patch to drop the !DM_USB code, but out of these the
imx8mn_ddr4_evkis the only one I have here for testing.I have 7 of those. Keep in mind that MX8MP is DWC3 controller and is not affected, MX8M{Q,M,N} is the chipidea EHCI.
Quoted 7 lines
Ah, right - I only checked which configs enable CONFIG_USB_EHCI_MX[67], not if it actually makes sense for the configs to enable it...
What would SPL USB support even be used for on the 8NM boards? These SoCs don't support USB Host boot, and SDP is handled via BOOTROM, so what should I test if I try SPL with
DM_USB? On 6Q/DL and 7D where SDP is handled by U-Boot itself, I could at least test that with some of our TQ-Systems boards.
That is a good point, the 8MN is BootROM "v2" which I think can be invoked again from SPL to do more loading via SDPS.
Quoted 5 lines
Unlike 8MN, 8MM defconfigs enable
CONFIG_SPL_USB_SDP_SUPPORTinstead ofCONFIG_SPL_BOOTROM_SUPPORTtoo, but I don't know if this has historical reasons or the 8MN and 8MM actually differ here (but in any case, none of the 8MM defconfigs build a !DM_USB SPL, so nothing that is working at the moment should break on those).
MX8MM are BootROM "v1" did need USB peripheral driver in SPL to do SDP loading.
Quoted 2 lines
We can scratch the IMXRT platforms from the list - those don't even enable USB in the SPL.
Good!
Re: [PATCH 10/16] usb: ehci-mx6: unconditionally run usb_oc_config()
In reply to Nora SchifferQuoted 5 lines · Nora Schiffer
Quoted 4 lines · Marek Vasut
Quoted 3 lines · Nora Schiffer
On i.MX6/7, VBUS enable and OC polarity is configured in the usbmisc; there is no PHY driver handling this. Always run
usb_oc_config()when a fsl,usbmisc exists.
Quoted 7 lines
Quoted 1 line
Would it make sense to add usbmisc PHY driver ?
Having a separate driver would make sense, as the usbmisc is a separate OF node with its own compatible. Thinking about this again, maybe not a PHY driver however, but a
UCLASS_MISC- on Linuxusbmisc_imxis a (subsystem-less) platform driver too and it doesn't really implement any features that would fit the PHY subsystem.
Hmm, I'm unsure what do do about the !DM_USB code paths in ehci-mx6; I assume these exist for constrained SPLs that require USB support? Having a DM-based usbmisc_imx without DM_USB seems undesirable, but duplicating code between the existing and the new driver would make ehci-mx6 !DM_USB support even less maintainable.
Best,
Nora
Signature · 4 lines
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany Amtsgericht München, HRB 105018 Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider https://www.tq-group.com/
Marek Vasut
maintainerRe: [PATCH 10/16] usb: ehci-mx6: unconditionally run usb_oc_config()
Quoted 14 lines · Nora Schiffer
Quoted 5 lines · Nora Schiffer
Quoted 4 lines · Marek Vasut
Quoted 3 lines · Nora Schiffer
On i.MX6/7, VBUS enable and OC polarity is configured in the usbmisc; there is no PHY driver handling this. Always run
usb_oc_config()when a fsl,usbmisc exists.Quoted 7 lines
Quoted 1 line
Would it make sense to add usbmisc PHY driver ?
Having a separate driver would make sense, as the usbmisc is a separate OF node with its own compatible. Thinking about this again, maybe not a PHY driver however, but a
UCLASS_MISC- on Linuxusbmisc_imxis a (subsystem-less) platform driver too and it doesn't really implement any features that would fit the PHY subsystem.
Quoted 5 lines
Hmm, I'm unsure what do do about the !DM_USB code paths in ehci-mx6; I assume these exist for constrained SPLs that require USB support? Having a DM-based
usbmisc_imxwithoutDM_USBseems undesirable, but duplicating code between the existing and the new driver would make ehci-mx6 !DM_USB support even less maintainable.
Please try if we can do with DM_USB in SPL (I can run the patches through CI to validate nothing got broken) and if not, then we might need some crutch for the SPL.
Thank you!
PATCH 11/16 usb: ehci-mx6: add support for power-active-high property
In reply to Nora SchifferSupport the same property used by the Linux kernel, obsoleting the CONFIG_MXC_USB_OTG_HACTIVE Kconfig symbol.
--- drivers/usb/host/ehci-mx6.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
drivers/usb/host/ehci-mx6.c +11 -10
@@ -264,7 +264,7 @@ int usb_phy_mode(int port)#endif /* Should be done in the a imx-usbmisc driver */ -static void usb_oc_config (struct usbnc_regs *usbnc,int index) +static void usb_oc_config (struct usbnc_regs *usbnc,int index,bool active_high) {void __iomem *ctrl;
@@ -274,12 +274,10 @@ static void usb_oc_config(struct usbnc_regs *usbnc, int index) ctrl = (void __iomem *)(&usbnc->ctrl[index]);setbits_le32 (ctrl,UCTRL_OVER_CUR_POL |UCTRL_OVER_CUR_DIS ); -/* Set power polarity to high active */ -#ifdef CONFIG_MXC_USB_OTG_HACTIVE -setbits_le32 (ctrl,UCTRL_PWR_POL ); -#else -clrbits_le32 (ctrl,UCTRL_PWR_POL ); -#endif +if (IS_ENABLED (CONFIG_MXC_USB_OTG_HACTIVE ) || active_high) +setbits_le32 (ctrl,UCTRL_PWR_POL ); +else +clrbits_le32 (ctrl,UCTRL_PWR_POL ); }#if !CONFIG_IS_ENABLED (DM_USB )
@@ -383,7 +381,7 @@ int ehci_hcd_init(int index, enum usb_init_type init,usb_power_config_mx7ulp (usbphy);#endif -usb_oc_config (usbnc, index); +usb_oc_config (usbnc, index, false);#if defined(CONFIG_MX6 ) || defined(CONFIG_MX7ULP ) || defined(CONFIG_IMXRT )if (index <ARRAY_SIZE (phy_bases)) {
@@ -431,6 +429,7 @@ struct ehci_mx6_priv_data {enum usb_phy_interface phy_type;void __iomem *misc_addr;int portnr; +bool pwr_active_high;#if !defined(CONFIG_PHY )void __iomem *phy_addr;void __iomem *anatop_addr;
@@ -472,7 +471,7 @@ static int mx6_init_after_reset(struct ehci_ctrl *dev)#endif usb_misc_config_mx7 (priv->misc_addr); -usb_oc_config (priv->misc_addr, priv->portnr); +usb_oc_config (priv->misc_addr, priv->portnr, priv->pwr_active_high);#if CONFIG_IS_ENABLED (DM_REGULATOR )if (priv->vbus_supply) {
@@ -690,6 +689,8 @@ static int ehci_usb_probe(struct udevice *dev)debug ("%s: No vbus supply\n" , dev->name);#endif + priv->pwr_active_high =dev_read_bool (dev,"power-active-high" ); +#if !defined(CONFIG_PHY )usb_power_config_mx6 (priv->anatop_addr, priv->portnr);usb_power_config_mx7ulp (priv->phy_addr);
@@ -705,7 +706,7 @@ static int ehci_usb_probe(struct udevice *dev)#endif usb_misc_config_mx7 (priv->misc_addr); -usb_oc_config (priv->misc_addr, priv->portnr); +usb_oc_config (priv->misc_addr, priv->portnr, priv->pwr_active_high);if (priv->init_type ==USB_INIT_HOST ) {setbits_le32 (&ehci->usbmode,CM_HOST );
Signature · 1 line
2.55.0
PATCH 12/16 usb: ehci-mx6: handle fsl,usbphy with CONFIG_PHY
In reply to Nora SchifferReplace generic_setup_phy() to handle fsl,usbphy in addition to the standard phys property.
This allows the USB controller of the i.MX7D to work in HSIC mode if the following configs are enabled:
- CONFIG_NOP_PHY
- CONFIG_IMX_GPCV2_POWER_DOMAIN
- CONFIG_DM_REGULATOR_ANATOP
--- drivers/usb/host/ehci-mx6.c | 47 ++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-)
drivers/usb/host/ehci-mx6.c +46 -1
@@ -571,6 +571,51 @@ static int ehci_usb_of_to_plat(struct udevice *dev)return 0 ; } +#if IS_ENABLED (CONFIG_PHY ) +/* +* ehci_mx6_setup_phy() is equivalent to generic_setup_phy(), +* but additionally supports fsl,usbphy +*/ +static int ehci_mx6_setup_phy (struct udevice *dev) +{ +struct ehci_mx6_priv_data *priv =dev_get_priv (dev); +struct ofnode_phandle_args args; +struct phy *phy = &priv->phy; +int ret; + + ret =ofnode_parse_phandle_with_args (dev_ofnode (dev),"fsl,usbphy" , +"#phy-cells" ,0 ,0 , &args); + +if (ret == -ENOENT ) + ret =ofnode_parse_phandle_with_args (dev_ofnode (dev),"phys" , +"#phy-cells" ,0 ,0 , &args); +if (ret) +return ret == -ENOENT ?0 : ret; + + ret =generic_phy_get_by_phandle_args (args, phy); +if (ret) +return ret == -ENOENT ?0 : ret; + + ret =generic_phy_init (phy); +if (ret) +return ret; + + ret =generic_phy_set_mode (phy,PHY_MODE_USB_HOST ,0 ); +if (ret) + goto phys_mode_err; + + ret =generic_phy_power_on (phy); +if (ret) + goto phys_mode_err; + +return 0 ; + +phys_mode_err: +generic_phy_exit (phy); +return ret; +} +#endif +static int mx6_parse_dt_addrs (struct udevice *dev) {struct ehci_mx6_priv_data *priv =dev_get_priv (dev);
@@ -700,7 +745,7 @@ static int ehci_usb_probe(struct udevice *dev)usb_phy_enable (ehci, priv->phy_addr);#endif #else - ret =generic_setup_phy (dev, &priv->phy,0 ,PHY_MODE_USB_HOST ,0 ); + ret =ehci_mx6_setup_phy (dev);if (ret) goto err_regulator;#endif
Signature · 1 line
2.55.0
PATCH 13/16 usb: ehci: allow overriding port enable operation
In reply to Nora SchifferSome USB controllers have quirks that require additional handling when enabling a port. One example is the Chipidea USB host found on various i.MX SoCs, which must be forced to HS mode for HSIC interfaces.
--- drivers/usb/host/ehci-hcd.c | 15 +++++++++++---- drivers/usb/host/ehci.h | 2 ++ 2 files changed, 13 insertions(+), 4 deletions(-)
drivers/usb/host/ehci-hcd.c +11 -4
@@ -139,6 +139,13 @@ static void ehci_set_usbmode(struct ehci_ctrl *ctrl)ehci_writel (reg_ptr, tmp); } +static void ehci_enable_port_power (struct ehci_ctrl *ctrl,uint32_t *status_reg, +uint32_t reg) +{ +if (HCS_PPC (ehci_readl (&ctrl->hccr->cr_hcsparams))) +ehci_writel (status_reg, reg |EHCI_PS_PP ); +} +static void ehci_powerup_fixup (struct ehci_ctrl *ctrl,uint32_t *status_reg,uint32_t *reg) {
@@ -874,10 +881,7 @@ static int ehci_submit_root(struct usb_device *dev, unsigned long pipe,ehci_writel (status_reg, reg);break ;case USB_PORT_FEAT_POWER : -if (HCS_PPC (ehci_readl (&ctrl->hccr->cr_hcsparams))) { - reg |=EHCI_PS_PP ; -ehci_writel (status_reg, reg); - } + ctrl->ops.enable_port_power (ctrl, status_reg, reg);break ;case USB_PORT_FEAT_RESET : if ((reg & (EHCI_PS_PE | EHCI_PS_CS)) == EHCI_PS_CS &&
@@ -1005,6 +1009,7 @@ unknown:static const struct ehci_ops default_ehci_ops = { .set_usb_mode = ehci_set_usbmode, .get_port_speed = ehci_get_port_speed, + .enable_port_power = ehci_enable_port_power, .powerup_fixup = ehci_powerup_fixup, .get_portsc_register = ehci_get_portsc_register, };
@@ -1019,6 +1024,8 @@ static void ehci_setup_ops(struct ehci_ctrl *ctrl, const struct ehci_ops *ops) ctrl->ops.set_usb_mode = ehci_set_usbmode;if (!ctrl->ops.get_port_speed) ctrl->ops.get_port_speed = ehci_get_port_speed; +if (!ctrl->ops.enable_port_power) + ctrl->ops.enable_port_power = ehci_enable_port_power;if (!ctrl->ops.powerup_fixup) ctrl->ops.powerup_fixup = ehci_powerup_fixup;if (!ctrl->ops.get_portsc_register)
drivers/usb/host/ehci.h +2 -0
@@ -238,6 +238,8 @@ struct ehci_ctrl;struct ehci_ops {void (*set_usb_mode)(struct ehci_ctrl *ctrl);int (*get_port_speed)(struct ehci_ctrl *ctrl,uint32_t reg); +void (*enable_port_power)(struct ehci_ctrl *ctrl,uint32_t *status_reg, +uint32_t reg);void (*powerup_fixup)(struct ehci_ctrl *ctrl,uint32_t *status_reg,uint32_t *reg);uint32_t *(*get_portsc_register)(struct ehci_ctrl *ctrl,int port);
Signature · 1 line
2.55.0
PATCH 14/16 usb: ehci-mx6: force HSIC ports to HS mode during port enable
In reply to Nora SchifferThis workaround is required to allow HSIC ports to connect again after a reset - without this, only the initial usb start will be successful, but after a usb reset no devices are found anymore.
A similar fix was introduced in Linux commit fc6b68ba4990 ("usb: chipidea: add work-around for Marvell HSIC PHY startup").
--- drivers/usb/host/ehci-mx6.c | 12 ++++++++++++ include/usb/ehci-ci.h | 1 + 2 files changed, 13 insertions(+)
drivers/usb/host/ehci-mx6.c +12 -0
@@ -454,6 +454,17 @@ static u32 mx6_portsc(enum usb_phy_interface phy_type) } } +static void mx6_ehci_enable_port_power (struct ehci_ctrl *ctrl, +uint32_t *status_reg,uint32_t reg) +{ +struct ehci_mx6_priv_data *priv = ctrl->priv; + +if (priv->phy_type ==USBPHY_INTERFACE_MODE_HSIC ) +ehci_writel (status_reg, reg |PORT_PP |PORT_PTC_HS ); + +ehci_writel (status_reg, reg |PORT_PP ); +} +static int mx6_init_after_reset (struct ehci_ctrl *dev) {struct ehci_mx6_priv_data *priv = dev->priv;
@@ -499,6 +510,7 @@ static int mx6_init_after_reset(struct ehci_ctrl *dev) }static const struct ehci_ops mx6_ehci_ops = { + .enable_port_power = mx6_ehci_enable_port_power, .init_after_reset = mx6_init_after_reset };
include/usb/ehci-ci.h +1 -0
@@ -26,6 +26,7 @@#define PORT_PTS_HSIC (1 << 25)#define PORT_PFSC (1 << 24)/* Defined on Page 39-44 of the mpc5151 ERM */ #define PORT_PTS_PHCD (1 << 23) +#define PORT_PTC_HS (5 << 16)#define PORT_PP (1 << 12)#define PORT_PR (1 << 8)
Signature · 1 line
2.55.0
PATCH 15/16 configs: tqma6ul: drop obsolete CONFIG_MXC_USB_OTG_HACTIVE symbol
In reply to Nora SchifferThe MBa6ULx Device Tree sets power-active-high.
--- configs/tqma6ul_common.config | 1 - 1 file changed, 1 deletion(-)
configs/tqma6ul_common.config +0 -1
@@ -123,5 +123,4 @@ CONFIG_SYSRESET_WATCHDOG=y CONFIG_SYSRESET_WATCHDOG_AUTO=y CONFIG_DM_THERMAL=y CONFIG_IMX_THERMAL=y -CONFIG_MXC_USB_OTG_HACTIVE=y CONFIG_IMX_WATCHDOG=y
Signature · 1 line
2.55.0
PATCH 16/16 configs: tqma7: enable PHY and power domain support for USB HSIC
In reply to Nora SchifferAllow the USB hub to work instead of hanging the whole board when attempting to configure the USB controller for HSIC.
The obsolete CONFIG_MXC_USB_OTG_HACTIVE setting is removed; it was unused by the MBa7, as all VBUS enable signals are controlled as regulators.
--- configs/tqma7_common.config | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
configs/tqma7_common.config +5 -1
@@ -98,13 +98,18 @@ CONFIG_PHY_GIGE=y CONFIG_FEC_MXC=y CONFIG_RGMII=y CONFIG_MII=y +CONFIG_PHY=y +CONFIG_NOP_PHY=y CONFIG_PINCTRL=y CONFIG_PINCTRL_IMX7=y +CONFIG_POWER_DOMAIN=y +CONFIG_IMX_GPCV2_POWER_DOMAIN=y CONFIG_DM_PMIC=y CONFIG_DM_PMIC_PFUZE100=y CONFIG_DM_REGULATOR=y CONFIG_DM_REGULATOR_PFUZE100=y CONFIG_DM_REGULATOR_FIXED=y +CONFIG_DM_REGULATOR_ANATOP=y CONFIG_DM_RTC=y CONFIG_RTC_DS1307=y CONFIG_CONS_INDEX=5
@@ -114,7 +119,6 @@ CONFIG_SYSRESET=y CONFIG_SYSRESET_WATCHDOG=y CONFIG_IMX_THERMAL=y CONFIG_USB_EHCI_HCD=y -CONFIG_MXC_USB_OTG_HACTIVE=y # CONFIG_WATCHDOG_AUTOSTART is not set CONFIG_IMX_WATCHDOG=y CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED=y
Signature · 1 line
2.55.0