ssb: Update the GPIO API

SVN-Revision: 10495
owl
Michael Büsch 2008-02-19 13:52:57 +00:00
parent 27e288859c
commit 66dec6d8a1
6 changed files with 217 additions and 245 deletions

View File

@ -53,6 +53,15 @@ static inline u32 gpio_intpolarity(u32 mask, u32 value)
gpio_op(polarity, mask, value);
}
static inline u32 __ssb_write32_masked(struct ssb_device *dev, u16 offset,
u32 mask, u32 value)
{
value &= mask;
value |= ssb_read32(dev, offset) & ~mask;
ssb_write32(dev, offset, value);
return value;
}
static void gpio_set_irqenable(int enabled, irqreturn_t (*handler)(int, void *))
{
int irq;
@ -71,7 +80,7 @@ static void gpio_set_irqenable(int enabled, irqreturn_t (*handler)(int, void *))
}
if (ssb.chipco.dev)
ssb_write32_masked(ssb.chipco.dev, SSB_CHIPCO_IRQMASK, SSB_CHIPCO_IRQ_GPIO, (enabled ? SSB_CHIPCO_IRQ_GPIO : 0));
__ssb_write32_masked(ssb.chipco.dev, SSB_CHIPCO_IRQMASK, SSB_CHIPCO_IRQ_GPIO, (enabled ? SSB_CHIPCO_IRQ_GPIO : 0));
}
#else

View File

@ -0,0 +1,160 @@
Index: linux-2.6.23.16/drivers/ssb/driver_chipcommon.c
===================================================================
--- linux-2.6.23.16.orig/drivers/ssb/driver_chipcommon.c 2008-02-19 14:37:06.000000000 +0100
+++ linux-2.6.23.16/drivers/ssb/driver_chipcommon.c 2008-02-19 14:37:08.000000000 +0100
@@ -39,12 +39,14 @@ static inline void chipco_write32(struct
ssb_write32(cc->dev, offset, value);
}
-static inline void chipco_write32_masked(struct ssb_chipcommon *cc, u16 offset,
- u32 mask, u32 value)
+static inline u32 chipco_write32_masked(struct ssb_chipcommon *cc, u16 offset,
+ u32 mask, u32 value)
{
value &= mask;
value |= chipco_read32(cc, offset) & ~mask;
chipco_write32(cc, offset, value);
+
+ return value;
}
void ssb_chipco_set_clockmode(struct ssb_chipcommon *cc,
@@ -355,16 +357,37 @@ u32 ssb_chipco_gpio_in(struct ssb_chipco
{
return chipco_read32(cc, SSB_CHIPCO_GPIOIN) & mask;
}
+EXPORT_SYMBOL(ssb_chipco_gpio_in);
+
+u32 ssb_chipco_gpio_out(struct ssb_chipcommon *cc, u32 mask, u32 value)
+{
+ return chipco_write32_masked(cc, SSB_CHIPCO_GPIOOUT, mask, value);
+}
+EXPORT_SYMBOL(ssb_chipco_gpio_out);
+
+u32 ssb_chipco_gpio_outen(struct ssb_chipcommon *cc, u32 mask, u32 value)
+{
+ return chipco_write32_masked(cc, SSB_CHIPCO_GPIOOUTEN, mask, value);
+}
+EXPORT_SYMBOL(ssb_chipco_gpio_outen);
+
+u32 ssb_chipco_gpio_control(struct ssb_chipcommon *cc, u32 mask, u32 value)
+{
+ return chipco_write32_masked(cc, SSB_CHIPCO_GPIOCTL, mask, value);
+}
+EXPORT_SYMBOL(ssb_chipco_gpio_control);
-void ssb_chipco_gpio_out(struct ssb_chipcommon *cc, u32 mask, u32 value)
+u32 ssb_chipco_gpio_intmask(struct ssb_chipcommon *cc, u32 mask, u32 value)
{
- chipco_write32_masked(cc, SSB_CHIPCO_GPIOOUT, mask, value);
+ return chipco_write32_masked(cc, SSB_CHIPCO_GPIOIRQ, mask, value);
}
+EXPORT_SYMBOL(ssb_chipco_gpio_intmask);
-void ssb_chipco_gpio_outen(struct ssb_chipcommon *cc, u32 mask, u32 value)
+u32 ssb_chipco_gpio_polarity(struct ssb_chipcommon *cc, u32 mask, u32 value)
{
- chipco_write32_masked(cc, SSB_CHIPCO_GPIOOUTEN, mask, value);
+ return chipco_write32_masked(cc, SSB_CHIPCO_GPIOPOL, mask, value);
}
+EXPORT_SYMBOL(ssb_chipco_gpio_polarity);
#ifdef CONFIG_SSB_SERIAL
int ssb_chipco_serial_init(struct ssb_chipcommon *cc,
Index: linux-2.6.23.16/drivers/ssb/driver_extif.c
===================================================================
--- linux-2.6.23.16.orig/drivers/ssb/driver_extif.c 2008-02-19 14:37:06.000000000 +0100
+++ linux-2.6.23.16/drivers/ssb/driver_extif.c 2008-02-19 14:37:08.000000000 +0100
@@ -27,12 +27,14 @@ static inline void extif_write32(struct
ssb_write32(extif->dev, offset, value);
}
-static inline void extif_write32_masked(struct ssb_extif *extif, u16 offset,
- u32 mask, u32 value)
+static inline u32 extif_write32_masked(struct ssb_extif *extif, u16 offset,
+ u32 mask, u32 value)
{
value &= mask;
value |= extif_read32(extif, offset) & ~mask;
extif_write32(extif, offset, value);
+
+ return value;
}
#ifdef CONFIG_SSB_SERIAL
@@ -114,16 +116,30 @@ u32 ssb_extif_gpio_in(struct ssb_extif *
{
return extif_read32(extif, SSB_EXTIF_GPIO_IN) & mask;
}
+EXPORT_SYMBOL(ssb_extif_gpio_in);
-void ssb_extif_gpio_out(struct ssb_extif *extif, u32 mask, u32 value)
+u32 ssb_extif_gpio_out(struct ssb_extif *extif, u32 mask, u32 value)
{
return extif_write32_masked(extif, SSB_EXTIF_GPIO_OUT(0),
mask, value);
}
+EXPORT_SYMBOL(ssb_extif_gpio_out);
-void ssb_extif_gpio_outen(struct ssb_extif *extif, u32 mask, u32 value)
+u32 ssb_extif_gpio_outen(struct ssb_extif *extif, u32 mask, u32 value)
{
return extif_write32_masked(extif, SSB_EXTIF_GPIO_OUTEN(0),
mask, value);
}
+EXPORT_SYMBOL(ssb_extif_gpio_outen);
+
+u32 ssb_extif_gpio_polarity(struct ssb_extif *extif, u32 mask, u32 value)
+{
+ return extif_write32_masked(extif, SSB_EXTIF_GPIO_INTPOL, mask, value);
+}
+EXPORT_SYMBOL(ssb_extif_gpio_polarity);
+u32 ssb_extif_gpio_intmask(struct ssb_extif *extif, u32 mask, u32 value)
+{
+ return extif_write32_masked(extif, SSB_EXTIF_GPIO_INTMASK, mask, value);
+}
+EXPORT_SYMBOL(ssb_extif_gpio_intmask);
Index: linux-2.6.23.16/include/linux/ssb/ssb_driver_chipcommon.h
===================================================================
--- linux-2.6.23.16.orig/include/linux/ssb/ssb_driver_chipcommon.h 2008-02-19 14:37:06.000000000 +0100
+++ linux-2.6.23.16/include/linux/ssb/ssb_driver_chipcommon.h 2008-02-19 14:37:08.000000000 +0100
@@ -382,11 +382,13 @@ extern void ssb_chipco_set_clockmode(str
extern void ssb_chipco_watchdog_timer_set(struct ssb_chipcommon *cc,
u32 ticks);
+/* Chipcommon GPIO pin access. */
u32 ssb_chipco_gpio_in(struct ssb_chipcommon *cc, u32 mask);
-
-void ssb_chipco_gpio_out(struct ssb_chipcommon *cc, u32 mask, u32 value);
-
-void ssb_chipco_gpio_outen(struct ssb_chipcommon *cc, u32 mask, u32 value);
+u32 ssb_chipco_gpio_out(struct ssb_chipcommon *cc, u32 mask, u32 value);
+u32 ssb_chipco_gpio_outen(struct ssb_chipcommon *cc, u32 mask, u32 value);
+u32 ssb_chipco_gpio_control(struct ssb_chipcommon *cc, u32 mask, u32 value);
+u32 ssb_chipco_gpio_intmask(struct ssb_chipcommon *cc, u32 mask, u32 value);
+u32 ssb_chipco_gpio_polarity(struct ssb_chipcommon *cc, u32 mask, u32 value);
#ifdef CONFIG_SSB_SERIAL
extern int ssb_chipco_serial_init(struct ssb_chipcommon *cc,
Index: linux-2.6.23.16/include/linux/ssb/ssb_driver_extif.h
===================================================================
--- linux-2.6.23.16.orig/include/linux/ssb/ssb_driver_extif.h 2008-02-19 14:37:06.000000000 +0100
+++ linux-2.6.23.16/include/linux/ssb/ssb_driver_extif.h 2008-02-19 14:37:08.000000000 +0100
@@ -171,11 +171,12 @@ extern void ssb_extif_get_clockcontrol(s
extern void ssb_extif_timing_init(struct ssb_extif *extif,
unsigned long ns);
+/* Extif GPIO pin access */
u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask);
-
-void ssb_extif_gpio_out(struct ssb_extif *extif, u32 mask, u32 value);
-
-void ssb_extif_gpio_outen(struct ssb_extif *extif, u32 mask, u32 value);
+u32 ssb_extif_gpio_out(struct ssb_extif *extif, u32 mask, u32 value);
+u32 ssb_extif_gpio_outen(struct ssb_extif *extif, u32 mask, u32 value);
+u32 ssb_extif_gpio_polarity(struct ssb_extif *extif, u32 mask, u32 value);
+u32 ssb_extif_gpio_intmask(struct ssb_extif *extif, u32 mask, u32 value);
#ifdef CONFIG_SSB_SERIAL
extern int ssb_extif_serial_init(struct ssb_extif *extif,

View File

@ -1,8 +1,8 @@
Index: linux-2.6.23.16/drivers/ssb/driver_chipcommon.c
===================================================================
--- linux-2.6.23.16.orig/drivers/ssb/driver_chipcommon.c 2008-02-19 00:42:42.000000000 +0100
+++ linux-2.6.23.16/drivers/ssb/driver_chipcommon.c 2008-02-19 00:43:34.000000000 +0100
@@ -268,6 +268,8 @@ void ssb_chipco_resume(struct ssb_chipco
--- linux-2.6.23.16.orig/drivers/ssb/driver_chipcommon.c 2008-02-19 13:46:08.000000000 +0100
+++ linux-2.6.23.16/drivers/ssb/driver_chipcommon.c 2008-02-19 13:46:17.000000000 +0100
@@ -270,6 +270,8 @@ void ssb_chipco_resume(struct ssb_chipco
void ssb_chipco_get_clockcpu(struct ssb_chipcommon *cc,
u32 *plltype, u32 *n, u32 *m)
{
@ -11,7 +11,7 @@ Index: linux-2.6.23.16/drivers/ssb/driver_chipcommon.c
*n = chipco_read32(cc, SSB_CHIPCO_CLOCK_N);
*plltype = (cc->capabilities & SSB_CHIPCO_CAP_PLLT);
switch (*plltype) {
@@ -291,6 +293,8 @@ void ssb_chipco_get_clockcpu(struct ssb_
@@ -293,6 +295,8 @@ void ssb_chipco_get_clockcpu(struct ssb_
void ssb_chipco_get_clockcontrol(struct ssb_chipcommon *cc,
u32 *plltype, u32 *n, u32 *m)
{
@ -22,8 +22,8 @@ Index: linux-2.6.23.16/drivers/ssb/driver_chipcommon.c
switch (*plltype) {
Index: linux-2.6.23.16/drivers/ssb/driver_mipscore.c
===================================================================
--- linux-2.6.23.16.orig/drivers/ssb/driver_mipscore.c 2008-02-19 00:42:42.000000000 +0100
+++ linux-2.6.23.16/drivers/ssb/driver_mipscore.c 2008-02-19 00:43:34.000000000 +0100
--- linux-2.6.23.16.orig/drivers/ssb/driver_mipscore.c 2008-02-19 13:46:08.000000000 +0100
+++ linux-2.6.23.16/drivers/ssb/driver_mipscore.c 2008-02-19 13:46:17.000000000 +0100
@@ -160,6 +160,8 @@ u32 ssb_cpu_clock(struct ssb_mipscore *m
if ((pll_type == SSB_PLLTYPE_5) || (bus->chip_id == 0x5365)) {
@ -35,9 +35,9 @@ Index: linux-2.6.23.16/drivers/ssb/driver_mipscore.c
}
Index: linux-2.6.23.16/drivers/ssb/main.c
===================================================================
--- linux-2.6.23.16.orig/drivers/ssb/main.c 2008-02-19 00:42:15.000000000 +0100
+++ linux-2.6.23.16/drivers/ssb/main.c 2008-02-19 00:43:34.000000000 +0100
@@ -860,6 +860,8 @@ u32 ssb_clockspeed(struct ssb_bus *bus)
--- linux-2.6.23.16.orig/drivers/ssb/main.c 2008-02-19 13:46:08.000000000 +0100
+++ linux-2.6.23.16/drivers/ssb/main.c 2008-02-19 13:46:17.000000000 +0100
@@ -862,6 +862,8 @@ u32 ssb_clockspeed(struct ssb_bus *bus)
if (bus->chip_id == 0x5365) {
rate = 100000000;

View File

@ -1,8 +1,8 @@
Index: linux-2.6.23.16/drivers/ssb/driver_chipcommon.c
===================================================================
--- linux-2.6.23.16.orig/drivers/ssb/driver_chipcommon.c 2008-02-18 21:38:58.000000000 +0100
+++ linux-2.6.23.16/drivers/ssb/driver_chipcommon.c 2008-02-18 21:39:00.000000000 +0100
@@ -365,6 +365,7 @@ int ssb_chipco_serial_init(struct ssb_ch
--- linux-2.6.23.16.orig/drivers/ssb/driver_chipcommon.c 2008-02-19 14:37:26.000000000 +0100
+++ linux-2.6.23.16/drivers/ssb/driver_chipcommon.c 2008-02-19 14:37:27.000000000 +0100
@@ -403,6 +403,7 @@ int ssb_chipco_serial_init(struct ssb_ch
unsigned int irq;
u32 baud_base, div;
u32 i, n;
@ -10,7 +10,7 @@ Index: linux-2.6.23.16/drivers/ssb/driver_chipcommon.c
plltype = (cc->capabilities & SSB_CHIPCO_CAP_PLLT);
irq = ssb_mips_irq(cc->dev);
@@ -376,14 +377,39 @@ int ssb_chipco_serial_init(struct ssb_ch
@@ -414,14 +415,39 @@ int ssb_chipco_serial_init(struct ssb_ch
chipco_read32(cc, SSB_CHIPCO_CLOCK_M2));
div = 1;
} else {
@ -53,7 +53,7 @@ Index: linux-2.6.23.16/drivers/ssb/driver_chipcommon.c
/* Internal backplane clock */
baud_base = ssb_clockspeed(bus);
div = chipco_read32(cc, SSB_CHIPCO_CLKDIV)
@@ -395,7 +421,7 @@ int ssb_chipco_serial_init(struct ssb_ch
@@ -433,7 +459,7 @@ int ssb_chipco_serial_init(struct ssb_ch
}
/* Clock source depends on strapping if UartClkOverride is unset */
@ -62,7 +62,7 @@ Index: linux-2.6.23.16/drivers/ssb/driver_chipcommon.c
!(chipco_read32(cc, SSB_CHIPCO_CORECTL) & SSB_CHIPCO_CORECTL_UARTCLK0)) {
if ((cc->capabilities & SSB_CHIPCO_CAP_UARTCLK) ==
SSB_CHIPCO_CAP_UARTCLK_INT) {
@@ -417,7 +443,7 @@ int ssb_chipco_serial_init(struct ssb_ch
@@ -455,7 +481,7 @@ int ssb_chipco_serial_init(struct ssb_ch
cc_mmio = cc->dev->bus->mmio + (cc->dev->core_index * SSB_CORE_SIZE);
uart_regs = cc_mmio + SSB_CHIPCO_UART0_DATA;
/* Offset changed at after rev 0 */
@ -73,8 +73,8 @@ Index: linux-2.6.23.16/drivers/ssb/driver_chipcommon.c
uart_regs += (i * 256);
Index: linux-2.6.23.16/include/linux/ssb/ssb_driver_chipcommon.h
===================================================================
--- linux-2.6.23.16.orig/include/linux/ssb/ssb_driver_chipcommon.h 2008-02-18 21:38:58.000000000 +0100
+++ linux-2.6.23.16/include/linux/ssb/ssb_driver_chipcommon.h 2008-02-18 21:39:00.000000000 +0100
--- linux-2.6.23.16.orig/include/linux/ssb/ssb_driver_chipcommon.h 2008-02-19 14:37:26.000000000 +0100
+++ linux-2.6.23.16/include/linux/ssb/ssb_driver_chipcommon.h 2008-02-19 14:37:27.000000000 +0100
@@ -51,9 +51,12 @@
#define SSB_CHIPCO_CAP_JTAGM 0x00400000 /* JTAG master present */
#define SSB_CHIPCO_CAP_BROM 0x00800000 /* Internal boot ROM active */

View File

@ -1,7 +1,7 @@
Index: linux-2.6.23.16/drivers/ssb/Kconfig
===================================================================
--- linux-2.6.23.16.orig/drivers/ssb/Kconfig 2008-02-19 12:38:31.000000000 +0100
+++ linux-2.6.23.16/drivers/ssb/Kconfig 2008-02-19 12:43:58.000000000 +0100
--- linux-2.6.23.16.orig/drivers/ssb/Kconfig 2008-02-19 13:46:05.000000000 +0100
+++ linux-2.6.23.16/drivers/ssb/Kconfig 2008-02-19 13:46:33.000000000 +0100
@@ -105,6 +105,12 @@ config SSB_DRIVER_MIPS
If unsure, say N
@ -17,8 +17,8 @@ Index: linux-2.6.23.16/drivers/ssb/Kconfig
depends on SSB_DRIVER_MIPS && EXPERIMENTAL
Index: linux-2.6.23.16/drivers/ssb/Makefile
===================================================================
--- linux-2.6.23.16.orig/drivers/ssb/Makefile 2008-02-19 12:38:31.000000000 +0100
+++ linux-2.6.23.16/drivers/ssb/Makefile 2008-02-19 12:43:58.000000000 +0100
--- linux-2.6.23.16.orig/drivers/ssb/Makefile 2008-02-19 13:46:05.000000000 +0100
+++ linux-2.6.23.16/drivers/ssb/Makefile 2008-02-19 13:46:33.000000000 +0100
@@ -1,5 +1,6 @@
# core
ssb-y += main.o scan.o
@ -28,10 +28,10 @@ Index: linux-2.6.23.16/drivers/ssb/Makefile
ssb-$(CONFIG_SSB_PCIHOST) += pci.o pcihost_wrapper.o
Index: linux-2.6.23.16/drivers/ssb/driver_extif.c
===================================================================
--- linux-2.6.23.16.orig/drivers/ssb/driver_extif.c 2008-02-19 12:38:34.000000000 +0100
+++ linux-2.6.23.16/drivers/ssb/driver_extif.c 2008-02-19 12:45:13.000000000 +0100
@@ -35,6 +35,12 @@ static inline void extif_write32_masked(
extif_write32(extif, offset, value);
--- linux-2.6.23.16.orig/drivers/ssb/driver_extif.c 2008-02-19 13:46:05.000000000 +0100
+++ linux-2.6.23.16/drivers/ssb/driver_extif.c 2008-02-19 13:46:33.000000000 +0100
@@ -37,6 +37,12 @@ static inline u32 extif_write32_masked(s
return value;
}
+void ssb_extif_watchdog_timer_set(struct ssb_extif *extif,
@ -46,7 +46,7 @@ Index: linux-2.6.23.16/drivers/ssb/driver_extif.c
Index: linux-2.6.23.16/drivers/ssb/embedded.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.23.16/drivers/ssb/embedded.c 2008-02-19 12:43:58.000000000 +0100
+++ linux-2.6.23.16/drivers/ssb/embedded.c 2008-02-19 13:46:33.000000000 +0100
@@ -0,0 +1,26 @@
+/*
+ * Sonics Silicon Backplane
@ -76,8 +76,8 @@ Index: linux-2.6.23.16/drivers/ssb/embedded.c
+}
Index: linux-2.6.23.16/include/linux/ssb/ssb_driver_chipcommon.h
===================================================================
--- linux-2.6.23.16.orig/include/linux/ssb/ssb_driver_chipcommon.h 2008-02-19 12:38:34.000000000 +0100
+++ linux-2.6.23.16/include/linux/ssb/ssb_driver_chipcommon.h 2008-02-19 12:43:58.000000000 +0100
--- linux-2.6.23.16.orig/include/linux/ssb/ssb_driver_chipcommon.h 2008-02-19 13:46:29.000000000 +0100
+++ linux-2.6.23.16/include/linux/ssb/ssb_driver_chipcommon.h 2008-02-19 13:46:33.000000000 +0100
@@ -360,6 +360,11 @@ struct ssb_chipcommon {
u16 fast_pwrup_delay;
};
@ -92,11 +92,11 @@ Index: linux-2.6.23.16/include/linux/ssb/ssb_driver_chipcommon.h
#include <linux/pm.h>
Index: linux-2.6.23.16/include/linux/ssb/ssb_driver_extif.h
===================================================================
--- linux-2.6.23.16.orig/include/linux/ssb/ssb_driver_extif.h 2008-02-19 12:38:34.000000000 +0100
+++ linux-2.6.23.16/include/linux/ssb/ssb_driver_extif.h 2008-02-19 12:47:03.000000000 +0100
@@ -170,6 +170,9 @@ extern void ssb_extif_get_clockcontrol(s
extern void ssb_extif_timing_init(struct ssb_extif *extif,
unsigned long ns);
--- linux-2.6.23.16.orig/include/linux/ssb/ssb_driver_extif.h 2008-02-19 13:46:05.000000000 +0100
+++ linux-2.6.23.16/include/linux/ssb/ssb_driver_extif.h 2008-02-19 13:46:33.000000000 +0100
@@ -178,6 +178,9 @@ u32 ssb_extif_gpio_outen(struct ssb_exti
u32 ssb_extif_gpio_polarity(struct ssb_extif *extif, u32 mask, u32 value);
u32 ssb_extif_gpio_intmask(struct ssb_extif *extif, u32 mask, u32 value);
+extern void ssb_extif_watchdog_timer_set(struct ssb_extif *extif,
+ u32 ticks);
@ -104,7 +104,7 @@ Index: linux-2.6.23.16/include/linux/ssb/ssb_driver_extif.h
#ifdef CONFIG_SSB_SERIAL
extern int ssb_extif_serial_init(struct ssb_extif *extif,
struct ssb_serial_port *ports);
@@ -224,5 +227,11 @@ void ssb_extif_get_clockcontrol(struct s
@@ -201,5 +204,11 @@ void ssb_extif_get_clockcontrol(struct s
{
}
@ -119,7 +119,7 @@ Index: linux-2.6.23.16/include/linux/ssb/ssb_driver_extif.h
Index: linux-2.6.23.16/include/linux/ssb/ssb_embedded.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.23.16/include/linux/ssb/ssb_embedded.h 2008-02-19 12:43:58.000000000 +0100
+++ linux-2.6.23.16/include/linux/ssb/ssb_embedded.h 2008-02-19 13:46:33.000000000 +0100
@@ -0,0 +1,10 @@
+#ifndef LINUX_SSB_EMBEDDED_H_
+#define LINUX_SSB_EMBEDDED_H_

View File

@ -1,216 +1,19 @@
This patch ports ssb to the 2.6.23 kernel.
Index: linux-2.6.23.16/drivers/ssb/driver_mipscore.c
===================================================================
--- linux-2.6.23.16.orig/drivers/ssb/driver_mipscore.c 2008-02-19 01:35:53.000000000 +0100
+++ linux-2.6.23.16/drivers/ssb/driver_mipscore.c 2008-02-19 02:01:16.000000000 +0100
--- linux-2.6.23.16.orig/drivers/ssb/driver_mipscore.c 2008-02-19 13:45:04.000000000 +0100
+++ linux-2.6.23.16/drivers/ssb/driver_mipscore.c 2008-02-19 13:45:07.000000000 +0100
@@ -222,3 +222,5 @@ void ssb_mipscore_init(struct ssb_mipsco
ssb_mips_serial_init(mcore);
ssb_mips_flash_detect(mcore);
}
+
+EXPORT_SYMBOL(ssb_mips_irq);
Index: linux-2.6.23.16/include/linux/ssb/ssb_driver_chipcommon.h
===================================================================
--- linux-2.6.23.16.orig/include/linux/ssb/ssb_driver_chipcommon.h 2008-02-19 01:35:53.000000000 +0100
+++ linux-2.6.23.16/include/linux/ssb/ssb_driver_chipcommon.h 2008-02-19 02:01:10.000000000 +0100
@@ -382,11 +382,45 @@ extern void ssb_chipco_set_clockmode(str
extern void ssb_chipco_watchdog_timer_set(struct ssb_chipcommon *cc,
u32 ticks);
-u32 ssb_chipco_gpio_in(struct ssb_chipcommon *cc, u32 mask);
+/* GPIO functions */
+static inline u32 ssb_chipco_gpio_in(struct ssb_chipcommon *cc,
+ u32 mask)
+{
+ return ssb_read32(cc->dev, SSB_CHIPCO_GPIOIN) & mask;
+}
-void ssb_chipco_gpio_out(struct ssb_chipcommon *cc, u32 mask, u32 value);
+static inline u32 ssb_chipco_gpio_out(struct ssb_chipcommon *cc,
+ u32 mask, u32 value)
+{
+ return ssb_write32_masked(cc->dev, SSB_CHIPCO_GPIOOUT, mask, value);
+}
-void ssb_chipco_gpio_outen(struct ssb_chipcommon *cc, u32 mask, u32 value);
+static inline u32 ssb_chipco_gpio_outen(struct ssb_chipcommon *cc,
+ u32 mask, u32 value)
+{
+ return ssb_write32_masked(cc->dev, SSB_CHIPCO_GPIOOUTEN, mask, value);
+}
+
+static inline u32 ssb_chipco_gpio_control(struct ssb_chipcommon *cc,
+ u32 mask, u32 value)
+{
+ return ssb_write32_masked(cc->dev, SSB_CHIPCO_GPIOCTL, mask, value);
+}
+
+static inline u32 ssb_chipco_gpio_intmask(struct ssb_chipcommon *cc,
+ u32 mask, u32 value)
+{
+ return ssb_write32_masked(cc->dev, SSB_CHIPCO_GPIOIRQ, mask, value);
+}
+
+static inline u32 ssb_chipco_gpio_polarity(struct ssb_chipcommon *cc,
+ u32 mask, u32 value)
+{
+ return ssb_write32_masked(cc->dev, SSB_CHIPCO_GPIOPOL, mask, value);
+}
+/* TODO: GPIO reservation */
+
+extern int ssb_chipco_watchdog(struct ssb_chipcommon *cc, uint ticks);
#ifdef CONFIG_SSB_SERIAL
extern int ssb_chipco_serial_init(struct ssb_chipcommon *cc,
Index: linux-2.6.23.16/include/linux/ssb/ssb_driver_extif.h
===================================================================
--- linux-2.6.23.16.orig/include/linux/ssb/ssb_driver_extif.h 2008-02-19 01:35:53.000000000 +0100
+++ linux-2.6.23.16/include/linux/ssb/ssb_driver_extif.h 2008-02-19 01:39:40.000000000 +0100
@@ -153,7 +153,6 @@
#define SSB_EXTIF_WATCHDOG_CLK 48000000 /* Hz */
-
#ifdef CONFIG_SSB_DRIVER_EXTIF
struct ssb_extif {
@@ -171,17 +170,42 @@ extern void ssb_extif_get_clockcontrol(s
extern void ssb_extif_timing_init(struct ssb_extif *extif,
unsigned long ns);
-u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask);
-
-void ssb_extif_gpio_out(struct ssb_extif *extif, u32 mask, u32 value);
-
-void ssb_extif_gpio_outen(struct ssb_extif *extif, u32 mask, u32 value);
-
#ifdef CONFIG_SSB_SERIAL
extern int ssb_extif_serial_init(struct ssb_extif *extif,
struct ssb_serial_port *ports);
#endif /* CONFIG_SSB_SERIAL */
+/* GPIO functions */
+static inline u32 ssb_extif_gpio_in(struct ssb_extif *extif,
+ u32 mask)
+{
+ return ssb_read32(extif->dev, SSB_EXTIF_GPIO_IN) & mask;
+}
+
+static inline u32 ssb_extif_gpio_out(struct ssb_extif *extif,
+ u32 mask, u32 value)
+{
+ return ssb_write32_masked(extif->dev, SSB_EXTIF_GPIO_OUT(0), mask, value);
+}
+
+static inline u32 ssb_extif_gpio_outen(struct ssb_extif *extif,
+ u32 mask, u32 value)
+{
+ return ssb_write32_masked(extif->dev, SSB_EXTIF_GPIO_OUTEN(0), mask, value);
+}
+
+static inline u32 ssb_extif_gpio_polarity(struct ssb_extif *extif,
+ u32 mask, u32 value)
+{
+ return ssb_write32_masked(extif->dev, SSB_EXTIF_GPIO_INTPOL, mask, value);
+}
+
+static inline u32 ssb_extif_gpio_intmask(struct ssb_extif *extif,
+ u32 mask, u32 value)
+{
+ return ssb_write32_masked(extif->dev, SSB_EXTIF_GPIO_INTMASK, mask, value);
+}
+
#else /* CONFIG_SSB_DRIVER_EXTIF */
/* extif disabled */
Index: linux-2.6.23.16/include/linux/ssb/ssb.h
===================================================================
--- linux-2.6.23.16.orig/include/linux/ssb/ssb.h 2008-02-19 01:35:53.000000000 +0100
+++ linux-2.6.23.16/include/linux/ssb/ssb.h 2008-02-19 01:39:40.000000000 +0100
@@ -217,6 +217,12 @@ enum ssb_bustype {
#define SSB_CHIPPACK_BCM4712M 2 /* Medium 225pin 4712 */
#define SSB_CHIPPACK_BCM4712L 0 /* Large 340pin 4712 */
+static inline u16 ssb_read16(struct ssb_device *dev, u16 offset);
+static inline u32 ssb_read32(struct ssb_device *dev, u16 offset);
+static inline void ssb_write16(struct ssb_device *dev, u16 offset, u16 value);
+static inline void ssb_write32(struct ssb_device *dev, u16 offset, u32 value);
+static inline u32 ssb_write32_masked(struct ssb_device *dev, u16 offset, u32 mask, u32 value);
+
#include <linux/ssb/ssb_driver_chipcommon.h>
#include <linux/ssb/ssb_driver_mips.h>
#include <linux/ssb/ssb_driver_extif.h>
@@ -349,6 +355,16 @@ static inline void ssb_write32(struct ss
dev->ops->write32(dev, offset, value);
}
+static inline u32 ssb_write32_masked(struct ssb_device *dev,
+ u16 offset,
+ u32 mask,
+ u32 value)
+{
+ value &= mask;
+ value |= ssb_read32(dev, offset) & ~mask;
+ ssb_write32(dev, offset, value);
+ return value;
+}
/* Translation (routing) bits that need to be ORed to DMA
* addresses before they are given to a device. */
Index: linux-2.6.23.16/drivers/ssb/driver_chipcommon.c
===================================================================
--- linux-2.6.23.16.orig/drivers/ssb/driver_chipcommon.c 2008-02-19 01:35:53.000000000 +0100
+++ linux-2.6.23.16/drivers/ssb/driver_chipcommon.c 2008-02-19 02:01:16.000000000 +0100
@@ -351,21 +351,6 @@ void ssb_chipco_watchdog_timer_set(struc
chipco_write32(cc, SSB_CHIPCO_WATCHDOG, ticks);
}
-u32 ssb_chipco_gpio_in(struct ssb_chipcommon *cc, u32 mask)
-{
- return chipco_read32(cc, SSB_CHIPCO_GPIOIN) & mask;
-}
-
-void ssb_chipco_gpio_out(struct ssb_chipcommon *cc, u32 mask, u32 value)
-{
- chipco_write32_masked(cc, SSB_CHIPCO_GPIOOUT, mask, value);
-}
-
-void ssb_chipco_gpio_outen(struct ssb_chipcommon *cc, u32 mask, u32 value)
-{
- chipco_write32_masked(cc, SSB_CHIPCO_GPIOOUTEN, mask, value);
-}
-
#ifdef CONFIG_SSB_SERIAL
int ssb_chipco_serial_init(struct ssb_chipcommon *cc,
struct ssb_serial_port *ports)
Index: linux-2.6.23.16/drivers/ssb/driver_extif.c
===================================================================
--- linux-2.6.23.16.orig/drivers/ssb/driver_extif.c 2008-02-19 01:35:53.000000000 +0100
+++ linux-2.6.23.16/drivers/ssb/driver_extif.c 2008-02-19 01:39:40.000000000 +0100
@@ -110,20 +110,4 @@ void ssb_extif_get_clockcontrol(struct s
*m = extif_read32(extif, SSB_EXTIF_CLOCK_SB);
}
-u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask)
-{
- return extif_read32(extif, SSB_EXTIF_GPIO_IN) & mask;
-}
-
-void ssb_extif_gpio_out(struct ssb_extif *extif, u32 mask, u32 value)
-{
- return extif_write32_masked(extif, SSB_EXTIF_GPIO_OUT(0),
- mask, value);
-}
-
-void ssb_extif_gpio_outen(struct ssb_extif *extif, u32 mask, u32 value)
-{
- return extif_write32_masked(extif, SSB_EXTIF_GPIO_OUTEN(0),
- mask, value);
-}
Index: linux-2.6.23.16/include/linux/mod_devicetable.h
===================================================================
--- linux-2.6.23.16.orig/include/linux/mod_devicetable.h 2008-02-19 01:35:53.000000000 +0100
+++ linux-2.6.23.16/include/linux/mod_devicetable.h 2008-02-19 01:39:40.000000000 +0100
--- linux-2.6.23.16.orig/include/linux/mod_devicetable.h 2008-02-19 13:45:04.000000000 +0100
+++ linux-2.6.23.16/include/linux/mod_devicetable.h 2008-02-19 13:45:07.000000000 +0100
@@ -340,4 +340,19 @@ struct parisc_device_id {
#define PA_HVERSION_ANY_ID 0xffff
#define PA_SVERSION_ANY_ID 0xffffffff
@ -233,8 +36,8 @@ Index: linux-2.6.23.16/include/linux/mod_devicetable.h
#endif /* LINUX_MOD_DEVICETABLE_H */
Index: linux-2.6.23.16/drivers/ssb/main.c
===================================================================
--- linux-2.6.23.16.orig/drivers/ssb/main.c 2008-02-19 01:45:24.000000000 +0100
+++ linux-2.6.23.16/drivers/ssb/main.c 2008-02-19 02:01:16.000000000 +0100
--- linux-2.6.23.16.orig/drivers/ssb/main.c 2008-02-19 13:45:04.000000000 +0100
+++ linux-2.6.23.16/drivers/ssb/main.c 2008-02-19 13:45:07.000000000 +0100
@@ -321,14 +321,16 @@ static int ssb_bus_match(struct device *
return 0;
}
@ -256,8 +59,8 @@ Index: linux-2.6.23.16/drivers/ssb/main.c
ssb_dev->id.revision);
Index: linux-2.6.23.16/drivers/ssb/scan.c
===================================================================
--- linux-2.6.23.16.orig/drivers/ssb/scan.c 2008-02-16 19:08:13.000000000 +0100
+++ linux-2.6.23.16/drivers/ssb/scan.c 2008-02-19 01:56:02.000000000 +0100
--- linux-2.6.23.16.orig/drivers/ssb/scan.c 2008-02-19 13:45:04.000000000 +0100
+++ linux-2.6.23.16/drivers/ssb/scan.c 2008-02-19 13:45:07.000000000 +0100
@@ -391,12 +391,14 @@ int ssb_bus_scan(struct ssb_bus *bus,
if (bus->bustype == SSB_BUSTYPE_PCI) {
/* Ignore PCI cores on PCI-E cards.
@ -279,8 +82,8 @@ Index: linux-2.6.23.16/drivers/ssb/scan.c
if (bus->pcicore.dev) {
Index: linux-2.6.23.16/drivers/ssb/driver_pcicore.c
===================================================================
--- linux-2.6.23.16.orig/drivers/ssb/driver_pcicore.c 2008-02-19 02:01:11.000000000 +0100
+++ linux-2.6.23.16/drivers/ssb/driver_pcicore.c 2008-02-19 02:01:32.000000000 +0100
--- linux-2.6.23.16.orig/drivers/ssb/driver_pcicore.c 2008-02-19 13:45:04.000000000 +0100
+++ linux-2.6.23.16/drivers/ssb/driver_pcicore.c 2008-02-19 13:45:07.000000000 +0100
@@ -362,7 +362,7 @@ static int pcicore_is_in_hostmode(struct
chipid_top != 0x5300)
return 0;