Re: [PATCH][RFC] McSPI Slave and DMA,FIFO support
"Hemanth V" writes: > - Original Message - > From: "Gadiyar, Anand" > To: "V, Hemanth" ; "Kevin Hilman" > > > >> >> Index: linux-omap-2.6/arch/arm/mach-omap2/devices.c >> >> === >> >> --- linux-omap-2.6.orig/arch/arm/mach-omap2/devices.c 2009-05-14 >> >> 12:38:50.0 +0530 >> >> +++ linux-omap-2.6/arch/arm/mach-omap2/devices.c 2009-05-15 >> >> 16:53:38.0 +0530 > > > >> >> }; >> >> >> >> static struct resource omap2_mcspi2_resources[] = { >> >> @@ -351,6 +359,14 @@ >> >> >> >> static void omap_init_mcspi(void) >> >> { >> >> + >> >> + if (cpu_is_omap3430()) { >> >> + omap_cfg_reg(AA3_3430_McSPI2_CLK); >> >> + omap_cfg_reg(Y2_3430_McSPI2_SIMO); >> >> + omap_cfg_reg(Y3_3430_McSPI2_SOMI); >> >> + omap_cfg_reg(Y4_3430_McSPI2_CS0); >> >> + } >> >> + > >>This will change the mux mode for these pads for all OMAP3 boards, >>even if they do not wish to use McSPI2. In particular, Beagleboard >>will be affected as it uses HSUSB on Port2 and these pads overlap. > > I could add an option like below to plat-omap/Kconfig under > OMAP Feature Selections. Kevin, Your thoughts on this > > config OMAP3430_ENABLE_SPI2_PIN_MUX >bool "Enable SPI2 pin mux configuration for OMAP3430" >depends on ARCH_OMAP3430 >default n >help >Enable pin mux for SPI2 on OMAP3430 platform. Note >that the same pins are used for EHCI port2 operation. Hence >enabling this option effectively disables EHCI port 2 Don't use compile-time setup for this, use runtime. Mux setup is board-specific and should be done in board init code. Kevin -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH][RFC] McSPI Slave and DMA,FIFO support
- Original Message - From: "Gadiyar, Anand" To: "V, Hemanth" ; "Kevin Hilman" >> Index: linux-omap-2.6/arch/arm/mach-omap2/devices.c >> === >> --- linux-omap-2.6.orig/arch/arm/mach-omap2/devices.c 2009-05-14 >> 12:38:50.0 +0530 >> +++ linux-omap-2.6/arch/arm/mach-omap2/devices.c 2009-05-15 >> 16:53:38.0 +0530 >> }; >> >> static struct resource omap2_mcspi2_resources[] = { >> @@ -351,6 +359,14 @@ >> >> static void omap_init_mcspi(void) >> { >> + >> + if (cpu_is_omap3430()) { >> + omap_cfg_reg(AA3_3430_McSPI2_CLK); >> + omap_cfg_reg(Y2_3430_McSPI2_SIMO); >> + omap_cfg_reg(Y3_3430_McSPI2_SOMI); >> + omap_cfg_reg(Y4_3430_McSPI2_CS0); >> + } >> + This will change the mux mode for these pads for all OMAP3 boards, even if they do not wish to use McSPI2. In particular, Beagleboard will be affected as it uses HSUSB on Port2 and these pads overlap. I could add an option like below to plat-omap/Kconfig under OMAP Feature Selections. Kevin, Your thoughts on this config OMAP3430_ENABLE_SPI2_PIN_MUX bool "Enable SPI2 pin mux configuration for OMAP3430" depends on ARCH_OMAP3430 default n help Enable pin mux for SPI2 on OMAP3430 platform. Note that the same pins are used for EHCI port2 operation. Hence enabling this option effectively disables EHCI port 2 usage. -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH][RFC] McSPI Slave and DMA,FIFO support
> >> Index: linux-omap-2.6/arch/arm/mach-omap2/devices.c > >> === > >> --- linux-omap-2.6.orig/arch/arm/mach-omap2/devices.c 2009-05-14 > >> 12:38:50.0 +0530 > >> +++ linux-omap-2.6/arch/arm/mach-omap2/devices.c 2009-05-15 > >> 16:53:38.0 +0530 > >> }; > >> > >> static struct resource omap2_mcspi2_resources[] = { > >> @@ -351,6 +359,14 @@ > >> > >> static void omap_init_mcspi(void) > >> { > >> + > >> + if (cpu_is_omap3430()) { > >> + omap_cfg_reg(AA3_3430_McSPI2_CLK); > >> + omap_cfg_reg(Y2_3430_McSPI2_SIMO); > >> + omap_cfg_reg(Y3_3430_McSPI2_SOMI); > >> + omap_cfg_reg(Y4_3430_McSPI2_CS0); > >> + } > >> + This will change the mux mode for these pads for all OMAP3 boards, even if they do not wish to use McSPI2. In particular, Beagleboard will be affected as it uses HSUSB on Port2 and these pads overlap. Regards, Anand -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH][RFC] McSPI Slave and DMA,FIFO support
- Original Message - From: "Kevin Hilman" Subject: Re: [PATCH][RFC] McSPI Slave and DMA,FIFO support "Hemanth V" writes: This patch adds support for McSPI slave and FIFO. DMA and FIFO could be enabled together for better throughput. Platform config parameters have been added to enable these features on any particular McSPI controller. FIFO can be enabled by defining fifo_depth parameter. fifo_depth needs to be a multiple of buffer size that is used for read/write. These features are useful when you have high throughput devices like WLAN or Modem connected over SPI. Signed-off-by: Hemanth V --- arch/arm/mach-omap2/board-3430sdp.c | 19 + arch/arm/mach-omap2/devices.c | 16 + arch/arm/mach-omap2/mux.c | 11 arch/arm/plat-omap/include/mach/mcspi.h | 13 + arch/arm/plat-omap/include/mach/mux.h |7 drivers/spi/omap2_mcspi.c | 353 6 files changed, 379 insertions(+), 40 deletions(-) I think you should break this up into a series: 1) SPI driver changes (which could go upstream after review/approval) 2) mux changes 3) OMAP init changes (devices.c) 4) SDP changes, which are debug only Where (2) and (3) could probably be combined. Yes, will create a series of 3 patches. Index: linux-omap-2.6/arch/arm/mach-omap2/board-3430sdp.c === --- linux-omap-2.6.orig/arch/arm/mach-omap2/board-3430sdp.c 2009-05-14 12:38:50.0 +0530 +++ linux-omap-2.6/arch/arm/mach-omap2/board-3430sdp.c 2009-05-14 19:48:35.0 +0530 @@ -228,6 +228,13 @@ .single_channel = 1, /* 0: slave, 1: master */ }; +#ifdef CONFIG_SPI_DEBUG +static struct omap2_mcspi_device_config dummy_mcspi_config = { + .turbo_mode = 0, + .single_channel = 1, /* 0: slave, 1: master */ +}; +#endif + static struct spi_board_info sdp3430_spi_board_info[] __initdata = { [0] = { /* @@ -242,6 +249,18 @@ .irq = 0, .platform_data = &tsc2046_config, }, +#ifdef CONFIG_SPI_DEBUG + [1] = { + /* SPI test driver attached to SPI2 controller by + * default + */ + .modalias = "spitst", + .bus_num = 2, + .chip_select = 0, + .max_speed_hz = 150, + .controller_data = &dummy_mcspi_config, + }, +#endif }; static struct platform_device sdp3430_lcd_device = { Index: linux-omap-2.6/arch/arm/mach-omap2/devices.c === --- linux-omap-2.6.orig/arch/arm/mach-omap2/devices.c 2009-05-14 12:38:50.0 +0530 +++ linux-omap-2.6/arch/arm/mach-omap2/devices.c 2009-05-15 16:53:38.0 +0530 @@ -257,8 +257,12 @@ #define OMAP2_MCSPI3_BASE 0x480b8000 #define OMAP2_MCSPI4_BASE 0x480ba000 +#define OMAP2_MCSPI_MASTER 0 +#define OMAP2_MCSPI_SLAVE 1 + If these are to be 'mode' flags for 'struct omap2_mcspi_platform_config' then they should be part of mcspi.h, not defined here. Will move them to mcspi.h static struct omap2_mcspi_platform_config omap2_mcspi1_config = { .num_cs = 4, + .force_cs_mode = 1, }; static struct resource omap2_mcspi1_resources[] = { @@ -281,6 +285,10 @@ static struct omap2_mcspi_platform_config omap2_mcspi2_config = { .num_cs = 2, + .mode = OMAP2_MCSPI_MASTER, + .dma_mode = 1, + .force_cs_mode = 0, + .fifo_depth = 0, Setting these init values to zero is redundant. This is to serve as an easy reference for someone trying to enable these features. }; static struct resource omap2_mcspi2_resources[] = { @@ -351,6 +359,14 @@ static void omap_init_mcspi(void) { + + if (cpu_is_omap3430()) { + omap_cfg_reg(AA3_3430_McSPI2_CLK); + omap_cfg_reg(Y2_3430_McSPI2_SIMO); + omap_cfg_reg(Y3_3430_McSPI2_SOMI); + omap_cfg_reg(Y4_3430_McSPI2_CS0); + } + platform_device_register(&omap2_mcspi1); platform_device_register(&omap2_mcspi2); #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) Index: linux-omap-2.6/arch/arm/mach-omap2/mux.c === --- linux-omap-2.6.orig/arch/arm/mach-omap2/mux.c 2009-05-14 12:38:50.0 +0530 +++ linux-omap-2.6/arch/arm/mach-omap2/mux.c 2009-05-15 16:18:41.0 +0530 @@ -486,6 +486,17 @@ OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_OUTPUT) MUX_CFG_34XX("J25_34XX_GPIO170", 0x1c6, OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT) + +/* McSPI */ +MUX_CFG_34XX("AA3_3430_McSPI2_CLK", 0x1d6, + OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT) +MUX_CFG_34XX("Y2_3430_McSPI2_SIMO", 0x1d8, + OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT) +MUX_CFG_34XX("Y3_3430_McSPI2_SOMI", 0x1da, + OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT) +MUX_CFG_34XX("Y4_3430_McSPI2_CS0", 0x1dc, + OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLDOWN) + }; #define OMAP34XX_PINS_SZ ARRAY_SIZE(omap34xx_pins) Index: linux-omap-2.6/arch/arm/plat-omap/include/mach/mcspi.h ===
Re: [PATCH][RFC] McSPI Slave and DMA,FIFO support
"Hemanth V" writes: > This patch adds support for McSPI slave and FIFO. DMA and FIFO > could be enabled together for better throughput. Platform config > parameters have been added to enable these features on any particular > McSPI controller. > > FIFO can be enabled by defining fifo_depth parameter. fifo_depth needs > to be a multiple of buffer size that is used for read/write. > > These features are useful when you have high throughput devices > like WLAN or Modem connected over SPI. > > Signed-off-by: Hemanth V > > --- > arch/arm/mach-omap2/board-3430sdp.c | 19 + > arch/arm/mach-omap2/devices.c | 16 + > arch/arm/mach-omap2/mux.c | 11 > arch/arm/plat-omap/include/mach/mcspi.h | 13 + > arch/arm/plat-omap/include/mach/mux.h |7 > drivers/spi/omap2_mcspi.c | 353 > > 6 files changed, 379 insertions(+), 40 deletions(-) I think you should break this up into a series: 1) SPI driver changes (which could go upstream after review/approval) 2) mux changes 3) OMAP init changes (devices.c) 4) SDP changes, which are debug only Where (2) and (3) could probably be combined. > Index: linux-omap-2.6/arch/arm/mach-omap2/board-3430sdp.c > === > --- linux-omap-2.6.orig/arch/arm/mach-omap2/board-3430sdp.c 2009-05-14 > 12:38:50.0 +0530 > +++ linux-omap-2.6/arch/arm/mach-omap2/board-3430sdp.c2009-05-14 > 19:48:35.0 +0530 > @@ -228,6 +228,13 @@ > .single_channel = 1,/* 0: slave, 1: master */ > }; > > +#ifdef CONFIG_SPI_DEBUG > +static struct omap2_mcspi_device_config dummy_mcspi_config = { > + .turbo_mode = 0, > + .single_channel = 1, /* 0: slave, 1: master */ > +}; > +#endif > + > static struct spi_board_info sdp3430_spi_board_info[] __initdata = { > [0] = { > /* > @@ -242,6 +249,18 @@ > .irq= 0, > .platform_data = &tsc2046_config, > }, > +#ifdef CONFIG_SPI_DEBUG > + [1] = { > + /* SPI test driver attached to SPI2 controller by > + * default > + */ > + .modalias = "spitst", > + .bus_num= 2, > + .chip_select= 0, > + .max_speed_hz = 150, > + .controller_data= &dummy_mcspi_config, > + }, > +#endif > }; > > static struct platform_device sdp3430_lcd_device = { > Index: linux-omap-2.6/arch/arm/mach-omap2/devices.c > === > --- linux-omap-2.6.orig/arch/arm/mach-omap2/devices.c 2009-05-14 > 12:38:50.0 +0530 > +++ linux-omap-2.6/arch/arm/mach-omap2/devices.c 2009-05-15 > 16:53:38.0 > +0530 > @@ -257,8 +257,12 @@ > #define OMAP2_MCSPI3_BASE0x480b8000 > #define OMAP2_MCSPI4_BASE0x480ba000 > > +#define OMAP2_MCSPI_MASTER 0 > +#define OMAP2_MCSPI_SLAVE1 > + If these are to be 'mode' flags for 'struct omap2_mcspi_platform_config' then they should be part of mcspi.h, not defined here. > static struct omap2_mcspi_platform_config omap2_mcspi1_config = { > .num_cs = 4, > + .force_cs_mode = 1, > }; > > static struct resource omap2_mcspi1_resources[] = { > @@ -281,6 +285,10 @@ > > static struct omap2_mcspi_platform_config omap2_mcspi2_config = { > .num_cs = 2, > + .mode = OMAP2_MCSPI_MASTER, > + .dma_mode = 1, > + .force_cs_mode = 0, > + .fifo_depth = 0, Setting these init values to zero is redundant. > }; > > static struct resource omap2_mcspi2_resources[] = { > @@ -351,6 +359,14 @@ > > static void omap_init_mcspi(void) > { > + > + if (cpu_is_omap3430()) { > + omap_cfg_reg(AA3_3430_McSPI2_CLK); > + omap_cfg_reg(Y2_3430_McSPI2_SIMO); > + omap_cfg_reg(Y3_3430_McSPI2_SOMI); > + omap_cfg_reg(Y4_3430_McSPI2_CS0); > + } > + > platform_device_register(&omap2_mcspi1); > platform_device_register(&omap2_mcspi2); > #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) > Index: linux-omap-2.6/arch/arm/mach-omap2/mux.c > === > --- linux-omap-2.6.orig/arch/arm/mach-omap2/mux.c 2009-05-14 > 12:38:50.0 > +0530 > +++ linux-omap-2.6/arch/arm/mach-omap2/mux.c 2009-05-15 16:18:41.0 > +0530 > @@ -486,6 +486,17 @@ > OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_OUTPUT) > MUX_CFG_34XX("J25_34XX_GPIO170", 0x1c6, > OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT) > + > +/* McSPI */ > +MUX_CFG_34XX("AA3_3430_McSPI2_CLK", 0x1d6, > + OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT) > +MUX_CFG_34XX("Y2_3430_McSPI2_SIMO", 0x1d8, > + OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT) > +MUX_CFG_34XX("Y3_3430_McSPI2_SOMI", 0x1da, > + OM
[PATCH][RFC] McSPI Slave and DMA,FIFO support
This patch adds support for McSPI slave and FIFO. DMA and FIFO could be enabled together for better throughput. Platform config parameters have been added to enable these features on any particular McSPI controller. FIFO can be enabled by defining fifo_depth parameter. fifo_depth needs to be a multiple of buffer size that is used for read/write. These features are useful when you have high throughput devices like WLAN or Modem connected over SPI. Signed-off-by: Hemanth V --- arch/arm/mach-omap2/board-3430sdp.c | 19 + arch/arm/mach-omap2/devices.c | 16 + arch/arm/mach-omap2/mux.c | 11 arch/arm/plat-omap/include/mach/mcspi.h | 13 + arch/arm/plat-omap/include/mach/mux.h |7 drivers/spi/omap2_mcspi.c | 353 6 files changed, 379 insertions(+), 40 deletions(-) Index: linux-omap-2.6/arch/arm/mach-omap2/board-3430sdp.c === --- linux-omap-2.6.orig/arch/arm/mach-omap2/board-3430sdp.c 2009-05-14 12:38:50.0 +0530 +++ linux-omap-2.6/arch/arm/mach-omap2/board-3430sdp.c 2009-05-14 19:48:35.0 +0530 @@ -228,6 +228,13 @@ .single_channel = 1,/* 0: slave, 1: master */ }; +#ifdef CONFIG_SPI_DEBUG +static struct omap2_mcspi_device_config dummy_mcspi_config = { + .turbo_mode = 0, + .single_channel = 1, /* 0: slave, 1: master */ +}; +#endif + static struct spi_board_info sdp3430_spi_board_info[] __initdata = { [0] = { /* @@ -242,6 +249,18 @@ .irq= 0, .platform_data = &tsc2046_config, }, +#ifdef CONFIG_SPI_DEBUG + [1] = { + /* SPI test driver attached to SPI2 controller by +* default +*/ + .modalias = "spitst", + .bus_num= 2, + .chip_select= 0, + .max_speed_hz = 150, + .controller_data= &dummy_mcspi_config, + }, +#endif }; static struct platform_device sdp3430_lcd_device = { Index: linux-omap-2.6/arch/arm/mach-omap2/devices.c === --- linux-omap-2.6.orig/arch/arm/mach-omap2/devices.c 2009-05-14 12:38:50.0 +0530 +++ linux-omap-2.6/arch/arm/mach-omap2/devices.c2009-05-15 16:53:38.0 +0530 @@ -257,8 +257,12 @@ #define OMAP2_MCSPI3_BASE 0x480b8000 #define OMAP2_MCSPI4_BASE 0x480ba000 +#define OMAP2_MCSPI_MASTER 0 +#define OMAP2_MCSPI_SLAVE 1 + static struct omap2_mcspi_platform_config omap2_mcspi1_config = { .num_cs = 4, + .force_cs_mode = 1, }; static struct resource omap2_mcspi1_resources[] = { @@ -281,6 +285,10 @@ static struct omap2_mcspi_platform_config omap2_mcspi2_config = { .num_cs = 2, + .mode = OMAP2_MCSPI_MASTER, + .dma_mode = 1, + .force_cs_mode = 0, + .fifo_depth = 0, }; static struct resource omap2_mcspi2_resources[] = { @@ -351,6 +359,14 @@ static void omap_init_mcspi(void) { + + if (cpu_is_omap3430()) { + omap_cfg_reg(AA3_3430_McSPI2_CLK); + omap_cfg_reg(Y2_3430_McSPI2_SIMO); + omap_cfg_reg(Y3_3430_McSPI2_SOMI); + omap_cfg_reg(Y4_3430_McSPI2_CS0); + } + platform_device_register(&omap2_mcspi1); platform_device_register(&omap2_mcspi2); #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) Index: linux-omap-2.6/arch/arm/mach-omap2/mux.c === --- linux-omap-2.6.orig/arch/arm/mach-omap2/mux.c 2009-05-14 12:38:50.0 +0530 +++ linux-omap-2.6/arch/arm/mach-omap2/mux.c2009-05-15 16:18:41.0 +0530 @@ -486,6 +486,17 @@ OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_OUTPUT) MUX_CFG_34XX("J25_34XX_GPIO170", 0x1c6, OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT) + +/* McSPI */ +MUX_CFG_34XX("AA3_3430_McSPI2_CLK", 0x1d6, + OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT) +MUX_CFG_34XX("Y2_3430_McSPI2_SIMO", 0x1d8, + OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT) +MUX_CFG_34XX("Y3_3430_McSPI2_SOMI", 0x1da, + OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT) +MUX_CFG_34XX("Y4_3430_McSPI2_CS0", 0x1dc, + OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLDOWN) + }; #define OMAP34XX_PINS_SZ ARRAY_SIZE(omap34xx_pins) Index: linux-omap-2.6/arch/arm/plat-omap/include/mach/mcspi.h === --- linux-omap-2.6.orig/arch/arm/plat-omap/include/mach/mcspi.h 2009-05-14 12:38:54.0 +0530 +++ linux-omap-2.6/arch/arm/plat-omap/include/mach/mcspi.h 2009-05-14 19:48:35.0 +0530 @@ -3,6 +3,19 @@ struct omap2_mcspi_platform_config { unsigned