mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* V3 patches for imx35pdk boot
@ 2010-05-14  2:15 Marc Reilly
  2010-05-14  2:15 ` [PATCH 1/5] arm: Add revision tag to boot parameters Marc Reilly
  2010-05-17  9:04 ` V3 patches for imx35pdk boot Sascha Hauer
  0 siblings, 2 replies; 8+ messages in thread
From: Marc Reilly @ 2010-05-14  2:15 UTC (permalink / raw)
  To: barebox

Hi,

Third time's a charm, hopefully. I fixed up all the whitespace issues in 3stack.c and signed off all the patches.

The morale of the story is get it right first go :)
(I'm not too sure how to combine patch 1 and 2, and being such a git newb my tree is already starting to look like a pair of octopi mating, so I'm just going to leave as is.)

Cheers
Marc


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

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

* [PATCH 1/5] arm: Add revision tag to boot parameters
  2010-05-14  2:15 V3 patches for imx35pdk boot Marc Reilly
@ 2010-05-14  2:15 ` Marc Reilly
  2010-05-14  2:15   ` [PATCH 2/5] arm boot: Formatting Marc Reilly
  2010-05-17  9:04 ` V3 patches for imx35pdk boot Sascha Hauer
  1 sibling, 1 reply; 8+ messages in thread
From: Marc Reilly @ 2010-05-14  2:15 UTC (permalink / raw)
  To: barebox

Revision info required for some boards at boot time.
Only adds if the system_rev has been set to non-zero.

Signed-off-by: Marc Reilly <marc@cpdesign.com.au>
---
 arch/arm/include/asm/armlinux.h |    6 ++++++
 arch/arm/lib/armlinux.c         |   23 +++++++++++++++++++++++
 2 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/arch/arm/include/asm/armlinux.h b/arch/arm/include/asm/armlinux.h
index cfe57f4..f4104fb 100644
--- a/arch/arm/include/asm/armlinux.h
+++ b/arch/arm/include/asm/armlinux.h
@@ -6,6 +6,7 @@
 void armlinux_set_bootparams(void *params);
 void armlinux_set_architecture(int architecture);
 void armlinux_add_dram(struct device_d *dev);
+void armlinux_set_revision(unsigned int);
 #else
 static inline void armlinux_set_bootparams(void *params)
 {
@@ -18,6 +19,11 @@ static inline void armlinux_set_architecture(int architecture)
 static inline void armlinux_add_dram(struct device_d *dev)
 {
 }
+
+static inline void armlinux_set_revision(unsigned int)
+{
+}
+
 #endif
 
 #endif /* __ARCH_ARMLINUX_H */
diff --git a/arch/arm/lib/armlinux.c b/arch/arm/lib/armlinux.c
index 019c030..1c39045 100644
--- a/arch/arm/lib/armlinux.c
+++ b/arch/arm/lib/armlinux.c
@@ -44,6 +44,8 @@ static struct tag *params;
 static int armlinux_architecture = 0;
 static void *armlinux_bootparams = NULL;
 
+static unsigned int system_rev;
+
 static void setup_start_tag(void)
 {
 	params = (struct tag *)armlinux_bootparams;
@@ -106,6 +108,18 @@ static void setup_commandline_tag(const char *commandline)
 	params = tag_next(params);
 }
 
+static void setup_revision_tag(void)
+{
+	if( system_rev) {
+		params->hdr.tag = ATAG_REVISION;
+		params->hdr.size = tag_size(tag_revision);
+		
+		params->u.revision.rev = system_rev;
+		
+		params = tag_next(params);
+	}
+}
+
 #if 0
 static void setup_initrd_tag(ulong initrd_start, ulong initrd_end)
 {
@@ -147,6 +161,12 @@ void armlinux_add_dram(struct device_d *dev)
 	list_add_tail(&mem->list, &memory_list);
 }
 
+void armlinux_set_revision(unsigned int rev)
+{
+	system_rev = rev;
+}
+
+
 #ifdef CONFIG_CMD_BOOTM
 int do_bootm_linux(struct image_data *data)
 {
@@ -184,6 +204,7 @@ int do_bootm_linux(struct image_data *data)
 	if (initrd_start && initrd_end)
 		setup_initrd_tag (initrd_start, initrd_end);
 #endif
+	setup_revision_tag();
 	setup_end_tag();
 
 	if (relocate_image(data->os, (void *)ntohl(os_header->ih_load)))
@@ -281,6 +302,7 @@ static int do_bootz(struct command *cmdtp, int argc, char *argv[])
 	if (initrd_start && initrd_end)
 		setup_initrd_tag (initrd_start, initrd_end);
 #endif
+	setup_revision_tag();
 	setup_end_tag();
 
 	shutdown_barebox();
@@ -323,6 +345,7 @@ static int do_bootu(struct command *cmdtp, int argc, char *argv[])
 	setup_start_tag();
 	setup_memory_tags();
 	setup_commandline_tag(commandline);
+	setup_revision_tag();
 	setup_end_tag();
 
 	shutdown_barebox();
-- 
1.6.4.2


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

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

* [PATCH 2/5] arm boot: Formatting
  2010-05-14  2:15 ` [PATCH 1/5] arm: Add revision tag to boot parameters Marc Reilly
@ 2010-05-14  2:15   ` Marc Reilly
  2010-05-14  2:15     ` [PATCH 3/5] imx35: add detection of silicon revision Marc Reilly
  0 siblings, 1 reply; 8+ messages in thread
From: Marc Reilly @ 2010-05-14  2:15 UTC (permalink / raw)
  To: barebox

Changed to be consistent with surrounding code.

Signed-off-by: Marc Reilly <marc@cpdesign.com.au>
---
 arch/arm/lib/armlinux.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/lib/armlinux.c b/arch/arm/lib/armlinux.c
index 1c39045..e0af838 100644
--- a/arch/arm/lib/armlinux.c
+++ b/arch/arm/lib/armlinux.c
@@ -110,7 +110,7 @@ static void setup_commandline_tag(const char *commandline)
 
 static void setup_revision_tag(void)
 {
-	if( system_rev) {
+	if (system_rev) {
 		params->hdr.tag = ATAG_REVISION;
 		params->hdr.size = tag_size(tag_revision);
 		
-- 
1.6.4.2


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

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

* [PATCH 3/5] imx35: add detection of silicon revision
  2010-05-14  2:15   ` [PATCH 2/5] arm boot: Formatting Marc Reilly
@ 2010-05-14  2:15     ` Marc Reilly
  2010-05-14  2:15       ` [PATCH 4/5] imx35pdk: correct mode for display contrast pin Marc Reilly
  0 siblings, 1 reply; 8+ messages in thread
From: Marc Reilly @ 2010-05-14  2:15 UTC (permalink / raw)
  To: barebox

Implemented imx_silicon_revision() for imx35.

Signed-off-by: Marc Reilly <marc@cpdesign.com.au>
---
 arch/arm/mach-imx/imx35.c                   |   11 +++++++++++
 arch/arm/mach-imx/include/mach/generic.h    |    5 +++++
 arch/arm/mach-imx/include/mach/imx35-regs.h |   18 ++++++++++++++++++
 3 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-imx/imx35.c b/arch/arm/mach-imx/imx35.c
index f2fea4c..0d21311 100644
--- a/arch/arm/mach-imx/imx35.c
+++ b/arch/arm/mach-imx/imx35.c
@@ -16,6 +16,9 @@
  */
 
 #include <common.h>
+#include <asm/io.h>
+#include <mach/imx-regs.h>
+#include <mach/generic.h>
 
 #include "gpio.h"
 
@@ -27,3 +30,11 @@ void *imx_gpio_base[] = {
 
 int imx_gpio_count = ARRAY_SIZE(imx_gpio_base) * 32;
 
+int imx_silicon_revision()
+{
+	uint32_t reg;
+	reg = readl(IMX_IIM_BASE + IIM_SREV);
+	reg += IMX35_CHIP_REVISION_1_0;
+	
+	return (reg & 0xFF);
+}
diff --git a/arch/arm/mach-imx/include/mach/generic.h b/arch/arm/mach-imx/include/mach/generic.h
index 99a53a4..48ed336 100644
--- a/arch/arm/mach-imx/include/mach/generic.h
+++ b/arch/arm/mach-imx/include/mach/generic.h
@@ -3,6 +3,11 @@ int imx_silicon_revision(void);
 #define IMX27_CHIP_REVISION_1_0   0
 #define IMX27_CHIP_REVISION_2_0   1
 
+#define IMX35_CHIP_REVISION_1_0   0x10
+#define IMX35_CHIP_REVISION_2_0   0x20
+
+
+
 #ifdef CONFIG_ARCH_IMX1
 #define cpu_is_mx1()	(1)
 #else
diff --git a/arch/arm/mach-imx/include/mach/imx35-regs.h b/arch/arm/mach-imx/include/mach/imx35-regs.h
index c394a2a..899e57b 100644
--- a/arch/arm/mach-imx/include/mach/imx35-regs.h
+++ b/arch/arm/mach-imx/include/mach/imx35-regs.h
@@ -76,6 +76,24 @@
 #define PDR0_AUTO_CON		(1 << 0)
 #define PDR0_PER_SEL		(1 << 26)
 
+
+#define IIM_STAT	0x0000
+#define IIM_STATM	0x0004
+#define IIM_ERR		0x0008
+#define IIM_EMASK	0x000C
+#define IIM_FCTL	0x0010
+#define IIM_UA		0x0014
+#define IIM_LA		0x0018
+#define IIM_SDAT	0x001C
+#define IIM_PREV	0x0020
+#define IIM_SREV	0x0024
+#define IIM_PREG_P	0x0028
+#define IIM_SCS0	0x002C
+#define IIM_SCS1	0x0030
+#define IIM_SCS2	0x0034
+#define IIM_SCS3	0x0038
+
+
 /*
  * Adresses and ranges of the external chip select lines
  */
-- 
1.6.4.2


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

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

* [PATCH 4/5] imx35pdk: correct mode for display contrast pin
  2010-05-14  2:15     ` [PATCH 3/5] imx35: add detection of silicon revision Marc Reilly
@ 2010-05-14  2:15       ` Marc Reilly
  2010-05-14  2:15         ` [PATCH 5/5] imx35pdk: Detect and set silicon and board revision for boot params Marc Reilly
  0 siblings, 1 reply; 8+ messages in thread
From: Marc Reilly @ 2010-05-14  2:15 UTC (permalink / raw)
  To: barebox


Signed-off-by: Marc Reilly <marc@cpdesign.com.au>
---
 board/freescale-mx35-3-stack/3stack.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/board/freescale-mx35-3-stack/3stack.c b/board/freescale-mx35-3-stack/3stack.c
index fcb87cf..d09de65 100644
--- a/board/freescale-mx35-3-stack/3stack.c
+++ b/board/freescale-mx35-3-stack/3stack.c
@@ -201,10 +201,8 @@ device_initcall(f3s_devices_init);
 
 static int f3s_enable_display(void)
 {
-	gpio_direction_output(1, 1);
-
 	/* Enable power to the LCD. (bit 6 hi.) */
-	mc9sdz60_set_bits( mc9sdz60_get(), MC9SDZ60_REG_GPIO_1, 0x40, 0x40);
+	mc9sdz60_set_bits(mc9sdz60_get(), MC9SDZ60_REG_GPIO_1, 0x40, 0x40);
 
 	return 0;
 }
@@ -270,10 +268,11 @@ static struct pad_desc f3s_pads[] = {
 	MX35_PAD_D3_HSYNC__IPU_DISPB_D3_HSYNC,
 	MX35_PAD_D3_FPSHIFT__IPU_DISPB_D3_CLK,
 	MX35_PAD_D3_DRDY__IPU_DISPB_D3_DRDY,
-	MX35_PAD_CONTRAST__GPIO1_1,
+	MX35_PAD_CONTRAST__IPU_DISPB_CONTR,
 	MX35_PAD_D3_VSYNC__IPU_DISPB_D3_VSYNC,
 	MX35_PAD_D3_REV__IPU_DISPB_D3_REV,
 	MX35_PAD_D3_CLS__IPU_DISPB_D3_CLS,
+	
 };
 
 static int f3s_console_init(void)
-- 
1.6.4.2


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

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

* [PATCH 5/5] imx35pdk: Detect and set silicon and board revision for boot params.
  2010-05-14  2:15       ` [PATCH 4/5] imx35pdk: correct mode for display contrast pin Marc Reilly
@ 2010-05-14  2:15         ` Marc Reilly
  0 siblings, 0 replies; 8+ messages in thread
From: Marc Reilly @ 2010-05-14  2:15 UTC (permalink / raw)
  To: barebox

The kernel for the imx35 pdk doesn't do any detection for board and chip revision. This patch passes the info to the kernel so that v2 boards/chips boot properly.

imx35pdk: make COMPARE pad a GPIO1_5 output

This pad is an interrupt source, active low for one of the external ICs.

fix up/remove unnecessary white space.

Signed-off-by: Marc Reilly <marc@cpdesign.com.au>
---
 board/freescale-mx35-3-stack/3stack.c |   52 +++++++++++++++++++++++++++++---
 1 files changed, 47 insertions(+), 5 deletions(-)

diff --git a/board/freescale-mx35-3-stack/3stack.c b/board/freescale-mx35-3-stack/3stack.c
index d09de65..9a66976 100644
--- a/board/freescale-mx35-3-stack/3stack.c
+++ b/board/freescale-mx35-3-stack/3stack.c
@@ -47,11 +47,17 @@
 #include <mach/iomux-v3.h>
 #include <mach/pmic.h>
 #include <mach/imx-ipu-fb.h>
+#include <mach/generic.h>
 
 #include <i2c/i2c.h>
 #include <i2c/mc13892.h>
 #include <i2c/mc9sdz60.h>
 
+
+/* Board rev for the PDK 3stack */
+#define MX35PDK_BOARD_REV_1		0
+#define MX35PDK_BOARD_REV_2		1
+
 static struct device_d cfi_dev = {
 	.name		= "cfi_flash",
 	.map_base	= IMX_CS0_BASE,
@@ -144,6 +150,32 @@ static struct device_d imxfb_dev = {
 	.platform_data	= &ipu_fb_data,
 };
 
+/*
+ * Revision to be passed to kernel. The kernel provided
+ * by freescale relies on this.
+ *
+ * C --> CPU type
+ * S --> Silicon revision
+ * B --> Board rev
+ *
+ * 31    20     16     12    8      4     0
+ *        | Cmaj | Cmin | B  | Smaj | Smin|
+ *
+ * e.g 0x00035120 --> i.MX35, Cpu silicon rev 2.0, Board rev 2
+*/
+static unsigned int imx35_3ds_system_rev = 0x00035000;
+
+static void set_silicon_rev( int rev)
+{
+	imx35_3ds_system_rev = imx35_3ds_system_rev | (rev & 0xFF);
+}
+
+static void set_board_rev(int rev)
+{
+	imx35_3ds_system_rev =  (imx35_3ds_system_rev & ~(0xF << 8)) | (rev & 0xF) << 8;
+}
+
+
 static int f3s_devices_init(void)
 {
 	uint32_t reg;
@@ -181,6 +213,8 @@ static int f3s_devices_init(void)
 		break;
 	}
 
+	set_silicon_rev(imx_silicon_revision());
+
 	i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));
 	register_device(&i2c_dev);
 
@@ -246,6 +280,8 @@ static struct pad_desc f3s_pads[] = {
 	MX35_PAD_I2C1_DAT__I2C1_SDA,
 
 	MX35_PAD_WDOG_RST__GPIO1_6,
+	MX35_PAD_COMPARE__GPIO1_5,
+
 	/* Display */
 	MX35_PAD_LD0__IPU_DISPB_DAT_0,
 	MX35_PAD_LD1__IPU_DISPB_DAT_1,
@@ -272,7 +308,6 @@ static struct pad_desc f3s_pads[] = {
 	MX35_PAD_D3_VSYNC__IPU_DISPB_D3_VSYNC,
 	MX35_PAD_D3_REV__IPU_DISPB_D3_REV,
 	MX35_PAD_D3_CLS__IPU_DISPB_D3_CLS,
-	
 };
 
 static int f3s_console_init(void)
@@ -373,13 +408,16 @@ static int f3s_get_rev(struct mc13892 *mc13892)
 	if (rev == 0x00ffffff)
 		return -ENODEV;
 
-	return ((rev >> 6) & 0x7) ? 20 : 10;
+	return ((rev >> 6) & 0x7) ? MX35PDK_BOARD_REV_2 : MX35PDK_BOARD_REV_1;
 }
 
 static int f3s_pmic_init_v2(struct mc13892 *mc13892)
 {
 	int err = 0;
 
+	/* COMPARE pin (GPIO1_5) as output and set high */
+	gpio_direction_output( 32*0 + 5 , 1);
+
 	err |= mc13892_set_bits(mc13892, MC13892_REG_SETTING_0, 0x03, 0x03);
 	err |= mc13892_set_bits(mc13892, MC13892_REG_MODE_0, 0x01, 0x01);
 	if (err)
@@ -420,16 +458,18 @@ static int f3s_pmic_init(void)
 
 	rev = f3s_get_rev(mc13892);
 	switch (rev) {
-	case 10:
+	case MX35PDK_BOARD_REV_1:
 		break;
-	case 20:
+	case MX35PDK_BOARD_REV_2:
 		f3s_pmic_init_v2(mc13892);
 		break;
 	default:
 		printf("FAILED to identify board revision!\n");
 		return 0;
 	}
-	printf("i.MX35 PDK CPU board version %d.%d\n", rev / 10, rev % 10);
+
+	set_board_rev(rev);
+	printf("i.MX35 PDK CPU board version %d.\n", rev );
 
 	mc9sdz60 = mc9sdz60_get();
 	if (!mc9sdz60) {
@@ -439,6 +479,8 @@ static int f3s_pmic_init(void)
 
 	f3s_pmic_init_all(mc9sdz60);
 
+	armlinux_set_revision(imx35_3ds_system_rev);
+
 	return 0;
 }
 
-- 
1.6.4.2


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

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

* Re: V3 patches for imx35pdk boot
  2010-05-14  2:15 V3 patches for imx35pdk boot Marc Reilly
  2010-05-14  2:15 ` [PATCH 1/5] arm: Add revision tag to boot parameters Marc Reilly
@ 2010-05-17  9:04 ` Sascha Hauer
  2010-05-17 11:16   ` Marc Reilly
  1 sibling, 1 reply; 8+ messages in thread
From: Sascha Hauer @ 2010-05-17  9:04 UTC (permalink / raw)
  To: Marc Reilly; +Cc: barebox

Hi Marc,

On Fri, May 14, 2010 at 12:15:14PM +1000, Marc Reilly wrote:
> Hi,
> 
> Third time's a charm, hopefully. I fixed up all the whitespace issues
> in 3stack.c and signed off all the patches.

There are still some trailing whitespaces left. I killed them while
committing.

> 
> The morale of the story is get it right first go :) (I'm not too sure
> how to combine patch 1 and 2, and being such a git newb my tree is
> already starting to look like a pair of octopi mating, so I'm just
> going to leave as is.)

Have a look at git rebase -i, it's really nice ;)

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] 8+ messages in thread

* RE: V3 patches for imx35pdk boot
  2010-05-17  9:04 ` V3 patches for imx35pdk boot Sascha Hauer
@ 2010-05-17 11:16   ` Marc Reilly
  0 siblings, 0 replies; 8+ messages in thread
From: Marc Reilly @ 2010-05-17 11:16 UTC (permalink / raw)
  To: 'Sascha Hauer'; +Cc: barebox

Hi,

> > Third time's a charm, hopefully. I fixed up all the whitespace issues
> > in 3stack.c and signed off all the patches.
> 
> There are still some trailing whitespaces left. I killed them while
committing.
Sorry, and thanks. I just had a quick scan through the patches that I
emailed and I swear I'd taken care of them...

> > The morale of the story is get it right first go :) (I'm not too sure
> > how to combine patch 1 and 2, and being such a git newb my tree is
> > already starting to look like a pair of octopi mating, so I'm just
> > going to leave as is.)
> 
> Have a look at git rebase -i, it's really nice ;)
That's what I found in the end. The original morale of the story still
stands though.

People should also note that the LCD and IPU remains enabled as the kernel
goes through its initialization. When the IPU is probed/initialized
(somewhere in ipu_common.c)  the IRQ is enabled (and then immediately
disabled after the function returns) before all the data structures are
properly setup. Because the IPU is still enabled the interrupt fires before
the init finishes and the kernel crashes.

TL;DR: either the ipu init in the kernel needs to be tweaked, or turned off
in barebox before boot.

Cheers
Marc



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

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

end of thread, other threads:[~2010-05-17 11:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-14  2:15 V3 patches for imx35pdk boot Marc Reilly
2010-05-14  2:15 ` [PATCH 1/5] arm: Add revision tag to boot parameters Marc Reilly
2010-05-14  2:15   ` [PATCH 2/5] arm boot: Formatting Marc Reilly
2010-05-14  2:15     ` [PATCH 3/5] imx35: add detection of silicon revision Marc Reilly
2010-05-14  2:15       ` [PATCH 4/5] imx35pdk: correct mode for display contrast pin Marc Reilly
2010-05-14  2:15         ` [PATCH 5/5] imx35pdk: Detect and set silicon and board revision for boot params Marc Reilly
2010-05-17  9:04 ` V3 patches for imx35pdk boot Sascha Hauer
2010-05-17 11:16   ` Marc Reilly

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