Skip to contentSkip to conversation

Add a new Nomadik board

PATCH New Alessandro Rubini 3 participants 9 messages Jan 18, 2010 – Jan 22, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Add a new Nomadik board

These two patches add the USB-S8815 board by Calao.

The board is very similar to the nhk8815 evaluation kit, but the NAND is connected on a 16-bit bus. Therefore, the first patch adds the option to have 16-bit nand, and the second one uses it.

The patch depends on the LCD support patches I sent on Dec 05. Some of them were picked up in the video-next branch (Dec 05), but I had no feedback about the other ones (actually, only those two are needed for this board, the other ones are for nhk8815 devices that are missing here).

Also, for the board to work the pach for reset timer is needed. I sent V4 on Nov 25th and I had no feedback (nor has it been applied). The trivial patch is needed for NAND operations to work reliably on both nhk8815 and usb-s8815 (this one).

Alessandro Rubini (2):
NAND Nomadik: add CONFIG_NAND_NOMADIK_16BIT option Add Nomadik board "usb-s8815" by Calao vendor

 MAINTAINERS                                        |    4 +
 Makefile                                           |    4 +
 board/{st/nhk8815 => calao/usb-s8815}/Makefile     |    3 +-
 board/{st/nhk8815 => calao/usb-s8815}/config.mk    |    0
 board/{st/nhk8815 => calao/usb-s8815}/lcd.c        |   34 +------
 board/{st/nhk8815 => calao/usb-s8815}/platform.S   |    0
 .../nhk8815.c => calao/usb-s8815/usb-s8815.c}      |   40 +--------
 drivers/mtd/nand/nomadik.c                         |   15 ++-
 include/configs/{nhk8815.h => usb-s8815.h}         |   98 ++++----------------
 9 files changed, 47 insertions(+), 151 deletions(-)
 copy board/{st/nhk8815 => calao/usb-s8815}/Makefile (96%)
 copy board/{st/nhk8815 => calao/usb-s8815}/config.mk (100%)
 copy board/{st/nhk8815 => calao/usb-s8815}/lcd.c (68%)
 copy board/{st/nhk8815 => calao/usb-s8815}/platform.S (100%)
 copy board/{st/nhk8815/nhk8815.c => calao/usb-s8815/usb-s8815.c} (67%)
 copy include/configs/{nhk8815.h => usb-s8815.h} (61%)
#1 lore raw

PATCH 1/2 NAND Nomadik: add CONFIG_NAND_NOMADIK_16BIT option

---
 drivers/mtd/nand/nomadik.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)
drivers/mtd/nand/nomadik.c +11 -4
index b76f4cb..149f68b 100644
@@ -196,13 +196,20 @@ static void nomadik_nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
 
 int board_nand_init(struct nand_chip *chip)
 {
-	/* Set up the FSMC_PCR0 for nand access*/
-	writel(0x0000004a, REG_FSMC_PCR0);
-	/* Set up FSMC_PMEM0, FSMC_PATT0 with timing data for access */
+	u32 pcr0_val;
+
+	chip->options = NAND_COPYBACK |	NAND_CACHEPRG | NAND_NO_PADDING;
+	pcr0_val = 0x0000004a; /* Enabled, nand, enable ecc hw */
+
+#ifdef CONFIG_NAND_NOMADIK_16BIT
+	chip->options |= NAND_BUSWIDTH_16;
+	pcr0_val |= 0x00000010; /* 16-bit access */
+#endif
+	/* Set up FSMC control0, PMEM0, PATT0 with timing data for access */
+	writel(pcr0_val, REG_FSMC_PCR0);
 	writel(0x00020401, REG_FSMC_PMEM0);
 	writel(0x00020404, REG_FSMC_PATT0);
 
-	chip->options = NAND_COPYBACK |	NAND_CACHEPRG | NAND_NO_PADDING;
 	chip->cmd_ctrl = nomadik_nand_hwcontrol;
 	chip->dev_ready = nomadik_nand_ready;
 	/* The chip allows 32bit reads, so avoid the default 8bit copy */
Signature · 1 line
1.6.0.2
#5 lore raw

PATCH 2/2 Add Nomadik board "usb-s8815" by Calao vendor

In reply to Alessandro Rubini
---
 MAINTAINERS                                        |    4 +
 Makefile                                           |    4 +
 board/{st/nhk8815 => calao/usb-s8815}/Makefile     |    3 +-
 board/{st/nhk8815 => calao/usb-s8815}/config.mk    |    0
 board/{st/nhk8815 => calao/usb-s8815}/lcd.c        |   34 +------
 board/{st/nhk8815 => calao/usb-s8815}/platform.S   |    0
 .../nhk8815.c => calao/usb-s8815/usb-s8815.c}      |   40 +--------
 include/configs/{nhk8815.h => usb-s8815.h}         |   98 ++++----------------
 8 files changed, 36 insertions(+), 147 deletions(-)
 copy board/{st/nhk8815 => calao/usb-s8815}/Makefile (96%)
 copy board/{st/nhk8815 => calao/usb-s8815}/config.mk (100%)
 copy board/{st/nhk8815 => calao/usb-s8815}/lcd.c (68%)
 copy board/{st/nhk8815 => calao/usb-s8815}/platform.S (100%)
 copy board/{st/nhk8815/nhk8815.c => calao/usb-s8815/usb-s8815.c} (67%)
 copy include/configs/{nhk8815.h => usb-s8815.h} (61%)
MAINTAINERS +4 -0
index e8ba4bc..9d97b40 100644
@@ -699,6 +699,10 @@ Nomadik Linux Team <[email protected]>
 
 	nhk8815		ARM926EJS (Nomadik 8815 Soc)
 
+Alessandro Rubini <[email protected]>
+
+	usb-s8815	ARM926EJS (Nomadik 8815 Soc)
+
 Steve Sakoman <[email protected]>
 
 	omap3_overo	ARM CORTEX-A8 (OMAP3xx SoC)
Makefile +4 -0
index 793fcec..39e9a09 100644
@@ -3068,6 +3068,10 @@ trab_old_config:	unconfig
 		}
 	@$(MKCONFIG) -a $(call xtract_trab,$@) arm arm920t trab NULL s3c24x0
 
+usb-s8815_config:	unconfig
+	@$(MKCONFIG) $(@:_config=) arm arm926ejs usb-s8815 calao nomadik
+
+
 VCMA9_config	:	unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm920t vcma9 mpl s3c24x0
 
board/calao/usb-s8815/Makefile renamed from board/st/nhk8815/Makefile +1 -2
similarity index 96%
copy from board/st/nhk8815/Makefile
copy to board/calao/usb-s8815/Makefile
index 7155f12..730d374 100644
@@ -29,8 +29,7 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(BOARD).a
 
-COBJS-y	:= nhk8815.o
-COBJS-$(CONFIG_NHK8815_KEYPAD) += keypad.o
+COBJS-y	:= usb-s8815.o
 COBJS-$(CONFIG_LCD) += lcd.o
 
 COBJS	:= $(COBJS-y)
board/calao/usb-s8815/config.mk renamed from board/st/nhk8815/config.mk +0 -0
similarity index 100%
copy from board/st/nhk8815/config.mk
copy to board/calao/usb-s8815/config.mk
board/calao/usb-s8815/lcd.c renamed from board/st/nhk8815/lcd.c +6 -28
similarity index 68%
copy from board/st/nhk8815/lcd.c
copy to board/calao/usb-s8815/lcd.c
index d3acb48..744da67 100644
@@ -1,5 +1,5 @@
 /*
- * board/st/nhk8815/lcd.c: use amba clcd and STMPE2401 for backlight/reset
+ * board/calao/usb-s8815/lcd.c: use amba clcd and STMPE2401 for backlight/reset
  *
  * Copyright 2009 Alessandro Rubini <[email protected]>
  *
@@ -24,7 +24,7 @@
 #include <common.h>
 #include <lcd.h>
 #include <amba_clcd.h>
-#include <stmpe2401.h>
+#include <asm/arch/gpio.h>
 
 /* Two configurations are supported: 32bpp and 16bpp */
 #if LCD_BPP == LCD_COLOR32
@@ -38,7 +38,7 @@
 #endif
 
 /* Horribly, these are precomputed registers */
-struct clcd_config nhk8815_clcd_config = {
+struct clcd_config s8815_clcd_config = {
 	.address =	(struct clcd_registers *)NOMADIK_CLCDC_BASE,
 	.tim0 =		0xd52600c4,	/* horizontal timings */
 	.tim1 =		0x220a01df,	/* vertical timings */
@@ -53,36 +53,14 @@ vidinfo_t panel_info = {
 	.vl_col =	800,
 	.vl_row =	480,
 	.vl_bpix =	CLCD_BPIX_VAL,
-	.priv =		&nhk8815_clcd_config,
+	.priv =		&s8815_clcd_config,
 };
 
-/* Don't turn on (too early), but configure data lines and remove reset */
+/* Set GPIO32..GPIO39 to ALTB, to enable LCD16..LCD23 */
 void lcd_enable(void)
 {
 	int i;
 
-	/* Turn the alternate functions as needed */
-	for (i = 32; i <= 39; i++)
+	for (i = 32; i < 40; i++)
 		nmk_gpio_af(i, GPIO_ALT_B);
-
-	/* EXP1_GPIO_5 = output high -- remove reset from display */
-	pe_gpio_af(STMPE1, 5, PE_GPIO_AF_GPIO);
-	pe_gpio_dir(STMPE1, 5, 1);
-	pe_gpio_set(STMPE1, 5, 1);
-}
-
-/* Called from late_init: we turn on the backlight through port expander */
-int nhk8815_backlight_on(void)
-{
-	int i;
-
-	/* Turn the alternate functions as needed */
-	for (i = 32; i <= 39; i++)
-		nmk_gpio_af(i, GPIO_ALT_B);
-
-	/* EXP0_GPIO_21 = output high -- backlight */
-	pe_gpio_af(STMPE0, 21, PE_GPIO_AF_GPIO);
-	pe_gpio_dir(STMPE0, 21, 1);
-	pe_gpio_set(STMPE0, 21, 1);
-	return 0;
 }
board/calao/usb-s8815/platform.S renamed from board/st/nhk8815/platform.S +0 -0
similarity index 100%
copy from board/st/nhk8815/platform.S
copy to board/calao/usb-s8815/platform.S
board/calao/usb-s8815/usb-s8815.c renamed from board/st/nhk8815/nhk8815.c +1 -39
similarity index 67%
copy from board/st/nhk8815/nhk8815.c
copy to board/calao/usb-s8815/usb-s8815.c
index fedb3c0..12ae810 100644
@@ -28,8 +28,6 @@
 #include <common.h>
 #include <netdev.h>
 #include <asm/io.h>
-#include <asm/arch/gpio.h>
-#include "nhk8815-devices.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -45,7 +43,7 @@ void show_boot_progress(int progress)
  */
 int board_init(void)
 {
-	gd->bd->bi_arch_number = MACH_TYPE_NOMADIK;
+	gd->bd->bi_arch_number = MACH_TYPE_USB_S8815;
 	gd->bd->bi_boot_params = 0x00000100;
 	writel(0xC37800F0, NOMADIK_GPIO1_BASE + 0x20);
 	writel(0x00000000, NOMADIK_GPIO1_BASE + 0x24);
@@ -56,32 +54,8 @@ int board_init(void)
 	writel(0x0000305b, REG_FSMC_BCR1);
 	writel(0x00033f33, REG_FSMC_BTR1);
 
-	/* Set up SMCS0 for OneNand: sram-like once again */
-	writel(0x000030db, NOMADIK_FSMC_BASE + 0x00); /* FSMC_BCR0 */
-	writel(0x02100551, NOMADIK_FSMC_BASE + 0x04); /* FSMC_BTR0 */
-
 	icache_enable();
 
-	/*
-	 * Configure I2C pins, as we will use I2C in a later commit
-	 */
-
-	/* Set the two I2C gpio lines to be gpio high */
-	nmk_gpio_set(__SCL, 1);	nmk_gpio_set(__SDA, 1);
-	nmk_gpio_dir(__SCL, 1);	nmk_gpio_dir(__SDA, 1);
-	nmk_gpio_af(__SCL, GPIO_GPIO); nmk_gpio_af(__SDA, GPIO_GPIO);
-
-	/* Put the two I2C port expanders out of reset, on GPIO77 and 79 */
-	{
-		int n[2]={77, 79};
-		int i;
-		for (i = 0; i < ARRAY_SIZE(n); i++) {
-			nmk_gpio_af(n[i], GPIO_GPIO);
-			nmk_gpio_dir(n[i], 1);
-			nmk_gpio_set(n[i], 1);
-		}
-	}
-
 	return 0;
 }
 
@@ -107,15 +81,3 @@ int board_eth_init(bd_t *bis)
 }
 #endif
 
-/* Initialization callback, from lib_arm/board.c */
-int board_late_init(void)
-{
-#ifdef CONFIG_NHK8815_KEYPAD
-	nhk8815_keypad_init();
-#endif
-#ifdef CONFIG_LCD
-	nhk8815_backlight_on();
-#endif
-	return 0;
-}
-
include/configs/usb-s8815.h renamed from include/configs/nhk8815.h +20 -78

143 lines not on this page · raw message

Signature · 1 line
1.6.0.2
#2 lore raw

PATCH 1/2 NAND Nomadik: add CONFIG_NAND_NOMADIK_16BIT option

In reply to Alessandro Rubini

Dear Alessandro Rubini,

Quoted 6 lines · In message <a14c1bde15838a59c60e177a43a4ebd35f28adea.1263851321.git.rubini@unip…
---
 drivers/mtd/nand/nomadik.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

New config options should be documented. If not in the REDME, so at last in the commit message. You may know what CONFIG_NAND_NOMADIK_16BIT is supposed to mean, others may not.

Also, I suggest to change the name into CONFIG_NOMADIK_NAND_16BIT which seems more logical to me.

Best regards,

Wolfgang Denk

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-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"There is no statute of limitations on stupidity."
- Randomly produced by a computer program called Markov3.
#3 lore raw

PATCH 1/2 NAND Nomadik: add CONFIG_NAND_NOMADIK_16BIT option

Quoted 9 lines · Wolfgang Denk

Dear Alessandro Rubini,

Quoted 5 lines · In message <a14c1bde15838a59c60e177a43a4ebd35f28adea.1263851321.git.rubini@unip…
---
 drivers/mtd/nand/nomadik.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)
Quoted 6 lines

New config options should be documented. If not in the REDME, so at last in the commit message. You may know what CONFIG_NAND_NOMADIK_16BIT is supposed to mean, others may not.

Also, I suggest to change the name into CONFIG_NOMADIK_NAND_16BIT which seems more logical to me.

It's an attribute of the hardware, so it should be CONFIG_SYS_NOMADIK_NAND_16BIT.

-Scott

#6 lore raw

PATCH 2/2 Add Nomadik board "usb-s8815" by Calao vendor

In reply to Alessandro Rubini

Dear Alessandro Rubini,

Quoted 18 lines · In message <f34ac6eeba7c2771468e8f7b08d1cdc9bdb04fe6.1263851321.git.rubini@unip…
---
 MAINTAINERS                                        |    4 +
 Makefile                                           |    4 +
 board/{st/nhk8815 => calao/usb-s8815}/Makefile     |    3 +-
 board/{st/nhk8815 => calao/usb-s8815}/config.mk    |    0
 board/{st/nhk8815 => calao/usb-s8815}/lcd.c        |   34 +------
 board/{st/nhk8815 => calao/usb-s8815}/platform.S   |    0
 .../nhk8815.c => calao/usb-s8815/usb-s8815.c}      |   40 +--------
 include/configs/{nhk8815.h => usb-s8815.h}         |   98 ++++----------------
 8 files changed, 36 insertions(+), 147 deletions(-)
 copy board/{st/nhk8815 => calao/usb-s8815}/Makefile (96%)
 copy board/{st/nhk8815 => calao/usb-s8815}/config.mk (100%)
 copy board/{st/nhk8815 => calao/usb-s8815}/lcd.c (68%)
 copy board/{st/nhk8815 => calao/usb-s8815}/platform.S (100%)
 copy board/{st/nhk8815/nhk8815.c => calao/usb-s8815/usb-s8815.c} (67%)
 copy include/configs/{nhk8815.h => usb-s8815.h} (61%)

I don't like to see such heavy copying of code. This is a clear indication that we should factor out the common parts ; Actually differences are so small that common code can be used completely, and no separate board directories are needed.

Note that many of the existing diffrences can be avoided easily and without need for #ifdef's:

board/calao/usb-s8815/lcd.c line 2

Quoted 7 lines

index d3acb48..744da67 100644

board/calao/usb-s8815/lcd.c renamed from board/st/nhk8815/lcd.c +1 -1
@@ -1,5 +1,5 @@
 /*
- * board/st/nhk8815/lcd.c: use amba clcd and STMPE2401 for backlight/reset
+ * board/calao/usb-s8815/lcd.c: use amba clcd and STMPE2401 for backlight/reset

No need to include the file name in the comment.

board/calao/usb-s8815/lcd.c line 41

Quoted 3 lines
board/calao/usb-s8815/lcd.c renamed from board/st/nhk8815/lcd.c +1 -1
 /* Horribly, these are precomputed registers */
-struct clcd_config nhk8815_clcd_config = {
+struct clcd_config s8815_clcd_config = {

Use a common name, then this...

board/calao/usb-s8815/lcd.c vidinfo_t panel_info = { · line 56

Quoted 9 lines
board/calao/usb-s8815/lcd.c renamed from board/st/nhk8815/lcd.c +0 -0
 	.address =	(struct clcd_registers *)NOMADIK_CLCDC_BASE,
board/calao/usb-s8815/lcd.c renamed from board/st/nhk8815/lcd.c +1 -1
 	.tim0 =		0xd52600c4,	/* horizontal timings */
 	.tim1 =		0x220a01df,	/* vertical timings */
@@ -53,36 +53,14 @@ vidinfo_t panel_info = {
 	.vl_col =	800,
 	.vl_row =	480,
 	.vl_bpix =	CLCD_BPIX_VAL,
-	.priv =		&nhk8815_clcd_config,
+	.priv =		&s8815_clcd_config,

...and this diff will go away.

board/calao/usb-s8815/lcd.c vidinfo_t panel_info = { · line 57

Quoted 2 lines
board/calao/usb-s8815/lcd.c renamed from board/st/nhk8815/lcd.c +1 -1
-	gd->bd->bi_arch_number = MACH_TYPE_NOMADIK;
+	gd->bd->bi_arch_number = MACH_TYPE_USB_S8815;

Set the current MACH_TYPE in the board config file, and use this setting here.

etc. etc.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Forty two.
#7 lore raw

PATCH 2/2 Add Nomadik board "usb-s8815" by Calao vendor

[I'm re-adding Gregory Hermant in Cc:, while my message had the Cc:
explicit, the copy I got from the list and your reply had no such header]

Quoted 1 line

I don't like to see such heavy copying of code.

I understand your point of view (although I didn't use --find-copies-harder you probably wouldn't have noticed).

However, these are really different boards from different vendors. The Calao one is a stripped-down version of the development system, not uncommon to what happens elsewhere.

Where do you suggest to place common code?

While it is true that, currently, platform.S can be placed in common nomadik code, the file could as well be cleaned up of unneeded or redundant stuff, which is different in the two boards. (The file is something I got from the vendor and would benefit from some cleanup, now that I know more of the various register sets in the SoC).

Quoted 2 lines

Note that many of the existing diffrences can be avoided easily and without need for #ifdef's:

You are right. But one LCD needs a turn-on-backlight method, while the other does not. If I place it on cpu/arm926ejs/nomadik/ we'll have problems when another board mounts a different display.

I'll try to factorize as I can, but I'm not sure it's the right thing to do. Will respin the patch by tomorrow night.

/alessandro

#4 lore raw

PATCH 1/2 NAND Nomadik: add CONFIG_NAND_NOMADIK_16BIT option

In reply to Scott Wood

Wolfgang Denk:

Quoted 2 lines
Quoted 2 lines

Also, I suggest to change the name into CONFIG_NOMADIK_NAND_16BIT which seems more logical to me.

Scott Wood:

Quoted 2 lines

It's an attribute of the hardware, so it should be CONFIG_SYS_NOMADIK_NAND_16BIT.

Actually, I would love to have this option passed from the board, to avoid an ifdef in the SoC driver, which actually can handle both. I haven't found how to do that. Any suggestion is welcome, otherwise I'll use the name suggested by Scott Wood.

/alessandro

#8 lore raw

PATCH 2/2 Add Nomadik board "usb-s8815" by Calao vendor

In reply to Wolfgang Denk

Wolfgang Denk:

Quoted 2 lines

I don't like to see such heavy copying of code. This is a clear indication that we should factor out the common parts

While I disagree (as explained), I'm trying hard to do it. Unfortunately what is currently a Makefile decision (COBJS-y and such) will sometimes become ifdef in the code.

However, i've moved platform.S and lcd.c to the cpu directory, so they can be shared (the assembly really ought to be personalized for each board, as some cruft is still there from past history, and the lcd.c is really two small data structures, but let's ignore this by now).

Now, reading better your message I see this that I don't understand.

Quoted 2 lines

Actually differences are so small that common code can be used completely, and no separate board directories are needed.

On one side we are asked to use the vendor directories, and now I should merge vendor/st/nhk8815 and vendor/calao/usb-8815. Now, I wonder where am I expected to place che board files. In cpu/arm926ejs/nomadik ? And using #ifdef in a single file to sort out differences?

I got the idea a board should be a separate object (directory), which bases on the available infrastructure to pick up pieces and define own parameters. Adding a board should be as easy as adding a directory.

Such parameters sometimes happen to match other parameters, but coalescing two boards just to save a few lines is not an advantage, in my opinion.

Could you please explain how to proceed to have both boards upstream in the best possible way? I currently don't understand the policy.

Please forgive me if the message looks aggressive. It's not meant to be, but ascii doesn't proprely convey tone.

/alessandro