Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Ilya Ledvich | 38a53c6 | 2017-09-24 09:00:25 +0300 | [diff] [blame] | 2 | /* |
| 3 | * SPL/U-Boot common functions for CompuLab CL-SOM-iMX7 module |
| 4 | * |
| 5 | * (C) Copyright 2017 CompuLab, Ltd. http://www.compulab.com |
| 6 | * |
| 7 | * Author: Uri Mashiach <uri.mashiach@compulab.co.il> |
Ilya Ledvich | 38a53c6 | 2017-09-24 09:00:25 +0300 | [diff] [blame] | 8 | */ |
| 9 | |
Yangbo Lu | 7334038 | 2019-06-21 11:42:28 +0800 | [diff] [blame] | 10 | #include <fsl_esdhc_imx.h> |
Ilya Ledvich | 38a53c6 | 2017-09-24 09:00:25 +0300 | [diff] [blame] | 11 | #include <asm-generic/gpio.h> |
| 12 | #include "common.h" |
| 13 | |
| 14 | #ifdef CONFIG_SPI |
| 15 | |
| 16 | #define CL_SOM_IMX7_GPIO_SPI_CS IMX_GPIO_NR(4, 19) |
| 17 | |
| 18 | int board_spi_cs_gpio(unsigned int bus, unsigned int cs) |
| 19 | { |
| 20 | return CL_SOM_IMX7_GPIO_SPI_CS; |
| 21 | } |
| 22 | |
| 23 | #endif /* CONFIG_SPI */ |
| 24 | |
Yangbo Lu | 7334038 | 2019-06-21 11:42:28 +0800 | [diff] [blame] | 25 | #ifdef CONFIG_FSL_ESDHC_IMX |
Ilya Ledvich | 38a53c6 | 2017-09-24 09:00:25 +0300 | [diff] [blame] | 26 | |
| 27 | int board_mmc_getcd(struct mmc *mmc) |
| 28 | { |
| 29 | struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv; |
| 30 | int ret = 0; |
| 31 | |
| 32 | switch (cfg->esdhc_base) { |
| 33 | case USDHC1_BASE_ADDR: |
| 34 | ret = !gpio_get_value(CL_SOM_IMX7_GPIO_USDHC1_CD); |
| 35 | break; |
| 36 | case USDHC3_BASE_ADDR: |
| 37 | ret = 1; /* Assume uSDHC3 emmc is always present */ |
| 38 | break; |
| 39 | } |
| 40 | |
| 41 | return ret; |
| 42 | } |
| 43 | |
Yangbo Lu | 7334038 | 2019-06-21 11:42:28 +0800 | [diff] [blame] | 44 | #endif /* CONFIG_FSL_ESDHC_IMX */ |