Channagoud Kadabi | 8fb2ab5 | 2015-06-02 16:19:24 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved. |
Shashank Mittal | a635abf | 2012-03-28 18:11:43 -0700 | [diff] [blame] | 2 | * |
| 3 | * Redistribution and use in source and binary forms, with or without |
| 4 | * modification, are permitted provided that the following conditions are |
| 5 | * met: |
| 6 | * * Redistributions of source code must retain the above copyright |
| 7 | * notice, this list of conditions and the following disclaimer. |
| 8 | * * Redistributions in binary form must reproduce the above |
| 9 | * copyright notice, this list of conditions and the following |
| 10 | * disclaimer in the documentation and/or other materials provided |
| 11 | * with the distribution. |
Channagoud Kadabi | afd62bf | 2013-01-08 20:32:52 -0800 | [diff] [blame] | 12 | * * Neither the name of The Linux Fundation, Inc. nor the names of its |
Shashank Mittal | a635abf | 2012-03-28 18:11:43 -0700 | [diff] [blame] | 13 | * contributors may be used to endorse or promote products derived |
| 14 | * from this software without specific prior written permission. |
| 15 | * |
| 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED |
| 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS |
| 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
| 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
| 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
| 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | * |
| 28 | */ |
| 29 | |
Amol Jadi | 5c61a95 | 2012-05-04 17:05:35 -0700 | [diff] [blame] | 30 | #ifndef __BOARD_H |
| 31 | #define __BOARD_H |
Shashank Mittal | a635abf | 2012-03-28 18:11:43 -0700 | [diff] [blame] | 32 | |
Channagoud Kadabi | bc0e47e | 2013-02-15 19:41:21 -0800 | [diff] [blame] | 33 | #include <smem.h> |
| 34 | |
Neeti Desai | 465491e | 2012-07-31 12:53:35 -0700 | [diff] [blame] | 35 | #define LINUX_MACHTYPE_UNKNOWN 0 |
Channagoud Kadabi | 867a807 | 2013-02-08 13:03:34 -0800 | [diff] [blame] | 36 | #define BOARD_SOC_VERSION2 0x20000 |
Channagoud Kadabi | bc0e47e | 2013-02-15 19:41:21 -0800 | [diff] [blame] | 37 | #define MAX_PMIC_DEVICES SMEM_MAX_PMIC_DEVICES |
| 38 | |
| 39 | struct board_pmic_data { |
| 40 | uint32_t pmic_type; |
| 41 | uint32_t pmic_version; |
Lijuan Gao | 9f15286 | 2014-08-18 13:45:24 +0800 | [diff] [blame] | 42 | uint32_t pmic_target; |
Channagoud Kadabi | bc0e47e | 2013-02-15 19:41:21 -0800 | [diff] [blame] | 43 | }; |
Shashank Mittal | a635abf | 2012-03-28 18:11:43 -0700 | [diff] [blame] | 44 | |
| 45 | struct board_data { |
| 46 | uint32_t platform; |
Sundarajan Srinivasan | 763c0db | 2014-05-20 17:08:36 -0700 | [diff] [blame] | 47 | uint32_t foundry_id; |
Sridhar Parasuram | c5f035f | 2014-10-22 12:37:36 -0700 | [diff] [blame] | 48 | uint32_t chip_serial; |
Channagoud Kadabi | afd62bf | 2013-01-08 20:32:52 -0800 | [diff] [blame] | 49 | uint32_t platform_version; |
Shashank Mittal | a635abf | 2012-03-28 18:11:43 -0700 | [diff] [blame] | 50 | uint32_t platform_hw; |
| 51 | uint32_t platform_subtype; |
| 52 | uint32_t target; |
| 53 | uint32_t baseband; |
Channagoud Kadabi | bc0e47e | 2013-02-15 19:41:21 -0800 | [diff] [blame] | 54 | struct board_pmic_data pmic_info[MAX_PMIC_DEVICES]; |
Aparna Mallavarapu | 6eb3090 | 2014-05-13 17:03:10 +0530 | [diff] [blame] | 55 | uint32_t platform_hlos_subtype; |
Sridhar Parasuram | 701c830 | 2015-06-15 11:03:14 -0700 | [diff] [blame] | 56 | uint32_t num_pmics; |
| 57 | uint32_t pmic_array_offset; |
| 58 | struct board_pmic_data *pmic_info_array; |
Shashank Mittal | a635abf | 2012-03-28 18:11:43 -0700 | [diff] [blame] | 59 | }; |
| 60 | |
| 61 | void board_init(); |
Amol Jadi | 5c61a95 | 2012-05-04 17:05:35 -0700 | [diff] [blame] | 62 | void target_detect(struct board_data *); |
| 63 | void target_baseband_detect(struct board_data *); |
| 64 | uint32_t board_platform_id(); |
| 65 | uint32_t board_target_id(); |
| 66 | uint32_t board_baseband(); |
Neeti Desai | 465491e | 2012-07-31 12:53:35 -0700 | [diff] [blame] | 67 | uint32_t board_hardware_id(); |
Channagoud Kadabi | bc0e47e | 2013-02-15 19:41:21 -0800 | [diff] [blame] | 68 | uint8_t board_pmic_info(struct board_pmic_data *, uint8_t num_ent); |
Channagoud Kadabi | 867a807 | 2013-02-08 13:03:34 -0800 | [diff] [blame] | 69 | uint32_t board_soc_version(); |
Joel King | aa335dc | 2013-06-03 16:11:08 -0700 | [diff] [blame] | 70 | uint32_t board_hardware_subtype(void); |
Aparna Mallavarapu | 6eb3090 | 2014-05-13 17:03:10 +0530 | [diff] [blame] | 71 | uint32_t board_get_ddr_subtype(void); |
| 72 | uint32_t board_hlos_subtype(void); |
Lijuan Gao | 9f15286 | 2014-08-18 13:45:24 +0800 | [diff] [blame] | 73 | uint32_t board_pmic_target(uint8_t num_ent); |
Sridhar Parasuram | c5f035f | 2014-10-22 12:37:36 -0700 | [diff] [blame] | 74 | uint32_t board_chip_serial(void); |
Sridhar Parasuram | 701c830 | 2015-06-15 11:03:14 -0700 | [diff] [blame] | 75 | void pmic_info_populate(); |
Aparna Mallavarapu | 6eb3090 | 2014-05-13 17:03:10 +0530 | [diff] [blame] | 76 | |
| 77 | /* DDR Subtype Macros |
| 78 | * Determine the DDR Size on the device and define |
| 79 | * the below subtype enums based on the DDR size. |
| 80 | * These defines are matched with that of the DT |
| 81 | * subtype |
| 82 | */ |
| 83 | |
| 84 | #define MB (1024 * 1024) |
| 85 | #define DDR_512MB (512 * MB) |
| 86 | |
| 87 | enum subtype_ddr { |
| 88 | SUBTYPE_512MB = 1, |
| 89 | }; |
| 90 | |
Sundarajan Srinivasan | 763c0db | 2014-05-20 17:08:36 -0700 | [diff] [blame] | 91 | uint32_t board_foundry_id(void); |
Channagoud Kadabi | 8fb2ab5 | 2015-06-02 16:19:24 -0700 | [diff] [blame] | 92 | void board_update_boot_dev(uint32_t); |
Channagoud Kadabi | 062d483 | 2015-09-18 14:22:35 -0700 | [diff] [blame] | 93 | bool board_pmic_type(uint32_t type); |
Amol Jadi | 5c61a95 | 2012-05-04 17:05:35 -0700 | [diff] [blame] | 94 | #endif |