Lokesh Vutla | faa680f | 2013-07-30 11:36:27 +0530 | [diff] [blame] | 1 | /* |
| 2 | * board.h |
| 3 | * |
| 4 | * TI AM437x boards information header |
| 5 | * Derived from AM335x board. |
| 6 | * |
| 7 | * Copyright (C) 2013, Texas Instruments, Incorporated - http://www.ti.com/ |
| 8 | * |
| 9 | * SPDX-License-Identifier: GPL-2.0+ |
| 10 | */ |
| 11 | |
| 12 | #ifndef _BOARD_H_ |
| 13 | #define _BOARD_H_ |
| 14 | |
Sekhar Nori | 2ab3c49 | 2013-12-10 15:02:15 +0530 | [diff] [blame] | 15 | #include <asm/arch/omap.h> |
| 16 | |
| 17 | static char *const am43xx_board_name = (char *)AM4372_BOARD_NAME_START; |
Franklin S. Cooper Jr | cc76fc4 | 2014-06-27 13:31:14 -0500 | [diff] [blame] | 18 | static char *const am43xx_board_rev = (char *)AM4372_BOARD_VERSION_START; |
Sekhar Nori | 2ab3c49 | 2013-12-10 15:02:15 +0530 | [diff] [blame] | 19 | |
| 20 | /* |
| 21 | * TI AM437x EVMs define a system EEPROM that defines certain sub-fields. |
| 22 | * We use these fields to in turn see what board we are on, and what |
| 23 | * that might require us to set or not set. |
| 24 | */ |
| 25 | #define HDR_NO_OF_MAC_ADDR 3 |
| 26 | #define HDR_ETH_ALEN 6 |
| 27 | #define HDR_NAME_LEN 8 |
| 28 | |
Lokesh Vutla | 42c213a | 2013-12-10 15:02:20 +0530 | [diff] [blame] | 29 | #define DEV_ATTR_MAX_OFFSET 5 |
| 30 | #define DEV_ATTR_MIN_OFFSET 0 |
| 31 | |
Sekhar Nori | 2ab3c49 | 2013-12-10 15:02:15 +0530 | [diff] [blame] | 32 | struct am43xx_board_id { |
| 33 | unsigned int magic; |
| 34 | char name[HDR_NAME_LEN]; |
| 35 | char version[4]; |
| 36 | char serial[12]; |
| 37 | char config[32]; |
| 38 | char mac_addr[HDR_NO_OF_MAC_ADDR][HDR_ETH_ALEN]; |
| 39 | }; |
| 40 | |
| 41 | static inline int board_is_eposevm(void) |
| 42 | { |
| 43 | return !strncmp(am43xx_board_name, "AM43EPOS", HDR_NAME_LEN); |
| 44 | } |
| 45 | |
| 46 | static inline int board_is_gpevm(void) |
| 47 | { |
| 48 | return !strncmp(am43xx_board_name, "AM43__GP", HDR_NAME_LEN); |
| 49 | } |
| 50 | |
Felipe Balbi | ccc6f84 | 2014-06-10 15:01:20 -0500 | [diff] [blame] | 51 | static inline int board_is_sk(void) |
| 52 | { |
| 53 | return !strncmp(am43xx_board_name, "AM43__SK", HDR_NAME_LEN); |
| 54 | } |
| 55 | |
Felipe Balbi | 3dcd6d8 | 2014-12-22 16:26:17 -0600 | [diff] [blame] | 56 | static inline int board_is_idk(void) |
| 57 | { |
| 58 | return !strncmp(am43xx_board_name, "AM43_IDK", HDR_NAME_LEN); |
| 59 | } |
| 60 | |
Franklin S. Cooper Jr | cc76fc4 | 2014-06-27 13:31:14 -0500 | [diff] [blame] | 61 | static inline int board_is_evm_14_or_later(void) |
| 62 | { |
| 63 | return (board_is_gpevm() && strncmp("1.4", am43xx_board_rev, 3) <= 0); |
| 64 | } |
| 65 | |
| 66 | static inline int board_is_evm_12_or_later(void) |
| 67 | { |
| 68 | return (board_is_gpevm() && strncmp("1.2", am43xx_board_rev, 3) <= 0); |
| 69 | } |
| 70 | |
Lokesh Vutla | faa680f | 2013-07-30 11:36:27 +0530 | [diff] [blame] | 71 | void enable_uart0_pin_mux(void); |
| 72 | void enable_board_pin_mux(void); |
Lokesh Vutla | 42c213a | 2013-12-10 15:02:20 +0530 | [diff] [blame] | 73 | void enable_i2c0_pin_mux(void); |
Lokesh Vutla | faa680f | 2013-07-30 11:36:27 +0530 | [diff] [blame] | 74 | #endif |