blob: 00c257c4b8dd13221276e2b50ee22940e894c37a [file] [log] [blame]
Vadim Bendebury476f7312014-04-08 18:45:46 -07001/*
2* Copyright (c) 2004-2011 Atheros Communications Inc.
3* Copyright (c) 2011-2012 The Linux Foundation. All rights reserved.
4*
5* Permission to use, copy, modify, and/or distribute this software for any
6* purpose with or without fee is hereby granted, provided that the above
7* copyright notice and this permission notice appear in all copies.
8*
9* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16*/
17
18
19#ifndef __GSBI_H_
20#define __GSBI_H_
21
Vadim Bendebury476f7312014-04-08 18:45:46 -070022/* GSBI Registers */
23#define GSBI_CTRL_REG(base) ((base) + 0x0)
24
25#define GSBI_CTRL_REG_PROTOCOL_CODE_S 4
26#define GSBI_PROTOCOL_CODE_I2C 0x2
27#define GSBI_PROTOCOL_CODE_SPI 0x3
28#define GSBI_PROTOCOL_CODE_UART_FLOW 0x4
29#define GSBI_PROTOCOL_CODE_I2C_UART 0x6
30
31#define GSBI_HCLK_CTL_S 4
32#define GSBI_HCLK_CTL_CLK_ENA 0x1
33
Vadim Bendebury6fe4e5e2014-12-06 10:44:58 -080034typedef enum {
35 GSBI_ID_1 = 1,
36 GSBI_ID_2,
37 GSBI_ID_3,
38 GSBI_ID_4,
39 GSBI_ID_5,
40 GSBI_ID_6,
41 GSBI_ID_7,
42} gsbi_id_t;
Vadim Bendebury476f7312014-04-08 18:45:46 -070043
Vadim Bendebury6fe4e5e2014-12-06 10:44:58 -080044typedef enum {
45 GSBI_SUCCESS = 0,
46 GSBI_ID_ERROR,
47 GSBI_ERROR,
48 GSBI_UNSUPPORTED
49} gsbi_return_t;
50
51typedef enum {
52 GSBI_PROTO_I2C_UIM = 1,
53 GSBI_PROTO_I2C_ONLY,
54 GSBI_PROTO_SPI_ONLY,
55 GSBI_PROTO_UART_FLOW_CTL,
56 GSBI_PROTO_UIM,
57 GSBI_PROTO_I2C_UART,
58} gsbi_protocol_t;
59
60gsbi_return_t gsbi_init(gsbi_id_t gsbi_id, gsbi_protocol_t protocol);
61int gsbi_init_board(gsbi_id_t gsbi_id);
62
63#endif