Lines Matching +full:pwr +full:- +full:reg

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Samsung SoC USB 1.1/2.0 PHY driver - Exynos 4x12 support
13 #include "phy-samsung-usb2.h"
114 /* Mode switching SUB Device <-> Host */
132 static int exynos4x12_rate_to_clk(unsigned long rate, u32 *reg) in exynos4x12_rate_to_clk() argument
138 *reg = EXYNOS_4x12_UPHYCLK_PHYFSEL_9MHZ6; in exynos4x12_rate_to_clk()
141 *reg = EXYNOS_4x12_UPHYCLK_PHYFSEL_10MHZ; in exynos4x12_rate_to_clk()
144 *reg = EXYNOS_4x12_UPHYCLK_PHYFSEL_12MHZ; in exynos4x12_rate_to_clk()
147 *reg = EXYNOS_4x12_UPHYCLK_PHYFSEL_19MHZ2; in exynos4x12_rate_to_clk()
150 *reg = EXYNOS_4x12_UPHYCLK_PHYFSEL_20MHZ; in exynos4x12_rate_to_clk()
153 *reg = EXYNOS_4x12_UPHYCLK_PHYFSEL_24MHZ; in exynos4x12_rate_to_clk()
156 *reg = EXYNOS_4x12_UPHYCLK_PHYFSEL_50MHZ; in exynos4x12_rate_to_clk()
159 return -EINVAL; in exynos4x12_rate_to_clk()
167 struct samsung_usb2_phy_driver *drv = inst->drv; in exynos4x12_isol()
171 switch (inst->cfg->id) { in exynos4x12_isol()
189 regmap_update_bits(drv->reg_pmu, offset, mask, on ? 0 : mask); in exynos4x12_isol()
194 struct samsung_usb2_phy_driver *drv = inst->drv; in exynos4x12_setup_clk()
197 clk = readl(drv->reg_phy + EXYNOS_4x12_UPHYCLK); in exynos4x12_setup_clk()
200 if (drv->cfg->has_refclk_sel) in exynos4x12_setup_clk()
203 clk |= drv->ref_reg_val << EXYNOS_4x12_UPHYCLK_PHYFSEL_OFFSET; in exynos4x12_setup_clk()
205 writel(clk, drv->reg_phy + EXYNOS_4x12_UPHYCLK); in exynos4x12_setup_clk()
210 struct samsung_usb2_phy_driver *drv = inst->drv; in exynos4x12_phy_pwr()
214 u32 pwr; in exynos4x12_phy_pwr() local
216 switch (inst->cfg->id) { in exynos4x12_phy_pwr()
240 pwr = readl(drv->reg_phy + EXYNOS_4x12_UPHYPWR); in exynos4x12_phy_pwr()
241 pwr &= ~phypwr; in exynos4x12_phy_pwr()
242 writel(pwr, drv->reg_phy + EXYNOS_4x12_UPHYPWR); in exynos4x12_phy_pwr()
244 rst = readl(drv->reg_phy + EXYNOS_4x12_UPHYRST); in exynos4x12_phy_pwr()
246 writel(rst, drv->reg_phy + EXYNOS_4x12_UPHYRST); in exynos4x12_phy_pwr()
249 writel(rst, drv->reg_phy + EXYNOS_4x12_UPHYRST); in exynos4x12_phy_pwr()
254 pwr = readl(drv->reg_phy + EXYNOS_4x12_UPHYPWR); in exynos4x12_phy_pwr()
255 pwr |= phypwr; in exynos4x12_phy_pwr()
256 writel(pwr, drv->reg_phy + EXYNOS_4x12_UPHYPWR); in exynos4x12_phy_pwr()
262 if (inst->int_cnt++ > 0) in exynos4x12_power_on_int()
272 struct samsung_usb2_phy_driver *drv = inst->drv; in exynos4x12_power_on()
274 if (inst->ext_cnt++ > 0) in exynos4x12_power_on()
277 if (inst->cfg->id == EXYNOS4x12_HOST) { in exynos4x12_power_on()
278 regmap_update_bits(drv->reg_sys, EXYNOS_4x12_MODE_SWITCH_OFFSET, in exynos4x12_power_on()
281 exynos4x12_power_on_int(&drv->instances[EXYNOS4x12_DEVICE]); in exynos4x12_power_on()
284 if (inst->cfg->id == EXYNOS4x12_DEVICE && drv->cfg->has_mode_switch) in exynos4x12_power_on()
285 regmap_update_bits(drv->reg_sys, EXYNOS_4x12_MODE_SWITCH_OFFSET, in exynos4x12_power_on()
289 if (inst->cfg->id == EXYNOS4x12_HSIC0 || in exynos4x12_power_on()
290 inst->cfg->id == EXYNOS4x12_HSIC1) { in exynos4x12_power_on()
291 exynos4x12_power_on_int(&drv->instances[EXYNOS4x12_DEVICE]); in exynos4x12_power_on()
292 exynos4x12_power_on_int(&drv->instances[EXYNOS4x12_HOST]); in exynos4x12_power_on()
302 if (inst->int_cnt-- > 1) in exynos4x12_power_off_int()
311 struct samsung_usb2_phy_driver *drv = inst->drv; in exynos4x12_power_off()
313 if (inst->ext_cnt-- > 1) in exynos4x12_power_off()
316 if (inst->cfg->id == EXYNOS4x12_DEVICE && drv->cfg->has_mode_switch) in exynos4x12_power_off()
317 regmap_update_bits(drv->reg_sys, EXYNOS_4x12_MODE_SWITCH_OFFSET, in exynos4x12_power_off()
321 if (inst->cfg->id == EXYNOS4x12_HOST) in exynos4x12_power_off()
322 exynos4x12_power_off_int(&drv->instances[EXYNOS4x12_DEVICE]); in exynos4x12_power_off()
324 if (inst->cfg->id == EXYNOS4x12_HSIC0 || in exynos4x12_power_off()
325 inst->cfg->id == EXYNOS4x12_HSIC1) { in exynos4x12_power_off()
326 exynos4x12_power_off_int(&drv->instances[EXYNOS4x12_DEVICE]); in exynos4x12_power_off()
327 exynos4x12_power_off_int(&drv->instances[EXYNOS4x12_HOST]); in exynos4x12_power_off()