Message ID | 20230627112126.1882666-3-xu.yang_2@nxp.com |
---|---|
State | Superseded |
Headers | show |
Series | [v2,1/3] usb: chipidea: imx: improve logic if samsung,picophy-* parameter is 0 | expand |
On 23-06-27 19:21:26, Xu Yang wrote: > In some cases, the user may need to tune the rise/fall time of the > high-speed transmitter waveform for USB Certification. This will add > a parameter for this purpose. The value will be fetched from dtb and > finally written to the register. > > Signed-off-by: Xu Yang <xu.yang_2@nxp.com> Acked-by: Peter Chen <peter.chen@kernel.org> Peter > > --- > Changes in v2: > - rename parameter name > --- > drivers/usb/chipidea/ci_hdrc_imx.c | 3 +++ > drivers/usb/chipidea/ci_hdrc_imx.h | 1 + > drivers/usb/chipidea/usbmisc_imx.c | 9 +++++++++ > 3 files changed, 13 insertions(+) > > diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c > index 873539f9a2c0..159509c5fe58 100644 > --- a/drivers/usb/chipidea/ci_hdrc_imx.c > +++ b/drivers/usb/chipidea/ci_hdrc_imx.c > @@ -181,6 +181,9 @@ static struct imx_usbmisc_data *usbmisc_get_init_data(struct device *dev) > if (of_property_read_u32(np, "samsung,picophy-dc-vol-level-adjust", > &data->dc_vol_level_adjust)) > data->dc_vol_level_adjust = -1; > + if (of_property_read_u32(np, "fsl,picophy-rise-fall-time-adjust", > + &data->rise_fall_time_adjust)) > + data->rise_fall_time_adjust = -1; > > return data; > } > diff --git a/drivers/usb/chipidea/ci_hdrc_imx.h b/drivers/usb/chipidea/ci_hdrc_imx.h > index 7135b9a5d913..88b8da79d518 100644 > --- a/drivers/usb/chipidea/ci_hdrc_imx.h > +++ b/drivers/usb/chipidea/ci_hdrc_imx.h > @@ -28,6 +28,7 @@ struct imx_usbmisc_data { > enum usb_dr_mode available_role; /* runtime usb dr mode */ > int emp_curr_control; > int dc_vol_level_adjust; > + int rise_fall_time_adjust; > }; > > int imx_usbmisc_init(struct imx_usbmisc_data *data); > diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c > index 1c7932f22218..56570100ffb8 100644 > --- a/drivers/usb/chipidea/usbmisc_imx.c > +++ b/drivers/usb/chipidea/usbmisc_imx.c > @@ -130,6 +130,8 @@ > #define MX7D_USB_OTG_PHY_CFG1 0x30 > #define TXPREEMPAMPTUNE0_BIT 28 > #define TXPREEMPAMPTUNE0_MASK (3 << 28) > +#define TXRISETUNE0_BIT 24 > +#define TXRISETUNE0_MASK (3 << 24) > #define TXVREFTUNE0_BIT 20 > #define TXVREFTUNE0_MASK (0xf << 20) > > @@ -673,6 +675,13 @@ static int usbmisc_imx7d_init(struct imx_usbmisc_data *data) > reg |= (data->dc_vol_level_adjust << TXVREFTUNE0_BIT); > } > > + if (data->rise_fall_time_adjust >= 0 && > + data->rise_fall_time_adjust <= > + (TXRISETUNE0_MASK >> TXRISETUNE0_BIT)) { > + reg &= ~TXRISETUNE0_MASK; > + reg |= (data->rise_fall_time_adjust << TXRISETUNE0_BIT); > + } > + > writel(reg, usbmisc->base + MX7D_USB_OTG_PHY_CFG1); > } > > -- > 2.34.1 >
diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c index 873539f9a2c0..159509c5fe58 100644 --- a/drivers/usb/chipidea/ci_hdrc_imx.c +++ b/drivers/usb/chipidea/ci_hdrc_imx.c @@ -181,6 +181,9 @@ static struct imx_usbmisc_data *usbmisc_get_init_data(struct device *dev) if (of_property_read_u32(np, "samsung,picophy-dc-vol-level-adjust", &data->dc_vol_level_adjust)) data->dc_vol_level_adjust = -1; + if (of_property_read_u32(np, "fsl,picophy-rise-fall-time-adjust", + &data->rise_fall_time_adjust)) + data->rise_fall_time_adjust = -1; return data; } diff --git a/drivers/usb/chipidea/ci_hdrc_imx.h b/drivers/usb/chipidea/ci_hdrc_imx.h index 7135b9a5d913..88b8da79d518 100644 --- a/drivers/usb/chipidea/ci_hdrc_imx.h +++ b/drivers/usb/chipidea/ci_hdrc_imx.h @@ -28,6 +28,7 @@ struct imx_usbmisc_data { enum usb_dr_mode available_role; /* runtime usb dr mode */ int emp_curr_control; int dc_vol_level_adjust; + int rise_fall_time_adjust; }; int imx_usbmisc_init(struct imx_usbmisc_data *data); diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c index 1c7932f22218..56570100ffb8 100644 --- a/drivers/usb/chipidea/usbmisc_imx.c +++ b/drivers/usb/chipidea/usbmisc_imx.c @@ -130,6 +130,8 @@ #define MX7D_USB_OTG_PHY_CFG1 0x30 #define TXPREEMPAMPTUNE0_BIT 28 #define TXPREEMPAMPTUNE0_MASK (3 << 28) +#define TXRISETUNE0_BIT 24 +#define TXRISETUNE0_MASK (3 << 24) #define TXVREFTUNE0_BIT 20 #define TXVREFTUNE0_MASK (0xf << 20) @@ -673,6 +675,13 @@ static int usbmisc_imx7d_init(struct imx_usbmisc_data *data) reg |= (data->dc_vol_level_adjust << TXVREFTUNE0_BIT); } + if (data->rise_fall_time_adjust >= 0 && + data->rise_fall_time_adjust <= + (TXRISETUNE0_MASK >> TXRISETUNE0_BIT)) { + reg &= ~TXRISETUNE0_MASK; + reg |= (data->rise_fall_time_adjust << TXRISETUNE0_BIT); + } + writel(reg, usbmisc->base + MX7D_USB_OTG_PHY_CFG1); }
In some cases, the user may need to tune the rise/fall time of the high-speed transmitter waveform for USB Certification. This will add a parameter for this purpose. The value will be fetched from dtb and finally written to the register. Signed-off-by: Xu Yang <xu.yang_2@nxp.com> --- Changes in v2: - rename parameter name --- drivers/usb/chipidea/ci_hdrc_imx.c | 3 +++ drivers/usb/chipidea/ci_hdrc_imx.h | 1 + drivers/usb/chipidea/usbmisc_imx.c | 9 +++++++++ 3 files changed, 13 insertions(+)