[PATCH v7 2/5] phy: qcom-m31: Introduce qcom,m31 USB phy driver

Varadarajan Narayanan quic_varada at quicinc.com
Mon Aug 14 01:35:04 PDT 2023


On Fri, Aug 11, 2023 at 09:30:05AM +0100, Vinod Koul wrote:
> On 10-08-23, 15:26, Varadarajan Narayanan wrote:
> > Add the M31 USB2 phy driver.
>	.
>	.
>	.
> > +#include <linux/kernel.h>
> > +#include <linux/module.h>
> > +#include <linux/of_platform.h>
> > +#include <linux/of.h>
>
> do you need both headers..?
>
>	.
>	.
>	.
> > + #define FREQ_24MHZ			(GENMASK(6, 6) | GENMASK(4, 4))
>
> why not use bit :-)
>	.
>	.
>	.
> > +struct m31_phy_regs m31_ipq5332_regs[] = {
> > +	{ USB_PHY_CFG0, UTMI_PHY_OVERRIDE_EN, 0 },
> > +	{ USB_PHY_UTMI_CTRL5, POR_EN, 15 },
> > +	{ USB_PHY_FSEL_SEL, FREQ_SEL, 0 },
> > +	{ USB_PHY_HS_PHY_CTRL_COMMON0, COMMONONN | FREQ_24MHZ | RETENABLEN, 0 },
> > +	{ USB_PHY_UTMI_CTRL5, POR_EN, 0 },
> > +	{ USB_PHY_HS_PHY_CTRL2, USB2_SUSPEND_N_SEL | USB2_SUSPEND_N | USB2_UTMI_CLK_EN, 0 },
> > +	{ USB2PHY_USB_PHY_M31_XCFGI_11, XCFG_COARSE_TUNE_NUM  | XCFG_FINE_TUNE_NUM, 0 },
> > +	{ USB2PHY_USB_PHY_M31_XCFGI_4, HSTX_SLEW_RATE_565PS | PLL_CHARGING_PUMP_CURRENT_35UA |
> > +				       ODT_VALUE_38_02_OHM, 0 },
> > +	{ USB2PHY_USB_PHY_M31_XCFGI_1, USB2_0_TX_ENABLE, 0 },
> > +	{ USB2PHY_USB_PHY_M31_XCFGI_5, ODT_VALUE_45_02_OHM | HSTX_PRE_EMPHASIS_LEVEL_0_55MA, 4 },
> > +	{ USB_PHY_UTMI_CTRL5, 0x0, 0 },
> > +	{ USB_PHY_HS_PHY_CTRL2, USB2_SUSPEND_N | USB2_UTMI_CLK_EN, 0 },
>
> More readable way to code
>                 USB_PHY_CFG0,
>                 UTMI_PHY_OVERRIDE_EN,
>                 0
>
> and so on, makes a better read and check for errors, one line for off,
> one for val and one for delay
>
> --
> `~Vinod

Have posted a new version addressing these (and Konrad's and Bjorn's) issues.
Please review.

Thanks
Varada



More information about the linux-phy mailing list