[U-Boot] [PATCH 2/2] move booti_setup to arch/arm/lig/image.c
Follow bootz's pattern by moving the booti_setup to arch/arm/lib. This allows to use booti_setup in other paths, e.g booting an Android image containing Image format. Note that kernel relocation is move out of booti_setup and it is the caller's responsibility to do it and allows them do it differently. say, cmd/booti.c just do a manually, while in the bootm path, we can use bootm_load_os(with some changes). v2: - fix review comments for indentation - fix the comment for booti_setup - rebase to lastest u-boot - improve the commit comment Signed-off-by: Bin ChenReviewed-by: Tom Rini --- arch/arm/lib/Makefile | 2 +- arch/arm/lib/image.c | 76 ++ cmd/booti.c | 92 --- include/image.h | 9 + 4 files changed, 99 insertions(+), 80 deletions(-) create mode 100644 arch/arm/lib/image.c diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile index 876024fc15..b5d4e3 100644 --- a/arch/arm/lib/Makefile +++ b/arch/arm/lib/Makefile @@ -32,7 +32,7 @@ endif obj-$(CONFIG_CPU_V7M) += cmd_boot.o obj-$(CONFIG_OF_LIBFDT) += bootm-fdt.o -obj-$(CONFIG_CMD_BOOTI) += bootm.o +obj-$(CONFIG_CMD_BOOTI) += bootm.o image.o obj-$(CONFIG_CMD_BOOTM) += bootm.o obj-$(CONFIG_CMD_BOOTZ) += bootm.o zimage.o obj-$(CONFIG_SYS_L2_PL310) += cache-pl310.o diff --git a/arch/arm/lib/image.c b/arch/arm/lib/image.c new file mode 100644 index 00..460f8eb0e9 --- /dev/null +++ b/arch/arm/lib/image.c @@ -0,0 +1,76 @@ +/* + * (C) Copyright 2000-2009 + * Wolfgang Denk, DENX Software Engineering, w...@denx.de. + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +#define LINUX_ARM64_IMAGE_MAGIC 0x644d5241 + +/* See Documentation/arm64/booting.txt in the Linux kernel */ +struct Image_header { +uint32_tcode0; /* Executable code */ +uint32_tcode1; /* Executable code */ +uint64_ttext_offset;/* Image load offset, LE */ +uint64_timage_size; /* Effective Image size, LE */ +uint64_tflags; /* Kernel flags, LE */ +uint64_tres2; /* reserved */ +uint64_tres3; /* reserved */ +uint64_tres4; /* reserved */ +uint32_tmagic; /* Magic number */ +uint32_tres5; +}; + +int booti_setup(ulong image, ulong *relocated_addr, ulong *size) +{ +struct Image_header *ih; +uint64_t dst; +uint64_t image_size, text_offset; + +*relocated_addr = image; + +ih = (struct Image_header *)map_sysmem(image, 0); + +if (ih->magic != le32_to_cpu(LINUX_ARM64_IMAGE_MAGIC)) { +puts("Bad Linux ARM64 Image magic!\n"); +return 1; +} + +/* + * Prior to Linux commit a2c1d73b94ed, the text_offset field + * is of unknown endianness. In these cases, the image_size + * field is zero, and we can assume a fixed value of 0x8. + */ +if (ih->image_size == 0) { +puts("Image lacks image_size field, assuming 16MiB\n"); +image_size = 16 << 20; +text_offset = 0x8; +} else { +image_size = le64_to_cpu(ih->image_size); +text_offset = le64_to_cpu(ih->text_offset); +} + +*size = image_size; + +/* + * If bit 3 of the flags field is set, the 2MB aligned base of the + * kernel image can be anywhere in physical memory, so respect + * images->ep. Otherwise, relocate the image to the base of RAM + * since memory below it is not accessible via the linear mapping. + */ +if (le64_to_cpu(ih->flags) & BIT(3)) +dst = image - text_offset; +else +dst = gd->bd->bi_dram[0].start; + +*relocated_addr = ALIGN(dst, SZ_2M) + text_offset; + +unmap_sysmem(ih); + +return 0; +} diff --git a/cmd/booti.c b/cmd/booti.c index da6fb01c11..0be786cb6b 100644 --- a/cmd/booti.c +++ b/cmd/booti.c @@ -16,77 +16,6 @@ DECLARE_GLOBAL_DATA_PTR; -/* See Documentation/arm64/booting.txt in the Linux kernel */ -struct Image_header { - uint32_tcode0; /* Executable code */ - uint32_tcode1; /* Executable code */ - uint64_ttext_offset;/* Image load offset, LE */ - uint64_timage_size; /* Effective Image size, LE */ - uint64_tflags; /* Kernel flags, LE */ - uint64_tres2; /* reserved */ - uint64_tres3; /* reserved */ - uint64_tres4; /* reserved */ - uint32_tmagic; /* Magic number */ - uint32_tres5; -}; - -#define LINUX_ARM64_IMAGE_MAGIC0x644d5241 - -static int booti_setup(bootm_headers_t *images) -{ - struct Image_header *ih; - uint64_t dst; - uint64_t image_size, text_offset; - - ih = (struct Image_header *)map_sysmem(images->ep, 0); - - if (ih->magic != le32_to_cpu(LINUX_ARM64_IMAGE_MAGIC)) {
[U-Boot] [PATCH 1/2] parse the second area of android image
The second area of android image was intended to put a 2nd stage bootloader but in practice were rarely used (in my knowledge). An proposal was made to the AOSP to (re)use the second area as the dtb[1], This patch itself doesn't depend on that proposal being accepted but it won't be that helpful as well if that proposal won't be accepted. But don't do any harm as well. [1] https://android-review.googlesource.com/#/c/417447/ Signed-off-by: Bin ChenReviewed-by: Tom Rini --- common/image-android.c | 19 +++ include/image.h| 2 ++ 2 files changed, 21 insertions(+) diff --git a/common/image-android.c b/common/image-android.c index e74d0aafca..5ad3a1fa38 100644 --- a/common/image-android.c +++ b/common/image-android.c @@ -146,6 +146,25 @@ int android_image_get_ramdisk(const struct andr_img_hdr *hdr, return 0; } +int android_image_get_second(const struct andr_img_hdr *hdr, + ulong *second_data, ulong *second_len) +{ + if (!hdr->second_size) { + *second_data = *second_len = 0; + return -1; + } + + *second_data = (unsigned long)hdr; + *second_data += hdr->page_size; + *second_data += ALIGN(hdr->kernel_size, hdr->page_size); + *second_data += ALIGN(hdr->ramdisk_size, hdr->page_size); + + printf("second address is 0x%lx\n",*second_data); + + *second_len = hdr->second_size; + return 0; +} + #if !defined(CONFIG_SPL_BUILD) /** * android_print_contents - prints out the contents of the Android format image diff --git a/include/image.h b/include/image.h index b2b23a96f1..c8ce4da901 100644 --- a/include/image.h +++ b/include/image.h @@ -1263,6 +1263,8 @@ int android_image_get_kernel(const struct andr_img_hdr *hdr, int verify, ulong *os_data, ulong *os_len); int android_image_get_ramdisk(const struct andr_img_hdr *hdr, ulong *rd_data, ulong *rd_len); +int android_image_get_second(const struct andr_img_hdr *hdr, + ulong *second_data, ulong *second_len); ulong android_image_get_end(const struct andr_img_hdr *hdr); ulong android_image_get_kload(const struct andr_img_hdr *hdr); void android_print_contents(const struct andr_img_hdr *hdr); -- 2.15.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 0/2] Android and arm64 improvement
I rebased the two patches submitted (quite )a while ago on top of current U-boot master fb4413295c765aa8c013650984dc2d908964c81d (and there were no conflicts). The first patch added the support of parsing the second area of Android image so that it can be used for good. On Poplar board, we are using that area for dtb. The first patch shouldn't impact any functionality since it is new. The second patch moves the booti_setup out of booti.c. It was the result of a discusion[1] how to better support the arm64 Android image. I have boot tested it on Poplar board[2] with additional patch[3] that is built on top of the booti. I have hacked version of using bootm but it seems quit mess up - need lots of changes in different places ("Shotgun Surgery") to handle Android specific and/or arm64 specific code. Now, I feel a separate bootandroid command might be a cleaner solution. That being said, the second patch doesn't depend on or impact any change we might have in the future for better Android support. [1] https://lists.denx.de/pipermail/u-boot/2017-July/297933.html [2] https://github.com/96boards-poplar/Documentation [3] https://github.com/pierrchen/u-boot/commit/8463e6177654026746161487d0f0bd8998bb7a5b Bin Chen (2): parse the second area of android image move booti_setup to arch/arm/lig/image.c arch/arm/lib/Makefile | 2 +- arch/arm/lib/image.c | 76 + cmd/booti.c| 92 +++--- common/image-android.c | 19 +++ include/image.h| 11 ++ 5 files changed, 120 insertions(+), 80 deletions(-) create mode 100644 arch/arm/lib/image.c -- 2.15.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] sunxi: Pine64: temporarily remove extra Pine64 non-plus DT
With the merge of the new u-boot.itb size check now the build for pine64_plus_defconfig breaks, as this file gets too large: = u-boot.itb exceeds file size limit: limit: 516096 bytes actual: 521852 bytes excess: 5756 bytes make: *** [u-boot.itb] Error 1 = One easily fixable reason is that we actually have two .dtbs in our FIT image, one for the regular Pine64+ board, and one for the non-plus version. The only difference U-Boot cares about is the 100Mbit Ethernet PHY used on the non-plus version, however Ethernet isn't enabled in the non-plus DT anyway. So we could avoid the non-plus special handling, and remove that extra .dtb from the FIT image, which saves a few KBs and brings us back below the limit. The Pine64 would boot with a Pine64+ .dtb, and would fail to enable Ethernet. Given that it didn't work in the first place, this is not a regression. Once we switch to a non-MMC environment, we can bring this back, then with a proper .dtb and hopefully working Ethernet. Signed-off-by: Andre Przywara--- Hi, cowardly picking this low hanging fruit to fix the build ;-) Alternatively we can create a separate defconfig for the non-plus version, but I am not sure this is worth the effort. And merging in the DTs from Linux breaks the limit again, oh well ... Cheers, Andre. configs/pine64_plus_defconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/configs/pine64_plus_defconfig b/configs/pine64_plus_defconfig index 01ed23844b..45b445646d 100644 --- a/configs/pine64_plus_defconfig +++ b/configs/pine64_plus_defconfig @@ -10,7 +10,6 @@ CONFIG_SPL=y # CONFIG_SPL_DOS_PARTITION is not set # CONFIG_SPL_ISO_PARTITION is not set # CONFIG_SPL_EFI_PARTITION is not set -CONFIG_OF_LIST="sun50i-a64-pine64 sun50i-a64-pine64-plus" CONFIG_SUN8I_EMAC=y CONFIG_USB_EHCI_HCD=y CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] Please pull u-boot-dm
On Fri, Jan 26, 2018 at 02:45:29PM -0700, Simon Glass wrote: > Hi Tom, > > Here are some additions to logging and 64-bit sandbox support. > > > The following changes since commit ab12aa24e619b5e81cbde7de88c6d9a19f04313b: > > ARM: socfpga: Convert callers of cm_write_with_phase for > wait_for_bit_le32 (2018-01-26 13:08:03 -0500) > > are available in the Git repository at: > > git://git.denx.de/u-boot-dm.git > > for you to fetch changes up to 4e94617bf911595efcecf52d6c9f323744a81cda: > > log: add category LOGC_EFI (2018-01-26 12:20:55 -0700) > NAK: Starting LLVM-3.8 test common/log.c:44:17: warning: implicit conversion from enumeration type 'enum log_category_t' to different enumeration type 'enum uclass_id' [-Wenum-conversion] if (log_uc_cat(cat) >= LOGC_NONE) ~~ ^~~ common/log.c:47:36: warning: implicit conversion from enumeration type 'enum log_category_t' to different enumeration type 'enum uclass_id' [-Wenum-conversion] return uclass_get_name(log_uc_cat(cat)); ~~ ^~~ 2 warnings generated. Also, checkpatch.pl notes that the sandbox64 defconfig isn't caught by MAINTAINERS and then I see the 32bit one already isn't. Finally, I see a bunch of warnings on sandbox64: lib/fdtdec.c: In function ‘fdtdec_get_addr_size_auto_noparent’: include/fdtdec.h:27:25: warning: large integer implicitly truncated to unsigned type [-Woverflow] #define FDT_ADDR_T_NONE (-1ULL) That's with my normal 64bit host gcc (5.4.0, Ubuntu 16.04). Thanks! -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH V3] imx: mx25: Remove SION bit in all pin-mux that are safe
Hi Michael, On Thu, Jan 25, 2018 at 11:06 AM, Michael Trimarchiwrote: > SION bit should be used in the situation that we need > to read back the value of a pin and should not be set by > default macro. > > We get some malfunction as raised by following thread > > https://www.spinics.net/lists/linux-usb/msg162574.html > > As reported by this application note: > https://www.nxp.com/docs/en/application-note/AN5078.pdf > > The software input on (SION) bit is an option to force an input > path to be active regardless of the value driven by the > corresponding module. It is used when the nature direction > of a pin depending on selected alternative function is an output, > but it is needed to read the real logic value on a pin. > > The SION bit can be used in: > • Loopback: the module of a selected alternative function drives > the pad and also receives the pad value as an input > • GPIO capture: the module of a selected alternative function > drives the pin and the value is captured by the GPIO > > SION bit is not necessary when the pin is configured as a peripheral > apart specific silicon bug. If an application needs to have this > set, this should be done in board file or in dts file > > Signed-off-by: Michael Trimarchi Please keep my previous Reviewed-by tag. Here it goes again: Reviewed-by: Fabio Estevam Thanks ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] How to build standalone app *outside* u-boot build tree
I'd like to build my own application - something like examples/standalone/hello_world - but if possible, I'd like to build it outside the u-boot tree. The standalone examples are meant to be invoked with a recursive make from an ancestor directory in the u-boot tree. They don't work if you just copy examples/standalone out into your own version controlled tree and attempt to build from there. Was wondering if there's a standard way to build your own standalone app, but using the u-boot infrastructure: e.g., something like the way you build a linux kernel module whose source lives outside the kernel source tree. Thanks, Brett S. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH V3] imx: mx25: Remove SION bit in all pin-mux that are safe
Hi Michael, On 26/01/2018 23:14, Michael Nazzareno Trimarchi wrote: > Hi Stefano > > Do I need to resend with you in CC? > > For some reason I forget to include you > No, don't worry, I have already got it :-) Regards, Stefano > Michael > > On Fri, Jan 26, 2018 at 12:00 PM, Benoît Thébaudeau> wrote: >> On 25/01/2018 at 22:48, Benoît Thébaudeau wrote: >>> On Thu, Jan 25, 2018 at 2:06 PM, Michael Trimarchi >>> wrote: SION bit should be used in the situation that we need to read back the value of a pin and should not be set by default macro. We get some malfunction as raised by following thread https://www.spinics.net/lists/linux-usb/msg162574.html As reported by this application note: https://www.nxp.com/docs/en/application-note/AN5078.pdf The software input on (SION) bit is an option to force an input path to be active regardless of the value driven by the corresponding module. It is used when the nature direction of a pin depending on selected alternative function is an output, but it is needed to read the real logic value on a pin. The SION bit can be used in: • Loopback: the module of a selected alternative function drives the pad and also receives the pad value as an input • GPIO capture: the module of a selected alternative function drives the pin and the value is captured by the GPIO SION bit is not necessary when the pin is configured as a peripheral apart specific silicon bug. If an application needs to have this set, this should be done in board file or in dts file Signed-off-by: Michael Trimarchi >>> >>> [...] >>> >>> I have now tested the following peripherals on i.MX25 without any SION >>> bit set: AUDMUX/SSI, eSDHC, FEC (except PHY access for which MDIO >>> might have an issue without SION; Ethernet works but I have not >>> checked whether this is possible at least partially without access to >>> the PHY registers), GPIO, I2C, SLCDC, UART, and USB. Everything worked >>> fine except the lack of SION for eSDHC CMD, which is true for all >>> eSDHC instances (and not only for eSDHC1, so Linux's >>> arch/arm/boot/dts/imx25-pinfunc.h should be fixed). Therefore, SION is >>> mandatory for all the eSDHC CMD functions in >>> arch/arm/include/asm/arch-mx25/iomux-mx25.h, but it can be removed for >>> everything else (I still have to carry out one more test to confirm >>> this for FEC MDIO), and moved to the board files if necessary (but I >>> don't think that any mainline board code is doing something fancy >>> enough to need it). >> >> I confirm that FEC RMII register access works fine without setting SION for >> MDIO. >> >> Benoît > > > -- = DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de = ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH V3] imx: mx25: Remove SION bit in all pin-mux that are safe
Hi Stefano Do I need to resend with you in CC? For some reason I forget to include you Michael On Fri, Jan 26, 2018 at 12:00 PM, Benoît Thébaudeauwrote: > On 25/01/2018 at 22:48, Benoît Thébaudeau wrote: >> On Thu, Jan 25, 2018 at 2:06 PM, Michael Trimarchi >> wrote: >>> SION bit should be used in the situation that we need >>> to read back the value of a pin and should not be set by >>> default macro. >>> >>> We get some malfunction as raised by following thread >>> >>> https://www.spinics.net/lists/linux-usb/msg162574.html >>> >>> As reported by this application note: >>> https://www.nxp.com/docs/en/application-note/AN5078.pdf >>> >>> The software input on (SION) bit is an option to force an input >>> path to be active regardless of the value driven by the >>> corresponding module. It is used when the nature direction >>> of a pin depending on selected alternative function is an output, >>> but it is needed to read the real logic value on a pin. >>> >>> The SION bit can be used in: >>> • Loopback: the module of a selected alternative function drives >>> the pad and also receives the pad value as an input >>> • GPIO capture: the module of a selected alternative function >>> drives the pin and the value is captured by the GPIO >>> >>> SION bit is not necessary when the pin is configured as a peripheral >>> apart specific silicon bug. If an application needs to have this >>> set, this should be done in board file or in dts file >>> >>> Signed-off-by: Michael Trimarchi >> >> [...] >> >> I have now tested the following peripherals on i.MX25 without any SION >> bit set: AUDMUX/SSI, eSDHC, FEC (except PHY access for which MDIO >> might have an issue without SION; Ethernet works but I have not >> checked whether this is possible at least partially without access to >> the PHY registers), GPIO, I2C, SLCDC, UART, and USB. Everything worked >> fine except the lack of SION for eSDHC CMD, which is true for all >> eSDHC instances (and not only for eSDHC1, so Linux's >> arch/arm/boot/dts/imx25-pinfunc.h should be fixed). Therefore, SION is >> mandatory for all the eSDHC CMD functions in >> arch/arm/include/asm/arch-mx25/iomux-mx25.h, but it can be removed for >> everything else (I still have to carry out one more test to confirm >> this for FEC MDIO), and moved to the board files if necessary (but I >> don't think that any mainline board code is doing something fancy >> enough to need it). > > I confirm that FEC RMII register access works fine without setting SION for > MDIO. > > Benoît -- | Michael Nazzareno Trimarchi Amarula Solutions BV | | COO - Founder Cruquiuskade 47 | | +31(0)851119172 Amsterdam 1018 AM NL | | [`as] http://www.amarulasolutions.com | ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] mips: bmips: select OF_EMBED for all boards
Signed-off-by: Álvaro Fernández Rojas--- configs/comtrend_ar5315u_ram_defconfig | 1 + configs/comtrend_ar5387un_ram_defconfig | 1 + configs/comtrend_ct5361_ram_defconfig| 1 + configs/comtrend_vr3032u_ram_defconfig | 1 + configs/comtrend_wap5813n_ram_defconfig | 1 + configs/netgear_cg3100d_ram_defconfig| 1 + configs/netgear_dgnd3700v2_ram_defconfig | 1 + configs/sagem_f@st1704_ram_defconfig | 1 + configs/sfr_nb4-ser_ram_defconfig| 1 + 9 files changed, 9 insertions(+) diff --git a/configs/comtrend_ar5315u_ram_defconfig b/configs/comtrend_ar5315u_ram_defconfig index 84ea67c7c1..c83234a98b 100644 --- a/configs/comtrend_ar5315u_ram_defconfig +++ b/configs/comtrend_ar5315u_ram_defconfig @@ -31,6 +31,7 @@ CONFIG_CMD_SPI=y # CONFIG_CMD_NET is not set # CONFIG_CMD_NFS is not set # CONFIG_CMD_MISC is not set +CONFIG_OF_EMBED=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_DM_GPIO=y CONFIG_LED=y diff --git a/configs/comtrend_ar5387un_ram_defconfig b/configs/comtrend_ar5387un_ram_defconfig index 352f01d65b..e4ed8cf9e0 100644 --- a/configs/comtrend_ar5387un_ram_defconfig +++ b/configs/comtrend_ar5387un_ram_defconfig @@ -31,6 +31,7 @@ CONFIG_CMD_SPI=y # CONFIG_CMD_NET is not set # CONFIG_CMD_NFS is not set # CONFIG_CMD_MISC is not set +CONFIG_OF_EMBED=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_DM_GPIO=y CONFIG_LED=y diff --git a/configs/comtrend_ct5361_ram_defconfig b/configs/comtrend_ct5361_ram_defconfig index ecbd77b5f2..1dfefcb379 100644 --- a/configs/comtrend_ct5361_ram_defconfig +++ b/configs/comtrend_ct5361_ram_defconfig @@ -28,6 +28,7 @@ CONFIG_CMD_MEMINFO=y # CONFIG_CMD_NET is not set # CONFIG_CMD_NFS is not set # CONFIG_CMD_MISC is not set +CONFIG_OF_EMBED=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_DM_GPIO=y CONFIG_BCM6345_GPIO=y diff --git a/configs/comtrend_vr3032u_ram_defconfig b/configs/comtrend_vr3032u_ram_defconfig index 4f0e3f3d55..0cf286c77c 100644 --- a/configs/comtrend_vr3032u_ram_defconfig +++ b/configs/comtrend_vr3032u_ram_defconfig @@ -29,6 +29,7 @@ CONFIG_CMD_MEMINFO=y # CONFIG_CMD_NET is not set # CONFIG_CMD_NFS is not set # CONFIG_CMD_MISC is not set +CONFIG_OF_EMBED=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_DM_GPIO=y CONFIG_LED=y diff --git a/configs/comtrend_wap5813n_ram_defconfig b/configs/comtrend_wap5813n_ram_defconfig index aba53cce05..985bd3cc25 100644 --- a/configs/comtrend_wap5813n_ram_defconfig +++ b/configs/comtrend_wap5813n_ram_defconfig @@ -28,6 +28,7 @@ CONFIG_CMD_MEMINFO=y # CONFIG_CMD_NET is not set # CONFIG_CMD_NFS is not set # CONFIG_CMD_MISC is not set +CONFIG_OF_EMBED=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_DM_GPIO=y CONFIG_BCM6345_GPIO=y diff --git a/configs/netgear_cg3100d_ram_defconfig b/configs/netgear_cg3100d_ram_defconfig index fb998f03bf..a2cdd39e69 100644 --- a/configs/netgear_cg3100d_ram_defconfig +++ b/configs/netgear_cg3100d_ram_defconfig @@ -30,6 +30,7 @@ CONFIG_CMD_SPI=y # CONFIG_CMD_NET is not set # CONFIG_CMD_NFS is not set # CONFIG_CMD_MISC is not set +CONFIG_OF_EMBED=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_DM_GPIO=y CONFIG_BCM6345_GPIO=y diff --git a/configs/netgear_dgnd3700v2_ram_defconfig b/configs/netgear_dgnd3700v2_ram_defconfig index 11ee28eab1..8106081fe0 100644 --- a/configs/netgear_dgnd3700v2_ram_defconfig +++ b/configs/netgear_dgnd3700v2_ram_defconfig @@ -30,6 +30,7 @@ CONFIG_CMD_MEMINFO=y # CONFIG_CMD_NET is not set # CONFIG_CMD_NFS is not set # CONFIG_CMD_MISC is not set +CONFIG_OF_EMBED=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_DM_GPIO=y CONFIG_BCM6345_GPIO=y diff --git a/configs/sagem_f@st1704_ram_defconfig b/configs/sagem_f@st1704_ram_defconfig index 07a125cec6..0adcd46d51 100644 --- a/configs/sagem_f@st1704_ram_defconfig +++ b/configs/sagem_f@st1704_ram_defconfig @@ -31,6 +31,7 @@ CONFIG_CMD_SPI=y # CONFIG_CMD_NET is not set # CONFIG_CMD_NFS is not set # CONFIG_CMD_MISC is not set +CONFIG_OF_EMBED=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_DM_GPIO=y CONFIG_BCM6345_GPIO=y diff --git a/configs/sfr_nb4-ser_ram_defconfig b/configs/sfr_nb4-ser_ram_defconfig index 985b830b18..6218465ede 100644 --- a/configs/sfr_nb4-ser_ram_defconfig +++ b/configs/sfr_nb4-ser_ram_defconfig @@ -29,6 +29,7 @@ CONFIG_CMD_MEMINFO=y # CONFIG_CMD_NET is not set # CONFIG_CMD_NFS is not set # CONFIG_CMD_MISC is not set +CONFIG_OF_EMBED=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_DM_GPIO=y CONFIG_BCM6345_GPIO=y -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] MIPS relocation DT error
I just found out I was missing OF_EMBED, which confirms that it was working because CFE was relocating u-boot and not u-boot itself... Sorry for the noise... El 26/01/2018 a las 22:53, Álvaro Fernández Rojas escribió: Hello Paul & Daniel, I've finally had some time to do more testing and it appears that the relocation error I saw on BMIPS is due to a DT not found error caused by mips relocation: https://gist.github.com/Noltari/9017b3d28e2109d1de4158e5ad5b1c65 Any ideas on how to fix it? BTW, the reason why I think it works if I disable relocation is because CFE relocates .elf before executing them. Regards, Álvaro. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] MIPS relocation DT error
Hello Paul & Daniel, I've finally had some time to do more testing and it appears that the relocation error I saw on BMIPS is due to a DT not found error caused by mips relocation: https://gist.github.com/Noltari/9017b3d28e2109d1de4158e5ad5b1c65 Any ideas on how to fix it? BTW, the reason why I think it works if I disable relocation is because CFE relocates .elf before executing them. Regards, Álvaro. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] Please pull u-boot-dm
Hi Tom, Here are some additions to logging and 64-bit sandbox support. The following changes since commit ab12aa24e619b5e81cbde7de88c6d9a19f04313b: ARM: socfpga: Convert callers of cm_write_with_phase for wait_for_bit_le32 (2018-01-26 13:08:03 -0500) are available in the Git repository at: git://git.denx.de/u-boot-dm.git for you to fetch changes up to 4e94617bf911595efcecf52d6c9f323744a81cda: log: add category LOGC_EFI (2018-01-26 12:20:55 -0700) Heinrich Schuchardt (1): log: add category LOGC_EFI Mario Six (1): sandbox: Add 64-bit sandbox Simon Glass (9): dm: core: Add a function to look up a uclass by name log: Add functions to convert IDs to/from names log: Add control over log formatting log: Update log_console to honour the log format log: Add a command to control the log output format log: Add a command to output a log record log: Add tests for the new log features log: Add documentation for commands and formatting log: Add a way to log error-return values arch/sandbox/Kconfig | 16 ++- arch/sandbox/cpu/cpu.c| 2 +- arch/sandbox/dts/Makefile | 4 + arch/sandbox/dts/sandbox64.dts| 317 + arch/sandbox/include/asm/io.h | 6 ++ arch/sandbox/include/asm/types.h | 17 +++- board/sandbox/README.sandbox | 7 +- cmd/demo.c| 6 +- cmd/log.c | 82 +++ common/Kconfig| 13 +++ common/log.c | 69 + common/log_console.c | 27 - configs/sandbox64_defconfig | 200 configs/sandbox_defconfig | 1 + doc/README.log| 36 +++ drivers/core/uclass.c | 14 +++ drivers/demo/demo-simple.c| 2 +- include/asm-generic/global_data.h | 1 + include/dm/uclass.h | 8 ++ include/log.h | 65 +++- test/dm/core.c| 9 ++ test/py/tests/test_log.py | 32 +- 22 files changed, 912 insertions(+), 22 deletions(-) create mode 100644 arch/sandbox/dts/sandbox64.dts create mode 100644 configs/sandbox64_defconfig Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 7/9] log: Add tests for the new log features
On 28 December 2017 at 13:14, Simon Glasswrote: > Add a test of the 'log format' and 'log rec' commands. This also covers > things like log_get_cat_by_name(), since they are used by these commands. > Fix a style nit in the tests also. > > Signed-off-by: Simon Glass > --- > > test/py/tests/test_log.py | 28 +++- > 1 file changed, 27 insertions(+), 1 deletion(-) > Applied to u-boot-dm. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 1/1] log: add category LOGC_EFI
On 26 January 2018 at 08:25, Simon Glasswrote: > On 22 January 2018 at 12:10, Heinrich Schuchardt wrote: >> The EFI implementation does not fit into any of the existing categories. >> >> Provide LOGC_EFI so that EFI related message can be filtered. >> >> Signed-off-by: Heinrich Schuchardt >> --- >> v2 >> rebase on git://git.denx.de/u-boot-dm.git, branch log-working >> add category name >> --- >> common/log.c | 1 + >> doc/README.log | 1 + >> include/log.h | 1 + >> 3 files changed, 3 insertions(+) > > Reviewed-by: Simon Glass Applied to u-boot-dm, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2] sandbox: Add 64-bit sandbox
On 19 January 2018 at 00:17, Mario Sixwrote: > From: Mario Six > > To debug device tree issues involving 32- and 64-bit platforms, it is useful > to > have a generic 64-bit platform available. > > Add a version of the sandbox that uses 64-bit integers for its physical > addresses as well as a modified device tree. > > Signed-off-by: Mario Six > Reviewed-by: Simon Glass > --- > > v1 -> v2: > * Renamed CONFIG_SANDBOX_64BIT to CONFIG_HOST_64BIT to make semantics more > easily understandable > * Switched control of integer width to depend on CONFIG_PHYS_64BIT instead of > CONFIG_SANDBOX64 > * Extended the sandbox README with information about the 64-bit sandbox > > --- > arch/sandbox/Kconfig | 16 +- > arch/sandbox/cpu/cpu.c | 2 +- > arch/sandbox/dts/Makefile| 4 + > arch/sandbox/dts/sandbox64.dts | 317 > +++ > arch/sandbox/include/asm/io.h| 6 + > arch/sandbox/include/asm/types.h | 17 ++- > board/sandbox/README.sandbox | 7 +- > cmd/demo.c | 6 +- > configs/sandbox64_defconfig | 200 > drivers/demo/demo-simple.c | 2 +- > 10 files changed, 561 insertions(+), 16 deletions(-) > create mode 100644 arch/sandbox/dts/sandbox64.dts > create mode 100644 configs/sandbox64_defconfig Applied to u-boot-dm, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 9/9] log: Add a way to log error-return values
On 28 December 2017 at 13:14, Simon Glasswrote: > When functions return an error it propagates up the stack to the point > where it is reported. Often the error code provides enough information > about the root cause of the error that this is obvious what went wrong. > > However in some cases the error may be hard to trace. For example if a > driver uses several devices to perform an operation, it may not be > obvious which one failed. > > Add a log_ret() macro to help with this. This can be used to wrap any > error-return value. The logging system will then output a log record when > the original error is generated, making it easy to trace the call stack > of the error. > > This macro can significantly impact code size, so its use is controlled > by a Kconfig option, which is enabled for sandbox. > > Signed-off-by: Simon Glass > --- > > common/Kconfig| 13 + > configs/sandbox_defconfig | 1 + > doc/README.log| 8 > include/log.h | 11 +++ > 4 files changed, 33 insertions(+) Applied to u-boot-dm. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 6/9] log: Add a command to output a log record
On 28 December 2017 at 13:14, Simon Glasswrote: > Add a 'log rec' command which allows a log record to be manually output. > This is useful for scripts which want full control over what is logged. It > also permits easy testing of the log system. > > Signed-off-by: Simon Glass > --- > > cmd/log.c | 41 - > 1 file changed, 40 insertions(+), 1 deletion(-) > Applied to u-boot-dm. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 5/9] log: Add a command to control the log output format
On 28 December 2017 at 13:14, Simon Glasswrote: > Add a 'log format' command which can display or change the log output > format. This is useful for changing how much information is displayed. The > ordering of the fields is fixed. > > Signed-off-by: Simon Glass > --- > > cmd/log.c | 43 +++ > 1 file changed, 43 insertions(+) > Applied to u-boot-dm. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 8/9] log: Add documentation for commands and formatting
On 28 December 2017 at 13:14, Simon Glasswrote: > Add some notes about recent new features. > > Signed-off-by: Simon Glass > --- > > doc/README.log | 27 +++ > 1 file changed, 27 insertions(+) Applied to u-boot-dm. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 3/9] log: Add control over log formatting
On 28 December 2017 at 13:14, Simon Glasswrote: > It is useful to be able to control the output format of log records on the > console. As a starting point, add definitions for controlling which > elements of the log record are displayed. Use function and message as the > default, since these are the most useful fields. > > Signed-off-by: Simon Glass > --- > > common/log.c | 1 + > include/asm-generic/global_data.h | 1 + > include/log.h | 14 ++ > 3 files changed, 16 insertions(+) Applied to u-boot-dm. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 4/9] log: Update log_console to honour the log format
On 28 December 2017 at 13:14, Simon Glasswrote: > At present this just outputs the message. Update it to output whatever the > format requests. > > Signed-off-by: Simon Glass > --- > > common/log_console.c | 27 ++- > test/py/tests/test_log.py | 4 ++-- > 2 files changed, 28 insertions(+), 3 deletions(-) Applied to u-boot-dm. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 2/9] log: Add functions to convert IDs to/from names
On 28 December 2017 at 13:14, Simon Glasswrote: > Category and level both use an enum for their ID values. Add functions to > convert these IDs to strings and vice versa. This will allow the log to > output the strings instead of the (inscrutable) values. > > At the same time, add a new 'driver-model' category, to cover core > driver-model functions and fix an incorrect value for LOGL_MAX. > > Tests will be added with the new 'log' subcommands. > > Signed-off-by: Simon Glass > --- > > common/log.c | 67 > +++ > include/log.h | 39 -- > 2 files changed, 104 insertions(+), 2 deletions(-) > Applied to u-boot-dm. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/9] dm: core: Add a function to look up a uclass by name
On 28 December 2017 at 13:14, Simon Glasswrote: > Each uclass has a driver name which we can use to look up the uclass. This > is useful for logging, where the uclass ID is used as the category. > > Add a function to handle this, as well as a test. > > Signed-off-by: Simon Glass > --- > > drivers/core/uclass.c | 14 ++ > include/dm/uclass.h | 8 > test/dm/core.c| 9 + > 3 files changed, 31 insertions(+) > Applied to u-boot-dm ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] Pull request: u-boot-sunxi/master
On Fri, Jan 26, 2018 at 08:05:41PM +0530, Jagan Teki wrote: > Hi Tom, > > Please pull this PR. > > thanks! > Jagan. > > The following changes since commit 557767ed29968af0294e3aae48433e5d5a298e0b: > > Merge git://git.denx.de/u-boot-marvell (2018-01-20 08:39:47 -0500) > > are available in the git repository at: > > git://git.denx.de/u-boot-sunxi.git master > > for you to fetch changes up to a6968ecb0ad6b06552c97005eba265a4c5761626: > > gpio: sunxi: Add compatible string for H5 PIO (2018-01-26 20:02:33 +0530) > Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 3/3] MIPS: add BMIPS Netgear DGND3700v2 board
Signed-off-by: Álvaro Fernández Rojas--- arch/mips/dts/Makefile | 1 + arch/mips/dts/netgear,dgnd3700v2.dts | 121 +++ arch/mips/mach-bmips/Kconfig | 12 +++ board/netgear/dgnd3700v2/Kconfig | 12 +++ board/netgear/dgnd3700v2/MAINTAINERS | 6 ++ board/netgear/dgnd3700v2/Makefile| 5 ++ board/netgear/dgnd3700v2/dgnd3700v2.c| 30 configs/netgear_dgnd3700v2_ram_defconfig | 46 include/configs/netgear_dgnd3700v2.h | 16 9 files changed, 249 insertions(+) create mode 100644 arch/mips/dts/netgear,dgnd3700v2.dts create mode 100644 board/netgear/dgnd3700v2/Kconfig create mode 100644 board/netgear/dgnd3700v2/MAINTAINERS create mode 100644 board/netgear/dgnd3700v2/Makefile create mode 100644 board/netgear/dgnd3700v2/dgnd3700v2.c create mode 100644 configs/netgear_dgnd3700v2_ram_defconfig create mode 100644 include/configs/netgear_dgnd3700v2.h diff --git a/arch/mips/dts/Makefile b/arch/mips/dts/Makefile index 840dbf170d..e80905cf3a 100644 --- a/arch/mips/dts/Makefile +++ b/arch/mips/dts/Makefile @@ -15,6 +15,7 @@ dtb-$(CONFIG_BOARD_COMTREND_VR3032U) += comtrend,vr-3032u.dtb dtb-$(CONFIG_BOARD_COMTREND_WAP5813N) += comtrend,wap-5813n.dtb dtb-$(CONFIG_BOARD_HUAWEI_HG556A) += huawei,hg556a.dtb dtb-$(CONFIG_BOARD_NETGEAR_CG3100D) += netgear,cg3100d.dtb +dtb-$(CONFIG_BOARD_NETGEAR_DGND3700V2) += netgear,dgnd3700v2.dtb dtb-$(CONFIG_BOARD_SAGEM_FAST1704) += sagem,f...@st1704.dtb dtb-$(CONFIG_BOARD_TPLINK_WDR4300) += tplink_wdr4300.dtb diff --git a/arch/mips/dts/netgear,dgnd3700v2.dts b/arch/mips/dts/netgear,dgnd3700v2.dts new file mode 100644 index 00..2739f2035a --- /dev/null +++ b/arch/mips/dts/netgear,dgnd3700v2.dts @@ -0,0 +1,121 @@ +/* + * Copyright (C) 2018 Álvaro Fernández Rojas + * + * SPDX-License-Identifier:GPL-2.0+ + */ + +/dts-v1/; + +#include "brcm,bcm6362.dtsi" + +/ { + model = "Netgear DGND3700v2"; + compatible = "netgear,dgnd3700v2", "brcm,bcm6362"; + + aliases { + serial0 = + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + gpio-leds { + compatible = "gpio-leds"; + + inet_green { + label = "DGND3700v2:green:inet"; + gpios = < 1 GPIO_ACTIVE_LOW>; + }; + + dsl_green { + label = "DGND3700v2:green:dsl"; + gpios = < 28 GPIO_ACTIVE_LOW>; + }; + + power_amber { + label = "DGND3700v2:red:power"; + gpios = < 2 GPIO_ACTIVE_LOW>; + }; + }; +}; + + { + status = "okay"; +}; + + { + status = "okay"; +}; + + { + status = "okay"; + brcm,serial-leds; + brcm,serial-dat-low; + brcm,serial-shift-inv; + brcm,serial-mux; + + led@8 { + reg = <8>; + label = "DGND3700v2:green:power"; + }; + + led@9 { + reg = <9>; + active-low; + label = "DGND3700v2:green:wps"; + }; + + led@10 { + reg = <10>; + active-low; + label = "DGND3700v2:green:usb1"; + }; + + led@11 { + reg = <11>; + active-low; + label = "DGND3700v2:green:usb2"; + }; + + led@12 { + reg = <12>; + active-low; + label = "DGND3700v2:amber:inet"; + }; + + led@13 { + reg = <13>; + active-low; + label = "DGND3700v2:green:ethernet"; + }; + + led@14 { + reg = <14>; + active-low; + label = "DGND3700v2:amber:dsl"; + }; + + led@16 { + reg = <16>; + active-low; + label = "DGND3700v2:amber:usb1"; + }; + + led@17 { + reg = <17>; + active-low; + label = "DGND3700v2:amber:usb2"; + }; + + led@18 { + reg = <18>; + active-low; + label = "DGND3700v2:amber:ethernet"; + }; +}; + + { + u-boot,dm-pre-reloc; + status = "okay"; +}; diff --git a/arch/mips/mach-bmips/Kconfig b/arch/mips/mach-bmips/Kconfig index 2cc6a6a8d9..10900bf604 100644 --- a/arch/mips/mach-bmips/Kconfig +++ b/arch/mips/mach-bmips/Kconfig @@ -200,6 +200,17 @@ config BOARD_NETGEAR_CG3100D ethernet ports, 1 UART, GPIO buttons and LEDs, and a BCM43225 (miniPCIe). +config BOARD_NETGEAR_DGND3700V2 + bool "Netgear DGND3700v2" + depends on SOC_BMIPS_BCM6362 + select BMIPS_SUPPORTS_BOOT_RAM + help + Netgear DGND3700v2 boards have a BCM6362 SoC with 64 MB of RAM and + 32 MB of flash (NAND). +
[U-Boot] [PATCH 2/3] MIPS: add support for Broadcom MIPS BCM6362 SoC family
Signed-off-by: Álvaro Fernández Rojas--- arch/mips/dts/brcm,bcm6362.dtsi| 186 + arch/mips/mach-bmips/Kconfig | 12 ++ include/configs/bmips_bcm6362.h| 25 +++ include/dt-bindings/clock/bcm6362-clock.h | 33 .../power-domain/bcm6362-power-domain.h| 25 +++ include/dt-bindings/reset/bcm6362-reset.h | 28 6 files changed, 309 insertions(+) create mode 100644 arch/mips/dts/brcm,bcm6362.dtsi create mode 100644 include/configs/bmips_bcm6362.h create mode 100644 include/dt-bindings/clock/bcm6362-clock.h create mode 100644 include/dt-bindings/power-domain/bcm6362-power-domain.h create mode 100644 include/dt-bindings/reset/bcm6362-reset.h diff --git a/arch/mips/dts/brcm,bcm6362.dtsi b/arch/mips/dts/brcm,bcm6362.dtsi new file mode 100644 index 00..921fcd52c3 --- /dev/null +++ b/arch/mips/dts/brcm,bcm6362.dtsi @@ -0,0 +1,186 @@ +/* + * Copyright (C) 2018 Álvaro Fernández Rojas + * + * SPDX-License-Identifier:GPL-2.0+ + */ + +#include +#include +#include +#include +#include "skeleton.dtsi" + +/ { + compatible = "brcm,bcm6362"; + + aliases { + spi0 = + spi1 = + }; + + cpus { + reg = <0x1000 0x4>; + #address-cells = <1>; + #size-cells = <0>; + u-boot,dm-pre-reloc; + + cpu@0 { + compatible = "brcm,bcm6362-cpu", "mips,mips4Kc"; + device_type = "cpu"; + reg = <0>; + u-boot,dm-pre-reloc; + }; + + cpu@1 { + compatible = "brcm,bcm6362-cpu", "mips,mips4Kc"; + device_type = "cpu"; + reg = <1>; + u-boot,dm-pre-reloc; + }; + }; + + clocks { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + u-boot,dm-pre-reloc; + + hsspi_pll: hsspi-pll { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <1>; + }; + + periph_osc: periph-osc { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <5000>; + u-boot,dm-pre-reloc; + }; + + periph_clk: periph-clk { + compatible = "brcm,bcm6345-clk"; + reg = <0x1004 0x4>; + #clock-cells = <1>; + }; + }; + + ubus { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + u-boot,dm-pre-reloc; + + pll_cntl: syscon@1008 { + compatible = "syscon"; + reg = <0x1008 0x4>; + }; + + syscon-reboot { + compatible = "syscon-reboot"; + regmap = <_cntl>; + offset = <0x0>; + mask = <0x1>; + }; + + periph_rst: reset-controller@1010 { + compatible = "brcm,bcm6345-reset"; + reg = <0x1010 0x4>; + #reset-cells = <1>; + }; + + wdt: watchdog@105c { + compatible = "brcm,bcm6345-wdt"; + reg = <0x105c 0xc>; + clocks = <_osc>; + }; + + wdt-reboot { + compatible = "wdt-reboot"; + wdt = <>; + }; + + gpio1: gpio-controller@1080 { + compatible = "brcm,bcm6345-gpio"; + reg = <0x1080 0x4>, <0x1088 0x4>; + gpio-controller; + #gpio-cells = <2>; + ngpios = <16>; + + status = "disabled"; + }; + + gpio0: gpio-controller@1084 { + compatible = "brcm,bcm6345-gpio"; + reg = <0x1084 0x4>, <0x108c 0x4>; + gpio-controller; + #gpio-cells = <2>; + + status = "disabled"; + }; + + uart0: serial@1100 { + compatible = "brcm,bcm6345-uart"; + reg = <0x1100 0x18>; + clocks = <_osc>; + + status = "disabled"; + }; + + uart1: serial@1120 { + compatible =
[U-Boot] [PATCH 1/3] dm: cpu: bmips: add BCM6362 support
Signed-off-by: Álvaro Fernández Rojas--- drivers/cpu/bmips_cpu.c | 51 + 1 file changed, 51 insertions(+) diff --git a/drivers/cpu/bmips_cpu.c b/drivers/cpu/bmips_cpu.c index 4ad291a56e..6c612bacdc 100644 --- a/drivers/cpu/bmips_cpu.c +++ b/drivers/cpu/bmips_cpu.c @@ -50,6 +50,10 @@ DECLARE_GLOBAL_DATA_PTR; #define DMIPSPLLCFG_6358_N2_SHIFT 29 #define DMIPSPLLCFG_6358_N2_MASK (0x7 << DMIPSPLLCFG_6358_N2_SHIFT) +#define REG_BCM6362_MISC_STRAPBUS 0x1814 +#define STRAPBUS_6362_FCVO_SHIFT 1 +#define STRAPBUS_6362_FCVO_MASK(0x1f << STRAPBUS_6362_FCVO_SHIFT) + #define REG_BCM6368_DDR_DMIPSPLLCFG0x12a0 #define DMIPSPLLCFG_6368_P1_SHIFT 0 #define DMIPSPLLCFG_6368_P1_MASK (0xf << DMIPSPLLCFG_6368_P1_SHIFT) @@ -194,6 +198,44 @@ static ulong bcm6358_get_cpu_freq(struct bmips_cpu_priv *priv) return (16 * 100 * n1 * n2) / m1; } +static ulong bcm6362_get_cpu_freq(struct bmips_cpu_priv *priv) +{ + unsigned int mips_pll_fcvo; + + mips_pll_fcvo = readl_be(priv->regs + REG_BCM6362_MISC_STRAPBUS); + mips_pll_fcvo = (mips_pll_fcvo & STRAPBUS_6362_FCVO_MASK) + >> STRAPBUS_6362_FCVO_SHIFT; + + switch (mips_pll_fcvo) { + case 0x03: + case 0x0b: + case 0x13: + case 0x1b: + return 24000; + case 0x04: + case 0x0c: + case 0x14: + case 0x1c: + return 16000; + case 0x05: + case 0x0e: + case 0x16: + case 0x1e: + case 0x1f: + return 4; + case 0x06: + return 44000; + case 0x07: + case 0x17: + return 38400; + case 0x15: + case 0x1d: + return 2; + default: + return 32000; + } +} + static ulong bcm6368_get_cpu_freq(struct bmips_cpu_priv *priv) { unsigned int tmp, p1, p2, ndiv, m1; @@ -289,6 +331,12 @@ static const struct bmips_cpu_hw bmips_cpu_bcm6358 = { .get_cpu_count = bcm6358_get_cpu_count, }; +static const struct bmips_cpu_hw bmips_cpu_bcm6362 = { + .get_cpu_desc = bmips_short_cpu_desc, + .get_cpu_freq = bcm6362_get_cpu_freq, + .get_cpu_count = bcm6358_get_cpu_count, +}; + static const struct bmips_cpu_hw bmips_cpu_bcm6368 = { .get_cpu_desc = bmips_short_cpu_desc, .get_cpu_freq = bcm6368_get_cpu_freq, @@ -395,6 +443,9 @@ static const struct udevice_id bmips_cpu_ids[] = { .compatible = "brcm,bcm6358-cpu", .data = (ulong)_cpu_bcm6358, }, { + .compatible = "brcm,bcm6362-cpu", + .data = (ulong)_cpu_bcm6362, + }, { .compatible = "brcm,bcm6368-cpu", .data = (ulong)_cpu_bcm6368, }, { -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 0/3] mips: bmips: add BCM6362 SoC support
BCM6362 is a dual core BCM63xx SoC. Álvaro Fernández Rojas (3): dm: cpu: bmips: add BCM6362 support MIPS: add support for Broadcom MIPS BCM6362 SoC family MIPS: add BMIPS Netgear DGND3700v2 board arch/mips/dts/Makefile | 1 + arch/mips/dts/brcm,bcm6362.dtsi| 186 + arch/mips/dts/netgear,dgnd3700v2.dts | 121 ++ arch/mips/mach-bmips/Kconfig | 24 +++ board/netgear/dgnd3700v2/Kconfig | 12 ++ board/netgear/dgnd3700v2/MAINTAINERS | 6 + board/netgear/dgnd3700v2/Makefile | 5 + board/netgear/dgnd3700v2/dgnd3700v2.c | 30 configs/netgear_dgnd3700v2_ram_defconfig | 46 + drivers/cpu/bmips_cpu.c| 51 ++ include/configs/bmips_bcm6362.h| 25 +++ include/configs/netgear_dgnd3700v2.h | 16 ++ include/dt-bindings/clock/bcm6362-clock.h | 33 .../power-domain/bcm6362-power-domain.h| 25 +++ include/dt-bindings/reset/bcm6362-reset.h | 28 15 files changed, 609 insertions(+) create mode 100644 arch/mips/dts/brcm,bcm6362.dtsi create mode 100644 arch/mips/dts/netgear,dgnd3700v2.dts create mode 100644 board/netgear/dgnd3700v2/Kconfig create mode 100644 board/netgear/dgnd3700v2/MAINTAINERS create mode 100644 board/netgear/dgnd3700v2/Makefile create mode 100644 board/netgear/dgnd3700v2/dgnd3700v2.c create mode 100644 configs/netgear_dgnd3700v2_ram_defconfig create mode 100644 include/configs/bmips_bcm6362.h create mode 100644 include/configs/netgear_dgnd3700v2.h create mode 100644 include/dt-bindings/clock/bcm6362-clock.h create mode 100644 include/dt-bindings/power-domain/bcm6362-power-domain.h create mode 100644 include/dt-bindings/reset/bcm6362-reset.h -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 1/1] efi_loader: split README.efi into two separate documents
README.efi describes two different concepts: * U-Boot exposing the UEFI API * U-Boot running on top of UEFI. This patch splits the document in two. Religious references are removed. The separation of the concepts makes sense before detailing the internals of U-Boot exposing the UEFI API in a future patch. Signed-off-by: Heinrich Schuchardt--- MAINTAINERS | 1 + doc/README.efi | 275 ++- doc/README.u-boot_on_efi | 259 3 files changed, 271 insertions(+), 264 deletions(-) create mode 100644 doc/README.u-boot_on_efi diff --git a/MAINTAINERS b/MAINTAINERS index 6e94cee5d3..bc4f4fcfc7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -288,6 +288,7 @@ S: Maintained T: git git://github.com/agraf/u-boot.git F: doc/README.efi F: doc/README.iscsi +F: doc/README.u-boot_on_efi F: include/efi* F: lib/efi*/ F: test/py/tests/test_efi* diff --git a/doc/README.efi b/doc/README.efi index 66259f3e26..956f5bfa0c 100644 --- a/doc/README.efi +++ b/doc/README.efi @@ -4,279 +4,24 @@ # SPDX-License-Identifier: GPL-2.0+ # -=== Table of Contents === - - 1 U-Boot on EFI - 1.1 In God's Name, Why? - 1.2 Status - 1.3 Build Instructions - 1.4 Trying it out - 1.5 Inner workings - 1.6 EFI Application - 1.7 EFI Payload - 1.8 Tables - 1.9 Interrupts - 1.10 32/64-bit - 1.11 Future work - 1.12 Where is the code? - - 2 EFI on U-Boot - 2.1 In God's Name, Why? - 2.2 How do I get it? - 2.3 Status - 2.4 Future work - -U-Boot on EFI +EFI on U-Boot = -This document provides information about U-Boot running on top of EFI, either -as an application or just as a means of getting U-Boot onto a new platform. - - -In God's Name, Why? -This is useful in several situations: - -- You have EFI running on a board but U-Boot does not natively support it -fully yet. You can boot into U-Boot from EFI and use that until U-Boot is -fully ported - -- You need to use an EFI implementation (e.g. UEFI) because your vendor -requires it in order to provide support +This document provides information about the implementation of the UEFI API [1] +in U-Boot. -- You plan to use coreboot to boot into U-Boot but coreboot support does -not currently exist for your platform. In the meantime you can use U-Boot -on EFI and then move to U-Boot on coreboot when ready - -- You use EFI but want to experiment with a simpler alternative like U-Boot +=== Table of Contents === +Motivation +How do I get it? Status --- -Only x86 is supported at present. If you are using EFI on another architecture -you may want to reconsider. However, much of the code is generic so could be -ported. - -U-Boot supports running as an EFI application for 32-bit EFI only. This is -not very useful since only a serial port is provided. You can look around at -memory and type 'help' but that is about it. - -More usefully, U-Boot supports building itself as a payload for either 32-bit -or 64-bit EFI. U-Boot is packaged up and loaded in its entirety by EFI. Once -started, U-Boot changes to 32-bit mode (currently) and takes over the -machine. You can use devices, boot a kernel, etc. - - -Build Instructions --- -First choose a board that has EFI support and obtain an EFI implementation -for that board. It will be either 32-bit or 64-bit. Alternatively, you can -opt for using QEMU [1] and the OVMF [2], as detailed below. - -To build U-Boot as an EFI application (32-bit EFI required), enable CONFIG_EFI -and CONFIG_EFI_APP. The efi-x86 config (efi-x86_defconfig) is set up for this. -Just build U-Boot as normal, e.g. - - make efi-x86_defconfig - make - -To build U-Boot as an EFI payload (32-bit or 64-bit EFI can be used), adjust an -existing config (like qemu-x86_defconfig) to enable CONFIG_EFI, CONFIG_EFI_STUB -and either CONFIG_EFI_STUB_32BIT or CONFIG_EFI_STUB_64BIT. All of these are -boolean Kconfig options. Then build U-Boot as normal, e.g. - - make qemu-x86_defconfig - make - -You will end up with one of these files depending on what you build for: - - u-boot-app.efi - U-Boot EFI application - u-boot-payload.efi - U-Boot EFI payload application - - -Trying it out -- -QEMU is an emulator and it can emulate an x86 machine. Please make sure your -QEMU version is 2.3.0 or above to test this. You can run the payload with -something like this: - - mkdir /tmp/efi - cp /path/to/u-boot*.efi /tmp/efi - qemu-system-x86_64 -bios bios.bin -hda fat:/tmp/efi/ - -Add -nographic if you want to use the terminal for output. Once it starts -type 'fs0:u-boot-payload.efi' to run the payload or 'fs0:u-boot-app.efi' to -run the application. 'bios.bin' is the EFI 'BIOS'. Check [2] to obtain a -prebuilt EFI BIOS for QEMU or you can build one from source as well. - -To try it on real hardware, put
[U-Boot] [PATCH v2 1/1] efi_loader: add a README.iscsi describing booting via iSCSI
The appended README explains how U-Boot and iPXE can be used to boot a diskless system from an iSCSI SAN. The maintainer for README.efi and README.iscsi is set. Signed-off-by: Heinrich Schuchardt--- v2 mention work on TCP and wget remove VLAN drawing fix reference of EFI service used by Grub --- MAINTAINERS | 2 + doc/README.iscsi | 159 ++ lib/efi_loader/efi_file.c | 9 +++ 3 files changed, 170 insertions(+) create mode 100644 doc/README.iscsi diff --git a/MAINTAINERS b/MAINTAINERS index d459153503..6e94cee5d3 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -286,6 +286,8 @@ EFI PAYLOAD M: Alexander Graf S: Maintained T: git git://github.com/agraf/u-boot.git +F: doc/README.efi +F: doc/README.iscsi F: include/efi* F: lib/efi*/ F: test/py/tests/test_efi* diff --git a/doc/README.iscsi b/doc/README.iscsi new file mode 100644 index 00..a731c06feb --- /dev/null +++ b/doc/README.iscsi @@ -0,0 +1,159 @@ +# iSCSI booting with U-Boot and iPXE + +## Motivation + +U-Boot has only a reduced set of supported network protocols. The focus for +network booting has been on UDP based protocols. A TCP stack and HTTP support +are expected to be integrated in 2018 together with a wget command. + +For booting a diskless computer this leaves us with BOOTP or DHCP to get the +address of a boot script. TFTP or NFS can be used to load the boot script, the +operating system kernel and the initial file system (initrd). + +These protocols are insecure. The client cannot validate the authenticity +of the contacted servers. And the server cannot verify the identity of the +client. + +Furthermore the services providing the operating system loader or kernel are +not the ones that the operating system typically will use. Especially in a SAN +environment this makes updating the operating system a hassle. After installing +a new kernel version the boot files have to be copied to the TFTP server +directory. + +The HTTPS protocol provides certificate based validation of servers. Sensitive +data like passwords can be securely transmitted. + +The iSCSI protocol is used for connecting storage attached networks. It +provides mutual authentication using the CHAP protocol. It typically runs on +a TCP transport. + +Thus a better solution than DHCP/TFTP/NFS boot would be to load a boot script +via HTTPS and to download any other files needed for booting via iSCSI from the +same target where the operating system is installed. + +An alternative to implementing these protocols in U-Boot is to use an existing +software that can run on top of U-Boot. iPXE is the "swiss army knife" of +network booting. It supports both HTTPS and iSCSI. It has a scripting engine for +fine grained control of the boot process and can provide a command shell. + +iPXE can be built as an EFI application (named snp.efi) which can be loaded and +run by U-Boot. + +## Boot sequence + +U-Boot loads the EFI application iPXE snp.efi using the bootefi command. This +application has network access via the simple network protocol offered by +U-Boot. + +iPXE executes its internal script. This script may optionally chain load a +secondary boot script via HTTPS or open a shell. + +For the further boot process iPXE connects to the iSCSI server. This includes +the mutual authentication using the CHAP protocol. After the authentication iPXE +has access to the iSCSI targets. + +For a selected iSCSI target iPXE sets up a handle with the block IO protocol. It +uses the ConnectController boot service of U-Boot to request U-Boot to connect a +file system driver. U-Boot reads from the iSCSI drive via the block IO protocol +offered by iPXE. It creates the partition handles and installs the simple file +protocol. Now iPXE can call the simple file protocol to load Grub. U-Boot uses +the block IO protocol offered by iPXE to fulfill the request. + +Once Grub is started it uses the same block IO protocol to load Linux. Via +the EFI stub Linux is called as an EFI application. + +``` + ++ ++ + || Runs || + | U-Boot |=>| iPXE | + | EFI| | snp.efi| +++ || DHCP || +||<||<=|| +| DHCP | || Get IP || +| Server | || Adress || +||>||=>|| +++ || Response || + || || + || || +++ || HTTPS|| +||<||<=|| +| HTTPS | || Load || +| Server | || Script || +||>||=>|| +++ || || +
Re: [U-Boot] [PATCH] ARM: socfpga: Convert callers of cm_write_with_phase for wait_for_bit_le32
On 01/26/2018 17:28, Tom Rini wrote: > Now that we have and use wait_for_bit_le32() available, the callers of > cm_write_with_phase() should not be casting values to u32 and instead we > expect a const void *, so provide that directly. > > Fixes: 48263504c8d5 ("wait_bit: use wait_for_bit_le32 and remove > wait_for_bit") > Cc: Marek Vasut> Signed-off-by: Tom Rini > --- > arch/arm/mach-socfpga/clock_manager_gen5.c | 10 +- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/arch/arm/mach-socfpga/clock_manager_gen5.c > b/arch/arm/mach-socfpga/clock_manager_gen5.c > index 3d048ba3e432..4e5b6d169371 100644 > --- a/arch/arm/mach-socfpga/clock_manager_gen5.c > +++ b/arch/arm/mach-socfpga/clock_manager_gen5.c > @@ -33,7 +33,7 @@ static void cm_write_ctrl(u32 val) > } > > /* function to write a clock register that has phase information */ > -static int cm_write_with_phase(u32 value, u32 reg_address, u32 mask) > +static int cm_write_with_phase(u32 value, const void *reg_address, u32 mask) Shouldn't that better be a non-const void * since it is used for writing a value, too? That 'const' is later casted away by __arch_putl(), but it still looks wrong to me. Simon > { >int ret; > > @@ -268,26 +268,26 @@ int cm_basic_init(const struct cm_config * const cfg) > * are aligned nicely; so we can change any phase. > */ > ret = cm_write_with_phase(cfg->ddrdqsclk, > - (u32)_manager_base->sdr_pll.ddrdqsclk, > + _manager_base->sdr_pll.ddrdqsclk, > CLKMGR_SDRPLLGRP_DDRDQSCLK_PHASE_MASK); > if (ret) > return ret; > > /* SDRAM DDR2XDQSCLK */ > ret = cm_write_with_phase(cfg->ddr2xdqsclk, > - > (u32)_manager_base->sdr_pll.ddr2xdqsclk, > + _manager_base->sdr_pll.ddr2xdqsclk, > CLKMGR_SDRPLLGRP_DDR2XDQSCLK_PHASE_MASK); > if (ret) > return ret; > > ret = cm_write_with_phase(cfg->ddrdqclk, > - (u32)_manager_base->sdr_pll.ddrdqclk, > + _manager_base->sdr_pll.ddrdqclk, > CLKMGR_SDRPLLGRP_DDRDQCLK_PHASE_MASK); > if (ret) > return ret; > > ret = cm_write_with_phase(cfg->s2fuser2clk, > - > (u32)_manager_base->sdr_pll.s2fuser2clk, > + _manager_base->sdr_pll.s2fuser2clk, > CLKMGR_SDRPLLGRP_S2FUSER2CLK_PHASE_MASK); > if (ret) > return ret; > -- > 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PULL] u-boot-mips/master
On Fri, Jan 26, 2018 at 01:45:32PM +0100, Daniel Schwierzeck wrote: > The following changes since commit fb4413295c765aa8c013650984dc2d908964c81d: > > Merge git://git.denx.de/u-boot-mmc (2018-01-24 11:28:44 -0500) > > are available in the Git repository at: > > git://git.denx.de/u-boot-mips.git master > > for you to fetch changes up to 664ec31db7b99269b612360ffb3c9840a195e263: > > MIPS: add BMIPS Comtrend AR-5315u board (2018-01-26 12:38:13 +0100) > Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] ARM: socfpga: Convert callers of cm_write_with_phase for wait_for_bit_le32
On Fri, Jan 26, 2018 at 11:28:22AM -0500, Tom Rini wrote: > Now that we have and use wait_for_bit_le32() available, the callers of > cm_write_with_phase() should not be casting values to u32 and instead we > expect a const void *, so provide that directly. > > Fixes: 48263504c8d5 ("wait_bit: use wait_for_bit_le32 and remove > wait_for_bit") > Reviewed-by: Marek Vasut> Signed-off-by: Tom Rini Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] Please pull u-boot-coldfire/master
On Wed, Jan 24, 2018 at 12:32:33AM +0100, Angelo Dureghello wrote: > The following changes since commit c761a7e29d703d60208585bb7d8415e00aa22556: > > Revert "travis-ci: Add qemu-x86_64 target" (2018-01-22 21:06:41 -0500) > > are available in the Git repository at: > > git://git.denx.de/u-boot-coldfire.git master > > for you to fetch changes up to b9153fe3088a4ea295d6cd23dd44bed51224679a: > > common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO (2018-01-23 > 23:47:02 +0100) > Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] Pull request v2: u-boot-spi/master
On Fri, Jan 26, 2018 at 11:57:27AM +0530, Jagan Teki wrote: > Hi Tom, > > Please pull this PR. > > Changes for v2: > - Fixed patches on wait_bit > - Collected new patches. > > thanks! > Jagan. > > The following changes since commit 98691a60abffb44303d7dae6e9e699d0daded930: > > Merge git://git.denx.de/u-boot-rockchip (2018-01-09 13:28:51 -0500) > > are available in the git repository at: > > git://git.denx.de/u-boot-spi.git master > > for you to fetch changes up to 58c125b9e2b232ce73ed7b24ba7b1ca5ff41c5bd: > > DW SPI: Get clock value from Device Tree (2018-01-26 11:26:16 +0530) > Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [RFC] i2c, omap24xx: Fixup High Speed Initialization
For devices running I2C over 400KHz, this needs to be in HS mode. Currently, the code is only running in HS mode when the speed is equal or greater than 3.4MHz. Using the Linux kernel setup as a reference, I used much of their calculation for fsscll, fssclh, hsscll, and hssclh. However, Linux uses fclk = clk_get(omap->dev, "fck") and fclk_rate = clk_get_rate(fclk) to setup psc. I wasn't sure how to do that in U-Boot since the structures are different, so I assumed fclk = I2C_IP_CLK (4800). I don't think this is correct, so I am hoping someone might have a suggestion. As it stands, attempts to initialize I2C1 @ 2.6MHz fail, but this RFC doesn't appear to give me issues. As of this writing, I don't have a scope to look at the actual clock speed. Signed-off-by: Adam Forddiff --git a/drivers/i2c/omap24xx_i2c.c b/drivers/i2c/omap24xx_i2c.c index 5d33815..4c1aa5d 100644 --- a/drivers/i2c/omap24xx_i2c.c +++ b/drivers/i2c/omap24xx_i2c.c @@ -205,9 +205,12 @@ static int __omap24_i2c_setspeed(struct i2c *i2c_base, uint speed, int hsscll = 0, hssclh = 0; u32 scll = 0, sclh = 0; - if (speed >= OMAP_I2C_HIGH_SPEED) { + if (speed > OMAP_I2C_FAST_MODE) { /* High speed */ - psc = I2C_IP_CLK / I2C_INTERNAL_SAMPLING_CLK; + int scl; + int internal_clk = 1920; + + psc = I2C_IP_CLK / internal_clk; psc -= 1; if (psc < I2C_PSC_MIN) { printf("Error : I2C unsupported prescaler %d\n", psc); @@ -215,12 +218,10 @@ static int __omap24_i2c_setspeed(struct i2c *i2c_base, uint speed, } /* For first phase of HS mode */ - fsscll = I2C_INTERNAL_SAMPLING_CLK / (2 * speed); - - fssclh = fsscll; + scl = internal_clk / (40); + fsscll = scl - (scl / 3) - 7; + fssclh = (scl / 3) - 5; - fsscll -= I2C_HIGHSPEED_PHASE_ONE_SCLL_TRIM; - fssclh -= I2C_HIGHSPEED_PHASE_ONE_SCLH_TRIM; if (((fsscll < 0) || (fssclh < 0)) || ((fsscll > 255) || (fssclh > 255))) { puts("Error : I2C initializing first phase clock\n"); @@ -228,10 +229,11 @@ static int __omap24_i2c_setspeed(struct i2c *i2c_base, uint speed, } /* For second phase of HS mode */ - hsscll = hssclh = I2C_INTERNAL_SAMPLING_CLK / (2 * speed); + scl = I2C_INTERNAL_SAMPLING_CLK / speed; + + hsscll = scl - (scl / 3) - 7; + hssclh = (scl / 3) - 5; - hsscll -= I2C_HIGHSPEED_PHASE_TWO_SCLL_TRIM; - hssclh -= I2C_HIGHSPEED_PHASE_TWO_SCLH_TRIM; if (((fsscll < 0) || (fssclh < 0)) || ((fsscll > 255) || (fssclh > 255))) { puts("Error : I2C initializing second phase clock\n"); -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v4 2/2] imx: mx7: run sec_init for CAAM RNG
On Fri, Jan 26, 2018 at 2:27 PM, Bryan O'Donoghuewrote: > This patch adds a sec_init call into arch_misc_init(). Doing so in > conjunction with the patch "drivers/crypto/fsl: assign job-rings to > non-TrustZone" enables use of the CAAM in Linux when OPTEE/TrustZone is > active. > > u-boot will initialise the RNG and assign ownership of the job-ring > registers to a non-TrustZone context. With recent changes by Lukas Auer to > fully initialize the RNG in sec_init() this means that u-boot will hand-off > the CAAM in a state that Linux then can use the CAAM without touching the > reserved DECO registers. > > This change is safe both for the OPTEE/TrustZone boot path and the regular > non-OPTEE/TrustZone boot path. > > Signed-off-by: Bryan O'Donoghue > Cc: Fabio Estevam > Cc: Peng Fan > Cc: Marco Franchi > Cc: Vanessa Maegima > Cc: Stefano Babic > Cc: Lukas Auer Reviewed-by: Fabio Estevam ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v4 2/2] imx: mx7: run sec_init for CAAM RNG
On Fri, 2018-01-26 at 16:27 +, Bryan O'Donoghue wrote: > This patch adds a sec_init call into arch_misc_init(). Doing so in > conjunction with the patch "drivers/crypto/fsl: assign job-rings to > non-TrustZone" enables use of the CAAM in Linux when OPTEE/TrustZone > is > active. > > u-boot will initialise the RNG and assign ownership of the job-ring > registers to a non-TrustZone context. With recent changes by Lukas > Auer to > fully initialize the RNG in sec_init() this means that u-boot will > hand-off > the CAAM in a state that Linux then can use the CAAM without touching > the > reserved DECO registers. > > This change is safe both for the OPTEE/TrustZone boot path and the > regular > non-OPTEE/TrustZone boot path. > > Signed-off-by: Bryan O'Donoghue> Cc: Fabio Estevam > Cc: Peng Fan > Cc: Marco Franchi > Cc: Vanessa Maegima > Cc: Stefano Babic > Cc: Lukas Auer > --- > arch/arm/mach-imx/mx7/soc.c | 5 + > 1 file changed, 5 insertions(+) > > diff --git a/arch/arm/mach-imx/mx7/soc.c b/arch/arm/mach- > imx/mx7/soc.c > index d160e80..d444046 100644 > --- a/arch/arm/mach-imx/mx7/soc.c > +++ b/arch/arm/mach-imx/mx7/soc.c > @@ -17,6 +17,7 @@ > #include > #include > #include > +#include > > #if defined(CONFIG_IMX_THERMAL) > static const struct imx_thermal_plat imx7_thermal_plat = { > @@ -262,6 +263,10 @@ int arch_misc_init(void) > env_set("soc", "imx7s"); > #endif > > +#ifdef CONFIG_FSL_CAAM > + sec_init(); > +#endif > + > return 0; > } > #endif Sorry, didn't see your patch in time before I sent my last email. I tested your patch set again and everything works on my imx7d board (successful probe call and using the CAAM with openssl). Tested-by: Lukas Auer ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] ARM: socfpga: Convert callers of cm_write_with_phase for wait_for_bit_le32
On 01/26/2018 05:28 PM, Tom Rini wrote: > Now that we have and use wait_for_bit_le32() available, the callers of > cm_write_with_phase() should not be casting values to u32 and instead we > expect a const void *, so provide that directly. > > Fixes: 48263504c8d5 ("wait_bit: use wait_for_bit_le32 and remove > wait_for_bit") > Cc: Marek Vasut> Signed-off-by: Tom Rini Reviewed-by: Marek Vasut > --- > arch/arm/mach-socfpga/clock_manager_gen5.c | 10 +- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/arch/arm/mach-socfpga/clock_manager_gen5.c > b/arch/arm/mach-socfpga/clock_manager_gen5.c > index 3d048ba3e432..4e5b6d169371 100644 > --- a/arch/arm/mach-socfpga/clock_manager_gen5.c > +++ b/arch/arm/mach-socfpga/clock_manager_gen5.c > @@ -33,7 +33,7 @@ static void cm_write_ctrl(u32 val) > } > > /* function to write a clock register that has phase information */ > -static int cm_write_with_phase(u32 value, u32 reg_address, u32 mask) > +static int cm_write_with_phase(u32 value, const void *reg_address, u32 mask) > { > int ret; > > @@ -268,26 +268,26 @@ int cm_basic_init(const struct cm_config * const cfg) >* are aligned nicely; so we can change any phase. >*/ > ret = cm_write_with_phase(cfg->ddrdqsclk, > - (u32)_manager_base->sdr_pll.ddrdqsclk, > + _manager_base->sdr_pll.ddrdqsclk, > CLKMGR_SDRPLLGRP_DDRDQSCLK_PHASE_MASK); > if (ret) > return ret; > > /* SDRAM DDR2XDQSCLK */ > ret = cm_write_with_phase(cfg->ddr2xdqsclk, > - (u32)_manager_base->sdr_pll.ddr2xdqsclk, > + _manager_base->sdr_pll.ddr2xdqsclk, > CLKMGR_SDRPLLGRP_DDR2XDQSCLK_PHASE_MASK); > if (ret) > return ret; > > ret = cm_write_with_phase(cfg->ddrdqclk, > - (u32)_manager_base->sdr_pll.ddrdqclk, > + _manager_base->sdr_pll.ddrdqclk, > CLKMGR_SDRPLLGRP_DDRDQCLK_PHASE_MASK); > if (ret) > return ret; > > ret = cm_write_with_phase(cfg->s2fuser2clk, > - (u32)_manager_base->sdr_pll.s2fuser2clk, > + _manager_base->sdr_pll.s2fuser2clk, > CLKMGR_SDRPLLGRP_S2FUSER2CLK_PHASE_MASK); > if (ret) > return ret; > -- Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [RESEND PATCH v3 2/2] imx: mx7: run sec_init for CAAM RNG
On Fri, 2018-01-26 at 12:24 +, Bryan O'Donoghue wrote: > This patch adds a sec_init call into arch_misc_init(). Doing so in > conjunction with the patch "drivers/crypto/fsl: assign job-rings to > non-TrustZone" enables use of the CAAM in Linux when OPTEE/TrustZone > is > active. > > u-boot will initialise the RNG and assign ownership of the job-ring > registers to a non-TrustZone context. With recent changes by Lukas > Auer to > fully initialize the RNG in sec_init() this means that u-boot will > hand-off > the CAAM in a state that Linux then can use the CAAM without touching > the > reserved DECO registers. > > This change is safe both for the OPTEE/TrustZone boot path and the > regular > non-OPTEE/TrustZone boot path. > > Signed-off-by: Bryan O'Donoghue> Cc: Fabio Estevam > Cc: Peng Fan > Cc: Marco Franchi > Cc: Vanessa Maegima > Cc: Stefano Babic > Cc: Lukas Auer > --- > arch/arm/mach-imx/mx7/soc.c | 4 > 1 file changed, 4 insertions(+) > > diff --git a/arch/arm/mach-imx/mx7/soc.c b/arch/arm/mach- > imx/mx7/soc.c > index d160e80..9023540 100644 > --- a/arch/arm/mach-imx/mx7/soc.c > +++ b/arch/arm/mach-imx/mx7/soc.c > @@ -262,6 +262,10 @@ int arch_misc_init(void) > env_set("soc", "imx7s"); > #endif > > +#ifdef CONFIG_FSL_CAAM > + sec_init(); > +#endif > + > return 0; > } > #endif I get an implicit declaration warning for sec_init() with this patch due to a missing include for fsl_sec.h. Other than that CAAM works on my imx7d board in non-secure mode (the driver probes successfully and I can use it with openssl speed). Tested-by: Lukas Auer ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] ARM: socfpga: Convert callers of cm_write_with_phase for wait_for_bit_le32
Now that we have and use wait_for_bit_le32() available, the callers of cm_write_with_phase() should not be casting values to u32 and instead we expect a const void *, so provide that directly. Fixes: 48263504c8d5 ("wait_bit: use wait_for_bit_le32 and remove wait_for_bit") Cc: Marek VasutSigned-off-by: Tom Rini --- arch/arm/mach-socfpga/clock_manager_gen5.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-socfpga/clock_manager_gen5.c b/arch/arm/mach-socfpga/clock_manager_gen5.c index 3d048ba3e432..4e5b6d169371 100644 --- a/arch/arm/mach-socfpga/clock_manager_gen5.c +++ b/arch/arm/mach-socfpga/clock_manager_gen5.c @@ -33,7 +33,7 @@ static void cm_write_ctrl(u32 val) } /* function to write a clock register that has phase information */ -static int cm_write_with_phase(u32 value, u32 reg_address, u32 mask) +static int cm_write_with_phase(u32 value, const void *reg_address, u32 mask) { int ret; @@ -268,26 +268,26 @@ int cm_basic_init(const struct cm_config * const cfg) * are aligned nicely; so we can change any phase. */ ret = cm_write_with_phase(cfg->ddrdqsclk, - (u32)_manager_base->sdr_pll.ddrdqsclk, + _manager_base->sdr_pll.ddrdqsclk, CLKMGR_SDRPLLGRP_DDRDQSCLK_PHASE_MASK); if (ret) return ret; /* SDRAM DDR2XDQSCLK */ ret = cm_write_with_phase(cfg->ddr2xdqsclk, - (u32)_manager_base->sdr_pll.ddr2xdqsclk, + _manager_base->sdr_pll.ddr2xdqsclk, CLKMGR_SDRPLLGRP_DDR2XDQSCLK_PHASE_MASK); if (ret) return ret; ret = cm_write_with_phase(cfg->ddrdqclk, - (u32)_manager_base->sdr_pll.ddrdqclk, + _manager_base->sdr_pll.ddrdqclk, CLKMGR_SDRPLLGRP_DDRDQCLK_PHASE_MASK); if (ret) return ret; ret = cm_write_with_phase(cfg->s2fuser2clk, - (u32)_manager_base->sdr_pll.s2fuser2clk, + _manager_base->sdr_pll.s2fuser2clk, CLKMGR_SDRPLLGRP_S2FUSER2CLK_PHASE_MASK); if (ret) return ret; -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v4 2/2] imx: mx7: run sec_init for CAAM RNG
This patch adds a sec_init call into arch_misc_init(). Doing so in conjunction with the patch "drivers/crypto/fsl: assign job-rings to non-TrustZone" enables use of the CAAM in Linux when OPTEE/TrustZone is active. u-boot will initialise the RNG and assign ownership of the job-ring registers to a non-TrustZone context. With recent changes by Lukas Auer to fully initialize the RNG in sec_init() this means that u-boot will hand-off the CAAM in a state that Linux then can use the CAAM without touching the reserved DECO registers. This change is safe both for the OPTEE/TrustZone boot path and the regular non-OPTEE/TrustZone boot path. Signed-off-by: Bryan O'DonoghueCc: Fabio Estevam Cc: Peng Fan Cc: Marco Franchi Cc: Vanessa Maegima Cc: Stefano Babic Cc: Lukas Auer --- arch/arm/mach-imx/mx7/soc.c | 5 + 1 file changed, 5 insertions(+) diff --git a/arch/arm/mach-imx/mx7/soc.c b/arch/arm/mach-imx/mx7/soc.c index d160e80..d444046 100644 --- a/arch/arm/mach-imx/mx7/soc.c +++ b/arch/arm/mach-imx/mx7/soc.c @@ -17,6 +17,7 @@ #include #include #include +#include #if defined(CONFIG_IMX_THERMAL) static const struct imx_thermal_plat imx7_thermal_plat = { @@ -262,6 +263,10 @@ int arch_misc_init(void) env_set("soc", "imx7s"); #endif +#ifdef CONFIG_FSL_CAAM + sec_init(); +#endif + return 0; } #endif -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v4 0/2] Fix CAAM for TrustZone enable for warp7
V4: - Fix dim-witted omission of #include to remove warning V3: - Changed location of sec_init() from warp.c::board_init() to soc.c::arch_misc_init() which will allow any i.MX7 which defines CONFIG_FSL_CAAM to forget about running sec_init(). V2: - Add an explicit assignment of JRMID when setting job-ring ownership Required on my reference part where the JRMID field is not set on the third job-ring V1: This series is the u-boot fix to a problem we encountered when enabling OPTEE/TrustZone on the WaRP7. The symptom is once TrustZone is activated the first page of CAAM registers becomes read-only, read-zero from the perspective of Linux and other non TrustZone contexts. Offlining the problem with Peng Fan[1] we eventually came to realise the problem could be worked around by 1. Making Linux skip RNG initialisation - a set of patches should be hitting LKML to do just that. 2. Initialising the RNG either from u-boot or OPTEE. In this case u-boot is the right place to-do that because there's upstream code in u-boot that just works. Patch #2 does that for the WaRP7. 3. Ensuring the job-ring registers are assigned to the non TrustZone mode. On the i.MX7 after the BootROM runs the job-ring registers are assigned to TrustZone. Patch #1 does that for all CAAM hardware. On point #3 this ordinarily isn't a problem because unless TrustZone is activated the restrictions on the job-ring registers don't kick in, its only after enabling TrustZone that Linux will loose access to the job-ring registers. Finally should OPTEE or another TEE want to do things with the job-ring registers it will have sufficient privilege to assign whichever job-ring registers it wants to OPTEE/TEE but will naturally then have to arbitrate with Linux to inform the Kernel CAAM driver which job-ring registers it can and cannot access. That arbitration process is for a future putative OPTEE/TEE CAAM driver to solve and is out of scope of this patchset. [1] Thanks for all of your help BTW - Peng, there's no way this would be working without you giving direction on how. Bryan O'Donoghue (2): drivers/crypto/fsl: assign job-rings to non-TrustZone imx: mx7: run sec_init for CAAM RNG arch/arm/mach-imx/mx7/soc.c | 5 + drivers/crypto/fsl/jr.c | 9 + drivers/crypto/fsl/jr.h | 2 ++ 3 files changed, 16 insertions(+) -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v4 1/2] drivers/crypto/fsl: assign job-rings to non-TrustZone
After enabling TrustZone various parts of the CAAM silicon become inaccessible to non TrustZone contexts. The job-ring registers are designed to allow non TrustZone contexts like Linux to still submit jobs to CAAM even after TrustZone has been enabled. The default job-ring permissions after the BootROM look like this for job-ring zero. ms=0x8001 ls=0x8001 The MS field is JRaMIDR_MS (job ring MID most significant). Referring to "Security Reference Manual for i.MX 7Dual and 7Solo Applications Processors, Rev. 0, 03/2017" section 8.10.4 we see that JROWN_NS controls whether or not a job-ring is accessible from non TrustZone. Bit 15 (TrustZone) is the logical inverse of bit 3 hence the above value of 0x8001 shows that JROWN_NS=0 and TrustZone=1. Clearly then as soon as TrustZone becomes active the job-ring registers are no longer accessible from Linux, which is not what we want. This patch explicitly sets all job-ring registers to JROWN_NS=1 (non TrustZone) by default and to the Non-Secure MID 001. Both settings are required to successfully assign a job-ring to non-secure mode. If a piece of TrustZone firmware requires ownership of job-ring registers it can unset the JROWN_NS bit itself. This patch in conjunction with a modification of the Linux kernel to skip HWRNG initialisation makes CAAM usable to Linux with TrustZone enabled. Signed-off-by: Bryan O'DonoghueCc: Fabio Estevam Cc: Peng Fan Cc: Alex Porosanu Cc: Ruchika Gupta Cc: Aneesh Bansal Link: https://github.com/OP-TEE/optee_os/issues/1408 Link: https://tinyurl.com/yam5gv9a Tested-by: Lukas Auer --- drivers/crypto/fsl/jr.c | 9 + drivers/crypto/fsl/jr.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/drivers/crypto/fsl/jr.c b/drivers/crypto/fsl/jr.c index a6dad01..34bd070 100644 --- a/drivers/crypto/fsl/jr.c +++ b/drivers/crypto/fsl/jr.c @@ -579,6 +579,8 @@ int sec_init_idx(uint8_t sec_idx) { ccsr_sec_t *sec = (void *)SEC_ADDR(sec_idx); uint32_t mcr = sec_in32(>mcfgr); + uint32_t jrown_ns; + int i; int ret = 0; #ifdef CONFIG_FSL_CORENET @@ -634,6 +636,13 @@ int sec_init_idx(uint8_t sec_idx) #endif #endif + /* Set ownership of job rings to non-TrustZone mode by default */ + for (i = 0; i < ARRAY_SIZE(sec->jrliodnr); i++) { + jrown_ns = sec_in32(>jrliodnr[i].ms); + jrown_ns |= JROWN_NS | JRMID_NS; + sec_out32(>jrliodnr[i].ms, jrown_ns); + } + ret = jr_init(sec_idx); if (ret < 0) { printf("SEC initialization failed\n"); diff --git a/drivers/crypto/fsl/jr.h b/drivers/crypto/fsl/jr.h index f546226..ef515e7 100644 --- a/drivers/crypto/fsl/jr.h +++ b/drivers/crypto/fsl/jr.h @@ -34,6 +34,8 @@ #define JRNSLIODN_MASK 0x0fff #define JRSLIODN_SHIFT 0 #define JRSLIODN_MASK 0x0fff +#define JROWN_NS 0x0008 +#define JRMID_NS 0x0001 #define JQ_DEQ_ERR -1 #define JQ_DEQ_TO_ERR -2 -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] imx-common: spl: Allow booting from eMMC when SPL is loaded from non-eMMC device
On 01/26/2018 05:16 PM, Marek Vasut wrote: > On 01/26/2018 05:05 PM, Stefano Babic wrote: >> On 26/01/2018 15:57, Lukasz Majewski wrote: >>> This patch tries to solve the problem described in following patch: >>> https://patchwork.ozlabs.org/patch/796237/ >>> >>> The main argument against the above code was the potential lack of >>> consistency if we boot SPL from the SD card (and then eMMC may load >>> u-boot proper). >>> >>> This patch preserves this consistency if spl_boot_device() detects boot >>> from either SD card or eMMC. >>> >>> It only will change boot device if boot from non-SD/eMMC device is >>> detected - i.e SPI-NOR (as in this case). >>> >>> Signed-off-by: Lukasz Majewski>>> --- >>> >>> arch/arm/mach-imx/spl.c | 7 ++- >>> 1 file changed, 6 insertions(+), 1 deletion(-) >>> >>> diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c >>> index 6c16872f59..735d9f6261 100644 >>> --- a/arch/arm/mach-imx/spl.c >>> +++ b/arch/arm/mach-imx/spl.c >>> @@ -134,7 +134,12 @@ int g_dnl_bind_fixup(struct usb_device_descriptor >>> *dev, const char *name) >>> /* called from spl_mmc to see type of boot mode for storage (RAW or FAT) */ >>> u32 spl_boot_mode(const u32 boot_device) >>> { >>> - switch (spl_boot_device()) { >>> + u32 spl_bd = spl_boot_device(); >>> + >>> + if (spl_bd != BOOT_DEVICE_MMC1) >>> + spl_bd = boot_device; >>> + >>> + switch (spl_bd) { >>> /* for MMC return either RAW or FAT mode */ >>> case BOOT_DEVICE_MMC1: >>> case BOOT_DEVICE_MMC2: >>> >> >> But have we not board_boot_order() for such as cases ? It is a wek >> function and you can define it in your board code. Put in mach-imx, it >> is valid for all boards. > > After a bit of offline discussion with Lukasz, I think I understand what > the problem is. > > The SPL common code calls spl_boot_device() to determine which boot > device to boot from next ; in his case, SPI or eMMC. In case eMMC is > selected, the SPL MMC common code then calls spl_boot_mode() (different > function than spl_boot_device()) to determine whether the content on > SD/eMMC is RAW or on a FS. > > The iMX implementation (and layerspace too) does extra stuff in the > implementation of spl_boot_mode() by calling spl_boot_device() again, > which is wrong. > > spl_boot_mode() is only used by spl_mmc.c , so we are certain the system > is booting from SD/MMC . By turning this around, if the board code did > override the board_boot_order() to load the next payload from > SD/MMC/eMMC AND started SPL from non-SD/MMC/eMMC device , calling > spl_boot_device() in spl_boot_mode() implementation will return bogus > result and the spl_boot_mode() will fail in the default: case. > > Thus, the fix here is to do what ie. socfpga does, just discern whether > the content on SD/MMC/eMMC is RAW or FS and do not do any extra checks. By doing so, we can probably even clean this up and have default __weak spl_boot_mode() implementation rather than having a custom copy for each SoC. -- Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] imx-common: spl: Allow booting from eMMC when SPL is loaded from non-eMMC device
On 01/26/2018 05:05 PM, Stefano Babic wrote: > On 26/01/2018 15:57, Lukasz Majewski wrote: >> This patch tries to solve the problem described in following patch: >> https://patchwork.ozlabs.org/patch/796237/ >> >> The main argument against the above code was the potential lack of >> consistency if we boot SPL from the SD card (and then eMMC may load >> u-boot proper). >> >> This patch preserves this consistency if spl_boot_device() detects boot >> from either SD card or eMMC. >> >> It only will change boot device if boot from non-SD/eMMC device is >> detected - i.e SPI-NOR (as in this case). >> >> Signed-off-by: Lukasz Majewski>> --- >> >> arch/arm/mach-imx/spl.c | 7 ++- >> 1 file changed, 6 insertions(+), 1 deletion(-) >> >> diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c >> index 6c16872f59..735d9f6261 100644 >> --- a/arch/arm/mach-imx/spl.c >> +++ b/arch/arm/mach-imx/spl.c >> @@ -134,7 +134,12 @@ int g_dnl_bind_fixup(struct usb_device_descriptor *dev, >> const char *name) >> /* called from spl_mmc to see type of boot mode for storage (RAW or FAT) */ >> u32 spl_boot_mode(const u32 boot_device) >> { >> -switch (spl_boot_device()) { >> +u32 spl_bd = spl_boot_device(); >> + >> +if (spl_bd != BOOT_DEVICE_MMC1) >> +spl_bd = boot_device; >> + >> +switch (spl_bd) { >> /* for MMC return either RAW or FAT mode */ >> case BOOT_DEVICE_MMC1: >> case BOOT_DEVICE_MMC2: >> > > But have we not board_boot_order() for such as cases ? It is a wek > function and you can define it in your board code. Put in mach-imx, it > is valid for all boards. After a bit of offline discussion with Lukasz, I think I understand what the problem is. The SPL common code calls spl_boot_device() to determine which boot device to boot from next ; in his case, SPI or eMMC. In case eMMC is selected, the SPL MMC common code then calls spl_boot_mode() (different function than spl_boot_device()) to determine whether the content on SD/eMMC is RAW or on a FS. The iMX implementation (and layerspace too) does extra stuff in the implementation of spl_boot_mode() by calling spl_boot_device() again, which is wrong. spl_boot_mode() is only used by spl_mmc.c , so we are certain the system is booting from SD/MMC . By turning this around, if the board code did override the board_boot_order() to load the next payload from SD/MMC/eMMC AND started SPL from non-SD/MMC/eMMC device , calling spl_boot_device() in spl_boot_mode() implementation will return bogus result and the spl_boot_mode() will fail in the default: case. Thus, the fix here is to do what ie. socfpga does, just discern whether the content on SD/MMC/eMMC is RAW or FS and do not do any extra checks. -- Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] imx-common: spl: Allow booting from eMMC when SPL is loaded from non-eMMC device
On 26/01/2018 15:57, Lukasz Majewski wrote: > This patch tries to solve the problem described in following patch: > https://patchwork.ozlabs.org/patch/796237/ > > The main argument against the above code was the potential lack of > consistency if we boot SPL from the SD card (and then eMMC may load > u-boot proper). > > This patch preserves this consistency if spl_boot_device() detects boot > from either SD card or eMMC. > > It only will change boot device if boot from non-SD/eMMC device is > detected - i.e SPI-NOR (as in this case). > > Signed-off-by: Lukasz Majewski> --- > > arch/arm/mach-imx/spl.c | 7 ++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c > index 6c16872f59..735d9f6261 100644 > --- a/arch/arm/mach-imx/spl.c > +++ b/arch/arm/mach-imx/spl.c > @@ -134,7 +134,12 @@ int g_dnl_bind_fixup(struct usb_device_descriptor *dev, > const char *name) > /* called from spl_mmc to see type of boot mode for storage (RAW or FAT) */ > u32 spl_boot_mode(const u32 boot_device) > { > - switch (spl_boot_device()) { > + u32 spl_bd = spl_boot_device(); > + > + if (spl_bd != BOOT_DEVICE_MMC1) > + spl_bd = boot_device; > + > + switch (spl_bd) { > /* for MMC return either RAW or FAT mode */ > case BOOT_DEVICE_MMC1: > case BOOT_DEVICE_MMC2: > But have we not board_boot_order() for such as cases ? It is a wek function and you can define it in your board code. Put in mach-imx, it is valid for all boards. Best regards, Stefano -- = DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de = ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 3/4] travis.yml: fix 'set +e' in build script
On Fri, Jan 26, 2018 at 04:31:06PM +0100, Daniel Schwierzeck wrote: > The build script should not manipulate shell flags (especially '-e'). > A non-zero exit value can also be catched with 'cmd || ret=$?'. > > Signed-off-by: Daniel SchwierzeckReviewed-by: Tom Rini -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [RFC PATCH 2/2] ARM: Introduce ability to enable invalidate of BTB on Cortex-A15 for CVE-2017-5715
On 01/26/2018 03:17 AM, Marc Zyngier wrote: On 25/01/18 21:45, Nishanth Menon wrote: As recommended by Arm in [1], ACR needs to be set[2] to enable invalidation of BTB. This has to be enabled unconditionally for ICIALLU to be functional on Cortex-A15 processors. Provide a config Not quite. ACTLR[0] (Enable invalidates of BTB) has to be set for the BTB to be invalidated on ICIALLU. ICIALLU itself is always functional (otherwise, we'd have much bigger problems). Thanks Marc. That did come out completely wrong! Sorry about that. will update once we have kernel side story complete. -- Regards, Nishanth Menon ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/1] efi_loader: add a README.iscsi describing booting via iSCSI
From: Heinrich SchuchardtTo: Duncan Hare ; Alexander Graf Subject: Re: [U-Boot] [PATCH 1/1] efi_loader: add a README.iscsi describing booting via iSCSI On 01/25/2018 08:39 PM, Duncan Hare wrote: >>> - Forwarded Message - >>> From: Alexander Graf >>> To: Heinrich Schuchardt >> The appended README explains how U-Boot and iPXE can be used to boot a diskless system from an iSCSI SAN. >> We are implementing a limited TCP and a wget (http 1.0) app.>> It is almost >> ready for an test release. Selective Acknowledgment (SACK) >> is under test as a final piece of the TCP stack. In which git can I find the code? >> >> We have noticed that omitting the http 1.0 declaration in >> downloading the kernel from an nginx web server that we remove the >> overhead of an http header completely. >> > RFC 1945 - Hypertext Transfer Protocol -- HTTP/1.0 > You should not program to please another accommodating software but > according to a standard. I agree. The comment was a FYI. > The key to TCP performance is supporting multiple packets in flight. And we do. That's set in include/net.h in the buffer definitions.With single packet-at-a time one might as well stick with udp. I've worked on network communication protocols since 1973.c programming, not so much. git, I'm a newb. HeinrichIt is not yet pushed to git.I need to fix the bugs in SACK before taking that step. I had hoped this week but I was delayed by flu. It adheres to http 1.0. It is a minimal implementation. It is relatively fast. It drives a Raspberry Pi at 10 M bits/sec, the limitation being the raspberry pi processor speed. I can send you a tarball, together with the changes to tftp.c for testing that a downloaded image is correct. Regards Duncan Hare 714 931 7952 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 2/4] buildman: add option -E for treating compiler warnings as errors
Add a new option '-E' for treating all compiler warnings as errors. Eventually this will pass 'KCFLAGS=-Werror' to Kbuild. Signed-off-by: Daniel Schwierzeck--- Changes in v2: - replace 'W=err' with 'KCFLAGS=-Werror' tools/buildman/builder.py | 5 - tools/buildman/builderthread.py | 2 ++ tools/buildman/cmdline.py | 2 ++ tools/buildman/control.py | 3 ++- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py index acb0810457..4e72b7d60d 100644 --- a/tools/buildman/builder.py +++ b/tools/buildman/builder.py @@ -212,7 +212,8 @@ class Builder: gnu_make='make', checkout=True, show_unknown=True, step=1, no_subdirs=False, full_path=False, verbose_build=False, incremental=False, per_board_out_dir=False, - config_only=False, squash_config_y=False): + config_only=False, squash_config_y=False, + warnings_as_errors=False): """Create a new Builder object Args: @@ -237,6 +238,7 @@ class Builder: board rather than a thread-specific directory config_only: Only configure each build, don't build it squash_config_y: Convert CONFIG options with the value 'y' to '1' +warnings_as_errors: Treat all compiler warnings as errors """ self.toolchains = toolchains self.base_dir = base_dir @@ -270,6 +272,7 @@ class Builder: if not self.squash_config_y: self.config_filenames += EXTRA_CONFIG_FILENAMES +self.warnings_as_errors = warnings_as_errors self.col = terminal.Color() self._re_function = re.compile('(.*): In function.*') diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py index 9e8ca80c5b..9ac101a5a4 100644 --- a/tools/buildman/builderthread.py +++ b/tools/buildman/builderthread.py @@ -216,6 +216,8 @@ class BuilderThread(threading.Thread): args.append('-s') if self.builder.num_jobs is not None: args.extend(['-j', str(self.builder.num_jobs)]) +if self.builder.warnings_as_errors: +args.append('KCFLAGS=-Werror') config_args = ['%s_defconfig' % brd.target] config_out = '' args.extend(self.builder.toolchains.GetMakeArguments(brd)) diff --git a/tools/buildman/cmdline.py b/tools/buildman/cmdline.py index 74247f0aff..6949d6bf2c 100644 --- a/tools/buildman/cmdline.py +++ b/tools/buildman/cmdline.py @@ -32,6 +32,8 @@ def ParseArgs(): help="Don't build, just configure each commit") parser.add_option('-e', '--show_errors', action='store_true', default=False, help='Show errors and warnings') +parser.add_option('-E', '--warnings-as-errors', action='store_true', + default=False, help='Treat all compiler warnings as errors') parser.add_option('-f', '--force-build', dest='force_build', action='store_true', default=False, help='Force build of boards even if already built') diff --git a/tools/buildman/control.py b/tools/buildman/control.py index 73b1a14fb6..3cac9f7cf6 100644 --- a/tools/buildman/control.py +++ b/tools/buildman/control.py @@ -263,7 +263,8 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None, incremental=options.incremental, per_board_out_dir=options.per_board_out_dir, config_only=options.config_only, -squash_config_y=not options.preserve_config_y) +squash_config_y=not options.preserve_config_y, +warnings_as_errors=options.warnings_as_errors) builder.force_config_on_failure = not options.quick if make_func: builder.do_make = make_func -- 2.16.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 4/4] travis.yml: run buildman with option -E
This forces all compiler warnings to be treated as errors. Signed-off-by: Daniel Schwierzeck--- Changes in v2: None .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1e55e1b7f1..59d1dd99e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -102,7 +102,7 @@ script: # Exit code 129 means warnings only. - if [[ "${BUILDMAN}" != "" ]]; then ret=0; - tools/buildman/buildman -P ${BUILDMAN} || ret=$?; + tools/buildman/buildman -P -E ${BUILDMAN} || ret=$?; if [[ $ret -ne 0 && $ret -ne 129 ]]; then tools/buildman/buildman -sdeP ${BUILDMAN}; exit $ret; -- 2.16.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 3/4] travis.yml: fix 'set +e' in build script
The build script should not manipulate shell flags (especially '-e'). A non-zero exit value can also be catched with 'cmd || ret=$?'. Signed-off-by: Daniel Schwierzeck--- Changes in v2: None .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2a98c4bb11..1e55e1b7f1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -101,9 +101,8 @@ script: # # Exit code 129 means warnings only. - if [[ "${BUILDMAN}" != "" ]]; then - set +e; - tools/buildman/buildman -P ${BUILDMAN}; - ret=$?; + ret=0; + tools/buildman/buildman -P ${BUILDMAN} || ret=$?; if [[ $ret -ne 0 && $ret -ne 129 ]]; then tools/buildman/buildman -sdeP ${BUILDMAN}; exit $ret; -- 2.16.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 1/4] README: add doc for how to supply user specific compiler flags to Kbuild
Probably not all users are aware of this possibility, thus add a pointer to the README. Also add a useful example. Signed-off-by: Daniel Schwierzeck--- Changes in v2: - new patch README | 5 + 1 file changed, 5 insertions(+) diff --git a/README b/README index b53ea7dfe3..b055ae7ef2 100644 --- a/README +++ b/README @@ -3719,6 +3719,11 @@ this behavior and build U-Boot to some external directory: Note that the command line "O=" setting overrides the KBUILD_OUTPUT environment variable. +User specific CPPFLAGS, AFLAGS and CFLAGS can be passed to the compiler by +setting the according environment variables KCPPFLAGS, KAFLAGS and KCFLAGS. +For example to treat all compiler warnings as errors: + + make KCFLAGS=-Werror Please be aware that the Makefiles assume you are using GNU make, so for instance on NetBSD you might need to use "gmake" instead of -- 2.16.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 0/4] Add support for treating compiler warnings as errors
To enforce a zero-warnings policy (e.g. in CI builds), all compiler warnings have to be treated as errors. Extend Kbuild and buildman with according options to achieve this. Enable these new options in all Travis CI builds. All builds with compiler warnings will now fail. Only DTC warnings are still being ignored. Example build which failed due to a compiler warning: https://travis-ci.org/danielschwierzeck/u-boot/jobs/49371#L936 The patch which fixes the warning above: https://patchwork.ozlabs.org/patch/866009/ Changes in v2: - new patch - replace 'W=err' with 'KCFLAGS=-Werror' Daniel Schwierzeck (4): README: add doc for how to supply user specific compiler flags to Kbuild buildman: add option -E for treating compiler warnings as errors travis.yml: fix 'set +e' in build script travis.yml: run buildman with option -E .travis.yml | 5 ++--- README | 5 + tools/buildman/builder.py | 5 - tools/buildman/builderthread.py | 2 ++ tools/buildman/cmdline.py | 2 ++ tools/buildman/control.py | 3 ++- 6 files changed, 17 insertions(+), 5 deletions(-) -- 2.16.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] host-tools: use python2 explicitly for shebang
Hi Masahiro, On 21 January 2018 at 02:34, Masahiro Yamadawrote: > All of these host tools are apparently written for Python2, > not Python3. > > Use 'python2' in the shebang line according to PEP 394 > (https://www.python.org/dev/peps/pep-0394/). > > Signed-off-by: Masahiro Yamada > --- > > I sent some time before figuring out why Patman does not work > on my machine. > > If 'python' points to python3, Patman does not epit any error > message, it just stays silent until it consumes all memory > on the system. > > > scripts/dtc/pylibfdt/setup.py | 2 +- > scripts/mailmapper| 2 +- > test/py/test.py | 2 +- > tools/buildman/buildman.py| 2 +- > tools/dtoc/dtoc.py| 2 +- > tools/microcode-tool.py | 2 +- > tools/patman/patman.py| 2 +- > tools/rkmux.py| 2 +- > 8 files changed, 8 insertions(+), 8 deletions(-) Reviewed-by: Simon Glass I can repeat that problem. There has been some effort to make patman (in particular) work with python 3. Should we fix the bug? This change will mask it. Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 1/1] log: add category LOGC_EFI
On 22 January 2018 at 12:10, Heinrich Schuchardtwrote: > The EFI implementation does not fit into any of the existing categories. > > Provide LOGC_EFI so that EFI related message can be filtered. > > Signed-off-by: Heinrich Schuchardt > --- > v2 > rebase on git://git.denx.de/u-boot-dm.git, branch log-working > add category name > --- > common/log.c | 1 + > doc/README.log | 1 + > include/log.h | 1 + > 3 files changed, 3 insertions(+) Reviewed-by: Simon Glass ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] imx-common: spl: Allow booting from eMMC when SPL is loaded from non-eMMC device
On 01/26/2018 03:57 PM, Lukasz Majewski wrote: > This patch tries to solve the problem described in following patch: > https://patchwork.ozlabs.org/patch/796237/ You should explain what the problem is in the commit message. Random link to a random website which may go away at some point is useless. Having it below --- is fine, but in the commit message it's not. > The main argument against the above code was the potential lack of > consistency if we boot SPL from the SD card (and then eMMC may load > u-boot proper). > > This patch preserves this consistency if spl_boot_device() detects boot > from either SD card or eMMC. > > It only will change boot device if boot from non-SD/eMMC device is > detected - i.e SPI-NOR (as in this case). And from this, I don't really understand what this patch is trying to solve. IMO it'd be better to solve this on a board-level. > Signed-off-by: Lukasz Majewski> --- > > arch/arm/mach-imx/spl.c | 7 ++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c > index 6c16872f59..735d9f6261 100644 > --- a/arch/arm/mach-imx/spl.c > +++ b/arch/arm/mach-imx/spl.c > @@ -134,7 +134,12 @@ int g_dnl_bind_fixup(struct usb_device_descriptor *dev, > const char *name) > /* called from spl_mmc to see type of boot mode for storage (RAW or FAT) */ > u32 spl_boot_mode(const u32 boot_device) > { > - switch (spl_boot_device()) { > + u32 spl_bd = spl_boot_device(); > + > + if (spl_bd != BOOT_DEVICE_MMC1) > + spl_bd = boot_device; > + > + switch (spl_bd) { > /* for MMC return either RAW or FAT mode */ > case BOOT_DEVICE_MMC1: > case BOOT_DEVICE_MMC2: > -- Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] imx-common: spl: Allow booting from eMMC when SPL is loaded from non-eMMC device
This patch tries to solve the problem described in following patch: https://patchwork.ozlabs.org/patch/796237/ The main argument against the above code was the potential lack of consistency if we boot SPL from the SD card (and then eMMC may load u-boot proper). This patch preserves this consistency if spl_boot_device() detects boot from either SD card or eMMC. It only will change boot device if boot from non-SD/eMMC device is detected - i.e SPI-NOR (as in this case). Signed-off-by: Lukasz Majewski--- arch/arm/mach-imx/spl.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c index 6c16872f59..735d9f6261 100644 --- a/arch/arm/mach-imx/spl.c +++ b/arch/arm/mach-imx/spl.c @@ -134,7 +134,12 @@ int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name) /* called from spl_mmc to see type of boot mode for storage (RAW or FAT) */ u32 spl_boot_mode(const u32 boot_device) { - switch (spl_boot_device()) { + u32 spl_bd = spl_boot_device(); + + if (spl_bd != BOOT_DEVICE_MMC1) + spl_bd = boot_device; + + switch (spl_bd) { /* for MMC return either RAW or FAT mode */ case BOOT_DEVICE_MMC1: case BOOT_DEVICE_MMC2: -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] Pull request: u-boot-sunxi/master
Hi Tom, Please pull this PR. thanks! Jagan. The following changes since commit 557767ed29968af0294e3aae48433e5d5a298e0b: Merge git://git.denx.de/u-boot-marvell (2018-01-20 08:39:47 -0500) are available in the git repository at: git://git.denx.de/u-boot-sunxi.git master for you to fetch changes up to a6968ecb0ad6b06552c97005eba265a4c5761626: gpio: sunxi: Add compatible string for H5 PIO (2018-01-26 20:02:33 +0530) Andre Heider (1): sunxi: imply CONFIG_OF_LIBFDT_OVERLAY Chris Blake (1): gpio: sunxi: Add compatible string for H5 PIO Giulio Benetti (1): sunxi: Fix display timing flags Maxime Ripard (11): dfu: select HASH cmd: crc32: Disable by default on sunXi cmd: unzip: Disable by default on sunXi cmd: loadb: Disable by default on sunXi cmd: loads: Disable by default on sunXi cmd: misc: Disable by default on sunXi video: bpp8: Disable by default on sunXi video: bpp16: Disable by default on sunXi net: regex: Disable by default on sunXi Makefile: Add size check to the u-boot.itb make target sunxi: Add limit with the MMC environment Makefile| 1 + arch/arm/Kconfig| 1 + cmd/Kconfig | 5 + configs/CHIP_defconfig | 1 - configs/CHIP_pro_defconfig | 1 - drivers/dfu/Kconfig | 1 + drivers/gpio/sunxi_gpio.c | 1 + drivers/video/Kconfig | 2 ++ drivers/video/sunxi/sunxi_display.c | 2 ++ include/configs/sunxi-common.h | 10 ++ lib/Kconfig | 1 + 11 files changed, 24 insertions(+), 2 deletions(-) ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 00/12] sunxi: arm64 binary size fixes
On Wed, Jan 24, 2018 at 10:12 PM, Jagan Tekiwrote: > On Tue, Jan 16, 2018 at 2:14 PM, Maxime Ripard > wrote: >> Hi, >> >> As we discussed already, this is the list of options that we will need >> to disable by default. >> >> I also added to the mix a size check, which even though it's not >> really optimal, is temporary and will be removed in a future (and >> hopefully close) release. >> >> Tom, is this still something we can merge for 2018.01? >> >> Thanks! >> Maxime >> >> Changes from v1: >> - Fixed a couple of nitpicks >> - Rebased on top of current master >> - Fixed a build error with boards using DFU >> >> Andre Heider (1): >> sunxi: imply CONFIG_OF_LIBFDT_OVERLAY >> >> Maxime Ripard (11): >> dfu: select HASH >> cmd: crc32: Disable by default on sunXi >> cmd: unzip: Disable by default on sunXi >> cmd: loadb: Disable by default on sunXi >> cmd: loads: Disable by default on sunXi >> cmd: misc: Disable by default on sunXi >> video: bpp8: Disable by default on sunXi >> video: bpp16: Disable by default on sunXi >> net: regex: Disable by default on sunXi >> Makefile: Add size check to the u-boot.itb make target >> sunxi: Add limit with the MMC environment > > Reviewed-by: Jagan Teki Applied to u-boot-sunxi/master, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 2/2] i2c: imx: Take mx6dqp in consideration in the I2C_PADS_INFO macro
We should take the MX6DP and MX6QP options in consideration in the I2C_PADS_INFO macro. Based on a patch by Pierluigi PassaroSigned-off-by: Eran Matityahu --- arch/arm/include/asm/mach-imx/mxc_i2c.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/arm/include/asm/mach-imx/mxc_i2c.h b/arch/arm/include/asm/mach-imx/mxc_i2c.h index 292bf0c..80018e4 100644 --- a/arch/arm/include/asm/mach-imx/mxc_i2c.h +++ b/arch/arm/include/asm/mach-imx/mxc_i2c.h @@ -88,8 +88,7 @@ struct mxc_i2c_bus { #define I2C_PADS_INFO(name)\ - (is_cpu_type(MXC_CPU_MX6Q) || is_cpu_type(MXC_CPU_MX6D)) ? \ - _##name : _##name + (is_mx6dq() || is_mx6dqp()) ? _##name : _##name #endif int setup_i2c(unsigned i2c_index, int speed, int slave_addr, -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 1/2] iomux-v3: Take mx6dqp in consideration for imx_iomux_v3_setup_pad()
We should take the MX6DP and MX6QP options in consideration when defining imx_iomux_v3_setup_pad(). Based on a patch by Pierluigi PassaroSigned-off-by: Eran Matityahu --- arch/arm/include/asm/mach-imx/iomux-v3.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/include/asm/mach-imx/iomux-v3.h b/arch/arm/include/asm/mach-imx/iomux-v3.h index ed75e9c..2008dc9 100644 --- a/arch/arm/include/asm/mach-imx/iomux-v3.h +++ b/arch/arm/include/asm/mach-imx/iomux-v3.h @@ -240,7 +240,7 @@ void imx_iomux_gpio_get_function(unsigned int gpio, #if defined(CONFIG_MX6QDL) #define IOMUX_PADS(x) (MX6Q_##x), (MX6DL_##x) #define SETUP_IOMUX_PAD(def) \ -if (is_cpu_type(MXC_CPU_MX6Q) || is_cpu_type(MXC_CPU_MX6D)) { \ +if (is_mx6dq() || is_mx6dqp()) { \ imx_iomux_v3_setup_pad(MX6Q_##def); \ } else { \ imx_iomux_v3_setup_pad(MX6DL_##def);\ -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 2/6] Add Broadwell-DE include header files
This patch contain all the include headers for Broadwell-DE architecture. Signed-off-by: Vincenzo Bove--- .../asm/arch-broadwell-de/acpi/global_nvs.asl | 15 + .../asm/arch-broadwell-de/acpi/irq_helper.h| 36 ++ .../asm/arch-broadwell-de/acpi/irqlinks.asl| 454 .../asm/arch-broadwell-de/acpi/irqroute.asl| 29 ++ .../include/asm/arch-broadwell-de/acpi/irqroute.h | 31 ++ .../x86/include/asm/arch-broadwell-de/acpi/lpc.asl | 81 .../include/asm/arch-broadwell-de/acpi/pcie1.asl | 455 + .../asm/arch-broadwell-de/acpi/platform.asl| 61 +++ .../asm/arch-broadwell-de/acpi/southcluster.asl| 339 +++ arch/x86/include/asm/arch-broadwell-de/device.h| 116 ++ .../asm/arch-broadwell-de/fsp/fsp_configs.h| 134 ++ .../include/asm/arch-broadwell-de/fsp/fsp_vpd.h| 116 ++ .../x86/include/asm/arch-broadwell-de/global_nvs.h | 21 + arch/x86/include/asm/arch-broadwell-de/iomap.h | 58 +++ arch/x86/include/asm/arch-broadwell-de/irq.h | 88 15 files changed, 2034 insertions(+) create mode 100644 arch/x86/include/asm/arch-broadwell-de/acpi/global_nvs.asl create mode 100644 arch/x86/include/asm/arch-broadwell-de/acpi/irq_helper.h create mode 100644 arch/x86/include/asm/arch-broadwell-de/acpi/irqlinks.asl create mode 100644 arch/x86/include/asm/arch-broadwell-de/acpi/irqroute.asl create mode 100644 arch/x86/include/asm/arch-broadwell-de/acpi/irqroute.h create mode 100644 arch/x86/include/asm/arch-broadwell-de/acpi/lpc.asl create mode 100644 arch/x86/include/asm/arch-broadwell-de/acpi/pcie1.asl create mode 100644 arch/x86/include/asm/arch-broadwell-de/acpi/platform.asl create mode 100644 arch/x86/include/asm/arch-broadwell-de/acpi/southcluster.asl create mode 100644 arch/x86/include/asm/arch-broadwell-de/device.h create mode 100644 arch/x86/include/asm/arch-broadwell-de/fsp/fsp_configs.h create mode 100644 arch/x86/include/asm/arch-broadwell-de/fsp/fsp_vpd.h create mode 100644 arch/x86/include/asm/arch-broadwell-de/global_nvs.h create mode 100644 arch/x86/include/asm/arch-broadwell-de/iomap.h create mode 100644 arch/x86/include/asm/arch-broadwell-de/irq.h diff --git a/arch/x86/include/asm/arch-broadwell-de/acpi/global_nvs.asl b/arch/x86/include/asm/arch-broadwell-de/acpi/global_nvs.asl new file mode 100644 index 00..a28d4dfade --- /dev/null +++ b/arch/x86/include/asm/arch-broadwell-de/acpi/global_nvs.asl @@ -0,0 +1,15 @@ +/* + * Copyright (C) 2016 Bin Meng + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include + +OperationRegion(GNVS, SystemMemory, ACPI_GNVS_ADDR, ACPI_GNVS_SIZE) +Field(GNVS, ByteAcc, NoLock, Preserve) +{ + Offset (0x00), + PCNT, 8, /* processor count */ + IURE, 8, /* internal UART enabled */ +} diff --git a/arch/x86/include/asm/arch-broadwell-de/acpi/irq_helper.h b/arch/x86/include/asm/arch-broadwell-de/acpi/irq_helper.h new file mode 100644 index 00..5b7d9c --- /dev/null +++ b/arch/x86/include/asm/arch-broadwell-de/acpi/irq_helper.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2017, Vincenzo Bove + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#undef PCI_DEV_PIRQ_ROUTES +#undef ACPI_DEV_IRQ +#undef PCI_DEV_PIRQ_ROUTE +#undef PIRQ_PIC_ROUTES +#undef PIRQ_PIC +#undef IRQROUTE_H + +#if defined(PIC_MODE) + +#define ACPI_DEV_IRQ(dev_, pin_, pin_name_) \ + { Package() { ## dev_ ## , pin_, \_SB.PCI0.LPCB.LNK ## pin_name_, 0 } } + +#else /* defined(PIC_MODE) */ + +#define ACPI_DEV_IRQ(dev_, pin_, pin_name_) \ + { Package() { ## dev_ ## , pin_, 0, PIRQ ## pin_name_ ## _APIC_IRQ } } + +#endif + +#define PCI_DEV_PIRQ_ROUTE(dev_, a_, b_, c_, d_) \ + { ACPI_DEV_IRQ(dev_, 0, a_), \ + ACPI_DEV_IRQ(dev_, 1, b_), \ + ACPI_DEV_IRQ(dev_, 2, c_), \ + ACPI_DEV_IRQ(dev_, 3, d_) } + +/* Empty PIRQ_PIC definition. */ +#define PIRQ_PIC(pirq_, pic_irq_) + +///* Include the mainboard irq route definition */ +#include "irqroute.h" diff --git a/arch/x86/include/asm/arch-broadwell-de/acpi/irqlinks.asl b/arch/x86/include/asm/arch-broadwell-de/acpi/irqlinks.asl new file mode 100644 index 00..36942982c8 --- /dev/null +++ b/arch/x86/include/asm/arch-broadwell-de/acpi/irqlinks.asl @@ -0,0 +1,454 @@ +/* + * Copyright (C) 2017, Vincenzo Bove + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +OperationRegion (PRR0, PCI_Config, 0x00, 0x100) +Field (PRR0, AnyAcc, NoLock, Preserve) { + Offset(0x60), + PIRA, 8, + PIRB, 8, + PIRC, 8, + PIRD, 8, + Offset(0x68), + PIRE, 8, + PIRF, 8, + PIRG, 8, + PIRH, 8 +} + +Device (LNKA) { // PCI IRQ link A + Name (_HID,EISAID("PNP0C0F")) + //Name(_UID, 1) + Method (_STA,0,NotSerialized) { +If(And(PIRA, 0x80)) { + Return (0x9) +} Else { + Return (0xB) +} // Don't display + } + + Method (_DIS,0,NotSerialized) { +Or (PIRA, 0x80, PIRA) + } + + Method
Re: [U-Boot] [U-Boot, v2, 1/2] spi: zynqmp_qspi: Add support for ZynqMP qspi drivers
Hi Siva, Sorry for the very late reply! > -Original Message- > From: Siva Durga Prasad Paladugu [mailto:siva.durga.palad...@xilinx.com] > Sent: Thursday, January 04, 2018 1:08 PM > To: u-boot@lists.denx.de > Cc: jagannadh.t...@gmail.com; Siva Durga Prasad Paladugu >> Subject: [PATCH v2 1/2] spi: zynqmp_qspi: Add support for ZynqMP qspi > driver > > This patch adds qspi driver support for ZynqMP SoC. This driver is > responsible for communicating with qspi flash devices. The Technical Reference Manual of the ZynqMP talks about the LQSPI and the GQSPI. Based on the #defines, I'm guessing this is for the GQSPI but should we be more explicit about it? > > Signed-off-by: Siva Durga Prasad Paladugu > --- > Changes from v1: > - Rebased on top of latest master > - Moved macro definitions to .h file as per comment > - Fixed magic values with macros as per comment > --- > arch/arm/cpu/armv8/zynqmp/Kconfig | 7 + > arch/arm/include/asm/arch-zynqmp/zynqmp_qspi.h | 154 ++ > drivers/spi/Makefile | 1 + > drivers/spi/zynqmp_qspi.c | 678 > + > 4 files changed, 840 insertions(+) > create mode 100644 arch/arm/include/asm/arch-zynqmp/zynqmp_qspi.h > create mode 100644 drivers/spi/zynqmp_qspi.c I tried building on top of master and running it on a zcu102 (Rev-B) board but I can't get anything newer than v2017.11 to work. I get this failure (unrelated to this series): In:serial@ff00 Out: serial@ff00 Err: serial@ff00 initcall sequence 7ff8dee8 failed at call 08002c7c (err=-22) ### ERROR ### Please RESET the board ### After looking arround a little, it seems it may be because of my FSBL. Since I can't get another FSBL for now, I rebased the series on top of v2017.11 and it seems to be working well except for the erase operation in a certain range of flash addresses. The same operations (in that range) in Linux seem to be working. I'm guessing this is due to something else, maybe in the spi_flash driver. Here is the test I used: ZynqMP> sf probe SF: Detected n25q512a with page size 256 Bytes, erase size 4 KiB, total 64 MiB ZynqMP> mw.w 0x100 0x00 0x100 ZynqMP> md.w 0x100 0100: 0110: 0120: 0130: 0140: 0150: 0160: 0170: ZynqMP> sf read 0x100 0x00 0x100 device 0 offset 0x0, size 0x100 SF: 256 bytes @ 0x0 Read: OK ZynqMP> md.w 0x100 0100: 1234 1234 abcd abcd abcd abcd abcd abcd4.4. 0110: abcd abcd abcd abcd abcd abcd abcd abcd 0120: 0130: 0140: 0150: 0160: 0170: ZynqMP> mw.w 0x100 0xbeee 0x10 ZynqMP> md.w 0x100 0100: beee beee beee beee beee beee beee beee 0110: beee beee beee beee beee beee beee beee 0120: 0130: 0140: 0150: 0160: 0170: ZynqMP> sf update 0x100 0x00 0x100 device 0 offset 0x0, size 0x100 256 bytes written, 0 bytes skipped in 0.70s, speed 3591 B/s ZynqMP> mw.w 0x100 0x00 0x100 ZynqMP> md.w 0x100 0100: 0110: 0120: 0130: 0140:
[U-Boot] [PATCH v3 22/26] flash: Fix spelling of "ERR_TIMOUT"
checkpatch.pl complains about the spelling of ERR_TIMOUT. Since the error is only used in a handful of files, we rename the error to ERR_TIMEOUT. Signed-off-by: Mario Six--- v2 -> v3: * Added proper commit message v1 -> v2: None --- board/cobra5272/flash.c | 2 +- common/flash.c| 4 ++-- drivers/mtd/cfi_flash.c | 4 ++-- drivers/mtd/pic32_flash.c | 6 +++--- include/flash.h | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/board/cobra5272/flash.c b/board/cobra5272/flash.c index 4fac6880f1..ca27b49a3b 100644 --- a/board/cobra5272/flash.c +++ b/board/cobra5272/flash.c @@ -216,7 +216,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last) goto outahere; } if (chip1 == TMO) { - rc = ERR_TIMOUT; + rc = ERR_TIMEOUT; goto outahere; } diff --git a/common/flash.c b/common/flash.c index 587ef60158..876677493f 100644 --- a/common/flash.c +++ b/common/flash.c @@ -112,7 +112,7 @@ addr2info (ulong addr) * and no protected sectors are hit. * Returns: * ERR_OK 0 - OK - * ERR_TIMOUT 1 - write timeout + * ERR_TIMEOUT 1 - write timeout * ERR_NOT_ERASED 2 - Flash not erased * ERR_PROTECTED 4 - target range includes protected sectors * ERR_INVAL 8 - target address not in Flash memory @@ -185,7 +185,7 @@ void flash_perror (int err) switch (err) { case ERR_OK: break; - case ERR_TIMOUT: + case ERR_TIMEOUT: puts ("Timeout writing to Flash\n"); break; case ERR_NOT_ERASED: diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index e94a7269e1..5ba0c5fdec 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -588,7 +588,7 @@ static int flash_status_check(flash_info_t *info, flash_sect_t sector, flash_read_long(info, sector, 0)); flash_write_cmd(info, sector, 0, info->cmd_reset); udelay(1); - return ERR_TIMOUT; + return ERR_TIMEOUT; } udelay(1); /* also triggers watchdog */ } @@ -696,7 +696,7 @@ static int flash_status_poll(flash_info_t *info, void *src, void *dst, if (get_timer(start) > tout) { printf("Flash %s timeout at address %lx data %lx\n", prompt, (ulong)dst, (ulong)flash_read8(dst)); - return ERR_TIMOUT; + return ERR_TIMEOUT; } udelay(1); /* also triggers watchdog */ } diff --git a/drivers/mtd/pic32_flash.c b/drivers/mtd/pic32_flash.c index e1a8d3bc4b..a6a5d1cc2e 100644 --- a/drivers/mtd/pic32_flash.c +++ b/drivers/mtd/pic32_flash.c @@ -69,7 +69,7 @@ static int flash_wait_till_busy(const char *func, ulong timeout) int ret = wait_for_bit(__func__, _regs_p->ctrl.raw, NVM_WR, false, timeout, false); - return ret ? ERR_TIMOUT : ERR_OK; + return ret ? ERR_TIMEOUT : ERR_OK; } static inline int flash_complete_operation(void) @@ -99,7 +99,7 @@ static inline int flash_complete_operation(void) * Erase flash sectors, returns: * ERR_OK - OK * ERR_INVAL - invalid sector arguments - * ERR_TIMOUT - write timeout + * ERR_TIMEOUT - write timeout * ERR_NOT_ERASED - Flash not erased * ERR_UNKNOWN_FLASH_VENDOR - incorrect flash */ @@ -217,7 +217,7 @@ static int write_word(flash_info_t *info, ulong dest, ulong word) /* * Copy memory to flash, returns: * ERR_OK - OK - * ERR_TIMOUT - write timeout + * ERR_TIMEOUT - write timeout * ERR_NOT_ERASED - Flash not erased */ int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt) diff --git a/include/flash.h b/include/flash.h index dc67cb2df6..1a4e879009 100644 --- a/include/flash.h +++ b/include/flash.h @@ -122,7 +122,7 @@ extern int jedec_flash_match(flash_info_t *info, ulong base); * return codes from flash_write(): */ #define ERR_OK 0 -#define ERR_TIMOUT 1 +#define ERR_TIMEOUT1 #define ERR_NOT_ERASED 2 #define ERR_PROTECTED 4 #define ERR_INVAL 8 -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 24/26] cfi_flash: Fix long lines
Long lines (>80 characters) should be avoided where possible. Break up some long lines where it's not detrimental to readability. Signed-off-by: Mario Six--- v2 -> v3: * Added proper commit message v1 -> v2: None --- drivers/mtd/cfi_flash.c | 31 +++ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 61c2e6379d..88c47cad90 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -175,7 +175,8 @@ __maybe_weak u64 flash_read64(void *addr) /*--- */ -#if defined(CONFIG_ENV_IS_IN_FLASH) || defined(CONFIG_ENV_ADDR_REDUND) || (CONFIG_SYS_MONITOR_BASE >= CONFIG_SYS_FLASH_BASE) +#if defined(CONFIG_ENV_IS_IN_FLASH) || defined(CONFIG_ENV_ADDR_REDUND) || \ + (CONFIG_SYS_MONITOR_BASE >= CONFIG_SYS_FLASH_BASE) static flash_info_t *flash_get_info(ulong base) { int i; @@ -569,8 +570,9 @@ static int flash_status_check(flash_info_t *info, flash_sect_t sector, ulong start; #if CONFIG_SYS_HZ != 1000 + /* Avoid overflow for large HZ */ if ((ulong)CONFIG_SYS_HZ > 10) - tout *= (ulong)CONFIG_SYS_HZ / 1000; /* for a big HZ, avoid overflow */ + tout *= (ulong)CONFIG_SYS_HZ / 1000; else tout = DIV_ROUND_UP(tout * (ulong)CONFIG_SYS_HZ, 1000); #endif @@ -661,8 +663,9 @@ static int flash_status_poll(flash_info_t *info, void *src, void *dst, int ready; #if CONFIG_SYS_HZ != 1000 + /* Avoid overflow for large HZ */ if ((ulong)CONFIG_SYS_HZ > 10) - tout *= (ulong)CONFIG_SYS_HZ / 1000; /* for a big HZ, avoid overflow */ + tout *= (ulong)CONFIG_SYS_HZ / 1000; else tout = DIV_ROUND_UP(tout * (ulong)CONFIG_SYS_HZ, 1000); #endif @@ -937,7 +940,8 @@ static int flash_write_cfibuffer(flash_info_t *info, ulong dest, uchar *cp, case CFI_CMDSET_INTEL_STANDARD: case CFI_CMDSET_INTEL_EXTENDED: write_cmd = (info->vendor == CFI_CMDSET_INTEL_PROG_REGIONS) ? - FLASH_CMD_WRITE_BUFFER_PROG : FLASH_CMD_WRITE_TO_BUFFER; + FLASH_CMD_WRITE_BUFFER_PROG : + FLASH_CMD_WRITE_TO_BUFFER; flash_write_cmd(info, sector, 0, FLASH_CMD_CLEAR_STATUS); flash_write_cmd(info, sector, 0, FLASH_CMD_READ_STATUS); flash_write_cmd(info, sector, 0, write_cmd); @@ -1152,7 +1156,8 @@ int flash_erase(flash_info_t *info, int s_first, int s_last) cword.w64 = 0xULL; dest = flash_map(info, sect, 0); st = flash_status_poll(info, , dest, - info->erase_blk_tout, "erase"); + info->erase_blk_tout, + "erase"); flash_unmap(info, sect, 0, dest); } else { st = flash_full_status_check(info, sect, @@ -1561,9 +1566,11 @@ int flash_real_protect(flash_info_t *info, long sector, int prot) flash_write_cmd(info, sector, 0, FLASH_CMD_CLEAR_STATUS); flash_write_cmd(info, sector, 0, FLASH_CMD_PROTECT); if (prot) - flash_write_cmd(info, sector, 0, FLASH_CMD_PROTECT_SET); + flash_write_cmd(info, sector, 0, + FLASH_CMD_PROTECT_SET); else - flash_write_cmd(info, sector, 0, FLASH_CMD_PROTECT_CLEAR); + flash_write_cmd(info, sector, 0, + FLASH_CMD_PROTECT_CLEAR); #endif }; @@ -1899,9 +1906,9 @@ static int __flash_detect_cfi(flash_info_t *info, struct cfi_qry *qry) flash_write_cmd(info, 0, flash_offset_cfi[cfi_offset], FLASH_CMD_CFI); if (flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP, 'Q') && - flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP + 1, 'R') && - flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP + 2, 'Y')) { - flash_read_cfi(info, qry, FLASH_OFFSET_CFI_RESP, + flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP + 1, 'R') && + flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP + 2, 'Y')) { + flash_read_cfi(info, qry, FLASH_OFFSET_CFI_RESP, sizeof(struct cfi_qry)); info->interface = le16_to_cpu(qry->interface_desc); @@ -2182,8 +2189,8 @@ ulong flash_get_size(phys_addr_t base, int banknum) tmp >>= 16;
[U-Boot] Antwort: [PATCH 4/5] Convert CONFIG_SPL_NAND_BASE et al to Kconfig
> Betreff: [PATCH 4/5] Convert CONFIG_SPL_NAND_BASE et al to Kconfig > > This converts the following to Kconfig: >CONFIG_SPL_NAND_BASE >CONFIG_SPL_NAND_LOAD >CONFIG_SPL_NAND_SOFTECC >CONFIG_SPL_NAND_RAW_ONLY > > Signed-off-by: Adam Ford> --- > configs/brppt1_nand_defconfig| 1 + > include/configs/brppt1.h | 1 - For the brppt1 Acked-by: Hannes Schmelzer ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 13/26] cfi_flash: Add missing braces in blocks
In if/else statements, either both blocks (if and else) should have braces or both blocks should not have braces, but mixed configurations are discouraged. Fix all instances where this occurs. Signed-off-by: Mario Six--- v2 -> v3: * Added proper commit message v1 -> v2: None --- drivers/mtd/cfi_flash.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 0a24e9173a..53842443eb 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -1154,10 +1154,12 @@ int flash_erase(flash_info_t *info, int s_first, int s_last) st = flash_status_poll(info, , dest, info->erase_blk_tout, "erase"); flash_unmap(info, sect, 0, dest); - } else + } else { st = flash_full_status_check(info, sect, info->erase_blk_tout, "erase"); + } + if (st) rcode = 1; else if (flash_verbose) -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 26/26] cfi_flash: Always define cfi_flash_num_flash_banks
The variable cfi_flash_num_flash_banks is defined iff CONFIG_SYS_MAX_FLASH_BANKS_DETECT is defined, but it is used unconditionally in the function cfi_flash_init_dm. This leads to a undefined variable compile error when CONFIG_SYS_MAX_FLASH_BANKS_DETECT is not defined, but DM is enabled. Fix this by always defining the cfi_flash_num_flash_banks variable. Signed-off-by: Mario Six--- v2 -> v3: * Added proper commit message v1 -> v2: None --- drivers/mtd/cfi_flash.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 347382f529..da44e6184e 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -91,6 +91,8 @@ static u16 cfi_flash_config_reg(int i) #if defined(CONFIG_SYS_MAX_FLASH_BANKS_DETECT) int cfi_flash_num_flash_banks = CONFIG_SYS_MAX_FLASH_BANKS_DETECT; +#else +int cfi_flash_num_flash_banks; #endif #ifdef CONFIG_CFI_FLASH /* for driver model */ -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 15/26] cfi_flash: Fix else after break
If in a loop, the if block in a if/else statement ends in a break, the statements in the else blockcan be extracted, since the break stops the execution. Signed-off-by: Mario Six--- v2 -> v3: * Added proper commit message v1 -> v2: None --- drivers/mtd/cfi_flash.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 4c5e1568e6..5b3c071b30 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -1826,9 +1826,9 @@ static int flash_detect_legacy(phys_addr_t base, int banknum) info->device_id2); if (jedec_flash_match(info, info->start[0])) break; - else - unmap_physmem((void *)info->start[0], - info->portwidth); + + unmap_physmem((void *)info->start[0], + info->portwidth); } } -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 19/26] cfi_flash: Use u8 pointers instead of void pointers
According to the C standard, pointer arithmetic for pointers of type void is undefined behavior (the assumption that they're 8-bit wide is a GCC-specific assumption). In the interest of keeping the code standards-compliant, and also better communicate intent, switch all void* variables where pointer arithmetic is used to u8* variables. Signed-off-by: Mario Six--- v2 -> v3: * Added proper commit message v1 -> v2: None --- drivers/mtd/cfi_flash.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 48086ded5c..fced9847ef 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -491,7 +491,7 @@ static int flash_isset(flash_info_t *info, flash_sect_t sect, static int flash_toggle(flash_info_t *info, flash_sect_t sect, uint offset, uchar cmd) { - void *addr; + u8 *addr; cfiword_t cword; int retval; @@ -872,9 +872,9 @@ static int flash_write_cfibuffer(flash_info_t *info, ulong dest, uchar *cp, flash_sect_t sector; int cnt; int retcode; - void *src = cp; - void *dst = (void *)dest; - void *dst2 = dst; + u8 *src = cp; + u8 *dst = (u8 *)dest; + u8 *dst2 = dst; int flag = 1; uint offset = 0; unsigned int shift; -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 21/26] cfi_flash: Rename camel-case variables
Camel-case naming should be avoided. Rename two camel-case variables, and fix their usage accordingly. Signed-off-by: Mario Six--- v2 -> v3: * Added proper commit message v1 -> v2: None --- drivers/mtd/cfi_flash.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 8040e43de7..e94a7269e1 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -1687,8 +1687,8 @@ static int cmdset_intel_init(flash_info_t *info, struct cfi_qry *qry) static void cmdset_amd_read_jedec_ids(flash_info_t *info) { - ushort bankId = 0; - uchar manuId; + ushort bank_id = 0; + uchar manu_id; uchar feature; flash_write_cmd(info, 0, 0, AMD_CMD_RESET); @@ -1696,14 +1696,14 @@ static void cmdset_amd_read_jedec_ids(flash_info_t *info) flash_write_cmd(info, 0, info->addr_unlock1, FLASH_CMD_READ_ID); udelay(1000); /* some flash are slow to respond */ - manuId = flash_read_uchar(info, FLASH_OFFSET_MANUFACTURER_ID); + manu_id = flash_read_uchar(info, FLASH_OFFSET_MANUFACTURER_ID); /* JEDEC JEP106Z specifies ID codes up to bank 7 */ - while (manuId == FLASH_CONTINUATION_CODE && bankId < 0x800) { - bankId += 0x100; - manuId = flash_read_uchar(info, - bankId | FLASH_OFFSET_MANUFACTURER_ID); + while (manu_id == FLASH_CONTINUATION_CODE && bank_id < 0x800) { + bank_id += 0x100; + manu_id = flash_read_uchar(info, + bank_id | FLASH_OFFSET_MANUFACTURER_ID); } - info->manufacturer_id = manuId; + info->manufacturer_id = manu_id; debug("info->ext_addr = 0x%x, cfi_version = 0x%x\n", info->ext_addr, info->cfi_version); -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 12/26] cfi_flash: Remove unnecessary braces
"==" and "!=" bind tighter than the boolean operators, so parentheses around them in compound logical statements are unnecessary. Fix all instances where this occurs. Signed-off-by: Mario Six--- v2 -> v3: * Added proper commit message v1 -> v2: None --- drivers/mtd/cfi_flash.c | 48 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index a21c407ed7..0a24e9173a 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -611,7 +611,7 @@ static int flash_full_status_check(flash_info_t *info, flash_sect_t sector, case CFI_CMDSET_INTEL_PROG_REGIONS: case CFI_CMDSET_INTEL_EXTENDED: case CFI_CMDSET_INTEL_STANDARD: - if ((retcode == ERR_OK) && + if (retcode == ERR_OK && !flash_isset(info, sector, 0, FLASH_STATUS_DONE)) { retcode = ERR_INVAL; printf("Flash %s error at address %lx\n", prompt, @@ -758,7 +758,7 @@ static flash_sect_t find_sector(flash_info_t *info, ulong addr) static flash_info_t *saved_info; /* previously used flash bank */ flash_sect_t sector = saved_sector; - if ((info != saved_info) || (sector >= info->sector_count)) + if (info != saved_info || sector >= info->sector_count) sector = 0; while ((info->start[sector] < addr) && @@ -1059,7 +1059,7 @@ int flash_erase(flash_info_t *info, int s_first, int s_last) puts("Can't erase unknown flash type - aborted\n"); return 1; } - if ((s_first < 0) || (s_first > s_last)) { + if (s_first < 0 || s_first > s_last) { puts("- no sectors to erase\n"); return 1; } @@ -1247,7 +1247,7 @@ void flash_print_info(flash_info_t *info) printf(info->chipwidth == FLASH_CFI_16BIT ? "%04X" : "%02X", info->device_id2); } - if ((info->vendor == CFI_CMDSET_AMD_STANDARD) && (info->legacy_unlock)) + if (info->vendor == CFI_CMDSET_AMD_STANDARD && info->legacy_unlock) printf("\n Advanced Sector Protection (PPB) enabled"); printf("\n Erase timeout: %ld ms, write timeout: %ld ms\n", info->erase_blk_tout, @@ -1291,7 +1291,7 @@ void flash_print_info(flash_info_t *info) #define FLASH_SHOW_PROGRESS(scale, dots, digit, dots_sub) \ if (flash_verbose) { \ dots -= dots_sub; \ - if ((scale > 0) && (dots <= 0)) { \ + if (scale > 0 && dots <= 0) { \ if ((digit % 5) == 0) \ printf("%d", digit / 5); \ else \ @@ -1577,7 +1577,7 @@ int flash_real_protect(flash_info_t *info, long sector, int prot) * On some of Intel's flash chips (marked via legacy_unlock) * unprotect unprotects all locking. */ - if ((prot == 0) && (info->legacy_unlock)) { + if (prot == 0 && info->legacy_unlock) { flash_sect_t i; for (i = 0; i < info->sector_count; i++) { @@ -1636,10 +1636,10 @@ static void cfi_reverse_geometry(struct cfi_qry *qry) u32 tmp; for (i = 0, j = qry->num_erase_regions - 1; i < j; i++, j--) { - tmp = get_unaligned(&(qry->erase_region_info[i])); - put_unaligned(get_unaligned(&(qry->erase_region_info[j])), - &(qry->erase_region_info[i])); - put_unaligned(tmp, &(qry->erase_region_info[j])); + tmp = get_unaligned(>erase_region_info[i]); + put_unaligned(get_unaligned(>erase_region_info[j]), + >erase_region_info[i]); + put_unaligned(tmp, >erase_region_info[j]); } } @@ -1919,11 +1919,11 @@ static int __flash_detect_cfi(flash_info_t *info, struct cfi_qry *qry) * in compatibility mode */ if (/* x8/x16 in x8 mode */ - ((info->chipwidth == FLASH_CFI_BY8) && - (info->interface == FLASH_CFI_X8X16)) || + (info->chipwidth == FLASH_CFI_BY8 && + info->interface == FLASH_CFI_X8X16) || /* x16/x32 in x16 mode */ - ((info->chipwidth == FLASH_CFI_BY16) && - (info->interface == FLASH_CFI_X16X32))) + (info->chipwidth == FLASH_CFI_BY16 && + info->interface == FLASH_CFI_X16X32)) { info->addr_unlock1 = 0xaaa; info->addr_unlock2 = 0x555; @@ -2040,8 +2040,8 @@ static void flash_fixup_num(flash_info_t
[U-Boot] [PATCH v3 20/26] cfi_flash: Fix strings split across lines
Strings should not be split accross multiple lines. Where possible and not detrimental to readability, fix the instances where this occurs. Signed-off-by: Mario Six--- v2 -> v3: * Added proper commit message v1 -> v2: None --- drivers/mtd/cfi_flash.c | 17 - 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index fced9847ef..8040e43de7 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -1255,10 +1255,9 @@ void flash_print_info(flash_info_t *info) info->erase_blk_tout, info->write_tout); if (info->buffer_size > 1) { - printf(" Buffer write timeout: %ld ms, " - "buffer size: %d bytes\n", - info->buffer_write_tout, - info->buffer_size); + printf(" Buffer write timeout: %ld ms, ", + info->buffer_write_tout); + printf("buffer size: %d bytes\n", info->buffer_size); } puts("\n Sector Start Addresses:"); @@ -2050,8 +2049,8 @@ static void flash_fixup_num(flash_info_t *info, struct cfi_qry *qry) info->device_id2 == 0x2301 || info->device_id2 == 0x2801 || info->device_id2 == 0x4801)) { - debug("Adjusted buffer size on Numonyx flash" - " M29EW family in 8 bit mode\n"); + debug("Adjusted buffer size on Numonyx flash"); + debug(" M29EW family in 8 bit mode\n"); qry->max_buf_write_size = 0x8; } } @@ -2388,9 +2387,9 @@ unsigned long flash_init(void) size += flash_info[i].size; if (flash_info[i].flash_id == FLASH_UNKNOWN) { #ifndef CONFIG_SYS_FLASH_QUIET_TEST - printf("## Unknown flash on Bank %d " - "- Size = 0x%08lx = %ld MB\n", - i + 1, flash_info[i].size, + printf("## Unknown flash on Bank %d ", i + 1); + printf("- Size = 0x%08lx = %ld MB\n", + flash_info[i].size, flash_info[i].size >> 20); #endif /* CONFIG_SYS_FLASH_QUIET_TEST */ } -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 09/26] cfi_flash: Fix logical continuations
When splitting long logical statements across multiple lines, the logical operators should be at the end of the lines. Fix all instances where this occurs. Signed-off-by: Mario Six--- v2 -> v3: * Added proper commit message v1 -> v2: None --- drivers/mtd/cfi_flash.c | 26 +- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index e2469055b8..eebd641e36 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -611,8 +611,8 @@ static int flash_full_status_check(flash_info_t *info, flash_sect_t sector, case CFI_CMDSET_INTEL_PROG_REGIONS: case CFI_CMDSET_INTEL_EXTENDED: case CFI_CMDSET_INTEL_STANDARD: - if ((retcode == ERR_OK) - && !flash_isset(info, sector, 0, FLASH_STATUS_DONE)) { + if ((retcode == ERR_OK) && + !flash_isset(info, sector, 0, FLASH_STATUS_DONE)) { retcode = ERR_INVAL; printf("Flash %s error at address %lx\n", prompt, info->start[sector]); @@ -761,8 +761,8 @@ static flash_sect_t find_sector(flash_info_t *info, ulong addr) if ((info != saved_info) || (sector >= info->sector_count)) sector = 0; - while ((info->start[sector] < addr) - && (sector < info->sector_count - 1)) + while ((info->start[sector] < addr) && + (sector < info->sector_count - 1)) sector++; while ((info->start[sector] > addr) && (sector > 0)) /* @@ -1435,8 +1435,8 @@ static inline int manufact_match(flash_info_t *info, u32 manu) static int cfi_protect_bugfix(flash_info_t *info, long sector, int prot) { - if (manufact_match(info, INTEL_MANUFACT) - && info->device_id == NUMONYX_256MBIT) { + if (manufact_match(info, INTEL_MANUFACT) && + info->device_id == NUMONYX_256MBIT) { /* * see errata called * "Numonyx Axcell P33/P30 Specification Update" :) @@ -1807,8 +1807,8 @@ static int flash_detect_legacy(phys_addr_t base, int banknum) (ulong)map_physmem(base, info->portwidth, MAP_NOCACHE); - if (info->portwidth == FLASH_CFI_8BIT - && info->interface == FLASH_CFI_X8X16) { + if (info->portwidth == FLASH_CFI_8BIT && + info->interface == FLASH_CFI_X8X16) { info->addr_unlock1 = 0x2AAA; info->addr_unlock2 = 0x; } else { @@ -1892,9 +1892,9 @@ static int __flash_detect_cfi(flash_info_t *info, struct cfi_qry *qry) cfi_offset++) { flash_write_cmd(info, 0, flash_offset_cfi[cfi_offset], FLASH_CMD_CFI); - if (flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP, 'Q') - && flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP + 1, 'R') - && flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP + 2, 'Y')) { + if (flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP, 'Q') && + flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP + 1, 'R') && + flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP + 2, 'Y')) { flash_read_cfi(info, qry, FLASH_OFFSET_CFI_RESP, sizeof(struct cfi_qry)); info->interface = le16_to_cpu(qry->interface_desc); @@ -2144,8 +2144,8 @@ ulong flash_get_size(phys_addr_t base, int banknum) size_ratio = info->portwidth / info->chipwidth; /* if the chip is x8/x16 reduce the ratio by half */ - if ((info->interface == FLASH_CFI_X8X16) - && (info->chipwidth == FLASH_CFI_BY8)) { + if ((info->interface == FLASH_CFI_X8X16) && + (info->chipwidth == FLASH_CFI_BY8)) { size_ratio >>= 1; } debug("size_ratio %d port %d bits chip %d bits\n", -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 25/26] cfi_flash: Fix indention
When long expressions surrounded by parentheses are split into multiple lines, each consecutive line should be aligned with the corresponding parenthesis. Fix all instances where this occurs. Signed-off-by: Mario Six--- v2 -> v3: * Added proper commit message v1 -> v2: None --- drivers/mtd/cfi_flash.c | 238 1 file changed, 118 insertions(+), 120 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 88c47cad90..347382f529 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -213,7 +213,7 @@ flash_map(flash_info_t *info, flash_sect_t sect, uint offset) } static inline void flash_unmap(flash_info_t *info, flash_sect_t sect, - unsigned int offset, void *addr) + unsigned int offset, void *addr) { } @@ -329,7 +329,7 @@ static ulong flash_read_long (flash_info_t *info, flash_sect_t sect, #ifdef DEBUG debug("long addr is at %p info->portwidth = %d\n", addr, - info->portwidth); + info->portwidth); for (x = 0; x < 4 * info->portwidth; x++) debug("addr[%x] = 0x%x\n", x, flash_read8(addr + x)); #endif @@ -363,19 +363,19 @@ static void flash_write_cmd(flash_info_t *info, flash_sect_t sect, switch (info->portwidth) { case FLASH_CFI_8BIT: debug("fwc addr %p cmd %x %x 8bit x %d bit\n", addr, cmd, - cword.w8, info->chipwidth << CFI_FLASH_SHIFT_WIDTH); + cword.w8, info->chipwidth << CFI_FLASH_SHIFT_WIDTH); flash_write8(cword.w8, addr); break; case FLASH_CFI_16BIT: debug("fwc addr %p cmd %x %4.4x 16bit x %d bit\n", addr, - cmd, cword.w16, - info->chipwidth << CFI_FLASH_SHIFT_WIDTH); + cmd, cword.w16, + info->chipwidth << CFI_FLASH_SHIFT_WIDTH); flash_write16(cword.w16, addr); break; case FLASH_CFI_32BIT: debug("fwc addr %p cmd %x %8.8x 32bit x %d bit\n", addr, - cmd, cword.w32, - info->chipwidth << CFI_FLASH_SHIFT_WIDTH); + cmd, cword.w32, + info->chipwidth << CFI_FLASH_SHIFT_WIDTH); flash_write32(cword.w32, addr); break; case FLASH_CFI_64BIT: @@ -386,8 +386,8 @@ static void flash_write_cmd(flash_info_t *info, flash_sect_t sect, print_longlong(str, cword.w64); debug("fwrite addr %p cmd %x %s 64 bit x %d bit\n", - addr, cmd, str, - info->chipwidth << CFI_FLASH_SHIFT_WIDTH); + addr, cmd, str, + info->chipwidth << CFI_FLASH_SHIFT_WIDTH); } #endif flash_write64(cword.w64, addr); @@ -408,8 +408,8 @@ static void flash_unlock_seq(flash_info_t *info, flash_sect_t sect) /*--- */ -static int flash_isequal(flash_info_t *info, flash_sect_t sect, - uint offset, uchar cmd) +static int flash_isequal(flash_info_t *info, flash_sect_t sect, uint offset, +uchar cmd) { void *addr; cfiword_t cword; @@ -456,8 +456,8 @@ static int flash_isequal(flash_info_t *info, flash_sect_t sect, /*--- */ -static int flash_isset(flash_info_t *info, flash_sect_t sect, - uint offset, uchar cmd) +static int flash_isset(flash_info_t *info, flash_sect_t sect, uint offset, + uchar cmd) { void *addr; cfiword_t cword; @@ -489,8 +489,8 @@ static int flash_isset(flash_info_t *info, flash_sect_t sect, /*--- */ -static int flash_toggle(flash_info_t *info, flash_sect_t sect, -uint offset, uchar cmd) +static int flash_toggle(flash_info_t *info, flash_sect_t sect, uint offset, + uchar cmd) { u8 *addr; cfiword_t cword; @@ -544,12 +544,12 @@ static int flash_is_busy(flash_info_t *info, flash_sect_t sect) #endif if (info->sr_supported) { flash_write_cmd(info, sect, info->addr_unlock1, -FLASH_CMD_READ_STATUS); + FLASH_CMD_READ_STATUS); retval = !flash_isset(info, sect, 0, - FLASH_STATUS_DONE); + FLASH_STATUS_DONE); } else { retval = flash_toggle(info, sect, 0, -
[U-Boot] [PATCH v3 01/26] cfi_flash: Fix space between function name and parenthesis
There should not be a space between a function name and a parenthesis ("func (...)"). Fix all instances where this occurs. Signed-off-by: Mario Six--- v2 -> v3: * Added proper commit message v1 -> v2: None --- drivers/mtd/cfi_flash.c | 428 1 file changed, 214 insertions(+), 214 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index f096e039cb..0dc7f4a6ba 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -204,7 +204,7 @@ unsigned long flash_sector_size(flash_info_t *info, flash_sect_t sect) * create an address based on the offset and the port width */ static inline void * -flash_map (flash_info_t * info, flash_sect_t sect, uint offset) +flash_map(flash_info_t * info, flash_sect_t sect, uint offset) { unsigned int byte_offset = offset * info->portwidth; @@ -247,17 +247,17 @@ static void flash_make_cmd(flash_info_t *info, u32 cmd, void *cmdbuf) /*--- * Debug support */ -static void print_longlong (char *str, unsigned long long data) +static void print_longlong(char *str, unsigned long long data) { int i; char *cp; cp = (char *) for (i = 0; i < 8; i++) - sprintf ([i * 2], "%2.2x", *cp++); + sprintf([i * 2], "%2.2x", *cp++); } -static void flash_printqry (struct cfi_qry *qry) +static void flash_printqry(struct cfi_qry *qry) { u8 *p = (u8 *)qry; int x, y; @@ -283,31 +283,31 @@ static void flash_printqry (struct cfi_qry *qry) /*--- * read a character at a port width address */ -static inline uchar flash_read_uchar (flash_info_t * info, uint offset) +static inline uchar flash_read_uchar(flash_info_t * info, uint offset) { uchar *cp; uchar retval; - cp = flash_map (info, 0, offset); + cp = flash_map(info, 0, offset); #if defined(__LITTLE_ENDIAN) || defined(CONFIG_SYS_WRITE_SWAPPED_DATA) retval = flash_read8(cp); #else retval = flash_read8(cp + info->portwidth - 1); #endif - flash_unmap (info, 0, offset, cp); + flash_unmap(info, 0, offset, cp); return retval; } /*--- * read a word at a port width address, assume 16bit bus */ -static inline ushort flash_read_word (flash_info_t * info, uint offset) +static inline ushort flash_read_word(flash_info_t * info, uint offset) { ushort *addr, retval; - addr = flash_map (info, 0, offset); - retval = flash_read16 (addr); - flash_unmap (info, 0, offset, addr); + addr = flash_map(info, 0, offset); + retval = flash_read16(addr); + flash_unmap(info, 0, offset, addr); return retval; } @@ -325,13 +325,13 @@ static ulong flash_read_long (flash_info_t * info, flash_sect_t sect, #ifdef DEBUG int x; #endif - addr = flash_map (info, sect, offset); + addr = flash_map(info, sect, offset); #ifdef DEBUG - debug ("long addr is at %p info->portwidth = %d\n", addr, + debug("long addr is at %p info->portwidth = %d\n", addr, info->portwidth); for (x = 0; x < 4 * info->portwidth; x++) { - debug ("addr[%x] = 0x%x\n", x, flash_read8(addr + x)); + debug("addr[%x] = 0x%x\n", x, flash_read8(addr + x)); } #endif #if defined(__LITTLE_ENDIAN) || defined(CONFIG_SYS_WRITE_SWAPPED_DATA) @@ -360,22 +360,22 @@ static void flash_write_cmd(flash_info_t *info, flash_sect_t sect, void *addr; cfiword_t cword; - addr = flash_map (info, sect, offset); - flash_make_cmd (info, cmd, ); + addr = flash_map(info, sect, offset); + flash_make_cmd(info, cmd, ); switch (info->portwidth) { case FLASH_CFI_8BIT: - debug ("fwc addr %p cmd %x %x 8bit x %d bit\n", addr, cmd, + debug("fwc addr %p cmd %x %x 8bit x %d bit\n", addr, cmd, cword.w8, info->chipwidth << CFI_FLASH_SHIFT_WIDTH); flash_write8(cword.w8, addr); break; case FLASH_CFI_16BIT: - debug ("fwc addr %p cmd %x %4.4x 16bit x %d bit\n", addr, + debug("fwc addr %p cmd %x %4.4x 16bit x %d bit\n", addr, cmd, cword.w16, info->chipwidth << CFI_FLASH_SHIFT_WIDTH); flash_write16(cword.w16, addr); break; case FLASH_CFI_32BIT: - debug ("fwc addr %p cmd %x %8.8x 32bit x %d bit\n", addr, + debug("fwc addr %p cmd %x %8.8x 32bit x %d bit\n", addr, cmd, cword.w32, info->chipwidth << CFI_FLASH_SHIFT_WIDTH); flash_write32(cword.w32, addr); @@ -385,9 +385,9 @@ static void
[U-Boot] [PATCH v3 11/26] cfi_flash: Fix comment style
Comment blocks should end with a "*/" on a separate line, not with the "*/" attached to the end of the last line of text. Fix all instances where this occurs. Signed-off-by: Mario Six--- v2 -> v3: * Added proper commit message v1 -> v2: None --- drivers/mtd/cfi_flash.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 6ae1ac871f..a21c407ed7 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -946,7 +946,8 @@ static int flash_write_cfibuffer(flash_info_t *info, ulong dest, uchar *cp, "write to buffer"); if (retcode == ERR_OK) { /* reduce the number of loops by the width of -* the port */ +* the port +*/ cnt = len >> shift; flash_write_cmd(info, sector, 0, cnt - 1); while (cnt-- > 0) { @@ -1793,7 +1794,8 @@ static int flash_detect_legacy(phys_addr_t base, int banknum) if (board_flash_get_legacy(base, banknum, info)) { /* board code may have filled info completely. If not, we - use JEDEC ID probing. */ +* use JEDEC ID probing. +*/ if (!info->vendor) { int modes[] = { CFI_CMDSET_AMD_STANDARD, -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 05/26] cfi_flash: Fix indent of case statements
case statements should be at the same level of indent as the switch keyword. Fix all instances where this occurs. Signed-off-by: Mario Six--- v2 -> v3: * Added proper commit message v1 -> v2: None --- drivers/mtd/cfi_flash.c | 200 1 file changed, 100 insertions(+), 100 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 2dc6b09cd9..b77fd3c0a2 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -1220,29 +1220,29 @@ void flash_print_info(flash_info_t *info) info->size >> 20, info->sector_count); printf(" "); switch (info->vendor) { - case CFI_CMDSET_INTEL_PROG_REGIONS: - printf("Intel Prog Regions"); - break; - case CFI_CMDSET_INTEL_STANDARD: - printf("Intel Standard"); - break; - case CFI_CMDSET_INTEL_EXTENDED: - printf("Intel Extended"); - break; - case CFI_CMDSET_AMD_STANDARD: - printf("AMD Standard"); - break; - case CFI_CMDSET_AMD_EXTENDED: - printf("AMD Extended"); - break; + case CFI_CMDSET_INTEL_PROG_REGIONS: + printf("Intel Prog Regions"); + break; + case CFI_CMDSET_INTEL_STANDARD: + printf("Intel Standard"); + break; + case CFI_CMDSET_INTEL_EXTENDED: + printf("Intel Extended"); + break; + case CFI_CMDSET_AMD_STANDARD: + printf("AMD Standard"); + break; + case CFI_CMDSET_AMD_EXTENDED: + printf("AMD Extended"); + break; #ifdef CONFIG_FLASH_CFI_LEGACY - case CFI_CMDSET_AMD_LEGACY: - printf("AMD Legacy"); - break; + case CFI_CMDSET_AMD_LEGACY: + printf("AMD Legacy"); + break; #endif - default: - printf("Unknown (%d)", info->vendor); - break; + default: + printf("Unknown (%d)", info->vendor); + break; } printf(" command set, Manufacturer ID: 0x%02X, Device ID: 0x", info->manufacturer_id); @@ -1480,94 +1480,94 @@ int flash_real_protect(flash_info_t *info, long sector, int prot) int retcode = 0; switch (info->vendor) { - case CFI_CMDSET_INTEL_PROG_REGIONS: - case CFI_CMDSET_INTEL_STANDARD: - case CFI_CMDSET_INTEL_EXTENDED: - if (!cfi_protect_bugfix(info, sector, prot)) { + case CFI_CMDSET_INTEL_PROG_REGIONS: + case CFI_CMDSET_INTEL_STANDARD: + case CFI_CMDSET_INTEL_EXTENDED: + if (!cfi_protect_bugfix(info, sector, prot)) { + flash_write_cmd(info, sector, 0, +FLASH_CMD_CLEAR_STATUS); + flash_write_cmd(info, sector, 0, + FLASH_CMD_PROTECT); + if (prot) flash_write_cmd(info, sector, 0, -FLASH_CMD_CLEAR_STATUS); + FLASH_CMD_PROTECT_SET); + else flash_write_cmd(info, sector, 0, - FLASH_CMD_PROTECT); - if (prot) - flash_write_cmd(info, sector, 0, - FLASH_CMD_PROTECT_SET); - else - flash_write_cmd(info, sector, 0, - FLASH_CMD_PROTECT_CLEAR); + FLASH_CMD_PROTECT_CLEAR); + } + break; + case CFI_CMDSET_AMD_EXTENDED: + case CFI_CMDSET_AMD_STANDARD: + /* U-Boot only checks the first byte */ + if (manufact_match(info, ATM_MANUFACT)) { + if (prot) { + flash_unlock_seq(info, 0); + flash_write_cmd(info, 0, + info->addr_unlock1, + ATM_CMD_SOFTLOCK_START); + flash_unlock_seq(info, 0); + flash_write_cmd(info, sector, 0, + ATM_CMD_LOCK_SECT); + } else { + flash_write_cmd(info, 0, + info->addr_unlock1, +
[U-Boot] [PATCH v3 07/26] cfi_flash: Fix missing/superfluous lines
There should be no consecutive blank lines, and no blank lines at the end of blocks. But there should be blank lines between variable declarations and code. Fix all instances where either occurs. Signed-off-by: Mario Six--- v2 -> v3: * Added proper commit message v1 -> v2: None --- drivers/mtd/cfi_flash.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 0d58914e44..9cc1b2b16f 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -269,6 +269,7 @@ static void flash_printqry(struct cfi_qry *qry) debug(" "); for (y = 0; y < 16; y++) { unsigned char c = p[x + y]; + if (c >= 0x20 && c <= 0x7e) debug("%c", c); else @@ -279,7 +280,6 @@ static void flash_printqry(struct cfi_qry *qry) } #endif - /*--- * read a character at a port width address */ @@ -311,7 +311,6 @@ static inline ushort flash_read_word(flash_info_t *info, uint offset) return retval; } - /*--- * read a long word by picking the least significant byte of each maximum * port size word. Swap for ppc format. @@ -356,7 +355,6 @@ static ulong flash_read_long (flash_info_t *info, flash_sect_t sect, static void flash_write_cmd(flash_info_t *info, flash_sect_t sect, uint offset, u32 cmd) { - void *addr; cfiword_t cword; @@ -1048,7 +1046,6 @@ out_unmap: } #endif /* CONFIG_SYS_FLASH_USE_BUFFER_WRITE */ - /*--- */ int flash_erase(flash_info_t *info, int s_first, int s_last) @@ -1080,7 +1077,6 @@ int flash_erase(flash_info_t *info, int s_first, int s_last) putc('\n'); } - for (sect = s_first; sect <= s_last; sect++) { if (ctrlc()) { printf("\n"); @@ -1154,6 +1150,7 @@ int flash_erase(flash_info_t *info, int s_first, int s_last) if (use_flash_status_poll(info)) { cfiword_t cword; void *dest; + cword.w64 = 0xULL; dest = flash_map(info, sect, 0); st = flash_status_poll(info, , dest, @@ -1494,7 +1491,6 @@ int flash_real_protect(flash_info_t *info, long sector, int prot) else flash_write_cmd(info, sector, 0, FLASH_CMD_PROTECT_CLEAR); - } break; case CFI_CMDSET_AMD_EXTENDED: @@ -1579,7 +1575,6 @@ int flash_real_protect(flash_info_t *info, long sector, int prot) if ((retcode = flash_full_status_check(info, sector, info->erase_blk_tout, prot ? "protect" : "unprotect")) == 0) { - info->protect[sector] = prot; /* @@ -1887,6 +1882,7 @@ static void __flash_cmd_reset(flash_info_t *info) udelay(1); flash_write_cmd(info, 0, 0, FLASH_CMD_RESET); } + void flash_cmd_reset(flash_info_t *info) __attribute__((weak, alias("__flash_cmd_reset"))); @@ -2370,6 +2366,7 @@ unsigned long flash_init(void) #ifdef CONFIG_SYS_FLASH_PROTECTION /* read environment from EEPROM */ char s[64]; + env_get_f("unlock", s, sizeof(s)); #endif -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 08/26] cfi_flash: Remove braces for single-statement blocks
Blocks with a single statement should not be enclosed in braces. Fix all instances where this occurs. Signed-off-by: Mario Six--- v2 -> v3: * Added proper commit message v1 -> v2: None --- drivers/mtd/cfi_flash.c | 15 +-- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 9cc1b2b16f..e2469055b8 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -329,9 +329,8 @@ static ulong flash_read_long (flash_info_t *info, flash_sect_t sect, #ifdef DEBUG debug("long addr is at %p info->portwidth = %d\n", addr, info->portwidth); - for (x = 0; x < 4 * info->portwidth; x++) { + for (x = 0; x < 4 * info->portwidth; x++) debug("addr[%x] = 0x%x\n", x, flash_read8(addr + x)); - } #endif #if defined(__LITTLE_ENDIAN) || defined(CONFIG_SYS_WRITE_SWAPPED_DATA) retval = ((flash_read8(addr) << 16) | @@ -1065,11 +1064,9 @@ int flash_erase(flash_info_t *info, int s_first, int s_last) } prot = 0; - for (sect = s_first; sect <= s_last; ++sect) { - if (info->protect[sect]) { + for (sect = s_first; sect <= s_last; ++sect) + if (info->protect[sect]) prot++; - } - } if (prot) { printf("- Warning: %d protected sectors will not be erased!\n", prot); @@ -1396,9 +1393,8 @@ int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt) #else while (cnt >= info->portwidth) { cword.w32 = 0; - for (i = 0; i < info->portwidth; i++) { + for (i = 0; i < info->portwidth; i++) flash_add_byte(info, , *src++); - } if ((rc = flash_write_cfiword(info, wp, cword)) != 0) return rc; wp += info->portwidth; @@ -1410,9 +1406,8 @@ int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt) } #endif /* CONFIG_SYS_FLASH_USE_BUFFER_WRITE */ - if (cnt == 0) { + if (cnt == 0) return (0); - } /* * handle unaligned tail bytes -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 23/26] cfi_flash: Bound-check index before array access
In a while loop in cfi_flash.c the array "start" is accessed at the index "sector" before the index variable "sector" is bounds-checked, which might lead to accesses beyond the bounds of the array. Swap the order of the checks in the "&&" expression, so that the short-circuit evaluation prevents out-of-bounds array accesses. Signed-off-by: Mario Six--- v2 -> v3: * Added proper commit message v1 -> v2: None --- drivers/mtd/cfi_flash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 5ba0c5fdec..61c2e6379d 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -761,8 +761,8 @@ static flash_sect_t find_sector(flash_info_t *info, ulong addr) if (info != saved_info || sector >= info->sector_count) sector = 0; - while ((info->start[sector] < addr) && - (sector < info->sector_count - 1)) + while ((sector < info->sector_count - 1) && + (info->start[sector] < addr)) sector++; while ((info->start[sector] > addr) && (sector > 0)) /* -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 18/26] cfi_flash: Remove assignments from if conditions
The condition in if statements should not be used for variable assignment. Instead, the assignment should be done in a separate step beforehand. Fix all instances where this occurs. Signed-off-by: Mario Six--- v2 -> v3: * Added proper commit message v1 -> v2: None --- drivers/mtd/cfi_flash.c | 18 +++--- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index d16357343f..48086ded5c 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -1339,7 +1339,8 @@ int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt) wp = (addr & ~(info->portwidth - 1)); /* handle unaligned start */ - if ((aln = addr - wp) != 0) { + aln = addr - wp; + if (aln != 0) { cword.w32 = 0; p = (uchar *)wp; for (i = 0; i < aln; ++i) @@ -1370,7 +1371,8 @@ int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt) cword.w32 = 0; for (i = 0; i < info->portwidth; i++) flash_add_byte(info, , *src++); - if ((rc = flash_write_cfiword(info, wp, cword)) != 0) + rc = flash_write_cfiword(info, wp, cword); + if (rc != 0) return rc; wp += info->portwidth; cnt -= info->portwidth; @@ -1381,7 +1383,8 @@ int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt) i = buffered_size - (wp % buffered_size); if (i > cnt) i = cnt; - if ((rc = flash_write_cfibuffer(info, wp, src, i)) != ERR_OK) + rc = flash_write_cfibuffer(info, wp, src, i); + if (rc != ERR_OK) return rc; i -= i & (info->portwidth - 1); wp += i; @@ -1397,7 +1400,8 @@ int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt) cword.w32 = 0; for (i = 0; i < info->portwidth; i++) flash_add_byte(info, , *src++); - if ((rc = flash_write_cfiword(info, wp, cword)) != 0) + rc = flash_write_cfiword(info, wp, cword); + if (rc != 0) return rc; wp += info->portwidth; cnt -= info->portwidth; @@ -1569,9 +1573,9 @@ int flash_real_protect(flash_info_t *info, long sector, int prot) * flash_full_status_check() to work correctly */ flash_write_cmd(info, sector, 0, FLASH_CMD_READ_STATUS); - if ((retcode = -flash_full_status_check(info, sector, info->erase_blk_tout, - prot ? "protect" : "unprotect")) == 0) { + retcode = flash_full_status_check(info, sector, info->erase_blk_tout, + prot ? "protect" : "unprotect"); + if (retcode == 0) { info->protect[sector] = prot; /* -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 10/26] cfi_flash: Use __func__ macro instead of function name
printf/debug statements should not include the file name as a hardcoded string, but instead use the __func__ macro. Fix all instances where this occurs. Signed-off-by: Mario Six--- v2 -> v3: * Added proper commit message v1 -> v2: None --- drivers/mtd/cfi_flash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index eebd641e36..6ae1ac871f 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -555,7 +555,7 @@ static int flash_is_busy(flash_info_t *info, flash_sect_t sect) default: retval = 0; } - debug("flash_is_busy: %d\n", retval); + debug("%s: %d\n", __func__, retval); return retval; } -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 14/26] cfi_flash: Fix spelling of "Unknown"
"Unkown" should be spelled "Unknown". Signed-off-by: Mario Six--- v2 -> v3: * Added proper commit message v1 -> v2: None --- drivers/mtd/cfi_flash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 53842443eb..4c5e1568e6 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -1140,7 +1140,7 @@ int flash_erase(flash_info_t *info, int s_first, int s_last) break; #endif default: - debug("Unkown flash vendor %d\n", + debug("Unknown flash vendor %d\n", info->vendor); break; } -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 17/26] cfi_flash: Remove return from void function
void functions don't need an explicit return at the end. Signed-off-by: Mario Six--- v2 -> v3: * Added proper commit message v1 -> v2: None --- drivers/mtd/cfi_flash.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 7aa379b0d8..d16357343f 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -1280,7 +1280,6 @@ void flash_print_info(flash_info_t *info) #endif } putc('\n'); - return; } /*--- -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 02/26] cfi_flash: Fix style of pointer declarations
In a pointer declaration there should not be a space between the asterisk and the pointer name. Fix all instances where this occurs. Signed-off-by: Mario Six--- v2 -> v3: * Added proper commit message v1 -> v2: None --- drivers/mtd/cfi_flash.c | 48 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 0dc7f4a6ba..a1b217cc0c 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -204,7 +204,7 @@ unsigned long flash_sector_size(flash_info_t *info, flash_sect_t sect) * create an address based on the offset and the port width */ static inline void * -flash_map(flash_info_t * info, flash_sect_t sect, uint offset) +flash_map(flash_info_t *info, flash_sect_t sect, uint offset) { unsigned int byte_offset = offset * info->portwidth; @@ -283,7 +283,7 @@ static void flash_printqry(struct cfi_qry *qry) /*--- * read a character at a port width address */ -static inline uchar flash_read_uchar(flash_info_t * info, uint offset) +static inline uchar flash_read_uchar(flash_info_t *info, uint offset) { uchar *cp; uchar retval; @@ -301,7 +301,7 @@ static inline uchar flash_read_uchar(flash_info_t * info, uint offset) /*--- * read a word at a port width address, assume 16bit bus */ -static inline ushort flash_read_word(flash_info_t * info, uint offset) +static inline ushort flash_read_word(flash_info_t *info, uint offset) { ushort *addr, retval; @@ -316,7 +316,7 @@ static inline ushort flash_read_word(flash_info_t * info, uint offset) * read a long word by picking the least significant byte of each maximum * port size word. Swap for ppc format. */ -static ulong flash_read_long (flash_info_t * info, flash_sect_t sect, +static ulong flash_read_long (flash_info_t *info, flash_sect_t sect, uint offset) { uchar *addr; @@ -402,7 +402,7 @@ static void flash_write_cmd(flash_info_t *info, flash_sect_t sect, flash_unmap(info, sect, offset, addr); } -static void flash_unlock_seq(flash_info_t * info, flash_sect_t sect) +static void flash_unlock_seq(flash_info_t *info, flash_sect_t sect) { flash_write_cmd(info, sect, info->addr_unlock1, AMD_CMD_UNLOCK_START); flash_write_cmd(info, sect, info->addr_unlock2, AMD_CMD_UNLOCK_ACK); @@ -410,7 +410,7 @@ static void flash_unlock_seq(flash_info_t * info, flash_sect_t sect) /*--- */ -static int flash_isequal(flash_info_t * info, flash_sect_t sect, +static int flash_isequal(flash_info_t *info, flash_sect_t sect, uint offset, uchar cmd) { void *addr; @@ -458,7 +458,7 @@ static int flash_isequal(flash_info_t * info, flash_sect_t sect, /*--- */ -static int flash_isset(flash_info_t * info, flash_sect_t sect, +static int flash_isset(flash_info_t *info, flash_sect_t sect, uint offset, uchar cmd) { void *addr; @@ -491,7 +491,7 @@ static int flash_isset(flash_info_t * info, flash_sect_t sect, /*--- */ -static int flash_toggle(flash_info_t * info, flash_sect_t sect, +static int flash_toggle(flash_info_t *info, flash_sect_t sect, uint offset, uchar cmd) { void *addr; @@ -529,7 +529,7 @@ static int flash_toggle(flash_info_t * info, flash_sect_t sect, * This routine checks the status of the chip and returns true if the * chip is busy. */ -static int flash_is_busy(flash_info_t * info, flash_sect_t sect) +static int flash_is_busy(flash_info_t *info, flash_sect_t sect) { int retval; @@ -566,7 +566,7 @@ static int flash_is_busy(flash_info_t * info, flash_sect_t sect) * wait for XSR.7 to be set. Time out with an error if it does not. * This routine does not set the flash to read-array mode. */ -static int flash_status_check(flash_info_t * info, flash_sect_t sector, +static int flash_status_check(flash_info_t *info, flash_sect_t sector, ulong tout, char *prompt) { ulong start; @@ -604,7 +604,7 @@ static int flash_status_check(flash_info_t * info, flash_sect_t sector, * * This routine sets the flash to read-array mode. */ -static int flash_full_status_check(flash_info_t * info, flash_sect_t sector, +static int flash_full_status_check(flash_info_t *info, flash_sect_t sector, ulong tout, char *prompt) { int retcode; @@ -709,7 +709,7 @@ static int flash_status_poll(flash_info_t *info, void *src, void *dst,
[U-Boot] [PATCH v3 03/26] cfi_flash: Fix Parenthesis spacing
There should not be additional spaces when nesting parentheses ("( (...) )"). Fix all instances where this occurs. Signed-off-by: Mario Six--- v2 -> v3: * Added proper commit message v1 -> v2: None --- drivers/mtd/cfi_flash.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index a1b217cc0c..e8f1739254 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -230,7 +230,7 @@ static void flash_make_cmd(flash_info_t *info, u32 cmd, void *cmdbuf) uchar val; uchar *cp = (uchar *) cmdbuf; - for (i = info->portwidth; i > 0; i--){ + for (i = info->portwidth; i > 0; i--) { cword_offset = (info->portwidth-i)%info->chipwidth; #if defined(__LITTLE_ENDIAN) || defined(CONFIG_SYS_WRITE_SWAPPED_DATA) cp_offset = info->portwidth - i; @@ -511,8 +511,8 @@ static int flash_toggle(flash_info_t *info, flash_sect_t sect, retval = flash_read32(addr) != flash_read32(addr); break; case FLASH_CFI_64BIT: - retval = ( (flash_read32( addr ) != flash_read32( addr )) || - (flash_read32(addr+4) != flash_read32(addr+4)) ); + retval = ((flash_read32(addr) != flash_read32(addr)) || + (flash_read32(addr+4) != flash_read32(addr+4))); break; default: retval = 0; @@ -1719,7 +1719,7 @@ static void cmdset_amd_read_jedec_ids(flash_info_t *info) info->sr_supported = feature & 0x1; } - switch (info->chipwidth){ + switch (info->chipwidth) { case FLASH_CFI_8BIT: info->device_id = flash_read_uchar(info, FLASH_OFFSET_DEVICE_ID); @@ -1838,7 +1838,7 @@ static int flash_detect_legacy(phys_addr_t base, int banknum) } } - switch(info->vendor) { + switch (info->vendor) { case CFI_CMDSET_INTEL_PROG_REGIONS: case CFI_CMDSET_INTEL_STANDARD: case CFI_CMDSET_INTEL_EXTENDED: @@ -1925,12 +1925,12 @@ static int __flash_detect_cfi(flash_info_t *info, struct cfi_qry *qry) * modify the unlock address if we are * in compatibility mode */ - if (/* x8/x16 in x8 mode */ - ((info->chipwidth == FLASH_CFI_BY8) && - (info->interface == FLASH_CFI_X8X16)) || - /* x16/x32 in x16 mode */ - ((info->chipwidth == FLASH_CFI_BY16) && - (info->interface == FLASH_CFI_X16X32))) + if (/* x8/x16 in x8 mode */ + ((info->chipwidth == FLASH_CFI_BY8) && + (info->interface == FLASH_CFI_X8X16)) || + /* x16/x32 in x16 mode */ + ((info->chipwidth == FLASH_CFI_BY16) && + (info->interface == FLASH_CFI_X16X32))) { info->addr_unlock1 = 0xaaa; info->addr_unlock2 = 0x555; -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 04/26] cfi_flash: Fix whitespace with casting
When casting to a pointer type, the asterisk should be attached to the type name, not separated by a space. Fix all instances where this occurs. Signed-off-by: Mario Six--- v2 -> v3: * Added proper commit message v1 -> v2: None --- drivers/mtd/cfi_flash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index e8f1739254..2dc6b09cd9 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -234,10 +234,10 @@ static void flash_make_cmd(flash_info_t *info, u32 cmd, void *cmdbuf) cword_offset = (info->portwidth-i)%info->chipwidth; #if defined(__LITTLE_ENDIAN) || defined(CONFIG_SYS_WRITE_SWAPPED_DATA) cp_offset = info->portwidth - i; - val = *((uchar*)_le + cword_offset); + val = *((uchar *)_le + cword_offset); #else cp_offset = i - 1; - val = *((uchar*) + sizeof(u32) - cword_offset - 1); + val = *((uchar *) + sizeof(u32) - cword_offset - 1); #endif cp[cp_offset] = (cword_offset >= sizeof(u32)) ? 0x00 : val; } -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 06/26] cfi_flash: Fix spacing around casts/operators
There should be spaces around operators, and no spaces between a cast and the variable its being applied to. Fix all instances where this occurs. Signed-off-by: Mario Six--- v2 -> v3: * Added proper commit message v1 -> v2: None --- drivers/mtd/cfi_flash.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index b77fd3c0a2..0d58914e44 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -231,7 +231,7 @@ static void flash_make_cmd(flash_info_t *info, u32 cmd, void *cmdbuf) uchar *cp = (uchar *) cmdbuf; for (i = info->portwidth; i > 0; i--) { - cword_offset = (info->portwidth-i)%info->chipwidth; + cword_offset = (info->portwidth - i) % info->chipwidth; #if defined(__LITTLE_ENDIAN) || defined(CONFIG_SYS_WRITE_SWAPPED_DATA) cp_offset = info->portwidth - i; val = *((uchar *)_le + cword_offset); @@ -252,7 +252,7 @@ static void print_longlong(char *str, unsigned long long data) int i; char *cp; - cp = (char *) + cp = (char *) for (i = 0; i < 8; i++) sprintf([i * 2], "%2.2x", *cp++); } @@ -512,7 +512,7 @@ static int flash_toggle(flash_info_t *info, flash_sect_t sect, break; case FLASH_CFI_64BIT: retval = ((flash_read32(addr) != flash_read32(addr)) || - (flash_read32(addr+4) != flash_read32(addr+4))); + (flash_read32(addr + 4) != flash_read32(addr + 4))); break; default: retval = 0; @@ -1212,7 +1212,7 @@ void flash_print_info(flash_info_t *info) printf("%s flash (%d x %d)", info->name, (info->portwidth << 3), (info->chipwidth << 3)); - if (info->size < 1024*1024) + if (info->size < 1024 * 1024) printf(" Size: %ld kB in %d Sectors\n", info->size >> 10, info->sector_count); else @@ -1888,7 +1888,7 @@ static void __flash_cmd_reset(flash_info_t *info) flash_write_cmd(info, 0, 0, FLASH_CMD_RESET); } void flash_cmd_reset(flash_info_t *info) - __attribute__((weak,alias("__flash_cmd_reset"))); + __attribute__((weak, alias("__flash_cmd_reset"))); static int __flash_detect_cfi(flash_info_t *info, struct cfi_qry *qry) { @@ -2035,7 +2035,7 @@ static void flash_fixup_sst(flash_info_t *info, struct cfi_qry *qry) if (info->device_id == 0x5D23 || /* SST39VF3201B */ info->device_id == 0x5C23) { /* SST39VF3202B */ /* set sector granularity to 4KB */ - info->cmd_erase_sector=0x50; + info->cmd_erase_sector = 0x50; } } @@ -2093,9 +2093,9 @@ ulong flash_get_size(phys_addr_t base, int banknum) num_erase_regions = qry.num_erase_regions; if (info->ext_addr) { - info->cfi_version = (ushort) flash_read_uchar(info, + info->cfi_version = (ushort)flash_read_uchar(info, info->ext_addr + 3) << 8; - info->cfi_version |= (ushort) flash_read_uchar(info, + info->cfi_version |= (ushort)flash_read_uchar(info, info->ext_addr + 4); } @@ -2392,7 +2392,7 @@ unsigned long flash_init(void) #ifndef CONFIG_SYS_FLASH_QUIET_TEST printf("## Unknown flash on Bank %d " "- Size = 0x%08lx = %ld MB\n", - i+1, flash_info[i].size, + i + 1, flash_info[i].size, flash_info[i].size >> 20); #endif /* CONFIG_SYS_FLASH_QUIET_TEST */ } -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/1] efi_loader: add a README.iscsi describing booting via iSCSI
On 01/25/2018 08:39 PM, Duncan Hare wrote: >> - Forwarded Message - >> From: Alexander Graf>> To: Heinrich Schuchardt > >>> The appended README explains how U-Boot and iPXE can be used >>> to boot a diskless system from an iSCSI SAN. >>> >>> The maintainer for README.efi and README.iscsi is set. >>> >>> Signed-off-by: Heinrich Schuchardt >>> --- >> +U-Boot has only a reduced set of supported network protocols. A >> major gap is >>> major gap is +the lack of a TCP stack. >> >> This is only semi-true. There is work in progress to get TCP support >> into U-Boot. The protocols on top however are still missing and using >> iPXE here is definitely a very reasonable approach. > > We are implementing a limited TCP and a wget (http 1.0) app. > It is almost ready for an test release. Selective Acknowledgment (SACK) > is under test as a final piece of the TCP stack. In which git can I find the code? > > We have noticed that omitting the http 1.0 declaration in > downloading the kernel from an nginx web server that we remove the > overhead of an http header completely. > I would prefer if the implementation were compliant with either of RFC 2616 - Hypertext Transfer Protocol -- HTTP/1.1 or RFC 1945 - Hypertext Transfer Protocol -- HTTP/1.0 You should not program to please another accommodating software but according to a standard. The key to TCP performance is supporting multiple packets in flight. Best regards Heinrich ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/4] Kbuild: support W=[N, ]err for passing '-Werror' to the compiler
Hi Masahiro, On 26.01.2018 02:09, Masahiro Yamada wrote: > Hi Daniel, > > > 2018-01-26 2:21 GMT+09:00 Daniel Schwierzeck: >> Extend the Kbuild's W=N option with an optional 'err' value. This >> will pass -Werror to the compiler to treat all warnings as errors. >> This is useful to enforce a zero-warnings policy. >> >> The 'err' value can also be combined with the numerical values >> like this: >> >> make W=1 >> make W=err >> make W=1,err >> >> Signed-off-by: Daniel Schwierzeck >> --- >> >> scripts/Makefile.extrawarn | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn >> index 1d3a570594..d8d93b7fe1 100644 >> --- a/scripts/Makefile.extrawarn >> +++ b/scripts/Makefile.extrawarn >> @@ -48,9 +48,12 @@ warning-3 += -Wswitch-default >> warning-3 += $(call cc-option, -Wpacked-bitfield-compat) >> warning-3 += $(call cc-option, -Wvla) >> >> +warning-err := -Werror >> + >> warning := $(warning-$(findstring 1, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS))) >> warning += $(warning-$(findstring 2, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS))) >> warning += $(warning-$(findstring 3, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS))) >> +warning += $(warning-$(findstring err, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS))) >> >> ifeq ("$(strip $(warning))","") >> $(error W=$(KBUILD_ENABLE_EXTRA_GCC_CHECKS) is unknown) >> -- >> 2.16.1 > > > I saw a similar patch before in linux-kbuild ML. > > > Kbuild provides a way to specify user-specific options. > See the following lines in the top-level Makefile: > > > # Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments > KBUILD_CPPFLAGS += $(KCPPFLAGS) > KBUILD_AFLAGS += $(KAFLAGS) > KBUILD_CFLAGS += $(KCFLAGS) > > > > "make W=err" is a shorthand of "make KCFLAGS=-Werror", right? > > I tend to hesitate to add another way > to do the same thing... > I didn't noticed that possibility, thanks for the pointer. I'll withdraw this patch and add a short pointer in the README instead. -- - Daniel signature.asc Description: OpenPGP digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [RFC PATCH] Allow providing default environment from file
On 24-01-2018 10:55, Rasmus Villemoes wrote: It is sometimes useful to be able to define the entire default environment in an external file. This implements a Kconfig option for allowing that. It is somewhat annoying to have two visible Kconfig options; it would probably be more user-friendly to just have the string option (with empty string obviously meaning not to use this feature). But then we'd also need a hidden CONFIG that we can use in the #ifdef in env_default.h, and I don't think one can set a def_bool based on whether a string-valued config is empty or not. I've tried to make the accepted format the same as the one the mkenvimage tool accepts. I have no idea how portable the sed script implementing the "allow embedded newlines in values" is. Nor do I know if one can expect xxd to be available. Signed-off-by: Rasmus VillemoesTested-by: Sean Nyekjaer --- Makefile | 16 env/Kconfig | 18 ++ include/env_default.h | 4 3 files changed, 38 insertions(+) diff --git a/Makefile b/Makefile index 4981a2ed6f..e5ba5213fd 100644 --- a/Makefile +++ b/Makefile @@ -423,6 +423,7 @@ endif version_h := include/generated/version_autogenerated.h timestamp_h := include/generated/timestamp_autogenerated.h +defaultenv_h := include/generated/defaultenv_autogenerated.h no-dot-config-targets := clean clobber mrproper distclean \ help %docs check% coccicheck \ @@ -1366,6 +1367,10 @@ ifeq ($(wildcard $(LDSCRIPT)),) @/bin/false endif +ifeq ($(CONFIG_DEFAULT_ENV_FROM_FILE),y) +prepare1: $(defaultenv_h) +endif + archprepare: prepare1 scripts_basic prepare0: archprepare FORCE @@ -1413,12 +1418,23 @@ define filechk_timestamp.h fi) endef +define filechk_defaultenv.h + (grep -v '^#' | \ +grep -v '^$$' | \ +tr '\n' '\0' | \ +sed -e 's/\\\x0/\n/' | \ +xxd -i ; echo ", 0x00" ; ) +endef + $(version_h): include/config/uboot.release FORCE $(call filechk,version.h) $(timestamp_h): $(srctree)/Makefile FORCE $(call filechk,timestamp.h) +$(defaultenv_h): $(CONFIG_DEFAULT_ENV_FILE:"%"=%) FORCE + $(call filechk,defaultenv.h) + # --- quiet_cmd_cpp_lds = LDS $@ cmd_cpp_lds = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) \ diff --git a/env/Kconfig b/env/Kconfig index a24370786b..1baebd743b 100644 --- a/env/Kconfig +++ b/env/Kconfig @@ -482,4 +482,22 @@ config ENV_SIZE endif +config DEFAULT_ENV_FROM_FILE + bool "Create default environment from file" + help + Normally, the default environment is automatically generated + based on the settings of various CONFIG_* options, as well + as the CONFIG_EXTRA_ENV_SETTINGS. By selecting this option, + you can instead define the entire default environment in an + external file. + +config DEFAULT_ENV_FILE + string "Path to default environment file" + depends on DEFAULT_ENV_FROM_FILE + help + The path containing the default environment. The format is + the same as accepted by the mkenvimage tool: lines + containing key=value pairs, blank lines and lines beginning + with # are ignored. + endmenu diff --git a/include/env_default.h b/include/env_default.h index b574345af2..656d202cc7 100644 --- a/include/env_default.h +++ b/include/env_default.h @@ -22,6 +22,7 @@ static char default_environment[] = { #else const uchar default_environment[] = { #endif +#ifndef CONFIG_DEFAULT_ENV_FROM_FILE #ifdefCONFIG_ENV_CALLBACK_LIST_DEFAULT ENV_CALLBACK_VAR "=" CONFIG_ENV_CALLBACK_LIST_DEFAULT "\0" #endif @@ -108,6 +109,9 @@ const uchar default_environment[] = { CONFIG_EXTRA_ENV_SETTINGS #endif "\0" +#else /* CONFIG_DEFAULT_ENV_FROM_FILE */ +#include "generated/defaultenv_autogenerated.h" +#endif #ifdef DEFAULT_ENV_INSTANCE_EMBEDDED } #endif ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 7/7] powerpc/8xx: refactorise reginfo
reginfo is redundant with some of the commands in immap.c, so move reginfo into that file and remove duplicated info. Signed-off-by: Christophe Leroy--- arch/powerpc/cpu/mpc8xx/Makefile | 1 - arch/powerpc/cpu/mpc8xx/immap.c | 20 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/cpu/mpc8xx/Makefile b/arch/powerpc/cpu/mpc8xx/Makefile index 40f38923ec..35ff18a7b3 100644 --- a/arch/powerpc/cpu/mpc8xx/Makefile +++ b/arch/powerpc/cpu/mpc8xx/Makefile @@ -12,6 +12,5 @@ obj-y += cpu_init.o obj-$(CONFIG_OF_LIBFDT) += fdt.o obj-$(CONFIG_CMD_IMMAP) += immap.o obj-y += interrupts.o -obj-$(CONFIG_CMD_REGINFO) += reginfo.o obj-y += speed.o obj-y += cache.o diff --git a/arch/powerpc/cpu/mpc8xx/immap.c b/arch/powerpc/cpu/mpc8xx/immap.c index dfe5dc2125..7059a4eb06 100644 --- a/arch/powerpc/cpu/mpc8xx/immap.c +++ b/arch/powerpc/cpu/mpc8xx/immap.c @@ -342,6 +342,26 @@ static int do_brginfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return 0; } +#ifdef CONFIG_CMD_REGINFO +void print_reginfo(void) +{ + immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR; + sit8xx_t __iomem *timers = >im_sit; + + printf("\nSystem Configuration registers\n" + "\tIMMR\t0x%08X\n", mfspr(SPRN_IMMR)); + do_siuinfo(NULL, 0, 0, NULL); + + printf("Memory Controller Registers\n"); + do_memcinfo(NULL, 0, 0, NULL); + + printf("\nSystem Integration Timers\n"); + printf("\tTBSCR\t0x%04X\tRTCSC\t0x%04X\n", + in_be16(>sit_tbscr), in_be16(>sit_rtcsc)); + printf("\tPISCR\t0x%04X\n", in_be16(>sit_piscr)); +} +#endif + /***/ U_BOOT_CMD( -- 2.13.3 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 5/7] powerpc/8xx: Change CONFIG_8xx to CONFIG_MPC8xx
CONFIG_8xx doesn't mean much outside of arch/powerpc. This patch renames it CONFIG_MPC8xx just like CONFIG_MPC85xx etc ... It also rename 8xx_immap.h to immap_8xx.h to be consistent with other file names. Signed-off-by: Christophe Leroy--- api/api_platform-powerpc.c| 2 +- arch/powerpc/Kconfig | 2 +- arch/powerpc/cpu/mpc8xx/Kconfig | 2 +- arch/powerpc/cpu/mpc8xx/immap.c | 2 +- arch/powerpc/include/asm/cache.h | 6 +++--- arch/powerpc/include/asm/global_data.h| 2 +- arch/powerpc/include/asm/{8xx_immap.h => immap_8xx.h} | 0 arch/powerpc/include/asm/iopin_8xx.h | 2 +- arch/powerpc/include/asm/ppc.h| 4 ++-- cmd/bdinfo.c | 2 +- configs/MCR3000_defconfig | 2 +- drivers/net/Kconfig | 2 +- drivers/serial/Kconfig| 2 +- drivers/spi/Kconfig | 2 +- include/asm-generic/u-boot.h | 2 +- include/commproc.h| 2 +- include/mpc8xx.h | 4 ++-- include/ppc_asm.tmpl | 6 +++--- 18 files changed, 23 insertions(+), 23 deletions(-) rename arch/powerpc/include/asm/{8xx_immap.h => immap_8xx.h} (100%) diff --git a/api/api_platform-powerpc.c b/api/api_platform-powerpc.c index 9e9bc63b2f..aae7ddee95 100644 --- a/api/api_platform-powerpc.c +++ b/api/api_platform-powerpc.c @@ -30,7 +30,7 @@ int platform_sys_info(struct sys_info *si) si->clk_bus = gd->bus_clk; si->clk_cpu = gd->cpu_clk; -#if defined(CONFIG_8xx) || defined(CONFIG_E500) || defined(CONFIG_MPC86xx) +#if defined(CONFIG_MPC8xx) || defined(CONFIG_E500) || defined(CONFIG_MPC86xx) #define bi_bar bi_immr_base #elif defined(CONFIG_MPC83xx) #define bi_bar bi_immrbar diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index b20837b473..af45cfe849 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -30,7 +30,7 @@ config MPC86xx select SYS_FSL_DDR_BE imply CMD_REGINFO -config 8xx +config MPC8xx bool "MPC8xx" select BOARD_EARLY_INIT_F imply CMD_REGINFO diff --git a/arch/powerpc/cpu/mpc8xx/Kconfig b/arch/powerpc/cpu/mpc8xx/Kconfig index 5a7db335ed..f112317376 100644 --- a/arch/powerpc/cpu/mpc8xx/Kconfig +++ b/arch/powerpc/cpu/mpc8xx/Kconfig @@ -1,5 +1,5 @@ menu "mpc8xx CPU" - depends on 8xx + depends on MPC8xx config SYS_CPU default "mpc8xx" diff --git a/arch/powerpc/cpu/mpc8xx/immap.c b/arch/powerpc/cpu/mpc8xx/immap.c index 2284979dd6..dfe5dc2125 100644 --- a/arch/powerpc/cpu/mpc8xx/immap.c +++ b/arch/powerpc/cpu/mpc8xx/immap.c @@ -12,7 +12,7 @@ #include #include -#include +#include #include #include #include diff --git a/arch/powerpc/include/asm/cache.h b/arch/powerpc/include/asm/cache.h index 0801d2c367..445a366807 100644 --- a/arch/powerpc/include/asm/cache.h +++ b/arch/powerpc/include/asm/cache.h @@ -7,7 +7,7 @@ #include /* bytes per L1 cache line */ -#if defined(CONFIG_8xx) +#if defined(CONFIG_MPC8xx) #defineL1_CACHE_SHIFT 4 #elif defined(CONFIG_PPC64BRIDGE) #define L1_CACHE_SHIFT 7 @@ -72,7 +72,7 @@ void disable_cpc_sram(void); #define L2CACHE_NONE 0x03/* NONE */ #define L2CACHE_PARITY 0x08/* Mask for L2 Cache Parity Protected bit */ -#ifdef CONFIG_8xx +#ifdef CONFIG_MPC8xx /* Cache control on the MPC8xx is provided through some additional * special purpose registers. */ @@ -139,6 +139,6 @@ static inline void wr_dc_adr(uint val) mtspr(DC_ADR, val); } #endif -#endif /* CONFIG_8xx */ +#endif /* CONFIG_MPC8xx */ #endif diff --git a/arch/powerpc/include/asm/global_data.h b/arch/powerpc/include/asm/global_data.h index 35a02b61a4..016dc19cb4 100644 --- a/arch/powerpc/include/asm/global_data.h +++ b/arch/powerpc/include/asm/global_data.h @@ -19,7 +19,7 @@ struct arch_global_data { u8 sdhc_adapter; #endif #endif -#if defined(CONFIG_8xx) +#if defined(CONFIG_MPC8xx) unsigned long brg_clk; #endif #if defined(CONFIG_CPM2) diff --git a/arch/powerpc/include/asm/8xx_immap.h b/arch/powerpc/include/asm/immap_8xx.h similarity index 100% rename from arch/powerpc/include/asm/8xx_immap.h rename to arch/powerpc/include/asm/immap_8xx.h diff --git a/arch/powerpc/include/asm/iopin_8xx.h b/arch/powerpc/include/asm/iopin_8xx.h index 15679a2db5..3b4e1b64a4 100644 --- a/arch/powerpc/include/asm/iopin_8xx.h +++ b/arch/powerpc/include/asm/iopin_8xx.h @@ -11,7 +11,7 @@ #define _ASM_IOPIN_8XX_H_ #include -#include +#include #include #ifdef __KERNEL__ diff --git a/arch/powerpc/include/asm/ppc.h b/arch/powerpc/include/asm/ppc.h index db289ed707..ec7adddc5e 100644 --- a/arch/powerpc/include/asm/ppc.h
[U-Boot] [PATCH 6/7] powerpc/8xx: get rid of the multiple PVR_ values
None of those values are used at the time being. Just keep one and call it PVR_8xx Signed-off-by: Christophe Leroy--- arch/powerpc/include/asm/processor.h | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h index baf38f8441..5dcba8cd45 100644 --- a/arch/powerpc/include/asm/processor.h +++ b/arch/powerpc/include/asm/processor.h @@ -973,10 +973,8 @@ * differentiated by the version number in the Communication Processor * Module (CPM). */ -#define PVR_8210x0050 -#define PVR_823PVR_821 -#define PVR_850PVR_821 -#define PVR_860PVR_821 +#define PVR_8xx0x0050 + #define PVR_7400 0x000C /* -- 2.13.3 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 4/7] powerpc/8xx: get rid of get_immr()
function get_immr() is almost not used and doesn't bring much added value. Just replace it with mfspr(SPRN_IMMR) at the two needed places. Signed-off-by: Christophe Leroy--- arch/powerpc/cpu/mpc8xx/cpu.c | 7 +++ arch/powerpc/cpu/mpc8xx/reginfo.c | 2 +- arch/powerpc/cpu/mpc8xx/speed.c | 3 +-- arch/powerpc/include/asm/ppc.h| 8 4 files changed, 5 insertions(+), 15 deletions(-) diff --git a/arch/powerpc/cpu/mpc8xx/cpu.c b/arch/powerpc/cpu/mpc8xx/cpu.c index 1883440db3..0eabb714d3 100644 --- a/arch/powerpc/cpu/mpc8xx/cpu.c +++ b/arch/powerpc/cpu/mpc8xx/cpu.c @@ -36,7 +36,7 @@ DECLARE_GLOBAL_DATA_PTR; static int check_CPU(long clock, uint pvr, uint immr) { - immap_t __iomem *immap = (immap_t __iomem *)(immr & 0x); + immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR; uint k; char buf[32]; @@ -90,7 +90,7 @@ static int check_CPU(long clock, uint pvr, uint immr) int checkcpu(void) { ulong clock = gd->cpu_clk; - uint immr = get_immr(0);/* Return full IMMR contents */ + uint immr = mfspr(SPRN_IMMR); /* Return full IMMR contents */ uint pvr = get_pvr(); puts("CPU: "); @@ -237,8 +237,7 @@ int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) */ unsigned long get_tbclk(void) { - uint immr = get_immr(0);/* Return full IMMR contents */ - immap_t __iomem *immap = (immap_t __iomem *)(immr & 0x); + immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR; ulong oscclk, factor, pll; if (in_be32(>im_clkrst.car_sccr) & SCCR_TBS) diff --git a/arch/powerpc/cpu/mpc8xx/reginfo.c b/arch/powerpc/cpu/mpc8xx/reginfo.c index 277d2753b2..1f6e606e52 100644 --- a/arch/powerpc/cpu/mpc8xx/reginfo.c +++ b/arch/powerpc/cpu/mpc8xx/reginfo.c @@ -22,7 +22,7 @@ void print_reginfo(void) */ printf("\nSystem Configuration registers\n" - "\tIMMR\t0x%08X\n", get_immr(0)); + "\tIMMR\t0x%08X\n", mfspr(SPRN_IMMR)); printf("\tSIUMCR\t0x%08X", in_be32(>sc_siumcr)); printf("\tSYPCR\t0x%08X\n", in_be32(>sc_sypcr)); diff --git a/arch/powerpc/cpu/mpc8xx/speed.c b/arch/powerpc/cpu/mpc8xx/speed.c index fa8f87cbc5..f8eb4a13ea 100644 --- a/arch/powerpc/cpu/mpc8xx/speed.c +++ b/arch/powerpc/cpu/mpc8xx/speed.c @@ -17,8 +17,7 @@ DECLARE_GLOBAL_DATA_PTR; */ int get_clocks(void) { - uint immr = get_immr(0);/* Return full IMMR contents */ - immap_t __iomem *immap = (immap_t __iomem *)(immr & 0x); + immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR; uint sccr = in_be32(>im_clkrst.car_sccr); uint divider = 1 << (((sccr & SCCR_DFBRG11) >> 11) * 2); diff --git a/arch/powerpc/include/asm/ppc.h b/arch/powerpc/include/asm/ppc.h index 5e0aa08be9..db289ed707 100644 --- a/arch/powerpc/include/asm/ppc.h +++ b/arch/powerpc/include/asm/ppc.h @@ -40,14 +40,6 @@ #include -#if defined(CONFIG_8xx) -static inline uint get_immr(uint mask) -{ - uint immr = mfspr(SPRN_IMMR); - - return mask ? (immr & mask) : immr; -} -#endif static inline uint get_pvr(void) { return mfspr(PVR); -- 2.13.3 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 3/7] powerpc/8xx: cleaning up watchdog
In preparation of migration to DM watchdog, clean up a bit. The 8xx watchdog really is a HW watchdog, so declare it as is then it goes through Kconfig Signed-off-by: Christophe Leroy--- arch/powerpc/Kconfig | 1 + arch/powerpc/cpu/mpc8xx/cpu.c | 20 +--- arch/powerpc/cpu/mpc8xx/cpu_init.c | 4 +--- include/configs/MCR3000.h | 2 -- include/watchdog.h | 5 - 5 files changed, 7 insertions(+), 25 deletions(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 3a2653ff0d..b20837b473 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -34,6 +34,7 @@ config 8xx bool "MPC8xx" select BOARD_EARLY_INIT_F imply CMD_REGINFO + imply HW_WATCHDOG endchoice diff --git a/arch/powerpc/cpu/mpc8xx/cpu.c b/arch/powerpc/cpu/mpc8xx/cpu.c index 1e0ea28a91..1883440db3 100644 --- a/arch/powerpc/cpu/mpc8xx/cpu.c +++ b/arch/powerpc/cpu/mpc8xx/cpu.c @@ -273,26 +273,16 @@ unsigned long get_tbclk(void) /* - */ -#if defined(CONFIG_WATCHDOG) -void watchdog_reset(void) +#if defined(CONFIG_HW_WATCHDOG) +void hw_watchdog_reset(void) { + immap_t __iomem *immr = (immap_t __iomem *)CONFIG_SYS_IMMR; int re_enable = disable_interrupts(); - reset_8xx_watchdog((immap_t __iomem *)CONFIG_SYS_IMMR); - if (re_enable) - enable_interrupts(); -} -#endif /* CONFIG_WATCHDOG */ - -#if defined(CONFIG_WATCHDOG) - -void reset_8xx_watchdog(immap_t __iomem *immr) -{ - /* -* All other boards use the MPC8xx Internal Watchdog -*/ out_be16(>im_siu_conf.sc_swsr, 0x556c); /* write magic1 */ out_be16(>im_siu_conf.sc_swsr, 0xaa39); /* write magic2 */ + if (re_enable) + enable_interrupts(); } #endif /* CONFIG_WATCHDOG */ diff --git a/arch/powerpc/cpu/mpc8xx/cpu_init.c b/arch/powerpc/cpu/mpc8xx/cpu_init.c index dc601a1297..aa5bf0d965 100644 --- a/arch/powerpc/cpu/mpc8xx/cpu_init.c +++ b/arch/powerpc/cpu/mpc8xx/cpu_init.c @@ -28,9 +28,7 @@ void cpu_init_f(immap_t __iomem *immr) out_be32(>im_siu_conf.sc_sypcr, CONFIG_SYS_SYPCR); -#if defined(CONFIG_WATCHDOG) - reset_8xx_watchdog(immr); -#endif /* CONFIG_WATCHDOG */ + WATCHDOG_RESET(); /* SIUMCR - contains debug pin configuration (11-6) */ setbits_be32(>im_siu_conf.sc_siumcr, CONFIG_SYS_SIUMCR); diff --git a/include/configs/MCR3000.h b/include/configs/MCR3000.h index 8393dc49c8..f5aeb6f1ff 100644 --- a/include/configs/MCR3000.h +++ b/include/configs/MCR3000.h @@ -60,8 +60,6 @@ #define CONFIG_LOADS_ECHO 1 /* echo on for serial download */ -#define CONFIG_WATCHDOG1 /* watchdog enabled */ - /* Miscellaneous configurable options */ #defineCONFIG_SYS_LONGHELP diff --git a/include/watchdog.h b/include/watchdog.h index 64b59f107a..52f4c506b0 100644 --- a/include/watchdog.h +++ b/include/watchdog.h @@ -72,11 +72,6 @@ int init_func_watchdog_reset(void); * Prototypes from $(CPU)/cpu.c. */ -/* MPC 8xx */ -#if defined(CONFIG_8xx) && !defined(__ASSEMBLY__) - void reset_8xx_watchdog(immap_t __iomem *immr); -#endif - #if defined(CONFIG_HW_WATCHDOG) && !defined(__ASSEMBLY__) void hw_watchdog_init(void); #endif -- 2.13.3 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot