summaryrefslogtreecommitdiff
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* mfd: add regmap driver for rohm-bd718x7Ahmad Fatoum2023-01-311-0/+3
| | | | | | | | | | | | Rohm BD71837 is a PMIC for i.MX8MM, which is used on most boards supported by barebox. So far, we didn't need to change PMIC configuration after the initial setup in PBL, but to support future debugging and development, let's port the Linux MFD driver sans the regulators, so we get a regmap for interacting with the device. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230130071622.34094-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ddr_spd: Support reading SPD from DDR3 sticksJohn Watts2023-01-251-1/+2
| | | | | | | | | DDR4 splits the read in two pages while other DDR types do not. Introduce a new parameter to indicate how to read the SPD. Signed-off-by: John Watts <contact@jookia.org> Link: https://lore.barebox.org/20230121144429.3524905-8-contact@jookia.org Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ddr_dimms: Remove mclk_ps for DDR3 and DDR4John Watts2023-01-251-4/+2
| | | | | | | | This parameter is unused, throw it away. Signed-off-by: John Watts <contact@jookia.org> Link: https://lore.barebox.org/20230121144429.3524905-7-contact@jookia.org Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ddr_dimms: Move ddr*_dimm_params to commonJohn Watts2023-01-251-0/+13
| | | | | | | | | | This code is no longer specific to the any board. Also make ddr2_speed_bins static to not break PowerPC compilation Signed-off-by: John Watts <contact@jookia.org> Link: https://lore.barebox.org/20230121144429.3524905-6-contact@jookia.org Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ddr: fsl: Remove includes to fsl-specific codeJohn Watts2023-01-241-0/+2
| | | | | | | | This is in preparation for use for generic SPD calculations. Signed-off-by: John Watts <contact@jookia.org> Link: https://lore.barebox.org/20230121144429.3524905-5-contact@jookia.org Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ddr_dimms: Move FSL dimm_params to include/ddr_dimms.hJohn Watts2023-01-242-91/+102
| | | | | | | | This is in preparation for use for generic SPD calculations. Signed-off-by: John Watts <contact@jookia.org> Link: https://lore.barebox.org/20230121144429.3524905-4-contact@jookia.org Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* I2C: i.MX: Add early i2c support for i.MX6John Watts2023-01-241-0/+1
| | | | | | | | | This adds early i2c support for i.MX6. Nothing special here, just a plain copy of the i.MX8 code with the divider adjusted. Signed-off-by: John Watts <contact@jookia.org> Link: https://lore.barebox.org/20230121144429.3524905-2-contact@jookia.org Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: dsa: add Realtek (rtl8365mb/rtl8366rb) switch supportAhmad Fatoum2023-01-233-1/+12
| | | | | | | | | This imports the Linux v6.1 state of the driver into barebox. This has been tested with the RTL8365MB in (bitbanged) SMI mode. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230116134501.2006391-10-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: dsa: add struct dsa_switch::priv member for driver useAhmad Fatoum2023-01-231-0/+1
| | | | | | | | | While we could use container_of, this makes porting and synchronizing with Linux drivers easier. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230116134501.2006391-9-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: dsa: add some helpers to ease porting kernel driversAhmad Fatoum2023-01-231-0/+16
| | | | | | | | | These make port of the realtek driver in a follow-up commit a bit more similar to the Linux driver. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230116134501.2006391-8-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: dsa: rename dsa_ops to dsa_switch_opsAhmad Fatoum2023-01-231-2/+2
| | | | | | | | | Linux calls the ops dsa_switch_ops and we have some members, which are the same in both, so adopt the Linux naming. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230116134501.2006391-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* gpiolib: implement gpio_direction_input/outputAhmad Fatoum2023-01-231-1/+11
| | | | | | | | | These are straight wrappers around existing functions, but with a name that's more like their Linux counterparts. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230116134501.2006391-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* driver: alias of_match_ptr and DRV_OF_COMPATAhmad Fatoum2023-01-231-1/+3
| | | | | | | | | Linux calls our DRV_OF_COMPAT of_match_ptr. Support both names for a while with the intention of removing DRV_OF_COMPAT Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230116134501.2006391-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/struct-rename'Sascha Hauer2023-01-201-0/+1
|\
| * of: implement of_device_enable_by_aliasAhmad Fatoum2023-01-161-0/+1
| | | | | | | | | | | | | | | | | | | | For symmetry with of_device_disable, which already has direct, path and by alias variants, implement the missing of_device_enable_by alias as well. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230116133500.1998550-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc-struct-rename'Sascha Hauer2023-01-205-3/+94
|\ \
| * | driver: drop no longer used RW_SIZE/_MASK macrosAhmad Fatoum2023-01-121-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | O_RWSIZE_MASK is what's now used and it's passed as argument to open. There remain no users of either RW_SIZE or RW_SIZE_MASK. Remove to avoid confusion. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230111120002.1104864-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | dev: add dev_bus_is_spi/i2c helpersAhmad Fatoum2023-01-122-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | These will simplify writing drivers that can probe via either I2C or SPI like the SSD1307FB and upcoming KSZ I2C switch support. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230111132956.1153359-9-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | net: dsa: ksz9477: create regmap cdev for switch registersAhmad Fatoum2023-01-121-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that we use regmap for the KSZ9477 driver, we can make the register map available for introspection as a device file. As the KSZ driver has a separate regmap for each of the three access sizes, we add a new regmap_multi_register_cdev abstraction that multiplexes device file access to the regmap with the best matching alignment. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230111132956.1153359-7-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | regmap: factor out regmap cdev size calculationAhmad Fatoum2023-01-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | We will add a new user of this calculate in a follow-up commit, so make it available as a global function. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230111132956.1153359-5-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | regmap: port regmap_init_spiAhmad Fatoum2023-01-121-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | We already have regmap_init_i2c, so add regmap_init_spi as well. Unlike regmap_init_i2c, this one makes full use of the formatted regmap API. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230111132956.1153359-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | regmap: support formatted read and writeAhmad Fatoum2023-01-121-0/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Regmap support in barebox compared to Linux is quite primitive. For incoming SPI regmap support, we will want users of the API to just populate their regmap config appropriately and have the core do the heavy lifting of formatting register and value into the buffer correctly. For this, import the formatted read/write functionality of Linux into a new regmap-fmt.c file. Unlike Linux, we keep this functionally gated behind a Kconfig option, so it's only selected when needed, e.g. via REGMAP_SPI in a follow-up commit. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230111132956.1153359-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | mtd: consult CONFIG_OFDEVICE in mtd_get_of_nodeAhmad Fatoum2023-01-121-0/+2
| |/ | | | | | | | | | | | | | | | | | | | | Get barebox on non-DT platforms with NAND a tiny bit smaller by directly returning NULL if CONFIG_OFDEVICE is not enabled, thereby allowing more code to be discarded at compile-time in absence of link-time optimization. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230111173548.1660598-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2023-01-203-2/+49
|\ \
| * | include: linux/iopoll.h: silence warning when timeout_us contains *Ahmad Fatoum2023-01-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We evaluate timeout_us for truthiness to determine whether we are entering an infinite poll loop. When timeout_us contains a multiplication, GCC will warn about it and suggest replacing the * with &&. Silence this warning by comparing directly against 0. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230111074957.897629-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | mci: handle SDIO cards gracefullySascha Hauer2023-01-111-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Detect SDIO cards properly to be able to return from card detection without errors. So far a SDIO card reports several errors during detection: ERROR: bcm2835_mci 3f300000.mmc@7e300000.of: Error while executing command 8 ERROR: bcm2835_mci 3f300000.mmc@7e300000.of: Status: 0x1FF0001, Interrupt: 0x18000 ERROR: bcm2835_mci 3f300000.mmc@7e300000.of: Error while executing command 55 ERROR: bcm2835_mci 3f300000.mmc@7e300000.of: Status: 0x1FF0001, Interrupt: 0x18000 ERROR: bcm2835_mci 3f300000.mmc@7e300000.of: Error while executing command 1 ERROR: bcm2835_mci 3f300000.mmc@7e300000.of: Status: 0x1FF0001, Interrupt: 0x18000 With this we can now detect SDIO cards without reporting errors, or to put it differently: barebox now has SDIO support ;) Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20230110155039.2039341-2-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | mci: Add more respone typesSascha Hauer2023-01-111-0/+24
| | | | | | | | | | | | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20230110155039.2039341-1-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | asm-generic: define IOMEM for assembly as wellAhmad Fatoum2023-01-101-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In interest of type safety, we should start using IOMEM() for register MMIO base addresses that we keep in headers for PBL. Some of these addresses are used from assembly code as well, so define IOMEM() for that case. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Link: https://lore.barebox.org/20230109175828.2017699-1-ahmad@a3f.at Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | mci: only write blocks when card out of programming modeAhmad Fatoum2022-12-161-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | eMMC Spec v5.1 (JEDEC Standard No. 84-B51) is quite clear that: Due to legacy reasons, a Device may still treat CMD24/25 during prg-state (while busy is active) as a legal or illegal command. A host should not send CMD24/25 while the Device is in the prg state and busy is active. So far, we had never evaluated MMC_CMD_SEND_STATUS. This patch corrects this and thereby resolves an issue of timed out writes with the atmel_mci driver: barebox@SAMA5D4:/ saveenv ERROR: atmel_mci fc000000.mmc@fc000000.of: command/data timeout ERROR: atmel_mci fc000000.mmc@fc000000.of: command/data timeout These issues are not new, but were first reported in 2018[0] along with a workaround suggesting a delay at the end of atmci_request: if (cmdidx == MMC_CMD_STOP_TRANSMISSION) mdelay(5) Just before the command timing out, we read 0x00c00_0025 from the status register, which is CMDRDY | TXRDY | NOTBUSY | XFERDONE | FIFOEMPTY which suggests the issue is not at the MCI host side, but rather at the card side. With this patch applied and debugging enabled, this seems to be confirmed: barebox@SAMA5D4:/ saveenv saving environment mmc1: Ready polling took 0ms mmc1: Ready polling took 4ms I compared with AT91Bootstrap[1], U-Boot[2] and Trusted Firmware-A[3] and all of them poll MCI status after block writes. The sequence imported here is taken from U-Boot, but instead of doing it after writes, we do it before them in hope that we need not always incur the extra delay. I don't have an answer why this was only necessary on the SAMA5D3/4 and such issues weren't observed with other drivers. Card was operated at 50MHz (SD HS) and it didn't help trying other cards or going down to 400kHz. I tested this change also on a Beaglebone Black where an environment is also stored into FAT on a SD-Card operated with 50 MHz: Ready polling took 0ms for each of the two writes. [0]: https://lore.barebox.org/barebox/20181102091156.26476-1-s.hauer@pengutronix.de/ [1]: https://github.com/linux4sam/at91bootstrap/blob/v4.0.5/driver/mci_media.c#L1187 [2]: https://github.com/trini/u-boot/blob/v2023.01-rc3/drivers/mmc/mmc_write.c#L181 [3]: https://github.com/ARM-software/arm-trusted-firmware/blob/v2.8.0/drivers/mmc/mmc.c#L718 Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20221214105050.633668-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/jsmn'Sascha Hauer2023-01-202-1/+150
|\ \ \
| * | | test: self: add json parser testAhmad Fatoum2023-01-101-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Newly added JSON parsing code doesn't yet have a consumer in-tree. Add a self-test to exercise the API for now. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230110084930.3439001-5-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | lib: extend jsmn with simple JSONPath lookup helpersAhmad Fatoum2023-01-101-0/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Board code may not be interested in iterating fully over the JSON blob and instead just wants to lookup a value at a specific JSONPath. Add helpers to facilitate this. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230110084930.3439001-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | lib: add jsmn JSON parser supportAhmad Fatoum2023-01-101-0/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Board code may require JSON support to parse factory data or to verify JSON web tokens in locked-down systems. Import the current master state[1] of JSMN, a minimalistic JSON parser, with slight changes to make it compile in barebox [1]: https://github.com/zserge/jsmn/commit/25647e6 Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230110084930.3439001-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | | Merge branch 'for-next/imx'Sascha Hauer2023-01-201-1/+1
|\ \ \ \
| * | | | ARM: i.MX8M: bootrom: access OCRAM directly if running in EL3Ahmad Fatoum2023-01-121-1/+1
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's straight-forward to hack barebox PBL to skip ATF installation and to start barebox proper in EL3. This can be useful for debugging and may in future be just a Kconfig option like we now have with Rockchip. In such a configuration, we don't need to copy the ROM log out of OCRAM, because there's no ATF installed there that might overwrite it. Therefore, just directly access the event log pointer in BootROM if running in EL3. As 0x9e0 is in the first zero page, we use the function in zero_page.h to temporarily disable traps in the zero page. We don't need to do that in PBL though as even early MMU will be enabled later. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230111152836.1548942-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | | Merge branch 'for-next/caam'Sascha Hauer2023-01-201-0/+17
|\ \ \ \
| * | | | crypto: caam - implement early PBL initAhmad Fatoum2023-01-121-0/+17
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While the CAAM is TrustZone aware, Linux and OP-TEE drivers are not necessarily so: - Linux running in normal world will attempt to set up RNG via DECO, which can be restricted to secure world - OP-TEE may depend on RNG being set up by BL2 While the proper solution would be to teach their drivers how to instantiate the RNG via SHs, we'll want to support existing firmware, so take the easy way out and just set up RNG4 SH0 and SH1 in barebox. We already do that for the i.MX6, but the setup there happens in barebox proper. For security reasons, we want to install OP-TEE as early as possible while running the prebootloader, so we replicate the setup for PBL. This has been tested with the i.MX8MM and i.MX8MN. Note that barebox itself does not yet benefit from this setup and that the barebox proper driver for CAAM is unaffected by this change. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230111075940.922817-6-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | | mtd: nand: atmel: import Linux NAND controller driverAhmad Fatoum2023-01-183-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For a few years, Linux has been using the new EBI bindings for NAND controllers on all AT91 SoCs newer than the AT91RM2000. We have so far only supported the old bindings by hacking the DT, but this doesn't suffice for the SAMA5D4. Therefore import a new state of the Linux NAND controller driver. We still keep around the old barebox driver to support the non-DT enabled AT91 platforms. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230111174023.1719129-13-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | | memory: add Atmel EBI driverAhmad Fatoum2023-01-182-0/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This driver is used to configure the EBI (external bus interface) when the device-tree is used. This bus supports NANDs, external Ethernet controller, SRAMs, ATA devices, etc. We import it from Linux in barebox in preparation for importing a newer state of the Atmel NAND controller driver. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230111174023.1719129-11-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | | Merge branch 'for-next/gpio' into HEADSascha Hauer2023-01-182-2/+46
|\ \ \ \
| * | | | gpiolib: implement gpiod_get_valueAhmad Fatoum2023-01-101-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The gpiod_ family of kernel functions always assume the logical state for values (i.e. taking active low/high into account). We already have gpio_set_value, so add gpiod_get_value for symmetry. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230109155836.2220277-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | | gpiolib: implement dev_gpiod_get_indexAhmad Fatoum2023-01-101-1/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Linux devm_gpiod_get_index is a superset of devm_gpiod_get. We already support gpiod_get to simplify kernel code porting, so reimplement it in terms of a new dev_gpiod_get_index to simplify porting kernel code using that as well. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230109155836.2220277-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | | gpiolib: use signed int for gpio in gpiod_set_valueAhmad Fatoum2023-01-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | barebox gpio identifiers are always in the range of non-negative signed integers with negative values reserved for errors. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230109155836.2220277-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | | of: gpio: include <of.h> in <of_gpio.h>Ahmad Fatoum2023-01-101-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This header can't be used without types and functions declared in of.h, so include that first. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230109155836.2220277-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | | | Merge branch 'for-next/kernelcode-helpers' into HEADSascha Hauer2023-01-177-2/+213
|\ \ \ \ \
| * | | | | barebox-wrapper: define MODULE_DEVICE_TABLEAhmad Fatoum2023-01-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We may elect to act on this in the future, but for now, define the macro, so it can be left in when porting kernel code. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230109151152.2052493-8-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | | | include: linux/slab.h: define krealloc/kstrdupAhmad Fatoum2023-01-101-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We already have a number of stubs for other kmalloc* functions, so add these two as well. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230109151152.2052493-7-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | | | of: provide of_node_get and of_node_put stubsAhmad Fatoum2023-01-101-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While removal of of_node_get and of_node_put can simplify ported kernel code, on the other hand, they can be more of a hassle with future syncs of the driver. Just provide stubs for them, so they can be left in. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230109151152.2052493-6-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | | | clk: add prepare/unprepare helpersAhmad Fatoum2023-01-101-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | barebox doesn't use interrupts, so it need not differentiate between a possibly sleeping prepare/unprepare and an atomic enable/disable. Provide a wrapper that just expands to the already existing functions to simplify porting of Linux kernel drivers. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230109151152.2052493-5-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | | | include: sync io-64-nonatomic-*.h headers with LinuxAhmad Fatoum2023-01-102-0/+180
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Linux headers additionally define readq/writeq_relaxed, io(read|write)64(be|le|), which may come in handy when porting code. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230109151152.2052493-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>