blob: e13fcff02a0251f1a3ddf2834e6d628bd38e7896 [file] [log] [blame]
Peter Korsgaard85ec2db2012-10-18 01:21:09 +00001/*
2 * board.h
3 *
4 * TI AM335x boards information header
5 *
6 * Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/
7 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02008 * SPDX-License-Identifier: GPL-2.0+
Peter Korsgaard85ec2db2012-10-18 01:21:09 +00009 */
10
11#ifndef _BOARD_H_
12#define _BOARD_H_
13
Jyri Sarha8d2998b2016-12-09 12:29:13 +020014/**
15 * AM335X (EMIF_4D) EMIF REG_COS_COUNT_1, REG_COS_COUNT_2, and
16 * REG_PR_OLD_COUNT values to avoid LCDC DMA FIFO underflows and Frame
17 * Synchronization Lost errors. The values are the biggest that work
18 * reliably with offered video modes and the memory subsystem on the
19 * boards. These register have are briefly documented in "7.3.3.5.2
20 * Command Starvation" section of AM335x TRM. The REG_COS_COUNT_1 and
21 * REG_COS_COUNT_2 do not have any effect on current versions of
22 * AM335x.
23 */
24#define EMIF_OCP_CONFIG_BEAGLEBONE_BLACK 0x00141414
25#define EMIF_OCP_CONFIG_AM335X_EVM 0x003d3d3d
26
Nishanth Menon2afa70d2016-02-24 12:30:55 -060027static inline int board_is_bone(void)
28{
29 return board_ti_is("A335BONE");
30}
Peter Korsgaard85ec2db2012-10-18 01:21:09 +000031
Nishanth Menon2afa70d2016-02-24 12:30:55 -060032static inline int board_is_bone_lt(void)
Tom Rini4021fd92013-07-18 15:13:01 -040033{
Nishanth Menon2afa70d2016-02-24 12:30:55 -060034 return board_ti_is("A335BNLT");
Tom Rini4021fd92013-07-18 15:13:01 -040035}
36
Nishanth Menon2afa70d2016-02-24 12:30:55 -060037static inline int board_is_bbg1(void)
Tom Rini4021fd92013-07-18 15:13:01 -040038{
Nishanth Menon2afa70d2016-02-24 12:30:55 -060039 return board_is_bone_lt() && !strncmp(board_ti_get_rev(), "BBG1", 4);
Tom Rini4021fd92013-07-18 15:13:01 -040040}
41
Lokesh Vutlae29609a2017-06-10 13:22:56 +053042static inline int board_is_beaglebonex(void)
43{
44 return board_is_bone() || board_is_bone_lt() || board_is_bbg1();
45}
46
Nishanth Menon2afa70d2016-02-24 12:30:55 -060047static inline int board_is_evm_sk(void)
Tom Rini4021fd92013-07-18 15:13:01 -040048{
Nishanth Menon2afa70d2016-02-24 12:30:55 -060049 return board_ti_is("A335X_SK");
Tom Rini4021fd92013-07-18 15:13:01 -040050}
51
Nishanth Menon2afa70d2016-02-24 12:30:55 -060052static inline int board_is_idk(void)
Tom Rini4021fd92013-07-18 15:13:01 -040053{
Nishanth Menon2afa70d2016-02-24 12:30:55 -060054 return !strncmp(board_ti_get_config(), "SKU#02", 6);
Tom Rini4021fd92013-07-18 15:13:01 -040055}
56
Nishanth Menon2afa70d2016-02-24 12:30:55 -060057static inline int board_is_gp_evm(void)
Tom Rini4021fd92013-07-18 15:13:01 -040058{
Nishanth Menon2afa70d2016-02-24 12:30:55 -060059 return board_ti_is("A33515BB");
Tom Rini4021fd92013-07-18 15:13:01 -040060}
61
Nishanth Menon2afa70d2016-02-24 12:30:55 -060062static inline int board_is_evm_15_or_later(void)
Tom Rini4021fd92013-07-18 15:13:01 -040063{
Nishanth Menon2afa70d2016-02-24 12:30:55 -060064 return (board_is_gp_evm() &&
65 strncmp("1.5", board_ti_get_rev(), 3) <= 0);
Tom Rini4021fd92013-07-18 15:13:01 -040066}
67
Lokesh Vutlad431b692016-05-16 11:47:22 +053068static inline int board_is_icev2(void)
69{
70 return board_ti_is("A335_ICE") && !strncmp("2", board_ti_get_rev(), 1);
71}
72
Peter Korsgaard85ec2db2012-10-18 01:21:09 +000073/*
74 * We have three pin mux functions that must exist. We must be able to enable
75 * uart0, for initial output and i2c0 to read the main EEPROM. We then have a
76 * main pinmux function that can be overridden to enable all other pinmux that
77 * is required on the board.
78 */
79void enable_uart0_pin_mux(void);
Andrew Bradford65c51ff2012-10-25 08:21:30 -040080void enable_uart1_pin_mux(void);
81void enable_uart2_pin_mux(void);
82void enable_uart3_pin_mux(void);
83void enable_uart4_pin_mux(void);
84void enable_uart5_pin_mux(void);
Peter Korsgaard85ec2db2012-10-18 01:21:09 +000085void enable_i2c0_pin_mux(void);
Nishanth Menon2afa70d2016-02-24 12:30:55 -060086void enable_board_pin_mux(void);
Peter Korsgaard85ec2db2012-10-18 01:21:09 +000087#endif