]> git.ipfire.org Git - thirdparty/u-boot.git/blame - board/compulab/cl-som-imx7/common.c
Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""
[thirdparty/u-boot.git] / board / compulab / cl-som-imx7 / common.c
CommitLineData
83d290c5 1// SPDX-License-Identifier: GPL-2.0+
6963204c
IL
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>
6963204c
IL
8 */
9
d678a59d 10#include <common.h>
e37ac717 11#include <fsl_esdhc_imx.h>
6963204c
IL
12#include <asm-generic/gpio.h>
13#include "common.h"
14
15#ifdef CONFIG_SPI
16
17#define CL_SOM_IMX7_GPIO_SPI_CS IMX_GPIO_NR(4, 19)
18
19int board_spi_cs_gpio(unsigned int bus, unsigned int cs)
20{
21 return CL_SOM_IMX7_GPIO_SPI_CS;
22}
23
24#endif /* CONFIG_SPI */
25
e37ac717 26#ifdef CONFIG_FSL_ESDHC_IMX
6963204c
IL
27
28int board_mmc_getcd(struct mmc *mmc)
29{
30 struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
31 int ret = 0;
32
33 switch (cfg->esdhc_base) {
34 case USDHC1_BASE_ADDR:
35 ret = !gpio_get_value(CL_SOM_IMX7_GPIO_USDHC1_CD);
36 break;
37 case USDHC3_BASE_ADDR:
38 ret = 1; /* Assume uSDHC3 emmc is always present */
39 break;
40 }
41
42 return ret;
43}
44
e37ac717 45#endif /* CONFIG_FSL_ESDHC_IMX */