Re: [U-Boot] [PATCH v2] hash: Compile only hardware or software versions of SHA algorithms
> -Original Message- > From: Tom Rini [mailto:tr...@konsulko.com] > Sent: Tuesday, August 15, 2017 2:08 AM > To: u-boot@lists.denx.de > Cc: Simon Glass; Sumit Garg > Subject: [PATCH v2] hash: Compile only hardware or software versions of SHA > algorithms > > Commit 089df18bfe9d ("lib: move hash CONFIG options to Kconfig") moved > CONFIG_SHA1, CONFIG_SHA256, CONFIG_SHA_HW_ACCEL, and > CONFIG_SHA_PROG_HW_ACCEL config options to Kconfig. So in the case of > SPL, CONFIG_SPL_HASH_SUPPORT enables CONFIG_SHA1 and > CONFIG_SHA256 which enables SHA SW library by default. But in the case of > platforms with SHA HW library support, SHA SW library becomes redundant and > increases size of SPL by approx 18K. Rework the code so that we have named > members and only have either software or hardware versions of the algorithm, > depending on the relevant config options. Update the comment around > hash_algo to reflect this as well. > > Reported-by: Sumit Garg > Cc: Sumit Garg > Signed-off-by: Tom Rini > --- > Changes in v2: > - Rework to switch the struct to use named members, and have only one > instance of sha1 and sha256. Re-order chunk_size in the listing so > it's not in between #ifdefs. > - Take author since the patch is almost entirely different. Sumit, if > you feel this is unfair, please feel free to speak-up and I'll re-post > with you as Author. Your commit message was quite good, so I've > reused that almost entirely. > --- > common/hash.c | 95 +++--- > - > 1 file changed, 44 insertions(+), 51 deletions(-) > With this patch code looks much cleaner. No issues from my side with you as Author. Reviewed-by: Sumit Garg Sumit ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] hash: Compile-off SHA SW lib in case SHA HW lib is present
> -Original Message- > From: Tom Rini [mailto:tr...@konsulko.com] > Sent: Monday, August 14, 2017 8:04 PM > To: Sumit Garg> Cc: u-boot@lists.denx.de; York Sun ; Ruchika Gupta > ; Prabhakar Kushwaha > ; s...@chromium.org > Subject: Re: [PATCH] hash: Compile-off SHA SW lib in case SHA HW lib is > present > > On Mon, Aug 14, 2017 at 05:09:46PM +0530, Sumit Garg wrote: > > > Commit 089df18bfe9d ("lib: move hash CONFIG options to Kconfig") moved > > CONFIG_SHA1, CONFIG_SHA256, CONFIG_SHA_HW_ACCEL, and > > CONFIG_SHA_PROG_HW_ACCEL config options to Kconfig. So in case of SPL, > > CONFIG_SPL_HASH_SUPPORT enables CONFIG_SHA1 and CONFIG_SHA256 > which > > enables SHA SW library by default. But in case of platforms with SHA > > HW library support, SHA SW library becomes redundant and increases > > size of SPL by approx 18K. So to take care of this SHA SW library is > > compiled-off in case SHA HW acceleration is present. > > > > Signed-off-by: Sumit Garg > > --- > > common/hash.c | 5 - > > 1 file changed, 4 insertions(+), 1 deletion(-) > > Good find. Looking at the code I think this can be done a bit differently to > clean > up the code as well, which was the first thing I was wondering about when > looking this over. I'll have a v2 of this hopefully later today (testing in > travis > now). Thanks! > > -- > Tom Thanks Tom for your comments. Sumit ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [UBOOT] [PATCH] cmd: usb: ignore block devices under mass storage device
Hi Simon, On Sun, Aug 13, 2017 at 2:37 PM, Simon Glasswrote: > Hi Suneel, > > On 10 August 2017 at 23:53, Suneel Garapati wrote: >> usb tree and info commands may cause crash otherwise >> >> Signed-off-by: Suneel Garapati >> --- >> cmd/usb.c | 6 -- >> 1 file changed, 4 insertions(+), 2 deletions(-) >> > > Thank you for the patch - it certainly looks like a bug. Can you > please expand the commit message a little? E.g. you have > UCLASS_USB_EMUL below. I will change the description > >> diff --git a/cmd/usb.c b/cmd/usb.c >> index 992d414..81e1a7b 100644 >> --- a/cmd/usb.c >> +++ b/cmd/usb.c >> @@ -415,7 +415,8 @@ static void usb_show_tree_graph(struct usb_device *dev, >> char *pre) >> udev = dev_get_parent_priv(child); >> >> /* Ignore emulators, we only want real devices */ >> - if (device_get_uclass_id(child) != UCLASS_USB_EMUL) { >> + if (device_get_uclass_id(child) != >> + (UCLASS_USB_EMUL | UCLASS_BLK)) { > > This seems odd to me. Do you mean to check that the child uclass is > neither USB_EMUL nor BLK? > > Would it be possible to check that the parent is UCLASS_USB? That > seems like a better condition to determine whether the child has USB > parent data. It is possible to check parent uclass but would that ever fail? I assume, block device under usb storage device will always have parent as usb class. Also, tree is called on only usb class devices. Maybe I am missing something. Regards, Suneel > >> usb_show_tree_graph(udev, pre); >> pre[index] = 0; >> } >> @@ -605,7 +606,8 @@ static void usb_show_info(struct usb_device *udev) >> for (device_find_first_child(udev->dev, ); >> child; >> device_find_next_child()) { >> - if (device_active(child)) { >> + if (device_active(child) && >> + (device_get_uclass_id(child) != UCLASS_BLK)) { >> udev = dev_get_parent_priv(child); >> usb_show_info(udev); >> } >> -- >> 2.7.4 >> > > Regards, > Simon ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] fs/fat: Correct blk_dread() return value check
The function blk_dread will return -ENOSYS on failure or on success the number of blocks read, which must be the number asked to read (otherwise it failed somewhere). Correct this check. Signed-off-by: Tom Rini--- fs/fat/fat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/fat/fat.c b/fs/fat/fat.c index 9ad18f96ff07..465a6875edf5 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -54,7 +54,7 @@ static int disk_read(__u32 block, __u32 nr_blocks, void *buf) ret = blk_dread(cur_dev, cur_part_info.start + block, nr_blocks, buf); - if (nr_blocks && ret == 0) + if (ret != nr_blocks) return -1; return ret; -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] spl: spl_mmc.c Correct blk_dread() return value check
The function blk_dread will return -ENOSYS on failure or on success the number of blocks read, which must be the number asked to read (otherwise it failed somewhere). Correct this check. Signed-off-by: Tom Rini--- common/spl/spl_mmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index d95f94ca15e0..b26c6e41 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -200,7 +200,7 @@ static int mmc_load_image_raw_os(struct spl_image_info *spl_image, CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR, CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS, (void *) CONFIG_SYS_SPL_ARGS_ADDR); - if (count == 0) { + if (count != CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS) { #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT puts("mmc_load_image_raw_os: mmc block read error\n"); #endif -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] fb_mmc.c: Correct blk_dread() return value checks
The function blk_dread will return -ENOSYS on failure or on success the number of blocks read, which must be the number asked to read (otherwise it failed somewhere). Correct this check. Cc: Lukasz MajewskiSigned-off-by: Tom Rini --- common/fb_mmc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/fb_mmc.c b/common/fb_mmc.c index 2113b6c37239..8cef1c44075c 100644 --- a/common/fb_mmc.c +++ b/common/fb_mmc.c @@ -132,7 +132,7 @@ static lbaint_t fb_mmc_get_boot_header(struct blk_desc *dev_desc, /* Read the boot image header */ res = blk_dread(dev_desc, info->start, hdr_sectors, (void *)hdr); - if (res == 0) { + if (res != hdr_sectors) { error("cannot read header from boot partition"); fastboot_fail("cannot read header from boot partition"); return 0; @@ -215,7 +215,7 @@ static int fb_mmc_update_zimage(struct blk_desc *dev_desc, ramdisk_buffer = (u8 *)hdr + (hdr_sectors * info.blksz); res = blk_dread(dev_desc, ramdisk_sector_start, ramdisk_sectors, ramdisk_buffer); - if (res == 0) { + if (res != ramdisk_sectors) { error("cannot read ramdisk from boot partition"); fastboot_fail("cannot read ramdisk from boot partition"); return -1; -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] cmd/read.c: Fix checking blk_dread return value
The function blk_dread will return -ENOSYS on failure or on success the number of blocks read, which must be the number asked to read (otherwise it failed somewhere). Correct this check. Reported-by: Coverity (CID: 166335) Cc: Philipp TomsichCc: Simon Glass Cc: Bin Meng Signed-off-by: Tom Rini --- cmd/read.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/read.c b/cmd/read.c index ecf925426fcc..82c2d9ad994e 100644 --- a/cmd/read.c +++ b/cmd/read.c @@ -66,7 +66,7 @@ int do_read(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return 1; } - if (blk_dread(dev_desc, offset + blk, cnt, addr) < 0) { + if (blk_dread(dev_desc, offset + blk, cnt, addr) != cnt) { printf("Error reading blocks\n"); return 1; } -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] mtdparts: Fix various issues reported by Coverity
Now that sandbox is building cmd/mtdparts.c Coverity has looked at the code and found a number of issues. In index_partitions() it is possible that part will be NULL, so re-work the checks and debug statements to take this into account. We have a number of string buffers that we print to in the exact size of, and use string functions on, so we need to ensure they are large enough to be NULL terminated. In device_parse() it is not possible for num_partitions to be 0 (we would have hit a different error first) so remove logically dead code. Finally, in parse_mtdparts() if we have an error we need to free the memory allocated to dev. Cc: Lothar WaßmannCc: Maxime Ripard Reported-by: Coverity (CID: 166334, 166333, 166332, 166329, 166328) Signed-off-by: Tom Rini --- cmd/mtdparts.c | 33 ++--- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/cmd/mtdparts.c b/cmd/mtdparts.c index 683c48bdad1b..93fd2f3767b8 100644 --- a/cmd/mtdparts.c +++ b/cmd/mtdparts.c @@ -133,9 +133,9 @@ static const char *mtdparts_default = MTDPARTS_DEFAULT; #define MTDIDS_MAXLEN 128 #define MTDPARTS_MAXLEN512 #define PARTITION_MAXLEN 16 -static char last_ids[MTDIDS_MAXLEN]; -static char last_parts[MTDPARTS_MAXLEN]; -static char last_partition[PARTITION_MAXLEN]; +static char last_ids[MTDIDS_MAXLEN + 1]; +static char last_parts[MTDPARTS_MAXLEN + 1]; +static char last_partition[PARTITION_MAXLEN + 1]; /* low level jffs2 cache cleaning routine */ extern void jffs2_free_cache(struct part_info *part); @@ -240,15 +240,22 @@ static void index_partitions(void) if (dev == current_mtd_dev) { mtddevnum += current_mtd_partnum; setenv_ulong("mtddevnum", mtddevnum); + debug("=> mtddevnum %d,\n", mtddevnum); break; } mtddevnum += dev->num_parts; } part = mtd_part_info(current_mtd_dev, current_mtd_partnum); - setenv("mtddevname", part->name); + if (part) { + setenv("mtddevname", part->name); + + debug("=> mtddevname %s\n", part->name); + } else { + setenv("mtddevname", NULL); - debug("=> mtddevnum %d,\n=> mtddevname %s\n", mtddevnum, part->name); + debug("=> mtddevname NULL\n"); + } } else { setenv("mtddevnum", NULL); setenv("mtddevname", NULL); @@ -912,12 +919,6 @@ static int device_parse(const char *const mtd_dev, const char **ret, struct mtd_ return 1; } - if (num_parts == 0) { - printf("no partitions for device %s%d (%s)\n", - MTD_DEV_TYPE(id->type), id->num, id->mtd_id); - return 1; - } - debug("\ntotal partitions: %d\n", num_parts); /* check for next device presence */ @@ -1593,8 +1594,10 @@ static int parse_mtdparts(const char *const mtdparts) list_add_tail(>link, ); err = 0; } - if (err == 1) + if (err == 1) { + free(dev); device_delall(); + } return err; } @@ -1730,9 +1733,9 @@ int mtdparts_init(void) if (!initialized) { INIT_LIST_HEAD(); INIT_LIST_HEAD(); - memset(last_ids, 0, MTDIDS_MAXLEN); - memset(last_parts, 0, MTDPARTS_MAXLEN); - memset(last_partition, 0, PARTITION_MAXLEN); + memset(last_ids, 0, sizeof(last_ids)); + memset(last_parts, 0, sizeof(last_parts)); + memset(last_partition, 0, sizeof(last_partition)); #if defined(CONFIG_SYS_MTDPARTS_RUNTIME) board_mtdparts_default(_default, _default); #endif -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] spi: add "jedec,spi-nor" to spi_flash_std_ids
+Jagan@gmail not sure what your primary u-boot address is On Wed, Aug 9, 2017 at 1:33 AM, Vignesh Rwrote: > > > On Tuesday 08 August 2017 10:27 AM, Chris Packham wrote: >> "jedec,spi-nor" is used by Linux for many boards with spi flash. In fact >> according to the binding documentation this must be included for any SPI >> NOR flash that can be identified by the JEDEC READ ID opcode (0x9F). >> Make device trees more portable between Linux an U-Boot by supporting >> "jedec,spi-nor" in addition to the U-Boot specific "spi-flash". >> >> Signed-off-by: Chris Packham >> --- > > +1 > > Use of U-Boot specific compatible "spi-flash" has caused quite a bit of > confusions and also problems while syncing U-Boot and kernel DTs. IMO, > its better if we could probe JEDEC SPI NOR flashes based on generic > "jedec,spi-nor" compatible as well like Linux. > >> This fixes my issues with the spi speed selection on db-88f6820-amc. I >> didn't find anything in the commit message from the initial >> implementation saying that "jedec,spi-nor" was omitted intentionally so >> I've settled on this instead of updating armada-385-amc.dts. >> >> If there is a good reason not to make this change I'm happy to submit a patch >> that just updates armada-385-amc.dts.> >> drivers/mtd/spi/sf_probe.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c >> index 7b296378d2be..1953ec3cb748 100644 >> --- a/drivers/mtd/spi/sf_probe.c >> +++ b/drivers/mtd/spi/sf_probe.c >> @@ -164,6 +164,7 @@ static const struct dm_spi_flash_ops spi_flash_std_ops = >> { >> >> static const struct udevice_id spi_flash_std_ids[] = { >> { .compatible = "spi-flash" }, >> + { .compatible = "jedec,spi-nor" }, >> { } >> }; >> >> > > -- > Regards > Vignesh ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v4 1/1] common: Move CONFIG_BOOTARGS to Kconfig
On Mon, Aug 14, 2017 at 08:22:17PM +0300, Sam Protsenko wrote: > Also introduce CONFIG_USE_BOOTARGS option so we can control if > CONFIG_BOOTARGS defined at all. > > Signed-off-by: Sam ProtsenkoWith a few more re-syncs, applied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [ANN] U-Boot v2017.09-rc2 released
Hey all, It's release day and v2017.09-rc2 is out. I'm mostly happy with the size of the changes here and I did remember to sync the defconfigs prior to tagging. If anyone has critical fixes I've missed or some Kconfig migrations (that I can prove out as correct), please speak up. I also expect there to be an MMC / PMIC related PR coming up sometime this week. Things look on track for -rc3 on the 28th of August and -rc4 on the 4th of September. Thanks all! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] Pull request: u-boot-net.git master
On Mon, Aug 14, 2017 at 12:48:43PM -0500, Joe Hershberger wrote: > Hi Tom, > > The following changes since commit aa6aaf93211b7e22361e75f1068e1e565e731f25: > > ARM: rockchip: rock: Correct test to use CONFIG_IS_ENABLED not defined > (2017-08-14 13:33:07 -0400) > > are available in the git repository at: > > git://git.denx.de/u-boot-net.git master > > for you to fetch changes up to a5fe87e829487cb5589afba3b5d8c3adff3b077d: > > driver: net: ldpaa: Update priv->phydev after free() (2017-08-14 12:47:33 > -0500) > Applied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 1/2] arm: use LOADADDR as the default for STANDALONE_LOAD_ADDR
On Mon, Aug 14, 2017 at 06:27:19PM +0200, Max Krummenacher wrote: > Different SoCs have different RAM layouts, so using > $(CONFIG_LOADADDR) instead of the constant 0xc10 for > CONFIG_STANDALONE_LOAD_ADDR is probably more appropriate. > > Signed-off-by: Max Krummenacher> Reviewed-by: Tom Rini -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 08/15] dm: mmc: sunxi: Pass private data around explicitly
Hi Chen-Yu, On 8 August 2017 at 21:27, Chen-Yu Tsaiwrote: > Hi Simon, > > On Wed, Jul 5, 2017 at 3:31 AM, Simon Glass wrote: >> At present the driver-private data is obtained in various functions by >> various means. With driver model this is provided automatically. Without >> driver model it comes from a C array declared at the top of the file. >> >> Adjust internal functions so that they are passed the private data as >> a parameter, allowing the caller to obtain it using either means. >> >> Signed-off-by: Simon Glass > > eMMC is currently broken for sunxi on my Orangepi Plus 2E. > I've narrowed it down to this patch. > > It seems the driver or device is now referencing the wrong > controller. On versions before this patch, for MMC1 (or eMMC): > > => mmc dev 1 > switch to partitions #0, OK > mmc1(part 0) is current device > => mmc info > Device: SUNXI SD/MMC > Manufacturer ID: 15 > OEM: 100 > Name: AWPD3 > Tran Speed: 5200 > Rd Block Len: 512 > MMC version 5.0 > High Capacity: Yes > Capacity: 14.6 GiB > Bus Width: 8-bit > Erase Group Size: 512 KiB > HC WP Group Size: 8 MiB > User Capacity: 14.6 GiB WRREL > Boot Capacity: 4 MiB ENH > RPMB Capacity: 4 MiB ENH > > > On later versions I get: > > => mmc dev 1 > switch to partitions #0, OK > mmc1 is current device > => mmc info > Device: SUNXI SD/MMC > Manufacturer ID: 27 > OEM: 5048 > Name: SD08G > Tran Speed: 5000 > Rd Block Len: 512 > SD version 3.0 > High Capacity: Yes > Capacity: 7.4 GiB > Bus Width: 1-bit > Erase Group Size: 512 Bytes > > > For reference, mmc0 looks like: > > => mmc dev 0 > switch to partitions #0, OK > mmc0 is current device > => mmc info > Device: SUNXI SD/MMC > Manufacturer ID: 27 > OEM: 5048 > Name: SD08G > Tran Speed: 5000 > Rd Block Len: 512 > SD version 3.0 > High Capacity: Yes > Capacity: 7.4 GiB > Bus Width: 4-bit > Erase Group Size: 512 Bytes > > > So it seems somewhere down the line, the driver is getting > passed the wrong set of priv data. Are you sure it was this patch? The ordering may have changed because there was a strange hack in the code before. There was some discussion about it but unfortunately I cannot find the thread right now. Can you take a look? Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 12/12] ARM: dts: dra76-evm: Add initial support
On Sat, Aug 12, 2017 at 11:59:33AM +0530, Lokesh Vutla wrote: > Signed-off-by: Lokesh Vutla> --- > arch/arm/dts/Makefile | 2 +- > arch/arm/dts/dra7-evm-common.dtsi | 259 +++ > arch/arm/dts/dra7-evm.dts | 271 ++-- > arch/arm/dts/dra76-evm.dts| 423 > ++ > arch/arm/dts/dra76x.dtsi | 19 ++ > board/ti/dra7xx/evm.c | 4 +- > configs/dra7xx_evm_defconfig | 2 +- > configs/dra7xx_hs_evm_defconfig | 2 +- > 8 files changed, 723 insertions(+), 259 deletions(-) > create mode 100644 arch/arm/dts/dra7-evm-common.dtsi > create mode 100644 arch/arm/dts/dra76-evm.dts > create mode 100644 arch/arm/dts/dra76x.dtsi Some of these syncs should be in the previous patch, please have a commit message, and if the skeleton of dra76-evm.dts isn't upstream just yet, have you submitted it? Thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 11/12] ARM: dts: dra7-evm: sync DT with latest Linux
On Sat, Aug 12, 2017 at 11:59:32AM +0530, Lokesh Vutla wrote: > Signed-off-by: Lokesh Vutla> --- > arch/arm/dts/dra7-evm.dts | 276 > -- > 1 file changed, 23 insertions(+), 253 deletions(-) Please include a commit message to say what rev we're syncing with, and we should probably cover dra7* while we're at it (and first move anything U-Boot centric to a -u-boot.dtsi so this goes cleaner in the future, if we're not there already). Thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 09/12] board: ti: dra76-evm: Add support for powering on mmc ldo
On Sat, Aug 12, 2017 at 11:59:30AM +0530, Lokesh Vutla wrote: > ldo4 is used to poweron mmc on dra76-evm. Enable it. > > Signed-off-by: Lokesh VutlaReviewed-by: Tom Rini -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 10/12] env: ti: boot: Select dtb name for dra76
On Sat, Aug 12, 2017 at 11:59:31AM +0530, Lokesh Vutla wrote: > Select dtb name for dra76-evm. > > Signed-off-by: Lokesh VutlaReviewed-by: Tom Rini -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 06/12] board: ti: dra76-evm: Add the pmic data
On Sat, Aug 12, 2017 at 11:59:27AM +0530, Lokesh Vutla wrote: > From: Keerthy> > dra76-evm uses lp8736 and tps65917 pmic for powering on > various peripherals. Add data for these pmics and register > for dra76-evm. > > Signed-off-by: Keerthy > Signed-off-by: Lokesh Vutla Reviewed-by: Tom Rini -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 08/12] board: ti: dra76-evm: Add the pinmux data
On Sat, Aug 12, 2017 at 11:59:29AM +0530, Lokesh Vutla wrote: > Adding pinmux and IODELAY data for dra76-evm. > > Signed-off-by: Vignesh R> Signed-off-by: Lokesh Vutla Reviewed-by: Tom Rini -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 05/12] board: ti: dra76-evm: Add epprom support
On Sat, Aug 12, 2017 at 11:59:26AM +0530, Lokesh Vutla wrote: > The dra76-evm is a board based on TI's DRA76 processor > Add eeprom support > > Signed-off-by: Lokesh VutlaReviewed-by: Tom Rini -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 07/12] board: ti: dra76-evm: Add DDR data
On Sat, Aug 12, 2017 at 11:59:28AM +0530, Lokesh Vutla wrote: > dra76-evm has the ddr parts connectedi running at 666MHz: > EMIF1: MT41K512M16HA-125 AIT:A x 2 > EMIF2: MT41K512M8RH-125-AAT:E x 4 > Add support for configuring the above DDR parts. > > Signed-off-by: Lokesh VutlaReviewed-by: Tom Rini -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 04/12] arm: dra76: Add support for ES1.0 detection
On Sat, Aug 12, 2017 at 11:59:25AM +0530, Lokesh Vutla wrote: > From: Praneeth Bajjuri> > dra76 family is a high-performance, infotainment application > device, based on OMAP architecture on a 28-nm technology. > This contains most of the subsystems, peripherals that are > available on dra74, dra72 family. This SoC mainly features > Subsystems: > - 2 x Cortex-A15 with max speed of 1.8GHz > - 2 X DSP > - 2 X Cortex-M4 IPU > - ISS > - CAL > - DSS > - VPE > - VIP > Connectivity peripherals: > - 1 USB3.0 and 3 USB2.0 subsystems > - 2 x SATA > - 2 x PCI Express Gen2 > - 3-port Gigabit ethernet switch > - 2 x CAN > - MCAN > > Adding CPU detection support for the dra76 ES1.0 soc > and update prcm, control module, dplls data. > > Signed-off-by: Praneeth Bajjuri > Signed-off-by: Lokesh Vutla Reviewed-by: Tom Rini -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 03/12] configs: dra7xx: Enable LP87565 related configs
On Sat, Aug 12, 2017 at 11:59:24AM +0530, Lokesh Vutla wrote: > From: Keerthy> > Enable LP87565 related configs > > Signed-off-by: Keerthy > Signed-off-by: Lokesh Vutla > --- > configs/dra7xx_evm_defconfig| 2 ++ > configs/dra7xx_hs_evm_defconfig | 2 ++ > 2 files changed, 4 insertions(+) Please switch to imply'ing all of the relevant PMICs so that these do not get out of sync, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 02/12] palmas: Add support for powering different ldos
On Sat, Aug 12, 2017 at 11:59:23AM +0530, Lokesh Vutla wrote: > It is not necessary that ldo1 is used to power on mmc. > So, add support for passing ldo registers for powering on mmc. > > Signed-off-by: Lokesh VutlaReviewed-by: Tom Rini -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 01/12] arm: omap5+: Add board specific ldo powering
On Sat, Aug 12, 2017 at 11:59:22AM +0530, Lokesh Vutla wrote: > It is not necessary all omap5+ based uses the same PMIC > to poweron mmc. So add support for enabling mmc based on board. > > Signed-off-by: Lokesh VutlaReviewed-by: Tom Rini -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 2/2] hello_world.c: fix entry point in case of arm thumb binary
On Sat, Aug 12, 2017 at 11:03:46AM +0200, Max Krummenacher wrote: > If compiling for thumb the U-Boot 'go' command can not jump to the entry > point, as the jump will be done in the assumption that the code jumped to > is using the arm instruction set. > > So add add a simple forwarder in arm instruction set which then jumps > to the 'real' entry. > > Signed-off-by: Max KrummenacherThis looks like a special case of what we're doing in f3c10882 and dc89c6fb778e and perhaps we need to move that kind of fixup around to somewhere else, as I assume you've found this problem on a custom application? Or are you utilizing hello_world in some test suites? Just curious, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/2] arm: use $loadaddr as the standalone entry point
On Mon, Aug 14, 2017 at 09:36:35PM +0200, Wolfgang Denk wrote: > Dear Max, > > In message <1502572898.17070.11.ca...@gmail.com> you wrote: > > > > Ok, will do. The issue is that linking the standalone application > > to have its text segment at a hardcoded address is less > > likely to work than using an address provided by the board > > This may (or may not) be the case - but no matter how youlook at it, > chosing CONFIG_LOADADDR is definitely the wrong approach, as the > LOAD address has nothing to do with the ENTRY point address, so it > must in no case ever play a role when linking an image. > > > configuration as a possible load address. > > You are confused in your wording, and I'm afraid in your thinking, > too. > > load address != entry point. But we're talking about CONFIG_STANDALONE_LOAD_ADDR not CONFIG_STANDALONE_ENTRY_POINT. What we've been doing in arch/arm/config.mk has been on my to fix list for a long time, because it's been wrong for so many boards. Setting this to CONFIG_LOADADDR is a reasonable default value. -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2] hash: Compile only hardware or software versions of SHA algorithms
Commit 089df18bfe9d ("lib: move hash CONFIG options to Kconfig") moved CONFIG_SHA1, CONFIG_SHA256, CONFIG_SHA_HW_ACCEL, and CONFIG_SHA_PROG_HW_ACCEL config options to Kconfig. So in the case of SPL, CONFIG_SPL_HASH_SUPPORT enables CONFIG_SHA1 and CONFIG_SHA256 which enables SHA SW library by default. But in the case of platforms with SHA HW library support, SHA SW library becomes redundant and increases size of SPL by approx 18K. Rework the code so that we have named members and only have either software or hardware versions of the algorithm, depending on the relevant config options. Update the comment around hash_algo to reflect this as well. Reported-by: Sumit GargCc: Sumit Garg Signed-off-by: Tom Rini --- Changes in v2: - Rework to switch the struct to use named members, and have only one instance of sha1 and sha256. Re-order chunk_size in the listing so it's not in between #ifdefs. - Take author since the patch is almost entirely different. Sumit, if you feel this is unfair, please feel free to speak-up and I'll re-post with you as Author. Your commit message was quite good, so I've reused that almost entirely. --- common/hash.c | 95 +++ 1 file changed, 44 insertions(+), 51 deletions(-) diff --git a/common/hash.c b/common/hash.c index 771d8fa87f94..b60c028da355 100644 --- a/common/hash.c +++ b/common/hash.c @@ -30,7 +30,7 @@ #include #include -#ifdef CONFIG_SHA1 +#if defined(CONFIG_SHA1) && !defined(CONFIG_SHA_PROG_HW_ACCEL) static int hash_init_sha1(struct hash_algo *algo, void **ctxp) { sha1_context *ctx = malloc(sizeof(sha1_context)); @@ -58,7 +58,7 @@ static int hash_finish_sha1(struct hash_algo *algo, void *ctx, void *dest_buf, } #endif -#ifdef CONFIG_SHA256 +#if defined(CONFIG_SHA256) && !defined(CONFIG_SHA_PROG_HW_ACCEL) static int hash_init_sha256(struct hash_algo *algo, void **ctxp) { sha256_context *ctx = malloc(sizeof(sha256_context)); @@ -113,68 +113,61 @@ static int hash_finish_crc32(struct hash_algo *algo, void *ctx, void *dest_buf, } /* - * These are the hash algorithms we support. Chips which support accelerated - * crypto could perhaps add named version of these algorithms here. Note that - * algorithm names must be in lower case. + * These are the hash algorithms we support. If we have hardware acceleration + * is enable we will use that, otherwise a software version of the algorithm. + * Note that algorithm names must be in lower case. */ static struct hash_algo hash_algo[] = { - /* -* CONFIG_SHA_HW_ACCEL is defined if hardware acceleration is -* available. -*/ -#ifdef CONFIG_SHA_HW_ACCEL +#ifdef CONFIG_SHA1 { - "sha1", - SHA1_SUM_LEN, - hw_sha1, - CHUNKSZ_SHA1, -#ifdef CONFIG_SHA_PROG_HW_ACCEL - hw_sha_init, - hw_sha_update, - hw_sha_finish, + .name = "sha1", + .digest_size= SHA1_SUM_LEN, + .chunk_size = CHUNKSZ_SHA1, +#ifdef CONFIG_SHA_HW_ACCEL + .hash_func_ws = hw_sha1, +#else + .hash_func_ws = sha1_csum_wd, #endif - }, { - "sha256", - SHA256_SUM_LEN, - hw_sha256, - CHUNKSZ_SHA256, #ifdef CONFIG_SHA_PROG_HW_ACCEL - hw_sha_init, - hw_sha_update, - hw_sha_finish, -#endif - }, + .hash_init = hw_sha_init, + .hash_update= hw_sha_update, + .hash_finish= hw_sha_finish, +#else + .hash_init = hash_init_sha1, + .hash_update= hash_update_sha1, + .hash_finish= hash_finish_sha1, #endif -#ifdef CONFIG_SHA1 - { - "sha1", - SHA1_SUM_LEN, - sha1_csum_wd, - CHUNKSZ_SHA1, - hash_init_sha1, - hash_update_sha1, - hash_finish_sha1, }, #endif #ifdef CONFIG_SHA256 { - "sha256", - SHA256_SUM_LEN, - sha256_csum_wd, - CHUNKSZ_SHA256, - hash_init_sha256, - hash_update_sha256, - hash_finish_sha256, + .name = "sha256", + .digest_size= SHA256_SUM_LEN, + .chunk_size = CHUNKSZ_SHA256, +#ifdef CONFIG_SHA_HW_ACCEL + .hash_func_ws = hw_sha256, +#else + .hash_func_ws = sha256_csum_wd, +#endif +#ifdef CONFIG_SHA_PROG_HW_ACCEL + .hash_init = hw_sha_init, + .hash_update= hw_sha_update, + .hash_finish= hw_sha_finish, +#else + .hash_init = hash_init_sha256, + .hash_update= hash_update_sha256, +
Re: [U-Boot] [PATCH 2/2] hello_world.c: fix entry point in case of arm thumb binary
Dear Max, In message <1502573515.17070.20.ca...@gmail.com> you wrote: > > This again stems from my assumption that one has to write the > standalone application in a way that the entry point is actually > linked to the beginning of the binary. No, this stems from your confusion of load address and entry point address. Of course it is possib;e that the entry point is at the very beginning of the binary. In that case you must load the image such into memory, that the start addresss of the binary is the same as the entry point address. But the load address is not the start of the binary in memory - it is the start address of the _image_. Almost always the bianry will be just a payload within the image - in the most simple cases of the lecagy uImage files the binary payload will be preceeded by a 64 byte image header. So when your load addess is set to 0x10, the binary will NOT start at this address, but at an offset of 64 bytes. So the entry poin can NEVER be the same as the load address, as this is outside of the image payload. > One cannot put the mode switching from thumb to arm instruction set > inside the body of a C function, as the entry code prepended by > the compiler would be in thumb and thus an exception would occur > before the mode switching code gets executed. If this cannot be a regular C funtion, we should still be able to provide some trampoline code using the same name. My main goal is to avoid confugion to the user who expects that he can look up the entry point address in the nm ouutput under the well-known name. > Probably one can add a pragma conditionally so that the entry > function gets compiled in arm instruction set. I investigate > further and send a v2. Thanks. Best regards, Wolfgang Denk -- 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 Do not follow where the path may leadgo instead where there is no path and leave a trail. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/2] arm: use $loadaddr as the standalone entry point
Dear Max, In message <1502572898.17070.11.ca...@gmail.com> you wrote: > > Ok, will do. The issue is that linking the standalone application > to have its text segment at a hardcoded address is less > likely to work than using an address provided by the board This may (or may not) be the case - but no matter how youlook at it, chosing CONFIG_LOADADDR is definitely the wrong approach, as the LOAD address has nothing to do with the ENTRY point address, so it must in no case ever play a role when linking an image. > configuration as a possible load address. You are confused in your wording, and I'm afraid in your thinking, too. load address != entry point. Best regards, Wolfgang Denk -- 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 In any group of employed individuals the only naturally early riser is _always_ the office manager, who will _always_ leave reproachful little notes ... on the desks of their subordinates. - Terry Pratchett, _Lords and Ladies_ ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] FYI: scripts for manually converting options to Kconfig
If you find yourself trying to convert some config option to Kconfig, and it's not going well with just moveconfig.py, you can still speed things up with a little bit of scripting. Tom asked me to share my scripts, so here they are: https://github.com/joe-skb7/uboot-convert-scripts ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 1/1] common: Move CONFIG_BOOTARGS to Kconfig
On 14 August 2017 at 05:43, Tom Riniwrote: > On Thu, Jul 27, 2017 at 06:43:44PM +0300, Sam Protsenko wrote: > >> Also introduce CONFIG_USE_BOOTARGS option so we can control if >> CONFIG_BOOTARGS defined at all. >> >> Signed-off-by: Sam Protsenko >> --- >> Changes in v2: >> - remove CONFIG_USE_BOOTARGS=y when no CONFIG_BOOTARGS defined >> - fixed mistakes found by running buildman > > Apologies for taking so long to try this. It doesn't 100% apply > correctly, but I did give it a global size test and it does look to > convert everything. Can you please rebase it asap and I'll apply it > back on top again? Also, did you have any scripts that helped with > this? I think they might be useful in a few other cases, thanks! Shared my scripts with instructions here: https://github.com/joe-skb7/uboot-convert-scripts > > -- > Tom ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] net: fman: add support RGMII_TXID to memac
Hi Madalin, https://patchwork.ozlabs.org/patch/797657/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git Thanks! -Joe ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] usb: net: Add support for Microchip LAN75xx and LAN78xx
Hi yuiko.osh...@microchip.com, https://patchwork.ozlabs.org/patch/800649/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git Thanks! -Joe ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] driver: net: ldpaa: Update priv->phydev after free()
Hi Ashish, https://patchwork.ozlabs.org/patch/728259/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git Thanks! -Joe ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] net: Add mii_resolve_flowctrl_fdx()
Hi yuiko.osh...@microchip.com, https://patchwork.ozlabs.org/patch/800647/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git Thanks! -Joe ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] Pull request: u-boot-net.git master
Hi Tom, The following changes since commit aa6aaf93211b7e22361e75f1068e1e565e731f25: ARM: rockchip: rock: Correct test to use CONFIG_IS_ENABLED not defined (2017-08-14 13:33:07 -0400) are available in the git repository at: git://git.denx.de/u-boot-net.git master for you to fetch changes up to a5fe87e829487cb5589afba3b5d8c3adff3b077d: driver: net: ldpaa: Update priv->phydev after free() (2017-08-14 12:47:33 -0500) Madalin Bucur (1): net: fman: add support RGMII_TXID to memac Prabhakar Kushwaha (1): driver: net: ldpaa: Update priv->phydev after free() Yuiko Oshino (2): net: Add mii_resolve_flowctrl_fdx() usb: net: Add support for Microchip LAN75xx and LAN78xx drivers/net/fm/memac.c| 4 +- drivers/net/ldpaa_eth/ldpaa_eth.c | 4 +- drivers/usb/Kconfig | 2 + drivers/usb/eth/Kconfig | 17 ++ drivers/usb/eth/Makefile | 2 + drivers/usb/eth/lan75xx.c | 315 drivers/usb/eth/lan78xx.c | 477 drivers/usb/eth/lan7x.c | 499 ++ drivers/usb/eth/lan7x.h | 230 ++ include/linux/mii.h | 23 ++ 10 files changed, 1571 insertions(+), 2 deletions(-) create mode 100644 drivers/usb/eth/Kconfig create mode 100644 drivers/usb/eth/lan75xx.c create mode 100644 drivers/usb/eth/lan78xx.c create mode 100644 drivers/usb/eth/lan7x.c create mode 100644 drivers/usb/eth/lan7x.h Thanks! -Joe ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] ARM: rockchip: rock: Correct test to use CONFIG_IS_ENABLED not defined
On Mon, Aug 14, 2017 at 01:24:48PM -0400, Tom Rini wrote: > While it is likely that this entire case is superfluous and can be > removed, correct the test now to match what is in rockchip-common.h and > makes sense based on context of the code. Otherwise we get a large > number of warnings. > > Reviewed-by: Philipp Tomsich> Signed-off-by: Tom Rini Applied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [GIT PULL v2] Please pull u-boot-rockchip/master
On Sun, Aug 13, 2017 at 06:37:05PM +0200, Dr. Philipp Tomsich wrote: > Tom, > > Here’s another pull-request for u-boot-rockchip. > This one shows no regressions with Travis after fixing up a few more > defconfig files and adjusting the target-list when the mxs-variant of > the SPL ldscript should be used. > > Regards, > Phil. > > > The following changes since commit da0227f7d2568c0cb0e435ed3caf780f9846d9a0: > > arm: omap: Fix 'get_device_type()' for OMAP34XX (2017-08-12 18:56:26 -0400) > > are available in the git repository at: > > git://git.denx.de/u-boot-rockchip.git master > > for you to fetch changes up to 217273cd441fe3d00a1bdad143dcb656854963f9: > > rockchip: clk: remove RATE_TO_DIV (2017-08-13 17:15:09 +0200) > Applied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] rk3288: 32KB SPL size restriction
On Mon, Aug 14, 2017 at 10:03 AM, Jagan Tekiwrote: > Hi Simon, > > On Mon, Aug 14, 2017 at 3:06 AM, Simon Glass wrote: >> Hi Jagan, >> >> On 10 August 2017 at 03:07, Jagan Teki wrote: >>> Hi Simon/Philipp or any, >>> >>> I believe rk3288 has 20KB BootRom and 100KB internal SRAM and current >>> u-boot can archive the maximum size of u-boot-spl-dtb.bin which the >>> boot ROM will read is 32KB, do we have any possibility to increase the >>> SPL size here. >>> >>> # ./tools/mkimage -n rk3288 -T rksd -d ./spl/u-boot-spl-dtb.bin out.img >>> Warning: SPL image is too large (size 0x9000) and will not boot >>> Error: image verification failed >>> >>> I tried to increase the spl_size from spl_infos (on tools/rkcommon.c) >>> but not able to boot. >> >> I thought all boards were OK at present. Which board is this? Also >> which toolchain are you using? There was a bug that bloating the >> static data a bit. > > Board similar to firefly-rk3288 and not using > ROCKCHIP_SPL_BACK_TO_BROM. Observed this when I try to add falcon mode > support which eventually increased the SPL size. > > toolchain: arm-linux-gnueabi-gcc with version 6.3.1 20170109 (Linaro > GCC 6.3-2017.02) And it is increasing further with gcc-4.7 thanks! -- Jagan Teki Free Software Engineer | www.openedev.com U-Boot, Linux | Upstream Maintainer Hyderabad, India. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] ARM: rockchip: rock: Correct test to use CONFIG_IS_ENABLED not defined
> On 14 Aug 2017, at 19:24, Tom Riniwrote: > > While it is likely that this entire case is superfluous and can be > removed, correct the test now to match what is in rockchip-common.h and > makes sense based on context of the code. Otherwise we get a large > number of warnings. > > Cc: hilipp Tomsich > Signed-off-by: Tom Rini Reviewed-by: Philipp Tomsich < philipp.toms...@theobroma-systems.com> ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot, 3/3] dtoc: Add support for 32 or 64-bit addresses
On Mon, 19 Jun 2017, Simon Glass wrote: When using 32-bit addresses dtoc works correctly. For 64-bit addresses it does not since it ignores the #address-cells and #size-cells properties. Update the tool to use fdt64_t as the element type for reg properties when either the address or size is larger than one cell. Use the correct value so that C code can obtain the information from the device tree easily. Add tests for the four combinations of address and size values (32/32, 64/64, 32/64, 64/32). Signed-off-by: Simon GlassSuggested-by: Heiko Stuebner Reported-by: Kever Yang Reviewed-by: Philipp Tomsich Tested-by: Philipp Tomsich See below for comments. --- tools/dtoc/dtb_platdata.py | 59 +++ tools/dtoc/dtoc_test_addr32.dts| 27 + tools/dtoc/dtoc_test_addr32_64.dts | 33 ++ tools/dtoc/dtoc_test_addr64.dts| 33 ++ tools/dtoc/dtoc_test_addr64_32.dts | 33 ++ tools/dtoc/test_dtoc.py| 212 + 6 files changed, 397 insertions(+) create mode 100644 tools/dtoc/dtoc_test_addr32.dts create mode 100644 tools/dtoc/dtoc_test_addr32_64.dts create mode 100644 tools/dtoc/dtoc_test_addr64.dts create mode 100644 tools/dtoc/dtoc_test_addr64_32.dts diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py index f5841cbb88..3de1a20dbd 100644 --- a/tools/dtoc/dtb_platdata.py +++ b/tools/dtoc/dtb_platdata.py @@ -242,6 +242,64 @@ class DtbPlatdata(object): self._valid_nodes = [] return self.scan_node(self._fdt.GetRoot()) +@staticmethod +def get_num_cells(node): +"""Get the number of cells in addresses and sizes for this node + +Args: +node: Node to check + +Returns: +Tuple: +Number of address cells for this node +Number of size cells for this node +""" +parent = node.parent +na, ns = 2, 2 +if parent: +na_prop = parent.props.get('#address-cells') +ns_prop = parent.props.get('#size-cells') +if na_prop: +na = fdt_util.fdt32_to_cpu(na_prop.value) +if ns_prop: +ns = fdt_util.fdt32_to_cpu(ns_prop.value) +return na, ns + +def scan_reg_sizes(self): +"""Scan for 64-bit 'reg' properties and update the values + +This finds 'reg' properties with 64-bit data and converts the value to +an array of 64-values. This allows it to be output in a way that the +C code can read. +""" +for node in self._valid_nodes: +reg = node.props.get('reg') +if not reg: +continue +na, ns = self.get_num_cells(node) +total = na + ns + +if reg.type != fdt.TYPE_INT: +raise ValueError("Node '%s' reg property is not an int") +if len(reg.value) % total: +raise ValueError("Node '%s' reg property has %d cells " +'which is not a multiple of na + ns = %d + %d)' % +(node.name, len(reg.value), na, ns)) +reg.na = na +reg.ns = ns +if na != 1 or ns != 1: +reg.type = fdt.TYPE_INT64 +i = 0 +new_value = [] +val = reg.value +while i < len(val): +addr = fdt_util.fdt_cells_to_cpu(val[i:], reg.na) +i += na +size = fdt_util.fdt_cells_to_cpu(val[i:], reg.ns) +i += ns If there's just a single element in the reg expression (e.g. reg = <1>), as will be the case for I2C or SPI devices, the type of reg.na will be str instead of list... thus causing a failures in fdt_cells_to_cpu. +new_value += [addr, size] +reg.value = new_value + def scan_structs(self): """Scan the device tree building up the C structures we will use. @@ -445,6 +503,7 @@ def run_steps(args, dtb_file, include_disabled, output): plat = DtbPlatdata(dtb_file, include_disabled) plat.scan_dtb() plat.scan_tree() +plat.scan_reg_sizes() plat.setup_output(output) structs = plat.scan_structs() plat.scan_phandles() diff --git a/tools/dtoc/dtoc_test_addr32.dts b/tools/dtoc/dtoc_test_addr32.dts new file mode 100644 index 00..bcfdcae10b --- /dev/null +++ b/tools/dtoc/dtoc_test_addr32.dts @@ -0,0 +1,27 @@ +/* + * Test device tree file for dtoc + * + * Copyright 2017 Google, Inc + * + * SPDX-License-Identifier:GPL-2.0+ + */ + + /dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + test1 { + u-boot,dm-pre-reloc; + compatible = "test1"; + reg = <0x1234 0x5678>; + }; + + test2 { +
[U-Boot] [PATCH] ARM: rockchip: rock: Correct test to use CONFIG_IS_ENABLED not defined
While it is likely that this entire case is superfluous and can be removed, correct the test now to match what is in rockchip-common.h and makes sense based on context of the code. Otherwise we get a large number of warnings. Cc: hilipp TomsichSigned-off-by: Tom Rini --- include/configs/rock.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/configs/rock.h b/include/configs/rock.h index 6b0788be9db5..8d845d95e378 100644 --- a/include/configs/rock.h +++ b/include/configs/rock.h @@ -12,7 +12,7 @@ #define CONFIG_SYS_MMC_ENV_DEV 0 -#if defined(ROCKCHIP_BACK_TO_BROM) +#if CONFIG_IS_ENABLED(ROCKCHIP_BACK_TO_BROM) /* SPL @ 32k for 34k * u-boot directly after @ 68k for 400k or so * ENV @ 992k -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot, 2/3] dtoc: Add a 64-bit type and a way to convert cells into 64 bits
On Mon, 19 Jun 2017, Simon Glass wrote: When dealing with multi-cell values we need a type that can hold this value. Add this and a function to process it from a list of cell values. Signed-off-by: Simon Glass--- Reviewed-by: Philipp Tomsich Tested-by: Philipp Tomsich ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot,1/3] dtoc: Adjust Node to record its parent
On Mon, 19 Jun 2017, Simon Glass wrote: We need to be able to search back up the tree for #address-cells and #size-cells. Record the parent of each node to make this easier. Signed-off-by: Simon Glass--- Reviewed-by: Philipp Tomsich Tested-by: Philipp Tomsich ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 4/4] rockchip: dts: rk3368: reduce the number of nodes seen in TPL
The RK3368 TPL stage always returns to the BootROM, so it has no need for the eMMC, SD and SPI nodes. This marks those nodes (that should be included in SPL, but not TPL) as 'u-boot,dm-spl'. Signed-off-by: Philipp Tomsich--- arch/arm/dts/rk3368-lion-u-boot.dtsi | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm/dts/rk3368-lion-u-boot.dtsi b/arch/arm/dts/rk3368-lion-u-boot.dtsi index 6052e8a..dbf614c 100644 --- a/arch/arm/dts/rk3368-lion-u-boot.dtsi +++ b/arch/arm/dts/rk3368-lion-u-boot.dtsi @@ -70,18 +70,18 @@ }; { - u-boot,dm-pre-reloc; + u-boot,dm-spl; }; { - u-boot,dm-pre-reloc; + u-boot,dm-spl; }; { - u-boot,dm-pre-reloc; + u-boot,dm-spl; spiflash: w25q32dw@0 { - u-boot,dm-pre-reloc; + u-boot,dm-spl; }; }; -- 2.1.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [RFC PATCH 0/4] rockchip: rk3368: fixes to work with 64bit-aware OF_PLATDATA
With Simon's series [1] to make dtoc 64bit-aware (i.e. handle addresses and sizes that occupy 2 cells as 64bit values and use fdt64_t in the generated datastructures), we need a few adjustments to the RK3368 support to make the RK3368-uQ7 bootable. This series has the DMC driver work around some remaining shortcomings in 'regmap_init_mem_platdata' (by bypassing the function) and removes some DTS nodes that are not needed in TPL (to work around and issue in dtoc). Patch #4 (the DTS change) is a useful cleanup independent of the remaining series --- this is why it is not marked as RFC. Note that the remaining uses of 'regmap_init_mem_platdata' work by a lucky coincidence only (i.e. that we are little-endian and never need the region-size correct) on the RK3368. [1] see https://lists.denx.de/pipermail/u-boot/2017-June/295929.html Philipp Tomsich (4): rockchip: clk: rk3368: update for 32/64bit-aware OF_PLATDATA rockchip: timer: update for 32/64bit-aware OF_PLATDATA rockchip: rk3368: adjust DMC driver for 32/64bit-aware OF_PLATDATA rockchip: dts: rk3368: reduce the number of nodes seen in TPL arch/arm/dts/rk3368-lion-u-boot.dtsi | 8 drivers/clk/rockchip/clk_rk3368.c| 2 +- drivers/ram/rockchip/dmc-rk3368.c| 11 ++- drivers/timer/rockchip_timer.c | 2 +- 4 files changed, 8 insertions(+), 15 deletions(-) -- 2.1.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [RFC PATCH 1/4] rockchip: clk: rk3368: update for 32/64bit-aware OF_PLATDATA
With dtoc emitting fdt64_t for addresses (and region sizes), the array indices for accessing the reg[] array needs to be adjusted. This adjusts the clk_rk3368 driver to correctly handle OF_PLATDATA given this new structure layout. Signed-off-by: Philipp Tomsich--- drivers/clk/rockchip/clk_rk3368.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/rockchip/clk_rk3368.c b/drivers/clk/rockchip/clk_rk3368.c index 2be1f57..0160d50 100644 --- a/drivers/clk/rockchip/clk_rk3368.c +++ b/drivers/clk/rockchip/clk_rk3368.c @@ -471,7 +471,7 @@ static int rk3368_clk_probe(struct udevice *dev) #if CONFIG_IS_ENABLED(OF_PLATDATA) struct rk3368_clk_plat *plat = dev_get_platdata(dev); - priv->cru = map_sysmem(plat->dtd.reg[1], plat->dtd.reg[3]); + priv->cru = map_sysmem(plat->dtd.reg[0], plat->dtd.reg[1]); #endif #if IS_ENABLED(CONFIG_SPL_BUILD) || IS_ENABLED(CONFIG_TPL_BUILD) rkclk_init(priv->cru); -- 2.1.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [RFC PATCH 2/4] rockchip: timer: update for 32/64bit-aware OF_PLATDATA
With dtoc emitting fdt64_t for addresses (and region sizes), the array indices for accessing the reg[] array needs to be adjusted. This adjusts the Rockchip DM timer driver to correctly handle OF_PLATDATA given this new structure layout. Signed-off-by: Philipp Tomsich--- drivers/timer/rockchip_timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/timer/rockchip_timer.c b/drivers/timer/rockchip_timer.c index 0848033..831b7da 100644 --- a/drivers/timer/rockchip_timer.c +++ b/drivers/timer/rockchip_timer.c @@ -76,7 +76,7 @@ static int rockchip_timer_probe(struct udevice *dev) struct rockchip_timer_priv *priv = dev_get_priv(dev); struct rockchip_timer_plat *plat = dev_get_platdata(dev); - priv->timer = map_sysmem(plat->dtd.reg[1], plat->dtd.reg[3]); + priv->timer = map_sysmem(plat->dtd.reg[0], plat->dtd.reg[1]); uc_priv->clock_rate = plat->dtd.clock_frequency; #endif -- 2.1.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [RFC PATCH 3/4] rockchip: rk3368: adjust DMC driver for 32/64bit-aware OF_PLATDATA
With the new 32/64bit-aware dtoc, the type of reg is fdt64_t and the OF_PLATDATA structure layout changes. This adjusts the DMC driver for the RK3368 to track these changes. For the time being (i.e. until regmap_init_mem_platdata works for the 64bit case), we won't use regmap_init_mem_platdata here and simply access of_plat.reg[] directly. Signed-off-by: Philipp Tomsich--- drivers/ram/rockchip/dmc-rk3368.c | 11 ++- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/ram/rockchip/dmc-rk3368.c b/drivers/ram/rockchip/dmc-rk3368.c index ca7b1ff..7577ff0 100644 --- a/drivers/ram/rockchip/dmc-rk3368.c +++ b/drivers/ram/rockchip/dmc-rk3368.c @@ -893,18 +893,11 @@ static int conv_of_platdata(struct udevice *dev) { struct rk3368_sdram_params *plat = dev_get_platdata(dev); struct dtd_rockchip_rk3368_dmc *of_plat = >of_plat; - int ret; plat->ddr_freq = of_plat->rockchip_ddr_frequency; plat->ddr_speed_bin = of_plat->rockchip_ddr_speed_bin; plat->memory_schedule = of_plat->rockchip_memory_schedule; - ret = regmap_init_mem_platdata(dev, of_plat->reg, - ARRAY_SIZE(of_plat->reg) / 2, - >map); - if (ret) - return ret; - return 0; } #endif @@ -933,8 +926,8 @@ static int rk3368_dmc_probe(struct udevice *dev) debug("%s: pmugrf=%p\n", __func__, priv->pmugrf); #ifdef CONFIG_TPL_BUILD - pctl = regmap_get_range(plat->map, 0); - ddrphy = regmap_get_range(plat->map, 1); + pctl = (struct rk3368_ddr_pctl *)plat->of_plat.reg[0]; + ddrphy = (struct rk3368_ddrphy *)plat->of_plat.reg[2]; msch = syscon_get_first_range(ROCKCHIP_SYSCON_MSCH); grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF); -- 2.1.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 3/5] spl: fit: Eanble GZIP support for image decompression
On 08/13/2017 02:35 PM, Simon Glass wrote: > Hi York, > > On 7 August 2017 at 17:16, York Sunwrote: >> Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for >> SPL boot, eg. falcon boot compressed kernel image. >> >> Signed-off-by: York Sun >> >> --- >> >> Changes in v2: >> Combine Kconfig change and actual code into one patch >> >> common/spl/spl_fit.c | 28 ++-- >> lib/Kconfig | 8 >> lib/Makefile | 5 +++-- >> 3 files changed, 37 insertions(+), 4 deletions(-) >> >> diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c >> index d2a352e..23f85d2 100644 >> --- a/common/spl/spl_fit.c >> +++ b/common/spl/spl_fit.c >> @@ -135,6 +135,19 @@ static int spl_load_fit_image(struct spl_load_info >> *info, ulong sector, >> ulong overhead; >> int nr_sectors; >> int align_len = ARCH_DMA_MINALIGN - 1; >> +#if defined(CONFIG_SPL_OS_BOOT) && defined(CONFIG_SPL_GZIP) > > If these are in Kconfig can we use if (IS_ENABLED()) instead of #if ? Sure thing. Will change in next version. York ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 4/5] spl: fit: Support both external and embedded data
On 08/13/2017 02:35 PM, Simon Glass wrote: > Hi York, > > On 7 August 2017 at 17:16, York Sunwrote: >> SPL supports U-Boot image in FIT format which has data outside of >> FIT structure. This adds support for embedded data for normal FIT >> images. >> >> Signed-off-by: York Sun >> >> --- >> >> Changes in v2: >> Rebase on top of "SPL: FIT: factor out spl_load_fit_image()" by Andre >> Przywara >> >> common/spl/spl_fit.c | 52 >> +--- >> 1 file changed, 33 insertions(+), 19 deletions(-) >> > > There is some docs here: > > doc/uImage.FIT/source_file_format.txt > > I feel that what you have here should be documented in some way, > associated with SPL. Any ideas? Yes. That's my plan. I have been waiting for Andre to comment on the priority of "kervel" vs "firmware". I believe it makes sense to favor "kernel" when falcon boot is enabled. The U-Boot image shouldn't contain "kernel" node in falcon boot scenario. Or it can be changed to "standalone" as Andre did for U-Boot image (to favor "loadables"). York ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 1/2] arm: use LOADADDR as the default for STANDALONE_LOAD_ADDR
Different SoCs have different RAM layouts, so using $(CONFIG_LOADADDR) instead of the constant 0xc10 for CONFIG_STANDALONE_LOAD_ADDR is probably more appropriate. Signed-off-by: Max Krummenacher--- Changes in v2: - Don't confuse loadaddr with entry point as reported by Wolfgang. arch/arm/config.mk| 4 doc/README.standalone | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/arm/config.mk b/arch/arm/config.mk index 1a9db4..8f56c7433f 100644 --- a/arch/arm/config.mk +++ b/arch/arm/config.mk @@ -9,7 +9,11 @@ ifndef CONFIG_STANDALONE_LOAD_ADDR ifneq ($(CONFIG_ARCH_OMAP2PLUS),) CONFIG_STANDALONE_LOAD_ADDR = 0x8030 else +ifndef CONFIG_LOADADDR CONFIG_STANDALONE_LOAD_ADDR = 0xc10 +else +CONFIG_STANDALONE_LOAD_ADDR = $(CONFIG_LOADADDR) +endif endif endif diff --git a/doc/README.standalone b/doc/README.standalone index 659a12f6cb..17d740c44b 100644 --- a/doc/README.standalone +++ b/doc/README.standalone @@ -53,7 +53,7 @@ Design Notes on Exporting U-Boot Functions to Standalone Applications: Load addressStart address x86 0x0004 0x0004 PowerPC 0x0004 0x00040004 - ARM 0x0c10 0x0c10 + ARM CONFIG_LOADADDR CONFIG_LOADADDR MIPS0x8020 0x8020 Blackfin0x1000 0x1000 NDS32 0x0030 0x0030 -- 2.13.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 2/2] hello_world.c: fix entry point in case of arm thumb binary
For the ARM architecture the U-Boot 'go' command can not jump to code compiled for thumb instruction set. Thus provide a forwarder function to be used as the entry point and have the forwarder deal with how to jump to thumb code. Note that code which is calling back into the U-Boot binary needs to be compiled in the same instruction set as the U-Boot binary is compiled with. Signed-off-by: Max Krummenacher--- Changes in v2: - Don't confuse loadaddr with entry point as reported by Wolfgang. - Change the assembly magic to a C function and use __attribute__ to force arm instruction set. - Keep the entry point name hello_world as reported by Wolfgang. examples/standalone/hello_world.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/examples/standalone/hello_world.c b/examples/standalone/hello_world.c index bd8b392315..3b58b147ff 100644 --- a/examples/standalone/hello_world.c +++ b/examples/standalone/hello_world.c @@ -8,7 +8,25 @@ #include #include +/* + * Make thumb work by compiling the entry function for arm. + * Only do this if the target CPU is able to execute arm code. + * Note that code which calls back into the U-Boot binary + * must be compiled for thumb. + */ +#if defined(__thumb__) && defined(__ARM_ARCH_ISA_ARM) +static int _hello_world(int argc, char * const argv[]); + +__attribute__((target("arm"))) +int hello_world(int argc, char * const argv[]) +{ + return _hello_world(argc, argv); +} + +static noinline int _hello_world(int argc, char * const argv[]) +#else int hello_world (int argc, char * const argv[]) +#endif { int i; -- 2.13.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 0/2] improve hello_world standalone application for arm
This series addresses - hardcoded load address, use LOADADDR if available as the entry point instead - fix thumb build, jumping with 'go' to the entry point expects arm code Note that in addition to the two fixes I've seen random freezes or 'random' printed stuff when using an early linaro gcc 6 compiler. Adding an initialized variable helped in that case static int dummy_var_in_text = 1; I assume that this forces alignment of some linker sections. (e.g. I see that __bss_start points to 0x1201027e, with the variable this moves to 0x12010280) However with the current linaro compilers this does not happen so I don't propose a patch for this issue. Linaro GCC 5.4-2017.05 5.4.1 20170404 Linaro GCC 6.3-2017.05 6.3.1 20170404 Linaro GCC 7.1-2017.05 7.1.1 20170510 This series is available at http://git.toradex.com/cgit/u-boot-toradex.git/log/?h=for-next Changes in v2: - Don't confuse loadaddr with entry point as reported by Wolfgang. - Change the assembly magic to a C function and use __attribute__ to force arm instruction set. - Keep the entry point name hello_world as reported by Wolfgang. Max Krummenacher (2): arm: use LOADADDR as the default for STANDALONE_LOAD_ADDR hello_world.c: fix entry point in case of arm thumb binary arch/arm/config.mk| 4 doc/README.standalone | 2 +- examples/standalone/hello_world.c | 18 ++ 3 files changed, 23 insertions(+), 1 deletion(-) -- 2.13.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] mmc: Support generic PCI SD host controller
On Mon, Aug 14, 2017 at 11:06:32PM +0800, Bin Meng wrote: > Hi Jaehoon, Tom, > > On Wed, Aug 9, 2017 at 3:21 PM, Bin Mengwrote: > > This changes pci_mmc driver to use PCI_CLASS_SYSTEM_SDHCI instead of > > individual vendor id & device id pair to support generic PCI SD host > > controller. > > > > Signed-off-by: Bin Meng > > --- > > > > drivers/mmc/pci_mmc.c | 7 +-- > > 1 file changed, 1 insertion(+), 6 deletions(-) > > > > Who is going to review and take this patch? I would expect Jaehoon to review and take this. Thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] sunxi: defaultly enable SPL for Lichee Pi Zero
On Mon, Aug 14, 2017 at 8:30 PM, Icenowy Zhengwrote: > As we have already DRAM initialization code for V3s SoC, we can > defaultly enable SPL now on Lichee Pi Zero. > > Add CONFIG_SPL in Lichee Pi Zero defconfig. > > Signed-off-by: Icenowy Zheng Reviewed-by: Jagan Teki thanks! -- Jagan Teki Free Software Engineer | www.openedev.com U-Boot, Linux | Upstream Maintainer Hyderabad, India. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v3] Makefile: honor PYTHON configuration properly
On Mon, Aug 14, 2017 at 08:59:11AM +0200, Cl??ment B??sch wrote: > On some systems `python` is `python3` (for instance, Archlinux). The > `PYTHON` variable can be used to point to `python2` to have a successful > build. > > The use of `PYTHON` is currently limited in the Makefile and needs to be > extended in other places: > > First, pylibfdt is required to be a Python 2 binding (binman imports > pylibfdt and is only compatible Python 2), so its setup.py needs to be > called accordingly. An alternative would be to change the libfdt > setup.py shebang to python2, but the binding is actually portable. Also, > it would break on system where there is no such thing as `python2`. > > Secondly, the libfdt import checks need to be done against Python 2 as > well since the Python 2 compiled modules (in this case _libdft.so) can > not be imported from Python 3. > > Note on the libfdt imports: "@if ! PYTHONPATH=tools $(PYTHON) -c 'import > libfdt'; then..." is probably simpler than the currently sub-optimal > pipe. Reviewed-by: Jonathan GrayThis is also helpful for OpenBSD where python 2 is not 'python' or 'python2' but rather 'python2.7'. > --- > Makefile | 2 +- > scripts/Makefile.spl | 2 +- > tools/Makefile | 2 +- > 3 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/Makefile b/Makefile > index 50a002e72f..1f70144e0a 100644 > --- a/Makefile > +++ b/Makefile > @@ -1378,7 +1378,7 @@ $(timestamp_h): $(srctree)/Makefile FORCE > $(call filechk,timestamp.h) > > checkbinman: tools > - @if ! ( echo 'import libfdt' | ( PYTHONPATH=tools python )); then \ > + @if ! ( echo 'import libfdt' | ( PYTHONPATH=tools $(PYTHON) )); then \ > echo >&2; \ > echo >&2 '*** binman needs the Python libfdt library.'; \ > echo >&2 '*** Either install it on your system, or try:'; \ > diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl > index ac3c2c7f13..c47248cc57 100644 > --- a/scripts/Makefile.spl > +++ b/scripts/Makefile.spl > @@ -356,7 +356,7 @@ ifneq ($(cmd_files),) > endif > > checkdtoc: tools > - @if ! ( echo 'import libfdt' | ( PYTHONPATH=tools python )); then \ > + @if ! ( echo 'import libfdt' | ( PYTHONPATH=tools $(PYTHON) )); then \ > echo '*** dtoc needs the Python libfdt library. Either '; \ > echo '*** install it on your system, or try:'; \ > echo '***'; \ > diff --git a/tools/Makefile b/tools/Makefile > index 0743677dc8..1940cdad1f 100644 > --- a/tools/Makefile > +++ b/tools/Makefile > @@ -138,7 +138,7 @@ tools/_libfdt.so: $(LIBFDT_SRCS) $(LIBFDT_SWIG) > CPPFLAGS="$(_hostc_flags)" OBJDIR=tools \ > SOURCES="$(LIBFDT_SRCS) tools/libfdt.i" \ > SWIG_OPTS="-I$(srctree)/lib/libfdt -I$(srctree)/lib" \ > - $(libfdt_tree)/pylibfdt/setup.py --quiet build_ext \ > + $(PYTHON) $(libfdt_tree)/pylibfdt/setup.py build_ext \ > --build-lib tools > > ifneq ($(CONFIG_MX23)$(CONFIG_MX28),) > -- > 2.14.1 > ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] mmc: Support generic PCI SD host controller
Hi Jaehoon, Tom, On Wed, Aug 9, 2017 at 3:21 PM, Bin Mengwrote: > This changes pci_mmc driver to use PCI_CLASS_SYSTEM_SDHCI instead of > individual vendor id & device id pair to support generic PCI SD host > controller. > > Signed-off-by: Bin Meng > --- > > drivers/mmc/pci_mmc.c | 7 +-- > 1 file changed, 1 insertion(+), 6 deletions(-) > Who is going to review and take this patch? Regards, Bin ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] sunxi: defaultly enable SPL for Lichee Pi Zero
As we have already DRAM initialization code for V3s SoC, we can defaultly enable SPL now on Lichee Pi Zero. Add CONFIG_SPL in Lichee Pi Zero defconfig. Signed-off-by: Icenowy Zheng--- configs/LicheePi_Zero_defconfig | 4 1 file changed, 4 insertions(+) diff --git a/configs/LicheePi_Zero_defconfig b/configs/LicheePi_Zero_defconfig index 887997bd4f..de90a4c6ce 100644 --- a/configs/LicheePi_Zero_defconfig +++ b/configs/LicheePi_Zero_defconfig @@ -4,7 +4,11 @@ CONFIG_MACH_SUN8I_V3S=y CONFIG_DRAM_CLK=360 CONFIG_DRAM_ZQ=14779 CONFIG_DEFAULT_DEVICE_TREE="sun8i-v3s-licheepi-zero" +CONFIG_SPL=y # CONFIG_CMD_IMLS is not set # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set # CONFIG_NETDEVICES is not set +# CONFIG_SPL_DOS_PARTITION is not set +# CONFIG_SPL_ISO_PARTITION is not set +# CONFIG_SPL_EFI_PARTITION is not set -- 2.13.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 3/8] fat/fs: convert to directory iterators
On Mon, Aug 14, 2017 at 10:39 AM, Rob Clarkwrote: > On Mon, Aug 14, 2017 at 9:47 AM, Brüns, Stefan > wrote: > >> Have you checked this case still works? AFAICS this is not covered in fs- >> test.sh. Examples of suitables sandbox commands are given in the commit >> message of: > > Directories split across clusters is definitely something that I've > tested. Not sure if some of them had vfat names spanning a cluster, > but handling that is inherent in the design, as it never needs more > than a single dent at a time to parse vfat names. > >> 18a10d46f267057ede0490ddba71c106475b4eb1 (fat: handle paths that include ../) > > hmm, but it does look like I'm missing something to ../ back to root dir.. > ok, looks like what I needed was: @@ -696,7 +696,7 @@ static void fat_itr_child(fat_itr *itr, fat_itr *parent) itr->cursect = itr->fsdata->data_begin + (clustnum * itr->fsdata->clust_size); } else { -itr->cursect = 0; +itr->cursect = parent->fsdata->rootdir_sect; } itr->dent = NULL; itr->remaining = 0; fixed up locally BR, -R ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 3/3] dtoc: Add support for 32 or 64-bit addresses
> On 20 Jun 2017, at 05:34, Simon Glasswrote: > > When using 32-bit addresses dtoc works correctly. For 64-bit addresses it > does not since it ignores the #address-cells and #size-cells properties. > > Update the tool to use fdt64_t as the element type for reg properties when > either the address or size is larger than one cell. Use the correct value > so that C code can obtain the information from the device tree easily. This breaks ‘regmap_init_mem_platdata’, which assumes that it processes 32bit words (i.e. both addr and size are 32bit). Or did I just miss another changeset? > Add tests for the four combinations of address and size values (32/32, > 64/64, 32/64, 64/32). > > Signed-off-by: Simon Glass > Suggested-by: Heiko Stuebner > Reported-by: Kever Yang > --- > > tools/dtoc/dtb_platdata.py | 59 +++ > tools/dtoc/dtoc_test_addr32.dts| 27 + > tools/dtoc/dtoc_test_addr32_64.dts | 33 ++ > tools/dtoc/dtoc_test_addr64.dts| 33 ++ > tools/dtoc/dtoc_test_addr64_32.dts | 33 ++ > tools/dtoc/test_dtoc.py| 212 + > 6 files changed, 397 insertions(+) > create mode 100644 tools/dtoc/dtoc_test_addr32.dts > create mode 100644 tools/dtoc/dtoc_test_addr32_64.dts > create mode 100644 tools/dtoc/dtoc_test_addr64.dts > create mode 100644 tools/dtoc/dtoc_test_addr64_32.dts > > diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py > index f5841cbb88..3de1a20dbd 100644 > --- a/tools/dtoc/dtb_platdata.py > +++ b/tools/dtoc/dtb_platdata.py > @@ -242,6 +242,64 @@ class DtbPlatdata(object): > self._valid_nodes = [] > return self.scan_node(self._fdt.GetRoot()) > > +@staticmethod > +def get_num_cells(node): > +"""Get the number of cells in addresses and sizes for this node > + > +Args: > +node: Node to check > + > +Returns: > +Tuple: > +Number of address cells for this node > +Number of size cells for this node > +""" > +parent = node.parent > +na, ns = 2, 2 > +if parent: > +na_prop = parent.props.get('#address-cells') > +ns_prop = parent.props.get('#size-cells') > +if na_prop: > +na = fdt_util.fdt32_to_cpu(na_prop.value) > +if ns_prop: > +ns = fdt_util.fdt32_to_cpu(ns_prop.value) > +return na, ns > + > +def scan_reg_sizes(self): > +"""Scan for 64-bit 'reg' properties and update the values > + > +This finds 'reg' properties with 64-bit data and converts the value > to > +an array of 64-values. This allows it to be output in a way that the > +C code can read. > +""" > +for node in self._valid_nodes: > +reg = node.props.get('reg') > +if not reg: > +continue > +na, ns = self.get_num_cells(node) > +total = na + ns > + > +if reg.type != fdt.TYPE_INT: > +raise ValueError("Node '%s' reg property is not an int") > +if len(reg.value) % total: > +raise ValueError("Node '%s' reg property has %d cells " > +'which is not a multiple of na + ns = %d + %d)' % > +(node.name, len(reg.value), na, ns)) > +reg.na = na > +reg.ns = ns > +if na != 1 or ns != 1: > +reg.type = fdt.TYPE_INT64 > +i = 0 > +new_value = [] > +val = reg.value > +while i < len(val): > +addr = fdt_util.fdt_cells_to_cpu(val[i:], reg.na) > +i += na > +size = fdt_util.fdt_cells_to_cpu(val[i:], reg.ns) > +i += ns > +new_value += [addr, size] > +reg.value = new_value > + > def scan_structs(self): > """Scan the device tree building up the C structures we will use. > > @@ -445,6 +503,7 @@ def run_steps(args, dtb_file, include_disabled, output): > plat = DtbPlatdata(dtb_file, include_disabled) > plat.scan_dtb() > plat.scan_tree() > +plat.scan_reg_sizes() > plat.setup_output(output) > structs = plat.scan_structs() > plat.scan_phandles() > diff --git a/tools/dtoc/dtoc_test_addr32.dts b/tools/dtoc/dtoc_test_addr32.dts > new file mode 100644 > index 00..bcfdcae10b > --- /dev/null > +++ b/tools/dtoc/dtoc_test_addr32.dts > @@ -0,0 +1,27 @@ > +/* > + * Test device tree file for dtoc > + * > + * Copyright 2017 Google, Inc > + * > + * SPDX-License-Identifier: GPL-2.0+ > + */ > + > + /dts-v1/; > + > +/ { > + #address-cells = <1>; > + #size-cells = <1>; > + > + test1 { > + u-boot,dm-pre-reloc; > + compatible = "test1"; > + reg = <0x1234
Re: [U-Boot] [PATCH v2 3/8] fat/fs: convert to directory iterators
On Mon, Aug 14, 2017 at 9:47 AM, Brüns, Stefanwrote: > On Montag, 14. August 2017 15:16:15 CEST Rob Clark wrote: >> And drop a whole lot of ugly code! >> >> Signed-off-by: Rob Clark >> --- >> fs/fat/fat.c | 723 >> ++ include/fat.h | >> 6 - >> 2 files changed, 75 insertions(+), 654 deletions(-) > > Nice, even after accounting for the ~300 lines added for the iterators :-) > > Two comments inline ... > >> diff --git a/fs/fat/fat.c b/fs/fat/fat.c >> index 69fa7f4cab..a50a10ba47 100644 >> --- a/fs/fat/fat.c >> +++ b/fs/fat/fat.c >> @@ -119,22 +119,6 @@ int fat_register_device(struct blk_desc *dev_desc, int >> part_no) } >> > [...] >> - >> -/* >> * Extract zero terminated short name from a directory entry. >> */ >> static void get_name(dir_entry *dirent, char *s_name) >> @@ -468,95 +452,6 @@ static int slot2str(dir_slot *slotptr, char *l_name, >> int *idx) return 0; >> } > [...] >> -} >> - >> /* Calculate short name checksum */ >> static __u8 mkcksum(const char name[8], const char ext[3]) >> { >> @@ -572,170 +467,11 @@ static __u8 mkcksum(const char name[8], const char >> ext[3]) return ret; > [...] >> >> /* >> * Read boot sector and volume info from a FAT filesystem >> @@ -877,374 +613,6 @@ static int get_fs_info(fsdata *mydata) >> return 0; >> } > [...] >> - >> - while (isdir) { >> - int startsect = mydata->data_begin >> - + START(dentptr) * mydata->clust_size; >> - dir_entry dent; >> - char *nextname = NULL; >> - >> - dent = *dentptr; >> - dentptr = >> - >> - idx = dirdelim(subname); >> - >> - if (idx >= 0) { >> - subname[idx] = '\0'; >> - nextname = subname + idx + 1; >> - /* Handle multiple delimiters */ >> - while (ISDIRDELIM(*nextname)) >> - nextname++; >> - if (dols && *nextname == '\0') >> - firsttime = 0; >> - } else { >> - if (dols && firsttime) { >> - firsttime = 0; >> - } else { >> - isdir = 0; >> - } >> - } >> - >> - if (get_dentfromdir(mydata, startsect, subname, dentptr, >> - isdir ? 0 : dols) == NULL) { >> - if (dols && !isdir) >> - *size = 0; >> - goto exit; >> - } >> - >> - if (isdir && !(dentptr->attr & ATTR_DIR)) >> - goto exit; >> - >> - /* >> - * If we are looking for a directory, and found a directory >> - * type entry, and the entry is for the root directory (as >> - * denoted by a cluster number of 0), jump back to the start >> - * of the function, since at least on FAT12/16, the root dir >> - * lives in a hard-coded location and needs special handling >> - * to parse, rather than simply following the cluster linked >> - * list in the FAT, like other directories. >> - */ > > Have you checked this case still works? AFAICS this is not covered in fs- > test.sh. Examples of suitables sandbox commands are given in the commit > message of: Directories split across clusters is definitely something that I've tested. Not sure if some of them had vfat names spanning a cluster, but handling that is inherent in the design, as it never needs more than a single dent at a time to parse vfat names. > 18a10d46f267057ede0490ddba71c106475b4eb1 (fat: handle paths that include ../) hmm, but it does look like I'm missing something to ../ back to root dir.. BR, -R >> - if (isdir && (dentptr->attr & ATTR_DIR) && !START(dentptr)) { >> - /* >> - * Modify the filename to remove the prefix that gets >> - * back to the root directory, so the initial root dir >> - * parsing code can continue from where we are without >> - * confusion. >> - */ >> - strcpy(fnamecopy, nextname ?: ""); >> - /* >> - * Set up state the same way as the function does when >> - * first started. This is required for the root dir >> - * parsing code operates in its expected environment. >> - */ >> - subname = ""; >> - cursect = mydata->rootdir_sect; >> - isdir = 0; >> - goto root_reparse; >> - } >> - >> - if (idx >= 0) >> - subname = nextname; >> - } >> - >>
Re: [U-Boot] [PATCH 0/3] dtoc: Add support for 64-bit addresses
Simon, > On 20 Jun 2017, at 05:34, Simon Glasswrote: > > This series updates dtoc to support 64-bit addresses automatically. These > appear in C code as fdt64_t arrays: > > struct dtd_test1 { > fdt64_t reg[2]; > > }; > > static struct dtd_test1 dtv_test1 = { > .reg= {0x1234, 0x5678}, > }; > > C code can then process these address and size parents easily. This > feature is controlled by the #address-cells and #size-cells values of the > parent. > > > Simon Glass (3): > dtoc: Adjust Node to record its parent > dtoc: Add a 64-bit type and a way to convert cells into 64 bits > dtoc: Add support for 32 or 64-bit addresses > > tools/dtoc/dtb_platdata.py | 62 +++ > tools/dtoc/dtoc_test_addr32.dts| 27 + > tools/dtoc/dtoc_test_addr32_64.dts | 33 ++ > tools/dtoc/dtoc_test_addr64.dts| 33 ++ > tools/dtoc/dtoc_test_addr64_32.dts | 33 ++ > tools/dtoc/fdt.py | 14 +-- > tools/dtoc/fdt_util.py | 14 +++ > tools/dtoc/test_dtoc.py| 212 + > 8 files changed, 422 insertions(+), 6 deletions(-) > create mode 100644 tools/dtoc/dtoc_test_addr32.dts > create mode 100644 tools/dtoc/dtoc_test_addr32_64.dts > create mode 100644 tools/dtoc/dtoc_test_addr64.dts > create mode 100644 tools/dtoc/dtoc_test_addr64_32.dts > > — While testing this for the TPL stage of the RK3368, I triggered an error: > Traceback (most recent call last): > File "./tools/dtoc/dtoc", line 76, in > options.output) > File > "/hgst-3tb/home/ptomsich/rk3399-spl/u-boot/tools/dtoc/dtb_platdata.py", line > 510, in run_steps > plat.scan_reg_sizes() > File > "/hgst-3tb/home/ptomsich/rk3399-spl/u-boot/tools/dtoc/dtb_platdata.py", line > 297, in scan_reg_sizes > addr = fdt_util.fdt_cells_to_cpu(val[i:], reg.na) > File "/hgst-3tb/home/ptomsich/rk3399-spl/u-boot/tools/dtoc/fdt_util.py", > line 41, in fdt_cells_to_cpu > out = long(fdt32_to_cpu(val[0])) > File "/hgst-3tb/home/ptomsich/rk3399-spl/u-boot/tools/dtoc/fdt_util.py", > line 30, in fdt32_to_cpu > return struct.unpack('>I', val)[0] > struct.error: unpack requires a string argument of length 4 with the following DTS snippet: > spi@ff12 { > compatible = "rockchip,rk3368-spi", "rockchip,rk3066-spi"; > reg = <0x0 0xff12 0x0 0x1000>; > clocks = <0xb 0x42 0xb 0x153>; > clock-names = "spiclk", "apb_pclk"; > interrupts = <0x0 0x2d 0x4>; > #address-cells = <0x1>; > #size-cells = <0x0>; > status = "okay"; > u-boot,dm-pre-reloc; > > w25q32dw@0 { > u-boot,dm-pre-reloc; > compatible = "spi-flash"; > reg = <0x0>; > spi-max-frequency = <0x2f34f60>; > spi-cpol; > spi-cpha; > }; > }; A bit of debug code shows that the error occurs during the processing of the 'w25q32dw@0’ node. Note that this is not a showstopper for the RK3368, as OF_PLATDATA is only used for TPL, which performs a return-to-bootrom anyway (and I will be making this more explicit by using the 'dm-spl’ and ‘dm-tpl’ decorators). Regards, Phil. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] hash: Compile-off SHA SW lib in case SHA HW lib is present
On Mon, Aug 14, 2017 at 05:09:46PM +0530, Sumit Garg wrote: > Commit 089df18bfe9d ("lib: move hash CONFIG options to Kconfig") > moved CONFIG_SHA1, CONFIG_SHA256, CONFIG_SHA_HW_ACCEL, and > CONFIG_SHA_PROG_HW_ACCEL config options to Kconfig. So in case of > SPL, CONFIG_SPL_HASH_SUPPORT enables CONFIG_SHA1 and CONFIG_SHA256 > which enables SHA SW library by default. But in case of platforms with > SHA HW library support, SHA SW library becomes redundant and increases > size of SPL by approx 18K. So to take care of this SHA SW library is > compiled-off in case SHA HW acceleration is present. > > Signed-off-by: Sumit Garg> --- > common/hash.c | 5 - > 1 file changed, 4 insertions(+), 1 deletion(-) Good find. Looking at the code I think this can be done a bit differently to clean up the code as well, which was the first thing I was wondering about when looking this over. I'll have a v2 of this hopefully later today (testing in travis now). Thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 3/8] fat/fs: convert to directory iterators
On Montag, 14. August 2017 15:16:15 CEST Rob Clark wrote: > And drop a whole lot of ugly code! > > Signed-off-by: Rob Clark> --- > fs/fat/fat.c | 723 > ++ include/fat.h | > 6 - > 2 files changed, 75 insertions(+), 654 deletions(-) Nice, even after accounting for the ~300 lines added for the iterators :-) Two comments inline ... > diff --git a/fs/fat/fat.c b/fs/fat/fat.c > index 69fa7f4cab..a50a10ba47 100644 > --- a/fs/fat/fat.c > +++ b/fs/fat/fat.c > @@ -119,22 +119,6 @@ int fat_register_device(struct blk_desc *dev_desc, int > part_no) } > [...] > - > -/* > * Extract zero terminated short name from a directory entry. > */ > static void get_name(dir_entry *dirent, char *s_name) > @@ -468,95 +452,6 @@ static int slot2str(dir_slot *slotptr, char *l_name, > int *idx) return 0; > } [...] > -} > - > /* Calculate short name checksum */ > static __u8 mkcksum(const char name[8], const char ext[3]) > { > @@ -572,170 +467,11 @@ static __u8 mkcksum(const char name[8], const char > ext[3]) return ret; [...] > > /* > * Read boot sector and volume info from a FAT filesystem > @@ -877,374 +613,6 @@ static int get_fs_info(fsdata *mydata) > return 0; > } [...] > - > - while (isdir) { > - int startsect = mydata->data_begin > - + START(dentptr) * mydata->clust_size; > - dir_entry dent; > - char *nextname = NULL; > - > - dent = *dentptr; > - dentptr = > - > - idx = dirdelim(subname); > - > - if (idx >= 0) { > - subname[idx] = '\0'; > - nextname = subname + idx + 1; > - /* Handle multiple delimiters */ > - while (ISDIRDELIM(*nextname)) > - nextname++; > - if (dols && *nextname == '\0') > - firsttime = 0; > - } else { > - if (dols && firsttime) { > - firsttime = 0; > - } else { > - isdir = 0; > - } > - } > - > - if (get_dentfromdir(mydata, startsect, subname, dentptr, > - isdir ? 0 : dols) == NULL) { > - if (dols && !isdir) > - *size = 0; > - goto exit; > - } > - > - if (isdir && !(dentptr->attr & ATTR_DIR)) > - goto exit; > - > - /* > - * If we are looking for a directory, and found a directory > - * type entry, and the entry is for the root directory (as > - * denoted by a cluster number of 0), jump back to the start > - * of the function, since at least on FAT12/16, the root dir > - * lives in a hard-coded location and needs special handling > - * to parse, rather than simply following the cluster linked > - * list in the FAT, like other directories. > - */ Have you checked this case still works? AFAICS this is not covered in fs- test.sh. Examples of suitables sandbox commands are given in the commit message of: 18a10d46f267057ede0490ddba71c106475b4eb1 (fat: handle paths that include ../) > - if (isdir && (dentptr->attr & ATTR_DIR) && !START(dentptr)) { > - /* > - * Modify the filename to remove the prefix that gets > - * back to the root directory, so the initial root dir > - * parsing code can continue from where we are without > - * confusion. > - */ > - strcpy(fnamecopy, nextname ?: ""); > - /* > - * Set up state the same way as the function does when > - * first started. This is required for the root dir > - * parsing code operates in its expected environment. > - */ > - subname = ""; > - cursect = mydata->rootdir_sect; > - isdir = 0; > - goto root_reparse; > - } > - > - if (idx >= 0) > - subname = nextname; > - } > - > - if (dogetsize) { > - *size = FAT2CPU32(dentptr->size); > - ret = 0; > - } else { > - ret = get_contents(mydata, dentptr, pos, buffer, maxsize, size); > - } > - debug("Size: %u, got: %llu\n", FAT2CPU32(dentptr->size), *size); > - > -exit: > - free(mydata->fatbuf); > - return ret; > -} > - > > /* > * Directory iterator, to simplify filesystem traversal > @@ -1571,12 +939,6 @@ static int fat_itr_resolve(fat_itr *itr, const char > *path, unsigned type) return -ENOENT; > } > > -int
[U-Boot] [PATCH v2 8/8] fs/fat: fix case for FAT shortnames
Noticed when comparing our output to linux. There are some lcase bits which control whether filename and/or extension should be downcase'd. Signed-off-by: Rob Clark--- fs/fat/fat.c | 17 - fs/fat/fat_write.c | 4 ++-- include/fat.h | 3 +++ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/fs/fat/fat.c b/fs/fat/fat.c index 08a066d80d..0626d4cb8c 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -29,11 +29,13 @@ static const int vfat_enabled = 0; #endif /* - * Convert a string to lowercase. + * Convert a string to lowercase. Converts at most 'len' characters, + * 'len' may be larger than the length of 'str' if 'str' is NULL + * terminated. */ -static void downcase(char *str) +static void downcase(char *str, size_t len) { - while (*str != '\0') { + while (*str != '\0' && len--) { *str = tolower(*str); str++; } @@ -131,10 +133,16 @@ static void get_name(dir_entry *dirent, char *s_name) ptr = s_name; while (*ptr && *ptr != ' ') ptr++; + if (dirent->lcase & CASE_LOWER_BASE) + downcase(s_name, (unsigned)(ptr - s_name)); if (dirent->ext[0] && dirent->ext[0] != ' ') { + char *ext; + *ptr = '.'; - ptr++; + ext = ++ptr; memcpy(ptr, dirent->ext, 3); + if (dirent->lcase & CASE_LOWER_EXT) + downcase(ext, 3); ptr[3] = '\0'; while (*ptr && *ptr != ' ') ptr++; @@ -144,7 +152,6 @@ static void get_name(dir_entry *dirent, char *s_name) *s_name = '\0'; else if (*s_name == aRING) *s_name = DELETED_FLAG; - downcase(s_name); } static int flush_dirty_fat_buffer(fsdata *mydata); diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c index f6f06289f4..3c8cc36b8a 100644 --- a/fs/fat/fat_write.c +++ b/fs/fat/fat_write.c @@ -345,7 +345,7 @@ get_long_file_name(fsdata *mydata, int curclust, __u8 *cluster, *l_name = '\0'; else if (*l_name == aRING) *l_name = DELETED_FLAG; - downcase(l_name); + downcase(l_name, ~0); /* Return the real directory entry */ *retdent = realdent; @@ -981,7 +981,7 @@ static int do_fat_write(const char *filename, void *buffer, loff_t size, memcpy(l_filename, filename, name_len); l_filename[name_len] = 0; /* terminate the string */ - downcase(l_filename); + downcase(l_filename, ~0); startsect = mydata->rootdir_sect; retdent = find_directory_entry(mydata, startsect, diff --git a/include/fat.h b/include/fat.h index b2d4b952fd..5e4924316a 100644 --- a/include/fat.h +++ b/include/fat.h @@ -128,6 +128,9 @@ typedef struct volume_info /* Boot sign comes last, 2 bytes */ } volume_info; +#define CASE_LOWER_BASE8 /* base is lower case */ +#define CASE_LOWER_EXT 16 /* extension is lower case */ + typedef struct dir_entry { charname[8],ext[3]; /* Name and extension */ __u8attr; /* Attribute bits */ -- 2.13.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 6/8] fat/fs: remove a bunch of dead code
Spotted by chance, when trying to remove file_fat_ls(), I noticed there were some dead users of the API. Signed-off-by: Rob ClarkAcked-by: Stefan Brüns --- fs/fat/Makefile | 4 -- fs/fat/file.c | 183 include/fat.h | 20 --- 3 files changed, 207 deletions(-) delete mode 100644 fs/fat/file.c diff --git a/fs/fat/Makefile b/fs/fat/Makefile index b60e8486c4..3e2a6b01a8 100644 --- a/fs/fat/Makefile +++ b/fs/fat/Makefile @@ -5,7 +5,3 @@ obj-$(CONFIG_FS_FAT) := fat.o obj-$(CONFIG_FAT_WRITE):= fat_write.o - -ifndef CONFIG_SPL_BUILD -obj-$(CONFIG_FS_FAT) += file.o -endif diff --git a/fs/fat/file.c b/fs/fat/file.c deleted file mode 100644 index 89706117b9..00 --- a/fs/fat/file.c +++ /dev/null @@ -1,183 +0,0 @@ -/* - * file.c - * - * Mini "VFS" by Marcus Sundberg - * - * 2002-07-28 - rjo...@nexus-tech.net - ported to ppcboot v1.1.6 - * 2003-03-10 - khar...@nexus-tech.net - ported to uboot - * - * SPDX-License-Identifier:GPL-2.0+ - */ - -#include -#include -#include -#include -#include -#include - -/* Supported filesystems */ -static const struct filesystem filesystems[] = { - { file_fat_detectfs, file_fat_ls, file_fat_read, "FAT" }, -}; -#define NUM_FILESYS(sizeof(filesystems)/sizeof(struct filesystem)) - -/* The filesystem which was last detected */ -static int current_filesystem = FSTYPE_NONE; - -/* The current working directory */ -#define CWD_LEN511 -char file_cwd[CWD_LEN+1] = "/"; - -const char * -file_getfsname(int idx) -{ - if (idx < 0 || idx >= NUM_FILESYS) - return NULL; - - return filesystems[idx].name; -} - -static void -pathcpy(char *dest, const char *src) -{ - char *origdest = dest; - - do { - if (dest-file_cwd >= CWD_LEN) { - *dest = '\0'; - return; - } - *(dest) = *(src); - if (*src == '\0') { - if (dest-- != origdest && ISDIRDELIM(*dest)) { - *dest = '\0'; - } - return; - } - ++dest; - - if (ISDIRDELIM(*src)) - while (ISDIRDELIM(*src)) src++; - else - src++; - } while (1); -} - -int -file_cd(const char *path) -{ - if (ISDIRDELIM(*path)) { - while (ISDIRDELIM(*path)) path++; - strncpy(file_cwd+1, path, CWD_LEN-1); - } else { - const char *origpath = path; - char *tmpstr = file_cwd; - int back = 0; - - while (*tmpstr != '\0') tmpstr++; - do { - tmpstr--; - } while (ISDIRDELIM(*tmpstr)); - - while (*path == '.') { - path++; - while (*path == '.') { - path++; - back++; - } - if (*path != '\0' && !ISDIRDELIM(*path)) { - path = origpath; - back = 0; - break; - } - while (ISDIRDELIM(*path)) path++; - origpath = path; - } - - while (back--) { - /* Strip off path component */ - while (!ISDIRDELIM(*tmpstr)) { - tmpstr--; - } - if (tmpstr == file_cwd) { - /* Incremented again right after the loop. */ - tmpstr--; - break; - } - /* Skip delimiters */ - while (ISDIRDELIM(*tmpstr)) tmpstr--; - } - tmpstr++; - if (*path == '\0') { - if (tmpstr == file_cwd) { - *tmpstr = '/'; - tmpstr++; - } - *tmpstr = '\0'; - return 0; - } - *tmpstr = '/'; - pathcpy(tmpstr+1, path); - } - - return 0; -} - -int -file_detectfs(void) -{ - int i; - - current_filesystem = FSTYPE_NONE; - - for (i = 0; i < NUM_FILESYS; i++) { - if (filesystems[i].detect() == 0) { - strcpy(file_cwd, "/"); - current_filesystem = i; - break; - } - } - - return current_filesystem; -} - -int -file_ls(const char *dir) -{ - char fullpath[1024]; - const char *arg; - - if (current_filesystem == FSTYPE_NONE) { -
[U-Boot] [PATCH v2 4/8] fs: add fs_readdir()
Needed to support efi file protocol. The fallback.efi loader wants to be able to read the contents of the /EFI directory to find an OS to boot. Modelled after POSIX opendir()/readdir()/closedir(). Unlike the other fs APIs, this is stateful (ie. state is held in the FS_DIR "directory stream"), to avoid re-traversing of the directory structure at each step. The directory stream must be released with closedir() when it is no longer needed. Signed-off-by: Rob Clark--- disk/part.c| 31 fs/fs.c| 91 ++ include/fs.h | 55 +++ include/part.h | 4 +++ 4 files changed, 169 insertions(+), 12 deletions(-) diff --git a/disk/part.c b/disk/part.c index e640a55163..3eb58a4805 100644 --- a/disk/part.c +++ b/disk/part.c @@ -327,6 +327,24 @@ int part_get_info(struct blk_desc *dev_desc, int part, return -1; } +int part_get_info_whole_disk(struct blk_desc *dev_desc, disk_partition_t *info) +{ + info->start = 0; + info->size = dev_desc->lba; + info->blksz = dev_desc->blksz; + info->bootable = 0; + strcpy((char *)info->type, BOOT_PART_TYPE); + strcpy((char *)info->name, "Whole Disk"); +#if CONFIG_IS_ENABLED(PARTITION_UUIDS) + info->uuid[0] = 0; +#endif +#ifdef CONFIG_PARTITION_TYPE_GUID + info->type_guid[0] = 0; +#endif + + return 0; +} + int blk_get_device_by_str(const char *ifname, const char *dev_hwpart_str, struct blk_desc **dev_desc) { @@ -519,18 +537,7 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str, (*dev_desc)->log2blksz = LOG2((*dev_desc)->blksz); - info->start = 0; - info->size = (*dev_desc)->lba; - info->blksz = (*dev_desc)->blksz; - info->bootable = 0; - strcpy((char *)info->type, BOOT_PART_TYPE); - strcpy((char *)info->name, "Whole Disk"); -#if CONFIG_IS_ENABLED(PARTITION_UUIDS) - info->uuid[0] = 0; -#endif -#ifdef CONFIG_PARTITION_TYPE_GUID - info->type_guid[0] = 0; -#endif + part_get_info_whole_disk(*dev_desc, info); ret = 0; goto cleanup; diff --git a/fs/fs.c b/fs/fs.c index 595ff1fe69..1b4f41920d 100644 --- a/fs/fs.c +++ b/fs/fs.c @@ -21,6 +21,7 @@ DECLARE_GLOBAL_DATA_PTR; static struct blk_desc *fs_dev_desc; +static int fs_dev_part; static disk_partition_t fs_partition; static int fs_type = FS_TYPE_ANY; @@ -69,6 +70,11 @@ static inline int fs_uuid_unsupported(char *uuid_str) return -1; } +static inline int fs_opendir_unsupported(const char *filename, FS_DIR **dirp) +{ + return -EACCES; +} + struct fstype_info { int fstype; char *name; @@ -92,6 +98,9 @@ struct fstype_info { loff_t len, loff_t *actwrite); void (*close)(void); int (*uuid)(char *uuid_str); + int (*opendir)(const char *filename, FS_DIR **dirp); + int (*readdir)(FS_DIR *dirp); + void (*closedir)(FS_DIR *dirp); }; static struct fstype_info fstypes[] = { @@ -112,6 +121,7 @@ static struct fstype_info fstypes[] = { .write = fs_write_unsupported, #endif .uuid = fs_uuid_unsupported, + .opendir = fs_opendir_unsupported, }, #endif #ifdef CONFIG_FS_EXT4 @@ -131,6 +141,7 @@ static struct fstype_info fstypes[] = { .write = fs_write_unsupported, #endif .uuid = ext4fs_uuid, + .opendir = fs_opendir_unsupported, }, #endif #ifdef CONFIG_SANDBOX @@ -146,6 +157,7 @@ static struct fstype_info fstypes[] = { .read = fs_read_sandbox, .write = fs_write_sandbox, .uuid = fs_uuid_unsupported, + .opendir = fs_opendir_unsupported, }, #endif #ifdef CONFIG_CMD_UBIFS @@ -161,6 +173,7 @@ static struct fstype_info fstypes[] = { .read = ubifs_read, .write = fs_write_unsupported, .uuid = fs_uuid_unsupported, + .opendir = fs_opendir_unsupported, }, #endif { @@ -175,6 +188,7 @@ static struct fstype_info fstypes[] = { .read = fs_read_unsupported, .write = fs_write_unsupported, .uuid = fs_uuid_unsupported, + .opendir = fs_opendir_unsupported, }, }; @@ -228,6 +242,31 @@ int fs_set_blk_dev(const char *ifname, const char *dev_part_str, int fstype) if (!info->probe(fs_dev_desc, _partition)) { fs_type = info->fstype; + fs_dev_part = part; + return 0; + } + } + + return -1; +} + +/* set current blk device w/ blk_desc + partition # */ +int fs_set_blk_dev2(struct blk_desc *desc, int part) +{ + struct
[U-Boot] [PATCH v2 7/8] fat/fs: move ls to generic implementation
Add a generic implementation of 'ls' using opendir/readdir/closedir, and replace fat's custom implementation. Other filesystems should move to the generic implementation after they add opendir/readdir/closedir support. Signed-off-by: Rob Clark--- fs/fat/fat.c | 32 fs/fs.c | 35 +-- include/fat.h | 5 - 3 files changed, 37 insertions(+), 35 deletions(-) diff --git a/fs/fat/fat.c b/fs/fat/fat.c index fe5819315b..08a066d80d 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -1002,38 +1002,6 @@ int file_fat_detectfs(void) return 0; } -int file_fat_ls(const char *dir) -{ - fsdata fsdata; - fat_itr itrblock, *itr = - int files = 0, dirs = 0; - int ret; - - ret = fat_itr_root(itr, ); - if (ret) - return ret; - - ret = fat_itr_resolve(itr, dir, TYPE_DIR); - if (ret) - return ret; - - while (fat_itr_next(itr)) { - if (fat_itr_isdir(itr)) { - printf("%s/\n", itr->name); - dirs++; - } else { - printf(" %8u %s\n", - FAT2CPU32(itr->dent->size), - itr->name); - files++; - } - } - - printf("\n%d file(s), %d dir(s)\n\n", files, dirs); - - return 0; -} - int fat_exists(const char *filename) { fsdata fsdata; diff --git a/fs/fs.c b/fs/fs.c index 1b4f41920d..374f319161 100644 --- a/fs/fs.c +++ b/fs/fs.c @@ -37,6 +37,35 @@ static inline int fs_ls_unsupported(const char *dirname) return -1; } +/* generic implementation of ls in terms of opendir/readdir/closedir */ +__maybe_unused +static int fs_ls_generic(const char *dirname) +{ + FS_DIR *dirp; + struct fs_dirent *dent; + int files = 0, dirs = 0; + + dirp = fs_opendir(dirname); + if (!dirp) + return -errno; + + while ((dent = fs_readdir(dirp))) { + if (dent->type == FS_DT_DIR) { + printf("%s/\n", dent->name); + dirs++; + } else { + printf(" %8lld %s\n", dent->size, dent->name); + files++; + } + } + + fs_closedir(dirp); + + printf("\n%d file(s), %d dir(s)\n\n", files, dirs); + + return 0; +} + static inline int fs_exists_unsupported(const char *filename) { return 0; @@ -111,7 +140,7 @@ static struct fstype_info fstypes[] = { .null_dev_desc_ok = false, .probe = fat_set_blk_dev, .close = fat_close, - .ls = file_fat_ls, + .ls = fs_ls_generic, .exists = fat_exists, .size = fat_size, .read = fat_read_file, @@ -121,7 +150,9 @@ static struct fstype_info fstypes[] = { .write = fs_write_unsupported, #endif .uuid = fs_uuid_unsupported, - .opendir = fs_opendir_unsupported, + .opendir = fat_opendir, + .readdir = fat_readdir, + .closedir = fat_closedir, }, #endif #ifdef CONFIG_FS_EXT4 diff --git a/include/fat.h b/include/fat.h index 1e8bc44e9a..b2d4b952fd 100644 --- a/include/fat.h +++ b/include/fat.h @@ -11,6 +11,7 @@ #define _FAT_H_ #include +#include #define CONFIG_SUPPORT_VFAT /* Maximum Long File Name length supported here is 128 UTF-16 code units */ @@ -172,7 +173,6 @@ typedef struct { } fsdata; int file_fat_detectfs(void); -int file_fat_ls(const char *dir); int fat_exists(const char *filename); int fat_size(const char *filename, loff_t *size); int file_fat_read_at(const char *filename, loff_t pos, void *buffer, @@ -185,5 +185,8 @@ int file_fat_write(const char *filename, void *buf, loff_t offset, loff_t len, loff_t *actwrite); int fat_read_file(const char *filename, void *buf, loff_t offset, loff_t len, loff_t *actread); +int fat_opendir(const char *filename, FS_DIR **dirp); +int fat_readdir(FS_DIR *dirp); +void fat_closedir(FS_DIR *dirp); void fat_close(void); #endif /* _FAT_H_ */ -- 2.13.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 3/8] fat/fs: convert to directory iterators
And drop a whole lot of ugly code! Signed-off-by: Rob Clark--- fs/fat/fat.c | 723 ++ include/fat.h | 6 - 2 files changed, 75 insertions(+), 654 deletions(-) diff --git a/fs/fat/fat.c b/fs/fat/fat.c index 69fa7f4cab..a50a10ba47 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -119,22 +119,6 @@ int fat_register_device(struct blk_desc *dev_desc, int part_no) } /* - * Get the first occurence of a directory delimiter ('/' or '\') in a string. - * Return index into string if found, -1 otherwise. - */ -static int dirdelim(char *str) -{ - char *start = str; - - while (*str != '\0') { - if (ISDIRDELIM(*str)) - return str - start; - str++; - } - return -1; -} - -/* * Extract zero terminated short name from a directory entry. */ static void get_name(dir_entry *dirent, char *s_name) @@ -468,95 +452,6 @@ static int slot2str(dir_slot *slotptr, char *l_name, int *idx) return 0; } -/* - * Extract the full long filename starting at 'retdent' (which is really - * a slot) into 'l_name'. If successful also copy the real directory entry - * into 'retdent' - * Return 0 on success, -1 otherwise. - */ -static int -get_vfatname(fsdata *mydata, int curclust, __u8 *cluster, -dir_entry *retdent, char *l_name) -{ - dir_entry *realdent; - dir_slot *slotptr = (dir_slot *)retdent; - __u8 *buflimit = cluster + mydata->sect_size * ((curclust == 0) ? - PREFETCH_BLOCKS : - mydata->clust_size); - __u8 counter = (slotptr->id & ~LAST_LONG_ENTRY_MASK) & 0xff; - int idx = 0; - - if (counter > VFAT_MAXSEQ) { - debug("Error: VFAT name is too long\n"); - return -1; - } - - while ((__u8 *)slotptr < buflimit) { - if (counter == 0) - break; - if (((slotptr->id & ~LAST_LONG_ENTRY_MASK) & 0xff) != counter) - return -1; - slotptr++; - counter--; - } - - if ((__u8 *)slotptr >= buflimit) { - dir_slot *slotptr2; - - if (curclust == 0) - return -1; - curclust = get_fatent(mydata, curclust); - if (CHECK_CLUST(curclust, mydata->fatsize)) { - debug("curclust: 0x%x\n", curclust); - printf("Invalid FAT entry\n"); - return -1; - } - - if (get_cluster(mydata, curclust, get_contents_vfatname_block, - mydata->clust_size * mydata->sect_size) != 0) { - debug("Error: reading directory block\n"); - return -1; - } - - slotptr2 = (dir_slot *)get_contents_vfatname_block; - while (counter > 0) { - if (((slotptr2->id & ~LAST_LONG_ENTRY_MASK) - & 0xff) != counter) - return -1; - slotptr2++; - counter--; - } - - /* Save the real directory entry */ - realdent = (dir_entry *)slotptr2; - while ((__u8 *)slotptr2 > get_contents_vfatname_block) { - slotptr2--; - slot2str(slotptr2, l_name, ); - } - } else { - /* Save the real directory entry */ - realdent = (dir_entry *)slotptr; - } - - do { - slotptr--; - if (slot2str(slotptr, l_name, )) - break; - } while (!(slotptr->id & LAST_LONG_ENTRY_MASK)); - - l_name[idx] = '\0'; - if (*l_name == DELETED_FLAG) - *l_name = '\0'; - else if (*l_name == aRING) - *l_name = DELETED_FLAG; - downcase(l_name); - - /* Return the real directory entry */ - memcpy(retdent, realdent, sizeof(dir_entry)); - - return 0; -} - /* Calculate short name checksum */ static __u8 mkcksum(const char name[8], const char ext[3]) { @@ -572,170 +467,11 @@ static __u8 mkcksum(const char name[8], const char ext[3]) return ret; } -/* - * Get the directory entry associated with 'filename' from the directory - * starting at 'startsect' - */ +// These should probably DIAF.. __u8 get_dentfromdir_block[MAX_CLUSTSIZE] __aligned(ARCH_DMA_MINALIGN); - -static dir_entry *get_dentfromdir(fsdata *mydata, int startsect, - char *filename, dir_entry *retdent, - int dols) -{ - __u16 prevcksum = 0x; - __u32 curclust = START(retdent); - int files = 0, dirs = 0; - - debug("get_dentfromdir: %s\n", filename); - -
[U-Boot] [PATCH v2 5/8] fs/fat: implement opendir/readdir/closedir
Implement the readdir interface using the directory iterators. Signed-off-by: Rob Clark--- fs/fat/fat.c | 56 1 file changed, 56 insertions(+) diff --git a/fs/fat/fat.c b/fs/fat/fat.c index a50a10ba47..fe5819315b 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -1119,6 +1120,61 @@ int fat_read_file(const char *filename, void *buf, loff_t offset, loff_t len, return ret; } +typedef struct { + FS_DIR parent; + fsdata fsdata; + fat_itr itr; +} fat_dir; + +int fat_opendir(const char *filename, FS_DIR **dirp) +{ + fat_dir *dir = malloc(sizeof(*dir)); + int ret; + + if (!dir) + return -ENOMEM; + + ret = fat_itr_root(>itr, >fsdata); + if (ret) + goto fail; + + ret = fat_itr_resolve(>itr, filename, TYPE_DIR); + if (ret) + goto fail; + + *dirp = (FS_DIR *)dir; + return 0; + +fail: + free(dir); + return ret; +} + +int fat_readdir(FS_DIR *dirp) +{ + fat_dir *dir = (fat_dir *)dirp; + struct fs_dirent *dent = >dirent; + + if (!fat_itr_next(>itr)) + return -ENOENT; + + strcpy(dent->name, dir->itr.name); + if (fat_itr_isdir(>itr)) { + dent->type = FS_DT_DIR; + } else { + dent->type = FS_DT_REG; + dent->size = FAT2CPU32(dir->itr.dent->size); + } + + return 0; +} + +void fat_closedir(FS_DIR *dirp) +{ + fat_dir *dir = (fat_dir *)dirp; + free(dir); +} + void fat_close(void) { } -- 2.13.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 2/8] fs/fat: introduce new director iterators
Untangle directory traversal into a simple iterator, to replace the existing multi-purpose do_fat_read_at() + get_dentfromdir(). Signed-off-by: Rob Clark--- fs/fat/fat.c | 326 +++ 1 file changed, 326 insertions(+) diff --git a/fs/fat/fat.c b/fs/fat/fat.c index eb3792d4c1..69fa7f4cab 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -1245,6 +1245,332 @@ exit: return ret; } + +/* + * Directory iterator, to simplify filesystem traversal + */ + +typedef struct { + fsdata*fsdata; + unsigned cursect; + dir_entry *dent; + intremaining; /* remaining dent's in current cluster */ + intlast_cluster; + intis_root; + + /* current iterator position values: */ + char l_name[VFAT_MAXLEN_BYTES]; + char s_name[14]; + char *name; /* l_name if there is one, else s_name */ + + u8 block[MAX_CLUSTSIZE] __aligned(ARCH_DMA_MINALIGN); +} fat_itr; + +static int fat_itr_isdir(fat_itr *itr); + +/** + * fat_itr_root() - initialize an iterator to start at the root + * directory + * + * @itr: iterator to initialize + * @fsdata: filesystem data for the partition + * @return 0 on success, else -errno + */ +static int fat_itr_root(fat_itr *itr, fsdata *fsdata) +{ + if (get_fs_info(fsdata)) + return -ENXIO; + + itr->fsdata = fsdata; + itr->cursect = fsdata->rootdir_sect; + itr->dent = NULL; + itr->remaining = 0; + itr->last_cluster = 0; + itr->is_root = 1; + + return 0; +} + +/** + * fat_itr_child() - initialize an iterator to descend into a sub- + * directory + * + * Initializes 'itr' to iterate the contents of the directory at + * the current cursor position of 'parent'. It is an error to + * call this if the current cursor of 'parent' is pointing at a + * regular file. + * + * Note that 'itr' and 'parent' can be the same pointer if you do + * not need to preserve 'parent' after this call, which is useful + * for traversing directory structure to resolve a file/directory. + * + * @itr: iterator to initialize + * @parent: the iterator pointing at a directory entry in the + *parent directory of the directory to iterate + */ +static void fat_itr_child(fat_itr *itr, fat_itr *parent) +{ + fsdata *mydata = parent->fsdata; /* for silly macros */ + unsigned clustnum = START(parent->dent); + + assert(fat_itr_isdir(parent)); + + itr->fsdata = parent->fsdata; + if (clustnum > 0) { + itr->cursect = itr->fsdata->data_begin + + (clustnum * itr->fsdata->clust_size); + } else { + itr->cursect = 0; + } + itr->dent = NULL; + itr->remaining = 0; + itr->last_cluster = 0; + itr->is_root = 0; +} + +static void *next_cluster(fat_itr *itr) +{ + fsdata *mydata = itr->fsdata; /* for silly macros */ + int ret; + + /* have we reached the end? */ + if (itr->last_cluster) + return NULL; + + debug("FAT read(sect=%d), clust_size=%d, DIRENTSPERBLOCK=%zd\n", + itr->cursect, itr->fsdata->clust_size, DIRENTSPERBLOCK); + + /* +* NOTE: do_fat_read_at() had complicated logic to deal w/ +* vfat names that span multiple clusters in the fat16 case, +* which get_dentfromdir() probably also needed (and was +* missing). And not entirely sure what fat32 didn't have +* the same issue.. We solve that by only caring about one +* dent at a time and iteratively constructing the vfat long +* name. +*/ + ret = disk_read(itr->cursect, itr->fsdata->clust_size, + itr->block); + if (ret < 0) { + debug("Error: reading block\n"); + return NULL; + } + + if (itr->is_root && itr->fsdata->fatsize != 32) { + itr->cursect++; + if (itr->cursect - itr->fsdata->rootdir_sect >= + itr->fsdata->rootdir_size) { + debug("cursect: 0x%x\n", itr->cursect); + itr->last_cluster = 1; + } + } else { + itr->cursect = get_fatent(itr->fsdata, itr->cursect); + if (CHECK_CLUST(itr->cursect, itr->fsdata->fatsize)) { + debug("cursect: 0x%x\n", itr->cursect); + itr->last_cluster = 1; + } + } + + return itr->block; +} + +static dir_entry *next_dent(fat_itr *itr) +{ + if (itr->remaining == 0) { + struct dir_entry *dent = next_cluster(itr); + + /* have we reached the last cluster? */ + if (!dent) + return NULL; + + itr->remaining = itr->fsdata->sect_size / sizeof(dir_entry) - 1; + itr->dent = dent; + } else { +
[U-Boot] [PATCH v2 0/8] fs/fat: cleanups + readdir implementation
Introduce directory traversal iterators, and implement fs_readdir() which is needed by EFI_LOADER. The part re-working fat.c to use the directory iterators itself is nearly a 2:1 negative diffstat, and a pretty big cleanup. I fixed one or two other small issues along the way. It hasn't really been tested with a wide variaty of different fat filesystems (if someone has a collection of disk images to test with somewhere, let me know), but it seems at least not worse than what it is replacing. Changes since v1: * fix+comment downcase() * fix partition-is-whole-disk case * fix missing fs_closedir() in generic ls implementation Rob Clark (8): fs/fat: split out helper to init fsdata fs/fat: introduce new director iterators fat/fs: convert to directory iterators fs: add fs_readdir() fs/fat: implement opendir/readdir/closedir fat/fs: remove a bunch of dead code fat/fs: move ls to generic implementation fs/fat: fix case for FAT shortnames disk/part.c| 31 +- fs/fat/Makefile|4 - fs/fat/fat.c | 1025 +--- fs/fat/fat_write.c |4 +- fs/fat/file.c | 183 -- fs/fs.c| 124 ++- include/fat.h | 35 +- include/fs.h | 55 +++ include/part.h |4 + 9 files changed, 622 insertions(+), 843 deletions(-) delete mode 100644 fs/fat/file.c -- 2.13.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 1/8] fs/fat: split out helper to init fsdata
Want to re-use this in fat dirent iterator in next patch. Signed-off-by: Rob Clark--- fs/fat/fat.c | 73 +++ include/fat.h | 1 + 2 files changed, 44 insertions(+), 30 deletions(-) diff --git a/fs/fat/fat.c b/fs/fat/fat.c index 9ad18f96ff..eb3792d4c1 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -808,35 +808,17 @@ exit: return ret; } -__u8 do_fat_read_at_block[MAX_CLUSTSIZE] - __aligned(ARCH_DMA_MINALIGN); - -int do_fat_read_at(const char *filename, loff_t pos, void *buffer, - loff_t maxsize, int dols, int dogetsize, loff_t *size) +static int get_fs_info(fsdata *mydata) { - char fnamecopy[2048]; boot_sector bs; volume_info volinfo; - fsdata datablock; - fsdata *mydata = - dir_entry *dentptr = NULL; - __u16 prevcksum = 0x; - char *subname = ""; - __u32 cursect; - int idx, isdir = 0; - int files = 0, dirs = 0; - int ret = -1; - int firsttime; __u32 root_cluster = 0; - __u32 read_blk; - int rootdir_size = 0; - int buffer_blk_cnt; - int do_read; - __u8 *dir_ptr; + int ret; - if (read_bootsectandvi(, , >fatsize)) { + ret = read_bootsectandvi(, , >fatsize); + if (ret) { debug("Error: reading boot sector\n"); - return -1; + return ret; } if (mydata->fatsize == 32) { @@ -848,8 +830,7 @@ int do_fat_read_at(const char *filename, loff_t pos, void *buffer, mydata->fat_sect = bs.reserved; - cursect = mydata->rootdir_sect - = mydata->fat_sect + mydata->fatlength * bs.fats; + mydata->rootdir_sect = mydata->fat_sect + mydata->fatlength * bs.fats; mydata->sect_size = (bs.sector_size[1] << 8) + bs.sector_size[0]; mydata->clust_size = bs.cluster_size; @@ -863,12 +844,12 @@ int do_fat_read_at(const char *filename, loff_t pos, void *buffer, mydata->data_begin = mydata->rootdir_sect - (mydata->clust_size * 2); } else { - rootdir_size = ((bs.dir_entries[1] * (int)256 + -bs.dir_entries[0]) * -sizeof(dir_entry)) / -mydata->sect_size; + mydata->rootdir_size = ((bs.dir_entries[1] * (int)256 + +bs.dir_entries[0]) * +sizeof(dir_entry)) / +mydata->sect_size; mydata->data_begin = mydata->rootdir_sect + - rootdir_size - + mydata->rootdir_size - (mydata->clust_size * 2); } @@ -893,6 +874,38 @@ int do_fat_read_at(const char *filename, loff_t pos, void *buffer, debug("Sector size: %d, cluster size: %d\n", mydata->sect_size, mydata->clust_size); + return 0; +} + +__u8 do_fat_read_at_block[MAX_CLUSTSIZE] + __aligned(ARCH_DMA_MINALIGN); + +int do_fat_read_at(const char *filename, loff_t pos, void *buffer, + loff_t maxsize, int dols, int dogetsize, loff_t *size) +{ + char fnamecopy[2048]; + fsdata datablock; + fsdata *mydata = + dir_entry *dentptr = NULL; + __u16 prevcksum = 0x; + char *subname = ""; + __u32 cursect; + int idx, isdir = 0; + int files = 0, dirs = 0; + int ret = -1; + int firsttime; + __u32 root_cluster = 0; + __u32 read_blk; + int rootdir_size = 0; + int buffer_blk_cnt; + int do_read; + __u8 *dir_ptr; + + if (get_fs_info(mydata)) + return -1; + + cursect = mydata->rootdir_sect; + /* "cwd" is always the root... */ while (ISDIRDELIM(*filename)) filename++; diff --git a/include/fat.h b/include/fat.h index 71879f01ca..6d3fc8e4a6 100644 --- a/include/fat.h +++ b/include/fat.h @@ -174,6 +174,7 @@ typedef struct { __u16 clust_size; /* Size of clusters in sectors */ int data_begin; /* The sector of the first cluster, can be negative */ int fatbufnum; /* Used by get_fatent, init to -1 */ + int rootdir_size; } fsdata; typedef int(file_detectfs_func)(void); -- 2.13.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 0/8] fs/fat: cleanups + readdir implementation
On Mon, Aug 14, 2017 at 08:48:47AM -0400, Rob Clark wrote: > On Sun, Aug 13, 2017 at 5:59 PM, Tom Riniwrote: > > On Sun, Aug 13, 2017 at 05:50:39PM -0400, Rob Clark wrote: > >> On Sun, Aug 13, 2017 at 5:13 PM, Tom Rini wrote: > >> > On Sun, Aug 13, 2017 at 06:45:20AM -0400, Rob Clark wrote: > >> > > >> >> Introduce directory traversal iterators, and implement fs_readdir() > >> >> which is needed by EFI_LOADER. > >> >> > >> >> The part re-working fat.c to use the directory iterators itself is > >> >> nearly a 2:1 negative diffstat, and a pretty big cleanup. I fixed > >> >> one or two other small issues along the way. It hasn't really been > >> >> tested with a wide variaty of different fat filesystems (if someone > >> >> has a collection of disk images to test with somewhere, let me know), > >> >> but it seems at least not worse than what it is replacing. > >> > > >> > Did you run test/fs/fs-test.sh and confirm there's at least no > >> > regressions? Thanks! > >> > >> I've been having trouble getting fs-test.sh to pass even without my > >> changes, so no.. > > > > Pass, or provide expected results? From the script, we expect: > > # Total Summary: TOTAL PASS: 132 TOTAL FAIL: 6 > > Ok, I was missing special case handling for the "partition is whole > disk" case (which I *guess* is only a sandbox thing?).. FWIW, nope, I believe some atmel boards utilize whole disk as FAT, IIRC, from when I was trying to come up with a good default value for the ENV_IS_IN_FAT Kconfig options. [snip] > fixed (and excluding the ext4 tests which have unrelated problems on > my setup): > > Total Summary: TOTAL PASS: 63 TOTAL FAIL: 6 > > So if the 6 failed fat tests (below) are "normal", then I guess we're > good.. I'll post a v2 shortly. Great, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 0/8] fs/fat: cleanups + readdir implementation
On Sun, Aug 13, 2017 at 5:59 PM, Tom Riniwrote: > On Sun, Aug 13, 2017 at 05:50:39PM -0400, Rob Clark wrote: >> On Sun, Aug 13, 2017 at 5:13 PM, Tom Rini wrote: >> > On Sun, Aug 13, 2017 at 06:45:20AM -0400, Rob Clark wrote: >> > >> >> Introduce directory traversal iterators, and implement fs_readdir() >> >> which is needed by EFI_LOADER. >> >> >> >> The part re-working fat.c to use the directory iterators itself is >> >> nearly a 2:1 negative diffstat, and a pretty big cleanup. I fixed >> >> one or two other small issues along the way. It hasn't really been >> >> tested with a wide variaty of different fat filesystems (if someone >> >> has a collection of disk images to test with somewhere, let me know), >> >> but it seems at least not worse than what it is replacing. >> > >> > Did you run test/fs/fs-test.sh and confirm there's at least no >> > regressions? Thanks! >> >> I've been having trouble getting fs-test.sh to pass even without my >> changes, so no.. > > Pass, or provide expected results? From the script, we expect: > # Total Summary: TOTAL PASS: 132 TOTAL FAIL: 6 Ok, I was missing special case handling for the "partition is whole disk" case (which I *guess* is only a sandbox thing?).. but with that fixed (and excluding the ext4 tests which have unrelated problems on my setup): Total Summary: TOTAL PASS: 63 TOTAL FAIL: 6 So if the 6 failed fat tests (below) are "normal", then I guess we're good.. I'll post a v2 shortly. ** Start sandbox/test/fs/fs-test.nonfs.fat.out_clean FAIL - TC12: 1MB write to . - write denied FAIL - TC13: 1MB read from ./1MB.file.w2 - content verified FAIL - TC13: 1MB read from 1MB.file.w2 - content verified ** Start sandbox/test/fs/fs-test.fs.fat.out_clean FAIL - TC12: 1MB write to . - write denied FAIL - TC13: 1MB read from ./1MB.file.w2 - content verified FAIL - TC13: 1MB read from 1MB.file.w2 - content verified BR, -R >> Not entirely sure if I have newer kernel/etc compared to the last >> person who ran fs-test.sh, or if there is something on u-boot side >> which changed without corresponding change in fs-test.sh. > > Note that this script it part of my > everything-my-lab-isn't-giving-me-fits loop. I'm probably going to > split that loop into pure-SW and HW, as the HW part is what's driving me > crazy most of the time. > > -- > Tom ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] hash: Compile-off SHA SW lib in case SHA HW lib is present
Commit 089df18bfe9d ("lib: move hash CONFIG options to Kconfig") moved CONFIG_SHA1, CONFIG_SHA256, CONFIG_SHA_HW_ACCEL, and CONFIG_SHA_PROG_HW_ACCEL config options to Kconfig. So in case of SPL, CONFIG_SPL_HASH_SUPPORT enables CONFIG_SHA1 and CONFIG_SHA256 which enables SHA SW library by default. But in case of platforms with SHA HW library support, SHA SW library becomes redundant and increases size of SPL by approx 18K. So to take care of this SHA SW library is compiled-off in case SHA HW acceleration is present. Signed-off-by: Sumit Garg--- common/hash.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/hash.c b/common/hash.c index 771d8fa..3f75c77 100644 --- a/common/hash.c +++ b/common/hash.c @@ -30,6 +30,7 @@ #include #include +#ifndef CONFIG_SHA_HW_ACCEL #ifdef CONFIG_SHA1 static int hash_init_sha1(struct hash_algo *algo, void **ctxp) { @@ -85,6 +86,7 @@ static int hash_finish_sha256(struct hash_algo *algo, void *ctx, void return 0; } #endif +#endif static int hash_init_crc32(struct hash_algo *algo, void **ctxp) { @@ -144,7 +146,7 @@ static struct hash_algo hash_algo[] = { hw_sha_finish, #endif }, -#endif +#else #ifdef CONFIG_SHA1 { "sha1", @@ -167,6 +169,7 @@ static struct hash_algo hash_algo[] = { hash_finish_sha256, }, #endif +#endif { "crc32", 4, -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 3/3] rockchip: evb-rv1108: add usb init function for dwc2 gadget
Dear Simon, 在 2017年08月14日 05:35, Simon Glass 写道: On 8 August 2017 at 21:36, William Wuwrote: This patch implements board_usb_init() for dwc2 gadget, it generally called from do_fastboot to do dwc2 udc probe and support fastboot over USB. Signed-off-by: William Wu --- board/rockchip/evb_rv1108/evb_rv1108.c | 47 ++ 1 file changed, 47 insertions(+) diff --git a/board/rockchip/evb_rv1108/evb_rv1108.c b/board/rockchip/evb_rv1108/evb_rv1108.c index fe37eac..8ca5ee6 100644 --- a/board/rockchip/evb_rv1108/evb_rv1108.c +++ b/board/rockchip/evb_rv1108/evb_rv1108.c @@ -50,3 +50,50 @@ int dram_init_banksize(void) return 0; } + +#if defined(CONFIG_USB_GADGET) && defined(CONFIG_USB_GADGET_DWC2_OTG) +#include +#include + +static struct dwc2_plat_otg_data rv1108_otg_data = { + .rx_fifo_sz = 512, + .np_tx_fifo_sz = 16, + .tx_fifo_sz = 128, +}; + +int board_usb_init(int index, enum usb_init_type init) +{ + int node; + const char *mode; + bool matched = false; + const void *blob = gd->fdt_blob; + + /* find the usb_otg node */ + node = fdt_node_offset_by_compatible(blob, -1, + "rockchip,rv1108-usb"); + + while (node > 0) { + mode = fdt_getprop(blob, node, "dr_mode", NULL); + if (mode && strcmp(mode, "otg") == 0) { + matched = true; + break; + } + + node = fdt_node_offset_by_compatible(blob, node, + "rockchip,rv1108-usb"); + } + if (!matched) { + debug("Not found usb_otg device\n"); + return -ENODEV; + } + + rv1108_otg_data.regs_otg = fdtdec_get_addr(blob, node, "reg"); + + return dwc2_udc_probe(_otg_data); These USB init things have been bothering me for a while. Do you think this could be changed into a driver that you could probe with device_probe()? Then much of the code in here would not be needed and it might be easier to tidy it up when we have proper driver-model support for USB device mode. Yes, on rockchip platforms, it did most of the same USB init things in different board special drivers. I think may be we can try to optimize the code in two different ways. Method1. 1. Move the USB init things from board_usb_init(), just simply call dwc2_udc_probe(). 2. Create a new USB init function in drivers/usb/gadget/dwc2_udc_otg.c, and call it in dwc2_udc_probe(). 3. Use fdt (Flat Device Tree manipulation ) to parse the dts, and get the regs_phy, regs_otg and so on. Method2. Just like your suggestion, use driver-model method to probe with device_probe, actually, I don't know much about the driver-model, as far as I know, we may need to do the following work: 1. Create a new uclass id for usb udc, and declare a new uclass_driver with UCLASS_DRIVER, and also need to create a new U-boot driver for dwc2 controller with U_BOOT_DRIVER. 2. How to call device_probe()? Maybe it's better to create a new driver (like drivers/usb/host/usb-uclass.c) in drivers/usb/gadget to match different usb gadget controllers, and wrap the device_probe() to a new function (like udc_pre_probe()), and then different udc driver can call it, e.g. dwc2_udc_probe() --> udc_pre_probe() --> device_probe() In summary, method1 is easily to be done, but method2 is more generic. I hope I haven't misunderstood your proposal, and hope to get your reply. Thank you! +} + +int board_usb_cleanup(int index, enum usb_init_type init) +{ + return 0; +} +#endif -- 2.0.0 Regards, Simon -- 吴良峰 William.Wu 福建省福州市铜盘路软件大道89号软件园A区21号楼 No.21 Building, A District, No.89,software Boulevard Fuzhou,Fujian, PRC 手机: 13685012275 座机: 0591-83991906-8520 邮件:w...@rock-chips.com ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 2/2] pinctrl: imx7ulp: Add new info instance for iomuxc1
To i.MX7ULP, we need to create two info instances for iomux0 and iomux1 respectively, otherwise iomuxc0/1 will share one info instance and use one base, because imx_pinctrl_probe will use info to store base address and etc. But iomuxc0/1 actually have different base address. Signed-off-by: Peng FanCc: Simon Glass Cc: Stefano Babic --- drivers/pinctrl/nxp/pinctrl-imx7ulp.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/pinctrl/nxp/pinctrl-imx7ulp.c b/drivers/pinctrl/nxp/pinctrl-imx7ulp.c index 4a893e5..618ce6a 100644 --- a/drivers/pinctrl/nxp/pinctrl-imx7ulp.c +++ b/drivers/pinctrl/nxp/pinctrl-imx7ulp.c @@ -12,7 +12,11 @@ #include "pinctrl-imx.h" -static struct imx_pinctrl_soc_info imx7ulp_pinctrl_soc_info = { +static struct imx_pinctrl_soc_info imx7ulp_pinctrl_soc_info0 = { + .flags = ZERO_OFFSET_VALID | SHARE_MUX_CONF_REG | CONFIG_IBE_OBE, +}; + +static struct imx_pinctrl_soc_info imx7ulp_pinctrl_soc_info1 = { .flags = ZERO_OFFSET_VALID | SHARE_MUX_CONF_REG | CONFIG_IBE_OBE, }; @@ -25,8 +29,8 @@ static int imx7ulp_pinctrl_probe(struct udevice *dev) } static const struct udevice_id imx7ulp_pinctrl_match[] = { - { .compatible = "fsl,imx7ulp-iomuxc-0", .data = (ulong)_pinctrl_soc_info }, - { .compatible = "fsl,imx7ulp-iomuxc-1", .data = (ulong)_pinctrl_soc_info }, + { .compatible = "fsl,imx7ulp-iomuxc-0", .data = (ulong)_pinctrl_soc_info0 }, + { .compatible = "fsl,imx7ulp-iomuxc-1", .data = (ulong)_pinctrl_soc_info1 }, { /* sentinel */ } }; -- 2.6.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 1/2] pinctrl: imx: Fix mask when SHARE_MUX_CONF_REG is set
when using SHARE_MUX_CONF_REG, wrong mask is used for writing config value, which causes mux value is cleared. Signed-off-by: Peng FanCc: Simon Glass Cc: Stefano Babic --- drivers/pinctrl/nxp/pinctrl-imx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/nxp/pinctrl-imx.c b/drivers/pinctrl/nxp/pinctrl-imx.c index 1b6107f..32cbac9 100644 --- a/drivers/pinctrl/nxp/pinctrl-imx.c +++ b/drivers/pinctrl/nxp/pinctrl-imx.c @@ -158,7 +158,7 @@ static int imx_pinctrl_set_state(struct udevice *dev, struct udevice *config) if (!(config_val & IMX_NO_PAD_CTL)) { if (info->flags & SHARE_MUX_CONF_REG) { clrsetbits_le32(info->base + conf_reg, - info->mux_mask, config_val); + ~info->mux_mask, config_val); } else { writel(config_val, info->base + conf_reg); } -- 2.6.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] i2c: muxes: add i2c gpio multiplexer driver
Add an i2c mux driver providing access to i2c bus segments using a hardware MUX sitting on a master bus and controlled through gpio pins. E.G. something like: -- -- Bus segment 1 - - - - - | | SCL/SDA| |-- | | | || | | || | Bus segment 2 | | | Linux | GPIO 1..N | MUX|--- Devices | || | | | | || | Bus segment M | || |---| | -- -- - - - - - SCL/SDA of the master I2C bus is multiplexed to bus segment 1..M according to the settings of the GPIO pins 1..N. Note commit log from kernel commit 92ed1a76("i2c: Add generic I2C multiplexer using GPIO API") Signed-off-by: Peng FanTested-by: Peng Fan (i.MX6QP-Sabreauto) Cc: Heiko Schocher Cc: Stefano Babic Cc: Simon Glass --- drivers/i2c/muxes/Kconfig| 9 +++ drivers/i2c/muxes/Makefile | 1 + drivers/i2c/muxes/i2c-mux-gpio.c | 138 +++ 3 files changed, 148 insertions(+) create mode 100644 drivers/i2c/muxes/i2c-mux-gpio.c diff --git a/drivers/i2c/muxes/Kconfig b/drivers/i2c/muxes/Kconfig index 48900ed..156380c 100644 --- a/drivers/i2c/muxes/Kconfig +++ b/drivers/i2c/muxes/Kconfig @@ -34,3 +34,12 @@ config I2C_MUX_PCA954x paritioning I2C bus and connect multiple devices with the same address to the same I2C controller where driver handles proper routing to target i2c device. PCA9544 and PCA9548 are supported. + +config I2C_MUX_GPIO +tristate "GPIO-based I2C multiplexer" + depends on I2C_MUX && DM_GPIO + help + If you say yes to this option, support will be included for + a GPIO based I2C multiplexer. This driver provides access to + I2C busses connected through a MUX, which is controlled + through GPIO pins. diff --git a/drivers/i2c/muxes/Makefile b/drivers/i2c/muxes/Makefile index 0811add..3831f4e 100644 --- a/drivers/i2c/muxes/Makefile +++ b/drivers/i2c/muxes/Makefile @@ -6,3 +6,4 @@ obj-$(CONFIG_I2C_ARB_GPIO_CHALLENGE) += i2c-arb-gpio-challenge.o obj-$(CONFIG_$(SPL_)I2C_MUX) += i2c-mux-uclass.o obj-$(CONFIG_I2C_MUX_PCA954x) += pca954x.o +obj-$(CONFIG_I2C_MUX_GPIO) += i2c-mux-gpio.o diff --git a/drivers/i2c/muxes/i2c-mux-gpio.c b/drivers/i2c/muxes/i2c-mux-gpio.c new file mode 100644 index 000..28e74ae --- /dev/null +++ b/drivers/i2c/muxes/i2c-mux-gpio.c @@ -0,0 +1,138 @@ +/* + * I2C multiplexer using GPIO API + * + * Copyright 2017 NXP + * + * Peng Fan + * + * SPDX-License-Identifier:GPL-2.0+ + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +/** + * struct i2c_mux_gpio_priv - private data for i2c mux gpio + * + * @values: the reg value of each child node + * @n_values: num of regs + * @gpios: the mux-gpios array + * @n_gpios: num of gpios in mux-gpios + * @idle: the value of idle-state + */ +struct i2c_mux_gpio_priv { + u32 *values; + int n_values; + struct gpio_desc *gpios; + int n_gpios; + u32 idle; +}; + + +static int i2c_mux_gpio_select(struct udevice *dev, struct udevice *bus, + uint channel) +{ + struct i2c_mux_gpio_priv *priv = dev_get_priv(dev); + int i, ret; + + for (i = 0; i < priv->n_gpios; i++) { + ret = dm_gpio_set_value(>gpios[i], (channel >> i) & 1); + if (ret) + return ret; + } + + return 0; +} + +static int i2c_mux_gpio_deselect(struct udevice *dev, struct udevice *bus, +uint channel) +{ + struct i2c_mux_gpio_priv *priv = dev_get_priv(dev); + int i, ret; + + for (i = 0; i < priv->n_gpios; i++) { + ret = dm_gpio_set_value(>gpios[i], (priv->idle >> i) & 1); + if (ret) + return ret; + } + + return 0; +} + +static int i2c_mux_gpio_probe(struct udevice *dev) +{ + const void *fdt = gd->fdt_blob; + int node = dev_of_offset(dev); + struct i2c_mux_gpio_priv *mux = dev_get_priv(dev); + struct gpio_desc *gpios; + u32 *values; + int i = 0, subnode, ret; + + mux->n_values = fdtdec_get_child_count(fdt, node); + values = devm_kzalloc(dev, sizeof(*mux->values) * mux->n_values, + GFP_KERNEL); + if (!values) { + dev_err(dev, "Cannot alloc values array"); + return -ENOMEM; + } + + fdt_for_each_subnode(subnode, fdt, node) { + *(values + i) =
Re: [U-Boot] [PATCH] nios2: 10m50: Add CPU pre-relocation in device tree
Hi all, this patch has been sent for a while. I did cc the patch to the u-boot custodian for Nios II, Thomas Chou. Can I know how can I get this patch reviewed and merged sooner? Thank you. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] rockchip: rk322x: Disable integrated macphy for saving power consuming
Unfortunately, the integrated macphy default is enabled, which will increase power consuming, if we do not use this PHY. So let's disable it at first, which will save power consuming. If we really use it, then enable it in driver level. Signed-off-by: David Wu--- arch/arm/include/asm/arch-rockchip/grf_rk322x.h | 32 + arch/arm/mach-rockchip/rk322x-board.c | 8 +++ 2 files changed, 40 insertions(+) diff --git a/arch/arm/include/asm/arch-rockchip/grf_rk322x.h b/arch/arm/include/asm/arch-rockchip/grf_rk322x.h index 26071c8..c0c0d84 100644 --- a/arch/arm/include/asm/arch-rockchip/grf_rk322x.h +++ b/arch/arm/include/asm/arch-rockchip/grf_rk322x.h @@ -54,6 +54,32 @@ struct rk322x_grf { unsigned int os_reg[8]; unsigned int reserved9[(0x604 - 0x5e4) / 4 - 1]; unsigned int ddrc_stat; + unsigned int reserved10[(0x680 - 0x604) / 4 - 1]; + unsigned int sig_detect_con[2]; + unsigned int reserved11[(0x690 - 0x684) / 4 - 1]; + unsigned int sig_detect_status[2]; + unsigned int reserved12[(0x6a0 - 0x694) / 4 - 1]; + unsigned int sig_detect_clr[2]; + unsigned int reserved13[(0x6b0 - 0x6a4) / 4 - 1]; + unsigned int emmc_det; + unsigned int reserved14[(0x700 - 0x6b0) / 4 - 1]; + unsigned int host0_con[3]; + unsigned int reserved15; + unsigned int host1_con[3]; + unsigned int reserved16; + unsigned int host2_con[3]; + unsigned int reserved17[(0x760 - 0x728) / 4 - 1]; + unsigned int usbphy0_con[27]; + unsigned int reserved18[(0x800 - 0x7c8) / 4 - 1]; + unsigned int usbphy1_con[27]; + unsigned int reserved19[(0x880 - 0x868) / 4 - 1]; + unsigned int otg_con0; + unsigned int uoc_status0; + unsigned int reserved20[(0x900 - 0x884) / 4 - 1]; + unsigned int mac_con[2]; + unsigned int reserved21[(0xb00 - 0x904) / 4 - 1]; + unsigned int macphy_con[4]; + unsigned int macphy_status; }; check_member(rk322x_grf, ddrc_stat, 0x604); @@ -516,4 +542,10 @@ enum { CON_IOMUX_PWM0SEL_SHIFT = 0, CON_IOMUX_PWM0SEL_MASK = 1 << CON_IOMUX_PWM0SEL_SHIFT, }; + +/* GRF_MACPHY_CON0 */ +enum { + MACPHY_CFG_ENABLE_SHIFT = 0, + MACPHY_CFG_ENABLE_MASK = 1 << MACPHY_CFG_ENABLE_SHIFT, +}; #endif diff --git a/arch/arm/mach-rockchip/rk322x-board.c b/arch/arm/mach-rockchip/rk322x-board.c index b6543a5..c8e6c6c 100644 --- a/arch/arm/mach-rockchip/rk322x-board.c +++ b/arch/arm/mach-rockchip/rk322x-board.c @@ -67,6 +67,14 @@ int board_init(void) CON_IOMUX_UART2SEL_MASK, CON_IOMUX_UART2SEL_21 << CON_IOMUX_UART2SEL_SHIFT); + /* + * The integrated macphy is enabled by default, disable it + * for saving power consuming. + */ + rk_clrsetreg(>macphy_con[0], +MACPHY_CFG_ENABLE_MASK, +0 << MACPHY_CFG_ENABLE_SHIFT); + return 0; } -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3] Makefile: honor PYTHON configuration properly
On some systems `python` is `python3` (for instance, Archlinux). The `PYTHON` variable can be used to point to `python2` to have a successful build. The use of `PYTHON` is currently limited in the Makefile and needs to be extended in other places: First, pylibfdt is required to be a Python 2 binding (binman imports pylibfdt and is only compatible Python 2), so its setup.py needs to be called accordingly. An alternative would be to change the libfdt setup.py shebang to python2, but the binding is actually portable. Also, it would break on system where there is no such thing as `python2`. Secondly, the libfdt import checks need to be done against Python 2 as well since the Python 2 compiled modules (in this case _libdft.so) can not be imported from Python 3. Note on the libfdt imports: "@if ! PYTHONPATH=tools $(PYTHON) -c 'import libfdt'; then..." is probably simpler than the currently sub-optimal pipe. --- Makefile | 2 +- scripts/Makefile.spl | 2 +- tools/Makefile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 50a002e72f..1f70144e0a 100644 --- a/Makefile +++ b/Makefile @@ -1378,7 +1378,7 @@ $(timestamp_h): $(srctree)/Makefile FORCE $(call filechk,timestamp.h) checkbinman: tools - @if ! ( echo 'import libfdt' | ( PYTHONPATH=tools python )); then \ + @if ! ( echo 'import libfdt' | ( PYTHONPATH=tools $(PYTHON) )); then \ echo >&2; \ echo >&2 '*** binman needs the Python libfdt library.'; \ echo >&2 '*** Either install it on your system, or try:'; \ diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl index ac3c2c7f13..c47248cc57 100644 --- a/scripts/Makefile.spl +++ b/scripts/Makefile.spl @@ -356,7 +356,7 @@ ifneq ($(cmd_files),) endif checkdtoc: tools - @if ! ( echo 'import libfdt' | ( PYTHONPATH=tools python )); then \ + @if ! ( echo 'import libfdt' | ( PYTHONPATH=tools $(PYTHON) )); then \ echo '*** dtoc needs the Python libfdt library. Either '; \ echo '*** install it on your system, or try:'; \ echo '***'; \ diff --git a/tools/Makefile b/tools/Makefile index 0743677dc8..1940cdad1f 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -138,7 +138,7 @@ tools/_libfdt.so: $(LIBFDT_SRCS) $(LIBFDT_SWIG) CPPFLAGS="$(_hostc_flags)" OBJDIR=tools \ SOURCES="$(LIBFDT_SRCS) tools/libfdt.i" \ SWIG_OPTS="-I$(srctree)/lib/libfdt -I$(srctree)/lib" \ - $(libfdt_tree)/pylibfdt/setup.py --quiet build_ext \ + $(PYTHON) $(libfdt_tree)/pylibfdt/setup.py build_ext \ --build-lib tools ifneq ($(CONFIG_MX23)$(CONFIG_MX28),) -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 2/2] powerpc: Rework cpu_init_f() to take no arguments
On Mon, Aug 14, 2017 at 8:20 AM, Christophe LEROYwrote: > Acked-by: Christophe Leroy > > > > Le 14/08/2017 à 04:44, Tom Rini a écrit : >> >> The function cpu_init_f() is called slightly differently on different >> PowerPC platforms. In some cases the function needs to make use of the >> IMMR and in other cases it does not. Rather than pass the IMMR location >> as the function argument and then ignore it on some platforms, allow the >> function to use the location as needed as it is a constant. >> >> Cc: Mario Six >> Cc: Wolfgang Denk >> Cc: Christophe Leroy >> Signed-off-by: Tom Rini >> --- >> arch/powerpc/cpu/mpc83xx/cpu_init.c| 4 +++- >> arch/powerpc/cpu/mpc83xx/spl_minimal.c | 4 +++- >> arch/powerpc/cpu/mpc83xx/start.S | 2 -- >> arch/powerpc/cpu/mpc85xx/cpu_init.c| 4 +--- >> arch/powerpc/cpu/mpc8xx/cpu_init.c | 4 +++- >> arch/powerpc/cpu/mpc8xx/start.S| 1 - >> arch/powerpc/include/asm/ppc.h | 1 + >> 7 files changed, 11 insertions(+), 9 deletions(-) >> >> diff --git a/arch/powerpc/cpu/mpc83xx/cpu_init.c >> b/arch/powerpc/cpu/mpc83xx/cpu_init.c >> index 2a9db0c51b89..f09a96b9abff 100644 >> --- a/arch/powerpc/cpu/mpc83xx/cpu_init.c >> +++ b/arch/powerpc/cpu/mpc83xx/cpu_init.c >> @@ -46,8 +46,10 @@ static void config_qe_ioports(void) >>* initialize a bunch of registers, >>* initialize the UPM's >>*/ >> -void cpu_init_f (volatile immap_t * im) >> +void cpu_init_f (void) >> { >> + volatile immap_t *im = (void *)(CONFIG_SYS_IMMR); >> + >> __be32 acr_mask = >> #ifdef CONFIG_SYS_ACR_PIPE_DEP /* Arbiter pipeline depth */ >> ACR_PIPE_DEP | >> diff --git a/arch/powerpc/cpu/mpc83xx/spl_minimal.c >> b/arch/powerpc/cpu/mpc83xx/spl_minimal.c >> index 1c65e4cb78dd..ce751d3bdf9f 100644 >> --- a/arch/powerpc/cpu/mpc83xx/spl_minimal.c >> +++ b/arch/powerpc/cpu/mpc83xx/spl_minimal.c >> @@ -16,8 +16,10 @@ DECLARE_GLOBAL_DATA_PTR; >>* initialize a bunch of registers, >>* initialize the UPM's >>*/ >> -void cpu_init_f (volatile immap_t * im) >> +void cpu_init_f (void) >> { >> + volatile immap_t *im = (void *)(CONFIG_SYS_IMMR); >> + >> /* Pointer is writable since we allocated a register for it */ >> gd = (gd_t *) (CONFIG_SYS_INIT_RAM_ADDR + >> CONFIG_SYS_GBL_DATA_OFFSET); >> diff --git a/arch/powerpc/cpu/mpc83xx/start.S >> b/arch/powerpc/cpu/mpc83xx/start.S >> index d2fced8aba86..8d10c50f6912 100644 >> --- a/arch/powerpc/cpu/mpc83xx/start.S >> +++ b/arch/powerpc/cpu/mpc83xx/start.S >> @@ -290,8 +290,6 @@ in_flash: >> GET_GOT /* initialize GOT access*/ >> - /* r3: IMMR */ >> - lis r3, CONFIG_SYS_IMMR@h >> /* run low-level CPU init code (in Flash)*/ >> bl cpu_init_f >> diff --git a/arch/powerpc/cpu/mpc85xx/cpu_init.c >> b/arch/powerpc/cpu/mpc85xx/cpu_init.c >> index a3076d8d7100..2db8f1f91fe2 100644 >> --- a/arch/powerpc/cpu/mpc85xx/cpu_init.c >> +++ b/arch/powerpc/cpu/mpc85xx/cpu_init.c >> @@ -435,7 +435,7 @@ void fsl_erratum_a007212_workaround(void) >> } >> #endif >> -ulong cpu_init_f(void) >> +void cpu_init_f(void) >> { >> extern void m8560_cpm_reset (void); >> #ifdef CONFIG_SYS_DCSRBAR_PHYS >> @@ -507,8 +507,6 @@ ulong cpu_init_f(void) >> #ifdef CONFIG_SYS_FSL_ERRATUM_A007212 >> fsl_erratum_a007212_workaround(); >> #endif >> - >> - return 0; >> } >> /* Implement a dummy function for those platforms w/o SERDES */ >> diff --git a/arch/powerpc/cpu/mpc8xx/cpu_init.c >> b/arch/powerpc/cpu/mpc8xx/cpu_init.c >> index dc601a12976f..c1cd2fac36f4 100644 >> --- a/arch/powerpc/cpu/mpc8xx/cpu_init.c >> +++ b/arch/powerpc/cpu/mpc8xx/cpu_init.c >> @@ -19,8 +19,10 @@ >>* initialize a bunch of registers, >>* initialize the UPM's >>*/ >> -void cpu_init_f(immap_t __iomem *immr) >> +void cpu_init_f(void) >> { >> + volatile immap_t *immr = (void *)(CONFIG_SYS_IMMR); >> + >> memctl8xx_t __iomem *memctl = >im_memctl; >> ulong reg; >> diff --git a/arch/powerpc/cpu/mpc8xx/start.S >> b/arch/powerpc/cpu/mpc8xx/start.S >> index 202ea81ae498..f03bfe94f25b 100644 >> --- a/arch/powerpc/cpu/mpc8xx/start.S >> +++ b/arch/powerpc/cpu/mpc8xx/start.S >> @@ -158,7 +158,6 @@ in_flash: >> GET_GOT /* initialize GOT access >> */ >> - /* r3: IMMR */ >> bl cpu_init_f /* run low-level CPU init code (from >> Flash) */ >> bl board_init_f/* run 1st part of board init code (from >> Flash) */ >> diff --git a/arch/powerpc/include/asm/ppc.h >> b/arch/powerpc/include/asm/ppc.h >> index 5e0aa08be936..615d7fda9324 100644 >> --- a/arch/powerpc/include/asm/ppc.h >> +++ b/arch/powerpc/include/asm/ppc.h >> @@ -122,6 +122,7 @@ static inline void set_msr(unsigned long msr) >> void
Re: [U-Boot] [PATCH 1/2] powerpc: Rework interrupt_init_cpu()
On Mon, Aug 14, 2017 at 4:44 AM, Tom Riniwrote: > The function interrupt_init_cpu() is given an int return type but does > not return anything but 0. Rework this to be a void function. > > Signed-off-by: Tom Rini > --- > arch/powerpc/cpu/mpc83xx/interrupts.c | 4 +--- > arch/powerpc/cpu/mpc85xx/interrupts.c | 4 +--- > arch/powerpc/cpu/mpc86xx/interrupts.c | 4 +--- > arch/powerpc/cpu/mpc8xx/interrupts.c | 4 +--- > arch/powerpc/include/asm/ppc.h| 2 +- > arch/powerpc/lib/interrupts.c | 7 +-- > 6 files changed, 6 insertions(+), 19 deletions(-) > > diff --git a/arch/powerpc/cpu/mpc83xx/interrupts.c > b/arch/powerpc/cpu/mpc83xx/interrupts.c > index 668aa020889e..50503b4d2c0f 100644 > --- a/arch/powerpc/cpu/mpc83xx/interrupts.c > +++ b/arch/powerpc/cpu/mpc83xx/interrupts.c > @@ -20,7 +20,7 @@ struct irq_action { > ulong count; > }; > > -int interrupt_init_cpu (unsigned *decrementer_count) > +void interrupt_init_cpu (unsigned *decrementer_count) > { > volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR; > > @@ -29,8 +29,6 @@ int interrupt_init_cpu (unsigned *decrementer_count) > /* Enable e300 time base */ > > immr->sysconf.spcr |= 0x0040; > - > - return 0; > } > > > diff --git a/arch/powerpc/cpu/mpc85xx/interrupts.c > b/arch/powerpc/cpu/mpc85xx/interrupts.c > index cf730c5c53cb..b92549000fbc 100644 > --- a/arch/powerpc/cpu/mpc85xx/interrupts.c > +++ b/arch/powerpc/cpu/mpc85xx/interrupts.c > @@ -20,7 +20,7 @@ > #include > #endif > > -int interrupt_init_cpu(unsigned *decrementer_count) > +void interrupt_init_cpu(unsigned *decrementer_count) > { > ccsr_pic_t __iomem *pic = (void *)CONFIG_SYS_MPC8xxx_PIC_ADDR; > > @@ -77,8 +77,6 @@ int interrupt_init_cpu(unsigned *decrementer_count) > #ifdef CONFIG_POST > post_word_store(post_word); > #endif > - > - return (0); > } > > /* Install and free a interrupt handler. Not implemented yet. */ > diff --git a/arch/powerpc/cpu/mpc86xx/interrupts.c > b/arch/powerpc/cpu/mpc86xx/interrupts.c > index a6db0baab33f..81874790ff35 100644 > --- a/arch/powerpc/cpu/mpc86xx/interrupts.c > +++ b/arch/powerpc/cpu/mpc86xx/interrupts.c > @@ -23,7 +23,7 @@ > #include > #endif > > -int interrupt_init_cpu(unsigned *decrementer_count) > +void interrupt_init_cpu(unsigned *decrementer_count) > { > volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR; > volatile ccsr_pic_t *pic = >im_pic; > @@ -73,8 +73,6 @@ int interrupt_init_cpu(unsigned *decrementer_count) > #ifdef CONFIG_POST > post_word_store(post_word); > #endif > - > - return 0; > } > > /* > diff --git a/arch/powerpc/cpu/mpc8xx/interrupts.c > b/arch/powerpc/cpu/mpc8xx/interrupts.c > index e8e287a13fa8..846148ab9867 100644 > --- a/arch/powerpc/cpu/mpc8xx/interrupts.c > +++ b/arch/powerpc/cpu/mpc8xx/interrupts.c > @@ -30,7 +30,7 @@ static void cpm_interrupt(void *regs); > > // > > -int interrupt_init_cpu(unsigned *decrementer_count) > +void interrupt_init_cpu(unsigned *decrementer_count) > { > immap_t __iomem *immr = (immap_t __iomem *)CONFIG_SYS_IMMR; > > @@ -41,8 +41,6 @@ int interrupt_init_cpu(unsigned *decrementer_count) > > /* Configure CPM interrupts */ > cpm_interrupt_init(); > - > - return 0; > } > > // > diff --git a/arch/powerpc/include/asm/ppc.h b/arch/powerpc/include/asm/ppc.h > index 850fe93f9798..5e0aa08be936 100644 > --- a/arch/powerpc/include/asm/ppc.h > +++ b/arch/powerpc/include/asm/ppc.h > @@ -122,7 +122,7 @@ static inline void set_msr(unsigned long msr) > void print_reginfo(void); > #endif > > -int interrupt_init_cpu(unsigned *); > +void interrupt_init_cpu(unsigned *); > void timer_interrupt_cpu(struct pt_regs *); > unsigned long search_exception_table(unsigned long addr); > > diff --git a/arch/powerpc/lib/interrupts.c b/arch/powerpc/lib/interrupts.c > index 46fa18c63fb0..e8784aa16e9c 100644 > --- a/arch/powerpc/lib/interrupts.c > +++ b/arch/powerpc/lib/interrupts.c > @@ -63,13 +63,8 @@ int disable_interrupts (void) > > int interrupt_init (void) > { > - int ret; > - > /* call cpu specific function from $(CPU)/interrupts.c */ > - ret = interrupt_init_cpu (_count); > - > - if (ret) > - return ret; > + interrupt_init_cpu (_count); > > set_dec (decrementer_count); > > -- > 1.9.1 > Acked-by: Mario Six ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 2/2] powerpc: Rework cpu_init_f() to take no arguments
Acked-by: Christophe LeroyLe 14/08/2017 à 04:44, Tom Rini a écrit : The function cpu_init_f() is called slightly differently on different PowerPC platforms. In some cases the function needs to make use of the IMMR and in other cases it does not. Rather than pass the IMMR location as the function argument and then ignore it on some platforms, allow the function to use the location as needed as it is a constant. Cc: Mario Six Cc: Wolfgang Denk Cc: Christophe Leroy Signed-off-by: Tom Rini --- arch/powerpc/cpu/mpc83xx/cpu_init.c| 4 +++- arch/powerpc/cpu/mpc83xx/spl_minimal.c | 4 +++- arch/powerpc/cpu/mpc83xx/start.S | 2 -- arch/powerpc/cpu/mpc85xx/cpu_init.c| 4 +--- arch/powerpc/cpu/mpc8xx/cpu_init.c | 4 +++- arch/powerpc/cpu/mpc8xx/start.S| 1 - arch/powerpc/include/asm/ppc.h | 1 + 7 files changed, 11 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/cpu/mpc83xx/cpu_init.c b/arch/powerpc/cpu/mpc83xx/cpu_init.c index 2a9db0c51b89..f09a96b9abff 100644 --- a/arch/powerpc/cpu/mpc83xx/cpu_init.c +++ b/arch/powerpc/cpu/mpc83xx/cpu_init.c @@ -46,8 +46,10 @@ static void config_qe_ioports(void) * initialize a bunch of registers, * initialize the UPM's */ -void cpu_init_f (volatile immap_t * im) +void cpu_init_f (void) { + volatile immap_t *im = (void *)(CONFIG_SYS_IMMR); + __be32 acr_mask = #ifdef CONFIG_SYS_ACR_PIPE_DEP /* Arbiter pipeline depth */ ACR_PIPE_DEP | diff --git a/arch/powerpc/cpu/mpc83xx/spl_minimal.c b/arch/powerpc/cpu/mpc83xx/spl_minimal.c index 1c65e4cb78dd..ce751d3bdf9f 100644 --- a/arch/powerpc/cpu/mpc83xx/spl_minimal.c +++ b/arch/powerpc/cpu/mpc83xx/spl_minimal.c @@ -16,8 +16,10 @@ DECLARE_GLOBAL_DATA_PTR; * initialize a bunch of registers, * initialize the UPM's */ -void cpu_init_f (volatile immap_t * im) +void cpu_init_f (void) { + volatile immap_t *im = (void *)(CONFIG_SYS_IMMR); + /* Pointer is writable since we allocated a register for it */ gd = (gd_t *) (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_GBL_DATA_OFFSET); diff --git a/arch/powerpc/cpu/mpc83xx/start.S b/arch/powerpc/cpu/mpc83xx/start.S index d2fced8aba86..8d10c50f6912 100644 --- a/arch/powerpc/cpu/mpc83xx/start.S +++ b/arch/powerpc/cpu/mpc83xx/start.S @@ -290,8 +290,6 @@ in_flash: GET_GOT /* initialize GOT access */ - /* r3: IMMR */ - lis r3, CONFIG_SYS_IMMR@h /* run low-level CPU init code (in Flash)*/ bl cpu_init_f diff --git a/arch/powerpc/cpu/mpc85xx/cpu_init.c b/arch/powerpc/cpu/mpc85xx/cpu_init.c index a3076d8d7100..2db8f1f91fe2 100644 --- a/arch/powerpc/cpu/mpc85xx/cpu_init.c +++ b/arch/powerpc/cpu/mpc85xx/cpu_init.c @@ -435,7 +435,7 @@ void fsl_erratum_a007212_workaround(void) } #endif -ulong cpu_init_f(void) +void cpu_init_f(void) { extern void m8560_cpm_reset (void); #ifdef CONFIG_SYS_DCSRBAR_PHYS @@ -507,8 +507,6 @@ ulong cpu_init_f(void) #ifdef CONFIG_SYS_FSL_ERRATUM_A007212 fsl_erratum_a007212_workaround(); #endif - - return 0; } /* Implement a dummy function for those platforms w/o SERDES */ diff --git a/arch/powerpc/cpu/mpc8xx/cpu_init.c b/arch/powerpc/cpu/mpc8xx/cpu_init.c index dc601a12976f..c1cd2fac36f4 100644 --- a/arch/powerpc/cpu/mpc8xx/cpu_init.c +++ b/arch/powerpc/cpu/mpc8xx/cpu_init.c @@ -19,8 +19,10 @@ * initialize a bunch of registers, * initialize the UPM's */ -void cpu_init_f(immap_t __iomem *immr) +void cpu_init_f(void) { + volatile immap_t *immr = (void *)(CONFIG_SYS_IMMR); + memctl8xx_t __iomem *memctl = >im_memctl; ulong reg; diff --git a/arch/powerpc/cpu/mpc8xx/start.S b/arch/powerpc/cpu/mpc8xx/start.S index 202ea81ae498..f03bfe94f25b 100644 --- a/arch/powerpc/cpu/mpc8xx/start.S +++ b/arch/powerpc/cpu/mpc8xx/start.S @@ -158,7 +158,6 @@ in_flash: GET_GOT /* initialize GOT access */ - /* r3: IMMR */ bl cpu_init_f /* run low-level CPU init code (from Flash) */ bl board_init_f /* run 1st part of board init code (from Flash) */ diff --git a/arch/powerpc/include/asm/ppc.h b/arch/powerpc/include/asm/ppc.h index 5e0aa08be936..615d7fda9324 100644 --- a/arch/powerpc/include/asm/ppc.h +++ b/arch/powerpc/include/asm/ppc.h @@ -122,6 +122,7 @@ static inline void set_msr(unsigned long msr) void print_reginfo(void); #endif +void cpu_init_f(void); void interrupt_init_cpu(unsigned *); void timer_interrupt_cpu(struct pt_regs *); unsigned long search_exception_table(unsigned long addr); ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot