Message ID | 20221011082924.884123-5-s.hauer@pengutronix.de |
---|---|
State | New |
Headers | show |
Series | usb: chipidea: Export more phy tuning parameters to device tree | expand |
On Tue, Oct 11, 2022 at 4:49 PM Sascha Hauer <s.hauer@pengutronix.de> wrote: > > The driver is used for a broad range of i.MX SoCs and most of the > register defines have a SoC/regname specific prefix to make clear > in which context they should be used. Add such a prefix to the > MX7D_USB_OTG_PHY_CFG1 defines as well. > > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Xu Yang <xu.yang_2@nxp.com> Thanks, Xu Yang > --- > drivers/usb/chipidea/usbmisc_imx.c | 20 ++++++++++++-------- > 1 file changed, 12 insertions(+), 8 deletions(-) > > diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c > index 95f2ba01c0df1..63de7d6fea427 100644 > --- a/drivers/usb/chipidea/usbmisc_imx.c > +++ b/drivers/usb/chipidea/usbmisc_imx.c > @@ -126,8 +126,8 @@ > #define MX7D_USB_OTG_PHY_STATUS_CHRGDET BIT(29) > > #define MX7D_USB_OTG_PHY_CFG1 0x30 > -#define TXPREEMPAMPTUNE0 GENMASK(29, 28) > -#define TXVREFTUNE0 GENMASK(23, 20) > +#define MX7D_USB_OTG_PHY_CFG1_TXPREEMPAMPTUNE0 GENMASK(29, 28) > +#define MX7D_USB_OTG_PHY_CFG1_TXVREFTUNE0 GENMASK(23, 20) > > #define MX6_USB_OTG_WAKEUP_BITS (MX6_BM_WAKEUP_ENABLE | MX6_BM_VBUS_WAKEUP | \ > MX6_BM_ID_WAKEUP) > @@ -659,15 +659,19 @@ static int usbmisc_imx7d_init(struct imx_usbmisc_data *data) > /* PHY tuning for signal quality */ > reg = readl(usbmisc->base + MX7D_USB_OTG_PHY_CFG1); > if (data->emp_curr_control && > - FIELD_FIT(TXPREEMPAMPTUNE0, data->emp_curr_control)) { > - reg &= ~TXPREEMPAMPTUNE0; > - reg |= FIELD_PREP(TXPREEMPAMPTUNE0, data->emp_curr_control); > + FIELD_FIT(MX7D_USB_OTG_PHY_CFG1_TXPREEMPAMPTUNE0, > + data->emp_curr_control)) { > + reg &= ~MX7D_USB_OTG_PHY_CFG1_TXPREEMPAMPTUNE0; > + reg |= FIELD_PREP(MX7D_USB_OTG_PHY_CFG1_TXPREEMPAMPTUNE0, > + data->emp_curr_control); > } > > if (data->dc_vol_level_adjust && > - FIELD_FIT(TXVREFTUNE0, data->dc_vol_level_adjust)) { > - reg &= ~TXVREFTUNE0; > - reg |= FIELD_PREP(TXVREFTUNE0, data->dc_vol_level_adjust); > + FIELD_FIT(MX7D_USB_OTG_PHY_CFG1_TXVREFTUNE0, > + data->dc_vol_level_adjust)) { > + reg &= ~MX7D_USB_OTG_PHY_CFG1_TXVREFTUNE0; > + reg |= FIELD_PREP(MX7D_USB_OTG_PHY_CFG1_TXVREFTUNE0, > + data->dc_vol_level_adjust); > } > > writel(reg, usbmisc->base + MX7D_USB_OTG_PHY_CFG1); > -- > 2.30.2 >
diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c index 95f2ba01c0df1..63de7d6fea427 100644 --- a/drivers/usb/chipidea/usbmisc_imx.c +++ b/drivers/usb/chipidea/usbmisc_imx.c @@ -126,8 +126,8 @@ #define MX7D_USB_OTG_PHY_STATUS_CHRGDET BIT(29) #define MX7D_USB_OTG_PHY_CFG1 0x30 -#define TXPREEMPAMPTUNE0 GENMASK(29, 28) -#define TXVREFTUNE0 GENMASK(23, 20) +#define MX7D_USB_OTG_PHY_CFG1_TXPREEMPAMPTUNE0 GENMASK(29, 28) +#define MX7D_USB_OTG_PHY_CFG1_TXVREFTUNE0 GENMASK(23, 20) #define MX6_USB_OTG_WAKEUP_BITS (MX6_BM_WAKEUP_ENABLE | MX6_BM_VBUS_WAKEUP | \ MX6_BM_ID_WAKEUP) @@ -659,15 +659,19 @@ static int usbmisc_imx7d_init(struct imx_usbmisc_data *data) /* PHY tuning for signal quality */ reg = readl(usbmisc->base + MX7D_USB_OTG_PHY_CFG1); if (data->emp_curr_control && - FIELD_FIT(TXPREEMPAMPTUNE0, data->emp_curr_control)) { - reg &= ~TXPREEMPAMPTUNE0; - reg |= FIELD_PREP(TXPREEMPAMPTUNE0, data->emp_curr_control); + FIELD_FIT(MX7D_USB_OTG_PHY_CFG1_TXPREEMPAMPTUNE0, + data->emp_curr_control)) { + reg &= ~MX7D_USB_OTG_PHY_CFG1_TXPREEMPAMPTUNE0; + reg |= FIELD_PREP(MX7D_USB_OTG_PHY_CFG1_TXPREEMPAMPTUNE0, + data->emp_curr_control); } if (data->dc_vol_level_adjust && - FIELD_FIT(TXVREFTUNE0, data->dc_vol_level_adjust)) { - reg &= ~TXVREFTUNE0; - reg |= FIELD_PREP(TXVREFTUNE0, data->dc_vol_level_adjust); + FIELD_FIT(MX7D_USB_OTG_PHY_CFG1_TXVREFTUNE0, + data->dc_vol_level_adjust)) { + reg &= ~MX7D_USB_OTG_PHY_CFG1_TXVREFTUNE0; + reg |= FIELD_PREP(MX7D_USB_OTG_PHY_CFG1_TXVREFTUNE0, + data->dc_vol_level_adjust); } writel(reg, usbmisc->base + MX7D_USB_OTG_PHY_CFG1);
The driver is used for a broad range of i.MX SoCs and most of the register defines have a SoC/regname specific prefix to make clear in which context they should be used. Add such a prefix to the MX7D_USB_OTG_PHY_CFG1 defines as well. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- drivers/usb/chipidea/usbmisc_imx.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)