blob: b0a3842423fb3e47945d78c513336b1e74a7693c [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Peter Korsgaard85ec2db2012-10-18 01:21:09 +00002/*
3 * board.h
4 *
5 * TI AM335x boards information header
6 *
Nishanth Menoneaa39c62023-11-01 15:56:03 -05007 * Copyright (C) 2011, Texas Instruments, Incorporated - https://www.ti.com/
Peter Korsgaard85ec2db2012-10-18 01:21:09 +00008 */
9
10#ifndef _BOARD_H_
11#define _BOARD_H_
12
Tom Rinidec7ea02024-05-20 13:35:03 -060013#include <linux/string.h>
14
Jyri Sarha8d2998b2016-12-09 12:29:13 +020015/**
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
Nishanth Menon2afa70d2016-02-24 12:30:55 -060028static inline int board_is_bone(void)
29{
30 return board_ti_is("A335BONE");
31}
Peter Korsgaard85ec2db2012-10-18 01:21:09 +000032
Nishanth Menon2afa70d2016-02-24 12:30:55 -060033static inline int board_is_bone_lt(void)
Tom Rini4021fd92013-07-18 15:13:01 -040034{
Nishanth Menon2afa70d2016-02-24 12:30:55 -060035 return board_ti_is("A335BNLT");
Tom Rini4021fd92013-07-18 15:13:01 -040036}
37
Jason Kridnerb56b5b32018-03-07 05:40:41 -050038static inline int board_is_pb(void)
39{
40 return board_ti_is("A335PBGL");
41}
42
Nishanth Menon2afa70d2016-02-24 12:30:55 -060043static inline int board_is_bbg1(void)
Tom Rini4021fd92013-07-18 15:13:01 -040044{
Nishanth Menon2afa70d2016-02-24 12:30:55 -060045 return board_is_bone_lt() && !strncmp(board_ti_get_rev(), "BBG1", 4);
Tom Rini4021fd92013-07-18 15:13:01 -040046}
47
Koen Kooi8a157862018-07-18 10:13:59 +020048static inline int board_is_bben(void)
49{
50 return board_is_bone_lt() && !strncmp(board_ti_get_rev(), "SE", 2);
51}
52
Lokesh Vutlae29609a2017-06-10 13:22:56 +053053static inline int board_is_beaglebonex(void)
54{
Koen Kooi8a157862018-07-18 10:13:59 +020055 return board_is_pb() || board_is_bone() || board_is_bone_lt() ||
56 board_is_bbg1() || board_is_bben();
Lokesh Vutlae29609a2017-06-10 13:22:56 +053057}
58
Nishanth Menon2afa70d2016-02-24 12:30:55 -060059static inline int board_is_evm_sk(void)
Tom Rini4021fd92013-07-18 15:13:01 -040060{
Nishanth Menon2afa70d2016-02-24 12:30:55 -060061 return board_ti_is("A335X_SK");
Tom Rini4021fd92013-07-18 15:13:01 -040062}
63
Nishanth Menon2afa70d2016-02-24 12:30:55 -060064static inline int board_is_idk(void)
Tom Rini4021fd92013-07-18 15:13:01 -040065{
Nishanth Menon2afa70d2016-02-24 12:30:55 -060066 return !strncmp(board_ti_get_config(), "SKU#02", 6);
Tom Rini4021fd92013-07-18 15:13:01 -040067}
68
Nishanth Menon2afa70d2016-02-24 12:30:55 -060069static inline int board_is_gp_evm(void)
Tom Rini4021fd92013-07-18 15:13:01 -040070{
Nishanth Menon2afa70d2016-02-24 12:30:55 -060071 return board_ti_is("A33515BB");
Tom Rini4021fd92013-07-18 15:13:01 -040072}
73
Nishanth Menon2afa70d2016-02-24 12:30:55 -060074static inline int board_is_evm_15_or_later(void)
Tom Rini4021fd92013-07-18 15:13:01 -040075{
Nishanth Menon2afa70d2016-02-24 12:30:55 -060076 return (board_is_gp_evm() &&
77 strncmp("1.5", board_ti_get_rev(), 3) <= 0);
Tom Rini4021fd92013-07-18 15:13:01 -040078}
79
Lokesh Vutlad431b692016-05-16 11:47:22 +053080static inline int board_is_icev2(void)
81{
82 return board_ti_is("A335_ICE") && !strncmp("2", board_ti_get_rev(), 1);
83}
84
Peter Korsgaard85ec2db2012-10-18 01:21:09 +000085/*
86 * We have three pin mux functions that must exist. We must be able to enable
87 * uart0, for initial output and i2c0 to read the main EEPROM. We then have a
88 * main pinmux function that can be overridden to enable all other pinmux that
89 * is required on the board.
90 */
91void enable_uart0_pin_mux(void);
Andrew Bradford65c51ff2012-10-25 08:21:30 -040092void enable_uart1_pin_mux(void);
93void enable_uart2_pin_mux(void);
94void enable_uart3_pin_mux(void);
95void enable_uart4_pin_mux(void);
96void enable_uart5_pin_mux(void);
Peter Korsgaard85ec2db2012-10-18 01:21:09 +000097void enable_i2c0_pin_mux(void);
Kory Maincent4c1a71d2021-05-04 19:31:29 +020098void enable_i2c2_pin_mux(void);
Nishanth Menon2afa70d2016-02-24 12:30:55 -060099void enable_board_pin_mux(void);
Peter Korsgaard85ec2db2012-10-18 01:21:09 +0000100#endif