2 * spidev platform data initilization file
4 * (C) Copyright 2014, 2016 Intel Corporation
5 * Authors: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
6 * Dan O'Donovan <dan@emutex.com>
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; version 2
14 #include <linux/err.h>
15 #include <linux/init.h>
16 #include <linux/sfi.h>
17 #include <linux/spi/pxa2xx_spi.h>
18 #include <linux/spi/spi.h>
20 #include <asm/intel-mid.h>
22 #define MRFLD_SPI_DEFAULT_DMA_BURST 8
23 #define MRFLD_SPI_DEFAULT_TIMEOUT 500
25 /* GPIO pin for spidev chipselect */
26 #define MRFLD_SPIDEV_GPIO_CS 111
28 static struct pxa2xx_spi_chip spidev_spi_chip = {
29 .dma_burst_size = MRFLD_SPI_DEFAULT_DMA_BURST,
30 .timeout = MRFLD_SPI_DEFAULT_TIMEOUT,
31 .gpio_cs = MRFLD_SPIDEV_GPIO_CS,
34 static void __init *spidev_platform_data(void *info)
36 struct spi_board_info *spi_info = info;
38 if (intel_mid_identify_cpu() != INTEL_MID_CPU_CHIP_TANGIER)
39 return ERR_PTR(-ENODEV);
41 spi_info->mode = SPI_MODE_0;
42 spi_info->controller_data = &spidev_spi_chip;
47 static const struct devs_id spidev_dev_id __initconst = {
49 .type = SFI_DEV_TYPE_SPI,
51 .get_platform_data = &spidev_platform_data,
54 sfi_device(spidev_dev_id);