summaryrefslogtreecommitdiffstats
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* sandbox: retire CONFIG_LINUX symbol in favor of CONFIG_SANDBOXAhmad Fatoum2020-11-271-2/+2
| | | | | | | | | | | | | 5211e428cbab ("image: Convert the IH_... values to enums") removed the IH_ARCH_LINUX enumeration value leading to breakage of sandbox configurations that enable bootm. Instead of reinstating IH_ARCH_LINUX, just use IH_ARCH_SANDBOX and remove mention of CONFIG_LINUX altogether, it's always true anyway when CONFIG_SANDBOX is true. Fixes: 5211e428cbab ("image: Convert the IH_... values to enums") Cc: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/mtd-nand'Sascha Hauer2020-11-1010-816/+2632
|\
| * nand command: Print OOB informationSascha Hauer2020-11-101-0/+2
| | | | | | | | | | | | | | | | NAND mtd devices carry information how the OOB area is used. So far there is no way to visualize it, so print it along with other NAND informations. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: nand: Update to Linux-5.9Sascha Hauer2020-11-109-766/+2592
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This updates the barebox NAND layer and parts of the mtd layer to Linux-5.9. This patch is huge, but the barebox NAND layer is so far away from the Linux NAND layer that a step by step update would have taken ages. Unlike Linux barebox has functions to mark a block as good. This feature has been preserved. Also barebox used to make NAND write support optional, this feature is lost during the update for the sake of better compatibility to the Linux NAND layer. This patch has been tested: - GPMI aka nand_mxs on i.MX6 - nand_imx on i.MX25 - nand_omap_gpmc on AM335x - atmel_nand on Atmel sama5d3 - nand_denali on SoCFPGA Currently untested: - nand_orion - nand_mrvl_nfc - nand_s3c24xx The nand_denali driver is tested with the update of that driver to Linux-5.9 following in the next patch. I could only test the drivers with the NAND chips found on my boards, so there's still enough room for regressions, especially given that the NAND drivers themselves are mostly not updated. With the NAND layer being up-to-date with Linux it should hopefully be easy to update drivers to their Linux counterpart as well if necessary. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: Add ecc_step_sizeSascha Hauer2020-11-091-0/+3
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: nand: move function hooks to struct nand_legacySascha Hauer2020-11-091-43/+53
| | | | | | | | | | | | | | Linux had moved the traditional nand function hooks to an extra struct nand_legacy. Do the same in barebox for compatibility. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * lib: Add match_string()Sascha Hauer2020-11-091-0/+2
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: rename master to parentSascha Hauer2020-11-091-1/+7
| | | | | | | | | | | | | | In Linux mtd->parent is what in barebox is mtd->master. Rename this to get closer to the Linux mtd layer. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: rename class_dev to devSascha Hauer2020-11-091-1/+1
| | | | | | | | | | | | | | | | The mtds own device is named 'dev' in the Kernel whereas it's named 'class_dev' in barebox. Rename it to 'dev' for better compatilibility to the Kernel. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: Use classdev->parentSascha Hauer2020-11-091-1/+0
| | | | | | | | | | | | | | | | | | | | Instead of mtd->parent we can use mtd->classdev.parent which points to the same device. With this we can remove the 'parent' member of struct mtd_info. This member exists in the Linux kernel as well, but is of type struct mtd_info, so this is done as preparation to re-add mtd->parent with the same type as in Linux. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: Add underscore prefix to mtd hooksSascha Hauer2020-11-061-23/+23
| | | | | | | | | | | | | | In the Kernel the mtd function hooks begin with an underscore. Do the same in barebox to be better comparable to the Kernel. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: nand: Pass struct nand_chip aroundSascha Hauer2020-11-063-58/+59
| | | | | | | | | | | | | | | | | | Traditionally Linux passed a struct mtd_info * around as context between the different functions. This has been changed to a struct nand_chip *. Do the same for barebox as well as another step towards updating the NAND layer to current Linux. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: nand: drop unused errstat hookSascha Hauer2020-11-061-5/+0
| | | | | | | | | | | | chip->errstat is never set by any driver, so remove it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: nand: drop unused erase_cmd hookSascha Hauer2020-11-061-3/+0
| | | | | | | | | | | | chip->erase_cmd is never used, so remove this hook. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: Drop asynchronous erase supportSascha Hauer2020-11-061-25/+0
| | | | | | | | | | | | | | asynchronous erase support is unused and also dropped from the Kernel, so remove it from barebox. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2020-11-101-0/+54
|\ \
| * | ARM: mmu64: allow to disable null pointer trap on zero pageMichael Tretter2020-10-221-0/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Barebox uses the zero page to trap NULL pointer dereferences. However, if the SDRAM starts at address 0x0, this makes the first page of the SDRAM inaccessible and makes it impossible to load images to offset 0x0 in the SDRAM. Trapping NULL pointer dereferences on such systems is still desirable. Therefore, add a function to disable the traps if accessing the zero page is necessary and to re-enable the traps after the access is done. The zero_page_memcpy function simplifies copying to the SDRAM, because this is the most common required functionality, but memtest also accesses the zero page and does not use memcpy. Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/imx'Sascha Hauer2020-11-101-0/+11
|\ \ \
| * | | ddr: imx8m: add workaround for DDRPHY rank to rank issueLucas Stach2020-11-091-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a port of upstream U-Boot commit b335966958a9. Sadly there is no more information to be found about the issue. The currently available errata documents don't mention this issue at all and the U-Boot commit doesn't tell much either, however this commit has been pointed out by NXP engineers as a solution to reports of board instabilities. | drivers: ddr: imx Workaround for i.MX8M DDRPHY rank to rank issue | | Add logic to automatically update umctl2's setting based | on phy training CDD value for rank to rank space issue | | Acked-by: Ye Li <ye.li@nxp.com> | Signed-off-by: Oliver Chen <Oliver.Chen@nxp.com> | Signed-off-by: Jacky Bai <ping.bai@nxp.com> | Signed-off-by: Peng Fan <peng.fan@nxp.com> Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Tested-by: Sascha Hauer <s.hauer@pengutronix.de> (on i.MX8MP) Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | ddr: imx8m: clean up entry pointsLucas Stach2020-11-091-0/+7
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | The DDRC address in the memory map and the TF-A parameter store address is the same for all i.MX8M* SoCs. The only difference (for now) is in the power up sequence. Add a enum for the DDRC type, so we can take different code paths in imx8m_ddr_init() depending on the SoC. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/imd-checksum'Sascha Hauer2020-11-101-6/+6
|\ \ \ | |/ / |/| |
| * | bootstrap_read_disk(): optionally inform the caller of the buffer sizeUlrich Ölmann2020-06-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | The size of the buffer allocated in the function is needed if it shall be inspected more closely later. Therefore optionally return it via a new pointer argument. Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
| * | bootstrap_read_devfs(): optionally inform the caller of the buffer sizeUlrich Ölmann2020-06-221-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | The size of the buffer allocated in the function is needed if it shall be inspected more closely later. Therefore optionally return it via a new pointer argument. Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
* | | Merge branch 'for-next/sandbox' into masterSascha Hauer2020-10-141-0/+43
|\ \ \
| * | | of: implement of_property_read_u64_arrayAhmad Fatoum2020-10-131-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For reading reg with #address-cells and #size-cells of 2, an of_property_read_u64_array can be quite convenient. Add one. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | of: Add common device tree register functionSascha Hauer2020-10-121-0/+2
| | |/ | |/| | | | | | | | | | | | | | | | | | | The different architectures duplicate some code around unflattening and registering the device tree. Add common functions to reduce this duplication. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/reboot-mode' into masterSascha Hauer2020-10-142-0/+40
|\ \ \
| * \ \ Merge branch 'for-next/magicvar-unique-id' into for-next/reboot-modeSascha Hauer2020-10-071-6/+4
| |\ \ \
| * | | | power: reset: reboot-mode: support multi-word magicAhmad Fatoum2020-09-291-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The upstream binding and driver implementation only supports reboot modes of 32-bit length. This is insufficient for cases where multiple registers need to be written for the reboot mode to become active. The i.MX6 is an example for this, the BootROM expects a second 32-bit register to indicate whether the reboot mode in the first is valid. In preparation for adding support for this to the syscon-reboot-mode driver. Migrate the reboot-mode core to support this. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | | power: reset: reboot-mode: fix up node into boot device treeAhmad Fatoum2020-09-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of relying that the kernel and barebox device trees are in sync, just enforce it by having barebox fix up the device tree node it probed into the kernel device tree. We usually want that, but some reboot mode drivers might want to inhibit the fixup, e.g. because they implement a non-upstream binding or because they communicate with the BootROM, while the kernel shouldn't. For those the fixup is made optional via a struct reboot_mode_driver::no_fixup member. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | | drivers: add reboot-mode infrastructureAhmad Fatoum2020-09-292-0/+38
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reboot modes provide a well-defined way to exchange information between different stage of the boot process. When configured, users can type `reboot bootloader` in the OS and barebox can read it out a device parameter. Likewise barebox can write a reboot mode for the BootROM to evaluate and then reset to fall into a serial recovery mode for example. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | | Merge branch 'for-next/percent_pe' into masterSascha Hauer2020-10-141-5/+0
|\ \ \ \
| * | | | vsprintf: retire strerrorp in favor of %peAhmad Fatoum2020-09-291-5/+0
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | strerrorp() is only used along with printf. We now have a format specifier for printing error pointers directly, so use that and remove strerrorp. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | | Merge branch 'for-next/misc' into masterSascha Hauer2020-10-146-3/+9
|\ \ \ \
| * | | | of: implement of_property_write_strings for multiple stringsAhmad Fatoum2020-10-022-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current way to set a property with multiple values (e.g. compatible strings) is to have char properties[] = "st,stm32mp157c-dk2\0st,stm32mp157"; of_set_property(np, "compatible", properties, sizeof(properties), 1); Add a new helper to make this easier at the cost of one runtime reallocation: of_property_write_strings(np, "compatible, "st,stm32mp157c-dk2", "st,stm32mp157", NULL); Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | | include: string: migrate barebox function from <linux/string.h>Ahmad Fatoum2020-10-022-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | <linux/string.h> was imported from Linux. In order to keep changes to a minimum, add prototypes for new barebox functions to <string.h> instead. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | | include: asm-generic: bitio.h don't include <asm-generic/io.h> directlyAhmad Fatoum2020-10-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | <asm-generic/io.h> is not meant for direct inclusion. It provides defaults for each arch's <asm/io.h> to fall back to. Use <asm/io.h> instead. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | | include: regulator.h: forward declare struct device_dAhmad Fatoum2020-09-291-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We so far depended on include order for struct device_d to be declared before <regulator.h> inclusion. Fix this. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | | aiodev: Name channels with device instance nameTrent Piepho2020-09-291-1/+2
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When dynamically assigning device names, an aiodev's name will be "aiodev" and an index, not part of the name string itself, will be allocated dynamically. These are combined to register a device with a name like "aiodev0" or "aiodev1". The shell environment variables use the device name, so one might use "${aiodev0.in_value0_mV}" and "${aiodev1.in_value0_mV}". However, the channel names that are used with aiochannel_get_by_name() just use the aiodev's name and channel name. So channel 0 of the 1st aiodev would be "aiodev.in_value0_mV" and the 2nd aiodev would use the same name. Change the channel naming to use the device instance name, e.g. "aiodev0", rather than the aiodev's base name. This makes the names used aiochannel_get_by_name() match the environment variable names and also avoids duplicate names with more than one dynamically allocated aiodev. Rename aiochannel_get_by_name() to aiochannel_by_name() so that any out of tree boards that use it will fail to compile, since they now need to pass in a different name. Signed-off-by: Trent Piepho <trent.piepho@synapse.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | | Merge branch 'for-next/magicvar-unique-id' into masterSascha Hauer2020-10-141-6/+4
|\ \ \ \ | | |/ / | |/| |
| * | | magicvar: retire BAREBOX_MAGICVAR_NAMEDSascha Hauer2020-10-021-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | BAREBOX_MAGICVAR_NAMED is no longer used, drop it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | magicvar: Use __UNIQUE_ID to generate nameSascha Hauer2020-10-021-5/+7
| |/ / | | | | | | | | | | | | | | | | | | | | | BAREBOX_MAGICVAR_NAME only exists to generate a unique identifier. We can generate that using __UNIQUE_ID. With this we can convert users from BAREBOX_MAGICVAR_NAME to the simpler BAREBOX_MAGICVAR macro. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/driver-macro' into masterSascha Hauer2020-10-142-0/+26
|\ \ \
| * | | net: phy: Add and use driver register macroSascha Hauer2020-10-011-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add driver registration macros for phy drivers similar to the existing platform device macros. This also changes the initcall level from fs_initcall to device_initcall for the phy drivers. It is not clear why the phy driver have been at fs_initcall in the first place, changing it shouldn't be a problem. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | treewide: Use driver macroSascha Hauer2020-09-291-0/+6
| |/ / | | | | | | | | | | | | | | | | | | We have several macros for a oneline driver registration. Add some missing and use them consistently where possible througout the tree. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/dev-drvdata' into masterSascha Hauer2020-10-141-0/+18
|\ \ \
| * | | driver: introduce less error-prone dev_get_drvdata alternativeAhmad Fatoum2020-10-091-0/+18
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We use dev_get_drvdata to get the driver match data associated with a device. This has two shortcomings: - Linux has dev_get_drvdata too, which returns a private pointer for driver specific info to associate with a device. We use dev->priv (or more often container_of) for that in barebox instead - It nearly always involves a cast to a double pointer, which is error-prone as size and alignment match need to be ensured on the programmer's part and can easily be gotten wrong: enum dev_type type; dev_get_drvdata(dev, (const void **)&type); // UB! Add a new function that instead of using a double pointer argument, returns the pointer directly: - For normal pointer driver data, no cast is necessary - For integer driver data casted to a pointer for storage, the cast is still necessary, but it's only a single pointer this way Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/deep-probe-prepare' into masterSascha Hauer2020-10-141-0/+2
|\ \ \
| * | | regulator: add device reference to regulator_devMarco Felsch2020-09-291-0/+2
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | It is useful to know the physical device a regulator_dev belongs to. This is at least needed for the new deep-probe mechanism. It is also useful for a few regulator drivers to drop their own device_d reference. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | imd: add buildsystem version to metadataSteffen Trumtrar2020-09-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | To have information about the exact state of a barebox binary from userspace, add the buildsystem version to the IMD. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>