diff options
-rw-r--r-- | MAINTAINERS | 2 | ||||
-rw-r--r-- | drivers/phy/Kconfig | 9 | ||||
-rw-r--r-- | drivers/phy/Makefile | 2 | ||||
-rw-r--r-- | drivers/phy/mediatek/Kconfig | 14 | ||||
-rw-r--r-- | drivers/phy/mediatek/Makefile | 5 | ||||
-rw-r--r-- | drivers/phy/mediatek/phy-mtk-tphy.c (renamed from drivers/phy/phy-mt65xx-usb3.c) | 264 |
6 files changed, 154 insertions, 142 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 205d3977ac46..428e5d0a3bca 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -1599,7 +1599,7 @@ M: Chunfeng Yun <chunfeng.yun@mediatek.com> | |||
1599 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 1599 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
1600 | L: linux-mediatek@lists.infradead.org (moderated for non-subscribers) | 1600 | L: linux-mediatek@lists.infradead.org (moderated for non-subscribers) |
1601 | S: Maintained | 1601 | S: Maintained |
1602 | F: drivers/phy/phy-mt65xx-usb3.c | 1602 | F: drivers/phy/mediatek/phy-mtk-tphy.c |
1603 | 1603 | ||
1604 | ARM/MICREL KS8695 ARCHITECTURE | 1604 | ARM/MICREL KS8695 ARCHITECTURE |
1605 | M: Greg Ungerer <gerg@uclinux.org> | 1605 | M: Greg Ungerer <gerg@uclinux.org> |
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index c1807d4a0079..d16704e77e68 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig | |||
@@ -26,14 +26,6 @@ config PHY_LPC18XX_USB_OTG | |||
26 | This driver is need for USB0 support on LPC18xx/43xx and takes | 26 | This driver is need for USB0 support on LPC18xx/43xx and takes |
27 | care of enabling and clock setup. | 27 | care of enabling and clock setup. |
28 | 28 | ||
29 | config PHY_MT65XX_USB3 | ||
30 | tristate "Mediatek USB3.0 PHY Driver" | ||
31 | depends on ARCH_MEDIATEK && OF | ||
32 | select GENERIC_PHY | ||
33 | help | ||
34 | Say 'Y' here to add support for Mediatek USB3.0 PHY driver, | ||
35 | it supports multiple usb2.0 and usb3.0 ports. | ||
36 | |||
37 | config PHY_PISTACHIO_USB | 29 | config PHY_PISTACHIO_USB |
38 | tristate "IMG Pistachio USB2.0 PHY driver" | 30 | tristate "IMG Pistachio USB2.0 PHY driver" |
39 | depends on MACH_PISTACHIO | 31 | depends on MACH_PISTACHIO |
@@ -53,6 +45,7 @@ source "drivers/phy/amlogic/Kconfig" | |||
53 | source "drivers/phy/broadcom/Kconfig" | 45 | source "drivers/phy/broadcom/Kconfig" |
54 | source "drivers/phy/hisilicon/Kconfig" | 46 | source "drivers/phy/hisilicon/Kconfig" |
55 | source "drivers/phy/marvell/Kconfig" | 47 | source "drivers/phy/marvell/Kconfig" |
48 | source "drivers/phy/mediatek/Kconfig" | ||
56 | source "drivers/phy/motorola/Kconfig" | 49 | source "drivers/phy/motorola/Kconfig" |
57 | source "drivers/phy/qualcomm/Kconfig" | 50 | source "drivers/phy/qualcomm/Kconfig" |
58 | source "drivers/phy/renesas/Kconfig" | 51 | source "drivers/phy/renesas/Kconfig" |
diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index f252201e0ec9..1c68189b2894 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile | |||
@@ -4,12 +4,12 @@ | |||
4 | 4 | ||
5 | obj-$(CONFIG_GENERIC_PHY) += phy-core.o | 5 | obj-$(CONFIG_GENERIC_PHY) += phy-core.o |
6 | obj-$(CONFIG_PHY_LPC18XX_USB_OTG) += phy-lpc18xx-usb-otg.o | 6 | obj-$(CONFIG_PHY_LPC18XX_USB_OTG) += phy-lpc18xx-usb-otg.o |
7 | obj-$(CONFIG_PHY_MT65XX_USB3) += phy-mt65xx-usb3.o | ||
8 | obj-$(CONFIG_PHY_XGENE) += phy-xgene.o | 7 | obj-$(CONFIG_PHY_XGENE) += phy-xgene.o |
9 | obj-$(CONFIG_PHY_PISTACHIO_USB) += phy-pistachio-usb.o | 8 | obj-$(CONFIG_PHY_PISTACHIO_USB) += phy-pistachio-usb.o |
10 | 9 | ||
11 | obj-$(CONFIG_ARCH_SUNXI) += allwinner/ | 10 | obj-$(CONFIG_ARCH_SUNXI) += allwinner/ |
12 | obj-$(CONFIG_ARCH_MESON) += amlogic/ | 11 | obj-$(CONFIG_ARCH_MESON) += amlogic/ |
12 | obj-$(CONFIG_ARCH_MEDIATEK) += mediatek/ | ||
13 | obj-$(CONFIG_ARCH_RENESAS) += renesas/ | 13 | obj-$(CONFIG_ARCH_RENESAS) += renesas/ |
14 | obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip/ | 14 | obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip/ |
15 | obj-$(CONFIG_ARCH_TEGRA) += tegra/ | 15 | obj-$(CONFIG_ARCH_TEGRA) += tegra/ |
diff --git a/drivers/phy/mediatek/Kconfig b/drivers/phy/mediatek/Kconfig new file mode 100644 index 000000000000..88ab4e25e34f --- /dev/null +++ b/drivers/phy/mediatek/Kconfig | |||
@@ -0,0 +1,14 @@ | |||
1 | # | ||
2 | # Phy drivers for Mediatek devices | ||
3 | # | ||
4 | config PHY_MTK_TPHY | ||
5 | tristate "MediaTek T-PHY Driver" | ||
6 | depends on ARCH_MEDIATEK && OF | ||
7 | select GENERIC_PHY | ||
8 | help | ||
9 | Say 'Y' here to add support for MediaTek T-PHY driver, | ||
10 | it supports multiple usb2.0, usb3.0 ports, PCIe and | ||
11 | SATA, and meanwhile supports two version T-PHY which have | ||
12 | different banks layout, the T-PHY with shared banks between | ||
13 | multi-ports is first version, otherwise is second veriosn, | ||
14 | so you can easily distinguish them by banks layout. | ||
diff --git a/drivers/phy/mediatek/Makefile b/drivers/phy/mediatek/Makefile new file mode 100644 index 000000000000..763a92eefa00 --- /dev/null +++ b/drivers/phy/mediatek/Makefile | |||
@@ -0,0 +1,5 @@ | |||
1 | # | ||
2 | # Makefile for the phy drivers. | ||
3 | # | ||
4 | |||
5 | obj-$(CONFIG_PHY_MTK_TPHY) += phy-mtk-tphy.o | ||
diff --git a/drivers/phy/phy-mt65xx-usb3.c b/drivers/phy/mediatek/phy-mtk-tphy.c index 45291c12d069..e3baad78521f 100644 --- a/drivers/phy/phy-mt65xx-usb3.c +++ b/drivers/phy/mediatek/phy-mtk-tphy.c | |||
@@ -38,7 +38,7 @@ | |||
38 | #define SSUSB_SIFSLV_V2_MISC 0x000 | 38 | #define SSUSB_SIFSLV_V2_MISC 0x000 |
39 | #define SSUSB_SIFSLV_V2_U2FREQ 0x100 | 39 | #define SSUSB_SIFSLV_V2_U2FREQ 0x100 |
40 | #define SSUSB_SIFSLV_V2_U2PHY_COM 0x300 | 40 | #define SSUSB_SIFSLV_V2_U2PHY_COM 0x300 |
41 | /* u3 phy banks */ | 41 | /* u3/pcie/sata phy banks */ |
42 | #define SSUSB_SIFSLV_V2_SPLLC 0x000 | 42 | #define SSUSB_SIFSLV_V2_SPLLC 0x000 |
43 | #define SSUSB_SIFSLV_V2_CHIP 0x100 | 43 | #define SSUSB_SIFSLV_V2_CHIP 0x100 |
44 | #define SSUSB_SIFSLV_V2_U3PHYD 0x200 | 44 | #define SSUSB_SIFSLV_V2_U3PHYD 0x200 |
@@ -258,15 +258,15 @@ | |||
258 | #define RG_CDR_BIRLTD0_GEN3_MSK GENMASK(4, 0) | 258 | #define RG_CDR_BIRLTD0_GEN3_MSK GENMASK(4, 0) |
259 | #define RG_CDR_BIRLTD0_GEN3_VAL(x) (0x1f & (x)) | 259 | #define RG_CDR_BIRLTD0_GEN3_VAL(x) (0x1f & (x)) |
260 | 260 | ||
261 | enum mt_phy_version { | 261 | enum mtk_phy_version { |
262 | MT_PHY_V1 = 1, | 262 | MTK_PHY_V1 = 1, |
263 | MT_PHY_V2, | 263 | MTK_PHY_V2, |
264 | }; | 264 | }; |
265 | 265 | ||
266 | struct mt65xx_phy_pdata { | 266 | struct mtk_phy_pdata { |
267 | /* avoid RX sensitivity level degradation only for mt8173 */ | 267 | /* avoid RX sensitivity level degradation only for mt8173 */ |
268 | bool avoid_rx_sen_degradation; | 268 | bool avoid_rx_sen_degradation; |
269 | enum mt_phy_version version; | 269 | enum mtk_phy_version version; |
270 | }; | 270 | }; |
271 | 271 | ||
272 | struct u2phy_banks { | 272 | struct u2phy_banks { |
@@ -282,7 +282,7 @@ struct u3phy_banks { | |||
282 | void __iomem *phya; /* include u3phya_da */ | 282 | void __iomem *phya; /* include u3phya_da */ |
283 | }; | 283 | }; |
284 | 284 | ||
285 | struct mt65xx_phy_instance { | 285 | struct mtk_phy_instance { |
286 | struct phy *phy; | 286 | struct phy *phy; |
287 | void __iomem *port_base; | 287 | void __iomem *port_base; |
288 | union { | 288 | union { |
@@ -294,18 +294,18 @@ struct mt65xx_phy_instance { | |||
294 | u8 type; | 294 | u8 type; |
295 | }; | 295 | }; |
296 | 296 | ||
297 | struct mt65xx_u3phy { | 297 | struct mtk_tphy { |
298 | struct device *dev; | 298 | struct device *dev; |
299 | void __iomem *sif_base; /* only shared sif */ | 299 | void __iomem *sif_base; /* only shared sif */ |
300 | /* deprecated, use @ref_clk instead in phy instance */ | 300 | /* deprecated, use @ref_clk instead in phy instance */ |
301 | struct clk *u3phya_ref; /* reference clock of usb3 anolog phy */ | 301 | struct clk *u3phya_ref; /* reference clock of usb3 anolog phy */ |
302 | const struct mt65xx_phy_pdata *pdata; | 302 | const struct mtk_phy_pdata *pdata; |
303 | struct mt65xx_phy_instance **phys; | 303 | struct mtk_phy_instance **phys; |
304 | int nphys; | 304 | int nphys; |
305 | }; | 305 | }; |
306 | 306 | ||
307 | static void hs_slew_rate_calibrate(struct mt65xx_u3phy *u3phy, | 307 | static void hs_slew_rate_calibrate(struct mtk_tphy *tphy, |
308 | struct mt65xx_phy_instance *instance) | 308 | struct mtk_phy_instance *instance) |
309 | { | 309 | { |
310 | struct u2phy_banks *u2_banks = &instance->u2_banks; | 310 | struct u2phy_banks *u2_banks = &instance->u2_banks; |
311 | void __iomem *fmreg = u2_banks->fmreg; | 311 | void __iomem *fmreg = u2_banks->fmreg; |
@@ -329,7 +329,7 @@ static void hs_slew_rate_calibrate(struct mt65xx_u3phy *u3phy, | |||
329 | tmp = readl(fmreg + U3P_U2FREQ_FMCR0); | 329 | tmp = readl(fmreg + U3P_U2FREQ_FMCR0); |
330 | tmp &= ~(P2F_RG_CYCLECNT | P2F_RG_MONCLK_SEL); | 330 | tmp &= ~(P2F_RG_CYCLECNT | P2F_RG_MONCLK_SEL); |
331 | tmp |= P2F_RG_CYCLECNT_VAL(U3P_FM_DET_CYCLE_CNT); | 331 | tmp |= P2F_RG_CYCLECNT_VAL(U3P_FM_DET_CYCLE_CNT); |
332 | if (u3phy->pdata->version == MT_PHY_V1) | 332 | if (tphy->pdata->version == MTK_PHY_V1) |
333 | tmp |= P2F_RG_MONCLK_SEL_VAL(instance->index >> 1); | 333 | tmp |= P2F_RG_MONCLK_SEL_VAL(instance->index >> 1); |
334 | 334 | ||
335 | writel(tmp, fmreg + U3P_U2FREQ_FMCR0); | 335 | writel(tmp, fmreg + U3P_U2FREQ_FMCR0); |
@@ -364,7 +364,7 @@ static void hs_slew_rate_calibrate(struct mt65xx_u3phy *u3phy, | |||
364 | /* if FM detection fail, set default value */ | 364 | /* if FM detection fail, set default value */ |
365 | calibration_val = 4; | 365 | calibration_val = 4; |
366 | } | 366 | } |
367 | dev_dbg(u3phy->dev, "phy:%d, fm_out:%d, calib:%d\n", | 367 | dev_dbg(tphy->dev, "phy:%d, fm_out:%d, calib:%d\n", |
368 | instance->index, fm_out, calibration_val); | 368 | instance->index, fm_out, calibration_val); |
369 | 369 | ||
370 | /* set HS slew rate */ | 370 | /* set HS slew rate */ |
@@ -379,8 +379,8 @@ static void hs_slew_rate_calibrate(struct mt65xx_u3phy *u3phy, | |||
379 | writel(tmp, com + U3P_USBPHYACR5); | 379 | writel(tmp, com + U3P_USBPHYACR5); |
380 | } | 380 | } |
381 | 381 | ||
382 | static void u3_phy_instance_init(struct mt65xx_u3phy *u3phy, | 382 | static void u3_phy_instance_init(struct mtk_tphy *tphy, |
383 | struct mt65xx_phy_instance *instance) | 383 | struct mtk_phy_instance *instance) |
384 | { | 384 | { |
385 | struct u3phy_banks *u3_banks = &instance->u3_banks; | 385 | struct u3phy_banks *u3_banks = &instance->u3_banks; |
386 | u32 tmp; | 386 | u32 tmp; |
@@ -426,11 +426,11 @@ static void u3_phy_instance_init(struct mt65xx_u3phy *u3phy, | |||
426 | tmp |= P3D_RG_RXDET_STB2_SET_P3_VAL(0x10); | 426 | tmp |= P3D_RG_RXDET_STB2_SET_P3_VAL(0x10); |
427 | writel(tmp, u3_banks->phyd + U3P_U3_PHYD_RXDET2); | 427 | writel(tmp, u3_banks->phyd + U3P_U3_PHYD_RXDET2); |
428 | 428 | ||
429 | dev_dbg(u3phy->dev, "%s(%d)\n", __func__, instance->index); | 429 | dev_dbg(tphy->dev, "%s(%d)\n", __func__, instance->index); |
430 | } | 430 | } |
431 | 431 | ||
432 | static void u2_phy_instance_init(struct mt65xx_u3phy *u3phy, | 432 | static void u2_phy_instance_init(struct mtk_tphy *tphy, |
433 | struct mt65xx_phy_instance *instance) | 433 | struct mtk_phy_instance *instance) |
434 | { | 434 | { |
435 | struct u2phy_banks *u2_banks = &instance->u2_banks; | 435 | struct u2phy_banks *u2_banks = &instance->u2_banks; |
436 | void __iomem *com = u2_banks->com; | 436 | void __iomem *com = u2_banks->com; |
@@ -462,7 +462,7 @@ static void u2_phy_instance_init(struct mt65xx_u3phy *u3phy, | |||
462 | writel(tmp, com + U3P_U2PHYACR4); | 462 | writel(tmp, com + U3P_U2PHYACR4); |
463 | } | 463 | } |
464 | 464 | ||
465 | if (u3phy->pdata->avoid_rx_sen_degradation) { | 465 | if (tphy->pdata->avoid_rx_sen_degradation) { |
466 | if (!index) { | 466 | if (!index) { |
467 | tmp = readl(com + U3P_USBPHYACR2); | 467 | tmp = readl(com + U3P_USBPHYACR2); |
468 | tmp |= PA2_RG_SIF_U2PLL_FORCE_EN; | 468 | tmp |= PA2_RG_SIF_U2PLL_FORCE_EN; |
@@ -488,11 +488,11 @@ static void u2_phy_instance_init(struct mt65xx_u3phy *u3phy, | |||
488 | tmp |= PA6_RG_U2_SQTH_VAL(2); | 488 | tmp |= PA6_RG_U2_SQTH_VAL(2); |
489 | writel(tmp, com + U3P_USBPHYACR6); | 489 | writel(tmp, com + U3P_USBPHYACR6); |
490 | 490 | ||
491 | dev_dbg(u3phy->dev, "%s(%d)\n", __func__, index); | 491 | dev_dbg(tphy->dev, "%s(%d)\n", __func__, index); |
492 | } | 492 | } |
493 | 493 | ||
494 | static void u2_phy_instance_power_on(struct mt65xx_u3phy *u3phy, | 494 | static void u2_phy_instance_power_on(struct mtk_tphy *tphy, |
495 | struct mt65xx_phy_instance *instance) | 495 | struct mtk_phy_instance *instance) |
496 | { | 496 | { |
497 | struct u2phy_banks *u2_banks = &instance->u2_banks; | 497 | struct u2phy_banks *u2_banks = &instance->u2_banks; |
498 | void __iomem *com = u2_banks->com; | 498 | void __iomem *com = u2_banks->com; |
@@ -515,7 +515,7 @@ static void u2_phy_instance_power_on(struct mt65xx_u3phy *u3phy, | |||
515 | tmp &= ~P2C_RG_SESSEND; | 515 | tmp &= ~P2C_RG_SESSEND; |
516 | writel(tmp, com + U3P_U2PHYDTM1); | 516 | writel(tmp, com + U3P_U2PHYDTM1); |
517 | 517 | ||
518 | if (u3phy->pdata->avoid_rx_sen_degradation && index) { | 518 | if (tphy->pdata->avoid_rx_sen_degradation && index) { |
519 | tmp = readl(com + U3D_U2PHYDCR0); | 519 | tmp = readl(com + U3D_U2PHYDCR0); |
520 | tmp |= P2C_RG_SIF_U2PLL_FORCE_ON; | 520 | tmp |= P2C_RG_SIF_U2PLL_FORCE_ON; |
521 | writel(tmp, com + U3D_U2PHYDCR0); | 521 | writel(tmp, com + U3D_U2PHYDCR0); |
@@ -524,11 +524,11 @@ static void u2_phy_instance_power_on(struct mt65xx_u3phy *u3phy, | |||
524 | tmp |= P2C_RG_SUSPENDM | P2C_FORCE_SUSPENDM; | 524 | tmp |= P2C_RG_SUSPENDM | P2C_FORCE_SUSPENDM; |
525 | writel(tmp, com + U3P_U2PHYDTM0); | 525 | writel(tmp, com + U3P_U2PHYDTM0); |
526 | } | 526 | } |
527 | dev_dbg(u3phy->dev, "%s(%d)\n", __func__, index); | 527 | dev_dbg(tphy->dev, "%s(%d)\n", __func__, index); |
528 | } | 528 | } |
529 | 529 | ||
530 | static void u2_phy_instance_power_off(struct mt65xx_u3phy *u3phy, | 530 | static void u2_phy_instance_power_off(struct mtk_tphy *tphy, |
531 | struct mt65xx_phy_instance *instance) | 531 | struct mtk_phy_instance *instance) |
532 | { | 532 | { |
533 | struct u2phy_banks *u2_banks = &instance->u2_banks; | 533 | struct u2phy_banks *u2_banks = &instance->u2_banks; |
534 | void __iomem *com = u2_banks->com; | 534 | void __iomem *com = u2_banks->com; |
@@ -556,24 +556,24 @@ static void u2_phy_instance_power_off(struct mt65xx_u3phy *u3phy, | |||
556 | tmp |= P2C_RG_SESSEND; | 556 | tmp |= P2C_RG_SESSEND; |
557 | writel(tmp, com + U3P_U2PHYDTM1); | 557 | writel(tmp, com + U3P_U2PHYDTM1); |
558 | 558 | ||
559 | if (u3phy->pdata->avoid_rx_sen_degradation && index) { | 559 | if (tphy->pdata->avoid_rx_sen_degradation && index) { |
560 | tmp = readl(com + U3D_U2PHYDCR0); | 560 | tmp = readl(com + U3D_U2PHYDCR0); |
561 | tmp &= ~P2C_RG_SIF_U2PLL_FORCE_ON; | 561 | tmp &= ~P2C_RG_SIF_U2PLL_FORCE_ON; |
562 | writel(tmp, com + U3D_U2PHYDCR0); | 562 | writel(tmp, com + U3D_U2PHYDCR0); |
563 | } | 563 | } |
564 | 564 | ||
565 | dev_dbg(u3phy->dev, "%s(%d)\n", __func__, index); | 565 | dev_dbg(tphy->dev, "%s(%d)\n", __func__, index); |
566 | } | 566 | } |
567 | 567 | ||
568 | static void u2_phy_instance_exit(struct mt65xx_u3phy *u3phy, | 568 | static void u2_phy_instance_exit(struct mtk_tphy *tphy, |
569 | struct mt65xx_phy_instance *instance) | 569 | struct mtk_phy_instance *instance) |
570 | { | 570 | { |
571 | struct u2phy_banks *u2_banks = &instance->u2_banks; | 571 | struct u2phy_banks *u2_banks = &instance->u2_banks; |
572 | void __iomem *com = u2_banks->com; | 572 | void __iomem *com = u2_banks->com; |
573 | u32 index = instance->index; | 573 | u32 index = instance->index; |
574 | u32 tmp; | 574 | u32 tmp; |
575 | 575 | ||
576 | if (u3phy->pdata->avoid_rx_sen_degradation && index) { | 576 | if (tphy->pdata->avoid_rx_sen_degradation && index) { |
577 | tmp = readl(com + U3D_U2PHYDCR0); | 577 | tmp = readl(com + U3D_U2PHYDCR0); |
578 | tmp &= ~P2C_RG_SIF_U2PLL_FORCE_ON; | 578 | tmp &= ~P2C_RG_SIF_U2PLL_FORCE_ON; |
579 | writel(tmp, com + U3D_U2PHYDCR0); | 579 | writel(tmp, com + U3D_U2PHYDCR0); |
@@ -584,13 +584,13 @@ static void u2_phy_instance_exit(struct mt65xx_u3phy *u3phy, | |||
584 | } | 584 | } |
585 | } | 585 | } |
586 | 586 | ||
587 | static void pcie_phy_instance_init(struct mt65xx_u3phy *u3phy, | 587 | static void pcie_phy_instance_init(struct mtk_tphy *tphy, |
588 | struct mt65xx_phy_instance *instance) | 588 | struct mtk_phy_instance *instance) |
589 | { | 589 | { |
590 | struct u3phy_banks *u3_banks = &instance->u3_banks; | 590 | struct u3phy_banks *u3_banks = &instance->u3_banks; |
591 | u32 tmp; | 591 | u32 tmp; |
592 | 592 | ||
593 | if (u3phy->pdata->version != MT_PHY_V1) | 593 | if (tphy->pdata->version != MTK_PHY_V1) |
594 | return; | 594 | return; |
595 | 595 | ||
596 | tmp = readl(u3_banks->phya + U3P_U3_PHYA_DA_REG0); | 596 | tmp = readl(u3_banks->phya + U3P_U3_PHYA_DA_REG0); |
@@ -654,11 +654,11 @@ static void pcie_phy_instance_init(struct mt65xx_u3phy *u3phy, | |||
654 | 654 | ||
655 | /* wait for PCIe subsys register to active */ | 655 | /* wait for PCIe subsys register to active */ |
656 | usleep_range(2500, 3000); | 656 | usleep_range(2500, 3000); |
657 | dev_dbg(u3phy->dev, "%s(%d)\n", __func__, instance->index); | 657 | dev_dbg(tphy->dev, "%s(%d)\n", __func__, instance->index); |
658 | } | 658 | } |
659 | 659 | ||
660 | static void pcie_phy_instance_power_on(struct mt65xx_u3phy *u3phy, | 660 | static void pcie_phy_instance_power_on(struct mtk_tphy *tphy, |
661 | struct mt65xx_phy_instance *instance) | 661 | struct mtk_phy_instance *instance) |
662 | { | 662 | { |
663 | struct u3phy_banks *bank = &instance->u3_banks; | 663 | struct u3phy_banks *bank = &instance->u3_banks; |
664 | u32 tmp; | 664 | u32 tmp; |
@@ -673,8 +673,8 @@ static void pcie_phy_instance_power_on(struct mt65xx_u3phy *u3phy, | |||
673 | writel(tmp, bank->chip + U3P_U3_CHIP_GPIO_CTLE); | 673 | writel(tmp, bank->chip + U3P_U3_CHIP_GPIO_CTLE); |
674 | } | 674 | } |
675 | 675 | ||
676 | static void pcie_phy_instance_power_off(struct mt65xx_u3phy *u3phy, | 676 | static void pcie_phy_instance_power_off(struct mtk_tphy *tphy, |
677 | struct mt65xx_phy_instance *instance) | 677 | struct mtk_phy_instance *instance) |
678 | 678 | ||
679 | { | 679 | { |
680 | struct u3phy_banks *bank = &instance->u3_banks; | 680 | struct u3phy_banks *bank = &instance->u3_banks; |
@@ -689,8 +689,8 @@ static void pcie_phy_instance_power_off(struct mt65xx_u3phy *u3phy, | |||
689 | writel(tmp, bank->chip + U3P_U3_CHIP_GPIO_CTLE); | 689 | writel(tmp, bank->chip + U3P_U3_CHIP_GPIO_CTLE); |
690 | } | 690 | } |
691 | 691 | ||
692 | static void sata_phy_instance_init(struct mt65xx_u3phy *u3phy, | 692 | static void sata_phy_instance_init(struct mtk_tphy *tphy, |
693 | struct mt65xx_phy_instance *instance) | 693 | struct mtk_phy_instance *instance) |
694 | { | 694 | { |
695 | struct u3phy_banks *u3_banks = &instance->u3_banks; | 695 | struct u3phy_banks *u3_banks = &instance->u3_banks; |
696 | void __iomem *phyd = u3_banks->phyd; | 696 | void __iomem *phyd = u3_banks->phyd; |
@@ -744,11 +744,11 @@ static void sata_phy_instance_init(struct mt65xx_u3phy *u3phy, | |||
744 | tmp |= RG_EQ_DLEQ_LFI_GEN1_VAL(0x03); | 744 | tmp |= RG_EQ_DLEQ_LFI_GEN1_VAL(0x03); |
745 | writel(tmp, phyd + ANA_EQ_EYE_CTRL_SIGNAL1); | 745 | writel(tmp, phyd + ANA_EQ_EYE_CTRL_SIGNAL1); |
746 | 746 | ||
747 | dev_dbg(u3phy->dev, "%s(%d)\n", __func__, instance->index); | 747 | dev_dbg(tphy->dev, "%s(%d)\n", __func__, instance->index); |
748 | } | 748 | } |
749 | 749 | ||
750 | static void phy_v1_banks_init(struct mt65xx_u3phy *u3phy, | 750 | static void phy_v1_banks_init(struct mtk_tphy *tphy, |
751 | struct mt65xx_phy_instance *instance) | 751 | struct mtk_phy_instance *instance) |
752 | { | 752 | { |
753 | struct u2phy_banks *u2_banks = &instance->u2_banks; | 753 | struct u2phy_banks *u2_banks = &instance->u2_banks; |
754 | struct u3phy_banks *u3_banks = &instance->u3_banks; | 754 | struct u3phy_banks *u3_banks = &instance->u3_banks; |
@@ -756,12 +756,12 @@ static void phy_v1_banks_init(struct mt65xx_u3phy *u3phy, | |||
756 | switch (instance->type) { | 756 | switch (instance->type) { |
757 | case PHY_TYPE_USB2: | 757 | case PHY_TYPE_USB2: |
758 | u2_banks->misc = NULL; | 758 | u2_banks->misc = NULL; |
759 | u2_banks->fmreg = u3phy->sif_base + SSUSB_SIFSLV_V1_U2FREQ; | 759 | u2_banks->fmreg = tphy->sif_base + SSUSB_SIFSLV_V1_U2FREQ; |
760 | u2_banks->com = instance->port_base + SSUSB_SIFSLV_V1_U2PHY_COM; | 760 | u2_banks->com = instance->port_base + SSUSB_SIFSLV_V1_U2PHY_COM; |
761 | break; | 761 | break; |
762 | case PHY_TYPE_USB3: | 762 | case PHY_TYPE_USB3: |
763 | case PHY_TYPE_PCIE: | 763 | case PHY_TYPE_PCIE: |
764 | u3_banks->spllc = u3phy->sif_base + SSUSB_SIFSLV_V1_SPLLC; | 764 | u3_banks->spllc = tphy->sif_base + SSUSB_SIFSLV_V1_SPLLC; |
765 | u3_banks->chip = NULL; | 765 | u3_banks->chip = NULL; |
766 | u3_banks->phyd = instance->port_base + SSUSB_SIFSLV_V1_U3PHYD; | 766 | u3_banks->phyd = instance->port_base + SSUSB_SIFSLV_V1_U3PHYD; |
767 | u3_banks->phya = instance->port_base + SSUSB_SIFSLV_V1_U3PHYA; | 767 | u3_banks->phya = instance->port_base + SSUSB_SIFSLV_V1_U3PHYA; |
@@ -770,13 +770,13 @@ static void phy_v1_banks_init(struct mt65xx_u3phy *u3phy, | |||
770 | u3_banks->phyd = instance->port_base + SSUSB_SIFSLV_V1_U3PHYD; | 770 | u3_banks->phyd = instance->port_base + SSUSB_SIFSLV_V1_U3PHYD; |
771 | break; | 771 | break; |
772 | default: | 772 | default: |
773 | dev_err(u3phy->dev, "incompatible PHY type\n"); | 773 | dev_err(tphy->dev, "incompatible PHY type\n"); |
774 | return; | 774 | return; |
775 | } | 775 | } |
776 | } | 776 | } |
777 | 777 | ||
778 | static void phy_v2_banks_init(struct mt65xx_u3phy *u3phy, | 778 | static void phy_v2_banks_init(struct mtk_tphy *tphy, |
779 | struct mt65xx_phy_instance *instance) | 779 | struct mtk_phy_instance *instance) |
780 | { | 780 | { |
781 | struct u2phy_banks *u2_banks = &instance->u2_banks; | 781 | struct u2phy_banks *u2_banks = &instance->u2_banks; |
782 | struct u3phy_banks *u3_banks = &instance->u3_banks; | 782 | struct u3phy_banks *u3_banks = &instance->u3_banks; |
@@ -795,96 +795,96 @@ static void phy_v2_banks_init(struct mt65xx_u3phy *u3phy, | |||
795 | u3_banks->phya = instance->port_base + SSUSB_SIFSLV_V2_U3PHYA; | 795 | u3_banks->phya = instance->port_base + SSUSB_SIFSLV_V2_U3PHYA; |
796 | break; | 796 | break; |
797 | default: | 797 | default: |
798 | dev_err(u3phy->dev, "incompatible PHY type\n"); | 798 | dev_err(tphy->dev, "incompatible PHY type\n"); |
799 | return; | 799 | return; |
800 | } | 800 | } |
801 | } | 801 | } |
802 | 802 | ||
803 | static int mt65xx_phy_init(struct phy *phy) | 803 | static int mtk_phy_init(struct phy *phy) |
804 | { | 804 | { |
805 | struct mt65xx_phy_instance *instance = phy_get_drvdata(phy); | 805 | struct mtk_phy_instance *instance = phy_get_drvdata(phy); |
806 | struct mt65xx_u3phy *u3phy = dev_get_drvdata(phy->dev.parent); | 806 | struct mtk_tphy *tphy = dev_get_drvdata(phy->dev.parent); |
807 | int ret; | 807 | int ret; |
808 | 808 | ||
809 | ret = clk_prepare_enable(u3phy->u3phya_ref); | 809 | ret = clk_prepare_enable(tphy->u3phya_ref); |
810 | if (ret) { | 810 | if (ret) { |
811 | dev_err(u3phy->dev, "failed to enable u3phya_ref\n"); | 811 | dev_err(tphy->dev, "failed to enable u3phya_ref\n"); |
812 | return ret; | 812 | return ret; |
813 | } | 813 | } |
814 | 814 | ||
815 | ret = clk_prepare_enable(instance->ref_clk); | 815 | ret = clk_prepare_enable(instance->ref_clk); |
816 | if (ret) { | 816 | if (ret) { |
817 | dev_err(u3phy->dev, "failed to enable ref_clk\n"); | 817 | dev_err(tphy->dev, "failed to enable ref_clk\n"); |
818 | return ret; | 818 | return ret; |
819 | } | 819 | } |
820 | 820 | ||
821 | switch (instance->type) { | 821 | switch (instance->type) { |
822 | case PHY_TYPE_USB2: | 822 | case PHY_TYPE_USB2: |
823 | u2_phy_instance_init(u3phy, instance); | 823 | u2_phy_instance_init(tphy, instance); |
824 | break; | 824 | break; |
825 | case PHY_TYPE_USB3: | 825 | case PHY_TYPE_USB3: |
826 | u3_phy_instance_init(u3phy, instance); | 826 | u3_phy_instance_init(tphy, instance); |
827 | break; | 827 | break; |
828 | case PHY_TYPE_PCIE: | 828 | case PHY_TYPE_PCIE: |
829 | pcie_phy_instance_init(u3phy, instance); | 829 | pcie_phy_instance_init(tphy, instance); |
830 | break; | 830 | break; |
831 | case PHY_TYPE_SATA: | 831 | case PHY_TYPE_SATA: |
832 | sata_phy_instance_init(u3phy, instance); | 832 | sata_phy_instance_init(tphy, instance); |
833 | break; | 833 | break; |
834 | default: | 834 | default: |
835 | dev_err(u3phy->dev, "incompatible PHY type\n"); | 835 | dev_err(tphy->dev, "incompatible PHY type\n"); |
836 | return -EINVAL; | 836 | return -EINVAL; |
837 | } | 837 | } |
838 | 838 | ||
839 | return 0; | 839 | return 0; |
840 | } | 840 | } |
841 | 841 | ||
842 | static int mt65xx_phy_power_on(struct phy *phy) | 842 | static int mtk_phy_power_on(struct phy *phy) |
843 | { | 843 | { |
844 | struct mt65xx_phy_instance *instance = phy_get_drvdata(phy); | 844 | struct mtk_phy_instance *instance = phy_get_drvdata(phy); |
845 | struct mt65xx_u3phy *u3phy = dev_get_drvdata(phy->dev.parent); | 845 | struct mtk_tphy *tphy = dev_get_drvdata(phy->dev.parent); |
846 | 846 | ||
847 | if (instance->type == PHY_TYPE_USB2) { | 847 | if (instance->type == PHY_TYPE_USB2) { |
848 | u2_phy_instance_power_on(u3phy, instance); | 848 | u2_phy_instance_power_on(tphy, instance); |
849 | hs_slew_rate_calibrate(u3phy, instance); | 849 | hs_slew_rate_calibrate(tphy, instance); |
850 | } else if (instance->type == PHY_TYPE_PCIE) { | 850 | } else if (instance->type == PHY_TYPE_PCIE) { |
851 | pcie_phy_instance_power_on(u3phy, instance); | 851 | pcie_phy_instance_power_on(tphy, instance); |
852 | } | 852 | } |
853 | 853 | ||
854 | return 0; | 854 | return 0; |
855 | } | 855 | } |
856 | 856 | ||
857 | static int mt65xx_phy_power_off(struct phy *phy) | 857 | static int mtk_phy_power_off(struct phy *phy) |
858 | { | 858 | { |
859 | struct mt65xx_phy_instance *instance = phy_get_drvdata(phy); | 859 | struct mtk_phy_instance *instance = phy_get_drvdata(phy); |
860 | struct mt65xx_u3phy *u3phy = dev_get_drvdata(phy->dev.parent); | 860 | struct mtk_tphy *tphy = dev_get_drvdata(phy->dev.parent); |
861 | 861 | ||
862 | if (instance->type == PHY_TYPE_USB2) | 862 | if (instance->type == PHY_TYPE_USB2) |
863 | u2_phy_instance_power_off(u3phy, instance); | 863 | u2_phy_instance_power_off(tphy, instance); |
864 | else if (instance->type == PHY_TYPE_PCIE) | 864 | else if (instance->type == PHY_TYPE_PCIE) |
865 | pcie_phy_instance_power_off(u3phy, instance); | 865 | pcie_phy_instance_power_off(tphy, instance); |
866 | 866 | ||
867 | return 0; | 867 | return 0; |
868 | } | 868 | } |
869 | 869 | ||
870 | static int mt65xx_phy_exit(struct phy *phy) | 870 | static int mtk_phy_exit(struct phy *phy) |
871 | { | 871 | { |
872 | struct mt65xx_phy_instance *instance = phy_get_drvdata(phy); | 872 | struct mtk_phy_instance *instance = phy_get_drvdata(phy); |
873 | struct mt65xx_u3phy *u3phy = dev_get_drvdata(phy->dev.parent); | 873 | struct mtk_tphy *tphy = dev_get_drvdata(phy->dev.parent); |
874 | 874 | ||
875 | if (instance->type == PHY_TYPE_USB2) | 875 | if (instance->type == PHY_TYPE_USB2) |
876 | u2_phy_instance_exit(u3phy, instance); | 876 | u2_phy_instance_exit(tphy, instance); |
877 | 877 | ||
878 | clk_disable_unprepare(instance->ref_clk); | 878 | clk_disable_unprepare(instance->ref_clk); |
879 | clk_disable_unprepare(u3phy->u3phya_ref); | 879 | clk_disable_unprepare(tphy->u3phya_ref); |
880 | return 0; | 880 | return 0; |
881 | } | 881 | } |
882 | 882 | ||
883 | static struct phy *mt65xx_phy_xlate(struct device *dev, | 883 | static struct phy *mtk_phy_xlate(struct device *dev, |
884 | struct of_phandle_args *args) | 884 | struct of_phandle_args *args) |
885 | { | 885 | { |
886 | struct mt65xx_u3phy *u3phy = dev_get_drvdata(dev); | 886 | struct mtk_tphy *tphy = dev_get_drvdata(dev); |
887 | struct mt65xx_phy_instance *instance = NULL; | 887 | struct mtk_phy_instance *instance = NULL; |
888 | struct device_node *phy_np = args->np; | 888 | struct device_node *phy_np = args->np; |
889 | int index; | 889 | int index; |
890 | 890 | ||
@@ -893,9 +893,9 @@ static struct phy *mt65xx_phy_xlate(struct device *dev, | |||
893 | return ERR_PTR(-EINVAL); | 893 | return ERR_PTR(-EINVAL); |
894 | } | 894 | } |
895 | 895 | ||
896 | for (index = 0; index < u3phy->nphys; index++) | 896 | for (index = 0; index < tphy->nphys; index++) |
897 | if (phy_np == u3phy->phys[index]->phy->dev.of_node) { | 897 | if (phy_np == tphy->phys[index]->phy->dev.of_node) { |
898 | instance = u3phy->phys[index]; | 898 | instance = tphy->phys[index]; |
899 | break; | 899 | break; |
900 | } | 900 | } |
901 | 901 | ||
@@ -913,10 +913,10 @@ static struct phy *mt65xx_phy_xlate(struct device *dev, | |||
913 | return ERR_PTR(-EINVAL); | 913 | return ERR_PTR(-EINVAL); |
914 | } | 914 | } |
915 | 915 | ||
916 | if (u3phy->pdata->version == MT_PHY_V1) { | 916 | if (tphy->pdata->version == MTK_PHY_V1) { |
917 | phy_v1_banks_init(u3phy, instance); | 917 | phy_v1_banks_init(tphy, instance); |
918 | } else if (u3phy->pdata->version == MT_PHY_V2) { | 918 | } else if (tphy->pdata->version == MTK_PHY_V2) { |
919 | phy_v2_banks_init(u3phy, instance); | 919 | phy_v2_banks_init(tphy, instance); |
920 | } else { | 920 | } else { |
921 | dev_err(dev, "phy version is not supported\n"); | 921 | dev_err(dev, "phy version is not supported\n"); |
922 | return ERR_PTR(-EINVAL); | 922 | return ERR_PTR(-EINVAL); |
@@ -925,30 +925,30 @@ static struct phy *mt65xx_phy_xlate(struct device *dev, | |||
925 | return instance->phy; | 925 | return instance->phy; |
926 | } | 926 | } |
927 | 927 | ||
928 | static const struct phy_ops mt65xx_u3phy_ops = { | 928 | static const struct phy_ops mtk_tphy_ops = { |
929 | .init = mt65xx_phy_init, | 929 | .init = mtk_phy_init, |
930 | .exit = mt65xx_phy_exit, | 930 | .exit = mtk_phy_exit, |
931 | .power_on = mt65xx_phy_power_on, | 931 | .power_on = mtk_phy_power_on, |
932 | .power_off = mt65xx_phy_power_off, | 932 | .power_off = mtk_phy_power_off, |
933 | .owner = THIS_MODULE, | 933 | .owner = THIS_MODULE, |
934 | }; | 934 | }; |
935 | 935 | ||
936 | static const struct mt65xx_phy_pdata tphy_v1_pdata = { | 936 | static const struct mtk_phy_pdata tphy_v1_pdata = { |
937 | .avoid_rx_sen_degradation = false, | 937 | .avoid_rx_sen_degradation = false, |
938 | .version = MT_PHY_V1, | 938 | .version = MTK_PHY_V1, |
939 | }; | 939 | }; |
940 | 940 | ||
941 | static const struct mt65xx_phy_pdata tphy_v2_pdata = { | 941 | static const struct mtk_phy_pdata tphy_v2_pdata = { |
942 | .avoid_rx_sen_degradation = false, | 942 | .avoid_rx_sen_degradation = false, |
943 | .version = MT_PHY_V2, | 943 | .version = MTK_PHY_V2, |
944 | }; | 944 | }; |
945 | 945 | ||
946 | static const struct mt65xx_phy_pdata mt8173_pdata = { | 946 | static const struct mtk_phy_pdata mt8173_pdata = { |
947 | .avoid_rx_sen_degradation = true, | 947 | .avoid_rx_sen_degradation = true, |
948 | .version = MT_PHY_V1, | 948 | .version = MTK_PHY_V1, |
949 | }; | 949 | }; |
950 | 950 | ||
951 | static const struct of_device_id mt65xx_u3phy_id_table[] = { | 951 | static const struct of_device_id mtk_tphy_id_table[] = { |
952 | { .compatible = "mediatek,mt2701-u3phy", .data = &tphy_v1_pdata }, | 952 | { .compatible = "mediatek,mt2701-u3phy", .data = &tphy_v1_pdata }, |
953 | { .compatible = "mediatek,mt2712-u3phy", .data = &tphy_v2_pdata }, | 953 | { .compatible = "mediatek,mt2712-u3phy", .data = &tphy_v2_pdata }, |
954 | { .compatible = "mediatek,mt8173-u3phy", .data = &mt8173_pdata }, | 954 | { .compatible = "mediatek,mt8173-u3phy", .data = &mt8173_pdata }, |
@@ -956,9 +956,9 @@ static const struct of_device_id mt65xx_u3phy_id_table[] = { | |||
956 | { .compatible = "mediatek,generic-tphy-v2", .data = &tphy_v2_pdata }, | 956 | { .compatible = "mediatek,generic-tphy-v2", .data = &tphy_v2_pdata }, |
957 | { }, | 957 | { }, |
958 | }; | 958 | }; |
959 | MODULE_DEVICE_TABLE(of, mt65xx_u3phy_id_table); | 959 | MODULE_DEVICE_TABLE(of, mtk_tphy_id_table); |
960 | 960 | ||
961 | static int mt65xx_u3phy_probe(struct platform_device *pdev) | 961 | static int mtk_tphy_probe(struct platform_device *pdev) |
962 | { | 962 | { |
963 | const struct of_device_id *match; | 963 | const struct of_device_id *match; |
964 | struct device *dev = &pdev->dev; | 964 | struct device *dev = &pdev->dev; |
@@ -966,50 +966,50 @@ static int mt65xx_u3phy_probe(struct platform_device *pdev) | |||
966 | struct device_node *child_np; | 966 | struct device_node *child_np; |
967 | struct phy_provider *provider; | 967 | struct phy_provider *provider; |
968 | struct resource *sif_res; | 968 | struct resource *sif_res; |
969 | struct mt65xx_u3phy *u3phy; | 969 | struct mtk_tphy *tphy; |
970 | struct resource res; | 970 | struct resource res; |
971 | int port, retval; | 971 | int port, retval; |
972 | 972 | ||
973 | match = of_match_node(mt65xx_u3phy_id_table, pdev->dev.of_node); | 973 | match = of_match_node(mtk_tphy_id_table, pdev->dev.of_node); |
974 | if (!match) | 974 | if (!match) |
975 | return -EINVAL; | 975 | return -EINVAL; |
976 | 976 | ||
977 | u3phy = devm_kzalloc(dev, sizeof(*u3phy), GFP_KERNEL); | 977 | tphy = devm_kzalloc(dev, sizeof(*tphy), GFP_KERNEL); |
978 | if (!u3phy) | 978 | if (!tphy) |
979 | return -ENOMEM; | 979 | return -ENOMEM; |
980 | 980 | ||
981 | u3phy->pdata = match->data; | 981 | tphy->pdata = match->data; |
982 | u3phy->nphys = of_get_child_count(np); | 982 | tphy->nphys = of_get_child_count(np); |
983 | u3phy->phys = devm_kcalloc(dev, u3phy->nphys, | 983 | tphy->phys = devm_kcalloc(dev, tphy->nphys, |
984 | sizeof(*u3phy->phys), GFP_KERNEL); | 984 | sizeof(*tphy->phys), GFP_KERNEL); |
985 | if (!u3phy->phys) | 985 | if (!tphy->phys) |
986 | return -ENOMEM; | 986 | return -ENOMEM; |
987 | 987 | ||
988 | u3phy->dev = dev; | 988 | tphy->dev = dev; |
989 | platform_set_drvdata(pdev, u3phy); | 989 | platform_set_drvdata(pdev, tphy); |
990 | 990 | ||
991 | if (u3phy->pdata->version == MT_PHY_V1) { | 991 | if (tphy->pdata->version == MTK_PHY_V1) { |
992 | /* get banks shared by multiple phys */ | 992 | /* get banks shared by multiple phys */ |
993 | sif_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 993 | sif_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
994 | u3phy->sif_base = devm_ioremap_resource(dev, sif_res); | 994 | tphy->sif_base = devm_ioremap_resource(dev, sif_res); |
995 | if (IS_ERR(u3phy->sif_base)) { | 995 | if (IS_ERR(tphy->sif_base)) { |
996 | dev_err(dev, "failed to remap sif regs\n"); | 996 | dev_err(dev, "failed to remap sif regs\n"); |
997 | return PTR_ERR(u3phy->sif_base); | 997 | return PTR_ERR(tphy->sif_base); |
998 | } | 998 | } |
999 | } | 999 | } |
1000 | 1000 | ||
1001 | /* it's deprecated, make it optional for backward compatibility */ | 1001 | /* it's deprecated, make it optional for backward compatibility */ |
1002 | u3phy->u3phya_ref = devm_clk_get(dev, "u3phya_ref"); | 1002 | tphy->u3phya_ref = devm_clk_get(dev, "u3phya_ref"); |
1003 | if (IS_ERR(u3phy->u3phya_ref)) { | 1003 | if (IS_ERR(tphy->u3phya_ref)) { |
1004 | if (PTR_ERR(u3phy->u3phya_ref) == -EPROBE_DEFER) | 1004 | if (PTR_ERR(tphy->u3phya_ref) == -EPROBE_DEFER) |
1005 | return -EPROBE_DEFER; | 1005 | return -EPROBE_DEFER; |
1006 | 1006 | ||
1007 | u3phy->u3phya_ref = NULL; | 1007 | tphy->u3phya_ref = NULL; |
1008 | } | 1008 | } |
1009 | 1009 | ||
1010 | port = 0; | 1010 | port = 0; |
1011 | for_each_child_of_node(np, child_np) { | 1011 | for_each_child_of_node(np, child_np) { |
1012 | struct mt65xx_phy_instance *instance; | 1012 | struct mtk_phy_instance *instance; |
1013 | struct phy *phy; | 1013 | struct phy *phy; |
1014 | 1014 | ||
1015 | instance = devm_kzalloc(dev, sizeof(*instance), GFP_KERNEL); | 1015 | instance = devm_kzalloc(dev, sizeof(*instance), GFP_KERNEL); |
@@ -1018,9 +1018,9 @@ static int mt65xx_u3phy_probe(struct platform_device *pdev) | |||
1018 | goto put_child; | 1018 | goto put_child; |
1019 | } | 1019 | } |
1020 | 1020 | ||
1021 | u3phy->phys[port] = instance; | 1021 | tphy->phys[port] = instance; |
1022 | 1022 | ||
1023 | phy = devm_phy_create(dev, child_np, &mt65xx_u3phy_ops); | 1023 | phy = devm_phy_create(dev, child_np, &mtk_tphy_ops); |
1024 | if (IS_ERR(phy)) { | 1024 | if (IS_ERR(phy)) { |
1025 | dev_err(dev, "failed to create phy\n"); | 1025 | dev_err(dev, "failed to create phy\n"); |
1026 | retval = PTR_ERR(phy); | 1026 | retval = PTR_ERR(phy); |
@@ -1047,7 +1047,7 @@ static int mt65xx_u3phy_probe(struct platform_device *pdev) | |||
1047 | port++; | 1047 | port++; |
1048 | 1048 | ||
1049 | /* if deprecated clock is provided, ignore instance's one */ | 1049 | /* if deprecated clock is provided, ignore instance's one */ |
1050 | if (u3phy->u3phya_ref) | 1050 | if (tphy->u3phya_ref) |
1051 | continue; | 1051 | continue; |
1052 | 1052 | ||
1053 | instance->ref_clk = devm_clk_get(&phy->dev, "ref"); | 1053 | instance->ref_clk = devm_clk_get(&phy->dev, "ref"); |
@@ -1058,7 +1058,7 @@ static int mt65xx_u3phy_probe(struct platform_device *pdev) | |||
1058 | } | 1058 | } |
1059 | } | 1059 | } |
1060 | 1060 | ||
1061 | provider = devm_of_phy_provider_register(dev, mt65xx_phy_xlate); | 1061 | provider = devm_of_phy_provider_register(dev, mtk_phy_xlate); |
1062 | 1062 | ||
1063 | return PTR_ERR_OR_ZERO(provider); | 1063 | return PTR_ERR_OR_ZERO(provider); |
1064 | put_child: | 1064 | put_child: |
@@ -1066,16 +1066,16 @@ put_child: | |||
1066 | return retval; | 1066 | return retval; |
1067 | } | 1067 | } |
1068 | 1068 | ||
1069 | static struct platform_driver mt65xx_u3phy_driver = { | 1069 | static struct platform_driver mtk_tphy_driver = { |
1070 | .probe = mt65xx_u3phy_probe, | 1070 | .probe = mtk_tphy_probe, |
1071 | .driver = { | 1071 | .driver = { |
1072 | .name = "mt65xx-u3phy", | 1072 | .name = "mtk-tphy", |
1073 | .of_match_table = mt65xx_u3phy_id_table, | 1073 | .of_match_table = mtk_tphy_id_table, |
1074 | }, | 1074 | }, |
1075 | }; | 1075 | }; |
1076 | 1076 | ||
1077 | module_platform_driver(mt65xx_u3phy_driver); | 1077 | module_platform_driver(mtk_tphy_driver); |
1078 | 1078 | ||
1079 | MODULE_AUTHOR("Chunfeng Yun <chunfeng.yun@mediatek.com>"); | 1079 | MODULE_AUTHOR("Chunfeng Yun <chunfeng.yun@mediatek.com>"); |
1080 | MODULE_DESCRIPTION("mt65xx USB PHY driver"); | 1080 | MODULE_DESCRIPTION("MediaTek T-PHY driver"); |
1081 | MODULE_LICENSE("GPL v2"); | 1081 | MODULE_LICENSE("GPL v2"); |