Tero Kristo | 144464b | 2021-06-11 11:45:15 +0300 | [diff] [blame] | 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 | |
Tero Kristo | f79753c | 2021-06-11 11:45:16 +0300 | [diff] [blame] | 25 | #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 Kristo | 144464b | 2021-06-11 11:45:15 +0300 | [diff] [blame] | 30 | struct ti_psc { |
| 31 | int id; |
| 32 | void __iomem *base; |
| 33 | }; |
| 34 | |
| 35 | struct ti_pd; |
| 36 | |
| 37 | struct ti_pd { |
| 38 | int id; |
| 39 | int usecount; |
| 40 | struct ti_psc *psc; |
| 41 | struct ti_pd *depend; |
| 42 | }; |
| 43 | |
| 44 | struct ti_lpsc; |
| 45 | |
| 46 | struct 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 | |
| 54 | struct 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 | */ |
| 62 | struct 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 | |
| 78 | extern const struct ti_k3_pd_platdata j721e_pd_platdata; |
| 79 | extern const struct ti_k3_pd_platdata j7200_pd_platdata; |
David Huang | 98551f8 | 2022-01-25 20:56:34 +0530 | [diff] [blame] | 80 | extern const struct ti_k3_pd_platdata j721s2_pd_platdata; |
Suman Anna | 4b8903a | 2022-05-25 13:38:43 +0530 | [diff] [blame] | 81 | extern const struct ti_k3_pd_platdata am62x_pd_platdata; |
Tero Kristo | 144464b | 2021-06-11 11:45:15 +0300 | [diff] [blame] | 82 | |
Tero Kristo | f79753c | 2021-06-11 11:45:16 +0300 | [diff] [blame] | 83 | u8 ti_pd_state(struct ti_pd *pd); |
| 84 | u8 lpsc_get_state(struct ti_lpsc *lpsc); |
| 85 | int ti_lpsc_transition(struct ti_lpsc *lpsc, u8 state); |
| 86 | |
Tero Kristo | 144464b | 2021-06-11 11:45:15 +0300 | [diff] [blame] | 87 | #endif |