Skip to contentSkip to conversation

palm treo 680 smartphone board support

PATCH Superseded Mike Dunn 4 participants 28 messages Apr 11, 2013 – Apr 14, 2013

Subsystems (7)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Mike Dunn

author
#0 lore raw

v2 cover palm treo 680 smartphone board support

Hi,

This patchset adds support for the Palm Treo 680 smartphone. I had to make some minor tweaks to u-boot to get things working. Most of these changes are small, and most only touch the pxa arch.

Thanks for looking.

Changelog:
v2:
- tabs removed in #defines in palmtreo680.h
- use '__weak' macro in pxa_lcd
- remove externs from function prototypes in bitrev.h
- remove commented-out code from docg4.c
- the CONFIG_SYS_LCD_PXA_NO_L_BIAS patch was removed; the same result is accomplished by re-configuring the L_BIAS gpio in the board-specific lcd_enable(), which runs after the driver initialization
- userland utility for programming u-boot to flash moved to tools/palmtreo680
- commit message for patches that add bitrev library and docg4 driver contain the commit and linux version for when the code was added to linux

Mike Dunn (7):
pxa_lcd: add the ACX544AKN lcd device
pxa_lcd: make lcd_enable() a weak pointer
pxa27x_udc: remove call to unimplemented set_GPIO_mode()
arm: bootm: call udc_disable()before booting linux
lib: import bitrev library from the linux kernel
mtd: nand: add driver for diskonchip g4 nand flash add support for palm treo 680 board

 CREDITS                                  |    4 +
 MAINTAINERS                              |    3 +
 arch/arm/include/asm/arch-pxa/hardware.h |   11 -
 arch/arm/include/asm/bootm.h             |    1 +
 arch/arm/lib/bootm.c                     |    1 +
 board/palmtreo680/Makefile               |   34 +
 board/palmtreo680/palmtreo680.c          |  179 +++++
 board/palmtreo680/palmtreo680_spl.lds    |   51 ++
 boards.cfg                               |    1 +
 doc/README.palmtreo680                   |  570 ++++++++++++++++
 drivers/mtd/nand/Makefile                |    2 +
 drivers/mtd/nand/docg4.c                 | 1034 ++++++++++++++++++++++++++++++
 drivers/mtd/nand/docg4_spl.c             |  221 +++++++
 drivers/usb/gadget/pxa27x_udc.c          |    4 +-
 drivers/video/pxa_lcd.c                  |   34 +-
 include/configs/palmtreo680.h            |  296 +++++++++
 include/linux/bitrev.h                   |   23 +
 include/linux/mtd/docg4.h                |  134 ++++
 lib/Makefile                             |    1 +
 lib/bitrev.c                             |   59 ++
 tools/palmtreo680/flash_u-boot.c         |  177 +++++
 21 files changed, 2827 insertions(+), 13 deletions(-)
 create mode 100644 board/palmtreo680/Makefile
 create mode 100644 board/palmtreo680/palmtreo680.c
 create mode 100644 board/palmtreo680/palmtreo680_spl.lds
 create mode 100644 doc/README.palmtreo680
 create mode 100644 drivers/mtd/nand/docg4.c
 create mode 100644 drivers/mtd/nand/docg4_spl.c
 create mode 100644 include/configs/palmtreo680.h
 create mode 100644 include/linux/bitrev.h
 create mode 100644 include/linux/mtd/docg4.h
 create mode 100644 lib/bitrev.c
 create mode 100644 tools/palmtreo680/flash_u-boot.c
Signature · 1 line
1.7.8.6
author
#1 lore raw

PATCH v2 1/7 pxa_lcd: add the ACX544AKN lcd device

This adds the definitions required to support the LCD device on the Palm Treo 680.

---
 drivers/video/pxa_lcd.c |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)
drivers/video/pxa_lcd.c +32 -0
index b40ec36..d5fbe7b 100644
@@ -248,6 +248,38 @@ vidinfo_t panel_info = {
 };
 #endif /* CONFIG_ACX517AKN */
 
+#ifdef CONFIG_ACX544AKN
+
+# define LCD_BPP	LCD_COLOR16
+
+/* you have to set lccr0 and lccr3 (including pcd) */
+# define REG_LCCR0	0x003008f9
+# define REG_LCCR3	0x04700007 /* 16bpp */
+
+vidinfo_t panel_info = {
+	.vl_col		= 320,
+	.vl_row		= 320,
+	.vl_width	= 320,
+	.vl_height	= 320,
+	.vl_clkp	= CONFIG_SYS_LOW,
+	.vl_oep		= CONFIG_SYS_LOW,
+	.vl_hsp		= CONFIG_SYS_LOW,
+	.vl_vsp		= CONFIG_SYS_LOW,
+	.vl_dp		= CONFIG_SYS_LOW,
+	.vl_bpix	= LCD_BPP,
+	.vl_lbw		= 0,
+	.vl_splt	= 0,
+	.vl_clor	= 1,
+	.vl_tft		= 1,
+	.vl_hpw		= 0x05,
+	.vl_blw		= 0x13,
+	.vl_elw		= 0x08,
+	.vl_vpw		= 0x02,
+	.vl_bfw		= 0x07,
+	.vl_efw		= 0x05,
+};
+#endif /* CONFIG_ACX544AKN */
+
 /*----------------------------------------------------------------------*/
 
 #ifdef CONFIG_LQ038J7DH53
Signature · 1 line
1.7.8.6
author
#3 lore raw

PATCH v2 2/7 pxa_lcd: make lcd_enable() a weak pointer

In reply to Mike Dunn

Make lcd_init() a weak pointer so that boards can overload it if necessary. The palmtreo680 board needs to wiggle some gpios and configure the pwm controller in order to get the lcd and its backlight working.

---
 drivers/video/pxa_lcd.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/pxa_lcd.c +1 -1
index d5fbe7b..5e4c685 100644
@@ -410,7 +410,7 @@ void lcd_initcolregs (void)
 #endif /* LCD_MONOCHROME */
 
 /*----------------------------------------------------------------------*/
-void lcd_enable (void)
+__weak void lcd_enable(void)
 {
 }
 
Signature · 1 line
1.7.8.6
#4 lore raw

PATCH v2 2/7 pxa_lcd: make lcd_enable() a weak pointer

Dear Mike Dunn,

Quoted 5 lines

Make lcd_init() a weak pointer so that boards can overload it if necessary.
The palmtreo680 board needs to wiggle some gpios and configure the pwm
controller in order to get the lcd and its backlight working.

Best regards,
Marek Vasut

author
#5 lore raw

PATCH v2 3/7 pxa27x_udc: remove call to unimplemented set_GPIO_mode()

In reply to Mike Dunn

If CONFIG_USB_DEV_PULLUP_GPIO is defined, a link error occurs because the set_GPIO_mode() helper function is not implemented. This function doesn't do much except make the code a little more readable, so I just manually coded its equivalent and removed the prototype from the header file. It is invoked no where else in the code.

While I was at it, I noticed that two other function prototypes in the same header file are also neither implemented nor invoked anywhere, so I removed them as well.

---
 arch/arm/include/asm/arch-pxa/hardware.h |   11 -----------
 drivers/usb/gadget/pxa27x_udc.c          |    4 +++-
 2 files changed, 3 insertions(+), 12 deletions(-)
arch/arm/include/asm/arch-pxa/hardware.h +0 -11
index 44b800f..2397bce 100644
@@ -77,17 +77,6 @@
 #define GPIO_FALLING_EDGE	1
 #define GPIO_RISING_EDGE	2
 #define GPIO_BOTH_EDGES		3
-extern void set_GPIO_IRQ_edge( int gpio_nr, int edge_mask );
-
-/*
- * Handy routine to set GPIO alternate functions
- */
-extern void set_GPIO_mode( int gpio_mode );
-
-/*
- * return current lclk frequency in units of 10kHz
- */
-extern unsigned int get_lclk_frequency_10khz(void);
 
 #endif
 
drivers/usb/gadget/pxa27x_udc.c +3 -1
index 4c00081..71cc0f2 100644
@@ -610,7 +610,9 @@ void udc_connect(void)
 
 #ifdef CONFIG_USB_DEV_PULLUP_GPIO
 	/* Turn on the USB connection by enabling the pullup resistor */
-	set_GPIO_mode(CONFIG_USB_DEV_PULLUP_GPIO | GPIO_OUT);
+	writel(readl(GPDR(CONFIG_USB_DEV_PULLUP_GPIO))
+		     | GPIO_bit(CONFIG_USB_DEV_PULLUP_GPIO),
+	       GPDR(CONFIG_USB_DEV_PULLUP_GPIO));
 	writel(GPIO_bit(CONFIG_USB_DEV_PULLUP_GPIO), GPSR(CONFIG_USB_DEV_PULLUP_GPIO));
 #else
 	/* Host port 2 transceiver D+ pull up enable */
Signature · 1 line
1.7.8.6
#6 lore raw

PATCH v2 3/7 pxa27x_udc: remove call to unimplemented set_GPIO_mode()

Dear Mike Dunn,

Quoted 11 lines

If CONFIG_USB_DEV_PULLUP_GPIO is defined, a link error occurs because the set_GPIO_mode() helper function is not implemented. This function doesn't do much except make the code a little more readable, so I just manually coded its equivalent and removed the prototype from the header file. It is invoked no where else in the code.

While I was at it, I noticed that two other function prototypes in the same header file are also neither implemented nor invoked anywhere, so I removed them as well.

Best regards,
Marek Vasut

author
#7 lore raw

PATCH v2 4/7 arm: bootm: call udc_disable()before booting linux

In reply to Mike Dunn

On the pxa270, if the udc device is not disabled before jumping to linux, the device fails to initialize in linux because it was left in a running state, and the linux driver assumes that it is in a disabled state.

---

Arguably, this is a bug in the linux driver, but it seemed pretty simple and benign to just disable it in u-boot. I'll also send a patch to upstream kernel to fix its driver.

 arch/arm/include/asm/bootm.h |    1 +
 arch/arm/lib/bootm.c         |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/include/asm/bootm.h +1 -0
index db2ff94..68189cc 100644
@@ -21,6 +21,7 @@
 
 #ifdef CONFIG_USB_DEVICE
 extern void udc_disconnect(void);
+extern void udc_disable(void);
 #endif
 
 #endif
arch/arm/lib/bootm.c +1 -0
index f3b30c5..6daa7bf 100644
@@ -105,6 +105,7 @@ static void announce_and_cleanup(void)
 
 #ifdef CONFIG_USB_DEVICE
 	udc_disconnect();
+	udc_disable();
 #endif
 	cleanup_before_linux();
 }
Signature · 1 line
1.7.8.6
#8 lore raw

PATCH v2 4/7 arm: bootm: call udc_disable()before booting linux

Dear Mike Dunn,

Quoted 5 lines

On the pxa270, if the udc device is not disabled before jumping to linux, the device fails to initialize in linux because it was left in a running state, and the linux driver assumes that it is in a disabled state.

I hope this won't break other platforms. Tom, can you test?

Best regards,
Marek Vasut

author
#9 lore raw

PATCH v2 5/7 lib: import bitrev library from the linux kernel

In reply to Mike Dunn

This patch adds the bitrev library from the linux kernel. This is a simple algorithm that uses an 8 bit look-up table to reverse the bits in data types of 8, 16, or 32 bit widths. The docg4 nand flash driver uses it.

[port from linux kernel 2.6.20 commit a5cfc1ec58a07074dacb6aa8c79eff864c966d12]

---
 include/linux/bitrev.h |   23 ++++++++++++++++++
 lib/Makefile           |    1 +
 lib/bitrev.c           |   59 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 83 insertions(+), 0 deletions(-)
 create mode 100644 include/linux/bitrev.h
 create mode 100644 lib/bitrev.c
include/linux/bitrev.h new file +23 -0
new file mode 100644
index 0000000..a61d956
@@ -0,0 +1,23 @@
+/*
+ * This file is released under the terms of GPL v2 and any later version.
+ * See the file COPYING in the root directory of the source tree for details.
+ *
+ * Based on bitrev from the Linux kernel, by Akinobu Mita
+ */
+
+#ifndef _LINUX_BITREV_H
+#define _LINUX_BITREV_H
+
+#include <linux/types.h>
+
+extern u8 const byte_rev_table[256];
+
+static inline u8 bitrev8(u8 byte)
+{
+	return byte_rev_table[byte];
+}
+
+u16 bitrev16(u16 in);
+u32 bitrev32(u32 in);
+
+#endif /* _LINUX_BITREV_H */
lib/Makefile +1 -0
index 1bfd3ee..b4aaae9 100644
@@ -55,6 +55,7 @@ COBJS-$(CONFIG_SHA1) += sha1.o
 COBJS-$(CONFIG_SHA256) += sha256.o
 COBJS-y	+= strmhz.o
 COBJS-$(CONFIG_RBTREE)	+= rbtree.o
+COBJS-$(CONFIG_BITREVERSE) += bitrev.o
 endif
 
 ifdef CONFIG_SPL_BUILD
lib/bitrev.c new file +59 -0

59 lines not on this page · raw message

Signature · 1 line
1.7.8.6
#10 lore raw

PATCH v2 5/7 lib: import bitrev library from the linux kernel

Dear Mike Dunn,

Quoted 6 lines

This patch adds the bitrev library from the linux kernel. This is a simple algorithm that uses an 8 bit look-up table to reverse the bits in data types of 8, 16, or 32 bit widths. The docg4 nand flash driver uses it.

[port from linux kernel 2.6.20 commit
a5cfc1ec58a07074dacb6aa8c79eff864c966d12]

Why did you port it from such an ancient kernel? Newer version is not an option?

Best regards,
Marek Vasut

author
#11 lore raw

PATCH v2 5/7 lib: import bitrev library from the linux kernel

Quoted 10 lines · Marek Vasut

Dear Mike Dunn,

Quoted 6 lines

This patch adds the bitrev library from the linux kernel. This is a simple algorithm that uses an 8 bit look-up table to reverse the bits in data types of 8, 16, or 32 bit widths. The docg4 nand flash driver uses it.

[port from linux kernel 2.6.20 commit
a5cfc1ec58a07074dacb6aa8c79eff864c966d12]

Why did you port it from such an ancient kernel? Newer version is not an option?

Maybe I misunderstood and gave the wrong information (probably, now that I think about it). I took it fom the latest kernel, but reported the commit that added it to the kernel.

In this case, it's a simple algorithm and only a couple trivial changes were made since it was first added to the kernel, so the error is probably inconsequential, but I'll resubmit, reporting the HEAD of the kernel I took it from if you like.

BTW, I did the same for the docg4 driver, but I did the u-boot port a while ago, so in that case it's correct, at least practically. Since I did the port, the kernel docg4 driver had some enhancements (reliable mode) that still need to be brought into u-boot.

Thanks Marek,
Mike

#12 lore raw

PATCH v2 5/7 lib: import bitrev library from the linux kernel

Dear Mike Dunn,

Quoted 18 lines · Marek Vasut
Quoted 7 lines

Dear Mike Dunn,

Quoted 5 lines

This patch adds the bitrev library from the linux kernel. This is a simple algorithm that uses an 8 bit look-up table to reverse the bits in data types of 8, 16, or 32 bit widths. The docg4 nand flash driver uses it.

Quoted 5 lines
Quoted 2 lines

[port from linux kernel 2.6.20 commit
a5cfc1ec58a07074dacb6aa8c79eff864c966d12]

Why did you port it from such an ancient kernel? Newer version is not an option?

Maybe I misunderstood and gave the wrong information (probably, now that I think about it). I took it fom the latest kernel, but reported the commit that added it to the kernel.

Quoted 8 lines

In this case, it's a simple algorithm and only a couple trivial changes were made since it was first added to the kernel, so the error is probably inconsequential, but I'll resubmit, reporting the HEAD of the kernel I took it from if you like.

BTW, I did the same for the docg4 driver, but I did the u-boot port a while ago, so in that case it's correct, at least practically. Since I did the port, the kernel docg4 driver had some enhancements (reliable mode) that

Knowing which tag in linux-stable you pulled it from is a good information too, yes.

Best regards,
Marek Vasut

#13 lore raw

PATCH v2 5/7 lib: import bitrev library from the linux kernel

In reply to Mike Dunn

Dear Mike Dunn,

Quoted 5 lines · In message <[email protected]> you wrote:

In this case, it's a simple algorithm and only a couple trivial changes were made since it was first added to the kernel, so the error is probably inconsequential, but I'll resubmit, reporting the HEAD of the kernel I took it from if you like.

Please use the git commit ID of the exact kernel version which you used to copy the code from, not any older nor any more recent version.

Thanks.

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
A good marriage would be between a blind wife and deaf husband.
                                               -- Michel de Montaigne
author
#14 lore raw

PATCH v2 6/7 mtd: nand: add driver for diskonchip g4 nand flash

In reply to Mike Dunn

This patch adds a driver for the diskonchip G4 nand flash device. It is based on the driver from the linux kernel.

This also includes a separate SPL driver. A separate SPL driver is used because the device operates in a different mode (reliable mode) when loading a boot image, and also because the storage format of the boot image is different from normal data (pages are stored redundantly). The SPL driver basically mimics how a typical IPL reads data from the device. The special operating mode and storage format are used to compensate for the fact that the IPL does not contain the BCH ecc decoding algorithm (due to size constraints). Although the u-boot SPL *could* use ecc, it operates like an IPL for the sake of simplicity and uniformity, since the IPL and SPL share the task of loading the u-boot image. As a side benefit, the SPL driver is very small.

[port from linux kernel 3.4 commit 570469f3bde7f71cc1ece07a18d54a05b6a8775d]

---
 drivers/mtd/nand/Makefile    |    2 +
 drivers/mtd/nand/docg4.c     | 1035 ++++++++++++++++++++++++++++++++++++++++++
 drivers/mtd/nand/docg4_spl.c |  222 +++++++++
 include/linux/mtd/docg4.h    |  134 ++++++
 4 files changed, 1393 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/nand/docg4.c
 create mode 100644 drivers/mtd/nand/docg4_spl.c
 create mode 100644 include/linux/mtd/docg4.h
drivers/mtd/nand/Makefile +2 -0
index c77c0c4..1bcf43c 100644
@@ -34,6 +34,7 @@ NORMAL_DRIVERS=y
 endif
 
 COBJS-$(CONFIG_SPL_NAND_AM33XX_BCH) += am335x_spl_bch.o
+COBJS-$(CONFIG_SPL_NAND_DOCG4) += docg4_spl.o
 COBJS-$(CONFIG_SPL_NAND_SIMPLE) += nand_spl_simple.o
 COBJS-$(CONFIG_SPL_NAND_LOAD) += nand_spl_load.o
 COBJS-$(CONFIG_SPL_NAND_ECC) += nand_ecc.o
@@ -78,6 +79,7 @@ COBJS-$(CONFIG_NAND_SPEAR) += spr_nand.o
 COBJS-$(CONFIG_TEGRA_NAND) += tegra_nand.o
 COBJS-$(CONFIG_NAND_OMAP_GPMC) += omap_gpmc.o
 COBJS-$(CONFIG_NAND_PLAT) += nand_plat.o
+COBJS-$(CONFIG_NAND_DOCG4) += docg4.o
 
 else  # minimal SPL drivers
 
drivers/mtd/nand/docg4.c new file +1035 -0

1,035 lines not on this page · raw message

drivers/mtd/nand/docg4_spl.c new file +222 -0

222 lines not on this page · raw message

include/linux/mtd/docg4.h new file +134 -0

134 lines not on this page · raw message

Signature · 1 line
1.7.8.6
#15 lore raw

PATCH v2 6/7 mtd: nand: add driver for diskonchip g4 nand flash

Dear Mike Dunn,

Quoted 15 lines

This patch adds a driver for the diskonchip G4 nand flash device. It is based on the driver from the linux kernel.

This also includes a separate SPL driver. A separate SPL driver is used because the device operates in a different mode (reliable mode) when loading a boot image, and also because the storage format of the boot image is different from normal data (pages are stored redundantly). The SPL driver basically mimics how a typical IPL reads data from the device. The special operating mode and storage format are used to compensate for the fact that the IPL does not contain the BCH ecc decoding algorithm (due to size constraints). Although the u-boot SPL *could* use ecc, it operates like an IPL for the sake of simplicity and uniformity, since the IPL and SPL share the task of loading the u-boot image. As a side benefit, the SPL driver is very small.

Quoted 2 lines

[port from linux kernel 3.4 commit
570469f3bde7f71cc1ece07a18d54a05b6a8775d]

Scott, this really is your turf.

Best regards,
Marek Vasut

#16 lore raw

PATCH v2 6/7 mtd: nand: add driver for diskonchip g4 nand flash

Quoted 22 lines · Marek Vasut

Dear Mike Dunn,

Quoted 1 line

This patch adds a driver for the diskonchip G4 nand flash device.

It is

Quoted 3 lines

based on the driver from the linux kernel.

This also includes a separate SPL driver. A separate SPL driver is

used

Quoted 2 lines

because the device operates in a different mode (reliable mode) when loading a boot image, and also because the storage format of the

boot

Quoted 1 line

image is different from normal data (pages are stored

redundantly). The

Quoted 1 line

SPL driver basically mimics how a typical IPL reads data from the

device.

Quoted 1 line

The special operating mode and storage format are used to

compensate for

Quoted 1 line

the fact that the IPL does not contain the BCH ecc decoding

algorithm (due

Quoted 2 lines

to size constraints). Although the u-boot SPL *could* use ecc, it operates like an IPL for the sake of simplicity and uniformity,

since the

Quoted 8 lines
Quoted 1 line

IPL and SPL share the task of loading the u-boot image. As a side

benefit,

Quoted 4 lines

the SPL driver is very small.

[port from linux kernel 3.4 commit
570469f3bde7f71cc1ece07a18d54a05b6a8775d]

Scott, this really is your turf.

I already acked it (it's up to Mike what he wants to do with dbg). Feel free to pick it up as part of the larger patchset -- it's a dependency for patch 7/7 that adds the board support.

-Scott

#17 lore raw

PATCH v2 6/7 mtd: nand: add driver for diskonchip g4 nand flash

In reply to Mike Dunn
Quoted 38 lines · Mike Dunn

This patch adds a driver for the diskonchip G4 nand flash device. It is based
on the driver from the linux kernel.

This also includes a separate SPL driver. A separate SPL driver is used because
the device operates in a different mode (reliable mode) when loading a boot
image, and also because the storage format of the boot image is different from
normal data (pages are stored redundantly). The SPL driver basically mimics how
a typical IPL reads data from the device. The special operating mode and
storage format are used to compensate for the fact that the IPL does not contain
the BCH ecc decoding algorithm (due to size constraints). Although the u-boot
SPL *could* use ecc, it operates like an IPL for the sake of simplicity and
uniformity, since the IPL and SPL share the task of loading the u-boot image.
As a side benefit, the SPL driver is very small.

[port from linux kernel 3.4 commit
570469f3bde7f71cc1ece07a18d54a05b6a8775d]

---
 drivers/mtd/nand/Makefile    |    2 +
 drivers/mtd/nand/docg4.c     | 1035  
++++++++++++++++++++++++++++++++++++++++++
 drivers/mtd/nand/docg4_spl.c |  222 +++++++++
 include/linux/mtd/docg4.h    |  134 ++++++
 4 files changed, 1393 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/nand/docg4.c
 create mode 100644 drivers/mtd/nand/docg4_spl.c
 create mode 100644 include/linux/mtd/docg4.h

[snip]

drivers/mtd/nand/docg4.c line 92

Quoted 5 lines
drivers/mtd/nand/docg4.c new file +5 -0
+#ifdef DEBUG_DOCG4
+#define dbg(format, arg...) printf("DEBUG: " format, ##arg)
+#else
+#define dbg(format, arg...) do {} while (0)
+#endif

Maybe use MTDDEBUG?

Otherwise:

-Scott

author
#18 lore raw

PATCH v2 6/7 mtd: nand: add driver for diskonchip g4 nand flash

Quoted 27 lines · Scott Wood
Quoted 17 lines · Mike Dunn

This patch adds a driver for the diskonchip G4 nand flash device. It is based on the driver from the linux kernel.

This also includes a separate SPL driver. A separate SPL driver is used because the device operates in a different mode (reliable mode) when loading a boot image, and also because the storage format of the boot image is different from normal data (pages are stored redundantly). The SPL driver basically mimics how a typical IPL reads data from the device. The special operating mode and storage format are used to compensate for the fact that the IPL does not contain the BCH ecc decoding algorithm (due to size constraints). Although the u-boot SPL *could* use ecc, it operates like an IPL for the sake of simplicity and uniformity, since the IPL and SPL share the task of loading the u-boot image. As a side benefit, the SPL driver is very small.

[port from linux kernel 3.4 commit 570469f3bde7f71cc1ece07a18d54a05b6a8775d]

Quoted 9 lines
---
 drivers/mtd/nand/Makefile    |    2 +
 drivers/mtd/nand/docg4.c     | 1035 ++++++++++++++++++++++++++++++++++++++++++
 drivers/mtd/nand/docg4_spl.c |  222 +++++++++
 include/linux/mtd/docg4.h    |  134 ++++++
 4 files changed, 1393 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/nand/docg4.c
 create mode 100644 drivers/mtd/nand/docg4_spl.c
 create mode 100644 include/linux/mtd/docg4.h
Quoted 8 lines

[snip]

drivers/mtd/nand/docg4.c line 92

Quoted 5 lines
drivers/mtd/nand/docg4.c new file +5 -0
+#ifdef DEBUG_DOCG4
+#define dbg(format, arg...) printf("DEBUG: " format, ##arg)
+#else
+#define dbg(format, arg...) do {} while (0)
+#endif

Maybe use MTDDEBUG?

Ok. Alternatively, I wouldn't mind pulling them out entirely. It's been behaving quite nicely, and amyway, in the past I used a JTAG emultor rather than the printfs.

Quoted 3 lines

Otherwise:

Many thanks Scott,
Mike

#19 lore raw

PATCH v2 6/7 mtd: nand: add driver for diskonchip g4 nand flash

In reply to Scott Wood

Dear Scott Wood,

[...]

Quoted 8 lines

[snip]

drivers/mtd/nand/docg4.c line 92

Quoted 5 lines
drivers/mtd/nand/docg4.c new file +5 -0
+#ifdef DEBUG_DOCG4
+#define dbg(format, arg...) printf("DEBUG: " format, ##arg)
+#else
+#define dbg(format, arg...) do {} while (0)
+#endif

There already is a debugging facility in include/common.h too. And it does the same thing too. MTDDEBUG might work as well.

Best regards,
Marek Vasut

#20 lore raw

PATCH v2 6/7 mtd: nand: add driver for diskonchip g4 nand flash

Quoted 6 lines · Marek Vasut

Dear Scott Wood,

[...]

Quoted 3 lines

[snip]

Quoted 9 lines
Quoted 5 lines

drivers/mtd/nand/docg4.c line 92

Quoted 5 lines
drivers/mtd/nand/docg4.c new file +5 -0
+#ifdef DEBUG_DOCG4
+#define dbg(format, arg...) printf("DEBUG: " format, ##arg)
+#else
+#define dbg(format, arg...) do {} while (0)
+#endif

There already is a debugging facility in include/common.h too. And it does the
same thing too. MTDDEBUG might work as well.

I already pointed out MTDDEBUG, though debug() may be a better fit as it doesn't require adding debug levels, and since this driver's usage doesn't correspond to CONFIG_MTD_DEBUG in Linux (which appears to have been removed from Linux -- removal from U-Boot should likely follow).

Mike said he may just remove the debug messages entirely (maybe also from the Linux driver?), making it moot.

-Scott

author
#21 lore raw

PATCH v2 7/7 add support for palm treo 680 board

In reply to Mike Dunn

A quick overview of u-boot implementation on the treo 680...

The treo 680 has a Diskonchip G4 nand flash chip. This device has a 2k region that maps to the system bus at the reset vector in a NOR-like fashion so that it can be used as the boot device. The phone is shipped with this 2k region configured as write-protected (can't be modified) and programmed with an initial program loader (IPL). At power-up, this IPL loads the contents of two flash blocks to SDRAM and jumps to it. The capacity of the two blocks is not large enough to hold all of u-boot, so a u-boot SPL is used. To conserve flash space, these two blocks and the necessary number of subsequent blocks are programmed with a concatenated spl + u-boot image. That way, the IPL will also load a portion of u-boot proper, and when the spl runs, it relocates the portion of u-boot that the IPL has already loaded, and then resumes loading the remaining part of u-boot before jumping to it.

The default_environment is used (CONFIG_ENV_IS_NOWHERE) because I didn't think that having a writable environment was worth the cost of a flash block, although adding it would be straightforward. I abuse the CONFIG_EXTRA_ENV_SETTINGS option to specify the usbtty for the console (CONFIG_SYS_CONSOLE_IS_IN_ENV).

Support for the LCD is included, but currently it is only useful for displaying the u-boot splash screen. But if u-boot is built without the usbtty console, it does display the auto-boot progress nicely.

---
 CREDITS                               |    4 +
 MAINTAINERS                           |    3 +
 board/palmtreo680/Makefile            |   34 ++
 board/palmtreo680/palmtreo680.c       |  179 +++++++++++
 board/palmtreo680/palmtreo680_spl.lds |   51 +++
 boards.cfg                            |    1 +
 doc/README.palmtreo680                |  570 +++++++++++++++++++++++++++++++++
 include/configs/palmtreo680.h         |  295 +++++++++++++++++
 tools/palmtreo680/flash_u-boot.c      |  177 ++++++++++
 9 files changed, 1314 insertions(+), 0 deletions(-)
 create mode 100644 board/palmtreo680/Makefile
 create mode 100644 board/palmtreo680/palmtreo680.c
 create mode 100644 board/palmtreo680/palmtreo680_spl.lds
 create mode 100644 doc/README.palmtreo680
 create mode 100644 include/configs/palmtreo680.h
 create mode 100644 tools/palmtreo680/flash_u-boot.c
CREDITS +4 -0
index 7c1458f..3b657e9 100644
@@ -124,6 +124,10 @@ N: James F. Dougherty
 E: jfd at GigabitNetworks.COM
 D: Port to the MOUSSE board
 
+N: Mike Dunn
+E: mikedunn at newsguy.com
+D: Palmtreo680 board, docg4 nand flash driver
+
 N: Dave Ellis
 E: DGE at sixnetio.com
 D: EEPROM Speedup, SXNI855T port
MAINTAINERS +3 -0
index 1614b91..db62af1 100644
@@ -650,6 +650,9 @@ Wolfgang Denk <[email protected]>
 	imx27lite	i.MX27
 	qong		i.MX31
 
+Mike Dunn <[email protected]>
+	palmtreo680	pxa270
+
 Kristoffer Ericson <[email protected]>
 
 	jornada	SA1110
board/palmtreo680/Makefile new file +34 -0
new file mode 100644
index 0000000..34ffb99
@@ -0,0 +1,34 @@
+#
+# Palm Treo680 Support
+#
+# Copyright (C) 2013 Mike Dunn <[email protected]>
+#
+# This file is released under the terms of GPL v2 and any later version.
+# See the file COPYING in the root directory of the source tree for details.
+
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(BOARD).o
+
+COBJS	:= palmtreo680.o
+
+SRCS	:= $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS))
+
+$(LIB):	$(obj).depend $(OBJS)
+	$(call cmd_link_o_target, $(OBJS))
+
+clean:
+	rm -f $(OBJS)
+
+distclean:	clean
+	rm -f $(LIB) core *.bak $(obj).depend
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
board/palmtreo680/palmtreo680.c new file +179 -0

179 lines not on this page · raw message

board/palmtreo680/palmtreo680_spl.lds new file +51 -0

51 lines not on this page · raw message

boards.cfg +1 -0
index 5fc70be..72a9440 100644
@@ -331,6 +331,7 @@ h2200                        arm         pxa
 lubbock                      arm         pxa
 palmld                       arm         pxa
 palmtc                       arm         pxa
+palmtreo680                  arm         pxa
 polaris                      arm         pxa         trizepsiv           -              -           trizepsiv:POLARIS
 pxa255_idp                   arm         pxa
 trizepsiv                    arm         pxa
doc/README.palmtreo680 new file +570 -0

570 lines not on this page · raw message

include/configs/palmtreo680.h new file +295 -0

295 lines not on this page · raw message

tools/palmtreo680/flash_u-boot.c new file +177 -0

177 lines not on this page · raw message

Signature · 1 line
1.7.8.6
#22 lore raw

PATCH v2 7/7 add support for palm treo 680 board

Dear Mike Dunn,

Quoted 22 lines

A quick overview of u-boot implementation on the treo 680...

The treo 680 has a Diskonchip G4 nand flash chip. This device has a 2k region that maps to the system bus at the reset vector in a NOR-like fashion so that it can be used as the boot device. The phone is shipped with this 2k region configured as write-protected (can't be modified) and programmed with an initial program loader (IPL). At power-up, this IPL loads the contents of two flash blocks to SDRAM and jumps to it. The capacity of the two blocks is not large enough to hold all of u-boot, so a u-boot SPL is used. To conserve flash space, these two blocks and the necessary number of subsequent blocks are programmed with a concatenated spl + u-boot image. That way, the IPL will also load a portion of u-boot proper, and when the spl runs, it relocates the portion of u-boot that the IPL has already loaded, and then resumes loading the remaining part of u-boot before jumping to it.

The default_environment is used (CONFIG_ENV_IS_NOWHERE) because I didn't think that having a writable environment was worth the cost of a flash block, although adding it would be straightforward. I abuse the CONFIG_EXTRA_ENV_SETTINGS option to specify the usbtty for the console (CONFIG_SYS_CONSOLE_IS_IN_ENV).

Quoted 5 lines

Support for the LCD is included, but currently it is only useful for displaying the u-boot splash screen. But if u-boot is built without the usbtty console, it does display the auto-boot progress nicely.

I think the tool shall really go as a separate patch. Besides, can the tool not be implemented as a part of u-boot's mkimage infrastructure?

author
#23 lore raw

PATCH v2 7/7 add support for palm treo 680 board

Quoted 24 lines · Marek Vasut

Dear Mike Dunn,

Quoted 22 lines

A quick overview of u-boot implementation on the treo 680...

The treo 680 has a Diskonchip G4 nand flash chip. This device has a 2k region that maps to the system bus at the reset vector in a NOR-like fashion so that it can be used as the boot device. The phone is shipped with this 2k region configured as write-protected (can't be modified) and programmed with an initial program loader (IPL). At power-up, this IPL loads the contents of two flash blocks to SDRAM and jumps to it. The capacity of the two blocks is not large enough to hold all of u-boot, so a u-boot SPL is used. To conserve flash space, these two blocks and the necessary number of subsequent blocks are programmed with a concatenated spl + u-boot image. That way, the IPL will also load a portion of u-boot proper, and when the spl runs, it relocates the portion of u-boot that the IPL has already loaded, and then resumes loading the remaining part of u-boot before jumping to it.

The default_environment is used (CONFIG_ENV_IS_NOWHERE) because I didn't think that having a writable environment was worth the cost of a flash block, although adding it would be straightforward. I abuse the CONFIG_EXTRA_ENV_SETTINGS option to specify the usbtty for the console (CONFIG_SYS_CONSOLE_IS_IN_ENV).

Quoted 8 lines
Quoted 5 lines

Support for the LCD is included, but currently it is only useful for displaying the u-boot splash screen. But if u-boot is built without the usbtty console, it does display the auto-boot progress nicely.

I think the tool shall really go as a separate patch. Besides, can the tool not be implemented as a part of u-boot's mkimage infrastructure?

OK, I can make the flash_u-boot utility (which writes u-boot to the flash boot blocks) a separate patch.

As for making it part of mkimage... I didn't really consider that because based on my (limited) knowledge, I figured they are unrelated. As I understand it, mkimage creates an OS image file that u-boot can parse and load. flash_u-boot is a utility that performs the task of writing u-boot itself to flash.

I figured that mine was a special case, since u-boot must be written in a special format (redundant pages) and in a special manner (alternate 4k regions skipped), with the flash device in a special mode, and so it can not be done in the normal manner; e.g., 'nandwrite' from mtd-utils, or its u-boot 'nand write' equivalent, even if you first ran the u-boot image through a separate utility that simply converted the format of the image.

Hope that makes sense. Any insight appreciated. I'll take a look at what's in the tools directory.

Thanks Marek,
Mike

#24 lore raw

PATCH v2 7/7 add support for palm treo 680 board

Dear Mike Dunn,

Quoted 34 lines · Marek Vasut
Quoted 24 lines

Dear Mike Dunn,

Quoted 22 lines

A quick overview of u-boot implementation on the treo 680...

The treo 680 has a Diskonchip G4 nand flash chip. This device has a 2k region that maps to the system bus at the reset vector in a NOR-like fashion so that it can be used as the boot device. The phone is shipped with this 2k region configured as write-protected (can't be modified) and programmed with an initial program loader (IPL). At power-up, this IPL loads the contents of two flash blocks to SDRAM and jumps to it. The capacity of the two blocks is not large enough to hold all of u-boot, so a u-boot SPL is used. To conserve flash space, these two blocks and the necessary number of subsequent blocks are programmed with a concatenated spl + u-boot image. That way, the IPL will also load a portion of u-boot proper, and when the spl runs, it relocates the portion of u-boot that the IPL has already loaded, and then resumes loading the remaining part of u-boot before jumping to it.

The default_environment is used (CONFIG_ENV_IS_NOWHERE) because I didn't think that having a writable environment was worth the cost of a flash block, although adding it would be straightforward. I abuse the CONFIG_EXTRA_ENV_SETTINGS option to specify the usbtty for the console (CONFIG_SYS_CONSOLE_IS_IN_ENV).

Quoted 8 lines
Quoted 5 lines

Support for the LCD is included, but currently it is only useful for displaying the u-boot splash screen. But if u-boot is built without the usbtty console, it does display the auto-boot progress nicely.

I think the tool shall really go as a separate patch. Besides, can the tool not be implemented as a part of u-boot's mkimage infrastructure?

Quoted 8 lines

OK, I can make the flash_u-boot utility (which writes u-boot to the flash boot blocks) a separate patch.

As for making it part of mkimage... I didn't really consider that because based on my (limited) knowledge, I figured they are unrelated. As I understand it, mkimage creates an OS image file that u-boot can parse and load. flash_u-boot is a utility that performs the task of writing u-boot itself to flash.

It can create an bootloader image that can be written to flash using standard mtd utilities. Does this not cut it for you? Why do you need a separate flasher, because the G4 is special ?

Quoted 9 lines

I figured that mine was a special case, since u-boot must be written in a special format (redundant pages) and in a special manner (alternate 4k regions skipped), with the flash device in a special mode, and so it can not be done in the normal manner; e.g., 'nandwrite' from mtd-utils, or its u-boot 'nand write' equivalent, even if you first ran the u-boot image through a separate utility that simply converted the format of the image.

Hope that makes sense. Any insight appreciated. I'll take a look at what's in the tools directory.

I see ... so the G4 is such a horrible beast :( OK

Best regards,
Marek Vasut

#25 lore raw

v2 cover palm treo 680 smartphone board support

In reply to Mike Dunn

Hi Mike,

Quoted 7 lines

Hi,

This patchset adds support for the Palm Treo 680 smartphone. I had to make some minor tweaks to u-boot to get things working. Most of these changes are small, and most only touch the pxa arch.

Thanks for looking.

I pushed what I considered ok to u-boot-pxa/master, please start your reworks on top of that.

Thanks!

Best regards,
Marek Vasut

author
#26 lore raw

v2 cover palm treo 680 smartphone board support

Quoted 4 lines · Marek Vasut

Hi Mike,

Quoted 2 lines

Hi,

Quoted 8 lines
Quoted 5 lines

This patchset adds support for the Palm Treo 680 smartphone. I had to make some minor tweaks to u-boot to get things working. Most of these changes are small, and most only touch the pxa arch.

Thanks for looking.

I pushed what I considered ok to u-boot-pxa/master, please start your reworks on top of that.

Will do. Thanks a lot for your time and effort in reviewing!

I forgot to add 'v3' to the subject line of patch 5/8 in the last set I sent:

[PATCH 5/8] lib: import bitrev library from the linux kernel

Don't know if that will cause problems or not. The contents of the patch are unchanged from v2, but the description added the HEAD commit from the kernel I took the code from, as we discussed.

Thanks again,
Mike

#27 lore raw

v2 cover palm treo 680 smartphone board support

Dear Mike Dunn,

Quoted 16 lines · Marek Vasut
Quoted 4 lines

Hi Mike,

Quoted 2 lines

Hi,

Quoted 8 lines
Quoted 5 lines

This patchset adds support for the Palm Treo 680 smartphone. I had to make some minor tweaks to u-boot to get things working. Most of these changes are small, and most only touch the pxa arch.

Thanks for looking.

I pushed what I considered ok to u-boot-pxa/master, please start your reworks on top of that.

Will do. Thanks a lot for your time and effort in reviewing!

Quoted 8 lines

I forgot to add 'v3' to the subject line of patch 5/8 in the last set I sent:

[PATCH 5/8] lib: import bitrev library from the linux kernel

Don't know if that will cause problems or not. The contents of the patch are unchanged from v2, but the description added the HEAD commit from the kernel I took the code from, as we discussed.

Don't worry, I picked most of them already.

Best regards,
Marek Vasut