blob: 48df914af96cfdc4b05a4ef5bac552b3577bf2da [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Peter Korsgaarde3634262012-10-18 01:21:09 +00002/*
3 * board.h
4 *
5 * TI AM335x boards information header
6 *
7 * Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/
Peter Korsgaarde3634262012-10-18 01:21:09 +00008 */
9
10#ifndef _BOARD_H_
11#define _BOARD_H_
12
Jyri Sarha8c17cbd2016-12-09 12:29:13 +020013/**
14 * AM335X (EMIF_4D) EMIF REG_COS_COUNT_1, REG_COS_COUNT_2, and
15 * REG_PR_OLD_COUNT values to avoid LCDC DMA FIFO underflows and Frame
16 * Synchronization Lost errors. The values are the biggest that work
17 * reliably with offered video modes and the memory subsystem on the
18 * boards. These register have are briefly documented in "7.3.3.5.2
19 * Command Starvation" section of AM335x TRM. The REG_COS_COUNT_1 and
20 * REG_COS_COUNT_2 do not have any effect on current versions of
21 * AM335x.
22 */
23#define EMIF_OCP_CONFIG_BEAGLEBONE_BLACK 0x00141414
24#define EMIF_OCP_CONFIG_AM335X_EVM 0x003d3d3d
25
Nishanth Menon770e68c2016-02-24 12:30:55 -060026static inline int board_is_bone(void)
Tom Riniace42752013-07-18 15:13:01 -040027{
Nishanth Menon770e68c2016-02-24 12:30:55 -060028 return board_ti_is("A335BONE");
Tom Riniace42752013-07-18 15:13:01 -040029}
30
Nishanth Menon770e68c2016-02-24 12:30:55 -060031static inline int board_is_bone_lt(void)
Tom Riniace42752013-07-18 15:13:01 -040032{
Nishanth Menon770e68c2016-02-24 12:30:55 -060033 return board_ti_is("A335BNLT");
Tom Riniace42752013-07-18 15:13:01 -040034}
35
Jason Kridnereff0c972018-03-07 05:40:41 -050036static inline int board_is_pb(void)
37{
38 return board_ti_is("A335PBGL");
39}
40
Nishanth Menon770e68c2016-02-24 12:30:55 -060041static inline int board_is_bbg1(void)
Tom Riniace42752013-07-18 15:13:01 -040042{
Nishanth Menon770e68c2016-02-24 12:30:55 -060043 return board_is_bone_lt() && !strncmp(board_ti_get_rev(), "BBG1", 4);
Tom Riniace42752013-07-18 15:13:01 -040044}
45
Koen Kooiad6054f2018-07-18 10:13:59 +020046static inline int board_is_bben(void)
47{
48 return board_is_bone_lt() && !strncmp(board_ti_get_rev(), "SE", 2);
49}
50
Lokesh Vutla9f7923c2017-06-10 13:22:56 +053051static inline int board_is_beaglebonex(void)
52{
Koen Kooiad6054f2018-07-18 10:13:59 +020053 return board_is_pb() || board_is_bone() || board_is_bone_lt() ||
54 board_is_bbg1() || board_is_bben();
Lokesh Vutla9f7923c2017-06-10 13:22:56 +053055}
56
Nishanth Menon770e68c2016-02-24 12:30:55 -060057static inline int board_is_evm_sk(void)
Tom Riniace42752013-07-18 15:13:01 -040058{
Nishanth Menon770e68c2016-02-24 12:30:55 -060059 return board_ti_is("A335X_SK");
Tom Riniace42752013-07-18 15:13:01 -040060}
61
Nishanth Menon770e68c2016-02-24 12:30:55 -060062static inline int board_is_idk(void)
Tom Riniace42752013-07-18 15:13:01 -040063{
Nishanth Menon770e68c2016-02-24 12:30:55 -060064 return !strncmp(board_ti_get_config(), "SKU#02", 6);
Tom Riniace42752013-07-18 15:13:01 -040065}
66
Nishanth Menon770e68c2016-02-24 12:30:55 -060067static inline int board_is_gp_evm(void)
Tom Riniace42752013-07-18 15:13:01 -040068{
Nishanth Menon770e68c2016-02-24 12:30:55 -060069 return board_ti_is("A33515BB");
70}
71
72static inline int board_is_evm_15_or_later(void)
73{
74 return (board_is_gp_evm() &&
75 strncmp("1.5", board_ti_get_rev(), 3) <= 0);
Tom Riniace42752013-07-18 15:13:01 -040076}
77
Lokesh Vutlaa9643322016-05-16 11:47:22 +053078static inline int board_is_icev2(void)
79{
80 return board_ti_is("A335_ICE") && !strncmp("2", board_ti_get_rev(), 1);
81}
82
Peter Korsgaarde3634262012-10-18 01:21:09 +000083/*
84 * We have three pin mux functions that must exist. We must be able to enable
85 * uart0, for initial output and i2c0 to read the main EEPROM. We then have a
86 * main pinmux function that can be overridden to enable all other pinmux that
87 * is required on the board.
88 */
89void enable_uart0_pin_mux(void);
Andrew Bradford6422b702012-10-25 08:21:30 -040090void enable_uart1_pin_mux(void);
91void enable_uart2_pin_mux(void);
92void enable_uart3_pin_mux(void);
93void enable_uart4_pin_mux(void);
94void enable_uart5_pin_mux(void);
Peter Korsgaarde3634262012-10-18 01:21:09 +000095void enable_i2c0_pin_mux(void);
Nishanth Menon770e68c2016-02-24 12:30:55 -060096void enable_board_pin_mux(void);
Peter Korsgaarde3634262012-10-18 01:21:09 +000097#endif