Skip to content

Commit d14c146

Browse files
andredvinodkoul
authored andcommitted
phy: exynos5-usbdrd: set ref clk freq in exynos850_usbdrd_utmi_init()
While commit 255ec38 ("phy: exynos5-usbdrd: Add 26MHz ref clk support") correctly states that CLKRSTCTRL[7:5] doesn't need to be set on modern Exynos platforms, SSPPLLCTL[2:0] should be programmed with the frequency of the reference clock for the USB2.0 phy instead. I stumbled across this while adding support for the Google Tensor gs101, but this should apply to E850 just the same. Do so. Signed-off-by: André Draszik <[email protected]> Reviewed-by: Peter Griffin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 32b2495 commit d14c146

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

drivers/phy/samsung/phy-exynos5-usbdrd.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* Author: Vivek Gautam <[email protected]>
99
*/
1010

11+
#include <linux/bitfield.h>
1112
#include <linux/clk.h>
1213
#include <linux/delay.h>
1314
#include <linux/io.h>
@@ -141,6 +142,9 @@
141142
#define CLKRST_PORT_RST BIT(1)
142143
#define CLKRST_LINK_SW_RST BIT(0)
143144

145+
#define EXYNOS850_DRD_SSPPLLCTL 0x30
146+
#define SSPPLLCTL_FSEL GENMASK(2, 0)
147+
144148
#define EXYNOS850_DRD_UTMI 0x50
145149
#define UTMI_FORCE_VBUSVALID BIT(5)
146150
#define UTMI_FORCE_BVALID BIT(4)
@@ -773,6 +777,31 @@ static void exynos850_usbdrd_utmi_init(struct exynos5_usbdrd_phy *phy_drd)
773777
reg |= HSP_VBUSVLDEXT | HSP_VBUSVLDEXTSEL;
774778
writel(reg, regs_base + EXYNOS850_DRD_HSP);
775779

780+
reg = readl(regs_base + EXYNOS850_DRD_SSPPLLCTL);
781+
reg &= ~SSPPLLCTL_FSEL;
782+
switch (phy_drd->extrefclk) {
783+
case EXYNOS5_FSEL_50MHZ:
784+
reg |= FIELD_PREP_CONST(SSPPLLCTL_FSEL, 7);
785+
break;
786+
case EXYNOS5_FSEL_26MHZ:
787+
reg |= FIELD_PREP_CONST(SSPPLLCTL_FSEL, 6);
788+
break;
789+
case EXYNOS5_FSEL_24MHZ:
790+
reg |= FIELD_PREP_CONST(SSPPLLCTL_FSEL, 2);
791+
break;
792+
case EXYNOS5_FSEL_20MHZ:
793+
reg |= FIELD_PREP_CONST(SSPPLLCTL_FSEL, 1);
794+
break;
795+
case EXYNOS5_FSEL_19MHZ2:
796+
reg |= FIELD_PREP_CONST(SSPPLLCTL_FSEL, 0);
797+
break;
798+
default:
799+
dev_warn(phy_drd->dev, "unsupported ref clk: %#.2x\n",
800+
phy_drd->extrefclk);
801+
break;
802+
}
803+
writel(reg, regs_base + EXYNOS850_DRD_SSPPLLCTL);
804+
776805
/* Power up PHY analog blocks */
777806
reg = readl(regs_base + EXYNOS850_DRD_HSP_TEST);
778807
reg &= ~HSP_TEST_SIDDQ;

0 commit comments

Comments
 (0)