power: domain: Introduce driver for raw TI K3 PDs
[platform/kernel/u-boot.git] / include / k3-dev.h
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
10 #include <asm/io.h>
11 #include <linux/types.h>
12 #include <stdint.h>
13
14 #define LPSC_MODULE_EXISTS      BIT(0)
15 #define LPSC_NO_CLOCK_GATING    BIT(1)
16 #define LPSC_DEPENDS            BIT(2)
17 #define LPSC_HAS_RESET_ISO      BIT(3)
18 #define LPSC_HAS_LOCAL_RESET    BIT(4)
19 #define LPSC_NO_MODULE_RESET    BIT(5)
20
21 #define PSC_PD_EXISTS           BIT(0)
22 #define PSC_PD_ALWAYSON         BIT(1)
23 #define PSC_PD_DEPENDS          BIT(2)
24
25 struct ti_psc {
26         int id;
27         void __iomem *base;
28 };
29
30 struct ti_pd;
31
32 struct ti_pd {
33         int id;
34         int usecount;
35         struct ti_psc *psc;
36         struct ti_pd *depend;
37 };
38
39 struct ti_lpsc;
40
41 struct ti_lpsc {
42         int id;
43         int usecount;
44         struct ti_psc *psc;
45         struct ti_pd *pd;
46         struct ti_lpsc *depend;
47 };
48
49 struct ti_dev {
50         struct ti_lpsc *lpsc;
51         int id;
52 };
53
54 /**
55  * struct ti_k3_pd_platdata - pm domain controller information structure
56  */
57 struct ti_k3_pd_platdata {
58         struct ti_psc *psc;
59         struct ti_pd *pd;
60         struct ti_lpsc *lpsc;
61         struct ti_dev *devs;
62         int num_psc;
63         int num_pd;
64         int num_lpsc;
65         int num_devs;
66 };
67
68 #define PSC(_id, _base) { .id = _id, .base = (void *)_base, }
69 #define PSC_PD(_id, _psc, _depend) { .id = _id, .psc = _psc, .depend = _depend }
70 #define PSC_LPSC(_id, _psc, _pd, _depend) { .id = _id, .psc = _psc, .pd = _pd, .depend = _depend }
71 #define PSC_DEV(_id, _lpsc) { .id = _id, .lpsc = _lpsc }
72
73 extern const struct ti_k3_pd_platdata j721e_pd_platdata;
74 extern const struct ti_k3_pd_platdata j7200_pd_platdata;
75
76 #endif