blob: 9a5db02c20a134465fd95bfd948fb78a3942637e [file] [log] [blame]
Channagoud Kadabi8fb2ab52015-06-02 16:19:24 -07001/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
Shashank Mittala635abf2012-03-28 18:11:43 -07002 *
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 Kadabiafd62bf2013-01-08 20:32:52 -080012 * * Neither the name of The Linux Fundation, Inc. nor the names of its
Shashank Mittala635abf2012-03-28 18:11:43 -070013 * 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 Jadi5c61a952012-05-04 17:05:35 -070030#ifndef __BOARD_H
31#define __BOARD_H
Shashank Mittala635abf2012-03-28 18:11:43 -070032
Channagoud Kadabibc0e47e2013-02-15 19:41:21 -080033#include <smem.h>
34
Neeti Desai465491e2012-07-31 12:53:35 -070035#define LINUX_MACHTYPE_UNKNOWN 0
Channagoud Kadabi867a8072013-02-08 13:03:34 -080036#define BOARD_SOC_VERSION2 0x20000
Channagoud Kadabibc0e47e2013-02-15 19:41:21 -080037#define MAX_PMIC_DEVICES SMEM_MAX_PMIC_DEVICES
38
39struct board_pmic_data {
40 uint32_t pmic_type;
41 uint32_t pmic_version;
Lijuan Gao9f152862014-08-18 13:45:24 +080042 uint32_t pmic_target;
Channagoud Kadabibc0e47e2013-02-15 19:41:21 -080043};
Shashank Mittala635abf2012-03-28 18:11:43 -070044
45struct board_data {
46 uint32_t platform;
Sundarajan Srinivasan763c0db2014-05-20 17:08:36 -070047 uint32_t foundry_id;
Sridhar Parasuramc5f035f2014-10-22 12:37:36 -070048 uint32_t chip_serial;
Channagoud Kadabiafd62bf2013-01-08 20:32:52 -080049 uint32_t platform_version;
Shashank Mittala635abf2012-03-28 18:11:43 -070050 uint32_t platform_hw;
51 uint32_t platform_subtype;
52 uint32_t target;
53 uint32_t baseband;
Channagoud Kadabibc0e47e2013-02-15 19:41:21 -080054 struct board_pmic_data pmic_info[MAX_PMIC_DEVICES];
Aparna Mallavarapu6eb30902014-05-13 17:03:10 +053055 uint32_t platform_hlos_subtype;
Sridhar Parasuram701c8302015-06-15 11:03:14 -070056 uint32_t num_pmics;
57 uint32_t pmic_array_offset;
58 struct board_pmic_data *pmic_info_array;
Shashank Mittala635abf2012-03-28 18:11:43 -070059};
60
61void board_init();
Amol Jadi5c61a952012-05-04 17:05:35 -070062void target_detect(struct board_data *);
63void target_baseband_detect(struct board_data *);
64uint32_t board_platform_id();
65uint32_t board_target_id();
66uint32_t board_baseband();
Neeti Desai465491e2012-07-31 12:53:35 -070067uint32_t board_hardware_id();
Channagoud Kadabibc0e47e2013-02-15 19:41:21 -080068uint8_t board_pmic_info(struct board_pmic_data *, uint8_t num_ent);
Channagoud Kadabi867a8072013-02-08 13:03:34 -080069uint32_t board_soc_version();
Joel Kingaa335dc2013-06-03 16:11:08 -070070uint32_t board_hardware_subtype(void);
Aparna Mallavarapu6eb30902014-05-13 17:03:10 +053071uint32_t board_get_ddr_subtype(void);
72uint32_t board_hlos_subtype(void);
Lijuan Gao9f152862014-08-18 13:45:24 +080073uint32_t board_pmic_target(uint8_t num_ent);
Sridhar Parasuramc5f035f2014-10-22 12:37:36 -070074uint32_t board_chip_serial(void);
Sridhar Parasuram701c8302015-06-15 11:03:14 -070075void pmic_info_populate();
Aparna Mallavarapu6eb30902014-05-13 17:03:10 +053076
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
87enum subtype_ddr {
88 SUBTYPE_512MB = 1,
89};
90
Sundarajan Srinivasan763c0db2014-05-20 17:08:36 -070091uint32_t board_foundry_id(void);
Channagoud Kadabi8fb2ab52015-06-02 16:19:24 -070092void board_update_boot_dev(uint32_t);
Channagoud Kadabi062d4832015-09-18 14:22:35 -070093bool board_pmic_type(uint32_t type);
Amol Jadi5c61a952012-05-04 17:05:35 -070094#endif