0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef _PHY_EXYNOS_USB2_H
0010 #define _PHY_EXYNOS_USB2_H
0011
0012 #include <linux/clk.h>
0013 #include <linux/phy/phy.h>
0014 #include <linux/device.h>
0015 #include <linux/regmap.h>
0016 #include <linux/spinlock.h>
0017 #include <linux/regulator/consumer.h>
0018
0019 #define KHZ 1000
0020 #define MHZ (KHZ * KHZ)
0021
0022 struct samsung_usb2_phy_driver;
0023 struct samsung_usb2_phy_instance;
0024 struct samsung_usb2_phy_config;
0025
0026 struct samsung_usb2_phy_instance {
0027 const struct samsung_usb2_common_phy *cfg;
0028 struct phy *phy;
0029 struct samsung_usb2_phy_driver *drv;
0030 int int_cnt;
0031 int ext_cnt;
0032 };
0033
0034 struct samsung_usb2_phy_driver {
0035 const struct samsung_usb2_phy_config *cfg;
0036 struct clk *clk;
0037 struct clk *ref_clk;
0038 struct regulator *vbus;
0039 unsigned long ref_rate;
0040 u32 ref_reg_val;
0041 struct device *dev;
0042 void __iomem *reg_phy;
0043 struct regmap *reg_pmu;
0044 struct regmap *reg_sys;
0045 spinlock_t lock;
0046 struct samsung_usb2_phy_instance instances[];
0047 };
0048
0049 struct samsung_usb2_common_phy {
0050 int (*power_on)(struct samsung_usb2_phy_instance *);
0051 int (*power_off)(struct samsung_usb2_phy_instance *);
0052 unsigned int id;
0053 char *label;
0054 };
0055
0056
0057 struct samsung_usb2_phy_config {
0058 const struct samsung_usb2_common_phy *phys;
0059 int (*rate_to_clk)(unsigned long, u32 *);
0060 unsigned int num_phys;
0061 bool has_mode_switch;
0062 bool has_refclk_sel;
0063 };
0064
0065 extern const struct samsung_usb2_phy_config exynos3250_usb2_phy_config;
0066 extern const struct samsung_usb2_phy_config exynos4210_usb2_phy_config;
0067 extern const struct samsung_usb2_phy_config exynos4x12_usb2_phy_config;
0068 extern const struct samsung_usb2_phy_config exynos5250_usb2_phy_config;
0069 extern const struct samsung_usb2_phy_config exynos5420_usb2_phy_config;
0070 extern const struct samsung_usb2_phy_config s5pv210_usb2_phy_config;
0071 #endif