With the patch it's attached it's better :)

Le 23/11/2010 16:08, Tanguy Bouzéloc a écrit :
Hello Florian,

I've updated the patch in order to be arch independant.

Regards,
Tanguy Bouzéloc.

Le 18/11/2010 16:46, Florian Fainelli a écrit :
Hello Tanguy,

On Thursday 18 November 2010 16:24:32 Tanguy Bouzéloc wrote:
Hi Florian,

I've updated the spi driver, it fixes the following issues :

- chipselect
- command register defines
- add missing clock
The patch looks good, however, you have put some BCM6358 specific code in the
generic driver, can you change the driver to add a platform_data callback
doning what you want for instance?
--
Florian

_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

From caa76314f534b3dc5fffa5ef703f5c110158e173 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tanguy=20Bouz=C3=A9loc?= <[email protected]>
Date: Tue, 23 Nov 2010 15:57:08 +0100
Subject: [PATCH 21/21] make slave select proper

---
 target/linux/brcm63xx/patches-2.6.35/240-spi.patch |  107 +++++++++++++++++---
 1 files changed, 93 insertions(+), 14 deletions(-)

diff --git a/target/linux/brcm63xx/patches-2.6.35/240-spi.patch 
b/target/linux/brcm63xx/patches-2.6.35/240-spi.patch
index c2dc79c..344b1b4 100644
--- a/target/linux/brcm63xx/patches-2.6.35/240-spi.patch
+++ b/target/linux/brcm63xx/patches-2.6.35/240-spi.patch
@@ -143,6 +143,8 @@
 +      spi_resources[0].end += RSET_SPI_SIZE - 1;
 +      spi_resources[1].start = bcm63xx_get_irq_number(IRQ_SPI);
 +
++      bcm63xx_spi_regs_init();
++
 +      /* Fill in platform data */
 +      if (BCMCPU_IS_6338() || BCMCPU_IS_6348())
 +              spi_pdata.fifo_size = SPI_BCM_6338_SPI_MSG_DATA_SIZE;
@@ -150,8 +152,6 @@
 +      if (BCMCPU_IS_6358())
 +              spi_pdata.fifo_size = SPI_BCM_6358_SPI_MSG_DATA_SIZE;
 +
-+      bcm63xx_spi_regs_init();
-+
 +      return platform_device_register(&bcm63xx_spi_device);
 +}
 --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h
@@ -199,7 +199,15 @@
  #define BCM_6358_OHCI0_IRQ            (IRQ_INTERNAL_BASE + 5)
 --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
 +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
-@@ -769,4 +769,116 @@
+@@ -403,7 +403,6 @@
+ #define GPIO_MODE_6358_SERIAL_LED     (1 << 10)
+ #define GPIO_MODE_6358_UTOPIA         (1 << 12)
+ 
+-
+ /*************************************************************************
+  * _REG relative to RSET_ENET
+  *************************************************************************/
+@@ -769,4 +768,116 @@
  #define DMIPSPLLCFG_N2_SHIFT          29
  #define DMIPSPLLCFG_N2_MASK           (0x7 << DMIPSPLLCFG_N2_SHIFT)
  
@@ -318,7 +326,7 @@
  #endif /* BCM63XX_REGS_H_ */
 --- /dev/null
 +++ b/drivers/spi/bcm63xx_spi.c
-@@ -0,0 +1,489 @@
+@@ -0,0 +1,480 @@
 +/*
 + * Broadcom BCM63xx SPI controller support
 + *
@@ -621,7 +629,6 @@
 +      struct spi_master *master;
 +      struct clk *clk;
 +      struct bcm63xx_spi *bs;
-+      uint32_t reg;
 +      int ret;
 +
 +      r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -701,14 +708,6 @@
 +              goto out_reset_hw;
 +      }
 +
-+      reg = bcm_gpio_readl(GPIO_MODE_REG);
-+      reg |= GPIO_MODE_6358_EXTRA_SPI_SS;
-+      bcm_gpio_writel(reg, GPIO_MODE_REG);
-+
-+      reg = bcm_gpio_readl(GPIO_CTL_HI_REG);
-+      reg |= 0x3;
-+      bcm_gpio_writel(reg, GPIO_CTL_HI_REG);
-+
 +      dev_info(dev, "at 0x%08x (irq %d, FIFOs size %d) v%s\n",
 +               r->start, irq, bs->fifo_size, DRV_VER);
 +
@@ -992,7 +991,76 @@
  #include <board_bcm963xx.h>
  
  #define PFX   "board_bcm963xx: "
-@@ -1602,6 +1603,9 @@ int __init board_register_devices(void)
+@@ -817,6 +818,8 @@ static struct board_info __initdata boar
+       .has_enet0                      = 1,
+       .has_enet1                      = 1,
+       .has_pci                        = 1,
++      .has_extspi0                    = 1,
++      .has_extspi1                    = 1,
+ 
+       .enet0 = {
+               .has_phy                = 1,
+@@ -912,6 +915,7 @@ static struct board_info __initdata boar
+       .has_enet0                      = 1,
+       .has_enet1                      = 1,
+       .has_pci                        = 1,
++      .has_extspi1                    = 1,
+ 
+       .enet0 = {
+               .has_phy                = 1,
+@@ -1007,6 +1011,8 @@ static struct board_info __initdata boar
+       .has_enet0                      = 1,
+       .has_enet1                      = 1,
+       .has_pci                        = 1,
++      .has_extspi0                    = 1,
++      .has_extspi1                    = 1,
+ 
+       .enet0 = {
+               .has_phy                = 1,
+@@ -1100,6 +1106,8 @@ static struct board_info __initdata boar
+       .has_enet0                      = 1,
+       .has_enet1                      = 1,
+       .has_pci                        = 1,
++      .has_extspi0                    = 1,
++      .has_extspi1                    = 1,
+ 
+       .enet0 = {
+               .has_phy                = 1,
+@@ -1190,6 +1198,7 @@ static struct board_info __initdata boar
+       .has_enet0                      = 1,
+       .has_enet1                      = 1,
+       .has_pci                        = 1,
++      .has_extspi1                    = 1,
+ 
+       .enet0 = {
+               .has_phy                = 1,
+@@ -1493,8 +1502,25 @@ void __init board_prom_init(void)
+                               GPIO_MODE_6348_G0_EXT_MII;
+       }
+ 
++      if (BCMCPU_IS_6358())
++              val |= GPIO_MODE_6358_EXTRA_SPI_SS;
++
+       bcm_gpio_writel(val, GPIO_MODE_REG);
+ 
++      if (board.has_extspi0) {
++              if (gpio_request(32, "extspi0"))
++                      printk(KERN_ERR PFX "extspi0 gpio error");
++              else
++                      gpio_direction_output(32, 1);
++      }
++
++      if (board.has_extspi1) {
++              if (gpio_request(33, "extspi1"))
++                      printk(KERN_ERR PFX "extspi1 gpio error");
++              else
++                      gpio_direction_output(33, 1);
++      }
++
+       /* Generate MAC address for WLAN and
+        * register our SPROM */
+ #ifdef CONFIG_SSB_PCIHOST
+@@ -1602,6 +1628,9 @@ int __init board_register_devices(void)
        if (board.num_spis)
                spi_register_board_info(board.spis, board.num_spis);
  
@@ -1002,3 +1070,14 @@
        /* read base address of boot chip select (0) */
        if (BCMCPU_IS_6345())
                val = 0x1fc00000;
+--- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
++++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
+@@ -48,6 +48,8 @@ struct board_info {
+       unsigned int    has_uart0:1;
+       unsigned int    has_uart1:1;
+       unsigned int    has_udc0:1;
++      unsigned int    has_extspi0:1;
++      unsigned int    has_extspi1:1;
+ 
+       /* ethernet config */
+       struct bcm63xx_enet_platform_data enet0;
-- 
1.7.3.2

_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to