blob: bc85241ed4b0ee4ad7dca9f3c8f459a2c561430f [file] [log] [blame]
Deepa Dinamaniab9c2b92013-09-12 11:30:58 -07001/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
2 *
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions are
5 * met:
6 * * Redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer.
8 * * Redistributions in binary form must reproduce the above
9 * copyright notice, this list of conditions and the following
10 * disclaimer in the documentation and/or other materials provided
11 * with the distribution.
12 * * Neither the name of The Linux Foundation nor the names of its
13 * contributors may be used to endorse or promote products derived
14 * from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28#ifndef _UIC_H_
29#define _UIC_H_
30
31#include <sys/types.h>
32
33#define HCI_UIC_TIMEOUT 100000
34#define HCI_ENABLE_TIMEOUT 100000
35
36enum uic_error_codes
37{
38 UIC_ERR_UNKNOWN,
39 UIC_ERR_TIMEOUT,
40};
41
42enum uic_gen_err_code
43{
44 UICCMD_SUCCESS,
45 UICCMD_FAILURE,
46};
47
48enum uic_num_cmd_args
49{
50 UICCMD_NO_ARGS = 0,
51 UICCMD_ONE_ARGS = 1,
52 UICCMD_TWO_ARGS = 2,
53 UICCMD_THREE_ARGS = 4,
54};
55
56struct uic_cmd
57{
58 uint32_t uiccmd;
59 uint32_t num_args;
60 uint32_t uiccmdarg1;
61 uint32_t uiccmdarg2;
62 uint32_t uiccmdarg3;
63 uint32_t gen_err_code;
64 uint32_t timeout_msecs;
65};
66
67/* UFS init settings. */
68#define UFS_SYS1CLK_1US_VAL 100
69#define UFS_TX_SYMBOL_CLK_1US_VAL 1
70#define UFS_CLK_NS_REG_VAL 10
71#define UFS_PA_LINK_STARTUP_TIMER_VAL 20000000
72#define UFS_LINK_STARTUP_RETRY 10
73
74#define SHFT_CLK_NS_REG (10)
75
76int uic_init(struct ufs_dev *dev);
77int uic_send_cmd(struct ufs_dev *dev, struct uic_cmd *cmd);
78int uic_reset(struct ufs_dev *dev);
79
80
81#endif