* [PATCH v2 0/2] phy: hisilicon: Add inno-usb2-phy driver for Hi3798MV100
@ 2023-05-09 6:04 David Yang
2023-05-09 6:04 ` [PATCH v2 1/2] " David Yang
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: David Yang @ 2023-05-09 6:04 UTC (permalink / raw)
To: linux-phy; +Cc: David Yang, Vinod Koul, Kishon Vijay Abraham I, linux-kernel
This series adds support for inno-usb2-phy on Hi3798MV100.
v2: split patches, and other changes according to reviews
David Yang (2):
phy: hisilicon: Add inno-usb2-phy driver for Hi3798MV100
phy: hisilicon: Allow building phy-hisi-inno-usb2 on ARM32
drivers/phy/hisilicon/Kconfig | 2 +-
drivers/phy/hisilicon/phy-hisi-inno-usb2.c | 62 ++++++++++++++++------
2 files changed, 47 insertions(+), 17 deletions(-)
base-commit: ba0ad6ed89fd5dada3b7b65ef2b08e95d449d4ab
--
2.39.2
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 1/2] phy: hisilicon: Add inno-usb2-phy driver for Hi3798MV100
2023-05-09 6:04 [PATCH v2 0/2] phy: hisilicon: Add inno-usb2-phy driver for Hi3798MV100 David Yang
@ 2023-05-09 6:04 ` David Yang
2023-05-09 6:04 ` [PATCH v2 2/2] phy: hisilicon: Allow building phy-hisi-inno-usb2 on ARM32 David Yang
2023-05-16 14:14 ` [PATCH v2 0/2] phy: hisilicon: Add inno-usb2-phy driver for Hi3798MV100 Vinod Koul
2 siblings, 0 replies; 4+ messages in thread
From: David Yang @ 2023-05-09 6:04 UTC (permalink / raw)
To: linux-phy; +Cc: David Yang, Vinod Koul, Kishon Vijay Abraham I, linux-kernel
Adopt existing phy-hisi-inno-usb2 driver to Hi3798MV100, with a slightly
different TEST register convention.
Signed-off-by: David Yang <mmyangfl@gmail.com>
---
drivers/phy/hisilicon/phy-hisi-inno-usb2.c | 62 ++++++++++++++++------
1 file changed, 46 insertions(+), 16 deletions(-)
diff --git a/drivers/phy/hisilicon/phy-hisi-inno-usb2.c b/drivers/phy/hisilicon/phy-hisi-inno-usb2.c
index b133ae06757a..15dafe359552 100644
--- a/drivers/phy/hisilicon/phy-hisi-inno-usb2.c
+++ b/drivers/phy/hisilicon/phy-hisi-inno-usb2.c
@@ -9,7 +9,7 @@
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/module.h>
-#include <linux/platform_device.h>
+#include <linux/of_device.h>
#include <linux/phy/phy.h>
#include <linux/reset.h>
@@ -20,12 +20,25 @@
#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_TYPE_0 0
+#define PHY_TYPE_1 1
+
#define PHY_TEST_DATA GENMASK(7, 0)
-#define PHY_TEST_ADDR GENMASK(15, 8)
-#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 */
+#define PHY_TEST_ADDR_OFFSET 8
+#define PHY0_TEST_ADDR GENMASK(15, 8)
+#define PHY0_TEST_PORT_OFFSET 16
+#define PHY0_TEST_PORT GENMASK(18, 16)
+#define PHY0_TEST_WREN BIT(21)
+#define PHY0_TEST_CLK BIT(22) /* rising edge active */
+#define PHY0_TEST_RST BIT(23) /* low active */
+#define PHY1_TEST_ADDR GENMASK(11, 8)
+#define PHY1_TEST_PORT_OFFSET 12
+#define PHY1_TEST_PORT BIT(12)
+#define PHY1_TEST_WREN BIT(13)
+#define PHY1_TEST_CLK BIT(14) /* rising edge active */
+#define PHY1_TEST_RST BIT(15) /* low active */
+
#define PHY_CLK_ENABLE BIT(2)
struct hisi_inno_phy_port {
@@ -37,6 +50,7 @@ struct hisi_inno_phy_priv {
void __iomem *mmio;
struct clk *ref_clk;
struct reset_control *por_rst;
+ unsigned int type;
struct hisi_inno_phy_port ports[INNO_PHY_PORT_NUM];
};
@@ -45,17 +59,27 @@ static void hisi_inno_phy_write_reg(struct hisi_inno_phy_priv *priv,
{
void __iomem *reg = priv->mmio;
u32 val;
-
- val = (data & PHY_TEST_DATA) |
- ((addr << 8) & PHY_TEST_ADDR) |
- ((port << 16) & PHY_TEST_PORT) |
- PHY_TEST_WREN | PHY_TEST_RST;
+ u32 value;
+
+ if (priv->type == PHY_TYPE_0)
+ val = (data & PHY_TEST_DATA) |
+ ((addr << PHY_TEST_ADDR_OFFSET) & PHY0_TEST_ADDR) |
+ ((port << PHY0_TEST_PORT_OFFSET) & PHY0_TEST_PORT) |
+ PHY0_TEST_WREN | PHY0_TEST_RST;
+ else
+ val = (data & PHY_TEST_DATA) |
+ ((addr << PHY_TEST_ADDR_OFFSET) & PHY1_TEST_ADDR) |
+ ((port << PHY1_TEST_PORT_OFFSET) & PHY1_TEST_PORT) |
+ PHY1_TEST_WREN | PHY1_TEST_RST;
writel(val, reg);
- val |= PHY_TEST_CLK;
- writel(val, reg);
+ value = val;
+ if (priv->type == PHY_TYPE_0)
+ value |= PHY0_TEST_CLK;
+ else
+ value |= PHY1_TEST_CLK;
+ writel(value, reg);
- val &= ~PHY_TEST_CLK;
writel(val, reg);
}
@@ -135,6 +159,8 @@ static int hisi_inno_phy_probe(struct platform_device *pdev)
if (IS_ERR(priv->por_rst))
return PTR_ERR(priv->por_rst);
+ priv->type = (uintptr_t) of_device_get_match_data(dev);
+
for_each_child_of_node(np, child) {
struct reset_control *rst;
struct phy *phy;
@@ -170,8 +196,12 @@ static int hisi_inno_phy_probe(struct platform_device *pdev)
}
static const struct of_device_id hisi_inno_phy_of_match[] = {
- { .compatible = "hisilicon,inno-usb2-phy", },
- { .compatible = "hisilicon,hi3798cv200-usb2-phy", },
+ { .compatible = "hisilicon,inno-usb2-phy",
+ .data = (void *) PHY_TYPE_0 },
+ { .compatible = "hisilicon,hi3798cv200-usb2-phy",
+ .data = (void *) PHY_TYPE_0 },
+ { .compatible = "hisilicon,hi3798mv100-usb2-phy",
+ .data = (void *) PHY_TYPE_1 },
{ },
};
MODULE_DEVICE_TABLE(of, hisi_inno_phy_of_match);
--
2.39.2
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 2/2] phy: hisilicon: Allow building phy-hisi-inno-usb2 on ARM32
2023-05-09 6:04 [PATCH v2 0/2] phy: hisilicon: Add inno-usb2-phy driver for Hi3798MV100 David Yang
2023-05-09 6:04 ` [PATCH v2 1/2] " David Yang
@ 2023-05-09 6:04 ` David Yang
2023-05-16 14:14 ` [PATCH v2 0/2] phy: hisilicon: Add inno-usb2-phy driver for Hi3798MV100 Vinod Koul
2 siblings, 0 replies; 4+ messages in thread
From: David Yang @ 2023-05-09 6:04 UTC (permalink / raw)
To: linux-phy; +Cc: David Yang, Vinod Koul, Kishon Vijay Abraham I, linux-kernel
Support for inno-usb2-phy on Hi3798MV100 was added into existing driver,
while Hi3798MV100 is a A9 ARM32-only SoC.
Signed-off-by: David Yang <mmyangfl@gmail.com>
---
drivers/phy/hisilicon/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/phy/hisilicon/Kconfig b/drivers/phy/hisilicon/Kconfig
index d3b92c288554..6c89136fc8c2 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
--
2.39.2
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 0/2] phy: hisilicon: Add inno-usb2-phy driver for Hi3798MV100
2023-05-09 6:04 [PATCH v2 0/2] phy: hisilicon: Add inno-usb2-phy driver for Hi3798MV100 David Yang
2023-05-09 6:04 ` [PATCH v2 1/2] " David Yang
2023-05-09 6:04 ` [PATCH v2 2/2] phy: hisilicon: Allow building phy-hisi-inno-usb2 on ARM32 David Yang
@ 2023-05-16 14:14 ` Vinod Koul
2 siblings, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2023-05-16 14:14 UTC (permalink / raw)
To: David Yang; +Cc: linux-phy, Kishon Vijay Abraham I, linux-kernel
On 09-05-23, 14:04, David Yang wrote:
> This series adds support for inno-usb2-phy on Hi3798MV100.
Applied, thanks
--
~Vinod
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-05-16 14:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-09 6:04 [PATCH v2 0/2] phy: hisilicon: Add inno-usb2-phy driver for Hi3798MV100 David Yang
2023-05-09 6:04 ` [PATCH v2 1/2] " David Yang
2023-05-09 6:04 ` [PATCH v2 2/2] phy: hisilicon: Allow building phy-hisi-inno-usb2 on ARM32 David Yang
2023-05-16 14:14 ` [PATCH v2 0/2] phy: hisilicon: Add inno-usb2-phy driver for Hi3798MV100 Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox