* [PATCH 2/2] McBSP preamble patch for 34xx support,
@ 2008-08-08 6:06 chandra shekhar
2008-08-08 6:26 ` Tony Lindgren
0 siblings, 1 reply; 4+ messages in thread
From: chandra shekhar @ 2008-08-08 6:06 UTC (permalink / raw)
To: linux-omap
Hi,
this patch modifies the read write function to do
16/32 bit read write depending on CPU.
Regards,
Chandra Shekhar
Signed-off-by: Chandra Shekhar< x0044955@ti.com>
---
arch/arm/mach-omap1/mcbsp.c | 1 +
arch/arm/mach-omap2/mcbsp.c | 3 +++
arch/arm/plat-omap/mcbsp.c | 24 +++++++++++++++++++++++-
include/asm-arm/arch-omap/mcbsp.h | 5 +----
4 files changed, 28 insertions(+), 5 deletions(-)
Index: linux-omap-2.6/arch/arm/mach-omap1/mcbsp.c
===================================================================
--- linux-omap-2.6.orig/arch/arm/mach-omap1/mcbsp.c 2008-08-07
16:40:14.000000000 +0530
+++ linux-omap-2.6/arch/arm/mach-omap1/mcbsp.c 2008-08-07 16:46:30.000000000 +0530
@@ -248,6 +248,7 @@
GFP_KERNEL);
if (!mcbsp_ptr)
return -ENOMEM;
+ mcbsp_32_bit_ops = 0;
if (cpu_is_omap730())
omap_mcbsp_register_board_cfg(omap730_mcbsp_pdata,
Index: linux-omap-2.6/arch/arm/mach-omap2/mcbsp.c
===================================================================
--- linux-omap-2.6.orig/arch/arm/mach-omap2/mcbsp.c 2008-08-07
16:41:17.000000000 +0530
+++ linux-omap-2.6/arch/arm/mach-omap2/mcbsp.c 2008-08-07 16:50:53.000000000 +0530
@@ -232,6 +232,7 @@
if (cpu_is_omap24xx())
omap_mcbsp_count = OMAP24XX_MCBSP_PDATA_SZ;
+
if (cpu_is_omap34xx())
omap_mcbsp_count = OMAP34XX_MCBSP_PDATA_SZ;
@@ -246,6 +247,8 @@
if (cpu_is_omap34xx())
omap_mcbsp_register_board_cfg(omap34xx_mcbsp_pdata,
OMAP34XX_MCBSP_PDATA_SZ);
+ if (!cpu_is_omap2420())
+ mcbsp_32_bit_ops = 1;
return omap_mcbsp_init();
}
Index: linux-omap-2.6/arch/arm/plat-omap/mcbsp.c
===================================================================
--- linux-omap-2.6.orig/arch/arm/plat-omap/mcbsp.c 2008-08-07
16:39:51.000000000 +0530
+++ linux-omap-2.6/arch/arm/plat-omap/mcbsp.c 2008-08-07 16:45:00.000000000 +0530
@@ -29,9 +29,31 @@
struct omap_mcbsp **mcbsp_ptr;
int omap_mcbsp_count;
+int mcbsp_32_bit_ops;
+
+void omap_mcbsp_write(u32 io_base, u16 reg, u32 val)
+{
+ if (!mcbsp_32_bit_ops)
+ __raw_writew((u16)val, io_base + reg);
+ else
+ __raw_writel(val, io_base + reg);
+}
+
+int omap_mcbsp_read(u32 io_base, u16 reg)
+{
+ if (!mcbsp_32_bit_ops)
+ return __raw_readw(io_base + reg);
+ else
+ return __raw_readl(io_base + reg);
+}
+
+#define OMAP_MCBSP_READ(base, reg) \
+ omap_mcbsp_read(base, OMAP_MCBSP_REG_##reg)
+#define OMAP_MCBSP_WRITE(base, reg, val) \
+ omap_mcbsp_write(base, OMAP_MCBSP_REG_##reg, val)
#define omap_mcbsp_check_valid_id(id) (id < omap_mcbsp_count)
-#define id_to_mcbsp_ptr(id) mcbsp_ptr[id];
+#define id_to_mcbsp_ptr(id) mcbsp_ptr[id];
static void omap_mcbsp_dump_reg(u8 id)
{
Index: linux-omap-2.6/include/asm-arm/arch-omap/mcbsp.h
===================================================================
--- linux-omap-2.6.orig/include/asm-arm/arch-omap/mcbsp.h 2008-08-07
16:41:17.000000000 +0530
+++ linux-omap-2.6/include/asm-arm/arch-omap/mcbsp.h 2008-08-07
16:45:00.000000000 +0530
@@ -139,10 +139,6 @@
#endif
-#define OMAP_MCBSP_READ(base, reg) __raw_readw((base) + OMAP_MCBSP_REG_##reg)
-#define OMAP_MCBSP_WRITE(base, reg, val) __raw_writew((val), (base) +
OMAP_MCBSP_REG_##reg)
-
-
/************************** McBSP SPCR1 bit definitions ***********************/
#define RRST 0x0001
#define RRDY 0x0002
@@ -369,6 +365,7 @@
};
extern struct omap_mcbsp **mcbsp_ptr;
extern int omap_mcbsp_count;
+extern int mcbsp_32_bit_ops;
int omap_mcbsp_init(void);
void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data *config,
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH 2/2] McBSP preamble patch for 34xx support,
2008-08-08 6:06 [PATCH 2/2] McBSP preamble patch for 34xx support, chandra shekhar
@ 2008-08-08 6:26 ` Tony Lindgren
2008-08-08 6:52 ` shekhar, chandra
0 siblings, 1 reply; 4+ messages in thread
From: Tony Lindgren @ 2008-08-08 6:26 UTC (permalink / raw)
To: chandra shekhar; +Cc: linux-omap
Hi,
* chandra shekhar <x0044955@ti.com> [080808 09:07]:
> Hi,
>
> this patch modifies the read write function to do
> 16/32 bit read write depending on CPU.
>
> Regards,
> Chandra Shekhar
>
> Signed-off-by: Chandra Shekhar< x0044955@ti.com>
> ---
> arch/arm/mach-omap1/mcbsp.c | 1 +
> arch/arm/mach-omap2/mcbsp.c | 3 +++
> arch/arm/plat-omap/mcbsp.c | 24 +++++++++++++++++++++++-
> include/asm-arm/arch-omap/mcbsp.h | 5 +----
> 4 files changed, 28 insertions(+), 5 deletions(-)
>
> Index: linux-omap-2.6/arch/arm/mach-omap1/mcbsp.c
> ===================================================================
> --- linux-omap-2.6.orig/arch/arm/mach-omap1/mcbsp.c 2008-08-07
> 16:40:14.000000000 +0530
> +++ linux-omap-2.6/arch/arm/mach-omap1/mcbsp.c 2008-08-07 16:46:30.000000000 +0530
> @@ -248,6 +248,7 @@
> GFP_KERNEL);
> if (!mcbsp_ptr)
> return -ENOMEM;
> + mcbsp_32_bit_ops = 0;
>
> if (cpu_is_omap730())
> omap_mcbsp_register_board_cfg(omap730_mcbsp_pdata,
> Index: linux-omap-2.6/arch/arm/mach-omap2/mcbsp.c
> ===================================================================
> --- linux-omap-2.6.orig/arch/arm/mach-omap2/mcbsp.c 2008-08-07
> 16:41:17.000000000 +0530
> +++ linux-omap-2.6/arch/arm/mach-omap2/mcbsp.c 2008-08-07 16:50:53.000000000 +0530
> @@ -232,6 +232,7 @@
>
> if (cpu_is_omap24xx())
> omap_mcbsp_count = OMAP24XX_MCBSP_PDATA_SZ;
> +
> if (cpu_is_omap34xx())
> omap_mcbsp_count = OMAP34XX_MCBSP_PDATA_SZ;
>
> @@ -246,6 +247,8 @@
> if (cpu_is_omap34xx())
> omap_mcbsp_register_board_cfg(omap34xx_mcbsp_pdata,
> OMAP34XX_MCBSP_PDATA_SZ);
> + if (!cpu_is_omap2420())
> + mcbsp_32_bit_ops = 1;
>
> return omap_mcbsp_init();
> }
> Index: linux-omap-2.6/arch/arm/plat-omap/mcbsp.c
> ===================================================================
> --- linux-omap-2.6.orig/arch/arm/plat-omap/mcbsp.c 2008-08-07
> 16:39:51.000000000 +0530
> +++ linux-omap-2.6/arch/arm/plat-omap/mcbsp.c 2008-08-07 16:45:00.000000000 +0530
> @@ -29,9 +29,31 @@
>
> struct omap_mcbsp **mcbsp_ptr;
> int omap_mcbsp_count;
> +int mcbsp_32_bit_ops;
> +
> +void omap_mcbsp_write(u32 io_base, u16 reg, u32 val)
> +{
> + if (!mcbsp_32_bit_ops)
> + __raw_writew((u16)val, io_base + reg);
> + else
> + __raw_writel(val, io_base + reg);
> +}
> +
> +int omap_mcbsp_read(u32 io_base, u16 reg)
> +{
> + if (!mcbsp_32_bit_ops)
> + return __raw_readw(io_base + reg);
> + else
> + return __raw_readl(io_base + reg);
> +}
> +
The 16 vs 32-bit test above would be better done with cpu_is_omap2420()
than setting mcbsp_32_bit_ops. If 2420 is not selected, the test gets
optimized out as cpu_is_omap2420() is defined as 0.
Regards,
Tony
> +#define OMAP_MCBSP_READ(base, reg) \
> + omap_mcbsp_read(base, OMAP_MCBSP_REG_##reg)
> +#define OMAP_MCBSP_WRITE(base, reg, val) \
> + omap_mcbsp_write(base, OMAP_MCBSP_REG_##reg, val)
>
> #define omap_mcbsp_check_valid_id(id) (id < omap_mcbsp_count)
> -#define id_to_mcbsp_ptr(id) mcbsp_ptr[id];
> +#define id_to_mcbsp_ptr(id) mcbsp_ptr[id];
>
> static void omap_mcbsp_dump_reg(u8 id)
> {
> Index: linux-omap-2.6/include/asm-arm/arch-omap/mcbsp.h
> ===================================================================
> --- linux-omap-2.6.orig/include/asm-arm/arch-omap/mcbsp.h 2008-08-07
> 16:41:17.000000000 +0530
> +++ linux-omap-2.6/include/asm-arm/arch-omap/mcbsp.h 2008-08-07
> 16:45:00.000000000 +0530
> @@ -139,10 +139,6 @@
>
> #endif
>
> -#define OMAP_MCBSP_READ(base, reg) __raw_readw((base) + OMAP_MCBSP_REG_##reg)
> -#define OMAP_MCBSP_WRITE(base, reg, val) __raw_writew((val), (base) +
> OMAP_MCBSP_REG_##reg)
> -
> -
> /************************** McBSP SPCR1 bit definitions ***********************/
> #define RRST 0x0001
> #define RRDY 0x0002
> @@ -369,6 +365,7 @@
> };
> extern struct omap_mcbsp **mcbsp_ptr;
> extern int omap_mcbsp_count;
> +extern int mcbsp_32_bit_ops;
>
> int omap_mcbsp_init(void);
> void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data *config,
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH 2/2] McBSP preamble patch for 34xx support,
2008-08-08 6:26 ` Tony Lindgren
@ 2008-08-08 6:52 ` shekhar, chandra
2008-08-08 6:59 ` Tony Lindgren
0 siblings, 1 reply; 4+ messages in thread
From: shekhar, chandra @ 2008-08-08 6:52 UTC (permalink / raw)
To: Tony Lindgren; +Cc: linux-omap
>> ===================================================================
>> --- linux-omap-2.6.orig/arch/arm/plat-omap/mcbsp.c 2008-08-07
>> 16:39:51.000000000 +0530
>> +++ linux-omap-2.6/arch/arm/plat-omap/mcbsp.c 2008-08-07
>> 16:45:00.000000000 +0530
>> @@ -29,9 +29,31 @@
>>
>> struct omap_mcbsp **mcbsp_ptr;
>> int omap_mcbsp_count;
>> +int mcbsp_32_bit_ops;
>> +
>> +void omap_mcbsp_write(u32 io_base, u16 reg, u32 val)
>> +{
>> + if (!mcbsp_32_bit_ops)
>> + __raw_writew((u16)val, io_base + reg);
>> + else
>> + __raw_writel(val, io_base + reg);
>> +}
>> +
>> +int omap_mcbsp_read(u32 io_base, u16 reg)
>> +{
>> + if (!mcbsp_32_bit_ops)
>> + return __raw_readw(io_base + reg);
>> + else
>> + return __raw_readl(io_base + reg);
>> +}
>> +
>
> The 16 vs 32-bit test above would be better done with cpu_is_omap2420()
> than setting mcbsp_32_bit_ops. If 2420 is not selected, the test gets
> optimized out as cpu_is_omap2420() is defined as 0.
>
> Regards,
>
> Tony
If i put a cpu check here then i will have to put either (cpu_class_is_omap1
|| cpu_is_omap2420) check , or
!( cpu_is_omap2430) & !(cpu_is_omap34xx) - for 16 bit ops.
i am not sure which one will be more optimized as in the second case we will
have
a logical operator as well as cpu check. while in the first case we have
just a varable check.
Let me know if i am missing something.
>
>
>> +#define OMAP_MCBSP_READ(base, reg) \
>> + omap_mcbsp_read(base, OMAP_MCBSP_REG_##reg)
>> +#define OMAP_MCBSP_WRITE(base, reg, val) \
>> + omap_mcbsp_write(base, OMAP_MCBSP_REG_##reg, val)
>>
>> #define omap_mcbsp_check_valid_id(id) (id < omap_mcbsp_count)
>> -#define id_to_mcbsp_ptr(id) mcbsp_ptr[id];
>> +#define id_to_mcbsp_ptr(id) mcbsp_ptr[id];
>>
>> static void omap_mcbsp_dump_reg(u8 id)
>> {
>> Index: linux-omap-2.6/include/asm-arm/arch-omap/mcbsp.h
>> ===================================================================
>> --- linux-omap-2.6.orig/include/asm-arm/arch-omap/mcbsp.h 2008-08-07
>> 16:41:17.000000000 +0530
>> +++ linux-omap-2.6/include/asm-arm/arch-omap/mcbsp.h 2008-08-07
>> 16:45:00.000000000 +0530
>> @@ -139,10 +139,6 @@
>>
>> #endif
>>
>> -#define OMAP_MCBSP_READ(base, reg) __raw_readw((base) +
>> OMAP_MCBSP_REG_##reg)
>> -#define OMAP_MCBSP_WRITE(base, reg, val) __raw_writew((val), (base) +
>> OMAP_MCBSP_REG_##reg)
>> -
>> -
>> /************************** McBSP SPCR1 bit definitions
>> ***********************/
>> #define RRST 0x0001
>> #define RRDY 0x0002
>> @@ -369,6 +365,7 @@
>> };
>> extern struct omap_mcbsp **mcbsp_ptr;
>> extern int omap_mcbsp_count;
>> +extern int mcbsp_32_bit_ops;
>>
>> int omap_mcbsp_init(void);
>> void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data
>> *config,
>>
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH 2/2] McBSP preamble patch for 34xx support,
2008-08-08 6:52 ` shekhar, chandra
@ 2008-08-08 6:59 ` Tony Lindgren
0 siblings, 0 replies; 4+ messages in thread
From: Tony Lindgren @ 2008-08-08 6:59 UTC (permalink / raw)
To: shekhar, chandra; +Cc: linux-omap
* shekhar, chandra <x0044955@ti.com> [080808 09:52]:
>
>
>>> ===================================================================
>>> --- linux-omap-2.6.orig/arch/arm/plat-omap/mcbsp.c 2008-08-07
>>> 16:39:51.000000000 +0530
>>> +++ linux-omap-2.6/arch/arm/plat-omap/mcbsp.c 2008-08-07
>>> 16:45:00.000000000 +0530
>>> @@ -29,9 +29,31 @@
>>>
>>> struct omap_mcbsp **mcbsp_ptr;
>>> int omap_mcbsp_count;
>>> +int mcbsp_32_bit_ops;
>>> +
>>> +void omap_mcbsp_write(u32 io_base, u16 reg, u32 val)
>>> +{
>>> + if (!mcbsp_32_bit_ops)
>>> + __raw_writew((u16)val, io_base + reg);
>>> + else
>>> + __raw_writel(val, io_base + reg);
>>> +}
>>> +
>>> +int omap_mcbsp_read(u32 io_base, u16 reg)
>>> +{
>>> + if (!mcbsp_32_bit_ops)
>>> + return __raw_readw(io_base + reg);
>>> + else
>>> + return __raw_readl(io_base + reg);
>>> +}
>>> +
>>
>> The 16 vs 32-bit test above would be better done with cpu_is_omap2420()
>> than setting mcbsp_32_bit_ops. If 2420 is not selected, the test gets
>> optimized out as cpu_is_omap2420() is defined as 0.
>>
>> Regards,
>>
>> Tony
>
> If i put a cpu check here then i will have to put either
> (cpu_class_is_omap1 || cpu_is_omap2420) check , or
> !( cpu_is_omap2430) & !(cpu_is_omap34xx) - for 16 bit ops.
>
> i am not sure which one will be more optimized as in the second case we
> will have
> a logical operator as well as cpu check. while in the first case we have
> just a varable check.
>
> Let me know if i am missing something.
if (cpu_class_is_omap1() || cpu_is_omap2420())
is same as
if (0 || 0)
when none of the omap1 boards or 2420 are not selected. So that
should work.
Tony
>
>
>>
>>
>>> +#define OMAP_MCBSP_READ(base, reg) \
>>> + omap_mcbsp_read(base, OMAP_MCBSP_REG_##reg)
>>> +#define OMAP_MCBSP_WRITE(base, reg, val) \
>>> + omap_mcbsp_write(base, OMAP_MCBSP_REG_##reg, val)
>>>
>>> #define omap_mcbsp_check_valid_id(id) (id < omap_mcbsp_count)
>>> -#define id_to_mcbsp_ptr(id) mcbsp_ptr[id];
>>> +#define id_to_mcbsp_ptr(id) mcbsp_ptr[id];
>>>
>>> static void omap_mcbsp_dump_reg(u8 id)
>>> {
>>> Index: linux-omap-2.6/include/asm-arm/arch-omap/mcbsp.h
>>> ===================================================================
>>> --- linux-omap-2.6.orig/include/asm-arm/arch-omap/mcbsp.h 2008-08-07
>>> 16:41:17.000000000 +0530
>>> +++ linux-omap-2.6/include/asm-arm/arch-omap/mcbsp.h 2008-08-07
>>> 16:45:00.000000000 +0530
>>> @@ -139,10 +139,6 @@
>>>
>>> #endif
>>>
>>> -#define OMAP_MCBSP_READ(base, reg) __raw_readw((base) +
>>> OMAP_MCBSP_REG_##reg)
>>> -#define OMAP_MCBSP_WRITE(base, reg, val) __raw_writew((val), (base) +
>>> OMAP_MCBSP_REG_##reg)
>>> -
>>> -
>>> /************************** McBSP SPCR1 bit definitions
>>> ***********************/
>>> #define RRST 0x0001
>>> #define RRDY 0x0002
>>> @@ -369,6 +365,7 @@
>>> };
>>> extern struct omap_mcbsp **mcbsp_ptr;
>>> extern int omap_mcbsp_count;
>>> +extern int mcbsp_32_bit_ops;
>>>
>>> int omap_mcbsp_init(void);
>>> void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data
>>> *config,
>>>
>>>
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-08-08 6:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-08 6:06 [PATCH 2/2] McBSP preamble patch for 34xx support, chandra shekhar
2008-08-08 6:26 ` Tony Lindgren
2008-08-08 6:52 ` shekhar, chandra
2008-08-08 6:59 ` Tony Lindgren
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox