blob: 27186ad654c97846a42ef61f850d48affd602048 [file] [log] [blame]
Andy Shevchenkoe81e11b2016-07-05 03:14:50 +03001/*
2 * spidev platform data initilization file
3 *
4 * (C) Copyright 2014, 2016 Intel Corporation
5 * Authors: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
6 * Dan O'Donovan <dan@emutex.com>
7 *
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
11 * of the License.
12 */
13
Andy Shevchenkoefa22522017-01-02 11:24:50 +020014#include <linux/err.h>
Andy Shevchenkoe81e11b2016-07-05 03:14:50 +030015#include <linux/init.h>
16#include <linux/sfi.h>
17#include <linux/spi/pxa2xx_spi.h>
18#include <linux/spi/spi.h>
19
20#include <asm/intel-mid.h>
21
22#define MRFLD_SPI_DEFAULT_DMA_BURST 8
23#define MRFLD_SPI_DEFAULT_TIMEOUT 500
24
25/* GPIO pin for spidev chipselect */
26#define MRFLD_SPIDEV_GPIO_CS 111
27
28static 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,
32};
33
34static void __init *spidev_platform_data(void *info)
35{
36 struct spi_board_info *spi_info = info;
37
Andy Shevchenkoefa22522017-01-02 11:24:50 +020038 if (intel_mid_identify_cpu() != INTEL_MID_CPU_CHIP_TANGIER)
39 return ERR_PTR(-ENODEV);
40
Andy Shevchenkoe81e11b2016-07-05 03:14:50 +030041 spi_info->mode = SPI_MODE_0;
42 spi_info->controller_data = &spidev_spi_chip;
43
44 return NULL;
45}
46
47static const struct devs_id spidev_dev_id __initconst = {
48 .name = "spidev",
49 .type = SFI_DEV_TYPE_SPI,
50 .delay = 0,
51 .get_platform_data = &spidev_platform_data,
52};
53
54sfi_device(spidev_dev_id);