palm treo 680 smartphone board support
Subsystems (7)
cover palm treo 680 smartphone board support
Hi,
This patchset adds support for the Palm Treo 680 smartphone. Sorry for the large number of patches; hope this isn't too bold for a first contribution to u-boot. 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. Of course I'd be happy to rework any patches as necessary.
I'd like to add more features... For one thing, the treo really needs support for the pxa keypad. But this patchset is large enough already, and it's perfectly useful on the treo, as long as you don't mind using usbtty for the console.
Thanks for looking.
Mike
Mike Dunn (8):
pxa_lcd: add the ACX544AKN lcd device
pxa_lcd: make lcd_enable() a weak pointer
pxa_lcd: allow L_BIAS line to be unused
pxa27x_udc: remove call to unimplemented set_GPIO_mode()
arm: bootm: call udc_disable() before booting linux
lib: import bitrev library from linux kernel
mtd: nand: add driver for diskonchip g4 nand flash board support for palm treo 680
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 | 47 ++ board/palmtreo680/flash_u-boot.c | 170 +++++ board/palmtreo680/palmtreo680.c | 184 ++++++ board/palmtreo680/palmtreo680_spl.lds | 69 ++ boards.cfg | 1 + doc/README.palmtreo680 | 570 ++++++++++++++++ drivers/mtd/nand/Makefile | 2 + drivers/mtd/nand/docg4.c | 1053 ++++++++++++++++++++++++++++++ drivers/mtd/nand/docg4_spl.c | 234 +++++++ drivers/usb/gadget/pxa27x_udc.c | 4 +- drivers/video/pxa_lcd.c | 56 ++- include/configs/palmtreo680.h | 307 +++++++++ include/linux/bitrev.h | 16 + include/linux/mtd/docg4.h | 126 ++++ lib/Makefile | 1 + lib/bitrev.c | 56 ++ 21 files changed, 2901 insertions(+), 15 deletions(-) create mode 100644 board/palmtreo680/Makefile create mode 100644 board/palmtreo680/flash_u-boot.c 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
Signature · 1 line
1.7.8.6
PATCH 1/8 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
@@ -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
PATCH 2/8 pxa_lcd: make lcd_enable() a weak pointer
In reply to Mike DunnMake lcd_init() a weak pointer aliased to the current (and currently empty) lcd_init(), 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 | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
drivers/video/pxa_lcd.c +5 -1
@@ -410,10 +410,14 @@ void lcd_initcolregs (void)#endif /* LCD_MONOCHROME */ /*----------------------------------------------------------------------*/ -void lcd_enable (void ) +void __lcd_enable (void ) { } +void lcd_enable (void ) + __attribute__((weak,alias ("__lcd_enable" ))); + +/************************************************************************/ /* ** PXA255 specific routines */ /************************************************************************/
Signature · 1 line
1.7.8.6
PATCH 2/8 pxa_lcd: make lcd_enable() a weak pointer
drivers/video/pxa_lcd.c void lcd_initcolregs (void) · line 418
Quoted 2 lines · Mike Dunn
drivers/video/pxa_lcd.c +2
-0+void lcd_enable (void ) + __attribute__((weak,alias ("__lcd_enable" )));
What about declaring it as:
__weak void lcd_enable(void)
PATCH 2/8 pxa_lcd: make lcd_enable() a weak pointer
Quoted 10 lines · Fabio Estevam
drivers/video/pxa_lcd.c void lcd_initcolregs (void) · line 418
Quoted 2 lines · Mike Dunn
drivers/video/pxa_lcd.c +2
-0+void lcd_enable (void ) + __attribute__((weak,alias ("__lcd_enable" )));What about declaring it as:
__weakvoidlcd_enable(void)
Yes, that works. And very to-the-point :) Thanks.
Mike
PATCH 3/8 pxa_lcd: allow L_BIAS line to be unused
In reply to Mike DunnThis patch adds a config option CONFIG_SYS_LCD_PXA_NO_L_BIAS, which causes the lcd controller initialization code to leave as an ordinary gpio the line that is typically configured as the lcd L_BIAS alternate function (this is the gpio 77 line).
For some reason (I don't have a datasheet), the lcd device on the palmtreo680 board does not use the L_BIAS line. PalmOS does not configure the gpio 77 line for the L_BIAS alternate function, and if it is configured as such, the lcd does not work.
---
This is a little ugly, I know, but I didn't want to try and get too fancy.
drivers/video/pxa_lcd.c | 18 ++++++++++++++++-- 1 files changed, 16 insertions(+), 2 deletions(-)
drivers/video/pxa_lcd.c +16 -2
@@ -478,8 +478,13 @@ static void pxafb_setup_gpio (vidinfo_t *vid)/* bits 74-77 */ writel (readl (GPDR2 ) | (0xf <<10 ),GPDR2 ); +#ifdef CONFIG_SYS_LCD_PXA_NO_L_BIAS +writel ((readl (GAFR2_L ) & ~(0xff <<20 )) | (0x2a <<20 ), +GAFR2_L ); +#else writel ((readl (GAFR2_L ) & ~(0xff <<20 )) | (0xaa <<20 ), -GAFR2_L ); +GAFR2_L ); +#endif }/* 8 bit interface */
@@ -497,8 +502,13 @@ static void pxafb_setup_gpio (vidinfo_t *vid)/* bits 74-77 */ writel (readl (GPDR2 ) | (0xf <<10 ),GPDR2 ); +#ifdef CONFIG_SYS_LCD_PXA_NO_L_BIAS +writel ((readl (GAFR2_L ) & ~(0xff <<20 )) | (0x2a <<20 ), +GAFR2_L ); +#else writel ((readl (GAFR2_L ) & ~(0xff <<20 )) | (0xaa <<20 ), -GAFR2_L ); +GAFR2_L ); +#endif }/* 16 bit interface */
@@ -511,7 +521,11 @@ static void pxafb_setup_gpio (vidinfo_t *vid)writel ((readl (GAFR1_U ) & ~(0xfff <<20 )) | (0xaaa <<20 ),GAFR1_U ); +#ifdef CONFIG_SYS_LCD_PXA_NO_L_BIAS +writel ((readl (GAFR2_L ) &0xf0000000 ) |0x02aaaaaa ,GAFR2_L ); +#else writel ((readl (GAFR2_L ) &0xf0000000 ) |0x0aaaaaaa ,GAFR2_L ); +#endif }else {
Signature · 1 line
1.7.8.6
PATCH 3/8 pxa_lcd: allow L_BIAS line to be unused
Dear Mike Dunn,
Quoted 11 lines
This patch adds a config option
CONFIG_SYS_LCD_PXA_NO_L_BIAS, which causes the lcd controller initialization code to leave as an ordinary gpio the line that is typically configured as the lcdL_BIASalternate function (this is the gpio 77 line).For some reason (I don't have a datasheet), the lcd device on the palmtreo680 board does not use the
L_BIASline. PalmOS does not configure the gpio 77 line for theL_BIASalternate function, and if it is configured as such, the lcd does not work.Signed-off-by Mike Dunn <[email protected]>
The other option would be to pull the GPIO setup from the driver. That'd be the best.
Best regards,
Marek Vasut
PATCH 3/8 pxa_lcd: allow L_BIAS line to be unused
Quoted 12 lines · Marek Vasut
Dear Mike Dunn,
Quoted 10 lines
This patch adds a config option
CONFIG_SYS_LCD_PXA_NO_L_BIAS, which causes the lcd controller initialization code to leave as an ordinary gpio the line that is typically configured as the lcdL_BIASalternate function (this is the gpio 77 line).For some reason (I don't have a datasheet), the lcd device on the palmtreo680 board does not use the
L_BIASline. PalmOS does not configure the gpio 77 line for theL_BIASalternate function, and if it is configured as such, the lcd does not work.
Quoted 4 lines
Quoted 1 line
Signed-off-by Mike Dunn <[email protected]>The other option would be to pull the GPIO setup from the driver. That'd be the best.
Well, there's a lot of shared code in pxafb_setup_gpio() that handles pin configuration for all possible interface widths.
But after looking at this problem some more, I realized that the board-specific lcd_enable() is called after the pxa driver's initialization, so the board code can undo the L_BIAS pin configuration. Not elegant, but better than the ugly #ifdefs.
Thanks,
Mike
PATCH 4/8 pxa27x_udc: remove call to unimplemented set_GPIO_mode()
In reply to Mike DunnIf 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
@@ -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
@@ -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
PATCH 5/8 arm: bootm: call udc_disable() before booting linux
In reply to Mike DunnOn the pxa270 (at least), 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.
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
@@ -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
@@ -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
PATCH 5/8 arm: bootm: call udc_disable() before booting linux
Dear Mike Dunn,
Quoted 10 lines
On the pxa270 (at least), 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.
Signed-off-by Mike Dunn <[email protected]>---
Arguably, this is a bug in the linux driver, but it seemed pretty simple and benign to just disable it in u-boot.
Fix the linux one too though please.
Best regards,
Marek Vasut
PATCH 6/8 lib: import bitrev library from linux kernel
In reply to Mike DunnThis 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.
--- include/linux/bitrev.h | 16 +++++++++++++ lib/Makefile | 1 + lib/bitrev.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 0 deletions(-) create mode 100644 include/linux/bitrev.h create mode 100644 lib/bitrev.c
include/linux/bitrev.h new file +16 -0
@@ -0,0 +1,16 @@ +#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]; +} + +extern u16 bitrev16 (u16 in); +extern u32 bitrev32 (u32 in); + +#endif /* _LINUX_BITREV_H */
lib/Makefile +1 -0
@@ -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 +56 -0
56 lines not on this page · raw message
Signature · 1 line
1.7.8.6
PATCH 6/8 lib: import bitrev library from linux kernel
Dear Mike Dunn,
Quoted 24 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.
Signed-off-by Mike Dunn <[email protected]>--- include/linux/bitrev.h | 16 +++++++++++++ lib/Makefile | 1 + lib/bitrev.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 0 deletions(-) create mode 100644 include/linux/bitrev.h create mode 100644 lib/bitrev.cinclude/linux/bitrev.h new file +4
-0@@ -0,0 +1,16 @@ +#ifndef _LINUX_BITREV_H +#define _LINUX_BITREV_H + +#include <linux/types.h>
include/linux/bitrev.h line 14
Quoted 10 lines
include/linux/bitrev.h new file +10
-0+ +extern u8 const byte_rev_table[256 ]; + +static inline u8 bitrev8 (u8 byte) +{ +return byte_rev_table[byte]; +} + +extern u16 bitrev16 (u16 in); +extern u32 bitrev32 (u32 in);
Do we really need to expose the array and use so many externs here?
[...]
PATCH 6/8 lib: import bitrev library from linux kernel
Quoted 30 lines · Marek Vasut
Dear Mike Dunn,
Quoted 28 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.
Signed-off-by Mike Dunn <[email protected]>--- include/linux/bitrev.h | 16 +++++++++++++ lib/Makefile | 1 + lib/bitrev.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 0 deletions(-) create mode 100644 include/linux/bitrev.h create mode 100644 lib/bitrev.cinclude/linux/bitrev.h new file +8
-0@@ -0,0 +1,16 @@ +#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)
Quoted 8 lines
include/linux/bitrev.h line 14
Quoted 6 lines
include/linux/bitrev.h new file +6
-0+{ +return byte_rev_table[byte]; +} + +extern u16 bitrev16 (u16 in); +extern u32 bitrev32 (u32 in);Do we really need to expose the array and use so many externs here?
Yeah, I don't know why the function prototypes were given the 'extern' specifier. This is how it is in the kernel. They aren't necessary.
As for the table... if the bitrev8() function is moved to bitrev.c, the table need not be extern. But if I'm not mistaken, bitrev8() is in the header so that it can be inlined by the compiler. So for the sake of performance I think the extern is appropriate for the table.
Thanks Marek,
Mike
PATCH 6/8 lib: import bitrev library from linux kernel
In reply to Mike DunnDear Mike Dunn,
Quoted 1 line · In message <[email protected]> you wrote:
This patch adds the bitrev library from the linux kernel. This is a simple
-------------------------------------^^^^^^^^^^^^^^^^^^^^^^
Please read bullet # 4 at
http://www.denx.de/wiki/view/U-Boot/Patches#Attributing_Code_Copyrights_Sign
and provide exact reference.
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 I have a very small mind and must live with it. -- Edsger Dijkstra
PATCH 7/8 mtd: nand: add driver for diskonchip g4 nand flash
In reply to Mike DunnThis 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.
--- drivers/mtd/nand/Makefile | 2 + drivers/mtd/nand/docg4.c | 1053 ++++++++++++++++++++++++++++++++++++++++++ drivers/mtd/nand/docg4_spl.c | 234 ++++++++++ include/linux/mtd/docg4.h | 126 +++++ 4 files changed, 1415 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
@@ -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 +1053 -0
1,053 lines not on this page · raw message
drivers/mtd/nand/docg4_spl.c new file +234 -0
234 lines not on this page · raw message
include/linux/mtd/docg4.h new file +126 -0
126 lines not on this page · raw message
Signature · 1 line
1.7.8.6
PATCH 7/8 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 1 line
Signed-off-by Mike Dunn <[email protected]>
Try #ifdef U_BOOT instead of #if 0, no?
Best regards,
Marek Vasut
PATCH 7/8 mtd: nand: add driver for diskonchip g4 nand flash
On 04/07/2013 11:25 PM, Marek Vasut wrote:
[..]
Quoted 1 line
Try #ifdef
U_BOOTinstead of #if 0, no?
Marek, can you clarify? Do you mean something like...
#define U_BOOT
...
#ifndef U_BOOT /* Currently u-boot does not have for_each_set_bit */
unsigned long bits = ~buf[i];
for_each_set_bit(bitnum, &bits, 8) {
...
#else
uint8_t mask;
for(bitnum = 0, mask = 0x80; bitnum < 8; bitnum++, mask >>= 1) {
if (!(buf[i] & mask)) {
...#endif
Thanks again,
Mike
PATCH 7/8 mtd: nand: add driver for diskonchip g4 nand flash
Dear Mike Dunn,
Quoted 19 lines · Marek Vasut
[..]
Quoted 1 line
Try #ifdef
U_BOOTinstead of #if 0, no?Marek, can you clarify? Do you mean something like...
#define
U_BOOT
...#ifndef U_BOOT /* Currently u-boot does not have for_each_set_bit */ unsigned long bits = ~buf[i]; for_each_set_bit(bitnum, &bits, 8) { ... #else uint8_t mask; for(bitnum = 0, mask = 0x80; bitnum < 8; bitnum++, mask >>= 1) { if (!(buf[i] & mask)) { ...
Quoted 1 line
#endif
Hrm, I always thought we had some __UBOOT__ defined, but apparently not :-(
Best regards,
Marek Vasut
PATCH 7/8 mtd: nand: add driver for diskonchip g4 nand flash
In reply to Marek VasutQuoted 21 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,
Quoted 8 lines
since the
Quoted 1 line
IPL and SPL share the task of loading the u-boot image. As a side
benefit,
Quoted 3 lines
the SPL driver is very small.
Signed-off-by Mike Dunn <[email protected]>Try #ifdef
U_BOOTinstead of #if 0, no?
Just remove the code that would be hidden by #if 0. Besides making the U-Boot code easier to read, we *want* to get a conflict marker if we try to merge in a new upstream version, and those lines were changed in Linux. This would give us an opportunity to see if similar changes are needed to the U-Boot version of the code.
Another option would be to introduce for_each_set_bit in U-Boot.
-Scott
PATCH 7/8 mtd: nand: add driver for diskonchip g4 nand flash
Quoted 20 lines · Scott Wood
Quoted 19 lines · Marek Vasut
Dear Mike Dunn,
Quoted 16 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.
Signed-off-by Mike Dunn <[email protected]>
Quoted 7 lines
Quoted 1 line
Try #ifdef
U_BOOTinstead of #if 0, no?Just remove the code that would be hidden by #if 0. Besides making the U-Boot code easier to read, we *want* to get a conflict marker if we try to merge in a new upstream version, and those lines were changed in Linux. This would give us an opportunity to see if similar changes are needed to the U-Boot version of the code.
OK.
Quoted 2 lines
Another option would be to introduce
for_each_set_bitin U-Boot.
This was my first inclination, but it looked like a lot of work across multiple architectures, so I let it go.
Thanks,
Mike
PATCH 8/8 board support for palm treo 680
In reply to Mike DunnA 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 | 47 +++ board/palmtreo680/flash_u-boot.c | 170 ++++++++++ board/palmtreo680/palmtreo680.c | 184 +++++++++++ board/palmtreo680/palmtreo680_spl.lds | 69 ++++ boards.cfg | 1 + doc/README.palmtreo680 | 570 +++++++++++++++++++++++++++++++++ include/configs/palmtreo680.h | 307 ++++++++++++++++++ 9 files changed, 1355 insertions(+), 0 deletions(-) create mode 100644 board/palmtreo680/Makefile create mode 100644 board/palmtreo680/flash_u-boot.c 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
CREDITS +4 -0
@@ -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
@@ -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 +47 -0
47 lines not on this page · raw message
board/palmtreo680/flash_u-boot.c new file +170 -0
170 lines not on this page · raw message
board/palmtreo680/palmtreo680.c new file +184 -0
184 lines not on this page · raw message
board/palmtreo680/palmtreo680_spl.lds new file +69 -0
69 lines not on this page · raw message
boards.cfg +1 -0
@@ -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 +307 -0
307 lines not on this page · raw message
Signature · 1 line
1.7.8.6
PATCH 8/8 board support for palm treo 680
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_environmentis 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 theCONFIG_EXTRA_ENV_SETTINGSoption 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.
Signed-off-by Mike Dunn <[email protected]>
I dunno about the userland too, it might go into tools/ and be unified to all DoCG4 devices. And also make sure to use #define[space] isntead of #define[tab] in the config file.