Merge git://git.denx.de/u-boot-usb
[platform/kernel/u-boot.git] / board / vscom / baltos / board.h
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 typedef struct _BSP_VS_HWPARAM    // v1.0
33 {
34         uint32_t Magic;
35         uint32_t HwRev;
36         uint32_t SerialNumber;
37         char PrdDate[11];    // as a string ie. "01.01.2006"
38         uint16_t SystemId;
39         uint8_t MAC1[6];        // internal EMAC
40         uint8_t MAC2[6];        // SMSC9514
41         uint8_t MAC3[6];        // WL1271 WLAN
42 } __attribute__ ((packed)) BSP_VS_HWPARAM;
43
44 static inline int board_is_bone(struct am335x_baseboard_id *header)
45 {
46         return !strncmp(header->name, "A335BONE", HDR_NAME_LEN);
47 }
48
49 static inline int board_is_bone_lt(struct am335x_baseboard_id *header)
50 {
51         return !strncmp(header->name, "A335BNLT", HDR_NAME_LEN);
52 }
53
54 static inline int board_is_evm_sk(struct am335x_baseboard_id *header)
55 {
56         return !strncmp("A335X_SK", header->name, HDR_NAME_LEN);
57 }
58
59 static inline int board_is_idk(struct am335x_baseboard_id *header)
60 {
61         return !strncmp(header->config, "SKU#02", 6);
62 }
63
64 static inline int board_is_gp_evm(struct am335x_baseboard_id *header)
65 {
66         return !strncmp("A33515BB", header->name, HDR_NAME_LEN);
67 }
68
69 static inline int board_is_evm_15_or_later(struct am335x_baseboard_id *header)
70 {
71         return (board_is_gp_evm(header) &&
72                 strncmp("1.5", header->version, 3) <= 0);
73 }
74
75 /*
76  * We have three pin mux functions that must exist.  We must be able to enable
77  * uart0, for initial output and i2c0 to read the main EEPROM.  We then have a
78  * main pinmux function that can be overridden to enable all other pinmux that
79  * is required on the board.
80  */
81 void enable_uart0_pin_mux(void);
82 void enable_uart1_pin_mux(void);
83 void enable_uart2_pin_mux(void);
84 void enable_uart3_pin_mux(void);
85 void enable_uart4_pin_mux(void);
86 void enable_uart5_pin_mux(void);
87 void enable_i2c0_pin_mux(void);
88 void enable_i2c1_pin_mux(void);
89 void enable_board_pin_mux(void);
90 #endif