Skip to content

Commit

Permalink
ramips: rt3883: add device registration code for the SPI controller
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@31922 3c298f89-4303-0410-b956-a3cf2f4a3e73
  • Loading branch information
juhosg committed May 27, 2012
1 parent 84b3423 commit 75c71fc
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
23 changes: 23 additions & 0 deletions target/linux/ramips/files/arch/mips/ralink/rt3883/devices.c
Expand Up @@ -14,6 +14,7 @@
#include <linux/mtd/physmap.h>
#include <linux/mtd/partitions.h>
#include <linux/dma-mapping.h>
#include <linux/spi/spi.h>
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/clk.h>
Expand Down Expand Up @@ -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);
}

3 changes: 3 additions & 0 deletions target/linux/ramips/files/arch/mips/ralink/rt3883/devices.h
Expand Up @@ -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;
Expand All @@ -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 */

0 comments on commit 75c71fc

Please sign in to comment.