xref: /openbmc/u-boot/board/ti/am335x/board.h (revision e77e65df)
1 /*
2  * board.h
3  *
4  * TI AM335x boards information header
5  *
6  * Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/
7  *
8  * SPDX-License-Identifier:	GPL-2.0+
9  */
10 
11 #ifndef _BOARD_H_
12 #define _BOARD_H_
13 
14 /*
15  * TI AM335x parts define a system EEPROM that defines certain sub-fields.
16  * We use these fields to in turn see what board we are on, and what
17  * that might require us to set or not set.
18  */
19 #define HDR_NO_OF_MAC_ADDR	3
20 #define HDR_ETH_ALEN		6
21 #define HDR_NAME_LEN		8
22 
23 struct am335x_baseboard_id {
24 	unsigned int  magic;
25 	char name[HDR_NAME_LEN];
26 	char version[4];
27 	char serial[12];
28 	char config[32];
29 	char mac_addr[HDR_NO_OF_MAC_ADDR][HDR_ETH_ALEN];
30 };
31 
32 static inline int board_is_bone(struct am335x_baseboard_id *header)
33 {
34 	return !strncmp(header->name, "A335BONE", HDR_NAME_LEN);
35 }
36 
37 static inline int board_is_bone_lt(struct am335x_baseboard_id *header)
38 {
39 	return !strncmp(header->name, "A335BNLT", HDR_NAME_LEN);
40 }
41 
42 static inline int board_is_evm_sk(struct am335x_baseboard_id *header)
43 {
44 	return !strncmp("A335X_SK", header->name, HDR_NAME_LEN);
45 }
46 
47 static inline int board_is_idk(struct am335x_baseboard_id *header)
48 {
49 	return !strncmp(header->config, "SKU#02", 6);
50 }
51 
52 static inline int board_is_gp_evm(struct am335x_baseboard_id *header)
53 {
54 	return !strncmp("A33515BB", header->name, HDR_NAME_LEN);
55 }
56 
57 static inline int board_is_evm_15_or_later(struct am335x_baseboard_id *header)
58 {
59 	return (board_is_gp_evm(header) &&
60 		strncmp("1.5", header->version, 3) <= 0);
61 }
62 
63 /*
64  * We have three pin mux functions that must exist.  We must be able to enable
65  * uart0, for initial output and i2c0 to read the main EEPROM.  We then have a
66  * main pinmux function that can be overridden to enable all other pinmux that
67  * is required on the board.
68  */
69 void enable_uart0_pin_mux(void);
70 void enable_uart1_pin_mux(void);
71 void enable_uart2_pin_mux(void);
72 void enable_uart3_pin_mux(void);
73 void enable_uart4_pin_mux(void);
74 void enable_uart5_pin_mux(void);
75 void enable_i2c0_pin_mux(void);
76 void enable_board_pin_mux(struct am335x_baseboard_id *header);
77 #endif
78