mx31: Setup AIPS registers
Subsystems (2)
Fabio Estevam
reviewerPATCH v2 1/1 mx31: Setup AIPS registers
Setup mx31 AIPS registers.
It was verified on a mx31pdk that without the AIPS settings it is not possible to run audio playback.
---
Changes since v1:
- Use CONFIG_ARCH_CPU_INIT
- Zero-out the 8 MSB of opacr4
- Confirmed that audio playback does work
arch/arm/cpu/arm1136/mx31/generic.c | 46 +++++++++++++++++++++++++++++ arch/arm/include/asm/arch-mx31/imx-regs.h | 13 ++++++++ include/configs/mx31pdk.h | 1 + 3 files changed, 60 insertions(+), 0 deletions(-)
arch/arm/cpu/arm1136/mx31/generic.c +46 -0
@@ -228,3 +228,49 @@ int print_cpuinfo(void)return 0 ; }#endif + +#ifdef CONFIG_ARCH_CPU_INIT +void init_aips (void ) +{ +struct aipstz_regs *aips1, *aips2; +unsigned int reg; + + aips1 = (struct aipstz_regs *)MX31_AIPS1_BASE_ADDR ; + aips2 = (struct aipstz_regs *)MX31_AIPS2_BASE_ADDR ; + +/* +* Set all MPROTx to be non-bufferable, trusted for R/W, +* not forced to user-mode. +*/ +writel (0x77777777 , &aips1->mprot0); +writel (0x77777777 , &aips1->mprot1); +writel (0x77777777 , &aips2->mprot0); +writel (0x77777777 , &aips2->mprot1); + +/* +* Set all OPACRx to be non-bufferable, not require +* supervisor privilege level for access, allow for +* write access and untrusted master access. +*/ +writel (0x0 , &aips1->opacr0); +writel (0x0 , &aips1->opacr1); +writel (0x0 , &aips1->opacr2); +writel (0x0 , &aips1->opacr3); + reg =readl (&aips1->opacr4) &0x00FFFFFF ; +writel (reg, &aips1->opacr4); + +writel (0x0 , &aips2->opacr0); +writel (0x0 , &aips2->opacr1); +writel (0x0 , &aips2->opacr2); +writel (0x0 , &aips2->opacr3); + reg =readl (&aips2->opacr4) &0x00FFFFFF ; +writel (reg, &aips2->opacr4); +} + +int arch_cpu_init (void ) +{ +init_aips (); + +return 0 ; +} +#endif
arch/arm/include/asm/arch-mx31/imx-regs.h +13 -0
@@ -539,6 +539,18 @@ struct esdc_regs { u32 dlyl; }; +/* AIPS registers */ +struct aipstz_regs { +u32 mprot0; +u32 mprot1; +u32 rsvd[0xe ]; +u32 opacr0; +u32 opacr1; +u32 opacr2; +u32 opacr3; +u32 opacr4; +}; +#endif #define __REG (x) (*((volatile u32 *)(x)))
@@ -873,6 +885,7 @@ struct esdc_regs {#define IRAM_SIZE (16 * 1024)#define MX31_AIPS1_BASE_ADDR 0x43f00000 +#define MX31_AIPS2_BASE_ADDR 0x53f00000#define IMX_USB_BASE (MX31_AIPS1_BASE_ADDR + 0x88000)/* USB portsc */
include/configs/mx31pdk.h +1 -0
@@ -40,6 +40,7 @@#define CONFIG_DISPLAY_CPUINFO #define CONFIG_DISPLAY_BOARDINFO +#define CONFIG_ARCH_CPU_INIT #define CONFIG_CMDLINE_TAG /* enable passing of ATAGs */ #define CONFIG_SETUP_MEMORY_TAGS
Signature · 1 line
1.7.1
PATCH v2 1/1 mx31: Setup AIPS registers
Quoted 6 lines · Fabio Estevam
Setup mx31 AIPS registers.
It was verified on a mx31pdk that without the AIPS settings it is not possible to run audio playback.
Signed-off-by Fabio Estevam<[email protected]>
Hmm, sorry if I missed anything because it's too late here. But:
Why now an U-Boot patch? What's about the kernel patch you sent earlier?
http://www.spinics.net/lists/arm-kernel/msg162109.html
And why don't you try to create some common parts with
?
Sorry again if I missed anything, best regards
Dirk
Quoted 108 lines
---
Changes since v1:
- UseCONFIG_ARCH_CPU_INIT
- Zero-out the 8 MSB of opacr4
- Confirmed that audio playback does workarch/arm/cpu/arm1136/mx31/generic.c | 46 +++++++++++++++++++++++++++++ arch/arm/include/asm/arch-mx31/imx-regs.h | 13 ++++++++ include/configs/mx31pdk.h | 1 + 3 files changed, 60 insertions(+), 0 deletions(-)arch/arm/cpu/arm1136/mx31/generic.c +46
-0@@ -228,3 +228,49 @@ int print_cpuinfo(void)return 0 ; }#endif + +#ifdef CONFIG_ARCH_CPU_INIT +void init_aips (void ) +{ +struct aipstz_regs *aips1, *aips2; +unsigned int reg; + + aips1 = (struct aipstz_regs *)MX31_AIPS1_BASE_ADDR ; + aips2 = (struct aipstz_regs *)MX31_AIPS2_BASE_ADDR ; + +/* +* Set all MPROTx to be non-bufferable, trusted for R/W, +* not forced to user-mode. +*/ +writel (0x77777777 ,&aips1->mprot0); +writel (0x77777777 ,&aips1->mprot1); +writel (0x77777777 ,&aips2->mprot0); +writel (0x77777777 ,&aips2->mprot1); + +/* +* Set all OPACRx to be non-bufferable, not require +* supervisor privilege level for access, allow for +* write access and untrusted master access. +*/ +writel (0x0 ,&aips1->opacr0); +writel (0x0 ,&aips1->opacr1); +writel (0x0 ,&aips1->opacr2); +writel (0x0 ,&aips1->opacr3); + reg =readl (&aips1->opacr4)&0x00FFFFFF ; +writel (reg,&aips1->opacr4); + +writel (0x0 ,&aips2->opacr0); +writel (0x0 ,&aips2->opacr1); +writel (0x0 ,&aips2->opacr2); +writel (0x0 ,&aips2->opacr3); + reg =readl (&aips2->opacr4)&0x00FFFFFF ; +writel (reg,&aips2->opacr4); +} + +int arch_cpu_init (void ) +{ +init_aips (); + +return 0 ; +} +#endif arch/arm/include/asm/arch-mx31/imx-regs.h +13
-0@@ -539,6 +539,18 @@ struct esdc_regs { u32 dlyl; }; +/* AIPS registers */ +struct aipstz_regs { +u32 mprot0; +u32 mprot1; +u32 rsvd[0xe ]; +u32 opacr0; +u32 opacr1; +u32 opacr2; +u32 opacr3; +u32 opacr4; +}; +#endif #define __REG (x) (*((volatile u32 *)(x)))@@ -873,6 +885,7 @@ struct esdc_regs {#define IRAM_SIZE (16 * 1024)#define MX31_AIPS1_BASE_ADDR 0x43f00000 +#define MX31_AIPS2_BASE_ADDR 0x53f00000#define IMX_USB_BASE (MX31_AIPS1_BASE_ADDR + 0x88000)/* USB portsc */ include/configs/mx31pdk.h +1
-0@@ -40,6 +40,7 @@#define CONFIG_DISPLAY_CPUINFO #define CONFIG_DISPLAY_BOARDINFO +#define CONFIG_ARCH_CPU_INIT #define CONFIG_CMDLINE_TAG /* enable passing of ATAGs */ #define CONFIG_SETUP_MEMORY_TAGS
Fabio Estevam
reviewerPATCH v2 1/1 mx31: Setup AIPS registers
Quoted 5 lines · Dirk Behme
Hmm, sorry if I missed anything because it's too late here. But:
Why now an U-Boot patch? What's about the kernel patch you sent earlier?
The motivation for this patch came after I was debugging audio playback on mx31pdk.
I noticed that audio only worked when I used Redboot.
Comparing the sources of Redboot and U-boot I saw that the aips registers were not set.
Setting them in U-boot allowed me to get audio playback working.
Why did I send the aips setting to the kernel? Well, it is not always possible for customers to change the bootloader.
In case the bootloader does not set aips, then this should be done in the kernel.
You can also think on the possibility of someone using the mainline U-boot with a kernel that does not set aips, so the safest thing is to have such settings in the bootloader and in the kernel.
Quoted 4 lines
And why don't you try to create some common parts with
I thought about that, but I realized the AIPS settings were not exactly the same. My main goal at this point was to get the aips settings in mx31, but I can work on factoring out this code later.
Regards,
Fabio Estevam
PATCH v2 1/1 mx31: Setup AIPS registers
Quoted 21 lines · Fabio Estevam
Quoted 5 lines · Dirk Behme
Hmm, sorry if I missed anything because it's too late here. But:
Why now an U-Boot patch? What's about the kernel patch you sent earlier?
The motivation for this patch came after I was debugging audio playback on mx31pdk.
I noticed that audio only worked when I used Redboot.
Comparing the sources of Redboot and U-boot I saw that the aips registers were not set.
Setting them in U-boot allowed me to get audio playback working.
Why did I send the aips setting to the kernel? Well, it is not always possible for customers to change the bootloader.
Quoted 6 lines
In case the bootloader does not set aips, then this should be done in the kernel.
You can also think on the possibility of someone using the mainline U-boot with a kernel that does not set aips, so the safest thing is to have such settings in the bootloader and in the kernel.
Ah, thanks for the explanation! :)
This does mean that you want the change in both, U-Boot and kernel, correct?
Quoted 7 lines
Quoted 3 lines
And why don't you try to create some common parts with
I thought about that, but I realized the AIPS settings were not exactly the same. My main goal at this point was to get the aips settings in mx31, but I can work on factoring out this code later.
Yes, we definitely should look at which parts are common. I haven't looked at the details, but at least the register definitions [1] are the same?
Best regards
Dirk
[1]
+/* AIPS registers */
+struct aipstz_regs {
+ u32 mprot0;
+ u32 mprot1;
+ u32 rsvd[0xe];
+ u32 opacr0;
+ u32 opacr1;
+ u32 opacr2;
+ u32 opacr3;
+ u32 opacr4;
+};
+
Fabio Estevam
reviewerPATCH v2 1/1 mx31: Setup AIPS registers
Quoted 3 lines · Dirk Behme
Ah, thanks for the explanation! :)
This does mean that you want the change in both, U-Boot and kernel, correct?
Correct.
Quoted 2 lines
Yes, we definitely should look at which parts are common. I haven't looked at the details, but at least the register definitions [1] are the same?
Yes, I can write a common code for this.
1. The aips register definitions:
/* AIPS registers */
struct aipstz_regs {
u32 mprot0;
u32 mprot1;
u32 rsvd[0xe];
u32 opacr0;
u32 opacr1;
u32 opacr2;
u32 opacr3;
u32 opacr4;
};should be present in each imx-regs.h file (for mx31/35/51/53/6), right?
Or is there a common .h file I could use for placing it in just one location?
2. What would be a good location for putting the common imx_init_aips function?
Regards,
Fabio Estevam
PATCH v2 1/1 mx31: Setup AIPS registers
Quoted 27 lines · Fabio Estevam
Quoted 3 lines · Dirk Behme
Ah, thanks for the explanation! :)
This does mean that you want the change in both, U-Boot and kernel, correct?
Correct.
Quoted 2 lines
Yes, we definitely should look at which parts are common. I haven't looked at the details, but at least the register definitions [1] are the same?
Yes, I can write a common code for this.
1. The aips register definitions:
/* AIPS registers */
struct aipstz_regs { u32 mprot0; u32 mprot1; u32 rsvd[0xe]; u32 opacr0; u32 opacr1; u32 opacr2; u32 opacr3; u32 opacr4; };
Quoted 3 lines
should be present in each
imx-regs.hfile (for mx31/35/51/53/6), right?Or is there a common .h file I could use for placing it in just one location?
There is not, but I am also coming to the conclusion that we need some sort of common files, exactly as the kernel does with plat-imx. Maybe in arch/arm/include/asm/plat-imx ? Then all imx-regs.h must include the common file. I am sure we will add them more things, because there are several parts that are still duplicated in code.
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================