From: Sascha Hauer <s.hauer@pengutronix.de>
To: linux-usb@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org,
Peter Chen <peter.chen@kernel.org>,
Peng Fan <peng.fan@oss.nxp.com>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
devicetree@vger.kernel.org, Sascha Hauer <s.hauer@pengutronix.de>
Subject: [PATCH 5/6] usb: chipidea: usbmisc_imx: Add device tree properties for i.MX7 phy tuning
Date: Tue, 11 Oct 2022 10:29:23 +0200 [thread overview]
Message-ID: <20221011082924.884123-6-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20221011082924.884123-1-s.hauer@pengutronix.de>
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(-)
diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
index 9ffcecd3058c1..a7c8c0065b9b7 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.c
+++ b/drivers/usb/chipidea/ci_hdrc_imx.c
@@ -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;
}
diff --git a/drivers/usb/chipidea/ci_hdrc_imx.h b/drivers/usb/chipidea/ci_hdrc_imx.h
index 7daccb9c5006a..c38f4746d6903 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.h
+++ b/drivers/usb/chipidea/ci_hdrc_imx.h
@@ -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);
diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c
index 63de7d6fea427..23dea390bf99b 100644
--- a/drivers/usb/chipidea/usbmisc_imx.c
+++ b/drivers/usb/chipidea/usbmisc_imx.c
@@ -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);
}
--
2.30.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-10-11 8:31 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-11 8:29 [PATCH 0/6] usb: chipidea: Export more phy tuning parameters to device tree Sascha Hauer
2022-10-11 8:29 ` [PATCH 1/6] usb: chipidea: usbmisc_imx: Fix i.MX53 clock sel masks Sascha Hauer
2022-10-18 8:45 ` Xu Yang
2022-10-11 8:29 ` [PATCH 2/6] usb: chipidea: usbmisc_imx: Fix setting i.MX6SX wakeup source Sascha Hauer
2022-10-18 8:46 ` Xu Yang
2022-10-11 8:29 ` [PATCH 3/6] usb: chipidea: usbmisc_imx: Use GENMASK/FIELD_PREP for bitfields Sascha Hauer
2022-10-18 8:39 ` xu yang
2022-10-11 8:29 ` [PATCH 4/6] usb: chipidea: usbmisc_imx: Add prefix to register defines Sascha Hauer
2022-10-18 8:49 ` Xu Yang
2022-10-11 8:29 ` Sascha Hauer [this message]
2022-10-11 8:29 ` [PATCH 6/6] dt-bindings: usb: ci-hdrc-usb2: Add more phy tuning properties Sascha Hauer
2022-10-12 16:08 ` Rob Herring
2022-10-13 10:14 ` Sascha Hauer
2022-10-13 20:03 ` Rob Herring
2022-10-17 0:41 ` [PATCH 0/6] usb: chipidea: Export more phy tuning parameters to device tree Peter Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221011082924.884123-6-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=devicetree@vger.kernel.org \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-usb@vger.kernel.org \
--cc=peng.fan@oss.nxp.com \
--cc=peter.chen@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).