Vadim Bendebury | 476f731 | 2014-04-08 18:45:46 -0700 | [diff] [blame] | 1 | /* |
| 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 Bendebury | 476f731 | 2014-04-08 18:45:46 -0700 | [diff] [blame] | 22 | /* 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 Bendebury | 6fe4e5e | 2014-12-06 10:44:58 -0800 | [diff] [blame] | 34 | typedef 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 Bendebury | 476f731 | 2014-04-08 18:45:46 -0700 | [diff] [blame] | 43 | |
Vadim Bendebury | 6fe4e5e | 2014-12-06 10:44:58 -0800 | [diff] [blame] | 44 | typedef enum { |
| 45 | GSBI_SUCCESS = 0, |
| 46 | GSBI_ID_ERROR, |
| 47 | GSBI_ERROR, |
| 48 | GSBI_UNSUPPORTED |
| 49 | } gsbi_return_t; |
| 50 | |
| 51 | typedef 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 | |
| 60 | gsbi_return_t gsbi_init(gsbi_id_t gsbi_id, gsbi_protocol_t protocol); |
| 61 | int gsbi_init_board(gsbi_id_t gsbi_id); |
| 62 | |
| 63 | #endif |