phy-samsung-usb2.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. int int_cnt;
  28. int ext_cnt;
  29. };
  30. struct samsung_usb2_phy_driver {
  31. const struct samsung_usb2_phy_config *cfg;
  32. struct clk *clk;
  33. struct clk *ref_clk;
  34. unsigned long ref_rate;
  35. u32 ref_reg_val;
  36. struct device *dev;
  37. void __iomem *reg_phy;
  38. struct regmap *reg_pmu;
  39. struct regmap *reg_sys;
  40. spinlock_t lock;
  41. struct samsung_usb2_phy_instance instances[0];
  42. };
  43. struct samsung_usb2_common_phy {
  44. int (*power_on)(struct samsung_usb2_phy_instance *);
  45. int (*power_off)(struct samsung_usb2_phy_instance *);
  46. unsigned int id;
  47. char *label;
  48. };
  49. struct samsung_usb2_phy_config {
  50. const struct samsung_usb2_common_phy *phys;
  51. int (*rate_to_clk)(unsigned long, u32 *);
  52. unsigned int num_phys;
  53. bool has_mode_switch;
  54. bool has_refclk_sel;
  55. };
  56. extern const struct samsung_usb2_phy_config exynos3250_usb2_phy_config;
  57. extern const struct samsung_usb2_phy_config exynos4210_usb2_phy_config;
  58. extern const struct samsung_usb2_phy_config exynos4x12_usb2_phy_config;
  59. extern const struct samsung_usb2_phy_config exynos5250_usb2_phy_config;
  60. extern const struct samsung_usb2_phy_config s5pv210_usb2_phy_config;
  61. #endif