phy-samsung-usb2.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Samsung SoC USB 1.1/2.0 PHY driver
  4. *
  5. * Copyright (C) 2013 Samsung Electronics Co., Ltd.
  6. * Author: Kamil Debski <[email protected]>
  7. */
  8. #ifndef _PHY_EXYNOS_USB2_H
  9. #define _PHY_EXYNOS_USB2_H
  10. #include <linux/clk.h>
  11. #include <linux/phy/phy.h>
  12. #include <linux/device.h>
  13. #include <linux/regmap.h>
  14. #include <linux/spinlock.h>
  15. #include <linux/regulator/consumer.h>
  16. #define KHZ 1000
  17. #define MHZ (KHZ * KHZ)
  18. struct samsung_usb2_phy_driver;
  19. struct samsung_usb2_phy_instance;
  20. struct samsung_usb2_phy_config;
  21. struct samsung_usb2_phy_instance {
  22. const struct samsung_usb2_common_phy *cfg;
  23. struct phy *phy;
  24. struct samsung_usb2_phy_driver *drv;
  25. int int_cnt;
  26. int ext_cnt;
  27. };
  28. struct samsung_usb2_phy_driver {
  29. const struct samsung_usb2_phy_config *cfg;
  30. struct clk *clk;
  31. struct clk *ref_clk;
  32. struct regulator *vbus;
  33. unsigned long ref_rate;
  34. u32 ref_reg_val;
  35. struct device *dev;
  36. void __iomem *reg_phy;
  37. struct regmap *reg_pmu;
  38. struct regmap *reg_sys;
  39. spinlock_t lock;
  40. struct samsung_usb2_phy_instance instances[];
  41. };
  42. struct samsung_usb2_common_phy {
  43. int (*power_on)(struct samsung_usb2_phy_instance *);
  44. int (*power_off)(struct samsung_usb2_phy_instance *);
  45. unsigned int id;
  46. char *label;
  47. };
  48. struct samsung_usb2_phy_config {
  49. const struct samsung_usb2_common_phy *phys;
  50. int (*rate_to_clk)(unsigned long, u32 *);
  51. unsigned int num_phys;
  52. bool has_mode_switch;
  53. bool has_refclk_sel;
  54. };
  55. extern const struct samsung_usb2_phy_config exynos3250_usb2_phy_config;
  56. extern const struct samsung_usb2_phy_config exynos4210_usb2_phy_config;
  57. extern const struct samsung_usb2_phy_config exynos4x12_usb2_phy_config;
  58. extern const struct samsung_usb2_phy_config exynos5250_usb2_phy_config;
  59. extern const struct samsung_usb2_phy_config exynos5420_usb2_phy_config;
  60. extern const struct samsung_usb2_phy_config s5pv210_usb2_phy_config;
  61. #endif