root/arch/x86/platform/intel-mid/device_libs/platform_mrfld_spidev.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. spidev_platform_data

   1 // SPDX-License-Identifier: GPL-2.0-only
   2 /*
   3  * spidev platform data initialization file
   4  *
   5  * (C) Copyright 2014, 2016 Intel Corporation
   6  * Authors: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
   7  *          Dan O'Donovan <dan@emutex.com>
   8  */
   9 
  10 #include <linux/err.h>
  11 #include <linux/init.h>
  12 #include <linux/sfi.h>
  13 #include <linux/spi/pxa2xx_spi.h>
  14 #include <linux/spi/spi.h>
  15 
  16 #include <asm/intel-mid.h>
  17 
  18 #define MRFLD_SPI_DEFAULT_DMA_BURST     8
  19 #define MRFLD_SPI_DEFAULT_TIMEOUT       500
  20 
  21 /* GPIO pin for spidev chipselect */
  22 #define MRFLD_SPIDEV_GPIO_CS            111
  23 
  24 static struct pxa2xx_spi_chip spidev_spi_chip = {
  25         .dma_burst_size         = MRFLD_SPI_DEFAULT_DMA_BURST,
  26         .timeout                = MRFLD_SPI_DEFAULT_TIMEOUT,
  27         .gpio_cs                = MRFLD_SPIDEV_GPIO_CS,
  28 };
  29 
  30 static void __init *spidev_platform_data(void *info)
  31 {
  32         struct spi_board_info *spi_info = info;
  33 
  34         if (intel_mid_identify_cpu() != INTEL_MID_CPU_CHIP_TANGIER)
  35                 return ERR_PTR(-ENODEV);
  36 
  37         spi_info->mode = SPI_MODE_0;
  38         spi_info->controller_data = &spidev_spi_chip;
  39 
  40         return NULL;
  41 }
  42 
  43 static const struct devs_id spidev_dev_id __initconst = {
  44         .name                   = "spidev",
  45         .type                   = SFI_DEV_TYPE_SPI,
  46         .delay                  = 0,
  47         .get_platform_data      = &spidev_platform_data,
  48 };
  49 
  50 sfi_device(spidev_dev_id);

/* [<][>][^][v][top][bottom][index][help] */