1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2025-04-21 12:27:27 +03:00

[brcm63xx] register spi controller, remove whitespaces

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21096 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
florian
2010-04-22 16:35:49 +00:00
parent 3143d2887a
commit 37c210f055
2 changed files with 133 additions and 37 deletions

View File

@@ -32,7 +32,7 @@
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2009 Florian Fainelli <florian@openwrt.org>
+ * Copyright (C) 2009 Florian Fainelli <florian@openwrt.org>
+ */
+
+#include <linux/init.h>
@@ -84,12 +84,20 @@
+
+ if (BCMCPU_IS_6358())
+ spi_pdata.fifo_size = SPI_BCM_6358_SPI_MSG_DATA_SIZE;
+
+
+ return platform_device_register(&bcm63xx_spi_device);
+}
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h
@@ -428,6 +428,7 @@ static inline unsigned long bcm63xx_regs
@@ -108,6 +108,7 @@ enum bcm63xx_regs_set {
#define RSET_WDT_SIZE 12
#define RSET_ENET_SIZE 2048
#define RSET_ENETDMA_SIZE 2048
+#define RSET_SPI_SIZE 256
#define RSET_UART_SIZE 24
#define RSET_UDC_SIZE 256
#define RSET_OHCI_SIZE 256
@@ -428,6 +429,7 @@ static inline unsigned long bcm63xx_regs
*/
enum bcm63xx_irq {
IRQ_TIMER = 0,
@@ -97,7 +105,7 @@
IRQ_UART0,
IRQ_DSL,
IRQ_UDC0,
@@ -493,6 +494,7 @@ enum bcm63xx_irq {
@@ -493,6 +495,7 @@ enum bcm63xx_irq {
* 6348 irqs
*/
#define BCM_6348_TIMER_IRQ (IRQ_INTERNAL_BASE + 0)
@@ -105,7 +113,7 @@
#define BCM_6348_UART0_IRQ (IRQ_INTERNAL_BASE + 2)
#define BCM_6348_DSL_IRQ (IRQ_INTERNAL_BASE + 4)
#define BCM_6348_UDC0_IRQ (IRQ_INTERNAL_BASE + 6)
@@ -517,6 +519,7 @@ enum bcm63xx_irq {
@@ -517,6 +520,7 @@ enum bcm63xx_irq {
* 6358 irqs
*/
#define BCM_6358_TIMER_IRQ (IRQ_INTERNAL_BASE + 0)
@@ -597,7 +605,7 @@
+ if (bs->tx_ptr)
+ bcm_spi_writeb(*bs->tx_ptr++, bs->regs, SPI_MSG_DATA);
+ else
+ bcm_spi_writeb(0, bs->regs, SPI_MSG_DATA);
+ bcm_spi_writeb(0, bs->regs, SPI_MSG_DATA);
+ bs->remaining_bytes--;
+ tail = bcm_spi_readb(bs->regs, SPI_MSG_TAIL);
+ }
@@ -636,7 +644,7 @@
+ cmd |= (0 << SPI_CMD_PREPEND_BYTE_CNT_SHIFT);
+ bcm_spi_writeb(cmd, bs->regs, SPI_CMD);
+
+ wait_for_completion(&bs->done);
+ wait_for_completion(&bs->done);
+
+ /* Disable the CMD_DONE interrupt */
+ bcm_spi_writeb(~(SPI_INTR_CMD_DONE), bs->regs, SPI_INT_MASK);
@@ -644,7 +652,7 @@
+ return t->len - bs->remaining_bytes;
+}
+
+/* This driver supports single master mode only. Hence
+/* This driver supports single master mode only. Hence
+ * CMD_DONE is the only interrupt we care about
+ */
+static irqreturn_t bcm63xx_spi_interrupt(int irq, void *dev_id)
@@ -908,3 +916,33 @@
+};
+
+#endif /* BCM63XX_DEV_SPI_H */
--- a/arch/mips/bcm63xx/Makefile
+++ b/arch/mips/bcm63xx/Makefile
@@ -1,6 +1,6 @@
obj-y += clk.o cpu.o cs.o gpio.o irq.o prom.o setup.o timer.o \
dev-dsp.o dev-enet.o dev-pcmcia.o dev-uart.o dev-wdt.o \
- dev-usb-ohci.o dev-usb-ehci.o dev-usb-udc.o
+ dev-usb-ohci.o dev-usb-ehci.o dev-usb-udc.o dev-spi.o
obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
obj-y += boards/
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -29,6 +29,7 @@
#include <bcm63xx_dev_usb_ohci.h>
#include <bcm63xx_dev_usb_ehci.h>
#include <bcm63xx_dev_usb_udc.h>
+#include <bcm63xx_dev_spi.h>
#include <board_bcm963xx.h>
#define PFX "board_bcm963xx: "
@@ -998,6 +999,9 @@ int __init board_register_devices(void)
if (board.has_udc0)
bcm63xx_udc_register();
+ if (!BCMCPU_IS_6345())
+ bcm63xx_spi_register();
+
/* Generate MAC address for WLAN and
* register our SPROM */
#ifdef CONFIG_SSB_PCIHOST