mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] OMAP3 updates
@ 2013-03-04 19:37 Sascha Hauer
  2013-03-04 19:37 ` [PATCH 1/2] ARM: OMAP3: invalidate L2 cache using ROM API Sascha Hauer
  2013-03-04 19:37 ` [PATCH 2/2] ARM: OMAP: beagle: Add missing MMC iomux setup Sascha Hauer
  0 siblings, 2 replies; 10+ messages in thread
From: Sascha Hauer @ 2013-03-04 19:37 UTC (permalink / raw)
  To: barebox

Two patches for OMAP3. One calls the internal ROM to invalidate
the L2 cache and removes the previously used omap3_invalidate_dcache
function. I don't know exactly what'S going on here, but it makes
the beagle board much more stable. In earlier days this was not
needed, maybe because we didn't enable the MMU.

The other one adds the iomux setup for MMC cards on the beagle board.
My hope was that with this the MMC slot would work even when not
booting from it. Unfortunately this was not the case. I also tried
and enabled VMMC in the twl4030, but this didn't help either.
So if anyone has an idea what needs to be done to make the MMC
slot work I'd be glad to hear.

Sascha

----------------------------------------------------------------
Sascha Hauer (2):
      ARM: OMAP3: invalidate L2 cache using ROM API
      ARM: OMAP: beagle: Add missing MMC iomux setup

 arch/arm/boards/beagle/lowlevel.c               | 13 +++-
 arch/arm/boards/omap343xdsp/lowlevel.c          |  2 -
 arch/arm/mach-omap/Makefile                     |  4 +-
 arch/arm/mach-omap/auxcr.S                      | 12 ++++
 arch/arm/mach-omap/include/mach/omap3-silicon.h |  8 ++-
 arch/arm/mach-omap/omap3_core.S                 | 87 -------------------------
 arch/arm/mach-omap/omap3_generic.c              |  4 +-
 7 files changed, 35 insertions(+), 95 deletions(-)
 delete mode 100644 arch/arm/mach-omap/omap3_core.S

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/2] ARM: OMAP3: invalidate L2 cache using ROM API
  2013-03-04 19:37 [PATCH] OMAP3 updates Sascha Hauer
@ 2013-03-04 19:37 ` Sascha Hauer
  2013-03-04 19:37 ` [PATCH 2/2] ARM: OMAP: beagle: Add missing MMC iomux setup Sascha Hauer
  1 sibling, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2013-03-04 19:37 UTC (permalink / raw)
  To: barebox

Code taken from U-Boot. This makes the beagle board much more
reliable.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/boards/beagle/lowlevel.c               |  2 -
 arch/arm/boards/omap343xdsp/lowlevel.c          |  2 -
 arch/arm/mach-omap/Makefile                     |  4 +-
 arch/arm/mach-omap/auxcr.S                      | 12 ++++
 arch/arm/mach-omap/include/mach/omap3-silicon.h |  8 ++-
 arch/arm/mach-omap/omap3_core.S                 | 87 -------------------------
 arch/arm/mach-omap/omap3_generic.c              |  4 +-
 7 files changed, 24 insertions(+), 95 deletions(-)
 delete mode 100644 arch/arm/mach-omap/omap3_core.S

diff --git a/arch/arm/boards/beagle/lowlevel.c b/arch/arm/boards/beagle/lowlevel.c
index 8afcb75..2c1232c 100644
--- a/arch/arm/boards/beagle/lowlevel.c
+++ b/arch/arm/boards/beagle/lowlevel.c
@@ -169,8 +169,6 @@ static int beagle_board_init(void)
 
 void __naked barebox_arm_reset_vector(void)
 {
-	omap3_invalidate_dcache();
-
 	arm_cpu_lowlevel_init();
 
 	beagle_board_init();
diff --git a/arch/arm/boards/omap343xdsp/lowlevel.c b/arch/arm/boards/omap343xdsp/lowlevel.c
index 5629655..ed675ad 100644
--- a/arch/arm/boards/omap343xdsp/lowlevel.c
+++ b/arch/arm/boards/omap343xdsp/lowlevel.c
@@ -547,8 +547,6 @@ static int sdp343x_board_init(void)
 
 void __naked barebox_arm_reset_vector(void)
 {
-	omap3_invalidate_dcache();
-
 	arm_cpu_lowlevel_init();
 
 	sdp343x_board_init();
diff --git a/arch/arm/mach-omap/Makefile b/arch/arm/mach-omap/Makefile
index aaa0cea..38786b2 100644
--- a/arch/arm/mach-omap/Makefile
+++ b/arch/arm/mach-omap/Makefile
@@ -19,8 +19,8 @@ obj-$(CONFIG_ARCH_OMAP) += syslib.o omap_devices.o
 pbl-$(CONFIG_ARCH_OMAP) += syslib.o
 obj-$(CONFIG_OMAP_CLOCK_SOURCE_S32K) += s32k_clksource.o
 obj-$(CONFIG_OMAP_CLOCK_SOURCE_DMTIMER0) += dmtimer0.o
-obj-$(CONFIG_ARCH_OMAP3) += omap3_core.o omap3_generic.o auxcr.o
-pbl-$(CONFIG_ARCH_OMAP3) += omap3_core.o omap3_generic.o auxcr.o
+obj-$(CONFIG_ARCH_OMAP3) += omap3_generic.o auxcr.o
+pbl-$(CONFIG_ARCH_OMAP3) += omap3_generic.o auxcr.o
 obj-$(CONFIG_ARCH_OMAP4) += omap4_generic.o omap4_clock.o
 pbl-$(CONFIG_ARCH_OMAP4) += omap4_generic.o omap4_clock.o
 obj-$(CONFIG_ARCH_AM33XX) += am33xx_generic.o am33xx_clock.o am33xx_mux.o
diff --git a/arch/arm/mach-omap/auxcr.S b/arch/arm/mach-omap/auxcr.S
index 2debc15..aaac0f2 100644
--- a/arch/arm/mach-omap/auxcr.S
+++ b/arch/arm/mach-omap/auxcr.S
@@ -31,3 +31,15 @@ ENTRY(setup_auxcr)
 	.word 0xE1600070		@ SMC
 	bx	lr
 ENDPROC(setup_auxcr)
+
+.arm
+ENTRY(omap3_gp_romcode_call)
+	push	{r4-r12, lr}		@ Save all registers from ROM code!
+	mov	r12, r0			@ Copy the Service ID in R12
+	mov	r0, r1			@ Copy parameter to R0
+	mcr     p15, 0, r0, c7, c10, 4	@ DSB
+	mcr     p15, 0, r0, c7, c10, 5	@ DMB
+	.word	0xe1600070		@ SMC #0 to enter monitor - hand assembled
+					@ because we use -march=armv5
+	pop	{r4-r12, pc}
+ENDPROC(omap3_gp_romcode_call)
diff --git a/arch/arm/mach-omap/include/mach/omap3-silicon.h b/arch/arm/mach-omap/include/mach/omap3-silicon.h
index 43b2953..9138057 100644
--- a/arch/arm/mach-omap/include/mach/omap3-silicon.h
+++ b/arch/arm/mach-omap/include/mach/omap3-silicon.h
@@ -130,10 +130,16 @@
 /* PRM */
 #define OMAP3_PRM_RSTCTRL_RESET	0x04
 
+/*
+ * ROM code API related flags
+ */
+#define OMAP3_GP_ROMCODE_API_L2_INVAL		1
+#define OMAP3_GP_ROMCODE_API_WRITE_ACR		3
+
 /* If Architecture specific init functions are present */
 #ifndef __ASSEMBLY__
 void omap3_core_init(void);
-void omap3_invalidate_dcache(void);
+void omap3_gp_romcode_call(u32 service_id, u32 parameter);
 #endif /* __ASSEMBLY__ */
 
 #endif /* __ASM_ARCH_OMAP3_H */
diff --git a/arch/arm/mach-omap/omap3_core.S b/arch/arm/mach-omap/omap3_core.S
deleted file mode 100644
index a47e248..0000000
--- a/arch/arm/mach-omap/omap3_core.S
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
- * @file
- * @brief Provide Architecture level Initialization
- *
- * This provides OMAP3 Architecture initialization. Among these,
- * @li OMAP ROM Code is located in SRAM, we can piggy back on
- * the same addresses
- * @li If clock initialization is required, call the same.
- * @li Setup a temporary SRAM stack which is necessary to call C
- * functions.
- * @li Call architecture initialization function a_init
- *
- * (C) Copyright 2006-2008
- * Texas Instruments, <www.ti.com>
- * Nishanth Menon <x0nishan@ti.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <config.h>
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-#include <mach/omap3-silicon.h>
-#include <mach/wdt.h>
-#include <mach/clocks.h>
-#include <asm/barebox-arm-head.h>
-
-.section .text.__omap3_invalidate_dcache
-ENTRY(omap3_invalidate_dcache)
-	/* Invalidate all Dcaches */
-#ifndef CONFIG_CPU_V7_DCACHE_SKIP
-	/* If Arch specific ROM code SMI handling does not exist */
-	mrc	p15, 1, r0, c0, c0, 1	/* read clidr */
-	ands	r3, r0, #0x7000000	/* extract loc from clidr */
-	mov	r3, r3, lsr #23		/* left align loc bit field */
-	beq	finished_inval		/* if loc is 0, then no need to clean */
-	mov	r10, #0			/* start clean at cache level 0 */
-inval_loop1:
-	add	r2, r10, r10, lsr #1	/* work out 3x current cache level */
-	mov	r1, r0, lsr r2		/* extract cache type bits from clidr */
-	and	r1, r1, #	7	/* mask of the bits for current cache only */
-	cmp	r1, #2			/* see what cache we have at this level */
-	blt	skip_inval		/* skip if no cache, or just i-cache */
-	mcr	p15, 2, r10, c0, c0, 0	/* select current cache level in cssr */
-	isb				/* isb to sych the new cssr&csidr */
-	mrc	p15, 1, r1, c0, c0, 0	/* read the new csidr */
-	and	r2, r1, #7		/* extract the length of the cache lines */
-	add	r2, r2, #4		/* add 4 (line length offset) */
-	ldr	r4, =0x3ff
-	ands	r4, r4, r1, lsr #3	/* find maximum number on the way size*/
-	clz	r5, r4			/* find bit position of way size increment */
-	ldr	r7, =0x7fff
-	ands	r7, r7, r1, lsr #13	/* extract max number of the index size */
-inval_loop2:
-	mov	r9, r4			/* create working copy of max way size */
-inval_loop3:
-ARM(	orr	r11, r10, r9, lsl r5	) /* factor way and cache number into r11 */
-ARM(	orr	r11, r11, r7, lsl r2	) /* factor index number into r11 */
-THUMB(	lsl	r6, r9, r5		)
-THUMB(	orr	r11, r10, r6		) /* factor way and cache number into r11 */
-THUMB(	lsl	r6, r7, r2		)
-THUMB(	orr	r11, r11, r6		) /* factor index number into r11 */
-	mcr	p15, 0, r11, c7, c6, 2	/* invalidate by set/way */
-	subs	r9, r9, #1		/* decrement the way */
-	bge	inval_loop3
-	subs	r7, r7, #1		/* decrement the index */
-	bge	inval_loop2
-skip_inval:
-	add	r10, r10, #2		/* increment cache number */
-	cmp	r3, r10
-	bgt	inval_loop1
-finished_inval:
-	mov	r10, #0			/* swith back to cache level 0 */
-	mcr	p15, 2, r10, c0, c0, 0	/* select current cache level in cssr */
-	isb
-#endif /* CONFIG_CPU_V7_DCACHE_SKIP */
-	/* back to arch calling code */
-	bx lr
-ENDPROC(omap3_invalidate_dcache)
diff --git a/arch/arm/mach-omap/omap3_generic.c b/arch/arm/mach-omap/omap3_generic.c
index 8487f07..a21a938 100644
--- a/arch/arm/mach-omap/omap3_generic.c
+++ b/arch/arm/mach-omap/omap3_generic.c
@@ -451,8 +451,10 @@ void omap3_core_init(void)
 	/* Currently SMI in Kernel on ES2 devices seems to have an isse
 	 * Once that is resolved, we can postpone this config to kernel
 	 */
-	if (get_device_type() == GP_DEVICE)
+	if (get_device_type() == GP_DEVICE) {
 		setup_auxcr();
+		omap3_gp_romcode_call(OMAP3_GP_ROMCODE_API_L2_INVAL, 0);
+	}
 
 	sdelay(100);
 
-- 
1.8.2.rc2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 2/2] ARM: OMAP: beagle: Add missing MMC iomux setup
  2013-03-04 19:37 [PATCH] OMAP3 updates Sascha Hauer
  2013-03-04 19:37 ` [PATCH 1/2] ARM: OMAP3: invalidate L2 cache using ROM API Sascha Hauer
@ 2013-03-04 19:37 ` Sascha Hauer
  2013-03-06 23:45   ` [PATCH 1/1] beagle: add missing mmc twl and control init Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 1 reply; 10+ messages in thread
From: Sascha Hauer @ 2013-03-04 19:37 UTC (permalink / raw)
  To: barebox

When the board is booted from NAND we have to setup the iomux to
make the SD card work. Unfortunately this still is not enough :(
The SD card still will only work when booting from it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/boards/beagle/lowlevel.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/arch/arm/boards/beagle/lowlevel.c b/arch/arm/boards/beagle/lowlevel.c
index 2c1232c..d0fd066 100644
--- a/arch/arm/boards/beagle/lowlevel.c
+++ b/arch/arm/boards/beagle/lowlevel.c
@@ -87,6 +87,17 @@ static void mux_config(void)
 	MUX_VAL(CP(ETK_D14_ES2),	(IEN  | PTU | DIS | M3));
 	MUX_VAL(CP(ETK_D15_ES2),	(IEN  | PTU | DIS | M3));
 	MUX_VAL(CP(UART2_RX),		(IEN  | PTD | DIS | M4)) /*GPIO_147*/;
+	/* Expansion card */
+	MUX_VAL(CP(MMC1_CLK),		(IDIS | PTU | EN  | M0)); /* MMC1_CLK */
+	MUX_VAL(CP(MMC1_CMD),		(IEN  | PTU | EN  | M0)); /* MMC1_CMD */
+	MUX_VAL(CP(MMC1_DAT0),		(IEN  | PTU | EN  | M0)); /* MMC1_DAT0 */
+	MUX_VAL(CP(MMC1_DAT1),		(IEN  | PTU | EN  | M0)); /* MMC1_DAT1 */
+	MUX_VAL(CP(MMC1_DAT2),		(IEN  | PTU | EN  | M0)); /* MMC1_DAT2 */
+	MUX_VAL(CP(MMC1_DAT3),		(IEN  | PTU | EN  | M0)); /* MMC1_DAT3 */
+	MUX_VAL(CP(MMC1_DAT4),		(IEN  | PTU | EN  | M0)); /* MMC1_DAT4 */
+	MUX_VAL(CP(MMC1_DAT5),		(IEN  | PTU | EN  | M0)); /* MMC1_DAT5 */
+	MUX_VAL(CP(MMC1_DAT6),		(IEN  | PTU | EN  | M0)); /* MMC1_DAT6 */
+	MUX_VAL(CP(MMC1_DAT7),		(IEN  | PTU | EN  | M0)); /* MMC1_DAT7 */
 }
 
 /**
-- 
1.8.2.rc2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/1] beagle: add missing mmc twl and control init
  2013-03-04 19:37 ` [PATCH 2/2] ARM: OMAP: beagle: Add missing MMC iomux setup Sascha Hauer
@ 2013-03-06 23:45   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-03-07  2:06     ` Alexander Aring
  2013-03-08  7:41     ` Sascha Hauer
  0 siblings, 2 replies; 10+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-03-06 23:45 UTC (permalink / raw)
  To: barebox

take from xloader

with this the mmc work even when booting from nand

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/boards/beagle/board.c |   29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boards/beagle/board.c b/arch/arm/boards/beagle/board.c
index bed4651..6e69e87 100644
--- a/arch/arm/boards/beagle/board.c
+++ b/arch/arm/boards/beagle/board.c
@@ -63,6 +63,7 @@
 #include <linux/err.h>
 #include <usb/ehci.h>
 #include <mach/xload.h>
+#include <mfd/twl4030.h>
 
 #ifdef CONFIG_DRIVER_SERIAL_NS16550
 
@@ -109,6 +110,32 @@ static struct gpmc_nand_platform_data nand_plat = {
 	.nand_cfg = &omap3_nand_cfg,
 };
 
+/* T2 Register definitions */
+#define CONTROL_DEV_CONF0	0x48002274
+#define CONTROL_PBIAS_LITE	0x48002520
+
+static void beagle_add_mmc(void)
+{
+	unsigned int value = 0;
+	struct twl4030 *t = twl4030_get();
+
+	if (!t) {
+		pr_warn("twl4030 not ready to setup mmc\n");
+	} else {
+		twl4030_reg_write(t, TWL4030_USB_OTHER_FUNC_CTRL_CLR, 0x20);
+		twl4030_reg_write(t, TWL4030_USB_OTHER_IFC_CTRL_CLR, 0x2);
+	}
+
+	value = readl(CONTROL_PBIAS_LITE);
+	value |= (1 << 2) | (1 << 1) | (1 << 9);
+	writel(value, CONTROL_PBIAS_LITE);
+
+	value = readl(CONTROL_DEV_CONF0);
+	writel(value | (1 << 24), CONTROL_PBIAS_LITE);
+
+	omap3_add_mmc1(NULL);
+}
+
 static int beagle_mem_init(void)
 {
 	omap_add_ram0(SZ_128M);
@@ -132,7 +159,7 @@ static int beagle_devices_init(void)
 #endif
 	omap_add_gpmc_nand_device(&nand_plat);
 
-	omap3_add_mmc1(NULL);
+	beagle_add_mmc();
 
 	armlinux_set_bootparams((void *)0x80000100);
 	armlinux_set_architecture(MACH_TYPE_OMAP3_BEAGLE);
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/1] beagle: add missing mmc twl and control init
  2013-03-06 23:45   ` [PATCH 1/1] beagle: add missing mmc twl and control init Jean-Christophe PLAGNIOL-VILLARD
@ 2013-03-07  2:06     ` Alexander Aring
  2013-03-08  7:41     ` Sascha Hauer
  1 sibling, 0 replies; 10+ messages in thread
From: Alexander Aring @ 2013-03-07  2:06 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

Hi,

On Thu, Mar 07, 2013 at 12:45:18AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> take from xloader
> 
> with this the mmc work even when booting from nand
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  arch/arm/boards/beagle/board.c |   29 ++++++++++++++++++++++++++++-
>  1 file changed, 28 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/boards/beagle/board.c b/arch/arm/boards/beagle/board.c
> index bed4651..6e69e87 100644
> --- a/arch/arm/boards/beagle/board.c
> +++ b/arch/arm/boards/beagle/board.c
> @@ -63,6 +63,7 @@
>  #include <linux/err.h>
>  #include <usb/ehci.h>
>  #include <mach/xload.h>
> +#include <mfd/twl4030.h>
>  
>  #ifdef CONFIG_DRIVER_SERIAL_NS16550
>  
> @@ -109,6 +110,32 @@ static struct gpmc_nand_platform_data nand_plat = {
>  	.nand_cfg = &omap3_nand_cfg,
>  };
>  
> +/* T2 Register definitions */
> +#define CONTROL_DEV_CONF0	0x48002274
> +#define CONTROL_PBIAS_LITE	0x48002520
> +
> +static void beagle_add_mmc(void)
> +{
> +	unsigned int value = 0;
> +	struct twl4030 *t = twl4030_get();
> +
> +	if (!t) {
> +		pr_warn("twl4030 not ready to setup mmc\n");
> +	} else {
> +		twl4030_reg_write(t, TWL4030_USB_OTHER_FUNC_CTRL_CLR, 0x20);
> +		twl4030_reg_write(t, TWL4030_USB_OTHER_IFC_CTRL_CLR, 0x2);
> +	}
> +
> +	value = readl(CONTROL_PBIAS_LITE);
> +	value |= (1 << 2) | (1 << 1) | (1 << 9);
> +	writel(value, CONTROL_PBIAS_LITE);
> +
> +	value = readl(CONTROL_DEV_CONF0);
> +	writel(value | (1 << 24), CONTROL_PBIAS_LITE);
> +
> +	omap3_add_mmc1(NULL);
> +}
> +
>  static int beagle_mem_init(void)
>  {
>  	omap_add_ram0(SZ_128M);
> @@ -132,7 +159,7 @@ static int beagle_devices_init(void)
>  #endif
>  	omap_add_gpmc_nand_device(&nand_plat);
>  
> -	omap3_add_mmc1(NULL);
> +	beagle_add_mmc();
>  

I had a similar problem with twl6030 and pcm049 some time ago...

See commit:

659f150e90d8bfcf8aa4c51bd3ab552f42e288f0

Please make sure this will work when you insert a mmc card after
beagle_mem_init call.

In my case, I need to add the VMMC setup at probing time in omap_hsmmc.
The reason is that twl6030 doesn't setup VMMC if a mmc card is not insert.

Maybe twl4030 do the same.

Alex

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/1] beagle: add missing mmc twl and control init
  2013-03-06 23:45   ` [PATCH 1/1] beagle: add missing mmc twl and control init Jean-Christophe PLAGNIOL-VILLARD
  2013-03-07  2:06     ` Alexander Aring
@ 2013-03-08  7:41     ` Sascha Hauer
  2013-03-08 12:21       ` Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 1 reply; 10+ messages in thread
From: Sascha Hauer @ 2013-03-08  7:41 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Thu, Mar 07, 2013 at 12:45:18AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> take from xloader
> 
> with this the mmc work even when booting from nand

Which beagle board revision do you have? With this patch the MMC
doesn't work at all anymore, even when booting from it.

Sascha

> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  arch/arm/boards/beagle/board.c |   29 ++++++++++++++++++++++++++++-
>  1 file changed, 28 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/boards/beagle/board.c b/arch/arm/boards/beagle/board.c
> index bed4651..6e69e87 100644
> --- a/arch/arm/boards/beagle/board.c
> +++ b/arch/arm/boards/beagle/board.c
> @@ -63,6 +63,7 @@
>  #include <linux/err.h>
>  #include <usb/ehci.h>
>  #include <mach/xload.h>
> +#include <mfd/twl4030.h>
>  
>  #ifdef CONFIG_DRIVER_SERIAL_NS16550
>  
> @@ -109,6 +110,32 @@ static struct gpmc_nand_platform_data nand_plat = {
>  	.nand_cfg = &omap3_nand_cfg,
>  };
>  
> +/* T2 Register definitions */
> +#define CONTROL_DEV_CONF0	0x48002274
> +#define CONTROL_PBIAS_LITE	0x48002520
> +
> +static void beagle_add_mmc(void)
> +{
> +	unsigned int value = 0;
> +	struct twl4030 *t = twl4030_get();
> +
> +	if (!t) {
> +		pr_warn("twl4030 not ready to setup mmc\n");
> +	} else {
> +		twl4030_reg_write(t, TWL4030_USB_OTHER_FUNC_CTRL_CLR, 0x20);
> +		twl4030_reg_write(t, TWL4030_USB_OTHER_IFC_CTRL_CLR, 0x2);
> +	}
> +
> +	value = readl(CONTROL_PBIAS_LITE);
> +	value |= (1 << 2) | (1 << 1) | (1 << 9);
> +	writel(value, CONTROL_PBIAS_LITE);
> +
> +	value = readl(CONTROL_DEV_CONF0);
> +	writel(value | (1 << 24), CONTROL_PBIAS_LITE);
> +
> +	omap3_add_mmc1(NULL);
> +}
> +
>  static int beagle_mem_init(void)
>  {
>  	omap_add_ram0(SZ_128M);
> @@ -132,7 +159,7 @@ static int beagle_devices_init(void)
>  #endif
>  	omap_add_gpmc_nand_device(&nand_plat);
>  
> -	omap3_add_mmc1(NULL);
> +	beagle_add_mmc();
>  
>  	armlinux_set_bootparams((void *)0x80000100);
>  	armlinux_set_architecture(MACH_TYPE_OMAP3_BEAGLE);
> -- 
> 1.7.10.4
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/1] beagle: add missing mmc twl and control init
  2013-03-08  7:41     ` Sascha Hauer
@ 2013-03-08 12:21       ` Jean-Christophe PLAGNIOL-VILLARD
  2013-03-08 12:45         ` Sascha Hauer
  0 siblings, 1 reply; 10+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-03-08 12:21 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 08:41 Fri 08 Mar     , Sascha Hauer wrote:
> On Thu, Mar 07, 2013 at 12:45:18AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > take from xloader
> > 
> > with this the mmc work even when booting from nand
> 
> Which beagle board revision do you have? With this patch the MMC
> doesn't work at all anymore, even when booting from it.
c3

Best Regards,
J.
> 
> Sascha
> 
> > 
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > ---
> >  arch/arm/boards/beagle/board.c |   29 ++++++++++++++++++++++++++++-
> >  1 file changed, 28 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/arm/boards/beagle/board.c b/arch/arm/boards/beagle/board.c
> > index bed4651..6e69e87 100644
> > --- a/arch/arm/boards/beagle/board.c
> > +++ b/arch/arm/boards/beagle/board.c
> > @@ -63,6 +63,7 @@
> >  #include <linux/err.h>
> >  #include <usb/ehci.h>
> >  #include <mach/xload.h>
> > +#include <mfd/twl4030.h>
> >  
> >  #ifdef CONFIG_DRIVER_SERIAL_NS16550
> >  
> > @@ -109,6 +110,32 @@ static struct gpmc_nand_platform_data nand_plat = {
> >  	.nand_cfg = &omap3_nand_cfg,
> >  };
> >  
> > +/* T2 Register definitions */
> > +#define CONTROL_DEV_CONF0	0x48002274
> > +#define CONTROL_PBIAS_LITE	0x48002520
> > +
> > +static void beagle_add_mmc(void)
> > +{
> > +	unsigned int value = 0;
> > +	struct twl4030 *t = twl4030_get();
> > +
> > +	if (!t) {
> > +		pr_warn("twl4030 not ready to setup mmc\n");
> > +	} else {
> > +		twl4030_reg_write(t, TWL4030_USB_OTHER_FUNC_CTRL_CLR, 0x20);
> > +		twl4030_reg_write(t, TWL4030_USB_OTHER_IFC_CTRL_CLR, 0x2);
> > +	}
> > +
> > +	value = readl(CONTROL_PBIAS_LITE);
> > +	value |= (1 << 2) | (1 << 1) | (1 << 9);
> > +	writel(value, CONTROL_PBIAS_LITE);
> > +
> > +	value = readl(CONTROL_DEV_CONF0);
> > +	writel(value | (1 << 24), CONTROL_PBIAS_LITE);
> > +
> > +	omap3_add_mmc1(NULL);
> > +}
> > +
> >  static int beagle_mem_init(void)
> >  {
> >  	omap_add_ram0(SZ_128M);
> > @@ -132,7 +159,7 @@ static int beagle_devices_init(void)
> >  #endif
> >  	omap_add_gpmc_nand_device(&nand_plat);
> >  
> > -	omap3_add_mmc1(NULL);
> > +	beagle_add_mmc();
> >  
> >  	armlinux_set_bootparams((void *)0x80000100);
> >  	armlinux_set_architecture(MACH_TYPE_OMAP3_BEAGLE);
> > -- 
> > 1.7.10.4
> > 
> > 
> > _______________________________________________
> > barebox mailing list
> > barebox@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/barebox
> > 
> 
> -- 
> Pengutronix e.K.                           |                             |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/1] beagle: add missing mmc twl and control init
  2013-03-08 12:45         ` Sascha Hauer
@ 2013-03-08 12:42           ` Jean-Christophe PLAGNIOL-VILLARD
  2013-03-08 13:00             ` Sascha Hauer
  0 siblings, 1 reply; 10+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-03-08 12:42 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 13:45 Fri 08 Mar     , Sascha Hauer wrote:
> On Fri, Mar 08, 2013 at 01:21:43PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > On 08:41 Fri 08 Mar     , Sascha Hauer wrote:
> > > On Thu, Mar 07, 2013 at 12:45:18AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > > take from xloader
> > > > 
> > > > with this the mmc work even when booting from nand
> > > 
> > > Which beagle board revision do you have? With this patch the MMC
> > > doesn't work at all anymore, even when booting from it.
> > c3
> 
> Me too. Have you tested the patch?
I use my current flashed barebox and re-run barebox

and it works

I boot from NAND

Best Regards,
J.
> 
> Sascha
> 
> -- 
> Pengutronix e.K.                           |                             |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/1] beagle: add missing mmc twl and control init
  2013-03-08 12:21       ` Jean-Christophe PLAGNIOL-VILLARD
@ 2013-03-08 12:45         ` Sascha Hauer
  2013-03-08 12:42           ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 10+ messages in thread
From: Sascha Hauer @ 2013-03-08 12:45 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Fri, Mar 08, 2013 at 01:21:43PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 08:41 Fri 08 Mar     , Sascha Hauer wrote:
> > On Thu, Mar 07, 2013 at 12:45:18AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > take from xloader
> > > 
> > > with this the mmc work even when booting from nand
> > 
> > Which beagle board revision do you have? With this patch the MMC
> > doesn't work at all anymore, even when booting from it.
> c3

Me too. Have you tested the patch?

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/1] beagle: add missing mmc twl and control init
  2013-03-08 12:42           ` Jean-Christophe PLAGNIOL-VILLARD
@ 2013-03-08 13:00             ` Sascha Hauer
  0 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2013-03-08 13:00 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Fri, Mar 08, 2013 at 01:42:45PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 13:45 Fri 08 Mar     , Sascha Hauer wrote:
> > On Fri, Mar 08, 2013 at 01:21:43PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > On 08:41 Fri 08 Mar     , Sascha Hauer wrote:
> > > > On Thu, Mar 07, 2013 at 12:45:18AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > > > take from xloader
> > > > > 
> > > > > with this the mmc work even when booting from nand
> > > > 
> > > > Which beagle board revision do you have? With this patch the MMC
> > > > doesn't work at all anymore, even when booting from it.
> > > c3
> > 
> > Me too. Have you tested the patch?
> I use my current flashed barebox and re-run barebox
> 
> and it works
> 
> I boot from NAND

Just tried again with current master + this patch flashed as xloader +
2nd stage flashed to Nand. It breaks compiling the xloader support btw:

arch/arm/boards/beagle/built-in.o: In function `beagle_devices_init':
lowlevel.c:(.text.beagle_devices_init+0x18): undefined reference to `twl4030_get'
lowlevel.c:(.text.beagle_devices_init+0x2c): undefined reference to `twlcore_reg_write'
lowlevel.c:(.text.beagle_devices_init+0x36): undefined reference to `twlcore_reg_write'

To fix this I enabled the twl support for now.

But still it doesn't work

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-03-08 13:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-04 19:37 [PATCH] OMAP3 updates Sascha Hauer
2013-03-04 19:37 ` [PATCH 1/2] ARM: OMAP3: invalidate L2 cache using ROM API Sascha Hauer
2013-03-04 19:37 ` [PATCH 2/2] ARM: OMAP: beagle: Add missing MMC iomux setup Sascha Hauer
2013-03-06 23:45   ` [PATCH 1/1] beagle: add missing mmc twl and control init Jean-Christophe PLAGNIOL-VILLARD
2013-03-07  2:06     ` Alexander Aring
2013-03-08  7:41     ` Sascha Hauer
2013-03-08 12:21       ` Jean-Christophe PLAGNIOL-VILLARD
2013-03-08 12:45         ` Sascha Hauer
2013-03-08 12:42           ` Jean-Christophe PLAGNIOL-VILLARD
2013-03-08 13:00             ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox