blob: 072e10ba6321f6dd9ff4c6648f41603a394977ca [file] [log] [blame]
Tero Kristo682c1282021-06-11 11:45:15 +03001/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * Texas Instruments K3 Device Platform Data
4 *
Nishanth Menoneaa39c62023-11-01 15:56:03 -05005 * Copyright (C) 2020 Texas Instruments Incorporated - https://www.ti.com/
Tero Kristo682c1282021-06-11 11:45:15 +03006 */
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
Tero Kristof95d3be2021-06-11 11:45:16 +030025#define MDSTAT_STATE_MASK 0x3f
26#define MDSTAT_BUSY_MASK 0x30
27#define MDSTAT_STATE_SWRSTDISABLE 0x0
28#define MDSTAT_STATE_ENABLE 0x3
29
Tero Kristo682c1282021-06-11 11:45:15 +030030struct ti_psc {
31 int id;
32 void __iomem *base;
33};
34
35struct ti_pd;
36
37struct ti_pd {
38 int id;
39 int usecount;
40 struct ti_psc *psc;
41 struct ti_pd *depend;
42};
43
44struct ti_lpsc;
45
46struct ti_lpsc {
47 int id;
48 int usecount;
49 struct ti_psc *psc;
50 struct ti_pd *pd;
51 struct ti_lpsc *depend;
52};
53
54struct ti_dev {
55 struct ti_lpsc *lpsc;
56 int id;
57};
58
59/**
60 * struct ti_k3_pd_platdata - pm domain controller information structure
61 */
62struct ti_k3_pd_platdata {
63 struct ti_psc *psc;
64 struct ti_pd *pd;
65 struct ti_lpsc *lpsc;
66 struct ti_dev *devs;
67 int num_psc;
68 int num_pd;
69 int num_lpsc;
70 int num_devs;
71};
72
73#define PSC(_id, _base) { .id = _id, .base = (void *)_base, }
74#define PSC_PD(_id, _psc, _depend) { .id = _id, .psc = _psc, .depend = _depend }
75#define PSC_LPSC(_id, _psc, _pd, _depend) { .id = _id, .psc = _psc, .pd = _pd, .depend = _depend }
76#define PSC_DEV(_id, _lpsc) { .id = _id, .lpsc = _lpsc }
77
78extern const struct ti_k3_pd_platdata j721e_pd_platdata;
79extern const struct ti_k3_pd_platdata j7200_pd_platdata;
David Huang7078f352022-01-25 20:56:34 +053080extern const struct ti_k3_pd_platdata j721s2_pd_platdata;
Suman Annaa9768c92022-05-25 13:38:43 +053081extern const struct ti_k3_pd_platdata am62x_pd_platdata;
Bryan Brattlof2d982b72022-11-03 19:13:56 -050082extern const struct ti_k3_pd_platdata am62ax_pd_platdata;
Tero Kristo682c1282021-06-11 11:45:15 +030083
Tero Kristof95d3be2021-06-11 11:45:16 +030084u8 ti_pd_state(struct ti_pd *pd);
85u8 lpsc_get_state(struct ti_lpsc *lpsc);
86int ti_lpsc_transition(struct ti_lpsc *lpsc, u8 state);
87
Tero Kristo682c1282021-06-11 11:45:15 +030088#endif