Updates on mcbsp driver (take #3)
Subsystems (5)
cover Updates on mcbsp driver (take #3)
From: Eduardo Valentin <[email protected]>
Hi Tony,
Here is the updated version of my previous patches. As on take #2, DMA and IRQ definitions were left as they are. Chandra is going to send his work on top of this series.
This series adds Tony's comments about clock usage on plat-omap/mcbsp.c. Now it is done only with usual clk_* functions calls. But a fake clock is created under mach-omap[1,2] to enable / disable correct clocks when necessary. I also included Tony's patch to fix clock definitions for 24xx.
This patch series updates mcbsp driver by transforming it into a platform driver. This is a very initial implementation. Basically it moves machine specific code to their correct place and creates the platform driver necessary structures.
It must be working for previous boards. For omap34xx it should work for mcbsp 1 and 2.
In order to do not break other places, I tryied to do not change previous API. But future improvements are needed.
Clock definitions for mcbsp 1 and 2 were also modified to add correct support for omap34xx.
Comments are wellcome.
Cheers,
Eduardo Valentin (4):
PLAT-OMAP: MCBSP: Tranform into platform driver
MACH-OMAP1: MCBSP: Add support for mcbsp on mach-omap1 Fix mcbsp clock definition on clock34xx.h
MACH-OMAP2: MCBSP: Add support for mcbsp on mach-omap2
Tony Lindgren (1):
ARM: OMAP: Fix 24xx mcbsp clocks
arch/arm/mach-omap1/Makefile | 2 + arch/arm/mach-omap1/mcbsp.c | 249 ++++++++++++++ arch/arm/mach-omap2/Makefile | 2 + arch/arm/mach-omap2/clock24xx.h | 30 ++- arch/arm/mach-omap2/clock34xx.h | 30 ++- arch/arm/mach-omap2/mcbsp.c | 190 +++++++++++ arch/arm/plat-omap/devices.c | 45 +++ arch/arm/plat-omap/mcbsp.c | 662 ++++++++++++++----------------------- include/asm-arm/arch-omap/mcbsp.h | 62 ++++- 9 files changed, 841 insertions(+), 431 deletions(-) create mode 100644 arch/arm/mach-omap1/mcbsp.c create mode 100644 arch/arm/mach-omap2/mcbsp.c
PATCH 2/5 MACH-OMAP1: MCBSP: Add support for mcbsp on mach-omap1
From: Eduardo Valentin <[email protected]>
This patch adds support for mach-omap1 based on current mcbsp platform driver.
--- arch/arm/mach-omap1/Makefile | 2 + arch/arm/mach-omap1/mcbsp.c | 249 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 251 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap1/mcbsp.c
arch/arm/mach-omap1/Makefile +2 -0
@@ -5,6 +5,8 @@ # Common support obj-y := io.o id.o sram.o clock.o irq.o mux.o serial.o devices.o +obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o + obj-$(CONFIG_OMAP_MPU_TIMER) += time.o obj-$(CONFIG_OMAP_32K_TIMER) += timer32k.o
arch/arm/mach-omap1/mcbsp.c new file +249 -0
249 lines not on this page · raw message
Signature · 1 line
1.5.5.GIT
PATCH 5/5 MACH-OMAP2: MCBSP: Add support for mcbsp on mach-omap2
In reply to Eduardo ValentinFrom: Eduardo Valentin <[email protected]>
This patch adds support for mach-omap2 based on current mcbsp platform driver.
--- arch/arm/mach-omap2/Makefile | 2 + arch/arm/mach-omap2/mcbsp.c | 190 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 192 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap2/mcbsp.c
arch/arm/mach-omap2/Makefile +2 -0
@@ -7,6 +7,8 @@ obj-y := irq.o id.o io.o memory.o control.o prcm.o clock.o mux.o \ devices.o serial.o gpmc.o timer-gp.o powerdomain.o \ clockdomain.o +obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o + # Functions loaded to SRAM obj-$(CONFIG_ARCH_OMAP2) += sram24xx.o obj-$(CONFIG_ARCH_OMAP3) += sram34xx.o
arch/arm/mach-omap2/mcbsp.c new file +190 -0
190 lines not on this page · raw message
Signature · 1 line
1.5.5.GIT
PATCH 4/5 Fix mcbsp clock definition on clock34xx.h
In reply to Eduardo ValentinFrom: Eduardo Valentin <[email protected]>
This patch fix the clock definition for mcbsps on clock34xx.h. Device identification must be done using .id field, not only name field.
--- arch/arm/mach-omap2/clock34xx.h | 30 ++++++++++++++++++++---------- 1 files changed, 20 insertions(+), 10 deletions(-)
arch/arm/mach-omap2/clock34xx.h +20 -10
@@ -1480,7 +1480,8 @@ static const struct clksel mcbsp_15_clksel[] = { };static struct clk mcbsp5_fck = { - .name ="mcbsp5_fck" , + .name ="mcbsp_fck" , + .id =5 , .init = &omap2_init_clksel_parent, .enable_reg =OMAP_CM_REGADDR (CORE_MOD ,CM_FCLKEN1 ), .enable_bit =OMAP3430_EN_MCBSP5_SHIFT ,
@@ -1493,7 +1494,8 @@ static struct clk mcbsp5_fck = { };static struct clk mcbsp1_fck = { - .name ="mcbsp1_fck" , + .name ="mcbsp_fck" , + .id =1 , .init = &omap2_init_clksel_parent, .enable_reg =OMAP_CM_REGADDR (CORE_MOD ,CM_FCLKEN1 ), .enable_bit =OMAP3430_EN_MCBSP1_SHIFT ,
@@ -1941,7 +1943,8 @@ static struct clk gpt10_ick = { };static struct clk mcbsp5_ick = { - .name ="mcbsp5_ick" , + .name ="mcbsp_ick" , + .id =5 , .parent = &core_l4_ick, .enable_reg =OMAP_CM_REGADDR (CORE_MOD ,CM_ICLKEN1 ), .enable_bit =OMAP3430_EN_MCBSP5_SHIFT ,
@@ -1951,7 +1954,8 @@ static struct clk mcbsp5_ick = { };static struct clk mcbsp1_ick = { - .name ="mcbsp1_ick" , + .name ="mcbsp_ick" , + .id =1 , .parent = &core_l4_ick, .enable_reg =OMAP_CM_REGADDR (CORE_MOD ,CM_ICLKEN1 ), .enable_bit =OMAP3430_EN_MCBSP1_SHIFT ,
@@ -2754,7 +2758,8 @@ static struct clk gpt2_ick = { };static struct clk mcbsp2_ick = { - .name ="mcbsp2_ick" , + .name ="mcbsp_ick" , + .id =2 , .parent = &per_l4_ick, .enable_reg =OMAP_CM_REGADDR (OMAP3430_PER_MOD ,CM_ICLKEN ), .enable_bit =OMAP3430_EN_MCBSP2_SHIFT ,
@@ -2764,7 +2769,8 @@ static struct clk mcbsp2_ick = { };static struct clk mcbsp3_ick = { - .name ="mcbsp3_ick" , + .name ="mcbsp_ick" , + .id =3 , .parent = &per_l4_ick, .enable_reg =OMAP_CM_REGADDR (OMAP3430_PER_MOD ,CM_ICLKEN ), .enable_bit =OMAP3430_EN_MCBSP3_SHIFT ,
@@ -2774,7 +2780,8 @@ static struct clk mcbsp3_ick = { };static struct clk mcbsp4_ick = { - .name ="mcbsp4_ick" , + .name ="mcbsp_ick" , + .id =4 , .parent = &per_l4_ick, .enable_reg =OMAP_CM_REGADDR (OMAP3430_PER_MOD ,CM_ICLKEN ), .enable_bit =OMAP3430_EN_MCBSP4_SHIFT ,
@@ -2790,7 +2797,8 @@ static const struct clksel mcbsp_234_clksel[] = { };static struct clk mcbsp2_fck = { - .name ="mcbsp2_fck" , + .name ="mcbsp_fck" , + .id =2 , .init = &omap2_init_clksel_parent, .enable_reg =OMAP_CM_REGADDR (OMAP3430_PER_MOD ,CM_FCLKEN ), .enable_bit =OMAP3430_EN_MCBSP2_SHIFT ,
@@ -2803,7 +2811,8 @@ static struct clk mcbsp2_fck = { };static struct clk mcbsp3_fck = { - .name ="mcbsp3_fck" , + .name ="mcbsp_fck" , + .id =3 , .init = &omap2_init_clksel_parent, .enable_reg =OMAP_CM_REGADDR (OMAP3430_PER_MOD ,CM_FCLKEN ), .enable_bit =OMAP3430_EN_MCBSP3_SHIFT ,
@@ -2816,7 +2825,8 @@ static struct clk mcbsp3_fck = { };static struct clk mcbsp4_fck = { - .name ="mcbsp4_fck" , + .name ="mcbsp_fck" , + .id =4 , .init = &omap2_init_clksel_parent, .enable_reg =OMAP_CM_REGADDR (OMAP3430_PER_MOD ,CM_FCLKEN ), .enable_bit =OMAP3430_EN_MCBSP4_SHIFT ,
Signature · 1 line
1.5.5.GIT
PATCH 1/5 PLAT-OMAP: MCBSP: Transform into platform driver
In reply to Eduardo ValentinFrom: Eduardo Valentin <[email protected]>
This patch transform mcbsp code into a very initial implementation of a platform driver.
It also gets ride of ifdefs on mcbsp.c code.
To do it, a platform data structure was defined.
Platform devices are located in arch/arm/plat-omap/devices.c
--- arch/arm/plat-omap/devices.c | 45 +++ arch/arm/plat-omap/mcbsp.c | 662 ++++++++++++++----------------------- include/asm-arm/arch-omap/mcbsp.h | 62 ++++- 3 files changed, 358 insertions(+), 411 deletions(-)
arch/arm/plat-omap/devices.c +45 -0
@@ -27,6 +27,7 @@#include <asm/arch/gpio.h> #include <asm/arch/menelaus.h> #include <asm/arch/dsp_common.h> +#include <asm/arch/mcbsp.h> #if defined(CONFIG_OMAP_DSP ) || defined(CONFIG_OMAP_DSP_MODULE )
@@ -150,6 +151,49 @@ static inline void omap_init_kp(void) {}#endif /*-------------------------------------------------------------------------*/ +#if defined(CONFIG_OMAP_MCBSP ) || defined(CONFIG_OMAP_MCBSP_MODULE ) + +static struct platform_device omap_mcbsp_devices[OMAP_MAX_MCBSP_COUNT ]; +static int mcbsps_configured; + +void omap_mcbsp_register_board_cfg (struct omap_mcbsp_platform_data *config, +int size) +{ +int i; + +if (size >OMAP_MAX_MCBSP_COUNT ) { +printk (KERN_WARNING "Registered too many McBSPs platform_data." +" Using maximum (%d) available.\n" , +OMAP_MAX_MCBSP_COUNT ); + size =OMAP_MAX_MCBSP_COUNT ; + } + +for (i =0 ; i < size; i++) { +struct platform_device *new_mcbsp = &omap_mcbsp_devices[i]; + new_mcbsp->name ="omap-mcbsp" ; + new_mcbsp->id = i +1 ; + new_mcbsp->dev.platform_data = &config[i]; + } + mcbsps_configured = size; +} + +static void __init omap_init_mcbsp (void ) +{ +int i; + +for (i =0 ; i < mcbsps_configured; i++) +platform_device_register (&omap_mcbsp_devices[i]); +} +#else +void omap_mcbsp_register_board_cfg (struct omap_mcbsp_platform_data *config, +int size) +{ } + +static inline void __init omap_init_mcbsp (void ) +{ } +#endif + +/*-------------------------------------------------------------------------*/ #if defined(CONFIG_MMC_OMAP ) || defined(CONFIG_MMC_OMAP_MODULE ) \ || defined(CONFIG_MMC_OMAP_HS ) || defined(CONFIG_MMC_OMAP_HS_MODULE )
@@ -511,6 +555,7 @@ static int __init omap_init_devices(void)*/ omap_init_dsp ();omap_init_kp (); +omap_init_mcbsp ();omap_init_mmc ();omap_init_uwire ();omap_init_wdt ();
arch/arm/plat-omap/mcbsp.c +253 -409
919 lines not on this page · raw message
include/asm-arm/arch-omap/mcbsp.h +60 -2
93 lines not on this page · raw message
Signature · 1 line
1.5.5.GIT
Re: [PATCH 2/5] MACH-OMAP1: MCBSP: Add support for mcbsp on mach-omap1
In reply to Eduardo ValentinHiya,
Quoted 73 lines · Eduardo Valentin
+static struct
omap_mcbsp_platform_dataomap1_mcbsp_pdata[] = { +#ifdefCONFIG_ARCH_OMAP730
+ {+ .virt_base = io_p2v(OMAP730_MCBSP1_BASE), + .dma_rx_sync = OMAP_DMA_MCBSP1_RX, + .dma_tx_sync = OMAP_DMA_MCBSP1_TX, + .rx_irq = INT_730_McBSP1RX, + .tx_irq = INT_730_McBSP1TX, + .ops = &omap1_mcbsp_ops, + }, + { + .virt_base = io_p2v(OMAP730_MCBSP2_BASE), + .dma_rx_sync = OMAP_DMA_MCBSP3_RX, + .dma_tx_sync = OMAP_DMA_MCBSP3_TX, + .rx_irq = INT_730_McBSP2RX, + .tx_irq = INT_730_McBSP2TX + .ops = &omap1_mcbsp_ops, + }, +#endif +#ifdef CONFIG_ARCH_OMAP15XX + { + .virt_base = OMAP1510_MCBSP1_BASE, + .dma_rx_sync = OMAP_DMA_MCBSP1_RX, + .dma_tx_sync = OMAP_DMA_MCBSP1_TX, + .rx_irq = INT_McBSP1RX, + .tx_irq = INT_McBSP1TX, + .ops = &omap1_mcbsp_ops, + .clk_name = "mcbsp_clk", + }, + { + .virt_base = io_p2v(OMAP1510_MCBSP2_BASE), + .dma_rx_sync = OMAP_DMA_MCBSP2_RX, + .dma_tx_sync = OMAP_DMA_MCBSP2_TX, + .rx_irq = INT_1510_SPI_RX, + .tx_irq = INT_1510_SPI_TX, + .ops = &omap1_mcbsp_ops, + }, + { + .virt_base = OMAP1510_MCBSP3_BASE, + .dma_rx_sync = OMAP_DMA_MCBSP3_RX, + .dma_tx_sync = OMAP_DMA_MCBSP3_TX, + .rx_irq = INT_McBSP3RX, + .tx_irq = INT_McBSP3TX, + .ops = &omap1_mcbsp_ops, + .clk_name = "mcbsp_clk", + }, +#endif +#ifdef CONFIG_ARCH_OMAP16XX + { + .virt_base = OMAP1610_MCBSP1_BASE, + .dma_rx_sync = OMAP_DMA_MCBSP1_RX, + .dma_tx_sync = OMAP_DMA_MCBSP1_TX, + .rx_irq = INT_McBSP1RX, + .tx_irq = INT_McBSP1TX, + .ops = &omap1_mcbsp_ops, + .clk_name = "mcbsp_clk", + }, + { + .virt_base = io_p2v(OMAP1610_MCBSP2_BASE), + .dma_rx_sync = OMAP_DMA_MCBSP2_RX, + .dma_tx_sync = OMAP_DMA_MCBSP2_TX, + .rx_irq = INT_1610_McBSP2_RX, + .tx_irq = INT_1610_McBSP2_TX, + .ops = &omap1_mcbsp_ops, + }, + { + .virt_base = OMAP1610_MCBSP3_BASE, + .dma_rx_sync = OMAP_DMA_MCBSP3_RX, + .dma_tx_sync = OMAP_DMA_MCBSP3_TX, + .rx_irq = INT_McBSP3RX, + .tx_irq = INT_McBSP3TX, + .ops = &omap1_mcbsp_ops, + .clk_name = "mcbsp_clk",
Quoted 3 lines
+ },
+#endif
+};
I think you need a runtime omap model check here. Otherwise if you have all three models enabled in the config (I don't remember if that is supported but that's not the point) you'll get eight platform_devices. That will not Oops because there's a sanity check in omap_mcbsp_register_board_cfg() but only the first three will get registered.
There is a runtime check in the original version.
Same applies to PATCH 5/5 for omap2.
Cheers,
Andrew
RE: [PATCH 5/5] MACH-OMAP2: MCBSP: Add support for mcbsp on mach-omap2
In reply to Eduardo ValentinQuoted 33 lines
arch/arm/mach-omap2/mcbsp.c new file +33
-0+ +static struct omap_mcbsp_platform_data omap2_mcbsp_pdata[] = { +#ifdef CONFIG_ARCH_OMAP24XX + { + .virt_base =IO_ADDRESS (OMAP24XX_MCBSP1_BASE ), + .dma_rx_sync =OMAP24XX_DMA_MCBSP1_RX , + .dma_tx_sync =OMAP24XX_DMA_MCBSP1_TX , + .rx_irq =INT_24XX_MCBSP1_IRQ_RX , + .tx_irq =INT_24XX_MCBSP1_IRQ_TX , + .ops = &omap2_mcbsp_ops, + .clk_name ="mcbsp_clk" , + }, + { + .virt_base =IO_ADDRESS (OMAP24XX_MCBSP2_BASE ), + .dma_rx_sync =OMAP24XX_DMA_MCBSP2_RX , + .dma_tx_sync =OMAP24XX_DMA_MCBSP2_TX , + .rx_irq =INT_24XX_MCBSP2_IRQ_RX , + .tx_irq =INT_24XX_MCBSP2_IRQ_TX , + .ops = &omap2_mcbsp_ops, + .clk_name ="mcbsp_clk" , + }, +#endif +#ifdef CONFIG_ARCH_OMAP34XX + { + .virt_base =IO_ADDRESS (OMAP34XX_MCBSP1_BASE ), + .dma_rx_sync =OMAP24XX_DMA_MCBSP1_RX , + .dma_tx_sync =OMAP24XX_DMA_MCBSP1_TX , + .rx_irq =INT_24XX_MCBSP1_IRQ_RX , + .tx_irq =INT_24XX_MCBSP1_IRQ_TX , + .ops = &omap2_mcbsp_ops, + .clk_name ="mcbsp_clk" , + }, + {
arch/arm/mach-omap2/mcbsp.c line 173
Quoted 10 lines
arch/arm/mach-omap2/mcbsp.c new file +10
-0+ .virt_base = IO_ADDRESS(OMAP34XX_MCBSP2_BASE), + .dma_rx_sync = OMAP24XX_DMA_MCBSP2_RX, + .dma_tx_sync = OMAP24XX_DMA_MCBSP2_TX, + .rx_irq = INT_24XX_MCBSP2_IRQ_RX, + .tx_irq = INT_24XX_MCBSP2_IRQ_TX, + .ops = &omap2_mcbsp_ops, + .clk_name = "mcbsp_clk", + }, +#endif +};
I guess Tony won't like this as it will break support for multi-omap.
Regards,
Anand
Tony Lindgren
maintainerRe: [PATCH 5/5] MACH-OMAP2: MCBSP: Add support for mcbsp on mach-omap2
Quoted 37 lines · Gadiyar, Anand
Quoted 37 lines
arch/arm/mach-omap2/mcbsp.c new file +37
-0+ +static struct omap_mcbsp_platform_data omap2_mcbsp_pdata[] = { +#ifdef CONFIG_ARCH_OMAP24XX + { + .virt_base =IO_ADDRESS (OMAP24XX_MCBSP1_BASE ), + .dma_rx_sync =OMAP24XX_DMA_MCBSP1_RX , + .dma_tx_sync =OMAP24XX_DMA_MCBSP1_TX , + .rx_irq =INT_24XX_MCBSP1_IRQ_RX , + .tx_irq =INT_24XX_MCBSP1_IRQ_TX , + .ops = &omap2_mcbsp_ops, + .clk_name ="mcbsp_clk" , + }, + { + .virt_base =IO_ADDRESS (OMAP24XX_MCBSP2_BASE ), + .dma_rx_sync =OMAP24XX_DMA_MCBSP2_RX , + .dma_tx_sync =OMAP24XX_DMA_MCBSP2_TX , + .rx_irq =INT_24XX_MCBSP2_IRQ_RX , + .tx_irq =INT_24XX_MCBSP2_IRQ_TX , + .ops = &omap2_mcbsp_ops, + .clk_name ="mcbsp_clk" , + }, +#endif +#ifdef CONFIG_ARCH_OMAP34XX + { + .virt_base =IO_ADDRESS (OMAP34XX_MCBSP1_BASE ), + .dma_rx_sync =OMAP24XX_DMA_MCBSP1_RX , + .dma_tx_sync =OMAP24XX_DMA_MCBSP1_TX , + .rx_irq =INT_24XX_MCBSP1_IRQ_RX , + .tx_irq =INT_24XX_MCBSP1_IRQ_TX , + .ops = &omap2_mcbsp_ops, + .clk_name ="mcbsp_clk" , + }, + { + .virt_base =IO_ADDRESS (OMAP34XX_MCBSP2_BASE ), + .dma_rx_sync =OMAP24XX_DMA_MCBSP2_RX , + .dma_tx_sync =OMAP24XX_DMA_MCBSP2_TX , + .rx_irq =INT_24XX_MCBSP2_IRQ_RX ,
Quoted 8 lines
arch/arm/mach-omap2/mcbsp.c line 173
Quoted 6 lines
arch/arm/mach-omap2/mcbsp.c new file +6
-0+ .tx_irq = INT_24XX_MCBSP2_IRQ_TX, + .ops = &omap2_mcbsp_ops, + .clk_name = "mcbsp_clk", + }, +#endif +};I guess Tony won't like this as it will break support for multi-omap.
Well looks like they both can be compiled in, so it should be fine :) That is assuming 242x and 243x have same OMAP2XX_MCBSP[12]_BASE.
And IO_ADDRESS will eventually be OMAP2_IO_ADDRESS, which is same for 24xx and 34xx.
Regards,
Tony