162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Samsung SoC USB 1.1/2.0 PHY driver 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright (C) 2013 Samsung Electronics Co., Ltd. 662306a36Sopenharmony_ci * Author: Kamil Debski <k.debski@samsung.com> 762306a36Sopenharmony_ci */ 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#ifndef _PHY_EXYNOS_USB2_H 1062306a36Sopenharmony_ci#define _PHY_EXYNOS_USB2_H 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci#include <linux/clk.h> 1362306a36Sopenharmony_ci#include <linux/phy/phy.h> 1462306a36Sopenharmony_ci#include <linux/device.h> 1562306a36Sopenharmony_ci#include <linux/regmap.h> 1662306a36Sopenharmony_ci#include <linux/spinlock.h> 1762306a36Sopenharmony_ci#include <linux/regulator/consumer.h> 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ci#define KHZ 1000 2062306a36Sopenharmony_ci#define MHZ (KHZ * KHZ) 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_cistruct samsung_usb2_phy_driver; 2362306a36Sopenharmony_cistruct samsung_usb2_phy_instance; 2462306a36Sopenharmony_cistruct samsung_usb2_phy_config; 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_cistruct samsung_usb2_phy_instance { 2762306a36Sopenharmony_ci const struct samsung_usb2_common_phy *cfg; 2862306a36Sopenharmony_ci struct phy *phy; 2962306a36Sopenharmony_ci struct samsung_usb2_phy_driver *drv; 3062306a36Sopenharmony_ci int int_cnt; 3162306a36Sopenharmony_ci int ext_cnt; 3262306a36Sopenharmony_ci}; 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_cistruct samsung_usb2_phy_driver { 3562306a36Sopenharmony_ci const struct samsung_usb2_phy_config *cfg; 3662306a36Sopenharmony_ci struct clk *clk; 3762306a36Sopenharmony_ci struct clk *ref_clk; 3862306a36Sopenharmony_ci struct regulator *vbus; 3962306a36Sopenharmony_ci unsigned long ref_rate; 4062306a36Sopenharmony_ci u32 ref_reg_val; 4162306a36Sopenharmony_ci struct device *dev; 4262306a36Sopenharmony_ci void __iomem *reg_phy; 4362306a36Sopenharmony_ci struct regmap *reg_pmu; 4462306a36Sopenharmony_ci struct regmap *reg_sys; 4562306a36Sopenharmony_ci spinlock_t lock; 4662306a36Sopenharmony_ci struct samsung_usb2_phy_instance instances[]; 4762306a36Sopenharmony_ci}; 4862306a36Sopenharmony_ci 4962306a36Sopenharmony_cistruct samsung_usb2_common_phy { 5062306a36Sopenharmony_ci int (*power_on)(struct samsung_usb2_phy_instance *); 5162306a36Sopenharmony_ci int (*power_off)(struct samsung_usb2_phy_instance *); 5262306a36Sopenharmony_ci unsigned int id; 5362306a36Sopenharmony_ci char *label; 5462306a36Sopenharmony_ci}; 5562306a36Sopenharmony_ci 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_cistruct samsung_usb2_phy_config { 5862306a36Sopenharmony_ci const struct samsung_usb2_common_phy *phys; 5962306a36Sopenharmony_ci int (*rate_to_clk)(unsigned long, u32 *); 6062306a36Sopenharmony_ci unsigned int num_phys; 6162306a36Sopenharmony_ci bool has_mode_switch; 6262306a36Sopenharmony_ci bool has_refclk_sel; 6362306a36Sopenharmony_ci}; 6462306a36Sopenharmony_ci 6562306a36Sopenharmony_ciextern const struct samsung_usb2_phy_config exynos3250_usb2_phy_config; 6662306a36Sopenharmony_ciextern const struct samsung_usb2_phy_config exynos4210_usb2_phy_config; 6762306a36Sopenharmony_ciextern const struct samsung_usb2_phy_config exynos4x12_usb2_phy_config; 6862306a36Sopenharmony_ciextern const struct samsung_usb2_phy_config exynos5250_usb2_phy_config; 6962306a36Sopenharmony_ciextern const struct samsung_usb2_phy_config exynos5420_usb2_phy_config; 7062306a36Sopenharmony_ciextern const struct samsung_usb2_phy_config s5pv210_usb2_phy_config; 7162306a36Sopenharmony_ci#endif 72