From 1c552ba8e5022a40024d2eaf2d4fc3a370c058dd Mon Sep 17 00:00:00 2001 From: Gabor Juhos Date: Sun, 27 May 2012 17:10:00 +0000 Subject: [PATCH] ramips: rt3883: add device registration code for the SPI controller SVN-Revision: 31922 --- .../files/arch/mips/ralink/rt3883/devices.c | 23 +++++++++++++++++++ .../files/arch/mips/ralink/rt3883/devices.h | 3 +++ 2 files changed, 26 insertions(+) diff --git a/target/linux/ramips/files/arch/mips/ralink/rt3883/devices.c b/target/linux/ramips/files/arch/mips/ralink/rt3883/devices.c index 8d394bb62e..c9863ab39b 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt3883/devices.c +++ b/target/linux/ramips/files/arch/mips/ralink/rt3883/devices.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -378,3 +379,25 @@ void __init rt3883_register_nand(void) { platform_device_register(&rt3883_nand_device); } + +static struct resource rt3883_spi_resources[] = { + { + .flags = IORESOURCE_MEM, + .start = RT3883_SPI_BASE, + .end = RT3883_SPI_BASE + RT3883_SPI_SIZE - 1, + }, +}; + +static struct platform_device rt3883_spi_device = { + .name = "ramips-spi", + .id = 0, + .resource = rt3883_spi_resources, + .num_resources = ARRAY_SIZE(rt3883_spi_resources), +}; + +void __init rt3883_register_spi(struct spi_board_info *info, int n) +{ + spi_register_board_info(info, n); + platform_device_register(&rt3883_spi_device); +} + diff --git a/target/linux/ramips/files/arch/mips/ralink/rt3883/devices.h b/target/linux/ramips/files/arch/mips/ralink/rt3883/devices.h index bbddc7e9c2..808bcb2d36 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt3883/devices.h +++ b/target/linux/ramips/files/arch/mips/ralink/rt3883/devices.h @@ -12,6 +12,7 @@ #define _RT3883_DEVICES_H struct physmap_flash_data; +struct spi_board_info; extern struct physmap_flash_data rt3883_flash0_data; extern struct physmap_flash_data rt3883_flash1_data; @@ -28,4 +29,6 @@ extern struct rt2x00_platform_data rt3883_wlan_data; void rt3883_register_wlan(void); void rt3883_register_wdt(bool enable_reset); +void rt3883_register_spi(struct spi_board_info *info, int n); + #endif /* _RT3883_DEVICES_H */ -- 2.30.2