* adds spi driver, thx daniel

SVN-Revision: 26355
This commit is contained in:
John Crispin 2011-03-29 07:10:50 +00:00
parent ff885fde8e
commit 628a47642c
4 changed files with 1218 additions and 0 deletions

View file

@ -0,0 +1,44 @@
From: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>
Date: Thu, 3 Mar 2011 17:15:58 +0000 (+0100)
Subject: MIPS: lantiq: Add platform data for Lantiq SoC SPI controller driver
X-Git-Url: http://nbd.name/gitweb.cgi?p=lantiq.git;a=commitdiff_plain;h=3d21b04682ae8eb1c1965aba39d1796e8c5ad84b;hp=06b420500fe98e37662837e78d8e51aead8aea81
MIPS: lantiq: Add platform data for Lantiq SoC SPI controller driver
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>
---
--- a/arch/mips/include/asm/mach-lantiq/lantiq_platform.h
+++ b/arch/mips/include/asm/mach-lantiq/lantiq_platform.h
@@ -48,4 +48,13 @@
extern int (*lqpci_plat_dev_init)(struct pci_dev *dev);
+
+struct lq_spi_platform_data {
+ u16 num_chipselect;
+};
+
+struct lq_spi_controller_data {
+ unsigned gpio;
+};
+
#endif
--- a/arch/mips/include/asm/mach-lantiq/xway/xway.h
+++ b/arch/mips/include/asm/mach-lantiq/xway/xway.h
@@ -72,6 +72,7 @@
#define LQ_PMU_BASE_ADDR (KSEG1 + 0x1F102000)
#define PMU_DMA 0x0020
+#define PMU_SPI 0x0100
#define PMU_USB 0x8041
#define PMU_LED 0x0800
#define PMU_GPT 0x1000
@@ -105,6 +106,7 @@
/*------------ SSC */
#define LQ_SSC_BASE_ADDR (KSEG1 + 0x1e100800)
+#define LQ_SSC_SIZE 0x100
/*------------ MEI */
#define LQ_MEI_BASE_ADDR (KSEG1 + 0x1E116000)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,66 @@
From: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>
Date: Thu, 3 Mar 2011 20:42:26 +0000 (+0100)
Subject: MIPS: lantiq: Add device register helper for SPI controller and devices
X-Git-Url: http://nbd.name/gitweb.cgi?p=lantiq.git;a=commitdiff_plain;h=b35b07062b718ece9b9cb7b23b12d83a087eafb0;hp=653c95b8b9066c9c6ac08bd64d0ceee439e9fd90
MIPS: lantiq: Add device register helper for SPI controller and devices
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>
---
--- a/arch/mips/lantiq/xway/devices.c
+++ b/arch/mips/lantiq/xway/devices.c
@@ -22,6 +22,7 @@
#include <linux/gpio.h>
#include <linux/gpio_buttons.h>
#include <linux/leds.h>
+#include <linux/spi/spi.h>
#include <asm/bootinfo.h>
#include <asm/irq.h>
@@ -332,5 +333,27 @@
lantiq_emulate_madwifi_eep = 1;
}
+static struct resource lq_spi_resources[] = {
+ {
+ .start = LQ_SSC_BASE_ADDR,
+ .end = LQ_SSC_BASE_ADDR + LQ_SSC_SIZE - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ IRQ_RES(spi_tx, LQ_SSC_TIR),
+ IRQ_RES(spi_rx, LQ_SSC_RIR),
+ IRQ_RES(spi_err, LQ_SSC_EIR),
+};
+static struct platform_device lq_spi = {
+ .name = "ltq-spi",
+ .resource = lq_spi_resources,
+ .num_resources = ARRAY_SIZE(lq_spi_resources),
+};
+void __init lq_register_spi(struct lq_spi_platform_data *pdata,
+ struct spi_board_info const *info, unsigned n)
+{
+ spi_register_board_info(info, n);
+ lq_spi.dev.platform_data = pdata;
+ platform_device_register(&lq_spi);
+}
--- a/arch/mips/lantiq/xway/devices.h
+++ b/arch/mips/lantiq/xway/devices.h
@@ -11,6 +11,7 @@
#include <lantiq_platform.h>
#include <xway_irq.h>
+#include <linux/spi/spi.h>
extern void __init lq_register_gpio(void);
extern void __init lq_register_gpio_stp(void);
@@ -25,5 +26,7 @@
extern void __init lq_register_asc(int port);
extern void __init lq_register_gpio_buttons(struct gpio_button *buttons, int cnt);
extern void __init lq_register_crypto(const char *name);
+extern void lq_register_spi(struct lq_spi_platform_data *pdata,
+ struct spi_board_info const *info, unsigned n);
#endif

View file

@ -19,4 +19,9 @@ CONFIG_LANTIQ_PROM_ASC1=y
CONFIG_RTL8306_PHY=y CONFIG_RTL8306_PHY=y
# CONFIG_SOC_LANTIQ_FALCON is not set # CONFIG_SOC_LANTIQ_FALCON is not set
CONFIG_SOC_LANTIQ_XWAY=y CONFIG_SOC_LANTIQ_XWAY=y
CONFIG_SPI=y
CONFIG_SPI_BITBANG=y
# CONFIG_SPI_GPIO is not set
CONFIG_SPI_LANTIQ=y
CONFIG_SPI_MASTER=y
CONFIG_USB_SUPPORT=y CONFIG_USB_SUPPORT=y