aboutsummaryrefslogtreecommitdiff
path: root/board/bosch/shc/board.h
blob: 46167fe59ecb0f64c72694596e168a96d872ad44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
/*
 * board.h
 *
 * (C) Copyright 2016
 * Heiko Schocher, DENX Software Engineering, hs@denx.de.
 *
 * Based on:
 * TI AM335x boards information header
 *
 * Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/
 *
 * SPDX-License-Identifier:	GPL-2.0+
 */

#ifndef _BOARD_H_
#define _BOARD_H_

/* Definition to control the GPIOs (for LEDs and Reset) */
#define GPIO_TO_PIN(bank, gpio) (32 * (bank) + (gpio))

static inline int board_is_b_sample(void)
{
#if defined CONFIG_B_SAMPLE
	return 1;
#else
	return 0;
#endif
}

static inline int board_is_c_sample(void)
{
#if defined CONFIG_C_SAMPLE
	return 1;
#else
	return 0;
#endif
}

static inline int board_is_c3_sample(void)
{
#if defined CONFIG_C3_SAMPLE
	return 1;
#else
	return 0;
#endif
}

static inline int board_is_series(void)
{
#if defined CONFIG_SERIES
	return 1;
#else
	return 0;
#endif
}

/*
 * Definitions for pinmuxing header and Board ID strings
 */
#if defined CONFIG_B_SAMPLE
# define BOARD_ID_STR "SHC B-Sample\n"
#elif defined CONFIG_B2_SAMPLE
# define BOARD_ID_STR "SHC B2-Sample\n"
#elif defined CONFIG_C_SAMPLE
# if defined(CONFIG_SHC_NETBOOT)
#  define BOARD_ID_STR "#### NETBOOT ####\nSHC C-Sample\n"
# elif defined(CONFIG_SHC_SDBOOT)
#  define BOARD_ID_STR "#### SDBOOT ####\nSHC C-Sample\n"
# else
#  define BOARD_ID_STR "SHC C-Sample\n"
# endif
#elif defined CONFIG_C2_SAMPLE
# if defined(CONFIG_SHC_ICT)
#  define BOARD_ID_STR "#### ICT ####\nSHC C2-Sample\n"
# elif defined(CONFIG_SHC_NETBOOT)
#  define BOARD_ID_STR "#### NETBOOT ####\nSHC C2-Sample\n"
# elif defined(CONFIG_SHC_SDBOOT)
#  define BOARD_ID_STR "#### SDBOOT ####\nSHC C2-Sample\n"
# else
#  define BOARD_ID_STR "SHC C2-Sample\n"
# endif
#elif defined CONFIG_C3_SAMPLE
# if defined(CONFIG_SHC_ICT)
#  define BOARD_ID_STR "#### ICT ####\nSHC C3-Sample\n"
# elif defined(CONFIG_SHC_NETBOOT)
#  define BOARD_ID_STR "#### NETBOOT ####\nSHC C3-Sample\n"
# elif defined(CONFIG_SHC_SDBOOT)
#  define BOARD_ID_STR "#### SDBOOT ####\nSHC C3-Sample\n"
# else
#  define BOARD_ID_STR "SHC C3-Sample\n"
# endif
#elif defined CONFIG_SERIES
# if defined(CONFIG_SHC_ICT)
#  define BOARD_ID_STR "#### ICT ####\nSHC\n"
# elif defined(CONFIG_SHC_NETBOOT)
#  define BOARD_ID_STR "#### NETBOOT ####\nSHC\n"
# elif defined(CONFIG_SHC_SDBOOT)
#  define BOARD_ID_STR "#### SDBOOT ####\nSHC\n"
# else
#  define BOARD_ID_STR "SHC\n"
# endif
#else
# define BOARD_ID_STR "Unknown device!\n"
#endif

/*
 * Definitions for GPIO pin assignments
 */
#if defined CONFIG_B_SAMPLE

# define LED_PWR_BL_GPIO   GPIO_TO_PIN(1, 17)
# define LED_PWR_RD_GPIO   GPIO_TO_PIN(1, 18)
# define LED_PWR_GN_GPIO   GPIO_TO_PIN(1, 19)
# define LED_CONN_BL_GPIO  GPIO_TO_PIN(0, 26)
# define LED_CONN_RD_GPIO  GPIO_TO_PIN(0, 22)
# define LED_CONN_GN_GPIO  GPIO_TO_PIN(0, 23)
# define RESET_GPIO        GPIO_TO_PIN(1, 29)
# define WIFI_REGEN_GPIO   GPIO_TO_PIN(1, 16)
# define WIFI_RST_GPIO     GPIO_TO_PIN(0, 27)
# define ZIGBEE_RST_GPIO   GPIO_TO_PIN(3, 18)
# define BIDCOS_RST_GPIO   GPIO_TO_PIN(0, 12)
# define ENOC_RST_GPIO     GPIO_TO_PIN(1, 22)

#else

# define LED_PWR_BL_GPIO   GPIO_TO_PIN(0, 22)
# define LED_PWR_RD_GPIO   GPIO_TO_PIN(0, 23)
# define LED_LAN_BL_GPIO   GPIO_TO_PIN(1, 17)
# define LED_LAN_RD_GPIO   GPIO_TO_PIN(0, 26)
# define LED_CLOUD_BL_GPIO GPIO_TO_PIN(1, 18)
# define LED_CLOUD_RD_GPIO GPIO_TO_PIN(2, 2)
# define LED_PWM_GPIO      GPIO_TO_PIN(1, 19)
# define RESET_GPIO        GPIO_TO_PIN(1, 29)
# define WIFI_REGEN_GPIO   GPIO_TO_PIN(1, 16)
# define WIFI_RST_GPIO     GPIO_TO_PIN(0, 27)
# define ZIGBEE_RST_GPIO   GPIO_TO_PIN(3, 18)
# define BIDCOS_RST_GPIO   GPIO_TO_PIN(1, 24)
# define Z_WAVE_RST_GPIO   GPIO_TO_PIN(1, 21)
# define ENOC_RST_GPIO     GPIO_TO_PIN(1, 22)

#endif

#define BACK_BUTTON_GPIO    GPIO_TO_PIN(1, 29)
#define FRONT_BUTTON_GPIO   GPIO_TO_PIN(1, 25)

/* Reset is on GPIO pin 29 of GPIO bank 1 */
#define RESET_MASK	(0x1 << 29)

#define HDR_MAGIC	0x43485342
#define HDR_ETH_ALEN	6
#define HDR_NAME_LEN	8
#define HDR_REV_LEN	8
#define HDR_SER_LEN	16
#define HDR_ROOT_LEN	12
#define HDR_FATC_LEN	12

/*
* SHC parameters held in On-Board I²C EEPROM device.
*
* Header Format
*
*  Name     Size   Contents
*-------------------------------------------------------------
*  Magic     4     0x42 0x53 0x48 0x43  [BSHC]
*
*  Version   2     0x0100 for v1.0
*
*  Lenght    2     The length of the complete structure, not only this header
*
*  Eth-MAC   6     Ethernet MAC Address
*                  SHC Pool: 7C:AC:B2:00:10:01 - TBD
*
*  --- Further values follow, not important for Bootloader ---
*/

struct  shc_eeprom {
	u32  magic;
	u16  version;
	u16  lenght;
	uint8_t mac_addr[HDR_ETH_ALEN];
};

void enable_uart0_pin_mux(void);
void enable_shc_board_pin_mux(void);
void enable_shc_board_pwm_pin_mux(void);

#endif