Peter Korsgaard | e363426 | 2012-10-18 01:21:09 +0000 | [diff] [blame] | 1 | /* |
| 2 | * board.h |
| 3 | * |
| 4 | * TI AM335x boards information header |
| 5 | * |
| 6 | * Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/ |
| 7 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 8 | * SPDX-License-Identifier: GPL-2.0+ |
Peter Korsgaard | e363426 | 2012-10-18 01:21:09 +0000 | [diff] [blame] | 9 | */ |
| 10 | |
| 11 | #ifndef _BOARD_H_ |
| 12 | #define _BOARD_H_ |
| 13 | |
| 14 | /* |
| 15 | * TI AM335x parts define a system EEPROM that defines certain sub-fields. |
| 16 | * We use these fields to in turn see what board we are on, and what |
| 17 | * that might require us to set or not set. |
| 18 | */ |
| 19 | #define HDR_NO_OF_MAC_ADDR 3 |
| 20 | #define HDR_ETH_ALEN 6 |
| 21 | #define HDR_NAME_LEN 8 |
| 22 | |
| 23 | struct am335x_baseboard_id { |
| 24 | unsigned int magic; |
| 25 | char name[HDR_NAME_LEN]; |
| 26 | char version[4]; |
| 27 | char serial[12]; |
| 28 | char config[32]; |
| 29 | char mac_addr[HDR_NO_OF_MAC_ADDR][HDR_ETH_ALEN]; |
| 30 | }; |
| 31 | |
Tom Rini | ace4275 | 2013-07-18 15:13:01 -0400 | [diff] [blame] | 32 | static inline int board_is_bone(struct am335x_baseboard_id *header) |
| 33 | { |
| 34 | return !strncmp(header->name, "A335BONE", HDR_NAME_LEN); |
| 35 | } |
| 36 | |
| 37 | static inline int board_is_bone_lt(struct am335x_baseboard_id *header) |
| 38 | { |
| 39 | return !strncmp(header->name, "A335BNLT", HDR_NAME_LEN); |
| 40 | } |
| 41 | |
| 42 | static inline int board_is_evm_sk(struct am335x_baseboard_id *header) |
| 43 | { |
| 44 | return !strncmp("A335X_SK", header->name, HDR_NAME_LEN); |
| 45 | } |
| 46 | |
| 47 | static inline int board_is_idk(struct am335x_baseboard_id *header) |
| 48 | { |
| 49 | return !strncmp(header->config, "SKU#02", 6); |
| 50 | } |
| 51 | |
| 52 | static inline int board_is_gp_evm(struct am335x_baseboard_id *header) |
| 53 | { |
| 54 | return !strncmp("A33515BB", header->name, HDR_NAME_LEN); |
| 55 | } |
| 56 | |
| 57 | static inline int board_is_evm_15_or_later(struct am335x_baseboard_id *header) |
| 58 | { |
| 59 | return (board_is_gp_evm(header) && |
| 60 | strncmp("1.5", header->version, 3) <= 0); |
| 61 | } |
| 62 | |
Peter Korsgaard | e363426 | 2012-10-18 01:21:09 +0000 | [diff] [blame] | 63 | /* |
| 64 | * We have three pin mux functions that must exist. We must be able to enable |
| 65 | * uart0, for initial output and i2c0 to read the main EEPROM. We then have a |
| 66 | * main pinmux function that can be overridden to enable all other pinmux that |
| 67 | * is required on the board. |
| 68 | */ |
| 69 | void enable_uart0_pin_mux(void); |
Andrew Bradford | 6422b70 | 2012-10-25 08:21:30 -0400 | [diff] [blame] | 70 | void enable_uart1_pin_mux(void); |
| 71 | void enable_uart2_pin_mux(void); |
| 72 | void enable_uart3_pin_mux(void); |
| 73 | void enable_uart4_pin_mux(void); |
| 74 | void enable_uart5_pin_mux(void); |
Peter Korsgaard | e363426 | 2012-10-18 01:21:09 +0000 | [diff] [blame] | 75 | void enable_i2c0_pin_mux(void); |
| 76 | void enable_board_pin_mux(struct am335x_baseboard_id *header); |
| 77 | #endif |