Re: [U-Boot] [PATCH] ARM: socfpga: Convert to DM serial
On 30.07.2018 16:04, Marek Vasut wrote: On 07/30/2018 04:03 PM, Simon Goldschmidt wrote: On 12.05.2018 22:28, Marek Vasut wrote: Pull the serial port configuration from DT and use DM serial instead of having the serial configuration in two places, DT and board config. Signed-off-by: Marek Vasut Cc: Chin Liang See Cc: Dinh Nguyen --- arch/arm/Kconfig | 3 +++ arch/arm/dts/socfpga.dtsi | 2 ++ arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts | 1 + include/configs/socfpga_common.h | 8 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 532aa41a87..2012ac6410 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -737,6 +737,7 @@ config ARCH_SOCFPGA select ARCH_MISC_INIT select CPU_V7A select DM + select DM_SERIAL select ENABLE_ARM_SOC_BOOT0_HOOK select OF_CONTROL select SPL_LIBCOMMON_SUPPORT @@ -746,11 +747,13 @@ config ARCH_SOCFPGA select SPL_NAND_SUPPORT if SPL_NAND_DENALI select SPL_OF_CONTROL select SPL_SERIAL_SUPPORT + select SPL_DM_SERIAL select SPL_SPI_FLASH_SUPPORT if SPL_SPI_SUPPORT select SPL_SPI_SUPPORT if DM_SPI select SPL_WATCHDOG_SUPPORT select SUPPORT_SPL select SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE + select SYS_NS16550 select SYS_THUMB_BUILD imply CMD_MTDPARTS imply CRC32_VERIFY diff --git a/arch/arm/dts/socfpga.dtsi b/arch/arm/dts/socfpga.dtsi index e64127fcb2..314449478d 100644 --- a/arch/arm/dts/socfpga.dtsi +++ b/arch/arm/dts/socfpga.dtsi @@ -737,6 +737,7 @@ reg-shift = <2>; reg-io-width = <4>; clocks = <&l4_sp_clk>; + clock-frequency = <1>; }; uart1: serial1@ffc03000 { @@ -746,6 +747,7 @@ reg-shift = <2>; reg-io-width = <4>; clocks = <&l4_sp_clk>; + clock-frequency = <1>; }; rst: rstmgr@ffd05000 { diff --git a/arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts b/arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts index b573d0e658..06b61cb0af 100644 --- a/arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts +++ b/arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts @@ -24,6 +24,7 @@ }; &uart1 { + clock-frequency = <5000>; u-boot,dm-pre-reloc; status = "okay"; }; diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h index 54b9edc97c..a60da85499 100644 --- a/include/configs/socfpga_common.h +++ b/include/configs/socfpga_common.h @@ -173,14 +173,6 @@ unsigned int cm_get_qspi_controller_clk_hz(void); * Serial Driver */ #define CONFIG_SYS_NS16550_SERIAL -#define CONFIG_SYS_NS16550_REG_SIZE -4 -#if defined(CONFIG_TARGET_SOCFPGA_GEN5) -#define CONFIG_SYS_NS16550_COM1 SOCFPGA_UART0_ADDRESS -#define CONFIG_SYS_NS16550_CLK 1 -#elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10) -#define CONFIG_SYS_NS16550_COM1 SOCFPGA_UART1_ADDRESS -#define CONFIG_SYS_NS16550_CLK 5000 -#endif /* * USB Unfortunately I saw this just now, but it seems this breaks GEN5 SPL? At least git-bisect told me that 73172753f4f3351ed1c9d2f6586fc599ce4e728c is the first bad commit. I tested socfpga_socrates_defconfig on my socrates board. Any idea what's wrong there? Nope, this should work fine. Can you investigate ? Ok, so after adding "u-boot,dm-pre-reloc" to uart0 in socfpga_cyclone5_socrates.dts, U-Boot works (combined with an old SPL). SPL still does not work. Any idea? How does SPL get the uart? Thanks for any pointers. Simon ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] ARM: socfpga: Convert to DM serial
On 08/01/2018 09:29 AM, Goldschmidt Simon wrote: > > On 30.07.2018 16:04, Marek Vasut wrote: >> On 07/30/2018 04:03 PM, Simon Goldschmidt wrote: >>> >>> On 12.05.2018 22:28, Marek Vasut wrote: Pull the serial port configuration from DT and use DM serial instead of having the serial configuration in two places, DT and board config. Signed-off-by: Marek Vasut Cc: Chin Liang See Cc: Dinh Nguyen --- arch/arm/Kconfig | 3 +++ arch/arm/dts/socfpga.dtsi | 2 ++ arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts | 1 + include/configs/socfpga_common.h | 8 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 532aa41a87..2012ac6410 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -737,6 +737,7 @@ config ARCH_SOCFPGA select ARCH_MISC_INIT select CPU_V7A select DM + select DM_SERIAL select ENABLE_ARM_SOC_BOOT0_HOOK select OF_CONTROL select SPL_LIBCOMMON_SUPPORT @@ -746,11 +747,13 @@ config ARCH_SOCFPGA select SPL_NAND_SUPPORT if SPL_NAND_DENALI select SPL_OF_CONTROL select SPL_SERIAL_SUPPORT + select SPL_DM_SERIAL select SPL_SPI_FLASH_SUPPORT if SPL_SPI_SUPPORT select SPL_SPI_SUPPORT if DM_SPI select SPL_WATCHDOG_SUPPORT select SUPPORT_SPL select SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE + select SYS_NS16550 select SYS_THUMB_BUILD imply CMD_MTDPARTS imply CRC32_VERIFY diff --git a/arch/arm/dts/socfpga.dtsi b/arch/arm/dts/socfpga.dtsi index e64127fcb2..314449478d 100644 --- a/arch/arm/dts/socfpga.dtsi +++ b/arch/arm/dts/socfpga.dtsi @@ -737,6 +737,7 @@ reg-shift = <2>; reg-io-width = <4>; clocks = <&l4_sp_clk>; + clock-frequency = <1>; }; uart1: serial1@ffc03000 { @@ -746,6 +747,7 @@ reg-shift = <2>; reg-io-width = <4>; clocks = <&l4_sp_clk>; + clock-frequency = <1>; }; rst: rstmgr@ffd05000 { diff --git a/arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts b/arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts index b573d0e658..06b61cb0af 100644 --- a/arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts +++ b/arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts @@ -24,6 +24,7 @@ }; &uart1 { + clock-frequency = <5000>; u-boot,dm-pre-reloc; status = "okay"; }; diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h index 54b9edc97c..a60da85499 100644 --- a/include/configs/socfpga_common.h +++ b/include/configs/socfpga_common.h @@ -173,14 +173,6 @@ unsigned int cm_get_qspi_controller_clk_hz(void); * Serial Driver */ #define CONFIG_SYS_NS16550_SERIAL -#define CONFIG_SYS_NS16550_REG_SIZE -4 -#if defined(CONFIG_TARGET_SOCFPGA_GEN5) -#define CONFIG_SYS_NS16550_COM1 SOCFPGA_UART0_ADDRESS -#define CONFIG_SYS_NS16550_CLK 1 -#elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10) -#define CONFIG_SYS_NS16550_COM1 SOCFPGA_UART1_ADDRESS -#define CONFIG_SYS_NS16550_CLK 5000 -#endif /* * USB >>> Unfortunately I saw this just now, but it seems this breaks GEN5 SPL? At >>> least git-bisect told me that 73172753f4f3351ed1c9d2f6586fc599ce4e728c >>> is the first bad commit. >>> >>> I tested socfpga_socrates_defconfig on my socrates board. >>> >>> Any idea what's wrong there? >> Nope, this should work fine. Can you investigate ? > > Ok, so after adding "u-boot,dm-pre-reloc" to uart0 in > socfpga_cyclone5_socrates.dts, U-Boot works (combined with an old SPL). Good! > SPL still does not work. Any idea? How does SPL get the uart? > > Thanks for any pointers. Dig around the NS16550 driver . -- Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v6 8/8] armv8: ls1046a: setup SEC ICIDs and fix up device tree
Hi Horia, > -Original Message- > From: Horia Geanta > > On 7/31/2018 5:53 PM, laurentiu.tu...@nxp.com wrote: > > From: Laurentiu Tudor > > > > Add support for SEC ICID configuration and apply it for ls1046a. > > Also add code to make the necessary device tree fixups. > > > > Signed-off-by: Laurentiu Tudor > Reviewed-by: Horia Geantă Thanks! > [snip] > > +#define SET_SEC_RTIC_ICID_ENTRY(rtic_num, streamid) \ > > + SET_ICID_ENTRY(NULL, streamid, (((streamid) << 16) | (streamid)), \ > > + offsetof(ccsr_sec_t, rticliodnr[rtic_num].ls) + \ > > + CONFIG_SYS_FSL_SEC_ADDR, 0) > > + > RTIC nodes have a binding doc in Linux kernel: > Documentation/devicetree/bindings/crypto/fsl-sec4.txt > > Thus, in theory, "fsl,sec-v4.0-rtic-memory" could be used instead of NULL for > the compat string. > PPC code in arch/powerpc/include/asm/fsl_liodn.h does this. I also noticed that. However I've decided to go with NULL instead of specifying the compat string because currently we don't have the RTIC nodes in the device trees. --- Best Regards, Laurentiu ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v6 8/8] armv8: ls1046a: setup SEC ICIDs and fix up device tree
Hi Bharat, > -Original Message- > From: Bharat Bhushan > > > > On 7/31/2018 5:53 PM, laurentiu.tu...@nxp.com wrote: > > > From: Laurentiu Tudor > > > > > > Add support for SEC ICID configuration and apply it for ls1046a. > > > Also add code to make the necessary device tree fixups. > > > > > > Signed-off-by: Laurentiu Tudor > > Reviewed-by: Horia Geantă > > Reviewed-by: Bharat Bhushan Thanks for the reviews! --- Best Regards, Laurentiu ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v1 9/9] ARM: Odroid XU3: Modify Odroid XU3 config to boot by default from SD card
On Tue, 31 Jul 2018 23:40:10 +0530 Anand Moon wrote: > Hi Lukasz, > > On 27 July 2018 at 15:26, Lukasz Majewski wrote: > > On Fri, 27 Jul 2018 14:42:32 +0530 > > Anand Moon wrote: > > > >> Hi Lukasz, > >> > >> On 27 July 2018 at 13:54, Lukasz Majewski wrote: > >> > On Fri, 27 Jul 2018 08:34:15 +0530 > >> > Anand Moon wrote: > >> > > >> >> Hi Lukasz, > >> >> > >> >> On 26 July 2018 at 21:23, Lukasz Majewski > >> >> wrote: > >> >> > Hi Anand, > >> >> > > >> >> >> Hi Lukasz, > >> >> >> > >> >> >> On 26 July 2018 at 03:55, Lukasz Majewski > >> >> >> wrote: > >> >> >> > This commit allows by default booting Odroid XU3 from the > >> >> >> > SD card (when e.g. eMMC module is not present). > >> >> >> > > >> >> >> > Signed-off-by: Lukasz Majewski > >> >> >> > > >> >> >> > --- > >> >> >> > > >> >> >> > include/configs/odroid_xu3.h | 7 +-- > >> >> >> > 1 file changed, 5 insertions(+), 2 deletions(-) > >> >> >> > > >> >> >> > diff --git a/include/configs/odroid_xu3.h > >> >> >> > b/include/configs/odroid_xu3.h index > >> >> >> > f495f6219ba9..818a06515cb2 100644 --- > >> >> >> > a/include/configs/odroid_xu3.h +++ > >> >> >> > b/include/configs/odroid_xu3.h @@ -94,6 +94,9 @@ > >> >> >> > #undef CONFIG_SYS_BOARD > >> >> >> > #define CONFIG_SYS_BOARD "odroid" > >> >> >> > > >> >> >> > +#undef CONFIG_SYS_MMC_ENV_DEV > >> >> >> > +#define CONFIG_SYS_MMC_ENV_DEV 2 > >> >> >> > + > >> >> >> > /* Define new extra env settings, including DFU settings > >> >> >> > */ #undef CONFIG_EXTRA_ENV_SETTINGS > >> >> >> > #define CONFIG_EXTRA_ENV_SETTINGS \ > >> >> >> > @@ -105,8 +108,8 @@ > >> >> >> > "console=" CONFIG_DEFAULT_CONSOLE "\0"\ > >> >> >> > "fdtfile=exynos5422-odroidxu3.dtb\0" \ > >> >> >> > "boardname=odroidxu3\0" \ > >> >> >> > - "mmcbootdev=0\0" \ > >> >> >> > - "mmcrootdev=0\0" \ > >> >> >> > + "mmcbootdev=2\0" \ > >> >> >> > + "mmcrootdev=1\0" \ > >> >> >> > "mmcbootpart=1\0" \ > >> >> >> > "mmcrootpart=2\0" \ > >> >> >> > "dfu_alt_system="CONFIG_DFU_ALT_SYSTEM \ > >> >> >> > -- > >> >> >> > 2.11.0 > >> >> >> > > >> >> >> > >> >> >> This changes probably breaks the booting from eMMC on > >> >> >> Odroid-XU4 > >> >> > > >> >> > I suppose, that XU4 is also equipped with SD card slot as XU3. > >> >> > > >> >> > Nonetheless, as I don't have eMMC card for mine XU3, the only > >> >> > way to boot my device is SD card. > >> >> > > >> >> > If you believe that this may be a problem, then I can drop > >> >> > this patch. > >> >> > > >> >> > Have you checked patches from 1-8? > >> >> > Does it work for you? If yes, please send tested-by tag. > >> >> > > >> >> > >> >> Yes you probably need to drop this patch, > >> >> I had some tough time recovering my eMMC back to flash new > >> >> u-boot. > >> >> > >> >> I have tested my eMMC with default boot.scr its boot good. > >> >> Need to modify the boot.scr to boot into SD card. > >> > > >> > SD card has different layout than eMMC. > >> > > >> > Despite above - you just shall need to apply patch 9/9 to get the > >> > board running from SD card. > >> > > >> > >> Actually SD card are easy to modify and tune with just adding > >> setenv mmcrootdev "1" to autoboot.cmd from sdcard. > >> > >> but with eMMC module it's bit difficult to make this work, > > > > Ach Ok, I see > > > > The problem is when you have both attached - the eMMC and SD card. > > > > In that case I always thought that one shall boot from eMMC and the > > SD card shall be used as an extra storage space. > > > > Also, please keep in mind that IIRC the ROM first tries to boot from > > eMMC, so you need BL1, u-boot placed there if it is present. > > > > Can we create a different board initialization file to fine tune the > odroid xu3 platform. > for example Odroid U3 has # board/samsung/odroid/odroid.c > The idea was to use common board file (./board/samsung/common/board.c) for all Exynos5 based boards. The potential differences were supposed to be added via device tree. > where we can initialize for Odroid XU3 platform boards with following > features. board_clock_init > board_gpio_init > exynos_power_init > board_usb_init Above two can be achieved with driver model. Providing such functions would be a step back from full XU3/XU4 conversion to DM. > board_leds > > Best Regards > -Anand Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de pgpynUTPQa9J8.pgp Description: OpenPGP digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v5 00/27] SPI-NAND support
Hi Jagan, Jagan Teki wrote on Wed, 1 Aug 2018 11:55:19 +0530: > On Wed, Aug 1, 2018 at 12:55 AM, Boris Brezillon > wrote: > > Hi Jagan, > > > > On Tue, 31 Jul 2018 20:03:47 +0530 > > Jagan Teki wrote: > > > >> > Applied to u-boot-spi/master > >> > >> Look like we have some build issues [1]? > > > > Yep, I reproduced the issue. Looks like u-boot Makefile hierarchy is a > > bit different from Linux one, and patch is breaking raw/parallel NAND > > build. I fixed it up (see below diff). This diff should be merged in > > patch 9, and you'll have to fix a few conflicts when rebasing. Here is > > a branch [1] containing this fixup commit (placed just after the > > offending one) in case you want to check the end result. > > Thanks, better send a patch v5.1 and point me where we need to apply > with in the series so-that it can't break individual commits. Thanks Boris for fixing the build, while I actually forgot some changes in MAINTAINERS, doc, README... The current way of compiling the NAND subsystem from the root Makefile is clearly something to fix. I'll send a v6 with Boris fixup included, you'll just have to apply. Thanks, Miquèl ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v6 02/27] mtd: Uninline mtd_write_oob and move it to mtdcore.c
From: Ezequiel Garcia There's no reason for having mtd_write_oob inlined in mtd.h header. Move it to mtdcore.c where it belongs. Signed-off-by: Ezequiel Garcia Acked-by: Boris Brezillon Signed-off-by: Jacek Anaszewski Signed-off-by: Miquel Raynal --- drivers/mtd/mtdcore.c | 12 include/linux/mtd/mtd.h | 12 +--- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index 60ad28efd4..ad61406dac 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -1031,6 +1031,18 @@ int mtd_read_oob(struct mtd_info *mtd, loff_t from, struct mtd_oob_ops *ops) } EXPORT_SYMBOL_GPL(mtd_read_oob); +int mtd_write_oob(struct mtd_info *mtd, loff_t to, + struct mtd_oob_ops *ops) +{ + ops->retlen = ops->oobretlen = 0; + if (!mtd->_write_oob) + return -EOPNOTSUPP; + if (!(mtd->flags & MTD_WRITEABLE)) + return -EROFS; + return mtd->_write_oob(mtd, to, ops); +} +EXPORT_SYMBOL_GPL(mtd_write_oob); + /** * mtd_ooblayout_ecc - Get the OOB region definition of a specific ECC section * @mtd: MTD device structure diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 823e535b82..eb39f38887 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -351,17 +351,7 @@ int mtd_panic_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf); int mtd_read_oob(struct mtd_info *mtd, loff_t from, struct mtd_oob_ops *ops); - -static inline int mtd_write_oob(struct mtd_info *mtd, loff_t to, - struct mtd_oob_ops *ops) -{ - ops->retlen = ops->oobretlen = 0; - if (!mtd->_write_oob) - return -EOPNOTSUPP; - if (!(mtd->flags & MTD_WRITEABLE)) - return -EROFS; - return mtd->_write_oob(mtd, to, ops); -} +int mtd_write_oob(struct mtd_info *mtd, loff_t to, struct mtd_oob_ops *ops); int mtd_get_fact_prot_info(struct mtd_info *mtd, size_t len, size_t *retlen, struct otp_info *buf); -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v6 00/27] SPI-NAND support
During the last months, Boris Brezillon shared his work to support serial flashes within Linux. First, he delivered (and merged) a new layer called spi-mem. He also initiated in Linux MTD subsystem the move of all 'raw' NAND related code to a raw/ subdirectory, adding at the same time a NAND core that would be shared with all NAND devices. Then, he contributed a generic SPI-NAND driver, making use of this NAND core, as well as some vendor code to drive a few chips. On top of this work, I added an 'mtd' U-Boot command to handle all sort of MTD devices. This should become the default command instead of having one per flash flavor ('sf', 'nand', 'spi-nand' ?). The series has been tested on an Ocelot board PCB123 (VSC7514), featuring a Macronix SPI NAND chip. TL;DR: the series contains: - A few patches from Linux to resynchronize some areas of the MTD layer. - Various fixes and re-organization of the MTD subsystem. - The introduction of the SPI-mem interface. - The addition of the generic SPI-NAND driver (and its bindings). - Several SPI NAND chip drivers (Macronix, Micron, Winbond). - A new 'mtd' command. - Support for spi-nand devices in mtdparts. To test your SPI-NAND device with U-Boot simply follow these lines: > setenv mtdparts mtdparts=spi-nand0:1m(foo),-(bar) > setenv mtdids spi-nand0=spi-nand0 > mtdparts # show the spi-nand device partitions > ubi part bar # create a static UBI volume in the bar partition Thanks, Miquèl Changes since v5: - * Included Boris fixup about the build issues. * Added Rb/Ab tags from Jagan on patchs 20/21. Changes since v4: - * Added Jagan's Acked-by tags to every patch related to the SPI-mem/SPI-NAND addition. * Rebased on top of master. Changes since v3: - * Fixed the debug messages in spi-mem to print either Rx or Tx data. * Fixed a Kconfig error that prevented to build mtdparts with plain defconfig. * Fixed a compilation error due to the above error that prevented one file to be compiled. * Adapted the mtd command to probe MTD partitions also. * Declared mtd_probe_devices() in a header so mtdparts or UBI could use it too (to probe all devices and MTD partitions in a clean way). * As I worked on mtdparts, I found annoying and completely useless the fact that we need to prefix the environment variable with "mtdparts=". Canceled this obligation. * Added one patch to allow spi-nand devices to be recognized by mtdparts (this is purely useless but needed to be done in order to use this command). * Removed useless definitions of MTD device types in UBI code. * Wrote a generic mtdparts environment variable parser, used by the mtd command. * Used the mtd_probe_devices() function from get_mtd_info() in cmd/mtdparts.c to be sure the desired partition really does not exist (otherwise it will be probed and then found). Changes since v2: - * Rebased on u-boot master branch. * Removed extra-parenthesis in "mtd: Fallback to ->_read/write() when ->_read/write_oob() is missing" * s/fiels/files/ in "mtd: move NAND fiels into a raw/ subdirectory" * Do not describe generic SPI device properties in SPI NAND bindings. * Changes in the mtd command: * Printing more information in 'mtd list' (device type, device characteristics) * Switch to do_div() instead of '(u32)value64b % value32b' which only worked because value32b was a power of 2. * Removed erase.chip option. * By default, erase/read/write happen on the full MTD device while a dump will only work on a single page. Changes since v1: - * Fixed the nand_memorg structure of the MX35LF2GE4AB chip. * Added Reviewed-by tags from Jagan. * Backported and squashed two patches fixing things in the SPI NAND core received on the Linux ML. * Backported more changes in mtdcore.c from Linux. * Added a patch to add a fallback on mtd->_read/_write() in mtdcore.c when mtd->_read/write_oob() is not supported. * Removed the DT changes, useless as the DTs are not available in mainline yet. * Addressed Boris/Stefan comments on the 'mtd' command. * Added support for multi-pages OOB read/write. Boris Brezillon (7): mtd: Fallback to ->_read/write_oob() when ->_read/write() is missing mtd: Add sanity checks in mtd_write/read_oob() mtd: nand: Add core infrastructure to deal with NAND devices mtd: nand: Pass mode information to nand_page_io_req spi: Extend the core to ease integration of SPI memory controllers mtd: spinand: Add initial support for the MX35LF1GE4AB chip dt-bindings: Add bindings for SPI NAND devices Brian Norris (1): mtd: add get/set of_node/flash_node helpers Ezequiel Garcia (1): mtd: Uninline mtd_write_oob and move it to mtdcore.c Frieder Schrempf (1): mtd: spinand: Add initial support for Winbond W25M02GV Miquel Raynal (15): mtd: Fallback to ->_read/write() when ->_read/write_oob() is missing mtd: fix build issue with includes mtd: move definitions to enlarge
[U-Boot] [PATCH v6 01/27] mtd: Fallback to ->_read/write_oob() when ->_read/write() is missing
From: Boris Brezillon Some MTD sublayers/drivers are implementing ->_read/write_oob() and provide dummy wrappers for their ->_read/write() implementations. Let the core handle this case instead of duplicating the logic. Signed-off-by: Boris Brezillon Acked-by: Robert Jarzmik Acked-by: Brian Norris Reviewed-by: Miquel Raynal Tested-by: Ladislav Michl Signed-off-by: Miquel Raynal Reviewed-by: Jagan Teki --- drivers/mtd/mtdcore.c | 31 ++-- drivers/mtd/mtdpart.c | 6 ++-- drivers/mtd/nand/nand_base.c | 56 --- drivers/mtd/onenand/onenand_base.c | 60 -- 4 files changed, 33 insertions(+), 120 deletions(-) diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index 6217be2352..60ad28efd4 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -937,7 +937,20 @@ int mtd_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, * representing the maximum number of bitflips that were corrected on * any one ecc region (if applicable; zero otherwise). */ - ret_code = mtd->_read(mtd, from, len, retlen, buf); + if (mtd->_read) { + ret_code = mtd->_read(mtd, from, len, retlen, buf); + } else if (mtd->_read_oob) { + struct mtd_oob_ops ops = { + .len = len, + .datbuf = buf, + }; + + ret_code = mtd->_read_oob(mtd, from, &ops); + *retlen = ops.retlen; + } else { + return -ENOTSUPP; + } + if (unlikely(ret_code < 0)) return ret_code; if (mtd->ecc_strength == 0) @@ -952,10 +965,24 @@ int mtd_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, *retlen = 0; if (to < 0 || to > mtd->size || len > mtd->size - to) return -EINVAL; - if (!mtd->_write || !(mtd->flags & MTD_WRITEABLE)) + if ((!mtd->_write && !mtd->_write_oob) || + !(mtd->flags & MTD_WRITEABLE)) return -EROFS; if (!len) return 0; + + if (!mtd->_write) { + struct mtd_oob_ops ops = { + .len = len, + .datbuf = (u8 *)buf, + }; + int ret; + + ret = mtd->_write_oob(mtd, to, &ops); + *retlen = ops.retlen; + return ret; + } + return mtd->_write(mtd, to, len, retlen, buf); } EXPORT_SYMBOL_GPL(mtd_write); diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index f87c962205..ccbb1757ea 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c @@ -417,8 +417,10 @@ static struct mtd_part *allocate_partition(struct mtd_info *master, slave->mtd.dev.parent = master->dev.parent; #endif - slave->mtd._read = part_read; - slave->mtd._write = part_write; + if (master->_read) + slave->mtd._read = part_read; + if (master->_write) + slave->mtd._write = part_write; if (master->_panic_write) slave->mtd._panic_write = part_panic_write; diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 64e4621aaa..0b58e15b03 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -1863,33 +1863,6 @@ read_retry: return max_bitflips; } -/** - * nand_read - [MTD Interface] MTD compatibility function for nand_do_read_ecc - * @mtd: MTD device structure - * @from: offset to read from - * @len: number of bytes to read - * @retlen: pointer to variable to store the number of read bytes - * @buf: the databuffer to put data - * - * Get hold of the chip and call nand_do_read. - */ -static int nand_read(struct mtd_info *mtd, loff_t from, size_t len, -size_t *retlen, uint8_t *buf) -{ - struct mtd_oob_ops ops; - int ret; - - nand_get_device(mtd, FL_READING); - memset(&ops, 0, sizeof(ops)); - ops.len = len; - ops.datbuf = buf; - ops.mode = MTD_OPS_PLACE_OOB; - ret = nand_do_read_ops(mtd, from, &ops); - *retlen = ops.retlen; - nand_release_device(mtd); - return ret; -} - /** * nand_read_oob_std - [REPLACEABLE] the most common OOB data read function * @mtd: mtd info structure @@ -2674,33 +2647,6 @@ static int panic_nand_write(struct mtd_info *mtd, loff_t to, size_t len, return ret; } -/** - * nand_write - [MTD Interface] NAND write with ECC - * @mtd: MTD device structure - * @to: offset to write to - * @len: number of bytes to write - * @retlen: pointer to variable to store the number of written bytes - * @buf: the data to write - * - * NAND write with ECC. - */ -static int nand_write(struct mtd_info *mtd, loff_t to, size_t len, - size_t *retlen, const uint8_t *buf) -{ - struct mtd_oob_ops ops; - int ret; - -
[U-Boot] [PATCH v6 04/27] mtd: Fallback to ->_read/write() when ->_read/write_oob() is missing
Some MTD sublayers/drivers are implementing ->_read/write() and not ->_read/write_oob(). While for NAND devices both are usually valid, for NOR devices, using the _oob variant has no real meaning. But, as the MTD layer is supposed to hide as much as possible the flash complexity to the user, there is no reason to error out while it is just a matter of rewritting things internally. Add a fallback on mtd->_read() (resp. mtd->_write()) when the user calls mtd_read_oob() (resp. mtd_write_oob()) while mtd->_read_oob() (resp. mtd->_write_oob) is not implemented. There is already a fallback on the _oob variant if the former is used. Signed-off-by: Miquel Raynal --- drivers/mtd/mtdcore.c | 26 -- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index 9a3efe95df..fb1d68d5e2 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -1047,20 +1047,27 @@ int mtd_read_oob(struct mtd_info *mtd, loff_t from, struct mtd_oob_ops *ops) { int ret_code; ops->retlen = ops->oobretlen = 0; - if (!mtd->_read_oob) - return -EOPNOTSUPP; ret_code = mtd_check_oob_ops(mtd, from, ops); if (ret_code) return ret_code; + /* Check the validity of a potential fallback on mtd->_read */ + if (!mtd->_read_oob && (!mtd->_read || ops->oobbuf)) + return -EOPNOTSUPP; + + if (mtd->_read_oob) + ret_code = mtd->_read_oob(mtd, from, ops); + else + ret_code = mtd->_read(mtd, from, ops->len, &ops->retlen, + ops->datbuf); + /* * In cases where ops->datbuf != NULL, mtd->_read_oob() has semantics * similar to mtd->_read(), returning a non-negative integer * representing max bitflips. In other cases, mtd->_read_oob() may * return -EUCLEAN. In all cases, perform similar logic to mtd_read(). */ - ret_code = mtd->_read_oob(mtd, from, ops); if (unlikely(ret_code < 0)) return ret_code; if (mtd->ecc_strength == 0) @@ -1075,8 +1082,7 @@ int mtd_write_oob(struct mtd_info *mtd, loff_t to, int ret; ops->retlen = ops->oobretlen = 0; - if (!mtd->_write_oob) - return -EOPNOTSUPP; + if (!(mtd->flags & MTD_WRITEABLE)) return -EROFS; @@ -1084,7 +1090,15 @@ int mtd_write_oob(struct mtd_info *mtd, loff_t to, if (ret) return ret; - return mtd->_write_oob(mtd, to, ops); + /* Check the validity of a potential fallback on mtd->_write */ + if (!mtd->_write_oob && (!mtd->_write || ops->oobbuf)) + return -EOPNOTSUPP; + + if (mtd->_write_oob) + return mtd->_write_oob(mtd, to, ops); + else + return mtd->_write(mtd, to, ops->len, &ops->retlen, + ops->datbuf); } EXPORT_SYMBOL_GPL(mtd_write_oob); -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v6 06/27] mtd: fix build issue with includes
Fix build errors produced by mtd.h and dm/device.h if not included in the right order. Signed-off-by: Miquel Raynal Reviewed-by: Jagan Teki --- include/linux/mtd/mtd.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index ea659c354b..8def104627 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -21,6 +21,7 @@ #include #include #include +#include #define MAX_MTD_DEVICES 32 #endif -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v6 07/27] mtd: move definitions to enlarge their range
Some helpers might be useful in a future 'mtd' U-Boot command to parse MTD device list. Signed-off-by: Miquel Raynal --- drivers/mtd/mtdcore.h | 6 -- include/linux/mtd/mtd.h | 6 ++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/mtd/mtdcore.h b/drivers/mtd/mtdcore.h index 7b0353399a..1d181a1045 100644 --- a/drivers/mtd/mtdcore.h +++ b/drivers/mtd/mtdcore.h @@ -5,7 +5,6 @@ extern struct mutex mtd_table_mutex; -struct mtd_info *__mtd_next_device(int i); int add_mtd_device(struct mtd_info *mtd); int del_mtd_device(struct mtd_info *mtd); int add_mtd_partitions(struct mtd_info *, const struct mtd_partition *, int); @@ -16,8 +15,3 @@ int parse_mtd_partitions(struct mtd_info *master, const char * const *types, int __init init_mtdchar(void); void __exit cleanup_mtdchar(void); - -#define mtd_for_each_device(mtd) \ - for ((mtd) = __mtd_next_device(0); \ -(mtd) != NULL; \ -(mtd) = __mtd_next_device(mtd->index + 1)) diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 8def104627..6771ee2586 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -517,6 +517,12 @@ int del_mtd_device(struct mtd_info *mtd); int add_mtd_partitions(struct mtd_info *, const struct mtd_partition *, int); int del_mtd_partitions(struct mtd_info *); +struct mtd_info *__mtd_next_device(int i); +#define mtd_for_each_device(mtd) \ + for ((mtd) = __mtd_next_device(0); \ +(mtd) != NULL; \ +(mtd) = __mtd_next_device(mtd->index + 1)) + int mtd_arg_off(const char *arg, int *idx, loff_t *off, loff_t *size, loff_t *maxsize, int devtype, uint64_t chipsize); int mtd_arg_off_size(int argc, char *const argv[], int *idx, loff_t *off, -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v6 03/27] mtd: Add sanity checks in mtd_write/read_oob()
From: Boris Brezillon Unlike what's done in mtd_read/write(), there are no checks to make sure the parameters passed to mtd_read/write_oob() are consistent, which forces implementers of ->_read/write_oob() to do it, which in turn leads to code duplication and possibly errors in the logic. Do general sanity checks, like ops fields consistency and range checking. Signed-off-by: Boris Brezillon Cc: Peter Pan Signed-off-by: Richard Weinberger [Miquel: squashed the fix about the chip's size check] Signed-off-by: Miquel Raynal --- drivers/mtd/mtdcore.c | 45 + 1 file changed, 45 insertions(+) diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index ad61406dac..9a3efe95df 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -1010,12 +1010,50 @@ int mtd_panic_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, } EXPORT_SYMBOL_GPL(mtd_panic_write); +static int mtd_check_oob_ops(struct mtd_info *mtd, loff_t offs, +struct mtd_oob_ops *ops) +{ + /* +* Some users are setting ->datbuf or ->oobbuf to NULL, but are leaving +* ->len or ->ooblen uninitialized. Force ->len and ->ooblen to 0 in +* this case. +*/ + if (!ops->datbuf) + ops->len = 0; + + if (!ops->oobbuf) + ops->ooblen = 0; + + if (offs < 0 || offs + ops->len > mtd->size) + return -EINVAL; + + if (ops->ooblen) { + u64 maxooblen; + + if (ops->ooboffs >= mtd_oobavail(mtd, ops)) + return -EINVAL; + + maxooblen = ((mtd_div_by_ws(mtd->size, mtd) - + mtd_div_by_ws(offs, mtd)) * +mtd_oobavail(mtd, ops)) - ops->ooboffs; + if (ops->ooblen > maxooblen) + return -EINVAL; + } + + return 0; +} + int mtd_read_oob(struct mtd_info *mtd, loff_t from, struct mtd_oob_ops *ops) { int ret_code; ops->retlen = ops->oobretlen = 0; if (!mtd->_read_oob) return -EOPNOTSUPP; + + ret_code = mtd_check_oob_ops(mtd, from, ops); + if (ret_code) + return ret_code; + /* * In cases where ops->datbuf != NULL, mtd->_read_oob() has semantics * similar to mtd->_read(), returning a non-negative integer @@ -1034,11 +1072,18 @@ EXPORT_SYMBOL_GPL(mtd_read_oob); int mtd_write_oob(struct mtd_info *mtd, loff_t to, struct mtd_oob_ops *ops) { + int ret; + ops->retlen = ops->oobretlen = 0; if (!mtd->_write_oob) return -EOPNOTSUPP; if (!(mtd->flags & MTD_WRITEABLE)) return -EROFS; + + ret = mtd_check_oob_ops(mtd, to, ops); + if (ret) + return ret; + return mtd->_write_oob(mtd, to, ops); } EXPORT_SYMBOL_GPL(mtd_write_oob); -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v6 12/27] mtd: nand: Pass mode information to nand_page_io_req
From: Boris Brezillon The NAND sub-layers are likely to need the MTD_OPS_XXX mode information in order to decide if they should enable/disable ECC or how they should place the OOB bytes in the provided OOB buffer. Add a field to nand_page_io_req to pass this information. Signed-off-by: Boris Brezillon Signed-off-by: Miquel Raynal --- include/linux/mtd/nand.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index ada7af4a41..13e8dd1103 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h @@ -86,6 +86,7 @@ struct nand_pos { * @ooboffs: the OOB offset within the page * @ooblen: the number of OOB bytes to read from/write to this page * @oobbuf: buffer to store OOB data in or get OOB data from + * @mode: one of the %MTD_OPS_XXX mode * * This object is used to pass per-page I/O requests to NAND sub-layers. This * way all useful information are already formatted in a useful way and @@ -106,6 +107,7 @@ struct nand_page_io_req { const void *out; void *in; } oobbuf; + int mode; }; /** @@ -599,6 +601,7 @@ static inline void nanddev_io_iter_init(struct nand_device *nand, { struct mtd_info *mtd = nanddev_to_mtd(nand); + iter->req.mode = req->mode; iter->req.dataoffs = nanddev_offs_to_pos(nand, offs, &iter->req.pos); iter->req.ooboffs = req->ooboffs; iter->oobbytes_per_page = mtd_oobavail(mtd, req); -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v6 05/27] mtd: add get/set of_node/flash_node helpers
From: Brian Norris We are going to begin using the mtd->dev.of_node field for MTD device nodes, so let's add helpers for it. Also, we'll be making some conversions on spi_nor (and nand_chip eventually) too, so get that ready with their own helpers. Signed-off-by: Brian Norris Reviewed-by: Boris Brezillon Signed-off-by: Miquel Raynal Reviewed-by: Jagan Teki --- include/linux/mtd/mtd.h | 11 +++ 1 file changed, 11 insertions(+) diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index eb39f38887..ea659c354b 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -306,6 +306,17 @@ struct mtd_info { int usecount; }; +static inline void mtd_set_of_node(struct mtd_info *mtd, + const struct device_node *np) +{ + mtd->dev->node.np = np; +} + +static inline const struct device_node *mtd_get_of_node(struct mtd_info *mtd) +{ + return mtd->dev->node.np; +} + int mtd_ooblayout_ecc(struct mtd_info *mtd, int section, struct mtd_oob_region *oobecc); int mtd_ooblayout_find_eccregion(struct mtd_info *mtd, int eccbyte, -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v6 10/27] mtd: rename nand into rawnand in Kconfig prompt
Sync the Kconfig raw NAND entry title with the code architecture. Signed-off-by: Miquel Raynal --- drivers/mtd/nand/raw/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig index 1e4ea7bdd4..008f7b4b4b 100644 --- a/drivers/mtd/nand/raw/Kconfig +++ b/drivers/mtd/nand/raw/Kconfig @@ -1,6 +1,6 @@ menuconfig NAND - bool "NAND Device Support" + bool "Raw NAND Device Support" if NAND config SYS_NAND_SELF_INIT -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v6 08/27] mtd: move all flash categories inside MTD submenu
There is no reason to have NAND, SPI flashes and UBI sections outside of the MTD submenu in Kconfig. Signed-off-by: Miquel Raynal Reviewed-by: Jagan Teki --- drivers/mtd/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig index 41f8883ec2..9341d518f3 100644 --- a/drivers/mtd/Kconfig +++ b/drivers/mtd/Kconfig @@ -59,10 +59,10 @@ config RENESAS_RPC_HF This enables access to Hyperflash memory through the Renesas RCar Gen3 RPC controller. -endmenu - source "drivers/mtd/nand/Kconfig" source "drivers/mtd/spi/Kconfig" source "drivers/mtd/ubi/Kconfig" + +endmenu -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v6 16/27] mtd: spinand: Add initial support for Winbond W25M02GV
From: Frieder Schrempf Add support for the W25M02GV chip. Signed-off-by: Frieder Schrempf Signed-off-by: Boris Brezillon Signed-off-by: Miquel Raynal Acked-by: Jagan Teki --- drivers/mtd/nand/spi/Makefile | 2 +- drivers/mtd/nand/spi/core.c| 1 + drivers/mtd/nand/spi/winbond.c | 143 + include/linux/mtd/spinand.h| 1 + 4 files changed, 146 insertions(+), 1 deletion(-) create mode 100644 drivers/mtd/nand/spi/winbond.c diff --git a/drivers/mtd/nand/spi/Makefile b/drivers/mtd/nand/spi/Makefile index 4eb745abd4..11ba5de68b 100644 --- a/drivers/mtd/nand/spi/Makefile +++ b/drivers/mtd/nand/spi/Makefile @@ -1,4 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 -spinand-objs := core.o micron.o +spinand-objs := core.o micron.o winbond.o obj-$(CONFIG_MTD_SPI_NAND) += spinand.o diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index 36b8b52bc2..ef3e6445d8 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -831,6 +831,7 @@ static const struct nand_ops spinand_ops = { static const struct spinand_manufacturer *spinand_manufacturers[] = { µn_spinand_manufacturer, + &winbond_spinand_manufacturer, }; static int spinand_manufacturer_detect(struct spinand_device *spinand) diff --git a/drivers/mtd/nand/spi/winbond.c b/drivers/mtd/nand/spi/winbond.c new file mode 100644 index 00..eac811d97c --- /dev/null +++ b/drivers/mtd/nand/spi/winbond.c @@ -0,0 +1,143 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2017 exceet electronics GmbH + * + * Authors: + * Frieder Schrempf + * Boris Brezillon + */ + +#ifndef __UBOOT__ +#include +#include +#endif +#include + +#define SPINAND_MFR_WINBOND0xEF + +#define WINBOND_CFG_BUF_READ BIT(3) + +static SPINAND_OP_VARIANTS(read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0)); + +static SPINAND_OP_VARIANTS(write_cache_variants, + SPINAND_PROG_LOAD_X4(true, 0, NULL, 0), + SPINAND_PROG_LOAD(true, 0, NULL, 0)); + +static SPINAND_OP_VARIANTS(update_cache_variants, + SPINAND_PROG_LOAD_X4(false, 0, NULL, 0), + SPINAND_PROG_LOAD(false, 0, NULL, 0)); + +static int w25m02gv_ooblayout_ecc(struct mtd_info *mtd, int section, + struct mtd_oob_region *region) +{ + if (section > 3) + return -ERANGE; + + region->offset = (16 * section) + 8; + region->length = 8; + + return 0; +} + +static int w25m02gv_ooblayout_free(struct mtd_info *mtd, int section, + struct mtd_oob_region *region) +{ + if (section > 3) + return -ERANGE; + + region->offset = (16 * section) + 2; + region->length = 6; + + return 0; +} + +static const struct mtd_ooblayout_ops w25m02gv_ooblayout = { + .ecc = w25m02gv_ooblayout_ecc, + .free = w25m02gv_ooblayout_free, +}; + +static int w25m02gv_select_target(struct spinand_device *spinand, + unsigned int target) +{ + struct spi_mem_op op = SPI_MEM_OP(SPI_MEM_OP_CMD(0xc2, 1), + SPI_MEM_OP_NO_ADDR, + SPI_MEM_OP_NO_DUMMY, + SPI_MEM_OP_DATA_OUT(1, + spinand->scratchbuf, + 1)); + + *spinand->scratchbuf = target; + return spi_mem_exec_op(spinand->slave, &op); +} + +static const struct spinand_info winbond_spinand_table[] = { + SPINAND_INFO("W25M02GV", 0xAB, +NAND_MEMORG(1, 2048, 64, 64, 1024, 1, 1, 2), +NAND_ECCREQ(1, 512), +SPINAND_INFO_OP_VARIANTS(&read_cache_variants, + &write_cache_variants, + &update_cache_variants), +0, +SPINAND_ECCINFO(&w25m02gv_ooblayout, NULL), +SPINAND_SELECT_TARGET(w25m02gv_select_target)), +}; + +/** + * winbond_spinand_detect - initialize device related part in spinand_device + * struct if it is a Winbond device. + * @spinand: SPI NAND device structure + */ +static int winbond_spinand_detect(struct spinand_device *spinand) +{ + u8 *id = spinand->id.data; + int ret; + + /* +* Winbond SPI NAND read ID need a dummy byte, +* so the first byte in raw_id is dummy. +*/ + if (id[1] != SPINA
[U-Boot] [PATCH v6 09/27] mtd: move NAND files into a raw/ subdirectory
NAND flavors, like serial and parallel, have a lot in common and would benefit to share code. Let's move raw (parallel) NAND specific code in a raw/ subdirectory, to ease the addition of a core file in nand/ and the introduction of a spi/ subdirectory specific to SPI NANDs. Documentation, README*, and MAINTAINERS files are updated accordingly. Signed-off-by: Miquel Raynal --- MAINTAINERS | 6 +- Makefile | 2 +- README| 6 +- arch/arm/mach-uniphier/board_late_init.c | 2 +- common/spl/Kconfig| 2 +- common/spl/spl_spi.c | 2 +- doc/README.SPL| 4 +- doc/README.arm-relocation | 2 +- doc/README.nand | 6 +- doc/README.zynq | 2 +- drivers/Makefile | 2 +- drivers/mtd/Makefile | 2 + drivers/mtd/nand/Kconfig | 298 +- drivers/mtd/nand/Makefile | 75 --- drivers/mtd/nand/raw/Kconfig | 297 + drivers/mtd/nand/raw/Makefile | 77 +++ drivers/mtd/nand/{ => raw}/am335x_spl_bch.c | 0 drivers/mtd/nand/{ => raw}/arasan_nfc.c | 0 drivers/mtd/nand/{ => raw}/atmel_nand.c | 0 drivers/mtd/nand/{ => raw}/atmel_nand_ecc.h | 0 drivers/mtd/nand/{ => raw}/davinci_nand.c | 2 +- drivers/mtd/nand/{ => raw}/denali.c | 0 drivers/mtd/nand/{ => raw}/denali.h | 0 drivers/mtd/nand/{ => raw}/denali_dt.c| 0 drivers/mtd/nand/{ => raw}/denali_spl.c | 0 drivers/mtd/nand/{ => raw}/fsl_elbc_nand.c| 0 drivers/mtd/nand/{ => raw}/fsl_elbc_spl.c | 0 drivers/mtd/nand/{ => raw}/fsl_ifc_nand.c | 0 drivers/mtd/nand/{ => raw}/fsl_ifc_spl.c | 0 drivers/mtd/nand/{ => raw}/fsl_upm.c | 0 drivers/mtd/nand/{ => raw}/fsmc_nand.c| 0 drivers/mtd/nand/{ => raw}/kb9202_nand.c | 0 drivers/mtd/nand/{ => raw}/kirkwood_nand.c| 0 drivers/mtd/nand/{ => raw}/kmeter1_nand.c | 0 drivers/mtd/nand/{ => raw}/lpc32xx_nand_mlc.c | 0 drivers/mtd/nand/{ => raw}/lpc32xx_nand_slc.c | 0 drivers/mtd/nand/{ => raw}/mxc_nand.c | 0 drivers/mtd/nand/{ => raw}/mxc_nand.h | 0 drivers/mtd/nand/{ => raw}/mxc_nand_spl.c | 0 drivers/mtd/nand/{ => raw}/mxs_nand.c | 0 drivers/mtd/nand/{ => raw}/mxs_nand.h | 0 drivers/mtd/nand/{ => raw}/mxs_nand_dt.c | 0 drivers/mtd/nand/{ => raw}/mxs_nand_spl.c | 0 drivers/mtd/nand/{ => raw}/nand.c | 0 drivers/mtd/nand/{ => raw}/nand_base.c| 0 drivers/mtd/nand/{ => raw}/nand_bbt.c | 0 drivers/mtd/nand/{ => raw}/nand_bch.c | 0 drivers/mtd/nand/{ => raw}/nand_ecc.c | 2 +- drivers/mtd/nand/{ => raw}/nand_ids.c | 0 drivers/mtd/nand/{ => raw}/nand_plat.c| 0 drivers/mtd/nand/{ => raw}/nand_spl_load.c| 0 drivers/mtd/nand/{ => raw}/nand_spl_loaders.c | 0 drivers/mtd/nand/{ => raw}/nand_spl_simple.c | 0 drivers/mtd/nand/{ => raw}/nand_timings.c | 0 drivers/mtd/nand/{ => raw}/nand_util.c| 2 +- drivers/mtd/nand/{ => raw}/omap_elm.c | 0 drivers/mtd/nand/{ => raw}/omap_gpmc.c| 0 drivers/mtd/nand/{ => raw}/pxa3xx_nand.c | 2 +- drivers/mtd/nand/{ => raw}/pxa3xx_nand.h | 0 drivers/mtd/nand/{ => raw}/sunxi_nand.c | 0 drivers/mtd/nand/{ => raw}/sunxi_nand_spl.c | 0 drivers/mtd/nand/{ => raw}/tegra_nand.c | 0 drivers/mtd/nand/{ => raw}/tegra_nand.h | 0 drivers/mtd/nand/{ => raw}/vf610_nfc.c| 0 drivers/mtd/nand/{ => raw}/zynq_nand.c| 0 include/configs/MPC8313ERDB.h | 2 +- 66 files changed, 400 insertions(+), 395 deletions(-) create mode 100644 drivers/mtd/nand/raw/Kconfig create mode 100644 drivers/mtd/nand/raw/Makefile rename drivers/mtd/nand/{ => raw}/am335x_spl_bch.c (100%) rename drivers/mtd/nand/{ => raw}/arasan_nfc.c (100%) rename drivers/mtd/nand/{ => raw}/atmel_nand.c (100%) rename drivers/mtd/nand/{ => raw}/atmel_nand_ecc.h (100%) rename drivers/mtd/nand/{ => raw}/davinci_nand.c (99%) rename drivers/mtd/nand/{ => raw}/denali.c (100%) rename drivers/mtd/nand/{ => raw}/denali.h (100%) rename drivers/mtd/nand/{ => raw}/denali_dt.c (100%) rename drivers/mtd/nand/{ => raw}/denali_spl.c (100%) rename drivers/mtd/nand/{ => raw}/fsl_elbc_nand.c (100%) rename drivers/mtd/nand/{ => raw}/fsl_elbc_spl.c (100%) rename drivers/mtd/nand/{ => raw}/fsl_ifc_nand.c (100%) rename drivers/mtd/nand/{ => raw}/fsl_ifc_spl.c (100%) rename drivers/mtd/nand/{ => raw}/fsl_upm.c (100%) rename drivers/mtd/nand/{ => raw}/fsmc_nand.c (100%) rename drivers/m
[U-Boot] [PATCH v6 13/27] spi: Extend the core to ease integration of SPI memory controllers
From: Boris Brezillon Some controllers are exposing high-level interfaces to access various kind of SPI memories. Unfortunately they do not fit in the current spi_controller model and usually have drivers placed in drivers/mtd/spi-nor which are only supporting SPI NORs and not SPI memories in general. This is an attempt at defining a SPI memory interface which works for all kinds of SPI memories (NORs, NANDs, SRAMs). Signed-off-by: Boris Brezillon Signed-off-by: Miquel Raynal Acked-by: Jagan Teki --- drivers/spi/Kconfig | 7 + drivers/spi/Makefile | 1 + drivers/spi/spi-mem.c | 500 ++ include/spi-mem.h | 258 ++ include/spi.h | 11 ++ 5 files changed, 777 insertions(+) create mode 100644 drivers/spi/spi-mem.c create mode 100644 include/spi-mem.h diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index b85fca5628..6286b2e234 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig @@ -18,6 +18,13 @@ config DM_SPI if DM_SPI +config SPI_MEM + bool "SPI memory extension" + help + Enable this option if you want to enable the SPI memory extension. + This extension is meant to simplify interaction with SPI memories + by providing an high-level interface to send memory-like commands. + config ALTERA_SPI bool "Altera SPI driver" help diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile index 95b03a29dc..7971adeb6f 100644 --- a/drivers/spi/Makefile +++ b/drivers/spi/Makefile @@ -8,6 +8,7 @@ ifdef CONFIG_DM_SPI obj-y += spi-uclass.o obj-$(CONFIG_SANDBOX) += spi-emul-uclass.o obj-$(CONFIG_SOFT_SPI) += soft_spi.o +obj-$(CONFIG_SPI_MEM) += spi-mem.o else obj-y += spi.o obj-$(CONFIG_SOFT_SPI) += soft_spi_legacy.o diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c new file mode 100644 index 00..07ce799170 --- /dev/null +++ b/drivers/spi/spi-mem.c @@ -0,0 +1,500 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2018 Exceet Electronics GmbH + * Copyright (C) 2018 Bootlin + * + * Author: Boris Brezillon + */ + +#ifndef __UBOOT__ +#include +#include +#include "internals.h" +#else +#include +#include +#endif + +#ifndef __UBOOT__ +/** + * spi_controller_dma_map_mem_op_data() - DMA-map the buffer attached to a + * memory operation + * @ctlr: the SPI controller requesting this dma_map() + * @op: the memory operation containing the buffer to map + * @sgt: a pointer to a non-initialized sg_table that will be filled by this + * function + * + * Some controllers might want to do DMA on the data buffer embedded in @op. + * This helper prepares everything for you and provides a ready-to-use + * sg_table. This function is not intended to be called from spi drivers. + * Only SPI controller drivers should use it. + * Note that the caller must ensure the memory region pointed by + * op->data.buf.{in,out} is DMA-able before calling this function. + * + * Return: 0 in case of success, a negative error code otherwise. + */ +int spi_controller_dma_map_mem_op_data(struct spi_controller *ctlr, + const struct spi_mem_op *op, + struct sg_table *sgt) +{ + struct device *dmadev; + + if (!op->data.nbytes) + return -EINVAL; + + if (op->data.dir == SPI_MEM_DATA_OUT && ctlr->dma_tx) + dmadev = ctlr->dma_tx->device->dev; + else if (op->data.dir == SPI_MEM_DATA_IN && ctlr->dma_rx) + dmadev = ctlr->dma_rx->device->dev; + else + dmadev = ctlr->dev.parent; + + if (!dmadev) + return -EINVAL; + + return spi_map_buf(ctlr, dmadev, sgt, op->data.buf.in, op->data.nbytes, + op->data.dir == SPI_MEM_DATA_IN ? + DMA_FROM_DEVICE : DMA_TO_DEVICE); +} +EXPORT_SYMBOL_GPL(spi_controller_dma_map_mem_op_data); + +/** + * spi_controller_dma_unmap_mem_op_data() - DMA-unmap the buffer attached to a + * memory operation + * @ctlr: the SPI controller requesting this dma_unmap() + * @op: the memory operation containing the buffer to unmap + * @sgt: a pointer to an sg_table previously initialized by + * spi_controller_dma_map_mem_op_data() + * + * Some controllers might want to do DMA on the data buffer embedded in @op. + * This helper prepares things so that the CPU can access the + * op->data.buf.{in,out} buffer again. + * + * This function is not intended to be called from SPI drivers. Only SPI + * controller drivers should use it. + * + * This function should be called after the DMA operation has finished and is + * only valid if the previous spi_controller_dma_map_mem_op_data() call + * returned 0. + * + * Return: 0 in case of success, a negative error code otherwise. + */ +void spi_controller_dma_unmap_mem_op_data(struct spi_controller *ctlr, +
[U-Boot] [PATCH v6 25/27] mtd: uclass: add probe function
The user might want to trigger the probe of any MTD device, export these functions so they can be called from a command source file. Signed-off-by: Miquel Raynal Acked-by: Jagan Teki --- drivers/mtd/mtd-uclass.c | 9 + include/linux/mtd/mtd.h | 3 +++ 2 files changed, 12 insertions(+) diff --git a/drivers/mtd/mtd-uclass.c b/drivers/mtd/mtd-uclass.c index 9ca049c437..9a9470410c 100644 --- a/drivers/mtd/mtd-uclass.c +++ b/drivers/mtd/mtd-uclass.c @@ -5,6 +5,7 @@ #include #include +#include #include #include @@ -13,6 +14,14 @@ * The uclass private is pointed to mtd_info. */ +int mtd_probe(struct udevice *dev) +{ + if (device_active(dev)) + return 0; + + return device_probe(dev); +} + UCLASS_DRIVER(mtd) = { .id = UCLASS_MTD, .name = "mtd", diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 6771ee2586..7dd45bde65 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -533,5 +533,8 @@ int mtd_arg_off_size(int argc, char *const argv[], int *idx, loff_t *off, void mtd_get_len_incl_bad(struct mtd_info *mtd, uint64_t offset, const uint64_t length, uint64_t *len_incl_bad, int *truncated); + +int mtd_probe(struct udevice *dev); + #endif #endif /* __MTD_MTD_H__ */ -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v6 14/27] mtd: nand: Add core infrastructure to support SPI NANDs
From: Peter Pan Add a SPI NAND framework based on the generic NAND framework and the spi-mem infrastructure. In its current state, this framework supports the following features: - single/dual/quad IO modes - on-die ECC Signed-off-by: Peter Pan Signed-off-by: Boris Brezillon Signed-off-by: Miquel Raynal Acked-by: Jagan Teki --- drivers/mtd/nand/Kconfig |2 + drivers/mtd/nand/Makefile |1 + drivers/mtd/nand/spi/Kconfig |7 + drivers/mtd/nand/spi/Makefile |4 + drivers/mtd/nand/spi/core.c | 1235 + include/linux/mtd/spinand.h | 427 ++ 6 files changed, 1676 insertions(+) create mode 100644 drivers/mtd/nand/spi/Kconfig create mode 100644 drivers/mtd/nand/spi/Makefile create mode 100644 drivers/mtd/nand/spi/core.c create mode 100644 include/linux/mtd/spinand.h diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig index 1c1a1f487e..78ae04bdcb 100644 --- a/drivers/mtd/nand/Kconfig +++ b/drivers/mtd/nand/Kconfig @@ -2,3 +2,5 @@ config MTD_NAND_CORE tristate source "drivers/mtd/nand/raw/Kconfig" + +source "drivers/mtd/nand/spi/Kconfig" diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile index cd492dbc14..a358bc680e 100644 --- a/drivers/mtd/nand/Makefile +++ b/drivers/mtd/nand/Makefile @@ -2,3 +2,4 @@ nandcore-objs := core.o bbt.o obj-$(CONFIG_MTD_NAND_CORE) += nandcore.o +obj-$(CONFIG_MTD_SPI_NAND) += spi/ diff --git a/drivers/mtd/nand/spi/Kconfig b/drivers/mtd/nand/spi/Kconfig new file mode 100644 index 00..2197cb531f --- /dev/null +++ b/drivers/mtd/nand/spi/Kconfig @@ -0,0 +1,7 @@ +menuconfig MTD_SPI_NAND + bool "SPI NAND device Support" + depends on MTD && DM_SPI + select MTD_NAND_CORE + select SPI_MEM + help + This is the framework for the SPI NAND device drivers. diff --git a/drivers/mtd/nand/spi/Makefile b/drivers/mtd/nand/spi/Makefile new file mode 100644 index 00..f0c6e69d2e --- /dev/null +++ b/drivers/mtd/nand/spi/Makefile @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 + +spinand-objs := core.o +obj-$(CONFIG_MTD_SPI_NAND) += spinand.o diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c new file mode 100644 index 00..08f853ae11 --- /dev/null +++ b/drivers/mtd/nand/spi/core.c @@ -0,0 +1,1235 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2016-2017 Micron Technology, Inc. + * + * Authors: + * Peter Pan + * Boris Brezillon + */ + +#define pr_fmt(fmt)"spi-nand: " fmt + +#ifndef __UBOOT__ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#else +#include +#include +#include +#include +#include +#endif + +/* SPI NAND index visible in MTD names */ +static int spi_nand_idx; + +static void spinand_cache_op_adjust_colum(struct spinand_device *spinand, + const struct nand_page_io_req *req, + u16 *column) +{ + struct nand_device *nand = spinand_to_nand(spinand); + unsigned int shift; + + if (nand->memorg.planes_per_lun < 2) + return; + + /* The plane number is passed in MSB just above the column address */ + shift = fls(nand->memorg.pagesize); + *column |= req->pos.plane << shift; +} + +static int spinand_read_reg_op(struct spinand_device *spinand, u8 reg, u8 *val) +{ + struct spi_mem_op op = SPINAND_GET_FEATURE_OP(reg, + spinand->scratchbuf); + int ret; + + ret = spi_mem_exec_op(spinand->slave, &op); + if (ret) + return ret; + + *val = *spinand->scratchbuf; + return 0; +} + +static int spinand_write_reg_op(struct spinand_device *spinand, u8 reg, u8 val) +{ + struct spi_mem_op op = SPINAND_SET_FEATURE_OP(reg, + spinand->scratchbuf); + + *spinand->scratchbuf = val; + return spi_mem_exec_op(spinand->slave, &op); +} + +static int spinand_read_status(struct spinand_device *spinand, u8 *status) +{ + return spinand_read_reg_op(spinand, REG_STATUS, status); +} + +static int spinand_get_cfg(struct spinand_device *spinand, u8 *cfg) +{ + struct nand_device *nand = spinand_to_nand(spinand); + + if (WARN_ON(spinand->cur_target < 0 || + spinand->cur_target >= nand->memorg.ntargets)) + return -EINVAL; + + *cfg = spinand->cfg_cache[spinand->cur_target]; + return 0; +} + +static int spinand_set_cfg(struct spinand_device *spinand, u8 cfg) +{ + struct nand_device *nand = spinand_to_nand(spinand); + int ret; + + if (WARN_ON(spinand->cur_target < 0 || + spinand->cur_target >= nand->memorg.ntargets)) + return -EINVAL; + + if (spinand->cfg_cache[spinand->cur_target] == cfg) + return 0; + + ret = spinand_wr
[U-Boot] [PATCH v6 11/27] mtd: nand: Add core infrastructure to deal with NAND devices
From: Boris Brezillon Add an intermediate layer to abstract NAND device interface so that some logic can be shared between SPI NANDs, parallel/raw NANDs, OneNANDs, ... Signed-off-by: Boris Brezillon Signed-off-by: Miquel Raynal Acked-by: Jagan Teki --- drivers/mtd/nand/Kconfig | 3 + drivers/mtd/nand/Makefile | 2 + drivers/mtd/nand/bbt.c| 132 + drivers/mtd/nand/core.c | 243 +++ include/linux/mtd/nand.h | 731 ++ 5 files changed, insertions(+) create mode 100644 drivers/mtd/nand/bbt.c create mode 100644 drivers/mtd/nand/core.c create mode 100644 include/linux/mtd/nand.h diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig index 6d53734718..1c1a1f487e 100644 --- a/drivers/mtd/nand/Kconfig +++ b/drivers/mtd/nand/Kconfig @@ -1 +1,4 @@ +config MTD_NAND_CORE + tristate + source "drivers/mtd/nand/raw/Kconfig" diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile index 69f40d1563..cd492dbc14 100644 --- a/drivers/mtd/nand/Makefile +++ b/drivers/mtd/nand/Makefile @@ -1,2 +1,4 @@ # SPDX-License-Identifier: GPL-2.0+ +nandcore-objs := core.o bbt.o +obj-$(CONFIG_MTD_NAND_CORE) += nandcore.o diff --git a/drivers/mtd/nand/bbt.c b/drivers/mtd/nand/bbt.c new file mode 100644 index 00..7e0ad3190c --- /dev/null +++ b/drivers/mtd/nand/bbt.c @@ -0,0 +1,132 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2017 Free Electrons + * + * Authors: + * Boris Brezillon + * Peter Pan + */ + +#define pr_fmt(fmt)"nand-bbt: " fmt + +#include +#ifndef __UBOOT__ +#include +#endif + +/** + * nanddev_bbt_init() - Initialize the BBT (Bad Block Table) + * @nand: NAND device + * + * Initialize the in-memory BBT. + * + * Return: 0 in case of success, a negative error code otherwise. + */ +int nanddev_bbt_init(struct nand_device *nand) +{ + unsigned int bits_per_block = fls(NAND_BBT_BLOCK_NUM_STATUS); + unsigned int nblocks = nanddev_neraseblocks(nand); + unsigned int nwords = DIV_ROUND_UP(nblocks * bits_per_block, + BITS_PER_LONG); + + nand->bbt.cache = kzalloc(nwords, GFP_KERNEL); + if (!nand->bbt.cache) + return -ENOMEM; + + return 0; +} +EXPORT_SYMBOL_GPL(nanddev_bbt_init); + +/** + * nanddev_bbt_cleanup() - Cleanup the BBT (Bad Block Table) + * @nand: NAND device + * + * Undoes what has been done in nanddev_bbt_init() + */ +void nanddev_bbt_cleanup(struct nand_device *nand) +{ + kfree(nand->bbt.cache); +} +EXPORT_SYMBOL_GPL(nanddev_bbt_cleanup); + +/** + * nanddev_bbt_update() - Update a BBT + * @nand: nand device + * + * Update the BBT. Currently a NOP function since on-flash bbt is not yet + * supported. + * + * Return: 0 in case of success, a negative error code otherwise. + */ +int nanddev_bbt_update(struct nand_device *nand) +{ + return 0; +} +EXPORT_SYMBOL_GPL(nanddev_bbt_update); + +/** + * nanddev_bbt_get_block_status() - Return the status of an eraseblock + * @nand: nand device + * @entry: the BBT entry + * + * Return: a positive number nand_bbt_block_status status or -%ERANGE if @entry + *is bigger than the BBT size. + */ +int nanddev_bbt_get_block_status(const struct nand_device *nand, +unsigned int entry) +{ + unsigned int bits_per_block = fls(NAND_BBT_BLOCK_NUM_STATUS); + unsigned long *pos = nand->bbt.cache + +((entry * bits_per_block) / BITS_PER_LONG); + unsigned int offs = (entry * bits_per_block) % BITS_PER_LONG; + unsigned long status; + + if (entry >= nanddev_neraseblocks(nand)) + return -ERANGE; + + status = pos[0] >> offs; + if (bits_per_block + offs > BITS_PER_LONG) + status |= pos[1] << (BITS_PER_LONG - offs); + + return status & GENMASK(bits_per_block - 1, 0); +} +EXPORT_SYMBOL_GPL(nanddev_bbt_get_block_status); + +/** + * nanddev_bbt_set_block_status() - Update the status of an eraseblock in the + * in-memory BBT + * @nand: nand device + * @entry: the BBT entry to update + * @status: the new status + * + * Update an entry of the in-memory BBT. If you want to push the updated BBT + * the NAND you should call nanddev_bbt_update(). + * + * Return: 0 in case of success or -%ERANGE if @entry is bigger than the BBT + *size. + */ +int nanddev_bbt_set_block_status(struct nand_device *nand, unsigned int entry, +enum nand_bbt_block_status status) +{ + unsigned int bits_per_block = fls(NAND_BBT_BLOCK_NUM_STATUS); + unsigned long *pos = nand->bbt.cache + +((entry * bits_per_block) / BITS_PER_LONG); + unsigned int offs = (entry * bits_per_block) % BITS_PER_LONG; + unsigned long val = status & GENMASK(bits_per_block - 1, 0); + + if (entry >= nanddev_neraseblocks(nand)) + return -ERANGE;
[U-Boot] [PATCH v6 20/27] mtd: declare MTD_PARTITIONS symbol in Kconfig
UBI selects MTD_PARTITIONS which is the symbol to compile drivers/mtd/mtdpart.c. Unfortunately, the symbol was not defined in Kconfig and this worked only with board files defining it. Fix this by adding a boolean in Kconfig so boards defined by defconfig files only will work as expected. Signed-off-by: Miquel Raynal Reviewed-by: Jagan Teki --- drivers/mtd/Kconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig index 9341d518f3..d98457e223 100644 --- a/drivers/mtd/Kconfig +++ b/drivers/mtd/Kconfig @@ -1,5 +1,8 @@ menu "MTD Support" +config MTD_PARTITIONS + bool + config MTD bool "Enable Driver Model for MTD drivers" depends on DM -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v6 15/27] mtd: spinand: Add initial support for Micron MT29F2G01ABAGD
From: Peter Pan Add a basic driver for Micron SPI NANDs. Only one device is supported right now, but the driver will be extended to support more devices afterwards. Signed-off-by: Peter Pan Signed-off-by: Boris Brezillon Signed-off-by: Miquel Raynal Acked-by: Jagan Teki --- drivers/mtd/nand/spi/Makefile | 2 +- drivers/mtd/nand/spi/core.c | 17 ++ drivers/mtd/nand/spi/micron.c | 135 ++ include/linux/mtd/spinand.h | 3 + 4 files changed, 156 insertions(+), 1 deletion(-) create mode 100644 drivers/mtd/nand/spi/micron.c diff --git a/drivers/mtd/nand/spi/Makefile b/drivers/mtd/nand/spi/Makefile index f0c6e69d2e..4eb745abd4 100644 --- a/drivers/mtd/nand/spi/Makefile +++ b/drivers/mtd/nand/spi/Makefile @@ -1,4 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 -spinand-objs := core.o +spinand-objs := core.o micron.o obj-$(CONFIG_MTD_SPI_NAND) += spinand.o diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index 08f853ae11..36b8b52bc2 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -829,8 +829,25 @@ static const struct nand_ops spinand_ops = { .isbad = spinand_isbad, }; +static const struct spinand_manufacturer *spinand_manufacturers[] = { + µn_spinand_manufacturer, +}; + static int spinand_manufacturer_detect(struct spinand_device *spinand) { + unsigned int i; + int ret; + + for (i = 0; i < ARRAY_SIZE(spinand_manufacturers); i++) { + ret = spinand_manufacturers[i]->ops->detect(spinand); + if (ret > 0) { + spinand->manufacturer = spinand_manufacturers[i]; + return 0; + } else if (ret < 0) { + return ret; + } + } + return -ENOTSUPP; } diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c new file mode 100644 index 00..83951c5d0f --- /dev/null +++ b/drivers/mtd/nand/spi/micron.c @@ -0,0 +1,135 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2016-2017 Micron Technology, Inc. + * + * Authors: + * Peter Pan + */ + +#ifndef __UBOOT__ +#include +#include +#endif +#include + +#define SPINAND_MFR_MICRON 0x2c + +#define MICRON_STATUS_ECC_MASK GENMASK(7, 4) +#define MICRON_STATUS_ECC_NO_BITFLIPS (0 << 4) +#define MICRON_STATUS_ECC_1TO3_BITFLIPS(1 << 4) +#define MICRON_STATUS_ECC_4TO6_BITFLIPS(3 << 4) +#define MICRON_STATUS_ECC_7TO8_BITFLIPS(5 << 4) + +static SPINAND_OP_VARIANTS(read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0)); + +static SPINAND_OP_VARIANTS(write_cache_variants, + SPINAND_PROG_LOAD_X4(true, 0, NULL, 0), + SPINAND_PROG_LOAD(true, 0, NULL, 0)); + +static SPINAND_OP_VARIANTS(update_cache_variants, + SPINAND_PROG_LOAD_X4(false, 0, NULL, 0), + SPINAND_PROG_LOAD(false, 0, NULL, 0)); + +static int mt29f2g01abagd_ooblayout_ecc(struct mtd_info *mtd, int section, + struct mtd_oob_region *region) +{ + if (section) + return -ERANGE; + + region->offset = 64; + region->length = 64; + + return 0; +} + +static int mt29f2g01abagd_ooblayout_free(struct mtd_info *mtd, int section, +struct mtd_oob_region *region) +{ + if (section) + return -ERANGE; + + /* Reserve 2 bytes for the BBM. */ + region->offset = 2; + region->length = 62; + + return 0; +} + +static const struct mtd_ooblayout_ops mt29f2g01abagd_ooblayout = { + .ecc = mt29f2g01abagd_ooblayout_ecc, + .free = mt29f2g01abagd_ooblayout_free, +}; + +static int mt29f2g01abagd_ecc_get_status(struct spinand_device *spinand, +u8 status) +{ + switch (status & MICRON_STATUS_ECC_MASK) { + case STATUS_ECC_NO_BITFLIPS: + return 0; + + case STATUS_ECC_UNCOR_ERROR: + return -EBADMSG; + + case MICRON_STATUS_ECC_1TO3_BITFLIPS: + return 3; + + case MICRON_STATUS_ECC_4TO6_BITFLIPS: + return 6; + + case MICRON_STATUS_ECC_7TO8_BITFLIPS: + return 8; + + default: + break; + } + + return -EINVAL; +} + +static const struct spinand_info micron_spinand_table[] = { + SPINAND_INFO("MT29F2G01ABAGD", 0x24, +NAND_MEMORG(1, 2048, 128, 64, 2048, 2, 1, 1), +NAND_ECCREQ(8, 512), +SPINAND_
[U-Boot] [PATCH v6 21/27] cmd: ubi: delete useless and misleading definitions
These definitions are simply not used and are misleading because similar definitions exist in jffs2/load_kernel.h and are used widely to define MTD device types (which is, by the way, totally redundant with what the MTD core does). Remove these definitions. Signed-off-by: Miquel Raynal Acked-by: Jagan Teki --- cmd/ubi.c | 5 - 1 file changed, 5 deletions(-) diff --git a/cmd/ubi.c b/cmd/ubi.c index 913f0f71fd..0a3405a3b1 100644 --- a/cmd/ubi.c +++ b/cmd/ubi.c @@ -27,11 +27,6 @@ #undef ubi_msg #define ubi_msg(fmt, ...) printf("UBI: " fmt "\n", ##__VA_ARGS__) -#define DEV_TYPE_NONE 0 -#define DEV_TYPE_NAND 1 -#define DEV_TYPE_ONENAND 2 -#define DEV_TYPE_NOR 3 - /* Private own data */ static struct ubi_device *ubi; static char buffer[80]; -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v6 19/27] dt-bindings: Add bindings for SPI NAND devices
From: Boris Brezillon Add bindings for SPI NAND chips. Signed-off-by: Boris Brezillon Signed-off-by: Miquel Raynal Acked-by: Jagan Teki --- doc/device-tree-bindings/mtd/spi-nand.txt | 5 + 1 file changed, 5 insertions(+) create mode 100644 doc/device-tree-bindings/mtd/spi-nand.txt diff --git a/doc/device-tree-bindings/mtd/spi-nand.txt b/doc/device-tree-bindings/mtd/spi-nand.txt new file mode 100644 index 00..8b51f3b6d5 --- /dev/null +++ b/doc/device-tree-bindings/mtd/spi-nand.txt @@ -0,0 +1,5 @@ +SPI NAND flash + +Required properties: +- compatible: should be "spi-nand" +- reg: should encode the chip-select line used to access the NAND chip -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v6 18/27] mtd: spinand: Add initial support for the MX35LF2GE4AB chip
Add support for the MX35LF2GE4AB chip, which is similar to its cousin MX35LF1GE4AB, with two planes instead of one. Signed-off-by: Miquel Raynal Acked-by: Jagan Teki --- drivers/mtd/nand/spi/macronix.c | 20 ++-- 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/mtd/nand/spi/macronix.c b/drivers/mtd/nand/spi/macronix.c index dd351dcb6c..662c561e50 100644 --- a/drivers/mtd/nand/spi/macronix.c +++ b/drivers/mtd/nand/spi/macronix.c @@ -27,13 +27,13 @@ static SPINAND_OP_VARIANTS(update_cache_variants, SPINAND_PROG_LOAD_X4(false, 0, NULL, 0), SPINAND_PROG_LOAD(false, 0, NULL, 0)); -static int mx35lf1ge4ab_ooblayout_ecc(struct mtd_info *mtd, int section, +static int mx35lfxge4ab_ooblayout_ecc(struct mtd_info *mtd, int section, struct mtd_oob_region *region) { return -ERANGE; } -static int mx35lf1ge4ab_ooblayout_free(struct mtd_info *mtd, int section, +static int mx35lfxge4ab_ooblayout_free(struct mtd_info *mtd, int section, struct mtd_oob_region *region) { if (section) @@ -45,9 +45,9 @@ static int mx35lf1ge4ab_ooblayout_free(struct mtd_info *mtd, int section, return 0; } -static const struct mtd_ooblayout_ops mx35lf1ge4ab_ooblayout = { - .ecc = mx35lf1ge4ab_ooblayout_ecc, - .free = mx35lf1ge4ab_ooblayout_free, +static const struct mtd_ooblayout_ops mx35lfxge4ab_ooblayout = { + .ecc = mx35lfxge4ab_ooblayout_ecc, + .free = mx35lfxge4ab_ooblayout_free, }; static int mx35lf1ge4ab_get_eccsr(struct spinand_device *spinand, u8 *eccsr) @@ -102,8 +102,16 @@ static const struct spinand_info macronix_spinand_table[] = { &write_cache_variants, &update_cache_variants), SPINAND_HAS_QE_BIT, -SPINAND_ECCINFO(&mx35lf1ge4ab_ooblayout, +SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, mx35lf1ge4ab_ecc_get_status)), + SPINAND_INFO("MX35LF2GE4AB", 0x22, +NAND_MEMORG(1, 2048, 64, 64, 2048, 2, 1, 1), +NAND_ECCREQ(4, 512), +SPINAND_INFO_OP_VARIANTS(&read_cache_variants, + &write_cache_variants, + &update_cache_variants), +SPINAND_HAS_QE_BIT, +SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, NULL)), }; static int macronix_spinand_detect(struct spinand_device *spinand) -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v6 24/27] cmd: mtdparts: remove useless 'mtdparts=' prefix
All U-Boot users must define the mtdparts environment variable with: setenv mtdparts mtdparts=... This is a pure software limitation and is a complete non-sense. Remove this limitation but keep the backward compatibility. Signed-off-by: Miquel Raynal Acked-by: Jagan Teki --- cmd/mtdparts.c | 17 ++--- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/cmd/mtdparts.c b/cmd/mtdparts.c index 27e84db0e4..ef8588bd71 100644 --- a/cmd/mtdparts.c +++ b/cmd/mtdparts.c @@ -44,7 +44,7 @@ * * 'mtdparts' - partition list * - * mtdparts=mtdparts=[;...] + * mtdparts=[mtdparts=][;...] * * := :[,...] *:= unique device tag used by linux kernel to find mtd device (mtd->name) @@ -62,11 +62,11 @@ * * 1 NOR Flash, with 1 single writable partition: * mtdids=nor0=edb7312-nor - * mtdparts=mtdparts=edb7312-nor:- + * mtdparts=[mtdparts=]edb7312-nor:- * * 1 NOR Flash with 2 partitions, 1 NAND with one * mtdids=nor0=edb7312-nor,nand0=edb7312-nand - * mtdparts=mtdparts=edb7312-nor:256k(ARMboot)ro,-(root);edb7312-nand:-(home) + * mtdparts=[mtdparts=]edb7312-nor:256k(ARMboot)ro,-(root);edb7312-nand:-(home) * */ @@ -1167,9 +1167,6 @@ static int generate_mtdparts(char *buf, u32 buflen) return 0; } - strcpy(p, "mtdparts="); - p += 9; - list_for_each(dentry, &devices) { dev = list_entry(dentry, struct mtd_device, link); @@ -1640,11 +1637,9 @@ static int parse_mtdparts(const char *const mtdparts) if (!p) p = mtdparts; - if (strncmp(p, "mtdparts=", 9) != 0) { - printf("mtdparts variable doesn't start with 'mtdparts='\n"); - return err; - } - p += 9; + /* Skip the useless prefix, if any */ + if (strncmp(p, "mtdparts=", 9) == 0) + p += 9; while (*p != '\0') { err = 1; -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v6 23/27] cmd: mtdparts: add a generic 'mtdparts' parser
The current parser is very specific to U-Boot mtdparts implementation. It does not use MTD structures like mtd_info and mtd_partition. Write some kind of a wrapper around the current implementation to allow other commands to benefit from this parsing in a user-friendly way. This new command will allocate an mtd_partition array for each successful call. This array must be freed after use by the caller. The given 'mtdparts' buffer pointer will be moved forward to the next MTD device (if any, it will point towards a '\0' character otherwise). Signed-off-by: Miquel Raynal Acked-by: Jagan Teki --- cmd/mtdparts.c | 71 ++ include/linux/mtd/partitions.h | 3 ++ 2 files changed, 74 insertions(+) diff --git a/cmd/mtdparts.c b/cmd/mtdparts.c index f26a761c99..27e84db0e4 100644 --- a/cmd/mtdparts.c +++ b/cmd/mtdparts.c @@ -78,6 +78,7 @@ #include #include #include +#include #if defined(CONFIG_CMD_NAND) #include @@ -705,6 +706,76 @@ static int part_parse(const char *const partdef, const char **ret, struct part_i return 0; } +int mtdparts_parse_part(struct mtd_info *parent, const char **_mtdparts, + struct mtd_partition **_parts, int *_nb_parts) +{ + const char *mtdparts = *_mtdparts; + struct part_info *part_legacy; + struct mtd_partition *parts; + int cur_off = 0, cur_sz = 0; + int nb_parts = 0; + char *names; + int ret, idx; + + *_parts = NULL; + *_nb_parts = 0; + + /* First, iterate over the partitions until we know their number */ + while (mtdparts[0] != '\0' && mtdparts[0] != ';') { + ret = part_parse(mtdparts, &mtdparts, &part_legacy); + if (ret) + return ret; + + nb_parts++; + free(part_legacy); + } + + /* Allocate an array of partitions to give back to the caller */ + parts = malloc((sizeof(*parts) + 20) * nb_parts); + names = (char *)&parts[nb_parts]; + if (!parts) { + printf("Could not allocate enough space to save partitions meta-data\n"); + return -ENOMEM; + } + + /* Iterate again over each partition to save the data in our array */ + for (idx = 0; idx < nb_parts; idx++) { + char *name; + + ret = part_parse(*_mtdparts, _mtdparts, &part_legacy); + if (ret) + return ret; + + name = &names[idx * 20]; + strncpy(name, part_legacy->name, 20); + parts[idx].name = name; + + parts[idx].size = part_legacy->size; + if (parts[idx].size == SIZE_REMAINING) + parts[idx].size = parent->size - cur_sz; + cur_sz += parts[idx].size; + + parts[idx].offset = part_legacy->offset; + if (parts[idx].offset == OFFSET_NOT_SPECIFIED) + parts[idx].offset = cur_off; + cur_off += parts[idx].size; + + parts[idx].mask_flags = part_legacy->mask_flags; + parts[idx].ecclayout = parent->ecclayout; + + free(part_legacy); + } + + /* Offset by one mtdparts to point to the next device if needed */ + if (*_mtdparts[0] == ';') + _mtdparts++; + + *_parts = parts; + *_nb_parts = nb_parts; + + return 0; +} + /** * Check device number to be within valid range for given device type. * diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h index ce0e8dbee4..0cf26ca945 100644 --- a/include/linux/mtd/partitions.h +++ b/include/linux/mtd/partitions.h @@ -87,4 +87,7 @@ int mtd_add_partition(struct mtd_info *master, const char *name, int mtd_del_partition(struct mtd_info *master, int partno); uint64_t mtd_get_device_size(const struct mtd_info *mtd); +int mtdparts_parse_part(struct mtd_info *parent, const char **_mtdparts, + struct mtd_partition **_parts, int *_nb_parts); + #endif -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v6 22/27] cmd: mtdparts: accept spi-nand devices
Let spi-nand devices be recognized by mtdparts. This is superfluous but a full mtdparts rework would be very time-consuming. Signed-off-by: Miquel Raynal Acked-by: Jagan Teki --- cmd/mtdparts.c | 13 - include/jffs2/load_kernel.h | 7 +-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/cmd/mtdparts.c b/cmd/mtdparts.c index 0da3afd75f..f26a761c99 100644 --- a/cmd/mtdparts.c +++ b/cmd/mtdparts.c @@ -37,7 +37,7 @@ * mtdids=[,,...] * * := = - *:= 'nand'|'nor'|'onenand' + *:= 'nand'|'nor'|'onenand'|'spi-nand' * := mtd device number, 0... *:= unique device tag used by linux kernel to find mtd device (mtd->name) * @@ -336,7 +336,7 @@ static int part_validate_eraseblock(struct mtdids *id, struct part_info *part) if (!mtd->numeraseregions) { /* -* Only one eraseregion (NAND, OneNAND or uniform NOR), +* Only one eraseregion (NAND, SPI-NAND, OneNAND or uniform NOR), * checking for alignment is easy here */ offset = part->offset; @@ -1027,7 +1027,7 @@ static struct mtdids* id_find_by_mtd_id(const char *mtd_id, unsigned int mtd_id_ } /** - * Parse device id string := 'nand'|'nor'|'onenand', + * Parse device id string := 'nand'|'nor'|'onenand'|'spi-nand', * return device type and number. * * @param id string describing device id @@ -1051,6 +1051,9 @@ int mtd_id_parse(const char *id, const char **ret_id, u8 *dev_type, } else if (strncmp(p, "onenand", 7) == 0) { *dev_type = MTD_DEV_TYPE_ONENAND; p += 7; + } else if (strncmp(p, "spi-nand", 8) == 0) { + *dev_type = MTD_DEV_TYPE_SPINAND; + p += 8; } else { printf("incorrect device type in %s\n", id); return 1; @@ -1633,7 +1636,7 @@ static int parse_mtdids(const char *const ids) while(p && (*p != '\0')) { ret = 1; - /* parse 'nor'|'nand'|'onenand' */ + /* parse 'nor'|'nand'|'onenand'|'spi-nand' */ if (mtd_id_parse(p, &p, &type, &num) != 0) break; @@ -2109,7 +2112,7 @@ static char mtdparts_help_text[] = "'mtdids' - linux kernel mtd device id <-> u-boot device id mapping\n\n" "mtdids=[,,...]\n\n" ":= =\n" - " := 'nand'|'nor'|'onenand'\n" + " := 'nand'|'nor'|'onenand'|'spi-nand'\n" " := mtd device number, 0...\n" " := unique device tag used by linux kernel to find mtd device (mtd->name)\n\n" "'mtdparts' - partition list\n\n" diff --git a/include/jffs2/load_kernel.h b/include/jffs2/load_kernel.h index 1ddff062ad..9346d7ee9f 100644 --- a/include/jffs2/load_kernel.h +++ b/include/jffs2/load_kernel.h @@ -15,9 +15,12 @@ #define MTD_DEV_TYPE_NOR 0x0001 #define MTD_DEV_TYPE_NAND 0x0002 #define MTD_DEV_TYPE_ONENAND 0x0004 +#define MTD_DEV_TYPE_SPINAND 0x0008 -#define MTD_DEV_TYPE(type) ((type == MTD_DEV_TYPE_NAND) ? "nand" : \ - (type == MTD_DEV_TYPE_ONENAND) ? "onenand" : "nor") +#define MTD_DEV_TYPE(type) (type == MTD_DEV_TYPE_NAND ? "nand" : \ + (type == MTD_DEV_TYPE_NOR ? "nor" : \ +(type == MTD_DEV_TYPE_ONENAND ? "onenand" : \ + "spi-nand"))) \ struct mtd_device { struct list_head link; -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v6 17/27] mtd: spinand: Add initial support for the MX35LF1GE4AB chip
From: Boris Brezillon Add minimal support for the MX35LF1GE4AB SPI NAND chip. Signed-off-by: Boris Brezillon Acked-by: Jagan Teki --- drivers/mtd/nand/spi/Makefile | 2 +- drivers/mtd/nand/spi/core.c | 1 + drivers/mtd/nand/spi/macronix.c | 138 include/linux/mtd/spinand.h | 1 + 4 files changed, 141 insertions(+), 1 deletion(-) create mode 100644 drivers/mtd/nand/spi/macronix.c diff --git a/drivers/mtd/nand/spi/Makefile b/drivers/mtd/nand/spi/Makefile index 11ba5de68b..a66edd9199 100644 --- a/drivers/mtd/nand/spi/Makefile +++ b/drivers/mtd/nand/spi/Makefile @@ -1,4 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 -spinand-objs := core.o micron.o winbond.o +spinand-objs := core.o macronix.o micron.o winbond.o obj-$(CONFIG_MTD_SPI_NAND) += spinand.o diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index ef3e6445d8..362d104846 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -830,6 +830,7 @@ static const struct nand_ops spinand_ops = { }; static const struct spinand_manufacturer *spinand_manufacturers[] = { + ¯onix_spinand_manufacturer, µn_spinand_manufacturer, &winbond_spinand_manufacturer, }; diff --git a/drivers/mtd/nand/spi/macronix.c b/drivers/mtd/nand/spi/macronix.c new file mode 100644 index 00..dd351dcb6c --- /dev/null +++ b/drivers/mtd/nand/spi/macronix.c @@ -0,0 +1,138 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2018 Macronix + * + * Author: Boris Brezillon + */ + +#ifndef __UBOOT__ +#include +#include +#endif +#include + +#define SPINAND_MFR_MACRONIX 0xC2 + +static SPINAND_OP_VARIANTS(read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0)); + +static SPINAND_OP_VARIANTS(write_cache_variants, + SPINAND_PROG_LOAD_X4(true, 0, NULL, 0), + SPINAND_PROG_LOAD(true, 0, NULL, 0)); + +static SPINAND_OP_VARIANTS(update_cache_variants, + SPINAND_PROG_LOAD_X4(false, 0, NULL, 0), + SPINAND_PROG_LOAD(false, 0, NULL, 0)); + +static int mx35lf1ge4ab_ooblayout_ecc(struct mtd_info *mtd, int section, + struct mtd_oob_region *region) +{ + return -ERANGE; +} + +static int mx35lf1ge4ab_ooblayout_free(struct mtd_info *mtd, int section, + struct mtd_oob_region *region) +{ + if (section) + return -ERANGE; + + region->offset = 2; + region->length = mtd->oobsize - 2; + + return 0; +} + +static const struct mtd_ooblayout_ops mx35lf1ge4ab_ooblayout = { + .ecc = mx35lf1ge4ab_ooblayout_ecc, + .free = mx35lf1ge4ab_ooblayout_free, +}; + +static int mx35lf1ge4ab_get_eccsr(struct spinand_device *spinand, u8 *eccsr) +{ + struct spi_mem_op op = SPI_MEM_OP(SPI_MEM_OP_CMD(0x7c, 1), + SPI_MEM_OP_NO_ADDR, + SPI_MEM_OP_DUMMY(1, 1), + SPI_MEM_OP_DATA_IN(1, eccsr, 1)); + + return spi_mem_exec_op(spinand->slave, &op); +} + +static int mx35lf1ge4ab_ecc_get_status(struct spinand_device *spinand, + u8 status) +{ + struct nand_device *nand = spinand_to_nand(spinand); + u8 eccsr; + + switch (status & STATUS_ECC_MASK) { + case STATUS_ECC_NO_BITFLIPS: + return 0; + + case STATUS_ECC_UNCOR_ERROR: + return -EBADMSG; + + case STATUS_ECC_HAS_BITFLIPS: + /* +* Let's try to retrieve the real maximum number of bitflips +* in order to avoid forcing the wear-leveling layer to move +* data around if it's not necessary. +*/ + if (mx35lf1ge4ab_get_eccsr(spinand, &eccsr)) + return nand->eccreq.strength; + + if (WARN_ON(eccsr > nand->eccreq.strength || !eccsr)) + return nand->eccreq.strength; + + return eccsr; + + default: + break; + } + + return -EINVAL; +} + +static const struct spinand_info macronix_spinand_table[] = { + SPINAND_INFO("MX35LF1GE4AB", 0x12, +NAND_MEMORG(1, 2048, 64, 64, 1024, 1, 1, 1), +NAND_ECCREQ(4, 512), +SPINAND_INFO_OP_VARIANTS(&read_cache_variants, + &write_cache_variants, + &update_cache_variants), +SPINAND_HAS_QE_BIT, +SPINAND_ECCINFO(&mx35lf1ge4ab_ooblayout, +mx35lf1ge4ab_ecc_get_status)), +}; +
[U-Boot] [PATCH v6 27/27] cmd: mtdparts: try to probe the MTD devices as a fallback
Current implementation of mtdparts command errors out if the desired MTD device is not found. Fallback to the new probe function in this case before erroring out. This will the save the user the need to call something like 'mtd list' before mtdparts. Signed-off-by: Miquel Raynal Acked-by: Jagan Teki --- cmd/mtdparts.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cmd/mtdparts.c b/cmd/mtdparts.c index ef8588bd71..76f0138e4d 100644 --- a/cmd/mtdparts.c +++ b/cmd/mtdparts.c @@ -305,9 +305,15 @@ static int get_mtd_info(u8 type, u8 num, struct mtd_info **mtd) sprintf(mtd_dev, "%s%d", MTD_DEV_TYPE(type), num); *mtd = get_mtd_device_nm(mtd_dev); - if (IS_ERR(*mtd)) { - printf("Device %s not found!\n", mtd_dev); - return 1; + if (IS_ERR_OR_NULL(*mtd)) { +#ifdef CONFIG_CMD_MTD + mtd_probe_devices(); + *mtd = get_mtd_device_nm(mtd_dev); +#endif + if (IS_ERR_OR_NULL(*mtd)) { + printf("Device %s not found!\n", mtd_dev); + return 1; + } } put_mtd_device(*mtd); -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v6 26/27] cmd: mtd: add 'mtd' command
There should not be a 'nand' command, a 'sf' command and certainly not another 'spi-nand'. Write a 'mtd' command instead to manage all MTD devices at once. This should be the preferred way to access any MTD device. Signed-off-by: Miquel Raynal Acked-by: Jagan Teki --- cmd/Kconfig | 7 + cmd/Makefile| 1 + cmd/mtd.c | 392 drivers/mtd/Makefile| 2 +- include/linux/mtd/mtd.h | 1 + 5 files changed, 402 insertions(+), 1 deletion(-) create mode 100644 cmd/mtd.c diff --git a/cmd/Kconfig b/cmd/Kconfig index 0cf530d923..45ead0ffce 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -848,6 +848,13 @@ config CMD_MMC_SWRITE Enable support for the "mmc swrite" command to write Android sparse images to eMMC. +config CMD_MTD + bool "mtd" + depends on CMD_MTDPARTS + select MTD_PARTITIONS + help + MTD commands support. + config CMD_NAND bool "nand" default y if NAND_SUNXI diff --git a/cmd/Makefile b/cmd/Makefile index 323f1fd2c7..32fd102189 100644 --- a/cmd/Makefile +++ b/cmd/Makefile @@ -90,6 +90,7 @@ obj-$(CONFIG_CMD_MISC) += misc.o obj-$(CONFIG_CMD_MMC) += mmc.o obj-$(CONFIG_CMD_MMC_SPI) += mmc_spi.o obj-$(CONFIG_MP) += mp.o +obj-$(CONFIG_CMD_MTD) += mtd.o obj-$(CONFIG_CMD_MTDPARTS) += mtdparts.o obj-$(CONFIG_CMD_NAND) += nand.o obj-$(CONFIG_CMD_NET) += net.o diff --git a/cmd/mtd.c b/cmd/mtd.c new file mode 100644 index 00..221b12500f --- /dev/null +++ b/cmd/mtd.c @@ -0,0 +1,392 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * mtd.c + * + * Generic command to handle basic operations on any memory device. + * + * Copyright: Bootlin, 2018 + * Author: Miquèl Raynal + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void mtd_dump_buf(u8 *buf, uint len, uint offset) +{ + int i, j; + + for (i = 0; i < len; ) { + printf("0x%08x:\t", offset + i); + for (j = 0; j < 8; j++) + printf("%02x ", buf[i + j]); + printf(" "); + i += 8; + for (j = 0; j < 8; j++) + printf("%02x ", buf[i + j]); + printf("\n"); + i += 8; + } +} + +static void mtd_show_device(struct mtd_info *mtd) +{ + /* Device */ + printf("* %s", mtd->name); + if (mtd->dev) + printf(" [device: %s] [parent: %s] [driver: %s]", + mtd->dev->name, mtd->dev->parent->name, + mtd->dev->driver->name); + printf("\n"); + + /* MTD information */ + printf("\t> type: "); + switch (mtd->type) { + case MTD_RAM: + printf("RAM\n"); + break; + case MTD_ROM: + printf("ROM\n"); + break; + case MTD_NORFLASH: + printf("NOR flash\n"); + break; + case MTD_NANDFLASH: + printf("NAND flash\n"); + break; + case MTD_DATAFLASH: + printf("Data flash\n"); + break; + case MTD_UBIVOLUME: + printf("UBI volume\n"); + break; + case MTD_MLCNANDFLASH: + printf("MLC NAND flash\n"); + break; + case MTD_ABSENT: + default: + printf("Unknown\n"); + break; + } + + printf("\t> Size: 0x%llx bytes\n", mtd->size); + printf("\t> Block: 0x%x bytes\n", mtd->erasesize); + printf("\t> Min I/O: 0x%x bytes\n", mtd->writesize); + + if (mtd->oobsize) { + printf("\t> OOB size: %u bytes\n", mtd->oobsize); + printf("\t> OOB available: %u bytes\n", mtd->oobavail); + } + + if (mtd->ecc_strength) { + printf("\t> ECC strength: %u bits\n", mtd->ecc_strength); + printf("\t> ECC step size: %u bytes\n", mtd->ecc_step_size); + printf("\t> Bitflip threshold: %u bits\n", + mtd->bitflip_threshold); + } +} + +int mtd_probe_devices(void) +{ + const char *mtdparts = env_get("mtdparts"); + struct udevice *dev; + int idx = 0; + + /* Probe devices with DM compliant drivers */ + while (!uclass_find_device(UCLASS_MTD, idx, &dev) && dev) { + mtd_probe(dev); + idx++; + } + + /* Create the partitions defined in mtdparts, here the fun begins */ + + /* Ignore the extra 'mtdparts=' prefix if any */ + if (strstr(mtdparts, "mtdparts=")) + mtdparts += 9; + + /* For each MTD device in mtdparts */ + while (mtdparts[0] != '\0') { + struct mtd_partition *parts; + struct mtd_info *parent; + char mtdname[20]; + int mtdname_len, len, ret; + + mtdname_len = strchr(mtdparts,
Re: [U-Boot] [PATCH] openrd: Once again shrink binary size
On Fri, Jul 27, 2018 at 11:59 PM Tom Rini wrote: > > With some recent changes to relevant drivers here the openrd board > (openrd_client in this case) does not fit within its size constraint. > We can however drop the slightly extended baudrate table and then the > duplication of mtdparts/mtdids in the default environment. These > defaults are set in the environment by the 'mtdparts' command and > otherwise referenced throughout the code. > > Signed-off-by: Tom Rini We could probably shrink things further by disabling jffs2 and only supporting ubifs. Similarly having support for both fat and ext4 is taking up much of the image although it may be less desirable to pick only one of these since either of those file systems could be on removable media. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] net: fman: Support both new and legacy FMan Compatibles
Recently the FMan Port and MAC compatibles were changed. This patch aligns the FMan Port and MAC compatibles to the new FMan device tree binding document. The FMan device tree binding document can be found in the Linux kernel: ./Documentation/devicetree/bindings/net/fsl-fman.txt This patch doesn't affect legacy compatibles support. Signed-off-by: Zhao Qiang --- drivers/net/fm/init.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/drivers/net/fm/init.c b/drivers/net/fm/init.c index 147d043..e3b1a50 100644 --- a/drivers/net/fm/init.c +++ b/drivers/net/fm/init.c @@ -328,7 +328,8 @@ void fdt_fixup_fman_ethernet(void *blob) ft_fixup_port(blob, &fm_info[i], "fsl,fman-1g-mac"); } else { - if (ft_fixup_port(blob, &fm_info[i], "fsl,fman-tgec")) + if (ft_fixup_port(blob, &fm_info[i], "fsl,fman-tgec") && + ft_fixup_port(blob, &fm_info[i], "fsl,fman-xgec")) ft_fixup_port(blob, &fm_info[i], "fsl,fman-10g-mac"); } -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] Converting to SPL_OF_CONTROL
I've long been trying to convert our board (AM3352) to all DM, after knocking out lots of problems, I've run into one I can't seem to configure my way around, when I enable SPL_OF_CONTROL. We have MMC2 as our boot device, with no MMC1 (and hence not present in the DTB). Once we're into full U-Boot this is all okay, we get the board's MMC2 appearing as mmc0 and everything's fine. My problem's during SPL, where the boot device is MMC2, the code tries to lookup by devnum (which is 1 because it numbers from 0 at this point), which doesn't exist. I'd expected aliases to work, but we don't seem to lookup up by alias, only index, so I don't have any way that I can see of overriding it. If I make this change, then everything works (with the addition of an an alias for mmc1 = &mmc2): diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index 0b2f059570..b7544ba183 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -131,7 +131,7 @@ static int spl_mmc_find_device(struct mmc **mmcp, u32 boot_device) } #if CONFIG_IS_ENABLED(DM_MMC) - err = uclass_get_device(UCLASS_MMC, mmc_dev, &dev); + err = uclass_get_device_by_seq(UCLASS_MMC, mmc_dev, &dev); if (!err) *mmcp = mmc_get_mmc_dev(dev); #else But that feels like a pretty fundamental change to make across every board and I've no real idea if that would even be the right thing to do, or if I should be trying to fix this some other way. -- Alex Kiernan ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] xyz-modem: Change getc timeout loop waiting
Hi! On Wed, 1 Aug 2018 08:44:13 +0300 Tomas Melin wrote: > > This commit breaks YMODEM SPL->U-Boot boot on Beagle Bone, > > transfer is aborted (because of timeout) after 497kb > > (u-boot.img is around 570kb). > > Reverting the commit repairs YMODEM boot. > > Is the timeout a watchdog timeout or some communication freeze? I suppose, it reports false-positive timeout back to ymodem code. Because all it does is terminating communication gracefully (with 'C' and a bunch of CANs). I need to check if timer overflow is possible on Beaglebone, because the code is obviously not overflow-proof, but on the other hand it happens within minutes and at least the timer variable is 32 bit... > In case watchdog is correctly configured, kicking should still > happen. -- Alexander Sverdlin. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] Corrected checksum failure handling of FDT within FIT image
Hello, I have observed, that if you have a corrupted FDT within a FIT image, then the error handling is not correct and you will fail to 'hang()'. To allow an error handling within scripts, the return value of the calling function 'fit_image_load()' has to be checked for negative values. On error (return value < 0), we have to exit the function. This error seems to also exists in the newest u-boot release. Please check and fix, if not already done in current versions of u-boot. With best regards, Heiko Patz Siemens Healthcare GmbH Diagnostic Imaging Computed Tomography Electronics SHS DI CT R&D SC EL Siemensstr. 1 91301 Forchheim, Germany Tel.: +49 9191 18-6444 Fax: +49 9191 18-6513 Mobile: +49 152 06340249 mailto:heiko.p...@siemens-healthineers.com [cid:image001.gif@01D42981.A98AE880] Siemens Healthcare GmbH: Management: Bernhard Montag, Chairman; Jochen Schmitz, Michael Reitermann; Chairman of the Supervisory Board: Michael Sen; Registered office: Munich, Germany; Commercial Registry: Munich, HRB 213821 WEEE-Reg.-No. DE 64872105 Important notice: This e-mail and any attachment thereof contain corporate proprietary information. If you have received it by mistake, please notify us immediately by reply e-mail and delete this e-mail and its attachments from your system. Thank you. u-boot-2015.04.patch Description: u-boot-2015.04.patch ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] ram: stm32_sdram: Adds stm32f746-disco fix for HardFault at booting
- changes ram start address to 0xC000 Signed-off-by: Mark Olsson Cc: Vipin Kumar --- include/configs/stm32f746-disco.h | 2 ++ 1 file changed, 2 insertions(+) mode change 100644 => 100755 include/configs/stm32f746-disco.h diff --git a/include/configs/stm32f746-disco.h b/include/configs/stm32f746-disco.h old mode 100644 new mode 100755 index 567e7f2a00..238d4e939f --- a/include/configs/stm32f746-disco.h +++ b/include/configs/stm32f746-disco.h @@ -21,6 +21,8 @@ * Configuration of the external SDRAM memory */ #define CONFIG_NR_DRAM_BANKS 1 +#define CONFIG_SYS_RAM_BASE0xC000 +#define CONFIG_SYS_SDRAM_BASE CONFIG_SYS_RAM_BASE #define CONFIG_SYS_MAX_FLASH_SECT 8 #define CONFIG_SYS_MAX_FLASH_BANKS 1 -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] Pull request: u-boot-sunxi/master
On Tue, Jul 31, 2018 at 11:41:50PM +0530, Jagan Teki wrote: > Hi Tom, > > Please pull this PR. > > thanks, > Jagan. > > The following changes since commit 5a0007d481c0fcd2d422dd48b2a129dd8e8a272a: > > Prepare v2017.09-rc1 (2018-07-30 21:47:29 -0400) > > are available in the Git repository at: > > git://git.denx.de/u-boot-sunxi.git master > > for you to fetch changes up to 89a897fc4d78e31332e5899e977d8bf3c82abafa: > > board: sun50i: h6: Add OrangePi One Plus initial support (2018-07-31 > 20:50:01 +0530) > For the moment, on hold. pine_h64 doesn't link (see https://travis-ci.org/trini/u-boot/jobs/410579615) but I bet Andre's changes to save some space on aarch64 will get it to fit in, and I need to see if I'm ready to apply them. -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] openrd: Once again shrink binary size
On Wed, Aug 01, 2018 at 08:40:18PM +1200, Chris Packham wrote: > On Fri, Jul 27, 2018 at 11:59 PM Tom Rini wrote: > > > > With some recent changes to relevant drivers here the openrd board > > (openrd_client in this case) does not fit within its size constraint. > > We can however drop the slightly extended baudrate table and then the > > duplication of mtdparts/mtdids in the default environment. These > > defaults are set in the environment by the 'mtdparts' command and > > otherwise referenced throughout the code. > > > > Signed-off-by: Tom Rini > > We could probably shrink things further by disabling jffs2 and only > supporting ubifs. Similarly having support for both fat and ext4 is > taking up much of the image although it may be less desirable to pick > only one of these since either of those file systems could be on > removable media. Ah, so, did you also see my email marking the platforms as orphaned? If so, please feel free to pick them up and trim the config down :) Thanks! -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 1/3] efi: Fix truncation of constant value
Hello Tom, Simon, Alexander, Heinrich, On Wed, Jul 25, 2018 at 03:30:16PM +0200, Eugeniu Rosca wrote: > Hello Alexander, > > Heinrich was kind to have a look at [1] and already provided his > Reviewed-by. Could you please state your further expectations to accept > the patches? > > [1] https://patchwork.ozlabs.org/patch/944004/ > > Thanks, > Eugeniu. Any idea how to move forward with these patches? Best regards, Eugeniu. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] Converting to SPL_OF_CONTROL
Hello Alex, have you tried to set "u-boot,spl-boot-order" in choosen node? Take a look into: doc/device-tree-bindings/chosen.txt Best regards Johann Neuhauser -Ursprüngliche Nachricht- Von: U-Boot [mailto:u-boot-boun...@lists.denx.de] Im Auftrag von Alex Kiernan Gesendet: Mittwoch, 1. August 2018 12:42 An: u-boot ; Simon Glass Betreff: [U-Boot] Converting to SPL_OF_CONTROL I've long been trying to convert our board (AM3352) to all DM, after knocking out lots of problems, I've run into one I can't seem to configure my way around, when I enable SPL_OF_CONTROL. We have MMC2 as our boot device, with no MMC1 (and hence not present in the DTB). Once we're into full U-Boot this is all okay, we get the board's MMC2 appearing as mmc0 and everything's fine. My problem's during SPL, where the boot device is MMC2, the code tries to lookup by devnum (which is 1 because it numbers from 0 at this point), which doesn't exist. I'd expected aliases to work, but we don't seem to lookup up by alias, only index, so I don't have any way that I can see of overriding it. If I make this change, then everything works (with the addition of an an alias for mmc1 = &mmc2): diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index 0b2f059570..b7544ba183 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -131,7 +131,7 @@ static int spl_mmc_find_device(struct mmc **mmcp, u32 boot_device) } #if CONFIG_IS_ENABLED(DM_MMC) - err = uclass_get_device(UCLASS_MMC, mmc_dev, &dev); + err = uclass_get_device_by_seq(UCLASS_MMC, mmc_dev, &dev); if (!err) *mmcp = mmc_get_mmc_dev(dev); #else But that feels like a pretty fundamental change to make across every board and I've no real idea if that would even be the right thing to do, or if I should be trying to fix this some other way. -- Alex Kiernan ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] Pull request: u-boot-sunxi/master
On Wed, Aug 1, 2018 at 4:43 PM, Tom Rini wrote: > On Tue, Jul 31, 2018 at 11:41:50PM +0530, Jagan Teki wrote: > >> Hi Tom, >> >> Please pull this PR. >> >> thanks, >> Jagan. >> >> The following changes since commit 5a0007d481c0fcd2d422dd48b2a129dd8e8a272a: >> >> Prepare v2017.09-rc1 (2018-07-30 21:47:29 -0400) >> >> are available in the Git repository at: >> >> git://git.denx.de/u-boot-sunxi.git master >> >> for you to fetch changes up to 89a897fc4d78e31332e5899e977d8bf3c82abafa: >> >> board: sun50i: h6: Add OrangePi One Plus initial support (2018-07-31 >> 20:50:01 +0530) >> > > For the moment, on hold. pine_h64 doesn't link (see > https://travis-ci.org/trini/u-boot/jobs/410579615) but I bet Andre's > changes to save some space on aarch64 will get it to fit in, and I need > to see if I'm ready to apply them. I though of inform the same, but for h6 atf need to use it from mainline here all a64 boards seems failing. I didn't reproduce this manually. +WARNING: BL31 file bl31.bin NOT found, resulting binary is non-functional ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] Two CRC32 implementation in U-Boot, why?
Hi, Currently it seems that we have two CRC32 implementation in U-Boot. Two headers files are provided. 1. include/linux/crc32.h The implementation is drivers/mtd/ubi/crc32.c. Codes that use this implementation include: drivers/mtd/ubi/* drivers/mtd/ubispl/* fs/ubifs/* 2. include/u-boot/crc.h The implementation is lib/crc32.c Codes that use this implementation include: fs/btrfs/hash.c tools/* common/hash.c common/image.c common/image-fit.c lib/efi_loader/efi_boottime.c It looks that include/linux/crc32.h was originally imported from Linux kernel's include/linux/crc32.h, but the implementation in Linux kernel's lib/crc32.c was not imported to U-Boot's lib/crc32.c but to drivers/mtd/ubi/crc32.c. Why? Somehow U-Boot lib/crc32.c uses another different implementation from zlib. This is a mess. For example if I include both headers in one C file, it won't compile. Can we clean this up? Regards, Bin ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] Pull request: u-boot-sunxi/master
On Wed, Aug 1, 2018 at 7:47 PM, Jagan Teki wrote: > On Wed, Aug 1, 2018 at 4:43 PM, Tom Rini wrote: >> On Tue, Jul 31, 2018 at 11:41:50PM +0530, Jagan Teki wrote: >> >>> Hi Tom, >>> >>> Please pull this PR. >>> >>> thanks, >>> Jagan. >>> >>> The following changes since commit 5a0007d481c0fcd2d422dd48b2a129dd8e8a272a: >>> >>> Prepare v2017.09-rc1 (2018-07-30 21:47:29 -0400) >>> >>> are available in the Git repository at: >>> >>> git://git.denx.de/u-boot-sunxi.git master >>> >>> for you to fetch changes up to 89a897fc4d78e31332e5899e977d8bf3c82abafa: >>> >>> board: sun50i: h6: Add OrangePi One Plus initial support (2018-07-31 >>> 20:50:01 +0530) >>> >> >> For the moment, on hold. pine_h64 doesn't link (see >> https://travis-ci.org/trini/u-boot/jobs/410579615) but I bet Andre's >> changes to save some space on aarch64 will get it to fit in, and I need >> to see if I'm ready to apply them. > > I though of inform the same, but for h6 atf need to use it from > mainline here all a64 boards seems failing. I didn't reproduce this > manually. > > +WARNING: BL31 file bl31.bin NOT found, resulting binary is non-functional The cause is obvious. The ATF blob is missing from the environment. If TravisCI is only used to test building, maybe we could just put an empty bl31.bin there to make it happy. ChenYu ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 0/8] ARM: Odroid XU3: Enable DM_MMC support which is necessary for CONFIG_BLK
This patch series provides following improvements to Odroid XU3: - Fix sdr_timing problem with DW_MMC running with DM - Clean up the defconfig file - Fix potential memory leak when running under DM (DW_MMC) - Rebase on newest ML - Remove the patch, which add support for booting only from SD card Travis-CI: https://travis-ci.org/lmajewski/u-boot-dfu/builds/410698980 SHA1: ae5afc37204e72ebe6e6844f70afff99db3bd910 Changes in v2: - Add tested-by - Rebase on the newest main line - Add tested-by - Rebase on the newest main line - Add tested-by - Rebase on the newest main line - Add tested-by - Rebase on the newest main line - Add tested-by - Rebase on the newest main line - Add tested-by - Rebase on the newest main line - Add tested-by - Rebase on the newest main line - Add tested-by - Rebase on the newest main line Lukasz Majewski (8): ARM: dw_mmc: Exclude dwmci Exynos priv_data allocation from exynos_dwmci_get_config() ARM: Odroid XU3: config: Disable SDHCI support in the Odroid XU3 ARM: Odroid XU3: Enable driver model support for MMC (DM_MMC) ARM: Odroid XU3: Fix autoboot.cmd to use ${mmcbootdev} instead of hardcoded 0 ARM: Odroid XU3: Adjust BOOT_TARGET_DEVICES to allow booting from SD card (mmc2) ARM: Odroid XU3: MAINTAINERS: Add a co-maintainer for OdroidXU3 ARM: Odroid XU3: Fix the dwmci_exynos *priv data assignment for DM_MMC (sdr_timing) ARM: Odroid XU3: Modify exynos dw_mmc driver to support Odroid XU3 in DM MMC board/samsung/common/bootscripts/autoboot.cmd | 6 ++--- board/samsung/smdk5420/MAINTAINERS| 1 + configs/odroid-xu3_defconfig | 3 +-- drivers/mmc/exynos_dw_mmc.c | 37 +++ include/configs/exynos5-common.h | 1 + 5 files changed, 27 insertions(+), 21 deletions(-) -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 1/8] ARM: dw_mmc: Exclude dwmci Exynos priv_data allocation from exynos_dwmci_get_config()
This commit prevents memory leak when this function is used with DM_MMC as the struct dwmci_exynos_priv_data is already allocated by DM. It is necessary for NON DM aware devices to allocate this struct first. Signed-off-by: Lukasz Majewski Tested-by: Anand Moon --- Changes in v2: - Add tested-by - Rebase on the newest main line drivers/mmc/exynos_dw_mmc.c | 30 +++--- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c index 865fdf4dbba0..49c4f7634830 100644 --- a/drivers/mmc/exynos_dw_mmc.c +++ b/drivers/mmc/exynos_dw_mmc.c @@ -146,17 +146,11 @@ static int do_dwmci_init(struct dwmci_host *host) } static int exynos_dwmci_get_config(const void *blob, int node, - struct dwmci_host *host) + struct dwmci_host *host, + struct dwmci_exynos_priv_data *priv) { int err = 0; u32 base, timing[3]; - struct dwmci_exynos_priv_data *priv; - - priv = malloc(sizeof(struct dwmci_exynos_priv_data)); - if (!priv) { - pr_err("dwmci_exynos_priv_data malloc fail!\n"); - return -ENOMEM; - } /* Extract device id for each mmc channel */ host->dev_id = pinmux_decode_periph_id(blob, node); @@ -167,7 +161,6 @@ static int exynos_dwmci_get_config(const void *blob, int node, if (host->dev_index > 4) { printf("DWMMC%d: Can't get the dev index\n", host->dev_index); - free(priv); return -EINVAL; } @@ -178,7 +171,6 @@ static int exynos_dwmci_get_config(const void *blob, int node, base = fdtdec_get_addr(blob, node, "reg"); if (!base) { printf("DWMMC%d: Can't get base address\n", host->dev_index); - free(priv); return -EINVAL; } host->ioaddr = (void *)base; @@ -188,7 +180,6 @@ static int exynos_dwmci_get_config(const void *blob, int node, if (err) { printf("DWMMC%d: Can't get sdr-timings for devider\n", host->dev_index); - free(priv); return -EINVAL; } @@ -208,14 +199,13 @@ static int exynos_dwmci_get_config(const void *blob, int node, host->bus_hz = fdtdec_get_int(blob, node, "bus_hz", 0); host->div = fdtdec_get_int(blob, node, "div", 0); - host->priv = priv; - return 0; } static int exynos_dwmci_process_node(const void *blob, int node_list[], int count) { + struct dwmci_exynos_priv_data *priv; struct dwmci_host *host; int i, node, err; @@ -224,11 +214,20 @@ static int exynos_dwmci_process_node(const void *blob, if (node <= 0) continue; host = &dwmci_host[i]; - err = exynos_dwmci_get_config(blob, node, host); + + priv = malloc(sizeof(struct dwmci_exynos_priv_data)); + if (!priv) { + pr_err("dwmci_exynos_priv_data malloc fail!\n"); + return -ENOMEM; + } + + err = exynos_dwmci_get_config(blob, node, host, priv); if (err) { printf("%s: failed to decode dev %d\n", __func__, i); + free(priv); return err; } + host->priv = priv; do_dwmci_init(host); } @@ -266,7 +265,8 @@ static int exynos_dwmmc_probe(struct udevice *dev) struct dwmci_host *host = &priv->host; int err; - err = exynos_dwmci_get_config(gd->fdt_blob, dev_of_offset(dev), host); + err = exynos_dwmci_get_config(gd->fdt_blob, dev_of_offset(dev), host, + priv); if (err) return err; err = do_dwmci_init(host); -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 2/8] ARM: Odroid XU3: config: Disable SDHCI support in the Odroid XU3
The Exynos5422 is solely using DW MMC IP block to support eMMC/SD devices, hence the SDHCI code doesn't need to be compiled it. Signed-off-by: Lukasz Majewski Tested-by: Anand Moon --- Changes in v2: - Add tested-by - Rebase on the newest main line configs/odroid-xu3_defconfig | 2 -- 1 file changed, 2 deletions(-) diff --git a/configs/odroid-xu3_defconfig b/configs/odroid-xu3_defconfig index 5943c19cf9b3..6398c2cd0d6a 100644 --- a/configs/odroid-xu3_defconfig +++ b/configs/odroid-xu3_defconfig @@ -30,8 +30,6 @@ CONFIG_ADC=y CONFIG_ADC_EXYNOS=y CONFIG_DFU_MMC=y CONFIG_MMC_DW=y -CONFIG_MMC_SDHCI=y -CONFIG_MMC_SDHCI_S5P=y CONFIG_NETDEVICES=y CONFIG_SMC911X=y CONFIG_SMC911X_BASE=0x500 -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 5/8] ARM: Odroid XU3: Adjust BOOT_TARGET_DEVICES to allow booting from SD card (mmc2)
This change is necessary to allow booting the Odroid XU3 from SD card after enabling the DM_MMC support. After this change the SD card mmc IP block is correctly enumerated as mmc2 (and not as mmc1 as in the legacy code). Signed-off-by: Lukasz Majewski Tested-by: Anand Moon --- Changes in v2: - Add tested-by - Rebase on the newest main line include/configs/exynos5-common.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/configs/exynos5-common.h b/include/configs/exynos5-common.h index a7621fc701b2..cd2a9046afec 100644 --- a/include/configs/exynos5-common.h +++ b/include/configs/exynos5-common.h @@ -138,6 +138,7 @@ #define BOOT_TARGET_DEVICES(func) \ func(MMC, mmc, 1) \ func(MMC, mmc, 0) \ + func(MMC, mmc, 2) \ func(PXE, pxe, na) \ func(DHCP, dhcp, na) -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 3/8] ARM: Odroid XU3: Enable driver model support for MMC (DM_MMC)
This commit enables support for DW_MMC running with driver model. Signed-off-by: Lukasz Majewski Tested-by: Anand Moon --- Changes in v2: - Add tested-by - Rebase on the newest main line configs/odroid-xu3_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/odroid-xu3_defconfig b/configs/odroid-xu3_defconfig index 6398c2cd0d6a..632542d98420 100644 --- a/configs/odroid-xu3_defconfig +++ b/configs/odroid-xu3_defconfig @@ -29,6 +29,7 @@ CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y CONFIG_ADC=y CONFIG_ADC_EXYNOS=y CONFIG_DFU_MMC=y +CONFIG_DM_MMC=y CONFIG_MMC_DW=y CONFIG_NETDEVICES=y CONFIG_SMC911X=y -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 6/8] ARM: Odroid XU3: MAINTAINERS: Add a co-maintainer for OdroidXU3
Signed-off-by: Lukasz Majewski Tested-by: Anand Moon --- Changes in v2: - Add tested-by - Rebase on the newest main line board/samsung/smdk5420/MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/board/samsung/smdk5420/MAINTAINERS b/board/samsung/smdk5420/MAINTAINERS index 590a1140b07e..31c00360f287 100644 --- a/board/samsung/smdk5420/MAINTAINERS +++ b/board/samsung/smdk5420/MAINTAINERS @@ -11,6 +11,7 @@ F:configs/peach-pi_defconfig ODROID-XU3 BOARD M: Jaehoon Chung +M: Lukasz Majewski S: Maintained F: board/samsung/smdk5420/ F: include/configs/odroid_xu3.h -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 8/8] ARM: Odroid XU3: Modify exynos dw_mmc driver to support Odroid XU3 in DM MMC
This commit enables support for Exynos Designware MMC driver based on DM. Signed-off-by: Lukasz Majewski Tested-by: Anand Moon --- Changes in v2: - Add tested-by - Rebase on the newest main line drivers/mmc/exynos_dw_mmc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c index cd0fa4c6341b..435ccac59421 100644 --- a/drivers/mmc/exynos_dw_mmc.c +++ b/drivers/mmc/exynos_dw_mmc.c @@ -295,6 +295,7 @@ static int exynos_dwmmc_bind(struct udevice *dev) static const struct udevice_id exynos_dwmmc_ids[] = { { .compatible = "samsung,exynos4412-dw-mshc" }, + { .compatible = "samsung,exynos-dwmmc" }, { } }; -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 4/8] ARM: Odroid XU3: Fix autoboot.cmd to use ${mmcbootdev} instead of hardcoded 0
This commit adjusts the autoboot.cmd file to use ${mmcbootdev} instead of hardcoded value 0. This is necessary to allow booting this board from the SD card. Signed-off-by: Lukasz Majewski Tested-by: Anand Moon --- Changes in v2: - Add tested-by - Rebase on the newest main line board/samsung/common/bootscripts/autoboot.cmd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/board/samsung/common/bootscripts/autoboot.cmd b/board/samsung/common/bootscripts/autoboot.cmd index 1faed8ba0c1a..11c724c4e095 100644 --- a/board/samsung/common/bootscripts/autoboot.cmd +++ b/board/samsung/common/bootscripts/autoboot.cmd @@ -74,15 +74,15 @@ setenv boot_img " Routine: autoboot - choose proper boot path setenv autoboot " -if test -e mmc 0:${mmcbootpart} Image.itb; then +if test -e mmc ${mmcbootdev}:${mmcbootpart} Image.itb; then echo Found kernel image: Image.itb; run setboot_fit; run boot_img; -elif test -e mmc 0:${mmcbootpart} zImage; then +elif test -e mmc ${mmcbootdev}:${mmcbootpart} zImage; then echo Found kernel image: zImage; run setboot_zimg; run boot_img; -elif test -e mmc 0:${mmcbootpart} uImage; then +elif test -e mmc ${mmcbootdev}:${mmcbootpart} uImage; then echo Found kernel image: uImage; run setboot_uimg; run boot_img; -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 7/8] ARM: Odroid XU3: Fix the dwmci_exynos *priv data assignment for DM_MMC (sdr_timing)
By convention for DM_MMC the host->priv is used to store struct udevice *dev pointer. Unfortunately, the legacy Exynos DW MMC code uses this field to store pointer to dwmci_exynos_priv_data struct Hence, we do need to get data in other way - namely by using container_of when host pointer is present. In this way the sdr_timing data is properly accessed. Signed-off-by: Lukasz Majewski Tested-by: Anand Moon --- Changes in v2: - Add tested-by - Rebase on the newest main line drivers/mmc/exynos_dw_mmc.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c index 49c4f7634830..cd0fa4c6341b 100644 --- a/drivers/mmc/exynos_dw_mmc.c +++ b/drivers/mmc/exynos_dw_mmc.c @@ -46,8 +46,12 @@ struct dwmci_exynos_priv_data { */ static void exynos_dwmci_clksel(struct dwmci_host *host) { +#ifdef CONFIG_DM_MMC + struct dwmci_exynos_priv_data *priv = + container_of(host, struct dwmci_exynos_priv_data, host); +#else struct dwmci_exynos_priv_data *priv = host->priv; - +#endif dwmci_writel(host, DWMCI_CLKSEL, priv->sdr_timing); } -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] Pull request: u-boot-sunxi/master
On Wed, Aug 01, 2018 at 08:43:17PM +0800, Chen-Yu Tsai wrote: > On Wed, Aug 1, 2018 at 7:47 PM, Jagan Teki wrote: > > On Wed, Aug 1, 2018 at 4:43 PM, Tom Rini wrote: > >> On Tue, Jul 31, 2018 at 11:41:50PM +0530, Jagan Teki wrote: > >> > >>> Hi Tom, > >>> > >>> Please pull this PR. > >>> > >>> thanks, > >>> Jagan. > >>> > >>> The following changes since commit > >>> 5a0007d481c0fcd2d422dd48b2a129dd8e8a272a: > >>> > >>> Prepare v2017.09-rc1 (2018-07-30 21:47:29 -0400) > >>> > >>> are available in the Git repository at: > >>> > >>> git://git.denx.de/u-boot-sunxi.git master > >>> > >>> for you to fetch changes up to 89a897fc4d78e31332e5899e977d8bf3c82abafa: > >>> > >>> board: sun50i: h6: Add OrangePi One Plus initial support (2018-07-31 > >>> 20:50:01 +0530) > >>> > >> > >> For the moment, on hold. pine_h64 doesn't link (see > >> https://travis-ci.org/trini/u-boot/jobs/410579615) but I bet Andre's > >> changes to save some space on aarch64 will get it to fit in, and I need > >> to see if I'm ready to apply them. > > > > I though of inform the same, but for h6 atf need to use it from > > mainline here all a64 boards seems failing. I didn't reproduce this > > manually. > > > > +WARNING: BL31 file bl31.bin NOT found, resulting binary is non-functional > > The cause is obvious. The ATF blob is missing from the environment. > If TravisCI is only used to test building, maybe we could just put an > empty bl31.bin there to make it happy. Please note that the above is NOT the problem. That's the non-fatal warning that your resulting binary won't work as there's no bl31.bin. The problem is: +aarch64-linux-ld.bfd: u-boot-spl section `.u_boot_list' will not fit in region `.sram' +aarch64-linux-ld.bfd: region `.sram' overflowed by 48 bytes +make[2]: *** [spl/u-boot-spl] Error 1 +make[1]: *** [spl/u-boot-spl] Error 2 +make: *** [sub-make] Error 2 -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] video: kconfig: remove DM_I2C dependency of I2C_EDID
On Mon, 30 Jul 2018 09:11:31 -0400 Luis Araneda luaran...@gmail.com wrote: > Hi, > > On Wed, Jul 4, 2018 at 2:40 AM Luis Araneda wrote: > > > > Drop the DM_I2C dependency, as the library only implements > > the parsing of EDID data and doesn't depend on any driver > > > > One user of this library, the i2c command, implements > > support for legacy and DM I2C drivers > > > > Tested on a Zynq board, whose I2C driver is not ported > > yet to DM > > > > Signed-off-by: Luis Araneda > > --- > > drivers/video/Kconfig | 1 - > > 1 file changed, 1 deletion(-) Applied to u-boot-video/master, thanks! -- Anatolij ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] Pull request: u-boot-sunxi/master
On Wed, Aug 1, 2018 at 8:55 PM, Tom Rini wrote: > On Wed, Aug 01, 2018 at 08:43:17PM +0800, Chen-Yu Tsai wrote: >> On Wed, Aug 1, 2018 at 7:47 PM, Jagan Teki >> wrote: >> > On Wed, Aug 1, 2018 at 4:43 PM, Tom Rini wrote: >> >> On Tue, Jul 31, 2018 at 11:41:50PM +0530, Jagan Teki wrote: >> >> >> >>> Hi Tom, >> >>> >> >>> Please pull this PR. >> >>> >> >>> thanks, >> >>> Jagan. >> >>> >> >>> The following changes since commit >> >>> 5a0007d481c0fcd2d422dd48b2a129dd8e8a272a: >> >>> >> >>> Prepare v2017.09-rc1 (2018-07-30 21:47:29 -0400) >> >>> >> >>> are available in the Git repository at: >> >>> >> >>> git://git.denx.de/u-boot-sunxi.git master >> >>> >> >>> for you to fetch changes up to 89a897fc4d78e31332e5899e977d8bf3c82abafa: >> >>> >> >>> board: sun50i: h6: Add OrangePi One Plus initial support (2018-07-31 >> >>> 20:50:01 +0530) >> >>> >> >> >> >> For the moment, on hold. pine_h64 doesn't link (see >> >> https://travis-ci.org/trini/u-boot/jobs/410579615) but I bet Andre's >> >> changes to save some space on aarch64 will get it to fit in, and I need >> >> to see if I'm ready to apply them. >> > >> > I though of inform the same, but for h6 atf need to use it from >> > mainline here all a64 boards seems failing. I didn't reproduce this >> > manually. >> > >> > +WARNING: BL31 file bl31.bin NOT found, resulting binary is non-functional >> >> The cause is obvious. The ATF blob is missing from the environment. >> If TravisCI is only used to test building, maybe we could just put an >> empty bl31.bin there to make it happy. > > Please note that the above is NOT the problem. That's the non-fatal > warning that your resulting binary won't work as there's no bl31.bin. > The problem is: > +aarch64-linux-ld.bfd: u-boot-spl section `.u_boot_list' will not fit in > region `.sram' > +aarch64-linux-ld.bfd: region `.sram' overflowed by 48 bytes > +make[2]: *** [spl/u-boot-spl] Error 1 > +make[1]: *** [spl/u-boot-spl] Error 2 > +make: *** [sub-make] Error 2 Yeah I noticed. Just pointing out if we want to get rid of the ATF noise. Thanks ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] Pull request: u-boot-sunxi/master
On Wed, Aug 01, 2018 at 08:58:10PM +0800, Chen-Yu Tsai wrote: > On Wed, Aug 1, 2018 at 8:55 PM, Tom Rini wrote: > > On Wed, Aug 01, 2018 at 08:43:17PM +0800, Chen-Yu Tsai wrote: > >> On Wed, Aug 1, 2018 at 7:47 PM, Jagan Teki > >> wrote: > >> > On Wed, Aug 1, 2018 at 4:43 PM, Tom Rini wrote: > >> >> On Tue, Jul 31, 2018 at 11:41:50PM +0530, Jagan Teki wrote: > >> >> > >> >>> Hi Tom, > >> >>> > >> >>> Please pull this PR. > >> >>> > >> >>> thanks, > >> >>> Jagan. > >> >>> > >> >>> The following changes since commit > >> >>> 5a0007d481c0fcd2d422dd48b2a129dd8e8a272a: > >> >>> > >> >>> Prepare v2017.09-rc1 (2018-07-30 21:47:29 -0400) > >> >>> > >> >>> are available in the Git repository at: > >> >>> > >> >>> git://git.denx.de/u-boot-sunxi.git master > >> >>> > >> >>> for you to fetch changes up to > >> >>> 89a897fc4d78e31332e5899e977d8bf3c82abafa: > >> >>> > >> >>> board: sun50i: h6: Add OrangePi One Plus initial support (2018-07-31 > >> >>> 20:50:01 +0530) > >> >>> > >> >> > >> >> For the moment, on hold. pine_h64 doesn't link (see > >> >> https://travis-ci.org/trini/u-boot/jobs/410579615) but I bet Andre's > >> >> changes to save some space on aarch64 will get it to fit in, and I need > >> >> to see if I'm ready to apply them. > >> > > >> > I though of inform the same, but for h6 atf need to use it from > >> > mainline here all a64 boards seems failing. I didn't reproduce this > >> > manually. > >> > > >> > +WARNING: BL31 file bl31.bin NOT found, resulting binary is > >> > non-functional > >> > >> The cause is obvious. The ATF blob is missing from the environment. > >> If TravisCI is only used to test building, maybe we could just put an > >> empty bl31.bin there to make it happy. > > > > Please note that the above is NOT the problem. That's the non-fatal > > warning that your resulting binary won't work as there's no bl31.bin. > > The problem is: > > +aarch64-linux-ld.bfd: u-boot-spl section `.u_boot_list' will not fit in > > region `.sram' > > +aarch64-linux-ld.bfd: region `.sram' overflowed by 48 bytes > > +make[2]: *** [spl/u-boot-spl] Error 1 > > +make[1]: *** [spl/u-boot-spl] Error 2 > > +make: *** [sub-make] Error 2 > > Yeah I noticed. Just pointing out if we want to get rid of the ATF noise. Ah, no. The noise is very intentional so that it's clear to humans that what they made won't boot. -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] efi_loader: don't allocate unusable RAM
>>> On 07/31/2018 02:03 PM, Alexander Graf wrote: > > Am 31.07.2018 um 21:44 schrieb Stephen Warren : > > From: Stephen Warren > > Some boards define a maximum usable RAM top that's more restrictive > than > the ranges defined by U-Boot's memory bank definitions[1]. In this > case, > the unusable RAM isn't mapped in the page tables, and so the EFI code > must > not attempt to allocate RAM from outside the usable regions. Fix > efi_find_free_memory() to detect when max_addr is unconstrained or out > of > range, and substitue a valid value. > > [1] For example, when some peripherals can't access RAM above 4GiB, > it's > simplest to force U-Boot's ram_top to a smaller value to avoid dealing > with this issue more explicitly. However, the RAM bank definitions > still > describe the unusable RAM so that the booted OS has access to it, since > the OS can typically deal with such restrictions in a more complex > manner. That's what we have the efi bounce buffers for. Can't we just enable those for tegra? >>> >>> >>> No, because that wouldn't help all the non-EFI code, or cause the RAM to >>> be mapped in the page tables due to the non-EFI code not needing it. >> >> >> The non-efi code can still rely on ram_top just fine, no? I was more >> thinking of enabling the bounce buffer config option as alternative to your >> patch. > > > A lot more besides enabling that option would have to be done. The issue > here is that EFI is attempting to use RAM that's not in the page tables and > hence crashes. Enabling bounce buffers alone isn't going to help that; we'd > also have to rejig the U-Boot MMU code to set up page table entries for the > entire of the RAM banks rather than just the usable RAM, and then we've have > to develop some new way of preventing U-Boot from mapping RAM that's part of > the RAM banks but shouldn't be mapped because e.g. it's part of the secure > carveout that can't be mapped in the MMU in order to ensure that the CPU > never pre-fetches that RAM to avoid taking security faults on the fetch. The > fact that ram_top is lower than the HW-defined RAM limit exists for reasons > other than just preventing use of RAM that some peripheral HW can't access, > so bounce buffers will only solve one of the causes, not everything. For reference on the TX1 this patch doesn't fix the problem I've seen on TX series that I previously sent the patch enabling the bounce buffer option on the TX2, if I enable bounce buffers it works as I need with or without this patch. I didn't test TX2 but can if it's useful (I had to power up the TX1 for other reasons this morning). Peter ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] SPL: fit signature: don´t strip off signature node and sub nodes from dtb
Hello, I have implemented verified boot in SPL and build my SPL image with "make EXT_DTB=/path/to/dtb/with/embedded/pub-key SPL". In the build process all nodes except chosen and config are stripped off for SPL and TPL builds. Don´t know if this is a good behavior to remove everything except the mentioned nodes... Probably there is another way to embed a precompiled dtb in the SPL image? The attached patch adds the needed signature and sub nodes for verified boot to cmd_fdtgrep in scripts/Makefile.lib. Best regards Johann Neuhauser DH electronics GmbH 0001-SPL-fit-signature-don-t-strip-off-signature-node-and.patch Description: 0001-SPL-fit-signature-don-t-strip-off-signature-node-and.patch ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] Converting to SPL_OF_CONTROL
On Wed, Aug 1, 2018 at 12:30 PM Johann Neuhauser wrote: > > Hello Alex, > > have you tried to set "u-boot,spl-boot-order" in choosen node? > > Take a look into: > doc/device-tree-bindings/chosen.txt > Thanks, I totally failed to see that. Let me have an investigate! > Best regards > > Johann Neuhauser > > -Ursprüngliche Nachricht- > Von: U-Boot [mailto:u-boot-boun...@lists.denx.de] Im Auftrag von Alex Kiernan > Gesendet: Mittwoch, 1. August 2018 12:42 > An: u-boot ; Simon Glass > Betreff: [U-Boot] Converting to SPL_OF_CONTROL > > I've long been trying to convert our board (AM3352) to all DM, after knocking > out lots of problems, I've run into one I can't seem to configure my way > around, when I enable SPL_OF_CONTROL. > > We have MMC2 as our boot device, with no MMC1 (and hence not present in the > DTB). Once we're into full U-Boot this is all okay, we get the board's MMC2 > appearing as mmc0 and everything's fine. > > My problem's during SPL, where the boot device is MMC2, the code tries to > lookup by devnum (which is 1 because it numbers from 0 at this point), which > doesn't exist. I'd expected aliases to work, but we don't seem to lookup up > by alias, only index, so I don't have any way that I can see of overriding it. > > If I make this change, then everything works (with the addition of an an > alias for mmc1 = &mmc2): > > diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index > 0b2f059570..b7544ba183 100644 > --- a/common/spl/spl_mmc.c > +++ b/common/spl/spl_mmc.c > @@ -131,7 +131,7 @@ static int spl_mmc_find_device(struct mmc **mmcp, > u32 boot_device) > } > > #if CONFIG_IS_ENABLED(DM_MMC) > - err = uclass_get_device(UCLASS_MMC, mmc_dev, &dev); > + err = uclass_get_device_by_seq(UCLASS_MMC, mmc_dev, &dev); > if (!err) > *mmcp = mmc_get_mmc_dev(dev); #else > > But that feels like a pretty fundamental change to make across every board > and I've no real idea if that would even be the right thing to do, or if I > should be trying to fix this some other way. > > -- > Alex Kiernan > ___ > U-Boot mailing list > U-Boot@lists.denx.de > https://lists.denx.de/listinfo/u-boot -- Alex Kiernan ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] U-Boot 2018.07 Still Broken for Allwinner H3 SoCs
On Tue, Jul 10, 2018 at 4:04 AM, Chen-Yu Tsai wrote: > This is on a Libre Computer ALL-H3-CC H3 variant. Still running a > bisect, but v2018.07-rc1 is a working version. From the EHCI error > messages, I'm thinking it might be related to the USB changes lately. > Not sure if any other SoCs (ex. A64) are broken or not at the moment. I'm still seeing this issue in 2018.09 RC1, what's the status of a fix for this? > See log: > > U-Boot SPL 2018.07 (Jul 10 2018 - 10:21:03 +0800) > DRAM: 1024 MiB > Trying to boot from MMC1 > > > U-Boot 2018.07 (Jul 10 2018 - 10:21:03 +0800) Allwinner Technology > > CPU: Allwinner H3 (SUN8I 1680) > Model: Libre Computer Board ALL-H3-CC H3 > DRAM: 1 GiB > MMC: SUNXI SD/MMC: 0 > Loading Environment from FAT... Unable to use mmc 0:1... Failed (-5) > In:serial > Out: serial > Err: serial > Net: phy interface0 > eth0: ethernet@1c3 > starting USB... > USB0: USB EHCI 1.00 > USB1: USB OHCI 1.0 > USB2: USB EHCI 1.00 > USB3: USB OHCI 1.0 > USB4: USB EHCI 1.00 > USB5: USB OHCI 1.0 > scanning bus 0 for devices... 1 USB Device(s) found > scanning bus 2 for devices... 1 USB Device(s) found > scanning bus 4 for devices... 1 USB Device(s) found >scanning usb for storage devices... 0 Storage Device(s) found > Hit any key to stop autoboot: 0 > switch to partitions #0, OK > mmc0 is current device > Scanning mmc 0:1... > Found U-Boot script /boot/boot.scr > 385 bytes read in 8 ms (46.9 KiB/s) > ## Executing script at 4310 > 6343768 bytes read in 295 ms (20.5 MiB/s) > 18710 bytes read in 10 ms (1.8 MiB/s) > ## Flattened Device Tree blob at 4300 >Booting using the fdt blob at 0x4300 > EHCI failed to shut down host controller. > EHCI failed to shut down host controller. > EHCI failed to shut down host controller. >Loading Device Tree to 49ff8000, end 49fff915 ... OK > > Starting kernel ... > > data abort > pc : [<7dfadc6c>] lr : [<7df82ed7>] > reloc pc : [<4a02bc6c>]lr : [<4a000ed7>] > sp : 79f5ce90 ip : 79f62b8a fp : 0003 > r10: 7dfc3d14 r9 : 79f61ed8 r8 : 0400 > r7 : r6 : 4200 r5 : 49ff8000 r4 : > r3 : 49ff8000 r2 : 49ff8000 r1 : r0 : > Flags: nZCv IRQs off FIQs off Mode UK6_32 > Code: e12fff1e e52de008 fa01 e3a0 (e49df008) > Resetting CPU ... > > resetting ... > ___ > U-Boot mailing list > U-Boot@lists.denx.de > https://lists.denx.de/listinfo/u-boot ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] Two CRC32 implementation in U-Boot, why?
On 08/01/2018 02:13 PM, Bin Meng wrote: > Hi, > > Currently it seems that we have two CRC32 implementation in U-Boot. > Two headers files are provided. > > 1. include/linux/crc32.h > The implementation is drivers/mtd/ubi/crc32.c. > Codes that use this implementation include: > > drivers/mtd/ubi/* > drivers/mtd/ubispl/* > fs/ubifs/* > > 2. include/u-boot/crc.h > The implementation is lib/crc32.c > Codes that use this implementation include: > > fs/btrfs/hash.c > tools/* > common/hash.c > common/image.c > common/image-fit.c > lib/efi_loader/efi_boottime.c > > It looks that include/linux/crc32.h was originally imported from Linux > kernel's include/linux/crc32.h, but the implementation in Linux > kernel's lib/crc32.c was not imported to U-Boot's lib/crc32.c but to > drivers/mtd/ubi/crc32.c. Why? > > Somehow U-Boot lib/crc32.c uses another different implementation from zlib. > > This is a mess. For example if I include both headers in one C file, > it won't compile. > > Can we clean this up? Thanks for pointing this out. The drivers/mtd/ubi/crc32.c is based on an elder version of Linux. When looking at the function signatures I am not happy with include/u-boot/crc.h uint32_t crc32 (uint32_t, const unsigned char *, uint) The last parameter should be size_t. Otherwise the CRC may be wrong on 64bit systems. The two crc32 implementations do not have the same result on a low-endian system: crc32_le(0, 'U-Boot', 6) = a289ac17 crc32(0, 'U-Boot', 6) = 134b0db4. According to the comments in in include/linux/crc32.h the result of crc32_le is in bit reversed order. Conflicting definitions could be avoided by removing #define crc32() in include/linux/crc32.h and adjusting the ubi code accordingly. Best regards Heinrich ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v1 1/2] dm: serial: Replace setparity by setconfig
Hi Patrice, On 31 July 2018 at 07:53, Patrice CHOTARD wrote: > > Hi Simon > > On 07/31/2018 01:52 PM, Simon Glass wrote: > > Hi Patrice, > > > > On 30 July 2018 at 09:23, Patrice Chotard wrote: > >> From: Patrick Delaunay > >> > >> Replace setparity by more generic setconfig ops > >> to allow uart parity, bits word length and stop bits > >> number change. > >> > >> Adds SERIAL_GET_PARITY/BITS/STOP macros. > >> > >> Signed-off-by: Patrick Delaunay > >> Signed-off-by: Patrice Chotard > >> --- > >> > >> drivers/serial/serial-uclass.c | 14 ++ > >> include/serial.h | 42 > >> +++--- > >> 2 files changed, 53 insertions(+), 3 deletions(-) > >> > >> diff --git a/drivers/serial/serial-uclass.c > >> b/drivers/serial/serial-uclass.c > >> index 321d23ee93bf..9f523751ce17 100644 > >> --- a/drivers/serial/serial-uclass.c > >> +++ b/drivers/serial/serial-uclass.c > >> @@ -287,6 +287,18 @@ void serial_setbrg(void) > >> ops->setbrg(gd->cur_serial_dev, gd->baudrate); > >> } > >> > >> +void serial_setconfig(u8 config) > >> +{ > >> + struct dm_serial_ops *ops; > >> + > >> + if (!gd->cur_serial_dev) > >> + return; > >> + > >> + ops = serial_get_ops(gd->cur_serial_dev); > >> + if (ops->setconfig) > >> + ops->setconfig(gd->cur_serial_dev, config); > >> +} > >> + > >> void serial_stdio_init(void) > >> { > >> } > >> @@ -398,6 +410,8 @@ static int serial_post_probe(struct udevice *dev) > >> ops->pending += gd->reloc_off; > >> if (ops->clear) > >> ops->clear += gd->reloc_off; > >> + if (ops->setconfig) > >> + ops->setconfig += gd->reloc_off; > >> #if CONFIG_POST & CONFIG_SYS_POST_UART > >> if (ops->loop) > >> ops->loop += gd->reloc_off > >> diff --git a/include/serial.h b/include/serial.h > >> index b9ef6d91c9c5..61c1362e9e32 100644 > >> --- a/include/serial.h > >> +++ b/include/serial.h > >> @@ -73,6 +73,39 @@ enum serial_par { > >> SERIAL_PAR_EVEN > >> }; > >> > >> +#define SERIAL_PAR_MASK0x03 > >> +#define SERIAL_PAR_SHIFT 0 > >> +#define SERIAL_GET_PARITY(config) \ > >> + ((config & SERIAL_PAR_MASK) >> SERIAL_PAR_SHIFT) > >> + > >> +enum serial_bits { > >> + SERIAL_5_BITS, > >> + SERIAL_6_BITS, > >> + SERIAL_7_BITS, > >> + SERIAL_8_BITS > >> +}; > >> + > >> +#define SERIAL_BITS_MASK 0x0C > >> +#define SERIAL_BITS_SHIFT 2 > > > > For consistency: > > > > #define SERIAL_BITS_SHIFT 2 > > #define SERIAL_BITS_MASK (0x3 << SERIAL_BITS_SHIFT) > > Ok > > > > >> +#define SERIAL_GET_BITS(config) \ > >> + ((config & SERIAL_BITS_MASK) >> SERIAL_BITS_SHIFT) > >> + > >> +enum serial_stop { > >> + SERIAL_HALF_STOP, /* 0.5 stop bit */ > >> + SERIAL_ONE_STOP,/* 1 stop bit */ > >> + SERIAL_ONE_HALF_STOP, /* 1.5 stop bit */ > >> + SERIAL_TWO_STOP /* 2 stop bit */ > >> +}; > >> + > >> +#define SERIAL_STOP_MASK 0x30 > >> +#define SERIAL_STOP_SHIFT 4 > > > > same here > > ok > > > > >> +#define SERIAL_GET_STOP(config) \ > >> + ((config & SERIAL_STOP_MASK) >> SERIAL_STOP_SHIFT) > >> + > >> +#define SERIAL_DEFAULT_CONFIG SERIAL_PAR_NONE << SERIAL_PAR_SHIFT | \ > >> + SERIAL_8_BITS << SERIAL_BITS_SHIFT | \ > >> + SERIAL_ONE_STOP << SERIAL_STOP_SHIFT > >> + > >> /** > >>* struct struct dm_serial_ops - Driver model serial operations > >>* > >> @@ -150,15 +183,18 @@ struct dm_serial_ops { > >> int (*loop)(struct udevice *dev, int on); > >> #endif > >> /** > >> -* setparity() - Set up the parity > >> +* setconfig() - Set up the uart configuration > >> +* (parity, 5/6/7/8 bits word length, stop bits) > >> * > >> -* Set up a new parity for this device. > >> +* Set up a new config for this device. > >> * > >> * @dev: Device pointer > >> * @parity: parity to use > >> +* @bits: bits number to use > >> +* @stop: stop bits number to use > >> * @return 0 if OK, -ve on error > >> */ > >> - int (*setparity)(struct udevice *dev, enum serial_par parity); > >> + int (*setconfig)(struct udevice *dev, u8 serial_config); > > > > Please make this uint instead of u8. There is no point in using u8 > > since the compiler will use a register anyway. It can only make code > > size worse, if the compile add masking, etc. > > ok > > > > >> }; > >> > >> /** > >> -- > >> 1.9.1 > >> > > > > Also you need a serial_setconfig() function call in the uclass so > > people can call it. > > I already add serial_setconfig() function call in serial-uclass at the > beginning of this patch ;-) OK good. Please change u8 there too :-) > > > > > Perhaps that could have separate para
Re: [U-Boot] Please pull u-boot-mpc85xx master
On Tue, Jul 31, 2018 at 05:25:52PM +, York Sun wrote: > Tom, > > The following changes since commit 2547e91dc15e5203e15d4ebde9172174743b14a7: > > tegra: Indicate that binman makes all three output files (2018-07-26 > 15:49:40 -0400) > > are available in the git repository at: > > git://git.denx.de/u-boot-mpc85xx.git > > for you to fetch changes up to 9dcb9d763d328da903194d0f14f97d9620a6f52d: > > Revert "powerpc/T104xRDB: Fix endian access issue on EHCI > intinalization" (2018-07-31 10:19:42 -0700) > Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] Please pull ARC changes or 2018.09-rc2
On Tue, Jul 31, 2018 at 04:59:33AM +, Alexey Brodkin wrote: > Hi Tom, > > The following changes since commit 5a0007d481c0fcd2d422dd48b2a129dd8e8a272a: > > Prepare v2017.09-rc1 (2018-07-30 21:47:29 -0400) > > are available in the Git repository at: > > git://git.denx.de/u-boot-arc.git tags/arc-updates-for-2018.09-rc2 > > for you to fetch changes up to 8f590063ba635264303b1713c421df331743fd46: > > ARC: Enable unaligned access in hardware if compiler uses it (2018-07-31 > 07:49:47 +0300) > Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [ v2 02/10] video: stm32: stm32_ltdc: add bridge to display controller
On Fri, 13 Jul 2018 14:11:10 +0200 Yannick Fertré yannick.fer...@st.com wrote: > Manage a bridge insert between the display controller & a panel. > > Signed-off-by: Yannick Fertré > --- > drivers/video/stm32/stm32_ltdc.c | 154 > +++ > 1 file changed, 92 insertions(+), 62 deletions(-) > > diff --git a/drivers/video/stm32/stm32_ltdc.c > b/drivers/video/stm32/stm32_ltdc.c > index dc6c889..4a1db5e 100644 > --- a/drivers/video/stm32/stm32_ltdc.c > +++ b/drivers/video/stm32/stm32_ltdc.c ... > @@ -330,96 +328,128 @@ static int stm32_ltdc_probe(struct udevice *dev) > struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev); > struct video_priv *uc_priv = dev_get_uclass_priv(dev); > struct stm32_ltdc_priv *priv = dev_get_priv(dev); > - struct udevice *panel; > +#ifdef CONFIG_VIDEO_BRIDGE > + struct udevice *bridge = NULL; > +#endif Please drop ifdef here. See below. ... > - rate = clk_set_rate(&pclk, priv->timing.pixelclock.typ); > - if (rate < 0) { > - debug("%s: fail to set pixel clock %d hz %d hz\n", > - __func__, priv->timing.pixelclock.typ, rate); > - return rate; > +#ifdef CONFIG_VIDEO_BRIDGE > + ret = uclass_get_device(UCLASS_VIDEO_BRIDGE, 0, &bridge); > + if (ret) > + debug("No video bridge, or no backlight on bridge\n"); > + > + if (bridge) { > + ret = video_bridge_attach(bridge); > + if (ret) { > + dev_err(dev, "fail to attach bridge\n"); > + return ret; > + } > } > - > - debug("%s: Set pixel clock req %d hz get %d hz\n", __func__, > - priv->timing.pixelclock.typ, rate); > - > +#endif Can we do without ifdefs and use IS_ENABLED() instead ? E.g. like: if (IS_ENABLED(CONFIG_VIDEO_BRIDGE)) { ret = uclass_get_device(UCLASS_VIDEO_BRIDGE, 0, &bridge); ... } ... > +#ifdef CONFIG_VIDEO_BRIDGE > + if (bridge) { > + ret = video_bridge_set_backlight(bridge, 80); > + if (ret) { > + dev_err(dev, "fail to set backlight\n"); > + return ret; > + } > + } else { > + ret = panel_enable_backlight(panel); > + if (ret) { > + dev_err(dev, "panel %s enable backlight error %d\n", > + panel->name, ret); > + return ret; > + } > + } > +#else > + ret = panel_enable_backlight(panel); > + if (ret) { > + dev_err(dev, "panel %s enable backlight error %d\n", > + panel->name, ret); > + return ret; > + } > +#endif Please reduce code duplication: if (!bridge) { ret = panel_enable_backlight(panel); if (ret) { dev_err(dev, "panel %s enable backlight error %d\n", panel->name, ret); return ret; } } else if (IS_ENABLED(CONFIG_VIDEO_BRIDGE)) { ret = video_bridge_set_backlight(bridge, 80); if (ret) { dev_err(dev, "fail to set backlight\n"); return ret; } } -- Anatolij ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] Converting to SPL_OF_CONTROL
Hi Johann On Wed, Aug 1, 2018 at 2:18 PM Alex Kiernan wrote: > > On Wed, Aug 1, 2018 at 12:30 PM Johann Neuhauser > wrote: > > > > Hello Alex, > > > > have you tried to set "u-boot,spl-boot-order" in choosen node? > > > > Take a look into: > > doc/device-tree-bindings/chosen.txt > > > > Thanks, I totally failed to see that. > > Let me have an investigate! > So that only seems to be implemented for rockchip, but it certainly looks like it's solving the kind of problem I have. The big thing you've made me realise is that board_boot_order() is a weak function that I can override... I'll see what I can do starting from the rockchip code. Thanks! > > Best regards > > > > Johann Neuhauser > > > > -Ursprüngliche Nachricht- > > Von: U-Boot [mailto:u-boot-boun...@lists.denx.de] Im Auftrag von Alex > > Kiernan > > Gesendet: Mittwoch, 1. August 2018 12:42 > > An: u-boot ; Simon Glass > > Betreff: [U-Boot] Converting to SPL_OF_CONTROL > > > > I've long been trying to convert our board (AM3352) to all DM, after > > knocking out lots of problems, I've run into one I can't seem to configure > > my way around, when I enable SPL_OF_CONTROL. > > > > We have MMC2 as our boot device, with no MMC1 (and hence not present in the > > DTB). Once we're into full U-Boot this is all okay, we get the board's MMC2 > > appearing as mmc0 and everything's fine. > > > > My problem's during SPL, where the boot device is MMC2, the code tries to > > lookup by devnum (which is 1 because it numbers from 0 at this point), > > which doesn't exist. I'd expected aliases to work, but we don't seem to > > lookup up by alias, only index, so I don't have any way that I can see of > > overriding it. > > > > If I make this change, then everything works (with the addition of an an > > alias for mmc1 = &mmc2): > > > > diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index > > 0b2f059570..b7544ba183 100644 > > --- a/common/spl/spl_mmc.c > > +++ b/common/spl/spl_mmc.c > > @@ -131,7 +131,7 @@ static int spl_mmc_find_device(struct mmc **mmcp, > > u32 boot_device) > > } > > > > #if CONFIG_IS_ENABLED(DM_MMC) > > - err = uclass_get_device(UCLASS_MMC, mmc_dev, &dev); > > + err = uclass_get_device_by_seq(UCLASS_MMC, mmc_dev, &dev); > > if (!err) > > *mmcp = mmc_get_mmc_dev(dev); #else > > > > But that feels like a pretty fundamental change to make across every board > > and I've no real idea if that would even be the right thing to do, or if I > > should be trying to fix this some other way. > > > > -- > > Alex Kiernan > > ___ > > U-Boot mailing list > > U-Boot@lists.denx.de > > https://lists.denx.de/listinfo/u-boot > > > > -- > Alex Kiernan -- Alex Kiernan ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 2/3] serial: stm32: Replace setparity by setconfig
Replace stm32_serial_setparity by stm32_serial_setconfig which allows to set serial bits number, parity and stop bits number. Only parity setting is implemented. Signed-off-by: Patrick Delaunay Signed-off-by: Patrice Chotard --- Changes in v2: - Update stm32_serial_setconfig prototype drivers/serial/serial_stm32.c | 21 +++-- 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/drivers/serial/serial_stm32.c b/drivers/serial/serial_stm32.c index f26234549c3e..53866a23e6fc 100644 --- a/drivers/serial/serial_stm32.c +++ b/drivers/serial/serial_stm32.c @@ -47,20 +47,28 @@ static int stm32_serial_setbrg(struct udevice *dev, int baudrate) return 0; } -static int stm32_serial_setparity(struct udevice *dev, enum serial_par parity) +static int stm32_serial_setconfig(struct udevice *dev, uint serial_config) { struct stm32x7_serial_platdata *plat = dev_get_platdata(dev); bool stm32f4 = plat->uart_info->stm32f4; u8 uart_enable_bit = plat->uart_info->uart_enable_bit; u32 cr1 = plat->base + CR1_OFFSET(stm32f4); u32 config = 0; - - if (stm32f4) - return -EINVAL; /* not supported in driver*/ + u8 parity = SERIAL_GET_PARITY(serial_config); + u8 bits = SERIAL_GET_BITS(serial_config); + u8 stop = SERIAL_GET_STOP(serial_config); + + /* +* only parity config is implemented, check if other serial settings +* are the default one. +* (STM32F4 serial IP didn't support parity setting) +*/ + if (bits != SERIAL_8_BITS || stop != SERIAL_ONE_STOP || stm32f4) + return -ENOTSUPP; /* not supported in driver*/ clrbits_le32(cr1, USART_CR1_RE | USART_CR1_TE | BIT(uart_enable_bit)); /* update usart configuration (uart need to be disable) -* PCE: parity check control +* PCE: parity check enable * PS : '0' : Even / '1' : Odd * M[1:0] = '00' : 8 Data bits * M[1:0] = '01' : 9 Data bits with parity @@ -77,6 +85,7 @@ static int stm32_serial_setparity(struct udevice *dev, enum serial_par parity) config = USART_CR1_PCE | USART_CR1_M0; break; } + clrsetbits_le32(cr1, USART_CR1_PCE | USART_CR1_PS | USART_CR1_M1 | USART_CR1_M0, @@ -210,7 +219,7 @@ static const struct dm_serial_ops stm32_serial_ops = { .pending = stm32_serial_pending, .getc = stm32_serial_getc, .setbrg = stm32_serial_setbrg, - .setparity = stm32_serial_setparity + .setconfig = stm32_serial_setconfig }; U_BOOT_DRIVER(serial_stm32) = { -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 3/3] sandbox: Add serial test
Signed-off-by: Patrice Chotard --- Changes in v2: - Add sandbox serial test drivers/serial/sandbox.c | 14 ++ include/common.h | 1 + test/dm/Makefile | 1 + test/dm/serial.c | 26 ++ 4 files changed, 42 insertions(+) create mode 100644 test/dm/serial.c diff --git a/drivers/serial/sandbox.c b/drivers/serial/sandbox.c index a60dabe58835..94b4fdfb1714 100644 --- a/drivers/serial/sandbox.c +++ b/drivers/serial/sandbox.c @@ -143,6 +143,19 @@ static int sandbox_serial_getc(struct udevice *dev) return result; } +static int sandbox_serial_setconfig(struct udevice *dev, uint serial_config) +{ + u8 parity = SERIAL_GET_PARITY(serial_config); + u8 bits = SERIAL_GET_BITS(serial_config); + u8 stop = SERIAL_GET_STOP(serial_config); + + if (bits != SERIAL_8_BITS || stop != SERIAL_ONE_STOP || + parity != SERIAL_PAR_NONE) + return -ENOTSUPP; /* not supported in driver*/ + + return 0; +} + static const char * const ansi_colour[] = { "black", "red", "green", "yellow", "blue", "megenta", "cyan", "white", @@ -173,6 +186,7 @@ static const struct dm_serial_ops sandbox_serial_ops = { .putc = sandbox_serial_putc, .pending = sandbox_serial_pending, .getc = sandbox_serial_getc, + .setconfig = sandbox_serial_setconfig, }; static const struct udevice_id sandbox_serial_ids[] = { diff --git a/include/common.h b/include/common.h index 940161f1758b..5c952af5e319 100644 --- a/include/common.h +++ b/include/common.h @@ -359,6 +359,7 @@ voidserial_putc_raw(const char); void serial_puts (const char *); intserial_getc (void); intserial_tstc (void); +intserial_setconfig(uint config); /* $(CPU)/speed.c */ intget_clocks (void); diff --git a/test/dm/Makefile b/test/dm/Makefile index d2ed96c61533..97517c7f825e 100644 --- a/test/dm/Makefile +++ b/test/dm/Makefile @@ -44,4 +44,5 @@ obj-$(CONFIG_DM_VIDEO) += video.o obj-$(CONFIG_ADC) += adc.o obj-$(CONFIG_SPMI) += spmi.o obj-$(CONFIG_WDT) += wdt.o +obj-$(CONFIG_DM_SERIAL) += serial.o endif diff --git a/test/dm/serial.c b/test/dm/serial.c new file mode 100644 index ..4d8422eebd34 --- /dev/null +++ b/test/dm/serial.c @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2018, STMicroelectronics + */ + +#include +#include +#include +#include +#include + +static int dm_test_serial(struct unit_test_state *uts) +{ + struct udevice *dev_serial; + + ut_assertok(uclass_get_device_by_name(UCLASS_SERIAL, "serial", + &dev_serial)); + + ut_assertok(serial_tstc()); + + ut_assertok(serial_setconfig(SERIAL_DEFAULT_CONFIG)); + + return 0; +} + +DM_TEST(dm_test_serial, DM_TESTF_SCAN_FDT); -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 0/3] Replace serial setparity by setconfig
This series : - replace setparity ops by more complete setconfig in serial uclass - replace setparity by setconfig in STM32 serial driver Changes in v2: - Update SERIAL_BITS_MASK and SERIAL_STOP_MASK - Update serial_setconfig prototype - Update stm32_serial_setconfig prototype - Add sandbox serial test Patrice Chotard (2): serial: stm32: Replace setparity by setconfig sandbox: Add serial test Patrick Delaunay (1): dm: serial: Replace setparity by setconfig drivers/serial/sandbox.c | 14 ++ drivers/serial/serial-uclass.c | 16 drivers/serial/serial_stm32.c | 21 +++-- include/common.h | 1 + include/serial.h | 42 +++--- test/dm/Makefile | 1 + test/dm/serial.c | 26 ++ 7 files changed, 112 insertions(+), 9 deletions(-) create mode 100644 test/dm/serial.c -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 1/3] dm: serial: Replace setparity by setconfig
From: Patrick Delaunay Replace setparity by more generic setconfig ops to allow uart parity, bits word length and stop bits number change. Adds SERIAL_GET_PARITY/BITS/STOP macros. Signed-off-by: Patrick Delaunay Signed-off-by: Patrice Chotard --- Changes in v2: - Update SERIAL_BITS_MASK and SERIAL_STOP_MASK - Update serial_setconfig prototype drivers/serial/serial-uclass.c | 16 include/serial.h | 42 +++--- 2 files changed, 55 insertions(+), 3 deletions(-) diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c index 321d23ee93bf..a7556c9b7bc3 100644 --- a/drivers/serial/serial-uclass.c +++ b/drivers/serial/serial-uclass.c @@ -287,6 +287,20 @@ void serial_setbrg(void) ops->setbrg(gd->cur_serial_dev, gd->baudrate); } +int serial_setconfig(uint config) +{ + struct dm_serial_ops *ops; + + if (!gd->cur_serial_dev) + return 0; + + ops = serial_get_ops(gd->cur_serial_dev); + if (ops->setconfig) + return ops->setconfig(gd->cur_serial_dev, config); + + return 0; +} + void serial_stdio_init(void) { } @@ -398,6 +412,8 @@ static int serial_post_probe(struct udevice *dev) ops->pending += gd->reloc_off; if (ops->clear) ops->clear += gd->reloc_off; + if (ops->setconfig) + ops->setconfig += gd->reloc_off; #if CONFIG_POST & CONFIG_SYS_POST_UART if (ops->loop) ops->loop += gd->reloc_off diff --git a/include/serial.h b/include/serial.h index b9ef6d91c9c5..4f104f6a7188 100644 --- a/include/serial.h +++ b/include/serial.h @@ -73,6 +73,39 @@ enum serial_par { SERIAL_PAR_EVEN }; +#define SERIAL_PAR_MASK0x03 +#define SERIAL_PAR_SHIFT 0 +#define SERIAL_GET_PARITY(config) \ + ((config & SERIAL_PAR_MASK) >> SERIAL_PAR_SHIFT) + +enum serial_bits { + SERIAL_5_BITS, + SERIAL_6_BITS, + SERIAL_7_BITS, + SERIAL_8_BITS +}; + +#define SERIAL_BITS_SHIFT 2 +#define SERIAL_BITS_MASK (0x3 << SERIAL_BITS_SHIFT) +#define SERIAL_GET_BITS(config) \ + ((config & SERIAL_BITS_MASK) >> SERIAL_BITS_SHIFT) + +enum serial_stop { + SERIAL_HALF_STOP, /* 0.5 stop bit */ + SERIAL_ONE_STOP,/* 1 stop bit */ + SERIAL_ONE_HALF_STOP, /* 1.5 stop bit */ + SERIAL_TWO_STOP /* 2 stop bit */ +}; + +#define SERIAL_STOP_SHIFT 4 +#define SERIAL_STOP_MASK (0x3 << SERIAL_STOP_SHIFT) +#define SERIAL_GET_STOP(config) \ + ((config & SERIAL_STOP_MASK) >> SERIAL_STOP_SHIFT) + +#define SERIAL_DEFAULT_CONFIG SERIAL_PAR_NONE << SERIAL_PAR_SHIFT | \ + SERIAL_8_BITS << SERIAL_BITS_SHIFT | \ + SERIAL_ONE_STOP << SERIAL_STOP_SHIFT + /** * struct struct dm_serial_ops - Driver model serial operations * @@ -150,15 +183,18 @@ struct dm_serial_ops { int (*loop)(struct udevice *dev, int on); #endif /** -* setparity() - Set up the parity +* setconfig() - Set up the uart configuration +* (parity, 5/6/7/8 bits word length, stop bits) * -* Set up a new parity for this device. +* Set up a new config for this device. * * @dev: Device pointer * @parity: parity to use +* @bits: bits number to use +* @stop: stop bits number to use * @return 0 if OK, -ve on error */ - int (*setparity)(struct udevice *dev, enum serial_par parity); + int (*setconfig)(struct udevice *dev, uint serial_config); }; /** -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [ v2 01/10] dm: panel: get timings from panel
On Fri, 13 Jul 2018 14:11:09 +0200 Yannick Fertré yannick.fer...@st.com wrote: > Get timings from panel instead of read device tree. > > Signed-off-by: Yannick Fertré > --- > drivers/video/panel-uclass.c | 11 +++ > include/panel.h | 18 ++ > 2 files changed, 29 insertions(+) Applied to u-boot-video/master, thanks! -- Anatolij ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] efi_loader: don't allocate unusable RAM
On 08/01/2018 12:07 AM, Heinrich Schuchardt wrote: On 07/31/2018 09:44 PM, Stephen Warren wrote: From: Stephen Warren Some boards define a maximum usable RAM top that's more restrictive than the ranges defined by U-Boot's memory bank definitions[1]. In this case, the unusable RAM isn't mapped in the page tables, and so the EFI code must not attempt to allocate RAM from outside the usable regions. Fix efi_find_free_memory() to detect when max_addr is unconstrained or out of range, and substitue a valid value. In this case the board has to call efi_add_memory_map() to mark the reserved region (cf. board/raspberrypi/rpi/rpi.c) or have to mark the memory region as reserved in the device tree (see efi_carve_out_dt_rsv()). Please, check if the tegra boards with which you had problems do so. I don't think this makes sense; memory should be managed the same way within U-Boot no matter which part of U-Boot is consuming that memory. Memory regions are currently represented by the content of the memory bank definitions and gd->ram_top. Having different parts of the code define legal RAM usage in different ways is horribly inconsistent. At this point, I think the best thing is to revert aa909462d018 "efi_loader: efi_allocate_pages is too restrictive" since it causes a regression on Jetson TX1, and we can work out the correct way to fix all this once the system is working again. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] ARM: socfpga: Convert to DM serial
On 08/01/2018 05:42 PM, Simon Goldschmidt wrote: > > > Marek Vasut mailto:ma...@denx.de>> schrieb am Mi., 1. > Aug. 2018, 09:35: > > On 08/01/2018 09:29 AM, Goldschmidt Simon wrote: > > > > On 30.07.2018 16:04, Marek Vasut wrote: > >> On 07/30/2018 04:03 PM, Simon Goldschmidt wrote: > >>> > >>> On 12.05.2018 22:28, Marek Vasut wrote: > Pull the serial port configuration from DT and use DM serial > instead > of having the serial configuration in two places, DT and board > config. > [..] > > > While debugging, a more generic question: which drivers are now > remaining non-DM for socfpga? Not much I believe, I can't think of anything right now. > And am I correct with the assumption that we could get rid of the qts > files (other than sdram maybe) by implementing pinctrl and clk drivers > as DM drivers? (Not that I would have found documentation about the pin > mux hardware cyclone5...) Yes. The pinmux docs are probably not public, it has to do with the iocsr ring programming and that's super-secret for whatever reason. What Altera did on Arria10 is pure trash, they encode registers in DT and are done with it. If you can design something saner, that'd be so nice. I am working on a clock driver for Arria10 now, I might do Gen5 too afterward, since the clock block is similar. The clock DT bindings on the other hand are complete insanity, words fail me. The clock stuff in U-Boot on SoCFPGA right now is a complete disaster too, the way stuff gets added to mach-socfpga is really irritating. > I'm looking for a way to control pins from a fit image that includes > kernel, dts and fpga because the pins may change depending on the fpga > config... DTOs maybe ? > Simon (from my private mail) -- Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v1 0/5] Add get_function_number ops
This series : - Add new gpio ops get_function_number - Add get_function and get_function_number support to stm32 gpio driver - Add get_function_number test Christophe Kerello (1): gpio: stm32f7: Add ops get_function Patrice Chotard (2): gpio: sandbox: Rename GPIOF_(OUTPUT|HIGH|ODR) to SDBX_GPIO_(OUTPUT|HIGH|ODR) test: dm: Add gpio get_function_number ops test Patrick Delaunay (2): dm: gpio: Add get_function_number ops gpio: stm32f7: Add ops get_function_number arch/sandbox/include/asm/gpio.h | 23 drivers/gpio/gpio-uclass.c | 6 ++ drivers/gpio/sandbox.c | 47 +++-- drivers/gpio/stm32f7_gpio.c | 36 +++ include/asm-generic/gpio.h | 11 ++ test/dm/gpio.c | 13 6 files changed, 125 insertions(+), 11 deletions(-) -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v1 1/5] dm: gpio: Add get_function_number ops
From: Patrick Delaunay When a pin is not configured as a GPIO, it could have several alternate function. To be able to identify the alternate function, add ops get_function_number() to request the pin function index from the driver when pin is not used as gpio. Signed-off-by: Patrick Delaunay Signed-off-by: Patrice Chotard --- drivers/gpio/gpio-uclass.c | 6 ++ include/asm-generic/gpio.h | 11 +++ 2 files changed, 17 insertions(+) diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c index da5e9ba6e524..fa249f7b12d4 100644 --- a/drivers/gpio/gpio-uclass.c +++ b/drivers/gpio/gpio-uclass.c @@ -568,6 +568,12 @@ int gpio_get_status(struct udevice *dev, int offset, char *buf, int buffsize) label ? label : ""); } + if (func == GPIOF_FUNC && ops->get_function_number) { + ret = ops->get_function_number(dev, offset); + if (ret >= 0) + snprintf(str + len, buffsize - len, ": %d", ret); + } + return 0; } diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index d03602696f6d..f8cd6ddccbbf 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h @@ -266,6 +266,17 @@ struct dm_gpio_ops { int (*get_function)(struct udevice *dev, unsigned offset); /** +* get_function_number() Get the function number +* +* get index for GPIOF_FUNC, when pin is not used as a GPIO +* +* @dev: Device to check +* @offset: GPIO offset within that device +* @return current function index +*/ + int (*get_function_number)(struct udevice *dev, unsigned int offset); + + /** * xlate() - Translate phandle arguments into a GPIO description * * This function should set up the fields in desc according to the -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v1 2/5] gpio: stm32f7: Add ops get_function
From: Christophe Kerello This patch adds gpio get_function ops support. This function reports the state of a gpio. Signed-off-by: Christophe Kerello Signed-off-by: Patrice Chotard --- drivers/gpio/stm32f7_gpio.c | 20 1 file changed, 20 insertions(+) diff --git a/drivers/gpio/stm32f7_gpio.c b/drivers/gpio/stm32f7_gpio.c index 5b08e7ee275c..55e121699022 100644 --- a/drivers/gpio/stm32f7_gpio.c +++ b/drivers/gpio/stm32f7_gpio.c @@ -66,11 +66,31 @@ static int stm32_gpio_set_value(struct udevice *dev, unsigned offset, int value) return 0; } +static int stm32_gpio_get_function(struct udevice *dev, unsigned int offset) +{ + struct stm32_gpio_priv *priv = dev_get_priv(dev); + struct stm32_gpio_regs *regs = priv->regs; + int bits_index = MODE_BITS(offset); + int mask = MODE_BITS_MASK << bits_index; + u32 mode; + + mode = (readl(®s->moder) & mask) >> bits_index; + if (mode == STM32_GPIO_MODE_OUT) + return GPIOF_OUTPUT; + if (mode == STM32_GPIO_MODE_IN) + return GPIOF_INPUT; + if (mode == STM32_GPIO_MODE_AN) + return GPIOF_UNUSED; + + return GPIOF_FUNC; +} + static const struct dm_gpio_ops gpio_stm32_ops = { .direction_input= stm32_gpio_direction_input, .direction_output = stm32_gpio_direction_output, .get_value = stm32_gpio_get_value, .set_value = stm32_gpio_set_value, + .get_function = stm32_gpio_get_function, }; static int gpio_stm32_probe(struct udevice *dev) -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v1 4/5] gpio: sandbox: Rename GPIOF_(OUTPUT|HIGH|ODR) to SDBX_GPIO_(OUTPUT|HIGH|ODR)
To avoid confusion with enum gpio_func_t GPIOF_OUTPUT defined in asm-generic/gpio.h, rename all sandbox flags GPIOF_(OUTPUT|HIGH|ODR) to SDBX_GPIO_(OUTPUT|HIGH|ODR) Signed-off-by: Patrice Chotard --- drivers/gpio/sandbox.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/gpio/sandbox.c b/drivers/gpio/sandbox.c index 2ef5c67ad593..50afa697d01c 100644 --- a/drivers/gpio/sandbox.c +++ b/drivers/gpio/sandbox.c @@ -12,9 +12,9 @@ #include /* Flags for each GPIO */ -#define GPIOF_OUTPUT (1 << 0)/* Currently set as an output */ -#define GPIOF_HIGH (1 << 1)/* Currently set high */ -#define GPIOF_ODR (1 << 2)/* Currently set to open drain mode */ +#define SDBX_GPIO_OUTPUT BIT(0) /* Currently set as an output */ +#define SDBX_GPIO_HIGH BIT(1) /* Currently set high */ +#define SDBX_GPIO_ODR BIT(2) /* Currently set to open drain mode */ struct gpio_state { const char *label; /* label given by requester */ @@ -60,34 +60,34 @@ static int set_gpio_flag(struct udevice *dev, unsigned offset, int flag, int sandbox_gpio_get_value(struct udevice *dev, unsigned offset) { - if (get_gpio_flag(dev, offset, GPIOF_OUTPUT)) + if (get_gpio_flag(dev, offset, SDBX_GPIO_OUTPUT)) debug("sandbox_gpio: get_value on output gpio %u\n", offset); - return get_gpio_flag(dev, offset, GPIOF_HIGH); + return get_gpio_flag(dev, offset, SDBX_GPIO_HIGH); } int sandbox_gpio_set_value(struct udevice *dev, unsigned offset, int value) { - return set_gpio_flag(dev, offset, GPIOF_HIGH, value); + return set_gpio_flag(dev, offset, SDBX_GPIO_HIGH, value); } int sandbox_gpio_get_open_drain(struct udevice *dev, unsigned offset) { - return get_gpio_flag(dev, offset, GPIOF_ODR); + return get_gpio_flag(dev, offset, SDBX_GPIO_ODR); } int sandbox_gpio_set_open_drain(struct udevice *dev, unsigned offset, int value) { - return set_gpio_flag(dev, offset, GPIOF_ODR, value); + return set_gpio_flag(dev, offset, SDBX_GPIO_ODR, value); } int sandbox_gpio_get_direction(struct udevice *dev, unsigned offset) { - return get_gpio_flag(dev, offset, GPIOF_OUTPUT); + return get_gpio_flag(dev, offset, SDBX_GPIO_OUTPUT); } int sandbox_gpio_set_direction(struct udevice *dev, unsigned offset, int output) { - return set_gpio_flag(dev, offset, GPIOF_OUTPUT, output); + return set_gpio_flag(dev, offset, SDBX_GPIO_OUTPUT, output); } /* @@ -158,7 +158,7 @@ static int sb_gpio_set_open_drain(struct udevice *dev, unsigned offset, int valu static int sb_gpio_get_function(struct udevice *dev, unsigned offset) { - if (get_gpio_flag(dev, offset, GPIOF_OUTPUT)) + if (get_gpio_flag(dev, offset, SDBX_GPIO_OUTPUT)) return GPIOF_OUTPUT; return GPIOF_INPUT; } -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v1 3/5] gpio: stm32f7: Add ops get_function_number
From: Patrick Delaunay Allow to display function number using "gpio" command. Example, display all gpio state : gpio status -a GPIOD2: func: 12 GPIOD3: func: 9 GPIOE3: func: 9 GPIOG6: func: 10 It's useful to control pin configuration Signed-off-by: Patrick Delaunay Signed-off-by: Patrice Chotard --- drivers/gpio/stm32f7_gpio.c | 16 1 file changed, 16 insertions(+) diff --git a/drivers/gpio/stm32f7_gpio.c b/drivers/gpio/stm32f7_gpio.c index 55e121699022..67c3002acd31 100644 --- a/drivers/gpio/stm32f7_gpio.c +++ b/drivers/gpio/stm32f7_gpio.c @@ -85,12 +85,28 @@ static int stm32_gpio_get_function(struct udevice *dev, unsigned int offset) return GPIOF_FUNC; } +static int stm32_gpio_get_function_number(struct udevice *dev, + unsigned int offset) +{ + struct stm32_gpio_priv *priv = dev_get_priv(dev); + struct stm32_gpio_regs *regs = priv->regs; + u32 af; + u32 alt_shift = (offset % 8) * 4; + u32 alt_index = offset / 8; + + af = (readl(®s->afr[alt_index]) & + GENMASK(alt_shift + 3, alt_shift)) >> alt_shift; + + return af; +} + static const struct dm_gpio_ops gpio_stm32_ops = { .direction_input= stm32_gpio_direction_input, .direction_output = stm32_gpio_direction_output, .get_value = stm32_gpio_get_value, .set_value = stm32_gpio_set_value, .get_function = stm32_gpio_get_function, + .get_function_number= stm32_gpio_get_function_number, }; static int gpio_stm32_probe(struct udevice *dev) -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v1 5/5] test: dm: Add gpio get_function_number ops test
In order to test get_function_number ops, add sandbox_gpio_set_function() and sandbox_gpio_set_function_number() to be able to configure a pin not as a GPIO and to select the function number. Signed-off-by: Patrice Chotard --- arch/sandbox/include/asm/gpio.h | 23 +++ drivers/gpio/sandbox.c | 25 + test/dm/gpio.c | 13 + 3 files changed, 61 insertions(+) diff --git a/arch/sandbox/include/asm/gpio.h b/arch/sandbox/include/asm/gpio.h index de8ac37f4262..d1eea307efc8 100644 --- a/arch/sandbox/include/asm/gpio.h +++ b/arch/sandbox/include/asm/gpio.h @@ -82,4 +82,27 @@ int sandbox_gpio_get_direction(struct udevice *dev, unsigned int offset); int sandbox_gpio_set_direction(struct udevice *dev, unsigned int offset, int output); +/** + * Set the simulated usage of a pin, as a GPIO or not (used only in sandbox + * test code) + * + * @param dev device to use + * @param offset GPIO offset within bank + * @param value0 to set as GPIO, 1 to set as not a GPIO + * @return -1 on error, 0 if ok + */ +int sandbox_gpio_set_function(struct udevice *dev, unsigned int offset, + int value); + +/** + * Set the simulated alternate function of a pin when pin is not used as a GPIO + * (used only in sandbox test code) + * + * @param dev device to use + * @param offset GPIO offset within bank + * @param valuepin alternate function number + * @return -1 on error, 0 if ok + */ +int sandbox_gpio_set_function_number(struct udevice *dev, unsigned int offset, +int value); #endif diff --git a/drivers/gpio/sandbox.c b/drivers/gpio/sandbox.c index 50afa697d01c..cdaab8f9bf2e 100644 --- a/drivers/gpio/sandbox.c +++ b/drivers/gpio/sandbox.c @@ -15,6 +15,8 @@ #define SDBX_GPIO_OUTPUT BIT(0) /* Currently set as an output */ #define SDBX_GPIO_HIGH BIT(1) /* Currently set high */ #define SDBX_GPIO_ODR BIT(2) /* Currently set to open drain mode */ +#define SDBX_GPIO_FUNC BIT(3) /* Currently set as not used as GPIO */ +#define SDBX_GPIO_FUNC_NB BIT(4) /* Currently set as function number 1 */ struct gpio_state { const char *label; /* label given by requester */ @@ -90,6 +92,18 @@ int sandbox_gpio_set_direction(struct udevice *dev, unsigned offset, int output) return set_gpio_flag(dev, offset, SDBX_GPIO_OUTPUT, output); } +int sandbox_gpio_set_function(struct udevice *dev, unsigned int offset, + int value) +{ + return set_gpio_flag(dev, offset, SDBX_GPIO_FUNC, value); +} + +int sandbox_gpio_set_function_number(struct udevice *dev, unsigned int offset, +int value) +{ + return set_gpio_flag(dev, offset, SDBX_GPIO_FUNC_NB, value); +} + /* * These functions implement the public interface within U-Boot */ @@ -158,11 +172,21 @@ static int sb_gpio_set_open_drain(struct udevice *dev, unsigned offset, int valu static int sb_gpio_get_function(struct udevice *dev, unsigned offset) { + if (get_gpio_flag(dev, offset, SDBX_GPIO_FUNC)) + return GPIOF_FUNC; + if (get_gpio_flag(dev, offset, SDBX_GPIO_OUTPUT)) return GPIOF_OUTPUT; return GPIOF_INPUT; } +static int sb_gpio_get_function_number(struct udevice *dev, unsigned int offset) +{ + debug("%s: offset:%u\n", __func__, offset); + + return get_gpio_flag(dev, offset, SDBX_GPIO_FUNC_NB); +} + static int sb_gpio_xlate(struct udevice *dev, struct gpio_desc *desc, struct ofnode_phandle_args *args) { @@ -189,6 +213,7 @@ static const struct dm_gpio_ops gpio_sandbox_ops = { .get_open_drain = sb_gpio_get_open_drain, .set_open_drain = sb_gpio_set_open_drain, .get_function = sb_gpio_get_function, + .get_function_number= sb_gpio_get_function_number, .xlate = sb_gpio_xlate, }; diff --git a/test/dm/gpio.c b/test/dm/gpio.c index bb4b20cea938..1cca1ba007bf 100644 --- a/test/dm/gpio.c +++ b/test/dm/gpio.c @@ -92,6 +92,19 @@ static int dm_test_gpio(struct unit_test_state *uts) ut_assertok(gpio_get_status(dev, offset, buf, sizeof(buf))); ut_asserteq_str("b4: input: 0 [ ]", buf); + /* +* Make it not used as GPIO, select function +* (by default function number 0 is active) +*/ + sandbox_gpio_set_function(dev, offset, 1); + ut_assertok(gpio_get_status(dev, offset, buf, sizeof(buf))); + ut_asserteq_str("b4: func: 0", buf); + + /* select function number 1 */ + sandbox_gpio_set_function_number(dev, offset, 1); + ut_assertok(gpio_get_status(dev, offset, buf, sizeof(buf))); + ut_asserteq_str("b4: func: 1", buf); + /* Check the 'a' bank also */ ut_assertok(gpio_loo
Re: [U-Boot] [PATCH v3 1/6] drivers: Add OSD uclass
Hi Mario, On Tue, 26 Jun 2018 13:28:49 +0200 Mario Six mario@gdsys.cc wrote: ... > --- > drivers/video/Kconfig| 8 ++ > drivers/video/Makefile | 2 +- > drivers/video/video_osd-uclass.c | 45 + > include/dm/uclass-id.h | 1 + > include/video_osd.h | 192 > +++ > 5 files changed, 247 insertions(+), 1 deletion(-) > create mode 100644 drivers/video/video_osd-uclass.c > create mode 100644 include/video_osd.h Applied to u-boot-video/master after fixing Makefile changes. ... > -obj-$(CONFIG_VIDEO_FSL_DCU_FB) += fsl_dcu_fb.o videomodes.o This line shouldn't be removed. Fixed when applying. -- Anatolij ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v3 2/6] video_osd: Add ihs_video_out driver
On Tue, 26 Jun 2018 13:28:50 +0200 Mario Six mario@gdsys.cc wrote: ... > --- > .../video/osd/gdsys,ihs_video_out.txt | 23 ++ > drivers/video/Kconfig | 9 + > drivers/video/Makefile | 1 + > drivers/video/ihs_video_out.c | 341 > + > 4 files changed, 374 insertions(+) > create mode 100644 doc/device-tree-bindings/video/osd/gdsys,ihs_video_out.txt > create mode 100644 drivers/video/ihs_video_out.c Applied to u-boot-video/master, rebased Makefile changes. Thanks! -- Anatolij ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [RFC PATCH] gpio: zynq: Setup bank_name to dev->name
Am 30.07.2018 um 10:00 schrieb Michal Simek: On 27.7.2018 11:14, Stefan Herbrechtsmeier wrote: Am 27.07.2018 um 08:42 schrieb Michal Simek: On 26.7.2018 22:04, Stefan Herbrechtsmeier wrote: Am 26.07.2018 um 10:22 schrieb Michal Simek: On 25.7.2018 21:17, Stefan Herbrechtsmeier wrote: Am 25.07.2018 um 08:07 schrieb Michal Simek: On 24.7.2018 21:39, Stefan Herbrechtsmeier wrote: Am 24.07.2018 um 10:37 schrieb Michal Simek: On 23.7.2018 20:29, Stefan Herbrechtsmeier wrote: Am 23.07.2018 um 11:08 schrieb Michal Simek: On 20.7.2018 21:31, Stefan Herbrechtsmeier wrote: Am 12.07.2018 um 16:04 schrieb Michal Simek: There should be proper bank name setup to distiguish between different gpio drivers. Use dev->name for it. Signed-off-by: Michal Simek --- drivers/gpio/zynq_gpio.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpio/zynq_gpio.c b/drivers/gpio/zynq_gpio.c index 26f69b1a713f..f793ee5754a8 100644 --- a/drivers/gpio/zynq_gpio.c +++ b/drivers/gpio/zynq_gpio.c @@ -337,6 +337,8 @@ static int zynq_gpio_probe(struct udevice *dev) struct zynq_gpio_privdata *priv = dev_get_priv(dev); struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); + uc_priv->bank_name = dev->name; + if (priv->p_data) uc_priv->gpio_count = priv->p_data->ngpio; Does this not lead to ugly names because the gpio number is append to the bank_name? Have you check the "gpio status -a" output? Yes I was checking it. Names are composed together but also just numbers works as before. gpio@ff0a0: input: 0 [ ] gpio@ff0a1: input: 0 [ ] gpio@ff0a2: input: 0 [ ] gpio@ff0a3: input: 0 [ ] gpio@ff0a4: input: 0 [ ] gpio@ff0a5: input: 0 [ ] gpio@ff0a6: input: 0 [ ] gpio@ff0a7: input: 0 [ ] gpio@ff0a8: input: 0 [ ] gpio@ff0a9: input: 0 [ ] Do you think that this are meaningful names? It isn't possible to separate the device and pin number as well as it mix hex and decimal numbers. If you know better way how to setup a bank name please let me know but I need to distinguish ps gpio from pl one and for pl we need to know the address. I know the use case. A lot of drivers use the bank_name from the device tree, some drivers append an underscore to the bank name and others add the req_seq of the device to an alphabetic character. Other drivers use the gpio-bank-name from the device tree. I can't see this property inside Linux kernel. If this has been reviewed by dt guys please let me know. This property is only used by u-boot. I think it isn't needed by the Linux kernel. I am happy to use consistent solution but what's that? Consistent solution between what? all drivers. Name should be composed consistently among all drivers. It means drivers shouldn't add additional "_" in driver code for example. Mixing name with hex and int is not nice but adding "_" or something else is just a pain in driver code. If this is done in core I am fine with that but adding this code to all drivers don't look like generic solution at all. Normally the bank name is an alphabetic character or string. Maybe we could add the device name to the gpio_lookup_name function and add an additional optional device name parameter to the gpio command. Using additional u-boot property is not good too. I have mentioned in "gpio: xilinx: Convert driver to DM" (sha1:10441ec9224d0d269dc512819a32c0785a6338d3) that uc-priv->name is completely unused. Maybe this should be dev->name and bank_name should be really used for banks. Isn't the uc-priv->name used for the label of the request? Last time when I looked at it and I didn't see this name listed anywhere in output. Then in gpio status -a can be Device gpio@a0001000: Bank: ... but not sure how gpio commands will work to address exact pin from prompt. Because this is normally working gpio toggle gpio@a00010001 With an optional device name this would be: gpio toggle gpio@a0001000 1 Alternative the gpio command could support the requested labels: gpio toggle second-gpio I am open to see this solution. Feel free to invest your time support this but I have no time for that. What does this mean? I understand that you don't have the time to develop a new common solution. But the discussion disappoints me. You misuse the bank name in a poor way and decline alternative solutions with additional requirements even if they are already used in u-boot. The name "gpio@a000100011" for pin 11 of the device gpio@a0001000 isn't consistent between the u-boot drivers nor is the name used in Linux. A bank-name from the device tree is used by several u-boot drivers even if it isn't consistent between the drivers. I am sorry that you feel like that. It is not about declining alternative solution. I want to know what's the right solution is. Thanks a lot for taking the time to write a detail explanation. Using bank-name/gpio-bank-name via DT is something what is IMHO not correct. T
Re: [U-Boot] [PATCH 3/4] gpio: xilinx: Not read output values via regs
Am 30.07.2018 um 21:34 schrieb Stefan Herbrechtsmeier: Am 30.07.2018 um 16:10 schrieb Michal Simek: On 30.7.2018 15:32, Stefan Herbrechtsmeier wrote: Am 30.07.2018 um 14:40 schrieb Michal Simek: On 27.7.2018 10:41, Stefan Herbrechtsmeier wrote: Am 27.07.2018 um 09:05 schrieb Michal Simek: On 26.7.2018 21:46, Stefan Herbrechtsmeier wrote: Am 26.07.2018 um 10:41 schrieb Michal Simek: On 25.7.2018 20:21, Stefan Herbrechtsmeier wrote: Am 25.07.2018 um 08:39 schrieb Michal Simek: On 24.7.2018 21:56, Stefan Herbrechtsmeier wrote: Am 24.07.2018 um 12:31 schrieb Michal Simek: On 23.7.2018 20:42, Stefan Herbrechtsmeier wrote: Am 23.07.2018 um 13:43 schrieb Michal Simek: Reading registers for finding out output value is not working because input value is read instead in case of tristate. Reported-by: Stefan Herbrechtsmeier Signed-off-by: Michal Simek --- drivers/gpio/xilinx_gpio.c | 38 +- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/drivers/gpio/xilinx_gpio.c b/drivers/gpio/xilinx_gpio.c index 4da9ae114d87..9d3e9379d0e5 100644 --- a/drivers/gpio/xilinx_gpio.c +++ b/drivers/gpio/xilinx_gpio.c [snip] + priv->output_val[bank] = val; + return val; }; @@ -441,6 +449,7 @@ static int xilinx_gpio_get_function(struct udevice *dev, unsigned offset) static int xilinx_gpio_get_value(struct udevice *dev, unsigned offset) { struct xilinx_gpio_platdata *platdata = dev_get_platdata(dev); + struct xilinx_gpio_privdata *priv = dev_get_priv(dev); int val, ret; u32 bank, pin; @@ -451,7 +460,14 @@ static int xilinx_gpio_get_value(struct udevice *dev, unsigned offset) debug("%s: regs: %lx, gpio: %x, bank %x, pin %x\n", __func__, (ulong)platdata->regs, offset, bank, pin); - val = readl(&platdata->regs->gpiodata + bank * 2); + if (xilinx_gpio_get_function(dev, offset) == GPIOF_INPUT) { + debug("%s: Read input value from reg\n", __func__); + val = readl(&platdata->regs->gpiodata + bank * 2); + } else { + debug("%s: Read saved output value\n", __func__); + val = priv->output_val[bank]; + } Why you don't always read the data register? This doesn't work for three state outputs. In three state register every bit/pin is 0 - output, 1 input. It means else part is output and I read saved value in priv->output_val. If pin is setup as INPUT then I need read data reg to find out input value. Maybe you are commenting something else but please let me know if there is any other bug. What happen if I have an open drain output. Even if the gpio output is 1 the input could read a 0. You driver will always return the output value and not the real input value. According to the picture in documentation and my tests a data register write writes the output registers and a data register read reads the input registers. Why should the driver return the desired state (output register) and not the real state (input register)? First of all thanks for description. I have another example where you have output only and you can't read input because there is no wire. Does you mean the all outputs configuration? Does this removes the "gpio_io_i" signal from the IP? I am not sure what synthesis is doing with that unused IP pins but I would consider as a bug if this is automatically connected together. I mean does the IP generator removes the gpio_io_i signal because it isn't needed? If the IP generator creates the gpio_io_i signal I would expect that you can't leave it unconnected as this would lead to undefined values. Normally when you know that you have output only there is no no gpio_io_i or tristate signal. The same for input only. And in this case the device tree flags "xlnx,all-inputs" or "xlnx,all-outputs" should be set. yes. And also wasting a logic if there is unused part. But in Vivado you should be able to setup output pins to and input pins separately. There are In/Out/Tristate. If you don't want to deal with external pin you can connect them inside PL. This isn't my point. I mean that if you have an gpio_io_i signal you have to connected it to a signal. You could connect it to the output of an IO, to the gpio_io_o signal or to fixed value (0 or 1). If you connect it to a fixed value (0 or 1) you get this value if you read the status of this GPIO. Not a HW to tell you what's vivado is going to do with that. But you can select that ouput/input only where these signals are out. You mean the all-inputs or all-outputs case. yes. Regarding open drain output. Also this is what it is written in manual: "AXI GPIO Data Register Description" "For each I/O bit programmed as output: • R: Reads to these bits always return zeros" This must be a mistake in the documentation. I could read the input value. The old driver and the Linux driver always read the register. In old u-boot dri
[U-Boot] Problem booting uImage with u-boot
Hello I am working on a project in which I need to boot a customized linux kernel on my board. The board components are stm32f429 processor, 8Mbyte SDRAM and 32Mbyte flash memory which are connected to the processer via FMC. I've booted u-boot on the internal flash of the processor and I've installed the linux image (networking.uImage) which is provided by EMCRAFT using TFTP successfully. Then I tried to build my own linux image by editing the example provided by EMCRAFT (rootfs). But when I build the image and try to boot it, the processor can not boot the image and it resets unexpectedly. This is the message u-boot shows when trying to boot the image: ## Booting kernel from Legacy Image at d0007fc0 ... Image Name: Linux-4.2.0 Image Type: ARM Linux Multi-File Image (uncompressed) Data Size:3945195 Bytes = 3.8 MB Load Address: d0008000 Entry Point: d0008001 Contents: Image 0: 3932720 Bytes = 3.8 MB Image 1: 12463 Bytes = 12.2 kB Verifying Checksum ... OK ## Flattened Device Tree from multi component Image at D0007FC0 Booting using the fdt at 0xd03c823c Loading Multi-File Image ... OK OK WARNING: legacy format multi component image overwritten Loading Device Tree to d07f9000, end d07ff0ae ... OK Starting kernel ... After this message the processor resets. Can you please tell me what is wrong? Regards ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] ARM: socfpga: Convert to DM serial
Marek Vasut schrieb am Mi., 1. Aug. 2018, 09:35: > On 08/01/2018 09:29 AM, Goldschmidt Simon wrote: > > > > On 30.07.2018 16:04, Marek Vasut wrote: > >> On 07/30/2018 04:03 PM, Simon Goldschmidt wrote: > >>> > >>> On 12.05.2018 22:28, Marek Vasut wrote: > Pull the serial port configuration from DT and use DM serial instead > of having the serial configuration in two places, DT and board config. > [..] > While debugging, a more generic question: which drivers are now remaining non-DM for socfpga? And am I correct with the assumption that we could get rid of the qts files (other than sdram maybe) by implementing pinctrl and clk drivers as DM drivers? (Not that I would have found documentation about the pin mux hardware cyclone5...) I'm looking for a way to control pins from a fit image that includes kernel, dts and fpga because the pins may change depending on the fpga config... Simon (from my private mail) ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] Please pull u-boot-dm
Hi Tom. On 31 July 2018 at 06:42, Tom Rini wrote: > > On Mon, Jul 30, 2018 at 02:10:44PM -0600, Simon Glass wrote: > > > Hi Tom, > > > > Here are the binman changes, with the rename of the 'pos' property to > > 'offset'. > > > > > > The following changes since commit 0e8a8a311020d317fcfcf594e8e3fb1598134593: > > > > Merge git://git.denx.de/u-boot-fsl-qoriq (2018-07-27 13:09:30 -0400) > > > > are available in the Git repository at: > > > > git://git.denx.de/u-boot-dm.git > > > > for you to fetch changes up to e824c2422356cc9656d714335fc9b7907c3dace7: > > > > binman: Adjust _GetPropTree() parameters (2018-07-30 10:28:07 -0600) > > > > NAK, this seems to be introducing some failures: > binman: Section '/binman/image1': Symbol '_binman_u_boot_any_prop_pos' >in entry '/binman/image1/u-boot-spl': No such property 'pos' > /home/trini/work/u-boot/u-boot/Makefile:1240: recipe for target > 'u-boot-tegra.bin' failed > make[1]: *** [u-boot-tegra.bin] Error 1 > make[1]: Leaving directory '/tmp/colibri_t30' > Makefile:148: recipe for target 'sub-make' failed > make: *** [sub-make] Error 2 I'm sorry about that. I saw the failure and thought it was device tree stuff. Oops. Do you know what is happening with all the device-tree warnings? Are they slowing going away? Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] Problem booting uImage with u-boot
Hi On Wed, Aug 1, 2018 at 8:47 PM, Saeed Abdoli wrote: > Hello > I am working on a project in which I need to boot a customized linux kernel > on my board. The board components are stm32f429 processor, 8Mbyte SDRAM and > 32Mbyte flash memory which are connected to the processer via FMC. I've > booted u-boot on the internal flash of the processor and I've installed the > linux image (networking.uImage) which is provided by EMCRAFT using TFTP > successfully. Then I tried to build my own linux image by editing the > example provided by EMCRAFT (rootfs). But when I build the image and try to > boot it, the processor can not boot the image and it resets unexpectedly. > This is the message u-boot shows when trying to boot the image: > ## Booting kernel from Legacy Image at d0007fc0 ... >Image Name: Linux-4.2.0 >Image Type: ARM Linux Multi-File Image (uncompressed) >Data Size:3945195 Bytes = 3.8 MB >Load Address: d0008000 >Entry Point: d0008001 >Contents: > Image 0: 3932720 Bytes = 3.8 MB > Image 1: 12463 Bytes = 12.2 kB >Verifying Checksum ... OK > ## Flattened Device Tree from multi component Image at D0007FC0 >Booting using the fdt at 0xd03c823c >Loading Multi-File Image ... OK > OK > WARNING: legacy format multi component image overwritten >Loading Device Tree to d07f9000, end d07ff0ae ... OK > > Starting kernel ... > > After this message the processor resets. > Can you please tell me what is wrong? > > WARNING: legacy format multi component image overwritten >Loading Device Tree to d07f9000, end d07ff0ae ... OK Problem look like relocation address of fit image Michael > Regards > ___ > U-Boot mailing list > U-Boot@lists.denx.de > https://lists.denx.de/listinfo/u-boot -- | Michael Nazzareno Trimarchi Amarula Solutions BV | | COO - Founder Cruquiuskade 47 | | +31(0)851119172 Amsterdam 1018 AM NL | | [`as] http://www.amarulasolutions.com | ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] Please pull u-boot-dm
On Wed, Aug 01, 2018 at 12:50:57PM -0600, Simon Glass wrote: > Hi Tom. > > On 31 July 2018 at 06:42, Tom Rini wrote: > > > > On Mon, Jul 30, 2018 at 02:10:44PM -0600, Simon Glass wrote: > > > > > Hi Tom, > > > > > > Here are the binman changes, with the rename of the 'pos' property to > > > 'offset'. > > > > > > > > > The following changes since commit > > > 0e8a8a311020d317fcfcf594e8e3fb1598134593: > > > > > > Merge git://git.denx.de/u-boot-fsl-qoriq (2018-07-27 13:09:30 -0400) > > > > > > are available in the Git repository at: > > > > > > git://git.denx.de/u-boot-dm.git > > > > > > for you to fetch changes up to e824c2422356cc9656d714335fc9b7907c3dace7: > > > > > > binman: Adjust _GetPropTree() parameters (2018-07-30 10:28:07 -0600) > > > > > > > NAK, this seems to be introducing some failures: > > binman: Section '/binman/image1': Symbol '_binman_u_boot_any_prop_pos' > >in entry '/binman/image1/u-boot-spl': No such property 'pos' > > /home/trini/work/u-boot/u-boot/Makefile:1240: recipe for target > > 'u-boot-tegra.bin' failed > > make[1]: *** [u-boot-tegra.bin] Error 1 > > make[1]: Leaving directory '/tmp/colibri_t30' > > Makefile:148: recipe for target 'sub-make' failed > > make: *** [sub-make] Error 2 > > I'm sorry about that. I saw the failure and thought it was device tree > stuff. Oops. > > Do you know what is happening with all the device-tree warnings? Are > they slowing going away? They're staying about constant. I looked before, and I guess these are also warnings in upstream Linux. In some cases a re-sync helps. -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] Problem booting uImage with u-boot
Hi On Wed, Aug 1, 2018 at 9:08 PM, Saeed Abdoli wrote: > Hi Michael > Thank you for your quick response. > Can you please tell me how to solve the problem. Where can I change the > relocation address, in kernel config or somewhere else? > If you not top-post and keep it posted it's better. What is your its file for generate fit-image? Michael > Regards > Saeed > > On Wed, 1 Aug 2018, 11:25 p.m. Michael Nazzareno Trimarchi, > wrote: >> >> Hi >> >> On Wed, Aug 1, 2018 at 8:47 PM, Saeed Abdoli wrote: >> > Hello >> > I am working on a project in which I need to boot a customized linux >> > kernel >> > on my board. The board components are stm32f429 processor, 8Mbyte SDRAM >> > and >> > 32Mbyte flash memory which are connected to the processer via FMC. I've >> > booted u-boot on the internal flash of the processor and I've installed >> > the >> > linux image (networking.uImage) which is provided by EMCRAFT using TFTP >> > successfully. Then I tried to build my own linux image by editing the >> > example provided by EMCRAFT (rootfs). But when I build the image and try >> > to >> > boot it, the processor can not boot the image and it resets >> > unexpectedly. >> > This is the message u-boot shows when trying to boot the image: >> > ## Booting kernel from Legacy Image at d0007fc0 ... >> >Image Name: Linux-4.2.0 >> >Image Type: ARM Linux Multi-File Image (uncompressed) >> >Data Size:3945195 Bytes = 3.8 MB >> >Load Address: d0008000 >> >Entry Point: d0008001 >> >Contents: >> > Image 0: 3932720 Bytes = 3.8 MB >> > Image 1: 12463 Bytes = 12.2 kB >> >Verifying Checksum ... OK >> > ## Flattened Device Tree from multi component Image at D0007FC0 >> >Booting using the fdt at 0xd03c823c >> >Loading Multi-File Image ... OK >> > OK >> > WARNING: legacy format multi component image overwritten >> >Loading Device Tree to d07f9000, end d07ff0ae ... OK >> > >> > Starting kernel ... >> > >> > After this message the processor resets. >> > Can you please tell me what is wrong? >> > >> >> > WARNING: legacy format multi component image overwritten >> >Loading Device Tree to d07f9000, end d07ff0ae ... OK >> >> Problem look like relocation address of fit image >> >> Michael >> >> > Regards >> > ___ >> > U-Boot mailing list >> > U-Boot@lists.denx.de >> > https://lists.denx.de/listinfo/u-boot >> >> >> >> -- >> | Michael Nazzareno Trimarchi Amarula Solutions BV | >> | COO - Founder Cruquiuskade 47 | >> | +31(0)851119172 Amsterdam 1018 AM NL | >> | [`as] http://www.amarulasolutions.com | -- | Michael Nazzareno Trimarchi Amarula Solutions BV | | COO - Founder Cruquiuskade 47 | | +31(0)851119172 Amsterdam 1018 AM NL | | [`as] http://www.amarulasolutions.com | ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 02/29] binman: Rename 'position' to 'offset'
After some thought, I believe there is an unfortunate naming flaw in binman. Entries have a position and size, but now that we support hierarchical sections it is unclear whether a position should be an absolute position within the image, or a relative position within its parent section. At present 'position' actually means the relative position. This indicates a need for an 'image position' for code that wants to find the location of an entry without having to do calculations back through parents to discover this image position. A better name for the current 'position' or 'pos' is 'offset'. It is not always an absolute position, but it is always an offset from its parent offset. It is unfortunate to rename this concept now, 18 months after binman was introduced. However I believe it is the right thing to do. The impact is mostly limited to binman itself and a few changes to in-tree users to binman: tegra sunxi x86 The change makes old binman definitions (e.g. downstream or out-of-tree) incompatible if they use the 'pos = <...>' property. Later work will adjust binman to generate an error when it is used. Signed-off-by: Simon Glass --- Changes in v2: - Adjust symbols in the U-Boot tree also arch/arm/dts/sunxi-u-boot.dtsi| 2 +- arch/arm/dts/tegra-u-boot.dtsi| 6 +- arch/x86/dts/u-boot.dtsi | 24 ++--- common/spl/spl.c | 4 +- common/spl/spl_ram.c | 2 +- include/spl.h | 2 +- tools/binman/README | 79 tools/binman/bsection.py | 88 +- tools/binman/cmdline.py | 2 +- tools/binman/control.py | 4 +- tools/binman/elf.py | 6 +- tools/binman/entry.py | 73 --- tools/binman/etype/_testing.py| 4 +- tools/binman/etype/intel_descriptor.py| 8 +- tools/binman/etype/section.py | 14 +-- tools/binman/etype/u_boot_dtb_with_ucode.py | 4 +- tools/binman/etype/u_boot_ucode.py| 4 +- tools/binman/etype/u_boot_with_ucode_ptr.py | 35 +++ tools/binman/ftest.py | 85 + tools/binman/image.py | 12 +-- tools/binman/test/08_pack.dts | 2 +- tools/binman/test/12_pack_inv_align.dts | 2 +- tools/binman/test/14_pack_overlap.dts | 2 +- tools/binman/test/21_image_pad.dts| 2 +- tools/binman/test/24_sorted.dts | 6 +- tools/binman/test/25_pack_zero_size.dts | 2 +- tools/binman/test/27_pack_4gb_no_size.dts | 6 +- tools/binman/test/28_pack_4gb_outside.dts | 6 +- tools/binman/test/29_x86-rom.dts | 6 +- tools/binman/test/30_x86-rom-me-no-desc.dts | 4 +- tools/binman/test/31_x86-rom-me.dts | 4 +- tools/binman/test/34_x86_ucode.dts| 2 +- tools/binman/test/35_x86_single_ucode.dts | 2 +- tools/binman/test/37_x86_no_ucode.dts | 2 +- .../binman/test/38_x86_ucode_missing_node.dts | 2 +- .../test/39_x86_ucode_missing_node2.dts | 2 +- .../binman/test/40_x86_ucode_not_in_image.dts | 2 +- tools/binman/test/44_x86_optional_ucode.dts | 2 +- tools/binman/test/45_prop_test.dts| 4 +- tools/binman/test/49_x86_ucode_spl.dts| 2 +- tools/binman/test/53_symbols.dts | 2 +- .../test/58_x86_ucode_spl_needs_retry.dts | 2 +- tools/binman/test/u_boot_binman_syms | Bin 4921 -> 4916 bytes tools/binman/test/u_boot_binman_syms.c| 6 +- 44 files changed, 267 insertions(+), 263 deletions(-) diff --git a/arch/arm/dts/sunxi-u-boot.dtsi b/arch/arm/dts/sunxi-u-boot.dtsi index 5adfd9bca2e..8a9f2a6417d 100644 --- a/arch/arm/dts/sunxi-u-boot.dtsi +++ b/arch/arm/dts/sunxi-u-boot.dtsi @@ -8,7 +8,7 @@ filename = "spl/sunxi-spl.bin"; }; u-boot-img { - pos = ; + offset = ; }; }; }; diff --git a/arch/arm/dts/tegra-u-boot.dtsi b/arch/arm/dts/tegra-u-boot.dtsi index 4f692ee9757..fe19619919e 100644 --- a/arch/arm/dts/tegra-u-boot.dtsi +++ b/arch/arm/dts/tegra-u-boot.dtsi @@ -15,7 +15,7 @@ u-boot-spl { }; u-boot { - pos = <(U_BOOT_OFFSET)>; + offset = <(U_BOOT_OFFSET)>; }; }; @@ -26,7 +26,7 @@ u-boot-spl { }; u-boot { - pos = <(U_BOOT_OFFSET)>; + offset = <(U_BOOT_OFFSET)>; }; }; @@ -36,7
[U-Boot] [PATCH v2 07/29] binman: Add a new 'image-pos' property
At present each entry has an offset within its parent section. This is useful for figuring out how entries relate to one another. However it is sometimes necessary to locate an entry within an image, regardless of which sections it is nested inside. Add a new 'image-pos' property to provide this information. Also add some documentation for the -u option binman provides, which updates the device tree with final entry information. Since the image position is a better symbol to use for the position of U-Boot as obtained by SPL, update the SPL symbols to use this instead of offset, which might be incorrect if hierarchical sections are used. Signed-off-by: Simon Glass --- Changes in v2: - Update U-Boot symbols to use image_pos instead of offset - Update tests to include test coverage of image_pos common/spl/spl.c | 4 ++-- common/spl/spl_ram.c | 2 +- include/spl.h | 2 +- tools/binman/README| 22 -- tools/binman/bsection.py | 10 +- tools/binman/control.py| 1 + tools/binman/entry.py | 12 +++- tools/binman/etype/section.py | 4 tools/binman/ftest.py | 9 - tools/binman/image.py | 3 +++ tools/binman/test/u_boot_binman_syms | Bin 4916 -> 4924 bytes tools/binman/test/u_boot_binman_syms.c | 2 +- 12 files changed, 61 insertions(+), 10 deletions(-) diff --git a/common/spl/spl.c b/common/spl/spl.c index b959aa02549..eda84d0c74c 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -34,7 +34,7 @@ DECLARE_GLOBAL_DATA_PTR; u32 *boot_params_ptr = NULL; /* See spl.h for information about this */ -binman_sym_declare(ulong, u_boot_any, offset); +binman_sym_declare(ulong, u_boot_any, image_pos); /* Define board data structure */ static bd_t bdata __attribute__ ((section(".data"))); @@ -129,7 +129,7 @@ __weak void spl_board_prepare_for_boot(void) void spl_set_header_raw_uboot(struct spl_image_info *spl_image) { - ulong u_boot_pos = binman_sym(ulong, u_boot_any, offset); + ulong u_boot_pos = binman_sym(ulong, u_boot_any, image_pos); spl_image->size = CONFIG_SYS_MONITOR_LEN; diff --git a/common/spl/spl_ram.c b/common/spl/spl_ram.c index 6000f495ccd..e594beaeaa3 100644 --- a/common/spl/spl_ram.c +++ b/common/spl/spl_ram.c @@ -49,7 +49,7 @@ static int spl_ram_load_image(struct spl_image_info *spl_image, load.read = spl_ram_load_read; spl_load_simple_fit(spl_image, &load, 0, header); } else { - ulong u_boot_pos = binman_sym(ulong, u_boot_any, offset); + ulong u_boot_pos = binman_sym(ulong, u_boot_any, image_pos); debug("Legacy image\n"); /* diff --git a/include/spl.h b/include/spl.h index 8c5523083b2..7fad62c043e 100644 --- a/include/spl.h +++ b/include/spl.h @@ -60,7 +60,7 @@ struct spl_load_info { * image is found. For * example if u-boot.img is used we don't check that * spl_parse_image_header() can parse a valid header. */ -binman_sym_extern(ulong, u_boot_any, offset); +binman_sym_extern(ulong, u_boot_any, image_pos); /** * spl_load_simple_fit() - Loads a fit image from a device. diff --git a/tools/binman/README b/tools/binman/README index 4b13776ffad..df88819a1c3 100644 --- a/tools/binman/README +++ b/tools/binman/README @@ -324,6 +324,12 @@ offset-unset: property is present, binman will give an error if another entry does not set the offset (with the GetOffsets() method). +image-pos: + This cannot be set on entry (or at least it is ignored if it is), but + with the -u option, binman will set it to the absolute image position + for each entry. This makes it easy to find out exactly where the entry + ended up in the image, regardless of parent sections, etc. + The attributes supported for images are described below. Several are similar to those for entries. @@ -550,8 +556,8 @@ the 'warning' line in scripts/Makefile.lib to see what it has found: # u_boot_dtsi_options_debug = $(u_boot_dtsi_options_raw) -Access to binman entry offsets at run time --- +Access to binman entry offsets at run time (symbols) + Binman assembles images and determines where each entry is placed in the image. This information may be useful to U-Boot at run time. For example, in SPL it @@ -577,6 +583,18 @@ At present this feature is only supported in SPL. In principle it is possible to fill in such symbols in U-Boot proper, as well. +Access to binman entry offsets at run time (fdt) + + +Binman can update the U-Boot FDT to include the final position and size of +each entry in the images it processes. The option to enable this is -u and it +causes binman t
Re: [U-Boot] [PATCH v3 03/13] regmap: Add documentation
On Tue, 31 Jul 2018 12:01:00 +0200 Mario Six mario@gdsys.cc wrote: > Document the regmap_alloc() function. > > Signed-off-by: Mario Six Reviewed-by: Anatolij Gustschin ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v3 01/13] test: regmap: Increase size of syscon0 memory
On Tue, 31 Jul 2018 12:00:58 +0200 Mario Six mario@gdsys.cc wrote: > The upcoming changes to the regmap interface will contain a proper check > for plausibility when reading/writing from/to a register map. To still > have the current tests pass, increase the size of the memory region for > the syscon0 device, since one of the tests reads and writes beyond this > range. > > Signed-off-by: Mario Six Reviewed-by: Anatolij Gustschin ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v3 02/13] regmap: Fix documentation
On Tue, 31 Jul 2018 12:00:59 +0200 Mario Six mario@gdsys.cc wrote: > The documentation in regmap.h is not in kernel-doc format. Correct this. > > Signed-off-by: Mario Six Reviewed-by: Anatolij Gustschin ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v3 04/13] regmap: Improve error handling
On Tue, 31 Jul 2018 12:01:01 +0200 Mario Six mario@gdsys.cc wrote: > ofnode_read_simple_addr_cells may fail and return a negative error code. > Check for this when initializing regmaps. > > Also check if both_len is zero, since this is perfectly possible, and > would lead to a division-by-zero further down the line. > > Signed-off-by: Mario Six Reviewed-by: Anatolij Gustschin ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v3 05/13] regmap: Introduce init_range
On Tue, 31 Jul 2018 12:01:02 +0200 Mario Six mario@gdsys.cc wrote: > Both fdtdec_get_addr_size_fixed and of_address_to_resource can fail with > an error, which is not currently checked during regmap initialization. > > Since the indentation depth is already quite deep, extract a new > 'init_range' method to do the initialization. > > Signed-off-by: Mario Six Reviewed-by: Anatolij Gustschin ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot