phy-samsung-usb2.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. #define KHZ 1000
  19. #define MHZ (KHZ * KHZ)
  20. struct samsung_usb2_phy_driver;
  21. struct samsung_usb2_phy_instance;
  22. struct samsung_usb2_phy_config;
  23. struct samsung_usb2_phy_instance {
  24. const struct samsung_usb2_common_phy *cfg;
  25. struct phy *phy;
  26. struct samsung_usb2_phy_driver *drv;
  27. bool enabled;
  28. };
  29. struct samsung_usb2_phy_driver {
  30. const struct samsung_usb2_phy_config *cfg;
  31. struct clk *clk;
  32. struct clk *ref_clk;
  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[0];
  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. };
  54. extern const struct samsung_usb2_phy_config exynos4210_usb2_phy_config;
  55. extern const struct samsung_usb2_phy_config exynos4x12_usb2_phy_config;
  56. extern const struct samsung_usb2_phy_config exynos5250_usb2_phy_config;
  57. #endif