@@ -172,8 +172,22 @@ static struct imx_usbmisc_data *usbmisc_get_init_data(struct device *dev)
of_property_read_u32(np, "samsung,picophy-pre-emp-curr-control",
&data->emp_curr_control);
+ of_property_read_u32(np, "samsung,picophy-usb-source-impedance-adjust",
+ &data->usb_source_impedance_adjust);
+ of_property_read_u32(np, "samsung,picophy-hs-rise-time-adjust",
+ &data->hs_transmitter_rise_time_adjust);
of_property_read_u32(np, "samsung,picophy-dc-vol-level-adjust",
&data->dc_vol_level_adjust);
+ of_property_read_u32(np, "samsung,picophy-fs-ls-source-impedance-adjust",
+ &data->fs_ls_source_impedance_adjust);
+ of_property_read_u32(np, "samsung,picophy-transmitter-hs-crossover-adjust",
+ &data->transmitter_hs_crossover_adjust);
+ of_property_read_u32(np, "samsung,picophy-vbus-valid-threshold-adjust",
+ &data->vbus_valid_threshold_adjust);
+ of_property_read_u32(np, "samsung,picophy-squelsh-threshold-adjust",
+ &data->squelsh_threshold_adjust);
+ of_property_read_u32(np, "samsung,picophy-disconnect-threshold-adjust",
+ &data->disconnect_threshold_adjust);
return data;
}
@@ -27,7 +27,14 @@ struct imx_usbmisc_data {
struct usb_phy *usb_phy;
enum usb_dr_mode available_role; /* runtime usb dr mode */
int emp_curr_control;
+ int hs_transmitter_rise_time_adjust;
int dc_vol_level_adjust;
+ int usb_source_impedance_adjust;
+ int fs_ls_source_impedance_adjust;
+ int transmitter_hs_crossover_adjust;
+ int vbus_valid_threshold_adjust;
+ int squelsh_threshold_adjust;
+ int disconnect_threshold_adjust;
};
int imx_usbmisc_init(struct imx_usbmisc_data *data);
@@ -126,8 +126,19 @@
#define MX7D_USB_OTG_PHY_STATUS_CHRGDET BIT(29)
#define MX7D_USB_OTG_PHY_CFG1 0x30
-#define MX7D_USB_OTG_PHY_CFG1_TXPREEMPAMPTUNE0 GENMASK(29, 28)
-#define MX7D_USB_OTG_PHY_CFG1_TXVREFTUNE0 GENMASK(23, 20)
+#define MX7D_USB_OTG_PHY_CFG1_CHRGDET_MEGAMIX BIT(31)
+#define MX7D_USB_OTG_PHY_CFG1_TXPREEMPPULSETUNE0 BIT(30)
+#define MX7D_USB_OTG_PHY_CFG1_TXPREEMPAMPTUNE0 GENMASK(29, 28)
+#define MX7D_USB_OTG_PHY_CFG1_TXRESTUNE0 GENMASK(27, 26)
+#define MX7D_USB_OTG_PHY_CFG1_TXRISETUNE0 GENMASK(25, 24)
+#define MX7D_USB_OTG_PHY_CFG1_TXVREFTUNE0 GENMASK(23, 20)
+#define MX7D_USB_OTG_PHY_CFG1_TXFSLSTUNE0 GENMASK(19, 16)
+#define MX7D_USB_OTG_PHY_CFG1_TXHSXVTUNE0 GENMASK(14, 13)
+#define MX7D_USB_OTG_PHY_CFG1_OTGTUNE0 GENMASK(12, 10)
+#define MX7D_USB_OTG_PHY_CFG1_SQRTUNE0 GENMASK(9, 7)
+#define MX7D_USB_OTG_PHY_CFG1_COMPDISTUNE0 GENMASK(6, 4)
+#define MX7D_USB_OTG_PHY_CFG1_FSEL GENMASK(3, 1)
+#define MX7D_USB_OTG_PHY_CFG1_COMMONONN BIT(0)
#define MX6_USB_OTG_WAKEUP_BITS (MX6_BM_WAKEUP_ENABLE | MX6_BM_VBUS_WAKEUP | \
MX6_BM_ID_WAKEUP)
@@ -666,6 +677,22 @@ static int usbmisc_imx7d_init(struct imx_usbmisc_data *data)
data->emp_curr_control);
}
+ if (data->usb_source_impedance_adjust &&
+ FIELD_FIT(MX7D_USB_OTG_PHY_CFG1_TXRESTUNE0,
+ data->usb_source_impedance_adjust)) {
+ reg &= ~MX7D_USB_OTG_PHY_CFG1_TXRESTUNE0;
+ reg |= FIELD_PREP(MX7D_USB_OTG_PHY_CFG1_TXRESTUNE0,
+ data->usb_source_impedance_adjust);
+ }
+
+ if (data->hs_transmitter_rise_time_adjust &&
+ FIELD_FIT(MX7D_USB_OTG_PHY_CFG1_TXRISETUNE0,
+ data->hs_transmitter_rise_time_adjust)) {
+ reg &= ~MX7D_USB_OTG_PHY_CFG1_TXRISETUNE0;
+ reg |= FIELD_PREP(MX7D_USB_OTG_PHY_CFG1_TXRISETUNE0,
+ data->hs_transmitter_rise_time_adjust);
+ }
+
if (data->dc_vol_level_adjust &&
FIELD_FIT(MX7D_USB_OTG_PHY_CFG1_TXVREFTUNE0,
data->dc_vol_level_adjust)) {
@@ -674,6 +701,46 @@ static int usbmisc_imx7d_init(struct imx_usbmisc_data *data)
data->dc_vol_level_adjust);
}
+ if (data->fs_ls_source_impedance_adjust &&
+ FIELD_FIT(MX7D_USB_OTG_PHY_CFG1_TXFSLSTUNE0,
+ data->fs_ls_source_impedance_adjust)) {
+ reg &= ~MX7D_USB_OTG_PHY_CFG1_TXFSLSTUNE0;
+ reg |= FIELD_PREP(MX7D_USB_OTG_PHY_CFG1_TXFSLSTUNE0,
+ data->fs_ls_source_impedance_adjust);
+ }
+
+ if (data->transmitter_hs_crossover_adjust &&
+ FIELD_FIT(MX7D_USB_OTG_PHY_CFG1_TXHSXVTUNE0,
+ data->transmitter_hs_crossover_adjust)) {
+ reg &= ~MX7D_USB_OTG_PHY_CFG1_TXHSXVTUNE0;
+ reg |= FIELD_PREP(MX7D_USB_OTG_PHY_CFG1_TXHSXVTUNE0,
+ data->transmitter_hs_crossover_adjust);
+ }
+
+ if (data->vbus_valid_threshold_adjust &&
+ FIELD_FIT(MX7D_USB_OTG_PHY_CFG1_OTGTUNE0,
+ data->vbus_valid_threshold_adjust)) {
+ reg &= ~MX7D_USB_OTG_PHY_CFG1_OTGTUNE0;
+ reg |= FIELD_PREP(MX7D_USB_OTG_PHY_CFG1_OTGTUNE0,
+ data->vbus_valid_threshold_adjust);
+ }
+
+ if (data->squelsh_threshold_adjust &&
+ FIELD_FIT(MX7D_USB_OTG_PHY_CFG1_SQRTUNE0,
+ data->squelsh_threshold_adjust)) {
+ reg &= ~MX7D_USB_OTG_PHY_CFG1_SQRTUNE0;
+ reg |= FIELD_PREP(MX7D_USB_OTG_PHY_CFG1_SQRTUNE0,
+ data->squelsh_threshold_adjust);
+ }
+
+ if (data->disconnect_threshold_adjust &&
+ FIELD_FIT(MX7D_USB_OTG_PHY_CFG1_COMPDISTUNE0,
+ data->disconnect_threshold_adjust)) {
+ reg &= ~MX7D_USB_OTG_PHY_CFG1_COMPDISTUNE0;
+ reg |= FIELD_PREP(MX7D_USB_OTG_PHY_CFG1_COMPDISTUNE0,
+ data->disconnect_threshold_adjust);
+ }
+
writel(reg, usbmisc->base + MX7D_USB_OTG_PHY_CFG1);
}
This adds support for configuring the remaining phy tuning options from device tree. Some properties are already configurable, the remaining properties are added following the same pattern. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- drivers/usb/chipidea/ci_hdrc_imx.c | 14 ++++++ drivers/usb/chipidea/ci_hdrc_imx.h | 7 +++ drivers/usb/chipidea/usbmisc_imx.c | 71 +++++++++++++++++++++++++++++- 3 files changed, 90 insertions(+), 2 deletions(-)