Glenn Stroz | 99291c2 | 2016-07-18 11:27:37 -0700 | [diff] [blame^] | 1 | /* Copyright (c) 2014,2016 The Linux Foundation. All rights reserved. |
Sundarajan Srinivasan | 34bbe07 | 2014-03-21 17:27:16 -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. |
| 12 | * * Neither the name of The Linux Foundation. nor the names of its |
| 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 | #ifndef __BOOT_DEVICE_H |
| 30 | #define __BOOT_DEVICE_H |
| 31 | |
| 32 | #include <sys/types.h> |
Unnati Gandhi | f37b362 | 2014-11-18 18:02:45 +0530 | [diff] [blame] | 33 | #include <platform.h> |
Sundarajan Srinivasan | 34bbe07 | 2014-03-21 17:27:16 -0700 | [diff] [blame] | 34 | |
Channagoud Kadabi | c42ea32 | 2014-10-10 12:26:54 -0700 | [diff] [blame] | 35 | #if USE_MDM_BOOT_CFG |
| 36 | #define BOOT_DEVICE_MASK(val) ((val & 0x1E) >> 1) |
| 37 | #else |
Unnati Gandhi | f37b362 | 2014-11-18 18:02:45 +0530 | [diff] [blame] | 38 | #define BOOT_DEVICE_MASK(val) boot_device_mask(val) |
Channagoud Kadabi | c42ea32 | 2014-10-10 12:26:54 -0700 | [diff] [blame] | 39 | #endif |
Sundarajan Srinivasan | 34bbe07 | 2014-03-21 17:27:16 -0700 | [diff] [blame] | 40 | |
| 41 | /* Boot device */ |
Channagoud Kadabi | c42ea32 | 2014-10-10 12:26:54 -0700 | [diff] [blame] | 42 | #if USE_MDM_BOOT_CFG |
Sundarajan Srinivasan | 34bbe07 | 2014-03-21 17:27:16 -0700 | [diff] [blame] | 43 | enum boot_device |
| 44 | { |
Channagoud Kadabi | c42ea32 | 2014-10-10 12:26:54 -0700 | [diff] [blame] | 45 | BOOT_DEFAULT=0, /* NAND */ |
| 46 | BOOT_EMMC=3, |
| 47 | }; |
| 48 | #else |
| 49 | enum boot_device |
| 50 | { |
| 51 | BOOT_DEFAULT=0, /* EMMC */ |
Sundarajan Srinivasan | 34bbe07 | 2014-03-21 17:27:16 -0700 | [diff] [blame] | 52 | BOOT_EMMC=2, |
| 53 | BOOT_UFS=4, |
Glenn Stroz | 99291c2 | 2016-07-18 11:27:37 -0700 | [diff] [blame^] | 54 | BOOT_SD_ELSE_UFS=5, |
Sundarajan Srinivasan | 34bbe07 | 2014-03-21 17:27:16 -0700 | [diff] [blame] | 55 | }; |
Channagoud Kadabi | c42ea32 | 2014-10-10 12:26:54 -0700 | [diff] [blame] | 56 | #endif |
Sundarajan Srinivasan | 34bbe07 | 2014-03-21 17:27:16 -0700 | [diff] [blame] | 57 | |
| 58 | void platform_read_boot_config(); |
| 59 | uint32_t platform_get_boot_dev(); |
| 60 | uint32_t platform_boot_dev_isemmc(); |
| 61 | void platform_boot_dev_cmdline(char *buf); |
Veera Sundaram Sankaran | 0018151 | 2014-12-09 11:23:39 -0800 | [diff] [blame] | 62 | |
| 63 | void *target_mmc_device(); |
Sundarajan Srinivasan | 34bbe07 | 2014-03-21 17:27:16 -0700 | [diff] [blame] | 64 | #endif |