[U-Boot] [PATCH v2 0/9] Collected fixes and improvements

This series contains a hodge-podge of minor fixes and improvements in various areas. They were found while adjusting mainline Nyan-big to work with Chrome OS verified boot.
Rather than send a large number of individual patches I decide to collect them into a series. They should all be independent so can be applied without coordination.
Sample of areas covered: - Detect a USB device being connected/disconnected - TPM support with CONFIG_DM_I2C - Detect when U-Boot is started from SPL - ARM binary output and boot tweaks - Small LCD BMP-drawing improvement - Tegra removable MMC support - Various small nits in driver model, sandbox, etc.
Changes in v2: - Fix use of 'hub' instead of 'dev' in usb_detect_change() - Clarify that this commit provides only the API, not the implementation - Rename constant to UBOOT_NOT_LOADED_FROM_SPL - Add new patch to remove typedefs from bmp_layout.h - Rename constant to UBOOT_NOT_LOADED_FROM_SPL - Use tegra-pinmux-scripts to update the pinmux - Drop applied patches from the series
Simon Glass (9): dm: usb: Implement usb_detect_change() for driver model arm: spl: Add an API to detect when U-Boot is started from SPL arm: Allow cleanup_before_linux() without disabling caches sandbox: Add an implementation for cleanup_before_linux_select() Remove typedefs from bmp_layout.h lcd: Support colour lookup table on 16bpp display in BMP images tegra124: Implement spl_was_boot_source() tegra: nyan-big: Allow TPM on I2C tegra124: Expand SPL space by 8KB
arch/arm/cpu/armv7/cpu.c | 47 ++++++++++++++++---------- arch/arm/mach-tegra/board.c | 16 +++++++++ arch/sandbox/cpu/cpu.c | 5 +++ board/nvidia/nyan-big/pinmux-config-nyan-big.h | 8 ++--- common/cmd_bmp.c | 16 ++++----- common/lcd.c | 33 +++++++++++++----- drivers/usb/host/usb-uclass.c | 43 +++++++++++++++++++++++ drivers/video/atmel_lcdfb.c | 4 +-- drivers/video/bus_vcxk.c | 4 +-- drivers/video/cfb_console.c | 10 +++--- include/bmp_layout.h | 17 +++++----- include/common.h | 15 ++++++++ include/configs/tegra124-common.h | 2 +- include/spl.h | 13 +++++++ 14 files changed, 176 insertions(+), 57 deletions(-)

Support this function with driver model also (CONFIG_DM_USB).
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v2: - Fix use of 'hub' instead of 'dev' in usb_detect_change()
drivers/usb/host/usb-uclass.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)
diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c index 963464c..6e86f4a 100644 --- a/drivers/usb/host/usb-uclass.c +++ b/drivers/usb/host/usb-uclass.c @@ -628,6 +628,49 @@ int usb_scan_device(struct udevice *parent, int port, return 0; }
+/* + * Detect if a USB device has been plugged or unplugged. + */ +int usb_detect_change(void) +{ + struct udevice *hub; + struct uclass *uc; + int change = 0; + int ret; + + ret = uclass_get(UCLASS_USB_HUB, &uc); + if (ret) + return ret; + + uclass_foreach_dev(hub, uc) { + struct usb_device *udev; + struct udevice *dev; + + if (!device_active(hub)) + continue; + for (device_find_first_child(hub, &dev); + dev; + device_find_next_child(&dev)) { + struct usb_port_status status; + + if (!device_active(dev)) + continue; + + udev = dev_get_parentdata(dev); + if (usb_get_port_status(udev, udev->portnr, &status) + < 0) + /* USB request failed */ + continue; + + if (le16_to_cpu(status.wPortChange) & + USB_PORT_STAT_C_CONNECTION) + change++; + } + } + + return change; +} + int usb_child_post_bind(struct udevice *dev) { struct usb_dev_platdata *plat = dev_get_parent_platdata(dev);

On 13 May 2015 at 07:02, Simon Glass sjg@chromium.org wrote:
Support this function with driver model also (CONFIG_DM_USB).
Signed-off-by: Simon Glass sjg@chromium.org
Changes in v2:
- Fix use of 'hub' instead of 'dev' in usb_detect_change()
drivers/usb/host/usb-uclass.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)
Applied to u-boot-dm.

For secure boot systems it is common to have a read-only U-Boot which starts the machine and jumps to a read-write U-Boot for actual booting the OS. This allows the read-write U-Boot to be upgraded without risk of permanently bricking the machine. In the event that the read-write U-Boot is corrupted, the read-only U-Boot can detect this with a checksum and boot into a recovery flow.
To support this, add a way to detect when U-Boot is run from SPL as opposed to some other method, such as booted directly (no SPL) or started from another source (e.g. a primary U-Boot). This works by putting a special value in r0.
For now we rely on board-specific code to actually check the register and set a flag. At some point this could be generalised, perhaps by using a spare register and passing a flag to _main and/or board_init_f().
This commit does not implement any feature, but merely provides the API for boards to implement.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v2: - Clarify that this commit provides only the API, not the implementation - Rename constant to UBOOT_NOT_LOADED_FROM_SPL
include/spl.h | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/include/spl.h b/include/spl.h index b2e5bf7..d19940f 100644 --- a/include/spl.h +++ b/include/spl.h @@ -11,6 +11,8 @@ #include <linux/compiler.h> #include <asm/spl.h>
+/* Value in r0 indicates we booted from U-Boot */ +#define UBOOT_NOT_LOADED_FROM_SPL 0x13578642
/* Boot type */ #define MMCSD_MODE_UNDEFINED 0 @@ -82,4 +84,15 @@ int spl_load_image_ext_os(block_dev_desc_t *block_dev, int partition); #ifdef CONFIG_SPL_BOARD_INIT void spl_board_init(void); #endif + +/** + * spl_was_boot_source() - check if U-Boot booted from SPL + * + * This will normally be true, but if U-Boot jumps to second U-Boot, it will + * be false. This should be implemented by board-specific code. + * + * @return true if U-Boot booted from SPL, else false + */ +bool spl_was_boot_source(void); + #endif

On 13 May 2015 at 07:02, Simon Glass sjg@chromium.org wrote:
For secure boot systems it is common to have a read-only U-Boot which starts the machine and jumps to a read-write U-Boot for actual booting the OS. This allows the read-write U-Boot to be upgraded without risk of permanently bricking the machine. In the event that the read-write U-Boot is corrupted, the read-only U-Boot can detect this with a checksum and boot into a recovery flow.
To support this, add a way to detect when U-Boot is run from SPL as opposed to some other method, such as booted directly (no SPL) or started from another source (e.g. a primary U-Boot). This works by putting a special value in r0.
For now we rely on board-specific code to actually check the register and set a flag. At some point this could be generalised, perhaps by using a spare register and passing a flag to _main and/or board_init_f().
This commit does not implement any feature, but merely provides the API for boards to implement.
Signed-off-by: Simon Glass sjg@chromium.org
Changes in v2:
- Clarify that this commit provides only the API, not the implementation
- Rename constant to UBOOT_NOT_LOADED_FROM_SPL
include/spl.h | 13 +++++++++++++ 1 file changed, 13 insertions(+)
Applied to u-boot-dm.

This function is used before jumping to U-Boot, but in that case we don't always want to disable caches.
Signed-off-by: Simon Glass sjg@chromium.org Signed-off-by: Vadim Bendebury vbendeb@chromium.org ---
Changes in v2: None
arch/arm/cpu/armv7/cpu.c | 47 +++++++++++++++++++++++++++++------------------ include/common.h | 15 +++++++++++++++ 2 files changed, 44 insertions(+), 18 deletions(-)
diff --git a/arch/arm/cpu/armv7/cpu.c b/arch/arm/cpu/armv7/cpu.c index c56417d..0b0e500 100644 --- a/arch/arm/cpu/armv7/cpu.c +++ b/arch/arm/cpu/armv7/cpu.c @@ -24,7 +24,7 @@
void __weak cpu_cache_initialization(void){}
-int cleanup_before_linux(void) +int cleanup_before_linux_select(int flags) { /* * this function is called just before we call linux @@ -42,24 +42,30 @@ int cleanup_before_linux(void) icache_disable(); invalidate_icache_all();
- /* - * turn off D-cache - * dcache_disable() in turn flushes the d-cache and disables MMU - */ - dcache_disable(); - v7_outer_cache_disable(); + if (flags & CBL_DISABLE_CACHES) { + /* + * turn off D-cache + * dcache_disable() in turn flushes the d-cache and disables MMU + */ + dcache_disable(); + v7_outer_cache_disable();
- /* - * After D-cache is flushed and before it is disabled there may - * be some new valid entries brought into the cache. We are sure - * that these lines are not dirty and will not affect our execution. - * (because unwinding the call-stack and setting a bit in CP15 SCTLR - * is all we did during this. We have not pushed anything on to the - * stack. Neither have we affected any static data) - * So just invalidate the entire d-cache again to avoid coherency - * problems for kernel - */ - invalidate_dcache_all(); + /* + * After D-cache is flushed and before it is disabled there may + * be some new valid entries brought into the cache. We are + * sure that these lines are not dirty and will not affect our + * execution. (because unwinding the call-stack and setting a + * bit in CP15 SCTRL is all we did during this. We have not + * pushed anything on to the stack. Neither have we affected + * any static data) So just invalidate the entire d-cache again + * to avoid coherency problems for kernel + */ + invalidate_dcache_all(); + } else { + flush_dcache_all(); + invalidate_icache_all(); + icache_enable(); + }
/* * Some CPU need more cache attention before starting the kernel. @@ -68,3 +74,8 @@ int cleanup_before_linux(void)
return 0; } + +int cleanup_before_linux(void) +{ + return cleanup_before_linux_select(CBL_ALL); +} diff --git a/include/common.h b/include/common.h index d4d704a..1285f7d 100644 --- a/include/common.h +++ b/include/common.h @@ -714,6 +714,21 @@ void invalidate_dcache_range(unsigned long start, unsigned long stop); void invalidate_dcache_all(void); void invalidate_icache_all(void);
+enum { + /* Disable caches (else flush caches but leave them active) */ + CBL_DISABLE_CACHES = 1 << 0, + CBL_SHOW_BOOTSTAGE_REPORT = 1 << 1, + + CBL_ALL = 3, +}; + +/** + * Clean up ready for linux + * + * @param flags Flags to control what is done + */ +int cleanup_before_linux_select(int flags); + /* arch/$(ARCH)/lib/ticks.S */ uint64_t get_ticks(void); void wait_ticks (unsigned long);

On 13 May 2015 at 07:02, Simon Glass sjg@chromium.org wrote:
This function is used before jumping to U-Boot, but in that case we don't always want to disable caches.
Signed-off-by: Simon Glass sjg@chromium.org Signed-off-by: Vadim Bendebury vbendeb@chromium.org
Changes in v2: None
arch/arm/cpu/armv7/cpu.c | 47 +++++++++++++++++++++++++++++------------------ include/common.h | 15 +++++++++++++++ 2 files changed, 44 insertions(+), 18 deletions(-)
Applied to u-boot-dm.

Support this function so we can use Chrome OS verified boot with sandbox.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v2: None
arch/sandbox/cpu/cpu.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c index b6aae37..2c36f4b 100644 --- a/arch/sandbox/cpu/cpu.c +++ b/arch/sandbox/cpu/cpu.c @@ -50,6 +50,11 @@ int cleanup_before_linux(void) return 0; }
+int cleanup_before_linux_select(int flags) +{ + return 0; +} + void *map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags) { #ifdef CONFIG_PCI

On 13 May 2015 at 07:02, Simon Glass sjg@chromium.org wrote:
Support this function so we can use Chrome OS verified boot with sandbox.
Signed-off-by: Simon Glass sjg@chromium.org
Changes in v2: None
arch/sandbox/cpu/cpu.c | 5 +++++ 1 file changed, 5 insertions(+)
Applied to u-boot-dm.

We try to avoid typedefs and these ones are easy enough to remove. Before changing this header in the next patch, remove the typedefs.
Signed-off-by: Simon Glass sjg@chromium.org Suggested-by: Joe Hershberger joe.hershberger@gmail.com ---
Changes in v2: - Add new patch to remove typedefs from bmp_layout.h
common/cmd_bmp.c | 16 ++++++++-------- common/lcd.c | 10 +++++----- drivers/video/atmel_lcdfb.c | 4 ++-- drivers/video/bus_vcxk.c | 4 ++-- drivers/video/cfb_console.c | 10 +++++----- include/bmp_layout.h | 17 ++++++++--------- 6 files changed, 30 insertions(+), 31 deletions(-)
diff --git a/common/cmd_bmp.c b/common/cmd_bmp.c index cc904c2..cb1f071 100644 --- a/common/cmd_bmp.c +++ b/common/cmd_bmp.c @@ -34,12 +34,12 @@ static int bmp_info (ulong addr); * didn't contain a valid BMP signature. */ #ifdef CONFIG_VIDEO_BMP_GZIP -bmp_image_t *gunzip_bmp(unsigned long addr, unsigned long *lenp, - void **alloc_addr) +struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp, + void **alloc_addr) { void *dst; unsigned long len; - bmp_image_t *bmp; + struct bmp_image *bmp;
/* * Decompress bmp image @@ -55,7 +55,7 @@ bmp_image_t *gunzip_bmp(unsigned long addr, unsigned long *lenp, bmp = dst;
/* align to 32-bit-aligned-address + 2 */ - bmp = (bmp_image_t *)((((unsigned int)dst + 1) & ~3) + 2); + bmp = (struct bmp_image *)((((unsigned int)dst + 1) & ~3) + 2);
if (gunzip(bmp, CONFIG_SYS_VIDEO_LOGO_MAX_SIZE, (uchar *)addr, &len) != 0) { free(dst); @@ -80,8 +80,8 @@ bmp_image_t *gunzip_bmp(unsigned long addr, unsigned long *lenp, return bmp; } #else -bmp_image_t *gunzip_bmp(unsigned long addr, unsigned long *lenp, - void **alloc_addr) +struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp, + void **alloc_addr) { return NULL; } @@ -187,7 +187,7 @@ U_BOOT_CMD( */ static int bmp_info(ulong addr) { - bmp_image_t *bmp=(bmp_image_t *)addr; + struct bmp_image *bmp = (struct bmp_image *)addr; void *bmp_alloc_addr = NULL; unsigned long len;
@@ -224,7 +224,7 @@ static int bmp_info(ulong addr) int bmp_display(ulong addr, int x, int y) { int ret; - bmp_image_t *bmp = (bmp_image_t *)addr; + struct bmp_image *bmp = (struct bmp_image *)addr; void *bmp_alloc_addr = NULL; unsigned long len;
diff --git a/common/lcd.c b/common/lcd.c index 055c366..c7f2830 100644 --- a/common/lcd.c +++ b/common/lcd.c @@ -448,8 +448,8 @@ static void draw_encoded_bitmap(ushort **fbp, ushort c, int cnt) /* * Do not call this function directly, must be called from lcd_display_bitmap. */ -static void lcd_display_rle8_bitmap(bmp_image_t *bmp, ushort *cmap, uchar *fb, - int x_off, int y_off) +static void lcd_display_rle8_bitmap(struct bmp_image *bmp, ushort *cmap, + uchar *fb, int x_off, int y_off) { uchar *bmap; ulong width, height; @@ -548,10 +548,10 @@ __weak void fb_put_word(uchar **fb, uchar **from) } #endif /* CONFIG_BMP_16BPP */
-__weak void lcd_set_cmap(bmp_image_t *bmp, unsigned colors) +__weak void lcd_set_cmap(struct bmp_image *bmp, unsigned colors) { int i; - bmp_color_table_entry_t cte; + struct bmp_color_table_entry cte; ushort *cmap = configuration_get_cmap();
for (i = 0; i < colors; ++i) { @@ -572,7 +572,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y) ushort *cmap_base = NULL; ushort i, j; uchar *fb; - bmp_image_t *bmp = (bmp_image_t *)map_sysmem(bmp_image, 0); + struct bmp_image *bmp = (struct bmp_image *)map_sysmem(bmp_image, 0); uchar *bmap; ushort padded_width; unsigned long width, height, byte_width; diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c index 4ed3a49..d43d8a5 100644 --- a/drivers/video/atmel_lcdfb.c +++ b/drivers/video/atmel_lcdfb.c @@ -81,12 +81,12 @@ void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue) #endif }
-void lcd_set_cmap(bmp_image_t *bmp, unsigned colors) +void lcd_set_cmap(struct bmp_image *bmp, unsigned colors) { int i;
for (i = 0; i < colors; ++i) { - bmp_color_table_entry_t cte = bmp->color_table[i]; + struct bmp_color_table_entry cte = bmp->color_table[i]; lcd_setcolreg(i, cte.red, cte.green, cte.blue); } } diff --git a/drivers/video/bus_vcxk.c b/drivers/video/bus_vcxk.c index 60a5cc5..2f54d3d 100644 --- a/drivers/video/bus_vcxk.c +++ b/drivers/video/bus_vcxk.c @@ -358,7 +358,7 @@ void vcxk_draw_mono(unsigned char *dataptr, unsigned long linewidth,
int vcxk_display_bitmap(ulong addr, int x, int y) { - bmp_image_t *bmp; + struct bmp_image *bmp; unsigned long width; unsigned long height; unsigned long bpp; @@ -369,7 +369,7 @@ int vcxk_display_bitmap(ulong addr, int x, int y) unsigned long c_height; unsigned char *dataptr;
- bmp = (bmp_image_t *) addr; + bmp = (struct bmp_image *)addr; if ((bmp->header.signature[0] == 'B') && (bmp->header.signature[1] == 'M')) { width = le32_to_cpu(bmp->header.width); diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index f4231b8..7f2ddc1 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -1295,7 +1295,7 @@ static void draw_bitmap(uchar **fb, uchar *bm, struct palette *p, *fb = (uchar *) addr; /* return modified address */ }
-static int display_rle8_bitmap(bmp_image_t *img, int xoff, int yoff, +static int display_rle8_bitmap(struct bmp_image *img, int xoff, int yoff, int width, int height) { unsigned char *bm; @@ -1304,7 +1304,7 @@ static int display_rle8_bitmap(bmp_image_t *img, int xoff, int yoff, int decode = 1; int x, y, bpp, i, ncolors; struct palette p[256]; - bmp_color_table_entry_t cte; + struct bmp_color_table_entry cte; int green_shift, red_off; int limit = VIDEO_COLS * VIDEO_ROWS; int pixels = 0; @@ -1447,13 +1447,13 @@ int video_display_bitmap(ulong bmp_image, int x, int y) { ushort xcount, ycount; uchar *fb; - bmp_image_t *bmp = (bmp_image_t *) bmp_image; + struct bmp_image *bmp = (struct bmp_image *)bmp_image; uchar *bmap; ushort padded_line; unsigned long width, height, bpp; unsigned colors; unsigned long compression; - bmp_color_table_entry_t cte; + struct bmp_color_table_entry cte;
#ifdef CONFIG_VIDEO_BMP_GZIP unsigned char *dst = NULL; @@ -1495,7 +1495,7 @@ int video_display_bitmap(ulong bmp_image, int x, int y) /* * Set addr to decompressed image */ - bmp = (bmp_image_t *)(dst+2); + bmp = (struct bmp_image *)(dst+2);
if (!((bmp->header.signature[0] == 'B') && (bmp->header.signature[1] == 'M'))) { diff --git a/include/bmp_layout.h b/include/bmp_layout.h index 22b1fbc..55db8b8 100644 --- a/include/bmp_layout.h +++ b/include/bmp_layout.h @@ -11,17 +11,17 @@ #ifndef _BMP_H_ #define _BMP_H_
-typedef struct bmp_color_table_entry { +struct __packed bmp_color_table_entry { __u8 blue; __u8 green; __u8 red; __u8 reserved; -} __attribute__ ((packed)) bmp_color_table_entry_t; +};
/* When accessing these fields, remember that they are stored in little endian format, so use linux macros, e.g. le32_to_cpu(width) */
-typedef struct bmp_header { +struct __packed bmp_header { /* Header */ char signature[2]; __u32 file_size; @@ -40,15 +40,14 @@ typedef struct bmp_header { __u32 colors_used; __u32 colors_important; /* ColorTable */ +};
-} __attribute__ ((packed)) bmp_header_t; - -typedef struct bmp_image { - bmp_header_t header; +struct bmp_image { + struct bmp_header header; /* We use a zero sized array just as a placeholder for variable sized array */ - bmp_color_table_entry_t color_table[0]; -} bmp_image_t; + struct bmp_color_table_entry color_table[0]; +};
/* Data in the bmp_image is aligned to this length */ #define BMP_DATA_ALIGN 4

Hi Simon,
On Wed, May 13, 2015 at 8:02 AM, Simon Glass sjg@chromium.org wrote:
We try to avoid typedefs and these ones are easy enough to remove. Before changing this header in the next patch, remove the typedefs.
Signed-off-by: Simon Glass sjg@chromium.org Suggested-by: Joe Hershberger joe.hershberger@gmail.com
Acked-by: Joe Hershberger joe.hershberger@ni.com
Thanks, -Joe

On 13 May 2015 at 09:38, Joe Hershberger joe.hershberger@gmail.com wrote:
Hi Simon,
On Wed, May 13, 2015 at 8:02 AM, Simon Glass sjg@chromium.org wrote:
We try to avoid typedefs and these ones are easy enough to remove. Before changing this header in the next patch, remove the typedefs.
Signed-off-by: Simon Glass sjg@chromium.org Suggested-by: Joe Hershberger joe.hershberger@gmail.com
Acked-by: Joe Hershberger joe.hershberger@ni.com
Thanks, -Joe
Applied to u-boot-dm.

For 16-bit-per-pixel displays it is useful to support 8 bit-per-pixel images to reduce image size. Add support for this when drawing BMP images.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v2: None
common/lcd.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/common/lcd.c b/common/lcd.c index c7f2830..5a52fe4 100644 --- a/common/lcd.c +++ b/common/lcd.c @@ -578,6 +578,8 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y) unsigned long width, height, byte_width; unsigned long pwidth = panel_info.vl_col; unsigned colors, bpix, bmp_bpix; + int hdr_size; + struct bmp_color_table_entry *palette = bmp->color_table;
if (!bmp || !(bmp->header.signature[0] == 'B' && bmp->header.signature[1] == 'M')) { @@ -589,6 +591,8 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y) width = get_unaligned_le32(&bmp->header.width); height = get_unaligned_le32(&bmp->header.height); bmp_bpix = get_unaligned_le16(&bmp->header.bit_count); + hdr_size = get_unaligned_le16(&bmp->header.size); + debug("hdr_size=%d, bmp_bpix=%d\n", hdr_size, bmp_bpix);
colors = 1 << bmp_bpix;
@@ -613,8 +617,8 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y) return 1; }
- debug("Display-bmp: %d x %d with %d colors\n", - (int)width, (int)height, (int)colors); + debug("Display-bmp: %d x %d with %d colors, display %d\n", + (int)width, (int)height, (int)colors, 1 << bpix);
if (bmp_bpix == 8) lcd_set_cmap(bmp, colors); @@ -641,6 +645,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y) cmap_base = configuration_get_cmap(); #ifdef CONFIG_LCD_BMP_RLE8 u32 compression = get_unaligned_le32(&bmp->header.compression); + debug("compressed %d %d\n", compression, BMP_BI_RLE8); if (compression == BMP_BI_RLE8) { if (bpix != 16) { /* TODO implement render code for bpix != 16 */ @@ -663,7 +668,19 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y) if (bpix != 16) { fb_put_byte(&fb, &bmap); } else { - *(uint16_t *)fb = cmap_base[*(bmap++)]; + struct bmp_color_table_entry *entry; + uint val; + + if (cmap_base) { + val = cmap_base[*bmap]; + } else { + entry = &palette[*bmap]; + val = entry->blue >> 3 | + entry->green >> 2 << 5 | + entry->red >> 3 << 11; + } + *(uint16_t *)fb = val; + bmap++; fb += sizeof(uint16_t) / sizeof(*fb); } }

On 13 May 2015 at 07:02, Simon Glass sjg@chromium.org wrote:
For 16-bit-per-pixel displays it is useful to support 8 bit-per-pixel images to reduce image size. Add support for this when drawing BMP images.
Signed-off-by: Simon Glass sjg@chromium.org
Changes in v2: None
common/lcd.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-)
Applied to u-boot-dm.

Add an implementation of this function for Tegra.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v2: - Rename constant to UBOOT_NOT_LOADED_FROM_SPL
arch/arm/mach-tegra/board.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
diff --git a/arch/arm/mach-tegra/board.c b/arch/arm/mach-tegra/board.c index 222de6a..a880a87 100644 --- a/arch/arm/mach-tegra/board.c +++ b/arch/arm/mach-tegra/board.c @@ -6,6 +6,7 @@ */
#include <common.h> +#include <spl.h> #include <asm/io.h> #include <asm/arch/clock.h> #include <asm/arch/funcmux.h> @@ -29,6 +30,21 @@ enum { UART_COUNT = 5, };
+static bool from_spl __attribute__ ((section(".data"))); + +#ifndef CONFIG_SPL_BUILD +void save_boot_params(u32 r0, u32 r1, u32 r2, u32 r3) +{ + from_spl = r0 != UBOOT_NOT_LOADED_FROM_SPL; + save_boot_params_ret(); +} +#endif + +bool spl_was_boot_source(void) +{ + return from_spl; +} + #if defined(CONFIG_TEGRA_SUPPORT_NON_SECURE) #if !defined(CONFIG_TEGRA124) #error tegra_cpu_is_non_secure has only been validated on Tegra124

Enable the I2C3 pins so that the TPM can be used.
Note: There is an DP change also, caused by running board-to-uboot.py script in the latest tegra-pinmux-script tree.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v2: - Use tegra-pinmux-scripts to update the pinmux
board/nvidia/nyan-big/pinmux-config-nyan-big.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/board/nvidia/nyan-big/pinmux-config-nyan-big.h b/board/nvidia/nyan-big/pinmux-config-nyan-big.h index 9c5fbaa..9c838ba 100644 --- a/board/nvidia/nyan-big/pinmux-config-nyan-big.h +++ b/board/nvidia/nyan-big/pinmux-config-nyan-big.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved. * * SPDX-License-Identifier: GPL-2.0+ */ @@ -234,8 +234,8 @@ static const struct pmux_pingrp_config nyan_big_pingrps[] = { PINCFG(SDMMC4_DAT6_PAA6, SDMMC4, UP, NORMAL, INPUT, DEFAULT, DEFAULT), PINCFG(SDMMC4_DAT7_PAA7, SDMMC4, UP, NORMAL, INPUT, DEFAULT, DEFAULT), PINCFG(PBB0, VGP6, DOWN, TRISTATE, OUTPUT, DEFAULT, DEFAULT), - PINCFG(CAM_I2C_SCL_PBB1, RSVD3, DOWN, TRISTATE, OUTPUT, DISABLE, DEFAULT), - PINCFG(CAM_I2C_SDA_PBB2, RSVD3, DOWN, TRISTATE, OUTPUT, DISABLE, DEFAULT), + PINCFG(CAM_I2C_SCL_PBB1, I2C3, NORMAL, NORMAL, INPUT, ENABLE, DEFAULT), + PINCFG(CAM_I2C_SDA_PBB2, I2C3, NORMAL, NORMAL, INPUT, ENABLE, DEFAULT), PINCFG(PBB3, VGP3, DOWN, TRISTATE, OUTPUT, DEFAULT, DEFAULT), PINCFG(PBB4, VGP4, DOWN, TRISTATE, OUTPUT, DEFAULT, DEFAULT), PINCFG(PBB5, RSVD3, DOWN, TRISTATE, OUTPUT, DEFAULT, DEFAULT), @@ -257,7 +257,7 @@ static const struct pmux_pingrp_config nyan_big_pingrps[] = { PINCFG(HDMI_CEC_PEE3, CEC, NORMAL, NORMAL, INPUT, ENABLE, DEFAULT), PINCFG(SDMMC3_CLK_LB_OUT_PEE4, SDMMC3, NORMAL, NORMAL, OUTPUT, DEFAULT, DEFAULT), PINCFG(SDMMC3_CLK_LB_IN_PEE5, SDMMC3, UP, NORMAL, INPUT, DEFAULT, DEFAULT), - PINCFG(DP_HPD_PFF0, DP, UP, NORMAL, INPUT, DEFAULT, DEFAULT), + PINCFG(DP_HPD_PFF0, DP, NORMAL, NORMAL, INPUT, DEFAULT, DEFAULT), PINCFG(USB_VBUS_EN2_PFF1, RSVD2, DOWN, TRISTATE, OUTPUT, DISABLE, DEFAULT), PINCFG(PFF2, RSVD2, DOWN, TRISTATE, OUTPUT, DISABLE, DEFAULT), PINCFG(CORE_PWR_REQ, PWRON, NORMAL, NORMAL, OUTPUT, DEFAULT, DEFAULT),

On 05/13/2015 07:02 AM, Simon Glass wrote:
Enable the I2C3 pins so that the TPM can be used.
Note: There is an DP change also, caused by running board-to-uboot.py script in the latest tegra-pinmux-script tree.
I didn't get the patch for tegra-pinmux-scripts. What was the send time/date and patch title?

Hi Stephen,
On 13 May 2015 at 07:53, Stephen Warren swarren@wwwdotorg.org wrote:
On 05/13/2015 07:02 AM, Simon Glass wrote:
Enable the I2C3 pins so that the TPM can be used.
Note: There is an DP change also, caused by running board-to-uboot.py script in the latest tegra-pinmux-script tree.
I didn't get the patch for tegra-pinmux-scripts. What was the send time/date and patch title?
It will be in the future :-) I need to transfer it via github as I don't have a proper git mirror in-house.
Regards, Simon

On 05/13/2015 07:57 AM, Simon Glass wrote:
Hi Stephen,
On 13 May 2015 at 07:53, Stephen Warren swarren@wwwdotorg.org wrote:
On 05/13/2015 07:02 AM, Simon Glass wrote:
Enable the I2C3 pins so that the TPM can be used.
Note: There is an DP change also, caused by running board-to-uboot.py script in the latest tegra-pinmux-script tree.
This also means that the version that got checked into U-Boot wasn't generated from the config file that first got checked into tegra-pinmux-scripts:-( Tomeu made this DP change when he submitted support to tegra-pinmux-scripts. We should make sure that boards are added to tegra-pinmux-scripts before sending U-Boot/kernel patches for a board to avoid this.
I didn't get the patch for tegra-pinmux-scripts. What was the send time/date and patch title?
It will be in the future :-) I need to transfer it via github as I don't have a proper git mirror in-house.
Ah, I should have looked at the email time; I didn't notice it'd only just arrived.
Assuming there are no objections to the tegra-pinmux-scripts patch and I apply it on Friday as I expect, then this patch looks fine too.
Acked-by: Stephen Warren swarren@nvidia.com

Hi Tom,
On 13 May 2015 at 08:33, Stephen Warren swarren@wwwdotorg.org wrote:
On 05/13/2015 07:57 AM, Simon Glass wrote:
Hi Stephen,
On 13 May 2015 at 07:53, Stephen Warren swarren@wwwdotorg.org wrote:
On 05/13/2015 07:02 AM, Simon Glass wrote:
Enable the I2C3 pins so that the TPM can be used.
Note: There is an DP change also, caused by running board-to-uboot.py script in the latest tegra-pinmux-script tree.
This also means that the version that got checked into U-Boot wasn't generated from the config file that first got checked into tegra-pinmux-scripts:-( Tomeu made this DP change when he submitted support to tegra-pinmux-scripts. We should make sure that boards are added to tegra-pinmux-scripts before sending U-Boot/kernel patches for a board to avoid this.
I didn't get the patch for tegra-pinmux-scripts. What was the send time/date and patch title?
It will be in the future :-) I need to transfer it via github as I don't have a proper git mirror in-house.
Ah, I should have looked at the email time; I didn't notice it'd only just arrived.
Assuming there are no objections to the tegra-pinmux-scripts patch and I apply it on Friday as I expect, then this patch looks fine too.
Acked-by: Stephen Warren swarren@nvidia.com
I think three patches got missed, including this one:
http://patchwork.ozlabs.org/patch/471865/ http://patchwork.ozlabs.org/patch/471871/ http://patchwork.ozlabs.org/patch/471869/
Can you please take a look?
Regards, Simon

We are getting very close to running out of space in SPL, and with the currently Chrome OS gcc 4.9 we exceed the limit. Add a litle more space.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v2: - Drop applied patches from the series
include/configs/tegra124-common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/configs/tegra124-common.h b/include/configs/tegra124-common.h index f2b3774..0347132 100644 --- a/include/configs/tegra124-common.h +++ b/include/configs/tegra124-common.h @@ -30,7 +30,7 @@ /*----------------------------------------------------------------------- * Physical Memory Map */ -#define CONFIG_SYS_TEXT_BASE 0x8010E000 +#define CONFIG_SYS_TEXT_BASE 0x80110000
/* * Memory layout for where various images get loaded by boot scripts:
participants (3)
-
Joe Hershberger
-
Simon Glass
-
Stephen Warren