phy-samsung-usb2.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Samsung SoC USB 1.1/2.0 PHY driver
  3. *
  4. * Copyright (C) 2013 Samsung Electronics Co., Ltd.
  5. * Author: Kamil Debski <k.debski@samsung.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #ifndef _PHY_EXYNOS_USB2_H
  12. #define _PHY_EXYNOS_USB2_H
  13. #include <linux/clk.h>
  14. #include <linux/phy/phy.h>
  15. #include <linux/device.h>
  16. #include <linux/regmap.h>
  17. #include <linux/spinlock.h>
  18. #include <linux/regulator/consumer.h>
  19. #define KHZ 1000
  20. #define MHZ (KHZ * KHZ)
  21. struct samsung_usb2_phy_driver;
  22. struct samsung_usb2_phy_instance;
  23. struct samsung_usb2_phy_config;
  24. struct samsung_usb2_phy_instance {
  25. const struct samsung_usb2_common_phy *cfg;
  26. struct phy *phy;
  27. struct samsung_usb2_phy_driver *drv;
  28. int int_cnt;
  29. int ext_cnt;
  30. };
  31. struct samsung_usb2_phy_driver {
  32. const struct samsung_usb2_phy_config *cfg;
  33. struct clk *clk;
  34. struct clk *ref_clk;
  35. struct regulator *vbus;
  36. unsigned long ref_rate;
  37. u32 ref_reg_val;
  38. struct device *dev;
  39. void __iomem *reg_phy;
  40. struct regmap *reg_pmu;
  41. struct regmap *reg_sys;
  42. spinlock_t lock;
  43. struct samsung_usb2_phy_instance instances[0];
  44. };
  45. struct samsung_usb2_common_phy {
  46. int (*power_on)(struct samsung_usb2_phy_instance *);
  47. int (*power_off)(struct samsung_usb2_phy_instance *);
  48. unsigned int id;
  49. char *label;
  50. };
  51. struct samsung_usb2_phy_config {
  52. const struct samsung_usb2_common_phy *phys;
  53. int (*rate_to_clk)(unsigned long, u32 *);
  54. unsigned int num_phys;
  55. bool has_mode_switch;
  56. bool has_refclk_sel;
  57. };
  58. extern const struct samsung_usb2_phy_config exynos3250_usb2_phy_config;
  59. extern const struct samsung_usb2_phy_config exynos4210_usb2_phy_config;
  60. extern const struct samsung_usb2_phy_config exynos4x12_usb2_phy_config;
  61. extern const struct samsung_usb2_phy_config exynos5250_usb2_phy_config;
  62. extern const struct samsung_usb2_phy_config s5pv210_usb2_phy_config;
  63. #endif