summaryrefslogtreecommitdiff
path: root/drivers
AgeCommit message (Collapse)Author
2023-11-01bootstd: BOOTDEV_SPI_FLASH requires BOOTSTDHeinrich Schuchardt
Compiling sandbox_defconfig with CONFIG_BOOTSTD=n fails: /usr/bin/ld: drivers/mtd/spi/sf_bootdev.o: in function `sf_get_bootflow': /drivers/mtd/spi/sf_bootdev.c:43:(.text+0x96): undefined reference to `bootmeth_set_bootflow' Add the missing Kconfig dependency. Fixes: Fixes: 0c1f4a9fb13a ("bootstd: Add a SPI flash bootdev") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-11-01mmc: sdhci: Rework SDHCI_QUIRK_BROKEN_R1BSean Anderson
As noted in commit 3a6383207be ("mmc: sdhci: add the quirk for broken r1b response"), some MMC controllers don't always set the transfer complete bit with R1b responses. According to the SD Host Controller Simplified Specification v4.20, > In the case of a command pairing with response-with-busy[, Transfer > Complete] is set when busy is de-asserted. Refer to DAT Line Active > and Command Inhibit (DAT) in the Present State register. By polling the DAT Line Active bit in the present state register, we can detect when we are no longer busy, without waiting for a long timeout. This results in much faster reads/writes on buggy controllers. Signed-off-by: Sean Anderson <sean.anderson@seco.com> Tested-by: Henrik Grimler <henrik@grimler.se>
2023-11-01mmc: pci: Drop the superfluous castBin Meng
dm_pci_map_bar() return a value of (void *) already, hence no need to cast it again before assigning to host->ioaddr. Signed-off-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2023-11-01mmc: spl: select SPL_BLK for SPL_DM_MMCOleksandr Suvorov
mmc_bind() in mmc-uclass.c calls blk_create_devicef() which is defined in blk-uclass.c, so SPL_BLK is required by SPL_DM_MMC. Implicitly select SPL_BLK for SPL_DM_MMC. Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2023-10-31clk: ti: k3-pll: Add calibration support for non fractional modeVishal Mahaveer
PLL calibration needs to be enabled when operating in non fractional mode. Add the sequence to do a fast calibration when using PLL in this mode. Signed-off-by: Vishal Mahaveer <vishalm@ti.com>
2023-10-31pinctrl: npcm8xx: Add name for gpio functionJim Liu
GPIO function name is needed in the debug log Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>
2023-10-30misc: i2c_eeprom: consider pagesize when writing to eepromMichel Alex
Calculate the maximum length of the buffer when writing across the page boundary. If the buffer length (len) exceeds the page boundary (pagesize), split it. Use this length instead of comparing the length with the pagesize, because if the write start address (offset) is not at the beginning of a page and the page_offset + len is greater than the page boundary (pagesize), the write operation would overflow the current page and the behaviour can be undefined (e.g. at24). Signed-off-by: Alex Michel <alex.michel@wiedemann-group.com>
2023-10-30Kconfig: Remove all default n/no optionsMichal Simek
Similar change was done by commit b4c2c151b14b ("Kconfig: Remove all default n/no options") and again sync is required. default n/no doesn't need to be specified. It is default option anyway. Signed-off-by: Michal Simek <michal.simek@amd.com> Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Angelo Dureghello <angelo@kernel-space.org>
2023-10-30arm_ffa: fix: remove deadcode in ffa_print_error_log()Abdellatif El Khlifi
address the CID 464361 Control flow issues [1] [1]: https://lore.kernel.org/all/20230821210927.GL3953269@bill-the-cat/ Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com> Cc: Tom Rini <trini@konsulko.com>
2023-10-28Merge branch 'master_tmio_fixes' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-sh - MMC fixes for Renesas platforms
2023-10-27driver: misc: k3_avs: Add support for thermal shutdownUdit Kumar
To avoid thermal burn out, program thermal shutdown value in VTM (Voltage and Thermal Manager) IP. Part of Linux kernel driver (drivers/thermal/k3_j72xx_bandgap.c) is ported from kernel 6.6-rc1, which sets thermal shutdown values. Signed-off-by: Udit Kumar <u-kumar1@ti.com> Signed-off-by: Neha Francis <n-francis@ti.com>
2023-10-27misc: vexpress_config: Use member .priv_auto to set the private dataWei Chen
In current vexpress_config_probe code, it sets the uclass private data directly. This will cause one compilation error: drivers/misc/vexpress_config.c:114:27: error: lvalue required as left operand of assignment 114 | dev_get_uclass_priv(dev) = priv; | ^ In this patch we set the uclass private data through struct member .priv_auto, and this compilation error disappears. Signed-off-by: Wei Chen <wei.chen@arm.com> Signed-off-by: Qi Feng <qi.feng@arm.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
2023-10-27Merge tag 'tpm-next-27102023' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-tpm bootX measurements and measurement API moved to u-boot core: Up to now, U-Boot could perform measurements and EventLog creation as described by the TCG spec when booting via EFI. The EFI code was residing in lib/efi_loader/efi_tcg2.c and contained both EFI specific code + the API needed to access the TPM, extend PCRs and create an EventLog. The non-EFI part proved modular enough and moving it around to the TPM subsystem was straightforward. With that in place we can have a common API for measuring binaries regardless of the boot command, EFI or boot(m|i|z), and contructing an EventLog. I've tested all of the EFI cases -- booting with an empty EventLog and booting with a previous stage loader providing one and found no regressions. Eddie tested the bootX part. Eddie also fixed the sandbox TPM which couldn't be used for the EFI code and it now supports all the required capabilities. This had a slight sideeffect in our testing since the EFI subsystem initializes the TPM early and 'tpm2 init' failed during some python tests. That code only opens the device though, so we can replace it with 'tpm2 autostart' which doesn't error out and still allows you to perfom the rest of the tests but doesn't report an error if the device is already opened. There's a few minor issues with this PR as well but since testing and verifying the changes takes a considerable amount of time, I prefer merging it now. Heinrich has already sent a PR for -master containing "efi_loader: fix EFI_ENTRY point on get_active_pcr_banks" and I am not sure if that will cause any conflicts, but in any case they should be trivial to resolve. Both the EFI and non-EFI code have a Kconfig for measuring the loaded Device Tree. The reason this is optional is that we can't reason when/if devices add random info like kaslr-seed, mac addresses etc in the DT. In that case measurements are random, board specific and eventually useless. The reason it was difficult to fix it prior to this patchset is because the EFI subsystem and thus measurements was brought up late and DT fixups might have already been applied. With this patchset we can measure the DT really early in the future. Heinrich also pointed out that the two Kconfigs for the DTB measurements can be squashed in a single one and that the documentation only explains the non-EFI case. I agree on both but as I said this is a sane working version, so let's pull this first it's aleady big enough and painful to test.
2023-10-27spi: add support for Amlogic A1 SPI Flash ControllerIgor Prusov
Add A1 SPIFC driver from Linux. Slightly modified to use u-boot driver framework and accommodate to lack of ioread32_rep/iowrite32_rep. Based on Linux version 6.6-rc4 Signed-off-by: Igor Prusov <IVPrusov@sberdevices.ru> Signed-off-by: Martin Kurbanov <mmkurbanov@sberdevices.ru> Reviewed-by: Simon Glass <sjg@chromium.org> Link: https://lore.kernel.org/r/20231024225140.366571-2-ivprusov@sberdevices.ru Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> [trini: Drop <common.h> as it's not needed]
2023-10-27tpm: sandbox: Update for needed TPM2 capabilitiesEddie James
The driver needs to support getting the PCRs in the capabilities command. Fix various other things and support the max number of PCRs for TPM2. Remove the !SANDBOX dependency for EFI TCG2 as well. Signed-off-by: Eddie James <eajames@linux.ibm.com> Reviewed-by: Simon Glass <sjg@chromium.org> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2023-10-27mmc: tmio: Disable 1/1024 clock divider on Renesas R-Car platformsMarek Vasut
The R-Car Gen3 SD_CLK_CTRL register does not use BIT(16) to implement divider 1/1024, instead BIT(16) is reserved bit and divider 1/1024 is not supported. The divider 1/1024 is specific to Socionext variant of the IP, as is indicated by Linux commit: 0196c8db8363 ("mmc: tmio: move tmio_mmc_set_clock() to platform hook") " Socionext (and Panasonic) uses bit 10 (CLKSEL) for 1/1. Also, newer versions of UniPhier SoC variants use bit 16 for 1/1024. " Do not set the TMIO_SD_CAP_DIV1024 on Renesas R-Car platforms even if the IP VERSION register does exist, and indicates IP version is newer or equal to version 1.0 . The IP version 1.0 or newer does not imply presence of the 1/1024 divider. Since the TMIO driver is used exactly by two supported platforms, that is Renesas R-Car and Socionext UniPhier, it is OK to check whether the TMIO_SD_CAP_RCAR capability is not set to identify the UniPhier platform and add the capability only on that platform. Fixes: 58c35b17aa8f ("mmc: matsushita-common: Always check controller version") Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Acked-by: Paul Barker <paul.barker.ct@bp.renesas.com> Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Tested-by: Thuan Nguyen Hong <thuan.nguyen-hong@banvien.com.vn>
2023-10-27mmc: tmio: Always check for errors after receiving an IRQMarek Vasut
Unconditionally check for errors even after successful reception of IRQ flag, since the hardware may set both an IRQ completion flag and an error flag at the same time. This mode of failure happens in case of an error during transfer, in which case the hardware may set the expected IRQ completion flag as well as error flags. The later is currently not checked by the driver and such an error is not detected. Improve the error detection. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Tested-by: Thuan Nguyen Hong <thuan.nguyen-hong@banvien.com.vn>
2023-10-27mmc: sh_sdhi: Drop unused driverMarek Vasut
This driver is long superseded by renesas-sdhi.c and unused. Drop the driver. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Acked-by: Paul Barker <paul.barker.ct@bp.renesas.com>
2023-10-27mmc: renesas-sdhi: Fix error handling in rzg2l_sdhi_setupPaul Barker
We should ensure that reset_free() is called in the error path. Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com> Fixes: 93c811b7331b ("mmc: renesas-sdhi: Initialize module on RZ/G2L") Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2023-10-24serial: introduce CONFIG_CONSOLE_FLUSH_ON_NEWLINERasmus Villemoes
When debugging, one sometimes only gets partial output lines or nothing at all from the last printf, because the uart has a largish buffer, and the code after the printf() may cause the CPU to hang before the uart IP has time to actually emit all the characters. That can be very confusing, because one doesn't then know exactly where the hang happens. Introduce a config knob allowing one to wait for the uart fifo to drain whenever a newline character is printed, roughly corresponding to the effect of setvbuf(..., _IOLBF, ...) in ordinary C programs. Since this uses IS_ENABLED() instead of cpp ifdef, we can remove the ifdef around the _serial_flush() definition - if neither CONSOLE_FLUSH_SUPPORT or CONSOLE_FLUSH_ON_NEWLINE are enabled, the compiler elides _serial_flush(), but it won't warn about it being unused. Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-24serial: serial-uclass.c: move definition of _serial_flush up a bitRasmus Villemoes
Preparation for next patch. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
2023-10-24sandbox: add SCMI power domain protocol support for testingAKASHI Takahiro
SCMI power domain management protocol is supported on sandbox for test purpose. Add fake agent interfaces and associated power domain devices. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-24power: domain: add SCMI driverAKASHI Takahiro
Add power domain driver based on SCMI power domain management protocol. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2023-10-24firmware: scmi: add power domain protocol supportAKASHI Takahiro
In this patch, added are helper functions to directly manipulate SCMI power domain management protocol. DM compliant power domain driver will be implemented on top of those interfaces in a succeeding patch. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2023-10-24Merge tag 'u-boot-rockchip-20231024' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-rockchip - Add Board: rk3588 NanoPC-T6, Orange Pi 5, Orange Pi 5 Plus; - clk driver fix for rk3568 and rk3588; - rkmtd cmd support for rockchip nand device; - dts update and sync from linux;
2023-10-24Merge tag 'u-boot-imx-20231024' of ↵Tom Rini
https://gitlab.denx.de/u-boot/custodians/u-boot-imx u-boot-imx-20231024 ------------------- CI: https://source.denx.de/u-boot/custodians/u-boot-imx/-/pipelines/18211 - Fixes for MC2432 Eeprom - i.MX93 ADC - Secondary boot mode on i.MX8M
2023-10-24rockchip: block: blk-uclass: add bounce buffer flag to blk_descJohan Jonker
Currently bounce buffer support is enabled for all block devices when available. Add a flag to blk_desc to enable only on demand. Signed-off-by: Johan Jonker <jbx6244@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2023-10-24rockchip: block: add rkmtd class and driversJohan Jonker
Add rkmtd class and drivers to create a virtual block device to transfer Rockchip boot block data to and from NAND with block orientated tools like "ums" and "rockusb". Signed-off-by: Johan Jonker <jbx6244@gmail.com> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2023-10-24rockchip: dm: prepare rkmtd UCLASSJohan Jonker
Prepare a rkmtd UCLASS in use for writing Rockchip boot blocks in combination with existing userspace tools and rockusb command. Signed-off-by: Johan Jonker <jbx6244@gmail.com> Reviewed-by: Kever Yang <kever.yang@rock-chips.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-24mtd: nand: raw: rockchip_nfc: add NAND_SKIP_BBTSCAN optionJohan Jonker
On Rockchip SoCs the first boot stages are written on NAND with help of manufacturer software that uses a different format then the MTD framework. Skip the automatic BBT scan with the NAND_SKIP_BBTSCAN option to be able to pass the driver probe function and to let the original data unchanged. Signed-off-by: Johan Jonker <jbx6244@gmail.com> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2023-10-24mtd: spi-nor: Add support for XMC XM25QU128CRicardo Pardini
Add support for XMC XM25QU128C (128M-bit) Serial Flash memory. Used on the Xunlong Orange Pi 3B, 5 and 5 Plus boards. Datasheet: https://www.xmcwh.com/uploads/806/XM25QU128C_Ver2.0.pdf Signed-off-by: Ricardo Pardini <ricardo@pardini.net> [jonas@kwiboo.se: update commit message] Signed-off-by: Jonas Karlman <jonas@kwiboo.se> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2023-10-23bootstd: sata: bootdev scanning for ahci sata with no drive attachedTony Dinh
It's normal to have no SATA drive attached to the controller, so return a successful status when there is no block device found after probing. Note: this patch depends on the previous patch https://patchwork.ozlabs.org/project/uboot/patch/20230917230649.30357-1-mibodhi@gmail.com/ Resend the right patch. Signed-off-by: Tony Dinh <mibodhi@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Stefan Roese <sr@denx.de>
2023-10-23bootstd: sata: Add bootstd support for ahci sataTony Dinh
Add ahci sata bootdev and corresponding hunting function. Signed-off-by: Tony Dinh <mibodhi@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Stefan Roese <sr@denx.de>
2023-10-23Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sunxiTom Rini
This is mostly about support for the Allwinner R528/T113s SoC, which is reportedly the same die as the Allwinner D1, but with the two Arm Cortex-A7 cores activated instead of the RISC-V one. Using sunxi code outside of arch/arm proved to be difficult, so apart from enabling this Arm SoC, the patches also prepare for more refactoring to get the D1 nicely supported some day: - We get rid of some Kconfig (hard-)coded GPIO pins, responsible for enabling regulators. - The GPIO code is moved out of arch/arm, into drivers/gpio. - Some definitions are moved out of header files under asm/arch. - Some T113s/D1 specific definitions are guarded by a generic Kconfig symbol (CONFIG_SUNXI_GEN_NCAT2). - The DRAM controller initialisation code is located under drivers/ram. - The base SoC .dtsi files are shared (under arch/riscv, as in Linux). Of course there are also the usual new SoC specific patches, like clock and pinmux descriptions, alongside a rework of the pinctrl code, since Allwinner changed the GPIO register layout, for the first time since sunxi's inception. On top of this the PSCI code sees some update, to provide SMP services for R528/T113s boards. Many thanks to Sam for providing this code and staying strong through the review cycles. The final patch enables support for one popular board, I hope to see more DTs and defconfigs contributed in the future! Many thanks to all the various contributors, testers and reviewers, that series was a real team effort!
2023-10-23Merge tag 'video-20231022' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-video - updates for pwm_backlight, simple_panel and tegra20 to keep fixed/gpio regulator counter in balance
2023-10-23Merge tag 'u-boot-amlogic-20231023' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-amlogic - sync A1 with Linux and add missing UART compatible - fix USB2 gadget init on G12/SM1 based Boards
2023-10-23clk: rockchip: rk3588: fix up the frac pll calculationElaine Zhang
rk3588 frac pll: FFVCO = ((m + k / 65536) * FFIN) / p FFOUT = ((m + k / 65536) * FFIN) / (p * 2s) k is the original code, but the K[15:0] is complement code (6'b1000_0000_0000_0000 <= K[15:0] <= 16'b0111_1111_1111_1111), need to be converted. Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2023-10-23clk: rockchip: rk3588: Avoid re-setting the pll rate of dclk_vop's parentElaine Zhang
Optimize setting process. Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2023-10-23clk: rockchip: rk3588: support aclk_top_root set 750MElaine Zhang
aclk_top_root choose a parent clock that does not change. Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2023-10-23clk: rk3588: Add 742.5M parameter for PLLGuochun Huang
For a specific frequency. Signed-off-by: Guochun Huang <hero.huang@rock-chips.com> Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2023-10-23clk: rockchip: rk3568: support dclk_vop select more parent clksElaine Zhang
For dclk_vop to support more frequencies. Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2023-10-22sunxi: add Allwinner R528/T113 SoC supportAndre Przywara
This adds the remaining code bits to teach U-Boot about Allwinner's newest SoC generation. This was introduced with the RISC-V based Allwinner D1 SoC, which actually shares a die with the ARM cores versions called R528 (BGA, without DRAM) and T113s (QFP, with embedded DRAM). This adds the new Kconfig stanza, using the two newly introduced symbols for the new SoC generation and pincontroller. It also adds the new symbols to the relavent code places, to set all the hardcoded bits directly. We need one DT override: The ARM core version of the DT specifies the CPUX watchdog as "reserved", which means it won't be recognised by U-Boot. Override this in our generic sunxi-u-boot.dtsi, to let U-Boot pick up this watchdog, so that the generic reset driver will work. Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2023-10-22sunxi: add R528/T113-s3/D1(s) DRAM initialisation codeAndre Przywara
The Allwinner R528/T113-s/D1/D1s SoCs all share the same die, so use the same DRAM initialisation code. Make use of prior art here and lift some code from awboot[1], which carried init code based on earlier decompilation efforts, but with a GPL2 license tag. This code has been heavily reworked and cleaned up, to match previous DRAM routines for other SoCs, and also to be closer to U-Boot's coding style and support routines. The actual DRAM chip timing parameters are included in the main file, since they cover all DRAM types, and are protected by a new Kconfig CONFIG_SUNXI_DRAM_TYPE symbol, which allows the compiler to pick only the relevant settings, at build time. The relevant DRAM chips/board specific configuration parameters are delivered via Kconfig, so this code here should work for all supported SoCs and DRAM chips combinations. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Tested-by: Sam Edwards <CFSworks@gmail.com>
2023-10-22Kconfig: sunxi: prepare for using drivers/ram/sunxiAndre Przywara
At the moment all Allwinner DRAM initialisation routines are stored in arch/arm/mach-sunxi, even though those "drivers" are just a giant collection of writel's, without any architectural dependency. The R528/T113-s SoC (with ARM cores) and the D1/D1s Soc (with RISC-V cores) share the same die, so should share the same DRAM init routines as well. To prepare for this, add a new sunxi directory inside drivers/ram, and add some stub entries to prepare for the addition of the share DRAM code for those SoCs. The RISC-V D1(s) SoCs will probably use SPL_DM, so for that SoC this would be the right directory anyway. Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2023-10-22clk: sunxi: Add support for the D1 CCUSamuel Holland
Since the D1 CCU binding is defined, we can add support for its gates/resets, following the pattern of the existing drivers. Signed-off-by: Samuel Holland <samuel@sholland.org> Reviewed-by: Andre Przywara <andre.przywara@arm.com> Acked-by: Sean Anderson <seanga2@gmail.com> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2023-10-22pinctrl: sunxi: add Allwinner D1 pinctrl descriptionAndre Przywara
Apart from using the new pinctrl MMIO register layout, the Allwinner D1 and related SoCs still need to usual set of mux values hardcoded in U-Boot's pinctrl driver. Add the values we need so far to this list, so that DM based drivers will just work without further ado. Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2023-10-22sunxi: introduce NCAT2 generation modelAndre Przywara
Allwinner seems to typically stick to a common MMIO memory map for several SoCs, but from time to time does some breaking changes, which also introduce new generations of some peripherals. The last time this happened with the H6, which apart from re-organising the base addresses also changed the clock controller significantly. We added a CONFIG_SUN50I_GEN_H6 symbol back then to mark SoCs sharing those traits. Now the Allwinner D1 changes the memory map again, and also extends the pincontroller, among other peripherals. To mark this generation of SoCs, add a CONFIG_SUNXI_GEN_NCAT2 symbol, this name is reportedly used in the Allwinner BSP code, and prevents us from inventing our own name. Add this new symbol to some guards that were already checking for the H6 generation, since many features are shared between the two (like the renovated clock controller). This paves the way to introduce a first user of this generation. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Tested-by: Samuel Holland <samuel@sholland.org>
2023-10-22pinctrl: sunxi: add new D1 pinctrl supportAndre Przywara
For the first time since at least the Allwinner A10 SoCs, the D1 (and related cores) use a new pincontroller MMIO register layout, so we cannot use our hardcoded, fixed offsets anymore. Ideally this would all be handled by devicetree and DM drivers, but for the DT-less SPL we still need the legacy interfaces. Add a new Kconfig symbol to differenciate between the two generations of pincontrollers, and just use that to just switch some basic symbols. The rest is already abstracted enough, so works out of the box. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Sam Edwards <CFSworks@gmail.com> Tested-by: Sam Edwards <CFSworks@gmail.com> Tested-by: Samuel Holland <samuel@sholland.org>
2023-10-22pinctrl: sunxi: remove GPIO_EXTRA_HEADERAndre Przywara
U-Boot's generic GPIO_EXTRA_HEADER is a convenience symbol to allow code to more easily include platform specific GPIO headers. This should not be needed in a DM world anymore, since the generic GPIO framework handles that nicely. For Allwinner boards we still need to deal with non-DM GPIO in the SPL, but this should become the exception, not the rule. Make this more obvious by removing the definition of GPIO_EXTRA_HEADER, and just force every legacy user of platform specific GPIO to include the new sunxi_gpio.h header explicitly. Everyone doing so should feel ashamed and should find a way to avoid it from now on. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Tested-by: Samuel Holland <samuel@sholland.org>
2023-10-22pinctrl: sunxi: remove struct sunxi_gpioAndre Przywara
So far every Allwinner SoC used the same basic pincontroller/GPIO register frame, and just differed by the number of implemented banks and pins, plus some special functionality from time to time. However the D1 and successors use a slightly different pinctrl register layout. Use that opportunity to drop "struct sunxi_gpio", that described that MMIO frame in a C struct. That approach is somewhat frowned upon in the Linux world and rarely used there, though still popular with U-Boot. Switching from a C struct to a "base address plus offset" approach allows to switch between the two models more dynamically, without reverting to preprocessor macros and #ifdef's. Model the pinctrl MMIO register frame in the usual "base address + offset" way, and replace a hard-to-parse CPP macro with a more readable static function. All the users get converted over. There are no functional changes at this point, it just prepares the stages for the D1 and friends. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Samuel Holland <samuel@sholland.org> Tested-by: Samuel Holland <samuel@sholland.org>