blob: fc1bcca8ccba23751878fa63e343da01e70a8b10 [file] [log] [blame]
Venkatesh Yadav Abbarapudaac30a2024-09-20 09:46:49 +05301/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * UFS Host driver for Synopsys Designware Core
4 *
5 * Copyright (C) 2015-2016 Synopsys, Inc. (www.synopsys.com)
6 *
7 * Authors: Joao Pinto <jpinto@synopsys.com>
8 */
9
10#ifndef _UFSHCD_DWC_H
11#define _UFSHCD_DWC_H
12
Venkatesh Yadav Abbarapufb59d472024-09-20 09:46:50 +053013/* PHY modes */
14#define UFSHCD_DWC_PHY_MODE_ROM 0
15
16/* RMMI Attributes */
17#define CBREFCLKCTRL2 0x8132
18#define CBCRCTRL 0x811F
19#define CBC10DIRECTCONF2 0x810E
20#define CBCREGADDRLSB 0x8116
21#define CBCREGADDRMSB 0x8117
22#define CBCREGWRLSB 0x8118
23#define CBCREGWRMSB 0x8119
24#define CBCREGRDLSB 0x811A
25#define CBCREGRDMSB 0x811B
26#define CBCREGRDWRSEL 0x811C
27
28#define CBREFREFCLK_GATE_OVR_EN BIT(7)
29
30/* M-PHY Attributes */
31#define MTX_FSM_STATE 0x41
32#define MRX_FSM_STATE 0xC1
33
34/* M-PHY registers */
35#define FAST_FLAGS(n) (0x401C + ((n) * 0x100))
36#define RX_AFE_ATT_IDAC(n) (0x4000 + ((n) * 0x100))
37#define RX_AFE_CTLE_IDAC(n) (0x4001 + ((n) * 0x100))
38#define FW_CALIB_CCFG(n) (0x404D + ((n) * 0x100))
39
40/* Tx/Rx FSM state */
41enum rx_fsm_state {
42 RX_STATE_DISABLED = 0,
43 RX_STATE_HIBERN8 = 1,
44 RX_STATE_SLEEP = 2,
45 RX_STATE_STALL = 3,
46 RX_STATE_LSBURST = 4,
47 RX_STATE_HSBURST = 5,
48};
49
50enum tx_fsm_state {
51 TX_STATE_DISABLED = 0,
52 TX_STATE_HIBERN8 = 1,
53 TX_STATE_SLEEP = 2,
54 TX_STATE_STALL = 3,
55 TX_STATE_LSBURST = 4,
56 TX_STATE_HSBURST = 5,
57};
58
Venkatesh Yadav Abbarapudaac30a2024-09-20 09:46:49 +053059struct ufshcd_dme_attr_val {
60 u32 attr_sel;
61 u32 mib_val;
62 u8 peer;
63};
64
65int ufshcd_dwc_link_startup_notify(struct ufs_hba *hba,
66 enum ufs_notify_change_status status);
67int ufshcd_dwc_dme_set_attrs(struct ufs_hba *hba,
68 const struct ufshcd_dme_attr_val *v, int n);
69#endif /* End of Header */