Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Marek Szyprowski and committed by
Kishon Vijay Abraham I
016e0d3c e379413a

+31 -8
+2
Documentation/devicetree/bindings/phy/samsung-phy.txt
··· 26 26 27 27 Required properties: 28 28 - compatible : should be one of the listed compatibles: 29 + - "samsung,exynos3250-usb2-phy" 29 30 - "samsung,exynos4210-usb2-phy" 30 31 - "samsung,exynos4x12-usb2-phy" 31 32 - "samsung,exynos5250-usb2-phy" ··· 47 46 1 - USB host ("host"), 48 47 2 - HSIC0 ("hsic0"), 49 48 3 - HSIC1 ("hsic1"), 49 + Exynos3250 has only USB device phy available as phy 0. 50 50 51 51 Exynos 4210 and Exynos 4212 use mode switching and require that mode switch 52 52 register is supplied.
+6 -6
drivers/phy/Kconfig
··· 151 151 phys are available - device, host, HSIC0 and HSIC1. 152 152 153 153 config PHY_EXYNOS4X12_USB2 154 - bool "Support for Exynos 4x12" 154 + bool "Support for Exynos 3250/4x12" 155 155 depends on PHY_SAMSUNG_USB2 156 - depends on (SOC_EXYNOS4212 || SOC_EXYNOS4412) 156 + depends on (SOC_EXYNOS3250 || SOC_EXYNOS4212 || SOC_EXYNOS4412) 157 157 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. 162 162 163 163 config PHY_EXYNOS5250_USB2 164 164 bool "Support for Exynos 5250"
+15 -2
drivers/phy/phy-exynos4x12-usb2.c
··· 67 67 #define EXYNOS_4x12_UPHYCLK_PHYFSEL_24MHZ (0x5 << 0) 68 68 #define EXYNOS_4x12_UPHYCLK_PHYFSEL_50MHZ (0x7 << 0) 69 69 70 + #define EXYNOS_3250_UPHYCLK_REFCLKSEL (0x2 << 8) 71 + 70 72 #define EXYNOS_4x12_UPHYCLK_PHY0_ID_PULLUP BIT(3) 71 73 #define EXYNOS_4x12_UPHYCLK_PHY0_COMMON_ON BIT(4) 72 74 #define EXYNOS_4x12_UPHYCLK_PHY1_COMMON_ON BIT(7) ··· 199 197 200 198 clk = readl(drv->reg_phy + EXYNOS_4x12_UPHYCLK); 201 199 clk &= ~EXYNOS_4x12_UPHYCLK_PHYFSEL_MASK; 200 + 201 + if (drv->cfg->has_refclk_sel) 202 + clk = EXYNOS_3250_UPHYCLK_REFCLKSEL; 203 + 202 204 clk |= drv->ref_reg_val << EXYNOS_4x12_UPHYCLK_PHYFSEL_OFFSET; 203 205 clk |= EXYNOS_4x12_UPHYCLK_PHY1_COMMON_ON; 204 206 writel(clk, drv->reg_phy + EXYNOS_4x12_UPHYCLK); ··· 284 278 exynos4x12_power_on_int(&drv->instances[EXYNOS4x12_DEVICE]); 285 279 } 286 280 287 - if (inst->cfg->id == EXYNOS4x12_DEVICE) 281 + if (inst->cfg->id == EXYNOS4x12_DEVICE && drv->cfg->has_mode_switch) 288 282 regmap_update_bits(drv->reg_sys, EXYNOS_4x12_MODE_SWITCH_OFFSET, 289 283 EXYNOS_4x12_MODE_SWITCH_MASK, 290 284 EXYNOS_4x12_MODE_SWITCH_DEVICE); ··· 316 310 if (inst->ext_cnt-- > 1) 317 311 return 0; 318 312 319 - if (inst->cfg->id == EXYNOS4x12_DEVICE) 313 + if (inst->cfg->id == EXYNOS4x12_DEVICE && drv->cfg->has_mode_switch) 320 314 regmap_update_bits(drv->reg_sys, EXYNOS_4x12_MODE_SWITCH_OFFSET, 321 315 EXYNOS_4x12_MODE_SWITCH_MASK, 322 316 EXYNOS_4x12_MODE_SWITCH_HOST); ··· 362 356 .power_off = exynos4x12_power_off, 363 357 }, 364 358 {}, 359 + }; 360 + 361 + const struct samsung_usb2_phy_config exynos3250_usb2_phy_config = { 362 + .has_refclk_sel = 1, 363 + .num_phys = 1, 364 + .phys = exynos4x12_phys, 365 + .rate_to_clk = exynos4x12_rate_to_clk, 365 366 }; 366 367 367 368 const struct samsung_usb2_phy_config exynos4x12_usb2_phy_config = {
+6
drivers/phy/phy-samsung-usb2.c
··· 87 87 } 88 88 89 89 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 90 96 #ifdef CONFIG_PHY_EXYNOS4210_USB2 91 97 { 92 98 .compatible = "samsung,exynos4210-usb2-phy",
+2
drivers/phy/phy-samsung-usb2.h
··· 60 60 int (*rate_to_clk)(unsigned long, u32 *); 61 61 unsigned int num_phys; 62 62 bool has_mode_switch; 63 + bool has_refclk_sel; 63 64 }; 64 65 66 + extern const struct samsung_usb2_phy_config exynos3250_usb2_phy_config; 65 67 extern const struct samsung_usb2_phy_config exynos4210_usb2_phy_config; 66 68 extern const struct samsung_usb2_phy_config exynos4x12_usb2_phy_config; 67 69 extern const struct samsung_usb2_phy_config exynos5250_usb2_phy_config;