Skip to contentSkip to conversation

Various fixes and improvements

PATCH Superseded Simon Glass 7 participants 106 messages Oct 1, 2018 – Oct 22, 2018

Subsystems (15)
x86 Block layer Kbuild PCI +11 more subsystems

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Various fixes and improvements

This series collects together a large number of small patches that I have been fiddling with for a while. At lot of them relate to SPL and TPL and updating Chromium OS verified boot to work on U-Boot.

Simon Glass (45):
dm: core: Alloc uclass-private data to be cache-aligned
dm: core: Update some functions to use const
dm: core: Add a function to find the first inactive child
dm: core: Update ofnode to read binman-style flash entry
sf: Avoid allocating memory on every read operation
spl: input: Allow input in SPL and TPL
Makefile: Add a warning if SPL/TPL cannot be built
spl: misc: Allow misc drivers in SPL and TPL
blk: Support block drivers in TPL
Kconfig: Convert CONFIG_RTC_MC146818 to Kconfig
rtc: Allow use of RTC in SPL and TPL
fdt: Document the fact that dtc is now built
doc: Update docs for device tree in SPL, TPL
fdt: Allow indicating a node is for U-Boot proper only
tpm: Add support for SPL and TPL
serial: Allow serial to be absent in TPL
fdt: Allow libfdt in TPL
cros: Update cros_ec code to use struct udevice
cros: Adjust board_get_cros_ec_dev() to return a udevice
dm: spi: Add logging of some return values
fdt: Remove fdtdec_decode_region() function
video: Adjust video_clear() to return an error
tpm: Use livetree and allow children
tpm: Tidy up logging in tpm-common.c
tpm: Add a few new commands for v1
binman: Move to three-digit test-file numbers
binman: Add a test for Intel reference code
log: Add comments to the rest of the log categories
malloc_simple: Add logging of allocations
Add a header file for strings
Rename GPT_HEADER_SIGNATURE to avoid conflict
cros: Update ec_commands to latest version
x86: Update mtrr functions to allow leaving cache alone
cros_ec: Update cros_ec_read_hash() to specify the image
cros_ec: Add support for v3 messages on LPC
test: panel: Add a test for the panel uclass
panel: Expand the backlight support
ctags: Minor changes to fix ctags output
fdt: Allow C++ comments in link scripts and DT files
pci: Add a little more debugging to pci_rom
sysreset: Tidy up a few comments and logging
sysreset: Add a way to find the last reset
video: at91: Adjust vidconsole_position_cursor() to use char pos
video: Tidy up a few comments in video.o
dtoc: Fix the value of SetInt()

 Makefile                                      |    2 +-
 arch/sandbox/dts/sandbox.dts                  |   20 +-
 arch/sandbox/dts/sandbox64.dts                |   20 +-
 arch/sandbox/dts/sandbox_pmic.dtsi            |    2 +-
 arch/sandbox/dts/test.dts                     |   20 +-
 arch/sandbox/include/asm/test.h               |   15 +
 arch/x86/cpu/mtrr.c                           |   31 +-
 arch/x86/include/asm/mtrr.h                   |    6 +-
 board/atmel/common/video_display.c            |    5 +-
 cmd/cros_ec.c                                 |   31 +-
 cmd/tpm_test.c                                |   15 -
 cmd/x86/mtrr.c                                |    8 +-
 common/cros_ec.c                              |    4 +-
 common/malloc_simple.c                        |   58 +-
 configs/edison_defconfig                      |    1 +
 configs/malta_defconfig                       |    1 +
 disk/part_efi.c                               |    6 +-
 doc/README.fdt-control                        |   16 +-
 doc/driver-model/README.txt                   |    7 +-
 drivers/block/Kconfig                         |   12 +
 drivers/block/Makefile                        |    2 +-
 drivers/core/device.c                         |   45 +-
 drivers/core/of_extra.c                       |   27 +-
 drivers/core/ofnode.c                         |    2 +
 drivers/input/Kconfig                         |   48 +
 drivers/input/Makefile                        |   11 +-
 drivers/input/input.c                         |    5 +-
 drivers/misc/Kconfig                          |   72 +
 drivers/misc/Makefile                         |    9 +-
 drivers/misc/cros_ec.c                        |  178 +-
 drivers/misc/cros_ec_lpc.c                    |   33 +
 drivers/misc/cros_ec_sandbox.c                |    8 +-
 drivers/mtd/spi/sf-uclass.c                   |    6 +-
 drivers/mtd/spi/sf_probe.c                    |    2 +-
 drivers/mtd/spi/spi_flash.c                   |   17 +-
 drivers/pci/pci_rom.c                         |    4 +-
 drivers/pwm/sandbox_pwm.c                     |   25 +
 drivers/rtc/Kconfig                           |   26 +
 drivers/rtc/Makefile                          |    2 +-
 drivers/rtc/rtc-uclass.c                      |    1 +
 drivers/serial/Kconfig                        |   10 +
 drivers/serial/serial-uclass.c                |    4 +
 drivers/spi/spi-uclass.c                      |    6 +-
 drivers/sysreset/sysreset-uclass.c            |   34 +-
 drivers/sysreset/sysreset_sandbox.c           |   12 +
 drivers/tpm/Makefile                          |    2 +-
 drivers/tpm/tpm-uclass.c                      |    7 +-
 drivers/tpm/tpm_tis_lpc.c                     |    2 +-
 drivers/video/backlight-uclass.c              |   10 +
 drivers/video/panel-uclass.c                  |   18 +
 drivers/video/pwm_backlight.c                 |  186 +-
 drivers/video/simple_panel.c                  |   20 +-
 drivers/video/tegra124/sor.c                  |    3 +-
 drivers/video/vidconsole-uclass.c             |    2 +
 drivers/video/video-uclass.c                  |    4 +-
 include/backlight.h                           |   25 +
 include/configs/edison.h                      |    1 -
 include/configs/malta.h                       |    1 -
 include/cros_ec.h                             |   72 +-
 include/dm/device.h                           |   39 +-
 include/dm/of_extra.h                         |    3 +-
 include/dm/uclass.h                           |    3 +
 include/ec_commands.h                         | 4324 ++++++++++++++---
 include/fdtdec.h                              |   45 -
 include/linux/compiler-gcc.h                  |    6 +-
 include/log.h                                 |   12 +-
 include/malloc.h                              |    1 +
 include/panel.h                               |   22 +-
 include/part_efi.h                            |    2 +-
 include/string.h                              |    1 +
 include/sysreset.h                            |   34 +-
 include/tpm-v1.h                              |   28 +
 include/video.h                               |    7 +-
 lib/Kconfig                                   |   32 +
 lib/Makefile                                  |   10 +-
 lib/fdtdec.c                                  |   83 -
 lib/hang.c                                    |    5 +-
 lib/tpm-common.c                              |   10 +-
 lib/tpm-v1.c                                  |   68 +-
 scripts/Makefile.spl                          |    9 +-
 scripts/config_whitelist.txt                  |    1 -
 test/dm/Makefile                              |    1 +
 test/dm/core.c                                |   31 +
 test/dm/ofnode.c                              |   16 +
 test/dm/panel.c                               |   79 +
 test/dm/sysreset.c                            |   20 +-
 tools/binman/entry_test.py                    |    2 +-
 tools/binman/fdt_test.py                      |    4 +-
 tools/binman/ftest.py                         |  231 +-
 .../test/{01_invalid.dts => 001_invalid.dts}  |    0
 ..._missing_node.dts => 002_missing_node.dts} |    0
 .../test/{03_empty.dts => 003_empty.dts}      |    0
 ...nvalid_entry.dts => 004_invalid_entry.dts} |    0
 .../test/{05_simple.dts => 005_simple.dts}    |    0
 .../{06_dual_image.dts => 006_dual_image.dts} |    0
 .../{07_bad_align.dts => 007_bad_align.dts}   |    0
 .../binman/test/{08_pack.dts => 008_pack.dts} |    0
 .../{09_pack_extra.dts => 009_pack_extra.dts} |    0
 ...n_power2.dts => 010_pack_align_power2.dts} |    0
 ...er2.dts => 011_pack_align_size_power2.dts} |    0
 ...k_inv_align.dts => 012_pack_inv_align.dts} |    0
 ..._align.dts => 013_pack_inv_size_align.dts} |    0
 ..._pack_overlap.dts => 014_pack_overlap.dts} |    0
 ...ack_overflow.dts => 015_pack_overflow.dts} |    0
 ...erflow.dts => 016_pack_image_overflow.dts} |    0
 ...image_size.dts => 017_pack_image_size.dts} |    0
 ...age_align.dts => 018_pack_image_align.dts} |    0
 ...align.dts => 019_pack_inv_image_align.dts} |    0
 ...ts => 020_pack_inv_image_align_power2.dts} |    0
 .../{21_image_pad.dts => 021_image_pad.dts}   |    0
 .../{22_image_name.dts => 022_image_name.dts} |    0
 .../binman/test/{23_blob.dts => 023_blob.dts} |    0
 .../test/{24_sorted.dts => 024_sorted.dts}    |    0
 ...k_zero_size.dts => 025_pack_zero_size.dts} |    0
 ...u_boot_dtb.dts => 026_pack_u_boot_dtb.dts} |    0
 ...b_no_size.dts => 027_pack_4gb_no_size.dts} |    0
 ...b_outside.dts => 028_pack_4gb_outside.dts} |    0
 .../test/{29_x86-rom.dts => 029_x86-rom.dts}  |    0
 ...no-desc.dts => 030_x86-rom-me-no-desc.dts} |    0
 .../{31_x86-rom-me.dts => 031_x86-rom-me.dts} |    0
 .../{32_intel-vga.dts => 032_intel-vga.dts}   |    0
 ...33_x86-start16.dts => 033_x86-start16.dts} |    0
 .../{34_x86_ucode.dts => 034_x86_ucode.dts}   |    0
 ...gle_ucode.dts => 035_x86_single_ucode.dts} |    0
 .../{36_u_boot_img.dts => 036_u_boot_img.dts} |    0
 ..._x86_no_ucode.dts => 037_x86_no_ucode.dts} |    0
 ...ode.dts => 038_x86_ucode_missing_node.dts} |    0
 ...e2.dts => 039_x86_ucode_missing_node2.dts} |    0
 ...age.dts => 040_x86_ucode_not_in_image.dts} |    0
 ..._pos_size.dts => 041_unknown_pos_size.dts} |    0
 .../{42_intel-fsp.dts => 042_intel-fsp.dts}   |    0
 .../{43_intel-cmc.dts => 043_intel-cmc.dts}   |    0
 ...l_ucode.dts => 044_x86_optional_ucode.dts} |    0
 .../{45_prop_test.dts => 045_prop_test.dts}   |    0
 .../{46_intel-vbt.dts => 046_intel-vbt.dts}   |    0
 ...47_spl_bss_pad.dts => 047_spl_bss_pad.dts} |    0
 ...tart16-spl.dts => 048_x86-start16-spl.dts} |    0
 ...86_ucode_spl.dts => 049_x86_ucode_spl.dts} |    0
 .../{50_intel_mrc.dts => 050_intel_mrc.dts}   |    0
 ...oot_spl_dtb.dts => 051_u_boot_spl_dtb.dts} |    0
 ...spl_nodtb.dts => 052_u_boot_spl_nodtb.dts} |    0
 .../test/{53_symbols.dts => 053_symbols.dts}  |    0
 ..._unit_address.dts => 054_unit_address.dts} |    0
 .../{55_sections.dts => 055_sections.dts}     |    0
 ...56_name_prefix.dts => 056_name_prefix.dts} |    0
 ..._contents.dts => 057_unknown_contents.dts} |    0
 ....dts => 058_x86_ucode_spl_needs_retry.dts} |    0
 ...59_change_size.dts => 059_change_size.dts} |    0
 .../{60_fdt_update.dts => 060_fdt_update.dts} |    0
 ..._update_bad.dts => 061_fdt_update_bad.dts} |    0
 .../{62_entry_args.dts => 062_entry_args.dts} |    0
 ...missing.dts => 063_entry_args_missing.dts} |    0
 ...quired.dts => 064_entry_args_required.dts} |    0
 ...ts => 065_entry_args_unknown_datatype.dts} |    0
 .../binman/test/{66_text.dts => 066_text.dts} |    0
 .../binman/test/{67_fmap.dts => 067_fmap.dts} |    0
 ...d_by_arg.dts => 068_blob_named_by_arg.dts} |    0
 .../binman/test/{69_fill.dts => 069_fill.dts} |    0
 ..._fill_no_size.dts => 070_fill_no_size.dts} |    0
 tools/binman/test/{71_gbb.dts => 071_gbb.dts} |    0
 ...bb_too_small.dts => 072_gbb_too_small.dts} |    0
 ...73_gbb_no_size.dts => 073_gbb_no_size.dts} |    0
 .../test/{74_vblock.dts => 074_vblock.dts}    |    0
 ..._content.dts => 075_vblock_no_content.dts} |    0
 ...phandle.dts => 076_vblock_bad_phandle.dts} |    0
 ...bad_entry.dts => 077_vblock_bad_entry.dts} |    0
 .../{78_u_boot_tpl.dts => 078_u_boot_tpl.dts} |    0
 .../{79_uses_pos.dts => 079_uses_pos.dts}     |    0
 .../{80_fill_empty.dts => 080_fill_empty.dts} |    0
 ...tart16-tpl.dts => 081_x86-start16-tpl.dts} |    0
 ..._update_all.dts => 082_fdt_update_all.dts} |    0
 .../{83_compress.dts => 083_compress.dts}     |    0
 .../test/{84_files.dts => 084_files.dts}      |    0
 ...es_compress.dts => 085_files_compress.dts} |    0
 .../{86_files_none.dts => 086_files_none.dts} |    0
 ...o_pattern.dts => 087_files_no_pattern.dts} |    0
 ...88_expand_size.dts => 088_expand_size.dts} |    0
 ...d_size_bad.dts => 089_expand_size_bad.dts} |    0
 .../binman/test/{90_hash.dts => 090_hash.dts} |    0
 ..._hash_no_algo.dts => 091_hash_no_algo.dts} |    0
 ...ash_bad_algo.dts => 092_hash_bad_algo.dts} |    0
 ...86_tpl_ucode.dts => 093_x86_tpl_ucode.dts} |    0
 .../{94_fmap_x86.dts => 094_fmap_x86.dts}     |    0
 ...6_section.dts => 095_fmap_x86_section.dts} |    0
 tools/binman/test/{96_elf.dts => 096_elf.dts} |    0
 .../{97_elf_strip.dts => 097_elf_strip.dts}   |    0
 ..._hash_section.dts => 099_hash_section.dts} |    0
 tools/binman/test/100_intel_refcode.dts       |   14 +
 tools/dtoc/fdt.py                             |    2 +-
 189 files changed, 5038 insertions(+), 1329 deletions(-)
 create mode 100644 include/string.h
 create mode 100644 test/dm/panel.c
 rename tools/binman/test/{01_invalid.dts => 001_invalid.dts} (100%)
 rename tools/binman/test/{02_missing_node.dts => 002_missing_node.dts} (100%)
 rename tools/binman/test/{03_empty.dts => 003_empty.dts} (100%)
 rename tools/binman/test/{04_invalid_entry.dts => 004_invalid_entry.dts} (100%)
 rename tools/binman/test/{05_simple.dts => 005_simple.dts} (100%)
 rename tools/binman/test/{06_dual_image.dts => 006_dual_image.dts} (100%)
 rename tools/binman/test/{07_bad_align.dts => 007_bad_align.dts} (100%)
 rename tools/binman/test/{08_pack.dts => 008_pack.dts} (100%)
 rename tools/binman/test/{09_pack_extra.dts => 009_pack_extra.dts} (100%)
 rename tools/binman/test/{10_pack_align_power2.dts => 010_pack_align_power2.dts} (100%)
 rename tools/binman/test/{11_pack_align_size_power2.dts => 011_pack_align_size_power2.dts} (100%)
 rename tools/binman/test/{12_pack_inv_align.dts => 012_pack_inv_align.dts} (100%)
 rename tools/binman/test/{13_pack_inv_size_align.dts => 013_pack_inv_size_align.dts} (100%)
 rename tools/binman/test/{14_pack_overlap.dts => 014_pack_overlap.dts} (100%)
 rename tools/binman/test/{15_pack_overflow.dts => 015_pack_overflow.dts} (100%)
 rename tools/binman/test/{16_pack_image_overflow.dts => 016_pack_image_overflow.dts} (100%)
 rename tools/binman/test/{17_pack_image_size.dts => 017_pack_image_size.dts} (100%)
 rename tools/binman/test/{18_pack_image_align.dts => 018_pack_image_align.dts} (100%)
 rename tools/binman/test/{19_pack_inv_image_align.dts => 019_pack_inv_image_align.dts} (100%)
 rename tools/binman/test/{20_pack_inv_image_align_power2.dts => 020_pack_inv_image_align_power2.dts} (100%)
 rename tools/binman/test/{21_image_pad.dts => 021_image_pad.dts} (100%)
 rename tools/binman/test/{22_image_name.dts => 022_image_name.dts} (100%)
 rename tools/binman/test/{23_blob.dts => 023_blob.dts} (100%)
 rename tools/binman/test/{24_sorted.dts => 024_sorted.dts} (100%)
 rename tools/binman/test/{25_pack_zero_size.dts => 025_pack_zero_size.dts} (100%)
 rename tools/binman/test/{26_pack_u_boot_dtb.dts => 026_pack_u_boot_dtb.dts} (100%)
 rename tools/binman/test/{27_pack_4gb_no_size.dts => 027_pack_4gb_no_size.dts} (100%)
 rename tools/binman/test/{28_pack_4gb_outside.dts => 028_pack_4gb_outside.dts} (100%)
 rename tools/binman/test/{29_x86-rom.dts => 029_x86-rom.dts} (100%)
 rename tools/binman/test/{30_x86-rom-me-no-desc.dts => 030_x86-rom-me-no-desc.dts} (100%)
 rename tools/binman/test/{31_x86-rom-me.dts => 031_x86-rom-me.dts} (100%)
 rename tools/binman/test/{32_intel-vga.dts => 032_intel-vga.dts} (100%)
 rename tools/binman/test/{33_x86-start16.dts => 033_x86-start16.dts} (100%)
 rename tools/binman/test/{34_x86_ucode.dts => 034_x86_ucode.dts} (100%)
 rename tools/binman/test/{35_x86_single_ucode.dts => 035_x86_single_ucode.dts} (100%)
 rename tools/binman/test/{36_u_boot_img.dts => 036_u_boot_img.dts} (100%)
 rename tools/binman/test/{37_x86_no_ucode.dts => 037_x86_no_ucode.dts} (100%)
 rename tools/binman/test/{38_x86_ucode_missing_node.dts => 038_x86_ucode_missing_node.dts} (100%)
 rename tools/binman/test/{39_x86_ucode_missing_node2.dts => 039_x86_ucode_missing_node2.dts} (100%)
 rename tools/binman/test/{40_x86_ucode_not_in_image.dts => 040_x86_ucode_not_in_image.dts} (100%)
 rename tools/binman/test/{41_unknown_pos_size.dts => 041_unknown_pos_size.dts} (100%)
 rename tools/binman/test/{42_intel-fsp.dts => 042_intel-fsp.dts} (100%)
 rename tools/binman/test/{43_intel-cmc.dts => 043_intel-cmc.dts} (100%)
 rename tools/binman/test/{44_x86_optional_ucode.dts => 044_x86_optional_ucode.dts} (100%)
 rename tools/binman/test/{45_prop_test.dts => 045_prop_test.dts} (100%)
 rename tools/binman/test/{46_intel-vbt.dts => 046_intel-vbt.dts} (100%)
 rename tools/binman/test/{47_spl_bss_pad.dts => 047_spl_bss_pad.dts} (100%)
 rename tools/binman/test/{48_x86-start16-spl.dts => 048_x86-start16-spl.dts} (100%)
 rename tools/binman/test/{49_x86_ucode_spl.dts => 049_x86_ucode_spl.dts} (100%)
 rename tools/binman/test/{50_intel_mrc.dts => 050_intel_mrc.dts} (100%)
 rename tools/binman/test/{51_u_boot_spl_dtb.dts => 051_u_boot_spl_dtb.dts} (100%)
 rename tools/binman/test/{52_u_boot_spl_nodtb.dts => 052_u_boot_spl_nodtb.dts} (100%)
 rename tools/binman/test/{53_symbols.dts => 053_symbols.dts} (100%)
 rename tools/binman/test/{54_unit_address.dts => 054_unit_address.dts} (100%)
 rename tools/binman/test/{55_sections.dts => 055_sections.dts} (100%)
 rename tools/binman/test/{56_name_prefix.dts => 056_name_prefix.dts} (100%)
 rename tools/binman/test/{57_unknown_contents.dts => 057_unknown_contents.dts} (100%)
 rename tools/binman/test/{58_x86_ucode_spl_needs_retry.dts => 058_x86_ucode_spl_needs_retry.dts} (100%)
 rename tools/binman/test/{59_change_size.dts => 059_change_size.dts} (100%)
 rename tools/binman/test/{60_fdt_update.dts => 060_fdt_update.dts} (100%)
 rename tools/binman/test/{61_fdt_update_bad.dts => 061_fdt_update_bad.dts} (100%)
 rename tools/binman/test/{62_entry_args.dts => 062_entry_args.dts} (100%)
 rename tools/binman/test/{63_entry_args_missing.dts => 063_entry_args_missing.dts} (100%)
 rename tools/binman/test/{64_entry_args_required.dts => 064_entry_args_required.dts} (100%)
 rename tools/binman/test/{65_entry_args_unknown_datatype.dts => 065_entry_args_unknown_datatype.dts} (100%)
 rename tools/binman/test/{66_text.dts => 066_text.dts} (100%)
 rename tools/binman/test/{67_fmap.dts => 067_fmap.dts} (100%)
 rename tools/binman/test/{68_blob_named_by_arg.dts => 068_blob_named_by_arg.dts} (100%)
 rename tools/binman/test/{69_fill.dts => 069_fill.dts} (100%)
 rename tools/binman/test/{70_fill_no_size.dts => 070_fill_no_size.dts} (100%)
 rename tools/binman/test/{71_gbb.dts => 071_gbb.dts} (100%)
 rename tools/binman/test/{72_gbb_too_small.dts => 072_gbb_too_small.dts} (100%)
 rename tools/binman/test/{73_gbb_no_size.dts => 073_gbb_no_size.dts} (100%)
 rename tools/binman/test/{74_vblock.dts => 074_vblock.dts} (100%)
 rename tools/binman/test/{75_vblock_no_content.dts => 075_vblock_no_content.dts} (100%)
 rename tools/binman/test/{76_vblock_bad_phandle.dts => 076_vblock_bad_phandle.dts} (100%)
 rename tools/binman/test/{77_vblock_bad_entry.dts => 077_vblock_bad_entry.dts} (100%)
 rename tools/binman/test/{78_u_boot_tpl.dts => 078_u_boot_tpl.dts} (100%)
 rename tools/binman/test/{79_uses_pos.dts => 079_uses_pos.dts} (100%)
 rename tools/binman/test/{80_fill_empty.dts => 080_fill_empty.dts} (100%)
 rename tools/binman/test/{81_x86-start16-tpl.dts => 081_x86-start16-tpl.dts} (100%)
 rename tools/binman/test/{82_fdt_update_all.dts => 082_fdt_update_all.dts} (100%)
 rename tools/binman/test/{83_compress.dts => 083_compress.dts} (100%)
 rename tools/binman/test/{84_files.dts => 084_files.dts} (100%)
 rename tools/binman/test/{85_files_compress.dts => 085_files_compress.dts} (100%)
 rename tools/binman/test/{86_files_none.dts => 086_files_none.dts} (100%)
 rename tools/binman/test/{87_files_no_pattern.dts => 087_files_no_pattern.dts} (100%)
 rename tools/binman/test/{88_expand_size.dts => 088_expand_size.dts} (100%)
 rename tools/binman/test/{89_expand_size_bad.dts => 089_expand_size_bad.dts} (100%)
 rename tools/binman/test/{90_hash.dts => 090_hash.dts} (100%)
 rename tools/binman/test/{91_hash_no_algo.dts => 091_hash_no_algo.dts} (100%)
 rename tools/binman/test/{92_hash_bad_algo.dts => 092_hash_bad_algo.dts} (100%)
 rename tools/binman/test/{93_x86_tpl_ucode.dts => 093_x86_tpl_ucode.dts} (100%)
 rename tools/binman/test/{94_fmap_x86.dts => 094_fmap_x86.dts} (100%)
 rename tools/binman/test/{95_fmap_x86_section.dts => 095_fmap_x86_section.dts} (100%)
 rename tools/binman/test/{96_elf.dts => 096_elf.dts} (100%)
 rename tools/binman/test/{97_elf_strip.dts => 097_elf_strip.dts} (100%)
 rename tools/binman/test/{99_hash_section.dts => 099_hash_section.dts} (100%)
 create mode 100644 tools/binman/test/100_intel_refcode.dts
Signature · 1 line
2.19.0.605.g01d371f741-goog
#1 lore raw

PATCH 1/45 dm: core: Alloc uclass-private data to be cache-aligned

There is no reason why this feature should not be supported for uclass- private data. Update the code accordingly.

---

 drivers/core/device.c | 3 ++-
 include/dm/uclass.h   | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/core/device.c +2 -1
index feed43c8c3e..73c99d1a65a 100644
@@ -331,7 +331,8 @@ int device_probe(struct udevice *dev)
 	/* Allocate private data if requested and not reentered */
 	size = dev->uclass->uc_drv->per_device_auto_alloc_size;
 	if (size && !dev->uclass_priv) {
-		dev->uclass_priv = calloc(1, size);
+		dev->uclass_priv = alloc_priv(size,
+					      dev->uclass->uc_drv->flags);
 		if (!dev->uclass_priv) {
 			ret = -ENOMEM;
 			goto fail;
include/dm/uclass.h +3 -0
index 6e7c1cd3e8b..eebf2d5614c 100644
@@ -44,6 +44,9 @@ struct udevice;
 /* Members of this uclass sequence themselves with aliases */
 #define DM_UC_FLAG_SEQ_ALIAS			(1 << 0)
 
+/* Same as DM_FLAG_ALLOC_PRIV_DMA */
+#define DM_UC_FLAG_ALLOC_PRIV_DMA		(1 << 5)
+
 /**
  * struct uclass_driver - Driver for the uclass
  *
Signature · 1 line
2.19.0.605.g01d371f741-goog
#2 lore raw

PATCH 1/45 dm: core: Alloc uclass-private data to be cache-aligned

There is no reason why this feature should not be supported for uclass- private data. Update the code accordingly.

---

 drivers/core/device.c | 3 ++-
 include/dm/uclass.h   | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)

Applied to u-boot-dm

#3 lore raw

PATCH 2/45 dm: core: Update some functions to use const

In reply to Simon Glass

Quite a few functions do not actually modify the device that is passed in. Update the function signatures to reflect that.

---

 drivers/core/device.c | 24 ++++++++++++------------
 include/dm/device.h   | 24 ++++++++++++------------
 2 files changed, 24 insertions(+), 24 deletions(-)
drivers/core/device.c +12 -12
index 73c99d1a65a..a9e5906e7cd 100644
@@ -442,7 +442,7 @@ fail:
 	return ret;
 }
 
-void *dev_get_platdata(struct udevice *dev)
+void *dev_get_platdata(const struct udevice *dev)
 {
 	if (!dev) {
 		dm_warn("%s: null device\n", __func__);
@@ -452,7 +452,7 @@ void *dev_get_platdata(struct udevice *dev)
 	return dev->platdata;
 }
 
-void *dev_get_parent_platdata(struct udevice *dev)
+void *dev_get_parent_platdata(const struct udevice *dev)
 {
 	if (!dev) {
 		dm_warn("%s: null device\n", __func__);
@@ -462,7 +462,7 @@ void *dev_get_parent_platdata(struct udevice *dev)
 	return dev->parent_platdata;
 }
 
-void *dev_get_uclass_platdata(struct udevice *dev)
+void *dev_get_uclass_platdata(const struct udevice *dev)
 {
 	if (!dev) {
 		dm_warn("%s: null device\n", __func__);
@@ -472,7 +472,7 @@ void *dev_get_uclass_platdata(struct udevice *dev)
 	return dev->uclass_platdata;
 }
 
-void *dev_get_priv(struct udevice *dev)
+void *dev_get_priv(const struct udevice *dev)
 {
 	if (!dev) {
 		dm_warn("%s: null device\n", __func__);
@@ -482,7 +482,7 @@ void *dev_get_priv(struct udevice *dev)
 	return dev->priv;
 }
 
-void *dev_get_uclass_priv(struct udevice *dev)
+void *dev_get_uclass_priv(const struct udevice *dev)
 {
 	if (!dev) {
 		dm_warn("%s: null device\n", __func__);
@@ -492,7 +492,7 @@ void *dev_get_uclass_priv(struct udevice *dev)
 	return dev->uclass_priv;
 }
 
-void *dev_get_parent_priv(struct udevice *dev)
+void *dev_get_parent_priv(const struct udevice *dev)
 {
 	if (!dev) {
 		dm_warn("%s: null device\n", __func__);
@@ -681,17 +681,17 @@ int device_find_next_child(struct udevice **devp)
 	return 0;
 }
 
-struct udevice *dev_get_parent(struct udevice *child)
+struct udevice *dev_get_parent(const struct udevice *child)
 {
 	return child->parent;
 }
 
-ulong dev_get_driver_data(struct udevice *dev)
+ulong dev_get_driver_data(const struct udevice *dev)
 {
 	return dev->driver_data;
 }
 
-const void *dev_get_driver_ops(struct udevice *dev)
+const void *dev_get_driver_ops(const struct udevice *dev)
 {
 	if (!dev || !dev->driver->ops)
 		return NULL;
@@ -699,12 +699,12 @@ const void *dev_get_driver_ops(struct udevice *dev)
 	return dev->driver->ops;
 }
 
-enum uclass_id device_get_uclass_id(struct udevice *dev)
+enum uclass_id device_get_uclass_id(const struct udevice *dev)
 {
 	return dev->uclass->uc_drv->id;
 }
 
-const char *dev_get_uclass_name(struct udevice *dev)
+const char *dev_get_uclass_name(const struct udevice *dev)
 {
 	if (!dev)
 		return NULL;
@@ -712,7 +712,7 @@ const char *dev_get_uclass_name(struct udevice *dev)
 	return dev->uclass->uc_drv->name;
 }
 
-bool device_has_children(struct udevice *dev)
+bool device_has_children(const struct udevice *dev)
 {
 	return !list_empty(&dev->child_head);
 }
include/dm/device.h +12 -12
index 9812d86f08b..f873fc66e12 100644
@@ -270,7 +270,7 @@ struct driver {
  * @dev		Device to check
  * @return platform data, or NULL if none
  */
-void *dev_get_platdata(struct udevice *dev);
+void *dev_get_platdata(const struct udevice *dev);
 
 /**
  * dev_get_parent_platdata() - Get the parent platform data for a device
@@ -280,7 +280,7 @@ void *dev_get_platdata(struct udevice *dev);
  * @dev		Device to check
  * @return parent's platform data, or NULL if none
  */
-void *dev_get_parent_platdata(struct udevice *dev);
+void *dev_get_parent_platdata(const struct udevice *dev);
 
 /**
  * dev_get_uclass_platdata() - Get the uclass platform data for a device
@@ -290,7 +290,7 @@ void *dev_get_parent_platdata(struct udevice *dev);
  * @dev		Device to check
  * @return uclass's platform data, or NULL if none
  */
-void *dev_get_uclass_platdata(struct udevice *dev);
+void *dev_get_uclass_platdata(const struct udevice *dev);
 
 /**
  * dev_get_priv() - Get the private data for a device
@@ -300,7 +300,7 @@ void *dev_get_uclass_platdata(struct udevice *dev);
  * @dev		Device to check
  * @return private data, or NULL if none
  */
-void *dev_get_priv(struct udevice *dev);
+void *dev_get_priv(const struct udevice *dev);
 
 /**
  * dev_get_parent_priv() - Get the parent private data for a device
@@ -314,7 +314,7 @@ void *dev_get_priv(struct udevice *dev);
  * @dev		Device to check
  * @return parent data, or NULL if none
  */
-void *dev_get_parent_priv(struct udevice *dev);
+void *dev_get_parent_priv(const struct udevice *dev);
 
 /**
  * dev_get_uclass_priv() - Get the private uclass data for a device
@@ -324,7 +324,7 @@ void *dev_get_parent_priv(struct udevice *dev);
  * @dev		Device to check
  * @return private uclass data for this device, or NULL if none
  */
-void *dev_get_uclass_priv(struct udevice *dev);
+void *dev_get_uclass_priv(const struct udevice *dev);
 
 /**
  * struct dev_get_parent() - Get the parent of a device
@@ -332,7 +332,7 @@ void *dev_get_uclass_priv(struct udevice *dev);
  * @child:	Child to check
  * @return parent of child, or NULL if this is the root device
  */
-struct udevice *dev_get_parent(struct udevice *child);
+struct udevice *dev_get_parent(const struct udevice *child);
 
 /**
  * dev_get_driver_data() - get the driver data used to bind a device
@@ -359,7 +359,7 @@ struct udevice *dev_get_parent(struct udevice *child);
  * @dev:	Device to check
  * @return driver data (0 if none is provided)
  */
-ulong dev_get_driver_data(struct udevice *dev);
+ulong dev_get_driver_data(const struct udevice *dev);
 
 /**
  * dev_get_driver_ops() - get the device's driver's operations
@@ -370,7 +370,7 @@ ulong dev_get_driver_data(struct udevice *dev);
  * @dev:	Device to check
  * @return void pointer to driver's operations or NULL for NULL-dev or NULL-ops
  */
-const void *dev_get_driver_ops(struct udevice *dev);
+const void *dev_get_driver_ops(const struct udevice *dev);
 
 /**
  * device_get_uclass_id() - return the uclass ID of a device
@@ -378,7 +378,7 @@ const void *dev_get_driver_ops(struct udevice *dev);
  * @dev:	Device to check
  * @return uclass ID for the device
  */
-enum uclass_id device_get_uclass_id(struct udevice *dev);
+enum uclass_id device_get_uclass_id(const struct udevice *dev);
 
 /**
  * dev_get_uclass_name() - return the uclass name of a device
@@ -388,7 +388,7 @@ enum uclass_id device_get_uclass_id(struct udevice *dev);
  * @dev:	Device to check
  * @return  pointer to the uclass name for the device
  */
-const char *dev_get_uclass_name(struct udevice *dev);
+const char *dev_get_uclass_name(const struct udevice *dev);
 
 /**
  * device_get_child() - Get the child of a device by index
@@ -525,7 +525,7 @@ int device_find_next_child(struct udevice **devp);
  * @dev:	Device to check
  * @return true if the device has one or more children
  */
-bool device_has_children(struct udevice *dev);
+bool device_has_children(const struct udevice *dev);
 
 /**
  * device_has_active_children() - check if a device has any active children
Signature · 1 line
2.19.0.605.g01d371f741-goog
#4 lore raw

PATCH 2/45 dm: core: Update some functions to use const

Quite a few functions do not actually modify the device that is passed in. Update the function signatures to reflect that.

---

 drivers/core/device.c | 24 ++++++++++++------------
 include/dm/device.h   | 24 ++++++++++++------------
 2 files changed, 24 insertions(+), 24 deletions(-)

Applied to u-boot-dm

#5 lore raw

PATCH 3/45 dm: core: Add a function to find the first inactive child

In reply to Simon Glass

Some devices have children and want to press an existing inactive child into service when needed. Add a function to help with this.

---

 drivers/core/device.c | 18 ++++++++++++++++++
 include/dm/device.h   | 15 +++++++++++++++
 test/dm/core.c        | 31 +++++++++++++++++++++++++++++++
 3 files changed, 64 insertions(+)
drivers/core/device.c +18 -0
index a9e5906e7cd..5176aa3f866 100644
@@ -681,6 +681,24 @@ int device_find_next_child(struct udevice **devp)
 	return 0;
 }
 
+int device_find_first_inactive_child(struct udevice *parent,
+				     enum uclass_id uclass_id,
+				     struct udevice **devp)
+{
+	struct udevice *dev;
+
+	*devp = NULL;
+	list_for_each_entry(dev, &parent->child_head, sibling_node) {
+		if (!device_active(dev) &&
+		    device_get_uclass_id(dev) == uclass_id) {
+			*devp = dev;
+			return 0;
+		}
+	}
+
+	return -ENODEV;
+}
+
 struct udevice *dev_get_parent(const struct udevice *child)
 {
 	return child->parent;
include/dm/device.h +15 -0
index f873fc66e12..847934425bb 100644
@@ -519,6 +519,21 @@ int device_find_first_child(struct udevice *parent, struct udevice **devp);
  */
 int device_find_next_child(struct udevice **devp);
 
+/**
+ * device_find_first_inactive_child() - Find the first inactive child
+ *
+ * This is used to locate an existing child of a device which is of a given
+ * uclass.
+ *
+ * @parent:	Parent device to search
+ * @uclass_id:	Uclass to look for
+ * @devp:	Returns device found, if any
+ * @return 0 if found, else -ENODEV
+ */
+int device_find_first_inactive_child(struct udevice *parent,
+				     enum uclass_id uclass_id,
+				     struct udevice **devp);
+
 /**
  * device_has_children() - check if a device has any children
  *
test/dm/core.c +31 -0
index c15a8406c09..260f6494a2e 100644
@@ -870,3 +870,34 @@ static int dm_test_uclass_names(struct unit_test_state *uts)
 	return 0;
 }
 DM_TEST(dm_test_uclass_names, DM_TESTF_SCAN_PDATA);
+
+static int dm_test_inactive_child(struct unit_test_state *uts)
+{
+	struct dm_test_state *dms = uts->priv;
+	struct udevice *parent, *dev1, *dev2;
+
+	/* Skip the behaviour in test_post_probe() */
+	dms->skip_post_probe = 1;
+
+	ut_assertok(uclass_first_device_err(UCLASS_TEST, &parent));
+
+	/*
+	 * Create a child but do not activate it. Calling the function again
+	 * should return the same child.
+	 */
+	ut_asserteq(-ENODEV, device_find_first_inactive_child(parent,
+							UCLASS_TEST, &dev1));
+	ut_assertok(device_bind_ofnode(parent, DM_GET_DRIVER(test_drv),
+				       "test_child", 0, ofnode_null(), &dev1));
+
+	ut_assertok(device_find_first_inactive_child(parent, UCLASS_TEST,
+						     &dev2));
+	ut_asserteq_ptr(dev1, dev2);
+
+	ut_assertok(device_probe(dev1));
+	ut_asserteq(-ENODEV, device_find_first_inactive_child(parent,
+							UCLASS_TEST, &dev2));
+
+	return 0;
+}
+DM_TEST(dm_test_inactive_child, DM_TESTF_SCAN_PDATA);
Signature · 1 line
2.19.0.605.g01d371f741-goog
#6 lore raw

PATCH 3/45 dm: core: Add a function to find the first inactive child

Some devices have children and want to press an existing inactive child into service when needed. Add a function to help with this.

---

 drivers/core/device.c | 18 ++++++++++++++++++
 include/dm/device.h   | 15 +++++++++++++++
 test/dm/core.c        | 31 +++++++++++++++++++++++++++++++
 3 files changed, 64 insertions(+)

Applied to u-boot-dm

#7 lore raw

PATCH 4/45 dm: core: Update ofnode to read binman-style flash entry

In reply to Simon Glass

At present ofnode_read_fmap_entry() reads a flash map entry in a format which is not supported by binman. To allow use to use binman-format descriptions, update this function.

Also add a simple test.

---

 arch/sandbox/dts/sandbox.dts   | 20 ++++++++++----------
 arch/sandbox/dts/sandbox64.dts | 20 ++++++++++----------
 drivers/core/of_extra.c        | 27 +++++++++++++++++++--------
 drivers/misc/cros_ec.c         | 33 +++++++++++++++++----------------
 include/dm/of_extra.h          |  3 ++-
 test/dm/ofnode.c               | 16 ++++++++++++++++
 6 files changed, 74 insertions(+), 45 deletions(-)
arch/sandbox/dts/sandbox.dts +10 -10
index 1aa0f8eef53..1b00fbebd78 100644
@@ -18,7 +18,7 @@
 		stdout-path = "/serial";
 	};
 
-	cros_ec: cros-ec at 0 {
+	cros_ec: cros-ec {
 		reg = <0 0>;
 		compatible = "google,cros-ec-sandbox";
 
@@ -26,23 +26,23 @@
 		 * This describes the flash memory within the EC. Note
 		 * that the STM32L flash erases to 0, not 0xff.
 		 */
-		#address-cells = <1>;
-		#size-cells = <1>;
-		flash at 8000000 {
-			reg = <0x08000000 0x20000>;
+		flash {
+			image-pos = <0x08000000>;
+			size = <0x20000>;
 			erase-value = <0>;
-			#address-cells = <1>;
-			#size-cells = <1>;
 
 			/* Information for sandbox */
 			ro {
-				reg = <0 0xf000>;
+				image-pos = <0>;
+				size = <0xf000>;
 			};
 			wp-ro {
-				reg = <0xf000 0x1000>;
+				image-pos = <0xf000>;
+				size = <0x1000>;
 			};
 			rw {
-				reg = <0x10000 0x10000>;
+				image-pos = <0x10000>;
+				size = <0x10000>;
 			};
 		};
 	};
arch/sandbox/dts/sandbox64.dts +10 -10
index 9e65d2fda3d..6ecaaad13d8 100644
@@ -17,7 +17,7 @@
 		stdout-path = "/serial";
 	};
 
-	cros_ec: cros-ec at 0 {
+	cros_ec: cros-ec {
 		reg = <0 0 0 0>;
 		compatible = "google,cros-ec-sandbox";
 
@@ -25,23 +25,23 @@
 		 * This describes the flash memory within the EC. Note
 		 * that the STM32L flash erases to 0, not 0xff.
 		 */
-		#address-cells = <1>;
-		#size-cells = <1>;
-		flash at 8000000 {
-			reg = <0x08000000 0x20000>;
+		flash {
+			image-pos = <0x08000000>;
+			size = <0x20000>;
 			erase-value = <0>;
-			#address-cells = <1>;
-			#size-cells = <1>;
 
 			/* Information for sandbox */
 			ro {
-				reg = <0 0xf000>;
+				image-pos = <0>;
+				size = <0xf000>;
 			};
 			wp-ro {
-				reg = <0xf000 0x1000>;
+				image-pos = <0xf000>;
+				size = <0x1000>;
 			};
 			rw {
-				reg = <0x10000 0x10000>;
+				image-pos = <0x10000>;
+				size = <0x10000>;
 			};
 		};
 	};
drivers/core/of_extra.c +19 -8
index aa48917dddf..f1f393c3598 100644
@@ -13,19 +13,30 @@
 int ofnode_read_fmap_entry(ofnode node, struct fmap_entry *entry)
 {
 	const char *prop;
-	u32 reg[2];
 
-	if (ofnode_read_u32_array(node, "reg", reg, 2)) {
-		debug("Node '%s' has bad/missing 'reg' property\n",
+	if (ofnode_read_u32(node, "image-pos", &entry->offset)) {
+		debug("Node '%s' has bad/missing 'image-pos' property\n",
 		      ofnode_get_name(node));
-		return -log_ret(ENOENT);
+		return log_ret(-ENOENT);
+	}
+	if (ofnode_read_u32(node, "size", &entry->length)) {
+		debug("Node '%s' has bad/missing 'size' property\n",
+		      ofnode_get_name(node));
+		return log_ret(-ENOENT);
 	}
-	entry->offset = reg[0];
-	entry->length = reg[1];
 	entry->used = ofnode_read_s32_default(node, "used", entry->length);
 	prop = ofnode_read_string(node, "compress");
-	entry->compress_algo = prop && !strcmp(prop, "lzo") ?
-		FMAP_COMPRESS_LZO : FMAP_COMPRESS_NONE;
+	if (prop) {
+		if (!strcmp(prop, "lz4"))
+			entry->compress_algo = FMAP_COMPRESS_LZ4;
+		else
+			return log_msg_ret("Unknown compression algo",
+					   -EINVAL);
+	} else {
+		entry->compress_algo = FMAP_COMPRESS_NONE;
+	}
+	entry->unc_length = ofnode_read_s32_default(node, "uncomp-size",
+						    entry->length);
 	prop = ofnode_read_string(node, "hash");
 	if (prop)
 		entry->hash_size = strlen(prop);
drivers/misc/cros_ec.c +17 -16
index 6f299d407a4..c5ac03d027d 100644
@@ -263,8 +263,8 @@ static int send_command(struct cros_ec_dev *dev, uint8_t cmd, int cmd_version,
  * @return number of bytes in response, or -ve on error
  */
 static int ec_command_inptr(struct cros_ec_dev *dev, uint8_t cmd,
-		int cmd_version, const void *dout, int dout_len, uint8_t **dinp,
-		int din_len)
+			    int cmd_version, const void *dout, int dout_len,
+			    uint8_t **dinp, int din_len)
 {
 	uint8_t *din = NULL;
 	int len;
@@ -409,7 +409,7 @@ int cros_ec_read_build_info(struct cros_ec_dev *dev, char **strp)
 }
 
 int cros_ec_read_current_image(struct cros_ec_dev *dev,
-		enum ec_current_image *image)
+			       enum ec_current_image *image)
 {
 	struct ec_response_get_version *r;
 
@@ -422,7 +422,7 @@ int cros_ec_read_current_image(struct cros_ec_dev *dev,
 }
 
 static int cros_ec_wait_on_hash_done(struct cros_ec_dev *dev,
-				  struct ec_response_vboot_hash *hash)
+				     struct ec_response_vboot_hash *hash)
 {
 	struct ec_params_vboot_hash p;
 	ulong start;
@@ -446,7 +446,7 @@ static int cros_ec_wait_on_hash_done(struct cros_ec_dev *dev,
 
 
 int cros_ec_read_hash(struct cros_ec_dev *dev,
-		struct ec_response_vboot_hash *hash)
+		      struct ec_response_vboot_hash *hash)
 {
 	struct ec_params_vboot_hash p;
 	int rv;
@@ -515,7 +515,7 @@ static int cros_ec_invalidate_hash(struct cros_ec_dev *dev)
 }
 
 int cros_ec_reboot(struct cros_ec_dev *dev, enum ec_reboot_cmd cmd,
-		uint8_t flags)
+		   uint8_t flags)
 {
 	struct ec_params_reboot_ec p;
 
@@ -601,8 +601,8 @@ int cros_ec_clear_host_events(struct cros_ec_dev *dev, uint32_t events)
 }
 
 int cros_ec_flash_protect(struct cros_ec_dev *dev,
-		       uint32_t set_mask, uint32_t set_flags,
-		       struct ec_response_flash_protect *resp)
+			  uint32_t set_mask, uint32_t set_flags,
+			  struct ec_response_flash_protect *resp)
 {
 	struct ec_params_flash_protect params;
 
@@ -742,7 +742,8 @@ int cros_ec_flash_erase(struct cros_ec_dev *dev, uint32_t offset, uint32_t size)
  * @return 0 if ok, -1 on error
  */
 static int cros_ec_flash_write_block(struct cros_ec_dev *dev,
-		const uint8_t *data, uint32_t offset, uint32_t size)
+				     const uint8_t *data, uint32_t offset,
+				     uint32_t size)
 {
 	struct ec_params_flash_write *p;
 	int ret;
@@ -802,7 +803,7 @@ static int cros_ec_data_is_erased(const uint32_t *data, int size)
  * @param info Pointer to output flash info struct
  */
 int cros_ec_read_flashinfo(struct cros_ec_dev *dev,
-			  struct ec_response_flash_info *info)
+			   struct ec_response_flash_info *info)
 {
 	int ret;
 
@@ -815,7 +816,7 @@ int cros_ec_read_flashinfo(struct cros_ec_dev *dev,
 }
 
 int cros_ec_flash_write(struct cros_ec_dev *dev, const uint8_t *data,
-		     uint32_t offset, uint32_t size)
+			uint32_t offset, uint32_t size)
 {
 	uint32_t burst = cros_ec_flash_write_burst_size(dev);
 	uint32_t end, off;
@@ -832,7 +833,7 @@ int cros_ec_flash_write(struct cros_ec_dev *dev, const uint8_t *data,
 		/* If the data is empty, there is no point in programming it */
 		todo = min(end - off, burst);
 		if (dev->optimise_flash_write &&
-				cros_ec_data_is_erased((uint32_t *)data, todo))
+		    cros_ec_data_is_erased((uint32_t *)data, todo))
 			continue;
 
 		ret = cros_ec_flash_write_block(dev, data, off, todo);
@@ -859,7 +860,7 @@ int cros_ec_flash_write(struct cros_ec_dev *dev, const uint8_t *data,
  * @return 0 if ok, -1 on error
  */
 static int cros_ec_flash_read_block(struct cros_ec_dev *dev, uint8_t *data,
-				 uint32_t offset, uint32_t size)
+				    uint32_t offset, uint32_t size)
 {
 	struct ec_params_flash_read p;
 
@@ -871,7 +872,7 @@ static int cros_ec_flash_read_block(struct cros_ec_dev *dev, uint8_t *data,
 }
 
 int cros_ec_flash_read(struct cros_ec_dev *dev, uint8_t *data, uint32_t offset,
-		    uint32_t size)
+		       uint32_t size)
 {
 	uint32_t burst = cros_ec_flash_write_burst_size(dev);
 	uint32_t end, off;
@@ -888,8 +889,8 @@ int cros_ec_flash_read(struct cros_ec_dev *dev, uint8_t *data, uint32_t offset,
 	return 0;
 }
 
-int cros_ec_flash_update_rw(struct cros_ec_dev *dev,
-			 const uint8_t *image, int image_size)
+int cros_ec_flash_update_rw(struct cros_ec_dev *dev, const uint8_t *image,
+			    int image_size)
 {
 	uint32_t rw_offset, rw_size;
 	int ret;
include/dm/of_extra.h +2 -1
index 97988b66632..ca15df21b06 100644
@@ -11,7 +11,7 @@
 
 enum fmap_compress_t {
 	FMAP_COMPRESS_NONE,
-	FMAP_COMPRESS_LZO,
+	FMAP_COMPRESS_LZ4,
 };
 
 enum fmap_hash_t {
@@ -26,6 +26,7 @@ struct fmap_entry {
 	uint32_t length;
 	uint32_t used;			/* Number of bytes used in region */
 	enum fmap_compress_t compress_algo;	/* Compression type */
+	uint32_t unc_length;			/* Uncompressed length */
 	enum fmap_hash_t hash_algo;		/* Hash algorithm */
 	const uint8_t *hash;			/* Hash value */
 	int hash_size;				/* Hash size */
test/dm/ofnode.c +16 -0
index 907d1ddbdb6..745de50c7ba 100644
@@ -2,6 +2,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <dm/of_extra.h>
 #include <dm/test.h>
 #include <test/ut.h>
 
@@ -42,3 +43,18 @@ static int dm_test_ofnode_by_prop_value(struct unit_test_state *uts)
 	return 0;
 }
 DM_TEST(dm_test_ofnode_by_prop_value, DM_TESTF_SCAN_FDT);
+
+static int dm_test_ofnode_fmap(struct unit_test_state *uts)
+{
+	struct fmap_entry entry;
+	ofnode node;
+
+	node = ofnode_path("/cros-ec/flash");
+	ut_assert(ofnode_valid(node));
+	ut_assertok(ofnode_read_fmap_entry(node, &entry));
+	ut_asserteq(0x08000000, entry.offset);
+	ut_asserteq(0x20000, entry.length);
+
+	return 0;
+}
+DM_TEST(dm_test_ofnode_fmap, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
Signature · 1 line
2.19.0.605.g01d371f741-goog
#8 lore raw

PATCH 4/45 dm: core: Update ofnode to read binman-style flash entry

At present ofnode_read_fmap_entry() reads a flash map entry in a format which is not supported by binman. To allow use to use binman-format descriptions, update this function.

Also add a simple test.

---

 arch/sandbox/dts/sandbox.dts   | 20 ++++++++++----------
 arch/sandbox/dts/sandbox64.dts | 20 ++++++++++----------
 drivers/core/of_extra.c        | 27 +++++++++++++++++++--------
 drivers/misc/cros_ec.c         | 33 +++++++++++++++++----------------
 include/dm/of_extra.h          |  3 ++-
 test/dm/ofnode.c               | 16 ++++++++++++++++
 6 files changed, 74 insertions(+), 45 deletions(-)

Applied to u-boot-dm

#9 lore raw

PATCH 5/45 sf: Avoid allocating memory on every read operation

In reply to Simon Glass

At present spi_flash_cmd_read_ops() allocates and frees a few bytes of memory every time it is called. It is faster to use the stack for this and this is now supported by the minimum GCC version required by U-Boot.

Remove the allocation and use a variable-sized array instead.

---

 drivers/mtd/spi/spi_flash.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/mtd/spi/spi_flash.c +2 -7
index c1591242591..7113c855fe4 100644
@@ -468,7 +468,7 @@ int spi_flash_cmd_read_ops(struct spi_flash *flash, u32 offset,
 		size_t len, void *data)
 {
 	struct spi_slave *spi = flash->spi;
-	u8 *cmd, cmdsz;
+	u8 cmdsz;
 	u32 remain_len, read_len, read_addr;
 	int bank_sel = 0;
 	int ret = -1;
@@ -488,11 +488,7 @@ int spi_flash_cmd_read_ops(struct spi_flash *flash, u32 offset,
 	}
 
 	cmdsz = SPI_FLASH_CMD_LEN + flash->dummy_byte;
-	cmd = calloc(1, cmdsz);
-	if (!cmd) {
-		debug("SF: Failed to allocate cmd\n");
-		return -ENOMEM;
-	}
+	u8 cmd[cmdsz];
 
 	cmd[0] = flash->read_cmd;
 	while (len) {
@@ -535,7 +531,6 @@ int spi_flash_cmd_read_ops(struct spi_flash *flash, u32 offset,
 	ret = clean_bar(flash);
 #endif
 
-	free(cmd);
 	return ret;
 }
 
Signature · 1 line
2.19.0.605.g01d371f741-goog
#10 lore raw

PATCH 5/45 sf: Avoid allocating memory on every read operation

At present spi_flash_cmd_read_ops() allocates and frees a few bytes of memory every time it is called. It is faster to use the stack for this and this is now supported by the minimum GCC version required by U-Boot.

Remove the allocation and use a variable-sized array instead.

---

 drivers/mtd/spi/spi_flash.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

Applied to u-boot-dm

#11 lore raw

PATCH 6/45 spl: input: Allow input in SPL and TPL

In reply to Simon Glass

In some cases it is necessary to read the keyboard in early phases of U-Boot. Update the config to allow this.

---

 drivers/input/Kconfig  | 48 ++++++++++++++++++++++++++++++++++++++++++
 drivers/input/Makefile | 11 ++++++----
 drivers/input/input.c  |  5 ++++-
 3 files changed, 59 insertions(+), 5 deletions(-)
drivers/input/Kconfig +48 -0
index 7ffb949f12d..7afdafed948 100644
@@ -1,3 +1,16 @@
+config INPUT
+	bool "Enable input subsystem"
+	depends on DM
+	default y
+
+config SPL_INPUT
+	bool "Enable input subsystem for SPL"
+	depends on SPL_DM
+
+config TPL_INPUT
+	bool "Enable input subsystem for TPL"
+	depends on TPL_DM
+
 config DM_KEYBOARD
 	bool "Enable driver model keyboard support"
 	depends on DM
@@ -7,8 +20,43 @@ config DM_KEYBOARD
 	  includes methods to start/stop the device, check for available
 	  input and update LEDs if the keyboard has them.
 
+config SPL_DM_KEYBOARD
+	bool "Enable driver model keyboard support"
+	depends on SPL_DM
+	help
+	  This adds a uclass for keyboards and implements keyboard support
+	  using driver model. The API is implemented by keyboard.h and
+	  includes methods to start/stop the device, check for available
+	  input and update LEDs if the keyboard has them.
+
+config TPL_DM_KEYBOARD
+	bool "Enable driver model keyboard support"
+	depends on TPL_DM
+	help
+	  This adds a uclass for keyboards and implements keyboard support
+	  using driver model. The API is implemented by keyboard.h and
+	  includes methods to start/stop the device, check for available
+	  input and update LEDs if the keyboard has them.
+
 config CROS_EC_KEYB
 	bool "Enable Chrome OS EC keyboard support"
+	depends on INPUT
+	help
+	  Most ARM Chromebooks use an EC to provide access to the keyboard.
+	  Messages are used to request key scans from the EC and these are
+	  then decoded into keys by this driver.
+
+config SPL_CROS_EC_KEYB
+	bool "Enable Chrome OS EC keyboard support in SPL"
+	depends on SPL_INPUT
+	help
+	  Most ARM Chromebooks use an EC to provide access to the keyboard.
+	  Messages are used to request key scans from the EC and these are
+	  then decoded into keys by this driver.
+
+config TPL_CROS_EC_KEYB
+	bool "Enable Chrome OS EC keyboard support in TPL"
+	depends on TPL_INPUT
 	help
 	  Most ARM Chromebooks use an EC to provide access to the keyboard.
 	  Messages are used to request key scans from the EC and these are
drivers/input/Makefile +7 -4
index d13baf3576a..fd56d7b3492 100644
@@ -3,12 +3,15 @@
 # (C) Copyright 2000-2007
 # Wolfgang Denk, DENX Software Engineering, wd at denx.de.
 
-obj-$(CONFIG_DM_KEYBOARD) += keyboard-uclass.o
+obj-y += input.o
+obj-$(CONFIG_$(SPL_TPL_)CROS_EC_KEYB) += cros_ec_keyb.o
+obj-$(CONFIG_$(SPL_TPL_)OF_CONTROL) += key_matrix.o
+obj-$(CONFIG_$(SPL_TPL_)DM_KEYBOARD) += keyboard-uclass.o
+
+ifndef CONFIG_SPL_BUILD
 
 obj-$(CONFIG_I8042_KEYB) += i8042.o
 obj-$(CONFIG_TEGRA_KEYBOARD) += tegra-kbc.o
 obj-$(CONFIG_TWL4030_INPUT) += twl4030.o
 obj-$(CONFIG_TWL6030_INPUT) += twl6030.o
-obj-$(CONFIG_CROS_EC_KEYB) += cros_ec_keyb.o
-obj-y += input.o
-obj-$(CONFIG_$(SPL_)OF_CONTROL) += key_matrix.o
+endif
drivers/input/input.c +4 -1
index 29620a9e279..4f514dba56d 100644
@@ -652,7 +652,7 @@ int input_stdio_register(struct stdio_dev *dev)
 	int error;
 
 	error = stdio_register(dev);
-
+#if !defined(CONFIG_SPL_BUILD) || CONFIG_IS_ENABLED(ENV_SUPPORT)
 	/* check if this is the standard input device */
 	if (!error && strcmp(env_get("stdin"), dev->name) == 0) {
 		/* reassign the console */
@@ -660,6 +660,9 @@ int input_stdio_register(struct stdio_dev *dev)
 				console_assign(stdin, dev->name))
 			return -1;
 	}
+#else
+	error = error;
+#endif
 
 	return 0;
 }
Signature · 1 line
2.19.0.605.g01d371f741-goog
#12 lore raw

PATCH 6/45 spl: input: Allow input in SPL and TPL

In some cases it is necessary to read the keyboard in early phases of U-Boot. Update the config to allow this.

---

 drivers/input/Kconfig  | 48 ++++++++++++++++++++++++++++++++++++++++++
 drivers/input/Makefile | 11 ++++++----
 drivers/input/input.c  |  5 ++++-
 3 files changed, 59 insertions(+), 5 deletions(-)

Applied to u-boot-dm

#13 lore raw

PATCH 7/45 Makefile: Add a warning if SPL/TPL cannot be built

In reply to Simon Glass

At present the build fails in strange ways if CONFIG_SPL is defined by CONFIG_SUPPORT_SPL is not. Add a warning for this case as it can be very confusing to debug.

---

 scripts/Makefile.spl | 7 +++++++
 1 file changed, 7 insertions(+)
scripts/Makefile.spl +7 -0
index e494d185e4b..c71497ff008 100644
@@ -45,6 +45,13 @@ SPL_ :=
 SPL_TPL_ :=
 endif
 
+ifeq ($(obj)$(CONFIG_SUPPORT_SPL),spl)
+$(error You cannot build SPL without enabling CONFIG_SUPPORT_SPL)
+endif
+ifeq ($(obj)$(CONFIG_SUPPORT_TPL),tpl)
+$(error You cannot build TPL without enabling CONFIG_SUPPORT_TPL)
+endif
+
 include $(srctree)/config.mk
 include $(srctree)/arch/$(ARCH)/Makefile
 
Signature · 1 line
2.19.0.605.g01d371f741-goog
#14 lore raw

PATCH 7/45 Makefile: Add a warning if SPL/TPL cannot be built

At present the build fails in strange ways if CONFIG_SPL is defined by CONFIG_SUPPORT_SPL is not. Add a warning for this case as it can be very confusing to debug.

---

 scripts/Makefile.spl | 7 +++++++
 1 file changed, 7 insertions(+)

Applied to u-boot-dm

#15 lore raw

PATCH 8/45 spl: misc: Allow misc drivers in SPL and TPL

In reply to Simon Glass

In some cases it is necessary to read the keyboard in early phases of U-Boot. The cros_ec keyboard is kept in the misc directory. Update the config to allow this.

---

 drivers/misc/Kconfig  | 72 +++++++++++++++++++++++++++++++++++++++++++
 drivers/misc/Makefile |  9 +++---
 2 files changed, 77 insertions(+), 4 deletions(-)
drivers/misc/Kconfig +72 -0
index b0fb73f6926..08ac16e0389 100644
@@ -13,6 +13,24 @@ config MISC
 	  set of generic read, write and ioctl methods may be used to
 	  access the device.
 
+config SPL_MISC
+	bool "Enable Driver Model for Misc drivers in SPL"
+	depends on SPL_DM
+	help
+	  Enable driver model for miscellaneous devices. This class is
+	  used only for those do not fit other more general classes. A
+	  set of generic read, write and ioctl methods may be used to
+	  access the device.
+
+config TPL_MISC
+	bool "Enable Driver Model for Misc drivers in TPL"
+	depends on TPL_DM
+	help
+	  Enable driver model for miscellaneous devices. This class is
+	  used only for those do not fit other more general classes. A
+	  set of generic read, write and ioctl methods may be used to
+	  access the device.
+
 config ALTERA_SYSID
 	bool "Altera Sysid support"
 	depends on MISC
@@ -60,6 +78,24 @@ config CROS_EC
 	  control access to the battery and main PMIC depending on the
 	  device. You can use the 'crosec' command to access it.
 
+config SPL_CROS_EC
+	bool "Enable Chrome OS EC in SPL"
+	help
+	  Enable access to the Chrome OS EC in SPL. This is a separate
+	  microcontroller typically available on a SPI bus on Chromebooks. It
+	  provides access to the keyboard, some internal storage and may
+	  control access to the battery and main PMIC depending on the
+	  device. You can use the 'crosec' command to access it.
+
+config TPL_CROS_EC
+	bool "Enable Chrome OS EC in TPL"
+	help
+	  Enable access to the Chrome OS EC in TPL. This is a separate
+	  microcontroller typically available on a SPI bus on Chromebooks. It
+	  provides access to the keyboard, some internal storage and may
+	  control access to the battery and main PMIC depending on the
+	  device. You can use the 'crosec' command to access it.
+
 config CROS_EC_I2C
 	bool "Enable Chrome OS EC I2C driver"
 	depends on CROS_EC
@@ -78,6 +114,24 @@ config CROS_EC_LPC
 	  through a legacy port interface, so on x86 machines the main
 	  function of the EC is power and thermal management.
 
+config SPL_CROS_EC_LPC
+	bool "Enable Chrome OS EC LPC driver in SPL"
+	depends on CROS_EC
+	help
+	  Enable I2C access to the Chrome OS EC. This is used on x86
+	  Chromebooks such as link and falco. The keyboard is provided
+	  through a legacy port interface, so on x86 machines the main
+	  function of the EC is power and thermal management.
+
+config TPL_CROS_EC_LPC
+	bool "Enable Chrome OS EC LPC driver in TPL"
+	depends on CROS_EC
+	help
+	  Enable I2C access to the Chrome OS EC. This is used on x86
+	  Chromebooks such as link and falco. The keyboard is provided
+	  through a legacy port interface, so on x86 machines the main
+	  function of the EC is power and thermal management.
+
 config CROS_EC_SANDBOX
 	bool "Enable Chrome OS EC sandbox driver"
 	depends on CROS_EC && SANDBOX
@@ -87,6 +141,24 @@ config CROS_EC_SANDBOX
 	  EC flash read/write/erase support and a few other things. It is
 	  enough to perform a Chrome OS verified boot on sandbox.
 
+config SPL_CROS_EC_SANDBOX
+	bool "Enable Chrome OS EC sandbox driver in SPL"
+	depends on SPL_CROS_EC && SANDBOX
+	help
+	  Enable a sandbox emulation of the Chrome OS EC in SPL. This supports
+	  keyboard (use the -l flag to enable the LCD), verified boot context,
+	  EC flash read/write/erase support and a few other things. It is
+	  enough to perform a Chrome OS verified boot on sandbox.
+
+config TPL_CROS_EC_SANDBOX
+	bool "Enable Chrome OS EC sandbox driver in TPL"
+	depends on TPL_CROS_EC && SANDBOX
+	help
+	  Enable a sandbox emulation of the Chrome OS EC in TPL. This supports
+	  keyboard (use the -l flag to enable the LCD), verified boot context,
+	  EC flash read/write/erase support and a few other things. It is
+	  enough to perform a Chrome OS verified boot on sandbox.
+
 config CROS_EC_SPI
 	bool "Enable Chrome OS EC SPI driver"
 	depends on CROS_EC
drivers/misc/Makefile +5 -4
index acf24c44fa9..9b92e61bfa8 100644
@@ -3,17 +3,18 @@
 # (C) Copyright 2000-2007
 # Wolfgang Denk, DENX Software Engineering, wd at denx.de.
 
-obj-$(CONFIG_MISC) += misc-uclass.o
+obj-$(CONFIG_$(SPL_TPL_)CROS_EC) += cros_ec.o
+obj-$(CONFIG_$(SPL_TPL_)CROS_EC_SANDBOX) += cros_ec_sandbox.o
+obj-$(CONFIG_$(SPL_TPL_)CROS_EC_LPC) += cros_ec_lpc.o
+
+obj-$(CONFIG_$(SPL_TPL_)MISC) += misc-uclass.o
 obj-$(CONFIG_ALI152X) += ali512x.o
 obj-$(CONFIG_ALTERA_SYSID) += altera_sysid.o
 obj-$(CONFIG_ATSHA204A) += atsha204a-i2c.o
 obj-$(CONFIG_DS4510)  += ds4510.o
 obj-$(CONFIG_CBMEM_CONSOLE) += cbmem_console.o
 ifndef CONFIG_SPL_BUILD
-obj-$(CONFIG_CROS_EC) += cros_ec.o
-obj-$(CONFIG_CROS_EC_LPC) += cros_ec_lpc.o
 obj-$(CONFIG_CROS_EC_I2C) += cros_ec_i2c.o
-obj-$(CONFIG_CROS_EC_SANDBOX) += cros_ec_sandbox.o
 obj-$(CONFIG_CROS_EC_SPI) += cros_ec_spi.o
 endif
 obj-$(CONFIG_FSL_IIM) += fsl_iim.o
Signature · 1 line
2.19.0.605.g01d371f741-goog
#16 lore raw

PATCH 8/45 spl: misc: Allow misc drivers in SPL and TPL

In some cases it is necessary to read the keyboard in early phases of U-Boot. The cros_ec keyboard is kept in the misc directory. Update the config to allow this.

---

 drivers/misc/Kconfig  | 72 +++++++++++++++++++++++++++++++++++++++++++
 drivers/misc/Makefile |  9 +++---
 2 files changed, 77 insertions(+), 4 deletions(-)

Applied to u-boot-dm

#17 lore raw

PATCH 9/45 blk: Support block drivers in TPL

In reply to Simon Glass

At present it is not possible to enable/disable block drivers in TPL. This is needed to provide sandbox support. Add a Kconfig option and adjust the Makefile.

---

 drivers/block/Kconfig  | 12 ++++++++++++
 drivers/block/Makefile |  2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)
drivers/block/Kconfig +12 -0
index f9502b36bac..33f4aa24185 100644
@@ -27,6 +27,18 @@ config SPL_BLK
 	  be partitioned into several areas, called 'partitions' in U-Boot.
 	  A filesystem can be placed in each partition.
 
+config TPL_BLK
+	bool "Support block devices in TPL"
+	depends on TPL_DM && BLK
+	default y
+	help
+	  Enable support for block devices, such as SCSI, MMC and USB
+	  flash sticks. These provide a block-level interface which permits
+	  reading, writing and (in some cases) erasing blocks. Block
+	  devices often have a partition table which allows the device to
+	  be partitioned into several areas, called 'partitions' in U-Boot.
+	  A filesystem can be placed in each partition.
+
 config BLOCK_CACHE
 	bool "Use block device cache"
 	depends on BLK
drivers/block/Makefile +1 -1
index 0e80ce94058..055d42f7d4a 100644
@@ -11,4 +11,4 @@ endif
 
 obj-$(CONFIG_IDE) += ide.o
 obj-$(CONFIG_SANDBOX) += sandbox.o
-obj-$(CONFIG_$(SPL_)BLOCK_CACHE) += blkcache.o
+obj-$(CONFIG_$(SPL_TPL_)BLOCK_CACHE) += blkcache.o
Signature · 1 line
2.19.0.605.g01d371f741-goog
#18 lore raw

PATCH 9/45 blk: Support block drivers in TPL

At present it is not possible to enable/disable block drivers in TPL. This is needed to provide sandbox support. Add a Kconfig option and adjust the Makefile.

---

 drivers/block/Kconfig  | 12 ++++++++++++
 drivers/block/Makefile |  2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)

Applied to u-boot-dm

#19 lore raw

PATCH 10/45 Kconfig: Convert CONFIG_RTC_MC146818 to Kconfig

In reply to Simon Glass

Move this option to Kconfig and tidy up the two boards which use it.

---

 configs/edison_defconfig     | 1 +
 configs/malta_defconfig      | 1 +
 drivers/rtc/Kconfig          | 8 ++++++++
 include/configs/edison.h     | 1 -
 include/configs/malta.h      | 1 -
 scripts/config_whitelist.txt | 1 -
 6 files changed, 10 insertions(+), 3 deletions(-)
configs/edison_defconfig +1 -0
index f0f3449464c..eb9f9a089f1 100644
@@ -33,6 +33,7 @@ CONFIG_CPU=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
 CONFIG_DM_PCI_COMPAT=y
+CONFIG_RTC_MC146818=y
 CONFIG_USB_DWC3_GADGET=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_MANUFACTURER="Intel"
configs/malta_defconfig +1 -0
index 585440584ee..8265daec8e7 100644
@@ -22,4 +22,5 @@ CONFIG_DEFAULT_DEVICE_TREE="mti,malta"
 CONFIG_ENV_IS_IN_FLASH=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_PCI=y
+CONFIG_RTC_MC146818=y
 CONFIG_SYS_NS16550=y
drivers/rtc/Kconfig +8 -0
index 54365092ec4..97cf7d84dfa 100644
@@ -68,4 +68,12 @@ config RTC_S35392A
 	help
 	  Enable s35392a driver which provides rtc get and set function.
 
+config RTC_MC146818
+	bool "Enable MC146818 driver"
+	help
+	  This is a widely used real-time clock chip originally by Motorola
+	  and now available from NXP. It includes a battery-backed real-time
+	  clock with a wide array of features and 50 bytes of general-purpose,
+	  battery-backed RAM. The driver supports access to the clock and RAM.
+
 endmenu
include/configs/edison.h +0 -1
index 476f5e38b4b..86c584d73dc 100644
@@ -48,6 +48,5 @@
 
 /* RTC */
 #define CONFIG_SYS_ISA_IO_BASE_ADDRESS	0
-#define CONFIG_RTC_MC146818
 
 #endif
include/configs/malta.h +0 -1
index ba3639d177e..520b9870601 100644
@@ -19,7 +19,6 @@
 #define CONFIG_PCNET_79C973
 #define PCNET_HAS_PROM
 
-#define CONFIG_RTC_MC146818
 #define CONFIG_SYS_ISA_IO_BASE_ADDRESS	0
 
 /*
scripts/config_whitelist.txt +0 -1
index 96d3f75750b..a588dd12a03 100644
@@ -1673,7 +1673,6 @@ CONFIG_RTC_IMXDI
 CONFIG_RTC_M41T11
 CONFIG_RTC_M41T62
 CONFIG_RTC_MC13XXX
-CONFIG_RTC_MC146818
 CONFIG_RTC_MCFRRTC
 CONFIG_RTC_MCP79411
 CONFIG_RTC_MXS
Signature · 1 line
2.19.0.605.g01d371f741-goog
#20 lore raw

PATCH 10/45 Kconfig: Convert CONFIG_RTC_MC146818 to Kconfig

Move this option to Kconfig and tidy up the two boards which use it.

---

 configs/edison_defconfig     | 1 +
 configs/malta_defconfig      | 1 +
 drivers/rtc/Kconfig          | 8 ++++++++
 include/configs/edison.h     | 1 -
 include/configs/malta.h      | 1 -
 scripts/config_whitelist.txt | 1 -
 6 files changed, 10 insertions(+), 3 deletions(-)

Applied to u-boot-dm

#21 lore raw

PATCH 11/45 rtc: Allow use of RTC in SPL and TPL

In reply to Simon Glass

Add Kconfig options so that the RTC can be used in SPL and TPL. This is helpful for accessing the contents of CMOS RAM, for example.

---

 drivers/rtc/Kconfig      | 18 ++++++++++++++++++
 drivers/rtc/Makefile     |  2 +-
 drivers/rtc/rtc-uclass.c |  1 +
 3 files changed, 20 insertions(+), 1 deletion(-)
drivers/rtc/Kconfig +18 -0
index 97cf7d84dfa..bcc01b135e5 100644
@@ -13,6 +13,24 @@ config DM_RTC
 	  drivers to perform the actual functions. See rtc.h for a
 	  description of the API.
 
+config SPL_DM_RTC
+	bool "Enable Driver Model for RTC drivers in SPL"
+	depends on SPL_DM
+	help
+	  Enable drver model for real-time-clock drivers. The RTC uclass
+	  then provides the rtc_get()/rtc_set() interface, delegating to
+	  drivers to perform the actual functions. See rtc.h for a
+	  description of the API.
+
+config TPL_DM_RTC
+	bool "Enable Driver Model for RTC drivers in TPL"
+	depends on TPL_DM
+	help
+	  Enable drver model for real-time-clock drivers. The RTC uclass
+	  then provides the rtc_get()/rtc_set() interface, delegating to
+	  drivers to perform the actual functions. See rtc.h for a
+	  description of the API.
+
 config RTC_PCF2127
 	bool "Enable PCF2127 driver"
 	depends on DM_RTC
drivers/rtc/Makefile +1 -1
index 513e3ffc079..1724602f1cb 100644
@@ -4,7 +4,7 @@
 # Wolfgang Denk, DENX Software Engineering, wd at denx.de.
 #ccflags-y += -DDEBUG
 
-obj-$(CONFIG_DM_RTC) += rtc-uclass.o
+obj-$(CONFIG_$(SPL_TPL_)DM_RTC) += rtc-uclass.o
 
 obj-$(CONFIG_RTC_AT91SAM9_RTT) += at91sam9_rtt.o
 obj-y += date.o
drivers/rtc/rtc-uclass.c +1 -0
index c676f0ff359..a0a238aedda 100644
@@ -122,4 +122,5 @@ int rtc_write32(struct udevice *dev, unsigned int reg, u32 value)
 UCLASS_DRIVER(rtc) = {
 	.name		= "rtc",
 	.id		= UCLASS_RTC,
+	.post_bind	= dm_scan_fdt_dev,
 };
Signature · 1 line
2.19.0.605.g01d371f741-goog
#22 lore raw

PATCH 11/45 rtc: Allow use of RTC in SPL and TPL

Add Kconfig options so that the RTC can be used in SPL and TPL. This is helpful for accessing the contents of CMOS RAM, for example.

---

 drivers/rtc/Kconfig      | 18 ++++++++++++++++++
 drivers/rtc/Makefile     |  2 +-
 drivers/rtc/rtc-uclass.c |  1 +
 3 files changed, 20 insertions(+), 1 deletion(-)

Applied to u-boot-dm

#23 lore raw

PATCH 11/45 rtc: Allow use of RTC in SPL and TPL

In reply to Simon Glass
Quoted 6 lines · Simon Glass

Add Kconfig options so that the RTC can be used in SPL and TPL. This is helpful for accessing the contents of CMOS RAM, for example.

---

Hello Simon,

with this patch x86_64 does not boot anymore:

$ qemu-system-x86_64 -bios u-boot.rom -nographic --enable-kvm --cpu host
### ERROR ### Please RESET the board ###

I am currently testing Bin's patch series:
https://patchwork.ozlabs.org/project/uboot/list/?series=70127
[U-Boot,1/4] x86: Specify -march=core2 to build 64-bit U-Boot proper

Quoted 40 lines
 drivers/rtc/Kconfig      | 18 ++++++++++++++++++
 drivers/rtc/Makefile     |  2 +-
 drivers/rtc/rtc-uclass.c |  1 +
 3 files changed, 20 insertions(+), 1 deletion(-)
drivers/rtc/Kconfig +18 -0
index 97cf7d84dfa..bcc01b135e5 100644
@@ -13,6 +13,24 @@ config DM_RTC
 	  drivers to perform the actual functions. See rtc.h for a
 	  description of the API.
 
+config SPL_DM_RTC
+	bool "Enable Driver Model for RTC drivers in SPL"
+	depends on SPL_DM
+	help
+	  Enable drver model for real-time-clock drivers. The RTC uclass
+	  then provides the rtc_get()/rtc_set() interface, delegating to
+	  drivers to perform the actual functions. See rtc.h for a
+	  description of the API.
+
+config TPL_DM_RTC
+	bool "Enable Driver Model for RTC drivers in TPL"
+	depends on TPL_DM
+	help
+	  Enable drver model for real-time-clock drivers. The RTC uclass
+	  then provides the rtc_get()/rtc_set() interface, delegating to
+	  drivers to perform the actual functions. See rtc.h for a
+	  description of the API.
+
 config RTC_PCF2127
 	bool "Enable PCF2127 driver"
 	depends on DM_RTC
drivers/rtc/Makefile +0 -0
index 513e3ffc079..1724602f1cb 100644

drivers/rtc/Makefile line 7

Quoted 5 lines
drivers/rtc/Makefile +1 -1
@@ -4,7 +4,7 @@
 # Wolfgang Denk, DENX Software Engineering, wd at denx.de.
 #ccflags-y += -DDEBUG
 
-obj-$(CONFIG_DM_RTC) += rtc-uclass.o
+obj-$(CONFIG_$(SPL_TPL_)DM_RTC) += rtc-uclass.o

This is the line to be reverted.

Best regards

Heinrich

Quoted 14 lines
drivers/rtc/Makefile +0 -0
 obj-$(CONFIG_RTC_AT91SAM9_RTT) += at91sam9_rtt.o
 obj-y += date.o
drivers/rtc/rtc-uclass.c +1 -0
index c676f0ff359..a0a238aedda 100644
@@ -122,4 +122,5 @@ int rtc_write32(struct udevice *dev, unsigned int reg, u32 value)
 UCLASS_DRIVER(rtc) = {
 	.name		= "rtc",
 	.id		= UCLASS_RTC,
+	.post_bind	= dm_scan_fdt_dev,
 };
#24 lore raw

PATCH 11/45 rtc: Allow use of RTC in SPL and TPL

Quoted 11 lines · Heinrich Schuchardt
Quoted 6 lines · Simon Glass

Add Kconfig options so that the RTC can be used in SPL and TPL. This is helpful for accessing the contents of CMOS RAM, for example.

---

Hello Simon,

Quoted 8 lines

with this patch x86_64 does not boot anymore:

$ qemu-system-x86_64 -bios u-boot.rom -nographic --enable-kvm --cpu host
### ERROR ### Please RESET the board ###

I am currently testing Bin's patch series:
https://patchwork.ozlabs.org/project/uboot/list/?series=70127
[U-Boot,1/4] x86: Specify -march=core2 to build 64-bit U-Boot proper

As a workaround for qemu-x86_defconfig I have sent a patch changing that single configuration file. But your patch may have broken more boards.

https://lists.denx.de/pipermail/u-boot/2018-October/344137.html
x86: qemu: enable CONFIG_SPL_DM_RTC

Regards

Heinrich

#25 lore raw

PATCH 11/45 rtc: Allow use of RTC in SPL and TPL

Hi Heinrich,

Quoted 17 lines · Heinrich Schuchardt
Quoted 15 lines · Heinrich Schuchardt
Quoted 6 lines · Simon Glass

Add Kconfig options so that the RTC can be used in SPL and TPL. This is helpful for accessing the contents of CMOS RAM, for example.

---

Hello Simon,

with this patch x86_64 does not boot anymore:

$ qemu-system-x86_64 -bios u-boot.rom -nographic --enable-kvm --cpu host
### ERROR ### Please RESET the board ###
Quoted 8 lines
Quoted 4 lines

I am currently testing Bin's patch series:
https://patchwork.ozlabs.org/project/uboot/list/?series=70127
[U-Boot,1/4] x86: Specify -march=core2 to build 64-bit U-Boot proper

As a workaround for qemu-x86_defconfig I have sent a patch changing that single configuration file. But your patch may have broken more boards.

Thanks for checking.

Quoted 2 lines

https://lists.denx.de/pipermail/u-boot/2018-October/344137.html
x86: qemu: enable CONFIG_SPL_DM_RTC

Simon, can you take a look at this? Whether I should take Heinrich's patch directly, or you will re-work the original RTC patch?

Regards,
Bin

#26 lore raw

PATCH 11/45 rtc: Allow use of RTC in SPL and TPL

Hi Bin,

Quoted 29 lines · Bin Meng

Hi Heinrich,

Quoted 17 lines · Heinrich Schuchardt
Quoted 15 lines · Heinrich Schuchardt
Quoted 6 lines · Simon Glass

Add Kconfig options so that the RTC can be used in SPL and TPL. This is helpful for accessing the contents of CMOS RAM, for example.

---

Hello Simon,

with this patch x86_64 does not boot anymore:

$ qemu-system-x86_64 -bios u-boot.rom -nographic --enable-kvm --cpu host
### ERROR ### Please RESET the board ###
Quoted 8 lines
Quoted 4 lines

I am currently testing Bin's patch series:
https://patchwork.ozlabs.org/project/uboot/list/?series=70127
[U-Boot,1/4] x86: Specify -march=core2 to build 64-bit U-Boot proper

As a workaround for qemu-x86_defconfig I have sent a patch changing that single configuration file. But your patch may have broken more boards.

Quoted 7 lines

Thanks for checking.

Quoted 2 lines

https://lists.denx.de/pipermail/u-boot/2018-October/344137.html
x86: qemu: enable CONFIG_SPL_DM_RTC

Simon, can you take a look at this? Whether I should take Heinrich's patch directly, or you will re-work the original RTC patch?

I think Heinrich's patch is good.

I don't believe any boards that use DM_RTC are using it in SPL. My reasoning is that this line would likely cause a build error for such boards, since they probably don't use DT:

+ .post_bind = dm_scan_fdt_dev,

Regards,
Simon

#27 lore raw

PATCH 11/45 rtc: Allow use of RTC in SPL and TPL

Hi Simon,

Quoted 35 lines · Simon Glass

Hi Bin,

Quoted 31 lines · Bin Meng

Hi Heinrich,

Quoted 17 lines · Heinrich Schuchardt
Quoted 15 lines · Heinrich Schuchardt
Quoted 6 lines · Simon Glass

Add Kconfig options so that the RTC can be used in SPL and TPL. This is helpful for accessing the contents of CMOS RAM, for example.

---

Hello Simon,

with this patch x86_64 does not boot anymore:

$ qemu-system-x86_64 -bios u-boot.rom -nographic --enable-kvm --cpu host
### ERROR ### Please RESET the board ###
Quoted 8 lines
Quoted 4 lines

I am currently testing Bin's patch series:
https://patchwork.ozlabs.org/project/uboot/list/?series=70127
[U-Boot,1/4] x86: Specify -march=core2 to build 64-bit U-Boot proper

As a workaround for qemu-x86_defconfig I have sent a patch changing that single configuration file. But your patch may have broken more boards.

Thanks for checking.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

https://lists.denx.de/pipermail/u-boot/2018-October/344137.html
x86: qemu: enable CONFIG_SPL_DM_RTC

Simon, can you take a look at this? Whether I should take Heinrich's patch directly, or you will re-work the original RTC patch?

I think Heinrich's patch is good.

Thanks for the confirmation. I will take Heinrich's patch then.

Quoted 6 lines

I don't believe any boards that use DM_RTC are using it in SPL. My reasoning is that this line would likely cause a build error for such boards, since they probably don't use DT:

+ .post_bind = dm_scan_fdt_dev,

Regards,
Bin

#28 lore raw

PATCH 12/45 fdt: Document the fact that dtc is now built

In reply to Simon Glass

This documentation is out of date now that U-Boot builds dtc automatically. Update it.

---

 doc/README.fdt-control | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
doc/README.fdt-control +5 -1
index 634a10616fc..88c04692f74 100644
@@ -56,7 +56,11 @@ In case you are wondering, OF stands for Open Firmware.
 Tools
 -----
 
-To use this feature you will need to get the device tree compiler here:
+To use this feature you will need to get the device tree compiler. This is
+provided by U-Boot automatically. If you have a system version of dtc
+(typically in the 'device-tree-compiler' package), it is currently not used.
+
+If you want to build your own dtc, it is kept here:
 
 	git://git.kernel.org/pub/scm/utils/dtc/dtc.git
 
Signature · 1 line
2.19.0.605.g01d371f741-goog
#29 lore raw

PATCH 12/45 fdt: Document the fact that dtc is now built

This documentation is out of date now that U-Boot builds dtc automatically. Update it.

---

 doc/README.fdt-control | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Applied to u-boot-dm

#30 lore raw

PATCH 13/45 doc: Update docs for device tree in SPL, TPL

In reply to Simon Glass

Make a few small updates to indicate that device tree can be used in SPL and TPL.

---

 doc/README.fdt-control      | 10 ++++++++++
 doc/driver-model/README.txt |  3 ++-
 2 files changed, 12 insertions(+), 1 deletion(-)
doc/README.fdt-control +10 -0
index 88c04692f74..d6ab7bf5706 100644
@@ -174,6 +174,16 @@ After board configuration is done, fdt supported u-boot can be build in two ways
     $ make DEVICE_TREE=<dts-file-name>
 
 
+Relocation, SPL and TPL
+-----------------------
+
+U-Boot can be divided into three phases: TPL, SPL and U-Boot proper.
+
+The full device tree is available to U-Boot proper, but normally only a subset
+(or none at all) is available to TPL and SPL. See 'Pre-Relocation Support' and
+'SPL Support' in doc/driver-model/README.txt for more details.
+
+
 Limitations
 -----------
 
doc/driver-model/README.txt +2 -1
index e949ff63bae..6085f927dea 100644
@@ -832,7 +832,8 @@ Pre-Relocation Support
 For pre-relocation we simply call the driver model init function. Only
 drivers marked with DM_FLAG_PRE_RELOC or the device tree
 'u-boot,dm-pre-reloc' flag are initialised prior to relocation. This helps
-to reduce the driver model overhead.
+to reduce the driver model overhead. This flag applies to SPL and TPL as
+well, if device tree is enabled there.
 
 It is possible to limit this to specific relocation steps, by using
 the more specialized 'u-boot,dm-spl' and 'u-boot,dm-tpl' flags
Signature · 1 line
2.19.0.605.g01d371f741-goog
#31 lore raw

PATCH 13/45 doc: Update docs for device tree in SPL, TPL

Make a few small updates to indicate that device tree can be used in SPL and TPL.

---

 doc/README.fdt-control      | 10 ++++++++++
 doc/driver-model/README.txt |  3 ++-
 2 files changed, 12 insertions(+), 1 deletion(-)

Applied to u-boot-dm

#32 lore raw

PATCH 14/45 fdt: Allow indicating a node is for U-Boot proper only

In reply to Simon Glass

At present it is not possible to specify that a node should be used before relocation (in U-Boot proper) without it also ending up in SPL and TPL device trees. Add a new "u-boot,dm-pre-proper" boolean property for this.

---

 doc/driver-model/README.txt | 4 +++-
 drivers/core/ofnode.c       | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)
doc/driver-model/README.txt +3 -1
index 6085f927dea..36541630a27 100644
@@ -837,7 +837,9 @@ well, if device tree is enabled there.
 
 It is possible to limit this to specific relocation steps, by using
 the more specialized 'u-boot,dm-spl' and 'u-boot,dm-tpl' flags
-in the devicetree.
+in the device tree node. For U-Boot proper you can use 'u-boot,dm-pre-proper'
+which means that it will be processed (and a driver bound) in U-Boot proper
+prior to relocation, but will not be available in SPL or TPL.
 
 Then post relocation we throw that away and re-init driver model again.
 For drivers which require some sort of continuity between pre- and
drivers/core/ofnode.c +2 -0
index 1e354803b06..825ffc27496 100644
@@ -695,6 +695,8 @@ bool ofnode_pre_reloc(ofnode node)
 {
 	if (ofnode_read_bool(node, "u-boot,dm-pre-reloc"))
 		return true;
+	if (ofnode_read_bool(node, "u-boot,dm-pre-proper"))
+		return true;
 
 #ifdef CONFIG_TPL_BUILD
 	if (ofnode_read_bool(node, "u-boot,dm-tpl"))
Signature · 1 line
2.19.0.605.g01d371f741-goog
#33 lore raw

PATCH 14/45 fdt: Allow indicating a node is for U-Boot proper only

At present it is not possible to specify that a node should be used before relocation (in U-Boot proper) without it also ending up in SPL and TPL device trees. Add a new "u-boot,dm-pre-proper" boolean property for this.

---

 doc/driver-model/README.txt | 4 +++-
 drivers/core/ofnode.c       | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

Applied to u-boot-dm

#34 lore raw

PATCH 15/45 tpm: Add support for SPL and TPL

In reply to Simon Glass

At present the tpm can only be used in U-Boot proper. Updated it to work in SPL and TPL also.

---

 drivers/tpm/Makefile |  2 +-
 lib/Kconfig          | 22 ++++++++++++++++++++++
 lib/Makefile         | 10 +++++++---
 3 files changed, 30 insertions(+), 4 deletions(-)
drivers/tpm/Makefile +1 -1
index af473ef662e..94c337b8ed3 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0+
 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
 
-obj-$(CONFIG_TPM) += tpm-uclass.o
+obj-$(CONFIG_$(SPL_TPL_)TPM) += tpm-uclass.o
 
 obj-$(CONFIG_TPM_ATMEL_TWI) += tpm_atmel_twi.o
 obj-$(CONFIG_TPM_TIS_INFINEON) += tpm_tis_infineon.o
lib/Kconfig +22 -0
index 622f3c26c33..b711d62d32f 100644
@@ -185,6 +185,28 @@ config TPM
 	  for the low-level TPM interface, but only one TPM is supported at
 	  a time by the TPM library.
 
+config SPL_TPM
+	bool "Trusted Platform Module (TPM) Support in SPL"
+	depends on SPL_DM
+	help
+	  This enables support for TPMs which can be used to provide security
+	  features for your board. The TPM can be connected via LPC or I2C
+	  and a sandbox TPM is provided for testing purposes. Use the 'tpm'
+	  command to interactive the TPM. Driver model support is provided
+	  for the low-level TPM interface, but only one TPM is supported at
+	  a time by the TPM library.
+
+config TPL_TPM
+	bool "Trusted Platform Module (TPM) Support in TPL"
+	depends on TPL_DM
+	help
+	  This enables support for TPMs which can be used to provide security
+	  features for your board. The TPM can be connected via LPC or I2C
+	  and a sandbox TPM is provided for testing purposes. Use the 'tpm'
+	  command to interactive the TPM. Driver model support is provided
+	  for the low-level TPM interface, but only one TPM is supported at
+	  a time by the TPM library.
+
 endmenu
 
 menu "Android Verified Boot"
lib/Makefile +7 -3
index f1696448506..fb6944128aa 100644
@@ -45,14 +45,18 @@ obj-$(CONFIG_PHYSMEM) += physmem.o
 obj-y += qsort.o
 obj-y += rc4.o
 obj-$(CONFIG_SUPPORT_EMMC_RPMB) += sha256.o
-obj-$(CONFIG_TPM) += tpm-common.o
-obj-$(CONFIG_TPM_V1) += tpm-v1.o
-obj-$(CONFIG_TPM_V2) += tpm-v2.o
 obj-$(CONFIG_RBTREE)	+= rbtree.o
 obj-$(CONFIG_BITREVERSE) += bitrev.o
 obj-y += list_sort.o
 endif
 
+obj-$(CONFIG_$(SPL_TPL_)TPM) += tpm-common.o
+ifeq ($(CONFIG_$(SPL_TPL_)TPM),y)
+obj-y += crc8.o
+obj-$(CONFIG_TPM_V1) += tpm-v1.o
+obj-$(CONFIG_TPM_V2) += tpm-v2.o
+endif
+
 obj-$(CONFIG_RSA) += rsa/
 obj-$(CONFIG_SHA1) += sha1.o
 obj-$(CONFIG_SHA256) += sha256.o
Signature · 1 line
2.19.0.605.g01d371f741-goog
#35 lore raw

PATCH 15/45 tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work in SPL and TPL also.

---

 drivers/tpm/Makefile |  2 +-
 lib/Kconfig          | 22 ++++++++++++++++++++++
 lib/Makefile         | 10 +++++++---
 3 files changed, 30 insertions(+), 4 deletions(-)

Applied to u-boot-dm

#36 lore raw

PATCH 16/45 serial: Allow serial to be absent in TPL

In reply to Simon Glass

At present this option applies to SPL, but it should be available in TPL also, and separately. Change to using CONFIG_IS_ENABLED(), add a new Kconfig option and fix up hang().

---

 drivers/serial/Kconfig         | 10 ++++++++++
 drivers/serial/serial-uclass.c |  4 ++++
 lib/hang.c                     |  5 +++--
 3 files changed, 17 insertions(+), 2 deletions(-)
drivers/serial/Kconfig +10 -0
index 83f8c94d028..597db4b9cbb 100644
@@ -53,6 +53,16 @@ config SPL_SERIAL_PRESENT
 	  This option enables the full UART in SPL, so if is it disabled,
 	  the full UART driver will be omitted, thus saving space.
 
+config TPL_SERIAL_PRESENT
+	bool "Provide a serial driver in TPL"
+	depends on DM_SERIAL
+	default y
+	help
+	  In very space-constrained devices even the full UART driver is too
+	  large. In this case the debug UART can still be used in some cases.
+	  This option enables the full UART in TPL, so if is it disabled,
+	  the full UART driver will be omitted, thus saving space.
+
 # Logic to allow us to use the imply keyword to set what the default port
 # should be.  The default is otherwise 1.
 config CONS_INDEX_0
drivers/serial/serial-uclass.c +4 -0
index ffdcae09318..e50f0aa8510 100644
@@ -26,6 +26,7 @@ static const unsigned long baudrate_table[] = CONFIG_SYS_BAUDRATE_TABLE;
 #error "Serial is required before relocation - define CONFIG_$(SPL_)SYS_MALLOC_F_LEN to make this work"
 #endif
 
+#if CONFIG_IS_ENABLED(SERIAL_PRESENT)
 static int serial_check_stdout(const void *blob, struct udevice **devp)
 {
 	int node;
@@ -150,12 +151,15 @@ static void serial_find_console_or_panic(void)
 	panic_str("No serial driver found");
 #endif
 }
+#endif /* CONFIG_SERIAL_PRESENT */
 
 /* Called prior to relocation */
 int serial_init(void)
 {
+#if CONFIG_IS_ENABLED(SERIAL_PRESENT)
 	serial_find_console_or_panic();
 	gd->flags |= GD_FLG_SERIAL_READY;
+#endif
 
 	return 0;
 }
lib/hang.c +3 -2
index bf56f4c662a..c5a78694be6 100644
@@ -20,8 +20,9 @@
  */
 void hang(void)
 {
-#if !defined(CONFIG_SPL_BUILD) || (defined(CONFIG_SPL_LIBCOMMON_SUPPORT) && \
-		defined(CONFIG_SPL_SERIAL_SUPPORT))
+#if !defined(CONFIG_SPL_BUILD) || \
+		(CONFIG_IS_ENABLED(LIBCOMMON_SUPPORT) && \
+		 CONFIG_IS_ENABLED(SERIAL_SUPPORT))
 	puts("### ERROR ### Please RESET the board ###\n");
 #endif
 	bootstage_error(BOOTSTAGE_ID_NEED_RESET);
Signature · 1 line
2.19.0.605.g01d371f741-goog
#37 lore raw

PATCH 16/45 serial: Allow serial to be absent in TPL

At present this option applies to SPL, but it should be available in TPL also, and separately. Change to using CONFIG_IS_ENABLED(), add a new Kconfig option and fix up hang().

---

 drivers/serial/Kconfig         | 10 ++++++++++
 drivers/serial/serial-uclass.c |  4 ++++
 lib/hang.c                     |  5 +++--
 3 files changed, 17 insertions(+), 2 deletions(-)

Applied to u-boot-dm

#38 lore raw

PATCH 17/45 fdt: Allow libfdt in TPL

In reply to Simon Glass

In some cases (e.g. sandbox with verified boot) it is useful to support libfdt in TPL. Update the Kconfig to handle this.

---

 lib/Kconfig | 10 ++++++++++
 1 file changed, 10 insertions(+)
lib/Kconfig +10 -0
index b711d62d32f..ccab426e121 100644
@@ -353,6 +353,16 @@ config SPL_OF_LIBFDT
 	  particular compatible nodes. The library operates on a flattened
 	  version of the device tree.
 
+config TPL_OF_LIBFDT
+	bool "Enable the FDT library for TPL"
+	default y if TPL_OF_CONTROL
+	help
+	  This enables the FDT library (libfdt). It provides functions for
+	  accessing binary device tree images in memory, such as adding and
+	  removing nodes and properties, scanning through the tree and finding
+	  particular compatible nodes. The library operates on a flattened
+	  version of the device tree.
+
 config FDT_FIXUP_PARTITIONS
 	bool "overwrite MTD partitions in DTS through defined in 'mtdparts'"
 	depends on OF_LIBFDT
Signature · 1 line
2.19.0.605.g01d371f741-goog
#39 lore raw

PATCH 17/45 fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support libfdt in TPL. Update the Kconfig to handle this.

---

 lib/Kconfig | 10 ++++++++++
 1 file changed, 10 insertions(+)

Applied to u-boot-dm

#40 lore raw

PATCH 18/45 cros: Update cros_ec code to use struct udevice

In reply to Simon Glass

At present we pass around a private pointer to specify the cros_ec device. With driver model it makes more sense to pass the device. Update the code to do this.

---

 cmd/cros_ec.c                  |  24 +++---
 drivers/misc/cros_ec.c         | 147 +++++++++++++++++----------------
 drivers/misc/cros_ec_sandbox.c |   4 +-
 drivers/tpm/tpm-uclass.c       |   6 +-
 include/cros_ec.h              |  66 +++++++--------
 5 files changed, 122 insertions(+), 125 deletions(-)
cmd/cros_ec.c +12 -12
index 60c87838fdf..fb369a4e329 100644
@@ -49,7 +49,7 @@ static int cros_ec_decode_region(int argc, char * const argv[])
  * @return 0 for ok, 1 for a usage error or -ve for ec command error
  *	(negative EC_RES_...)
  */
-static int do_read_write(struct cros_ec_dev *dev, int is_write, int argc,
+static int do_read_write(struct udevice *dev, int is_write, int argc,
 			 char * const argv[])
 {
 	uint32_t offset, size = -1U, region_size;
@@ -94,8 +94,7 @@ static int do_read_write(struct cros_ec_dev *dev, int is_write, int argc,
 
 static int do_cros_ec(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
-	struct cros_ec_dev *dev;
-	struct udevice *udev;
+	struct udevice *dev;
 	const char *cmd;
 	int ret = 0;
 
@@ -105,10 +104,10 @@ static int do_cros_ec(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	cmd = argv[1];
 	if (0 == strcmp("init", cmd)) {
 		/* Remove any existing device */
-		ret = uclass_find_device(UCLASS_CROS_EC, 0, &udev);
+		ret = uclass_find_device(UCLASS_CROS_EC, 0, &dev);
 		if (!ret)
-			device_remove(udev, DM_REMOVE_NORMAL);
-		ret = uclass_get_device(UCLASS_CROS_EC, 0, &udev);
+			device_remove(dev, DM_REMOVE_NORMAL);
+		ret = uclass_get_device(UCLASS_CROS_EC, 0, &dev);
 		if (ret) {
 			printf("Could not init cros_ec device (err %d)\n", ret);
 			return 1;
@@ -116,12 +115,11 @@ static int do_cros_ec(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		return 0;
 	}
 
-	ret = uclass_get_device(UCLASS_CROS_EC, 0, &udev);
+	ret = uclass_get_device(UCLASS_CROS_EC, 0, &dev);
 	if (ret) {
 		printf("Cannot get cros-ec device (err=%d)\n", ret);
 		return 1;
 	}
-	dev = dev_get_uclass_priv(udev);
 	if (0 == strcmp("id", cmd)) {
 		char id[MSG_BYTES];
 
@@ -262,7 +260,8 @@ static int do_cros_ec(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		unsigned long result;
 
 		if (argc <= 2) {
-			ret = cros_ec_read_vbnvcontext(dev, block);
+			ret = cros_ec_read_nvdata(dev, block,
+						  EC_VBNV_BLOCK_SIZE);
 			if (!ret) {
 				printf("vbnv_block: ");
 				for (i = 0; i < EC_VBNV_BLOCK_SIZE; i++)
@@ -288,7 +287,8 @@ static int do_cros_ec(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 				strict_strtoul(buf, 16, &result);
 				block[i] = result;
 			}
-			ret = cros_ec_write_vbnvcontext(dev, block);
+			ret = cros_ec_write_nvdata(dev, block,
+						   EC_VBNV_BLOCK_SIZE);
 		}
 		if (ret) {
 			debug("%s: Could not %s VbNvContext\n", __func__,
@@ -336,9 +336,9 @@ static int do_cros_ec(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 			state = simple_strtoul(argv[3], &endp, 10);
 			if (*argv[3] == 0 || *endp != 0)
 				return CMD_RET_USAGE;
-			ret = cros_ec_set_ldo(udev, index, state);
+			ret = cros_ec_set_ldo(dev, index, state);
 		} else {
-			ret = cros_ec_get_ldo(udev, index, &state);
+			ret = cros_ec_get_ldo(dev, index, &state);
 			if (!ret) {
 				printf("LDO%d: %s\n", index,
 				       state == EC_LDO_STATE_ON ?
drivers/misc/cros_ec.c +74 -73

480 lines not on this page · raw message

drivers/misc/cros_ec_sandbox.c +2 -2
index 47a9d26c3c7..dedad9b8573 100644
@@ -491,9 +491,9 @@ int cros_ec_sandbox_packet(struct udevice *udev, int out_bytes, int in_bytes)
 	return in_bytes;
 }
 
-void cros_ec_check_keyboard(struct cros_ec_dev *dev)
+void cros_ec_check_keyboard(struct udevice *dev)
 {
-	struct ec_state *ec = dev_get_priv(dev->dev);
+	struct ec_state *ec = dev_get_priv(dev);
 	ulong start;
 
 	printf("Press keys for EC to detect on reset (ESC=recovery)...");
drivers/tpm/tpm-uclass.c +3 -3
index c83f53ab86b..80fa0783d58 100644
@@ -126,8 +126,8 @@ int tpm_xfer(struct udevice *dev, const uint8_t *sendbuf, size_t send_size,
 }
 
 UCLASS_DRIVER(tpm) = {
-	.id             = UCLASS_TPM,
-	.name           = "tpm",
-	.flags          = DM_UC_FLAG_SEQ_ALIAS,
+	.id		= UCLASS_TPM,
+	.name		= "tpm",
+	.flags		= DM_UC_FLAG_SEQ_ALIAS,
 	.per_device_auto_alloc_size	= sizeof(struct tpm_chip_priv),
 };
include/cros_ec.h +31 -35

187 lines not on this page · raw message

Signature · 1 line
2.19.0.605.g01d371f741-goog
#41 lore raw

PATCH 18/45 cros: Update cros_ec code to use struct udevice

At present we pass around a private pointer to specify the cros_ec device. With driver model it makes more sense to pass the device. Update the code to do this.

---

 cmd/cros_ec.c                  |  24 +++---
 drivers/misc/cros_ec.c         | 147 +++++++++++++++++----------------
 drivers/misc/cros_ec_sandbox.c |   4 +-
 drivers/tpm/tpm-uclass.c       |   6 +-
 include/cros_ec.h              |  66 +++++++--------
 5 files changed, 122 insertions(+), 125 deletions(-)

Applied to u-boot-dm

#42 lore raw

PATCH 19/45 cros: Adjust board_get_cros_ec_dev() to return a udevice

In reply to Simon Glass

Rather than returning what is effectively an internal data structure, return the cros EC device itself.

---

 common/cros_ec.c  | 4 ++--
 include/cros_ec.h | 4 +---
 2 files changed, 3 insertions(+), 5 deletions(-)
common/cros_ec.c +2 -2
index 1a0caf80dde..4ca15e19d5f 100644
@@ -13,7 +13,7 @@
 #include <dm.h>
 #include <errno.h>
 
-struct cros_ec_dev *board_get_cros_ec_dev(void)
+struct udevice *board_get_cros_ec_dev(void)
 {
 	struct udevice *dev;
 	int ret;
@@ -23,7 +23,7 @@ struct cros_ec_dev *board_get_cros_ec_dev(void)
 		debug("%s: Error %d\n", __func__, ret);
 		return NULL;
 	}
-	return dev_get_uclass_priv(dev);
+	return dev;
 }
 
 int cros_ec_get_error(void)
include/cros_ec.h +1 -3
index afd99aae946..5576bcf32ee 100644
@@ -208,11 +208,9 @@ int cros_ec_flash_update_rw(struct udevice *dev, const uint8_t  *image,
 /**
  * Return a pointer to the board's CROS-EC device
  *
- * This should be implemented by board files.
- *
  * @return pointer to CROS-EC device, or NULL if none is available
  */
-struct cros_ec_dev *board_get_cros_ec_dev(void);
+struct udevice *board_get_cros_ec_dev(void);
 
 struct dm_cros_ec_ops {
 	int (*check_version)(struct udevice *dev);
Signature · 1 line
2.19.0.605.g01d371f741-goog
#43 lore raw

PATCH 19/45 cros: Adjust board_get_cros_ec_dev() to return a udevice

Rather than returning what is effectively an internal data structure, return the cros EC device itself.

---

 common/cros_ec.c  | 4 ++--
 include/cros_ec.h | 4 +---
 2 files changed, 3 insertions(+), 5 deletions(-)

Applied to u-boot-dm

#44 lore raw

PATCH 20/45 dm: spi: Add logging of some return values

In reply to Simon Glass

When SPI flash operations fail it is helpful to be able to see the error codes and where they are generated. Add logging to capture this information for read operations.

---

 drivers/mtd/spi/sf-uclass.c | 6 +++---
 drivers/mtd/spi/sf_probe.c  | 2 +-
 drivers/mtd/spi/spi_flash.c | 8 ++++----
 drivers/spi/spi-uclass.c    | 6 +++---
 4 files changed, 11 insertions(+), 11 deletions(-)
drivers/mtd/spi/sf-uclass.c +3 -3
index 3858f77a6dd..662525f016f 100644
@@ -14,18 +14,18 @@ DECLARE_GLOBAL_DATA_PTR;
 
 int spi_flash_read_dm(struct udevice *dev, u32 offset, size_t len, void *buf)
 {
-	return sf_get_ops(dev)->read(dev, offset, len, buf);
+	return log_ret(sf_get_ops(dev)->read(dev, offset, len, buf));
 }
 
 int spi_flash_write_dm(struct udevice *dev, u32 offset, size_t len,
 		       const void *buf)
 {
-	return sf_get_ops(dev)->write(dev, offset, len, buf);
+	return log_ret(sf_get_ops(dev)->write(dev, offset, len, buf));
 }
 
 int spi_flash_erase_dm(struct udevice *dev, u32 offset, size_t len)
 {
-	return sf_get_ops(dev)->erase(dev, offset, len);
+	return log_ret(sf_get_ops(dev)->erase(dev, offset, len));
 }
 
 /*
drivers/mtd/spi/sf_probe.c +1 -1
index 42c7cdedf6f..94fde2ae7a3 100644
@@ -97,7 +97,7 @@ static int spi_flash_std_read(struct udevice *dev, u32 offset, size_t len,
 {
 	struct spi_flash *flash = dev_get_uclass_priv(dev);
 
-	return spi_flash_cmd_read_ops(flash, offset, len, buf);
+	return log_ret(spi_flash_cmd_read_ops(flash, offset, len, buf));
 }
 
 static int spi_flash_std_write(struct udevice *dev, u32 offset, size_t len,
drivers/mtd/spi/spi_flash.c +4 -4
index 7113c855fe4..92300603644 100644
@@ -471,14 +471,14 @@ int spi_flash_cmd_read_ops(struct spi_flash *flash, u32 offset,
 	u8 cmdsz;
 	u32 remain_len, read_len, read_addr;
 	int bank_sel = 0;
-	int ret = -1;
+	int ret = 0;
 
 	/* Handle memory-mapped SPI */
 	if (flash->memory_map) {
 		ret = spi_claim_bus(spi);
 		if (ret) {
 			debug("SF: unable to claim SPI bus\n");
-			return ret;
+			return log_ret(ret);
 		}
 		spi_xfer(spi, 0, NULL, NULL, SPI_XFER_MMAP);
 		spi_flash_copy_mmap(data, flash->memory_map + offset, len);
@@ -501,7 +501,7 @@ int spi_flash_cmd_read_ops(struct spi_flash *flash, u32 offset,
 #ifdef CONFIG_SPI_FLASH_BAR
 		ret = write_bar(flash, read_addr);
 		if (ret < 0)
-			return ret;
+			return log_ret(ret);
 		bank_sel = flash->bank_curr;
 #endif
 		remain_len = ((SPI_FLASH_16MB_BOUN << flash->shift) *
@@ -531,7 +531,7 @@ int spi_flash_cmd_read_ops(struct spi_flash *flash, u32 offset,
 	ret = clean_bar(flash);
 #endif
 
-	return ret;
+	return log_ret(ret);
 }
 
 #ifdef CONFIG_SPI_FLASH_SST
drivers/spi/spi-uclass.c +3 -3
index c517d066f69..b84255bd274 100644
@@ -63,11 +63,11 @@ int dm_spi_claim_bus(struct udevice *dev)
 		int ret = spi_set_speed_mode(bus, speed, slave->mode);
 
 		if (ret)
-			return ret;
+			return log_ret(ret);
 		slave->speed = speed;
 	}
 
-	return ops->claim_bus ? ops->claim_bus(dev) : 0;
+	return log_ret(ops->claim_bus ? ops->claim_bus(dev) : 0);
 }
 
 void dm_spi_release_bus(struct udevice *dev)
@@ -92,7 +92,7 @@ int dm_spi_xfer(struct udevice *dev, unsigned int bitlen,
 
 int spi_claim_bus(struct spi_slave *slave)
 {
-	return dm_spi_claim_bus(slave->dev);
+	return log_ret(dm_spi_claim_bus(slave->dev));
 }
 
 void spi_release_bus(struct spi_slave *slave)
Signature · 1 line
2.19.0.605.g01d371f741-goog
#45 lore raw

PATCH 20/45 dm: spi: Add logging of some return values

When SPI flash operations fail it is helpful to be able to see the error codes and where they are generated. Add logging to capture this information for read operations.

---

 drivers/mtd/spi/sf-uclass.c | 6 +++---
 drivers/mtd/spi/sf_probe.c  | 2 +-
 drivers/mtd/spi/spi_flash.c | 8 ++++----
 drivers/spi/spi-uclass.c    | 6 +++---
 4 files changed, 11 insertions(+), 11 deletions(-)

Applied to u-boot-dm

#46 lore raw

PATCH 21/45 fdt: Remove fdtdec_decode_region() function

In reply to Simon Glass

This function is not used in U-Boot now. Remove it along with its 'memory' version.

---

 include/fdtdec.h | 45 --------------------------
 lib/fdtdec.c     | 83 ------------------------------------------------
 2 files changed, 128 deletions(-)
include/fdtdec.h +0 -45
index 83be06403d8..c26df50543a 100644
@@ -802,23 +802,6 @@ int fdtdec_get_byte_array(const void *blob, int node, const char *prop_name,
 const u8 *fdtdec_locate_byte_array(const void *blob, int node,
 			     const char *prop_name, int count);
 
-/**
- * Look up a property in a node which contains a memory region address and
- * size. Then return a pointer to this address.
- *
- * The property must hold one address with a length. This is only tested on
- * 32-bit machines.
- *
- * @param blob		FDT blob
- * @param node		node to examine
- * @param prop_name	name of property to find
- * @param basep		Returns base address of region
- * @param size		Returns size of region
- * @return 0 if ok, -1 on error (property not found)
- */
-int fdtdec_decode_region(const void *blob, int node, const char *prop_name,
-			 fdt_addr_t *basep, fdt_size_t *sizep);
-
 /**
  * Obtain an indexed resource from a device property.
  *
@@ -849,34 +832,6 @@ int fdt_get_named_resource(const void *fdt, int node, const char *property,
 			   const char *prop_names, const char *name,
 			   struct fdt_resource *res);
 
-/**
- * Decode a named region within a memory bank of a given type.
- *
- * This function handles selection of a memory region. The region is
- * specified as an offset/size within a particular type of memory.
- *
- * The properties used are:
- *
- *	<mem_type>-memory<suffix> for the name of the memory bank
- *	<mem_type>-offset<suffix> for the offset in that bank
- *
- * The property value must have an offset and a size. The function checks
- * that the region is entirely within the memory bank.5
- *
- * @param blob		FDT blob
- * @param node		Node containing the properties (-1 for /config)
- * @param mem_type	Type of memory to use, which is a name, such as
- *			"u-boot" or "kernel".
- * @param suffix	String to append to the memory/offset
- *			property names
- * @param basep		Returns base of region
- * @param sizep		Returns size of region
- * @return 0 if OK, -ive on error
- */
-int fdtdec_decode_memory_region(const void *blob, int node,
-				const char *mem_type, const char *suffix,
-				fdt_addr_t *basep, fdt_size_t *sizep);
-
 /* Display timings from linux include/video/display_timing.h */
 enum display_flags {
 	DISPLAY_FLAGS_HSYNC_LOW		= 1 << 0,
lib/fdtdec.c +0 -83

95 lines not on this page · raw message

Signature · 1 line
2.19.0.605.g01d371f741-goog
#47 lore raw

PATCH 21/45 fdt: Remove fdtdec_decode_region() function

This function is not used in U-Boot now. Remove it along with its 'memory' version.

---

 include/fdtdec.h | 45 --------------------------
 lib/fdtdec.c     | 83 ------------------------------------------------
 2 files changed, 128 deletions(-)

Applied to u-boot-dm

#48 lore raw

PATCH 22/45 video: Adjust video_clear() to return an error

In reply to Simon Glass

All driver-model operation should return an error code. Adjust this function to do so also.

---

 drivers/video/video-uclass.c | 4 +++-
 include/video.h              | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/video/video-uclass.c +3 -1
index fea0886c415..44dfa71b6f4 100644
@@ -86,7 +86,7 @@ int video_reserve(ulong *addrp)
 	return 0;
 }
 
-void video_clear(struct udevice *dev)
+int video_clear(struct udevice *dev)
 {
 	struct video_priv *priv = dev_get_uclass_priv(dev);
 
@@ -111,6 +111,8 @@ void video_clear(struct udevice *dev)
 		memset(priv->fb, priv->colour_bg, priv->fb_size);
 		break;
 	}
+
+	return 0;
 }
 
 void video_set_default_colors(struct video_priv *priv)
include/video.h +2 -1
index cd5558f86eb..ab416c1cfac 100644
@@ -120,8 +120,9 @@ int video_reserve(ulong *addrp);
  * video_clear() - Clear a device's frame buffer to background color.
  *
  * @dev:	Device to clear
+ * @return 0
  */
-void video_clear(struct udevice *dev);
+int video_clear(struct udevice *dev);
 
 /**
  * video_sync() - Sync a device's frame buffer with its hardware
Signature · 1 line
2.19.0.605.g01d371f741-goog
#51 lore raw

PATCH 23/45 tpm: Use livetree and allow children

In reply to Simon Glass

Adjust the TPM drivers to use livetree (only one does not). Also, sometimes TPMs can have child devices if they provide a service to the system (such as storing secure data), so permit that.

---

 drivers/misc/cros_ec.c    | 6 +++---
 drivers/tpm/tpm-uclass.c  | 1 +
 drivers/tpm/tpm_tis_lpc.c | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)
drivers/misc/cros_ec.c +3 -3
index a92806c46c9..5ccf8ad359b 100644
@@ -263,9 +263,9 @@ static int send_command(struct cros_ec_dev *dev, uint8_t cmd, int cmd_version,
  * @param din_len       Maximum size of response in bytes
  * @return number of bytes in response, or -ve on error
  */
-static int ec_command_inptr(struct udevice *dev, uint8_t cmd,
-			    int cmd_version, const void *dout, int dout_len,
-			    uint8_t **dinp, int din_len)
+static int ec_command_inptr(struct udevice *dev, uint8_t cmd, int cmd_version,
+			    const void *dout, int dout_len, uint8_t **dinp,
+			    int din_len)
 {
 	struct cros_ec_dev *cdev = dev_get_uclass_priv(dev);
 	uint8_t *din = NULL;
drivers/tpm/tpm-uclass.c +1 -0
index 80fa0783d58..455f82b1c2b 100644
@@ -129,5 +129,6 @@ UCLASS_DRIVER(tpm) = {
 	.id		= UCLASS_TPM,
 	.name		= "tpm",
 	.flags		= DM_UC_FLAG_SEQ_ALIAS,
+	.post_bind	= dm_scan_fdt_dev,
 	.per_device_auto_alloc_size	= sizeof(struct tpm_chip_priv),
 };
drivers/tpm/tpm_tis_lpc.c +1 -1
index 7664bb1a605..e993fd9f833 100644
@@ -164,7 +164,7 @@ static int tpm_tis_lpc_probe(struct udevice *dev)
 	u32 didvid;
 	ulong chip_type = dev_get_driver_data(dev);
 
-	addr = devfdt_get_addr(dev);
+	addr = dev_read_addr(dev);
 	if (addr == FDT_ADDR_T_NONE)
 		return -EINVAL;
 	priv->regs = map_sysmem(addr, 0);
Signature · 1 line
2.19.0.605.g01d371f741-goog
#52 lore raw

PATCH 23/45 tpm: Use livetree and allow children

Adjust the TPM drivers to use livetree (only one does not). Also, sometimes TPMs can have child devices if they provide a service to the system (such as storing secure data), so permit that.

---

 drivers/misc/cros_ec.c    | 6 +++---
 drivers/tpm/tpm-uclass.c  | 1 +
 drivers/tpm/tpm_tis_lpc.c | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

Applied to u-boot-dm

#53 lore raw

PATCH 24/45 tpm: Tidy up logging in tpm-common.c

In reply to Simon Glass

At present this file uses logging but it should use the new macros. Update it and add a log message for an error.

---

 lib/tpm-common.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
lib/tpm-common.c +7 -3
index 43b530865a0..a440639cec3 100644
@@ -4,6 +4,8 @@
  * Coypright (c) 2013 Guntermann & Drunck GmbH
  */
 
+#define LOG_CATEGORY UCLASS_TPM
+
 #include <common.h>
 #include <dm.h>
 #include <asm/unaligned.h>
@@ -110,6 +112,8 @@ int unpack_byte_string(const u8 *str, size_t size, const char *format, ...)
 
 		if (offset + length > size) {
 			va_end(args);
+			log_err("Failed to read: size=%d, offset=%x, len=%x\n",
+				size, offset, length);
 			return -1;
 		}
 
@@ -176,10 +180,10 @@ u32 tpm_sendrecv_command(const void *command, void *response, size_t *size_ptr)
 
 	ret = tpm_return_code(response);
 
-	log(LOGC_NONE, LOGL_DEBUG, "TPM response [ret:%d]: ", ret);
+	log_debug("TPM response [ret:%d]: ", ret);
 	for (i = 0; i < response_length; i++)
-		log(LOGC_NONE, LOGL_DEBUG, "%02x ", ((u8 *)response)[i]);
-	log(LOGC_NONE, LOGL_DEBUG, "\n");
+		log_debug("%02x ", ((u8 *)response)[i]);
+	log_debug("\n");
 
 	return ret;
 }
Signature · 1 line
2.19.0.605.g01d371f741-goog
#54 lore raw

PATCH 24/45 tpm: Tidy up logging in tpm-common.c

At present this file uses logging but it should use the new macros. Update it and add a log message for an error.

---

 lib/tpm-common.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Applied to u-boot-dm

#55 lore raw

PATCH 25/45 tpm: Add a few new commands for v1

In reply to Simon Glass

These are needed for the 2018 version of Chromium OS vboot. Add an implementation for TPM v1, with v2 to come later.

---

 cmd/tpm_test.c   | 15 -----------
 include/tpm-v1.h | 28 ++++++++++++++++++++
 lib/tpm-v1.c     | 68 +++++++++++++++++++++++++++++++++++++++++++++---
 3 files changed, 93 insertions(+), 18 deletions(-)
cmd/tpm_test.c +0 -15
index 35f3c96e3de..f21ad5d3cf9 100644
@@ -62,14 +62,6 @@ static uint32_t tpm_get_flags(uint8_t *disable, uint8_t *deactivated,
 	return 0;
 }
 
-static uint32_t tpm_set_global_lock(void)
-{
-	uint32_t x;
-
-	debug("TPM: Set global lock\n");
-	return tpm_nv_write_value(INDEX0, (uint8_t *)&x, 0);
-}
-
 static uint32_t tpm_nv_write_value_lock(uint32_t index)
 {
 	debug("TPM: Write lock 0x%x\n", index);
@@ -77,13 +69,6 @@ static uint32_t tpm_nv_write_value_lock(uint32_t index)
 	return tpm_nv_write_value(index, NULL, 0);
 }
 
-static uint32_t tpm_nv_set_locked(void)
-{
-	debug("TPM: Set NV locked\n");
-
-	return tpm_nv_define_space(TPM_NV_INDEX_LOCK, 0, 0);
-}
-
 static int tpm_is_owned(void)
 {
 	uint8_t response[TPM_PUBEK_SIZE];
include/tpm-v1.h +28 -0
index f9ffbb26561..be2eca946fb 100644
@@ -525,4 +525,32 @@ u32 tpm_find_key_sha1(const u8 auth[20], const u8 pubkey_digest[20],
  */
 u32 tpm_get_random(void *data, u32 count);
 
+/**
+ * tpm_finalise_physical_presence() - Finalise physical presence
+ *
+ * @return return code of the operation (0 = success)
+ */
+u32 tpm_finalise_physical_presence(void);
+
+/**
+ * tpm_nv_set_locked() - lock the non-volatile space
+ *
+ * @return return code of the operation (0 = success)
+ */
+u32 tpm_nv_set_locked(void);
+
+/**
+ * tpm_set_global_lock() - set the global lock
+ *
+ * @return return code of the operation (0 = success)
+ */
+u32 tpm_set_global_lock(void);
+
+/**
+ * tpm_resume() - start up the TPM from resume (after suspend)
+ *
+ * @return return code of the operation (0 = success)
+ */
+u32 tpm_resume(void);
+
 #endif /* __TPM_V1_H */
lib/tpm-v1.c +65 -3

114 lines not on this page · raw message

Signature · 1 line
2.19.0.605.g01d371f741-goog
#56 lore raw

PATCH 25/45 tpm: Add a few new commands for v1

These are needed for the 2018 version of Chromium OS vboot. Add an implementation for TPM v1, with v2 to come later.

---

 cmd/tpm_test.c   | 15 -----------
 include/tpm-v1.h | 28 ++++++++++++++++++++
 lib/tpm-v1.c     | 68 +++++++++++++++++++++++++++++++++++++++++++++---
 3 files changed, 93 insertions(+), 18 deletions(-)

Applied to u-boot-dm

#57 lore raw

PATCH 26/45 binman: Move to three-digit test-file numbers

In reply to Simon Glass

We now have 99 tests. Before adding any more, rename everything to three digits. This helps to preserve the ordering of tests and makes it easier to find things.

---

 tools/binman/entry_test.py                    |   2 +-
 tools/binman/fdt_test.py                      |   4 +-
 tools/binman/ftest.py                         | 224 +++++++++---------
 .../test/{01_invalid.dts => 001_invalid.dts}  |   0
 ..._missing_node.dts => 002_missing_node.dts} |   0
 .../test/{03_empty.dts => 003_empty.dts}      |   0
 ...nvalid_entry.dts => 004_invalid_entry.dts} |   0
 .../test/{05_simple.dts => 005_simple.dts}    |   0
 .../{06_dual_image.dts => 006_dual_image.dts} |   0
 .../{07_bad_align.dts => 007_bad_align.dts}   |   0
 .../binman/test/{08_pack.dts => 008_pack.dts} |   0
 .../{09_pack_extra.dts => 009_pack_extra.dts} |   0
 ...n_power2.dts => 010_pack_align_power2.dts} |   0
 ...er2.dts => 011_pack_align_size_power2.dts} |   0
 ...k_inv_align.dts => 012_pack_inv_align.dts} |   0
 ..._align.dts => 013_pack_inv_size_align.dts} |   0
 ..._pack_overlap.dts => 014_pack_overlap.dts} |   0
 ...ack_overflow.dts => 015_pack_overflow.dts} |   0
 ...erflow.dts => 016_pack_image_overflow.dts} |   0
 ...image_size.dts => 017_pack_image_size.dts} |   0
 ...age_align.dts => 018_pack_image_align.dts} |   0
 ...align.dts => 019_pack_inv_image_align.dts} |   0
 ...ts => 020_pack_inv_image_align_power2.dts} |   0
 .../{21_image_pad.dts => 021_image_pad.dts}   |   0
 .../{22_image_name.dts => 022_image_name.dts} |   0
 .../binman/test/{23_blob.dts => 023_blob.dts} |   0
 .../test/{24_sorted.dts => 024_sorted.dts}    |   0
 ...k_zero_size.dts => 025_pack_zero_size.dts} |   0
 ...u_boot_dtb.dts => 026_pack_u_boot_dtb.dts} |   0
 ...b_no_size.dts => 027_pack_4gb_no_size.dts} |   0
 ...b_outside.dts => 028_pack_4gb_outside.dts} |   0
 .../test/{29_x86-rom.dts => 029_x86-rom.dts}  |   0
 ...no-desc.dts => 030_x86-rom-me-no-desc.dts} |   0
 .../{31_x86-rom-me.dts => 031_x86-rom-me.dts} |   0
 .../{32_intel-vga.dts => 032_intel-vga.dts}   |   0
 ...33_x86-start16.dts => 033_x86-start16.dts} |   0
 .../{34_x86_ucode.dts => 034_x86_ucode.dts}   |   0
 ...gle_ucode.dts => 035_x86_single_ucode.dts} |   0
 .../{36_u_boot_img.dts => 036_u_boot_img.dts} |   0
 ..._x86_no_ucode.dts => 037_x86_no_ucode.dts} |   0
 ...ode.dts => 038_x86_ucode_missing_node.dts} |   0
 ...e2.dts => 039_x86_ucode_missing_node2.dts} |   0
 ...age.dts => 040_x86_ucode_not_in_image.dts} |   0
 ..._pos_size.dts => 041_unknown_pos_size.dts} |   0
 .../{42_intel-fsp.dts => 042_intel-fsp.dts}   |   0
 .../{43_intel-cmc.dts => 043_intel-cmc.dts}   |   0
 ...l_ucode.dts => 044_x86_optional_ucode.dts} |   0
 .../{45_prop_test.dts => 045_prop_test.dts}   |   0
 .../{46_intel-vbt.dts => 046_intel-vbt.dts}   |   0
 ...47_spl_bss_pad.dts => 047_spl_bss_pad.dts} |   0
 ...tart16-spl.dts => 048_x86-start16-spl.dts} |   0
 ...86_ucode_spl.dts => 049_x86_ucode_spl.dts} |   0
 .../{50_intel_mrc.dts => 050_intel_mrc.dts}   |   0
 ...oot_spl_dtb.dts => 051_u_boot_spl_dtb.dts} |   0
 ...spl_nodtb.dts => 052_u_boot_spl_nodtb.dts} |   0
 .../test/{53_symbols.dts => 053_symbols.dts}  |   0
 ..._unit_address.dts => 054_unit_address.dts} |   0
 .../{55_sections.dts => 055_sections.dts}     |   0
 ...56_name_prefix.dts => 056_name_prefix.dts} |   0
 ..._contents.dts => 057_unknown_contents.dts} |   0
 ....dts => 058_x86_ucode_spl_needs_retry.dts} |   0
 ...59_change_size.dts => 059_change_size.dts} |   0
 .../{60_fdt_update.dts => 060_fdt_update.dts} |   0
 ..._update_bad.dts => 061_fdt_update_bad.dts} |   0
 .../{62_entry_args.dts => 062_entry_args.dts} |   0
 ...missing.dts => 063_entry_args_missing.dts} |   0
 ...quired.dts => 064_entry_args_required.dts} |   0
 ...ts => 065_entry_args_unknown_datatype.dts} |   0
 .../binman/test/{66_text.dts => 066_text.dts} |   0
 .../binman/test/{67_fmap.dts => 067_fmap.dts} |   0
 ...d_by_arg.dts => 068_blob_named_by_arg.dts} |   0
 .../binman/test/{69_fill.dts => 069_fill.dts} |   0
 ..._fill_no_size.dts => 070_fill_no_size.dts} |   0
 tools/binman/test/{71_gbb.dts => 071_gbb.dts} |   0
 ...bb_too_small.dts => 072_gbb_too_small.dts} |   0
 ...73_gbb_no_size.dts => 073_gbb_no_size.dts} |   0
 .../test/{74_vblock.dts => 074_vblock.dts}    |   0
 ..._content.dts => 075_vblock_no_content.dts} |   0
 ...phandle.dts => 076_vblock_bad_phandle.dts} |   0
 ...bad_entry.dts => 077_vblock_bad_entry.dts} |   0
 .../{78_u_boot_tpl.dts => 078_u_boot_tpl.dts} |   0
 .../{79_uses_pos.dts => 079_uses_pos.dts}     |   0
 .../{80_fill_empty.dts => 080_fill_empty.dts} |   0
 ...tart16-tpl.dts => 081_x86-start16-tpl.dts} |   0
 ..._update_all.dts => 082_fdt_update_all.dts} |   0
 .../{83_compress.dts => 083_compress.dts}     |   0
 .../test/{84_files.dts => 084_files.dts}      |   0
 ...es_compress.dts => 085_files_compress.dts} |   0
 .../{86_files_none.dts => 086_files_none.dts} |   0
 ...o_pattern.dts => 087_files_no_pattern.dts} |   0
 ...88_expand_size.dts => 088_expand_size.dts} |   0
 ...d_size_bad.dts => 089_expand_size_bad.dts} |   0
 .../binman/test/{90_hash.dts => 090_hash.dts} |   0
 ..._hash_no_algo.dts => 091_hash_no_algo.dts} |   0
 ...ash_bad_algo.dts => 092_hash_bad_algo.dts} |   0
 ...86_tpl_ucode.dts => 093_x86_tpl_ucode.dts} |   0
 .../{94_fmap_x86.dts => 094_fmap_x86.dts}     |   0
 ...6_section.dts => 095_fmap_x86_section.dts} |   0
 tools/binman/test/{96_elf.dts => 096_elf.dts} |   0
 .../{97_elf_strip.dts => 097_elf_strip.dts}   |   0
 ..._hash_section.dts => 099_hash_section.dts} |   0
 101 files changed, 115 insertions(+), 115 deletions(-)
 rename tools/binman/test/{01_invalid.dts => 001_invalid.dts} (100%)
 rename tools/binman/test/{02_missing_node.dts => 002_missing_node.dts} (100%)
 rename tools/binman/test/{03_empty.dts => 003_empty.dts} (100%)
 rename tools/binman/test/{04_invalid_entry.dts => 004_invalid_entry.dts} (100%)
 rename tools/binman/test/{05_simple.dts => 005_simple.dts} (100%)
 rename tools/binman/test/{06_dual_image.dts => 006_dual_image.dts} (100%)
 rename tools/binman/test/{07_bad_align.dts => 007_bad_align.dts} (100%)
 rename tools/binman/test/{08_pack.dts => 008_pack.dts} (100%)
 rename tools/binman/test/{09_pack_extra.dts => 009_pack_extra.dts} (100%)
 rename tools/binman/test/{10_pack_align_power2.dts => 010_pack_align_power2.dts} (100%)
 rename tools/binman/test/{11_pack_align_size_power2.dts => 011_pack_align_size_power2.dts} (100%)
 rename tools/binman/test/{12_pack_inv_align.dts => 012_pack_inv_align.dts} (100%)
 rename tools/binman/test/{13_pack_inv_size_align.dts => 013_pack_inv_size_align.dts} (100%)
 rename tools/binman/test/{14_pack_overlap.dts => 014_pack_overlap.dts} (100%)
 rename tools/binman/test/{15_pack_overflow.dts => 015_pack_overflow.dts} (100%)
 rename tools/binman/test/{16_pack_image_overflow.dts => 016_pack_image_overflow.dts} (100%)
 rename tools/binman/test/{17_pack_image_size.dts => 017_pack_image_size.dts} (100%)
 rename tools/binman/test/{18_pack_image_align.dts => 018_pack_image_align.dts} (100%)
 rename tools/binman/test/{19_pack_inv_image_align.dts => 019_pack_inv_image_align.dts} (100%)
 rename tools/binman/test/{20_pack_inv_image_align_power2.dts => 020_pack_inv_image_align_power2.dts} (100%)
 rename tools/binman/test/{21_image_pad.dts => 021_image_pad.dts} (100%)
 rename tools/binman/test/{22_image_name.dts => 022_image_name.dts} (100%)
 rename tools/binman/test/{23_blob.dts => 023_blob.dts} (100%)
 rename tools/binman/test/{24_sorted.dts => 024_sorted.dts} (100%)
 rename tools/binman/test/{25_pack_zero_size.dts => 025_pack_zero_size.dts} (100%)
 rename tools/binman/test/{26_pack_u_boot_dtb.dts => 026_pack_u_boot_dtb.dts} (100%)
 rename tools/binman/test/{27_pack_4gb_no_size.dts => 027_pack_4gb_no_size.dts} (100%)
 rename tools/binman/test/{28_pack_4gb_outside.dts => 028_pack_4gb_outside.dts} (100%)
 rename tools/binman/test/{29_x86-rom.dts => 029_x86-rom.dts} (100%)
 rename tools/binman/test/{30_x86-rom-me-no-desc.dts => 030_x86-rom-me-no-desc.dts} (100%)
 rename tools/binman/test/{31_x86-rom-me.dts => 031_x86-rom-me.dts} (100%)
 rename tools/binman/test/{32_intel-vga.dts => 032_intel-vga.dts} (100%)
 rename tools/binman/test/{33_x86-start16.dts => 033_x86-start16.dts} (100%)
 rename tools/binman/test/{34_x86_ucode.dts => 034_x86_ucode.dts} (100%)
 rename tools/binman/test/{35_x86_single_ucode.dts => 035_x86_single_ucode.dts} (100%)
 rename tools/binman/test/{36_u_boot_img.dts => 036_u_boot_img.dts} (100%)
 rename tools/binman/test/{37_x86_no_ucode.dts => 037_x86_no_ucode.dts} (100%)
 rename tools/binman/test/{38_x86_ucode_missing_node.dts => 038_x86_ucode_missing_node.dts} (100%)
 rename tools/binman/test/{39_x86_ucode_missing_node2.dts => 039_x86_ucode_missing_node2.dts} (100%)
 rename tools/binman/test/{40_x86_ucode_not_in_image.dts => 040_x86_ucode_not_in_image.dts} (100%)
 rename tools/binman/test/{41_unknown_pos_size.dts => 041_unknown_pos_size.dts} (100%)
 rename tools/binman/test/{42_intel-fsp.dts => 042_intel-fsp.dts} (100%)
 rename tools/binman/test/{43_intel-cmc.dts => 043_intel-cmc.dts} (100%)
 rename tools/binman/test/{44_x86_optional_ucode.dts => 044_x86_optional_ucode.dts} (100%)
 rename tools/binman/test/{45_prop_test.dts => 045_prop_test.dts} (100%)
 rename tools/binman/test/{46_intel-vbt.dts => 046_intel-vbt.dts} (100%)
 rename tools/binman/test/{47_spl_bss_pad.dts => 047_spl_bss_pad.dts} (100%)
 rename tools/binman/test/{48_x86-start16-spl.dts => 048_x86-start16-spl.dts} (100%)
 rename tools/binman/test/{49_x86_ucode_spl.dts => 049_x86_ucode_spl.dts} (100%)
 rename tools/binman/test/{50_intel_mrc.dts => 050_intel_mrc.dts} (100%)
 rename tools/binman/test/{51_u_boot_spl_dtb.dts => 051_u_boot_spl_dtb.dts} (100%)
 rename tools/binman/test/{52_u_boot_spl_nodtb.dts => 052_u_boot_spl_nodtb.dts} (100%)
 rename tools/binman/test/{53_symbols.dts => 053_symbols.dts} (100%)
 rename tools/binman/test/{54_unit_address.dts => 054_unit_address.dts} (100%)
 rename tools/binman/test/{55_sections.dts => 055_sections.dts} (100%)
 rename tools/binman/test/{56_name_prefix.dts => 056_name_prefix.dts} (100%)
 rename tools/binman/test/{57_unknown_contents.dts => 057_unknown_contents.dts} (100%)
 rename tools/binman/test/{58_x86_ucode_spl_needs_retry.dts => 058_x86_ucode_spl_needs_retry.dts} (100%)
 rename tools/binman/test/{59_change_size.dts => 059_change_size.dts} (100%)
 rename tools/binman/test/{60_fdt_update.dts => 060_fdt_update.dts} (100%)
 rename tools/binman/test/{61_fdt_update_bad.dts => 061_fdt_update_bad.dts} (100%)
 rename tools/binman/test/{62_entry_args.dts => 062_entry_args.dts} (100%)
 rename tools/binman/test/{63_entry_args_missing.dts => 063_entry_args_missing.dts} (100%)
 rename tools/binman/test/{64_entry_args_required.dts => 064_entry_args_required.dts} (100%)
 rename tools/binman/test/{65_entry_args_unknown_datatype.dts => 065_entry_args_unknown_datatype.dts} (100%)
 rename tools/binman/test/{66_text.dts => 066_text.dts} (100%)
 rename tools/binman/test/{67_fmap.dts => 067_fmap.dts} (100%)
 rename tools/binman/test/{68_blob_named_by_arg.dts => 068_blob_named_by_arg.dts} (100%)
 rename tools/binman/test/{69_fill.dts => 069_fill.dts} (100%)
 rename tools/binman/test/{70_fill_no_size.dts => 070_fill_no_size.dts} (100%)
 rename tools/binman/test/{71_gbb.dts => 071_gbb.dts} (100%)
 rename tools/binman/test/{72_gbb_too_small.dts => 072_gbb_too_small.dts} (100%)
 rename tools/binman/test/{73_gbb_no_size.dts => 073_gbb_no_size.dts} (100%)
 rename tools/binman/test/{74_vblock.dts => 074_vblock.dts} (100%)
 rename tools/binman/test/{75_vblock_no_content.dts => 075_vblock_no_content.dts} (100%)
 rename tools/binman/test/{76_vblock_bad_phandle.dts => 076_vblock_bad_phandle.dts} (100%)
 rename tools/binman/test/{77_vblock_bad_entry.dts => 077_vblock_bad_entry.dts} (100%)
 rename tools/binman/test/{78_u_boot_tpl.dts => 078_u_boot_tpl.dts} (100%)
 rename tools/binman/test/{79_uses_pos.dts => 079_uses_pos.dts} (100%)
 rename tools/binman/test/{80_fill_empty.dts => 080_fill_empty.dts} (100%)
 rename tools/binman/test/{81_x86-start16-tpl.dts => 081_x86-start16-tpl.dts} (100%)
 rename tools/binman/test/{82_fdt_update_all.dts => 082_fdt_update_all.dts} (100%)
 rename tools/binman/test/{83_compress.dts => 083_compress.dts} (100%)
 rename tools/binman/test/{84_files.dts => 084_files.dts} (100%)
 rename tools/binman/test/{85_files_compress.dts => 085_files_compress.dts} (100%)
 rename tools/binman/test/{86_files_none.dts => 086_files_none.dts} (100%)
 rename tools/binman/test/{87_files_no_pattern.dts => 087_files_no_pattern.dts} (100%)
 rename tools/binman/test/{88_expand_size.dts => 088_expand_size.dts} (100%)
 rename tools/binman/test/{89_expand_size_bad.dts => 089_expand_size_bad.dts} (100%)
 rename tools/binman/test/{90_hash.dts => 090_hash.dts} (100%)
 rename tools/binman/test/{91_hash_no_algo.dts => 091_hash_no_algo.dts} (100%)
 rename tools/binman/test/{92_hash_bad_algo.dts => 092_hash_bad_algo.dts} (100%)
 rename tools/binman/test/{93_x86_tpl_ucode.dts => 093_x86_tpl_ucode.dts} (100%)
 rename tools/binman/test/{94_fmap_x86.dts => 094_fmap_x86.dts} (100%)
 rename tools/binman/test/{95_fmap_x86_section.dts => 095_fmap_x86_section.dts} (100%)
 rename tools/binman/test/{96_elf.dts => 096_elf.dts} (100%)
 rename tools/binman/test/{97_elf_strip.dts => 097_elf_strip.dts} (100%)
 rename tools/binman/test/{99_hash_section.dts => 099_hash_section.dts} (100%)
tools/binman/entry_test.py +1 -1
index 17ab2290140..1f7ff5b4e41 100644
@@ -25,7 +25,7 @@ class TestEntry(unittest.TestCase):
     def GetNode(self):
         binman_dir = os.path.dirname(os.path.realpath(sys.argv[0]))
         fname = fdt_util.EnsureCompiled(
-            os.path.join(binman_dir,('test/05_simple.dts')))
+            os.path.join(binman_dir,('test/005_simple.dts')))
         dtb = fdt.FdtScan(fname)
         return dtb.GetNode('/binman/u-boot')
 
tools/binman/fdt_test.py +2 -2
index b9167012d25..ac6f910d3c0 100644
@@ -36,12 +36,12 @@ class TestFdt(unittest.TestCase):
         node.DeleteProp('data')
 
     def testFdtNormal(self):
-        fname = self.GetCompiled('34_x86_ucode.dts')
+        fname = self.GetCompiled('034_x86_ucode.dts')
         dt = FdtScan(fname)
         self._DeleteProp(dt)
 
     def testFdtNormalProp(self):
-        fname = self.GetCompiled('45_prop_test.dts')
+        fname = self.GetCompiled('045_prop_test.dts')
         dt = FdtScan(fname)
         node = dt.GetNode('/binman/intel-me')
         self.assertEquals('intel-me', node.name)
tools/binman/ftest.py +112 -112

849 lines not on this page · raw message

tools/binman/test/001_invalid.dts renamed from tools/binman/test/01_invalid.dts +0 -0
similarity index 100%
rename from tools/binman/test/01_invalid.dts
rename to tools/binman/test/001_invalid.dts
tools/binman/test/002_missing_node.dts renamed from tools/binman/test/02_missing_node.dts +0 -0
similarity index 100%
rename from tools/binman/test/02_missing_node.dts
rename to tools/binman/test/002_missing_node.dts
tools/binman/test/003_empty.dts renamed from tools/binman/test/03_empty.dts +0 -0
similarity index 100%
rename from tools/binman/test/03_empty.dts
rename to tools/binman/test/003_empty.dts
tools/binman/test/004_invalid_entry.dts renamed from tools/binman/test/04_invalid_entry.dts +0 -0
similarity index 100%
rename from tools/binman/test/04_invalid_entry.dts
rename to tools/binman/test/004_invalid_entry.dts
tools/binman/test/005_simple.dts renamed from tools/binman/test/05_simple.dts +0 -0
similarity index 100%
rename from tools/binman/test/05_simple.dts
rename to tools/binman/test/005_simple.dts
tools/binman/test/006_dual_image.dts renamed from tools/binman/test/06_dual_image.dts +0 -0
similarity index 100%
rename from tools/binman/test/06_dual_image.dts
rename to tools/binman/test/006_dual_image.dts
tools/binman/test/007_bad_align.dts renamed from tools/binman/test/07_bad_align.dts +0 -0
similarity index 100%
rename from tools/binman/test/07_bad_align.dts
rename to tools/binman/test/007_bad_align.dts
tools/binman/test/008_pack.dts renamed from tools/binman/test/08_pack.dts +0 -0
similarity index 100%
rename from tools/binman/test/08_pack.dts
rename to tools/binman/test/008_pack.dts
tools/binman/test/009_pack_extra.dts renamed from tools/binman/test/09_pack_extra.dts +0 -0
similarity index 100%
rename from tools/binman/test/09_pack_extra.dts
rename to tools/binman/test/009_pack_extra.dts
tools/binman/test/010_pack_align_power2.dts renamed from tools/binman/test/10_pack_align_power2.dts +0 -0
similarity index 100%
rename from tools/binman/test/10_pack_align_power2.dts
rename to tools/binman/test/010_pack_align_power2.dts
tools/binman/test/011_pack_align_size_power2.dts renamed from tools/binman/test/11_pack_align_size_power2.dts +0 -0
similarity index 100%
rename from tools/binman/test/11_pack_align_size_power2.dts
rename to tools/binman/test/011_pack_align_size_power2.dts
tools/binman/test/012_pack_inv_align.dts renamed from tools/binman/test/12_pack_inv_align.dts +0 -0
similarity index 100%
rename from tools/binman/test/12_pack_inv_align.dts
rename to tools/binman/test/012_pack_inv_align.dts
tools/binman/test/013_pack_inv_size_align.dts renamed from tools/binman/test/13_pack_inv_size_align.dts +0 -0
similarity index 100%
rename from tools/binman/test/13_pack_inv_size_align.dts
rename to tools/binman/test/013_pack_inv_size_align.dts
tools/binman/test/014_pack_overlap.dts renamed from tools/binman/test/14_pack_overlap.dts +0 -0
similarity index 100%
rename from tools/binman/test/14_pack_overlap.dts
rename to tools/binman/test/014_pack_overlap.dts
tools/binman/test/015_pack_overflow.dts renamed from tools/binman/test/15_pack_overflow.dts +0 -0
similarity index 100%
rename from tools/binman/test/15_pack_overflow.dts
rename to tools/binman/test/015_pack_overflow.dts
tools/binman/test/016_pack_image_overflow.dts renamed from tools/binman/test/16_pack_image_overflow.dts +0 -0
similarity index 100%
rename from tools/binman/test/16_pack_image_overflow.dts
rename to tools/binman/test/016_pack_image_overflow.dts
tools/binman/test/017_pack_image_size.dts renamed from tools/binman/test/17_pack_image_size.dts +0 -0
similarity index 100%
rename from tools/binman/test/17_pack_image_size.dts
rename to tools/binman/test/017_pack_image_size.dts
tools/binman/test/018_pack_image_align.dts renamed from tools/binman/test/18_pack_image_align.dts +0 -0
similarity index 100%
rename from tools/binman/test/18_pack_image_align.dts
rename to tools/binman/test/018_pack_image_align.dts
tools/binman/test/019_pack_inv_image_align.dts renamed from tools/binman/test/19_pack_inv_image_align.dts +0 -0
similarity index 100%
rename from tools/binman/test/19_pack_inv_image_align.dts
rename to tools/binman/test/019_pack_inv_image_align.dts
tools/binman/test/020_pack_inv_image_align_power2.dts renamed from tools/binman/test/20_pack_inv_image_align_power2.dts +0 -0
similarity index 100%
rename from tools/binman/test/20_pack_inv_image_align_power2.dts
rename to tools/binman/test/020_pack_inv_image_align_power2.dts
tools/binman/test/021_image_pad.dts renamed from tools/binman/test/21_image_pad.dts +0 -0
similarity index 100%
rename from tools/binman/test/21_image_pad.dts
rename to tools/binman/test/021_image_pad.dts
tools/binman/test/022_image_name.dts renamed from tools/binman/test/22_image_name.dts +0 -0
similarity index 100%
rename from tools/binman/test/22_image_name.dts
rename to tools/binman/test/022_image_name.dts
tools/binman/test/023_blob.dts renamed from tools/binman/test/23_blob.dts +0 -0
similarity index 100%
rename from tools/binman/test/23_blob.dts
rename to tools/binman/test/023_blob.dts
tools/binman/test/024_sorted.dts renamed from tools/binman/test/24_sorted.dts +0 -0
similarity index 100%
rename from tools/binman/test/24_sorted.dts
rename to tools/binman/test/024_sorted.dts
tools/binman/test/025_pack_zero_size.dts renamed from tools/binman/test/25_pack_zero_size.dts +0 -0
similarity index 100%
rename from tools/binman/test/25_pack_zero_size.dts
rename to tools/binman/test/025_pack_zero_size.dts
tools/binman/test/026_pack_u_boot_dtb.dts renamed from tools/binman/test/26_pack_u_boot_dtb.dts +0 -0
similarity index 100%
rename from tools/binman/test/26_pack_u_boot_dtb.dts
rename to tools/binman/test/026_pack_u_boot_dtb.dts
tools/binman/test/027_pack_4gb_no_size.dts renamed from tools/binman/test/27_pack_4gb_no_size.dts +0 -0
similarity index 100%
rename from tools/binman/test/27_pack_4gb_no_size.dts
rename to tools/binman/test/027_pack_4gb_no_size.dts
tools/binman/test/028_pack_4gb_outside.dts renamed from tools/binman/test/28_pack_4gb_outside.dts +0 -0
similarity index 100%
rename from tools/binman/test/28_pack_4gb_outside.dts
rename to tools/binman/test/028_pack_4gb_outside.dts
tools/binman/test/029_x86-rom.dts renamed from tools/binman/test/29_x86-rom.dts +0 -0
similarity index 100%
rename from tools/binman/test/29_x86-rom.dts
rename to tools/binman/test/029_x86-rom.dts
tools/binman/test/030_x86-rom-me-no-desc.dts renamed from tools/binman/test/30_x86-rom-me-no-desc.dts +0 -0
similarity index 100%
rename from tools/binman/test/30_x86-rom-me-no-desc.dts
rename to tools/binman/test/030_x86-rom-me-no-desc.dts
tools/binman/test/031_x86-rom-me.dts renamed from tools/binman/test/31_x86-rom-me.dts +0 -0
similarity index 100%
rename from tools/binman/test/31_x86-rom-me.dts
rename to tools/binman/test/031_x86-rom-me.dts
tools/binman/test/032_intel-vga.dts renamed from tools/binman/test/32_intel-vga.dts +0 -0
similarity index 100%
rename from tools/binman/test/32_intel-vga.dts
rename to tools/binman/test/032_intel-vga.dts
tools/binman/test/033_x86-start16.dts renamed from tools/binman/test/33_x86-start16.dts +0 -0
similarity index 100%
rename from tools/binman/test/33_x86-start16.dts
rename to tools/binman/test/033_x86-start16.dts
tools/binman/test/034_x86_ucode.dts renamed from tools/binman/test/34_x86_ucode.dts +0 -0
similarity index 100%
rename from tools/binman/test/34_x86_ucode.dts
rename to tools/binman/test/034_x86_ucode.dts
tools/binman/test/035_x86_single_ucode.dts renamed from tools/binman/test/35_x86_single_ucode.dts +0 -0
similarity index 100%
rename from tools/binman/test/35_x86_single_ucode.dts
rename to tools/binman/test/035_x86_single_ucode.dts
tools/binman/test/036_u_boot_img.dts renamed from tools/binman/test/36_u_boot_img.dts +0 -0
similarity index 100%
rename from tools/binman/test/36_u_boot_img.dts
rename to tools/binman/test/036_u_boot_img.dts
tools/binman/test/037_x86_no_ucode.dts renamed from tools/binman/test/37_x86_no_ucode.dts +0 -0
similarity index 100%
rename from tools/binman/test/37_x86_no_ucode.dts
rename to tools/binman/test/037_x86_no_ucode.dts
tools/binman/test/038_x86_ucode_missing_node.dts renamed from tools/binman/test/38_x86_ucode_missing_node.dts +0 -0
similarity index 100%
rename from tools/binman/test/38_x86_ucode_missing_node.dts
rename to tools/binman/test/038_x86_ucode_missing_node.dts
tools/binman/test/039_x86_ucode_missing_node2.dts renamed from tools/binman/test/39_x86_ucode_missing_node2.dts +0 -0
similarity index 100%
rename from tools/binman/test/39_x86_ucode_missing_node2.dts
rename to tools/binman/test/039_x86_ucode_missing_node2.dts
tools/binman/test/040_x86_ucode_not_in_image.dts renamed from tools/binman/test/40_x86_ucode_not_in_image.dts +0 -0
similarity index 100%
rename from tools/binman/test/40_x86_ucode_not_in_image.dts
rename to tools/binman/test/040_x86_ucode_not_in_image.dts
tools/binman/test/041_unknown_pos_size.dts renamed from tools/binman/test/41_unknown_pos_size.dts +0 -0
similarity index 100%
rename from tools/binman/test/41_unknown_pos_size.dts
rename to tools/binman/test/041_unknown_pos_size.dts
tools/binman/test/042_intel-fsp.dts renamed from tools/binman/test/42_intel-fsp.dts +0 -0
similarity index 100%
rename from tools/binman/test/42_intel-fsp.dts
rename to tools/binman/test/042_intel-fsp.dts
tools/binman/test/043_intel-cmc.dts renamed from tools/binman/test/43_intel-cmc.dts +0 -0
similarity index 100%
rename from tools/binman/test/43_intel-cmc.dts
rename to tools/binman/test/043_intel-cmc.dts
tools/binman/test/044_x86_optional_ucode.dts renamed from tools/binman/test/44_x86_optional_ucode.dts +0 -0
similarity index 100%
rename from tools/binman/test/44_x86_optional_ucode.dts
rename to tools/binman/test/044_x86_optional_ucode.dts
tools/binman/test/045_prop_test.dts renamed from tools/binman/test/45_prop_test.dts +0 -0
similarity index 100%
rename from tools/binman/test/45_prop_test.dts
rename to tools/binman/test/045_prop_test.dts
tools/binman/test/046_intel-vbt.dts renamed from tools/binman/test/46_intel-vbt.dts +0 -0
similarity index 100%
rename from tools/binman/test/46_intel-vbt.dts
rename to tools/binman/test/046_intel-vbt.dts
tools/binman/test/047_spl_bss_pad.dts renamed from tools/binman/test/47_spl_bss_pad.dts +0 -0
similarity index 100%
rename from tools/binman/test/47_spl_bss_pad.dts
rename to tools/binman/test/047_spl_bss_pad.dts
tools/binman/test/048_x86-start16-spl.dts renamed from tools/binman/test/48_x86-start16-spl.dts +0 -0
similarity index 100%
rename from tools/binman/test/48_x86-start16-spl.dts
rename to tools/binman/test/048_x86-start16-spl.dts
tools/binman/test/049_x86_ucode_spl.dts renamed from tools/binman/test/49_x86_ucode_spl.dts +0 -0
similarity index 100%
rename from tools/binman/test/49_x86_ucode_spl.dts
rename to tools/binman/test/049_x86_ucode_spl.dts
tools/binman/test/050_intel_mrc.dts renamed from tools/binman/test/50_intel_mrc.dts +0 -0
similarity index 100%
rename from tools/binman/test/50_intel_mrc.dts
rename to tools/binman/test/050_intel_mrc.dts
tools/binman/test/051_u_boot_spl_dtb.dts renamed from tools/binman/test/51_u_boot_spl_dtb.dts +0 -0
similarity index 100%
rename from tools/binman/test/51_u_boot_spl_dtb.dts
rename to tools/binman/test/051_u_boot_spl_dtb.dts
tools/binman/test/052_u_boot_spl_nodtb.dts renamed from tools/binman/test/52_u_boot_spl_nodtb.dts +0 -0
similarity index 100%
rename from tools/binman/test/52_u_boot_spl_nodtb.dts
rename to tools/binman/test/052_u_boot_spl_nodtb.dts
tools/binman/test/053_symbols.dts renamed from tools/binman/test/53_symbols.dts +0 -0
similarity index 100%
rename from tools/binman/test/53_symbols.dts
rename to tools/binman/test/053_symbols.dts
tools/binman/test/054_unit_address.dts renamed from tools/binman/test/54_unit_address.dts +0 -0
similarity index 100%
rename from tools/binman/test/54_unit_address.dts
rename to tools/binman/test/054_unit_address.dts
tools/binman/test/055_sections.dts renamed from tools/binman/test/55_sections.dts +0 -0
similarity index 100%
rename from tools/binman/test/55_sections.dts
rename to tools/binman/test/055_sections.dts
tools/binman/test/056_name_prefix.dts renamed from tools/binman/test/56_name_prefix.dts +0 -0
similarity index 100%
rename from tools/binman/test/56_name_prefix.dts
rename to tools/binman/test/056_name_prefix.dts
tools/binman/test/057_unknown_contents.dts renamed from tools/binman/test/57_unknown_contents.dts +0 -0
similarity index 100%
rename from tools/binman/test/57_unknown_contents.dts
rename to tools/binman/test/057_unknown_contents.dts
tools/binman/test/058_x86_ucode_spl_needs_retry.dts renamed from tools/binman/test/58_x86_ucode_spl_needs_retry.dts +0 -0
similarity index 100%
rename from tools/binman/test/58_x86_ucode_spl_needs_retry.dts
rename to tools/binman/test/058_x86_ucode_spl_needs_retry.dts
tools/binman/test/059_change_size.dts renamed from tools/binman/test/59_change_size.dts +0 -0
similarity index 100%
rename from tools/binman/test/59_change_size.dts
rename to tools/binman/test/059_change_size.dts
tools/binman/test/060_fdt_update.dts renamed from tools/binman/test/60_fdt_update.dts +0 -0
similarity index 100%
rename from tools/binman/test/60_fdt_update.dts
rename to tools/binman/test/060_fdt_update.dts
tools/binman/test/061_fdt_update_bad.dts renamed from tools/binman/test/61_fdt_update_bad.dts +0 -0
similarity index 100%
rename from tools/binman/test/61_fdt_update_bad.dts
rename to tools/binman/test/061_fdt_update_bad.dts
tools/binman/test/062_entry_args.dts renamed from tools/binman/test/62_entry_args.dts +0 -0
similarity index 100%
rename from tools/binman/test/62_entry_args.dts
rename to tools/binman/test/062_entry_args.dts
tools/binman/test/063_entry_args_missing.dts renamed from tools/binman/test/63_entry_args_missing.dts +0 -0
similarity index 100%
rename from tools/binman/test/63_entry_args_missing.dts
rename to tools/binman/test/063_entry_args_missing.dts
tools/binman/test/064_entry_args_required.dts renamed from tools/binman/test/64_entry_args_required.dts +0 -0
similarity index 100%
rename from tools/binman/test/64_entry_args_required.dts
rename to tools/binman/test/064_entry_args_required.dts
tools/binman/test/065_entry_args_unknown_datatype.dts renamed from tools/binman/test/65_entry_args_unknown_datatype.dts +0 -0
similarity index 100%
rename from tools/binman/test/65_entry_args_unknown_datatype.dts
rename to tools/binman/test/065_entry_args_unknown_datatype.dts
tools/binman/test/066_text.dts renamed from tools/binman/test/66_text.dts +0 -0
similarity index 100%
rename from tools/binman/test/66_text.dts
rename to tools/binman/test/066_text.dts
tools/binman/test/067_fmap.dts renamed from tools/binman/test/67_fmap.dts +0 -0
similarity index 100%
rename from tools/binman/test/67_fmap.dts
rename to tools/binman/test/067_fmap.dts
tools/binman/test/068_blob_named_by_arg.dts renamed from tools/binman/test/68_blob_named_by_arg.dts +0 -0
similarity index 100%
rename from tools/binman/test/68_blob_named_by_arg.dts
rename to tools/binman/test/068_blob_named_by_arg.dts
tools/binman/test/069_fill.dts renamed from tools/binman/test/69_fill.dts +0 -0
similarity index 100%
rename from tools/binman/test/69_fill.dts
rename to tools/binman/test/069_fill.dts
tools/binman/test/070_fill_no_size.dts renamed from tools/binman/test/70_fill_no_size.dts +0 -0
similarity index 100%
rename from tools/binman/test/70_fill_no_size.dts
rename to tools/binman/test/070_fill_no_size.dts
tools/binman/test/071_gbb.dts renamed from tools/binman/test/71_gbb.dts +0 -0
similarity index 100%
rename from tools/binman/test/71_gbb.dts
rename to tools/binman/test/071_gbb.dts
tools/binman/test/072_gbb_too_small.dts renamed from tools/binman/test/72_gbb_too_small.dts +0 -0
similarity index 100%
rename from tools/binman/test/72_gbb_too_small.dts
rename to tools/binman/test/072_gbb_too_small.dts
tools/binman/test/073_gbb_no_size.dts renamed from tools/binman/test/73_gbb_no_size.dts +0 -0
similarity index 100%
rename from tools/binman/test/73_gbb_no_size.dts
rename to tools/binman/test/073_gbb_no_size.dts
tools/binman/test/074_vblock.dts renamed from tools/binman/test/74_vblock.dts +0 -0
similarity index 100%
rename from tools/binman/test/74_vblock.dts
rename to tools/binman/test/074_vblock.dts
tools/binman/test/075_vblock_no_content.dts renamed from tools/binman/test/75_vblock_no_content.dts +0 -0
similarity index 100%
rename from tools/binman/test/75_vblock_no_content.dts
rename to tools/binman/test/075_vblock_no_content.dts
tools/binman/test/076_vblock_bad_phandle.dts renamed from tools/binman/test/76_vblock_bad_phandle.dts +0 -0
similarity index 100%
rename from tools/binman/test/76_vblock_bad_phandle.dts
rename to tools/binman/test/076_vblock_bad_phandle.dts
tools/binman/test/077_vblock_bad_entry.dts renamed from tools/binman/test/77_vblock_bad_entry.dts +0 -0
similarity index 100%
rename from tools/binman/test/77_vblock_bad_entry.dts
rename to tools/binman/test/077_vblock_bad_entry.dts
tools/binman/test/078_u_boot_tpl.dts renamed from tools/binman/test/78_u_boot_tpl.dts +0 -0
similarity index 100%
rename from tools/binman/test/78_u_boot_tpl.dts
rename to tools/binman/test/078_u_boot_tpl.dts
tools/binman/test/079_uses_pos.dts renamed from tools/binman/test/79_uses_pos.dts +0 -0
similarity index 100%
rename from tools/binman/test/79_uses_pos.dts
rename to tools/binman/test/079_uses_pos.dts
tools/binman/test/080_fill_empty.dts renamed from tools/binman/test/80_fill_empty.dts +0 -0
similarity index 100%
rename from tools/binman/test/80_fill_empty.dts
rename to tools/binman/test/080_fill_empty.dts
tools/binman/test/081_x86-start16-tpl.dts renamed from tools/binman/test/81_x86-start16-tpl.dts +0 -0
similarity index 100%
rename from tools/binman/test/81_x86-start16-tpl.dts
rename to tools/binman/test/081_x86-start16-tpl.dts
tools/binman/test/082_fdt_update_all.dts renamed from tools/binman/test/82_fdt_update_all.dts +0 -0
similarity index 100%
rename from tools/binman/test/82_fdt_update_all.dts
rename to tools/binman/test/082_fdt_update_all.dts
tools/binman/test/083_compress.dts renamed from tools/binman/test/83_compress.dts +0 -0
similarity index 100%
rename from tools/binman/test/83_compress.dts
rename to tools/binman/test/083_compress.dts
tools/binman/test/084_files.dts renamed from tools/binman/test/84_files.dts +0 -0
similarity index 100%
rename from tools/binman/test/84_files.dts
rename to tools/binman/test/084_files.dts
tools/binman/test/085_files_compress.dts renamed from tools/binman/test/85_files_compress.dts +0 -0
similarity index 100%
rename from tools/binman/test/85_files_compress.dts
rename to tools/binman/test/085_files_compress.dts
tools/binman/test/086_files_none.dts renamed from tools/binman/test/86_files_none.dts +0 -0
similarity index 100%
rename from tools/binman/test/86_files_none.dts
rename to tools/binman/test/086_files_none.dts
tools/binman/test/087_files_no_pattern.dts renamed from tools/binman/test/87_files_no_pattern.dts +0 -0
similarity index 100%
rename from tools/binman/test/87_files_no_pattern.dts
rename to tools/binman/test/087_files_no_pattern.dts
tools/binman/test/088_expand_size.dts renamed from tools/binman/test/88_expand_size.dts +0 -0
similarity index 100%
rename from tools/binman/test/88_expand_size.dts
rename to tools/binman/test/088_expand_size.dts
tools/binman/test/089_expand_size_bad.dts renamed from tools/binman/test/89_expand_size_bad.dts +0 -0
similarity index 100%
rename from tools/binman/test/89_expand_size_bad.dts
rename to tools/binman/test/089_expand_size_bad.dts
tools/binman/test/090_hash.dts renamed from tools/binman/test/90_hash.dts +0 -0
similarity index 100%
rename from tools/binman/test/90_hash.dts
rename to tools/binman/test/090_hash.dts
tools/binman/test/091_hash_no_algo.dts renamed from tools/binman/test/91_hash_no_algo.dts +0 -0
similarity index 100%
rename from tools/binman/test/91_hash_no_algo.dts
rename to tools/binman/test/091_hash_no_algo.dts
tools/binman/test/092_hash_bad_algo.dts renamed from tools/binman/test/92_hash_bad_algo.dts +0 -0
similarity index 100%
rename from tools/binman/test/92_hash_bad_algo.dts
rename to tools/binman/test/092_hash_bad_algo.dts
tools/binman/test/093_x86_tpl_ucode.dts renamed from tools/binman/test/93_x86_tpl_ucode.dts +0 -0
similarity index 100%
rename from tools/binman/test/93_x86_tpl_ucode.dts
rename to tools/binman/test/093_x86_tpl_ucode.dts
tools/binman/test/094_fmap_x86.dts renamed from tools/binman/test/94_fmap_x86.dts +0 -0
similarity index 100%
rename from tools/binman/test/94_fmap_x86.dts
rename to tools/binman/test/094_fmap_x86.dts
tools/binman/test/095_fmap_x86_section.dts renamed from tools/binman/test/95_fmap_x86_section.dts +0 -0
similarity index 100%
rename from tools/binman/test/95_fmap_x86_section.dts
rename to tools/binman/test/095_fmap_x86_section.dts
tools/binman/test/096_elf.dts renamed from tools/binman/test/96_elf.dts +0 -0
similarity index 100%
rename from tools/binman/test/96_elf.dts
rename to tools/binman/test/096_elf.dts
tools/binman/test/097_elf_strip.dts renamed from tools/binman/test/97_elf_strip.dts +0 -0
similarity index 100%
rename from tools/binman/test/97_elf_strip.dts
rename to tools/binman/test/097_elf_strip.dts
tools/binman/test/099_hash_section.dts renamed from tools/binman/test/99_hash_section.dts +0 -0
similarity index 100%
rename from tools/binman/test/99_hash_section.dts
rename to tools/binman/test/099_hash_section.dts
Signature · 1 line
2.19.0.605.g01d371f741-goog
#58 lore raw

PATCH 26/45 binman: Move to three-digit test-file numbers

We now have 99 tests. Before adding any more, rename everything to three digits. This helps to preserve the ordering of tests and makes it easier to find things.

---

 tools/binman/entry_test.py                    |   2 +-
 tools/binman/fdt_test.py                      |   4 +-
 tools/binman/ftest.py                         | 224 +++++++++---------
 .../test/{01_invalid.dts => 001_invalid.dts}  |   0
 ..._missing_node.dts => 002_missing_node.dts} |   0
 .../test/{03_empty.dts => 003_empty.dts}      |   0
 ...nvalid_entry.dts => 004_invalid_entry.dts} |   0
 .../test/{05_simple.dts => 005_simple.dts}    |   0
 .../{06_dual_image.dts => 006_dual_image.dts} |   0
 .../{07_bad_align.dts => 007_bad_align.dts}   |   0
 .../binman/test/{08_pack.dts => 008_pack.dts} |   0
 .../{09_pack_extra.dts => 009_pack_extra.dts} |   0
 ...n_power2.dts => 010_pack_align_power2.dts} |   0
 ...er2.dts => 011_pack_align_size_power2.dts} |   0
 ...k_inv_align.dts => 012_pack_inv_align.dts} |   0
 ..._align.dts => 013_pack_inv_size_align.dts} |   0
 ..._pack_overlap.dts => 014_pack_overlap.dts} |   0
 ...ack_overflow.dts => 015_pack_overflow.dts} |   0
 ...erflow.dts => 016_pack_image_overflow.dts} |   0
 ...image_size.dts => 017_pack_image_size.dts} |   0
 ...age_align.dts => 018_pack_image_align.dts} |   0
 ...align.dts => 019_pack_inv_image_align.dts} |   0
 ...ts => 020_pack_inv_image_align_power2.dts} |   0
 .../{21_image_pad.dts => 021_image_pad.dts}   |   0
 .../{22_image_name.dts => 022_image_name.dts} |   0
 .../binman/test/{23_blob.dts => 023_blob.dts} |   0
 .../test/{24_sorted.dts => 024_sorted.dts}    |   0
 ...k_zero_size.dts => 025_pack_zero_size.dts} |   0
 ...u_boot_dtb.dts => 026_pack_u_boot_dtb.dts} |   0
 ...b_no_size.dts => 027_pack_4gb_no_size.dts} |   0
 ...b_outside.dts => 028_pack_4gb_outside.dts} |   0
 .../test/{29_x86-rom.dts => 029_x86-rom.dts}  |   0
 ...no-desc.dts => 030_x86-rom-me-no-desc.dts} |   0
 .../{31_x86-rom-me.dts => 031_x86-rom-me.dts} |   0
 .../{32_intel-vga.dts => 032_intel-vga.dts}   |   0
 ...33_x86-start16.dts => 033_x86-start16.dts} |   0
 .../{34_x86_ucode.dts => 034_x86_ucode.dts}   |   0
 ...gle_ucode.dts => 035_x86_single_ucode.dts} |   0
 .../{36_u_boot_img.dts => 036_u_boot_img.dts} |   0
 ..._x86_no_ucode.dts => 037_x86_no_ucode.dts} |   0
 ...ode.dts => 038_x86_ucode_missing_node.dts} |   0
 ...e2.dts => 039_x86_ucode_missing_node2.dts} |   0
 ...age.dts => 040_x86_ucode_not_in_image.dts} |   0
 ..._pos_size.dts => 041_unknown_pos_size.dts} |   0
 .../{42_intel-fsp.dts => 042_intel-fsp.dts}   |   0
 .../{43_intel-cmc.dts => 043_intel-cmc.dts}   |   0
 ...l_ucode.dts => 044_x86_optional_ucode.dts} |   0
 .../{45_prop_test.dts => 045_prop_test.dts}   |   0
 .../{46_intel-vbt.dts => 046_intel-vbt.dts}   |   0
 ...47_spl_bss_pad.dts => 047_spl_bss_pad.dts} |   0
 ...tart16-spl.dts => 048_x86-start16-spl.dts} |   0
 ...86_ucode_spl.dts => 049_x86_ucode_spl.dts} |   0
 .../{50_intel_mrc.dts => 050_intel_mrc.dts}   |   0
 ...oot_spl_dtb.dts => 051_u_boot_spl_dtb.dts} |   0
 ...spl_nodtb.dts => 052_u_boot_spl_nodtb.dts} |   0
 .../test/{53_symbols.dts => 053_symbols.dts}  |   0
 ..._unit_address.dts => 054_unit_address.dts} |   0
 .../{55_sections.dts => 055_sections.dts}     |   0
 ...56_name_prefix.dts => 056_name_prefix.dts} |   0
 ..._contents.dts => 057_unknown_contents.dts} |   0
 ....dts => 058_x86_ucode_spl_needs_retry.dts} |   0
 ...59_change_size.dts => 059_change_size.dts} |   0
 .../{60_fdt_update.dts => 060_fdt_update.dts} |   0
 ..._update_bad.dts => 061_fdt_update_bad.dts} |   0
 .../{62_entry_args.dts => 062_entry_args.dts} |   0
 ...missing.dts => 063_entry_args_missing.dts} |   0
 ...quired.dts => 064_entry_args_required.dts} |   0
 ...ts => 065_entry_args_unknown_datatype.dts} |   0
 .../binman/test/{66_text.dts => 066_text.dts} |   0
 .../binman/test/{67_fmap.dts => 067_fmap.dts} |   0
 ...d_by_arg.dts => 068_blob_named_by_arg.dts} |   0
 .../binman/test/{69_fill.dts => 069_fill.dts} |   0
 ..._fill_no_size.dts => 070_fill_no_size.dts} |   0
 tools/binman/test/{71_gbb.dts => 071_gbb.dts} |   0
 ...bb_too_small.dts => 072_gbb_too_small.dts} |   0
 ...73_gbb_no_size.dts => 073_gbb_no_size.dts} |   0
 .../test/{74_vblock.dts => 074_vblock.dts}    |   0
 ..._content.dts => 075_vblock_no_content.dts} |   0
 ...phandle.dts => 076_vblock_bad_phandle.dts} |   0
 ...bad_entry.dts => 077_vblock_bad_entry.dts} |   0
 .../{78_u_boot_tpl.dts => 078_u_boot_tpl.dts} |   0
 .../{79_uses_pos.dts => 079_uses_pos.dts}     |   0
 .../{80_fill_empty.dts => 080_fill_empty.dts} |   0
 ...tart16-tpl.dts => 081_x86-start16-tpl.dts} |   0
 ..._update_all.dts => 082_fdt_update_all.dts} |   0
 .../{83_compress.dts => 083_compress.dts}     |   0
 .../test/{84_files.dts => 084_files.dts}      |   0
 ...es_compress.dts => 085_files_compress.dts} |   0
 .../{86_files_none.dts => 086_files_none.dts} |   0
 ...o_pattern.dts => 087_files_no_pattern.dts} |   0
 ...88_expand_size.dts => 088_expand_size.dts} |   0
 ...d_size_bad.dts => 089_expand_size_bad.dts} |   0
 .../binman/test/{90_hash.dts => 090_hash.dts} |   0
 ..._hash_no_algo.dts => 091_hash_no_algo.dts} |   0
 ...ash_bad_algo.dts => 092_hash_bad_algo.dts} |   0
 ...86_tpl_ucode.dts => 093_x86_tpl_ucode.dts} |   0
 .../{94_fmap_x86.dts => 094_fmap_x86.dts}     |   0
 ...6_section.dts => 095_fmap_x86_section.dts} |   0
 tools/binman/test/{96_elf.dts => 096_elf.dts} |   0
 .../{97_elf_strip.dts => 097_elf_strip.dts}   |   0
 ..._hash_section.dts => 099_hash_section.dts} |   0
 101 files changed, 115 insertions(+), 115 deletions(-)
 rename tools/binman/test/{01_invalid.dts => 001_invalid.dts} (100%)
 rename tools/binman/test/{02_missing_node.dts => 002_missing_node.dts} (100%)
 rename tools/binman/test/{03_empty.dts => 003_empty.dts} (100%)
 rename tools/binman/test/{04_invalid_entry.dts => 004_invalid_entry.dts} (100%)
 rename tools/binman/test/{05_simple.dts => 005_simple.dts} (100%)
 rename tools/binman/test/{06_dual_image.dts => 006_dual_image.dts} (100%)
 rename tools/binman/test/{07_bad_align.dts => 007_bad_align.dts} (100%)
 rename tools/binman/test/{08_pack.dts => 008_pack.dts} (100%)
 rename tools/binman/test/{09_pack_extra.dts => 009_pack_extra.dts} (100%)
 rename tools/binman/test/{10_pack_align_power2.dts =>
010_pack_align_power2.dts} (100%)
 rename tools/binman/test/{11_pack_align_size_power2.dts =>
011_pack_align_size_power2.dts} (100%)
 rename tools/binman/test/{12_pack_inv_align.dts =>
012_pack_inv_align.dts} (100%)
 rename tools/binman/test/{13_pack_inv_size_align.dts =>
013_pack_inv_size_align.dts} (100%)
 rename tools/binman/test/{14_pack_overlap.dts => 014_pack_overlap.dts} (100%)
 rename tools/binman/test/{15_pack_overflow.dts => 015_pack_overflow.dts} (100%)
 rename tools/binman/test/{16_pack_image_overflow.dts =>
016_pack_image_overflow.dts} (100%)
 rename tools/binman/test/{17_pack_image_size.dts =>
017_pack_image_size.dts} (100%)
 rename tools/binman/test/{18_pack_image_align.dts =>
018_pack_image_align.dts} (100%)
 rename tools/binman/test/{19_pack_inv_image_align.dts =>
019_pack_inv_image_align.dts} (100%)
 rename tools/binman/test/{20_pack_inv_image_align_power2.dts =>
020_pack_inv_image_align_power2.dts} (100%)
 rename tools/binman/test/{21_image_pad.dts => 021_image_pad.dts} (100%)
 rename tools/binman/test/{22_image_name.dts => 022_image_name.dts} (100%)
 rename tools/binman/test/{23_blob.dts => 023_blob.dts} (100%)
 rename tools/binman/test/{24_sorted.dts => 024_sorted.dts} (100%)
 rename tools/binman/test/{25_pack_zero_size.dts =>
025_pack_zero_size.dts} (100%)
 rename tools/binman/test/{26_pack_u_boot_dtb.dts =>
026_pack_u_boot_dtb.dts} (100%)
 rename tools/binman/test/{27_pack_4gb_no_size.dts =>
027_pack_4gb_no_size.dts} (100%)
 rename tools/binman/test/{28_pack_4gb_outside.dts =>
028_pack_4gb_outside.dts} (100%)
 rename tools/binman/test/{29_x86-rom.dts => 029_x86-rom.dts} (100%)
 rename tools/binman/test/{30_x86-rom-me-no-desc.dts =>
030_x86-rom-me-no-desc.dts} (100%)
 rename tools/binman/test/{31_x86-rom-me.dts => 031_x86-rom-me.dts} (100%)
 rename tools/binman/test/{32_intel-vga.dts => 032_intel-vga.dts} (100%)
 rename tools/binman/test/{33_x86-start16.dts => 033_x86-start16.dts} (100%)
 rename tools/binman/test/{34_x86_ucode.dts => 034_x86_ucode.dts} (100%)
 rename tools/binman/test/{35_x86_single_ucode.dts =>
035_x86_single_ucode.dts} (100%)
 rename tools/binman/test/{36_u_boot_img.dts => 036_u_boot_img.dts} (100%)
 rename tools/binman/test/{37_x86_no_ucode.dts => 037_x86_no_ucode.dts} (100%)
 rename tools/binman/test/{38_x86_ucode_missing_node.dts =>
038_x86_ucode_missing_node.dts} (100%)
 rename tools/binman/test/{39_x86_ucode_missing_node2.dts =>
039_x86_ucode_missing_node2.dts} (100%)
 rename tools/binman/test/{40_x86_ucode_not_in_image.dts =>
040_x86_ucode_not_in_image.dts} (100%)
 rename tools/binman/test/{41_unknown_pos_size.dts =>
041_unknown_pos_size.dts} (100%)
 rename tools/binman/test/{42_intel-fsp.dts => 042_intel-fsp.dts} (100%)
 rename tools/binman/test/{43_intel-cmc.dts => 043_intel-cmc.dts} (100%)
 rename tools/binman/test/{44_x86_optional_ucode.dts =>
044_x86_optional_ucode.dts} (100%)
 rename tools/binman/test/{45_prop_test.dts => 045_prop_test.dts} (100%)
 rename tools/binman/test/{46_intel-vbt.dts => 046_intel-vbt.dts} (100%)
 rename tools/binman/test/{47_spl_bss_pad.dts => 047_spl_bss_pad.dts} (100%)
 rename tools/binman/test/{48_x86-start16-spl.dts =>
048_x86-start16-spl.dts} (100%)
 rename tools/binman/test/{49_x86_ucode_spl.dts => 049_x86_ucode_spl.dts} (100%)
 rename tools/binman/test/{50_intel_mrc.dts => 050_intel_mrc.dts} (100%)
 rename tools/binman/test/{51_u_boot_spl_dtb.dts =>
051_u_boot_spl_dtb.dts} (100%)
 rename tools/binman/test/{52_u_boot_spl_nodtb.dts =>
052_u_boot_spl_nodtb.dts} (100%)
 rename tools/binman/test/{53_symbols.dts => 053_symbols.dts} (100%)
 rename tools/binman/test/{54_unit_address.dts => 054_unit_address.dts} (100%)
 rename tools/binman/test/{55_sections.dts => 055_sections.dts} (100%)
 rename tools/binman/test/{56_name_prefix.dts => 056_name_prefix.dts} (100%)
 rename tools/binman/test/{57_unknown_contents.dts =>
057_unknown_contents.dts} (100%)
 rename tools/binman/test/{58_x86_ucode_spl_needs_retry.dts =>
058_x86_ucode_spl_needs_retry.dts} (100%)
 rename tools/binman/test/{59_change_size.dts => 059_change_size.dts} (100%)
 rename tools/binman/test/{60_fdt_update.dts => 060_fdt_update.dts} (100%)
 rename tools/binman/test/{61_fdt_update_bad.dts =>
061_fdt_update_bad.dts} (100%)
 rename tools/binman/test/{62_entry_args.dts => 062_entry_args.dts} (100%)
 rename tools/binman/test/{63_entry_args_missing.dts =>
063_entry_args_missing.dts} (100%)
 rename tools/binman/test/{64_entry_args_required.dts =>
064_entry_args_required.dts} (100%)
 rename tools/binman/test/{65_entry_args_unknown_datatype.dts =>
065_entry_args_unknown_datatype.dts} (100%)
 rename tools/binman/test/{66_text.dts => 066_text.dts} (100%)
 rename tools/binman/test/{67_fmap.dts => 067_fmap.dts} (100%)
 rename tools/binman/test/{68_blob_named_by_arg.dts =>
068_blob_named_by_arg.dts} (100%)
 rename tools/binman/test/{69_fill.dts => 069_fill.dts} (100%)
 rename tools/binman/test/{70_fill_no_size.dts => 070_fill_no_size.dts} (100%)
 rename tools/binman/test/{71_gbb.dts => 071_gbb.dts} (100%)
 rename tools/binman/test/{72_gbb_too_small.dts => 072_gbb_too_small.dts} (100%)
 rename tools/binman/test/{73_gbb_no_size.dts => 073_gbb_no_size.dts} (100%)
 rename tools/binman/test/{74_vblock.dts => 074_vblock.dts} (100%)
 rename tools/binman/test/{75_vblock_no_content.dts =>
075_vblock_no_content.dts} (100%)
 rename tools/binman/test/{76_vblock_bad_phandle.dts =>
076_vblock_bad_phandle.dts} (100%)
 rename tools/binman/test/{77_vblock_bad_entry.dts =>
077_vblock_bad_entry.dts} (100%)
 rename tools/binman/test/{78_u_boot_tpl.dts => 078_u_boot_tpl.dts} (100%)
 rename tools/binman/test/{79_uses_pos.dts => 079_uses_pos.dts} (100%)
 rename tools/binman/test/{80_fill_empty.dts => 080_fill_empty.dts} (100%)
 rename tools/binman/test/{81_x86-start16-tpl.dts =>
081_x86-start16-tpl.dts} (100%)
 rename tools/binman/test/{82_fdt_update_all.dts =>
082_fdt_update_all.dts} (100%)
 rename tools/binman/test/{83_compress.dts => 083_compress.dts} (100%)
 rename tools/binman/test/{84_files.dts => 084_files.dts} (100%)
 rename tools/binman/test/{85_files_compress.dts =>
085_files_compress.dts} (100%)
 rename tools/binman/test/{86_files_none.dts => 086_files_none.dts} (100%)
 rename tools/binman/test/{87_files_no_pattern.dts =>
087_files_no_pattern.dts} (100%)
 rename tools/binman/test/{88_expand_size.dts => 088_expand_size.dts} (100%)
 rename tools/binman/test/{89_expand_size_bad.dts =>
089_expand_size_bad.dts} (100%)
 rename tools/binman/test/{90_hash.dts => 090_hash.dts} (100%)
 rename tools/binman/test/{91_hash_no_algo.dts => 091_hash_no_algo.dts} (100%)
 rename tools/binman/test/{92_hash_bad_algo.dts => 092_hash_bad_algo.dts} (100%)
 rename tools/binman/test/{93_x86_tpl_ucode.dts => 093_x86_tpl_ucode.dts} (100%)
 rename tools/binman/test/{94_fmap_x86.dts => 094_fmap_x86.dts} (100%)
 rename tools/binman/test/{95_fmap_x86_section.dts =>
095_fmap_x86_section.dts} (100%)
 rename tools/binman/test/{96_elf.dts => 096_elf.dts} (100%)
 rename tools/binman/test/{97_elf_strip.dts => 097_elf_strip.dts} (100%)
 rename tools/binman/test/{99_hash_section.dts => 099_hash_section.dts} (100%)

Applied to u-boot-dm

#59 lore raw

PATCH 27/45 binman: Add a test for Intel reference code

In reply to Simon Glass

Unfortunately the test was not included in the original implementation. Add one.

---

 tools/binman/ftest.py                   |  7 +++++++
 tools/binman/test/100_intel_refcode.dts | 14 ++++++++++++++
 2 files changed, 21 insertions(+)
 create mode 100644 tools/binman/test/100_intel_refcode.dts
tools/binman/ftest.py +7 -0
index 167f56dd060..e77fce5a26f 100644
@@ -60,6 +60,7 @@ VBLOCK_DATA           = 'vblk'
 FILES_DATA            = ("sorry I'm late\nOh, don't bother apologising, I'm " +
                          "sorry you're alive\n")
 COMPRESS_DATA         = 'data to compress'
+REFCODE_DATA          = 'refcode'
 
 
 class TestFunctional(unittest.TestCase):
@@ -115,6 +116,7 @@ class TestFunctional(unittest.TestCase):
         TestFunctional._MakeInputFile('ecrw.bin', CROS_EC_RW_DATA)
         TestFunctional._MakeInputDir('devkeys')
         TestFunctional._MakeInputFile('bmpblk.bin', BMPBLK_DATA)
+        TestFunctional._MakeInputFile('refcode.bin', REFCODE_DATA)
 
         # ELF file with a '_dt_ucode_base_size' symbol
         with open(self.TestFile('u_boot_ucode_ptr')) as fd:
@@ -1764,6 +1766,11 @@ class TestFunctional(unittest.TestCase):
 <none>     00000003  00000004  u-boot-align
 ''', map_data)
 
+    def testPacRefCode(self):
+        """Test that an image with an Intel Reference code binary works"""
+        data = self._DoReadFile('100_intel_refcode.dts')
+        self.assertEqual(REFCODE_DATA, data[:len(REFCODE_DATA)])
+
 
 if __name__ == "__main__":
     unittest.main()
tools/binman/test/100_intel_refcode.dts new file +14 -0
new file mode 100644
index 00000000000..0a1a0270e5f
@@ -0,0 +1,14 @@
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	binman {
+		size = <16>;
+
+		intel-refcode {
+			filename = "refcode.bin";
+		};
+	};
+};
Signature · 1 line
2.19.0.605.g01d371f741-goog
#60 lore raw

PATCH 27/45 binman: Add a test for Intel reference code

Unfortunately the test was not included in the original implementation. Add one.

---

 tools/binman/ftest.py                   |  7 +++++++
 tools/binman/test/100_intel_refcode.dts | 14 ++++++++++++++
 2 files changed, 21 insertions(+)
 create mode 100644 tools/binman/test/100_intel_refcode.dts

Applied to u-boot-dm

#61 lore raw

PATCH 27/45 binman: Add a test for Intel reference code

In reply to Simon Glass
Quoted 5 lines · Simon Glass

Unfortunately the test was not included in the original implementation. Add one.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181022/d371d750/attachment.sig>
#62 lore raw

PATCH 28/45 log: Add comments to the rest of the log categories

In reply to Simon Glass

At present some of the log categories are missing comments. Add them.

---

 include/log.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
include/log.h +6 -6
index 623f0fc32f7..0243bc08a4f 100644
@@ -39,18 +39,18 @@ enum log_level_t {
 enum log_category_t {
 	LOGC_FIRST = 0,	/* First part mirrors UCLASS_... */
 
-	LOGC_NONE = UCLASS_COUNT,
-	LOGC_ARCH,
-	LOGC_BOARD,
-	LOGC_CORE,
+	LOGC_NONE = UCLASS_COUNT,	/* First number is after all uclasses */
+	LOGC_ARCH,	/* Related to arch-specific code */
+	LOGC_BOARD,	/* Related to board-specific code */
+	LOGC_CORE,	/* Related to core features (non-driver-model) */
 	LOGC_DM,	/* Core driver-model */
 	LOGC_DT,	/* Device-tree */
 	LOGC_EFI,	/* EFI implementation */
 	LOGC_BLOBLIST,	/* Bloblist */
 	LOGC_ALLOC,	/* Memory allocation */
 
-	LOGC_COUNT,
-	LOGC_END,
+	LOGC_COUNT,	/* Number of log categories */
+	LOGC_END,	/* Sentinel value for a list of log categories */
 };
 
 /* Helper to cast a uclass ID to a log category */
Signature · 1 line
2.19.0.605.g01d371f741-goog
#63 lore raw

PATCH 28/45 log: Add comments to the rest of the log categories

At present some of the log categories are missing comments. Add them.

---

 include/log.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Applied to u-boot-dm

#64 lore raw

PATCH 29/45 malloc_simple: Add logging of allocations

In reply to Simon Glass

It is sometimes useful to see what memory is being allocated early during boot. Add logging to support this, using a new LOGC_ALLOC category.

---

 common/malloc_simple.c | 58 +++++++++++++++++++++++++++---------------
 include/malloc.h       |  1 +
 2 files changed, 38 insertions(+), 21 deletions(-)
common/malloc_simple.c +37 -21
index 871b5444bd7..aae0b66680a 100644
@@ -5,6 +5,8 @@
  * Copyright (c) 2014 Google, Inc
  */
 
+#define LOG_CATEGORY LOGC_ALLOC
+
 #include <common.h>
 #include <malloc.h>
 #include <mapmem.h>
@@ -12,40 +14,47 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-void *malloc_simple(size_t bytes)
+static void *alloc_simple(size_t bytes, int align)
 {
-	ulong new_ptr;
+	ulong addr, new_ptr;
 	void *ptr;
 
-	new_ptr = gd->malloc_ptr + bytes;
-	debug("%s: size=%zx, ptr=%lx, limit=%lx: ", __func__, bytes, new_ptr,
-	      gd->malloc_limit);
+	addr = ALIGN(gd->malloc_base + gd->malloc_ptr, align);
+	new_ptr = addr + bytes - gd->malloc_base;
+	log_debug("size=%zx, ptr=%lx, limit=%lx: ", bytes, new_ptr,
+	gd->malloc_limit);
 	if (new_ptr > gd->malloc_limit) {
-		debug("space exhausted\n");
+		log(LOGC_ALLOC, LOGL_ERR, "alloc space exhausted\n");
 		return NULL;
 	}
-	ptr = map_sysmem(gd->malloc_base + gd->malloc_ptr, bytes);
+
+	ptr = map_sysmem(addr, bytes);
 	gd->malloc_ptr = ALIGN(new_ptr, sizeof(new_ptr));
-	debug("%lx\n", (ulong)ptr);
 
 	return ptr;
 }
 
-void *memalign_simple(size_t align, size_t bytes)
+void *malloc_simple(size_t bytes)
 {
-	ulong addr, new_ptr;
 	void *ptr;
 
-	addr = ALIGN(gd->malloc_base + gd->malloc_ptr, align);
-	new_ptr = addr + bytes - gd->malloc_base;
-	if (new_ptr > gd->malloc_limit) {
-		debug("space exhausted\n");
-		return NULL;
-	}
+	ptr = alloc_simple(bytes, 1);
+	if (!ptr)
+		return ptr;
 
-	ptr = map_sysmem(addr, bytes);
-	gd->malloc_ptr = ALIGN(new_ptr, sizeof(new_ptr));
-	debug("%lx\n", (ulong)ptr);
+	log_debug("%lx\n", (ulong)ptr);
+
+	return ptr;
+}
+
+void *memalign_simple(size_t align, size_t bytes)
+{
+	void *ptr;
+
+	ptr = alloc_simple(bytes, align);
+	if (!ptr)
+		return ptr;
+	log_debug("aligned to %lx\n", (ulong)ptr);
 
 	return ptr;
 }
@@ -57,9 +66,16 @@ void *calloc(size_t nmemb, size_t elem_size)
 	void *ptr;
 
 	ptr = malloc(size);
-	if (ptr)
-		memset(ptr, '\0', size);
+	if (!ptr)
+		return ptr;
+	memset(ptr, '\0', size);
 
 	return ptr;
 }
 #endif
+
+void malloc_simple_info(void)
+{
+	log_info("malloc_simple: %lx bytes used, %lx remain\n", gd->malloc_ptr,
+		 CONFIG_VAL(SYS_MALLOC_F_LEN) - gd->malloc_ptr);
+}
include/malloc.h +1 -0
index 8175c75920c..b714fedf457 100644
@@ -880,6 +880,7 @@ static inline void free(void *ptr) {}
 void *calloc(size_t nmemb, size_t size);
 void *memalign_simple(size_t alignment, size_t bytes);
 void *realloc_simple(void *ptr, size_t size);
+void malloc_simple_info(void);
 #else
 
 # ifdef USE_DL_PREFIX
Signature · 1 line
2.19.0.605.g01d371f741-goog
#65 lore raw

PATCH 29/45 malloc_simple: Add logging of allocations

It is sometimes useful to see what memory is being allocated early during boot. Add logging to support this, using a new LOGC_ALLOC category.

---

 common/malloc_simple.c | 58 +++++++++++++++++++++++++++---------------
 include/malloc.h       |  1 +
 2 files changed, 38 insertions(+), 21 deletions(-)

Applied to u-boot-dm

#66 lore raw

PATCH 30/45 Add a header file for strings

In reply to Simon Glass

Add a string.h header for libraries that expect this to be available, now that U-Boot's version has moved to include/linux.

---

 include/string.h | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 include/string.h
include/string.h new file +1 -0
new file mode 100644
index 00000000000..38134dcf4c7
@@ -0,0 +1 @@
+#include <linux/string.h>
Signature · 1 line
2.19.0.605.g01d371f741-goog
#67 lore raw

PATCH 30/45 Add a header file for strings

Add a string.h header for libraries that expect this to be available, now that U-Boot's version has moved to include/linux.

---

 include/string.h | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 include/string.h

Applied to u-boot-dm

#68 lore raw

PATCH 31/45 Rename GPT_HEADER_SIGNATURE to avoid conflict

In reply to Simon Glass

The current name conflicts with the Chrome OS verified boot library, which prevents it being built. That library uses a string whereas U-Boot uses a 64-bit hex value. Rename this in U-Boot.

---

 disk/part_efi.c    | 6 +++---
 include/part_efi.h | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
disk/part_efi.c +3 -3
index 519a6376848..d6bb53e6b5d 100644
@@ -82,11 +82,11 @@ static int validate_gpt_header(gpt_header *gpt_h, lbaint_t lba,
 	uint32_t calc_crc32;
 
 	/* Check the GPT header signature */
-	if (le64_to_cpu(gpt_h->signature) != GPT_HEADER_SIGNATURE) {
+	if (le64_to_cpu(gpt_h->signature) != GPT_HEADER_SIGNATURE_UBOOT) {
 		printf("%s signature is wrong: 0x%llX != 0x%llX\n",
 		       "GUID Partition Table Header",
 		       le64_to_cpu(gpt_h->signature),
-		       GPT_HEADER_SIGNATURE);
+		       GPT_HEADER_SIGNATURE_UBOOT);
 		return -1;
 	}
 
@@ -603,7 +603,7 @@ static uint32_t partition_entries_offset(struct blk_desc *dev_desc)
 int gpt_fill_header(struct blk_desc *dev_desc, gpt_header *gpt_h,
 		char *str_guid, int parts_count)
 {
-	gpt_h->signature = cpu_to_le64(GPT_HEADER_SIGNATURE);
+	gpt_h->signature = cpu_to_le64(GPT_HEADER_SIGNATURE_UBOOT);
 	gpt_h->revision = cpu_to_le32(GPT_HEADER_REVISION_V1);
 	gpt_h->header_size = cpu_to_le32(sizeof(gpt_header));
 	gpt_h->my_lba = cpu_to_le64(1);
include/part_efi.h +1 -1
index 8525770445a..7170b61c955 100644
@@ -24,7 +24,7 @@
 #define EFI_PMBR_OSTYPE_EFI 0xEF
 #define EFI_PMBR_OSTYPE_EFI_GPT 0xEE
 
-#define GPT_HEADER_SIGNATURE 0x5452415020494645ULL
+#define GPT_HEADER_SIGNATURE_UBOOT 0x5452415020494645ULL
 #define GPT_HEADER_REVISION_V1 0x00010000
 #define GPT_PRIMARY_PARTITION_TABLE_LBA 1ULL
 #define GPT_ENTRY_NUMBERS		CONFIG_EFI_PARTITION_ENTRIES_NUMBERS
Signature · 1 line
2.19.0.605.g01d371f741-goog
#69 lore raw

PATCH 31/45 Rename GPT_HEADER_SIGNATURE to avoid conflict

The current name conflicts with the Chrome OS verified boot library, which prevents it being built. That library uses a string whereas U-Boot uses a 64-bit hex value. Rename this in U-Boot.

---

 disk/part_efi.c    | 6 +++---
 include/part_efi.h | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

Applied to u-boot-dm

#70 lore raw

PATCH 32/45 cros: Update ec_commands to latest version

In reply to Simon Glass

This file has changed quite a bit in the last 5 years as the capabilities of the ECs have grown. Sync it up with the copy in coreboot commit b9141f2215.

The only change is the addition of EC_VBNV_BLOCK_SIZE_V2. This is needed because U-Boot uses the new v2 vboot API and this is not currently fully supported by Chromium OS firmware.

---

 cmd/cros_ec.c                  |    5 +-
 drivers/misc/cros_ec.c         |    7 +-
 drivers/misc/cros_ec_sandbox.c |    4 +-
 include/ec_commands.h          | 4324 ++++++++++++++++++++++++++------
 4 files changed, 3613 insertions(+), 727 deletions(-)
cmd/cros_ec.c +2 -3
index fb369a4e329..3ac4f3b235d 100644
@@ -27,7 +27,7 @@ static int cros_ec_decode_region(int argc, char * const argv[])
 {
 	if (argc > 0) {
 		if (0 == strcmp(*argv, "rw"))
-			return EC_FLASH_REGION_RW;
+			return EC_FLASH_REGION_ACTIVE;
 		else if (0 == strcmp(*argv, "ro"))
 			return EC_FLASH_REGION_RO;
 
@@ -137,7 +137,6 @@ static int do_cros_ec(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		}
 		printf("rows     = %u\n", info.rows);
 		printf("cols     = %u\n", info.cols);
-		printf("switches = %#x\n", info.switches);
 	} else if (0 == strcmp("curimage", cmd)) {
 		enum ec_current_image image;
 
@@ -177,7 +176,7 @@ static int do_cros_ec(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 			region = cros_ec_decode_region(argc - 2, argv + 2);
 			if (region == EC_FLASH_REGION_RO)
 				cmd = EC_REBOOT_JUMP_RO;
-			else if (region == EC_FLASH_REGION_RW)
+			else if (region == EC_FLASH_REGION_ACTIVE)
 				cmd = EC_REBOOT_JUMP_RW;
 			else
 				return CMD_RET_USAGE;
drivers/misc/cros_ec.c +4 -3
index 5ccf8ad359b..2deed0e839f 100644
@@ -473,7 +473,7 @@ int cros_ec_read_hash(struct udevice *dev, struct ec_response_vboot_hash *hash)
 	p.cmd = EC_VBOOT_HASH_START;
 	p.hash_type = EC_VBOOT_HASH_TYPE_SHA256;
 	p.nonce_size = 0;
-	p.offset = EC_VBOOT_HASH_OFFSET_RW;
+	p.offset = EC_VBOOT_HASH_OFFSET_ACTIVE;
 
 	if (ec_command(dev, EC_CMD_VBOOT_HASH, 0, &p, sizeof(p),
 		       hash, sizeof(*hash)) < 0)
@@ -894,7 +894,8 @@ int cros_ec_flash_update_rw(struct udevice *dev, const uint8_t *image,
 	uint32_t rw_offset, rw_size;
 	int ret;
 
-	if (cros_ec_flash_offset(dev, EC_FLASH_REGION_RW, &rw_offset, &rw_size))
+	if (cros_ec_flash_offset(dev, EC_FLASH_REGION_ACTIVE, &rw_offset,
+		&rw_size))
 		return -1;
 	if (image_size > (int)rw_size)
 		return -1;
@@ -1045,7 +1046,7 @@ int cros_ec_decode_ec_flash(struct udevice *dev, struct fdt_cros_ec *config)
 		if (0 == strcmp(name, "ro")) {
 			region = EC_FLASH_REGION_RO;
 		} else if (0 == strcmp(name, "rw")) {
-			region = EC_FLASH_REGION_RW;
+			region = EC_FLASH_REGION_ACTIVE;
 		} else if (0 == strcmp(name, "wp-ro")) {
 			region = EC_FLASH_REGION_WP_RO;
 		} else {
drivers/misc/cros_ec_sandbox.c +2 -2
index dedad9b8573..d741554d8a6 100644
@@ -365,7 +365,7 @@ static int process_cmd(struct ec_state *ec,
 		struct fmap_entry *entry;
 		int ret, size;
 
-		entry = &ec->ec_config.region[EC_FLASH_REGION_RW];
+		entry = &ec->ec_config.region[EC_FLASH_REGION_ACTIVE];
 
 		switch (req->cmd) {
 		case EC_VBOOT_HASH_RECALC:
@@ -420,7 +420,7 @@ static int process_cmd(struct ec_state *ec,
 
 		switch (req->region) {
 		case EC_FLASH_REGION_RO:
-		case EC_FLASH_REGION_RW:
+		case EC_FLASH_REGION_ACTIVE:
 		case EC_FLASH_REGION_WP_RO:
 			entry = &ec->ec_config.region[req->region];
 			resp->offset = entry->offset;
include/ec_commands.h +3605 -719

2,936 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.19.0.605.g01d371f741-goog

Part of the diff is not shown here. View the raw message.

#71 lore raw

PATCH 32/45 cros: Update ec_commands to latest version

This file has changed quite a bit in the last 5 years as the capabilities of the ECs have grown. Sync it up with the copy in coreboot commit b9141f2215.

The only change is the addition of EC_VBNV_BLOCK_SIZE_V2. This is needed because U-Boot uses the new v2 vboot API and this is not currently fully supported by Chromium OS firmware.

---

 cmd/cros_ec.c                  |    5 +-
 drivers/misc/cros_ec.c         |    7 +-
 drivers/misc/cros_ec_sandbox.c |    4 +-
 include/ec_commands.h          | 4324 ++++++++++++++++++++++++++------
 4 files changed, 3613 insertions(+), 727 deletions(-)

Applied to u-boot-dm

#72 lore raw

PATCH 33/45 x86: Update mtrr functions to allow leaving cache alone

In reply to Simon Glass

At present the mtrr functions disable the cache before making changes and enable it again afterwards. This is fine in U-Boot, but does not work if running in CAR (such as we are in SPL).

Update the functions so that the caller can request that caches be left alone.

---

 arch/x86/cpu/mtrr.c         | 31 +++++++++++++++++++++++--------
 arch/x86/include/asm/mtrr.h |  6 ++++--
 cmd/x86/mtrr.c              |  8 ++++----
 3 files changed, 31 insertions(+), 14 deletions(-)
arch/x86/cpu/mtrr.c +23 -8
index 30940065621..0939736164d 100644
@@ -11,6 +11,11 @@
  * System Programming
  */
 
+/*
+ * Note that any console output (e.g. debug()) in this file will likely fail
+ * since the MTRR registers are sometimes in flux.
+ */
+
 #include <common.h>
 #include <asm/io.h>
 #include <asm/msr.h>
@@ -19,27 +24,29 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 /* Prepare to adjust MTRRs */
-void mtrr_open(struct mtrr_state *state)
+void mtrr_open(struct mtrr_state *state, bool do_caches)
 {
 	if (!gd->arch.has_mtrr)
 		return;
 
-	state->enable_cache = dcache_status();
+	if (do_caches) {
+		state->enable_cache = dcache_status();
 
-	if (state->enable_cache)
-		disable_caches();
+		if (state->enable_cache)
+			disable_caches();
+	}
 	state->deftype = native_read_msr(MTRR_DEF_TYPE_MSR);
 	wrmsrl(MTRR_DEF_TYPE_MSR, state->deftype & ~MTRR_DEF_TYPE_EN);
 }
 
 /* Clean up after adjusting MTRRs, and enable them */
-void mtrr_close(struct mtrr_state *state)
+void mtrr_close(struct mtrr_state *state, bool do_caches)
 {
 	if (!gd->arch.has_mtrr)
 		return;
 
 	wrmsrl(MTRR_DEF_TYPE_MSR, state->deftype | MTRR_DEF_TYPE_EN);
-	if (state->enable_cache)
+	if (do_caches && state->enable_cache)
 		enable_caches();
 }
 
@@ -50,10 +57,14 @@ int mtrr_commit(bool do_caches)
 	uint64_t mask;
 	int i;
 
+	debug("%s: enabled=%d, count=%d\n", __func__, gd->arch.has_mtrr,
+	      gd->arch.mtrr_req_count);
 	if (!gd->arch.has_mtrr)
 		return -ENOSYS;
 
-	mtrr_open(&state);
+	debug("open\n");
+	mtrr_open(&state, do_caches);
+	debug("open done\n");
 	for (i = 0; i < gd->arch.mtrr_req_count; i++, req++) {
 		mask = ~(req->size - 1);
 		mask &= (1ULL << CONFIG_CPU_ADDR_BITS) - 1;
@@ -62,9 +73,12 @@ int mtrr_commit(bool do_caches)
 	}
 
 	/* Clear the ones that are unused */
+	debug("clear\n");
 	for (; i < MTRR_COUNT; i++)
 		wrmsrl(MTRR_PHYS_MASK_MSR(i), 0);
-	mtrr_close(&state);
+	debug("close\n");
+	mtrr_close(&state, do_caches);
+	debug("mtrr done\n");
 
 	return 0;
 }
@@ -74,6 +88,7 @@ int mtrr_add_request(int type, uint64_t start, uint64_t size)
 	struct mtrr_request *req;
 	uint64_t mask;
 
+	debug("%s: count=%d\n", __func__, gd->arch.mtrr_req_count);
 	if (!gd->arch.has_mtrr)
 		return -ENOSYS;
 
arch/x86/include/asm/mtrr.h +4 -2
index 05cd7b7f17b..2d897f82ef7 100644
@@ -77,8 +77,9 @@ struct mtrr_state {
  * possibly the cache.
  *
  * @state:	Empty structure to pass in to hold settings
+ * @do_caches:	true to disable caches before opening
  */
-void mtrr_open(struct mtrr_state *state);
+void mtrr_open(struct mtrr_state *state, bool do_caches);
 
 /**
  * mtrr_open() - Clean up after adjusting MTRRs, and enable them
@@ -86,8 +87,9 @@ void mtrr_open(struct mtrr_state *state);
  * This uses the structure containing information returned from mtrr_open().
  *
  * @state:	Structure from mtrr_open()
+ * @state:	true to restore cache state to that before mtrr_open()
  */
-void mtrr_close(struct mtrr_state *state);
+void mtrr_close(struct mtrr_state *state, bool do_caches);
 
 /**
  * mtrr_add_request() - Add a new MTRR request
cmd/x86/mtrr.c +4 -4
index 70f373a72a5..d3fd959235f 100644
@@ -73,10 +73,10 @@ static int do_mtrr_set(uint reg, int argc, char * const argv[])
 		mask |= MTRR_PHYS_MASK_VALID;
 
 	printf("base=%llx, mask=%llx\n", base, mask);
-	mtrr_open(&state);
+	mtrr_open(&state, true);
 	wrmsrl(MTRR_PHYS_BASE_MSR(reg), base);
 	wrmsrl(MTRR_PHYS_MASK_MSR(reg), mask);
-	mtrr_close(&state);
+	mtrr_close(&state, true);
 
 	return 0;
 }
@@ -86,14 +86,14 @@ static int mtrr_set_valid(int reg, bool valid)
 	struct mtrr_state state;
 	uint64_t mask;
 
-	mtrr_open(&state);
+	mtrr_open(&state, true);
 	mask = native_read_msr(MTRR_PHYS_MASK_MSR(reg));
 	if (valid)
 		mask |= MTRR_PHYS_MASK_VALID;
 	else
 		mask &= ~MTRR_PHYS_MASK_VALID;
 	wrmsrl(MTRR_PHYS_MASK_MSR(reg), mask);
-	mtrr_close(&state);
+	mtrr_close(&state, true);
 
 	return 0;
 }
Signature · 1 line
2.19.0.605.g01d371f741-goog
#73 lore raw

PATCH 33/45 x86: Update mtrr functions to allow leaving cache alone

Quoted 8 lines · Simon Glass

At present the mtrr functions disable the cache before making changes and enable it again afterwards. This is fine in U-Boot, but does not work if running in CAR (such as we are in SPL).

Update the functions so that the caller can request that caches be left alone.

Quoted 8 lines

---

 arch/x86/cpu/mtrr.c         | 31 +++++++++++++++++++++++--------
 arch/x86/include/asm/mtrr.h |  6 ++++--
 cmd/x86/mtrr.c              |  8 ++++----
 3 files changed, 31 insertions(+), 14 deletions(-)
#74 lore raw

PATCH 33/45 x86: Update mtrr functions to allow leaving cache alone

Quoted 8 lines · Simon Glass

At present the mtrr functions disable the cache before making changes and enable it again afterwards. This is fine in U-Boot, but does not work if running in CAR (such as we are in SPL).

Update the functions so that the caller can request that caches be left alone.

Quoted 8 lines

---

 arch/x86/cpu/mtrr.c         | 31 +++++++++++++++++++++++--------
 arch/x86/include/asm/mtrr.h |  6 ++++--
 cmd/x86/mtrr.c              |  8 ++++----
 3 files changed, 31 insertions(+), 14 deletions(-)

Applied to u-boot-dm

#75 lore raw

PATCH 34/45 cros_ec: Update cros_ec_read_hash() to specify the image

In reply to Simon Glass

Allow selection of which EC image to hash.

---

 cmd/cros_ec.c          | 2 +-
 drivers/misc/cros_ec.c | 7 ++++---
 include/cros_ec.h      | 4 +++-
 3 files changed, 8 insertions(+), 5 deletions(-)
cmd/cros_ec.c +1 -1
index 3ac4f3b235d..9e2f1b06f3c 100644
@@ -149,7 +149,7 @@ static int do_cros_ec(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		struct ec_response_vboot_hash hash;
 		int i;
 
-		if (cros_ec_read_hash(dev, &hash)) {
+		if (cros_ec_read_hash(dev, EC_VBOOT_HASH_OFFSET_ACTIVE, &hash)) {
 			debug("%s: Could not read KBC hash\n", __func__);
 			return 1;
 		}
drivers/misc/cros_ec.c +4 -3
index 2deed0e839f..d2543f8ddc0 100644
@@ -444,13 +444,14 @@ static int cros_ec_wait_on_hash_done(struct udevice *dev,
 	return 0;
 }
 
-
-int cros_ec_read_hash(struct udevice *dev, struct ec_response_vboot_hash *hash)
+int cros_ec_read_hash(struct udevice *dev, uint hash_offset,
+		      struct ec_response_vboot_hash *hash)
 {
 	struct ec_params_vboot_hash p;
 	int rv;
 
 	p.cmd = EC_VBOOT_HASH_GET;
+	p.offset = hash_offset;
 	if (ec_command(dev, EC_CMD_VBOOT_HASH, 0, &p, sizeof(p),
 		       hash, sizeof(*hash)) < 0)
 		return -1;
@@ -473,7 +474,7 @@ int cros_ec_read_hash(struct udevice *dev, struct ec_response_vboot_hash *hash)
 	p.cmd = EC_VBOOT_HASH_START;
 	p.hash_type = EC_VBOOT_HASH_TYPE_SHA256;
 	p.nonce_size = 0;
-	p.offset = EC_VBOOT_HASH_OFFSET_ACTIVE;
+	p.offset = hash_offset;
 
 	if (ec_command(dev, EC_CMD_VBOOT_HASH, 0, &p, sizeof(p),
 		       hash, sizeof(*hash)) < 0)
include/cros_ec.h +3 -1
index 5576bcf32ee..4771e6b7d1c 100644
@@ -96,10 +96,12 @@ int cros_ec_read_current_image(struct udevice *dev,
  * Read the hash of the CROS-EC device firmware.
  *
  * @param dev		CROS-EC device
+ * @param hash_offset	Offset in flash to read from
  * @param hash		Destination for hash information
  * @return 0 if ok, <0 on error
  */
-int cros_ec_read_hash(struct udevice *dev, struct ec_response_vboot_hash *hash);
+int cros_ec_read_hash(struct udevice *dev, uint hash_offset,
+		      struct ec_response_vboot_hash *hash);
 
 /**
  * Send a reboot command to the CROS-EC device.
Signature · 1 line
2.19.0.605.g01d371f741-goog
#76 lore raw

PATCH 34/45 cros_ec: Update cros_ec_read_hash() to specify the image

Allow selection of which EC image to hash.

---

 cmd/cros_ec.c          | 2 +-
 drivers/misc/cros_ec.c | 7 ++++---
 include/cros_ec.h      | 4 +++-
 3 files changed, 8 insertions(+), 5 deletions(-)

Applied to u-boot-dm

#77 lore raw

PATCH 35/45 cros_ec: Add support for v3 messages on LPC

In reply to Simon Glass

At present version 3 messages are only supported on SPI. Add support for using LPC as well, as used on samus.

---

 drivers/misc/cros_ec_lpc.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
drivers/misc/cros_ec_lpc.c +33 -0
index be17adcc5ac..71d03bfba2b 100644
@@ -40,6 +40,38 @@ static int wait_for_sync(struct cros_ec_dev *dev)
 	return 0;
 }
 
+int cros_ec_lpc_packet(struct udevice *udev, int out_bytes, int in_bytes)
+{
+	struct cros_ec_dev *dev = dev_get_uclass_priv(udev);
+	uint8_t *d;
+	int i;
+
+	if (out_bytes > EC_LPC_HOST_PACKET_SIZE)
+		return log_msg_ret("Cannot send that many bytes\n", -E2BIG);
+
+	if (in_bytes > EC_LPC_HOST_PACKET_SIZE)
+		return log_msg_ret("Cannot receive that many bytes\n", -E2BIG);
+
+	if (wait_for_sync(dev))
+		return log_msg_ret("Timeout waiting ready\n", -ETIMEDOUT);
+
+	/* Write data */
+	for (i = 0, d = (uint8_t *)dev->dout; i < out_bytes; i++, d++)
+		outb(*d, EC_LPC_ADDR_HOST_PACKET + i);
+
+	/* Start the command */
+	outb(EC_COMMAND_PROTOCOL_3, EC_LPC_ADDR_HOST_CMD);
+
+	if (wait_for_sync(dev))
+		return log_msg_ret("Timeout waiting ready\n", -ETIMEDOUT);
+
+	/* Read back args */
+	for (i = 0, d = dev->din; i < in_bytes; i++, d++)
+		*d = inb(EC_LPC_ADDR_HOST_PACKET + i);
+
+	return in_bytes;
+}
+
 int cros_ec_lpc_command(struct udevice *udev, uint8_t cmd, int cmd_version,
 		     const uint8_t *dout, int dout_len,
 		     uint8_t **dinp, int din_len)
@@ -200,6 +232,7 @@ static int cros_ec_probe(struct udevice *dev)
 }
 
 static struct dm_cros_ec_ops cros_ec_ops = {
+	.packet = cros_ec_lpc_packet,
 	.command = cros_ec_lpc_command,
 	.check_version = cros_ec_lpc_check_version,
 };
Signature · 1 line
2.19.0.605.g01d371f741-goog
#78 lore raw

PATCH 35/45 cros_ec: Add support for v3 messages on LPC

At present version 3 messages are only supported on SPI. Add support for using LPC as well, as used on samus.

---

 drivers/misc/cros_ec_lpc.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

Applied to u-boot-dm

#79 lore raw

PATCH 36/45 test: panel: Add a test for the panel uclass

In reply to Simon Glass

At present this uclass has no tests. Add a simple one which checks the PWM configuration, regulator and GPIO.

---

 arch/sandbox/dts/sandbox_pmic.dtsi |  2 +-
 arch/sandbox/dts/test.dts          | 20 +++++++++++-
 arch/sandbox/include/asm/test.h    | 15 +++++++++
 drivers/pwm/sandbox_pwm.c          | 25 +++++++++++++++
 test/dm/Makefile                   |  1 +
 test/dm/panel.c                    | 50 ++++++++++++++++++++++++++++++
 6 files changed, 111 insertions(+), 2 deletions(-)
 create mode 100644 test/dm/panel.c
arch/sandbox/dts/sandbox_pmic.dtsi +1 -1
index 403656f25e5..5ecafaab364 100644
@@ -60,7 +60,7 @@
 		regulator-max-microvolt = <3300000>;
 	};
 
-	ldo1 {
+	ldo_1: ldo1 {
 		regulator-name = "VDD_EMMC_1.8V";
 		regulator-min-microvolt = <1800000>;
 		regulator-max-microvolt = <1800000>;
arch/sandbox/dts/test.dts +19 -1
index 491f889f3b9..43f79509f75 100644
@@ -11,6 +11,8 @@
 		eth0 = "/eth at 10002000";
 		eth3 = &eth_3;
 		eth5 = &eth_5;
+		gpio1 = &gpio_a;
+		gpio2 = &gpio_b;
 		i2c0 = "/i2c at 0";
 		mmc0 = "/mmc0";
 		mmc1 = "/mmc1";
@@ -62,6 +64,15 @@
 		reg = <2 1>;
 	};
 
+	backlight: backlight {
+		compatible = "pwm-backlight";
+		enable-gpios = <&gpio_a 1>;
+		power-supply = <&ldo_1>;
+		pwms = <&pwm 0 1000>;
+		default-brightness-level = <5>;
+		brightness-levels = <0 16 32 64 128 170 202 234 255>;
+	};
+
 	bind-test {
 		bind-test-child1 {
 			compatible = "sandbox,phy";
@@ -412,12 +423,14 @@
 		power-domains = <&pwrdom 2>;
 	};
 
-	pwm {
+	pwm: pwm {
 		compatible = "sandbox,pwm";
+		#pwm-cells = <2>;
 	};
 
 	pwm2 {
 		compatible = "sandbox,pwm";
+		#pwm-cells = <2>;
 	};
 
 	ram {
@@ -454,6 +467,11 @@
 		remoteproc-name = "remoteproc-test-dev2";
 	};
 
+	panel {
+		compatible = "simple-panel";
+		backlight = <&backlight 0 100>;
+	};
+
 	smem at 0 {
 		compatible = "sandbox,smem";
 	};
arch/sandbox/include/asm/test.h +15 -0
index 89f3d90c734..8e60f80ae7f 100644
@@ -98,4 +98,19 @@ int sandbox_usb_keyb_add_string(struct udevice *dev, const char *str);
  * @buflen:	length of buffer in bytes
  */
 int sandbox_osd_get_mem(struct udevice *dev, u8 *buf, size_t buflen);
+
+/**
+ * sandbox_pwm_get_config() - get the PWM config for a channel
+ *
+ * @dev: Device to check
+ * @channel: Channel number to check
+ * @period_ns: Period of the PWM in nanoseconds
+ * @duty_ns: Current duty cycle of the PWM in nanoseconds
+ * @enable: true if the PWM is enabled
+ * @polarity: true if the PWM polarity is active high
+ * @return 0 if OK, -ENOSPC if the PWM number is invalid
+ */
+int sandbox_pwm_get_config(struct udevice *dev, uint channel, uint *period_nsp,
+			   uint *duty_nsp, bool *enablep, bool *polarityp);
+
 #endif
drivers/pwm/sandbox_pwm.c +25 -0
index 4b50b19c618..28988187e03 100644
@@ -14,6 +14,14 @@ enum {
 	NUM_CHANNELS	= 3,
 };
 
+/**
+ * struct sandbox_pwm_chan - a sandbox PWM channel
+ *
+ * @period_ns: Period of the PWM in nanoseconds
+ * @duty_ns: Current duty cycle of the PWM in nanoseconds
+ * @enable: true if the PWM is enabled
+ * @polarity: true if the PWM polarity is active high
+ */
 struct sandbox_pwm_chan {
 	uint period_ns;
 	uint duty_ns;
@@ -25,6 +33,23 @@ struct sandbox_pwm_priv {
 	struct sandbox_pwm_chan chan[NUM_CHANNELS];
 };
 
+int sandbox_pwm_get_config(struct udevice *dev, uint channel, uint *period_nsp,
+			   uint *duty_nsp, bool *enablep, bool *polarityp)
+{
+	struct sandbox_pwm_priv *priv = dev_get_priv(dev);
+	struct sandbox_pwm_chan *chan;
+
+	if (channel >= NUM_CHANNELS)
+		return -ENOSPC;
+	chan = &priv->chan[channel];
+	*period_nsp = chan->period_ns;
+	*duty_nsp = chan->duty_ns;
+	*enablep = chan->enable;
+	*polarityp = chan->polarity;
+
+	return 0;
+}
+
 static int sandbox_pwm_set_config(struct udevice *dev, uint channel,
 				  uint period_ns, uint duty_ns)
 {
test/dm/Makefile +1 -0
index 264f12633ff..2da762ddc8e 100644
@@ -25,6 +25,7 @@ obj-$(CONFIG_DM_MAILBOX) += mailbox.o
 obj-$(CONFIG_DM_MMC) += mmc.o
 obj-y += ofnode.o
 obj-$(CONFIG_OSD) += osd.o
+obj-$(CONFIG_DM_VIDEO) += panel.o
 obj-$(CONFIG_DM_PCI) += pci.o
 obj-$(CONFIG_PHY) += phy.o
 obj-$(CONFIG_POWER_DOMAIN) += power-domain.o
test/dm/panel.c new file +50 -0

50 lines not on this page · raw message

Signature · 1 line
2.19.0.605.g01d371f741-goog
#80 lore raw

PATCH 36/45 test: panel: Add a test for the panel uclass

At present this uclass has no tests. Add a simple one which checks the PWM configuration, regulator and GPIO.

---

 arch/sandbox/dts/sandbox_pmic.dtsi |  2 +-
 arch/sandbox/dts/test.dts          | 20 +++++++++++-
 arch/sandbox/include/asm/test.h    | 15 +++++++++
 drivers/pwm/sandbox_pwm.c          | 25 +++++++++++++++
 test/dm/Makefile                   |  1 +
 test/dm/panel.c                    | 50 ++++++++++++++++++++++++++++++
 6 files changed, 111 insertions(+), 2 deletions(-)
 create mode 100644 test/dm/panel.c

Applied to u-boot-dm

#81 lore raw

PATCH 37/45 panel: Expand the backlight support

In reply to Simon Glass

At present the panel can be turned on but not off, and the brightness cannot be controlled at run-time. Add a new API function to both the panel and backlight uclasses to handle this. Enhance the PWM backlight driver to deal with custom levels properly and allow the backlight to be turned on and off.

Update the test to cover thes new features.

---

 drivers/video/backlight-uclass.c |  10 ++
 drivers/video/panel-uclass.c     |  18 +++
 drivers/video/pwm_backlight.c    | 186 +++++++++++++++++++++++++------
 drivers/video/simple_panel.c     |  20 +++-
 include/backlight.h              |  25 +++++
 include/panel.h                  |  22 +++-
 test/dm/panel.c                  |  29 +++++
 7 files changed, 273 insertions(+), 37 deletions(-)
drivers/video/backlight-uclass.c +10 -0
index 92715e2f130..0aadf8a1f97 100644
@@ -18,6 +18,16 @@ int backlight_enable(struct udevice *dev)
 	return ops->enable(dev);
 }
 
+int backlight_set_brightness(struct udevice *dev, int percent)
+{
+	const struct backlight_ops *ops = backlight_get_ops(dev);
+
+	if (!ops->set_brightness)
+		return -ENOSYS;
+
+	return ops->set_brightness(dev, percent);
+}
+
 UCLASS_DRIVER(backlight) = {
 	.id		= UCLASS_PANEL_BACKLIGHT,
 	.name		= "backlight",
drivers/video/panel-uclass.c +18 -0
index aec44a8bf7a..246d1b2836d 100644
@@ -18,6 +18,24 @@ int panel_enable_backlight(struct udevice *dev)
 	return ops->enable_backlight(dev);
 }
 
+/**
+ * panel_set_backlight - Set brightness for the panel backlight
+ *
+ * @dev:	Panel device containing the backlight to update
+ * @percent:	Brightness value (0=off, 1=min brightness,
+ *		100=full brightness)
+ * @return 0 if OK, -ve on error
+ */
+int panel_set_backlight(struct udevice *dev, int percent)
+{
+	struct panel_ops *ops = panel_get_ops(dev);
+
+	if (!ops->set_backlight)
+		return -ENOSYS;
+
+	return ops->set_backlight(dev, percent);
+}
+
 int panel_get_display_timing(struct udevice *dev,
 			     struct display_timing *timings)
 {
drivers/video/pwm_backlight.c +152 -34

257 lines not on this page · raw message

drivers/video/simple_panel.c +18 -2
index 6c604f9bedb..7a968e740c5 100644
@@ -32,6 +32,21 @@ static int simple_panel_enable_backlight(struct udevice *dev)
 	return 0;
 }
 
+static int simple_panel_set_backlight(struct udevice *dev, int percent)
+{
+	struct simple_panel_priv *priv = dev_get_priv(dev);
+	int ret;
+
+	debug("%s: start, backlight = '%s'\n", __func__, priv->backlight->name);
+	dm_gpio_set_value(&priv->enable, 1);
+	ret = backlight_set_brightness(priv->backlight, percent);
+	debug("%s: done, ret = %d\n", __func__, ret);
+	if (ret)
+		return ret;
+
+	return 0;
+}
+
 static int simple_panel_ofdata_to_platdata(struct udevice *dev)
 {
 	struct simple_panel_priv *priv = dev_get_priv(dev);
@@ -51,7 +66,7 @@ static int simple_panel_ofdata_to_platdata(struct udevice *dev)
 					   "backlight", &priv->backlight);
 	if (ret) {
 		debug("%s: Cannot get backlight: ret=%d\n", __func__, ret);
-		return ret;
+		return log_ret(ret);
 	}
 	ret = gpio_request_by_name(dev, "enable-gpios", 0, &priv->enable,
 				   GPIOD_IS_OUT);
@@ -59,7 +74,7 @@ static int simple_panel_ofdata_to_platdata(struct udevice *dev)
 		debug("%s: Warning: cannot get enable GPIO: ret=%d\n",
 		      __func__, ret);
 		if (ret != -ENOENT)
-			return ret;
+			return log_ret(ret);
 	}
 
 	return 0;
@@ -82,6 +97,7 @@ static int simple_panel_probe(struct udevice *dev)
 
 static const struct panel_ops simple_panel_ops = {
 	.enable_backlight	= simple_panel_enable_backlight,
+	.set_backlight		= simple_panel_set_backlight,
 };
 
 static const struct udevice_id simple_panel_ids[] = {
include/backlight.h +25 -0
index a304c36e019..ac59eb293b4 100644
@@ -7,6 +7,13 @@
 #ifndef _BACKLIGHT_H
 #define _BACKLIGHT_H
 
+enum {
+	BACKLIGHT_MAX		= 100,
+	BACKLIGHT_MIN		= 0,
+	BACKLIGHT_OFF		= -1,
+	BACKLIGHT_DEFAULT	= -2,
+};
+
 struct backlight_ops {
 	/**
 	 * enable() - Enable a backlight
@@ -15,6 +22,15 @@ struct backlight_ops {
 	 * @return 0 if OK, -ve on error
 	 */
 	int (*enable)(struct udevice *dev);
+
+	/**
+	 * set_brightness - Set brightness
+	 *
+	 * @dev:	Backlight device to update
+	 * @percent:	Brightness value (0 to 100, or BACKLIGHT_... value)
+	 * @return 0 if OK, -ve on error
+	 */
+	int (*set_brightness)(struct udevice *dev, int percent);
 };
 
 #define backlight_get_ops(dev)	((struct backlight_ops *)(dev)->driver->ops)
@@ -27,4 +43,13 @@ struct backlight_ops {
  */
 int backlight_enable(struct udevice *dev);
 
+/**
+ * backlight_set_brightness - Set brightness
+ *
+ * @dev:	Backlight device to update
+ * @percent:	Brightness value (0 to 100, or BACKLIGHT_... value)
+ * @return 0 if OK, -ve on error
+ */
+int backlight_set_brightness(struct udevice *dev, int percent);
+
 #endif
include/panel.h +21 -1
index 6237d32657d..cd596d48c02 100644
@@ -15,6 +15,16 @@ struct panel_ops {
 	 * @return 0 if OK, -ve on error
 	 */
 	int (*enable_backlight)(struct udevice *dev);
+
+	/**
+	 * set_backlight - Set panel backlight brightness
+	 *
+	 * @dev:	Panel device containing the backlight to update
+	 * @percent:	Brightness value (0 to 100, or BACKLIGHT_... value)
+	 * @return 0 if OK, -ve on error
+	 */
+	int (*set_backlight)(struct udevice *dev, int percent);
+
 	/**
 	 * get_timings() - Get display timings from panel.
 	 *
@@ -29,13 +39,23 @@ struct panel_ops {
 #define panel_get_ops(dev)	((struct panel_ops *)(dev)->driver->ops)
 
 /**
- * panel_enable_backlight() - Enable the panel backlight
+ * panel_enable_backlight() - Enable/disable the panel backlight
  *
  * @dev:	Panel device containing the backlight to enable
+ * @enable:	true to enable the backlight, false to dis
  * @return 0 if OK, -ve on error
  */
 int panel_enable_backlight(struct udevice *dev);
 
+/**
+ * panel_set_backlight - Set brightness for the panel backlight
+ *
+ * @dev:	Panel device containing the backlight to update
+ * @percent:	Brightness value (0 to 100, or BACKLIGHT_... value)
+ * @return 0 if OK, -ve on error
+ */
+int panel_set_backlight(struct udevice *dev, int percent);
+
 /**
  * panel_get_display_timing() - Get display timings from panel.
  *
test/dm/panel.c +29 -0
index ca032409f8c..7e4ebd6d81e 100644
@@ -45,6 +45,35 @@ static int dm_test_panel(struct unit_test_state *uts)
 	ut_asserteq(1, sandbox_gpio_get_value(gpio, 1));
 	ut_asserteq(true, regulator_get_enable(reg));
 
+	ut_assertok(panel_set_backlight(dev, 40));
+	ut_assertok(sandbox_pwm_get_config(pwm, 0, &period_ns, &duty_ns,
+					   &enable, &polarity));
+	ut_asserteq(64 * 1000 / 256, duty_ns);
+
+	ut_assertok(panel_set_backlight(dev, BACKLIGHT_MAX));
+	ut_assertok(sandbox_pwm_get_config(pwm, 0, &period_ns, &duty_ns,
+					   &enable, &polarity));
+	ut_asserteq(255 * 1000 / 256, duty_ns);
+
+	ut_assertok(panel_set_backlight(dev, BACKLIGHT_MIN));
+	ut_assertok(sandbox_pwm_get_config(pwm, 0, &period_ns, &duty_ns,
+					   &enable, &polarity));
+	ut_asserteq(0 * 1000 / 256, duty_ns);
+	ut_asserteq(1, sandbox_gpio_get_value(gpio, 1));
+
+	ut_assertok(panel_set_backlight(dev, BACKLIGHT_DEFAULT));
+	ut_assertok(sandbox_pwm_get_config(pwm, 0, &period_ns, &duty_ns,
+					   &enable, &polarity));
+	ut_asserteq(true, enable);
+	ut_asserteq(170 * 1000 / 256, duty_ns);
+
+	ut_assertok(panel_set_backlight(dev, BACKLIGHT_OFF));
+	ut_assertok(sandbox_pwm_get_config(pwm, 0, &period_ns, &duty_ns,
+					   &enable, &polarity));
+	ut_asserteq(0 * 1000 / 256, duty_ns);
+	ut_asserteq(0, sandbox_gpio_get_value(gpio, 1));
+	ut_asserteq(false, regulator_get_enable(reg));
+
 	return 0;
 }
 DM_TEST(dm_test_panel, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
Signature · 1 line
2.19.0.605.g01d371f741-goog
#82 lore raw

PATCH 37/45 panel: Expand the backlight support

At present the panel can be turned on but not off, and the brightness cannot be controlled at run-time. Add a new API function to both the panel and backlight uclasses to handle this. Enhance the PWM backlight driver to deal with custom levels properly and allow the backlight to be turned on and off.

Update the test to cover thes new features.

---

 drivers/video/backlight-uclass.c |  10 ++
 drivers/video/panel-uclass.c     |  18 +++
 drivers/video/pwm_backlight.c    | 186 +++++++++++++++++++++++++------
 drivers/video/simple_panel.c     |  20 +++-
 include/backlight.h              |  25 +++++
 include/panel.h                  |  22 +++-
 test/dm/panel.c                  |  29 +++++
 7 files changed, 273 insertions(+), 37 deletions(-)

Applied to u-boot-dm

#83 lore raw

PATCH 38/45 ctags: Minor changes to fix ctags output

In reply to Simon Glass

At present ctags emits lines with unmatched quotes which means that the output file is invalid. This is with exuberant-ctags version 5.9~svn201103 but I also see it with plain ctags. I am not sure that it is a bug though.

Make a few minor changes in the source code to fix this problem.

---

 drivers/video/tegra124/sor.c | 3 ++-
 include/linux/compiler-gcc.h | 6 ++++--
 2 files changed, 6 insertions(+), 3 deletions(-)
drivers/video/tegra124/sor.c +2 -1
index 91e61b58527..172bb14d6c8 100644
@@ -533,7 +533,8 @@ static int tegra_dc_sor_power_up(struct udevice *dev, int is_lvds)
 #if DEBUG_SOR
 static void dump_sor_reg(struct tegra_dc_sor_data *sor)
 {
-#define DUMP_REG(a) printk(BIOS_INFO, "%-32s  %03x  %08x\n",		\
+#define DUMP_REG(a) printk(BIOS_INFO, \
+		"%-32s  %03x  %08x\n",		\
 		#a, a, tegra_sor_readl(sor, a));
 
 	DUMP_REG(SUPER_STATE0);
include/linux/compiler-gcc.h +4 -2
index 22ab246feed..8d9e0794351 100644
@@ -12,7 +12,8 @@
 /* Optimization barrier */
 
 /* The "volatile" is due to gcc bugs */
-#define barrier() __asm__ __volatile__("": : :"memory")
+#define barrier() \
+	__asm__ __volatile__("": : :"memory")
 /*
  * This version is i.e. to prevent dead stores elimination on @ptr
  * where gcc and llvm may behave differently when otherwise using
@@ -26,7 +27,8 @@
  * the compiler that the inline asm absolutely may see the contents
  * of @ptr. See also: https://llvm.org/bugs/show_bug.cgi?id=15495
  */
-#define barrier_data(ptr) __asm__ __volatile__("": :"r"(ptr) :"memory")
+#define barrier_data(ptr) \
+	__asm__ __volatile__("": :"r"(ptr) :"memory")
 
 /*
  * This macro obfuscates arithmetic on a variable address so that gcc
Signature · 1 line
2.19.0.605.g01d371f741-goog
#84 lore raw

PATCH 38/45 ctags: Minor changes to fix ctags output

At present ctags emits lines with unmatched quotes which means that the output file is invalid. This is with exuberant-ctags version 5.9~svn201103 but I also see it with plain ctags. I am not sure that it is a bug though.

Make a few minor changes in the source code to fix this problem.

---

 drivers/video/tegra124/sor.c | 3 ++-
 include/linux/compiler-gcc.h | 6 ++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

Applied to u-boot-dm

#85 lore raw

PATCH 39/45 fdt: Allow C++ comments in link scripts and DT files

In reply to Simon Glass

At present // in a device-tree file or link script causes a warning. But this is used in the standard license header. Update the compiler flags to use C99, which permits this.

---

 Makefile             | 2 +-
 scripts/Makefile.spl | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Makefile +1 -1
index f578cce3663..5d4533b4243 100644
@@ -1521,7 +1521,7 @@ $(defaultenv_h): $(CONFIG_DEFAULT_ENV_FILE:"%"=%) FORCE
 # ---------------------------------------------------------------------------
 quiet_cmd_cpp_lds = LDS     $@
 cmd_cpp_lds = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) \
-		-D__ASSEMBLY__ -x assembler-with-cpp -P -o $@ $<
+		-D__ASSEMBLY__ -x assembler-with-cpp -std=c99 -P -o $@ $<
 
 u-boot.lds: $(LDSCRIPT) prepare FORCE
 	$(call if_changed_dep,cpp_lds)
scripts/Makefile.spl +1 -1
index c71497ff008..7416abec62e 100644
@@ -371,7 +371,7 @@ $(u-boot-spl-dirs): $(u-boot-spl-platdata)
 
 quiet_cmd_cpp_lds = LDS     $@
 cmd_cpp_lds = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) -ansi \
-		-D__ASSEMBLY__ -x assembler-with-cpp -P -o $@ $<
+		-D__ASSEMBLY__ -x assembler-with-cpp -std=c99 -P -o $@ $<
 
 $(obj)/u-boot-spl.lds: $(LDSCRIPT) FORCE
 	$(call if_changed_dep,cpp_lds)
Signature · 1 line
2.19.0.605.g01d371f741-goog
#86 lore raw

PATCH 39/45 fdt: Allow C++ comments in link scripts and DT files

At present // in a device-tree file or link script causes a warning. But this is used in the standard license header. Update the compiler flags to use C99, which permits this.

---

 Makefile             | 2 +-
 scripts/Makefile.spl | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Applied to u-boot-dm

#87 lore raw

PATCH 40/45 pci: Add a little more debugging to pci_rom

In reply to Simon Glass

Add some logging on failure.

---

 drivers/pci/pci_rom.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/pci_rom.c +2 -2
index 29113f79586..eaacd4066e8 100644
@@ -247,7 +247,7 @@ int dm_pci_run_vga_bios(struct udevice *dev, int (*int15_handler)(void),
 	}
 
 	if (!board_should_load_oprom(dev))
-		return -ENXIO;
+		return log_msg_ret("Should not load OPROM", -ENXIO);
 
 	ret = pci_rom_probe(dev, &rom);
 	if (ret)
@@ -328,7 +328,7 @@ int vbe_setup_video_priv(struct vesa_mode_info *vesa,
 			 struct video_uc_platdata *plat)
 {
 	if (!vesa->x_resolution)
-		return -ENXIO;
+		return log_msg_ret("No x resolution", -ENXIO);
 	uc_priv->xsize = vesa->x_resolution;
 	uc_priv->ysize = vesa->y_resolution;
 	switch (vesa->bits_per_pixel) {
Signature · 1 line
2.19.0.605.g01d371f741-goog
#90 lore raw

PATCH 41/45 sysreset: Tidy up a few comments and logging

In reply to Simon Glass

Some comments are incorrect or missing pieces. Fix these and use logging to print the error.

---

 drivers/sysreset/sysreset-uclass.c | 4 +++-
 include/sysreset.h                 | 4 +++-
 test/dm/sysreset.c                 | 1 -
 3 files changed, 6 insertions(+), 3 deletions(-)
drivers/sysreset/sysreset-uclass.c +3 -1
index 06ef0ed96c7..e38814b3ed1 100644
@@ -4,6 +4,8 @@
  * Written by Simon Glass <[email protected]>
  */
 
+#define LOG_CATEGORY UCLASS_SYSRESET
+
 #include <common.h>
 #include <sysreset.h>
 #include <dm.h>
@@ -64,7 +66,7 @@ void sysreset_walk_halt(enum sysreset_t type)
 		mdelay(100);
 
 	/* Still no reset? Give up */
-	debug("System reset not supported on this platform\n");
+	log_err("System reset not supported on this platform\n");
 	hang();
 }
 
include/sysreset.h +3 -1
index a5c0b74a473..343e46f1aa5 100644
@@ -31,6 +31,7 @@ struct sysreset_ops {
 	/**
 	 * get_status() - get printable reset status information
 	 *
+	 * @dev:	Device to check
 	 * @buf:	Buffer to receive the textual reset information
 	 * @size:	Size of the passed buffer
 	 * @return 0 if OK, -ve on error
@@ -49,8 +50,9 @@ struct sysreset_ops {
 int sysreset_request(struct udevice *dev, enum sysreset_t type);
 
 /**
- * get_status() - get printable reset status information
+ * sysreset_get_status() - get printable reset status information
  *
+ * @dev:	Device to check
  * @buf:	Buffer to receive the textual reset information
  * @size:	Size of the passed buffer
  * @return 0 if OK, -ve on error
test/dm/sysreset.c +0 -1
index 04d4621d9e1..218cc239cc6 100644
@@ -62,7 +62,6 @@ static int dm_test_sysreset_get_status(struct unit_test_state *uts)
 
 	return 0;
 }
-
 DM_TEST(dm_test_sysreset_get_status, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
 
 /* Test that we can walk through the sysreset devices */
Signature · 1 line
2.19.0.605.g01d371f741-goog
#91 lore raw

PATCH 41/45 sysreset: Tidy up a few comments and logging

Some comments are incorrect or missing pieces. Fix these and use logging to print the error.

---

 drivers/sysreset/sysreset-uclass.c | 4 +++-
 include/sysreset.h                 | 4 +++-
 test/dm/sysreset.c                 | 1 -
 3 files changed, 6 insertions(+), 3 deletions(-)

Applied to u-boot-dm

#92 lore raw

PATCH 42/45 sysreset: Add a way to find the last reset

In reply to Simon Glass

We have a method to return the last reset as a string for humans, but not a method that allows it to be used programmatically. Add a new method that returns the last reset as an enum.

---

 drivers/sysreset/sysreset-uclass.c  | 30 +++++++++++++++++++++++++++++
 drivers/sysreset/sysreset_sandbox.c | 12 ++++++++++++
 include/sysreset.h                  | 30 +++++++++++++++++++++++++++++
 test/dm/sysreset.c                  | 19 ++++++++++++++++++
 4 files changed, 91 insertions(+)
drivers/sysreset/sysreset-uclass.c +30 -0
index e38814b3ed1..ad831c703a9 100644
@@ -36,6 +36,16 @@ int sysreset_get_status(struct udevice *dev, char *buf, int size)
 	return ops->get_status(dev, buf, size);
 }
 
+int sysreset_get_last(struct udevice *dev)
+{
+	struct sysreset_ops *ops = sysreset_get_ops(dev);
+
+	if (!ops->get_last)
+		return -ENOSYS;
+
+	return ops->get_last(dev);
+}
+
 int sysreset_walk(enum sysreset_t type)
 {
 	struct udevice *dev;
@@ -55,6 +65,26 @@ int sysreset_walk(enum sysreset_t type)
 	return ret;
 }
 
+int sysreset_get_last_walk(void)
+{
+	struct udevice *dev;
+	int value = -ENOENT;
+
+	for (uclass_first_device(UCLASS_SYSRESET, &dev);
+	     dev;
+	     uclass_next_device(&dev)) {
+		int ret;
+
+		ret = sysreset_get_last(dev);
+		if (ret >= 0) {
+			value = ret;
+			break;
+		}
+	}
+
+	return value;
+}
+
 void sysreset_walk_halt(enum sysreset_t type)
 {
 	int ret;
drivers/sysreset/sysreset_sandbox.c +12 -0
index 75004d9f774..51252f7f71b 100644
@@ -36,6 +36,11 @@ int sandbox_warm_sysreset_get_status(struct udevice *dev, char *buf, int size)
 	return 0;
 }
 
+int sandbox_warm_sysreset_get_last(struct udevice *dev)
+{
+	return SYSRESET_WARM;
+}
+
 static int sandbox_sysreset_request(struct udevice *dev, enum sysreset_t type)
 {
 	struct sandbox_state *state = state_get_current();
@@ -74,9 +79,15 @@ int sandbox_sysreset_get_status(struct udevice *dev, char *buf, int size)
 	return 0;
 }
 
+int sandbox_sysreset_get_last(struct udevice *dev)
+{
+	return SYSRESET_COLD;
+}
+
 static struct sysreset_ops sandbox_sysreset_ops = {
 	.request	= sandbox_sysreset_request,
 	.get_status	= sandbox_sysreset_get_status,
+	.get_last	= sandbox_sysreset_get_last,
 };
 
 static const struct udevice_id sandbox_sysreset_ids[] = {
@@ -94,6 +105,7 @@ U_BOOT_DRIVER(sysreset_sandbox) = {
 static struct sysreset_ops sandbox_warm_sysreset_ops = {
 	.request	= sandbox_warm_sysreset_request,
 	.get_status	= sandbox_warm_sysreset_get_status,
+	.get_last	= sandbox_warm_sysreset_get_last,
 };
 
 static const struct udevice_id sandbox_warm_sysreset_ids[] = {
include/sysreset.h +30 -0
index 343e46f1aa5..61295e3fcbb 100644
@@ -11,6 +11,7 @@ enum sysreset_t {
 	SYSRESET_WARM,	/* Reset CPU, keep GPIOs active */
 	SYSRESET_COLD,	/* Reset CPU and GPIOs */
 	SYSRESET_POWER,	/* Reset PMIC (remove and restore power) */
+	SYSRESET_POWER_OFF,	/* Turn off power */
 
 	SYSRESET_COUNT,
 };
@@ -37,6 +38,14 @@ struct sysreset_ops {
 	 * @return 0 if OK, -ve on error
 	 */
 	int (*get_status)(struct udevice *dev, char *buf, int size);
+
+	/**
+	 * get_last() - get information on the last reset
+	 *
+	 * @dev:	Device to check
+	 * @return last reset state (enum sysreset_t) or -ve error
+	 */
+	int (*get_last)(struct udevice *dev);
 };
 
 #define sysreset_get_ops(dev)        ((struct sysreset_ops *)(dev)->driver->ops)
@@ -59,6 +68,14 @@ int sysreset_request(struct udevice *dev, enum sysreset_t type);
  */
 int sysreset_get_status(struct udevice *dev, char *buf, int size);
 
+/**
+ * sysreset_get_last() - get information on the last reset
+ *
+ * @dev:	Device to check
+ * @return last reset state (enum sysreset_t) or -ve error
+ */
+int sysreset_get_last(struct udevice *dev);
+
 /**
  * sysreset_walk() - cause a system reset
  *
@@ -73,6 +90,19 @@ int sysreset_get_status(struct udevice *dev, char *buf, int size);
  */
 int sysreset_walk(enum sysreset_t type);
 
+/**
+ * sysreset_get_last_walk() - get information on the last reset
+ *
+ * This works through the available sysreset devices until it finds one that can
+ * perform a reset. If the provided sysreset type is not available, the next one
+ * will be tried.
+ *
+ * If no device prives the information, this function returns -ENOENT
+ *
+ * @return last reset state (enum sysreset_t) or -ve error
+ */
+int sysreset_get_last_walk(void);
+
 /**
  * sysreset_walk_halt() - try to reset, otherwise halt
  *
test/dm/sysreset.c +19 -0
index 218cc239cc6..a4607fa857e 100644
@@ -90,3 +90,22 @@ static int dm_test_sysreset_walk(struct unit_test_state *uts)
 	return 0;
 }
 DM_TEST(dm_test_sysreset_walk, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+
+static int dm_test_sysreset_get_last(struct unit_test_state *uts)
+{
+	struct udevice *dev;
+
+	/* Device 1 is the warm sysreset device */
+	ut_assertok(uclass_get_device(UCLASS_SYSRESET, 1, &dev));
+	ut_asserteq(SYSRESET_WARM, sysreset_get_last(dev));
+
+	/* Device 2 is the cold sysreset device */
+	ut_assertok(uclass_get_device(UCLASS_SYSRESET, 2, &dev));
+	ut_asserteq(SYSRESET_COLD, sysreset_get_last(dev));
+
+	/* This is device 0, the non-DT one */
+	ut_asserteq(SYSRESET_COLD, sysreset_get_last_walk());
+
+	return 0;
+}
+DM_TEST(dm_test_sysreset_get_last, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
Signature · 1 line
2.19.0.605.g01d371f741-goog
#93 lore raw

PATCH 42/45 sysreset: Add a way to find the last reset

We have a method to return the last reset as a string for humans, but not a method that allows it to be used programmatically. Add a new method that returns the last reset as an enum.

---

 drivers/sysreset/sysreset-uclass.c  | 30 +++++++++++++++++++++++++++++
 drivers/sysreset/sysreset_sandbox.c | 12 ++++++++++++
 include/sysreset.h                  | 30 +++++++++++++++++++++++++++++
 test/dm/sysreset.c                  | 19 ++++++++++++++++++
 4 files changed, 91 insertions(+)

Applied to u-boot-dm

#94 lore raw

PATCH 43/45 video: at91: Adjust vidconsole_position_cursor() to use char pos

In reply to Simon Glass

At present this function uses pixels but it seems more useful for it to position in terms of characters on the screen. This also matches the comment to the function. Update this.

Unfortunately there is one user of this function (at91). Have a crack at fixing this, since I cannot test it.

---

 board/atmel/common/video_display.c | 5 ++++-
 drivers/video/vidconsole-uclass.c  | 2 ++
 2 files changed, 6 insertions(+), 1 deletion(-)
board/atmel/common/video_display.c +4 -1
index 7dd7b85556e..e02cb00f866 100644
@@ -18,6 +18,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 int at91_video_show_board_info(void)
 {
+	struct vidconsole_priv *priv;
 	ulong dram_size, nand_size;
 	int i;
 	u32 len = 0;
@@ -63,7 +64,9 @@ int at91_video_show_board_info(void)
 	if (ret)
 		return ret;
 
-	vidconsole_position_cursor(con, 0, logo_info.logo_height);
+	priv = dev_get_uclass_priv(con);
+	vidconsole_position_cursor(con, 0, (logo_info.logo_height +
+				   con->y_charsize - 1) / con->y_charsize);
 	for (s = buf, i = 0; i < len; s++, i++)
 		vidconsole_put_char(con, *s);
 
drivers/video/vidconsole-uclass.c +2 -0
index 89ac8b3cc8f..1874887f2f3 100644
@@ -511,6 +511,8 @@ void vidconsole_position_cursor(struct udevice *dev, unsigned col, unsigned row)
 	struct udevice *vid_dev = dev->parent;
 	struct video_priv *vid_priv = dev_get_uclass_priv(vid_dev);
 
+	col *= priv->x_charsize;
+	row *= priv->y_charsize;
 	priv->xcur_frac = VID_TO_POS(min_t(short, col, vid_priv->xsize - 1));
 	priv->ycur = min_t(short, row, vid_priv->ysize - 1);
 }
Signature · 1 line
2.19.0.605.g01d371f741-goog
#95 lore raw

PATCH 43/45 video: at91: Adjust vidconsole_position_cursor() to use char pos

Hi Simon,

Quoted 8 lines · On Mon, 1 Oct 2018 12:22:47 -0600 Simon Glass sjg at chromium.org wrote:

At present this function uses pixels but it seems more useful for it to position in terms of characters on the screen. This also matches the comment to the function. Update this.

Unfortunately there is one user of this function (at91). Have a crack at fixing this, since I cannot test it.

Quoted 19 lines

---

 board/atmel/common/video_display.c | 5 ++++-
 drivers/video/vidconsole-uclass.c  | 2 ++
 2 files changed, 6 insertions(+), 1 deletion(-)
board/atmel/common/video_display.c +1 -0
index 7dd7b85556e..e02cb00f866 100644
@@ -18,6 +18,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 int at91_video_show_board_info(void)
 {
+	struct vidconsole_priv *priv;
 	ulong dram_size, nand_size;
 	int i;
 	u32 len = 0;

board/atmel/common/video_display.c int at91_video_show_board_info(void) · line 69

Quoted 7 lines
board/atmel/common/video_display.c +3 -1
@@ -63,7 +64,9 @@ int at91_video_show_board_info(void)
 	if (ret)
 		return ret;
 
-	vidconsole_position_cursor(con, 0, logo_info.logo_height);
+	priv = dev_get_uclass_priv(con);
+	vidconsole_position_cursor(con, 0, (logo_info.logo_height +
+				   con->y_charsize - 1) / con->y_charsize);

Shouldn't it be priv->y_charsize? 'con' is struct udevice * and doesn't have y_charsize.

--
Anatolij

#96 lore raw

PATCH 43/45 video: at91: Adjust vidconsole_position_cursor() to use char pos

Quoted 11 lines · Anatolij Gustschin

Hi Simon,

Quoted 6 lines · On Mon, 1 Oct 2018 12:22:47 -0600 Simon Glass sjg at chromium.org wrote:

At present this function uses pixels but it seems more useful for it to position in terms of characters on the screen. This also matches the comment to the function. Update this.

Unfortunately there is one user of this function (at91). Have a crack at fixing this, since I cannot test it.

Hello Simon,

I will gladly test this for you on at91 board, but I am having some issues applying your patch series:

Applying: binman: Move to three-digit test-file numbers
error: patch failed: tools/binman/entry_test.py:25
error: tools/binman/entry_test.py: patch does not apply
error: patch failed: tools/binman/ftest.py:712
error: tools/binman/ftest.py: patch does not apply Patch failed at 0026 binman: Move to three-digit test-file numbers

Do you have them in some public tree I can pull from ?

Also, any specific tests you would like except just checking the video console ?

Eugen

Quoted 43 lines
Quoted 2 lines
Quoted 19 lines

---

  board/atmel/common/video_display.c | 5 ++++-
  drivers/video/vidconsole-uclass.c  | 2 ++
  2 files changed, 6 insertions(+), 1 deletion(-)
board/atmel/common/video_display.c +1 -0
index 7dd7b85556e..e02cb00f866 100644
@@ -18,6 +18,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
  int at91_video_show_board_info(void)
  {
+	struct vidconsole_priv *priv;
  	ulong dram_size, nand_size;
  	int i;
  	u32 len = 0;

board/atmel/common/video_display.c int at91_video_show_board_info(void) · line 69

Quoted 7 lines
board/atmel/common/video_display.c +3 -1
@@ -63,7 +64,9 @@ int at91_video_show_board_info(void)
  	if (ret)
  		return ret;
 
-	vidconsole_position_cursor(con, 0, logo_info.logo_height);
+	priv = dev_get_uclass_priv(con);
+	vidconsole_position_cursor(con, 0, (logo_info.logo_height +
+				   con->y_charsize - 1) / con->y_charsize);

Shouldn't it be priv->y_charsize? 'con' is struct udevice * and doesn't have y_charsize.

--
Anatolij
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#97 lore raw

PATCH 43/45 video: at91: Adjust vidconsole_position_cursor() to use char pos

Hi Eugen,

Quoted 23 lines · Eugen Hristev
Quoted 12 lines · Anatolij Gustschin

Hi Simon,

Quoted 6 lines · On Mon, 1 Oct 2018 12:22:47 -0600 Simon Glass sjg at chromium.org wrote:

At present this function uses pixels but it seems more useful for it to position in terms of characters on the screen. This also matches the comment to the function. Update this.

Unfortunately there is one user of this function (at91). Have a crack at fixing this, since I cannot test it.

Hello Simon,

I will gladly test this for you on at91 board, but I am having some issues applying your patch series:

Quoted 8 lines

Applying: binman: Move to three-digit test-file numbers
error: patch failed: tools/binman/entry_test.py:25
error: tools/binman/entry_test.py: patch does not apply
error: patch failed: tools/binman/ftest.py:712
error: tools/binman/ftest.py: patch does not apply Patch failed at 0026 binman: Move to three-digit test-file numbers

Do you have them in some public tree I can pull from ?

Yes you can try u-boot-dm/testing

Quoted 2 lines

Also, any specific tests you would like except just checking the video console ?

It looks like this code runs when the board boots up, so just starting it should be enough.

Thanks,
Simon

Quoted 47 lines

Eugen

Quoted 43 lines
Quoted 2 lines
Quoted 18 lines

---

  board/atmel/common/video_display.c | 5 ++++-
  drivers/video/vidconsole-uclass.c  | 2 ++
  2 files changed, 6 insertions(+), 1 deletion(-)
board/atmel/common/video_display.c +1 -0
index 7dd7b85556e..e02cb00f866 100644
@@ -18,6 +18,7 @@ DECLARE_GLOBAL_DATA_PTR;
    int at91_video_show_board_info(void)
  {
+       struct vidconsole_priv *priv;
        ulong dram_size, nand_size;
        int i;
        u32 len = 0;

board/atmel/common/video_display.c int at91_video_show_board_info(void) · line 69

Quoted 6 lines
board/atmel/common/video_display.c +3 -0
@@ -63,7 +64,9 @@ int at91_video_show_board_info(void)
        if (ret)
                return ret;
  -     vidconsole_position_cursor(con, 0, logo_info.logo_height);
+       priv = dev_get_uclass_priv(con);
+       vidconsole_position_cursor(con, 0, (logo_info.logo_height +
+                                  con->y_charsize - 1) / con->y_charsize);

Shouldn't it be priv->y_charsize? 'con' is struct udevice * and doesn't have y_charsize.

--
Anatolij
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#98 lore raw

PATCH 43/45 video: at91: Adjust vidconsole_position_cursor() to use char pos

Quoted 35 lines · Simon Glass

Hi Eugen,

Quoted 23 lines · Eugen Hristev
Quoted 12 lines · Anatolij Gustschin

Hi Simon,

Quoted 6 lines · On Mon, 1 Oct 2018 12:22:47 -0600 Simon Glass sjg at chromium.org wrote:

At present this function uses pixels but it seems more useful for it to position in terms of characters on the screen. This also matches the comment to the function. Update this.

Unfortunately there is one user of this function (at91). Have a crack at fixing this, since I cannot test it.

Hello Simon,

I will gladly test this for you on at91 board, but I am having some issues applying your patch series:

Quoted 8 lines

Applying: binman: Move to three-digit test-file numbers
error: patch failed: tools/binman/entry_test.py:25
error: tools/binman/entry_test.py: patch does not apply
error: patch failed: tools/binman/ftest.py:712
error: tools/binman/ftest.py: patch does not apply Patch failed at 0026 binman: Move to three-digit test-file numbers

Do you have them in some public tree I can pull from ?

Quoted 7 lines

Yes you can try u-boot-dm/testing

Quoted 2 lines

Also, any specific tests you would like except just checking the video console ?

It looks like this code runs when the board boots up, so just starting it should be enough.

I made a build on your branch and tested it on at91 sama5d2_xplained board, and the logo and text appears on the display.

Let me know if you want me to do more tests.

Eugen

Quoted 52 lines

Thanks,
Simon

Quoted 47 lines

Eugen

Quoted 43 lines
Quoted 2 lines
Quoted 18 lines

---

   board/atmel/common/video_display.c | 5 ++++-
   drivers/video/vidconsole-uclass.c  | 2 ++
   2 files changed, 6 insertions(+), 1 deletion(-)
board/atmel/common/video_display.c +1 -0
index 7dd7b85556e..e02cb00f866 100644
@@ -18,6 +18,7 @@ DECLARE_GLOBAL_DATA_PTR;
     int at91_video_show_board_info(void)
   {
+       struct vidconsole_priv *priv;
         ulong dram_size, nand_size;
         int i;
         u32 len = 0;

board/atmel/common/video_display.c int at91_video_show_board_info(void) · line 69

Quoted 6 lines
board/atmel/common/video_display.c +3 -0
@@ -63,7 +64,9 @@ int at91_video_show_board_info(void)
         if (ret)
                 return ret;
   -     vidconsole_position_cursor(con, 0, logo_info.logo_height);
+       priv = dev_get_uclass_priv(con);
+       vidconsole_position_cursor(con, 0, (logo_info.logo_height +
+                                  con->y_charsize - 1) / con->y_charsize);

Shouldn't it be priv->y_charsize? 'con' is struct udevice * and doesn't have y_charsize.

--
Anatolij
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#99 lore raw

PATCH 43/45 video: at91: Adjust vidconsole_position_cursor() to use char pos

Quoted 35 lines · Simon Glass

Hi Eugen,

Quoted 23 lines · Eugen Hristev
Quoted 12 lines · Anatolij Gustschin

Hi Simon,

Quoted 6 lines · On Mon, 1 Oct 2018 12:22:47 -0600 Simon Glass sjg at chromium.org wrote:

At present this function uses pixels but it seems more useful for it to position in terms of characters on the screen. This also matches the comment to the function. Update this.

Unfortunately there is one user of this function (at91). Have a crack at fixing this, since I cannot test it.

Hello Simon,

I will gladly test this for you on at91 board, but I am having some issues applying your patch series:

Quoted 8 lines

Applying: binman: Move to three-digit test-file numbers
error: patch failed: tools/binman/entry_test.py:25
error: tools/binman/entry_test.py: patch does not apply
error: patch failed: tools/binman/ftest.py:712
error: tools/binman/ftest.py: patch does not apply Patch failed at 0026 binman: Move to three-digit test-file numbers

Do you have them in some public tree I can pull from ?

Quoted 7 lines

Yes you can try u-boot-dm/testing

Quoted 2 lines

Also, any specific tests you would like except just checking the video console ?

It looks like this code runs when the board boots up, so just starting it should be enough.

I made a build on your branch and tested it on at91 sama5d2_xplained board, and the logo and text appears on the display.

Let me know if you want me to do more tests.

Eugen

Quoted 21 lines

Thanks,
Simon

Quoted 16 lines

Eugen

Quoted 12 lines
Quoted 2 lines
Quoted 6 lines

---

   board/atmel/common/video_display.c | 5 ++++-
   drivers/video/vidconsole-uclass.c  | 2 ++
   2 files changed, 6 insertions(+), 1 deletion(-)

Applied to u-boot-dm

#100 lore raw

PATCH 43/45 video: at91: Adjust vidconsole_position_cursor() to use char pos

In reply to Anatolij Gustschin

Hi Anatolij,

Quoted 38 lines · Anatolij Gustschin

Hi Simon,

Quoted 8 lines · On Mon, 1 Oct 2018 12:22:47 -0600 Simon Glass sjg at chromium.org wrote:

At present this function uses pixels but it seems more useful for it to position in terms of characters on the screen. This also matches the comment to the function. Update this.

Unfortunately there is one user of this function (at91). Have a crack at fixing this, since I cannot test it.

Quoted 22 lines

---

 board/atmel/common/video_display.c | 5 ++++-
 drivers/video/vidconsole-uclass.c  | 2 ++
 2 files changed, 6 insertions(+), 1 deletion(-)
board/atmel/common/video_display.c +1 -0
index 7dd7b85556e..e02cb00f866 100644
@@ -18,6 +18,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 int at91_video_show_board_info(void)
 {
+     struct vidconsole_priv *priv;
      ulong dram_size, nand_size;
      int i;
      u32 len = 0;
@@ -63,7 +64,9 @@ int at91_video_show_board_info(void)
      if (ret)
              return ret;
 
Quoted 7 lines

board/atmel/common/video_display.c int at91_video_show_board_info(void) · line 69

Quoted 4 lines
board/atmel/common/video_display.c +3 -1
-     vidconsole_position_cursor(con, 0, logo_info.logo_height);
+     priv = dev_get_uclass_priv(con);
+     vidconsole_position_cursor(con, 0, (logo_info.logo_height +
+                                con->y_charsize - 1) / con->y_charsize);

Shouldn't it be priv->y_charsize? 'con' is struct udevice * and doesn't have y_charsize.

Yes thanks, I will fix that when I apply this.

Regards,
Simon

Quoted 4 lines

--
Anatolij

#101 lore raw

PATCH 44/45 video: Tidy up a few comments in video.o

In reply to Simon Glass

Add a little more information to one comment and update the guard comment to be more accurate.

---

 include/video.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/video.h +2 -2
index ab416c1cfac..75200f0e452 100644
@@ -55,7 +55,7 @@ enum video_log2_bpp {
  * @xsize:	Number of pixel columns (e.g. 1366)
  * @ysize:	Number of pixels rows (e.g.. 768)
  * @rot:	Display rotation (0=none, 1=90 degrees clockwise, etc.)
- * @bpix:	Encoded bits per pixel
+ * @bpix:	Encoded bits per pixel (enum video_log2_bpp)
  * @vidconsole_drv_name:	Driver to use for the text console, NULL to
  *		select automatically
  * @font_size:	Font size in pixels (0 to use a default value)
@@ -269,6 +269,6 @@ int lg4573_spi_startup(unsigned int bus, unsigned int cs,
  */
 void video_get_info_str(int line_number, char *info);
 
-#endif /* CONFIG_DM_VIDEO */
+#endif /* !CONFIG_DM_VIDEO */
 
 #endif
Signature · 1 line
2.19.0.605.g01d371f741-goog
#104 lore raw

PATCH 45/45 dtoc: Fix the value of SetInt()

In reply to Simon Glass

This does not set the correct value at present. Fix it.

---

 tools/dtoc/fdt.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/dtoc/fdt.py +1 -1
index 2df2d4b0cc7..9ad72f89ec7 100644
@@ -171,7 +171,7 @@ class Prop:
             val: Integer value (32-bit, single cell)
         """
         self.bytes = struct.pack('>I', val);
-        self.value = val
+        self.value = self.bytes
         self.type = TYPE_INT
         self.dirty = True
 
Signature · 1 line
2.19.0.605.g01d371f741-goog