1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * SDHCI platform data initilisation file
4  *
5  * (C) Copyright 2016 Intel Corporation
6  * Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
7  */
8 
9 #include <linux/init.h>
10 #include <linux/pci.h>
11 
12 #include <linux/mmc/sdhci-pci-data.h>
13 
14 #include <asm/intel-mid.h>
15 
16 #define INTEL_MRFLD_SD			2
17 #define INTEL_MRFLD_SD_CD_GPIO		77
18 
19 static struct sdhci_pci_data mrfld_sdhci_pci_data = {
20 	.rst_n_gpio	= -EINVAL,
21 	.cd_gpio	= INTEL_MRFLD_SD_CD_GPIO,
22 };
23 
24 static struct sdhci_pci_data *
mrfld_sdhci_pci_get_data(struct pci_dev * pdev,int slotno)25 mrfld_sdhci_pci_get_data(struct pci_dev *pdev, int slotno)
26 {
27 	unsigned int func = PCI_FUNC(pdev->devfn);
28 
29 	if (func == INTEL_MRFLD_SD)
30 		return &mrfld_sdhci_pci_data;
31 
32 	return NULL;
33 }
34 
mrfld_sd_init(void)35 static int __init mrfld_sd_init(void)
36 {
37 	if (intel_mid_identify_cpu() != INTEL_MID_CPU_CHIP_TANGIER)
38 		return -ENODEV;
39 
40 	sdhci_pci_get_data = mrfld_sdhci_pci_get_data;
41 	return 0;
42 }
43 arch_initcall(mrfld_sd_init);
44