x86: Add initial support for apollolake
Subsystems (22)
v4 cover x86: Add initial support for apollolake
Apollo Lake 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 Apollo Lake. As an example it adds an implementation of chromebook_coral (a large range of Chromebooks released in 2017).
The series provides enough support to boot to a prompt. with LCD display, storage, USB, EC and keyboard.
Since this is the first time U-Boot has used FSP2 there is quite a bit of refactoring needed.
This series is available at u-boot-dm/coral-working
Changes in v4:
- Add a LOG_CATEGORY for silicon init
- Add a binding file
- Add a comment about the speed logic in __dw_i2c_set_bus_speed()
- Add a comment for enable_bios_reset_cpl()
- Add a comment in the commit message about why has_max_speed is added
- Add a patch to explain of-platdata and header files
- Add an extra comment to apl_uart_init()
- Add comments about MRC-cache records being the same size
- Add comments for exported functions
- Add comments to functions
- Add more documentation for pci_ofplat_get_devfn()
- Add new patch to allow designware I2C driver to work in SPL
- Add new patch to drop static data in designware i2c driver
- Add new patch to make mrccache_update() static
- Add new patch to move early-timer init later
- Add support for updating power state
- Add u-boot,skip-auto-config-until-reloc property to PCI
- Adjust
- Adjust condition for binding children
- Adjust the comment for struct dw_i2c_speed_config
- Allow pinctrl nodes to have subnodes (i.e. GPIO nodes)
- Avoid needing to know internals of pinctrl in this driver
- Change apollolake to apl
- Change the behaviour to be a device-tree option
- Detect zero mmio address
- Disable SPL_DM_GPIO on omap35_logic to avoid a build error
- Drop 'if (0)' call to deep_magic_nexgen_probe() and use #ifndef instead
- Drop GPIO_NUM_PAD_CFG_REGS
- Drop TCO_BASE_ADDRESS
- Drop change to message about a missing uclass
- Drop duplicate VBT file CONFIG
- Drop duplicate commit 'Create a new sandbox_pci_read_bar() function'
- Drop empty operations struct since p2sb does not need it
- Drop incorrect coreboot reference from header file
- Drop itss uclass change in Makefile (now in previous patch)
- Drop itss uclass in Makefile
- Drop pmic_pm8916 driver name and use a sandbox name instead
- Drop sandbox defconfig change now that p2sb change is correct
- Drop the whole interrupt file for TPL
- Drop unwanted debug printf("bad\n")
- Enable HAVE_VBT for FSP2 also
- Enable HAVE_X86_FIT
- Enable INTEL_GPIO
- Enable IRQ for sandbox64 too to avoid build error
- Enable option for slimbootloader, coreboot, efi
- Expand commit message to better explain the need to checksum functions
- Explain the 'twisty headers' comment
- Explain why FSP-M cannot be shown
- Fix 'enabled' typo
- Fix 'what' typo
- Fix FSP_M reference to refer to FSP_S in commit message
- Fix Makefile copyright message
- Fix alpha order in Kconfig
- Fix comment for exec_sync_hwseq_xfer()
- Fix comment on fsp_silicon_init()
- Fix incorrect mask check in pmc_gpe_init()
- Fix indentation nit
- Fix up license header
- Fix various code-style problems
- Mention that the return value is pci_dev_t
- Move code to pinctrl driver
- Move this to intel_common
- Name this P-Unit instead of power unit, in the commit message
- New GPIO driver binding
- One last desperate attempt to try to explain the purpose of this commit
- Rename arch_fsp_s_preinit() to arch_fsps_preinit()
- Rename get_coreboot_fsp() and add comments
- Rename new file to designware_i2c_pci.c
- Rename option to HAVE_SYS_TEXT_BASE
- Rename pci_x86_ofplat_get_devfn() to pci_ofplat_get_devfn()
- Reverse the sense of the CONFIG option
- Set up LPC pads early
- Split out GPIO code from the pinctrl driver
- Split out into a separate patch
- Split out mmio changes into a separate patch
- Switch over to use pinctrl for pad init/config
- Tidy up header guards
- Tidy up mixed case in FSP code
- Tidy up the header file a little
- Update SPI flash protection only in SPL
- Update commit message to indicate that CPU-identity bug is fixed
- Update documentation with more detailed memory map
- Update the commit message to be clearer, fix 'correct' typo
- Update the message to mention the preprocessed file, not un-preprocessed
- Use 'Apollo Lake'
- Use BIT() macro a bit more
- Use BIT() macro bit more
- Use CONFIG_INTEL_CAR_CQOS to control car2.S inclusion
- Use car_init_ret to return
- Use existing VBT Kconfig option
- Use hex for size values also
- Use hyphen for device-tree properties
- Use lower-case pinctrl in arch_cpu_init_dm()
- Use pci_ofplat_get_devfn()
- Use post_code() calls consistent with car.S
- Use priv->pch instead of dev->parent
- Use tabs instead of spaces
- Use the new pci_ofplat_get_devfn() function
- apollolake -> Apollo Lake
- use GENMASK() for VTBAR_MASK
Changes in v3:
- Ad FSP-S support
- Add CONFIG_TPL_X86_ASSUME_CPUID to reduce code size
- Add Chrome OS EC support
- Add FSP-S and VBT also
- Add MMC, video, USB configs
- Add SPL condition to the option
- Add VBT signature
- Add a driver for APL SPI for TPL (using of-platdata)
- Add a proper SPI node and make the SPI flash node a child
- Add a proper implementation of fsp_notify
- Add a weak function to avoid errors on other platforms
- Add an APL_SPI_FLASH_BOOT option to enable non-mmap boot
- Add an extra size parameter to the find_next_mrc_cache() function
- Add an fsp: tag
- Add bootstage support
- Add bootstage timing for memory-mapped reads
- Add bootstage timing for reading vbt
- Add fsp_locate_fsp to locate an fsp component
- Add fspm_done() hook
- Add fspm_done() hook to handle FSP-S wierdness (it breaks SPI flash)
- Add help to CONFIG_FIT and don't make it 'default y'
- Add more documentation
- Add snapshot/restore for IRQs
- Add spi alias in device tree
- Add structures for FSP-S also
- Add support for FSP-S component and VBT
- Add support for of-platdata for TPL
- Add the missing header file
- Add two more defines for the CPU driver
- Add two more operations to IRQ
- Add various minor tidy-ups
- Adjust fast_spi_cache_bios_region() to avoid using SPI driver
- Change Fast-SPI driver into a helper file used by ICH SPI
- Change the sandbox test from ITSS to IRQ
- Convert code to use hex increased of decimal
- Disable the bootcommand since it does nothing useful on coral
- Don't allow BOOT_FROM_FAST_SPI_FLASH with FSP-S
- Don't enable SPI flash in TPL by default
- Don't imply SPI flash either
- Don't include write() and erase() in TPL
- Drop 'a4' comment for register offset
- Drop CONFIG_SPL_NET_SUPPORT
- Drop VBT as we already have it elsewhere
- Drop calls to x86_cpu_init_f(), x86_cpu_reinit_f()
- Drop dead code
- Drop patch '86: timer: Reduce timer code size in TPL on Intel CPUs'
- Drop patch 'dm: core: Don't include ofnode functions with of-platdata'
- Drop patch 'spi: sandbox: Add a test driver for sandbox SPI flash'
- Drop patch 'spl: Allow SPL/TPL to use of-platdata without libfdt'
- Drop patch 'x86: apollolake: Add definitions for the Intel Fast SPI interface'
- Drop patch 'x86: timer: Set up the timer in timer_early_get_count()'
- Drop struct fsp_usp_header as it is now in the API file
- Drop unnecessary #else part of CONFIG_HAVE_MICROCODE
- Drop unneeded Kconfig file
- Drop unused code in lpc_configure_pads()
- Enable video and USB3
- Expand comments for BOOT_FROM_FAST_SPI_FLASH
- Fix build error when debug UART is disabled
- Fix build errors in sandbox_spl, etc
- Fix mixed case in GPIO defines
- Fix the incorrect value of CPU_ADDR_BITS
- Fix value of LPC_BC_LE
- Init the p2sb before the northbridge since the latter so it can use GPIOs
- Merge in patch "x86: Add support for booting from Fast SPI"
- Move an additional error handling fix from a future patch
- Move line related to variable-cache into the next patch
- Move location of fast_spi.h header file
- Move mtrr_add_request() call into this patch
- Move mtrr_add_request() call to next patch
- Move pad programming into the hostbridge to reduce TPL device-tree size
- Move the function to a common file instead of duplicating it
- Move the mrccache_get_region() change into this patch
- Move write_pirq_routing_table() to avoid 64-bit build error
- Only supress the 'MAC address from ROM' warning on sandbox
- Reduce amount of early-pad data in TPL
- Rename X86_HAS_FIT to HAVE_X86_FIT
- Rename power-mgr uclass to acpi-pmc
- Reorder file so that write() and erase() are together
- Rework how pads configuration is defined in TPL and SPL
- Rewrite commit message
- Set boot_loader_tolum_size to 0
- Set the environment variables at runtime to avoid other warnings
- Shorten log_msg_ret() calls since the function name is always printed
- Simplify types for fsp_locate_fsp()
- Support TPL without CONFIG_TPL_SPI_SUPPORT
- Support TPL without CONFIG_TPL_SPI_SUPPORT (reduces code size)
- Support bootstage timing
- Switch mmap to use SPI instead of SPI flash
- Tidy up Makefile rules to reduce duplication
- Tidy up the pad settings in the device tree
- Update commit message to explain why HAVE_FIT woudl be confusing
- Update device type to pci_dev_t
- Update example error message to better show the intended purpose
- Update mrccache livetree patch to just convert to livetree
- Update the 'fsp' command for FSP2, instead of disabling it
- Use a macro for is-power-of-two
- Use a zero-based tsc timer
- Use pci_get_devfn()
- Use the IRQ uclass instead of ITSS
- Use the IRQ uclass instead of creating a new ITSS uclass
- Use the LPSS code from a separate file
Changes in v2:
- Change 'queensbay' to 'baytrail' in help
- Drop probe() function
- Fix 'proides' typo
- Fix the Kconfig condition to avoid build errors on snow
- Implement set_spi_protect()
- Use SPI mmap() instead of SPI flash
Simon Glass (100):
binman: Add a library to access binman entries
dm: gpio: Allow control of GPIO uclass in SPL
dm: core: Fix offset_to_ofnode() with invalid offset
dm: pci: Allow delaying auto-config until after relocation
dm: pci: Move pci_get_devfn() into a common file
net: Move the checksum functions to lib/
i2c: designware: Tidy up PCI support
i2c: designware: Avoid using static data
i2c: designware: Support use in SPL
x86: spi: Add helper functions for Intel Fast SPI
fdt: Show the preprocessed .dts file on error
board_r: Move early-timer init later
RFC: sandbox: net: Suppress the MAC-address warnings Revert "RFC: sandbox: net: Suppress the MAC-address warnings"
x86: timer: use a timer base of 0
x86: timer: Reduce timer code size in TPL on Intel CPUs
x86: Drop unnecessary cpu code for TPL
x86: Drop unnecessary interrupt code for TPL
x86: power: Add an ACPI PMC uclass
x86: sandbox: Add a PMC emulator and test
x86: power: Add a 'pmc' command
pci: Add support for p2sb uclass
sandbox: Disable mmio by default in tests
sandbox: Add PCI driver and test for p2sb
x86: Move UCLASS_IRQ into a separate file
sandbox: Add a test for IRQ
x86: Define the SPL image start
x86: Reduce mrccache record alignment size
x86: Correct mrccache find_next_mrc_cache() calculation
x86: Adjust mrccache_get_region() to use livetree
x86: Adjust mrccache_get_region() to support get_mmap()
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: Don't export mrccache_update()
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: Don't imply libfdt or SPI flash in TPL
x86: Allow removal of standard PCH drivers
x86: Allow interrupt to happen once
x86: fsp: Make graphics support common to FSP1/2
x86: fsp: Correct wrong header inlude in fsp_support.c
x86: fsp: Add FSP2 base support
x86: fsp: Set up an MTRR for the graphics frame buffer
x86: fsp: Add a new arch_fsp_init_r() hook
x86: fsp: Allow remembering the location of FSP-S
x86: fsp: Make the notify API call common
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: Disable microcode section for FSP2
x86: Update the fsp command for FSP2
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: Add an fdtmap and image-header
x86: Don't repeat microcode in U-Boot if not needed
x86: Separate out U-Boot and device tree in ROM image
x86: Make MSR_PKG_POWER_SKU common
spi: Correct operations check in dm_spi_xfer()
x86: spi: Don't enable SPI_FLASH_BAR by default
spi: ich: Move init function just above probe()
spi: ich: Move the protection/lockdown code into a function
spi: ich: Convert to livetree
spi: ich: Fix header order
spi: ich: Various small tidy-ups
spi: ich: Add mmio_base to struct ich_spi_platdata
dm: doc: Add a note about of-platdata and header files
spi: ich: Correct max-size bug in ich_spi_adjust_size()
spi: ich: Support of-platdata for fast-spi
spi: ich: Support hardware sequencing
spi: ich: Add support for get_mmap() method
spi: ich: Add TPL support
spi: ich: Add Apollo Lake support
mtd: spi: Export spi_flash_std_probe()
x86: Enable pinctrl in SPL and TPL
x86: Add low-power subsystem (lpss) support
x86: Add a generic Intel pinctrl driver
x86: Add a generic Intel GPIO driver
x86: apl: Add basic IO addresses
x86: apl: Add PMC driver
x86: apl: Add UART driver
x86: apl: Add pinctrl driver
i2c: designware: Add Apollo Lake support
x86: apl: Add systemagent driver
x86: apl: Add hostbridge driver
x86: apl: Add ITSS driver
x86: apl: Add LPC driver
x86: apl: Add PCH driver
x86: apl: Add PUNIT driver
x86: apl: Add SPL loaders
x86: apl: Add a CPU driver
x86: apl: Add SPL/TPL init
x86: apl: Add P2SB driver
x86: apl: Add Kconfig and Makefile
x86: apl: Add FSP structures
x86: apl: Add FSP support
x86: Add chromebook_coral
Kconfig | 9 +-
arch/Kconfig | 9 +-
arch/arm/include/asm/omap_gpio.h | 2 +-
arch/arm/mach-at91/include/mach/at91sam9260.h | 2 +-
arch/arm/mach-davinci/include/mach/gpio.h | 2 +-
arch/arm/mach-omap2/am33xx/board.c | 4 +-
arch/arm/mach-omap2/omap3/board.c | 2 +-
arch/arm/mach-omap2/omap5/hwinit.c | 2 +-
arch/sandbox/cpu/state.c | 1 +
arch/sandbox/dts/sandbox.dtsi | 14 +
arch/sandbox/dts/test.dts | 31 +
arch/sandbox/include/asm/test.h | 2 +
arch/x86/Kconfig | 93 +-
arch/x86/cpu/Makefile | 3 +-
arch/x86/cpu/apollolake/Kconfig | 86 ++
arch/x86/cpu/apollolake/Makefile | 26 +
arch/x86/cpu/apollolake/cpu.c | 51 ++
arch/x86/cpu/apollolake/cpu_spl.c | 274 ++++++
arch/x86/cpu/apollolake/fsp_m.c | 210 +++++
arch/x86/cpu/apollolake/fsp_s.c | 664 ++++++++++++++
arch/x86/cpu/apollolake/hostbridge.c | 179 ++++
arch/x86/cpu/apollolake/itss.c | 214 +++++
arch/x86/cpu/apollolake/lpc.c | 141 +++
arch/x86/cpu/apollolake/p2sb.c | 167 ++++
arch/x86/cpu/apollolake/pch.c | 36 +
arch/x86/cpu/apollolake/pmc.c | 216 +++++
arch/x86/cpu/apollolake/punit.c | 121 +++
arch/x86/cpu/apollolake/spl.c | 202 +++++
arch/x86/cpu/apollolake/systemagent.c | 19 +
arch/x86/cpu/apollolake/uart.c | 141 +++
arch/x86/cpu/broadwell/sdram.c | 8 +-
arch/x86/cpu/coreboot/Kconfig | 1 +
arch/x86/cpu/cpu.c | 4 +
arch/x86/cpu/i386/Makefile | 2 +
arch/x86/cpu/i386/cpu.c | 41 +-
arch/x86/cpu/intel_common/Makefile | 10 +
arch/x86/cpu/intel_common/car2.S | 448 ++++++++++
arch/x86/cpu/intel_common/car2_uninit.S | 87 ++
arch/x86/cpu/intel_common/fast_spi.c | 73 ++
arch/x86/cpu/intel_common/lpss.c | 44 +
arch/x86/cpu/irq.c | 13 -
arch/x86/cpu/ivybridge/sdram.c | 8 +-
arch/x86/cpu/quark/dram.c | 8 +-
arch/x86/cpu/slimbootloader/Kconfig | 1 +
arch/x86/cpu/u-boot-spl.lds | 5 +-
arch/x86/dts/Makefile | 1 +
arch/x86/dts/chromebook_coral.dts | 823 ++++++++++++++++++
arch/x86/dts/u-boot.dtsi | 81 +-
arch/x86/include/asm/arch-apollolake/cpu.h | 27 +
.../asm/arch-apollolake/fsp/fsp_configs.h | 14 +
.../asm/arch-apollolake/fsp/fsp_m_upd.h | 123 +++
.../asm/arch-apollolake/fsp/fsp_s_upd.h | 292 +++++++
.../include/asm/arch-apollolake/fsp/fsp_vpd.h | 11 +
arch/x86/include/asm/arch-apollolake/gpio.h | 490 +++++++++++
arch/x86/include/asm/arch-apollolake/iomap.h | 25 +
arch/x86/include/asm/arch-apollolake/itss.h | 43 +
arch/x86/include/asm/arch-apollolake/lpc.h | 82 ++
arch/x86/include/asm/arch-apollolake/pch.h | 9 +
arch/x86/include/asm/arch-apollolake/pm.h | 19 +
.../include/asm/arch-apollolake/systemagent.h | 37 +
arch/x86/include/asm/arch-apollolake/uart.h | 20 +
arch/x86/include/asm/arch-broadwell/cpu.h | 1 -
.../include/asm/arch-ivybridge/model_206ax.h | 1 -
arch/x86/include/asm/fast_spi.h | 68 ++
arch/x86/include/asm/fsp/fsp_api.h | 24 +
arch/x86/include/asm/fsp/fsp_support.h | 7 -
arch/x86/include/asm/fsp1/fsp_api.h | 21 +-
arch/x86/include/asm/fsp2/fsp_api.h | 63 ++
arch/x86/include/asm/fsp2/fsp_internal.h | 97 +++
arch/x86/include/asm/global_data.h | 25 +-
arch/x86/include/asm/intel_pinctrl.h | 293 +++++++
arch/x86/include/asm/intel_pinctrl_defs.h | 386 ++++++++
arch/x86/include/asm/lpss.h | 36 +
arch/x86/include/asm/mrccache.h | 29 +-
arch/x86/include/asm/msr-index.h | 9 +-
arch/x86/include/asm/processor.h | 12 +-
arch/x86/include/asm/spl.h | 1 +
arch/x86/lib/Makefile | 2 +
arch/x86/lib/fsp/Makefile | 3 +
arch/x86/lib/fsp/fsp_common.c | 20 -
arch/x86/lib/fsp/fsp_dram.c | 35 +-
arch/x86/lib/{fsp1 => fsp}/fsp_graphics.c | 6 +-
arch/x86/lib/fsp/fsp_support.c | 2 +-
arch/x86/lib/fsp1/Makefile | 1 -
arch/x86/lib/fsp1/fsp_common.c | 20 +
arch/x86/lib/fsp1/fsp_dram.c | 8 +-
arch/x86/lib/fsp2/Makefile | 10 +
arch/x86/lib/fsp2/fsp_common.c | 13 +
arch/x86/lib/fsp2/fsp_dram.c | 77 ++
arch/x86/lib/fsp2/fsp_init.c | 174 ++++
arch/x86/lib/fsp2/fsp_meminit.c | 97 +++
arch/x86/lib/fsp2/fsp_silicon_init.c | 54 ++
arch/x86/lib/fsp2/fsp_support.c | 135 +++
arch/x86/lib/mrccache.c | 204 +++--
arch/x86/lib/pirq_routing.c | 10 +
board/freescale/imx8qm_mek/imx8qm_mek.c | 2 +-
board/freescale/imx8qxp_mek/imx8qxp_mek.c | 2 +-
board/gateworks/gw_ventana/Kconfig | 3 +
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/toradex/apalis-imx8/apalis-imx8.c | 2 +-
cmd/Kconfig | 8 +
cmd/Makefile | 1 +
cmd/pmc.c | 81 ++
cmd/x86/fsp.c | 65 +-
common/board_r.c | 32 +-
configs/chromebook_coral_defconfig | 102 +++
configs/chromebook_samus_tpl_defconfig | 1 +
configs/omap35_logic_defconfig | 1 +
configs/sandbox64_defconfig | 3 +
configs/sandbox_defconfig | 2 +
configs/sandbox_flattree_defconfig | 4 +
configs/sandbox_spl_defconfig | 4 +
configs/tools-only_defconfig | 2 +
doc/board/google/chromebook_coral.rst | 241 +++++
.../gpio/intel,apl-gpio.txt | 55 ++
doc/device-tree-bindings/pci/x86-pci.txt | 24 +
.../pinctrl/intel,apl-pinctrl.txt | 39 +
doc/driver-model/of-plat.rst | 6 +
drivers/Makefile | 1 +
drivers/core/util.c | 20 +
drivers/gpio/Kconfig | 31 +
drivers/gpio/Makefile | 5 +-
drivers/gpio/at91_gpio.c | 6 +-
drivers/gpio/atmel_pio4.c | 2 +-
drivers/gpio/da8xx_gpio.c | 7 +-
drivers/gpio/da8xx_gpio.h | 2 +-
drivers/gpio/intel_gpio.c | 161 ++++
drivers/gpio/mxc_gpio.c | 4 +-
drivers/gpio/mxs_gpio.c | 4 +-
drivers/gpio/omap_gpio.c | 6 +-
drivers/gpio/sunxi_gpio.c | 8 +-
drivers/i2c/Makefile | 3 +
drivers/i2c/designware_i2c.c | 106 +--
drivers/i2c/designware_i2c.h | 35 +
drivers/i2c/designware_i2c_pci.c | 144 +++
drivers/i2c/i2c-uclass.c | 6 +-
drivers/i2c/muxes/pca954x.c | 4 +-
drivers/misc/Kconfig | 42 +
drivers/misc/Makefile | 5 +
drivers/misc/irq-uclass.c | 53 ++
drivers/misc/irq_sandbox.c | 55 ++
drivers/misc/p2sb-uclass.c | 209 +++++
drivers/misc/p2sb_emul.c | 272 ++++++
drivers/misc/p2sb_sandbox.c | 40 +
drivers/misc/sandbox_adder.c | 60 ++
drivers/mmc/fsl_esdhc_imx.c | 13 +-
drivers/mmc/omap_hsmmc.c | 2 +-
drivers/mtd/spi/sf_probe.c | 2 +-
drivers/net/designware.c | 10 +-
drivers/net/designware.h | 4 +-
drivers/net/fec_mxc.c | 6 +-
drivers/net/fec_mxc.h | 2 +-
drivers/net/mvneta.c | 4 +-
drivers/net/mvpp2.c | 8 +-
drivers/net/sun8i_emac.c | 12 +-
drivers/pch/Kconfig | 18 +
drivers/pch/Makefile | 4 +-
drivers/pci/pci-aardvark.c | 4 +-
drivers/pci/pci-uclass.c | 31 +-
drivers/pci/pcie_dw_mvebu.c | 4 +-
drivers/pinctrl/Kconfig | 23 +
drivers/pinctrl/Makefile | 1 +
drivers/pinctrl/intel/Kconfig | 24 +
drivers/pinctrl/intel/Makefile | 6 +
drivers/pinctrl/intel/pinctrl.c | 615 +++++++++++++
drivers/pinctrl/intel/pinctrl_apl.c | 192 ++++
drivers/power/Kconfig | 2 +
drivers/power/acpi_pmc/Kconfig | 34 +
drivers/power/acpi_pmc/Makefile | 6 +
drivers/power/acpi_pmc/acpi-pmc-uclass.c | 244 ++++++
drivers/power/acpi_pmc/pmc_emul.c | 246 ++++++
drivers/power/acpi_pmc/sandbox.c | 97 +++
drivers/spi/Kconfig | 1 -
drivers/spi/atmel_spi.c | 10 +-
drivers/spi/designware_spi.c | 4 +-
drivers/spi/ich.c | 528 ++++++++---
drivers/spi/ich.h | 46 +-
drivers/spi/spi-uclass.c | 5 +-
drivers/timer/Kconfig | 23 +
drivers/timer/tsc_timer.c | 10 +-
drivers/tpm/tpm2_tis_spi.c | 2 +-
include/binman.h | 45 +
include/bootstage.h | 3 +
include/config_uncmd_spl.h | 1 -
include/configs/at91-sama5_common.h | 5 +-
include/configs/chromebook_coral.h | 32 +
include/configs/gw_ventana.h | 1 -
include/configs/mx6ul_14x14_evk.h | 1 +
include/dm/ofnode.h | 2 +-
include/dm/pci.h | 43 +
include/dm/uclass-id.h | 2 +
include/init.h | 11 +
include/irq.h | 88 ++
include/p2sb.h | 127 +++
include/pci.h | 21 +-
include/power/acpi_pmc.h | 185 ++++
include/spi.h | 2 +-
include/spi_flash.h | 12 +
lib/Kconfig | 10 +
lib/Makefile | 3 +-
lib/binman.c | 48 +
lib/efi/Kconfig | 1 +
lib/net_utils.c | 48 +
net/Makefile | 1 -
net/checksum.c | 59 --
scripts/Makefile.lib | 4 +-
scripts/Makefile.uncmd_spl | 1 -
test/dm/Makefile | 3 +
test/dm/irq.c | 32 +
test/dm/p2sb.c | 28 +
test/dm/pmc.c | 33 +
215 files changed, 12234 insertions(+), 636 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/fsp_m.c
create mode 100644 arch/x86/cpu/apollolake/fsp_s.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/car2.S
create mode 100644 arch/x86/cpu/intel_common/car2_uninit.S
create mode 100644 arch/x86/cpu/intel_common/fast_spi.c
create mode 100644 arch/x86/cpu/intel_common/lpss.c
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/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_s_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/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/fast_spi.h
create mode 100644 arch/x86/include/asm/fsp/fsp_api.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/include/asm/intel_pinctrl.h
create mode 100644 arch/x86/include/asm/intel_pinctrl_defs.h
create mode 100644 arch/x86/include/asm/lpss.h
rename arch/x86/lib/{fsp1 => fsp}/fsp_graphics.c (95%)
create mode 100644 arch/x86/lib/fsp2/Makefile
create mode 100644 arch/x86/lib/fsp2/fsp_common.c
create mode 100644 arch/x86/lib/fsp2/fsp_dram.c
create mode 100644 arch/x86/lib/fsp2/fsp_init.c
create mode 100644 arch/x86/lib/fsp2/fsp_meminit.c
create mode 100644 arch/x86/lib/fsp2/fsp_silicon_init.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 cmd/pmc.c
create mode 100644 configs/chromebook_coral_defconfig
create mode 100644 doc/board/google/chromebook_coral.rst
create mode 100644 doc/device-tree-bindings/gpio/intel,apl-gpio.txt
create mode 100644 doc/device-tree-bindings/pci/x86-pci.txt
create mode 100644 doc/device-tree-bindings/pinctrl/intel,apl-pinctrl.txt
create mode 100644 drivers/gpio/intel_gpio.c
create mode 100644 drivers/i2c/designware_i2c_pci.c
create mode 100644 drivers/misc/irq-uclass.c
create mode 100644 drivers/misc/irq_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/pinctrl/intel/Kconfig
create mode 100644 drivers/pinctrl/intel/Makefile
create mode 100644 drivers/pinctrl/intel/pinctrl.c
create mode 100644 drivers/pinctrl/intel/pinctrl_apl.c
create mode 100644 drivers/power/acpi_pmc/Kconfig
create mode 100644 drivers/power/acpi_pmc/Makefile
create mode 100644 drivers/power/acpi_pmc/acpi-pmc-uclass.c
create mode 100644 drivers/power/acpi_pmc/pmc_emul.c
create mode 100644 drivers/power/acpi_pmc/sandbox.c
create mode 100644 include/binman.h
create mode 100644 include/configs/chromebook_coral.h
create mode 100644 include/dm/pci.h
create mode 100644 include/irq.h
create mode 100644 include/p2sb.h
create mode 100644 include/power/acpi_pmc.h
create mode 100644 lib/binman.c
delete mode 100644 net/checksum.c
create mode 100644 test/dm/irq.c
create mode 100644 test/dm/p2sb.c
create mode 100644 test/dm/pmc.cSignature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 1/100 binman: Add a library to access binman entries
SPL and TPL can access information about binman entries using link-time symbols but this is not available in U-Boot proper. Of course it could be made available, but the intention is to just read the device tree.
Add support for this, so that U-Boot can locate entries.
---
Changes in v4:
- Add comments to functions
Changes in v3: None
Changes in v2: None
common/board_r.c | 10 ++++++++++ include/binman.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ lib/Kconfig | 10 ++++++++++ lib/Makefile | 1 + lib/binman.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 114 insertions(+) create mode 100644 include/binman.h create mode 100644 lib/binman.c
common/board_r.c +10 -0
@@ -15,6 +15,7 @@#if defined(CONFIG_CMD_BEDBUG )#include <bedbug/type.h> #endif +#include <binman.h> #include <command.h> #include <console.h> #include <dm.h>
@@ -342,6 +343,14 @@ static int initr_manual_reloc_cmdtable(void) }#endif +static int initr_binman (void ) +{ +if (!CONFIG_IS_ENABLED (BINMAN_FDT )) +return 0 ; + +return binman_init (); +} +#if defined(CONFIG_MTD_NOR_FLASH )static int initr_flash (void ) {
@@ -692,6 +701,7 @@ static init_fnc_t init_sequence_r[] = {#ifdef CONFIG_EFI_LOADER efi_memory_init, #endif + initr_binman, stdio_init_tables, initr_serial, initr_announce,
include/binman.h new file +45 -0
45 lines not on this page · raw message
lib/Kconfig +10 -0
@@ -7,6 +7,16 @@ config BCH This is used by SoC platforms which do not have built-in ELM hardware engine required for BCH ECC correction. +config BINMAN_FDT + bool "Allow access to binman information in the device tree" + depends on BINMAN + default y + help + This enables U-Boot to access information about binman entries, + stored in the device tree in a binman node. Typical uses are to + locate entries in the firmware image. See binman.h for the available + functionality. + config CC_OPTIMIZE_LIBS_FOR_SPEED bool "Optimize libraries for speed" help
lib/Makefile +1 -0
@@ -19,6 +19,7 @@ obj-$(CONFIG_ARCH_AT91) += at91/ obj-$(CONFIG_OPTEE) += optee/ obj-$(CONFIG_AES) += aes.o +obj-$(CONFIG_$(SPL_TPL_)BINMAN_FDT) += binman.o ifndef API_BUILD ifneq ($(CONFIG_UT_UNICODE)$(CONFIG_EFI_LOADER),)
lib/binman.c new file +48 -0
48 lines not on this page · raw message
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 2/100 dm: gpio: Allow control of GPIO uclass in SPL
In reply to Simon GlassAt present if CONFIG_SPL_GPIO_SUPPORT is enabled then the GPIO uclass is included in SPL/TPL without any control for boards. Some boards may want to disable this to reduce code size where GPIOs are not needed in SPL or TPL.
Add a new Kconfig option to permit this. Default it to 'y' so that existing boards work correctly.
Change existing uses of CONFIG_DM_GPIO to CONFIG_IS_ENABLED(DM_GPIO) to preserve the current behaviour. Also update the 74x164 GPIO driver since it cannot build with SPL.
This allows us to remove the hacks in config_uncmd_spl.h and Makefile.uncmd_spl (eventually those files should be removed).
---
Changes in v4:
- Disable SPL_DM_GPIO on omap35_logic to avoid a build error
Changes in v3: None
Changes in v2:
- Fix the Kconfig condition to avoid build errors on snow
arch/arm/include/asm/omap_gpio.h | 2 +- arch/arm/mach-at91/include/mach/at91sam9260.h | 2 +- arch/arm/mach-davinci/include/mach/gpio.h | 2 +- arch/arm/mach-omap2/am33xx/board.c | 4 ++-- arch/arm/mach-omap2/omap3/board.c | 2 +- arch/arm/mach-omap2/omap5/hwinit.c | 2 +- board/freescale/imx8qm_mek/imx8qm_mek.c | 2 +- board/freescale/imx8qxp_mek/imx8qxp_mek.c | 2 +- board/gateworks/gw_ventana/Kconfig | 3 +++ board/toradex/apalis-imx8/apalis-imx8.c | 2 +- configs/omap35_logic_defconfig | 1 + drivers/gpio/Kconfig | 22 +++++++++++++++++++ drivers/gpio/Makefile | 4 +++- drivers/gpio/at91_gpio.c | 6 ++--- drivers/gpio/atmel_pio4.c | 2 +- drivers/gpio/da8xx_gpio.c | 7 +++--- drivers/gpio/da8xx_gpio.h | 2 +- drivers/gpio/mxc_gpio.c | 4 ++-- drivers/gpio/mxs_gpio.c | 4 ++-- drivers/gpio/omap_gpio.c | 6 ++--- drivers/gpio/sunxi_gpio.c | 8 +++---- drivers/i2c/i2c-uclass.c | 6 ++--- drivers/i2c/muxes/pca954x.c | 4 ++-- drivers/mmc/fsl_esdhc_imx.c | 13 ++++++----- drivers/mmc/omap_hsmmc.c | 2 +- drivers/net/designware.c | 10 ++++----- drivers/net/designware.h | 4 ++-- drivers/net/fec_mxc.c | 6 ++--- drivers/net/fec_mxc.h | 2 +- drivers/net/mvneta.c | 4 ++-- drivers/net/mvpp2.c | 8 +++---- drivers/net/sun8i_emac.c | 12 +++++----- drivers/pci/pci-aardvark.c | 4 ++-- drivers/pci/pcie_dw_mvebu.c | 4 ++-- drivers/spi/atmel_spi.c | 10 ++++----- drivers/spi/designware_spi.c | 4 ++-- drivers/tpm/tpm2_tis_spi.c | 2 +- include/config_uncmd_spl.h | 1 - include/configs/at91-sama5_common.h | 5 +++-- include/configs/gw_ventana.h | 1 - include/configs/mx6ul_14x14_evk.h | 1 + scripts/Makefile.uncmd_spl | 1 - 42 files changed, 111 insertions(+), 82 deletions(-)
arch/arm/include/asm/omap_gpio.h +1 -1
@@ -22,7 +22,7 @@#include <asm/arch/cpu.h> -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )/* Information about a GPIO bank */ struct omap_gpio_platdata {
arch/arm/mach-at91/include/mach/at91sam9260.h +1 -1
@@ -133,7 +133,7 @@/* * Other misc defines */ -#ifndef CONFIG_DM_GPIO +#if !CONFIG_IS_ENABLED (DM_GPIO )#define ATMEL_PIO_PORTS 3/* these SoCs have 3 PIO */ #define ATMEL_BASE_PIO ATMEL_BASE_PIOA#endif
arch/arm/mach-davinci/include/mach/gpio.h +1 -1
@@ -18,7 +18,7 @@#define davinci_gpio_bank67 ((struct davinci_gpio *)DAVINCI_GPIO_BANK67)#define davinci_gpio_bank8 ((struct davinci_gpio *)DAVINCI_GPIO_BANK8) -#ifndef CONFIG_DM_GPIO +#if !CONFIG_IS_ENABLED (DM_GPIO )#define gpio_status () gpio_info()#endif #define GPIO_NAME_SIZE 20
arch/arm/mach-omap2/am33xx/board.c +2 -2
@@ -116,7 +116,7 @@ U_BOOT_DEVICES(am33xx_i2c) = { };#endif -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )static const struct omap_gpio_platdata am33xx_gpio[] = { {0 ,AM33XX_GPIO0_BASE }, { 1, AM33XX_GPIO1_BASE },
@@ -141,7 +141,7 @@ U_BOOT_DEVICES(am33xx_gpios) = {#endif #endif -#ifndef CONFIG_DM_GPIO +#if !CONFIG_IS_ENABLED (DM_GPIO )static const struct gpio_bank gpio_bank_am33xx[] = { { (void *)AM33XX_GPIO0_BASE }, { (void *)AM33XX_GPIO1_BASE },
arch/arm/mach-omap2/omap3/board.c +1 -1
@@ -33,7 +33,7 @@ extern omap3_sysinfo sysinfo;static void omap3_invalidate_l2_cache_secure (void );#endif -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )#if !CONFIG_IS_ENABLED (OF_CONTROL )/* Manually initialize GPIO banks when OF_CONTROL doesn't */ static const struct omap_gpio_platdata omap34xx_gpio[] = {
arch/arm/mach-omap2/omap5/hwinit.c +1 -1
@@ -25,7 +25,7 @@u32 *const omap_si_rev = (u32 *)OMAP_SRAM_SCRATCH_OMAP_REV ; -#ifndef CONFIG_DM_GPIO +#if !CONFIG_IS_ENABLED (DM_GPIO )static struct gpio_bank gpio_bank_54xx[8 ] = { { (void *)OMAP54XX_GPIO1_BASE }, { (void *)OMAP54XX_GPIO2_BASE },
board/freescale/imx8qm_mek/imx8qm_mek.c +1 -1
@@ -49,7 +49,7 @@ int board_early_init_f(void)return 0 ; } -#if IS_ENABLED (CONFIG_DM_GPIO ) +#if CONFIG_IS_ENABLED (DM_GPIO )static void board_gpio_init (void ) {/* TODO */
board/freescale/imx8qxp_mek/imx8qxp_mek.c +1 -1
@@ -53,7 +53,7 @@ int board_early_init_f(void)return 0 ; } -#if IS_ENABLED (CONFIG_DM_GPIO ) +#if CONFIG_IS_ENABLED (DM_GPIO )static void board_gpio_init (void ) {struct gpio_desc desc;
board/gateworks/gw_ventana/Kconfig +3 -0
@@ -1,5 +1,8 @@ if TARGET_GW_VENTANA +config DM_GPIO + default y + config SYS_BOARD default "gw_ventana"
board/toradex/apalis-imx8/apalis-imx8.c +1 -1
@@ -50,7 +50,7 @@ int board_early_init_f(void)return 0 ; } -#if IS_ENABLED (CONFIG_DM_GPIO ) +#if CONFIG_IS_ENABLED (DM_GPIO )static void board_gpio_init (void ) {/* TODO */
configs/omap35_logic_defconfig +1 -0
@@ -45,6 +45,7 @@ CONFIG_DEFAULT_DEVICE_TREE="logicpd-torpedo-35xx-devkit" CONFIG_ENV_IS_IN_NAND=y CONFIG_SPL_DM=y CONFIG_SPL_OF_TRANSLATE=y +# CONFIG_SPL_DM_GPIO is not set CONFIG_DM_I2C=y CONFIG_DM_MMC=y CONFIG_MMC_OMAP_HS=y
drivers/gpio/Kconfig +22 -0
@@ -14,6 +14,28 @@ config DM_GPIO particular GPIOs that they provide. The uclass interface is defined in include/asm-generic/gpio.h. +config SPL_DM_GPIO + bool "Enable Driver Model for GPIO drivers in SPL" + depends on DM_GPIO && SPL_DM && SPL_GPIO_SUPPORT + default y + help + Enable driver model for GPIO access in SPL. The standard GPIO + interface (gpio_get_value(), etc.) is then implemented by + the GPIO uclass. Drivers provide methods to query the + particular GPIOs that they provide. The uclass interface + is defined in include/asm-generic/gpio.h. + +config TPL_DM_GPIO + bool "Enable Driver Model for GPIO drivers in TPL" + depends on DM_GPIO && TPL_DM && TPL_GPIO_SUPPORT + default y + help + Enable driver model for GPIO access in TPL. The standard GPIO + interface (gpio_get_value(), etc.) is then implemented by + the GPIO uclass. Drivers provide methods to query the + particular GPIOs that they provide. The uclass interface + is defined in include/asm-generic/gpio.h. + config GPIO_HOG bool "Enable GPIO hog support" depends on DM_GPIO
drivers/gpio/Makefile +3 -1
@@ -7,10 +7,12 @@ ifndef CONFIG_SPL_BUILD obj-$(CONFIG_DWAPB_GPIO) += dwapb_gpio.o obj-$(CONFIG_AXP_GPIO) += axp_gpio.o endif -obj-$(CONFIG_DM_GPIO) += gpio-uclass.o +obj-$(CONFIG_$(SPL_TPL_)DM_GPIO) += gpio-uclass.o obj-$(CONFIG_$(SPL_)DM_PCA953X) += pca953x_gpio.o +ifdef CONFIG_$(SPL_TPL_)GPIO obj-$(CONFIG_DM_74X164) += 74x164_gpio.o +endif obj-$(CONFIG_AT91_GPIO) += at91_gpio.o obj-$(CONFIG_ATMEL_PIO4) += atmel_pio4.o
drivers/gpio/at91_gpio.c +3 -3
@@ -210,7 +210,7 @@ int at91_pio3_set_d_periph(unsigned port, unsigned pin, int use_pullup)return 0 ; } -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )static bool at91_get_port_output (struct at91_port *at91_port,int offset) {u32 mask, val;
@@ -457,7 +457,7 @@ int at91_get_pio_value(unsigned port, unsigned pin)return 0 ; } -#ifndef CONFIG_DM_GPIO +#if !CONFIG_IS_ENABLED (DM_GPIO )/* Common GPIO API */ int gpio_request (unsigned gpio,const char *label)
@@ -499,7 +499,7 @@ int gpio_set_value(unsigned gpio, int value) }#endif -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO ) struct at91_port_priv { struct at91_port *regs;
drivers/gpio/atmel_pio4.c +1 -1
@@ -168,7 +168,7 @@ int atmel_pio4_get_pio_input(u32 port, u32 pin)return (readl (&port_base->pdsr) & mask) ?1 :0 ; } -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED(DM_GPIO) struct atmel_pioctrl_data { u32 nbanks;
drivers/gpio/da8xx_gpio.c +4 -3
@@ -15,7 +15,7 @@#include "da8xx_gpio.h" -#ifndef CONFIG_DM_GPIO +#if !CONFIG_IS_ENABLED (DM_GPIO )#include <asm/arch/hardware.h> #include <asm/arch/davinci_misc.h>
@@ -377,7 +377,8 @@ static int _gpio_direction_output(struct davinci_gpio *bank, unsigned int gpio,_gpio_set_value (bank, gpio, value);return 0 ; } -#ifndef CONFIG_DM_GPIO + +#if !CONFIG_IS_ENABLED (DM_GPIO )void gpio_info (void ) {
@@ -428,7 +429,7 @@ int gpio_set_value(unsigned int gpio, int value) return _gpio_set_value(bank, gpio, value); } -#else /* CONFIG_DM_GPIO */ +#else /* DM_GPIO */ static struct davinci_gpio *davinci_get_gpio_bank (struct udevice *dev,unsigned int offset) {
drivers/gpio/da8xx_gpio.h +1 -1
@@ -28,7 +28,7 @@ struct davinci_gpio_bank {#define MAX_NUM_GPIOS 144#define GPIO_BIT (gp) ((gp) & 0x1F) -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )/* Information about a GPIO bank */ struct davinci_gpio_platdata {
drivers/gpio/mxc_gpio.c +2 -2
@@ -30,7 +30,7 @@ struct mxc_bank_info {struct gpio_regs *regs; }; -#ifndef CONFIG_DM_GPIO +#if !CONFIG_IS_ENABLED (DM_GPIO )#define GPIO_TO_PORT (n) ((n) / 32)/* GPIO port description */
@@ -161,7 +161,7 @@ int gpio_direction_output(unsigned gpio, int value) }#endif -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )#include <fdtdec.h> static int mxc_gpio_is_output (struct gpio_regs *regs,int offset) {
drivers/gpio/mxs_gpio.c +2 -2
@@ -128,7 +128,7 @@ int name_to_gpio(const char *name) return (bank << MXS_PAD_BANK_SHIFT) | (pin << MXS_PAD_PIN_SHIFT); } -#else /* CONFIG_DM_GPIO */ +#else /* DM_GPIO */ #include <dm.h> #include <asm/gpio.h> #include <dt-structs.h>
@@ -312,4 +312,4 @@ U_BOOT_DRIVER(gpio_mxs) = { .ofdata_to_platdata = mxs_ofdata_to_platdata, #endif }; -#endif /* CONFIG_DM_GPIO */ +#endif /* DM_GPIO */
drivers/gpio/omap_gpio.c +3 -3
@@ -30,7 +30,7 @@ DECLARE_GLOBAL_DATA_PTR;#define OMAP_GPIO_DIR_OUT 0#define OMAP_GPIO_DIR_IN 1 -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )#define GPIO_PER_BANK 32
@@ -121,7 +121,7 @@ static int _get_gpio_value(const struct gpio_bank *bank, int gpio)return (__raw_readl (reg) & (1 << gpio)) !=0 ; } -#ifndef CONFIG_DM_GPIO +#if !CONFIG_IS_ENABLED (DM_GPIO )static inline const struct gpio_bank *get_gpio_bank (int gpio) {
@@ -377,4 +377,4 @@ U_BOOT_DRIVER(gpio_omap) = { #endif }; -#endif /* CONFIG_DM_GPIO */ +#endif /* !DM_GPIO */
drivers/gpio/sunxi_gpio.c +4 -4
@@ -28,7 +28,7 @@ struct sunxi_gpio_platdata {int gpio_count; }; -#ifndef CONFIG_DM_GPIO +#if !CONFIG_IS_ENABLED (DM_GPIO )static int sunxi_gpio_output (u32 pin,u32 val) {u32 dat;
@@ -116,7 +116,7 @@ int sunxi_name_to_gpio(const char *name)return -1 ; return group * 32 + pin; } -#endif +#endif /* DM_GPIO */ int sunxi_name_to_gpio_bank (const char *name) {
@@ -132,7 +132,7 @@ int sunxi_name_to_gpio_bank(const char *name)return -1 ; } -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )/* TODO([email protected]): Remove this function and use device tree */ int sunxi_name_to_gpio (const char *name) {
@@ -373,4 +373,4 @@ U_BOOT_DRIVER(gpio_sunxi) = { .bind = gpio_sunxi_bind, .probe = gpio_sunxi_probe, }; -#endif +#endif /* DM_GPIO */
drivers/i2c/i2c-uclass.c +3 -3
@@ -11,7 +11,7 @@#include <dm/device-internal.h> #include <dm/lists.h> #include <dm/pinctrl.h> -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )#include <asm/gpio.h> #endif
@@ -465,7 +465,7 @@ int i2c_get_chip_offset_len(struct udevice *dev)return chip->offset_len; } -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )static void i2c_gpio_set_pin (struct gpio_desc *pin,int bit) {if (bit)
@@ -561,7 +561,7 @@ static int i2c_deblock_gpio(struct udevice *bus) {return -ENOSYS ; } -#endif // CONFIG_DM_GPIO +#endif /* DM_GPIO */ int i2c_deblock (struct udevice *bus) {
drivers/i2c/muxes/pca954x.c +2 -2
@@ -125,7 +125,7 @@ static int pca954x_ofdata_to_platdata(struct udevice *dev)static int pca954x_probe (struct udevice *dev) { -if (IS_ENABLED (CONFIG_DM_GPIO )) { +if (CONFIG_IS_ENABLED (DM_GPIO )) {struct pca954x_priv *priv =dev_get_priv (dev);int err;
@@ -146,7 +146,7 @@ static int pca954x_probe(struct udevice *dev)static int pca954x_remove (struct udevice *dev) { -if (IS_ENABLED (CONFIG_DM_GPIO )) { +if (CONFIG_IS_ENABLED (DM_GPIO )) {struct pca954x_priv *priv =dev_get_priv (dev);if (dm_gpio_is_valid (&priv->gpio_mux_reset))
drivers/mmc/fsl_esdhc_imx.c +7 -6
@@ -149,7 +149,7 @@ struct fsl_esdhc_priv {struct udevice *vqmmc_dev;struct udevice *vmmc_dev;#endif -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )struct gpio_desc cd_gpio;struct gpio_desc wp_gpio;#endif
@@ -302,8 +302,9 @@ static int esdhc_setup_data(struct fsl_esdhc_priv *priv, struct mmc *mmc,return -ETIMEDOUT ; } }else { -#ifdef CONFIG_DM_GPIO -if (dm_gpio_is_valid (&priv->wp_gpio) &&dm_gpio_get_value (&priv->wp_gpio)) { +#if CONFIG_IS_ENABLED (DM_GPIO ) +if (dm_gpio_is_valid (&priv->wp_gpio) && +dm_gpio_get_value (&priv->wp_gpio)) {printf ("\nThe SD card is locked. Can not write to a locked card.\n\n" );return -ETIMEDOUT ; }
@@ -1091,7 +1092,7 @@ static int esdhc_getcd_common(struct fsl_esdhc_priv *priv)#if CONFIG_IS_ENABLED (DM_MMC )if (priv->non_removable)return 1 ; -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )if (dm_gpio_is_valid (&priv->cd_gpio))return dm_gpio_get_value (&priv->cd_gpio);#endif
@@ -1453,7 +1454,7 @@ static int fsl_esdhc_probe(struct udevice *dev) priv->non_removable =1 ; }else { priv->non_removable =0 ; -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )gpio_request_by_name (dev,"cd-gpios" ,0 , &priv->cd_gpio,GPIOD_IS_IN );#endif
@@ -1463,7 +1464,7 @@ static int fsl_esdhc_probe(struct udevice *dev) priv->wp_enable =1 ; }else { priv->wp_enable =0 ; -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )gpio_request_by_name (dev,"wp-gpios" ,0 , &priv->wp_gpio,GPIOD_IS_IN );#endif
drivers/mmc/omap_hsmmc.c +1 -1
@@ -183,7 +183,7 @@ static int omap_mmc_setup_gpio_in(int gpio, const char *label) {int ret; -#ifndef CONFIG_DM_GPIO +#if !CONFIG_IS_ENABLED (DM_GPIO )if (!gpio_is_valid (gpio))return -1 ;#endif
drivers/net/designware.c +5 -5
@@ -81,7 +81,7 @@ static int dw_mdio_write(struct mii_dev *bus, int addr, int devad, int reg,return ret; } -#if defined(CONFIG_DM_ETH ) && defined(CONFIG_DM_GPIO ) +#if defined(CONFIG_DM_ETH ) &&CONFIG_IS_ENABLED (DM_GPIO )static int dw_mdio_reset (struct mii_dev *bus) {struct udevice *dev = bus->priv;
@@ -127,7 +127,7 @@ static int dw_mdio_init(const char *name, void *priv) bus->read = dw_mdio_read; bus->write = dw_mdio_write;snprintf (bus->name,sizeof (bus->name),"%s" , name); -#if defined(CONFIG_DM_ETH ) && defined(CONFIG_DM_GPIO ) +#if defined(CONFIG_DM_ETH ) &&CONFIG_IS_ENABLED (DM_GPIO ) bus->reset = dw_mdio_reset;#endif
@@ -806,12 +806,12 @@ const struct eth_ops designware_eth_ops = {int designware_eth_ofdata_to_platdata (struct udevice *dev) {struct dw_eth_pdata *dw_pdata =dev_get_platdata (dev); -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )struct dw_eth_dev *priv =dev_get_priv (dev);#endif struct eth_pdata *pdata = &dw_pdata->eth_pdata;const char *phy_mode; -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )int reset_flags =GPIOD_IS_OUT ;#endif int ret =0 ;
@@ -828,7 +828,7 @@ int designware_eth_ofdata_to_platdata(struct udevice *dev) pdata->max_speed =dev_read_u32_default (dev,"max-speed" ,0 ); -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )if (dev_read_bool (dev,"snps,reset-active-low" )) reset_flags |=GPIOD_ACTIVE_LOW ;
drivers/net/designware.h +2 -2
@@ -7,7 +7,7 @@#ifndef _DW_ETH_H#define _DW_ETH_H -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )#include <asm-generic/gpio.h> #endif
@@ -235,7 +235,7 @@ struct dw_eth_dev {#ifndef CONFIG_DM_ETH struct eth_device *dev;#endif -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )struct gpio_desc reset_gpio;#endif #ifdef CONFIG_CLK
drivers/net/fec_mxc.c +3 -3
@@ -1308,7 +1308,7 @@ static int fec_phy_init(struct fec_priv *priv, struct udevice *dev)return 0 ; } -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )/* FEC GPIO reset */ static void fec_gpio_reset (struct fec_priv *priv) {
@@ -1401,7 +1401,7 @@ static int fecmxc_probe(struct udevice *dev) }#endif -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )fec_gpio_reset (priv);#endif /* Reset chip. */
@@ -1507,7 +1507,7 @@ static int fecmxc_ofdata_to_platdata(struct udevice *dev)device_get_supply_regulator (dev,"phy-supply" , &priv->phy_supply);#endif -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO ) ret =gpio_request_by_name (dev,"phy-reset-gpios" ,0 , &priv->phy_reset_gpio,GPIOD_IS_OUT );if (ret <0 )
drivers/net/fec_mxc.h +1 -1
@@ -255,7 +255,7 @@ struct fec_priv {#ifdef CONFIG_DM_REGULATOR struct udevice *phy_supply;#endif -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )struct gpio_desc phy_reset_gpio;uint32_t reset_delay;uint32_t reset_post_delay;
drivers/net/mvneta.c +2 -2
@@ -275,7 +275,7 @@ struct mvneta_port {int init;int phyaddr;struct phy_device *phydev; -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )struct gpio_desc phy_reset_gpio;#endif struct mii_dev *bus;
@@ -1753,7 +1753,7 @@ static int mvneta_probe(struct udevice *dev)if (ret)return ret; -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )gpio_request_by_name (dev,"phy-reset-gpios" ,0 , &pp->phy_reset_gpio,GPIOD_IS_OUT );
drivers/net/mvpp2.c +4 -4
@@ -976,7 +976,7 @@ struct mvpp2_port {int phy_node;int phyaddr;struct mii_dev *bus; -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )struct gpio_desc phy_reset_gpio;struct gpio_desc phy_tx_disable_gpio;#endif
@@ -4753,7 +4753,7 @@ static int phy_info_parse(struct udevice *dev, struct mvpp2_port *port)return -EINVAL ; } -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )gpio_request_by_name (dev,"phy-reset-gpios" ,0 , &port->phy_reset_gpio,GPIOD_IS_OUT ); gpio_request_by_name(dev, "marvell,sfp-tx-disable-gpio", 0,
@@ -4781,7 +4781,7 @@ static int phy_info_parse(struct udevice *dev, struct mvpp2_port *port)return 0 ; } -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )/* Port GPIO initialization */ static void mvpp2_gpio_init (struct mvpp2_port *port) {
@@ -4814,7 +4814,7 @@ static int mvpp2_port_probe(struct udevice *dev, }mvpp2_port_power_up (port); -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )mvpp2_gpio_init (port);#endif
drivers/net/sun8i_emac.c +6 -6
@@ -23,7 +23,7 @@#include <net.h> #include <reset.h> #include <dt-bindings/pinctrl/sun4i-a10.h> -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )#include <asm-generic/gpio.h> #endif
@@ -141,7 +141,7 @@ struct emac_eth_dev {struct clk ephy_clk;struct reset_ctl tx_rst;struct reset_ctl ephy_rst; -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )struct gpio_desc reset_gpio;#endif };
@@ -695,7 +695,7 @@ err_tx_clk:return ret; } -#if defined(CONFIG_DM_GPIO ) +#if CONFIG_IS_ENABLED (DM_GPIO )static int sun8i_mdio_reset (struct mii_dev *bus) {struct udevice *dev = bus->priv;
@@ -742,7 +742,7 @@ static int sun8i_mdio_init(const char *name, struct udevice *priv) bus->write = sun8i_mdio_write;snprintf (bus->name,sizeof (bus->name), name); bus->priv = (void *)priv; -#if defined(CONFIG_DM_GPIO ) +#if CONFIG_IS_ENABLED (DM_GPIO ) bus->reset = sun8i_mdio_reset;#endif
@@ -904,7 +904,7 @@ static int sun8i_emac_eth_ofdata_to_platdata(struct udevice *dev)const fdt32_t *reg;int node =dev_of_offset (dev);int offset =0 ; -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )int reset_flags =GPIOD_IS_OUT ;#endif int ret;
@@ -998,7 +998,7 @@ static int sun8i_emac_eth_ofdata_to_platdata(struct udevice *dev)printf ("%s: Invalid RX delay value %d\n" , __func__, sun8i_pdata->rx_delay_ps); -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )if (fdtdec_get_bool (gd->fdt_blob,dev_of_offset (dev),"snps,reset-active-low" )) reset_flags |=GPIOD_ACTIVE_LOW ;
drivers/pci/pci-aardvark.c +2 -2
@@ -610,7 +610,7 @@ static int pcie_advk_probe(struct udevice *dev) {struct pcie_advk *pcie =dev_get_priv (dev); -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )struct gpio_desc reset_gpio; gpio_request_by_name(dev, "reset-gpio", 0, &reset_gpio,
@@ -636,7 +636,7 @@ static int pcie_advk_probe(struct udevice *dev) }#else dev_dbg (pcie->dev,"PCIE Reset on GPIO support is missing\n" ); -#endif /* CONFIG_DM_GPIO */ +#endif /* DM_GPIO */ pcie->first_busno = dev->seq; pcie->dev =pci_get_controller (dev);
drivers/pci/pcie_dw_mvebu.c +2 -2
@@ -476,7 +476,7 @@ static int pcie_dw_mvebu_probe(struct udevice *dev)struct pcie_dw_mvebu *pcie =dev_get_priv (dev);struct udevice *ctlr =pci_get_controller (dev);struct pci_controller *hose =dev_get_uclass_priv (ctlr); -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )struct gpio_desc reset_gpio; gpio_request_by_name(dev, "marvell,reset-gpio", 0, &reset_gpio,
@@ -496,7 +496,7 @@ static int pcie_dw_mvebu_probe(struct udevice *dev) }#else debug ("PCIE Reset on GPIO support is missing\n" ); -#endif /* CONFIG_DM_GPIO */ +#endif /* DM_GPIO */ pcie->first_busno = dev->seq;
drivers/spi/atmel_spi.c +5 -5
@@ -17,7 +17,7 @@#ifdef CONFIG_DM_SPI #include <asm/arch/at91_spi.h> #endif -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )#include <asm/gpio.h> #endif
@@ -228,7 +228,7 @@ struct atmel_spi_priv {unsigned int freq;/* Default frequency */ unsigned int mode;ulong bus_clk_rate; -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )struct gpio_desc cs_gpios[MAX_CS_COUNT ];#endif };
@@ -285,7 +285,7 @@ static int atmel_spi_release_bus(struct udevice *dev)static void atmel_spi_cs_activate (struct udevice *dev) { -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )struct udevice *bus =dev_get_parent (dev);struct atmel_spi_priv *priv =dev_get_priv (bus);struct dm_spi_slave_platdata *slave_plat =dev_get_parent_platdata (dev);
@@ -300,7 +300,7 @@ static void atmel_spi_cs_activate(struct udevice *dev)static void atmel_spi_cs_deactivate (struct udevice *dev) { -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )struct udevice *bus =dev_get_parent (dev);struct atmel_spi_priv *priv =dev_get_priv (bus);struct dm_spi_slave_platdata *slave_plat =dev_get_parent_platdata (dev);
@@ -468,7 +468,7 @@ static int atmel_spi_probe(struct udevice *bus) bus_plat->regs = (struct at91_spi *)devfdt_get_addr (bus); -#ifdef CONFIG_DM_GPIO +#if CONFIG_IS_ENABLED (DM_GPIO )struct atmel_spi_priv *priv =dev_get_priv (bus);int i;
drivers/spi/designware_spi.c +2 -2
@@ -126,7 +126,7 @@ static inline void dw_write(struct dw_spi_priv *priv, u32 offset, u32 val)static int request_gpio_cs (struct udevice *bus) { -#if defined(CONFIG_DM_GPIO ) && !defined(CONFIG_SPL_BUILD ) +#if CONFIG_IS_ENABLED (DM_GPIO ) && !defined(CONFIG_SPL_BUILD )struct dw_spi_priv *priv =dev_get_priv (bus);int ret;
@@ -373,7 +373,7 @@ static int poll_transfer(struct dw_spi_priv *priv)*/ __weak void external_cs_manage (struct udevice *dev,bool on) { -#if defined(CONFIG_DM_GPIO ) && !defined(CONFIG_SPL_BUILD ) +#if CONFIG_IS_ENABLED (DM_GPIO ) && !defined(CONFIG_SPL_BUILD )struct dw_spi_priv *priv =dev_get_priv (dev->parent);if (!dm_gpio_is_valid (&priv->cs_gpio))
drivers/tpm/tpm2_tis_spi.c +1 -1
@@ -587,7 +587,7 @@ static int tpm_tis_spi_probe(struct udevice *dev)/* Use the TPM v2 stack */ priv->version =TPM_V2 ; -if (IS_ENABLED (CONFIG_DM_GPIO )) { +if (CONFIG_IS_ENABLED (DM_GPIO )) {struct gpio_desc reset_gpio; ret = gpio_request_by_name(dev, "gpio-reset", 0,
include/config_uncmd_spl.h +0 -1
@@ -12,7 +12,6 @@#ifndef CONFIG_SPL_DM #undef CONFIG_DM_SERIAL -#undef CONFIG_DM_GPIO#undef CONFIG_DM_I2C#undef CONFIG_DM_SPI#endif
include/configs/at91-sama5_common.h +3 -2
@@ -9,6 +9,8 @@#ifndef __AT91_SAMA5_COMMON_H#define __AT91_SAMA5_COMMON_H +#include <linux/kconfig.h> +/* ARM asynchronous clock */ #define CONFIG_SYS_AT91_SLOW_CLOCK 32768#define CONFIG_SYS_AT91_MAIN_CLOCK 12000000/* from 12 MHz crystal */
@@ -18,11 +20,10 @@#endif /* general purpose I/O */ -#ifndef CONFIG_DM_GPIO +#if !CONFIG_IS_ENABLED (DM_GPIO )#define CONFIG_AT91_GPIO #endif -/* * BOOTP options */
include/configs/gw_ventana.h +0 -1
@@ -36,7 +36,6 @@/* Driver Model */ #ifndef CONFIG_SPL_BUILD -#define CONFIG_DM_GPIO #define CONFIG_DM_THERMAL #endif
include/configs/mx6ul_14x14_evk.h +1 -0
@@ -44,6 +44,7 @@#define CONFIG_SYS_I2C_SPEED 100000#endif +/* Note: This is incorrect and should move to Kconfig / defconfig */ #ifdef CONFIG_DM_GPIO #define CONFIG_DM_74X164 #endif
scripts/Makefile.uncmd_spl +0 -1
@@ -6,7 +6,6 @@ ifdef CONFIG_SPL_BUILD ifndef CONFIG_SPL_DM CONFIG_DM_SERIAL= -CONFIG_DM_GPIO= CONFIG_DM_I2C= CONFIG_DM_SPI= CONFIG_DM_SPI_FLASH=
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 3/100 dm: core: Fix offset_to_ofnode() with invalid offset
In reply to Simon GlassIf the offset is -1 this function correctly sets up a null ofnode. But if the offset is any other negative number (e.g. -FDT_ERR_BADPATH) then it does the wrong thing.
An offset of -1 in ofnode indicates that the ofnode is not valid. Any other negative value is not handled by ofnode_valid(). We could of course change that function, but it seems much better to always use the same value for an invalid node.
Fix it by setting the offset to -1 if it is invalid for any reason.
---
Changes in v4:
- Update the commit message to be clearer, fix 'correct' typo
Changes in v3: None
Changes in v2: None
include/dm/ofnode.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/dm/ofnode.h +1 -1
@@ -118,7 +118,7 @@ static inline ofnode offset_to_ofnode(int of_offset)if (of_live_active ()) node.np =NULL ;else - node.of_offset = of_offset; + node.of_offset = of_offset >=0 ? of_offset :-1 ;return node; }
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 4/100 dm: pci: Allow delaying auto-config until after relocation
In reply to Simon GlassAt present PCI auto-configuration happens in U-Boot both before and after relocation. This is a waste of time and may mess up static addresses used in board_init_f(). Adjust the code to supporting doing auto-configuration once, after relocation, under control of a device-tree property.
This is needed for Apollo Lake for debugging the silicon-init code. Once the UART is moved to a different MMIO address the debug UART does not work and any debug output in Apollo Lake's arch_fsp_init_r() causes a hang.
---
Changes in v4:
- Change the behaviour to be a device-tree option
- apollolake -> Apollo Lake
Changes in v3: None
Changes in v2: None
doc/device-tree-bindings/pci/x86-pci.txt | 24 ++++++++++++++++++++++++ drivers/pci/pci-uclass.c | 15 ++++++++++----- include/pci.h | 9 ++++++++- 3 files changed, 42 insertions(+), 6 deletions(-) create mode 100644 doc/device-tree-bindings/pci/x86-pci.txt
doc/device-tree-bindings/pci/x86-pci.txt new file +24 -0
@@ -0,0 +1,24 @@ +x86 PCI DT details: +=================== + +Some options are available to affect how PCI operates on x86. + +Optional properties: +- u-boot,skip-auto-config-until-reloc : Don't set up PCI configuration until + after U-Boot has relocated. Normally if PCI is used before relocation, + this happens before relocation also. Some platforms set up static + configuration in TPL/SPL to reduce code size and boot time, since these + phases only know about a small subset of PCI devices. + +Example: + +pci { + compatible = "pci-x86"; + #address-cells = <3>; + #size-cells = <2>; + u-boot,dm-pre-reloc; + ranges = <0x02000000 0x0 0xc0000000 0xc0000000 0 0x10000000 + 0x42000000 0x0 0xb0000000 0xb0000000 0 0x10000000 + 0x01000000 0x0 0x1000 0x1000 0 0xefff>; + u-boot,skip-auto-config-until-reloc; +};
drivers/pci/pci-uclass.c +10 -5
@@ -970,12 +970,15 @@ static int pci_uclass_pre_probe(struct udevice *bus) hose->bus = bus; hose->first_busno = bus->seq; hose->last_busno = bus->seq; + hose->skip_auto_config_until_reloc = +dev_read_bool (bus,"u-boot,skip-auto-config-until-reloc" );return 0 ; }static int pci_uclass_post_probe (struct udevice *bus) { +struct pci_controller *hose =dev_get_uclass_priv (bus);int ret;debug ("%s: probing bus %d\n" , __func__, bus->seq);
@@ -983,11 +986,13 @@ static int pci_uclass_post_probe(struct udevice *bus)if (ret)return ret; -#if CONFIG_IS_ENABLED (PCI_PNP ) - ret =pci_auto_config_devices (bus); -if (ret <0 ) -return ret; -#endif +if (CONFIG_IS_ENABLED (PCI_PNP ) && + (!hose->skip_auto_config_until_reloc || + (gd->flags &GD_FLG_RELOC ))) { + ret =pci_auto_config_devices (bus); +if (ret <0 ) +return log_msg_ret ("pci auto-config" , ret); + }#if defined(CONFIG_X86 ) && defined(CONFIG_HAVE_FSP )/*
include/pci.h +8 -1
@@ -571,15 +571,22 @@ extern void pci_cfgfunc_config_device(struct pci_controller* hose, pci_dev_t dev#define INDIRECT_TYPE_NO_PCIE_LINK 1 -/* +/** * Structure of a PCI controller (host bridge) * * With driver model this is dev_get_uclass_priv(bus) +* +* @skip_auto_config_until_reloc: true to avoid auto-config until U-Boot has +* relocated. Normally if PCI is used before relocation, this happens +* before relocation also. Some platforms set up static configuration in +* TPL/SPL to reduce code size and boot time, since these phases only know +* about a small subset of PCI devices. This is normally false. */ struct pci_controller {#ifdef CONFIG_DM_PCI struct udevice *bus;struct udevice *ctlr; +bool skip_auto_config_until_reloc;#else struct pci_controller *next;#endif
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 5/100 dm: pci: Move pci_get_devfn() into a common file
In reply to Simon GlassEarly in boot it is necessary to decode the PCI device/function values for particular peripherals in the device tree or of-platdata. This is needed in TPL where CONFIG_PCI is not defined.
To handle this, move pci_get_devfn() into a file that is built even when CONFIG_PCI is not defined.
Also add a function for use by of-platdata, to convert a reg property to a pci_dev_t.
---
Changes in v4:
- Add more documentation for pci_ofplat_get_devfn()
- Mention that the return value is pci_dev_t
- Rename pci_x86_ofplat_get_devfn() to pci_ofplat_get_devfn()
Changes in v3:
- Move the function to a common file instead of duplicating it
- Update device type to pci_dev_t
Changes in v2: None
drivers/core/util.c | 20 +++++++++++++++++++ drivers/pci/pci-uclass.c | 16 --------------- include/dm/pci.h | 43 ++++++++++++++++++++++++++++++++++++++++ include/pci.h | 12 ++--------- 4 files changed, 65 insertions(+), 26 deletions(-) create mode 100644 include/dm/pci.h
drivers/core/util.c +20 -0
@@ -4,7 +4,9 @@*/ #include <common.h> +#include <dm/device.h> #include <dm/ofnode.h> +#include <dm/read.h> #include <dm/util.h> #include <linux/libfdt.h> #include <vsprintf.h>
@@ -58,3 +60,21 @@ bool dm_ofnode_pre_reloc(ofnode node) #endif }#endif + +#if !CONFIG_IS_ENABLED (OF_PLATDATA ) +int pci_get_devfn (struct udevice *dev) +{ +struct fdt_pci_addr addr; +int ret; + +/* Extract the devfn from fdt_pci_addr */ + ret =ofnode_read_pci_addr (dev_ofnode (dev),FDT_PCI_SPACE_CONFIG , +"reg" , &addr); +if (ret) { +if (ret != -ENOENT ) +return -EINVAL ; + } + +return addr.phys_hi &0xff00 ; +} +#endif
drivers/pci/pci-uclass.c +0 -16
@@ -1018,22 +1018,6 @@ static int pci_uclass_post_probe(struct udevice *bus)return 0 ; } -int pci_get_devfn (struct udevice *dev) -{ -struct fdt_pci_addr addr; -int ret; - -/* Extract the devfn from fdt_pci_addr */ - ret =ofnode_read_pci_addr (dev_ofnode (dev),FDT_PCI_SPACE_CONFIG , -"reg" , &addr); -if (ret) { -if (ret != -ENOENT ) -return -EINVAL ; - } - -return addr.phys_hi &0xff00 ; -} -static int pci_uclass_child_post_bind (struct udevice *dev) {struct pci_child_platdata *pplat;
include/dm/pci.h new file +43 -0
43 lines not on this page · raw message
include/pci.h +2 -10
@@ -482,6 +482,8 @@#ifndef __ASSEMBLY__ +#include <dm/pci.h> +#ifdef CONFIG_SYS_PCI_64BIT typedef u64 pci_addr_t ;typedef u64 pci_size_t ;
@@ -1619,16 +1621,6 @@ int sandbox_pci_get_emul(struct udevice *bus, pci_dev_t find_devfn,*/ int sandbox_pci_get_client (struct udevice *emul,struct udevice **devp); -/** -* pci_get_devfn() - Extract the devfn from fdt_pci_addr of the device -* -* Get devfn from fdt_pci_addr of the specified device -* -* @dev: PCI device -* @return devfn in bits 15...8 if found, -ENODEV if not found -*/ -int pci_get_devfn (struct udevice *dev); -#endif /* CONFIG_DM_PCI */ /**
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 6/100 net: Move the checksum functions to lib/
In reply to Simon GlassThese functions are used by code outside the network support, so move them to lib/ to be more accessible.
Without this, the functions are only accessible if CONFIG_NET is defined. Many boards do not enable that option but still want to do checksums in this format.
Fix up a few code-style nits while we are here.
---
Changes in v4:
- Expand commit message to better explain the need to checksum functions
Changes in v3: None
Changes in v2: None
lib/Makefile | 2 +- lib/net_utils.c | 48 ++++++++++++++++++++++++++++++++++++++++ net/Makefile | 1 - net/checksum.c | 59 ------------------------------------------------- 4 files changed, 49 insertions(+), 61 deletions(-) delete mode 100644 net/checksum.c
lib/Makefile +1 -1
@@ -76,7 +76,7 @@ endif ifdef CONFIG_SPL_BUILD obj-$(CONFIG_SPL_YMODEM_SUPPORT) += crc16.o obj-$(CONFIG_$(SPL_TPL_)HASH_SUPPORT) += crc16.o -obj-$(CONFIG_SPL_NET_SUPPORT) += net_utils.o +obj-y += net_utils.o endif obj-$(CONFIG_ADDR_MAP) += addr_map.o obj-y += qsort.o
lib/net_utils.c +48 -0
51 lines not on this page · raw message
net/Makefile +0 -1
@@ -5,7 +5,6 @@ #ccflags-y += -DDEBUG -obj-y += checksum.o obj-$(CONFIG_NET) += arp.o obj-$(CONFIG_CMD_BOOTP) += bootp.o obj-$(CONFIG_CMD_CDP) += cdp.o
net/checksum.c deleted +0 -59
59 lines not on this page · raw message
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 7/100 i2c: designware: Tidy up PCI support
In reply to Simon GlassThis is hacked into the driver at present. It seems better to have it as a separate driver that uses the base driver. Create a new file and put the X86 code into it.
Actually the Baytrail settings should really come from the device tree.
Note that 'has_max_speed' is added as well. This is currently always false but since only Baytrail provides the config, it does not affect operation for other devices.
---
Changes in v4:
- Add a comment about the speed logic in __dw_i2c_set_bus_speed()
- Add a comment in the commit message about why has_max_speed is added
- Drop unwanted debug printf("bad\n")
- Fix indentation nit
- Rename new file to designware_i2c_pci.c
Changes in v3: None
Changes in v2: None
drivers/i2c/Makefile | 3 + drivers/i2c/designware_i2c.c | 106 +++++-------------------------- drivers/i2c/designware_i2c.h | 35 ++++++++++ drivers/i2c/designware_i2c_pci.c | 79 +++++++++++++++++++++++ 4 files changed, 134 insertions(+), 89 deletions(-) create mode 100644 drivers/i2c/designware_i2c_pci.c
drivers/i2c/Makefile +3 -0
@@ -14,6 +14,9 @@ obj-$(CONFIG_SYS_I2C_AT91) += at91_i2c.o obj-$(CONFIG_SYS_I2C_CADENCE) += i2c-cdns.o obj-$(CONFIG_SYS_I2C_DAVINCI) += davinci_i2c.o obj-$(CONFIG_SYS_I2C_DW) += designware_i2c.o +ifdef CONFIG_DM_PCI +obj-$(CONFIG_SYS_I2C_DW) += designware_i2c_pci.o +endif obj-$(CONFIG_SYS_I2C_FSL) += fsl_i2c.o obj-$(CONFIG_SYS_I2C_IHS) += ihs_i2c.o obj-$(CONFIG_SYS_I2C_INTEL) += intel_i2c.o
drivers/i2c/designware_i2c.c +17 -89
161 lines not on this page · raw message
drivers/i2c/designware_i2c.h +35 -0
@@ -7,6 +7,8 @@ #ifndef __DW_I2C_H_ #define __DW_I2C_H_ +#include <reset.h> + struct i2c_regs { u32 ic_con; /* 0x00 */ u32 ic_tar; /* 0x04 */
@@ -131,4 +133,37 @@ struct i2c_regs {#define I2C_FAST_SPEED 400000#define I2C_STANDARD_SPEED 100000 +/** +* struct dw_scl_sda_cfg - I2C timing configuration +* +* @has_max_speed: Support maximum speed (1Mbps) +* @ss_hcnt: Standard speed high time in ns +* @fs_hcnt: Fast speed high time in ns +* @ss_lcnt: Standard speed low time in ns +* @fs_lcnt: Fast speed low time in ns +* @sda_hold: SDA hold time +*/ +struct dw_scl_sda_cfg { +bool has_max_speed; +u32 ss_hcnt; +u32 fs_hcnt; +u32 ss_lcnt; +u32 fs_lcnt; +u32 sda_hold; +}; + +struct dw_i2c { +struct i2c_regs *regs; +struct dw_scl_sda_cfg *scl_sda_cfg; +struct reset_ctl_bulk resets; +#if CONFIG_IS_ENABLED (CLK ) +struct clk clk; +#endif +}; + +extern const struct dm_i2c_ops designware_i2c_ops; + +int designware_i2c_probe (struct udevice *bus); +int designware_i2c_remove (struct udevice *dev); +#endif /* __DW_I2C_H_ */
drivers/i2c/designware_i2c_pci.c new file +79 -0
79 lines not on this page · raw message
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 8/100 i2c: designware: Avoid using static data
In reply to Simon GlassDrivers are not allowed to use static data since they may be used in SPL where BSS is not available.
It is possible that driver model may provide support for numbering devices in the future. But for now, move this to global_data.
---
Changes in v4:
- Add new patch to drop static data in designware i2c driver
Changes in v3: None
Changes in v2: None
arch/x86/include/asm/global_data.h | 1 + drivers/i2c/designware_i2c_pci.c | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-)
arch/x86/include/asm/global_data.h +1 -0
@@ -96,6 +96,7 @@ struct arch_global_data {ulong table;/* Table pointer from previous loader */ int turbo_state;/* Current turbo state */ struct irq_routing_table *pirq_routing_table; +int dw_i2c_num_cards;/* Used by designware i2c driver */ #ifdef CONFIG_SEABIOS u32 high_table_ptr;u32 high_table_limit;
drivers/i2c/designware_i2c_pci.c +6 -3
@@ -34,7 +34,6 @@ static int designware_i2c_pci_probe(struct udevice *dev)static int designware_i2c_pci_bind (struct udevice *dev) { -static int num_cards;char name[20 ];/*
@@ -45,9 +44,13 @@ static int designware_i2c_pci_bind(struct udevice *dev)* using this driver is impossible for PCIe I2C devices. * This can be removed, once a better (correct) way for this * is found and implemented. +* +* TODO(sjg at chromium.org): Perhaps if uclasses had platdata this would +* be possible. We cannot use static data in drivers since they may be +* used in SPL or before relocation. */ - dev->req_seq = num_cards; -sprintf (name,"i2c_designware#%u" , num_cards++); + dev->req_seq = gd->arch.dw_i2c_num_cards++; +sprintf (name,"i2c_designware#%u" , dev->req_seq);device_set_name (dev, name);return 0 ;
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 9/100 i2c: designware: Support use in SPL
In reply to Simon GlassAllow this driver to set up an IO address in SPL using an 'early-regs' property. This allows SPL to use the I2C driver without having to enable the full PCI stack.
Also split out ofdata_to_platdata in designware driver since this is more correct, and more convenient for the new logic.
---
Changes in v4:
- Add new patch to allow designware I2C driver to work in SPL
Changes in v3: None
Changes in v2: None
drivers/i2c/designware_i2c_pci.c | 46 +++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-)
drivers/i2c/designware_i2c_pci.c +43 -3
@@ -7,6 +7,7 @@#include <common.h> #include <dm.h> +#include <spl.h> #include "designware_i2c.h" /* BayTrail HCNT/LCNT/SDA hold time */
@@ -18,17 +19,49 @@ static struct dw_scl_sda_cfg byt_config = { .sda_hold = 0x6, }; -static int designware_i2c_pci_probe (struct udevice *dev) +/* Have a weak function for now - possibly should be a new uclass */ +__weak void lpss_reset_release (void *regs); + +static int designware_i2c_pci_ofdata_to_platdata (struct udevice *dev) {struct dw_i2c *priv =dev_get_priv (dev); +if (spl_phase () <PHASE_SPL ) { +u32 base; +int ret; + + ret =dev_read_u32 (dev,"early-regs" , &base); +if (ret) +return log_msg_ret ("early-regs" , ret); + +/* Set i2c base address */ +dm_pci_write_config32 (dev,PCI_BASE_ADDRESS_0 , base); + +/* Enable memory access and bus master */ +dm_pci_write_config32 (dev,PCI_COMMAND ,PCI_COMMAND_MEMORY | +PCI_COMMAND_MASTER ); + } + +if (spl_phase () <PHASE_BOARD_F ) { +/* Handle early, fixed mapping into a different address space */ + priv->regs = (struct i2c_regs *)dm_pci_read_bar32 (dev,0 ); + }else { + priv->regs = (struct i2c_regs *) +dm_pci_map_bar (dev,PCI_BASE_ADDRESS_0 ,PCI_REGION_MEM ); + } +if (!priv->regs) +return -EINVAL ; +/* Save base address from PCI BAR */ - priv->regs = (struct i2c_regs *) -dm_pci_map_bar (dev,PCI_BASE_ADDRESS_0 ,PCI_REGION_MEM );if (IS_ENABLED (CONFIG_INTEL_BAYTRAIL ))/* Use BayTrail specific timing values */ priv->scl_sda_cfg = &byt_config; +return 0 ; +} + +static int designware_i2c_pci_probe (struct udevice *dev) +{return designware_i2c_probe (dev); }
@@ -56,10 +89,17 @@ static int designware_i2c_pci_bind(struct udevice *dev)return 0 ; } +static const struct udevice_id designware_i2c_pci_ids[] = { + { .compatible ="snps,designware-i2c-pci" }, + { } +}; +U_BOOT_DRIVER (i2c_designware_pci) = { .name ="i2c_designware_pci" , .id =UCLASS_I2C , + .of_match = designware_i2c_pci_ids, .bind = designware_i2c_pci_bind, + .ofdata_to_platdata = designware_i2c_pci_ofdata_to_platdata, .probe = designware_i2c_pci_probe, .priv_auto_alloc_size =sizeof (struct dw_i2c ), .remove = designware_i2c_remove,
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 10/100 x86: spi: Add helper functions for Intel Fast SPI
In reply to Simon GlassMost x86 CPUs use a mechanism where the SPI flash is mapped into the very top of 32-bit address space, so that it can be executed in place and read simply by copying from memory. For an 8MB ROM the mapping starts at 0xff800000.
However some recent Intel CPUs do not use a simple 1:1 memory map. Instead the map starts at a different address and not all of the SPI flash is accessible through the map. This 'Fast SPI' feature requires that U-Boot check the location of the map. It is also possible (optionally) to read from the SPI flash using a driver.
Add support for booting from Fast SPI. The memory-mapped version is used by both TPL and SPL on Apollo Lake.
In respect of a SPI flash driver, the actual SPI driver is ich.c - this just adds a few helper functions and definitions.
This is used by Apollo Lake.
---
Changes in v4: None
Changes in v3:
- Add support for of-platdata for TPL
- Add the missing header file
- Change Fast-SPI driver into a helper file used by ICH SPI
- Don't include write() and erase() in TPL
- Drop 'a4' comment for register offset
- Merge in patch "x86: Add support for booting from Fast SPI"
- Reorder file so that write() and erase() are together
- Use pci_get_devfn()
Changes in v2: None
arch/x86/cpu/intel_common/Makefile | 1 + arch/x86/cpu/intel_common/fast_spi.c | 73 ++++++++++++++++++++++++++++ arch/x86/include/asm/fast_spi.h | 68 ++++++++++++++++++++++++++ arch/x86/include/asm/spl.h | 1 + 4 files changed, 143 insertions(+) create mode 100644 arch/x86/cpu/intel_common/fast_spi.c create mode 100644 arch/x86/include/asm/fast_spi.h
arch/x86/cpu/intel_common/Makefile +1 -0
@@ -9,6 +9,7 @@ obj-$(CONFIG_$(SPL_TPL_)X86_32BIT_INIT) += report_platform.o obj-$(CONFIG_$(SPL_TPL_)X86_32BIT_INIT) += mrc.o endif obj-y += cpu.o +obj-y += fast_spi.o obj-y += lpc.o ifndef CONFIG_TARGET_EFI_APP obj-$(CONFIG_$(SPL_TPL_)X86_32BIT_INIT) += microcode.o
arch/x86/cpu/intel_common/fast_spi.c new file +73 -0
73 lines not on this page · raw message
arch/x86/include/asm/fast_spi.h new file +68 -0
68 lines not on this page · raw message
arch/x86/include/asm/spl.h +1 -0
@@ -11,6 +11,7 @@enum {BOOT_DEVICE_SPI_MMAP =10 , +BOOT_DEVICE_FAST_SPI ,BOOT_DEVICE_CROS_VBOOT , };
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 11/100 fdt: Show the preprocessed .dts file on error
In reply to Simon GlassWhen device-tree compilation fails it is sometimes tricky to see which line is broken, since the input file to dtc is a pre-processed version of the device tree.
Add a line that points to the file that needs to be checked:
When the error is in the main .dts file, output is something like this:
output: 'Error: arch/x86/dts/.chromebook_coral.dtb.pre.tmp:478.46-47
syntax error
FATAL ERROR: Unable to parse input tree
but in fact looking at that file shows nothing useful:
PAD_CFG_NF_IOSSTATE_IOSTERM(GPIO_157, UP_20K, DEEP, NF1, HIZCRX1, DISPUPD)
Instead we need to look at the preprocessed file, which shows:
163 ((1U << 30) | (1 << 10)) ((0xb << 10) | PAD_CFG1_IOSSTATE_HIZCRX1)
Here it is clear that PAD_CFG1_IOSSTATE_HIZCRX1 is not defined and so is not being resolved by the preprocessor.
This commit adds an additional useful message:
Check arch/x86/dts/.chromebook_coral.dtb.dts.tmp for errors
Note that if the error is reported in an included file, such as u-boot.dtsi then the output is the following:
Error: arch/x86/dts/u-boot.dtsi:137.14-15 syntax error FATAL ERROR: Unable to parse input tree
But again, if the error is due to a preprocessor failure, like this:
filename = CONFIG_IFW_INPUT_FILE;
then you can't tell what the problem is by looking at the source. All you see is the original code:
intel-ifwi {
filename = CONFIG_IFW_INPUT_FILE;
...
};
};
intel-fsp-m {
filename = CONFIG_FSP_FILE_M;
};Everything looks fine. But looking at the output of the preprocessor:
intel-ifwi {
filename = CONFIG_IFW_INPUT_FILE;
...
};
intel-fsp-m {
filename = "fsp_m.bin";
};
This shows that the filename (normally "fitimage.bin") has not been inserted the preprocess, leading to the realisation that the value should be CONFIG_IFWI_INPUT_FILE.
If the above does not make sense, I encourage people to try introducing errors in the device tree preprocessed values.
---
Changes in v4:
- One last desperate attempt to try to explain the purpose of this commit
- Update the message to mention the preprocessed file, not un-preprocessed
Changes in v3:
- Update example error message to better show the intended purpose
Changes in v2: None
scripts/Makefile.lib | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
scripts/Makefile.lib +3 -1
@@ -300,7 +300,9 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \ $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $(pre-tmp) ; \ $(DTC) -O dtb -o $@ -b 0 \ -i $(dir $<) $(DTC_FLAGS) \ - -d $(depfile).dtc.tmp $(dtc-tmp) ; \ + -d $(depfile).dtc.tmp $(dtc-tmp) || \ + (echo "Check $(shell pwd)/$(pre-tmp) for errors" && false) \ + ; \ cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) ; \ sed -i "s:$(pre-tmp):$(<):" $(depfile)
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 12/100 board_r: Move early-timer init later
In reply to Simon GlassAt present the early timer init happens as soon as driver mode is set up. This makes it impossible to do any in that needs driver model but must run before devices are problem (as needed with Intel's FSP-S, for example).
In any case it is not a good idea to tie probing of particular drivers too closely to the DM init.
Create a new function to init the timer and put it a bit later in the sequence.
---
Changes in v4:
- Add new patch to move early-timer init later
Changes in v3: None
Changes in v2: None
common/board_r.c | 19 ++++++++++++++----- drivers/pinctrl/Kconfig | 14 ++++++++++++++ 2 files changed, 28 insertions(+), 5 deletions(-)
common/board_r.c +14 -5
@@ -306,16 +306,24 @@ static int initr_dm(void)bootstage_accum (BOOTSTATE_ID_ACCUM_DM_R );if (ret)return ret; -#ifdef CONFIG_TIMER_EARLY - ret =dm_timer_init (); -if (ret) -return ret; -#endif return 0; }#endif +static int initr_dm_devices (void ) +{ +int ret; + +if (IS_ENABLED (CONFIG_TIMER_EARLY )) { + ret =dm_timer_init (); +if (ret) +return ret; + } + +return 0 ; +} +static int initr_bootstage (void ) {bootstage_mark_name (BOOTSTAGE_ID_START_UBOOT_R ,"board_init_r" );
@@ -702,6 +710,7 @@ static init_fnc_t init_sequence_r[] = { efi_memory_init, #endif initr_binman, + initr_dm_devices, stdio_init_tables, initr_serial, initr_announce,
drivers/pinctrl/Kconfig +14 -0
@@ -82,6 +82,13 @@ config SPL_PINCTRL This option is an SPL-variant of the PINCTRL option. See the help of PINCTRL for details. +config TPL_PINCTRL + bool "Support pin controllers in TPL" + depends on TPL && TPL_DM + help + This option is an TPL variant of the PINCTRL option. + See the help of PINCTRL for details. + config SPL_PINCTRL_FULL bool "Support full pin controllers in SPL" depends on SPL_PINCTRL && SPL_OF_CONTROL
@@ -91,6 +98,13 @@ config SPL_PINCTRL_FULL This option is an SPL-variant of the PINCTRL_FULL option. See the help of PINCTRL_FULL for details. +config TPL_PINCTRL_FULL + bool "Support full pin controllers in TPL" + depends on TPL_PINCTRL && TPL_OF_CONTROL + help + This option is an TPL-variant of the PINCTRL_FULL option. + See the help of PINCTRL_FULL for details. + config SPL_PINCTRL_GENERIC bool "Support generic pin controllers in SPL" depends on SPL_PINCTRL_FULL
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 13/100 RFC: sandbox: net: Suppress the MAC-address warnings
In reply to Simon GlassThese warnings appear every thing sandbox is run (see below) and dwarf the actual useful output. Suppress them in two ways:
1. For the mismatch warnings, only set the eth<x>addr environment variables when running tests.
2. For the 'MAC address from ROM' warning, never print this on sandbox.
---
Unfortunately this breaks the tests so is not applicable as is:
$ /tmp/b/sandbox/u-boot -T -c "ut dm eth_prime"
U-Boot 2019.10-00508-g95f6257285-dirty (Oct 13 2019 - 09:21:34 -0600)
Model: sandbox DRAM: 128 MiB WDT: Started with servicing (60s timeout) MMC: mmc2: 2 (SD), mmc1: 1 (SD), mmc0: 0 (SD) In: serial Out: vidconsole Err: vidconsole Model: sandbox
SCSI:
Net:
Error: eth at 10002000 address not set.
eth-1: eth at 10002000
Error: eth at 10003000 address not set.
, eth-1: eth at 10003000
Error: sbe5 address not set.
, eth-1: sbe5
Error: eth at 10004000 address not set.
, eth-1: eth at 10004000
Test: dm_test_eth_prime: eth.c
Test: dm_test_eth_prime: eth.c (flat tree)
Failures: 0
Old output:
U-Boot 2019.10-rc2
Model: sandbox DRAM: 128 MiB
Warning: host_lo MAC addresses don't match:
Address in ROM is a6:28:b7:47:28:93
Address in environment is 00:00:11:22:33:44
Warning: host_enp5s0 MAC addresses don't match:
Address in ROM is a6:28:b7:47:28:93
Address in environment is 00:00:11:22:33:45
Warning: host_eth6 using MAC address from ROM
Warning: host_docker0 MAC addresses don't match:
Address in ROM is a6:28:b7:47:28:93
Address in environment is 00:00:11:22:33:46
Warning: host_docker_gwbridge using MAC address from ROM
Warning: host_veth1118e68 MAC addresses don't match:
Address in ROM is a6:28:b7:47:28:93
Address in environment is 00:00:11:22:33:47
WDT: Not found!
MMC:
In: cros-ec-keyb Out: vidconsole Err: vidconsole Model: sandbox SCSI: Net: eth0: host_lo, eth1: host_enp5s0, eth2: host_eth6, eth3: host_docker0, eth4: host_docker_gwbridge, eth5: host_veth1118e68 Error: eth at 10002000 address not set.
, eth-1: eth at 10002000
Test 'pmc_base' not found
Warning: host_lo MAC addresses don't match:
Address in ROM is 2a:24:9a:31:90:f8
Address in environment is 00:00:11:22:33:44
Warning: host_enp5s0 MAC addresses don't match:
Address in ROM is ce:23:d9:74:6f:6c
Address in environment is 00:00:11:22:33:45
Warning: host_eth6 using MAC address from ROM
Warning: host_docker0 MAC addresses don't match:
Address in ROM is ee:22:1c:3b:be:bc
Address in environment is 00:00:11:22:33:46
Warning: host_docker_gwbridge using MAC address from ROM
Warning: host_veth1118e68 MAC addresses don't match:
Address in ROM is ae:20:9e:3d:a4:9f
Address in environment is 00:00:11:22:33:47
New output:
U-Boot 2019.10
Model: sandbox DRAM: 128 MiB WDT: Not found! MMC: In: cros-ec-keyb Out: vidconsole Err: vidconsole Model: sandbox SCSI: Net: eth0: host_lo, eth1: host_enp5s0, eth2: host_eth6, eth3: host_docker0, eth4: host_docker_gwbridge, eth5: host_vethc7e1b9e Error: eth at 10002000 address not set.
, eth-1: eth at 10002000
Hit any key to stop autoboot: 0
=>
Changes in v4: None
Changes in v3:
- Only supress the 'MAC address from ROM' warning on sandbox
- Set the environment variables at runtime to avoid other warnings
Changes in v2: None
arch/sandbox/cpu/state.c | 12 ++++++++++-- arch/sandbox/include/asm/state.h | 5 ++++- cmd/nvedit.c | 8 ++++++++ include/configs/sandbox.h | 7 ++----- include/env.h | 12 ++++++++++++ net/eth-uclass.c | 11 +++++++++-- test/dm/test-main.c | 2 +- 7 files changed, 46 insertions(+), 11 deletions(-)
arch/sandbox/cpu/state.c +10 -2
@@ -351,7 +351,7 @@ bool state_get_skip_delays(void)return state->skip_delays; } -void state_reset_for_test (struct sandbox_state *state) +void state_reset_for_test (struct sandbox_state *state,bool eth_vars) {/* No reset yet, so mark it as such. Always allow power reset */ state->last_sysreset =SYSRESET_COUNT ;
@@ -367,6 +367,14 @@ void state_reset_for_test(struct sandbox_state *state)*/ INIT_LIST_HEAD (&state->mapmem_head); state->next_tag = state->ram_size; + +if (eth_vars) { +/* set up some environment variables needed by the eth tests */ +env_set_for_test ("ethaddr" ,"00:00:11:22:33:44" ); +env_set_for_test ("eth1addr" ,"00:00:11:22:33:45" ); +env_set_for_test ("eth3addr" ,"00:00:11:22:33:46" ); +env_set_for_test ("eth5addr" ,"00:00:11:22:33:47" ); + } }int state_init (void )
@@ -377,7 +385,7 @@ int state_init(void) state->ram_buf =os_malloc (state->ram_size);assert (state->ram_buf); -state_reset_for_test (state); +state_reset_for_test (state, false);/* * Example of how to use GPIOs: *
arch/sandbox/include/asm/state.h +4 -1
@@ -251,8 +251,11 @@ bool state_get_skip_delays(void);* state_reset_for_test() - Reset ready to re-run tests * * This clears out any test state ready for another test run. +* +* @param state Sandbox state to update +* @param eth_vars Set environment variables for eth tests */ -void state_reset_for_test (struct sandbox_state *state); +void state_reset_for_test (struct sandbox_state *state,bool eth_vars);/** * state_show() - Show information about the sandbox state
cmd/nvedit.c +8 -0
@@ -299,6 +299,14 @@ static int _do_env_set(int flag, int argc, char * const argv[], int env_flag)return 0 ; } +int env_set_for_test (const char *varname,const char *value) +{ +const char *const argv[4 ] = {"setenv" , varname, value,NULL }; + +assert (value); +return _do_env_set (0 ,3 , (char *const *)argv,0 ); +} +int env_set (const char *varname,const char *varvalue) {const char *const argv[4 ] = {"setenv" , varname, varvalue,NULL };
include/configs/sandbox.h +2 -5
@@ -98,11 +98,8 @@ "stderr=serial,vidconsole\0"#endif -#define SANDBOX_ETH_SETTINGS "ethaddr=00:00:11:22:33:44\0" \ - "eth1addr=00:00:11:22:33:45\0" \ - "eth3addr=00:00:11:22:33:46\0" \ - "eth5addr=00:00:11:22:33:47\0" \ - "ipaddr=1.2.3.4\0" +/* Note that some ethernet variables are set in state_reset_for_test() */ +#define SANDBOX_ETH_SETTINGS "ipaddr=1.2.3.4\0"#define MEM_LAYOUT_ENV_SETTINGS \ "bootm_size=0x10000000\0" \
include/env.h +12 -0
@@ -145,6 +145,18 @@ int env_get_yesno(const char *var);*/ int env_set (const char *varname,const char *value); +/** +* env_set_for_test() - Set the value of a variable for testing +* +* This works as if the variable value was defined in the built-in environment, +* so uses a flags value of 0. This should only be used in tests. +* +* @varname: Variable to adjust +* @value: Value to set for the variable (cannot be NULL) +* @return 0 if OK, 1 on error +*/ +int env_set_for_test (const char *varname,const char *value); +/** * env_get_ulong() - Return an environment variable as an integer value *
net/eth-uclass.c +9 -2
@@ -485,6 +485,12 @@ static int eth_post_probe(struct udevice *dev)struct eth_device_priv *priv = dev->uclass_priv;struct eth_pdata *pdata = dev->platdata;unsigned char env_enetaddr[ARP_HLEN ]; +/* +* These warnings always appear on sandbox and are not useful. They have +* been here for some time and the issue has not been resolved. So for +* now, disable them. +*/ +bool show_warnings = !IS_ENABLED (CONFIG_SANDBOX );#if defined(CONFIG_NEEDS_MANUAL_RELOC )struct eth_ops *ops =eth_get_ops (dev);
@@ -538,8 +544,9 @@ static int eth_post_probe(struct udevice *dev)memcpy (pdata->enetaddr, env_enetaddr,ARP_HLEN ); }else if (is_valid_ethaddr (pdata->enetaddr)) {eth_env_set_enetaddr_by_index ("eth" , dev->seq, pdata->enetaddr); -printf ("\nWarning: %s using MAC address from ROM\n" , - dev->name); +if (show_warnings) +printf ("\nWarning: %s using MAC address from ROM\n" , + dev->name); }else if (is_zero_ethaddr (pdata->enetaddr) || !is_valid_ethaddr (pdata->enetaddr)) {#ifdef CONFIG_NET_RANDOM_ETHADDR
test/dm/test-main.c +1 -1
@@ -28,7 +28,7 @@ static int dm_test_init(struct unit_test_state *uts, bool of_live)memset (dms,'\0' ,sizeof (*dms)); gd->dm_root =NULL ;memset (dm_testdrv_op_count,'\0' ,sizeof (dm_testdrv_op_count)); -state_reset_for_test (state_get_current ()); +state_reset_for_test (state_get_current (), true);#ifdef CONFIG_OF_LIVE /* Determine whether to make the live tree available */
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 13/100 RFC: sandbox: net: Suppress the MAC-address warnings
Hi Simon,
Quoted 251 lines · Simon Glass
These warnings appear every thing sandbox is run (see below) and dwarf the actual useful output. Suppress them in two ways:
1. For the mismatch warnings, only set the eth<x>addr environment variables when running tests.
2. For the 'MAC address from ROM' warning, never print this on sandbox.
Signed-off-by Simon Glass <[email protected]>---
Unfortunately this breaks the tests so is not applicable as is:$ /tmp/b/sandbox/u-boot -T -c "ut dm eth_prime"U-Boot 2019.10-00508-g95f6257285-dirty (Oct 13 2019 - 09:21:34 -0600)
Model: sandbox DRAM: 128 MiB WDT: Started with servicing (60s timeout) MMC: mmc2: 2 (SD), mmc1: 1 (SD), mmc0: 0 (SD) In: serial Out: vidconsole Err: vidconsole Model: sandboxSCSI:
Net:
Error: eth at 10002000 address not set.
eth-1: eth at 10002000
Error: eth at 10003000 address not set.
, eth-1: eth at 10003000
Error: sbe5 address not set.
, eth-1: sbe5
Error: eth at 10004000 address not set.
, eth-1: eth at 10004000
Test:dm_test_eth_prime:eth.c
Test:dm_test_eth_prime:eth.c(flat tree)
Failures: 0Old output:
U-Boot 2019.10-rc2
Model: sandbox DRAM: 128 MiBWarning:
host_loMAC addresses don't match:
Address in ROM is a6:28:b7:47:28:93
Address in environment is 00:00:11:22:33:44Warning:
host_enp5s0MAC addresses don't match:
Address in ROM is a6:28:b7:47:28:93
Address in environment is 00:00:11:22:33:45Warning:
host_eth6using MAC address from ROMWarning:
host_docker0MAC addresses don't match:
Address in ROM is a6:28:b7:47:28:93
Address in environment is 00:00:11:22:33:46Warning:
host_docker_gwbridgeusing MAC address from ROMWarning:
host_veth1118e68MAC addresses don't match:
Address in ROM is a6:28:b7:47:28:93
Address in environment is 00:00:11:22:33:47
WDT: Not found!
MMC:In: cros-ec-keyb Out: vidconsole Err: vidconsole Model: sandbox SCSI: Net: eth0: host_lo, eth1: host_enp5s0, eth2: host_eth6, eth3: host_docker0, eth4: host_docker_gwbridge, eth5: host_veth1118e68 Error: eth at 10002000 address not set., eth-1: eth at 10002000
Test 'pmc_base' not foundWarning:
host_loMAC addresses don't match:
Address in ROM is 2a:24:9a:31:90:f8
Address in environment is 00:00:11:22:33:44Warning:
host_enp5s0MAC addresses don't match:
Address in ROM is ce:23:d9:74:6f:6c
Address in environment is 00:00:11:22:33:45Warning:
host_eth6using MAC address from ROMWarning:
host_docker0MAC addresses don't match:
Address in ROM is ee:22:1c:3b:be:bc
Address in environment is 00:00:11:22:33:46Warning:
host_docker_gwbridgeusing MAC address from ROMWarning:
host_veth1118e68MAC addresses don't match:
Address in ROM is ae:20:9e:3d:a4:9f
Address in environment is 00:00:11:22:33:47New output:
U-Boot 2019.10Model: sandbox DRAM: 128 MiB WDT: Not found! MMC: In: cros-ec-keyb Out: vidconsole Err: vidconsole Model: sandbox SCSI: Net: eth0: host_lo, eth1: host_enp5s0, eth2: host_eth6, eth3: host_docker0, eth4: host_docker_gwbridge, eth5: host_vethc7e1b9e Error: eth at 10002000 address not set., eth-1: eth at 10002000
Hit any key to stop autoboot: 0
=>Changes in v4: None
Changes in v3:
- Only supress the 'MAC address from ROM' warning on sandbox
- Set the environment variables at runtime to avoid other warningsChanges in v2: None
arch/sandbox/cpu/state.c | 12 ++++++++++-- arch/sandbox/include/asm/state.h | 5 ++++- cmd/nvedit.c | 8 ++++++++ include/configs/sandbox.h | 7 ++----- include/env.h | 12 ++++++++++++ net/eth-uclass.c | 11 +++++++++-- test/dm/test-main.c | 2 +- 7 files changed, 46 insertions(+), 11 deletions(-)arch/sandbox/cpu/state.c +10
-2@@ -351,7 +351,7 @@ bool state_get_skip_delays(void)return state->skip_delays; } -void state_reset_for_test (struct sandbox_state *state) +void state_reset_for_test (struct sandbox_state *state,bool eth_vars) {/* No reset yet, so mark it as such. Always allow power reset */ state->last_sysreset =SYSRESET_COUNT ;@@ -367,6 +367,14 @@ void state_reset_for_test(struct sandbox_state *state)*/ INIT_LIST_HEAD (&state->mapmem_head); state->next_tag = state->ram_size; + +if (eth_vars) { +/* set up some environment variables needed by the eth tests */ +env_set_for_test ("ethaddr" ,"00:00:11:22:33:44" ); +env_set_for_test ("eth1addr" ,"00:00:11:22:33:45" ); +env_set_for_test ("eth3addr" ,"00:00:11:22:33:46" ); +env_set_for_test ("eth5addr" ,"00:00:11:22:33:47" ); + } }int state_init (void )@@ -377,7 +385,7 @@ int state_init(void) state->ram_buf =os_malloc (state->ram_size);assert (state->ram_buf); -state_reset_for_test (state); +state_reset_for_test (state, false);/* * Example of how to use GPIOs: * arch/sandbox/include/asm/state.h +4
-1@@ -251,8 +251,11 @@ bool state_get_skip_delays(void);* state_reset_for_test() - Reset ready to re-run tests * * This clears out any test state ready for another test run. +* +* @param state Sandbox state to update +* @param eth_vars Set environment variables for eth tests */ -void state_reset_for_test (struct sandbox_state *state); +void state_reset_for_test (struct sandbox_state *state,bool eth_vars);/** * state_show() - Show information about the sandbox state cmd/nvedit.c +8
-0@@ -299,6 +299,14 @@ static int _do_env_set(int flag, int argc, char * const argv[], int env_flag)return 0 ; } +int env_set_for_test (const char *varname,const char *value) +{ +const char *const argv[4 ] = {"setenv" , varname, value,NULL }; + +assert (value); +return _do_env_set (0 ,3 , (char *const *)argv,0 ); +} +int env_set (const char *varname,const char *varvalue) {const char *const argv[4 ] = {"setenv" , varname, varvalue,NULL };include/configs/sandbox.h +2
-5@@ -98,11 +98,8 @@ "stderr=serial,vidconsole\0"#endif -#define SANDBOX_ETH_SETTINGS "ethaddr=00:00:11:22:33:44\0" \ - "eth1addr=00:00:11:22:33:45\0" \ - "eth3addr=00:00:11:22:33:46\0" \ - "eth5addr=00:00:11:22:33:47\0" \ - "ipaddr=1.2.3.4\0" +/* Note that some ethernet variables are set in state_reset_for_test() */ +#define SANDBOX_ETH_SETTINGS "ipaddr=1.2.3.4\0"#define MEM_LAYOUT_ENV_SETTINGS \ "bootm_size=0x10000000\0" \include/env.h +12
-0@@ -145,6 +145,18 @@ int env_get_yesno(const char *var);*/ int env_set (const char *varname,const char *value); +/** +* env_set_for_test() - Set the value of a variable for testing +* +* This works as if the variable value was defined in the built-in environment, +* so uses a flags value of 0. This should only be used in tests. +* +* @varname: Variable to adjust +* @value: Value to set for the variable (cannot be NULL) +* @return 0 if OK, 1 on error +*/ +int env_set_for_test (const char *varname,const char *value); +/** * env_get_ulong() - Return an environment variable as an integer value * net/eth-uclass.c +0
-0
net/eth-uclass.c static int eth_post_probe(struct udevice *dev) · line 493
Quoted 9 lines
net/eth-uclass.c +6
-0@@ -485,6 +485,12 @@ static int eth_post_probe(struct udevice *dev)struct eth_device_priv *priv = dev->uclass_priv;struct eth_pdata *pdata = dev->platdata;unsigned char env_enetaddr[ARP_HLEN ]; +/* +* These warnings always appear on sandbox and are not useful. They have +* been here for some time and the issue has not been resolved. So for +* now, disable them. +*/ +bool show_warnings = !IS_ENABLED (CONFIG_SANDBOX );
It seems like it would be better to make this a new config that sandbox enables. This way other boards that wish to disable them can and we don't start getting a growing list of configs here.
Quoted 35 lines
net/eth-uclass.c +3
-2#if defined(CONFIG_NEEDS_MANUAL_RELOC )struct eth_ops *ops =eth_get_ops (dev);@@ -538,8 +544,9 @@ static int eth_post_probe(struct udevice *dev)memcpy (pdata->enetaddr, env_enetaddr,ARP_HLEN ); }else if (is_valid_ethaddr (pdata->enetaddr)) {eth_env_set_enetaddr_by_index ("eth" , dev->seq, pdata->enetaddr); -printf ("\nWarning: %s using MAC address from ROM\n" , - dev->name); +if (show_warnings) +printf ("\nWarning: %s using MAC address from ROM\n" , + dev->name); }else if (is_zero_ethaddr (pdata->enetaddr) || !is_valid_ethaddr (pdata->enetaddr)) {#ifdef CONFIG_NET_RANDOM_ETHADDR test/dm/test-main.c +1
-2@@ -28,7 +28,7 @@ static int dm_test_init(struct unit_test_state *uts, bool of_live)memset (dms,'\0' ,sizeof (*dms)); gd->dm_root =NULL ;memset (dm_testdrv_op_count,'\0' ,sizeof (dm_testdrv_op_count)); -state_reset_for_test (state_get_current ()); +state_reset_for_test (state_get_current (), true);#ifdef CONFIG_OF_LIVE /* Determine whether to make the live tree available */ --2.24.0.432.g9d3f5f5b63-goog
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
PATCH v4 14/100 Revert "RFC: sandbox: net: Suppress the MAC-address warnings"
In reply to Simon GlassThis reverts commit 96ac4def8b6686de8566b91419ce98cd5765079b.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
arch/sandbox/cpu/state.c | 12 ++---------- arch/sandbox/include/asm/state.h | 5 +---- cmd/nvedit.c | 8 -------- include/configs/sandbox.h | 7 +++++-- include/env.h | 12 ------------ net/eth-uclass.c | 11 ++--------- test/dm/test-main.c | 2 +- 7 files changed, 11 insertions(+), 46 deletions(-)
arch/sandbox/cpu/state.c +2 -10
@@ -351,7 +351,7 @@ bool state_get_skip_delays(void)return state->skip_delays; } -void state_reset_for_test (struct sandbox_state *state,bool eth_vars) +void state_reset_for_test (struct sandbox_state *state) {/* No reset yet, so mark it as such. Always allow power reset */ state->last_sysreset =SYSRESET_COUNT ;
@@ -367,14 +367,6 @@ void state_reset_for_test(struct sandbox_state *state, bool eth_vars)*/ INIT_LIST_HEAD (&state->mapmem_head); state->next_tag = state->ram_size; - -if (eth_vars) { -/* set up some environment variables needed by the eth tests */ -env_set_for_test ("ethaddr" ,"00:00:11:22:33:44" ); -env_set_for_test ("eth1addr" ,"00:00:11:22:33:45" ); -env_set_for_test ("eth3addr" ,"00:00:11:22:33:46" ); -env_set_for_test ("eth5addr" ,"00:00:11:22:33:47" ); - } }int state_init (void )
@@ -385,7 +377,7 @@ int state_init(void) state->ram_buf =os_malloc (state->ram_size);assert (state->ram_buf); -state_reset_for_test (state, false); +state_reset_for_test (state);/* * Example of how to use GPIOs: *
arch/sandbox/include/asm/state.h +1 -4
@@ -251,11 +251,8 @@ bool state_get_skip_delays(void);* state_reset_for_test() - Reset ready to re-run tests * * This clears out any test state ready for another test run. -* -* @param state Sandbox state to update -* @param eth_vars Set environment variables for eth tests */ -void state_reset_for_test (struct sandbox_state *state,bool eth_vars); +void state_reset_for_test (struct sandbox_state *state);/** * state_show() - Show information about the sandbox state
cmd/nvedit.c +0 -8
@@ -299,14 +299,6 @@ static int _do_env_set(int flag, int argc, char * const argv[], int env_flag)return 0 ; } -int env_set_for_test (const char *varname,const char *value) -{ -const char *const argv[4 ] = {"setenv" , varname, value,NULL }; - -assert (value); -return _do_env_set (0 ,3 , (char *const *)argv,0 ); -} -int env_set (const char *varname,const char *varvalue) {const char *const argv[4 ] = {"setenv" , varname, varvalue,NULL };
include/configs/sandbox.h +5 -2
@@ -98,8 +98,11 @@ "stderr=serial,vidconsole\0"#endif -/* Note that some ethernet variables are set in state_reset_for_test() */ -#define SANDBOX_ETH_SETTINGS "ipaddr=1.2.3.4\0" +#define SANDBOX_ETH_SETTINGS "ethaddr=00:00:11:22:33:44\0" \ + "eth1addr=00:00:11:22:33:45\0" \ + "eth3addr=00:00:11:22:33:46\0" \ + "eth5addr=00:00:11:22:33:47\0" \ + "ipaddr=1.2.3.4\0"#define MEM_LAYOUT_ENV_SETTINGS \ "bootm_size=0x10000000\0" \
include/env.h +0 -12
@@ -145,18 +145,6 @@ int env_get_yesno(const char *var);*/ int env_set (const char *varname,const char *value); -/** -* env_set_for_test() - Set the value of a variable for testing -* -* This works as if the variable value was defined in the built-in environment, -* so uses a flags value of 0. This should only be used in tests. -* -* @varname: Variable to adjust -* @value: Value to set for the variable (cannot be NULL) -* @return 0 if OK, 1 on error -*/ -int env_set_for_test (const char *varname,const char *value); -/** * env_get_ulong() - Return an environment variable as an integer value *
net/eth-uclass.c +2 -9
@@ -485,12 +485,6 @@ static int eth_post_probe(struct udevice *dev)struct eth_device_priv *priv = dev->uclass_priv;struct eth_pdata *pdata = dev->platdata;unsigned char env_enetaddr[ARP_HLEN ]; -/* -* These warnings always appear on sandbox and are not useful. They have -* been here for some time and the issue has not been resolved. So for -* now, disable them. -*/ -bool show_warnings = !IS_ENABLED (CONFIG_SANDBOX );#if defined(CONFIG_NEEDS_MANUAL_RELOC )struct eth_ops *ops =eth_get_ops (dev);
@@ -544,9 +538,8 @@ static int eth_post_probe(struct udevice *dev)memcpy (pdata->enetaddr, env_enetaddr,ARP_HLEN ); }else if (is_valid_ethaddr (pdata->enetaddr)) {eth_env_set_enetaddr_by_index ("eth" , dev->seq, pdata->enetaddr); -if (show_warnings) -printf ("\nWarning: %s using MAC address from ROM\n" , - dev->name); +printf ("\nWarning: %s using MAC address from ROM\n" , + dev->name); }else if (is_zero_ethaddr (pdata->enetaddr) || !is_valid_ethaddr (pdata->enetaddr)) {#ifdef CONFIG_NET_RANDOM_ETHADDR
test/dm/test-main.c +1 -1
@@ -28,7 +28,7 @@ static int dm_test_init(struct unit_test_state *uts, bool of_live)memset (dms,'\0' ,sizeof (*dms)); gd->dm_root =NULL ;memset (dm_testdrv_op_count,'\0' ,sizeof (dm_testdrv_op_count)); -state_reset_for_test (state_get_current (), true); +state_reset_for_test (state_get_current ());#ifdef CONFIG_OF_LIVE /* Determine whether to make the live tree available */
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 15/100 x86: timer: use a timer base of 0
In reply to Simon GlassOn x86 platforms the timer is reset to 0 when the SoC is reset. Having this as the timer base is useful since it provides an indication of how long it takes before U-Boot is running.
When U-Boot sets the timer base to something else, time is lost and we no-longer have an accurate account of the time since reset. This particularly affects bootstage.
Change the default to not read the timer base, leaving it at 0. Add an option for when U-Boot is the secondary bootloader.
---
Changes in v4:
- Enable option for slimbootloader, coreboot, efi
- Reverse the sense of the CONFIG option
Changes in v3: None
Changes in v2: None
arch/x86/cpu/coreboot/Kconfig | 1 + arch/x86/cpu/slimbootloader/Kconfig | 1 + drivers/timer/Kconfig | 14 ++++++++++++++ drivers/timer/tsc_timer.c | 3 ++- lib/efi/Kconfig | 1 + 5 files changed, 19 insertions(+), 1 deletion(-)
arch/x86/cpu/coreboot/Kconfig +1 -0
@@ -24,5 +24,6 @@ config SYS_COREBOOT imply CMD_CBFS imply FS_CBFS imply CBMEM_CONSOLE + imply X86_TSC_READ_BASE endif
arch/x86/cpu/slimbootloader/Kconfig +1 -0
@@ -17,3 +17,4 @@ config SYS_SLIMBOOTLOADER imply USB_EHCI_HCD imply USB_XHCI_HCD imply E1000 + imply X86_TSC_READ_BASE
drivers/timer/Kconfig +14 -0
@@ -174,6 +174,20 @@ config X86_TSC_TIMER help Select this to enable Time-Stamp Counter (TSC) timer for x86. +config X86_TSC_READ_BASE + bool "Read the TSC timer base on start-up" + depends on X86_TSC_TIMER + help + On x86 platforms the TSC timer tick starts at the value 0 on reset. + This it makes no sense to read the timer on boot and use that as the + base, since we will miss some time taken to load U-Boot, etc. This + delay is controlled by the SoC and we cannot reduce it, but for + bootstage we want to record the time since reset as accurately as + possible. + + The only exception is when U-Boot is used as a secondary bootloader, + where this option should be enabled. + config MTK_TIMER bool "MediaTek timer support" depends on TIMER
drivers/timer/tsc_timer.c +2 -1
@@ -396,7 +396,8 @@ static void tsc_timer_ensure_setup(bool early) {if (gd->arch.tsc_inited)return ; - gd->arch.tsc_base =rdtsc (); +if (IS_ENABLED (CONFIG_X86_TSC_READ_BASE )) + gd->arch.tsc_base =rdtsc ();if (!gd->arch.clock_rate) {unsigned long fast_calibrate;
lib/efi/Kconfig +1 -0
@@ -1,6 +1,7 @@ config EFI bool "Support running U-Boot from EFI" depends on X86 + imply X86_TSC_READ_BASE help U-Boot can be started from EFI on certain platforms. This allows EFI to perform most of the system init and then jump to U-Boot for
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 16/100 x86: timer: Reduce timer code size in TPL on Intel CPUs
In reply to Simon GlassMost of the timer-calibration methods are not needed on recent Intel CPUs and just increase code size. Add an option to use the known-good way to get the clock frequency in TPL. Size reduction is about 700 bytes.
Note that version 1 of this commit caused bootstage to crash since the CPU was not identified. This is corrected by changes previously applied to make sure that the CPU is identified before spl_init() is called, such as
39146a2e0b x86: Move CPU init to before spl_init()
---
Changes in v4:
- Update commit message to indicate that CPU-identity bug is fixed
Changes in v3: None
Changes in v2: None
drivers/timer/Kconfig | 9 +++++++++ drivers/timer/tsc_timer.c | 7 +++++-- 2 files changed, 14 insertions(+), 2 deletions(-)
drivers/timer/Kconfig +9 -0
@@ -188,6 +188,15 @@ config X86_TSC_READ_BASE The only exception is when U-Boot is used as a secondary bootloader, where this option should be enabled. +config TPL_X86_TSC_TIMER_NATIVE + bool "x86 TSC timer uses native calibration" + depends on TPL && X86_TSC_TIMER + help + Selects native timer calibration for TPL and don't include the other + methods in the code. This helps to reduce code size in TPL and works + on fairly modern Intel chips. Code-size reductions is about 700 + bytes. + config MTK_TIMER bool "MediaTek timer support" depends on TIMER
drivers/timer/tsc_timer.c +5 -2
@@ -49,8 +49,7 @@ static unsigned long native_calibrate_tsc(void)return 0 ; crystal_freq = tsc_info.ecx /1000 ; - -if (!crystal_freq) { +if (!CONFIG_IS_ENABLED (X86_TSC_TIMER_NATIVE ) && !crystal_freq) {switch (gd->arch.x86_model) {case INTEL_FAM6_SKYLAKE_MOBILE :case INTEL_FAM6_SKYLAKE_DESKTOP :
@@ -406,6 +405,10 @@ static void tsc_timer_ensure_setup(bool early)if (fast_calibrate) goto done; +/* Reduce code size by dropping other methods */ +if (CONFIG_IS_ENABLED (X86_TSC_TIMER_NATIVE )) +panic ("no timer" ); + fast_calibrate =cpu_mhz_from_cpuid ();if (fast_calibrate) goto done;
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 17/100 x86: Drop unnecessary cpu code for TPL
In reply to Simon GlassWe don't need to know every detail about the CPU in TPL. Drop some superfluous functions to reduce code size. Add a simple CPU detection algorithm which just supports Intel and AMD, since we only support TPL on Intel, so far.
---
Changes in v4:
- Drop 'if (0)' call to deep_magic_nexgen_probe() and use #ifndef instead
- Fix 'what' typo
Changes in v3: None
Changes in v2: None
arch/x86/cpu/cpu.c | 4 ++++ arch/x86/cpu/i386/cpu.c | 41 +++++++++++++++++++++++++++++++++++++---- 2 files changed, 41 insertions(+), 4 deletions(-)
arch/x86/cpu/cpu.c +4 -0
@@ -45,6 +45,7 @@DECLARE_GLOBAL_DATA_PTR ; +#ifndef CONFIG_TPL_BUILD static const char *const x86_vendor_name[] = { [X86_VENDOR_INTEL ] ="Intel" , [X86_VENDOR_CYRIX] = "Cyrix",
@@ -57,6 +58,7 @@ static const char *const x86_vendor_name[] = { [X86_VENDOR_NSC] = "NSC", [X86_VENDOR_SIS] = "SiS", }; +#endif int __weak x86_cleanup_before_linux (void ) {
@@ -113,6 +115,7 @@ int icache_status(void)return 1 ; } +#ifndef CONFIG_TPL_BUILD const char *cpu_vendor_name (int vendor) {const char *name;
@@ -123,6 +126,7 @@ const char *cpu_vendor_name(int vendor) return name; } +#endif char *cpu_get_name (char *name) {
arch/x86/cpu/i386/cpu.c +37 -4
102 lines not on this page · raw message
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 18/100 x86: Drop unnecessary interrupt code for TPL
In reply to Simon GlassWe don't expect an exception in TPL and don't need to set up interrupts in TPL. Drop this whole file.
---
Changes in v4:
- Drop the whole interrupt file for TPL
Changes in v3: None
Changes in v2: None
arch/x86/cpu/i386/Makefile | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/cpu/i386/Makefile +2 -0
@@ -5,5 +5,7 @@ obj-y += call64.o obj-y += cpu.o +ifndef CONFIG_TPL_BUILD obj-y += interrupt.o +endif obj-y += setjmp.o
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 19/100 x86: power: Add an ACPI PMC uclass
In reply to Simon GlassIntel x86 SoCs have a power manager/controller which handles several power-related aspects of the platform. Add a uclass for this, with a few useful operations.
---
Changes in v4:
- Fix alpha order in Kconfig
- Switch over to use pinctrl for pad init/config
Changes in v3:
- Rename power-mgr uclass to acpi-pmc
Changes in v2: None
drivers/power/Kconfig | 2 + drivers/power/acpi_pmc/Kconfig | 25 +++ drivers/power/acpi_pmc/Makefile | 5 + drivers/power/acpi_pmc/acpi-pmc-uclass.c | 188 +++++++++++++++++++++++ include/dm/uclass-id.h | 1 + include/power/acpi_pmc.h | 185 ++++++++++++++++++++++ 6 files changed, 406 insertions(+) create mode 100644 drivers/power/acpi_pmc/Kconfig create mode 100644 drivers/power/acpi_pmc/Makefile create mode 100644 drivers/power/acpi_pmc/acpi-pmc-uclass.c create mode 100644 include/power/acpi_pmc.h
drivers/power/Kconfig +2 -0
@@ -1,5 +1,7 @@ menu "Power" +source "drivers/power/acpi_pmc/Kconfig" + source "drivers/power/domain/Kconfig" source "drivers/power/pmic/Kconfig"
drivers/power/acpi_pmc/Kconfig new file +25 -0
@@ -0,0 +1,25 @@ +config ACPI_PMC + bool "Power Manager (x86 PMC) support" + help + Enable support for an x86-style power-management controller which + provides features including checking whether the system started from + resume, powering off the system and enabling/disabling the reset + mechanism. + +config SPL_ACPI_PMC + bool "Power Manager (x86 PMC) support in SPL" + default y if ACPI_PMC + help + Enable support for an x86-style power-management controller which + provides features including checking whether the system started from + resume, powering off the system and enabling/disabling the reset + mechanism. + +config TPL_ACPI_PMC + bool "Power Manager (x86 PMC) support in TPL" + default y if ACPI_PMC + help + Enable support for an x86-style power-management controller which + provides features including checking whether the system started from + resume, powering off the system and enabling/disabling the reset + mechanism.
drivers/power/acpi_pmc/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright 2019 Google LLC + +obj-$(CONFIG_$(SPL_TPL_)ACPI_PMC) += acpi-pmc-uclass.o
drivers/power/acpi_pmc/acpi-pmc-uclass.c new file +188 -0
188 lines not on this page · raw message
include/dm/uclass-id.h +1 -0
@@ -28,6 +28,7 @@ enum uclass_id {UCLASS_AXI_EMUL ,/* sandbox AXI bus device emulator */ /* U-Boot uclasses start here - in alphabetical order */ +UCLASS_ACPI_PMC ,/* (x86) Power-management controller (PMC) */ UCLASS_ADC ,/* Analog-to-digital converter */ UCLASS_AHCI ,/* SATA disk controller */ UCLASS_AUDIO_CODEC, /* Audio codec with control and data path */
include/power/acpi_pmc.h new file +185 -0
185 lines not on this page · raw message
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 20/100 x86: sandbox: Add a PMC emulator and test
In reply to Simon GlassAdd a simple PMC for sandbox to permit tests to run.
---
Changes in v4: None
Changes in v3:
- Rename power-mgr uclass to acpi-pmc
- Tidy up Makefile rules to reduce duplication
Changes in v2: None
arch/Kconfig | 2 + arch/sandbox/dts/sandbox.dtsi | 14 ++ arch/sandbox/dts/test.dts | 14 ++ arch/sandbox/include/asm/test.h | 1 + drivers/Makefile | 1 + drivers/power/acpi_pmc/Kconfig | 9 ++ drivers/power/acpi_pmc/Makefile | 1 + drivers/power/acpi_pmc/pmc_emul.c | 246 ++++++++++++++++++++++++++++++ drivers/power/acpi_pmc/sandbox.c | 97 ++++++++++++ test/dm/Makefile | 1 + test/dm/pmc.c | 33 ++++ 11 files changed, 419 insertions(+) create mode 100644 drivers/power/acpi_pmc/pmc_emul.c create mode 100644 drivers/power/acpi_pmc/sandbox.c create mode 100644 test/dm/pmc.c
arch/Kconfig +2 -0
@@ -133,6 +133,8 @@ config SANDBOX imply PHYLIB imply DM_MDIO imply DM_MDIO_MUX + imply ACPI_PMC + imply ACPI_PMC_SANDBOX config SH bool "SuperH architecture"
arch/sandbox/dts/sandbox.dtsi +14 -0
@@ -100,6 +100,17 @@ }; pci-controller { + pci at 1e,0 { + compatible = "sandbox,pmc"; + reg = <0xf000 0 0 0 0>; + sandbox,emul = <&pmc_emul>; + gpe0-dwx-mask = <0xf>; + gpe0-dwx-shift-base = <4>; + gpe0-dw = <6 7 9>; + gpe0-sts = <0x20>; + gpe0-en = <0x30>; + }; + pci at 1f,0 { compatible = "pci-generic"; reg = <0xf800 0 0 0 0>;
@@ -109,6 +120,9 @@ emul { compatible = "sandbox,pci-emul-parent"; + pmc_emul: emul at 1e,0 { + compatible = "sandbox,pmc-emul"; + }; swap_case_emul: emul at 1f,0 { compatible = "sandbox,swap-case"; };
arch/sandbox/dts/test.dts +14 -0
@@ -471,6 +471,17 @@ 0x01000810 0 0 0 0>; sandbox,emul = <&swap_case_emul0_1>; }; + pci at 1e,0 { + compatible = "sandbox,pmc"; + reg = <0xf000 0 0 0 0>; + sandbox,emul = <&pmc_emul1e>; + acpi-base = <0x400>; + gpe0-dwx-mask = <0xf>; + gpe0-dwx-shift-base = <4>; + gpe0-dw = <6 7 9>; + gpe0-sts = <0x20>; + gpe0-en = <0x30>; + }; pci at 1f,0 { compatible = "pci-generic"; /* reg 0 is at 0x10, using FDT_PCI_SPACE_IO */
@@ -491,6 +502,9 @@ swap_case_emul0_1f: emul0 at 1f,0 { compatible = "sandbox,swap-case"; }; + pmc_emul1e: emul at 1e,0 { + compatible = "sandbox,pmc-emul"; + }; }; pci1: pci-controller1 {
arch/sandbox/include/asm/test.h +1 -0
@@ -13,6 +13,7 @@#define SANDBOX_PCI_VENDOR_ID 0x1234#define SANDBOX_PCI_SWAP_CASE_EMUL_ID 0x5678 +#define SANDBOX_PCI_PMC_EMUL_ID 0x5677#define SANDBOX_PCI_CLASS_CODE PCI_CLASS_CODE_COMM#define SANDBOX_PCI_CLASS_SUB_CODE PCI_CLASS_SUB_CODE_COMM_SERIAL
drivers/Makefile +1 -0
@@ -26,6 +26,7 @@ obj-$(CONFIG_$(SPL_TPL_)VIRTIO) += virtio/ obj-$(CONFIG_$(SPL_)DM_MAILBOX) += mailbox/ obj-$(CONFIG_$(SPL_)REMOTEPROC) += remoteproc/ obj-$(CONFIG_$(SPL_TPL_)TPM) += tpm/ +obj-$(CONFIG_$(SPL_TPL_)ACPI_PMC) += power/acpi_pmc/ ifndef CONFIG_TPL_BUILD ifdef CONFIG_SPL_BUILD
drivers/power/acpi_pmc/Kconfig +9 -0
@@ -23,3 +23,12 @@ config TPL_ACPI_PMC provides features including checking whether the system started from resume, powering off the system and enabling/disabling the reset mechanism. + +config ACPI_PMC_SANDBOX + bool "Test power manager (PMC) for sandbox" + depends on ACPI_PMC && SANDBOX + help + This driver emulates a PMC (Power-Management Controller) so that + the uclass logic can be tested. You can use the 'pmc' command to + access information from the driver. It uses I/O access to read + from the PMC.
drivers/power/acpi_pmc/Makefile +1 -0
@@ -3,3 +3,4 @@ # Copyright 2019 Google LLC obj-$(CONFIG_$(SPL_TPL_)ACPI_PMC) += acpi-pmc-uclass.o +obj-$(CONFIG_$(SPL_TPL_)ACPI_PMC_SANDBOX) += sandbox.o pmc_emul.o
drivers/power/acpi_pmc/pmc_emul.c new file +246 -0
246 lines not on this page · raw message
drivers/power/acpi_pmc/sandbox.c new file +97 -0
97 lines not on this page · raw message
test/dm/Makefile +1 -0
@@ -36,6 +36,7 @@ obj-$(CONFIG_PCI_ENDPOINT) += pci_ep.o obj-$(CONFIG_PCH) += pch.o obj-$(CONFIG_PHY) += phy.o obj-$(CONFIG_POWER_DOMAIN) += power-domain.o +obj-$(CONFIG_ACPI_PMC) += pmc.o obj-$(CONFIG_DM_PWM) += pwm.o obj-$(CONFIG_RAM) += ram.o obj-y += regmap.o
test/dm/pmc.c new file +33 -0
@@ -0,0 +1,33 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Test for power-management controller uclass (PMC) +* +* Copyright 2019 Google LLC +*/ + +#include <common.h> +#include <dm.h> +#include <power/acpi_pmc.h> +#include <dm/test.h> +#include <test/ut.h> + +/* Base test of the PMC uclass */ +static int dm_test_pmc_base (struct unit_test_state *uts) +{ +struct acpi_pmc_upriv *upriv; +struct udevice *dev; + +ut_assertok (uclass_first_device_err (UCLASS_ACPI_PMC , &dev)); + +ut_assertok (pmc_disable_tco (dev)); +ut_assertok (pmc_init (dev)); +ut_assertok (pmc_prev_sleep_state (dev)); + +/* Check some values to see that I/O works */ + upriv =dev_get_uclass_priv (dev); +ut_asserteq (0x24 , upriv->gpe0_sts[1 ]); +ut_asserteq (0x64 , upriv->tco1_sts); + +return 0 ; +} +DM_TEST (dm_test_pmc_base,DM_TESTF_SCAN_PDATA |DM_TESTF_SCAN_FDT );
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 21/100 x86: power: Add a 'pmc' command
In reply to Simon GlassAdd a simple command to show information about the PMC.
---
Changes in v4: None
Changes in v3:
- Rename power-mgr uclass to acpi-pmc
Changes in v2: None
arch/Kconfig | 1 + cmd/Kconfig | 8 ++++++ cmd/Makefile | 1 + cmd/pmc.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 91 insertions(+) create mode 100644 cmd/pmc.c
arch/Kconfig +1 -0
@@ -135,6 +135,7 @@ config SANDBOX imply DM_MDIO_MUX imply ACPI_PMC imply ACPI_PMC_SANDBOX + imply CMD_PMC config SH bool "SuperH architecture"
cmd/Kconfig +8 -0
@@ -228,6 +228,14 @@ config CMD_LICENSE help Print GPL license text +config CMD_PMC + bool "pmc" + help + Provides access to the Intel Power-Management Controller (PMC) so + that its state can be examined. This does not currently support + changing the state but it is still useful for debugging and seeing + what is going on. + config CMD_REGINFO bool "reginfo" depends on PPC
cmd/Makefile +1 -0
@@ -108,6 +108,7 @@ ifdef CONFIG_PCI obj-$(CONFIG_CMD_PCI) += pci.o endif obj-$(CONFIG_CMD_PINMUX) += pinmux.o +obj-$(CONFIG_CMD_PMC) += pmc.o obj-$(CONFIG_CMD_PXE) += pxe.o obj-$(CONFIG_CMD_WOL) += wol.o obj-$(CONFIG_CMD_QFW) += qfw.o
cmd/pmc.c new file +81 -0
81 lines not on this page · raw message
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 22/100 pci: Add support for p2sb uclass
In reply to Simon GlassThe Primary-to-Sideband bus (P2SB) is used to access various peripherals through memory-mapped I/O in a large chunk of PCI space. The space is segmented into different channels and peripherals are accessed by device-specific means within those channels. Devices should be added in the device tree as subnodes of the p2sb.
This adds a uclass and enables it for sandbox.
---
Changes in v4:
- Adjust condition for binding children
Changes in v3: None
Changes in v2: None
configs/sandbox_defconfig | 1 + configs/sandbox_spl_defconfig | 1 + drivers/misc/Kconfig | 33 ++++++ drivers/misc/Makefile | 1 + drivers/misc/p2sb-uclass.c | 209 ++++++++++++++++++++++++++++++++++ include/dm/uclass-id.h | 1 + include/p2sb.h | 127 +++++++++++++++++++++ 7 files changed, 373 insertions(+) create mode 100644 drivers/misc/p2sb-uclass.c create mode 100644 include/p2sb.h
configs/sandbox_defconfig +1 -0
@@ -149,6 +149,7 @@ CONFIG_PCI=y CONFIG_DM_PCI=y CONFIG_DM_PCI_COMPAT=y CONFIG_PCI_SANDBOX=y +CONFIG_P2SB=y CONFIG_PHY=y CONFIG_PHY_SANDBOX=y CONFIG_PINCTRL=y
configs/sandbox_spl_defconfig +1 -0
@@ -134,6 +134,7 @@ CONFIG_PCI=y CONFIG_DM_PCI=y CONFIG_DM_PCI_COMPAT=y CONFIG_PCI_SANDBOX=y +CONFIG_P2SB=y CONFIG_PHY=y CONFIG_PHY_SANDBOX=y CONFIG_PINCTRL=y
drivers/misc/Kconfig +33 -0
@@ -226,6 +226,39 @@ config NUVOTON_NCT6102D disable the legacy UART, the watchdog or other devices in the Nuvoton Super IO chips on X86 platforms. +config P2SB + bool "Intel Primary-to-Sideband Bus" + depends on X86 || SANDBOX + help + This enables support for the Intel Primary-to-Sideband bus, + abbreviated to P2SB. The P2SB is used to access various peripherals + such as eSPI, GPIO, through memory-mapped I/O in a large chunk of PCI + space. The space is segmented into different channels and peripherals + are accessed by device-specific means within those channels. Devices + should be added in the device tree as subnodes of the P2SB. A + Peripheral Channel Register? (PCR) API is provided to access those + devices - see pcr_readl(), etc. + +config SPL_P2SB + bool "Intel Primary-to-Sideband Bus in SPL" + depends on SPL && (X86 || SANDBOX) + help + The Primary-to-Sideband bus is used to access various peripherals + through memory-mapped I/O in a large chunk of PCI space. The space is + segmented into different channels and peripherals are accessed by + device-specific means within those channels. Devices should be added + in the device tree as subnodes of the p2sb. + +config TPL_P2SB + bool "Intel Primary-to-Sideband Bus in TPL" + depends on TPL && (X86 || SANDBOX) + help + The Primary-to-Sideband bus is used to access various peripherals + through memory-mapped I/O in a large chunk of PCI space. The space is + segmented into different channels and peripherals are accessed by + device-specific means within those channels. Devices should be added + in the device tree as subnodes of the p2sb. + config PWRSEQ bool "Enable power-sequencing drivers" depends on DM
drivers/misc/Makefile +1 -0
@@ -49,6 +49,7 @@ obj-$(CONFIG_MXC_OCOTP) += mxc_ocotp.o obj-$(CONFIG_MXS_OCOTP) += mxs_ocotp.o obj-$(CONFIG_NS87308) += ns87308.o obj-$(CONFIG_NUVOTON_NCT6102D) += nuvoton_nct6102d.o +obj-$(CONFIG_P2SB) += p2sb-uclass.o obj-$(CONFIG_PCA9551_LED) += pca9551_led.o obj-$(CONFIG_$(SPL_)PWRSEQ) += pwrseq-uclass.o obj-$(CONFIG_QFW) += qfw.o
drivers/misc/p2sb-uclass.c new file +209 -0
209 lines not on this page · raw message
include/dm/uclass-id.h +1 -0
@@ -70,6 +70,7 @@ enum uclass_id {UCLASS_NOP ,/* No-op devices */ UCLASS_NORTHBRIDGE ,/* Intel Northbridge / SDRAM controller */ UCLASS_NVME ,/* NVM Express device */ +UCLASS_P2SB ,/* (x86) Primary-to-Sideband Bus */ UCLASS_PANEL ,/* Display panel, such as an LCD */ UCLASS_PANEL_BACKLIGHT ,/* Backlight controller for panel */ UCLASS_PCH, /* x86 platform controller hub */
include/p2sb.h new file +127 -0
127 lines not on this page · raw message
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 23/100 sandbox: Disable mmio by default in tests
In reply to Simon GlassWhen reseting sandbox for tests, disable mmio support since that is the default state.
---
Changes in v4:
- Split out into a separate patch
Changes in v3: None
Changes in v2: None
arch/sandbox/cpu/state.c | 1 + 1 file changed, 1 insertion(+)
arch/sandbox/cpu/state.c +1 -0
@@ -356,6 +356,7 @@ void state_reset_for_test(struct sandbox_state *state)/* No reset yet, so mark it as such. Always allow power reset */ state->last_sysreset =SYSRESET_COUNT ; state->sysreset_allowed[SYSRESET_POWER_OFF ] = true; + state->allow_memio = false;memset (&state->wdt,'\0' ,sizeof (state->wdt));memset (state->spi,'\0' ,sizeof (state->spi));
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 24/100 sandbox: Add PCI driver and test for p2sb
In reply to Simon GlassAdd a sandbox driver and PCI-device emulator for p2sb. Also add a test which uses a simple 'adder' driver to test the p2sb functionality.
---
Changes in v4:
- Drop change to message about a missing uclass
- Drop empty operations struct since p2sb does not need it
- Drop pmic_pm8916 driver name and use a sandbox name instead
- Split out mmio changes into a separate patch
Changes in v3:
- Fix build errors in sandbox_spl, etc
Changes in v2: None
arch/sandbox/dts/test.dts | 13 ++ arch/sandbox/include/asm/test.h | 1 + configs/sandbox64_defconfig | 2 + configs/sandbox_defconfig | 3 +- configs/sandbox_flattree_defconfig | 3 + configs/sandbox_spl_defconfig | 2 + configs/tools-only_defconfig | 2 + drivers/misc/Makefile | 2 + drivers/misc/p2sb_emul.c | 272 +++++++++++++++++++++++++++++ drivers/misc/p2sb_sandbox.c | 40 +++++ drivers/misc/sandbox_adder.c | 60 +++++++ test/dm/Makefile | 1 + test/dm/p2sb.c | 28 +++ 13 files changed, 428 insertions(+), 1 deletion(-) 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 test/dm/p2sb.c
arch/sandbox/dts/test.dts +13 -0
@@ -471,6 +471,16 @@ 0x01000810 0 0 0 0>; sandbox,emul = <&swap_case_emul0_1>; }; + p2sb-pci at 2,0 { + compatible = "sandbox,p2sb"; + reg = <0x02001010 0 0 0 0>; + sandbox,emul = <&p2sb_emul>; + + adder { + intel,p2sb-port-id = <3>; + compatible = "sandbox,adder"; + }; + }; pci at 1e,0 { compatible = "sandbox,pmc"; reg = <0xf000 0 0 0 0>;
@@ -502,6 +512,9 @@ swap_case_emul0_1f: emul0 at 1f,0 { compatible = "sandbox,swap-case"; }; + p2sb_emul: emul at 2,0 { + compatible = "sandbox,p2sb-emul"; + }; pmc_emul1e: emul at 1e,0 { compatible = "sandbox,pmc-emul"; };
arch/sandbox/include/asm/test.h +1 -0
@@ -14,6 +14,7 @@#define SANDBOX_PCI_VENDOR_ID 0x1234#define SANDBOX_PCI_SWAP_CASE_EMUL_ID 0x5678#define SANDBOX_PCI_PMC_EMUL_ID 0x5677 +#define SANDBOX_PCI_P2SB_EMUL_ID 0x5676#define SANDBOX_PCI_CLASS_CODE PCI_CLASS_CODE_COMM#define SANDBOX_PCI_CLASS_SUB_CODE PCI_CLASS_SUB_CODE_COMM_SERIAL
configs/sandbox64_defconfig +2 -0
@@ -81,6 +81,8 @@ CONFIG_DEVRES=y CONFIG_DEBUG_DEVRES=y CONFIG_ADC=y CONFIG_ADC_SANDBOX=y +CONFIG_AXI=y +CONFIG_AXI_SANDBOX=y CONFIG_CLK=y CONFIG_CPU=y CONFIG_DM_DEMO=y
configs/sandbox_defconfig +2 -1
@@ -130,6 +130,8 @@ CONFIG_CROS_EC_I2C=y CONFIG_CROS_EC_LPC=y CONFIG_CROS_EC_SANDBOX=y CONFIG_CROS_EC_SPI=y +CONFIG_IRQ=y +CONFIG_P2SB=y CONFIG_PWRSEQ=y CONFIG_SPL_PWRSEQ=y CONFIG_I2C_EEPROM=y
@@ -149,7 +151,6 @@ CONFIG_PCI=y CONFIG_DM_PCI=y CONFIG_DM_PCI_COMPAT=y CONFIG_PCI_SANDBOX=y -CONFIG_P2SB=y CONFIG_PHY=y CONFIG_PHY_SANDBOX=y CONFIG_PINCTRL=y
configs/sandbox_flattree_defconfig +3 -0
@@ -65,6 +65,8 @@ CONFIG_DEVRES=y CONFIG_DEBUG_DEVRES=y CONFIG_ADC=y CONFIG_ADC_SANDBOX=y +CONFIG_AXI=y +CONFIG_AXI_SANDBOX=y CONFIG_CLK=y CONFIG_CLK_COMPOSITE_CCF=y CONFIG_SANDBOX_CLK_CCF=y
@@ -115,6 +117,7 @@ CONFIG_PCI=y CONFIG_DM_PCI=y CONFIG_DM_PCI_COMPAT=y CONFIG_PCI_SANDBOX=y +CONFIG_P2SB=y CONFIG_PHY=y CONFIG_PHY_SANDBOX=y CONFIG_PINCTRL=y
configs/sandbox_spl_defconfig +2 -0
@@ -86,6 +86,8 @@ CONFIG_DEBUG_DEVRES=y # CONFIG_SPL_SIMPLE_BUS is not set CONFIG_ADC=y CONFIG_ADC_SANDBOX=y +CONFIG_AXI=y +CONFIG_AXI_SANDBOX=y CONFIG_CLK=y CONFIG_CPU=y CONFIG_DM_DEMO=y
configs/tools-only_defconfig +2 -0
@@ -11,6 +11,8 @@ CONFIG_OF_HOSTFILE=y CONFIG_DEFAULT_DEVICE_TREE="sandbox" CONFIG_IP_DEFRAG=y # CONFIG_UDP_FUNCTION_FASTBOOT is not set +CONFIG_AXI=y +CONFIG_AXI_SANDBOX=y CONFIG_SANDBOX_GPIO=y CONFIG_PCI=y CONFIG_DM_PCI=y
drivers/misc/Makefile +2 -0
@@ -10,8 +10,10 @@ obj-$(CONFIG_$(SPL_TPL_)CROS_EC_SANDBOX) += cros_ec_sandbox.o obj-$(CONFIG_$(SPL_TPL_)CROS_EC_LPC) += cros_ec_lpc.o ifndef CONFIG_SPL_BUILD +obj-$(CONFIG_SANDBOX) += sandbox_adder.o obj-$(CONFIG_CROS_EC_I2C) += cros_ec_i2c.o obj-$(CONFIG_CROS_EC_SPI) += cros_ec_spi.o +obj-$(CONFIG_SANDBOX) += p2sb_sandbox.o p2sb_emul.o obj-$(CONFIG_SANDBOX) += swap_case.o endif
drivers/misc/p2sb_emul.c new file +272 -0
272 lines not on this page · raw message
drivers/misc/p2sb_sandbox.c new file +40 -0
@@ -0,0 +1,40 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Sandbox P2SB for testing +* +* Copyright 2019 Google LLC +*/ + +#define LOG_CATEGORY UCLASS_P2SB + +#include <common.h> +#include <dm.h> +#include <asm/io.h> +#include <p2sb.h> + +struct sandbox_p2sb_priv { +ulong base; +}; + +static int sandbox_p2sb_probe (struct udevice *dev) +{ +struct p2sb_uc_priv *upriv =dev_get_uclass_priv (dev); + + upriv->mmio_base =dm_pci_read_bar32 (dev,0 ); +printf ("mmio base %x\n" , upriv->mmio_base); + +return 0 ; +} + +static const struct udevice_id sandbox_p2sb_ids[] = { + { .compatible ="sandbox,p2sb" }, + { } +}; + +U_BOOT_DRIVER (p2sb_sandbox) = { + .name ="p2sb_sandbox" , + .id =UCLASS_P2SB , + .of_match = sandbox_p2sb_ids, + .probe = sandbox_p2sb_probe, + .priv_auto_alloc_size =sizeof (struct sandbox_p2sb_priv ), +};
drivers/misc/sandbox_adder.c new file +60 -0
60 lines not on this page · raw message
test/dm/Makefile +1 -0
@@ -32,6 +32,7 @@ obj-y += ofnode.o obj-$(CONFIG_OSD) += osd.o obj-$(CONFIG_DM_VIDEO) += panel.o obj-$(CONFIG_DM_PCI) += pci.o +obj-$(CONFIG_P2SB) += p2sb.o obj-$(CONFIG_PCI_ENDPOINT) += pci_ep.o obj-$(CONFIG_PCH) += pch.o obj-$(CONFIG_PHY) += phy.o
test/dm/p2sb.c new file +28 -0
@@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Test for Primary-to-Sideband bus (P2SB) +* +* Copyright 2019 Google LLC +*/ + +#include <common.h> +#include <dm.h> +#include <p2sb.h> +#include <asm/test.h> +#include <dm/test.h> +#include <test/ut.h> + +/* Base test of the PMC uclass */ +static int dm_test_p2sb_base (struct unit_test_state *uts) +{ +struct udevice *dev; + +sandbox_set_enable_memio (true); +ut_assertok (uclass_get_device_by_name (UCLASS_AXI ,"adder" , &dev)); +ut_asserteq (0x03000004 ,pcr_read32 (dev,4 )); +ut_asserteq (0x300 ,pcr_read16 (dev,6 )); +ut_asserteq (4 ,pcr_read8 (dev,4 )); + +return 0 ; +} +DM_TEST (dm_test_p2sb_base,DM_TESTF_SCAN_PDATA |DM_TESTF_SCAN_FDT );
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 25/100 x86: Move UCLASS_IRQ into a separate file
In reply to Simon GlassUpdate this uclass to support the needs of the Apollo Lake ITSS. It supports four operations.
Move the uclass into a separate directory so that sandbox can use it too. Add a new Kconfig to control it and enable this on x86.
---
Changes in v4:
- Drop itss uclass in Makefile
- Fix 'enabled' typo
- apollolake -> Apollo Lake
Changes in v3:
- Add two more operations to IRQ
- Use the IRQ uclass instead of creating a new ITSS uclass
Changes in v2: None
arch/Kconfig | 1 + arch/x86/cpu/irq.c | 5 --- drivers/misc/Kconfig | 9 ++++ drivers/misc/Makefile | 1 + drivers/misc/irq-uclass.c | 53 +++++++++++++++++++++++ include/irq.h | 88 +++++++++++++++++++++++++++++++++++++++ 6 files changed, 152 insertions(+), 5 deletions(-) create mode 100644 drivers/misc/irq-uclass.c create mode 100644 include/irq.h
arch/Kconfig +1 -0
@@ -186,6 +186,7 @@ config X86 imply USB_HOST_ETHER imply PCH imply RTC_MC146818 + imply IRQ # Thing to enable for when SPL/TPL are enabled: SPL imply SPL_DM
arch/x86/cpu/irq.c +0 -5
@@ -370,8 +370,3 @@ U_BOOT_DRIVER(irq_router_drv) = { .probe = irq_router_probe, .priv_auto_alloc_size = sizeof(struct irq_router), }; - -UCLASS_DRIVER (irq) = { - .id =UCLASS_IRQ , - .name ="irq" , -};
drivers/misc/Kconfig +9 -0
@@ -203,6 +203,15 @@ config FSL_SEC_MON Security Monitor can be transitioned on any security failures, like software violations or hardware security violations. +config IRQ + bool "Intel Interrupt controller" + depends on X86 || SANDBOX + help + This enables support for Intel interrupt controllers, including ITSS. + Some devices have extra features, such as Apollo Lake. The + device has its own uclass since there are several operations + involved. + config JZ4780_EFUSE bool "Ingenic JZ4780 eFUSE support" depends on ARCH_JZ47XX
drivers/misc/Makefile +1 -0
@@ -41,6 +41,7 @@ obj-$(CONFIG_FS_LOADER) += fs_loader.o obj-$(CONFIG_GDSYS_IOEP) += gdsys_ioep.o obj-$(CONFIG_GDSYS_RXAUI_CTRL) += gdsys_rxaui_ctrl.o obj-$(CONFIG_GDSYS_SOC) += gdsys_soc.o +obj-$(CONFIG_IRQ) += irq-uclass.o obj-$(CONFIG_$(SPL_)I2C_EEPROM) += i2c_eeprom.o obj-$(CONFIG_IHS_FPGA) += ihs_fpga.o obj-$(CONFIG_IMX8) += imx8/
drivers/misc/irq-uclass.c new file +53 -0
53 lines not on this page · raw message
include/irq.h new file +88 -0
88 lines not on this page · raw message
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 26/100 sandbox: Add a test for IRQ
In reply to Simon GlassAdd a simple sandbox test for this uclass.
---
Changes in v4:
- Drop itss uclass change in Makefile (now in previous patch)
- Drop sandbox defconfig change now that p2sb change is correct
- Enable IRQ for sandbox64 too to avoid build error
Changes in v3:
- Change the sandbox test from ITSS to IRQ
Changes in v2: None
arch/sandbox/dts/test.dts | 4 +++ configs/sandbox64_defconfig | 1 + configs/sandbox_flattree_defconfig | 1 + configs/sandbox_spl_defconfig | 1 + drivers/misc/Makefile | 1 + drivers/misc/irq_sandbox.c | 55 ++++++++++++++++++++++++++++++ test/dm/Makefile | 1 + test/dm/irq.c | 32 +++++++++++++++++ 8 files changed, 96 insertions(+) create mode 100644 drivers/misc/irq_sandbox.c create mode 100644 test/dm/irq.c
arch/sandbox/dts/test.dts +4 -0
@@ -353,6 +353,10 @@ vss-microvolts = <0>; }; + irq { + compatible = "sandbox,irq"; + }; + lcd { u-boot,dm-pre-reloc; compatible = "sandbox,lcd-sdl";
configs/sandbox64_defconfig +1 -0
@@ -112,6 +112,7 @@ CONFIG_CROS_EC_I2C=y CONFIG_CROS_EC_LPC=y CONFIG_CROS_EC_SANDBOX=y CONFIG_CROS_EC_SPI=y +CONFIG_IRQ=y CONFIG_PWRSEQ=y CONFIG_SPL_PWRSEQ=y CONFIG_I2C_EEPROM=y
configs/sandbox_flattree_defconfig +1 -0
@@ -98,6 +98,7 @@ CONFIG_CROS_EC_I2C=y CONFIG_CROS_EC_LPC=y CONFIG_CROS_EC_SANDBOX=y CONFIG_CROS_EC_SPI=y +CONFIG_IRQ=y CONFIG_PWRSEQ=y CONFIG_SPL_PWRSEQ=y CONFIG_I2C_EEPROM=y
configs/sandbox_spl_defconfig +1 -0
@@ -118,6 +118,7 @@ CONFIG_CROS_EC_I2C=y CONFIG_CROS_EC_LPC=y CONFIG_CROS_EC_SANDBOX=y CONFIG_CROS_EC_SPI=y +CONFIG_IRQ=y CONFIG_PWRSEQ=y CONFIG_SPL_PWRSEQ=y CONFIG_MMC_SANDBOX=y
drivers/misc/Makefile +1 -0
@@ -42,6 +42,7 @@ obj-$(CONFIG_GDSYS_IOEP) += gdsys_ioep.o obj-$(CONFIG_GDSYS_RXAUI_CTRL) += gdsys_rxaui_ctrl.o obj-$(CONFIG_GDSYS_SOC) += gdsys_soc.o obj-$(CONFIG_IRQ) += irq-uclass.o +obj-$(CONFIG_SANDBOX) += irq_sandbox.o obj-$(CONFIG_$(SPL_)I2C_EEPROM) += i2c_eeprom.o obj-$(CONFIG_IHS_FPGA) += ihs_fpga.o obj-$(CONFIG_IMX8) += imx8/
drivers/misc/irq_sandbox.c new file +55 -0
55 lines not on this page · raw message
test/dm/Makefile +1 -0
@@ -25,6 +25,7 @@ obj-$(CONFIG_DM_GPIO) += gpio.o obj-$(CONFIG_DM_HWSPINLOCK) += hwspinlock.o obj-$(CONFIG_DM_I2C) += i2c.o obj-$(CONFIG_SOUND) += i2s.o +obj-y += irq.o obj-$(CONFIG_LED) += led.o obj-$(CONFIG_DM_MAILBOX) += mailbox.o obj-$(CONFIG_DM_MMC) += mmc.o
test/dm/irq.c new file +32 -0
@@ -0,0 +1,32 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Test for irq uclass +* +* Copyright 2019 Google LLC +*/ + +#include <common.h> +#include <dm.h> +#include <irq.h> +#include <dm/test.h> +#include <test/ut.h> + +/* Base test of the irq uclass */ +static int dm_test_irq_base (struct unit_test_state *uts) +{ +struct udevice *dev; + +ut_assertok (uclass_first_device_err (UCLASS_IRQ , &dev)); + +ut_asserteq (5 ,irq_route_pmc_gpio_gpe (dev,4 )); +ut_asserteq (-ENOENT ,irq_route_pmc_gpio_gpe (dev,14 )); + +ut_assertok (irq_set_polarity (dev,4 , true)); +ut_asserteq (-EINVAL ,irq_set_polarity (dev,14 , true)); + +ut_assertok (irq_snapshot_polarities (dev)); +ut_assertok (irq_restore_polarities (dev)); + +return 0 ; +} +DM_TEST (dm_test_irq_base,DM_TESTF_SCAN_PDATA |DM_TESTF_SCAN_FDT );
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 27/100 x86: Define the SPL image start
In reply to Simon GlassDefine this symbol so that we can use binman symbols correctly.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
arch/x86/cpu/u-boot-spl.lds | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/x86/cpu/u-boot-spl.lds +4 -1
@@ -17,7 +17,10 @@ SECTIONS . = IMAGE_TEXT_BASE; /* Location of bootcode in flash */ __text_start = .; - .text : { *(.text*); } + .text : { + __image_copy_start = .; + *(.text*); + } . = ALIGN(4);
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 28/100 x86: Reduce mrccache record alignment size
In reply to Simon GlassAt present the records are 4KB in size. This is unnecessarily large when the SPI-flash erase size is 256 bytes. Reduce it so it will be more efficient with Apollo Lake's 24-byte variable-data record.
---
Changes in v4:
- apollolake -> Apollo Lake
Changes in v3: None
Changes in v2: None
arch/x86/include/asm/mrccache.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/mrccache.h +1 -1
@@ -7,7 +7,7 @@#ifndef _ASM_MRCCACHE_H#define _ASM_MRCCACHE_H -#define MRC_DATA_ALIGN 0x1000 +#define MRC_DATA_ALIGN 0x100#define MRC_DATA_SIGNATURE (('M' << 0) | ('R' << 8) | \ ('C' << 16) | ('D'<<24))
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 29/100 x86: Correct mrccache find_next_mrc_cache() calculation
In reply to Simon GlassThis should take account of the end of the new cache record since a record cannot extend beyond the end of the flash region. This problem was not seen before due to the alignment of the relatively small amount of MRC data.
But with Apollo Lake the MRC data is about 45KB, even if most of it is zeroes.
Fix this bug and update the parameter name to be less confusing.
---
Changes in v4:
- Add comments about MRC-cache records being the same size
- apollolake -> Apollo Lake
Changes in v3:
- Add an extra size parameter to the find_next_mrc_cache() function
Changes in v2: None
arch/x86/lib/mrccache.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
arch/x86/lib/mrccache.c +14 -4
@@ -80,21 +80,31 @@ struct mrc_data_container *mrccache_find_current(struct mrc_region *entry)/** * find_next_mrc_cache() - get next cache entry * +* This moves to the next cache entry in the region, making sure it has enough +* space to hold data of size @data_size. +* * @entry: MRC cache flash area * @cache: Entry to start from +* @data_size: Required data size of the new entry. Note that we assume that +* all cache entries are the same size * * @return next cache entry if found, NULL if we got to the end */ static struct mrc_data_container *find_next_mrc_cache (struct mrc_region *entry, -struct mrc_data_container *cache) +struct mrc_data_container *prev,int data_size) { +struct mrc_data_container *cache;ulong base_addr, end_addr; base_addr = entry->base + entry->offset; end_addr = base_addr + entry->length; - cache =next_mrc_block (cache); -if ((ulong )cache >= end_addr) { +/* +* We assume that all cache entries are the same size, but let's use +* data_size here for clarity. +*/ + cache =next_mrc_block (prev); +if ((ulong )cache +mrc_block_size (data_size) > end_addr) {/* Crossed the boundary */ cache =NULL ;debug ("%s: no available entries found\n" , __func__);
@@ -131,7 +141,7 @@ int mrccache_update(struct udevice *sf, struct mrc_region *entry,/* Move to the next block, which will be the first unused block */ if (cache) - cache =find_next_mrc_cache (entry, cache); + cache =find_next_mrc_cache (entry, cache, cur->data_size);/* * If we have got to the end, erase the entire mrc-cache area and start
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 30/100 x86: Adjust mrccache_get_region() to use livetree
In reply to Simon GlassChange the algorithm to first find the flash device then read the properties using the livetree API. With this change the device is not probed so this needs to be done in mrccache_save().
---
Changes in v4: None
Changes in v3:
- Update mrccache livetree patch to just convert to livetree
Changes in v2: None
arch/x86/lib/mrccache.c | 55 +++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 29 deletions(-)
arch/x86/lib/mrccache.c +26 -29
@@ -14,6 +14,8 @@#include <spi.h> #include <spi_flash.h> #include <asm/mrccache.h> +#include <dm/device-internal.h> +#include <dm/uclass-internal.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -206,45 +208,37 @@ int mrccache_reserve(void)int mrccache_get_region (struct udevice **devp,struct mrc_region *entry) { -const void *blob = gd->fdt_blob; -int node, mrc_node; +struct udevice *dev; +ofnode mrc_node;u32 reg[2 ];int ret; -/* Find the flash chip within the SPI controller node */ - node =fdtdec_next_compatible (blob,0 ,COMPAT_GENERIC_SPI_FLASH ); -if (node <0 ) { -debug ("%s: Cannot find SPI flash\n" , __func__); -return -ENOENT ; - } - -if (fdtdec_get_int_array (blob, node,"memory-map" , reg,2 )) { -debug ("%s: Cannot find memory map\n" , __func__); -return -EINVAL ; - } +/* +* Find the flash chip within the SPI controller node. Avoid probing +* the device here since it may put it into a strange state where the +* memory map cannot be read. +*/ + ret =uclass_find_first_device (UCLASS_SPI_FLASH , &dev); +if (ret) +return log_msg_ret ("Cannot find SPI flash\n" , ret); + ret =dev_read_u32_array (dev,"memory-map" , reg,2 ); +if (ret) +return log_msg_ret ("Cannot find memory map\n" , ret); entry->base = reg[0 ];/* Find the place where we put the MRC cache */ - mrc_node =fdt_subnode_offset (blob, node,"rw-mrc-cache" ); -if (mrc_node <0 ) { -debug ("%s: Cannot find node\n" , __func__); -return -EPERM ; - } + mrc_node =dev_read_subnode (dev,"rw-mrc-cache" ); +if (!ofnode_valid (mrc_node)) +return log_msg_ret ("Cannot find node" , -EPERM ); -if (fdtdec_get_int_array (blob, mrc_node,"reg" , reg,2 )) { -debug ("%s: Cannot find address\n" , __func__); -return -EINVAL ; - } + ret =ofnode_read_u32_array (mrc_node,"reg" , reg,2 ); +if (ret) +return log_msg_ret ("Cannot find address" , ret); entry->offset = reg[0 ]; entry->length = reg[1 ]; -if (devp) { - ret =uclass_get_device_by_of_offset (UCLASS_SPI_FLASH , node, - devp); -debug ("ret = %d\n" , ret); -if (ret) -return ret; - } +if (devp) + *devp = dev;return 0 ; }
@@ -262,6 +256,9 @@ int mrccache_save(void) gd->arch.mrc_output_len); ret =mrccache_get_region (&sf, &entry); +if (ret) + goto err_entry; + ret =device_probe (sf);if (ret) goto err_entry; data = (struct mrc_data_container *)gd->arch.mrc_output;
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 31/100 x86: Adjust mrccache_get_region() to support get_mmap()
In reply to Simon GlassIt is now possible to obtain the memory map for a SPI controllers instead of having it hard-coded in the device tree. Update the code to support this.
---
Changes in v4: None
Changes in v3: None
Changes in v2:
- Use SPI mmap() instead of SPI flash
arch/x86/lib/mrccache.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
arch/x86/lib/mrccache.c +14 -4
@@ -210,6 +210,9 @@ int mrccache_get_region(struct udevice **devp, struct mrc_region *entry) {struct udevice *dev;ofnode mrc_node; +ulong map_base; +uint map_size; +uint offset;u32 reg[2 ];int ret;
@@ -221,10 +224,15 @@ int mrccache_get_region(struct udevice **devp, struct mrc_region *entry) ret =uclass_find_first_device (UCLASS_SPI_FLASH , &dev);if (ret)return log_msg_ret ("Cannot find SPI flash\n" , ret); - ret =dev_read_u32_array (dev,"memory-map" , reg,2 ); -if (ret) -return log_msg_ret ("Cannot find memory map\n" , ret); - entry->base = reg[0 ]; + ret =dm_spi_get_mmap (dev, &map_base, &map_size, &offset); +if (!ret) { + entry->base = map_base; + }else { + ret =dev_read_u32_array (dev,"memory-map" , reg,2 ); +if (ret) +return log_msg_ret ("Cannot find memory map\n" , ret); + entry->base = reg[0 ]; + }/* Find the place where we put the MRC cache */ mrc_node =dev_read_subnode (dev,"rw-mrc-cache" );
@@ -239,6 +247,8 @@ int mrccache_get_region(struct udevice **devp, struct mrc_region *entry)if (devp) *devp = dev; +debug ("MRC cache in '%s', offset %x, len %x, base %x\n" , + dev->name, entry->offset, entry->length, entry->base);return 0 ; }
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 32/100 x86: Add a new global_data member for the cache record
In reply to Simon GlassAt present we reuse the mrc_output char * to also point to the cache record after it has been set up. This is confusing and doesn't save much data space.
Add a new mrc_cache member instead.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
arch/x86/include/asm/global_data.h | 2 ++ arch/x86/lib/mrccache.c | 11 +++++------ 2 files changed, 7 insertions(+), 6 deletions(-)
arch/x86/include/asm/global_data.h +2 -0
@@ -10,6 +10,7 @@#ifndef __ASSEMBLY__#include <asm/processor.h> +#include <asm/mrccache.h> enum pei_boot_mode_t { PEI_BOOT_NONE = 0,
@@ -93,6 +94,7 @@ struct arch_global_data {/* MRC training data to save for the next boot */ char *mrc_output;unsigned int mrc_output_len; +struct mrc_data_container *mrc_cache;ulong table;/* Table pointer from previous loader */ int turbo_state;/* Current turbo state */ struct irq_routing_table *pirq_routing_table;
arch/x86/lib/mrccache.c +5 -6
@@ -188,8 +188,7 @@ static void mrccache_setup(void *data) cache->reserved =0 ;memcpy (cache->data, gd->arch.mrc_output, cache->data_size); -/* gd->arch.mrc_output now points to the container */ - gd->arch.mrc_output = (char *)cache; + gd->arch.mrc_cache = cache; }int mrccache_reserve (void )
@@ -255,7 +254,7 @@ int mrccache_get_region(struct udevice **devp, struct mrc_region *entry)int mrccache_save (void ) { -struct mrc_data_container *data; +struct mrc_data_container *cache;struct mrc_region entry;struct udevice *sf;int ret;
@@ -271,10 +270,10 @@ int mrccache_save(void) ret =device_probe (sf);if (ret) goto err_entry; - data = (struct mrc_data_container *)gd->arch.mrc_output; - ret =mrccache_update (sf, &entry, data); + cache = gd->arch.mrc_cache; + ret =mrccache_update (sf, &entry, cache);if (!ret) { -debug ("Saved MRC data with checksum %04x\n" , data->checksum); +debug ("Saved MRC data with checksum %04x\n" , cache->checksum); }else if (ret == -EEXIST ) {debug ("MRC data is the same as last time, skipping save\n" ); ret =0 ;
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 33/100 x86: Tidy up error handling in mrccache_save()
In reply to Simon GlassThis function is a bit confusing at present due to the error handling. Update it to remove the goto, returning errors as they happen.
While we are here, use hex for the data size since this is the norm in U-Boot.
---
Changes in v4: None
Changes in v3:
- Move an additional error handling fix from a future patch
Changes in v2: None
arch/x86/lib/mrccache.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-)
arch/x86/lib/mrccache.c +7 -12
@@ -168,7 +168,7 @@ int mrccache_update(struct udevice *sf, struct mrc_region *entry, cur);if (ret) {debug ("Failed to write to SPI flash\n" ); -return ret; +return log_msg_ret ("Cannot update mrccache" , ret); }return 0 ;
@@ -261,28 +261,23 @@ int mrccache_save(void)if (!gd->arch.mrc_output_len)return 0 ; -debug ("Saving %d bytes of MRC output data to SPI flash\n" , +debug ("Saving %#x bytes of MRC output data to SPI flash\n" , gd->arch.mrc_output_len); ret =mrccache_get_region (&sf, &entry);if (ret) - goto err_entry; +return log_msg_ret ("Cannot get region" , ret); ret =device_probe (sf);if (ret) - goto err_entry; +return log_msg_ret ("Cannot probe device" , ret); cache = gd->arch.mrc_cache; ret =mrccache_update (sf, &entry, cache); -if (!ret) { +if (!ret)debug ("Saved MRC data with checksum %04x\n" , cache->checksum); - }else if (ret == -EEXIST ) { +else if (ret == -EEXIST )debug ("MRC data is the same as last time, skipping save\n" ); - ret =0 ; - } -err_entry: -if (ret) -debug ("%s: Failed: %d\n" , __func__, ret); -return ret; +return 0 ; }int mrccache_spl_save (void )
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 34/100 x86: Update mrccache to support multiple caches
In reply to Simon GlassWith Apollo Lake we need to support a normal cache, which almost never changes and a much smaller 'variable' cache which changes every time.
Update the code to add a cache type, use an array for the caches and use a for loop to iterate over the caches.
---
Changes in v4:
- apollolake -> Apollo Lake
Changes in v3:
- Move line related to variable-cache into the next patch
Changes in v2: None
arch/x86/cpu/broadwell/sdram.c | 8 ++- arch/x86/cpu/ivybridge/sdram.c | 8 ++- arch/x86/cpu/quark/dram.c | 8 ++- arch/x86/include/asm/global_data.h | 21 +++++-- arch/x86/include/asm/mrccache.h | 11 +++- arch/x86/lib/fsp/fsp_common.c | 2 +- arch/x86/lib/fsp1/fsp_dram.c | 8 ++- arch/x86/lib/mrccache.c | 88 ++++++++++++++++++++---------- 8 files changed, 106 insertions(+), 48 deletions(-)
arch/x86/cpu/broadwell/sdram.c +5 -3
@@ -82,7 +82,7 @@ static int prepare_mrc_cache(struct pei_data *pei_data)struct mrc_region entry;int ret; - ret =mrccache_get_region (NULL , &entry); + ret =mrccache_get_region (MRC_TYPE_NORMAL ,NULL , &entry);if (ret)return ret; mrc_cache =mrccache_find_current (&entry);
@@ -168,12 +168,14 @@ int dram_init(void) pei_data->data_to_save);/* S3 resume: don't save scrambler seed or MRC data */ if (pei_data->boot_mode !=SLEEP_STATE_S3 ) { +struct mrc_output *mrc = &gd->arch.mrc[MRC_TYPE_NORMAL ]; +/* * This will be copied to SDRAM in reserve_arch(), then written * to SPI flash in mrccache_save() */ - gd->arch.mrc_output = (char *)pei_data->data_to_save; - gd->arch.mrc_output_len = pei_data->data_to_save_size; + mrc->buf = (char *)pei_data->data_to_save; + mrc->len = pei_data->data_to_save_size; } gd->arch.pei_meminfo = pei_data->meminfo;
arch/x86/cpu/ivybridge/sdram.c +5 -3
@@ -115,7 +115,7 @@ static int prepare_mrc_cache(struct pei_data *pei_data) ret =read_seed_from_cmos (pei_data);if (ret)return ret; - ret =mrccache_get_region (NULL , &entry); + ret =mrccache_get_region (MRC_TYPE_NORMAL ,NULL , &entry);if (ret)return ret; mrc_cache =mrccache_find_current (&entry);
@@ -537,12 +537,14 @@ int dram_init(void)/* S3 resume: don't save scrambler seed or MRC data */ if (pei_data->boot_mode !=PEI_BOOT_RESUME ) { +struct mrc_output *mrc = &gd->arch.mrc[MRC_TYPE_NORMAL ]; +/* * This will be copied to SDRAM in reserve_arch(), then written * to SPI flash in mrccache_save() */ - gd->arch.mrc_output = (char *)pei_data->mrc_output; - gd->arch.mrc_output_len = pei_data->mrc_output_len; + mrc->buf = (char *)pei_data->mrc_output; + mrc->len = pei_data->mrc_output_len; ret =write_seeds_to_cmos (pei_data);if (ret)debug ("Failed to write seeds to CMOS: %d\n" , ret);
arch/x86/cpu/quark/dram.c +5 -3
@@ -22,7 +22,7 @@ static __maybe_unused int prepare_mrc_cache(struct mrc_params *mrc_params)struct mrc_region entry;int ret; - ret =mrccache_get_region (NULL , &entry); + ret =mrccache_get_region (MRC_TYPE_NORMAL ,NULL , &entry);if (ret)return ret;
@@ -152,9 +152,11 @@ int dram_init(void)#ifdef CONFIG_ENABLE_MRC_CACHE cache =malloc (sizeof (struct mrc_timings ));if (cache) { +struct mrc_output *mrc = &gd->arch.mrc[MRC_TYPE_NORMAL ]; +memcpy (cache, &mrc_params.timings,sizeof (struct mrc_timings )); - gd->arch.mrc_output = cache; - gd->arch.mrc_output_len =sizeof (struct mrc_timings ); + mrc->buf = cache; + mrc->len =sizeof (struct mrc_timings ); }#endif
arch/x86/include/asm/global_data.h +17 -4
@@ -67,6 +67,21 @@ struct mtrr_request {uint64_t size; }; +/** +* struct mrc_output - holds the MRC data +* +* @buf: MRC training data to save for the next boot. This is set to point to +* the raw data after SDRAM init is complete. Then mrccache_setup() +* turns it into a proper cache record with a checksum +* @len: Length of @buf +* @cache: Resulting cache record +*/ +struct mrc_output { +char *buf; +uint len; +struct mrc_data_container *cache; +}; +/* Architecture-specific global data */ struct arch_global_data {u64 gdt[X86_GDT_NUM_ENTRIES ]__aligned(16) ;
@@ -91,10 +106,8 @@ struct arch_global_data {struct mtrr_request mtrr_req[MAX_MTRR_REQUESTS ];int mtrr_req_count;int has_mtrr; -/* MRC training data to save for the next boot */ -char *mrc_output; -unsigned int mrc_output_len; -struct mrc_data_container *mrc_cache; +/* MRC training data */ +struct mrc_output mrc[MRC_TYPE_COUNT ];ulong table;/* Table pointer from previous loader */ int turbo_state;/* Current turbo state */ struct irq_routing_table *pirq_routing_table;
arch/x86/include/asm/mrccache.h +10 -1
@@ -27,6 +27,13 @@ struct mrc_region {u32 length; }; +/* Types of MRC data */ +enum mrc_type_t { +MRC_TYPE_NORMAL , + +MRC_TYPE_COUNT , +}; +struct udevice ;/**
@@ -84,6 +91,7 @@ int mrccache_reserve(void);* triggers PCI bus enumeration during which insufficient memory issue * might be exposed and it causes subsequent SPI flash probe fails). * +* @type: Type of MRC data to use * @devp: Returns pointer to the SPI flash device * @entry: Position and size of MRC cache in SPI flash * @return 0 if success, -ENOENT if SPI flash node does not exist in the
@@ -91,7 +99,8 @@ int mrccache_reserve(void);* tree, -EINVAL if MRC region properties format is incorrect, other error * if SPI flash probe failed. */ -int mrccache_get_region (struct udevice **devp,struct mrc_region *entry); +int mrccache_get_region (enum mrc_type_t type,struct udevice **devp, +struct mrc_region *entry);/** * mrccache_save() - save MRC data to the SPI flash
arch/x86/lib/fsp/fsp_common.c +1 -1
@@ -63,7 +63,7 @@ void *fsp_prepare_mrc_cache(void)struct mrc_region entry;int ret; - ret =mrccache_get_region (NULL , &entry); + ret =mrccache_get_region (MRC_TYPE_NORMAL ,NULL , &entry);if (ret)return NULL ;
arch/x86/lib/fsp1/fsp_dram.c +5 -3
@@ -15,9 +15,11 @@ int dram_init(void)if (ret)return ret; -if (IS_ENABLED (CONFIG_ENABLE_MRC_CACHE )) - gd->arch.mrc_output =fsp_get_nvs_data (gd->arch.hob_list, - &gd->arch.mrc_output_len); +if (IS_ENABLED (CONFIG_ENABLE_MRC_CACHE )) { +struct mrc_output *mrc = &gd->arch.mrc[MRC_TYPE_NORMAL ]; + + mrc->buf =fsp_get_nvs_data (gd->arch.hob_list, &mrc->len); + }return 0 ; }
arch/x86/lib/mrccache.c +58 -30
144 lines not on this page · raw message
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 35/100 x86: Add mrccache support for a 'variable' cache
In reply to Simon GlassAdd support for a second cache type, for Apollo Lake.
---
Changes in v4:
- apollolake -> Apollo Lake
Changes in v3:
- Move the mrccache_get_region() change into this patch
Changes in v2: None
arch/x86/include/asm/mrccache.h | 1 + arch/x86/lib/mrccache.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-)
arch/x86/include/asm/mrccache.h +1 -0
@@ -30,6 +30,7 @@ struct mrc_region {/* Types of MRC data */ enum mrc_type_t {MRC_TYPE_NORMAL , +MRC_TYPE_VAR ,MRC_TYPE_COUNT , };
arch/x86/lib/mrccache.c +2 -1
@@ -241,7 +241,8 @@ int mrccache_get_region(enum mrc_type_t type, struct udevice **devp, }/* Find the place where we put the MRC cache */ - mrc_node =dev_read_subnode (dev,"rw-mrc-cache" ); + mrc_node =dev_read_subnode (dev, type ==MRC_TYPE_NORMAL ? +"rw-mrc-cache" :"rw-var-mrc-cache" );if (!ofnode_valid (mrc_node))return log_msg_ret ("Cannot find node" , -EPERM );
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 36/100 x86: Don't export mrccache_update()
In reply to Simon GlassThis function is only used within the implementation so make it static.
---
Changes in v4:
- Add new patch to make mrccache_update() static
Changes in v3: None
Changes in v2: None
arch/x86/include/asm/mrccache.h | 15 --------------- arch/x86/lib/mrccache.c | 16 ++++++++++++++-- 2 files changed, 14 insertions(+), 17 deletions(-)
arch/x86/include/asm/mrccache.h +0 -15
@@ -48,21 +48,6 @@ struct udevice;*/ struct mrc_data_container *mrccache_find_current (struct mrc_region *entry); -/** -* mrccache_update() - update the MRC cache with a new record -* -* This writes a new record to the end of the MRC cache region. If the new -* record is the same as the latest record then the write is skipped -* -* @sf: SPI flash to write to -* @entry: Position and size of MRC cache in SPI flash -* @cur: Record to write -* @return 0 if updated, -EEXIST if the record is the same as the latest -* record, -EINVAL if the record is not valid, other error if SPI write failed -*/ -int mrccache_update (struct udevice *sf,struct mrc_region *entry, -struct mrc_data_container *cur); -/** * mrccache_reserve() - reserve MRC data on the stack *
arch/x86/lib/mrccache.c +14 -2
@@ -118,8 +118,20 @@ static struct mrc_data_container *find_next_mrc_cache(struct mrc_region *entry,return cache; } -int mrccache_update (struct udevice *sf,struct mrc_region *entry, -struct mrc_data_container *cur) +/** +* mrccache_update() - update the MRC cache with a new record +* +* This writes a new record to the end of the MRC cache region. If the new +* record is the same as the latest record then the write is skipped +* +* @sf: SPI flash to write to +* @entry: Position and size of MRC cache in SPI flash +* @cur: Record to write +* @return 0 if updated, -EEXIST if the record is the same as the latest +* record, -EINVAL if the record is not valid, other error if SPI write failed +*/ +static int mrccache_update (struct udevice *sf,struct mrc_region *entry, +struct mrc_data_container *cur) {struct mrc_data_container *cache;ulong offset;
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 37/100 x86: Move fsp_prepare_mrc_cache() to fsp1 directory
In reply to Simon GlassThis function needs to be different for FSP2, so move the existing function into the fsp1 directory. Since it is only called from one file, drop it from the header file.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
arch/x86/include/asm/fsp/fsp_support.h | 7 ------- arch/x86/lib/fsp/fsp_common.c | 20 -------------------- arch/x86/lib/fsp1/fsp_common.c | 20 ++++++++++++++++++++ 3 files changed, 20 insertions(+), 27 deletions(-)
arch/x86/include/asm/fsp/fsp_support.h +0 -7
@@ -143,13 +143,6 @@ int fsp_init_phase_pci(void);*/ int fsp_scan_for_ram_size (void ); -/** -* fsp_prepare_mrc_cache() - Find the DRAM training data from the MRC cache -* -* @return pointer to data, or NULL if no cache or no data found in the cache -*/ -void *fsp_prepare_mrc_cache (void ); -/** * fsp_notify() - FSP notification wrapper function *
arch/x86/lib/fsp/fsp_common.c +0 -20
@@ -57,26 +57,6 @@ void board_final_cleanup(void)debug ("OK\n" ); } -void *fsp_prepare_mrc_cache (void ) -{ -struct mrc_data_container *cache; -struct mrc_region entry; -int ret; - - ret =mrccache_get_region (MRC_TYPE_NORMAL ,NULL , &entry); -if (ret) -return NULL ; - - cache =mrccache_find_current (&entry); -if (!cache) -return NULL ; - -debug ("%s: mrc cache at %p, size %x checksum %04x\n" , __func__, - cache->data, cache->data_size, cache->checksum); - -return cache->data; -} -#ifdef CONFIG_HAVE_ACPI_RESUME int fsp_save_s3_stack (void ) {
arch/x86/lib/fsp1/fsp_common.c +20 -0
@@ -18,6 +18,26 @@DECLARE_GLOBAL_DATA_PTR ; +static void *fsp_prepare_mrc_cache (void ) +{ +struct mrc_data_container *cache; +struct mrc_region entry; +int ret; + + ret =mrccache_get_region (MRC_TYPE_NORMAL ,NULL , &entry); +if (ret) +return NULL ; + + cache =mrccache_find_current (&entry); +if (!cache) +return NULL ; + +debug ("%s: mrc cache at %p, size %x checksum %04x\n" , __func__, + cache->data, cache->data_size, cache->checksum); + +return cache->data; +} +int arch_fsp_init (void ) {void *nvs;
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 38/100 x86: Set the DRAM banks to reflect real location
In reply to Simon GlassAt present with fsp a single DRAM bank is added which extends to the whole size of memory. However there is typically only 2GB of memory available below the 4GB boundary, and this is what is used by U-Boot while running in 32-bit mode.
Scan the tables to set the banks correct. The first bank is set to memory below 4GB, and the rest of memory is put into subsequent banks.
---
Changes in v4: None
Changes in v3:
- Move mtrr_add_request() call to next patch
Changes in v2: None
arch/x86/lib/fsp/fsp_dram.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-)
arch/x86/lib/fsp/fsp_dram.c +29 -1
@@ -37,8 +37,36 @@ int fsp_scan_for_ram_size(void)int dram_init_banksize (void ) { +const struct hob_header *hdr; +struct hob_res_desc *res_desc; +phys_addr_t low_end; +uint bank; + + low_end =0 ; +for (bank =1 , hdr = gd->arch.hob_list; + bank <CONFIG_NR_DRAM_BANKS && !end_of_hob (hdr); + hdr =get_next_hob (hdr)) { +if (hdr->type !=HOB_TYPE_RES_DESC ) +continue ; + res_desc = (struct hob_res_desc *)hdr; +if (res_desc->type !=RES_SYS_MEM && + res_desc->type !=RES_MEM_RESERVED ) +continue ; +if (res_desc->phys_start < (1ULL <<32 )) { + low_end =max (low_end, + res_desc->phys_start + res_desc->len); +continue ; + } + + gd->bd->bi_dram[bank].start = res_desc->phys_start; + gd->bd->bi_dram[bank].size = res_desc->len; +log_debug ("ram %llx %llx\n" , gd->bd->bi_dram[bank].start, + gd->bd->bi_dram[bank].size); + } + +/* Add the memory below 4GB */ gd->bd->bi_dram[0 ].start =0 ; - gd->bd->bi_dram[0 ].size = gd->ram_size; + gd->bd->bi_dram[0 ].size = low_end;return 0 ; }
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 39/100 x86: Set up the MTRR for SDRAM
In reply to Simon GlassSet up MTRRs for the FST SDRAM regions to improve performance.
---
Changes in v4: None
Changes in v3:
- Move mtrr_add_request() call into this patch
Changes in v2: None
arch/x86/lib/fsp/fsp_dram.c | 5 +++++ 1 file changed, 5 insertions(+)
arch/x86/lib/fsp/fsp_dram.c +5 -0
@@ -8,6 +8,7 @@#include <asm/fsp/fsp_support.h> #include <asm/e820.h> #include <asm/mrccache.h> +#include <asm/mtrr.h> #include <asm/post.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -60,6 +61,8 @@ int dram_init_banksize(void) gd->bd->bi_dram[bank].start = res_desc->phys_start; gd->bd->bi_dram[bank].size = res_desc->len; +mtrr_add_request (MTRR_TYPE_WRBACK , res_desc->phys_start, + res_desc->len);log_debug ("ram %llx %llx\n" , gd->bd->bi_dram[bank].start, gd->bd->bi_dram[bank].size); }
@@ -68,6 +71,8 @@ int dram_init_banksize(void) gd->bd->bi_dram[0 ].start =0 ; gd->bd->bi_dram[0 ].size = low_end; +mtrr_add_request (MTRR_TYPE_WRBACK ,0 , low_end); +return 0 ; }
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 40/100 x86: Don't imply libfdt or SPI flash in TPL
In reply to Simon GlassWe don't want to pull in libfdt if of-platdata is being used, since it reduces the available code-size saves. Also, SPI flash is seldom needed in TPL.
Drop these options.
---
Changes in v4: None
Changes in v3:
- Don't imply SPI flash either
- Rewrite commit message
Changes in v2: None
arch/Kconfig | 3 --- 1 file changed, 3 deletions(-)
arch/Kconfig +0 -3
@@ -204,14 +204,11 @@ config X86 imply SPL_SYSCON # TPL imply TPL_DM - imply TPL_OF_LIBFDT imply TPL_DRIVERS_MISC_SUPPORT imply TPL_GPIO_SUPPORT imply TPL_LIBCOMMON_SUPPORT imply TPL_LIBGENERIC_SUPPORT imply TPL_SERIAL_SUPPORT - imply TPL_SPI_FLASH_SUPPORT - imply TPL_SPI_SUPPORT imply TPL_OF_CONTROL imply TPL_TIMER imply TPL_REGMAP
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 41/100 x86: Allow removal of standard PCH drivers
In reply to Simon GlassThese drivers are not needed on all platforms. While they are small, it is useful in TPL to drop then. Add Kconfig control to allow this.
---
Changes in v4: None
Changes in v3: None
Changes in v2:
- Change 'queensbay' to 'baytrail' in help
- Fix 'proides' typo
drivers/pch/Kconfig | 18 ++++++++++++++++++ drivers/pch/Makefile | 4 ++-- 2 files changed, 20 insertions(+), 2 deletions(-)
drivers/pch/Kconfig +18 -0
@@ -7,3 +7,21 @@ config PCH northbridge / southbridge architecture that was previously used. The PCH allows for higher performance since the memory functions are handled in the CPU. + +config X86_PCH7 + bool "Add support for Intel PCH7" + default y if X86 + help + Enable this if your SoC uses Platform Controller Hub 7 (PCH7). This + dates from about 2011 and is used on baytrail, for example. The + PCH provides access to the GPIO and SPI base addresses, among other + functions. + +config X86_PCH9 + bool "Add support for Intel PCH9" + default y if X86 + help + Enable this if your SoC uses Platform Controller Hub 9 (PCH9). This + dates from about 2015 and is used on baytrail, for example. The + PCH provides access to the GPIO and SPI base addresses, among other + functions.
drivers/pch/Makefile +2 -2
@@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0+ obj-y += pch-uclass.o -obj-y += pch7.o -obj-y += pch9.o +obj-$(CONFIG_X86_PCH7) += pch7.o +obj-$(CONFIG_X86_PCH9) += pch9.o obj-$(CONFIG_SANDBOX) += sandbox_pch.o
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 42/100 x86: Allow interrupt to happen once
In reply to Simon GlassAt present the interrupt table is included in all phases of U-Boot. Allow it to be omitted, e.g. in TPL, to reduce size.
---
Changes in v4: None
Changes in v3:
- Move write_pirq_routing_table() to avoid 64-bit build error
Changes in v2: None
arch/x86/cpu/Makefile | 2 +- arch/x86/cpu/irq.c | 8 -------- arch/x86/lib/pirq_routing.c | 10 ++++++++++ 3 files changed, 11 insertions(+), 9 deletions(-)
arch/x86/cpu/Makefile +1 -1
@@ -53,7 +53,7 @@ obj-$(CONFIG_INTEL_QUARK) += quark/ obj-$(CONFIG_INTEL_QUEENSBAY) += queensbay/ obj-$(CONFIG_INTEL_TANGIER) += tangier/ obj-$(CONFIG_APIC) += lapic.o ioapic.o -obj-y += irq.o +obj-$(CONFIG_$(SPL_TPL_)X86_32BIT_INIT) += irq.o ifndef CONFIG_$(SPL_)X86_64 obj-$(CONFIG_SMP) += mp_init.o endif
arch/x86/cpu/irq.c +0 -8
@@ -350,14 +350,6 @@ int irq_router_probe(struct udevice *dev)return 0 ; } -ulong write_pirq_routing_table (ulong addr) -{ -if (!gd->arch.pirq_routing_table) -return addr; - -return copy_pirq_routing_table (addr, gd->arch.pirq_routing_table); -} -static const struct udevice_id irq_router_ids[] = { { .compatible ="intel,irq-router" }, { }
arch/x86/lib/pirq_routing.c +10 -0
@@ -10,6 +10,8 @@#include <asm/pci.h> #include <asm/pirq_routing.h> +DECLARE_GLOBAL_DATA_PTR ; +static u8 pirq_get_next_free_irq (struct udevice *dev,u8 *pirq,u16 bitmap,bool irq_already_routed[]) {
@@ -131,3 +133,11 @@ u32 copy_pirq_routing_table(u32 addr, struct irq_routing_table *rt)return addr + rt->size; } + +ulong write_pirq_routing_table (ulong addr) +{ +if (!gd->arch.pirq_routing_table) +return addr; + +return copy_pirq_routing_table (addr, gd->arch.pirq_routing_table); +}
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 43/100 x86: fsp: Make graphics support common to FSP1/2
In reply to Simon GlassBoth versions of FSP can use the same graphics support, so move it into the common directory.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
arch/x86/lib/fsp/Makefile | 3 +++
arch/x86/lib/{fsp1 => fsp}/fsp_graphics.c | 2 +-
arch/x86/lib/fsp1/Makefile | 1 -
3 files changed, 4 insertions(+), 2 deletions(-)
rename arch/x86/lib/{fsp1 => fsp}/fsp_graphics.c (98%)arch/x86/lib/fsp/Makefile +3 -0
@@ -4,4 +4,7 @@ obj-y += fsp_common.o obj-y += fsp_dram.o +ifndef CONFIG_SPL_BUILD +obj-$(CONFIG_VIDEO_FSP) += fsp_graphics.o +endif obj-y += fsp_support.o
arch/x86/lib/fsp/fsp_graphics.c renamed from arch/x86/lib/fsp1/fsp_graphics.c +1 -1
@@ -7,7 +7,7 @@#include <dm.h> #include <vbe.h> #include <video.h> -#include <asm/fsp1/fsp_support.h> +#include <asm/fsp/fsp_support.h> DECLARE_GLOBAL_DATA_PTR ;
arch/x86/lib/fsp1/Makefile +0 -1
@@ -5,5 +5,4 @@ obj-y += fsp_car.o obj-y += fsp_common.o obj-y += fsp_dram.o -obj-$(CONFIG_VIDEO_FSP) += fsp_graphics.o obj-y += fsp_support.o
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 44/100 x86: fsp: Correct wrong header inlude in fsp_support.c
In reply to Simon GlassThis generic FSP file should include the generic FSP support header, not the FSP1 version. Fix it.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
arch/x86/lib/fsp/fsp_support.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/lib/fsp/fsp_support.c +1 -1
@@ -5,7 +5,7 @@*/ #include <common.h> -#include <asm/fsp1/fsp_support.h> +#include <asm/fsp/fsp_support.h> #include <asm/post.h> u32 fsp_get_usable_lowmem_top (const void *hob_list)
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 45/100 x86: fsp: Add FSP2 base support
In reply to Simon GlassAdd support for some important configuration options and FSP memory init. The memory init uses swizzle tables from the device tree.
Support for the FSP_S binary is also included.
Bootstage timing is used for both FSP_M and FSP_S and memory-mapped SPI reads.
---
Changes in v4:
- Add a LOG_CATEGORY for silicon init
- Drop duplicate VBT file CONFIG
- Enable HAVE_VBT for FSP2 also
- Explain the 'twisty headers' comment
- Fix FSP_M reference to refer to FSP_S in commit message
- Fix comment on fsp_silicon_init()
- Rename arch_fsp_s_preinit() to arch_fsps_preinit()
- Rename get_coreboot_fsp() and add comments
- Switch over to use pinctrl for pad init/config
- Use lower-case pinctrl in arch_cpu_init_dm()
Changes in v3:
- Add a proper implementation of fsp_notify
- Add an fsp: tag
- Add bootstage timing for memory-mapped reads
- Add fsp_locate_fsp to locate an fsp component
- Add fspm_done() hook
- Add support for FSP-S component and VBT
- Simplify types for fsp_locate_fsp()
- Switch mmap to use SPI instead of SPI flash
Changes in v2: None
arch/x86/Kconfig | 54 ++++++- arch/x86/include/asm/fsp2/fsp_api.h | 63 ++++++++ arch/x86/include/asm/fsp2/fsp_internal.h | 97 +++++++++++++ arch/x86/lib/fsp2/Makefile | 10 ++ arch/x86/lib/fsp2/fsp_common.c | 13 ++ arch/x86/lib/fsp2/fsp_dram.c | 77 ++++++++++ arch/x86/lib/fsp2/fsp_init.c | 174 +++++++++++++++++++++++ arch/x86/lib/fsp2/fsp_meminit.c | 97 +++++++++++++ arch/x86/lib/fsp2/fsp_silicon_init.c | 54 +++++++ arch/x86/lib/fsp2/fsp_support.c | 135 ++++++++++++++++++ include/bootstage.h | 3 + 11 files changed, 774 insertions(+), 3 deletions(-) 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_common.c create mode 100644 arch/x86/lib/fsp2/fsp_dram.c create mode 100644 arch/x86/lib/fsp2/fsp_init.c create mode 100644 arch/x86/lib/fsp2/fsp_meminit.c create mode 100644 arch/x86/lib/fsp2/fsp_silicon_init.c create mode 100644 arch/x86/lib/fsp2/fsp_support.c
arch/x86/Kconfig +51 -3
@@ -326,7 +326,7 @@ config X86_RAMTEST config FLASH_DESCRIPTOR_FILE string "Flash descriptor binary filename" - depends on HAVE_INTEL_ME + depends on HAVE_INTEL_ME || FSP_VERSION2 default "descriptor.bin" help The filename of the file to use as flash descriptor in the
@@ -411,6 +411,54 @@ config FSP_ADDR The default base address of 0xfffc0000 indicates that the binary must be located at offset 0xc0000 from the beginning of a 1MB flash device. +if FSP_VERSION2 + +config FSP_FILE_T + string "Firmware-Support-Package binary filename (Temp RAM)" + default "fsp_t.bin" + help + The filename of the file to use for the temporary-RAM init phase from + the Firmware-Support-Package binary. Put this in the board directory. + It is used to set up an initial area of RAM which can be used for the + stack and other purposes, while bringing up the main system DRAM. + +config FSP_ADDR_T + hex "Firmware-Support-Package binary location (Temp RAM)" + default 0xffff8000 + help + FSP is not Position-Independent Code (PIC) and FSP components have to + be rebased if placed at a location which is different from the + perferred base address specified during the FSP build. Use Intel's + Binary Configuration Tool (BCT) to do the rebase. + +config FSP_FILE_M + string "Firmware-Support-Package binary filename (Memory Init)" + default "fsp_m.bin" + help + The filename of the file to use for the RAM init phase from the + Firmware Support Package binary. Put this in the board directory. + It is used to set up the main system DRAM and runs in SPL, once + temporary RAM (CAR) is working. + +config FSP_FILE_S + string "Firmware-Support-Package binary filename (Silicon Init)" + default "fsp_s.bin" + help + The filename of the file to use for the Silicon init phase from the + Firmware Support Package binary. Put this in the board directory. + It is used to set up the silicon to work correctly and must be + executed after DRAM is running. + +config IFWI_INPUT_FILE + string "Filename containing FIT (Firmware Interface Table) with IFWI" + default "fitimage.bin" + help + The IFWI is obtained by running a tool on this file to extract the + IFWI. Put this in the board directory. The IFWI contains U-Boot TPL, + microcode and other internal items. + +endif + config FSP_TEMP_RAM_ADDR hex depends on FSP_VERSION1
@@ -595,7 +643,7 @@ config VGA_BIOS_ADDR config HAVE_VBT bool "Add a Video BIOS Table (VBT) image" - depends on FSP_VERSION1 + depends on HAVE_FSP help Select this option if you have a Video BIOS Table (VBT) image that you would like to add to your ROM. This is normally required if you
@@ -629,7 +677,7 @@ config VBT_ADDR config VIDEO_FSP bool "Enable FSP framebuffer driver support" - depends on HAVE_VBT && DM_VIDEO + depends on (HAVE_VBT || FSP_VERSION2) && DM_VIDEO help Turn on this option to enable a framebuffer driver when U-Boot is using Video BIOS Table (VBT) image for FSP firmware to initialize
arch/x86/include/asm/fsp2/fsp_api.h new file +63 -0
63 lines not on this page · raw message
arch/x86/include/asm/fsp2/fsp_internal.h new file +97 -0
97 lines not on this page · raw message
arch/x86/lib/fsp2/Makefile new file +10 -0
@@ -0,0 +1,10 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright 2019 Google LLC + +obj-y += fsp_common.o +obj-y += fsp_dram.o +obj-y += fsp_init.o +obj-y += fsp_meminit.o +obj-y += fsp_silicon_init.o +obj-y += fsp_support.o
arch/x86/lib/fsp2/fsp_common.c new file +13 -0
@@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright 2019 Google LLC +* Written by Simon Glass <[email protected]> +*/ + +#include <common.h> +#include <init.h> + +int arch_fsp_init (void ) +{ +return 0 ; +}
arch/x86/lib/fsp2/fsp_dram.c new file +77 -0
77 lines not on this page · raw message
arch/x86/lib/fsp2/fsp_init.c new file +174 -0
174 lines not on this page · raw message
arch/x86/lib/fsp2/fsp_meminit.c new file +97 -0
97 lines not on this page · raw message
arch/x86/lib/fsp2/fsp_silicon_init.c new file +54 -0
54 lines not on this page · raw message
arch/x86/lib/fsp2/fsp_support.c new file +135 -0
135 lines not on this page · raw message
include/bootstage.h +3 -0
@@ -202,6 +202,9 @@ enum bootstage_id {BOOTSTATE_ID_ACCUM_DM_SPL ,BOOTSTATE_ID_ACCUM_DM_F ,BOOTSTATE_ID_ACCUM_DM_R , +BOOTSTATE_ID_ACCUM_FSP_M , +BOOTSTATE_ID_ACCUM_FSP_S , +BOOTSTAGE_ID_ACCUM_MMAP_SPI ,/* a few spare for the user, from here */ BOOTSTAGE_ID_USER,
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 46/100 x86: fsp: Set up an MTRR for the graphics frame buffer
In reply to Simon GlassThe FSP-S may do this but at least for coral it does not. Set this up so that graphics is not deathly slow.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
arch/x86/lib/fsp/fsp_graphics.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/x86/lib/fsp/fsp_graphics.c +4 -0
@@ -8,6 +8,7 @@#include <vbe.h> #include <video.h> #include <asm/fsp/fsp_support.h> +#include <asm/mtrr.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -97,6 +98,9 @@ static int fsp_video_probe(struct udevice *dev)if (ret) goto err; +mtrr_add_request (MTRR_TYPE_WRCOMB , vesa->phys_base_ptr,256 <<20 ); +mtrr_commit (true); +printf ("%dx%dx%d\n" , uc_priv->xsize, uc_priv->ysize, vesa->bits_per_pixel);
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 47/100 x86: fsp: Add a new arch_fsp_init_r() hook
In reply to Simon GlassWith FSP2 we need to run silicon init early after relocation. Add a new hook for this.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
common/board_r.c | 3 +++ include/init.h | 11 +++++++++++ 2 files changed, 14 insertions(+)
common/board_r.c +3 -0
@@ -710,6 +710,9 @@ static init_fnc_t init_sequence_r[] = { efi_memory_init, #endif initr_binman, +#ifdef CONFIG_FSP_VERSION2 + arch_fsp_init_r, +#endif initr_dm_devices, stdio_init_tables, initr_serial,
include/init.h +11 -0
@@ -65,6 +65,17 @@ int mach_cpu_init(void);*/ int arch_fsp_init (void ); +/** +* arch_fsp_init() - perform post-relocation firmware support package init +* +* Where U-Boot relies on binary blobs to handle part of the system init, this +* function can be used to set up the blobs. This is used on some Intel +* platforms. +* +* Return: 0 +*/ +int arch_fsp_init_r (void ); +int dram_init (void );/**
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 48/100 x86: fsp: Allow remembering the location of FSP-S
In reply to Simon GlassFSP-S is used by the notify call after it has been used for silicon init. To avoid having to load it again, add a field to store the location.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
arch/x86/include/asm/global_data.h | 3 +++ 1 file changed, 3 insertions(+)
arch/x86/include/asm/global_data.h +3 -0
@@ -120,6 +120,9 @@ struct arch_global_data {int prev_sleep_state;/* Previous sleep state ACPI_S0/1../5 */ ulong backup_mem;/* Backup memory address for S3 */ #endif +#ifdef CONFIG_FSP_VERSION2 +struct fsp_header *fsp_s_hdr;/* Pointer to FSP-S header */ +#endif };#endif
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 49/100 x86: fsp: Make the notify API call common
In reply to Simon GlassThe fsp_notify() API is the same for FSP1 and FSP2. Move it into a new common API file.
---
Changes in v4:
- Drop incorrect coreboot reference from header file
Changes in v3: None
Changes in v2: None
arch/x86/include/asm/fsp/fsp_api.h | 24 ++++++++++++++++++++++++ arch/x86/include/asm/fsp1/fsp_api.h | 21 +++------------------ 2 files changed, 27 insertions(+), 18 deletions(-) create mode 100644 arch/x86/include/asm/fsp/fsp_api.h
arch/x86/include/asm/fsp/fsp_api.h new file +24 -0
@@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright 2019 Google LLC +*/ + +#ifndef __ASM_FSP_API_H +#define __ASM_FSP_API_H + +enum fsp_phase { +/* Notification code for post PCI enuermation */ +INIT_PHASE_PCI =0x20 , +/* Notification code before transferring control to the payload */ +INIT_PHASE_BOOT =0x40 +}; + +struct fsp_notify_params { +/* Notification phase used for NotifyPhase API */ +enum fsp_phase phase; +}; + +/* FspNotify API function prototype */ +typedef asmlinkage u32 (*fsp_notify_f)(struct fsp_notify_params *params); + +#endif
arch/x86/include/asm/fsp1/fsp_api.h +3 -18
@@ -4,11 +4,11 @@* Copyright (C) 2014, Bin Meng <[email protected]> */ -#ifndef __FSP_API_H__ -#define __FSP_API_H__ +#ifndef __FSP1_API_H__ +#define __FSP1_API_H__#include <linux/linkage.h> - +#include <asm/fsp/fsp_api.h> /* * FSP common configuration structure. * This needs to be included in the platform-specific struct fsp_config_data.
@@ -46,22 +46,7 @@ struct common_buf {u32 reserved[6 ];/* Reserved */ }; -enum fsp_phase { -/* Notification code for post PCI enuermation */ -INIT_PHASE_PCI =0x20 , -/* Notification code before transfering control to the payload */ -INIT_PHASE_BOOT =0x40 -}; - -struct fsp_notify_params { -/* Notification phase used for NotifyPhase API */ -enum fsp_phase phase; -}; -/* FspInit API function prototype */ typedef asmlinkage u32 (*fsp_init_f)(struct fsp_init_params *params); -/* FspNotify API function prototype */ -typedef asmlinkage u32 (*fsp_notify_f)(struct fsp_notify_params *params); -#endif
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 50/100 x86: Don't include the BIOS emulator in TPL
In reply to Simon GlassWe don't generally have enough space to run this, so don't build it into TPL. This helps reduce the size of TPL.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
arch/x86/lib/Makefile | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/lib/Makefile +2 -0
@@ -4,9 +4,11 @@ # Wolfgang Denk, DENX Software Engineering, wd at denx.de. ifndef CONFIG_X86_64 +ifndef CONFIG_TPL_BUILD obj-y += bios.o obj-y += bios_asm.o obj-y += bios_interrupts.o +endif obj-y += string.o endif ifndef CONFIG_SPL_BUILD
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 51/100 x86: Add an option to include a FIT
In reply to Simon GlassMany Intel SoCs require a FIT in order to boot properly. Add an option to include this and enable it by default.
This term can be confused with FIT (Flat Image Tree) in U-Boot so the CONFIG option has to include 'X86'.
---
Changes in v4: None
Changes in v3:
- Add help to CONFIG_FIT and don't make it 'default y'
- Rename X86_HAS_FIT to HAVE_X86_FIT
- Update commit message to explain why HAVE_FIT woudl be confusing
Changes in v2: None
arch/x86/Kconfig | 8 ++++++++ arch/x86/dts/u-boot.dtsi | 6 ++++++ 2 files changed, 14 insertions(+)
arch/x86/Kconfig +8 -0
@@ -217,6 +217,14 @@ config SYS_X86_START16 depends on X86_RESET_VECTOR default 0xfffff800 +config HAVE_X86_FIT + bool + help + Enable inclusion of an Intel Firmware Interface Table (FIT) into the + image. This table is supposed to point to microcode and the like. So + far it is just a fixed table with the minimum set of headers, so that + it is actually present. + config X86_LOAD_FROM_32_BIT bool "Boot from a 32-bit program" help
arch/x86/dts/u-boot.dtsi +6 -0
@@ -82,6 +82,12 @@ u-boot-ucode { align = <16>; }; +#ifdef CONFIG_HAVE_X86_FIT + intel-fit { + }; + intel-fit-ptr { + }; +#endif #ifdef CONFIG_HAVE_MRC intel-mrc { offset = <CONFIG_X86_MRC_ADDR>;
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 52/100 x86: Add support for newer CAR schemes
In reply to Simon GlassNewer Intel SoCs have different ways of setting up cache-as-ram (CAR). Add support for these along with suitable configuration options.
To make the code cleaner, adjust a few definitions in processor.h so that they can be used from assembler.
---
Changes in v4:
- Adjust
- Fix up license header
- Fix various code-style problems
- Use CONFIG_INTEL_CAR_CQOS to control car2.S inclusion
- Use car_init_ret to return
- Use post_code() calls consistent with car.S
Changes in v3:
- Drop dead code
- Drop unneeded Kconfig file
- Use a macro for is-power-of-two
Changes in v2: None
arch/x86/Kconfig | 16 + arch/x86/cpu/intel_common/Makefile | 8 + arch/x86/cpu/intel_common/car2.S | 448 ++++++++++++++++++++++++ arch/x86/cpu/intel_common/car2_uninit.S | 87 +++++ arch/x86/include/asm/processor.h | 12 +- 5 files changed, 564 insertions(+), 7 deletions(-) create mode 100644 arch/x86/cpu/intel_common/car2.S create mode 100644 arch/x86/cpu/intel_common/car2_uninit.S
arch/x86/Kconfig +16 -0
@@ -879,4 +879,20 @@ config HIGH_TABLE_SIZE Increse it if the default size does not fit the board's needs. This is most likely due to a large ACPI DSDT table is used. +config INTEL_CAR_CQOS + bool "Support Intel Cache Quality of Service" + help + Cache Quality of Service allows more fine-grained control of cache + usage. As result, it is possible to set up a portion of L2 cache for + CAR and use the remainder for actual caching. + +# +# Each bit in QOS mask controls this many bytes. This is calculated as: +# (CACHE_WAYS / CACHE_BITS_PER_MASK) * CACHE_LINE_SIZE * CACHE_SETS +# +config CACHE_QOS_SIZE_PER_BIT + hex + depends on INTEL_CAR_CQOS + default 0x20000 # 128 KB + endmenu
arch/x86/cpu/intel_common/Makefile +8 -0
@@ -8,6 +8,14 @@ obj-$(CONFIG_$(SPL_TPL_)X86_32BIT_INIT) += me_status.o obj-$(CONFIG_$(SPL_TPL_)X86_32BIT_INIT) += report_platform.o obj-$(CONFIG_$(SPL_TPL_)X86_32BIT_INIT) += mrc.o endif + +ifdef CONFIG_INTEL_CAR_CQOS +obj-$(CONFIG_TPL_BUILD) += car2.o +ifndef CONFIG_SPL_BUILD +obj-y += car2_uninit.o +endif +endif + obj-y += cpu.o obj-y += fast_spi.o obj-y += lpc.o
arch/x86/cpu/intel_common/car2.S new file +448 -0
448 lines not on this page · raw message
arch/x86/cpu/intel_common/car2_uninit.S new file +87 -0
87 lines not on this page · raw message
arch/x86/include/asm/processor.h +5 -7
@@ -25,8 +25,6 @@/* Length of the public header on Intel microcode blobs */ #define UCODE_HEADER_LEN 0x30 -#ifndef __ASSEMBLY__ -/* * This register is documented in (for example) the Intel Atom Processor E3800 * Product Family Datasheet in "PCU - Power Management Controller (PMC)".
@@ -37,11 +35,11 @@*/ #define IO_PORT_RESET 0xcf9 -enum { -SYS_RST =1 <<1 ,/* 0 for soft reset, 1 for hard reset */ -RST_CPU =1 <<2 ,/* initiate reset */ -FULL_RST =1 <<3 ,/* full power cycle */ -}; +#define SYS_RST (1 << 1)/* 0 for soft reset, 1 for hard reset */ +#define RST_CPU (1 << 2)/* initiate reset */ +#define FULL_RST (1 << 3)/* full power cycle */ + +#ifndef __ASSEMBLY__static inline __attribute__((always_inline))void cpu_hlt (void ) {
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 53/100 x86: Disable microcode section for FSP2
In reply to Simon GlassAt present we don't support loading microcode with FSP2. The correct way to do this is by adding it to the FIT. For now, disable including microcode in the image.
---
Changes in v4: None
Changes in v3:
- Drop unnecessary #else part of CONFIG_HAVE_MICROCODE
Changes in v2: None
arch/x86/Kconfig | 4 ++++ arch/x86/dts/u-boot.dtsi | 7 +++++++ 2 files changed, 11 insertions(+)
arch/x86/Kconfig +4 -0
@@ -588,6 +588,10 @@ config HAVE_REFCODE broadwell) U-Boot will be missing some critical setup steps. Various peripherals may fail to work. +config HAVE_MICROCODE + bool + default y if !FSP_VERSION2 + config SMP bool "Enable Symmetric Multiprocessing" default n
arch/x86/dts/u-boot.dtsi +7 -0
@@ -37,11 +37,13 @@ }; #endif #ifdef CONFIG_TPL +#ifdef CONFIG_HAVE_MICROCODE u-boot-tpl-with-ucode-ptr { offset = <CONFIG_TPL_TEXT_BASE>; }; u-boot-tpl-dtb { }; +#endif u-boot-spl { offset = <CONFIG_SPL_TEXT_BASE>; };
@@ -77,11 +79,16 @@ offset = <CONFIG_SYS_TEXT_BASE>; }; #endif +#ifdef CONFIG_HAVE_MICROCODE u-boot-dtb-with-ucode { }; u-boot-ucode { align = <16>; }; +#else + u-boot-dtb { + }; +#endif #ifdef CONFIG_HAVE_X86_FIT intel-fit { };
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 54/100 x86: Update the fsp command for FSP2
In reply to Simon GlassThe current 'fsp' command only works with FSP1. Update it to handle FSP2 as well. Convert everything to hex which is what U-Boot uses.
---
Changes in v4:
- Explain why FSP-M cannot be shown
- Use hex for size values also
Changes in v3:
- Convert code to use hex increased of decimal
- Update the 'fsp' command for FSP2, instead of disabling it
Changes in v2: None
cmd/x86/fsp.c | 65 ++++++++++++++++++++++++++++++++++----------------- 1 file changed, 44 insertions(+), 21 deletions(-)
cmd/x86/fsp.c +44 -21
@@ -5,23 +5,38 @@#include <common.h> #include <command.h> -#include <asm/fsp1/fsp_support.h> +#include <asm/fsp/fsp_support.h> DECLARE_GLOBAL_DATA_PTR ;static int do_hdr (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) { -struct fsp_header *hdr =fsp_find_header (); -u32 img_addr = hdr->img_base; -char *sign = (char *)&hdr->sign; +struct fsp_header *hdr; +u32 img_addr; +char *sign; +uint addr;int i; -printf ("FSP : binary 0x%08x, header 0x%08x\n" , -CONFIG_FSP_ADDR , (int )hdr); +#ifdef CONFIG_FSP_VERSION2 +/* +* Only FSP-S is displayed. FSP-M was used in SPL but may not still be +* around, and we didn't keep a pointer to it. +*/ + hdr = gd->arch.fsp_s_hdr; + img_addr = hdr->img_base; + addr = img_addr; +#else + addr =CONFIG_FSP_ADDR ; + hdr =fsp_find_header (); + img_addr = hdr->img_base; +#endif + sign = (char *)&hdr->sign; + +printf ("FSP : binary %08x, header %08x\n" , addr, (int )hdr);printf ("Header : sign " );for (i =0 ; i <sizeof (hdr->sign); i++)printf ("%c" , *sign++); -printf (", size %d, rev %d\n" , hdr->hdr_len, hdr->hdr_rev); +printf (", size %x, rev %d\n" , hdr->hdr_len, hdr->hdr_rev);printf ("Image : rev " );if (hdr->hdr_rev ==FSP_HEADER_REVISION_1 ) { printf("%d.%d",
@@ -34,24 +49,32 @@ static int do_hdr(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])printf (", id " );for (i =0 ; i <ARRAY_SIZE (hdr->img_id); i++)printf ("%c" , hdr->img_id[i]); -printf (", addr 0x%08x, size %d\n" , img_addr, hdr->img_size); -if (hdr->hdr_rev ==FSP_HEADER_REVISION_2 ) { +printf (", addr %08x, size %x\n" , img_addr, hdr->img_size); +if (hdr->hdr_rev >=FSP_HEADER_REVISION_1 ) {printf ("GFX :%ssupported\n" , hdr->img_attr &FSP_ATTR_GRAPHICS_SUPPORT ?" " :" un" ); } -printf ("VPD : addr 0x%08x, size %d\n" , +printf ("VPD : addr %08x, size %x\n" , hdr->cfg_region_off + img_addr, hdr->cfg_region_size); -printf ("\nNumber of APIs Supported : %d\n" , hdr->api_num); -printf ("\tTempRamInit : 0x%08x\n" , hdr->fsp_tempram_init + img_addr); -printf ("\tFspInit : 0x%08x\n" , hdr->fsp_init + img_addr); -printf ("\tFspNotify : 0x%08x\n" , hdr->fsp_notify + img_addr); -if (hdr->hdr_rev ==FSP_HEADER_REVISION_2 ) { -printf ("\tMemoryInit : 0x%08x\n" , - hdr->fsp_mem_init + img_addr); -printf ("\tTempRamExit : 0x%08x\n" , - hdr->fsp_tempram_exit + img_addr); -printf ("\tSiliconInit : 0x%08x\n" , - hdr->fsp_silicon_init + img_addr); +if (hdr->hdr_rev <=FSP_HEADER_REVISION_2 ) +printf ("\nNumber of APIs Supported : %d\n" , hdr->api_num); +if (hdr->fsp_tempram_init) +printf ("\tTempRamInit : %08x\n" , + hdr->fsp_tempram_init + img_addr); +if (hdr->fsp_init) +printf ("\tFspInit : %08x\n" , hdr->fsp_init + img_addr); +if (hdr->fsp_notify) +printf ("\tFspNotify : %08x\n" , hdr->fsp_notify + img_addr); +if (hdr->hdr_rev >=FSP_HEADER_REVISION_1 ) { +if (hdr->fsp_mem_init) +printf ("\tMemoryInit : %08x\n" , + hdr->fsp_mem_init + img_addr); +if (hdr->fsp_tempram_exit) +printf ("\tTempRamExit : %08x\n" , + hdr->fsp_tempram_exit + img_addr); +if (hdr->fsp_silicon_init) +printf ("\tSiliconInit : %08x\n" , + hdr->fsp_silicon_init + img_addr); }return 0 ;
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 55/100 x86: Update .dtsi file for FSP2
In reply to Simon GlassInclude the IFWI section and the FSP-M binary. The FSP-T binary is not currently used, as CAR is set up manually.
Also drop the FSP binary as this relates only to FSP1.
---
Changes in v4: None
Changes in v3:
- Add FSP-S and VBT also
- Drop VBT as we already have it elsewhere
Changes in v2: None
arch/x86/dts/u-boot.dtsi | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-)
arch/x86/dts/u-boot.dtsi +31 -1
@@ -100,12 +100,42 @@ offset = <CONFIG_X86_MRC_ADDR>; }; #endif -#ifdef CONFIG_HAVE_FSP +#ifdef CONFIG_FSP_VERSION1 intel-fsp { filename = CONFIG_FSP_FILE; offset = <CONFIG_FSP_ADDR>; }; #endif +#ifdef CONFIG_FSP_VERSION2 + intel-descriptor { + filename = CONFIG_FLASH_DESCRIPTOR_FILE; + }; + intel-ifwi { + filename = CONFIG_IFWI_INPUT_FILE; + convert-fit; + + section { + size = <0x8000>; + ifwi-replace; + ifwi-subpart = "IBBP"; + ifwi-entry = "IBBL"; + u-boot-tpl { + }; + x86-start16-tpl { + offset = <0x7800>; + }; + x86-reset16-tpl { + offset = <0x7ff0>; + }; + }; + }; + intel-fsp-m { + filename = CONFIG_FSP_FILE_M; + }; + intel-fsp-s { + filename = CONFIG_FSP_FILE_S; + }; +#endif #ifdef CONFIG_HAVE_CMC intel-cmc { filename = CONFIG_CMC_FILE;
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 56/100 x86: Add an option to control the position of U-Boot
In reply to Simon GlassThe existing work-around for positioning U-Boot in the ROM when it actually runs from RAM still exists and there is not obvious way to change this.
Add a proper Kconfig option to handle this case. This also adds a new bool property to indicate whether CONFIG_SYS_TEXT_BASE exists.
---
Changes in v4:
- Rename option to HAVE_SYS_TEXT_BASE
Changes in v3: None
Changes in v2: None
Kconfig | 9 ++++++--- arch/x86/Kconfig | 5 +++++ arch/x86/dts/u-boot.dtsi | 18 +++--------------- configs/chromebook_samus_tpl_defconfig | 1 + 4 files changed, 15 insertions(+), 18 deletions(-)
Kconfig +6 -3
@@ -544,9 +544,14 @@ config SYS_EXTRA_OPTIONS configuration to Kconfig. Since this option will be removed sometime, new boards should not use this option. -config SYS_TEXT_BASE +config HAVE_SYS_TEXT_BASE + bool depends on !NIOS2 && !XTENSA depends on !EFI_APP + default y + +config SYS_TEXT_BASE + depends on HAVE_SYS_TEXT_BASE default 0x80800000 if ARCH_OMAP2PLUS || ARCH_K3 default 0x4a000000 if ARCH_SUNXI && !MACH_SUN9I && !MACH_SUN8I_V3S default 0x2a000000 if ARCH_SUNXI && MACH_SUN9I
@@ -555,8 +560,6 @@ config SYS_TEXT_BASE help The address in memory that U-Boot will be running from, initially. - - config SYS_CLK_FREQ depends on ARC || ARCH_SUNXI || MPC83xx int "CPU clock frequency"
arch/x86/Kconfig +5 -0
@@ -899,4 +899,9 @@ config CACHE_QOS_SIZE_PER_BIT depends on INTEL_CAR_CQOS default 0x20000 # 128 KB +config X86_OFFSET_U_BOOT + hex "Offset of U-Boot in ROM image" + depends on HAVE_SYS_TEXT_BASE + default SYS_TEXT_BASE + endmenu
arch/x86/dts/u-boot.dtsi +3 -15
@@ -50,7 +50,7 @@ u-boot-spl-dtb { }; u-boot { - offset = <CONFIG_SYS_TEXT_BASE>; + offset = <CONFIG_X86_OFFSET_U_BOOT>; }; #elif defined(CONFIG_SPL) u-boot-spl-with-ucode-ptr {
@@ -60,23 +60,11 @@ type = "u-boot-dtb-with-ucode"; }; u-boot { - /* - * TODO(sjg at chromium.org): - * Normally we use CONFIG_SYS_TEXT_BASE as the flash offset. But - * for boards with textbase in SDRAM we cannot do this. Just use - * an assumed-valid value (1MB before the end of flash) here so - * that we can actually build an image for coreboot, etc. - * We need a better solution, perhaps a separate Kconfig. - */ -#if CONFIG_SYS_TEXT_BASE == 0x1110000 - offset = <0xfff00000>; -#else - offset = <CONFIG_SYS_TEXT_BASE>; -#endif + offset = <CONFIG_X86_OFFSET_U_BOOT>; }; #else u-boot-with-ucode-ptr { - offset = <CONFIG_SYS_TEXT_BASE>; + offset = <CONFIG_X86_OFFSET_U_BOOT>; }; #endif #ifdef CONFIG_HAVE_MICROCODE
configs/chromebook_samus_tpl_defconfig +1 -0
@@ -13,6 +13,7 @@ CONFIG_HAVE_REFCODE=y CONFIG_SMP=y CONFIG_HAVE_VGA_BIOS=y CONFIG_SPL_TEXT_BASE=0xffe70000 +CONFIG_X86_OFFSET_U_BOOT=0xfff00000 CONFIG_BOOTSTAGE=y CONFIG_BOOTSTAGE_REPORT=y CONFIG_SHOW_BOOT_PROGRESS=y
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 57/100 x86: Add an option to control the position of SPL
In reply to Simon GlassFor Apollo Lake SPL is run from CAR (cache-as-RAM) which is in a different location from where SPL must be placed in ROM. In other words, although SPL runs before SDRAM is set up, it is not execute-in-place (XIP).
Add a Kconfig option for the ROM position.
---
Changes in v4:
- apollolake -> Apollo Lake
Changes in v3:
- Add SPL condition to the option
Changes in v2: None
arch/x86/Kconfig | 5 +++++ arch/x86/dts/u-boot.dtsi | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-)
arch/x86/Kconfig +5 -0
@@ -904,4 +904,9 @@ config X86_OFFSET_U_BOOT depends on HAVE_SYS_TEXT_BASE default SYS_TEXT_BASE +config X86_OFFSET_SPL + hex "Offset of SPL in ROM image" + depends on SPL && X86 + default SPL_TEXT_BASE + endmenu
arch/x86/dts/u-boot.dtsi +2 -2
@@ -45,7 +45,7 @@ }; #endif u-boot-spl { - offset = <CONFIG_SPL_TEXT_BASE>; + offset = <CONFIG_X86_OFFSET_SPL>; }; u-boot-spl-dtb { };
@@ -54,7 +54,7 @@ }; #elif defined(CONFIG_SPL) u-boot-spl-with-ucode-ptr { - offset = <CONFIG_SPL_TEXT_BASE>; + offset = <CONFIG_X86_OFFSET_SPL>; }; u-boot-dtb-with-ucode2 { type = "u-boot-dtb-with-ucode";
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 58/100 x86: Add an fdtmap and image-header
In reply to Simon GlassAdd these entries to the ROM so that we can list the contents of an image with 'binman ls'. The image-header is not essential but does speed up access.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
arch/x86/dts/u-boot.dtsi | 5 +++++ 1 file changed, 5 insertions(+)
arch/x86/dts/u-boot.dtsi +5 -0
@@ -124,6 +124,8 @@ filename = CONFIG_FSP_FILE_S; }; #endif + fdtmap { + }; #ifdef CONFIG_HAVE_CMC intel-cmc { filename = CONFIG_CMC_FILE;
@@ -169,5 +171,8 @@ offset = <CONFIG_RESET_VEC_LOC>; }; #endif + image-header { + location = "end"; + }; }; #endif
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 59/100 x86: Don't repeat microcode in U-Boot if not needed
In reply to Simon GlassAt present if SPL sets up the microcode then it is still included in U-Boot as well. This is wasteful as microcode is large. Adjust the logic in the image to prevent this.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
arch/x86/dts/u-boot.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)
arch/x86/dts/u-boot.dtsi +7 -0
@@ -63,9 +63,16 @@ offset = <CONFIG_X86_OFFSET_U_BOOT>; }; #else +# ifdef CONFIG_SPL + u-boot { + offset = <CONFIG_SYS_TEXT_BASE>; + }; +# else + /* If there is no SPL then we need to put microcode in U-Boot */ u-boot-with-ucode-ptr { offset = <CONFIG_X86_OFFSET_U_BOOT>; }; +# endif #endif #ifdef CONFIG_HAVE_MICROCODE u-boot-dtb-with-ucode {
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 60/100 x86: Separate out U-Boot and device tree in ROM image
In reply to Simon GlassAt present binman does not support updating a device tree that is part of U-Boot (i.e u-boot.bin). Separate the entries into two so that we can get updated entry information. This makes binman_entry_find() work correctly.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
arch/x86/dts/u-boot.dtsi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/x86/dts/u-boot.dtsi +3 -1
@@ -49,9 +49,11 @@ }; u-boot-spl-dtb { }; - u-boot { + u-boot-nodtb { offset = <CONFIG_X86_OFFSET_U_BOOT>; }; + u-boot-dtb { + }; #elif defined(CONFIG_SPL) u-boot-spl-with-ucode-ptr { offset = <CONFIG_X86_OFFSET_SPL>;
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 61/100 x86: Make MSR_PKG_POWER_SKU common
In reply to Simon GlassThis is used on several boards so add it to the common file. Also add a useful power-limit value while we are here.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
arch/x86/include/asm/arch-broadwell/cpu.h | 1 - arch/x86/include/asm/arch-ivybridge/model_206ax.h | 1 - arch/x86/include/asm/msr-index.h | 9 ++++++++- 3 files changed, 8 insertions(+), 3 deletions(-)
arch/x86/include/asm/arch-broadwell/cpu.h +0 -1
@@ -27,7 +27,6 @@#define MSR_VR_CURRENT_CONFIG 0x601#define MSR_VR_MISC_CONFIG 0x603 -#define MSR_PKG_POWER_SKU 0x614#define MSR_DDR_RAPL_LIMIT 0x618#define MSR_VR_MISC_CONFIG2 0x636
arch/x86/include/asm/arch-ivybridge/model_206ax.h +0 -1
@@ -43,7 +43,6 @@#define MSR_PP1_CURRENT_CONFIG 0x602#define PP1_CURRENT_LIMIT_SNB (35 << 3)/* 35 A */ #define PP1_CURRENT_LIMIT_IVB (50 << 3)/* 50 A */ -#define MSR_PKG_POWER_SKU 0x614#define IVB_CONFIG_TDP_MIN_CPUID 0x306a2#define MSR_CONFIG_TDP_LEVEL1 0x649
arch/x86/include/asm/msr-index.h +8 -1
@@ -241,10 +241,17 @@#define PKG_POWER_LIMIT_CLAMP (1 << 16)#define PKG_POWER_LIMIT_TIME_SHIFT 17#define PKG_POWER_LIMIT_TIME_MASK 0x7f +/* +* For Mobile, RAPL default PL1 time window value set to 28 seconds. +* RAPL time window calculation defined as follows: +* Time Window = (float)((1+X/4)*(2*^Y), X Corresponds to [23:22], +* Y to [21:17] in MSR 0x610. 28 sec is equal to 0x6e. +*/ +#define MB_POWER_LIMIT1_TIME_DEFAULT 0x6e#define MSR_PKG_ENERGY_STATUS 0x00000611#define MSR_PKG_PERF_STATUS 0x00000613 -#define MSR_PKG_POWER_INFO 0x00000614 +#define MSR_PKG_POWER_SKU 0x614#define MSR_DRAM_POWER_LIMIT 0x00000618#define MSR_DRAM_ENERGY_STATUS 0x00000619
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 62/100 spi: Correct operations check in dm_spi_xfer()
In reply to Simon GlassAt present we have to have an xfer() method even if it does nothing. This is not correct, so fix it.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
drivers/spi/ich.c | 9 +-------- drivers/spi/spi-uclass.c | 5 ++++- include/spi.h | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-)
drivers/spi/ich.c +1 -8
@@ -493,13 +493,6 @@ static int ich_spi_adjust_size(struct spi_slave *slave, struct spi_mem_op *op)return 0 ; } -static int ich_spi_xfer (struct udevice *dev,unsigned int bitlen, -const void *dout,void *din,unsigned long flags) -{ -printf ("ICH SPI: Only supports memory operations\n" ); -return -1 ; -} -static int ich_spi_probe (struct udevice *dev) {struct ich_spi_platdata *plat =dev_get_platdata (dev);
@@ -612,7 +605,7 @@ static const struct spi_controller_mem_ops ich_controller_mem_ops = { };static const struct dm_spi_ops ich_spi_ops = { - .xfer = ich_spi_xfer, +/* xfer is not supported */ .set_speed = ich_spi_set_speed, .set_mode = ich_spi_set_mode, .mem_ops = &ich_controller_mem_ops,
drivers/spi/spi-uclass.c +4 -1
@@ -85,11 +85,14 @@ int dm_spi_xfer(struct udevice *dev, unsigned int bitlen, const void *dout, void *din, unsigned long flags) { struct udevice *bus = dev->parent; +struct dm_spi_ops *ops =spi_get_ops (bus);if (bus->uclass->uc_drv->id !=UCLASS_SPI )return -EOPNOTSUPP ; +if (!ops->xfer) +return -ENOSYS ; -return spi_get_ops (bus)->xfer (dev, bitlen, dout, din, flags); +return ops->xfer (dev, bitlen, dout, din, flags); } int dm_spi_get_mmap(struct udevice *dev, ulong *map_basep, uint *map_sizep,
include/spi.h +1 -1
@@ -224,7 +224,7 @@ void spi_release_bus(struct spi_slave *slave);int spi_set_wordlen (struct spi_slave *slave,unsigned int wordlen);/** -* SPI transfer +* SPI transfer (optional if mem_ops is used) * * This writes "bitlen" bits out the SPI MOSI port and simultaneously clocks * "bitlen" bits in the SPI MISO port. That's just the way SPI works.
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 63/100 x86: spi: Don't enable SPI_FLASH_BAR by default
In reply to Simon GlassWe don't normally need this on x86 unless the size of SPI flash devices is larger than 16MB. This can be enabled by particular SoCs as needed, since it adds to code size.
Drop the default enabling of this option on x86.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
drivers/spi/Kconfig | 1 - 1 file changed, 1 deletion(-)
drivers/spi/Kconfig +0 -1
@@ -142,7 +142,6 @@ config FSL_DSPI config ICH_SPI bool "Intel ICH SPI driver" - imply SPI_FLASH_BAR help Enable the Intel ICH SPI driver. This driver can be used to access the SPI NOR flash on platforms embedding this Intel
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 64/100 spi: ich: Move init function just above probe()
In reply to Simon GlassIt is annoying to have some of the init code in a different part of the file. Move ich_init_controller() to just above probe() to keep things together.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
drivers/spi/ich.c | 122 +++++++++++++++++++++++----------------------- 1 file changed, 61 insertions(+), 61 deletions(-)
drivers/spi/ich.c +61 -61
@@ -112,67 +112,6 @@ static int ich9_can_do_33mhz(struct udevice *dev)return speed ==1 ; } -static int ich_init_controller (struct udevice *dev, -struct ich_spi_platdata *plat, -struct ich_spi_priv *ctlr) -{ -ulong sbase_addr; -void *sbase; - -/* SBASE is similar */ -pch_get_spi_base (dev->parent, &sbase_addr); - sbase = (void *)sbase_addr; -debug ("%s: sbase=%p\n" , __func__, sbase); - -if (plat->ich_version ==ICHV_7 ) { -struct ich7_spi_regs *ich7_spi = sbase; - - ctlr->opmenu = offsetof(struct ich7_spi_regs , opmenu); - ctlr->menubytes =sizeof (ich7_spi->opmenu); - ctlr->optype = offsetof(struct ich7_spi_regs , optype); - ctlr->addr = offsetof(struct ich7_spi_regs , spia); - ctlr->data = offsetof(struct ich7_spi_regs , spid); - ctlr->databytes =sizeof (ich7_spi->spid); - ctlr->status = offsetof(struct ich7_spi_regs , spis); - ctlr->control = offsetof(struct ich7_spi_regs , spic); - ctlr->bbar = offsetof(struct ich7_spi_regs , bbar); - ctlr->preop = offsetof(struct ich7_spi_regs , preop); - ctlr->base = ich7_spi; - }else if (plat->ich_version ==ICHV_9 ) { -struct ich9_spi_regs *ich9_spi = sbase; - - ctlr->opmenu = offsetof(struct ich9_spi_regs , opmenu); - ctlr->menubytes =sizeof (ich9_spi->opmenu); - ctlr->optype = offsetof(struct ich9_spi_regs , optype); - ctlr->addr = offsetof(struct ich9_spi_regs , faddr); - ctlr->data = offsetof(struct ich9_spi_regs , fdata); - ctlr->databytes =sizeof (ich9_spi->fdata); - ctlr->status = offsetof(struct ich9_spi_regs , ssfs); - ctlr->control = offsetof(struct ich9_spi_regs , ssfc); - ctlr->speed = ctlr->control +2 ; - ctlr->bbar = offsetof(struct ich9_spi_regs , bbar); - ctlr->preop = offsetof(struct ich9_spi_regs , preop); - ctlr->bcr = offsetof(struct ich9_spi_regs , bcr); - ctlr->pr = &ich9_spi->pr[0 ]; - ctlr->base = ich9_spi; - }else { -debug ("ICH SPI: Unrecognised ICH version %d\n" , - plat->ich_version); -return -EINVAL ; - } - -/* Work out the maximum speed we can support */ - ctlr->max_speed =20000000 ; -if (plat->ich_version ==ICHV_9 &&ich9_can_do_33mhz (dev)) - ctlr->max_speed =33000000 ; -debug ("ICH SPI: Version ID %d detected at %p, speed %ld\n" , - plat->ich_version, ctlr->base, ctlr->max_speed); - -ich_set_bbar (ctlr,0 ); - -return 0 ; -} -static void spi_lock_down (struct ich_spi_platdata *plat,void *sbase) {if (plat->ich_version ==ICHV_7 ) {
@@ -493,6 +432,67 @@ static int ich_spi_adjust_size(struct spi_slave *slave, struct spi_mem_op *op)return 0 ; } +static int ich_init_controller (struct udevice *dev, +struct ich_spi_platdata *plat, +struct ich_spi_priv *ctlr) +{ +ulong sbase_addr; +void *sbase; + +/* SBASE is similar */ +pch_get_spi_base (dev->parent, &sbase_addr); + sbase = (void *)sbase_addr; +debug ("%s: sbase=%p\n" , __func__, sbase); + +if (plat->ich_version ==ICHV_7 ) { +struct ich7_spi_regs *ich7_spi = sbase; + + ctlr->opmenu = offsetof(struct ich7_spi_regs , opmenu); + ctlr->menubytes =sizeof (ich7_spi->opmenu); + ctlr->optype = offsetof(struct ich7_spi_regs , optype); + ctlr->addr = offsetof(struct ich7_spi_regs , spia); + ctlr->data = offsetof(struct ich7_spi_regs , spid); + ctlr->databytes =sizeof (ich7_spi->spid); + ctlr->status = offsetof(struct ich7_spi_regs , spis); + ctlr->control = offsetof(struct ich7_spi_regs , spic); + ctlr->bbar = offsetof(struct ich7_spi_regs , bbar); + ctlr->preop = offsetof(struct ich7_spi_regs , preop); + ctlr->base = ich7_spi; + }else if (plat->ich_version ==ICHV_9 ) { +struct ich9_spi_regs *ich9_spi = sbase; + + ctlr->opmenu = offsetof(struct ich9_spi_regs , opmenu); + ctlr->menubytes =sizeof (ich9_spi->opmenu); + ctlr->optype = offsetof(struct ich9_spi_regs , optype); + ctlr->addr = offsetof(struct ich9_spi_regs , faddr); + ctlr->data = offsetof(struct ich9_spi_regs , fdata); + ctlr->databytes =sizeof (ich9_spi->fdata); + ctlr->status = offsetof(struct ich9_spi_regs , ssfs); + ctlr->control = offsetof(struct ich9_spi_regs , ssfc); + ctlr->speed = ctlr->control +2 ; + ctlr->bbar = offsetof(struct ich9_spi_regs , bbar); + ctlr->preop = offsetof(struct ich9_spi_regs , preop); + ctlr->bcr = offsetof(struct ich9_spi_regs , bcr); + ctlr->pr = &ich9_spi->pr[0 ]; + ctlr->base = ich9_spi; + }else { +debug ("ICH SPI: Unrecognised ICH version %d\n" , + plat->ich_version); +return -EINVAL ; + } + +/* Work out the maximum speed we can support */ + ctlr->max_speed =20000000 ; +if (plat->ich_version ==ICHV_9 &&ich9_can_do_33mhz (dev)) + ctlr->max_speed =33000000 ; +debug ("ICH SPI: Version ID %d detected at %p, speed %ld\n" , + plat->ich_version, ctlr->base, ctlr->max_speed); + +ich_set_bbar (ctlr,0 ); + +return 0 ; +} +static int ich_spi_probe (struct udevice *dev) {struct ich_spi_platdata *plat =dev_get_platdata (dev);
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 65/100 spi: ich: Move the protection/lockdown code into a function
In reply to Simon GlassReduce the size of the probe function but putting this code into its own function.
Also remove the assumption that the PCH is always a parent of the SPI controller, as this is not the case APL platforms. Use driver model to find the PCH instead.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
drivers/spi/ich.c | 63 ++++++++++++++++++++++++++++++++--------------- drivers/spi/ich.h | 1 + 2 files changed, 44 insertions(+), 20 deletions(-)
drivers/spi/ich.c +43 -20
@@ -98,13 +98,14 @@ static void ich_set_bbar(struct ich_spi_priv *ctlr, uint32_t minaddr)/* @return 1 if the SPI flash supports the 33MHz speed */ static int ich9_can_do_33mhz (struct udevice *dev) { +struct ich_spi_priv *priv =dev_get_priv (dev);u32 fdod, speed;/* Observe SPI Descriptor Component Section 0 */ -dm_pci_write_config32 (dev->parent,0xb0 ,0x1000 ); +dm_pci_write_config32 (priv->pch,0xb0 ,0x1000 );/* Extract the Write/Erase SPI Frequency from descriptor */ -dm_pci_read_config32 (dev->parent,0xb4 , &fdod); +dm_pci_read_config32 (priv->pch,0xb4 , &fdod);/* Bits 23:21 have the fast read clock frequency, 0=20MHz, 1=33MHz */ speed = (fdod >>21 ) &7 ;
@@ -432,6 +433,37 @@ static int ich_spi_adjust_size(struct spi_slave *slave, struct spi_mem_op *op)return 0 ; } +static int ich_protect_lockdown (struct udevice *dev) +{ +struct ich_spi_platdata *plat =dev_get_platdata (dev); +struct ich_spi_priv *priv =dev_get_priv (dev); +int ret = -ENOSYS ; + +/* Disable the BIOS write protect so write commands are allowed */ +if (priv->pch) + ret =pch_set_spi_protect (priv->pch, false); +if (ret == -ENOSYS ) { +u8 bios_cntl; + + bios_cntl =ich_readb (priv, priv->bcr); + bios_cntl &= ~BIT (5 );/* clear Enable InSMM_STS (EISS) */ + bios_cntl |=1 ;/* Write Protect Disable (WPD) */ +ich_writeb (priv, bios_cntl, priv->bcr); + }else if (ret) { +debug ("%s: Failed to disable write-protect: err=%d\n" , + __func__, ret); +return ret; + } + +/* Lock down SPI controller settings if required */ +if (plat->lockdown) { +ich_spi_config_opcode (dev); +spi_lock_down (plat, priv->base); + } + +return 0 ; +} +static int ich_init_controller (struct udevice *dev,struct ich_spi_platdata *plat,struct ich_spi_priv *ctlr)
@@ -497,30 +529,15 @@ static int ich_spi_probe(struct udevice *dev) {struct ich_spi_platdata *plat =dev_get_platdata (dev);struct ich_spi_priv *priv =dev_get_priv (dev); -uint8_t bios_cntl;int ret; ret =ich_init_controller (dev, plat, priv);if (ret)return ret; -/* Disable the BIOS write protect so write commands are allowed */ - ret =pch_set_spi_protect (dev->parent, false); -if (ret == -ENOSYS ) { - bios_cntl =ich_readb (priv, priv->bcr); - bios_cntl &= ~BIT (5 );/* clear Enable InSMM_STS (EISS) */ - bios_cntl |=1 ;/* Write Protect Disable (WPD) */ -ich_writeb (priv, bios_cntl, priv->bcr); - }else if (ret) { -debug ("%s: Failed to disable write-protect: err=%d\n" , - __func__, ret); -return ret; - } -/* Lock down SPI controller settings if required */ -if (plat->lockdown) { -ich_spi_config_opcode (dev); -spi_lock_down (plat, priv->base); - } + ret =ich_protect_lockdown (dev); +if (ret) +return ret; priv->cur_speed = priv->max_speed;
@@ -579,9 +596,15 @@ static int ich_spi_child_pre_probe(struct udevice *dev)static int ich_spi_ofdata_to_platdata (struct udevice *dev) {struct ich_spi_platdata *plat =dev_get_platdata (dev); +struct ich_spi_priv *priv =dev_get_priv (dev);int node =dev_of_offset (dev);int ret; +/* Find a PCH if there is one */ +uclass_first_device (UCLASS_PCH , &priv->pch); +if (!priv->pch) + priv->pch =dev_get_parent (dev); + ret =fdt_node_check_compatible (gd->fdt_blob, node,"intel,ich7-spi" );if (ret ==0 ) { plat->ich_version =ICHV_7 ;
drivers/spi/ich.h +1 -0
@@ -191,6 +191,7 @@ struct ich_spi_priv {ulong max_speed;/* Maximum bus speed in MHz */ ulong cur_speed;/* Current bus speed */ struct spi_trans trans;/* current transaction in progress */ + struct udevice *pch; /* PCH, used to control SPI access */ };#endif /* _ICH_H_ */
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 66/100 spi: ich: Convert to livetree
In reply to Simon GlassUse dev_get_driver_data() to obtain the device type. It has the same effect and is shorter.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
drivers/spi/ich.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-)
drivers/spi/ich.c +5 -17
@@ -597,28 +597,16 @@ static int ich_spi_ofdata_to_platdata(struct udevice *dev) {struct ich_spi_platdata *plat =dev_get_platdata (dev);struct ich_spi_priv *priv =dev_get_priv (dev); -int node =dev_of_offset (dev); -int ret;/* Find a PCH if there is one */ uclass_first_device (UCLASS_PCH , &priv->pch);if (!priv->pch) priv->pch =dev_get_parent (dev); - ret =fdt_node_check_compatible (gd->fdt_blob, node,"intel,ich7-spi" ); -if (ret ==0 ) { - plat->ich_version =ICHV_7 ; - }else { - ret =fdt_node_check_compatible (gd->fdt_blob, node, -"intel,ich9-spi" ); -if (ret ==0 ) - plat->ich_version =ICHV_9 ; - } + plat->ich_version =dev_get_driver_data (dev); + plat->lockdown =dev_read_bool (dev,"intel,spi-lock-down" ); - plat->lockdown =fdtdec_get_bool (gd->fdt_blob, node, -"intel,spi-lock-down" ); - -return ret; +return 0 ; }static const struct spi_controller_mem_ops ich_controller_mem_ops = {
@@ -639,8 +627,8 @@ static const struct dm_spi_ops ich_spi_ops = { };static const struct udevice_id ich_spi_ids[] = { - { .compatible ="intel,ich7-spi" }, - { .compatible ="intel,ich9-spi" }, + { .compatible ="intel,ich7-spi" ,ICHV_7 }, + { .compatible ="intel,ich9-spi" ,ICHV_9 }, { } };
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 67/100 spi: ich: Fix header order
In reply to Simon GlassMove the header files into the right order.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
drivers/spi/ich.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/ich.c +2 -2
@@ -6,6 +6,7 @@*/ #include <common.h> +#include <div64.h> #include <dm.h> #include <errno.h> #include <malloc.h>
@@ -13,9 +14,8 @@#include <pci.h> #include <pci_ids.h> #include <spi.h> -#include <asm/io.h> #include <spi-mem.h> -#include <div64.h> +#include <asm/io.h> #include "ich.h"
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 68/100 spi: ich: Various small tidy-ups
In reply to Simon GlassUse debug() instead of printf() to reduce code size and change a bool return value to the use the 'bool' type. Also drop the global data declaration since it not actually used. Finally, set the log category.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
drivers/spi/ich.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/spi/ich.c +8 -9
@@ -5,6 +5,8 @@* This file is derived from the flashrom project. */ +#define LOG_CATEGORY UCLASS_SPI +#include <common.h> #include <div64.h> #include <dm.h>
@@ -19,8 +21,6 @@#include "ich.h" -DECLARE_GLOBAL_DATA_PTR ; -#ifdef DEBUG_TRACE #define debug_trace(fmt, args...) debug(fmt, ##args)#else
@@ -96,7 +96,7 @@ static void ich_set_bbar(struct ich_spi_priv *ctlr, uint32_t minaddr) }/* @return 1 if the SPI flash supports the 33MHz speed */ -static int ich9_can_do_33mhz (struct udevice *dev) +static bool ich9_can_do_33mhz (struct udevice *dev) {struct ich_spi_priv *priv =dev_get_priv (dev);u32 fdod, speed;
@@ -173,8 +173,7 @@ static int spi_setup_opcode(struct ich_spi_priv *ctlr, struct spi_trans *trans, }if (opcode_index == ctlr->menubytes) { -printf ("ICH SPI: Opcode %x not found\n" , - trans->opcode); +debug ("ICH SPI: Opcode %x not found\n" , trans->opcode);return -EINVAL ; }
@@ -182,8 +181,8 @@ static int spi_setup_opcode(struct ich_spi_priv *ctlr, struct spi_trans *trans, optype = (optypes >> (opcode_index *2 )) &0x3 ;if (optype != trans->type) { -printf ("ICH SPI: Transaction doesn't fit type %d\n" , - optype); +debug ("ICH SPI: Transaction doesn't fit type %d\n" , + optype);return -ENOSPC ; }return opcode_index;
@@ -214,9 +213,9 @@ static int ich_status_poll(struct ich_spi_priv *ctlr, u16 bitmask, }udelay (10 ); } +debug ("ICH SPI: SCIP timeout, read %x, expected %x, wts %x %x\n" , + status, bitmask, wait_til_set, status & bitmask); -printf ("ICH SPI: SCIP timeout, read %x, expected %x\n" , - status, bitmask);return -ETIMEDOUT ; }
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 69/100 spi: ich: Add mmio_base to struct ich_spi_platdata
In reply to Simon GlassIt is useful to store the mmio base in platdata. It reduces the amount of casting needed. Update the code and move the struct to the C file at the same time, as we will need to use with of-platdata.
---
Changes in v4:
- Use priv->pch instead of dev->parent
Changes in v3: None
Changes in v2: None
drivers/spi/ich.c | 27 +++++++++++++-------------- drivers/spi/ich.h | 5 ----- 2 files changed, 13 insertions(+), 19 deletions(-)
drivers/spi/ich.c +13 -14
@@ -27,6 +27,12 @@ #define debug_trace(x, args...)#endif +struct ich_spi_platdata { +enum ich_version ich_version;/* Controller version, 7 or 9 */ +bool lockdown;/* lock down controller settings? */ +ulong mmio_base;/* Base of MMIO registers */ +}; +static u8 ich_readb (struct ich_spi_priv *priv,int reg) {u8 value =readb (priv->base + reg);
@@ -467,16 +473,9 @@ static int ich_init_controller(struct udevice *dev,struct ich_spi_platdata *plat, struct ich_spi_priv *ctlr) { - ulong sbase_addr; -void *sbase; - -/* SBASE is similar */ -pch_get_spi_base (dev->parent, &sbase_addr); - sbase = (void *)sbase_addr; -debug ("%s: sbase=%p\n" , __func__, sbase); - + ctlr->base = (void *)plat->mmio_base;if (plat->ich_version ==ICHV_7 ) { -struct ich7_spi_regs *ich7_spi = sbase; +struct ich7_spi_regs *ich7_spi = ctlr->base; ctlr->opmenu = offsetof(struct ich7_spi_regs , opmenu); ctlr->menubytes =sizeof (ich7_spi->opmenu);
@@ -488,9 +487,8 @@ static int ich_init_controller(struct udevice *dev, ctlr->control = offsetof(struct ich7_spi_regs , spic); ctlr->bbar = offsetof(struct ich7_spi_regs , bbar); ctlr->preop = offsetof(struct ich7_spi_regs , preop); - ctlr->base = ich7_spi; }else if (plat->ich_version ==ICHV_9 ) { -struct ich9_spi_regs *ich9_spi = sbase; +struct ich9_spi_regs *ich9_spi = ctlr->base; ctlr->opmenu = offsetof(struct ich9_spi_regs , opmenu); ctlr->menubytes =sizeof (ich9_spi->opmenu);
@@ -505,7 +503,6 @@ static int ich_init_controller(struct udevice *dev, ctlr->preop = offsetof(struct ich9_spi_regs , preop); ctlr->bcr = offsetof(struct ich9_spi_regs , bcr); ctlr->pr = &ich9_spi->pr[0 ]; - ctlr->base = ich9_spi; }else {debug ("ICH SPI: Unrecognised ICH version %d\n" , plat->ich_version);
@@ -516,8 +513,8 @@ static int ich_init_controller(struct udevice *dev, ctlr->max_speed =20000000 ;if (plat->ich_version ==ICHV_9 &&ich9_can_do_33mhz (dev)) ctlr->max_speed =33000000 ; -debug ("ICH SPI: Version ID %d detected at %p, speed %ld\n" , - plat->ich_version, ctlr->base, ctlr->max_speed); +debug ("ICH SPI: Version ID %d detected at %lx, speed %ld\n" , + plat->ich_version, plat->mmio_base, ctlr->max_speed);ich_set_bbar (ctlr,0 );
@@ -605,6 +602,8 @@ static int ich_spi_ofdata_to_platdata(struct udevice *dev) plat->ich_version =dev_get_driver_data (dev); plat->lockdown =dev_read_bool (dev,"intel,spi-lock-down" ); +pch_get_spi_base (priv->pch, &plat->mmio_base); +return 0 ; }
drivers/spi/ich.h +0 -5
@@ -168,11 +168,6 @@ enum ich_version { ICHV_9, }; -struct ich_spi_platdata { -enum ich_version ich_version;/* Controller version, 7 or 9 */ -bool lockdown;/* lock down controller settings? */ -}; -struct ich_spi_priv {int opmenu;int menubytes;
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 70/100 dm: doc: Add a note about of-platdata and header files
In reply to Simon GlassWe don't want to include dt-structs.h in header files, so add a note about that.
---
Changes in v4:
- Add a patch to explain of-platdata and header files
Changes in v3: None
Changes in v2: None
doc/driver-model/of-plat.rst | 6 ++++++ 1 file changed, 6 insertions(+)
doc/driver-model/of-plat.rst +6 -0
@@ -279,6 +279,12 @@ For example: }; +Note that struct mmc_platdata is defined in the C file, not in a header. This +is to avoid needing to include dt-structs.h in a header file. The idea is to +keep the use of each of-platdata struct to the smallest possible code area. +There is just one driver C file for each struct, that can convert from the +of-platdata struct to the standard one used by the driver. + In the case where SPL_OF_PLATDATA is enabled, platdata_auto_alloc_size is still used to allocate space for the platform data. This is different from the normal behaviour and is triggered by the use of of-platdata (strictly
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 71/100 spi: ich: Correct max-size bug in ich_spi_adjust_size()
In reply to Simon GlassThis incorrectly shortens read operations if there is a maximum write size but no maximum read size. Fix it.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
drivers/spi/ich.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/spi/ich.c +5 -3
@@ -425,9 +425,11 @@ static int ich_spi_adjust_size(struct spi_slave *slave, struct spi_mem_op *op) page_offset =do_div (aux,ICH_BOUNDARY ); } -if (op->data.dir ==SPI_MEM_DATA_IN && slave->max_read_size) { - op->data.nbytes =min (ICH_BOUNDARY - page_offset, - slave->max_read_size); +if (op->data.dir ==SPI_MEM_DATA_IN ) { +if (slave->max_read_size) { + op->data.nbytes =min (ICH_BOUNDARY - page_offset, + slave->max_read_size); + } }else if (slave->max_write_size) { op->data.nbytes =min (ICH_BOUNDARY - page_offset, slave->max_write_size);
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 72/100 spi: ich: Support of-platdata for fast-spi
In reply to Simon GlassThe Intel Fast SPI interface is similar to ICH. Add of-platdata support for this using the "intel,fast-spi" compatible string.
---
Changes in v4:
- Use the new pci_ofplat_get_devfn() function
Changes in v3: None
Changes in v2: None
drivers/spi/ich.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/spi/ich.c +15 -3
@@ -10,6 +10,7 @@#include <common.h> #include <div64.h> #include <dm.h> +#include <dt-structs.h> #include <errno.h> #include <malloc.h> #include <pch.h>
@@ -28,9 +29,13 @@#endif struct ich_spi_platdata { +#if CONFIG_IS_ENABLED (OF_PLATDATA ) +struct dtd_intel_fast_spi dtplat; +#endif enum ich_version ich_version;/* Controller version, 7 or 9 */ bool lockdown;/* lock down controller settings? */ ulong mmio_base;/* Base of MMIO registers */ +pci_dev_t bdf;/* PCI address used by of-platdata */ };static u8 ich_readb (struct ich_spi_priv *priv,int reg)
@@ -594,6 +599,8 @@ static int ich_spi_child_pre_probe(struct udevice *dev)static int ich_spi_ofdata_to_platdata (struct udevice *dev) {struct ich_spi_platdata *plat =dev_get_platdata (dev); + +#if !CONFIG_IS_ENABLED (OF_PLATDATA )struct ich_spi_priv *priv =dev_get_priv (dev);/* Find a PCH if there is one */
@@ -603,8 +610,13 @@ static int ich_spi_ofdata_to_platdata(struct udevice *dev) plat->ich_version =dev_get_driver_data (dev); plat->lockdown =dev_read_bool (dev,"intel,spi-lock-down" ); -pch_get_spi_base (priv->pch, &plat->mmio_base); +#else + plat->ich_version =ICHV_APL ; + plat->mmio_base = plat->dtplat.early_regs[0 ]; + plat->bdf =pci_ofplat_get_devfn (plat->dtplat.reg[0 ]); +#endif +debug ("%s: mmio_base=%lx\n" , __func__, plat->mmio_base);return 0 ; }
@@ -632,8 +644,8 @@ static const struct udevice_id ich_spi_ids[] = { { } }; -U_BOOT_DRIVER (ich_spi) = { - .name ="ich_spi" , +U_BOOT_DRIVER (intel_fast_spi) = { + .name ="intel_fast_spi" , .id =UCLASS_SPI , .of_match = ich_spi_ids, .ops = &ich_spi_ops,
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 73/100 spi: ich: Support hardware sequencing
In reply to Simon GlassApollo Lake (APL) only supports hardware sequencing. Add support for this into the SPI driver, as an option.
---
Changes in v4:
- Fix comment for exec_sync_hwseq_xfer()
- apollolake -> Apollo Lake
Changes in v3: None
Changes in v2: None
drivers/spi/ich.c | 205 +++++++++++++++++++++++++++++++++++++++++++++- drivers/spi/ich.h | 39 +++++++++ 2 files changed, 241 insertions(+), 3 deletions(-)
drivers/spi/ich.c +202 -3
@@ -17,7 +17,9 @@#include <pci.h> #include <pci_ids.h> #include <spi.h> +#include <spi_flash.h> #include <spi-mem.h> +#include <asm/fast_spi.h> #include <asm/io.h> #include "ich.h"
@@ -36,6 +38,7 @@ struct ich_spi_platdata {bool lockdown;/* lock down controller settings? */ ulong mmio_base;/* Base of MMIO registers */ pci_dev_t bdf;/* PCI address used by of-platdata */ +bool hwseq;/* Use hardware sequencing (not s/w) */ };static u8 ich_readb (struct ich_spi_priv *priv,int reg)
@@ -245,7 +248,8 @@ static void ich_spi_config_opcode(struct udevice *dev)ich_writel (ctlr,SPI_OPMENU_UPPER , ctlr->opmenu +sizeof (u32)); } -static int ich_spi_exec_op (struct spi_slave *slave,const struct spi_mem_op *op) +static int ich_spi_exec_op_swseq (struct spi_slave *slave, +const struct spi_mem_op *op) {struct udevice *bus =dev_get_parent (slave->dev);struct ich_spi_platdata *plat =dev_get_platdata (bus);
@@ -416,6 +420,197 @@ static int ich_spi_exec_op(struct spi_slave *slave, const struct spi_mem_op *op)return 0 ; } +/* +* Ensure read/write xfer len is not greater than SPIBAR_FDATA_FIFO_SIZE and +* that the operation does not cross page boundary. +*/ +static uint get_xfer_len (u32 offset,int len,int page_size) +{ +uint xfer_len =min (len,SPIBAR_FDATA_FIFO_SIZE ); +uint bytes_left =ALIGN (offset, page_size) - offset; + +if (bytes_left) + xfer_len =min (xfer_len, bytes_left); + +return xfer_len; +} + +/* Fill FDATAn FIFO in preparation for a write transaction */ +static void fill_xfer_fifo (struct fast_spi_regs *regs,const void *data, +uint len) +{ +memcpy (regs->fdata, data, len); +} + +/* Drain FDATAn FIFO after a read transaction populates data */ +static void drain_xfer_fifo (struct fast_spi_regs *regs,void *dest,uint len) +{ +memcpy (dest, regs->fdata, len); +} + +/* Fire up a transfer using the hardware sequencer */ +static void start_hwseq_xfer (struct fast_spi_regs *regs,uint hsfsts_cycle, +uint offset,uint len) +{ +/* Make sure all W1C status bits get cleared */ +u32 hsfsts; + + hsfsts =readl (®s->hsfsts_ctl); + hsfsts &= ~(HSFSTS_FCYCLE_MASK |HSFSTS_FDBC_MASK ); + hsfsts |=HSFSTS_AEL |HSFSTS_FCERR |HSFSTS_FDONE ; + +/* Set up transaction parameters */ + hsfsts |= hsfsts_cycle <<HSFSTS_FCYCLE_SHIFT ; + hsfsts |= ((len -1 ) <<HSFSTS_FDBC_SHIFT ) &HSFSTS_FDBC_MASK ; + hsfsts |=HSFSTS_FGO ; + +writel (offset, ®s->faddr); +writel (hsfsts, ®s->hsfsts_ctl); +} + +static int wait_for_hwseq_xfer (struct fast_spi_regs *regs,uint offset) +{ +ulong start; +u32 hsfsts; + + start =get_timer (0 ); +do { + hsfsts =readl (®s->hsfsts_ctl); +if (hsfsts &HSFSTS_FCERR ) { +debug ("SPI transaction error at offset %x HSFSTS = %08x\n" , + offset, hsfsts); +return -EIO ; + } +if (hsfsts &HSFSTS_AEL ) +return -EPERM ; + +if (hsfsts &HSFSTS_FDONE ) +return 0 ; + }while (get_timer (start) <SPIBAR_HWSEQ_XFER_TIMEOUT_MS ); + +debug ("SPI transaction timeout@offset %x HSFSTS = %08x, timer %d\n" , + offset, hsfsts, (uint )get_timer (start)); + +return -ETIMEDOUT ; +} + +/** +* exec_sync_hwseq_xfer() - Execute flash transfer by hardware sequencing +* +* This waits until complete or timeout +* +* @regs: SPI registers +* @hsfsts_cycle: Cycle type (enum hsfsts_cycle_t) +* @offset: Offset to access +* @len: Number of bytes to transfer (can be 0) +* @return 0 if OK, -EIO on flash-cycle error (FCERR), -EPERM on access error +* (AEL), -ETIMEDOUT on timeout +*/ +static int exec_sync_hwseq_xfer (struct fast_spi_regs *regs,uint hsfsts_cycle, +uint offset,uint len) +{ +start_hwseq_xfer (regs, hsfsts_cycle, offset, len); + +return wait_for_hwseq_xfer (regs, offset); +} + +static int ich_spi_exec_op_hwseq (struct spi_slave *slave, +const struct spi_mem_op *op) +{ +struct spi_flash *flash =dev_get_uclass_priv (slave->dev); +struct udevice *bus =dev_get_parent (slave->dev); +struct ich_spi_priv *priv =dev_get_priv (bus); +struct fast_spi_regs *regs = priv->base; +uint page_size; +uint offset; +int cycle; +uint len; +bool out; +int ret; +u8 *buf; + + offset = op->addr.val; + len = op->data.nbytes; + +switch (op->cmd.opcode) { +case SPINOR_OP_RDID : + cycle =HSFSTS_CYCLE_RDID ; +break ; +case SPINOR_OP_READ_FAST : + cycle =HSFSTS_CYCLE_READ ; +break ; +case SPINOR_OP_PP : + cycle =HSFSTS_CYCLE_WRITE ; +break ; +case SPINOR_OP_WREN : +/* Nothing needs to be done */ +return 0 ; +case SPINOR_OP_WRSR : + cycle =HSFSTS_CYCLE_WR_STATUS ; +break ; +case SPINOR_OP_RDSR : + cycle =HSFSTS_CYCLE_RD_STATUS ; +break ; +case SPINOR_OP_WRDI : +return 0 ;/* ignore */ +case SPINOR_OP_BE_4K : + cycle =HSFSTS_CYCLE_4K_ERASE ; +while (len) { +uint xfer_len =0x1000 ; + + ret =exec_sync_hwseq_xfer (regs, cycle, offset,0 ); +if (ret) +return ret; + offset += xfer_len; + len -= xfer_len; + } +return 0 ; +default : +debug ("Unknown cycle %x\n" , op->cmd.opcode); +return -EINVAL ; + }; + + out = op->data.dir ==SPI_MEM_DATA_OUT ; + buf = out ? (u8 *)op->data.buf.out : op->data.buf.in; + page_size = flash->page_size ? :256 ; + +while (len) { +uint xfer_len =get_xfer_len (offset, len, page_size); + +if (out) +fill_xfer_fifo (regs, buf, xfer_len); + + ret =exec_sync_hwseq_xfer (regs, cycle, offset, xfer_len); +if (ret) +return ret; + +if (!out) +drain_xfer_fifo (regs, buf, xfer_len); + + offset += xfer_len; + buf += xfer_len; + len -= xfer_len; + } + +return 0 ; +} + +static int ich_spi_exec_op (struct spi_slave *slave,const struct spi_mem_op *op) +{ +struct udevice *bus =dev_get_parent (slave->dev); +struct ich_spi_platdata *plat =dev_get_platdata (bus); +int ret; + +bootstage_start (BOOTSTAGE_ID_ACCUM_SPI ,"fast_spi" ); +if (plat->hwseq) + ret =ich_spi_exec_op_hwseq (slave, op); +else + ret =ich_spi_exec_op_swseq (slave, op); +bootstage_accum (BOOTSTAGE_ID_ACCUM_SPI ); + +return ret; +} +static int ich_spi_adjust_size (struct spi_slave *slave,struct spi_mem_op *op) {unsigned int page_offset;
@@ -583,9 +778,11 @@ static int ich_spi_child_pre_probe(struct udevice *dev)/* * Yes this controller can only write a small number of bytes at -* once! The limit is typically 64 bytes. +* once! The limit is typically 64 bytes. For hardware sequencing a +* a loop is used to get around this. */ - slave->max_write_size = priv->databytes; +if (!plat->hwseq) + slave->max_write_size = priv->databytes;/* * ICH 7 SPI controller only supports array read command * and byte program command for SST flash
@@ -611,10 +808,12 @@ static int ich_spi_ofdata_to_platdata(struct udevice *dev) plat->ich_version =dev_get_driver_data (dev); plat->lockdown =dev_read_bool (dev,"intel,spi-lock-down" );pch_get_spi_base (priv->pch, &plat->mmio_base); + plat->hwseq =dev_read_u32_default (dev,"intel,hardware-seq" ,0 );#else plat->ich_version =ICHV_APL ; plat->mmio_base = plat->dtplat.early_regs[0 ]; plat->bdf =pci_ofplat_get_devfn (plat->dtplat.reg[0 ]); + plat->hwseq = plat->dtplat.intel_hardware_seq;#endif debug ("%s: mmio_base=%lx\n" , __func__, plat->mmio_base);
drivers/spi/ich.h +39 -0
@@ -163,6 +163,45 @@ struct spi_trans {#define ICH_BOUNDARY 0x1000 +#define HSFSTS_FDBC_SHIFT 24 +#define HSFSTS_FDBC_MASK (0x3f << HSFSTS_FDBC_SHIFT) +#define HSFSTS_WET BIT(21) +#define HSFSTS_FCYCLE_SHIFT 17 +#define HSFSTS_FCYCLE_MASK (0xf << HSFSTS_FCYCLE_SHIFT) + +/* Supported flash cycle types */ +enum hsfsts_cycle_t { +HSFSTS_CYCLE_READ =0 , +HSFSTS_CYCLE_WRITE =2 , +HSFSTS_CYCLE_4K_ERASE , +HSFSTS_CYCLE_64K_ERASE , +HSFSTS_CYCLE_RDSFDP , +HSFSTS_CYCLE_RDID , +HSFSTS_CYCLE_WR_STATUS , +HSFSTS_CYCLE_RD_STATUS , +}; + +#define HSFSTS_FGO BIT(16) +#define HSFSTS_FLOCKDN BIT(15) +#define HSFSTS_FDV BIT(14) +#define HSFSTS_FDOPSS BIT(13) +#define HSFSTS_WRSDIS BIT(11) +#define HSFSTS_SAF_CE BIT(8) +#define HSFSTS_SAF_ACTIVE BIT(7) +#define HSFSTS_SAF_LE BIT(6) +#define HSFSTS_SCIP BIT(5) +#define HSFSTS_SAF_DLE BIT(4) +#define HSFSTS_SAF_ERROR BIT(3) +#define HSFSTS_AEL BIT(2) +#define HSFSTS_FCERR BIT(1) +#define HSFSTS_FDONE BIT(0) +#define HSFSTS_W1C_BITS 0xff + +/* Maximum bytes of data that can fit in FDATAn (0x10) registers */ +#define SPIBAR_FDATA_FIFO_SIZE 0x40 + +#define SPIBAR_HWSEQ_XFER_TIMEOUT_MS 5000 +enum ich_version {ICHV_7 ,ICHV_9 ,
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 74/100 spi: ich: Add support for get_mmap() method
In reply to Simon GlassAdd this method so that the memory-mapped location of the SPI flash can be queried.
---
Changes in v4:
- Use the new pci_ofplat_get_devfn() function
Changes in v3: None
Changes in v2: None
drivers/spi/ich.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
drivers/spi/ich.c +32 -0
@@ -611,6 +611,37 @@ static int ich_spi_exec_op(struct spi_slave *slave, const struct spi_mem_op *op)return ret; } +static int ich_get_mmap_bus (struct udevice *bus,ulong *map_basep, +uint *map_sizep,uint *offsetp) +{ +pci_dev_t spi_bdf; + +#if !CONFIG_IS_ENABLED (OF_PLATDATA ) +struct pci_child_platdata *pplat =dev_get_parent_platdata (bus); + + spi_bdf = pplat->devfn; +#else +struct ich_spi_platdata *plat =dev_get_platdata (bus); + +/* +* We cannot rely on plat->bdf being set up yet since this method can +* be called before the device is probed. Use the of-platdata directly +* instead. +*/ + spi_bdf =pci_ofplat_get_devfn (plat->dtplat.reg[0 ]); +#endif + +return fast_spi_get_bios_mmap (spi_bdf, map_basep, map_sizep, offsetp); +} + +static int ich_get_mmap (struct udevice *dev,ulong *map_basep,uint *map_sizep, +uint *offsetp) +{ +struct udevice *bus =dev_get_parent (dev); + +return ich_get_mmap_bus (bus, map_basep, map_sizep, offsetp); +} +static int ich_spi_adjust_size (struct spi_slave *slave,struct spi_mem_op *op) {unsigned int page_offset;
@@ -831,6 +862,7 @@ static const struct dm_spi_ops ich_spi_ops = { .set_speed = ich_spi_set_speed, .set_mode = ich_spi_set_mode, .mem_ops = &ich_controller_mem_ops, + .get_mmap = ich_get_mmap,/* * cs_info is not needed, since we require all chip selects to be * in the device tree explicitly
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 75/100 spi: ich: Add TPL support
In reply to Simon GlassIn TPL we want to reduce code size and support running with CONFIG_PCI disabled. Add special code to handle this using a fixed BAR programmed into the SPI on boot. Also cache the SPI flash to speed up boot.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
drivers/spi/ich.c | 46 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-)
drivers/spi/ich.c +42 -4
@@ -19,8 +19,10 @@#include <spi.h> #include <spi_flash.h> #include <spi-mem.h> +#include <spl.h> #include <asm/fast_spi.h> #include <asm/io.h> +#include <asm/mtrr.h> #include "ich.h"
@@ -115,6 +117,8 @@ static bool ich9_can_do_33mhz(struct udevice *dev)struct ich_spi_priv *priv =dev_get_priv (dev);u32 fdod, speed; +if (!CONFIG_IS_ENABLED (PCI )) +return false;/* Observe SPI Descriptor Component Section 0 */ dm_pci_write_config32 (priv->pch,0xb0 ,0x1000 );
@@ -706,6 +710,15 @@ static int ich_init_controller(struct udevice *dev,struct ich_spi_platdata *plat, struct ich_spi_priv *ctlr) { + if (spl_phase() == PHASE_TPL) { + struct ich_spi_platdata *plat = dev_get_platdata(dev); +int ret; + + ret =fast_spi_early_init (plat->bdf, plat->mmio_base); +if (ret) +return ret; + } + ctlr->base = (void *)plat->mmio_base;if (plat->ich_version ==ICHV_7 ) {struct ich7_spi_regs *ich7_spi = ctlr->base;
@@ -754,6 +767,25 @@ static int ich_init_controller(struct udevice *dev,return 0 ; } +static int ich_cache_bios_region (struct udevice *dev) +{ +ulong map_base; +uint map_size; +uint offset; +ulong base; +int ret; + + ret =ich_get_mmap_bus (dev, &map_base, &map_size, &offset); +if (ret) +return ret; + + base = (4ULL <<30 ) - map_size; +mtrr_set_next_var (MTRR_TYPE_WRPROT , base, map_size); +log_debug ("BIOS cache base=%lx, size=%x\n" , base, (uint )map_size); + +return 0 ; +} +static int ich_spi_probe (struct udevice *dev) {struct ich_spi_platdata *plat =dev_get_platdata (dev);
@@ -764,10 +796,16 @@ static int ich_spi_probe(struct udevice *dev)if (ret)return ret; - ret =ich_protect_lockdown (dev); -if (ret) -return ret; - +if (spl_phase () ==PHASE_TPL ) { +/* Cache the BIOS to speed things up */ + ret =ich_cache_bios_region (dev); +if (ret) +return ret; + }else { + ret =ich_protect_lockdown (dev); +if (ret) +return ret; + } priv->cur_speed = priv->max_speed;return 0 ;
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 76/100 spi: ich: Add Apollo Lake support
In reply to Simon GlassAdd support for Apollo Lake to the ICH driver. This involves adjusting the mmio address and skipping setting of the bbar.
---
Changes in v4:
- apollolake -> Apollo Lake
Changes in v3: None
Changes in v2: None
drivers/spi/ich.c | 19 ++++++++++++++----- drivers/spi/ich.h | 1 + 2 files changed, 15 insertions(+), 5 deletions(-)
drivers/spi/ich.c +14 -5
@@ -105,10 +105,12 @@ static void ich_set_bbar(struct ich_spi_priv *ctlr, uint32_t minaddr)const uint32_t bbar_mask =0x00ffff00 ;uint32_t ichspi_bbar; - minaddr &= bbar_mask; - ichspi_bbar =ich_readl (ctlr, ctlr->bbar) & ~bbar_mask; - ichspi_bbar |= minaddr; -ich_writel (ctlr, ichspi_bbar, ctlr->bbar); +if (ctlr->bbar) { + minaddr &= bbar_mask; + ichspi_bbar =ich_readl (ctlr, ctlr->bbar) & ~bbar_mask; + ichspi_bbar |= minaddr; +ich_writel (ctlr, ichspi_bbar, ctlr->bbar); + } }/* @return 1 if the SPI flash supports the 33MHz speed */
@@ -749,6 +751,7 @@ static int ich_init_controller(struct udevice *dev, ctlr->preop = offsetof(struct ich9_spi_regs , preop); ctlr->bcr = offsetof(struct ich9_spi_regs , bcr); ctlr->pr = &ich9_spi->pr[0 ]; + }else if (plat->ich_version ==ICHV_APL ) { }else {debug ("ICH SPI: Unrecognised ICH version %d\n" , plat->ich_version);
@@ -876,7 +879,12 @@ static int ich_spi_ofdata_to_platdata(struct udevice *dev) plat->ich_version =dev_get_driver_data (dev); plat->lockdown =dev_read_bool (dev,"intel,spi-lock-down" ); -pch_get_spi_base (priv->pch, &plat->mmio_base); +if (plat->ich_version ==ICHV_APL ) { + plat->mmio_base =dm_pci_read_bar32 (dev,0 ); + }else { +/* SBASE is similar */ +pch_get_spi_base (priv->pch, &plat->mmio_base); + } plat->hwseq =dev_read_u32_default (dev,"intel,hardware-seq" ,0 );#else plat->ich_version =ICHV_APL ;
@@ -910,6 +918,7 @@ static const struct dm_spi_ops ich_spi_ops = {static const struct udevice_id ich_spi_ids[] = { { .compatible ="intel,ich7-spi" ,ICHV_7 }, { .compatible ="intel,ich9-spi" ,ICHV_9 }, + { .compatible ="intel,fast-spi" ,ICHV_APL }, { } };
drivers/spi/ich.h +1 -0
@@ -205,6 +205,7 @@ enum hsfsts_cycle_t {enum ich_version {ICHV_7 ,ICHV_9 , +ICHV_APL , };struct ich_spi_priv {
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 77/100 mtd: spi: Export spi_flash_std_probe()
In reply to Simon GlassWith of-platdata we need to create drivers for particular chips, or at least drivers that are separate from the standard code, since C structures are created by dtoc which are private to that driver.
To avoid duplicating the probing code, export this probe function for use by these drivers.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
drivers/mtd/spi/sf_probe.c | 2 +- include/spi_flash.h | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-)
drivers/mtd/spi/sf_probe.c +1 -1
@@ -137,7 +137,7 @@ static int spi_flash_std_get_sw_write_prot(struct udevice *dev)return spi_flash_cmd_get_sw_write_prot (flash); } -static int spi_flash_std_probe (struct udevice *dev) +int spi_flash_std_probe (struct udevice *dev) {struct spi_slave *slave =dev_get_parent_priv (dev);struct dm_spi_slave_platdata *plat =dev_get_parent_platdata (dev);
include/spi_flash.h +12 -0
@@ -102,6 +102,18 @@ int spi_flash_erase_dm(struct udevice *dev, u32 offset, size_t len);*/ int spl_flash_get_sw_write_prot (struct udevice *dev); +/** +* spi_flash_std_probe() - Probe a SPI flash device +* +* This is the standard internal method for probing a SPI flash device to +* determine its type. It can be used in chip-specific drivers which need to +* do this, typically with of-platdata +* +* @dev: SPI-flash device to probe +* @return 0 if OK, -ve on error +*/ +int spi_flash_std_probe (struct udevice *dev); +int spi_flash_probe_bus_cs (unsigned int busnum,unsigned int cs,unsigned int max_hz,unsigned int spi_mode,struct udevice **devp);
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 78/100 x86: Enable pinctrl in SPL and TPL
In reply to Simon GlassIf these phases are used we typically want to enable pinctrl in then, so that pad setup and GPIO access are possible.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
arch/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
arch/Kconfig +2 -0
@@ -193,6 +193,7 @@ config X86 imply SPL_OF_LIBFDT imply SPL_DRIVERS_MISC_SUPPORT imply SPL_GPIO_SUPPORT + imply SPL_PINCTRL imply SPL_LIBCOMMON_SUPPORT imply SPL_LIBGENERIC_SUPPORT imply SPL_SERIAL_SUPPORT
@@ -206,6 +207,7 @@ config X86 imply TPL_DM imply TPL_DRIVERS_MISC_SUPPORT imply TPL_GPIO_SUPPORT + imply TPL_PINCTRL imply TPL_LIBCOMMON_SUPPORT imply TPL_LIBGENERIC_SUPPORT imply TPL_SERIAL_SUPPORT
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 79/100 x86: Add low-power subsystem (lpss) support
In reply to Simon GlassThis subsystem is present on various Intel SoCs.
Add very basic support for taking an lpss device out of reset.
---
Changes in v4:
- Add support for updating power state
- Move this to intel_common
Changes in v3: None
Changes in v2: None
arch/x86/cpu/intel_common/Makefile | 1 + arch/x86/cpu/intel_common/lpss.c | 44 ++++++++++++++++++++++++++++++ arch/x86/include/asm/lpss.h | 36 ++++++++++++++++++++++++ 3 files changed, 81 insertions(+) create mode 100644 arch/x86/cpu/intel_common/lpss.c create mode 100644 arch/x86/include/asm/lpss.h
arch/x86/cpu/intel_common/Makefile +1 -0
@@ -19,6 +19,7 @@ endif obj-y += cpu.o obj-y += fast_spi.o obj-y += lpc.o +obj-y += lpss.o ifndef CONFIG_TARGET_EFI_APP obj-$(CONFIG_$(SPL_TPL_)X86_32BIT_INIT) += microcode.o ifndef CONFIG_$(SPL_)X86_64
arch/x86/cpu/intel_common/lpss.c new file +44 -0
44 lines not on this page · raw message
arch/x86/include/asm/lpss.h new file +36 -0
@@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright 2019 Google LLC +*/ + +#ifndef __ASM_LPSS_H +#define __ASM_LPSS_H + +struct udevice ; + +/* D0 and D3 enable config */ +enum lpss_pwr_state { +STATE_D0 =0 , +STATE_D3 =3 +}; + +/** +* lpss_reset_release() - Release device from reset +* +* This is used for devices which have LPSS support. +* +* @regs: Pointer to device registers +*/ +void lpss_reset_release (void *regs); + +/** +* lpss_set_power_state() - Change power state of a device +* +* This is used for devices which have LPSS support. +* +* @dev: Device to update +* @state: New power state to set +*/ +void lpss_set_power_state (struct udevice *dev,enum lpss_pwr_state state); + +#endif
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 80/100 x86: Add a generic Intel pinctrl driver
In reply to Simon GlassRecent Intel SoCs share a pinctrl mechanism with many common elements. Add an implementation of this core functionality, allowing SoC-specific drivers to avoid adding common code.
As well as a pinctrl driver this provides a GPIO driver based on the same code.
Once other SoCs use this driver we may consider moving more properties to the device tree (e.g. the community info and pad definitions).
---
Changes in v4:
- Add a binding file
- Split out GPIO code from the pinctrl driver
- Switch over to use pinctrl for pad init/config
Changes in v3: None
Changes in v2: None
arch/x86/include/asm/intel_pinctrl.h | 293 +++++++++ arch/x86/include/asm/intel_pinctrl_defs.h | 386 +++++++++++ .../pinctrl/intel,apl-pinctrl.txt | 39 ++ drivers/pinctrl/Kconfig | 9 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/intel/Kconfig | 7 + drivers/pinctrl/intel/Makefile | 5 + drivers/pinctrl/intel/pinctrl.c | 615 ++++++++++++++++++ 8 files changed, 1355 insertions(+) create mode 100644 arch/x86/include/asm/intel_pinctrl.h create mode 100644 arch/x86/include/asm/intel_pinctrl_defs.h create mode 100644 doc/device-tree-bindings/pinctrl/intel,apl-pinctrl.txt create mode 100644 drivers/pinctrl/intel/Kconfig create mode 100644 drivers/pinctrl/intel/Makefile create mode 100644 drivers/pinctrl/intel/pinctrl.c
arch/x86/include/asm/intel_pinctrl.h new file +293 -0
@@ -0,0 +1,293 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2017 Intel Corporation. +* Copyright 2019 Google LLC +* +* Modified from coreboot gpio.h +*/ + +#ifndef __ASM_INTEL_PINCTRL_H +#define __ASM_INTEL_PINCTRL_H + +#include <dm/pinctrl.h> + +/** +* struct pad_config - config for a pad +* @pad: offset of pad within community +* @pad_config: Pad config data corresponding to DW0, DW1, etc. +*/ +struct pad_config { +int pad; +u32 pad_config[4 ]; +}; + +#include <asm/arch/gpio.h> + +/* GPIO community IOSF sideband clock gating */ +#define MISCCFG_GPSIDEDPCGEN BIT(5) +/* GPIO community RCOMP clock gating */ +#define MISCCFG_GPRCOMPCDLCGEN BIT(4) +/* GPIO community RTC clock gating */ +#define MISCCFG_GPRTCDLCGEN BIT(3) +/* GFX controller clock gating */ +#define MISCCFG_GSXSLCGEN BIT(2) +/* GPIO community partition clock gating */ +#define MISCCFG_GPDPCGEN BIT(1) +/* GPIO community local clock gating */ +#define MISCCFG_GPDLCGEN BIT(0) +/* Enable GPIO community power management configuration */ +#define MISCCFG_ENABLE_GPIO_PM_CONFIG (MISCCFG_GPSIDEDPCGEN | \ + MISCCFG_GPRCOMPCDLCGEN | MISCCFG_GPRTCDLCGEN | MISCCFG_GSXSLCGEN \ + | MISCCFG_GPDPCGEN | MISCCFG_GPDLCGEN) + +/* +* GPIO numbers may not be contiguous and instead will have a different +* starting pin number for each pad group. +*/ +#define INTEL_GPP_BASE (first_of_community, start_of_group, end_of_group,\ + group_pad_base) \ + { \ + .first_pad = (start_of_group) - (first_of_community), \ + .size = (end_of_group) - (start_of_group) + 1, \ + .acpi_pad_base = (group_pad_base), \ + } + +/* +* A pad base of -1 indicates that this group uses contiguous numbering +* and a pad base should not be used for this group. +*/ +#define PAD_BASE_NONE -1 + +/* The common/default group numbering is contiguous */ +#define INTEL_GPP (first_of_community, start_of_group, end_of_group) \ + INTEL_GPP_BASE(first_of_community, start_of_group, end_of_group,\ + PAD_BASE_NONE) + +/** +* struct reset_mapping - logical to actual value for PADRSTCFG in DW0 +* +* Note that the values are expected to be within the field placement of the +* register itself. i.e. if the reset field is at 31:30 then the values within +* logical and chipset should occupy 31:30. +*/ +struct reset_mapping { +u32 logical; +u32 chipset; +}; + +/** +* struct pad_group - describes the groups within each community +* +* @first_pad: offset of first pad of the group relative to the community +* @size: size of the group +* @acpi_pad_base: starting pin number for the pads in this group when they are +* used in ACPI. This is only needed if the pins are not contiguous across +* groups. Most groups will have this set to PAD_BASE_NONE and use +* contiguous numbering for ACPI. +*/ +struct pad_group { +int first_pad; +uint size; +int acpi_pad_base; +}; + +/** +* struct pad_community - community of pads +* +* This describes a community, or each group within a community when multiple +* groups exist inside a community +* +* @name: Community name +* @acpi_path: ACPI path +* @num_gpi_regs: number of gpi registers in community +* @max_pads_per_group: number of pads in each group; number of pads bit-mapped +* in each GPI status/en and Host Own Reg +* @first_pad: first pad in community +* @last_pad: last pad in community +* @host_own_reg_0: offset to Host Ownership Reg 0 +* @gpi_int_sts_reg_0: offset to GPI Int STS Reg 0 +* @gpi_int_en_reg_0: offset to GPI Int Enable Reg 0 +* @gpi_smi_sts_reg_0: offset to GPI SMI STS Reg 0 +* @gpi_smi_en_reg_0: offset to GPI SMI EN Reg 0 +* @pad_cfg_base: offset to first PAD_GFG_DW0 Reg +* @gpi_status_offset: specifies offset in struct gpi_status +* @port: PCR Port ID +* @reset_map: PADRSTCFG logical to chipset mapping +* @num_reset_vals: number of values in @reset_map +* @groups; list of groups for this community +* @num_groups: number of groups +*/ +struct pad_community { +const char *name; +const char *acpi_path; +size_t num_gpi_regs; +size_t max_pads_per_group; +uint first_pad; +uint last_pad; +u16 host_own_reg_0; +u16 gpi_int_sts_reg_0; +u16 gpi_int_en_reg_0; +u16 gpi_smi_sts_reg_0; +u16 gpi_smi_en_reg_0; +u16 pad_cfg_base; +u8 gpi_status_offset; +u8 port; +const struct reset_mapping *reset_map; +size_t num_reset_vals; +const struct pad_group *groups; +size_t num_groups; +}; + +/** +* struct intel_pinctrl_priv - private data for each pinctrl device +* +* @comm: Pad community for this device +* @num_cfgs: Number of configuration words for each pad +* @itss: ITSS device (for interrupt handling) +* @itss_pol_cfg: Use to program Interrupt Polarity Control (IPCx) register +* Each bit represents IRQx Active High Polarity Disable configuration: +* when set to 1, the interrupt polarity associated with IRQx is inverted +* to appear as Active Low to IOAPIC and vice versa +*/ +struct intel_pinctrl_priv { +const struct pad_community *comm; +int num_cfgs; +struct udevice *itss; +bool itss_pol_cfg; +}; + +/* Exported common operations for the pinctrl driver */ +extern const struct pinctrl_ops intel_pinctrl_ops; + +/* Exported common probe function for the pinctrl driver */ +int intel_pinctrl_probe (struct udevice *dev); + +/** +* intel_pinctrl_ofdata_to_platdata() - Handle common platdata setup +* +* @dev: Pinctrl device +* @comm: Pad community for this device +* @num_cfgs: Number of configuration words for each pad +* @return 0 if OK, -EDOM if @comm is NULL, other -ve value on other error +*/ +int intel_pinctrl_ofdata_to_platdata (struct udevice *dev, +const struct pad_community *comm, +int num_cfgs); + +/** +* pinctrl_route_gpe() - set GPIO groups for the general-purpose-event blocks +* +* The values from PMC register GPE_CFG are passed which is then mapped to +* proper groups for MISCCFG. This basically sets the MISCCFG register bits: +* dw0 = gpe0_route[11:8]. This is ACPI GPE0b. +* dw1 = gpe0_route[15:12]. This is ACPI GPE0c. +* dw2 = gpe0_route[19:16]. This is ACPI GPE0d. +* +* @dev: ITSS device +* @gpe0b: Value for GPE0B +* @gpe0c: Value for GPE0C +* @gpe0d: Value for GPE0D +* @return 0 if OK, -ve on error +*/ +int pinctrl_route_gpe (struct udevice *dev,uint gpe0b,uint gpe0c,uint gpe0d); + +/** +* pinctrl_config_pads() - Configure a list of pads +* +* Configures multiple pads using the provided data from the device tree. +* +* @dev: pinctrl device (any will do) +* @pads: Pad data, consisting of a pad number followed by num_cfgs entries +* containing the data for that pad (num_cfgs is set by the pinctrl device) +* @pads_count: Number of pads to configure +* @return 0 if OK, -ve on error +*/ +int pinctrl_config_pads (struct udevice *dev,u32 *pads,int pads_count); + +/** +* pinctrl_gpi_clear_int_cfg() - Set up the interrupts for use +* +* This enables the interrupt inputs and clears the status register bits +* +* @return 0 if OK, -ve on error +*/ +int pinctrl_gpi_clear_int_cfg (void ); + +/** +* pinctrl_config_pads_for_node() - Configure pads +* +* Set up the pads using the data in a given node +* +* @dev: pinctrl device (any will do) +* @node: Node containing the 'pads' property with the data in it +* @return 0 if OK, -ve on error +*/ +int pinctrl_config_pads_for_node (struct udevice *dev,ofnode node); + +/** +* pinctrl_read_pads() - Read pad data from a node +* +* @dev: pinctrl device (any will do, it is just used to get config) +* @node: Node to read pad data from +* @prop: Property name to use (e.g. "pads") +* @padsp: Returns a pointer to an allocated array of pad data, in the format: +* <pad> +* <pad_config0> +* <pad_config1> +* ... +* +* The number of pad config values is set by the pinctrl controller. +* The caller must free this array. +* @pad_countp: Returns the number of pads read +* @ereturn 0 if OK, -ve on error +*/ +int pinctrl_read_pads (struct udevice *dev,ofnode node,const char *prop, +u32 **padsp,int *pad_countp); + +/** +* pinctrl_count_pads() - Count the number of pads in a pad array +* +* This used used with of-platdata where the array may be smaller than its +* maximum size. This function searches for the last pad in the array by finding +* the first 'zero' record +* +* This works out the number of records in the array. Each record has one word +* for the pad and num_cfgs words for the config. +* +* @dev: pinctrl device (any will do) +* @pads: Array of pad data +* @size: Size of pad data in bytes +* @return number of pads represented by the data +*/ +int pinctrl_count_pads (struct udevice *dev,u32 *pads,int size); + +/** +* intel_pinctrl_get_config_reg_addr() - Get address of the pin config registers +* +* @dev: Pinctrl device +* @offset: GPIO offset within this device +* @return register offset within the GPIO p2sb region +*/ +u32 intel_pinctrl_get_config_reg_addr (struct udevice *dev,uint offset); + +/** +* intel_pinctrl_get_config_reg() - Get the value of a GPIO register +* +* @dev: Pinctrl device +* @offset: GPIO offset within this device +* @return register value within the GPIO p2sb region +*/ +u32 intel_pinctrl_get_config_reg (struct udevice *dev,uint offset); + +/** +* intel_pinctrl_get_pad() - Get pad information for a pad +* +* This is used by the GPIO controller to find the pinctrl used by a pad. +* +* @pad: Pad to check +* @devp: Returns pinctrl device containing that pad +* @offsetp: Returns offset of pad within that pinctrl device +*/ +int intel_pinctrl_get_pad (uint pad,struct udevice **devp,uint *offsetp); + +#endif
arch/x86/include/asm/intel_pinctrl_defs.h new file +386 -0
386 lines not on this page · raw message
doc/device-tree-bindings/pinctrl/intel,apl-pinctrl.txt new file +39 -0
@@ -0,0 +1,39 @@ +* Intel Apollo Lake pin controller + +The Apollo Lake (APL) pin controller is used to select the function of a pin +and to configure it. + +Required properties: +- compatible: "intel,apl-pinctrl" +- intel,p2sb-port-id: Port ID number within the parent P2SB +- reg: PCI address of the controller + +Please refer to pinctrl-bindings.txt in this directory for details of the +common pinctrl bindings used by client devices. + +Optional subnodes: + +GPIO nodes may be added as children of the pinctrl nodes. See intel,apl-gpio +for the binding. + + +Example: + +... +{ + p2sb: p2sb at d,0 { + reg = <0x02006810 0 0 0 0>; + compatible = "intel,apl-p2sb"; + early-regs = <IOMAP_P2SB_BAR 0x100000>; + + n { + compatible = "intel,apl-pinctrl"; + intel,p2sb-port-id = <PID_GPIO_N>; + gpio_n: gpio-n { + compatible = "intel,apl-gpio"; + #gpio-cells = <2>; + }; + }; + }; +}; +...
drivers/pinctrl/Kconfig +9 -0
@@ -177,6 +177,14 @@ config PINCTRL_AT91PIO4 This option is to enable the AT91 pinctrl driver for AT91 PIO4 controller which is available on SAMA5D2 SoC. +config PINCTRL_INTEL + bool "Standard Intel pin-control and pin-mux driver" + help + Recent Intel chips such as Apollo Lake (APL) use a common pin control + and GPIO scheme. The settings for this come from an SoC-specific + driver which must be separately enabled. The driver supports setting + pins on start-up and changing the GPIO attributes. + config PINCTRL_PIC32 bool "Microchip PIC32 pin-control and pin-mux driver" depends on DM && MACH_PIC32
@@ -280,6 +288,7 @@ endif source "drivers/pinctrl/broadcom/Kconfig" source "drivers/pinctrl/exynos/Kconfig" +source "drivers/pinctrl/intel/Kconfig" source "drivers/pinctrl/mediatek/Kconfig" source "drivers/pinctrl/meson/Kconfig" source "drivers/pinctrl/mscc/Kconfig"
drivers/pinctrl/Makefile +1 -0
@@ -9,6 +9,7 @@ obj-y += nxp/ obj-$(CONFIG_$(SPL_)PINCTRL_ROCKCHIP) += rockchip/ obj-$(CONFIG_ARCH_ASPEED) += aspeed/ obj-$(CONFIG_ARCH_ATH79) += ath79/ +obj-$(CONFIG_PINCTRL_INTEL) += intel/ obj-$(CONFIG_ARCH_MTMIPS) += mtmips/ obj-$(CONFIG_ARCH_RMOBILE) += renesas/ obj-$(CONFIG_PINCTRL_SANDBOX) += pinctrl-sandbox.o
drivers/pinctrl/intel/Kconfig new file +7 -0
@@ -0,0 +1,7 @@ +# +# Intel PINCTRL drivers +# + +if PINCTRL_INTEL + +endif
drivers/pinctrl/intel/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright 2019 Google LLC + +obj-y += pinctrl.o
drivers/pinctrl/intel/pinctrl.c new file +615 -0
615 lines not on this page · raw message
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 81/100 x86: Add a generic Intel GPIO driver
In reply to Simon GlassAdd a GPIO driver which uses the pinctrl driver to access the pad information. This driver relies on the GPIO nodes being subnodes to the pinctrl device.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
.../gpio/intel,apl-gpio.txt | 55 ++++++ drivers/gpio/Kconfig | 9 + drivers/gpio/Makefile | 1 + drivers/gpio/intel_gpio.c | 161 ++++++++++++++++++ 4 files changed, 226 insertions(+) create mode 100644 doc/device-tree-bindings/gpio/intel,apl-gpio.txt create mode 100644 drivers/gpio/intel_gpio.c
doc/device-tree-bindings/gpio/intel,apl-gpio.txt new file +55 -0
@@ -0,0 +1,55 @@ +* Intel Apollo Lake GPIO controller + +The Apollo Lake (APL) GPIO controller is used to control GPIO functions of +the pins. + +Required properties: +- compatible: "intel,apl-gpio" +- #gpio-cells: Should be 2. The syntax of the gpio specifier used by client + nodes should be the following with values derived from the SoC user manual. + <[phandle of the gpio controller node] + [pin number within the gpio controller] + [flags]> + + Values for gpio specifier: + - Pin number: is a GPIO pin number between 0 and 244 + - Flags: GPIO_ACTIVE_HIGH or GPIO_ACTIVE_LOW + +- gpio-controller: Specifies that the node is a gpio controller. + +Example: + +... +{ + p2sb: p2sb at d,0 { + reg = <0x02006810 0 0 0 0>; + compatible = "intel,apl-p2sb"; + early-regs = <IOMAP_P2SB_BAR 0x100000>; + + n { + compatible = "intel,apl-pinctrl"; + intel,p2sb-port-id = <PID_GPIO_N>; + gpio_n: gpio-n { + compatible = "intel,apl-gpio"; + gpio-controller; + #gpio-cells = <2>; + }; + }; + }; + + i2c_2: i2c2 at 16,2 { + compatible = "intel,apl-i2c", "snps,designware-i2c-pci"; + reg = <0x0200b210 0 0 0 0>; + #address-cells = <1>; + #size-cells = <0>; + clock-frequency = <400000>; + tpm at 50 { + reg = <0x50>; + compatible = "google,cr50"; + u-boot,i2c-offset-len = <0>; + ready-gpio = <&gpio_n GPIO_28 GPIO_ACTIVE_LOW>; + }; + }; + +}; +...
drivers/gpio/Kconfig +9 -0
@@ -104,6 +104,15 @@ config INTEL_BROADWELL_GPIO driver from the common Intel ICH6 driver. It supports a total of 95 GPIOs which can be configured from the device tree. +config INTEL_GPIO + bool "Intel generic GPIO driver" + depends on DM_GPIO + help + Say yes here to select Intel generic GPIO driver. This controller + supports recent chips (e.g. Apollo Lake). It permits basic GPIO + control including setting pins to input/output. It makes use of its + parent pinctrl driver to actually effect changes. + config INTEL_ICH6_GPIO bool "Intel ICH6 compatible legacy GPIO driver" depends on DM_GPIO
drivers/gpio/Makefile +1 -0
@@ -17,6 +17,7 @@ endif obj-$(CONFIG_AT91_GPIO) += at91_gpio.o obj-$(CONFIG_ATMEL_PIO4) += atmel_pio4.o obj-$(CONFIG_BCM6345_GPIO) += bcm6345_gpio.o +obj-$(CONFIG_INTEL_GPIO) += intel_gpio.o obj-$(CONFIG_INTEL_ICH6_GPIO) += intel_ich6_gpio.o obj-$(CONFIG_INTEL_BROADWELL_GPIO) += intel_broadwell_gpio.o obj-$(CONFIG_KIRKWOOD_GPIO) += kw_gpio.o
drivers/gpio/intel_gpio.c new file +161 -0
161 lines not on this page · raw message
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 82/100 x86: apl: Add basic IO addresses
In reply to Simon GlassAdd some fixed IO and mmap addresses for use in the device tree and with some early-init code.
---
Changes in v4:
- Drop TCO_BASE_ADDRESS
- Tidy up header guards
Changes in v3: None
Changes in v2: None
arch/x86/include/asm/arch-apollolake/iomap.h | 25 ++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 arch/x86/include/asm/arch-apollolake/iomap.h
arch/x86/include/asm/arch-apollolake/iomap.h new file +25 -0
@@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2017 Intel Corporation. +* Take from coreboot project file of the same name +*/ + +#ifndef _ASM_ARCH_IOMAP_H +#define _ASM_ARCH_IOMAP_H + +#define R_ACPI_PM1_TMR 0x8 + +/* Put p2sb at 0xd0000000 in TPL */ +#define IOMAP_P2SB_BAR 0xd0000000 + +#define IOMAP_SPI_BASE 0xfe010000 +/* +* Use UART2. To use UART1 you need to set '2' to '1', change device tree serial +* node name and 'reg' property, and update CONFIG_DEBUG_UART_BASE. +*/ +#define PCH_DEV_UART PCI_BDF(0, 0x18, 2) + +#define PCH_DEV_LPC PCI_BDF(0, 0x1f, 0) +#define PCH_DEV_SPI PCI_BDF(0, 0x0d, 2) + +#endif
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 83/100 x86: apl: Add PMC driver
In reply to Simon GlassAdd a driver for the Apollo Lake SoC. It supports the basic operations and can use device tree or of-platdata.
---
Changes in v4:
- Fix Makefile copyright message
- Fix incorrect mask check in pmc_gpe_init()
- Switch over to use pinctrl for pad init/config
- Tidy up header guards
- Use pci_ofplat_get_devfn()
- apollolake -> Apollo Lake
Changes in v3:
- Use pci_get_devfn()
Changes in v2: None
arch/x86/cpu/apollolake/Makefile | 5 + arch/x86/cpu/apollolake/pmc.c | 216 ++++++++++++++++++++++ arch/x86/include/asm/arch-apollolake/pm.h | 19 ++ drivers/power/acpi_pmc/acpi-pmc-uclass.c | 56 ++++++ 4 files changed, 296 insertions(+) create mode 100644 arch/x86/cpu/apollolake/Makefile create mode 100644 arch/x86/cpu/apollolake/pmc.c create mode 100644 arch/x86/include/asm/arch-apollolake/pm.h
arch/x86/cpu/apollolake/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright 2019 Google LLC + +obj-y += pmc.o
arch/x86/cpu/apollolake/pmc.c new file +216 -0
216 lines not on this page · raw message
arch/x86/include/asm/arch-apollolake/pm.h new file +19 -0
@@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2015-2016 Intel Corp. +* (Written by Lance Zhao <[email protected]> for Intel Corp.) +*/ + +#ifndef _ASM_ARCH_PM_H +#define _ASM_ARCH_PM_H + +#define PMC_GPE_SW_31_0 0 +#define PMC_GPE_SW_63_32 1 +#define PMC_GPE_NW_31_0 3 +#define PMC_GPE_NW_63_32 4 +#define PMC_GPE_NW_95_64 5 +#define PMC_GPE_N_31_0 6 +#define PMC_GPE_N_63_32 7 +#define PMC_GPE_W_31_0 9 + +#endif
drivers/power/acpi_pmc/acpi-pmc-uclass.c +56 -0
68 lines not on this page · raw message
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 84/100 x86: apl: Add UART driver
In reply to Simon GlassAdd a driver for the Apollo Lake UART. It uses the standard ns16550 device but also sets up the input clock with LPSS and supports configuration via of-platdata.
---
Changes in v4:
- Add an extra comment to apl_uart_init()
- Tidy up header guards
- apollolake -> Apollo Lake
Changes in v3:
- Use the LPSS code from a separate file
Changes in v2: None
arch/x86/cpu/apollolake/Makefile | 1 + arch/x86/cpu/apollolake/uart.c | 141 ++++++++++++++++++++ arch/x86/include/asm/arch-apollolake/uart.h | 20 +++ 3 files changed, 162 insertions(+) create mode 100644 arch/x86/cpu/apollolake/uart.c create mode 100644 arch/x86/include/asm/arch-apollolake/uart.h
arch/x86/cpu/apollolake/Makefile +1 -0
@@ -3,3 +3,4 @@ # Copyright 2019 Google LLC obj-y += pmc.o +obj-y += uart.o
arch/x86/cpu/apollolake/uart.c new file +141 -0
141 lines not on this page · raw message
arch/x86/include/asm/arch-apollolake/uart.h new file +20 -0
@@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright 2019 Google LLC +*/ + +#ifndef _ASM_ARCH_UART_H +#define _ASM_ARCH_UART_H + +/** +* apl_uart_init() - Set up the APL UART device and clock +* +* This enables the PCI device, sets up the MMIO region and turns on the clock +* using LPSS. +* +* The UART won't actually work unless the GPIO settings are correct and the +* signals actually exit the SoC. See init_for_uart() for that. +*/ +int apl_uart_init (pci_dev_t bdf,ulong base); + +#endif
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 85/100 x86: apl: Add pinctrl driver
In reply to Simon GlassAdd a driver for the Apollo Lake pinctrl. This mostly makes use of the common Intel pinctrl support.
---
Changes in v4:
- Allow pinctrl nodes to have subnodes (i.e. GPIO nodes)
- Drop GPIO_NUM_PAD_CFG_REGS
- Switch over to use pinctrl for pad init/config
- Tidy up the header file a little
- apollolake -> Apollo Lake
Changes in v3:
- Add various minor tidy-ups
- Fix mixed case in GPIO defines
- Rework how pads configuration is defined in TPL and SPL
- Use the IRQ uclass instead of ITSS
Changes in v2: None
arch/x86/include/asm/arch-apollolake/gpio.h | 490 ++++++++++++++++++++ drivers/pinctrl/intel/Kconfig | 17 + drivers/pinctrl/intel/Makefile | 1 + drivers/pinctrl/intel/pinctrl_apl.c | 192 ++++++++ 4 files changed, 700 insertions(+) create mode 100644 arch/x86/include/asm/arch-apollolake/gpio.h create mode 100644 drivers/pinctrl/intel/pinctrl_apl.c
arch/x86/include/asm/arch-apollolake/gpio.h new file +490 -0
@@ -0,0 +1,490 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Definitions for the GPIO subsystem on Apollolake +* +* Copyright (C) 2015 - 2017 Intel Corp. +* (Written by Alexandru Gagniuc <[email protected]> for Intel Corp.) +* +* Placed in a separate file since some of these definitions can be used from +* assembly code +* +* Taken from gpio_apl.h in coreboot +*/ + +#ifndef _ASM_ARCH_GPIO_H_ +#define _ASM_ARCH_GPIO_H_ + +/* Port ids */ +#if IS_ENABLED (CONFIG_SOC_INTEL_GLK ) +#define PID_GPIO_AUDIO 0xC9 +#define PID_GPIO_SCC 0xC8 +#else +#define PID_GPIO_SW 0xC0 +#define PID_GPIO_S 0xC2 +#define PID_GPIO_W 0xC7 +#endif +#define PID_GPIO_NW 0xC4 +#define PID_GPIO_N 0xC5 +#define PID_ITSS 0xD0 +#define PID_RTC 0xD1 + +/* +* Miscellaneous Configuration register(MISCCFG). These are community-specific +* registers and are meant to house miscellaneous configuration fields per +* community. There are 8 GPIO groups: GPP_0 -> GPP_8 (Group 3 is absent) +*/ +#define GPIO_MISCCFG 0x10/* Miscellaneous Configuration offset */ +#define GPIO_GPE_SW_31_0 0/* SOUTHWEST GPIO# 0 ~ 31 belong to GROUP0 */ +#define GPIO_GPE_SW_63_32 1/* SOUTHWEST GPIO# 32 ~ 42 belong to GROUP1 */ +#define GPIO_GPE_W_31_0 2/* WEST GPIO# 0 ~ 25 belong to GROUP2 */ +#define GPIO_GPE_NW_31_0 4/* NORTHWEST GPIO# 0 ~ 17 belong to GROUP4 */ +#define GPIO_GPE_NW_63_32 5/* NORTHWEST GPIO# 32 ~ 63 belong to GROUP5 */ +#define GPIO_GPE_NW_95_64 6/* NORTHWEST GPIO# 64 ~ 76 belong to GROUP6 */ +#define GPIO_GPE_N_31_0 7/* NORTH GPIO# 0 ~ 31 belong to GROUP7 */ +#define GPIO_GPE_N_63_32 8/* NORTH GPIO# 32 ~ 61 belong to GROUP8 */ + +#define GPIO_MAX_NUM_PER_GROUP 32 + +/* +* Host Software Pad Ownership Register. +* The pins in the community are divided into 3 groups: +* GPIO 0 ~ 31, GPIO 32 ~ 63, GPIO 64 ~ 95 +*/ +#define HOSTSW_OWN_REG_0 0x80 + +#define PAD_CFG_BASE 0x500 + +#define GPI_INT_STS_0 0x100 +#define GPI_INT_EN_0 0x110 + +#define GPI_SMI_STS_0 0x140 +#define GPI_SMI_EN_0 0x150 + +#define NUM_N_PADS (PAD_N(SVID0_CLK) + 1) +#define NUM_NW_PADS (PAD_NW(GPIO_123) + 1) +#define NUM_W_PADS (PAD_W(SUSPWRDNACK) + 1) +#define NUM_SW_PADS (PAD_SW(LPC_FRAMEB) + 1) + +#define NUM_N_GPI_REGS \ + (ALIGN(NUM_N_PADS, GPIO_MAX_NUM_PER_GROUP) / GPIO_MAX_NUM_PER_GROUP) + +#define NUM_NW_GPI_REGS \ + (ALIGN(NUM_NW_PADS, GPIO_MAX_NUM_PER_GROUP) / GPIO_MAX_NUM_PER_GROUP) + +#define NUM_W_GPI_REGS \ + (ALIGN(NUM_W_PADS, GPIO_MAX_NUM_PER_GROUP) / GPIO_MAX_NUM_PER_GROUP) + +#define NUM_SW_GPI_REGS \ + (ALIGN(NUM_SW_PADS, GPIO_MAX_NUM_PER_GROUP) / GPIO_MAX_NUM_PER_GROUP) + +/* +* Total number of GPI status registers across all GPIO communities in the SOC +*/ +#define NUM_GPI_STATUS_REGS (NUM_N_GPI_REGS + NUM_NW_GPI_REGS \ + + NUM_W_GPI_REGS + NUM_SW_GPI_REGS) + +/* North community pads */ +#define GPIO_0 0 +#define GPIO_1 1 +#define GPIO_2 2 +#define GPIO_3 3 +#define GPIO_4 4 +#define GPIO_5 5 +#define GPIO_6 6 +#define GPIO_7 7 +#define GPIO_8 8 +#define GPIO_9 9 +#define GPIO_10 10 +#define GPIO_11 11 +#define GPIO_12 12 +#define GPIO_13 13 +#define GPIO_14 14 +#define GPIO_15 15 +#define GPIO_16 16 +#define GPIO_17 17 +#define GPIO_18 18 +#define GPIO_19 19 +#define GPIO_20 20 +#define GPIO_21 21 +#define GPIO_22 22 +#define GPIO_23 23 +#define GPIO_24 24 +#define GPIO_25 25 +#define GPIO_26 26 +#define GPIO_27 27 +#define GPIO_28 28 +#define GPIO_29 29 +#define GPIO_30 30 +#define GPIO_31 31 +#define GPIO_32 32 +#define GPIO_33 33 +#define GPIO_34 34 +#define GPIO_35 35 +#define GPIO_36 36 +#define GPIO_37 37 +#define GPIO_38 38 +#define GPIO_39 39 +#define GPIO_40 40 +#define GPIO_41 41 +#define GPIO_42 42 +#define GPIO_43 43 +#define GPIO_44 44 +#define GPIO_45 45 +#define GPIO_46 46 +#define GPIO_47 47 +#define GPIO_48 48 +#define GPIO_49 49 +#define GPIO_62 50 +#define GPIO_63 51 +#define GPIO_64 52 +#define GPIO_65 53 +#define GPIO_66 54 +#define GPIO_67 55 +#define GPIO_68 56 +#define GPIO_69 57 +#define GPIO_70 58 +#define GPIO_71 59 +#define GPIO_72 60 +#define GPIO_73 61 +#define JTAG_TCK 62 +#define JTAG_TRST_B 63 +#define JTAG_TMS 64 +#define JTAG_TDI 65 +#define JTAG_CX_PMODE 66 +#define JTAG_CX_PREQ_B 67 +#define JTAGX 68 +#define JTAG_CX_PRDY_B 69 +#define JTAG_TDO 70 +#define CNV_BRI_DT 71 +#define CNV_BRI_RSP 72 +#define CNV_RGI_DT 73 +#define CNV_RGI_RSP 74 +#define SVID0_ALERT_B 75 +#define SVID0_DATA 76 +#define SVID0_CLK 77 + +/* Northwest community pads */ +#define GPIO_187 78 +#define GPIO_188 79 +#define GPIO_189 80 +#define GPIO_190 81 +#define GPIO_191 82 +#define GPIO_192 83 +#define GPIO_193 84 +#define GPIO_194 85 +#define GPIO_195 86 +#define GPIO_196 87 +#define GPIO_197 88 +#define GPIO_198 89 +#define GPIO_199 90 +#define GPIO_200 91 +#define GPIO_201 92 +#define GPIO_202 93 +#define GPIO_203 94 +#define GPIO_204 95 +#define PMC_SPI_FS0 96 +#define PMC_SPI_FS1 97 +#define PMC_SPI_FS2 98 +#define PMC_SPI_RXD 99 +#define PMC_SPI_TXD 100 +#define PMC_SPI_CLK 101 +#define PMIC_PWRGOOD 102 +#define PMIC_RESET_B 103 +#define GPIO_213 104 +#define GPIO_214 105 +#define GPIO_215 106 +#define PMIC_THERMTRIP_B 107 +#define PMIC_STDBY 108 +#define PROCHOT_B 109 +#define PMIC_I2C_SCL 110 +#define PMIC_I2C_SDA 111 +#define GPIO_74 112 +#define GPIO_75 113 +#define GPIO_76 114 +#define GPIO_77 115 +#define GPIO_78 116 +#define GPIO_79 117 +#define GPIO_80 118 +#define GPIO_81 119 +#define GPIO_82 120 +#define GPIO_83 121 +#define GPIO_84 122 +#define GPIO_85 123 +#define GPIO_86 124 +#define GPIO_87 125 +#define GPIO_88 126 +#define GPIO_89 127 +#define GPIO_90 128 +#define GPIO_91 129 +#define GPIO_92 130 +#define GPIO_97 131 +#define GPIO_98 132 +#define GPIO_99 133 +#define GPIO_100 134 +#define GPIO_101 135 +#define GPIO_102 136 +#define GPIO_103 137 +#define FST_SPI_CLK_FB 138 +#define GPIO_104 139 +#define GPIO_105 140 +#define GPIO_106 141 +#define GPIO_109 142 +#define GPIO_110 143 +#define GPIO_111 144 +#define GPIO_112 145 +#define GPIO_113 146 +#define GPIO_116 147 +#define GPIO_117 148 +#define GPIO_118 149 +#define GPIO_119 150 +#define GPIO_120 151 +#define GPIO_121 152 +#define GPIO_122 153 +#define GPIO_123 154 + +/* West community pads */ +#define GPIO_124 155 +#define GPIO_125 156 +#define GPIO_126 157 +#define GPIO_127 158 +#define GPIO_128 159 +#define GPIO_129 160 +#define GPIO_130 161 +#define GPIO_131 162 +#define GPIO_132 163 +#define GPIO_133 164 +#define GPIO_134 165 +#define GPIO_135 166 +#define GPIO_136 167 +#define GPIO_137 168 +#define GPIO_138 169 +#define GPIO_139 170 +#define GPIO_146 171 +#define GPIO_147 172 +#define GPIO_148 173 +#define GPIO_149 174 +#define GPIO_150 175 +#define GPIO_151 176 +#define GPIO_152 177 +#define GPIO_153 178 +#define GPIO_154 179 +#define GPIO_155 180 +#define GPIO_209 181 +#define GPIO_210 182 +#define GPIO_211 183 +#define GPIO_212 184 +#define OSC_CLK_OUT_0 185 +#define OSC_CLK_OUT_1 186 +#define OSC_CLK_OUT_2 187 +#define OSC_CLK_OUT_3 188 +#define OSC_CLK_OUT_4 189 +#define PMU_AC_PRESENT 190 +#define PMU_BATLOW_B 191 +#define PMU_PLTRST_B 192 +#define PMU_PWRBTN_B 193 +#define PMU_RESETBUTTON_B 194 +#define PMU_SLP_S0_B 195 +#define PMU_SLP_S3_B 196 +#define PMU_SLP_S4_B 197 +#define PMU_SUSCLK 198 +#define PMU_WAKE_B 199 +#define SUS_STAT_B 200 +#define SUSPWRDNACK 201 + +/* Southwest community pads */ +#define GPIO_205 202 +#define GPIO_206 203 +#define GPIO_207 204 +#define GPIO_208 205 +#define GPIO_156 206 +#define GPIO_157 207 +#define GPIO_158 208 +#define GPIO_159 209 +#define GPIO_160 210 +#define GPIO_161 211 +#define GPIO_162 212 +#define GPIO_163 213 +#define GPIO_164 214 +#define GPIO_165 215 +#define GPIO_166 216 +#define GPIO_167 217 +#define GPIO_168 218 +#define GPIO_169 219 +#define GPIO_170 220 +#define GPIO_171 221 +#define GPIO_172 222 +#define GPIO_179 223 +#define GPIO_173 224 +#define GPIO_174 225 +#define GPIO_175 226 +#define GPIO_176 227 +#define GPIO_177 228 +#define GPIO_178 229 +#define GPIO_186 230 +#define GPIO_182 231 +#define GPIO_183 232 +#define SMB_ALERTB 233 +#define SMB_CLK 234 +#define SMB_DATA 235 +#define LPC_ILB_SERIRQ 236 +#define LPC_CLKOUT0 237 +#define LPC_CLKOUT1 238 +#define LPC_AD0 239 +#define LPC_AD1 240 +#define LPC_AD2 241 +#define LPC_AD3 242 +#define LPC_CLKRUNB 243 +#define LPC_FRAMEB 244 + +/* PERST_0 not defined */ +#define GPIO_PRT0_UDEF 0xFF + +#define TOTAL_PADS 245 +#define N_OFFSET GPIO_0 +#define NW_OFFSET GPIO_187 +#define W_OFFSET GPIO_124 +#define SW_OFFSET GPIO_205 + +/* Macros for translating a global pad offset to a local offset */ +#define PAD_N (pad) (pad - N_OFFSET) +#define PAD_NW (pad) (pad - NW_OFFSET) +#define PAD_W (pad) (pad - W_OFFSET) +#define PAD_SW (pad) (pad - SW_OFFSET) + +/* Linux names of the GPIO devices */ +#define GPIO_COMM_N_NAME "INT3452:00" +#define GPIO_COMM_NW_NAME "INT3452:01" +#define GPIO_COMM_W_NAME "INT3452:02" +#define GPIO_COMM_SW_NAME "INT3452:03" + +/* Following is used in gpio asl */ +#define GPIO_COMM_NAME "INT3452" +#define GPIO_COMM_0_DESC \ + "General Purpose Input/Output (GPIO) Controller - North" +#define GPIO_COMM_1_DESC \ + "General Purpose Input/Output (GPIO) Controller - Northwest" +#define GPIO_COMM_2_DESC \ + "General Purpose Input/Output (GPIO) Controller - West" +#define GPIO_COMM_3_DESC \ + "General Purpose Input/Output (GPIO) Controller - Southwest" + +#define GPIO_COMM0_PID PID_GPIO_N +#define GPIO_COMM1_PID PID_GPIO_NW +#define GPIO_COMM2_PID PID_GPIO_W +#define GPIO_COMM3_PID PID_GPIO_SW + +/* +* IOxAPIC IRQs for the GPIOs, overlap is expected as we encourage to use +* shared IRQ instead of direct IRQ, in case of overlapping, we can easily +* program one of the overlap to shared IRQ to avoid the conflict. +*/ + +/* NorthWest community pads */ +#define PMIC_I2C_SDA_IRQ 0x32 +#define GPIO_74_IRQ 0x33 +#define GPIO_75_IRQ 0x34 +#define GPIO_76_IRQ 0x35 +#define GPIO_77_IRQ 0x36 +#define GPIO_78_IRQ 0x37 +#define GPIO_79_IRQ 0x38 +#define GPIO_80_IRQ 0x39 +#define GPIO_81_IRQ 0x3A +#define GPIO_82_IRQ 0x3B +#define GPIO_83_IRQ 0x3C +#define GPIO_84_IRQ 0x3D +#define GPIO_85_IRQ 0x3E +#define GPIO_86_IRQ 0x3F +#define GPIO_87_IRQ 0x40 +#define GPIO_88_IRQ 0x41 +#define GPIO_89_IRQ 0x42 +#define GPIO_90_IRQ 0x43 +#define GPIO_91_IRQ 0x44 +#define GPIO_97_IRQ 0x49 +#define GPIO_98_IRQ 0x4A +#define GPIO_99_IRQ 0x4B +#define GPIO_100_IRQ 0x4C +#define GPIO_101_IRQ 0x4D +#define GPIO_102_IRQ 0x4E +#define GPIO_103_IRQ 0x4F +#define GPIO_104_IRQ 0x50 +#define GPIO_105_IRQ 0x51 +#define GPIO_106_IRQ 0x52 +#define GPIO_109_IRQ 0x54 +#define GPIO_110_IRQ 0x55 +#define GPIO_111_IRQ 0x56 +#define GPIO_112_IRQ 0x57 +#define GPIO_113_IRQ 0x58 +#define GPIO_116_IRQ 0x5B +#define GPIO_117_IRQ 0x5C +#define GPIO_118_IRQ 0x5D +#define GPIO_119_IRQ 0x5E +#define GPIO_120_IRQ 0x5F +#define GPIO_121_IRQ 0x60 +#define GPIO_122_IRQ 0x61 +#define GPIO_123_IRQ 0x62 + +/* North community pads */ +#define GPIO_0_IRQ 0x63 +#define GPIO_1_IRQ 0x64 +#define GPIO_2_IRQ 0x65 +#define GPIO_3_IRQ 0x66 +#define GPIO_4_IRQ 0x67 +#define GPIO_5_IRQ 0x68 +#define GPIO_6_IRQ 0x69 +#define GPIO_7_IRQ 0x6A +#define GPIO_8_IRQ 0x6B +#define GPIO_9_IRQ 0x6C +#define GPIO_10_IRQ 0x6D +#define GPIO_11_IRQ 0x6E +#define GPIO_12_IRQ 0x6F +#define GPIO_13_IRQ 0x70 +#define GPIO_14_IRQ 0x71 +#define GPIO_15_IRQ 0x72 +#define GPIO_16_IRQ 0x73 +#define GPIO_17_IRQ 0x74 +#define GPIO_18_IRQ 0x75 +#define GPIO_19_IRQ 0x76 +#define GPIO_20_IRQ 0x77 +#define GPIO_21_IRQ 0x32 +#define GPIO_22_IRQ 0x33 +#define GPIO_23_IRQ 0x34 +#define GPIO_24_IRQ 0x35 +#define GPIO_25_IRQ 0x36 +#define GPIO_26_IRQ 0x37 +#define GPIO_27_IRQ 0x38 +#define GPIO_28_IRQ num_reset_vals0x39 +#define GPIO_29_IRQ 0x3A +#define GPIO_30_IRQ 0x3B +#define GPIO_31_IRQ 0x3C +#define GPIO_32_IRQ 0x3D +#define GPIO_33_IRQ 0x3E +#define GPIO_34_IRQ 0x3F +#define GPIO_35_IRQ 0x40 +#define GPIO_36_IRQ 0x41 +#define GPIO_37_IRQ 0x42 +#define GPIO_38_IRQ 0x43 +#define GPIO_39_IRQ 0x44 +#define GPIO_40_IRQ 0x45 +#define GPIO_41_IRQ 0x46 +#define GPIO_42_IRQ 0x47 +#define GPIO_43_IRQ 0x48 +#define GPIO_44_IRQ 0x49 +#define GPIO_45_IRQ 0x4A +#define GPIO_46_IRQ 0x4B +#define GPIO_47_IRQ 0x4C +#define GPIO_48_IRQ 0x4D +#define GPIO_49_IRQ 0x4E +#define GPIO_62_IRQ 0x5B +#define GPIO_63_IRQ 0x5C +#define GPIO_64_IRQ 0x5D +#define GPIO_65_IRQ 0x5E +#define GPIO_66_IRQ 0x5F +#define GPIO_67_IRQ 0x60 +#define GPIO_68_IRQ 0x61 +#define GPIO_69_IRQ 0x62 +#define GPIO_70_IRQ 0x63 +#define GPIO_71_IRQ 0x64 +#define GPIO_72_IRQ 0x65 +#define GPIO_73_IRQ 0x66 + +#endif /* _ASM_ARCH_GPIO_H_ */
drivers/pinctrl/intel/Kconfig +17 -0
@@ -4,4 +4,21 @@ if PINCTRL_INTEL +config PINCTRL_INTEL_APL + bool "Support Intel Apollo Lake (APL)" + help + Add support for Intel Apollo Lake pin-control and pin-mux settings. + These are mostly read from the device tree, with the early-pads + property in the host bridge and the pads property in the fsp-s + subnode of the host bridge. + +config INTEL_PINCTRL_DUAL_ROUTE_SUPPORT + def_bool y + +config INTEL_PINCTRL_PADCFG_PADTOL + def_bool n + +config INTEL_PINCTRL_IOSTANDBY + def_bool y + endif
drivers/pinctrl/intel/Makefile +1 -0
@@ -3,3 +3,4 @@ # Copyright 2019 Google LLC obj-y += pinctrl.o +obj-$(CONFIG_PINCTRL_INTEL_APL) += pinctrl_apl.o
drivers/pinctrl/intel/pinctrl_apl.c new file +192 -0
192 lines not on this page · raw message
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 86/100 i2c: designware: Add Apollo Lake support
In reply to Simon GlassFor Apollo Lake we need to take the I2C bus controller out of reset before using this. Add this functionality to the driver.
---
Changes in v4:
- apollolake -> Apollo Lake
Changes in v3:
- Add a weak function to avoid errors on other platforms
Changes in v2: None
drivers/i2c/designware_i2c_pci.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
drivers/i2c/designware_i2c_pci.c +22 -0
@@ -8,8 +8,14 @@#include <common.h> #include <dm.h> #include <spl.h> +#include <asm/lpss.h> #include "designware_i2c.h" +enum { +VANILLA =0 , +INTEL_APL , +}; +/* BayTrail HCNT/LCNT/SDA hold time */ static struct dw_scl_sda_cfg byt_config = { .ss_hcnt =0x200 ,
@@ -62,6 +68,15 @@ static int designware_i2c_pci_ofdata_to_platdata(struct udevice *dev)static int designware_i2c_pci_probe (struct udevice *dev) { +struct dw_i2c *priv =dev_get_priv (dev); + +if (dev_get_driver_data (dev) ==INTEL_APL ) { +/* Ensure controller is in D0 state */ +lpss_set_power_state (dev,STATE_D0 ); + +lpss_reset_release (priv->regs); + } +return designware_i2c_probe (dev); }
@@ -91,6 +106,7 @@ static int designware_i2c_pci_bind(struct udevice *dev)static const struct udevice_id designware_i2c_pci_ids[] = { { .compatible ="snps,designware-i2c-pci" }, + { .compatible ="intel,apl-i2c" ,INTEL_APL }, { } };
@@ -116,6 +132,12 @@ static struct pci_device_id designware_pci_supported[] = { { PCI_VDEVICE(INTEL, 0x0f45) }, { PCI_VDEVICE(INTEL, 0x0f46) }, { PCI_VDEVICE(INTEL, 0x0f47) }, + { PCI_VDEVICE(INTEL, 0x5aac), .driver_data = INTEL_APL }, + { PCI_VDEVICE(INTEL, 0x5aae), .driver_data = INTEL_APL }, + { PCI_VDEVICE(INTEL, 0x5ab0), .driver_data = INTEL_APL }, + { PCI_VDEVICE(INTEL, 0x5ab2), .driver_data = INTEL_APL }, + { PCI_VDEVICE(INTEL, 0x5ab4), .driver_data = INTEL_APL }, + { PCI_VDEVICE(INTEL, 0x5ab6), .driver_data = INTEL_APL }, {}, };
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 87/100 x86: apl: Add systemagent driver
In reply to Simon GlassThis driver handles communication with the systemagent which needs to be told when U-Boot has completed its init.
---
Changes in v4:
- Add a comment for enable_bios_reset_cpl()
- Tidy up header guards
- use GENMASK() for VTBAR_MASK
Changes in v3: None
Changes in v2: None
arch/x86/cpu/apollolake/Makefile | 2 + arch/x86/cpu/apollolake/systemagent.c | 19 ++++++++++ .../include/asm/arch-apollolake/systemagent.h | 37 +++++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 arch/x86/cpu/apollolake/systemagent.c create mode 100644 arch/x86/include/asm/arch-apollolake/systemagent.h
arch/x86/cpu/apollolake/Makefile +2 -0
@@ -2,5 +2,7 @@ # # Copyright 2019 Google LLC +obj-$(CONFIG_SPL_BUILD) += systemagent.o + obj-y += pmc.o obj-y += uart.o
arch/x86/cpu/apollolake/systemagent.c new file +19 -0
@@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) 2017 Intel Corporation. +* Take from coreboot project file of the same name +*/ + +#include <common.h> +#include <asm/intel_regs.h> +#include <asm/io.h> +#include <asm/arch/systemagent.h> + +void enable_bios_reset_cpl (void ) +{ +/* +* Set bits 0+1 of BIOS_RESET_CPL to indicate to the CPU +* that BIOS has initialised memory and power management +*/ +setbits_8 (MCHBAR_REG (BIOS_RESET_CPL ),3 ); +}
arch/x86/include/asm/arch-apollolake/systemagent.h new file +37 -0
@@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2017 Intel Corporation. +* Take from coreboot project file of the same name +*/ + +#ifndef _ASM_ARCH_SYSTEMAGENT_H +#define _ASM_ARCH_SYSTEMAGENT_H + +/* Device 0:0.0 PCI configuration space */ +#define MCHBAR 0x48 + +/* RAPL Package Power Limit register under MCHBAR */ +#define PUNIT_THERMAL_DEVICE_IRQ 0x700C +#define PUINT_THERMAL_DEVICE_IRQ_VEC_NUMBER 0x18 +#define PUINT_THERMAL_DEVICE_IRQ_LOCK 0x80000000 +#define BIOS_RESET_CPL 0x7078 +#define PCODE_INIT_DONE BIT(8) +#define MCHBAR_RAPL_PPL 0x70A8 +#define CORE_DISABLE_MASK 0x7168 +#define CAPID0_A 0xE4 +#define VTD_DISABLE BIT(23) +#define DEFVTBAR 0x6c80 +#define GFXVTBAR 0x6c88 +#define VTBAR_ENABLED 0x01 +#define VTBAR_MASK GENMASK_ULL(39, 12) +#define VTBAR_SIZE 0x1000 + +/** +* enable_bios_reset_cpl() - Tell the system agent that memory/power are ready +* +* This should be called when U-Boot has set up the memory and power +* management. +*/ +void enable_bios_reset_cpl (void ); + +#endif
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 88/100 x86: apl: Add hostbridge driver
In reply to Simon GlassThis driver models the hostbridge as a northbridge. It simply sets up the graphics BAR. It supports of-platdata.
---
Changes in v4:
- Avoid needing to know internals of pinctrl in this driver
- Move code to pinctrl driver
- Switch over to use pinctrl for pad init/config
Changes in v3:
- Move pad programming into the hostbridge to reduce TPL device-tree size
- Use pci_get_devfn()
Changes in v2: None
arch/x86/cpu/apollolake/Makefile | 1 + arch/x86/cpu/apollolake/hostbridge.c | 179 +++++++++++++++++++++++++++ 2 files changed, 180 insertions(+) create mode 100644 arch/x86/cpu/apollolake/hostbridge.c
arch/x86/cpu/apollolake/Makefile +1 -0
@@ -4,5 +4,6 @@ obj-$(CONFIG_SPL_BUILD) += systemagent.o +obj-y += hostbridge.o obj-y += pmc.o obj-y += uart.o
arch/x86/cpu/apollolake/hostbridge.c new file +179 -0
179 lines not on this page · raw message
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 89/100 x86: apl: Add ITSS driver
In reply to Simon GlassThis driver models some sort of interrupt thingy but there are so many abreviations that I cannot find out what it stands for. Possibly something to do with interrupts.
---
Changes in v4:
- Tidy up header guards
Changes in v3:
- Add snapshot/restore for IRQs
- Use the IRQ uclass instead of ITSS
Changes in v2: None
arch/x86/cpu/apollolake/Makefile | 1 + arch/x86/cpu/apollolake/itss.c | 214 ++++++++++++++++++++ arch/x86/include/asm/arch-apollolake/itss.h | 43 ++++ 3 files changed, 258 insertions(+) create mode 100644 arch/x86/cpu/apollolake/itss.c create mode 100644 arch/x86/include/asm/arch-apollolake/itss.h
arch/x86/cpu/apollolake/Makefile +1 -0
@@ -5,5 +5,6 @@ obj-$(CONFIG_SPL_BUILD) += systemagent.o obj-y += hostbridge.o +obj-y += itss.o obj-y += pmc.o obj-y += uart.o
arch/x86/cpu/apollolake/itss.c new file +214 -0
214 lines not on this page · raw message
arch/x86/include/asm/arch-apollolake/itss.h new file +43 -0
43 lines not on this page · raw message
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 90/100 x86: apl: Add LPC driver
In reply to Simon GlassThis driver the LPC and provides a few functions to set up LPC features. These should probably use ioctls() or perhaps, better, have specific uclass methods.
---
Changes in v4:
- Add comments for exported functions
- Tidy up header guards
- Use 'Apollo Lake'
- Use BIT() macro a bit more
- Use tabs instead of spaces
Changes in v3:
- Drop unused code in lpc_configure_pads()
- Fix value of LPC_BC_LE
Changes in v2: None
arch/x86/cpu/apollolake/Makefile | 1 + arch/x86/cpu/apollolake/lpc.c | 141 +++++++++++++++++++++ arch/x86/include/asm/arch-apollolake/lpc.h | 82 ++++++++++++ 3 files changed, 224 insertions(+) create mode 100644 arch/x86/cpu/apollolake/lpc.c create mode 100644 arch/x86/include/asm/arch-apollolake/lpc.h
arch/x86/cpu/apollolake/Makefile +1 -0
@@ -6,5 +6,6 @@ obj-$(CONFIG_SPL_BUILD) += systemagent.o obj-y += hostbridge.o obj-y += itss.o +obj-y += lpc.o obj-y += pmc.o obj-y += uart.o
arch/x86/cpu/apollolake/lpc.c new file +141 -0
141 lines not on this page · raw message
arch/x86/include/asm/arch-apollolake/lpc.h new file +82 -0
82 lines not on this page · raw message
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 91/100 x86: apl: Add PCH driver
In reply to Simon GlassAdd a driver for the Apollo Lake Platform Controller Hub. It does not have any functionality and is just a placeholder for now.
---
Changes in v4:
- Tidy up header guards
- Update SPI flash protection only in SPL
- apollolake -> Apollo Lake
Changes in v3: None
Changes in v2:
- Drop probe() function
- Implement set_spi_protect()
arch/x86/cpu/apollolake/Makefile | 1 + arch/x86/cpu/apollolake/pch.c | 36 ++++++++++++++++++++++ arch/x86/include/asm/arch-apollolake/pch.h | 9 ++++++ 3 files changed, 46 insertions(+) create mode 100644 arch/x86/cpu/apollolake/pch.c create mode 100644 arch/x86/include/asm/arch-apollolake/pch.h
arch/x86/cpu/apollolake/Makefile +1 -0
@@ -7,5 +7,6 @@ obj-$(CONFIG_SPL_BUILD) += systemagent.o obj-y += hostbridge.o obj-y += itss.o obj-y += lpc.o +obj-y += pch.o obj-y += pmc.o obj-y += uart.o
arch/x86/cpu/apollolake/pch.c new file +36 -0
@@ -0,0 +1,36 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright 2019 Google LLC +*/ + +#include <common.h> +#include <dm.h> +#include <pch.h> +#include <spl.h> +#include <asm/lpc_common.h> + +#define BIOS_CTRL 0xdc + +static int apl_set_spi_protect (struct udevice *dev,bool protect) +{ +if (spl_phase () ==PHASE_SPL ) +return lpc_set_spi_protect (dev,BIOS_CTRL , protect); + +return 0 ; +} + +static const struct pch_ops apl_pch_ops = { + .set_spi_protect = apl_set_spi_protect, +}; + +static const struct udevice_id apl_pch_ids[] = { + { .compatible ="intel,apl-pch" }, + { } +}; + +U_BOOT_DRIVER (apl_pch) = { + .name ="apl_pch" , + .id =UCLASS_PCH , + .of_match = apl_pch_ids, + .ops = &apl_pch_ops, +};
arch/x86/include/asm/arch-apollolake/pch.h new file +9 -0
@@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright 2019 Google LLC +*/ + +#ifndef _ASM_ARCH_PCH_H +#define _ASM_ARCH_PCH_H + +#endif /* _ASM_ARCH_PCH_H */
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 92/100 x86: apl: Add PUNIT driver
In reply to Simon GlassAdd a driver for the Apollo Lake P-unit (power unit). It is modelled as a syscon driver since it only needs to be probed.
---
Changes in v4:
- Name this P-Unit instead of power unit, in the commit message
- apollolake -> Apollo Lake
Changes in v3:
- Use pci_get_devfn()
Changes in v2: None
arch/x86/cpu/apollolake/Makefile | 3 + arch/x86/cpu/apollolake/punit.c | 121 +++++++++++++++++++++++++++++++ 2 files changed, 124 insertions(+) create mode 100644 arch/x86/cpu/apollolake/punit.c
arch/x86/cpu/apollolake/Makefile +3 -0
@@ -3,6 +3,9 @@ # Copyright 2019 Google LLC obj-$(CONFIG_SPL_BUILD) += systemagent.o +ifndef CONFIG_TPL_BUILD +obj-y += punit.o +endif obj-y += hostbridge.o obj-y += itss.o
arch/x86/cpu/apollolake/punit.c new file +121 -0
121 lines not on this page · raw message
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 93/100 x86: apl: Add SPL loaders
In reply to Simon GlassAdd loaders for SPL and TPL so that the next stage can be loaded from memory-mapped SPI or, failing that, the Fast SPI driver.
---
Changes in v4: None
Changes in v3:
- Add a driver for APL SPI for TPL (using of-platdata)
- Support TPL without CONFIG_TPL_SPI_SUPPORT
- Support bootstage timing
Changes in v2: None
arch/x86/cpu/apollolake/Makefile | 2 + arch/x86/cpu/apollolake/spl.c | 202 +++++++++++++++++++++++++++++++ 2 files changed, 204 insertions(+) create mode 100644 arch/x86/cpu/apollolake/spl.c
arch/x86/cpu/apollolake/Makefile +2 -0
@@ -2,7 +2,9 @@ # # Copyright 2019 Google LLC +obj-$(CONFIG_SPL_BUILD) += spl.o obj-$(CONFIG_SPL_BUILD) += systemagent.o + ifndef CONFIG_TPL_BUILD obj-y += punit.o endif
arch/x86/cpu/apollolake/spl.c new file +202 -0
202 lines not on this page · raw message
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 94/100 x86: apl: Add a CPU driver
In reply to Simon GlassAdd a bare-bones CPU driver so that CPUs can be probed.
---
Changes in v4:
- Change apollolake to apl
- Tidy up header guards
Changes in v3:
- Add two more defines for the CPU driver
- Expand comments for BOOT_FROM_FAST_SPI_FLASH
Changes in v2: None
arch/x86/cpu/apollolake/Makefile | 1 + arch/x86/cpu/apollolake/cpu.c | 51 ++++++++++++++++++++++ arch/x86/include/asm/arch-apollolake/cpu.h | 27 ++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 arch/x86/cpu/apollolake/cpu.c create mode 100644 arch/x86/include/asm/arch-apollolake/cpu.h
arch/x86/cpu/apollolake/Makefile +1 -0
@@ -6,6 +6,7 @@ obj-$(CONFIG_SPL_BUILD) += spl.o obj-$(CONFIG_SPL_BUILD) += systemagent.o ifndef CONFIG_TPL_BUILD +obj-y += cpu.o obj-y += punit.o endif
arch/x86/cpu/apollolake/cpu.c new file +51 -0
51 lines not on this page · raw message
arch/x86/include/asm/arch-apollolake/cpu.h new file +27 -0
@@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright 2019 Google LLC +*/ + +#ifndef _ASM_ARCH_CPU_H +#define _ASM_ARCH_CPU_H + +/* Common Timer Copy (CTC) frequency - 19.2MHz */ +#define CTC_FREQ 19200000 + +/* +* Set to true to use the fast SPI driver to boot, instead of mapped SPI. +* You also need to enable CONFIG_APL_SPI_FLASH_BOOT. +*/ +#define BOOT_FROM_FAST_SPI_FLASH false + +/* +* We need to read well past the end of the region in order for execution from +* the loaded data to work. It is not clear why. +*/ +#define SAFETY_MARGIN 0x4000 + +#define MAX_PCIE_PORTS 6 +#define CLKREQ_DISABLED 0xf + +#endif /* _ASM_ARCH_CPU_H */
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 95/100 x86: apl: Add SPL/TPL init
In reply to Simon GlassAdd code to init the system both in TPL and SPL. Each phase has its own procedure.
---
Changes in v4:
- Switch over to use pinctrl for pad init/config
Changes in v3:
- Adjust fast_spi_cache_bios_region() to avoid using SPI driver
- Drop calls to x86_cpu_init_f(), x86_cpu_reinit_f()
- Fix build error when debug UART is disabled
- Init the p2sb before the northbridge since the latter so it can use GPIOs
- Move location of fast_spi.h header file
- Shorten log_msg_ret() calls since the function name is always printed
- Support TPL without CONFIG_TPL_SPI_SUPPORT (reduces code size)
Changes in v2: None
arch/x86/cpu/apollolake/Makefile | 1 + arch/x86/cpu/apollolake/cpu_spl.c | 274 ++++++++++++++++++++++++++++++ 2 files changed, 275 insertions(+) create mode 100644 arch/x86/cpu/apollolake/cpu_spl.c
arch/x86/cpu/apollolake/Makefile +1 -0
@@ -2,6 +2,7 @@ # # Copyright 2019 Google LLC +obj-$(CONFIG_SPL_BUILD) += cpu_spl.o obj-$(CONFIG_SPL_BUILD) += spl.o obj-$(CONFIG_SPL_BUILD) += systemagent.o
arch/x86/cpu/apollolake/cpu_spl.c new file +274 -0
274 lines not on this page · raw message
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 96/100 x86: apl: Add P2SB driver
In reply to Simon GlassAdds a driver for the Apollo Lake Primary-to-sideband bus. This supports various child devices. It supposed both device tree and of-platdata.
---
Changes in v4:
- Detect zero mmio address
- Use BIT() macro bit more
- apollolake -> Apollo Lake
Changes in v3:
- Use pci_get_devfn()
Changes in v2: None
arch/x86/cpu/apollolake/Makefile | 1 + arch/x86/cpu/apollolake/p2sb.c | 167 +++++++++++++++++++++++++++++++ 2 files changed, 168 insertions(+) create mode 100644 arch/x86/cpu/apollolake/p2sb.c
arch/x86/cpu/apollolake/Makefile +1 -0
@@ -14,6 +14,7 @@ endif obj-y += hostbridge.o obj-y += itss.o obj-y += lpc.o +obj-y += p2sb.o obj-y += pch.o obj-y += pmc.o obj-y += uart.o
arch/x86/cpu/apollolake/p2sb.c new file +167 -0
167 lines not on this page · raw message
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 97/100 x86: apl: Add Kconfig and Makefile
In reply to Simon GlassAdd basic plumbing to allow Apollo Lake support to be used.
---
Changes in v4:
- Enable HAVE_X86_FIT
- Enable INTEL_GPIO
- Switch over to use pinctrl for pad init/config
- Use existing VBT Kconfig option
- apollolake -> Apollo Lake
Changes in v3:
- Add MMC, video, USB configs
- Add an APL_SPI_FLASH_BOOT option to enable non-mmap boot
- Fix the incorrect value of CPU_ADDR_BITS
Changes in v2: None
arch/x86/Kconfig | 1 + arch/x86/cpu/Makefile | 1 + arch/x86/cpu/apollolake/Kconfig | 86 +++++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+) create mode 100644 arch/x86/cpu/apollolake/Kconfig
arch/x86/Kconfig +1 -0
@@ -106,6 +106,7 @@ source "board/google/Kconfig" source "board/intel/Kconfig" # platform-specific options below +source "arch/x86/cpu/apollolake/Kconfig" source "arch/x86/cpu/baytrail/Kconfig" source "arch/x86/cpu/braswell/Kconfig" source "arch/x86/cpu/broadwell/Kconfig"
arch/x86/cpu/Makefile +1 -0
@@ -41,6 +41,7 @@ extra-y += call32.o endif obj-y += intel_common/ +obj-$(CONFIG_INTEL_APOLLOLAKE) += apollolake/ obj-$(CONFIG_INTEL_BAYTRAIL) += baytrail/ obj-$(CONFIG_INTEL_BRASWELL) += braswell/ obj-$(CONFIG_INTEL_BROADWELL) += broadwell/
arch/x86/cpu/apollolake/Kconfig new file +86 -0
86 lines not on this page · raw message
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 98/100 x86: apl: Add FSP structures
In reply to Simon GlassThese are mostly specific to a particular SoC. Add the definitions for Apollo Lake.
---
Changes in v4:
- apollolake -> Apollo Lake
Changes in v3:
- Add VBT signature
- Add structures for FSP-S also
- Drop struct fsp_usp_header as it is now in the API file
Changes in v2: None
.../asm/arch-apollolake/fsp/fsp_configs.h | 14 + .../asm/arch-apollolake/fsp/fsp_m_upd.h | 123 ++++++++ .../asm/arch-apollolake/fsp/fsp_s_upd.h | 292 ++++++++++++++++++ .../include/asm/arch-apollolake/fsp/fsp_vpd.h | 11 + 4 files changed, 440 insertions(+) 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_s_upd.h create mode 100644 arch/x86/include/asm/arch-apollolake/fsp/fsp_vpd.h
arch/x86/include/asm/arch-apollolake/fsp/fsp_configs.h new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: Intel */ +/* +* Copyright 2019 Google LLC +*/ + +#ifndef __FSP_CONFIGS_H__ +#define __FSP_CONFIGS_H__ + +#define FSPT_UPD_SIGNATURE 0x545F4450554C5041/* 'APLUPD_T' */ +#define FSPM_UPD_SIGNATURE 0x4D5F4450554C5041/* 'APLUPD_M' */ +#define FSPS_UPD_SIGNATURE 0x535F4450554C5041/* 'APLUPD_S' */ +#define VBT_SIGNATURE 0x54425624 + +#endif
arch/x86/include/asm/arch-apollolake/fsp/fsp_m_upd.h new file +123 -0
123 lines not on this page · raw message
arch/x86/include/asm/arch-apollolake/fsp/fsp_s_upd.h new file +292 -0
292 lines not on this page · raw message
arch/x86/include/asm/arch-apollolake/fsp/fsp_vpd.h new file +11 -0
@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: Intel */ +/* +* Copyright 2019 Google LLC +*/ + +#ifndef __FSP_VPD_H +#define __FSP_VPD_H + +/* Nothing to declare here for FSP2 */ + +#endif
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 99/100 x86: apl: Add FSP support
In reply to Simon GlassThe memory and silicon init parts of the FSP need support code to work. Add this for Apollo Lake.
---
Changes in v4:
- Adjust the comment for struct dw_i2c_speed_config
- Rename arch_fsp_s_preinit() to arch_fsps_preinit()
- Switch over to use pinctrl for pad init/config
- Tidy up mixed case in FSP code
- apollolake -> Apollo Lake
Changes in v3:
- Add bootstage timing for reading vbt
- Add fspm_done() hook to handle FSP-S wierdness (it breaks SPI flash)
- Don't allow BOOT_FROM_FAST_SPI_FLASH with FSP-S
- Set boot_loader_tolum_size to 0
- Use the IRQ uclass instead of ITSS
Changes in v2: None
arch/x86/cpu/apollolake/Makefile | 6 + arch/x86/cpu/apollolake/fsp_m.c | 210 ++++++++++ arch/x86/cpu/apollolake/fsp_s.c | 664 +++++++++++++++++++++++++++++++ 3 files changed, 880 insertions(+) create mode 100644 arch/x86/cpu/apollolake/fsp_m.c create mode 100644 arch/x86/cpu/apollolake/fsp_s.c
arch/x86/cpu/apollolake/Makefile +6 -0
@@ -9,6 +9,12 @@ obj-$(CONFIG_SPL_BUILD) += systemagent.o ifndef CONFIG_TPL_BUILD obj-y += cpu.o obj-y += punit.o +ifdef CONFIG_SPL_BUILD +obj-y += fsp_m.o +endif +endif +ifndef CONFIG_SPL_BUILD +obj-y += fsp_s.o endif obj-y += hostbridge.o
arch/x86/cpu/apollolake/fsp_m.c new file +210 -0
210 lines not on this page · raw message
arch/x86/cpu/apollolake/fsp_s.c new file +664 -0
664 lines not on this page · raw message
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
PATCH v4 100/100 x86: Add chromebook_coral
In reply to Simon GlassAdd support for coral which is a range of Apollo Lake-based Chromebook released in 2017. This also includes reef released in 2016, since it is based on the same SoC.
---
Changes in v4:
- Add u-boot,skip-auto-config-until-reloc property to PCI
- Drop duplicate commit 'Create a new sandbox_pci_read_bar() function'
- New GPIO driver binding
- Set up LPC pads early
- Switch over to use pinctrl for pad init/config
- Update documentation with more detailed memory map
- Use hyphen for device-tree properties
- apollolake -> Apollo Lake
Changes in v3:
- Ad FSP-S support
- Add CONFIG_TPL_X86_ASSUME_CPUID to reduce code size
- Add Chrome OS EC support
- Add a proper SPI node and make the SPI flash node a child
- Add bootstage support
- Add more documentation
- Add spi alias in device tree
- Disable the bootcommand since it does nothing useful on coral
- Don't enable SPI flash in TPL by default
- Drop CONFIG_SPL_NET_SUPPORT
- Drop patch '86: timer: Reduce timer code size in TPL on Intel CPUs'
- Drop patch 'dm: core: Don't include ofnode functions with of-platdata'
- Drop patch 'spi: sandbox: Add a test driver for sandbox SPI flash'
- Drop patch 'spl: Allow SPL/TPL to use of-platdata without libfdt'
- Drop patch 'x86: apollolake: Add definitions for the Intel Fast SPI interface'
- Drop patch 'x86: timer: Set up the timer in timer_early_get_count()'
- Enable video and USB3
- Reduce amount of early-pad data in TPL
- Tidy up the pad settings in the device tree
- Use a zero-based tsc timer
Changes in v2: None
arch/x86/dts/Makefile | 1 + arch/x86/dts/chromebook_coral.dts | 823 ++++++++++++++++++++++ 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 + configs/chromebook_coral_defconfig | 102 +++ doc/board/google/chromebook_coral.rst | 241 +++++++ include/configs/chromebook_coral.h | 32 + 10 files changed, 1286 insertions(+) create mode 100644 arch/x86/dts/chromebook_coral.dts 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 configs/chromebook_coral_defconfig create mode 100644 doc/board/google/chromebook_coral.rst create mode 100644 include/configs/chromebook_coral.h
arch/x86/dts/Makefile +1 -0
@@ -2,6 +2,7 @@ dtb-y += bayleybay.dtb \ cherryhill.dtb \ + chromebook_coral.dtb \ chromebook_link.dtb \ chromebox_panther.dtb \ chromebook_samus.dtb \
arch/x86/dts/chromebook_coral.dts new file +823 -0
823 lines not on this page · raw message
board/google/Kconfig +15 -0
@@ -60,8 +60,23 @@ config TARGET_CHROMEBOOK_SAMUS_TPL between different A/B versions of SPL/U-Boot, to allow upgrading of almost all U-Boot code in the field. +config TARGET_CHROMEBOOK_CORAL + bool "Chromebook coral" + help + This is a range of Intel-based laptops released in 2018. They use an + Intel Apollo Lake SoC. The design supports WiFi, 4GB to 16GB of + LPDDR4 1600MHz SDRAM, PCIe WiFi and Bluetooth, eMMC (typically 32GB), + up two cameras (front-facing 720p and another 5MP option), USB SD + reader, microphone and speakers. It also includes two USB 3 Type A and + two Type C ports. The latter are used as power input and can also + charge external devices as well as a 4K external display. There is a + Chrome OS EC connected on LPC, a Cr50 secure chip from Google and + various display options. OEMs products include Acer Chromebook 11 + (e.g. C732, CB11, CP311) and Lenovo Chromebook (100e, 300e, 500e). + endchoice +source "board/google/chromebook_coral/Kconfig" source "board/google/chromebook_link/Kconfig" source "board/google/chromebox_panther/Kconfig" source "board/google/chromebook_samus/Kconfig"
board/google/chromebook_coral/Kconfig new file +43 -0
43 lines not on this page · raw message
board/google/chromebook_coral/MAINTAINERS new file +6 -0
@@ -0,0 +1,6 @@ +CHROMEBOOK_CORAL_BOARD +M: Simon Glass <[email protected]> +S: Maintained +F: board/google/chromebook_coral/ +F: include/configs/chromebook_coral.h +F: configs/chromebook_coral_defconfig
board/google/chromebook_coral/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright 2019 Google LLC + +obj-y += coral.o
board/google/chromebook_coral/coral.c new file +18 -0
@@ -0,0 +1,18 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright 2019 Google LLC +*/ + +#include <common.h> + +int arch_misc_init (void ) +{ +return 0 ; +} + +int board_run_command (const char *cmdline) +{ +printf ("No command line\n" ); + +return 0 ; +}
configs/chromebook_coral_defconfig new file +102 -0
102 lines not on this page · raw message
doc/board/google/chromebook_coral.rst new file +241 -0
241 lines not on this page · raw message
include/configs/chromebook_coral.h new file +32 -0
@@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright 2019 Google LLC +*/ + +/* +* board/config.h - configuration options, board-specific +*/ + +#ifndef __CONFIG_H +#define __CONFIG_H + +#define CONFIG_BOOTCOMMAND \ + "fatload mmc 1:c 1000000 syslinux/vmlinuz.A; zboot 1000000" + +#include <configs/x86-common.h> +#include <configs/x86-chromebook.h> + +#undef CONFIG_STD_DEVICES_SETTINGS +#define CONFIG_STD_DEVICES_SETTINGS "stdin=usbkbd,i8042-kbd,serial\0" \ + "stdout=vidconsole,serial\0" \ + "stderr=vidconsole,serial\0" + +#define CONFIG_ENV_SECT_SIZE 0x1000 +#define CONFIG_ENV_OFFSET 0x003f8000 + +#define CONFIG_TPL_TEXT_BASE 0xffff8000 + +#define CONFIG_SYS_NS16550_MEM32 +#undef CONFIG_SYS_NS16550_PORT_MAPPED + +#endif /* __CONFIG_H */
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
v4 cover x86: Add initial support for apollolake
In reply to Simon GlassHi Bin,
Quoted 12 lines · Simon Glass
Apollo Lake 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 Apollo Lake. As an example it adds an implementation of
chromebook_coral(a large range of Chromebooks released in 2017).The series provides enough support to boot to a prompt. with LCD display, storage, USB, EC and keyboard.
Quoted 7 lines
Since this is the first time U-Boot has used FSP2 there is quite a bit of refactoring needed.
This series is available at u-boot-dm/coral-working
Changes in v4:
- Add aLOG_CATEGORYfor silicon init
Unfortunately I left out some review tags in this version. I can resend if that helps.
Regards,
Simon
v4 cover x86: Add initial support for apollolake
Hi Simon,
Quoted 19 lines · Simon Glass
Hi Bin,
Quoted 15 lines · Simon Glass
Apollo Lake 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 Apollo Lake. As an example it adds an implementation of
chromebook_coral(a large range of Chromebooks released in 2017).The series provides enough support to boot to a prompt. with LCD display, storage, USB, EC and keyboard.
Since this is the first time U-Boot has used FSP2 there is quite a bit of refactoring needed.
Quoted 7 lines
Quoted 4 lines
This series is available at u-boot-dm/coral-working
Changes in v4:
- Add aLOG_CATEGORYfor silicon initUnfortunately I left out some review tags in this version. I can resend if that helps.
Yes, please do, as that definitely helps reviewing such a big series. :)
Regards,
Bin