Skip to content

Commit 016e0d3

Browse files
mszyprowkishon
authored andcommitted
drivers: phy: exynos-usb2: add support for Exynos 3250
This patch adds support for Exynos3250 SoC to Exynos2USB PHY driver. Although Exynos3250 has only one device phy interface, the register layout and all operations that are required to get it enabled are almost same as on Exynos4x12. The only different is one more register (REFCLKSEL) which need to be set and lack of MODE SWITCH register. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Reviewed-by: Tomasz Figa <t.figa@samsung.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
1 parent e379413 commit 016e0d3

File tree

5 files changed

+31
-8
lines changed

5 files changed

+31
-8
lines changed

Documentation/devicetree/bindings/phy/samsung-phy.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Samsung S5P/EXYNOS SoC series USB PHY
2626

2727
Required properties:
2828
- compatible : should be one of the listed compatibles:
29+
- "samsung,exynos3250-usb2-phy"
2930
- "samsung,exynos4210-usb2-phy"
3031
- "samsung,exynos4x12-usb2-phy"
3132
- "samsung,exynos5250-usb2-phy"
@@ -46,6 +47,7 @@ and Exynos 4212) it is as follows:
4647
1 - USB host ("host"),
4748
2 - HSIC0 ("hsic0"),
4849
3 - HSIC1 ("hsic1"),
50+
Exynos3250 has only USB device phy available as phy 0.
4951

5052
Exynos 4210 and Exynos 4212 use mode switching and require that mode switch
5153
register is supplied.

drivers/phy/Kconfig

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,14 @@ config PHY_EXYNOS4210_USB2
151151
phys are available - device, host, HSIC0 and HSIC1.
152152

153153
config PHY_EXYNOS4X12_USB2
154-
bool "Support for Exynos 4x12"
154+
bool "Support for Exynos 3250/4x12"
155155
depends on PHY_SAMSUNG_USB2
156-
depends on (SOC_EXYNOS4212 || SOC_EXYNOS4412)
156+
depends on (SOC_EXYNOS3250 || SOC_EXYNOS4212 || SOC_EXYNOS4412)
157157
help
158-
Enable USB PHY support for Exynos 4x12. This option requires that
159-
Samsung USB 2.0 PHY driver is enabled and means that support for this
160-
particular SoC is compiled in the driver. In case of Exynos 4x12 four
161-
phys are available - device, host, HSIC0 and HSIC1.
158+
Enable USB PHY support for Exynos 3250/4x12. This option requires
159+
that Samsung USB 2.0 PHY driver is enabled and means that support for
160+
this particular SoC is compiled in the driver. In case of Exynos 4x12
161+
four phys are available - device, host, HSIC0 and HSIC1.
162162

163163
config PHY_EXYNOS5250_USB2
164164
bool "Support for Exynos 5250"

drivers/phy/phy-exynos4x12-usb2.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@
6767
#define EXYNOS_4x12_UPHYCLK_PHYFSEL_24MHZ (0x5 << 0)
6868
#define EXYNOS_4x12_UPHYCLK_PHYFSEL_50MHZ (0x7 << 0)
6969

70+
#define EXYNOS_3250_UPHYCLK_REFCLKSEL (0x2 << 8)
71+
7072
#define EXYNOS_4x12_UPHYCLK_PHY0_ID_PULLUP BIT(3)
7173
#define EXYNOS_4x12_UPHYCLK_PHY0_COMMON_ON BIT(4)
7274
#define EXYNOS_4x12_UPHYCLK_PHY1_COMMON_ON BIT(7)
@@ -197,6 +199,10 @@ static void exynos4x12_setup_clk(struct samsung_usb2_phy_instance *inst)
197199

198200
clk = readl(drv->reg_phy + EXYNOS_4x12_UPHYCLK);
199201
clk &= ~EXYNOS_4x12_UPHYCLK_PHYFSEL_MASK;
202+
203+
if (drv->cfg->has_refclk_sel)
204+
clk = EXYNOS_3250_UPHYCLK_REFCLKSEL;
205+
200206
clk |= drv->ref_reg_val << EXYNOS_4x12_UPHYCLK_PHYFSEL_OFFSET;
201207
clk |= EXYNOS_4x12_UPHYCLK_PHY1_COMMON_ON;
202208
writel(clk, drv->reg_phy + EXYNOS_4x12_UPHYCLK);
@@ -278,7 +284,7 @@ static int exynos4x12_power_on(struct samsung_usb2_phy_instance *inst)
278284
exynos4x12_power_on_int(&drv->instances[EXYNOS4x12_DEVICE]);
279285
}
280286

281-
if (inst->cfg->id == EXYNOS4x12_DEVICE)
287+
if (inst->cfg->id == EXYNOS4x12_DEVICE && drv->cfg->has_mode_switch)
282288
regmap_update_bits(drv->reg_sys, EXYNOS_4x12_MODE_SWITCH_OFFSET,
283289
EXYNOS_4x12_MODE_SWITCH_MASK,
284290
EXYNOS_4x12_MODE_SWITCH_DEVICE);
@@ -310,7 +316,7 @@ static int exynos4x12_power_off(struct samsung_usb2_phy_instance *inst)
310316
if (inst->ext_cnt-- > 1)
311317
return 0;
312318

313-
if (inst->cfg->id == EXYNOS4x12_DEVICE)
319+
if (inst->cfg->id == EXYNOS4x12_DEVICE && drv->cfg->has_mode_switch)
314320
regmap_update_bits(drv->reg_sys, EXYNOS_4x12_MODE_SWITCH_OFFSET,
315321
EXYNOS_4x12_MODE_SWITCH_MASK,
316322
EXYNOS_4x12_MODE_SWITCH_HOST);
@@ -358,6 +364,13 @@ static const struct samsung_usb2_common_phy exynos4x12_phys[] = {
358364
{},
359365
};
360366

367+
const struct samsung_usb2_phy_config exynos3250_usb2_phy_config = {
368+
.has_refclk_sel = 1,
369+
.num_phys = 1,
370+
.phys = exynos4x12_phys,
371+
.rate_to_clk = exynos4x12_rate_to_clk,
372+
};
373+
361374
const struct samsung_usb2_phy_config exynos4x12_usb2_phy_config = {
362375
.has_mode_switch = 1,
363376
.num_phys = EXYNOS4x12_NUM_PHYS,

drivers/phy/phy-samsung-usb2.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ static struct phy *samsung_usb2_phy_xlate(struct device *dev,
8787
}
8888

8989
static const struct of_device_id samsung_usb2_phy_of_match[] = {
90+
#ifdef CONFIG_PHY_EXYNOS4X12_USB2
91+
{
92+
.compatible = "samsung,exynos3250-usb2-phy",
93+
.data = &exynos3250_usb2_phy_config,
94+
},
95+
#endif
9096
#ifdef CONFIG_PHY_EXYNOS4210_USB2
9197
{
9298
.compatible = "samsung,exynos4210-usb2-phy",

drivers/phy/phy-samsung-usb2.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,10 @@ struct samsung_usb2_phy_config {
6060
int (*rate_to_clk)(unsigned long, u32 *);
6161
unsigned int num_phys;
6262
bool has_mode_switch;
63+
bool has_refclk_sel;
6364
};
6465

66+
extern const struct samsung_usb2_phy_config exynos3250_usb2_phy_config;
6567
extern const struct samsung_usb2_phy_config exynos4210_usb2_phy_config;
6668
extern const struct samsung_usb2_phy_config exynos4x12_usb2_phy_config;
6769
extern const struct samsung_usb2_phy_config exynos5250_usb2_phy_config;

0 commit comments

Comments
 (0)