Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Peter Korsgaard | 85ec2db | 2012-10-18 01:21:09 +0000 | [diff] [blame] | 2 | /* |
| 3 | * board.h |
| 4 | * |
| 5 | * TI AM335x boards information header |
| 6 | * |
Nishanth Menon | eaa39c6 | 2023-11-01 15:56:03 -0500 | [diff] [blame] | 7 | * Copyright (C) 2011, Texas Instruments, Incorporated - https://www.ti.com/ |
Peter Korsgaard | 85ec2db | 2012-10-18 01:21:09 +0000 | [diff] [blame] | 8 | */ |
| 9 | |
| 10 | #ifndef _BOARD_H_ |
| 11 | #define _BOARD_H_ |
| 12 | |
Tom Rini | dec7ea0 | 2024-05-20 13:35:03 -0600 | [diff] [blame] | 13 | #include <linux/string.h> |
| 14 | |
Jyri Sarha | 8d2998b | 2016-12-09 12:29:13 +0200 | [diff] [blame] | 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 | |
Nishanth Menon | 2afa70d | 2016-02-24 12:30:55 -0600 | [diff] [blame] | 28 | static inline int board_is_bone(void) |
| 29 | { |
| 30 | return board_ti_is("A335BONE"); |
| 31 | } |
Peter Korsgaard | 85ec2db | 2012-10-18 01:21:09 +0000 | [diff] [blame] | 32 | |
Nishanth Menon | 2afa70d | 2016-02-24 12:30:55 -0600 | [diff] [blame] | 33 | static inline int board_is_bone_lt(void) |
Tom Rini | 4021fd9 | 2013-07-18 15:13:01 -0400 | [diff] [blame] | 34 | { |
Nishanth Menon | 2afa70d | 2016-02-24 12:30:55 -0600 | [diff] [blame] | 35 | return board_ti_is("A335BNLT"); |
Tom Rini | 4021fd9 | 2013-07-18 15:13:01 -0400 | [diff] [blame] | 36 | } |
| 37 | |
Jason Kridner | b56b5b3 | 2018-03-07 05:40:41 -0500 | [diff] [blame] | 38 | static inline int board_is_pb(void) |
| 39 | { |
| 40 | return board_ti_is("A335PBGL"); |
| 41 | } |
| 42 | |
Nishanth Menon | 2afa70d | 2016-02-24 12:30:55 -0600 | [diff] [blame] | 43 | static inline int board_is_bbg1(void) |
Tom Rini | 4021fd9 | 2013-07-18 15:13:01 -0400 | [diff] [blame] | 44 | { |
Nishanth Menon | 2afa70d | 2016-02-24 12:30:55 -0600 | [diff] [blame] | 45 | return board_is_bone_lt() && !strncmp(board_ti_get_rev(), "BBG1", 4); |
Tom Rini | 4021fd9 | 2013-07-18 15:13:01 -0400 | [diff] [blame] | 46 | } |
| 47 | |
Koen Kooi | 8a15786 | 2018-07-18 10:13:59 +0200 | [diff] [blame] | 48 | static inline int board_is_bben(void) |
| 49 | { |
| 50 | return board_is_bone_lt() && !strncmp(board_ti_get_rev(), "SE", 2); |
| 51 | } |
| 52 | |
Lokesh Vutla | e29609a | 2017-06-10 13:22:56 +0530 | [diff] [blame] | 53 | static inline int board_is_beaglebonex(void) |
| 54 | { |
Koen Kooi | 8a15786 | 2018-07-18 10:13:59 +0200 | [diff] [blame] | 55 | return board_is_pb() || board_is_bone() || board_is_bone_lt() || |
| 56 | board_is_bbg1() || board_is_bben(); |
Lokesh Vutla | e29609a | 2017-06-10 13:22:56 +0530 | [diff] [blame] | 57 | } |
| 58 | |
Nishanth Menon | 2afa70d | 2016-02-24 12:30:55 -0600 | [diff] [blame] | 59 | static inline int board_is_evm_sk(void) |
Tom Rini | 4021fd9 | 2013-07-18 15:13:01 -0400 | [diff] [blame] | 60 | { |
Nishanth Menon | 2afa70d | 2016-02-24 12:30:55 -0600 | [diff] [blame] | 61 | return board_ti_is("A335X_SK"); |
Tom Rini | 4021fd9 | 2013-07-18 15:13:01 -0400 | [diff] [blame] | 62 | } |
| 63 | |
Nishanth Menon | 2afa70d | 2016-02-24 12:30:55 -0600 | [diff] [blame] | 64 | static inline int board_is_idk(void) |
Tom Rini | 4021fd9 | 2013-07-18 15:13:01 -0400 | [diff] [blame] | 65 | { |
Nishanth Menon | 2afa70d | 2016-02-24 12:30:55 -0600 | [diff] [blame] | 66 | return !strncmp(board_ti_get_config(), "SKU#02", 6); |
Tom Rini | 4021fd9 | 2013-07-18 15:13:01 -0400 | [diff] [blame] | 67 | } |
| 68 | |
Nishanth Menon | 2afa70d | 2016-02-24 12:30:55 -0600 | [diff] [blame] | 69 | static inline int board_is_gp_evm(void) |
Tom Rini | 4021fd9 | 2013-07-18 15:13:01 -0400 | [diff] [blame] | 70 | { |
Nishanth Menon | 2afa70d | 2016-02-24 12:30:55 -0600 | [diff] [blame] | 71 | return board_ti_is("A33515BB"); |
Tom Rini | 4021fd9 | 2013-07-18 15:13:01 -0400 | [diff] [blame] | 72 | } |
| 73 | |
Nishanth Menon | 2afa70d | 2016-02-24 12:30:55 -0600 | [diff] [blame] | 74 | static inline int board_is_evm_15_or_later(void) |
Tom Rini | 4021fd9 | 2013-07-18 15:13:01 -0400 | [diff] [blame] | 75 | { |
Nishanth Menon | 2afa70d | 2016-02-24 12:30:55 -0600 | [diff] [blame] | 76 | return (board_is_gp_evm() && |
| 77 | strncmp("1.5", board_ti_get_rev(), 3) <= 0); |
Tom Rini | 4021fd9 | 2013-07-18 15:13:01 -0400 | [diff] [blame] | 78 | } |
| 79 | |
Lokesh Vutla | d431b69 | 2016-05-16 11:47:22 +0530 | [diff] [blame] | 80 | static inline int board_is_icev2(void) |
| 81 | { |
| 82 | return board_ti_is("A335_ICE") && !strncmp("2", board_ti_get_rev(), 1); |
| 83 | } |
| 84 | |
Peter Korsgaard | 85ec2db | 2012-10-18 01:21:09 +0000 | [diff] [blame] | 85 | /* |
| 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 | */ |
| 91 | void enable_uart0_pin_mux(void); |
Andrew Bradford | 65c51ff | 2012-10-25 08:21:30 -0400 | [diff] [blame] | 92 | void enable_uart1_pin_mux(void); |
| 93 | void enable_uart2_pin_mux(void); |
| 94 | void enable_uart3_pin_mux(void); |
| 95 | void enable_uart4_pin_mux(void); |
| 96 | void enable_uart5_pin_mux(void); |
Peter Korsgaard | 85ec2db | 2012-10-18 01:21:09 +0000 | [diff] [blame] | 97 | void enable_i2c0_pin_mux(void); |
Kory Maincent | 4c1a71d | 2021-05-04 19:31:29 +0200 | [diff] [blame] | 98 | void enable_i2c2_pin_mux(void); |
Nishanth Menon | 2afa70d | 2016-02-24 12:30:55 -0600 | [diff] [blame] | 99 | void enable_board_pin_mux(void); |
Peter Korsgaard | 85ec2db | 2012-10-18 01:21:09 +0000 | [diff] [blame] | 100 | #endif |