1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
2 | /* |
3 | * UNISOC UFS Host Controller driver |
4 | * |
5 | * Copyright (C) 2022 Unisoc, Inc. |
6 | * Author: Zhe Wang <zhe.wang1@unisoc.com> |
7 | */ |
8 | |
9 | #ifndef _UFS_SPRD_H_ |
10 | #define _UFS_SPRD_H_ |
11 | |
12 | /* Vendor specific attributes */ |
13 | #define RXSQCONTROL 0x8009 |
14 | #define CBRATESEL 0x8114 |
15 | #define CBCREGADDRLSB 0x8116 |
16 | #define CBCREGADDRMSB 0x8117 |
17 | #define CBCREGWRLSB 0x8118 |
18 | #define CBCREGWRMSB 0x8119 |
19 | #define CBCREGRDWRSEL 0x811C |
20 | #define CBCRCTRL 0x811F |
21 | #define CBREFCLKCTRL2 0x8132 |
22 | #define VS_MPHYDISABLE 0xD0C1 |
23 | |
24 | #define APB_UFSDEV_REG 0xCE8 |
25 | #define APB_UFSDEV_REFCLK_EN 0x2 |
26 | #define APB_USB31PLL_CTRL 0xCFC |
27 | #define APB_USB31PLLV_REF2MPHY 0x1 |
28 | |
29 | #define SPRD_SIP_SVC_STORAGE_UFS_CRYPTO_ENABLE \ |
30 | ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \ |
31 | ARM_SMCCC_SMC_32, \ |
32 | ARM_SMCCC_OWNER_SIP, \ |
33 | 0x0301) |
34 | |
35 | enum SPRD_UFS_RST_INDEX { |
36 | SPRD_UFSHCI_SOFT_RST, |
37 | SPRD_UFS_DEV_RST, |
38 | |
39 | SPRD_UFS_RST_MAX |
40 | }; |
41 | |
42 | enum SPRD_UFS_SYSCON_INDEX { |
43 | SPRD_UFS_ANLG, |
44 | SPRD_UFS_AON_APB, |
45 | |
46 | SPRD_UFS_SYSCON_MAX |
47 | }; |
48 | |
49 | enum SPRD_UFS_VREG_INDEX { |
50 | SPRD_UFS_VDD_MPHY, |
51 | |
52 | SPRD_UFS_VREG_MAX |
53 | }; |
54 | |
55 | struct ufs_sprd_rst { |
56 | const char *name; |
57 | struct reset_control *rc; |
58 | }; |
59 | |
60 | struct ufs_sprd_syscon { |
61 | const char *name; |
62 | struct regmap *regmap; |
63 | }; |
64 | |
65 | struct ufs_sprd_vreg { |
66 | const char *name; |
67 | struct regulator *vreg; |
68 | }; |
69 | |
70 | struct ufs_sprd_priv { |
71 | struct ufs_sprd_rst rci[SPRD_UFS_RST_MAX]; |
72 | struct ufs_sprd_syscon sysci[SPRD_UFS_SYSCON_MAX]; |
73 | struct ufs_sprd_vreg vregi[SPRD_UFS_VREG_MAX]; |
74 | const struct ufs_hba_variant_ops ufs_hba_sprd_vops; |
75 | }; |
76 | |
77 | struct ufs_sprd_host { |
78 | struct ufs_hba *hba; |
79 | struct ufs_sprd_priv *priv; |
80 | void __iomem *ufs_dbg_mmio; |
81 | |
82 | enum ufs_unipro_ver unipro_ver; |
83 | }; |
84 | |
85 | #endif /* _UFS_SPRD_H_ */ |
86 | |