k3-dev.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Texas Instruments K3 Device Platform Data
  4. *
  5. * Copyright (C) 2020 Texas Instruments Incorporated - http://www.ti.com/
  6. */
  7. #ifndef __K3_DEV_H__
  8. #define __K3_DEV_H__
  9. #include <asm/io.h>
  10. #include <linux/types.h>
  11. #include <stdint.h>
  12. #define LPSC_MODULE_EXISTS BIT(0)
  13. #define LPSC_NO_CLOCK_GATING BIT(1)
  14. #define LPSC_DEPENDS BIT(2)
  15. #define LPSC_HAS_RESET_ISO BIT(3)
  16. #define LPSC_HAS_LOCAL_RESET BIT(4)
  17. #define LPSC_NO_MODULE_RESET BIT(5)
  18. #define PSC_PD_EXISTS BIT(0)
  19. #define PSC_PD_ALWAYSON BIT(1)
  20. #define PSC_PD_DEPENDS BIT(2)
  21. #define MDSTAT_STATE_MASK 0x3f
  22. #define MDSTAT_BUSY_MASK 0x30
  23. #define MDSTAT_STATE_SWRSTDISABLE 0x0
  24. #define MDSTAT_STATE_ENABLE 0x3
  25. struct ti_psc {
  26. int id;
  27. void __iomem *base;
  28. };
  29. struct ti_pd;
  30. struct ti_pd {
  31. int id;
  32. int usecount;
  33. struct ti_psc *psc;
  34. struct ti_pd *depend;
  35. };
  36. struct ti_lpsc;
  37. struct ti_lpsc {
  38. int id;
  39. int usecount;
  40. struct ti_psc *psc;
  41. struct ti_pd *pd;
  42. struct ti_lpsc *depend;
  43. };
  44. struct ti_dev {
  45. struct ti_lpsc *lpsc;
  46. int id;
  47. };
  48. /**
  49. * struct ti_k3_pd_platdata - pm domain controller information structure
  50. */
  51. struct ti_k3_pd_platdata {
  52. struct ti_psc *psc;
  53. struct ti_pd *pd;
  54. struct ti_lpsc *lpsc;
  55. struct ti_dev *devs;
  56. int num_psc;
  57. int num_pd;
  58. int num_lpsc;
  59. int num_devs;
  60. };
  61. #define PSC(_id, _base) { .id = _id, .base = (void *)_base, }
  62. #define PSC_PD(_id, _psc, _depend) { .id = _id, .psc = _psc, .depend = _depend }
  63. #define PSC_LPSC(_id, _psc, _pd, _depend) { .id = _id, .psc = _psc, .pd = _pd, .depend = _depend }
  64. #define PSC_DEV(_id, _lpsc) { .id = _id, .lpsc = _lpsc }
  65. extern const struct ti_k3_pd_platdata j721e_pd_platdata;
  66. extern const struct ti_k3_pd_platdata j7200_pd_platdata;
  67. extern const struct ti_k3_pd_platdata j721s2_pd_platdata;
  68. u8 ti_pd_state(struct ti_pd *pd);
  69. u8 lpsc_get_state(struct ti_lpsc *lpsc);
  70. int ti_lpsc_transition(struct ti_lpsc *lpsc, u8 state);
  71. #endif