From: David Yang <mmyangfl@gmail.com>
To: mmyangfl@gmail.com
Cc: Vinod Koul <vkoul@kernel.org>,
Kishon Vijay Abraham I <kishon@kernel.org>,
linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH] phy: hisilicon: Adopt phy-hisi-inno-usb2 to ARM
Date: Thu, 16 Feb 2023 09:37:13 +0800 [thread overview]
Message-ID: <20230216013714.1480736-1-mmyangfl@gmail.com> (raw)
Hisilicon also uses phy-hisi-inno-usb2 on some ARM32-only SoCs (for
example, Hi3798), with a slightly different register convention.
Signed-off-by: David Yang <mmyangfl@gmail.com>
---
drivers/phy/hisilicon/Kconfig | 2 +-
drivers/phy/hisilicon/phy-hisi-inno-usb2.c | 16 ++++++++++++++--
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/drivers/phy/hisilicon/Kconfig b/drivers/phy/hisilicon/Kconfig
index d3b92c288..6c89136fc 100644
--- a/drivers/phy/hisilicon/Kconfig
+++ b/drivers/phy/hisilicon/Kconfig
@@ -54,7 +54,7 @@ config PHY_HISTB_COMBPHY
config PHY_HISI_INNO_USB2
tristate "HiSilicon INNO USB2 PHY support"
- depends on (ARCH_HISI && ARM64) || COMPILE_TEST
+ depends on ARCH_HISI || COMPILE_TEST
select GENERIC_PHY
select MFD_SYSCON
help
diff --git a/drivers/phy/hisilicon/phy-hisi-inno-usb2.c b/drivers/phy/hisilicon/phy-hisi-inno-usb2.c
index b133ae067..624899536 100644
--- a/drivers/phy/hisilicon/phy-hisi-inno-usb2.c
+++ b/drivers/phy/hisilicon/phy-hisi-inno-usb2.c
@@ -20,12 +20,24 @@
#define PHY_CLK_STABLE_TIME 2 /* unit:ms */
#define UTMI_RST_COMPLETE_TIME 2 /* unit:ms */
#define POR_RST_COMPLETE_TIME 300 /* unit:us */
+
#define PHY_TEST_DATA GENMASK(7, 0)
+#define PHY_TEST_ADDR_OFFSET 8
+#ifdef CONFIG_ARM64
#define PHY_TEST_ADDR GENMASK(15, 8)
+#define PHY_TEST_PORT_OFFSET 16
#define PHY_TEST_PORT GENMASK(18, 16)
#define PHY_TEST_WREN BIT(21)
#define PHY_TEST_CLK BIT(22) /* rising edge active */
#define PHY_TEST_RST BIT(23) /* low active */
+#else
+#define PHY_TEST_ADDR GENMASK(11, 8)
+#define PHY_TEST_PORT_OFFSET 12
+#define PHY_TEST_PORT BIT(12)
+#define PHY_TEST_WREN BIT(13)
+#define PHY_TEST_CLK BIT(14) /* rising edge active */
+#define PHY_TEST_RST BIT(15) /* low active */
+#endif
#define PHY_CLK_ENABLE BIT(2)
struct hisi_inno_phy_port {
@@ -47,8 +59,8 @@ static void hisi_inno_phy_write_reg(struct hisi_inno_phy_priv *priv,
u32 val;
val = (data & PHY_TEST_DATA) |
- ((addr << 8) & PHY_TEST_ADDR) |
- ((port << 16) & PHY_TEST_PORT) |
+ ((addr << PHY_TEST_ADDR_OFFSET) & PHY_TEST_ADDR) |
+ ((port << PHY_TEST_PORT_OFFSET) & PHY_TEST_PORT) |
PHY_TEST_WREN | PHY_TEST_RST;
writel(val, reg);
--
2.39.1
reply other threads:[~2023-02-16 1:38 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230216013714.1480736-1-mmyangfl@gmail.com \
--to=mmyangfl@gmail.com \
--cc=kishon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=vkoul@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
all inboxes | Powered by JetHome®