From mboxrd@z Thu Jan 1 00:00:00 1970 From: Simon Glass Date: Wed, 25 Sep 2019 08:55:44 -0600 Subject: [U-Boot] [PATCH 000/126] x86: Add initial support for apollolake Message-ID: <20190925145750.200592-1-sjg@chromium.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Apollolake is an Intel SoC generation aimed at relatively low-end embedded systems. It was released in 2016 but has become more popular recently with some embedded boards using it. This series adds support for apollolake. As an example it adds an implementation of chromebook_coral (a large range of Chromebooks released in 2017). The series provides only enough to boot to a prompt. It does not include display, storage, USB, etc. But it does include the major part of the plumbing. Since this is the first time U-Boot has used FSP2 there is quite a bit of refactoring needed. Some of this is in previous series, but much of it is here. Some further clean-up is needed with this series and it needs more documentation, but it is ready for review. This series is available at u-boot-dm/coral-working Simon Glass (126): dm: core: Use U-Boot logging instead of pr_debug() dm: core: Correct low cell in ofnode_read_pci_addr() dm: core: Drop a few early returns dm: core: Add documentation on how to debug driver model dm: core: Don't include ofnode functions with of-platdata dm: core: Correct bad cast in ofnode_get_addr_size_index() dm: test: Fix running of multiple test from command line dm: test: Don't fail when tests are skipped due to build dm: core: Call ofdata_to_platdata() with of-platdata dm: doc: Correct of-platdata CONFIG_IS_ENABLED() condition dm: core: Correct the return value for uclass_find_first_device() dm: core: Add device_foreach_child() dm: test: Correct a stray backslash in dm_test_destroy() fdt: Show the preprocessed .dts file on error sandbox: spmi: Add ranges property for address translation sandbox: mmc: Fix up MMC emulator for valgrind sandbox: Rename PCI ID for swap_case to be more specific sandbox: Add support for clrsetio_32() and friends sandbox: swap_case: Use statics where possible sandbox: pci: Drop the get_devfn() method sandbox: net: Suppress the MAC-address warnings sandbox: pci: Move pci_offset_to_barnum() to pci.h sandbox: Add a -T flag to use the test device tree sandbox: pci: Increase the memory space sandbox: Allow use of real I/O with readl(), etc. pci: sandbox: Move the emulators into their own node pci: sandbox: Probe PCI emulation devices when used pci: Show the result of binding a device pci: Disable autoconfig in SPL pci: Correct 'specifified' and 'Plese' typos pci: Add more debug detail when resources are exhausted pci: Show a message if PCI autoconfig fails dm: pci: Add a function to read a PCI BAR serial: ns16550: Add a PCI device/function field binman: Allow verbose output with all commands binman: Add a base implementation of Entry.ReadChildData() binman: Handle reading data for end-at-4gb sections binman: Take account of skip-at-start with image-header log: Add log_nop() to avoid unused-variable warnings cros_ec: Add MEC_EMI_BASE and size to the header file iod: Enhance to support display of multiple values arm: mxs: Correct CONFIG_SPL_NO_CPU_SUPPORT option spl: Allow tiny printf() to be controlled in SPL and TPL spl: Convert CONFIG_SPL_LIMIT to hex spl: Add a size check for TPL spl: Allow distinguishing between two phases in U-Boot spl: Allow SPL/TPL to use of-platdata without libfdt x86: Move acpi_s3.h to a common location x86: pci: Drop the first parameter in pci_x86_r/w_config() x86: timer: Reduce timer code size in TPL on Intel CPUs x86: Use a common definition of MSR_IA32_PERF_CTL x86: Add a common function to set CPU thermal target x86: Use a common bus clock for Intel CPUs x86: Add common functions for TDP and perf control x86: Tidy up some duplicate MSR defines x86: Add new common CPU functions for turbo/burst mode dm: core: Drop fdtdec_get_pci_addr() sandbox: pci: Create a new sandbox_pci_read_bar() function x86: Allow the PCH and LPC uclasses to work with of-platdata x86: timer: Set up the timer in timer_early_get_count() x86: Refactor mtrr_commit() to allow for shared code x86: Add a function to set variable MTRRs x86: pci: Add a function to decode a PCI BDF x86: cpu: Don't include the cpu driver in TPL x86: Use mtrr_commit() with FSP2 x86: spl: Support init of a PUNIT x86: Panic when SPL or TPL fail x86: tpl: Add a fake PCI bus sandbox: pci: Remember the device being emulated x86: power: Add a PMC uclass x86: sandbox: Add a PMC emulator and test x86: power: Add a 'pmc' command trace: Remove the const from write functions pci: Add support for p2sb uclass sandbox: Add PCI driver and test for p2sb x86: Add a uclass for ITSS sandbox: Add a test for ITSS x86: Define the SPL image start x86: Reduce mrccache record alignment size x86: Add a function to find the size of an mrccache record x86: Correct mrccache find_next_mrc_cache() calculation x86: Adjust mrccache_get_region() to use livetree x86: Add a new global_data member for the cache record x86: Tidy up error handling in mrccache_save() x86: Update mrccache to support multiple caches x86: Add mrccache support for a 'variable' cache x86: Move fsp_prepare_mrc_cache() to fsp1 directory x86: Set the DRAM banks to reflect real location x86: Set up the MTRR for SDRAM x86: Update Kconfig options for FSP1 x86: Don't imply TPL_OF_LIBFDT x86: Allow removal of standard PCH drivers x86: Allow interrupt to happen once x86: Add FSP2 base support x86: Don't include the BIOS emulator in TPL x86: Add an option to include a FIT x86: Add support for newer CAR schemes x86: Drop RESET_BASE x86: Drop RESET_SEG_SIZE x86: Disable microcode section for FSP2 x86: Use fsp command with FSP1 x86: Update .dtsi file for FSP2 x86: Add an option to control the position of U-Boot x86: Add an option to control the position of SPL x86: Reduce resetvec size x86: Add an fdtmap and image-header x86: Don't repeat microcode in U-Boot if not needed x86: apollolake: Add basic IO addresses x86: apollolake: Add PMC driver x86: apollolake: Add UART driver x86: apollolake: Add GPIO driver x86: apollolake: Add defintions for the Intel Fast SPI interface x86: apollolake: Add systemagent driver x86: apollolake: Add hostbridge driver x86: apollolake: Add ITSS driver x86: apollolake: Add LPC driver x86: apollolake: Add PCH driver x86: apollolake: Add PUNIT driver x86: apollolake: Add SPL loaders x86: apollolake: Add a CPU driver x86: apollolake: Add SPL/TPL init x86: apollolake: Add P2SB driver x86: apollolake: Add Kconfig and Makefile x86: apollolake: Add FSP structures x86: Add chromebook_coral RFC: x86: coral: Add binary MRC data Kconfig | 9 +- Makefile | 20 +- arch/Kconfig | 4 +- arch/arm/Kconfig | 2 +- arch/arm/cpu/arm926ejs/Makefile | 2 +- arch/arm/mach-omap2/Kconfig | 6 +- arch/arm/mach-rmobile/Kconfig | 2 +- arch/arm/mach-rmobile/Kconfig.32 | 14 +- arch/arm/mach-socfpga/Kconfig | 6 +- arch/arm/mach-uniphier/pinctrl-glue.c | 4 +- arch/sandbox/cpu/cpu.c | 51 ++ arch/sandbox/cpu/start.c | 25 + arch/sandbox/cpu/state.c | 1 + arch/sandbox/dts/sandbox.dtsi | 25 +- arch/sandbox/dts/test.dts | 78 +- arch/sandbox/include/asm/io.h | 69 +- arch/sandbox/include/asm/state.h | 1 + arch/sandbox/include/asm/test.h | 28 +- arch/sandbox/lib/pci_io.c | 12 +- arch/x86/Kconfig | 100 ++- arch/x86/cpu/Makefile | 8 +- arch/x86/cpu/apollolake/Kconfig | 68 ++ arch/x86/cpu/apollolake/Makefile | 21 + arch/x86/cpu/apollolake/cpu.c | 51 ++ arch/x86/cpu/apollolake/cpu_spl.c | 272 +++++++ arch/x86/cpu/apollolake/gpio.c | 742 ++++++++++++++++++ arch/x86/cpu/apollolake/hostbridge.c | 127 +++ arch/x86/cpu/apollolake/itss.c | 129 +++ arch/x86/cpu/apollolake/lpc.c | 155 ++++ arch/x86/cpu/apollolake/p2sb.c | 167 ++++ arch/x86/cpu/apollolake/pch.c | 29 + arch/x86/cpu/apollolake/pmc.c | 216 +++++ arch/x86/cpu/apollolake/punit.c | 121 +++ arch/x86/cpu/apollolake/spl.c | 122 +++ arch/x86/cpu/apollolake/systemagent.c | 19 + arch/x86/cpu/apollolake/uart.c | 157 ++++ arch/x86/cpu/baytrail/acpi.c | 2 +- arch/x86/cpu/baytrail/cpu.c | 6 +- arch/x86/cpu/broadwell/cpu.c | 18 +- arch/x86/cpu/broadwell/cpu_full.c | 41 +- arch/x86/cpu/broadwell/sdram.c | 8 +- arch/x86/cpu/config.mk | 2 - arch/x86/cpu/cpu.c | 2 +- arch/x86/cpu/intel_common/Kconfig | 18 + arch/x86/cpu/intel_common/Makefile | 8 + arch/x86/cpu/intel_common/car2.S | 490 ++++++++++++ arch/x86/cpu/intel_common/car2_uninit.S | 87 ++ arch/x86/cpu/intel_common/cpu.c | 104 ++- arch/x86/cpu/intel_common/fast_spi.c | 3 +- arch/x86/cpu/ivybridge/cpu.c | 3 +- arch/x86/cpu/ivybridge/model_206ax.c | 52 +- arch/x86/cpu/ivybridge/northbridge.c | 2 +- arch/x86/cpu/ivybridge/sdram.c | 8 +- arch/x86/cpu/mtrr.c | 57 +- arch/x86/cpu/pci.c | 38 +- arch/x86/cpu/quark/dram.c | 8 +- arch/x86/cpu/resetvec.S | 3 - arch/x86/cpu/turbo.c | 10 +- arch/x86/cpu/u-boot-spl.lds | 5 +- arch/x86/cpu/wakeup.S | 2 +- arch/x86/dts/Makefile | 1 + arch/x86/dts/chromebook_coral.dts | 298 +++++++ arch/x86/dts/u-boot.dtsi | 89 ++- arch/x86/include/asm/arch-apollolake/cpu.h | 21 + .../include/asm/arch-apollolake/fast_spi.h | 176 +++++ .../asm/arch-apollolake/fsp/fsp_configs.h | 13 + .../asm/arch-apollolake/fsp/fsp_m_upd.h | 127 +++ .../include/asm/arch-apollolake/fsp/fsp_vpd.h | 11 + arch/x86/include/asm/arch-apollolake/gpio.h | 156 ++++ .../include/asm/arch-apollolake/gpio_apl.h | 491 ++++++++++++ .../include/asm/arch-apollolake/gpio_defs.h | 398 ++++++++++ arch/x86/include/asm/arch-apollolake/iomap.h | 28 + arch/x86/include/asm/arch-apollolake/itss.h | 43 + arch/x86/include/asm/arch-apollolake/lpc.h | 61 ++ arch/x86/include/asm/arch-apollolake/pch.h | 9 + arch/x86/include/asm/arch-apollolake/pm.h | 19 + .../include/asm/arch-apollolake/systemagent.h | 31 + arch/x86/include/asm/arch-apollolake/uart.h | 17 + arch/x86/include/asm/arch-broadwell/cpu.h | 3 - arch/x86/include/asm/arch-broadwell/pch.h | 3 - .../include/asm/arch-ivybridge/model_206ax.h | 5 +- arch/x86/include/asm/cpu.h | 1 + arch/x86/include/asm/cpu_common.h | 83 +- arch/x86/include/asm/fsp/fsp_support.h | 7 - arch/x86/include/asm/fsp2/fsp_api.h | 38 + arch/x86/include/asm/fsp2/fsp_internal.h | 16 + arch/x86/include/asm/global_data.h | 21 +- arch/x86/include/asm/mrccache.h | 14 +- arch/x86/include/asm/msr-index.h | 106 +-- arch/x86/include/asm/mtrr.h | 12 + arch/x86/include/asm/pci.h | 37 +- arch/x86/lib/Makefile | 2 + arch/x86/lib/acpi_s3.c | 2 +- arch/x86/lib/coreboot_table.c | 2 +- arch/x86/lib/fsp/fsp_common.c | 22 +- arch/x86/lib/fsp/fsp_dram.c | 35 +- arch/x86/lib/fsp1/fsp_common.c | 22 +- arch/x86/lib/fsp1/fsp_dram.c | 8 +- arch/x86/lib/fsp2/Makefile | 7 + arch/x86/lib/fsp2/fsp_dram.c | 73 ++ arch/x86/lib/fsp2/fsp_meminit.c | 344 ++++++++ arch/x86/lib/fsp2/fsp_support.c | 109 +++ arch/x86/lib/init_helpers.c | 22 +- arch/x86/lib/lpc-uclass.c | 2 + arch/x86/lib/mrccache.c | 186 +++-- arch/x86/lib/spl.c | 42 +- arch/x86/lib/tpl.c | 27 +- board/google/Kconfig | 15 + board/google/chromebook_coral/Kconfig | 43 + board/google/chromebook_coral/MAINTAINERS | 6 + board/google/chromebook_coral/Makefile | 5 + board/google/chromebook_coral/coral.c | 18 + board/google/chromebook_coral/rw-mrc-cache | Bin 0 -> 65536 bytes .../google/chromebook_coral/rw-var-mrc-cache | Bin 0 -> 4096 bytes cmd/Kconfig | 8 + cmd/Makefile | 1 + cmd/io.c | 84 +- cmd/pmc.c | 81 ++ cmd/x86/Makefile | 2 +- common/iotrace.c | 6 +- common/spl/Kconfig | 12 +- common/xyzModem.c | 2 +- configs/am335x_pdu001_defconfig | 2 +- configs/chromebook_coral_defconfig | 95 +++ configs/chromebook_samus_tpl_defconfig | 1 + configs/evb-rk3288_defconfig | 2 +- configs/ls1043ardb_nand_SECURE_BOOT_defconfig | 2 +- configs/ls1043ardb_nand_defconfig | 2 +- .../ls1043ardb_sdcard_SECURE_BOOT_defconfig | 2 +- configs/ls1043ardb_sdcard_defconfig | 2 +- configs/sandbox_defconfig | 2 + configs/sandbox_spl_defconfig | 3 +- configs/tinker-rk3288_defconfig | 2 +- doc/arch/sandbox.rst | 9 + doc/board/google/chromebook_coral.rst | 25 + doc/driver-model/debugging.rst | 62 ++ doc/driver-model/of-plat.rst | 2 +- doc/driver-model/pci-info.rst | 25 +- drivers/Makefile | 2 + drivers/block/blk-uclass.c | 4 +- drivers/core/Makefile | 4 +- drivers/core/device.c | 3 +- drivers/core/fdtaddr.c | 30 + drivers/core/lists.c | 20 +- drivers/core/ofnode.c | 9 +- drivers/core/read.c | 11 + drivers/core/uclass.c | 16 +- drivers/gpio/gpio-uclass.c | 4 +- drivers/gpio/pm8916_gpio.c | 12 +- drivers/misc/Kconfig | 42 + drivers/misc/Makefile | 7 +- drivers/misc/itss-uclass.c | 34 + drivers/misc/itss_sandbox.c | 44 ++ drivers/misc/p2sb-uclass.c | 199 +++++ drivers/misc/p2sb_emul.c | 272 +++++++ drivers/misc/p2sb_sandbox.c | 44 ++ drivers/misc/sandbox_adder.c | 60 ++ drivers/misc/swap_case.c | 48 +- drivers/mmc/mmc.c | 2 +- drivers/mmc/sandbox_mmc.c | 4 + drivers/mtd/spi/sf-uclass.c | 2 +- drivers/nvme/nvme.h | 4 +- drivers/pch/Kconfig | 18 + drivers/pch/Makefile | 4 +- drivers/pch/pch-uclass.c | 2 + drivers/pci/pci-emul-uclass.c | 74 +- drivers/pci/pci-uclass.c | 5 +- drivers/pci/pci_auto.c | 12 +- drivers/pci/pci_auto_common.c | 3 +- drivers/pci/pci_rom.c | 2 +- drivers/pci/pci_sandbox.c | 1 + drivers/pci/pci_x86.c | 16 +- drivers/power/Kconfig | 2 + drivers/power/power_mgr/Kconfig | 34 + drivers/power/power_mgr/Makefile | 6 + drivers/power/power_mgr/pmc_emul.c | 246 ++++++ drivers/power/power_mgr/power-mgr-uclass.c | 242 ++++++ drivers/power/power_mgr/sandbox.c | 97 +++ drivers/serial/ns16550.c | 31 +- drivers/serial/sandbox.c | 2 + drivers/sysreset/sysreset_x86.c | 2 +- drivers/timer/Kconfig | 29 +- drivers/timer/tsc_timer.c | 9 +- {arch/x86/include/asm => include}/acpi_s3.h | 0 include/configs/chromebook_coral.h | 29 + include/configs/mxs.h | 2 +- include/dm/device.h | 9 + include/dm/fdtaddr.h | 8 + include/dm/read.h | 28 +- include/dm/uclass-id.h | 4 + include/dm/uclass-internal.h | 4 +- include/ec_commands.h | 4 + include/fdtdec.h | 17 - include/iotrace.h | 13 +- include/itss.h | 56 ++ include/log.h | 33 +- include/ns16550.h | 4 + include/p2sb.h | 127 +++ include/pci.h | 33 +- include/power/power_mgr.h | 177 +++++ include/spl.h | 16 +- lib/Kconfig | 24 +- lib/Makefile | 2 +- lib/fdtdec.c | 54 -- net/eth-uclass.c | 34 +- scripts/Makefile.lib | 4 +- scripts/config_whitelist.txt | 1 - test/dm/Makefile | 3 + test/dm/core.c | 3 +- test/dm/itss.c | 29 + test/dm/p2sb.c | 28 + test/dm/pci.c | 51 +- test/dm/pmc.c | 33 + test/dm/test-main.c | 16 +- tools/binman/control.py | 36 +- tools/binman/entry.py | 18 + tools/binman/etype/image_header.py | 1 + tools/binman/etype/section.py | 16 +- tools/binman/image.py | 2 + 219 files changed, 9447 insertions(+), 787 deletions(-) create mode 100644 arch/x86/cpu/apollolake/Kconfig create mode 100644 arch/x86/cpu/apollolake/Makefile create mode 100644 arch/x86/cpu/apollolake/cpu.c create mode 100644 arch/x86/cpu/apollolake/cpu_spl.c create mode 100644 arch/x86/cpu/apollolake/gpio.c create mode 100644 arch/x86/cpu/apollolake/hostbridge.c create mode 100644 arch/x86/cpu/apollolake/itss.c create mode 100644 arch/x86/cpu/apollolake/lpc.c create mode 100644 arch/x86/cpu/apollolake/p2sb.c create mode 100644 arch/x86/cpu/apollolake/pch.c create mode 100644 arch/x86/cpu/apollolake/pmc.c create mode 100644 arch/x86/cpu/apollolake/punit.c create mode 100644 arch/x86/cpu/apollolake/spl.c create mode 100644 arch/x86/cpu/apollolake/systemagent.c create mode 100644 arch/x86/cpu/apollolake/uart.c create mode 100644 arch/x86/cpu/intel_common/Kconfig create mode 100644 arch/x86/cpu/intel_common/car2.S create mode 100644 arch/x86/cpu/intel_common/car2_uninit.S create mode 100644 arch/x86/dts/chromebook_coral.dts create mode 100644 arch/x86/include/asm/arch-apollolake/cpu.h create mode 100644 arch/x86/include/asm/arch-apollolake/fast_spi.h create mode 100644 arch/x86/include/asm/arch-apollolake/fsp/fsp_configs.h create mode 100644 arch/x86/include/asm/arch-apollolake/fsp/fsp_m_upd.h create mode 100644 arch/x86/include/asm/arch-apollolake/fsp/fsp_vpd.h create mode 100644 arch/x86/include/asm/arch-apollolake/gpio.h create mode 100644 arch/x86/include/asm/arch-apollolake/gpio_apl.h create mode 100644 arch/x86/include/asm/arch-apollolake/gpio_defs.h create mode 100644 arch/x86/include/asm/arch-apollolake/iomap.h create mode 100644 arch/x86/include/asm/arch-apollolake/itss.h create mode 100644 arch/x86/include/asm/arch-apollolake/lpc.h create mode 100644 arch/x86/include/asm/arch-apollolake/pch.h create mode 100644 arch/x86/include/asm/arch-apollolake/pm.h create mode 100644 arch/x86/include/asm/arch-apollolake/systemagent.h create mode 100644 arch/x86/include/asm/arch-apollolake/uart.h create mode 100644 arch/x86/include/asm/fsp2/fsp_api.h create mode 100644 arch/x86/include/asm/fsp2/fsp_internal.h create mode 100644 arch/x86/lib/fsp2/Makefile create mode 100644 arch/x86/lib/fsp2/fsp_dram.c create mode 100644 arch/x86/lib/fsp2/fsp_meminit.c create mode 100644 arch/x86/lib/fsp2/fsp_support.c create mode 100644 board/google/chromebook_coral/Kconfig create mode 100644 board/google/chromebook_coral/MAINTAINERS create mode 100644 board/google/chromebook_coral/Makefile create mode 100644 board/google/chromebook_coral/coral.c create mode 100644 board/google/chromebook_coral/rw-mrc-cache create mode 100644 board/google/chromebook_coral/rw-var-mrc-cache create mode 100644 cmd/pmc.c create mode 100644 configs/chromebook_coral_defconfig create mode 100644 doc/board/google/chromebook_coral.rst create mode 100644 doc/driver-model/debugging.rst create mode 100644 drivers/misc/itss-uclass.c create mode 100644 drivers/misc/itss_sandbox.c create mode 100644 drivers/misc/p2sb-uclass.c create mode 100644 drivers/misc/p2sb_emul.c create mode 100644 drivers/misc/p2sb_sandbox.c create mode 100644 drivers/misc/sandbox_adder.c create mode 100644 drivers/power/power_mgr/Kconfig create mode 100644 drivers/power/power_mgr/Makefile create mode 100644 drivers/power/power_mgr/pmc_emul.c create mode 100644 drivers/power/power_mgr/power-mgr-uclass.c create mode 100644 drivers/power/power_mgr/sandbox.c rename {arch/x86/include/asm => include}/acpi_s3.h (100%) create mode 100644 include/configs/chromebook_coral.h create mode 100644 include/itss.h create mode 100644 include/p2sb.h create mode 100644 include/power/power_mgr.h create mode 100644 test/dm/itss.c create mode 100644 test/dm/p2sb.c create mode 100644 test/dm/pmc.c -- 2.23.0.444.g18eeb5a265-goog