1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * board.h
4  *
5  * TI AM335x boards information header
6  *
7  * Copyright (C) 2011, Texas Instruments, Incorporated - https://www.ti.com/
8  */
9 
10 #ifndef _BOARD_H_
11 #define _BOARD_H_
12 
13 #include <linux/string.h>
14 
15 /**
16  * AM335X (EMIF_4D) EMIF REG_COS_COUNT_1, REG_COS_COUNT_2, and
17  * REG_PR_OLD_COUNT values to avoid LCDC DMA FIFO underflows and Frame
18  * Synchronization Lost errors. The values are the biggest that work
19  * reliably with offered video modes and the memory subsystem on the
20  * boards. These register have are briefly documented in "7.3.3.5.2
21  * Command Starvation" section of AM335x TRM. The REG_COS_COUNT_1 and
22  * REG_COS_COUNT_2 do not have any effect on current versions of
23  * AM335x.
24  */
25 #define EMIF_OCP_CONFIG_BEAGLEBONE_BLACK       0x00141414
26 #define EMIF_OCP_CONFIG_AM335X_EVM             0x003d3d3d
27 
board_is_bone(void)28 static inline int board_is_bone(void)
29 {
30 	return board_ti_is("A335BONE");
31 }
32 
board_is_bone_lt(void)33 static inline int board_is_bone_lt(void)
34 {
35 	return board_ti_is("A335BNLT");
36 }
37 
board_is_pb(void)38 static inline int board_is_pb(void)
39 {
40 	return board_ti_is("A335PBGL");
41 }
42 
board_is_bbg1(void)43 static inline int board_is_bbg1(void)
44 {
45 	return board_is_bone_lt() && !strncmp(board_ti_get_rev(), "BBG1", 4);
46 }
47 
board_is_bbge(void)48 static inline int board_is_bbge(void)
49 {
50 	return board_is_bone_lt() && !strncmp(board_ti_get_rev(), "BBGE", 4);
51 }
52 
board_is_bben(void)53 static inline int board_is_bben(void)
54 {
55 	return board_is_bone_lt() && !strncmp(board_ti_get_rev(), "SE", 2);
56 }
57 
board_is_beaglebonex(void)58 static inline int board_is_beaglebonex(void)
59 {
60 	return board_is_pb() || board_is_bone() || board_is_bone_lt() ||
61 	       board_is_bbg1() || board_is_bben();
62 }
63 
board_is_evm_sk(void)64 static inline int board_is_evm_sk(void)
65 {
66 	return board_ti_is("A335X_SK");
67 }
68 
board_is_idk(void)69 static inline int board_is_idk(void)
70 {
71 	return !strncmp(board_ti_get_config(), "SKU#02", 6);
72 }
73 
board_is_gp_evm(void)74 static inline int board_is_gp_evm(void)
75 {
76 	return board_ti_is("A33515BB");
77 }
78 
board_is_evm_15_or_later(void)79 static inline int board_is_evm_15_or_later(void)
80 {
81 	return (board_is_gp_evm() &&
82 		strncmp("1.5", board_ti_get_rev(), 3) <= 0);
83 }
84 
board_is_icev2(void)85 static inline int board_is_icev2(void)
86 {
87 	return board_ti_is("A335_ICE") && !strncmp("2", board_ti_get_rev(), 1);
88 }
89 
90 /*
91  * We have three pin mux functions that must exist.  We must be able to enable
92  * uart0, for initial output and i2c0 to read the main EEPROM.  We then have a
93  * main pinmux function that can be overridden to enable all other pinmux that
94  * is required on the board.
95  */
96 void enable_uart0_pin_mux(void);
97 void enable_uart1_pin_mux(void);
98 void enable_uart2_pin_mux(void);
99 void enable_uart3_pin_mux(void);
100 void enable_uart4_pin_mux(void);
101 void enable_uart5_pin_mux(void);
102 void enable_i2c0_pin_mux(void);
103 void enable_i2c2_pin_mux(void);
104 void enable_board_pin_mux(void);
105 #endif
106