diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2016-07-04 20:14:50 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-07-08 05:15:34 -0400 |
commit | e81e11bc71573709352a5275e175a4b2ee1325e5 (patch) | |
tree | 1af54193709779ed4b418a908d2ac1fcc4e15bc3 | |
parent | ca22312dc840065206285626829ceed8bb4df88c (diff) |
x86/platform/intel-mid: Enable spidev on Intel Edison boards
Intel Edison board provides one of the SPI bus for user's connected devices.
Append platform data to get spidev enumerated over it.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Dan O'Donovan <dan@emutex.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1467677690-90007-1-git-send-email-andriy.shevchenko@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | arch/x86/platform/intel-mid/device_libs/Makefile | 2 | ||||
-rw-r--r-- | arch/x86/platform/intel-mid/device_libs/platform_spidev.c | 50 |
2 files changed, 52 insertions, 0 deletions
diff --git a/arch/x86/platform/intel-mid/device_libs/Makefile b/arch/x86/platform/intel-mid/device_libs/Makefile index 79e97ed5be5b..fc135bf70511 100644 --- a/arch/x86/platform/intel-mid/device_libs/Makefile +++ b/arch/x86/platform/intel-mid/device_libs/Makefile | |||
@@ -10,6 +10,8 @@ obj-$(subst m,y,$(CONFIG_MFD_INTEL_MSIC)) += platform_msic_battery.o | |||
10 | obj-$(subst m,y,$(CONFIG_INTEL_MID_POWER_BUTTON)) += platform_msic_power_btn.o | 10 | obj-$(subst m,y,$(CONFIG_INTEL_MID_POWER_BUTTON)) += platform_msic_power_btn.o |
11 | obj-$(subst m,y,$(CONFIG_GPIO_INTEL_PMIC)) += platform_pmic_gpio.o | 11 | obj-$(subst m,y,$(CONFIG_GPIO_INTEL_PMIC)) += platform_pmic_gpio.o |
12 | obj-$(subst m,y,$(CONFIG_INTEL_MFLD_THERMAL)) += platform_msic_thermal.o | 12 | obj-$(subst m,y,$(CONFIG_INTEL_MFLD_THERMAL)) += platform_msic_thermal.o |
13 | # SPI Devices | ||
14 | obj-$(subst m,y,$(CONFIG_SPI_SPIDEV)) += platform_spidev.o | ||
13 | # I2C Devices | 15 | # I2C Devices |
14 | obj-$(subst m,y,$(CONFIG_SENSORS_EMC1403)) += platform_emc1403.o | 16 | obj-$(subst m,y,$(CONFIG_SENSORS_EMC1403)) += platform_emc1403.o |
15 | obj-$(subst m,y,$(CONFIG_SENSORS_LIS3LV02D)) += platform_lis331.o | 17 | obj-$(subst m,y,$(CONFIG_SENSORS_LIS3LV02D)) += platform_lis331.o |
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_spidev.c b/arch/x86/platform/intel-mid/device_libs/platform_spidev.c new file mode 100644 index 000000000000..30c601b399ee --- /dev/null +++ b/arch/x86/platform/intel-mid/device_libs/platform_spidev.c | |||
@@ -0,0 +1,50 @@ | |||
1 | /* | ||
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 | |||
14 | #include <linux/init.h> | ||
15 | #include <linux/sfi.h> | ||
16 | #include <linux/spi/pxa2xx_spi.h> | ||
17 | #include <linux/spi/spi.h> | ||
18 | |||
19 | #include <asm/intel-mid.h> | ||
20 | |||
21 | #define MRFLD_SPI_DEFAULT_DMA_BURST 8 | ||
22 | #define MRFLD_SPI_DEFAULT_TIMEOUT 500 | ||
23 | |||
24 | /* GPIO pin for spidev chipselect */ | ||
25 | #define MRFLD_SPIDEV_GPIO_CS 111 | ||
26 | |||
27 | static struct pxa2xx_spi_chip spidev_spi_chip = { | ||
28 | .dma_burst_size = MRFLD_SPI_DEFAULT_DMA_BURST, | ||
29 | .timeout = MRFLD_SPI_DEFAULT_TIMEOUT, | ||
30 | .gpio_cs = MRFLD_SPIDEV_GPIO_CS, | ||
31 | }; | ||
32 | |||
33 | static void __init *spidev_platform_data(void *info) | ||
34 | { | ||
35 | struct spi_board_info *spi_info = info; | ||
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); | ||