Re: [U-Boot] [linux-sunxi] Re: [PATCH v4 13/19] sunxi: DT: A64: update board .dts files from Linux
Hi, On Tue, Mar 27, 2018 at 10:43 PM, Andre Przywarawrote: > Hi Maxime, > > thanks for the answer. > > On 27/03/18 15:30, Maxime Ripard wrote: >> Hi, >> >> On Sat, Mar 24, 2018 at 01:07:27AM +, André Przywara wrote: >>> On 23/03/18 18:14, Jagan Teki wrote: On Wed, Mar 14, 2018 at 7:27 AM, Andre Przywara wrote: > Update the .dts files for the various boards with an Allwinner A64 SoC. > This is as of v4.15-rc9, exactly Linux commit: >>> >>> >>> > > { > pinctrl-names = "default"; > pinctrl-0 = <_pins>; > - vmmc-supply = <_vcc3v3>; > + vmmc-supply = <_dcdc1>; These AXP regulator stuff need to wait until the relevant driver supported through dt >>> >>> Well, we could take the two patches I had in v3 that revert this change. >>> As mentioned before, DCDC1 is an always-on regulator anyways. >>> >>> But actually that's not our problem, as we don't define DM_REGULATORS, >>> so we will never parse those properties. >>> >>> Instead: >>> otherwise moving to DM_MMC might fail to get the regulator? [1] [1] https://patchwork.ozlabs.org/patch/887405/ >>> >>> Ah, thanks for the link, I totally missed that. >>> So as Heinrich rightfully feared in his first patch, this change - for >>> all sunxi boards - breaks most of them: The DM-MMC part of the sunxi MMC >>> driver is not ready for any other SoC than the A20: >>> a) The only compatible string it knows is "allwinner,sun5i-a13-mmc". >>> b) It assumes the old style clocks, even without checking if the >>> referenced nodes are compatible. >>> >>> So while a) is trivial to fix (U-Boot probably does not need to care >>> about the differences in the MMC controllers of the different SoCs), b) >>> is more of a beast. >>> I started looking into an easy implementation of the new clocks, >>> basically just enough to get MMC going, for the H3/H5 and A64. This >>> could be extended for other clocks once we need them. >>> But I am afraid this is not 2018.05 material anymore. >>> >>> So what do we do here? >>> >>> 1) Just switch over A20? The A20 DTs in U-Boot use the old-style clocks >>> still, so that's fine. And we postpone the DM-MMC switch for the rest >>> until we have some DM new-style clock driver? >> >> I'm not sure I'd like to do that to be honest, this sounds like >> something that will never happen. >> >>> 2) Push forward on some simple sunxi-ng MMC clock driver? >> >> That one would work for me >> >>> 3) Don't use DM_MMC at all? >> >> Given the warning that was set for the next release, I'm not sure we >> have much choice unfortunately. > > OK. So meanwhile I have something almost(TM) working: > - drivers/clk/sunxi/clk-a64.c, which is a UCLASS_CLK implementation of > the clock IDs from allwinner,sun50i-a64-ccu that we need: CLK_BUS_UARTx, > CLK_BUS_MMCx, CLK_MMCx. Their implementation is fairly simple, actually > (I did it the U-Boot way, not pulling in any super-fancy Linux code). > Porting this over to H3/H5 and other SoCs should be trivial: copy/paste > for now. We can look at how to unify this later. > - drivers/mmc/sunxi_mmc.c extended to use UCLASS_CLK clocks. This is > also not too bad, but I seem to miss a bit in here, as it times out. > Will debug this tonight. > - Cowardly dodging a proper UCLASS_RESET driver for now, instead hacking > the single bit in :-( > > That looks tight to still get into this merge window, though, at least > if we follow the usual process. You could post an initial version during the merge window, and refine it in the following two weeks? AFAIK the rules allow for it to be merged for the coming release, instead of the next. Curiously, U-boot repositories don't have -next branches. Is that a maintainer preference? Having one would help developers in a way as to not have to hunt down prerequisites and try to figure out whether they have passed review and will be merged or not, and also avoid conflicts with other to-be-queued patches. I know this takes extra effort from the maintainer to possibly rebase or manage conflicts after a new merge window has opened, as I personally manage sunxi-next for the Linux kernel to serve as sort of an integration branch for others. I'm asking is it possible to have -next, even just for sunxi. > > Keep you posted. I'm interested. IMHO we don't need full blown drivers like in Linux. We should be able to get away with selectively supporting only the resources needed for the peripherals supported / actively used in U-boot. This goes for clocks, resets, pinctrl, regulators, etc.. Regards ChenYu ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] arm: imx: Add Winbond SPI-NOR support for Advantech DMS-BA16 board
Windbond's been in the AVL list and need to enable the support Signed-off-by: Ken Lin--- configs/dms-ba16-1g_defconfig | 1 + configs/dms-ba16_defconfig| 1 + 2 files changed, 2 insertions(+) diff --git a/configs/dms-ba16-1g_defconfig b/configs/dms-ba16-1g_defconfig index 40b317093f..8008916234 100644 --- a/configs/dms-ba16-1g_defconfig +++ b/configs/dms-ba16-1g_defconfig @@ -32,6 +32,7 @@ CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_DWC_AHSATA=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_STMICRO=y +CONFIG_SPI_FLASH_WINBOND=y CONFIG_PHYLIB=y CONFIG_MXC_SPI=y CONFIG_USB=y diff --git a/configs/dms-ba16_defconfig b/configs/dms-ba16_defconfig index 3519c5275c..7803052642 100644 --- a/configs/dms-ba16_defconfig +++ b/configs/dms-ba16_defconfig @@ -31,6 +31,7 @@ CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_DWC_AHSATA=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_STMICRO=y +CONFIG_SPI_FLASH_WINBOND=y CONFIG_PHYLIB=y CONFIG_MXC_SPI=y CONFIG_USB=y -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] ARM: mx6: ddr: Add write leveling correction code
When the DDR calibration is enabled, a situation may happen that it will fail on a few select boards out of a whole production lot. In particular, after the first write leveling stage, the MPWLDECTRLx registers will contain a value 0x1nn , for nn usually being 0x7f or slightly lower. What this means is that the HW write leveling detected that the DQS rising edge on one or more bundles arrives slightly _after_ CLK and therefore when the DDR DRAM samples CLK on the DQS rising edge, the CLK signal is already high (cfr. AN4467 rev2 Figure 7 on page 18). The HW write leveling then ends up adding almost an entire cycle (thus the 0x17f) to the DQS delay, which indeed aligns it, but also triggers subsequent calibration failure in DQS gating due to this massive offset. There are two observations here: - If the MPWLDECTRLx value is corrected from 0x17f to 0x0 , then the DQS gating passes, the entire calibration passes as well and the DRAM is perfectly stable even under massive load. - When using the NXP DRAM calibrator for iMX6/7, the value 0x17f or so in MPWLDECTRx register is not there, but it is replaced by 0x0 as one would expect. Someone from NXP finally explains why, quoting [1]: " Having said all that, the DDR Stress Test does something that we do not advertise to the users. The Stress Test iself looks at the values of the MPWLDECTRL0/1 fields before reporting results, and if it sees any filed with a value greater than 200/256 delay (reported as half-cycle = 0x1 and ABS_OFFSET > 0x48), the DDR Stress test will reset the Write Leveling delay for this lane to 0x000 and not report it in the log. The reason that the DDR Stress test does this is because a delay of more than 78% a clock cycle means that the DQS edge is arriving within the JEDEC tolerence of 25% of the clock edge. In most cases, DQS is arriving < 5% tCK of the SDCLK edge in the early case, and it does not make sense to delay the DQS strobe almost a full clock cycle and add extra latency to each Write burst just to make the two edges align exactly. In this case, we are guilty of making a decision for the customer without telling them we are doing it so that we don't have to provide the above explanation to every customer. They don't need to know it. " This patch adds the correction described above, that is if the MPWLDECTRx value is over 0x148, the value is corrected back to 0x0. [1] https://community.nxp.com/thread/456246 Signed-off-by: Marek VasutCc: Stefano Babic --- arch/arm/mach-imx/mx6/ddr.c | 24 1 file changed, 24 insertions(+) diff --git a/arch/arm/mach-imx/mx6/ddr.c b/arch/arm/mach-imx/mx6/ddr.c index 43b77cfa41..6e5e40dd1a 100644 --- a/arch/arm/mach-imx/mx6/ddr.c +++ b/arch/arm/mach-imx/mx6/ddr.c @@ -85,6 +85,23 @@ static void modify_dg_result(u32 *reg_st0, u32 *reg_st1, u32 *reg_ctrl) writel(val_ctrl, reg_ctrl); } +static void correct_mpwldectr_result(void *reg) +{ + /* Limit is 200/256 of CK, which is WL_HC_DELx | 0x48. */ + const unsigned int limit = 0x148; + u32 val = readl(reg); + u32 old = val; + + if ((val & 0x17f) > limit) + val &= 0x << 16; + + if (((val >> 16) & 0x17f) > limit) + val &= 0x; + + if (old != val) + writel(val, reg); +} + int mmdc_do_write_level_calibration(struct mx6_ddr_sysinfo const *sysinfo) { struct mmdc_p_regs *mmdc0 = (struct mmdc_p_regs *)MMDC_P0_BASE_ADDR; @@ -176,6 +193,13 @@ int mmdc_do_write_level_calibration(struct mx6_ddr_sysinfo const *sysinfo) errors |= 4; } + correct_mpwldectr_result(>mpwldectrl0); + correct_mpwldectr_result(>mpwldectrl1); + if (sysinfo->dsize == 2) { + correct_mpwldectr_result(>mpwldectrl0); + correct_mpwldectr_result(>mpwldectrl1); + } + /* * User should issue MRS command to exit write leveling mode * through Load Mode Register command -- 2.16.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/1] arm: armv7: enable unaligned access
On 03/30/2018 01:36 AM, Siarhei Siamashka wrote: > On Thu, 29 Mar 2018 23:33:50 +0200 > Heinrich Schuchardtwrote: > >> We use the command bootefi to run UEFI executables like GRUB and iPXE. >> The UEFI spec requires that unaligned access is enabled if the CPU >> supports it. This is true for armv7. >> >> So we should not set bit 1 of the system control register, the alignment >> bit. >> >> Without this patch iPXE snp.efi cannot be executed on the Allwinner A20. >> >> Signed-off-by: Heinrich Schuchardt >> --- >> arch/arm/cpu/armv7/start.S | 1 - >> 1 file changed, 1 deletion(-) >> >> diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S >> index 7e2695761e..1771741119 100644 >> --- a/arch/arm/cpu/armv7/start.S >> +++ b/arch/arm/cpu/armv7/start.S >> @@ -150,7 +150,6 @@ ENTRY(cpu_init_cp15) >> mrc p15, 0, r0, c1, c0, 0 >> bic r0, r0, #0x2000 @ clear bits 13 (--V-) >> bic r0, r0, #0x0007 @ clear bits 2:0 (-CAM) >> -orr r0, r0, #0x0002 @ set bit 1 (--A-) Align >> orr r0, r0, #0x0800 @ set bit 11 (Z---) BTB >> #ifdef CONFIG_SYS_ICACHE_OFF >> bic r0, r0, #0x1000 @ clear bit 12 (I) I-cache > > Can you postpone flipping this bit until the very moment when you > are about to start your UEFI executable? > > The main reason against setting this bit for the whole U-Boot > globally is that a lot of common code in U-Boot can be run on > different CPU architectures, including those which don't > support unaligned memory accesses (ARMv5, MIPS, ...). This > is a maintenance nightmare. Because the people, who test their > patches only on ARMv7 hardware, will unintentionally keep > breaking other architectures. > Hello Siarhei, we could clear the bit when the bootefi command is invoked. Best regards Heinrich ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/1] arm: armv7: enable unaligned access
On Thu, 29 Mar 2018 23:33:50 +0200 Heinrich Schuchardtwrote: > We use the command bootefi to run UEFI executables like GRUB and iPXE. > The UEFI spec requires that unaligned access is enabled if the CPU > supports it. This is true for armv7. > > So we should not set bit 1 of the system control register, the alignment > bit. > > Without this patch iPXE snp.efi cannot be executed on the Allwinner A20. > > Signed-off-by: Heinrich Schuchardt > --- > arch/arm/cpu/armv7/start.S | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S > index 7e2695761e..1771741119 100644 > --- a/arch/arm/cpu/armv7/start.S > +++ b/arch/arm/cpu/armv7/start.S > @@ -150,7 +150,6 @@ ENTRY(cpu_init_cp15) > mrc p15, 0, r0, c1, c0, 0 > bic r0, r0, #0x2000 @ clear bits 13 (--V-) > bic r0, r0, #0x0007 @ clear bits 2:0 (-CAM) > - orr r0, r0, #0x0002 @ set bit 1 (--A-) Align > orr r0, r0, #0x0800 @ set bit 11 (Z---) BTB > #ifdef CONFIG_SYS_ICACHE_OFF > bic r0, r0, #0x1000 @ clear bit 12 (I) I-cache Can you postpone flipping this bit until the very moment when you are about to start your UEFI executable? The main reason against setting this bit for the whole U-Boot globally is that a lot of common code in U-Boot can be run on different CPU architectures, including those which don't support unaligned memory accesses (ARMv5, MIPS, ...). This is a maintenance nightmare. Because the people, who test their patches only on ARMv7 hardware, will unintentionally keep breaking other architectures. -- Best regards, Siarhei Siamashka ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/3] pci: Don't use pci_indirect when DM is active
+Bin On 28 March 2018 at 20:40, Mario Sixwrote: > Declaration of indirect PCI bridges is not compatible with DM: Both > define PCI operations, but in different ways. Hence, don't use indirect > bridges if DM is active. > > Signed-off-by: Mario Six > --- > drivers/pci/pci_indirect.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Simon Glass ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] gpio: uclass: Fix debug string
On 28 March 2018 at 20:39, Mario Sixwrote: > A debug string still has the old name of a function being called; update > it. > > Signed-off-by: Mario Six > --- > drivers/gpio/gpio-uclass.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Simon Glass ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 3/3] core: Add dev_{disable,enable}_by_path
Hi Mario, On 28 March 2018 at 20:37, Mario Sixwrote: > We cannot use device structures to disable devices, since getting > them with the API functions would bind and activate the device, which > would fail if the underlying device does not exist. > > Hence, add a function to disable devices by path in a live device tree. What is the use case here? Is it to disable something after it has already been bound / probed? Why can this not be done in the device tree before U-Boot starts? Also this needs a test. > > Signed-off-by: Mario Six > --- > drivers/core/device.c | 36 > include/dm/device.h | 20 > 2 files changed, 56 insertions(+) > > diff --git a/drivers/core/device.c b/drivers/core/device.c > index 940a153c58..c627453bb9 100644 > --- a/drivers/core/device.c > +++ b/drivers/core/device.c > @@ -724,3 +724,39 @@ bool of_machine_is_compatible(const char *compat) > > return !fdt_node_check_compatible(fdt, 0, compat); > } > + > +#ifdef CONFIG_OF_LIVE > +int dev_disable_by_path(const char *path) > +{ > + ofnode node = np_to_ofnode(of_find_node_by_path(path)); Please see ofnode_path() > + struct udevice *dev = ofnode_dev(node); > + int res; > + > + res = device_remove(dev, DM_REMOVE_NORMAL); > + if (res) > + return res; > + > + res = device_unbind(dev); > + if (res) > + return res; > + > + return ofnode_disable(node); > +} > + > +int dev_enable_by_path(const char *path) > +{ > + ofnode node = np_to_ofnode(of_find_node_by_path(path)); > + ofnode pnode = ofnode_get_parent(node); > + struct udevice *parent = ofnode_dev(pnode); > + int res; > + > + if (!parent) > + return -EINVAL; > + > + res = ofnode_enable(node); > + if (res) > + return res; > + > + return lists_bind_fdt(parent, node, NULL); > +} > +#endif /* CONFIG_OF_LIVE */ > diff --git a/include/dm/device.h b/include/dm/device.h > index 7786b1cf4e..f55907966a 100644 > --- a/include/dm/device.h > +++ b/include/dm/device.h > @@ -586,6 +586,26 @@ bool device_is_compatible(struct udevice *dev, const > char *compat); > */ > bool of_machine_is_compatible(const char *compat); > > +#ifdef CONFIG_OF_LIVE > + > +/** > + * dev_disable_by_path() - Disable a device given its device tree path > + * > + * @path: The device tree path identifying the device to be disabled > + * @return 0 on success, -ve on error > + */ > +int dev_disable_by_path(const char *path); > + > +/** > + * dev_enable_by_path() - Enable a device given its device tree path > + * > + * @path: The device tree path identifying the device to be enabled > + * @return 0 on success, -ve on error > + */ > +int dev_enable_by_path(const char *path); > + > +#endif /* CONFIG_OF_LIVE */ > + > /** > * device_is_on_pci_bus - Test if a device is on a PCI bus > * > -- > 2.16.1 > Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 06/19] tpm: add macros for TPMv2 commands
Hi Miquel, On 29 March 2018 at 15:43, Miquel Raynalwrote: > TPM commands are much easier to handle with these macros that will > transform words or integers into byte string. This way, there is no need > to call pack_byte_string() while all variable length in a command are > known (and at must 4 bytes, which is a lot of them). > > Signed-off-by: Miquel Raynal > --- > lib/tpm.c | 6 ++ > 1 file changed, 6 insertions(+) > > diff --git a/lib/tpm.c b/lib/tpm.c > index 38b76b4961..2b329145be 100644 > --- a/lib/tpm.c > +++ b/lib/tpm.c > @@ -15,6 +15,12 @@ > /* Internal error of TPM command library */ > #define TPM_LIB_ERROR ((uint32_t)~0u) > > +/* To make strings of commands more easily */ > +#define __MSB(x) ((x) >> 8) > +#define __LSB(x) ((x) & 0xFF) > +#define U16_TO_ARRAY(x) __MSB(x), __LSB(x) > +#define U32_TO_ARRAY(x) U16_TO_ARRAY((x) >> 16), U16_TO_ARRAY((x) & 0x) > + > /* Global boolean to discriminate TPMv2.x from TPMv1.x functions */ > static bool is_tpmv2; > > -- > 2.14.1 > See my later comments about these macros. Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/3] dm: Add migration plan for CONFIG_BLK
Hi Jagan, On 28 March 2018 at 02:04, Jagan Tekiwrote: > On Mon, Sep 4, 2017 at 9:57 PM, wrote: >> Hi Tom, >> >> On 7 August 2017 at 09:39, Tom Rini wrote: >>> On Sat, Aug 05, 2017 at 03:45:53PM -0600, Simon Glass wrote: >>> The CONFIG_BLK conversion involves quite invasive changes in the U-Boot code, with #ifdefs and different code paths. We should try to move over to this soon so we can drop the old code. > > I hope this will applicable to SPL too? > > If so, we are having SPL size issues with few Allwinner families, if > enable SPL_DM any suggestions? I don't think we can require BLK for SPL / TPL, or even DM for that matter. We should use it when size permits. Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/2] dm: pci: Check board information pointer in decode_regions()
On 27 March 2018 at 15:46, Bin Mengwrote: > PCI enumeration may happen very early on an x86 board. The board > information pointer should have been checked in decode_regions() > as its space may not be allocated yet. > > With this commit, Intel Galileo board boots again. > > Fixes: 664758c ("pci: Fix decode regions for memory banks") > Signed-off-by: Bin Meng > --- > > drivers/pci/pci-uclass.c | 3 +++ > 1 file 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] watchdog: Fix Kconfig alignment for WDT_SANDBOX
On 28 March 2018 at 18:57, Michal Simekwrote: > Fix Kconfig alignment which should be . > > Signed-off-by: Michal Simek > --- > > drivers/watchdog/Kconfig | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > Reviewed-by: Simon Glass ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/3] core: Add function to get device for ofnode
Hi Mario, On 28 March 2018 at 20:37, Mario Sixwrote: > It's sometimes useful to get the device associated with a given ofnode. > Implement a function to implement this lookup operation. Where would you use this? Can you not use phandles to find the device? Or uclass_get_device_by_ofnode() ? > > Signed-off-by: Mario Six > --- > drivers/core/ofnode.c | 15 +++ > include/dm/ofnode.h | 8 > 2 files changed, 23 insertions(+) > > diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c > index 4e4532651f..ca002063b3 100644 > --- a/drivers/core/ofnode.c > +++ b/drivers/core/ofnode.c > @@ -16,6 +16,21 @@ > #include > #include > > +struct udevice *ofnode_dev(ofnode node) Can you please add a test for this? This seems like an internal function since it does not probe the device. So how about putting it in device.h: device_get_by_ofnode() - does probe the device it returns device_find_by_ofnode() - doesn't probe > +{ > + struct uclass *uc; > + struct udevice *dev; > + > + list_for_each_entry(uc, >uclass_root, sibling_node) { > + list_for_each_entry(dev, >dev_head, uclass_node) { > + if (ofnode_equal(dev_ofnode(dev), node)) > + return dev; > + } > + } > + > + return NULL; > +} > + > int ofnode_read_u32(ofnode node, const char *propname, u32 *outp) > { > assert(ofnode_valid(node)); > diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h > index 0d008404f9..aec205eb80 100644 > --- a/include/dm/ofnode.h > +++ b/include/dm/ofnode.h > @@ -193,6 +193,14 @@ static inline ofnode ofnode_null(void) > return node; > } > > +/** > + * ofnode_dev() - Get the device associated with a given ofnode > + * > + * @node: valid node reference to get the corresponding device for > + * @return a pointer to the udevice if OK, NULL on error > + */ > +struct udevice *ofnode_dev(ofnode node); > + > /** > * ofnode_read_u32() - Read a 32-bit integer from a property > * > -- > 2.16.1 > Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 2/3] core: Add functions to set properties in live-tree
Hi Mario, On 28 March 2018 at 20:37, Mario Sixwrote: > Implement a set of functions to manipulate properties in a live device > tree: > > * ofnode_set_property() to set generic properties of a node > * ofnode_write_string() to set string properties of a node > * ofnode_enable() to enable a node > * ofnode_disable() to disable a node > Please add a test for these functions. > Signed-off-by: Mario Six > --- > drivers/core/ofnode.c | 58 > +++ > include/dm/ofnode.h | 49 +++ > 2 files changed, 107 insertions(+) > > diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c > index ca002063b3..90d05aa559 100644 > --- a/drivers/core/ofnode.c > +++ b/drivers/core/ofnode.c > @@ -699,3 +699,61 @@ u64 ofnode_translate_address(ofnode node, const fdt32_t > *in_addr) > else > return fdt_translate_address(gd->fdt_blob, > ofnode_to_offset(node), in_addr); > } > + > +#ifdef CONFIG_OF_LIVE Is this needed? > +int ofnode_set_property(ofnode node, const char *propname, int len, > + const void *value) > +{ > + const struct device_node *np = ofnode_to_np(node); > + struct property *pp; > + struct property *new; > + > + if (!np) > + return -EINVAL; > + > + for (pp = np->properties; pp; pp = pp->next) { > + if (strcmp(pp->name, propname) == 0) { > + /* Property exists -> change value */ > + pp->value = (void *)value; > + pp->length = len; > + return 0; > + } > + } > + > + /* Property does not exist -> append new property */ > + new = malloc(sizeof(struct property)); > + > + new->name = strdup(propname); > + new->value = malloc(len); > + memcpy(new->value, value, len); > + new->length = len; > + new->next = NULL; > + > + pp->next = new; > + > + return 0; > +} > + > +int ofnode_write_string(ofnode node, const char *propname, const char *value) > +{ > + assert(ofnode_valid(node)); What does this function do if livetree is not enabled? > + debug("%s: %s = %s", __func__, propname, value); > + > + return ofnode_set_property(node, propname, strlen(value) + 1, value); > +} > + > +int ofnode_enable(ofnode node) > +{ > + assert(ofnode_valid(node)); > + > + return ofnode_write_string(node, "status", "okay"); > +} > + > +int ofnode_disable(ofnode node) > +{ > + assert(ofnode_valid(node)); > + > + return ofnode_write_string(node, "status", "disable"); > +} > + > +#endif > diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h > index aec205eb80..e82ebf19c5 100644 > --- a/include/dm/ofnode.h > +++ b/include/dm/ofnode.h > @@ -689,4 +689,53 @@ int ofnode_read_resource_byname(ofnode node, const char > *name, > * @return the translated address; OF_BAD_ADDR on error > */ > u64 ofnode_translate_address(ofnode node, const fdt32_t *in_addr); > + > +#ifdef CONFIG_OF_LIVE > + > +/** > + * ofnode_set_property() - Set a property of a ofnode > + * > + * @node: The node for whose property should be set > + * @propname: The name of the property to set > + * @len: The length of the new value of the property > + * @value: The new value of the property > + * @return 0 if successful, -ve on error > + */ > +int ofnode_set_property(ofnode node, const char *propname, int len, > + const void *value); We should think about consistency here. Maybe ofnode_write_prop()? > + > +/** > + * ofnode_write_string() - Set a string property of a ofnode > + * > + * @node: The node for whose string property should be set > + * @propname: The name of the string property to set > + * @value: The new value of the string property > + * @return 0 if successful, -ve on error > + */ > +int ofnode_write_string(ofnode node, const char *propname, const char > *value); > + > +/** > + * ofnode_enable() - Enable a device tree node given by its ofnode > + * > + * This function effectively sets the node's "status" property to "okay", > hence > + * making it available for driver model initialization. > + * > + * @node: The node to enable > + * @return 0 if successful, -ve on error > + */ > +int ofnode_enable(ofnode node); > + > +/** > + * ofnode_disable() - Disable a device tree node given by its ofnode > + * > + * This function effectively sets the node's "status" property to "disable", > + * hence stopping it from being picked up by driver model initialization. > + * > + * @node: The node to disable > + * @return 0 if successful, -ve on error > + */ > +int ofnode_disable(ofnode node); Would it be OK to have one function like ofnode_set_enabled(ofnode node, bool enable) ? Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de
Re: [U-Boot] [PATCH v2 11/19] tpm: add TPM2_Clear command support
Hi Miquel, On 29 March 2018 at 15:43, Miquel Raynalwrote: > Add support for the TPM2_Clear command. > > Change the command file and the help accordingly. > > Signed-off-by: Miquel Raynal > --- > cmd/tpm.c | 29 ++--- > cmd/tpm_test.c | 6 +++--- > include/tpm.h | 21 + > lib/tpm.c | 42 ++ > 4 files changed, 84 insertions(+), 14 deletions(-) > > diff --git a/cmd/tpm.c b/cmd/tpm.c > index fc9ef9d4a3..32921e1a70 100644 > --- a/cmd/tpm.c > +++ b/cmd/tpm.c > @@ -454,6 +454,29 @@ static int do_tpm_init(cmd_tbl_t *cmdtp, int flag, > return report_return_code(tpm_init()); > } > > +static int do_tpm_force_clear(cmd_tbl_t *cmdtp, int flag, > + int argc, char * const argv[]) > +{ > + u32 handle = 0; > + const char *pw = (argc < 3) ? NULL : argv[2]; > + const ssize_t pw_sz = pw ? strlen(pw) : 0; > + > + if (argc < 2 || argc > 3) > + return CMD_RET_USAGE; > + > + if (pw_sz > TPM2_DIGEST_LENGTH) > + return -EINVAL; > + > + if (!strcasecmp("TPM2_RH_LOCKOUT", argv[1])) > + handle = TPM2_RH_LOCKOUT; > + else if (!strcasecmp("TPM2_RH_PLATFORM", argv[1])) > + handle = TPM2_RH_PLATFORM; > + else > + return CMD_RET_USAGE; > + > + return report_return_code(tpm_force_clear(handle, pw, pw_sz)); > +} > + > #define TPM_COMMAND_NO_ARG(cmd)\ > static int do_##cmd(cmd_tbl_t *cmdtp, int flag,\ > int argc, char * const argv[]) \ > @@ -465,7 +488,6 @@ static int do_##cmd(cmd_tbl_t *cmdtp, int flag, > \ > > TPM_COMMAND_NO_ARG(tpm_self_test_full) > TPM_COMMAND_NO_ARG(tpm_continue_self_test) > -TPM_COMMAND_NO_ARG(tpm_force_clear) > TPM_COMMAND_NO_ARG(tpm_physical_enable) > TPM_COMMAND_NO_ARG(tpm_physical_disable) > > @@ -951,8 +973,9 @@ U_BOOT_CMD(tpm, CONFIG_SYS_MAXARGS, 1, do_tpm, > " physical_set_deactivated 0|1\n" > "- Set deactivated flag.\n" > "Admin Ownership Commands:\n" > -" force_clear\n" > -"- Issue TPM_ForceClear command.\n" > +" force_clear []\n" > +"- Issue TPM_[Force]Clear command, with one of (TPMv2 only):\n" > +" * TPM2_RH_LOCKOUT, TPM2_RH_PLATFORM.\n" > " tsc_physical_presence flags\n" > "- Set TPM device's Physical Presence flags to .\n" > "The Capability Commands:\n" > diff --git a/cmd/tpm_test.c b/cmd/tpm_test.c > index 37ad2ff33d..da40dbc423 100644 > --- a/cmd/tpm_test.c > +++ b/cmd/tpm_test.c > @@ -176,7 +176,7 @@ static int test_fast_enable(void) > TPM_CHECK(tpm_get_flags(, , NULL)); > printf("\tdisable is %d, deactivated is %d\n", disable, deactivated); > for (i = 0; i < 2; i++) { > - TPM_CHECK(tpm_force_clear()); > + TPM_CHECK(tpm_force_clear(0, NULL, 0)); > TPM_CHECK(tpm_get_flags(, , NULL)); > printf("\tdisable is %d, deactivated is %d\n", disable, >deactivated); > @@ -458,7 +458,7 @@ static int test_write_limit(void) > TPM_CHECK(TlclStartupIfNeeded()); > TPM_CHECK(tpm_self_test_full()); > TPM_CHECK(tpm_tsc_physical_presence(PRESENCE)); > - TPM_CHECK(tpm_force_clear()); > + TPM_CHECK(tpm_force_clear(0, NULL, 0)); > TPM_CHECK(tpm_physical_enable()); > TPM_CHECK(tpm_physical_set_deactivated(0)); > > @@ -477,7 +477,7 @@ static int test_write_limit(void) > } > > /* Reset write count */ > - TPM_CHECK(tpm_force_clear()); > + TPM_CHECK(tpm_force_clear(0, NULL, 0)); > TPM_CHECK(tpm_physical_enable()); > TPM_CHECK(tpm_physical_set_deactivated(0)); > > diff --git a/include/tpm.h b/include/tpm.h > index 38d7cb899d..2f1712 100644 > --- a/include/tpm.h > +++ b/include/tpm.h > @@ -43,13 +43,23 @@ enum tpm_startup_type { > }; > > enum tpm2_startup_types { > - TPM2_SU_CLEAR = 0x, > - TPM2_SU_STATE = 0x0001, > + TPM2_SU_CLEAR = 0x, > + TPM2_SU_STATE = 0x0001, > +}; > + > +enum tpm2_handles { Please add comment to enum > + TPM2_RH_OWNER = 0x4001, > + TPM2_RS_PW = 0x4009, > + TPM2_RH_LOCKOUT = 0x400A, > + TPM2_RH_ENDORSEMENT = 0x400B, > + TPM2_RH_PLATFORM= 0x400C, > }; > > enum tpm2_command_codes { > TPM2_CC_STARTUP = 0x0144, > TPM2_CC_SELF_TEST = 0x0143, > + TPM2_CC_CLEAR = 0x0126, > + TPM2_CC_CLEARCONTROL= 0x0127, > TPM2_CC_GET_CAPABILITY = 0x017A, > TPM2_CC_PCR_READ= 0x017E, > TPM2_CC_PCR_EXTEND = 0x0182, > @@ -567,11 +577,14 @@ uint32_t tpm_tsc_physical_presence(uint16_t presence); > uint32_t tpm_read_pubek(void *data, size_t count); > >
Re: [U-Boot] [PATCH 1/3] drivers: Add OSD uclass
Hi Mario, On 28 March 2018 at 20:39, Mario Sixwrote: > Some devices offer a text-based OSD (on-screen display) that can be > programmatically controlled (i.e. text displayed on). > > Add a uclass to support such devices. > > Signed-off-by: Mario Six > --- > drivers/video/Kconfig| 8 +++ > drivers/video/Makefile | 2 + > drivers/video/video_osd-uclass.c | 47 + > include/dm/uclass-id.h | 1 + > include/video_osd.h | 145 > +++ > 5 files changed, 203 insertions(+) > create mode 100644 drivers/video/video_osd-uclass.c > create mode 100644 include/video_osd.h Please add a sandbox driver and simple test for this. All uclasses should have this. > > diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig > index 2fc0defcd0..da60bbe692 100644 > --- a/drivers/video/Kconfig > +++ b/drivers/video/Kconfig > @@ -660,4 +660,12 @@ config VIDEO_DT_SIMPLEFB > The video output is initialized by U-Boot, and kept by the > kernel. > > +config OSD > + bool "Enable OSD support" > + depends on DM > + default n > + help > + This supports drivers that provide a OSD (on-screen display), which > + is a (usually text-oriented) graphics buffer to show information on > + a display. > endmenu > diff --git a/drivers/video/Makefile b/drivers/video/Makefile > index dfafe08fc5..209d5e3a75 100644 > --- a/drivers/video/Makefile > +++ b/drivers/video/Makefile > @@ -58,5 +58,7 @@ obj-${CONFIG_EXYNOS_FB} += exynos/ > obj-${CONFIG_VIDEO_ROCKCHIP} += rockchip/ > obj-${CONFIG_VIDEO_STM32} += stm32/ > > +obj-${CONFIG_OSD} += video_osd-uclass.o > + > obj-y += bridge/ > obj-y += sunxi/ > diff --git a/drivers/video/video_osd-uclass.c > b/drivers/video/video_osd-uclass.c > new file mode 100644 > index 00..b6dd7e59b1 > --- /dev/null > +++ b/drivers/video/video_osd-uclass.c > @@ -0,0 +1,47 @@ > +/* > + * (C) Copyright 2017 > + * Mario Six, Guntermann & Drunck GmbH, mario@gdsys.cc > + * > + * SPDX-License-Identifier:GPL-2.0+ > + */ > + > +#include > +#include > +#include > + > +int video_osd_get_data(struct udevice *dev, void *data) > +{ > + struct video_osd_ops *ops = video_osd_get_ops(dev); > + > + return ops->get_data(dev, data); > +} > + > +int video_osd_set_mem(struct udevice *dev, uint x, uint y, u8 *buf, > + size_t buflen, uint count) > +{ > + struct video_osd_ops *ops = video_osd_get_ops(dev); > + > + return ops->set_mem(dev, x, y, buf, buflen, count); > +} > + > +int video_osd_set_size(struct udevice *dev, uint x, uint y) > +{ > + struct video_osd_ops *ops = video_osd_get_ops(dev); > + > + return ops->set_size(dev, x, y); > +} > + > +int video_osd_print(struct udevice *dev, uint x, uint y, ulong color, > + char *text) > +{ > + struct video_osd_ops *ops = video_osd_get_ops(dev); > + > + return ops->print(dev, x, y, color, text); > +} > + > +UCLASS_DRIVER(video_osd) = { > + .id = UCLASS_VIDEO_OSD, > + .name = "video_osd", > + .flags = DM_UC_FLAG_SEQ_ALIAS, > +}; > + > diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h > index 07fabc3ce6..685f22550a 100644 > --- a/include/dm/uclass-id.h > +++ b/include/dm/uclass-id.h > @@ -89,6 +89,7 @@ enum uclass_id { > UCLASS_VIDEO, /* Video or LCD device */ > UCLASS_VIDEO_BRIDGE,/* Video bridge, e.g. DisplayPort to LVDS */ > UCLASS_VIDEO_CONSOLE, /* Text console driver for video device */ > + UCLASS_VIDEO_OSD, /* On-screen displays */ please use singular > UCLASS_WDT, /* Watchdot Timer driver */ > > UCLASS_COUNT, > diff --git a/include/video_osd.h b/include/video_osd.h > new file mode 100644 > index 00..1ab5ff9b21 > --- /dev/null > +++ b/include/video_osd.h > @@ -0,0 +1,145 @@ > +/* > + * (C) Copyright 2017 > + * Mario Six, Guntermann & Drunck GmbH, mario@gdsys.cc > + * > + * SPDX-License-Identifier:GPL-2.0+ > + */ > + > +#ifndef _VIDEO_OSD_H_ > +#define _VIDEO_OSD_H_ > + > +/** > + * struct video_osd_ops - driver operations for OSD uclass > + * Please add a general description of what this uclass is and how it works > + * Drivers should support these operations unless otherwise noted. These > + * operations are intended to be used by uclass code, not directly from > + * other code. > + */ > +struct video_osd_ops { > + /** > +* get_data() - Get information about a OSD instance > +* > +* A OSD instance may keep some internal data about itself. This > +* function can be used to access this data. How big is the data? What does it contain? Should pass in the size of the buffer I think. > +* > +* @dev:OSD instance to query. > +* @data: Pointer to a buffer
Re: [U-Boot] [PATCH v2 09/19] tpm: add TPM2_Startup command support
Hi Miquel, On 29 March 2018 at 15:43, Miquel Raynalwrote: > Add support for the TPM2_Startup command. > > Change the command file and the help accordingly. > > Signed-off-by: Miquel Raynal > --- > cmd/tpm.c | 9 +++-- > include/tpm.h | 26 +- > lib/tpm.c | 35 +-- > 3 files changed, 57 insertions(+), 13 deletions(-) > > diff --git a/cmd/tpm.c b/cmd/tpm.c > index 3e2bb3b118..fc9ef9d4a3 100644 > --- a/cmd/tpm.c > +++ b/cmd/tpm.c > @@ -255,6 +255,10 @@ static int do_tpm_startup(cmd_tbl_t *cmdtp, int flag, > mode = TPM_ST_STATE; > } else if (!strcasecmp("TPM_ST_DEACTIVATED", argv[1])) { > mode = TPM_ST_DEACTIVATED; > + } else if (!strcasecmp("TPM2_SU_CLEAR", argv[1])) { > + mode = TPM2_SU_CLEAR; > + } else if (!strcasecmp("TPM2_SU_STATE", argv[1])) { > + mode = TPM2_SU_STATE; > } else { > printf("Couldn't recognize mode string: %s\n", argv[1]); > return CMD_RET_FAILURE; > @@ -929,8 +933,9 @@ U_BOOT_CMD(tpm, CONFIG_SYS_MAXARGS, 1, do_tpm, > " is one of TPM1 (default) or TPM2. This choice impacts the > way\n" > " other functions will behave.\n" > " startup mode\n" > -"- Issue TPM_Starup command. is one of TPM_ST_CLEAR,\n" > -" TPM_ST_STATE, and TPM_ST_DEACTIVATED.\n" > +"- Issue TPM_Startup command. is one of:\n" > +" * TPM_ST_CLEAR, TPM_ST_STATE, TPM_ST_DEACTIVATED for TPMv1.x.\n" > +" * TPM2_SU_CLEAR, TPM2_SU_STATE, for TPMv2.x.\n" > "Admin Testing Commands:\n" > " self_test_full\n" > "- Test all of the TPM capabilities.\n" > diff --git a/include/tpm.h b/include/tpm.h > index 1a60ef5b36..ba71bac885 100644 > --- a/include/tpm.h > +++ b/include/tpm.h > @@ -26,6 +26,11 @@ enum tpm_duration { > TPM_DURATION_COUNT, > }; > > +enum tpm2_structures { Please add comments for these. > + TPM2_ST_NO_SESSIONS = 0x8001, > + TPM2_ST_SESSIONS= 0x8002, > +}; > + > enum tpm_startup_type { > TPM_ST_CLEAR= 0x0001, > TPM_ST_STATE= 0x0002, > @@ -37,6 +42,25 @@ enum tpm2_startup_types { > TPM2_SU_STATE = 0x0001, > }; > > +enum tpm2_command_codes { > + TPM2_CC_STARTUP = 0x0144, > + TPM2_CC_SELF_TEST = 0x0143, > + TPM2_CC_GET_CAPABILITY = 0x017A, > + TPM2_CC_PCR_READ= 0x017E, > + TPM2_CC_PCR_EXTEND = 0x0182, > +}; > + > +enum tpm2_return_codes { > + TPM2_RC_SUCCESS = 0x, > + TPM2_RC_HASH= 0x0083, /* RC_FMT1 */ > + TPM2_RC_HANDLE = 0x008B, > + TPM2_RC_INITIALIZE = 0x0100, /* RC_VER1 */ > + TPM2_RC_DISABLED= 0x0120, > + TPM2_RC_TESTING = 0x090A, /* RC_WARN */ > + TPM2_RC_REFERENCE_H0= 0x0910, > + TPM2_RC_LOCKOUT = 0x0921, > +}; > + > enum tpm_physical_presence { > TPM_PHYSICAL_PRESENCE_HW_DISABLE= 0x0200, > TPM_PHYSICAL_PRESENCE_CMD_DISABLE = 0x0100, > @@ -445,7 +469,7 @@ int tpm_get_specification(void); > * @param mode TPM startup mode > * @return return code of the operation > */ > -uint32_t tpm_startup(enum tpm_startup_type mode); > +int tpm_startup(enum tpm_startup_type mode); How come the change to an int? It's fine, I just want to understand it. > > /** > * Issue a TPM_SelfTestFull command. > diff --git a/lib/tpm.c b/lib/tpm.c > index c0fbba86ff..0c57ef8dc7 100644 > --- a/lib/tpm.c > +++ b/lib/tpm.c > @@ -310,20 +310,35 @@ int tpm_init(void) > return tpm_open(dev); > } > > -uint32_t tpm_startup(enum tpm_startup_type mode) > +int tpm_startup(enum tpm_startup_type mode) > { > - const uint8_t command[12] = { > - 0x0, 0xc1, 0x0, 0x0, 0x0, 0xc, 0x0, 0x0, 0x0, 0x99, 0x0, 0x0, > + const u8 command_v1[12] = { > + U16_TO_ARRAY(0xc1), > + U32_TO_ARRAY(12), > + U32_TO_ARRAY(0x99), > + U16_TO_ARRAY(mode), > }; > - const size_t mode_offset = 10; > - uint8_t buf[COMMAND_BUFFER_SIZE]; > + const u8 command_v2[12] = { > + U16_TO_ARRAY(TPM2_ST_NO_SESSIONS), > + U32_TO_ARRAY(12), > + U32_TO_ARRAY(TPM2_CC_STARTUP), > + U16_TO_ARRAY(mode), > + }; > + int ret; > + > + if (!is_tpmv2) > + return tpm_sendrecv_command(command_v1, NULL, NULL); > + > + ret = tpm_sendrecv_command(command_v2, NULL, NULL); This doesn't seem better (than the pack_byte thing) to me. What is the benefit? > > - if (pack_byte_string(buf, sizeof(buf), "sw", > - 0, command, sizeof(command), > - mode_offset, mode)) > - return TPM_LIB_ERROR; > + /* > +* Note TPMv2: STARTUP command
Re: [U-Boot] [PATCH v2 18/19] tpm: add PCR authentication commands support
Hi Miquel, On 29 March 2018 at 15:44, Miquel Raynalwrote: > Add support for the TPM2_PCR_SetAuthPolicy and > TPM2_PCR_SetAuthValue commands. > > Change the command file and the help accordingly. > > Note: These commands could not be tested because the TPMs available > do not support them, however they could be useful for someone else. > The user is warned by the command help. You should be able to test them by adding sandbox support. > > Signed-off-by: Miquel Raynal > --- > cmd/tpm.c | 49 +++ > include/tpm.h | 29 > lib/tpm.c | 106 > ++ > 3 files changed, 184 insertions(+) > Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 3/3] cmd: Add osd commands
Hi Mario, On 28 March 2018 at 20:39, Mario Sixwrote: > Add command to query information from and write text to IHS OSDs. > > Signed-off-by: Mario Six > --- > cmd/Kconfig | 16 +++ > cmd/Makefile | 1 + > cmd/osd.c| 366 > +++ > 3 files changed, 383 insertions(+) > create mode 100644 cmd/osd.c > > diff --git a/cmd/Kconfig b/cmd/Kconfig > index 136836d146..0d60051960 100644 > --- a/cmd/Kconfig > +++ b/cmd/Kconfig > @@ -846,6 +846,22 @@ config CMD_ONENAND > and erasing blocks. It allso provides a way to show and change > bad blocks, and test the device. > > +config CMD_OSD > + bool "osd" > + help > + Enable the 'osd' command which allows to query information from and > + write text data to a OSD. Please expand help. E.g. what is an OSD? > + > +if CMD_OSD > + > +config GDSYS_LEGACY_OSD_CMDS > + bool "Use legacy gdsys-specific commands" > + help > + Use the 'osdw', 'osdp', and 'osdsize' legacy commands required by > + gdsys devices. > + > +endif > + > config CMD_PART > bool "part" > select PARTITION_UUIDS > diff --git a/cmd/Makefile b/cmd/Makefile > index 9a358e4801..d3f7522700 100644 > --- a/cmd/Makefile > +++ b/cmd/Makefile > @@ -61,6 +61,7 @@ obj-$(CONFIG_CMD_FS_GENERIC) += fs.o > obj-$(CONFIG_CMD_FUSE) += fuse.o > obj-$(CONFIG_CMD_GETTIME) += gettime.o > obj-$(CONFIG_CMD_GPIO) += gpio.o > +obj-$(CONFIG_CMD_OSD) += osd.o > obj-$(CONFIG_CMD_I2C) += i2c.o > obj-$(CONFIG_CMD_IOTRACE) += iotrace.o > obj-$(CONFIG_CMD_HASH) += hash.o > diff --git a/cmd/osd.c b/cmd/osd.c > new file mode 100644 > index 00..bbabfc3c54 > --- /dev/null > +++ b/cmd/osd.c > @@ -0,0 +1,366 @@ > +/* > + * (C) Copyright 2017 > + * Mario Six, Guntermann & Drunck GmbH, mario@gdsys.cc > + * > + * based on the gdsys osd driver, which is > + * > + * (C) Copyright 2010 > + * Dirk Eibach, Guntermann & Drunck GmbH, eib...@gdsys.de > + * > + * SPDX-License-Identifier:GPL-2.0+ > + */ > + > +#include > +#include > +#include > +#include > + > +#ifndef CONFIG_GDSYS_LEGACY_OSD_CMDS > +static struct udevice *osd_cur; > +#endif > + > +void hexstr_to_u8_array(char *hexstr, u8 *array, size_t arrsize) > +{ > + size_t pos; > + > + for (pos = 0; pos < arrsize; ++pos) { > + char substr[3]; > + > + memcpy(substr, hexstr, 2); > + substr[2] = 0; > + *array = simple_strtoul(substr, NULL, 16); > + > + hexstr += 2; > + array++; > + if (*hexstr == 0) > + break; > + } > +} Feels like we have a function like this already in U-Boot? > + > +#ifdef CONFIG_GDSYS_LEGACY_OSD_CMDS > +int do_osd_write(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) > +{ > + struct udevice *dev; > + uint x, y; > + uint count; > + char *hexstr; > + u8 *buffer; > + size_t buflen; > + > + if (argc < 4 || (strlen(argv[3])) % 2) { > + cmd_usage(cmdtp); > + return 1; > + } > + > + x = simple_strtoul(argv[1], NULL, 16); > + y = simple_strtoul(argv[2], NULL, 16); > + hexstr = argv[3]; > + count = (argc > 4) ? simple_strtoul(argv[4], NULL, 16) : 1; > + > + buflen = strlen(hexstr) / 2; > + buffer = malloc(buflen); > + hexstr_to_u8_array(hexstr, buffer, buflen); > + > + for (uclass_first_device(UCLASS_VIDEO_OSD, ); > +dev; > +uclass_next_device()) > + if (video_osd_set_mem(dev, x, y, buffer, buflen, count)) > + printf("Could not write to video mem on osd %s\n", > + dev->name); It seems odd to write it on all devices. If you want to do this, it should be implemented in the uclass I think. Also you ignore errors here. Most commands allow you to select a particular device to work with. You have this feature below, so why not use it here? Same below. > + > + free(buffer); > + > + return 0; > +} > + > +static int do_osd_print(cmd_tbl_t *cmdtp, int flag, int argc, > + char * const argv[]) > +{ > + struct udevice *dev; > + uint x, y; > + u8 color; > + char *text; > + > + if (argc < 5) { > + cmd_usage(cmdtp); > + return 1; > + } > + > + x = simple_strtoul(argv[1], NULL, 16); > + y = simple_strtoul(argv[2], NULL, 16); > + color = simple_strtoul(argv[3], NULL, 16); > + text = argv[4]; > + > + for (uclass_first_device(UCLASS_VIDEO_OSD, ); > +dev; > +uclass_next_device()) { > + if (video_osd_print(dev, x, y, color, text)) > + printf("Could not print string to osd %s\n", > dev->name); > + } > + > + return 0; > +} > + > +int
Re: [U-Boot] [PATCH 2/2] dm: pci: Avoid setting a PCI region that has 0 size
On 27 March 2018 at 15:46, Bin Mengwrote: > It makes no sense to set a PCI region that has 0 size. > > Signed-off-by: Bin Meng > --- > > drivers/pci/pci-uclass.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) Reviewed-by: Simon Glass ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] cmd: Add command for calculating binary operations
Hi Mario, On 28 March 2018 at 20:39, Mario Sixwrote: > This patch adds a command that enables the calculation of bit operations > (AND, OR, XOR) on binary data from the command line. Memory locations as > well as the contents of environment variables are eligible as sources > and destination of the binary data used in the operations. > > The possible applications are manifold: Setting specific bits in > registers using the regular read-OR-write pattern, masking out bits in > bit values, implementation of simple OTP encryption using the XOR > operation, etc. > > Signed-off-by: Mario Six > --- > cmd/Kconfig | 6 ++ > cmd/Makefile | 1 + > cmd/binop.c | 176 > +++ > 3 files changed, 183 insertions(+) > create mode 100644 cmd/binop.c This looks useful. It needs a test. Can we integrate with setexpr somehow? Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 2/3] video_osd: Add ihs_video_out driver
Hi Mario, On 28 March 2018 at 20:39, Mario Sixwrote: > Add a driver for IHS OSDs on IHS FPGAs. > > Signed-off-by: Mario Six > --- > drivers/misc/Kconfig | 6 +- > drivers/video/Kconfig | 7 ++ > drivers/video/Makefile| 1 + > drivers/video/ihs_video_out.c | 277 > ++ > 4 files changed, 290 insertions(+), 1 deletion(-) > create mode 100644 drivers/video/ihs_video_out.c > > diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig > index d774569cbc..742fee3b76 100644 > --- a/drivers/misc/Kconfig > +++ b/drivers/misc/Kconfig > @@ -263,5 +263,9 @@ config SYS_I2C_EEPROM_ADDR_OVERFLOW > > endif > > - > +config IHS_VIDEO_OUT > + bool "Enable IHS video out driver" > + depends on MISC > + help > + Support for IHS video out. What is IHS? Please greatly expand this help. > endmenu > diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig > index da60bbe692..40a881cf56 100644 > --- a/drivers/video/Kconfig > +++ b/drivers/video/Kconfig > @@ -668,4 +668,11 @@ config OSD >This supports drivers that provide a OSD (on-screen display), which >is a (usually text-oriented) graphics buffer to show information on >a display. > + > +config IHS_VIDEO_OUT > + bool "Enable IHS video out driver" > + depends on OSD > + help > + Support for IHS video out OSD. Same here > + > endmenu > diff --git a/drivers/video/Makefile b/drivers/video/Makefile > index 209d5e3a75..0d633e03d4 100644 > --- a/drivers/video/Makefile > +++ b/drivers/video/Makefile > @@ -59,6 +59,7 @@ obj-${CONFIG_VIDEO_ROCKCHIP} += rockchip/ > obj-${CONFIG_VIDEO_STM32} += stm32/ > > obj-${CONFIG_OSD} += video_osd-uclass.o > +obj-$(CONFIG_IHS_VIDEO_OUT) += ihs_video_out.o > > obj-y += bridge/ > obj-y += sunxi/ > diff --git a/drivers/video/ihs_video_out.c b/drivers/video/ihs_video_out.c > new file mode 100644 > index 00..3efb343c02 > --- /dev/null > +++ b/drivers/video/ihs_video_out.c > @@ -0,0 +1,277 @@ > +/* > + * (C) Copyright 2017 > + * Mario Six, Guntermann & Drunck GmbH, mario@gdsys.cc > + * > + * based on the gdsys osd driver, which is > + * > + * (C) Copyright 2010 > + * Dirk Eibach, Guntermann & Drunck GmbH, dirk.eib...@gdsys.de > + * > + * SPDX-License-Identifier:GPL-2.0+ > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "../misc/gdsys_soc.h" > +#include "../video/logicore_dp_tx.h" > + > +#define MAX_X_CHARS 53 > +#define MAX_Y_CHARS 26 > +#define MAX_VIDEOMEM_WIDTH (2 * 64) > +#define MAX_VIDEOMEM_HEIGHT (2 * 32) > + > +enum { > + REG_VERSION = 0x00, > + REG_FEATURES = 0x02, > + REG_CONTROL = 0x04, > + REG_XY_SIZE = 0x06, > + REG_XY_SCALE = 0x08, > + REG_X_POS = 0x0A, > + REG_Y_POS = 0x0C, > +}; > + > +struct ihs_video_out_priv { This struct needs a comment describing the members > + int addr; > + int osd_base; > + int osd_buffer_base; > + int osd_buffer_size; > + uint base_width; > + uint base_height; > + uint res_x; > + uint res_y; > + int sync_src; > + struct udevice *dp_tx; > + struct udevice *clk_gen; > +}; > + > +/** > + * struct ihs_video_out_data - information about a IHS OSD instance > + * > + * @width Maximum width of the OSD screen in characters. > + * @heigth Maximum height of the OSD screen in characters. > + */ > +struct ihs_video_out_data { > + uint width; > + uint height; > +}; > + > +static const struct udevice_id ihs_video_out_ids[] = { > + { .compatible = "gdsys,ihs_video_out" }, > + { } > +}; > + > +static int set_control(struct udevice *dev, u16 value) > +{ > + struct ihs_video_out_priv *priv = dev_get_priv(dev); > + struct udevice *fpga; > + > + gdsys_soc_get_fpga(dev, ); > + > + if (priv->sync_src) > + value |= ((priv->sync_src & 0x7) << 8); > + > + fpgamap_write(fpga, priv->osd_base + REG_CONTROL, , > + FPGAMAP_SIZE_16); > + > + return 0; > +} > + > +static void print_info(struct udevice *dev) > +{ Instead of printing the info, can you add a way to get the driver info? See cpu.h get_desc() for how it does it. > + struct ihs_video_out_priv *priv = dev_get_priv(dev); > + struct udevice *fpga; > + u16 version; > + u16 features; > + > + gdsys_soc_get_fpga(dev, ); > + > + fpgamap_read(fpga, priv->osd_base + REG_VERSION, , > +FPGAMAP_SIZE_16); > + fpgamap_read(fpga, priv->osd_base + REG_FEATURES, , > +FPGAMAP_SIZE_16); > + > + set_control(dev, 0x0049); > + > + priv->base_width = ((features & 0x3f00) >> 8) + 1; > + priv->base_height = (features & 0x001f) + 1; > + > + printf("OSD-%s: Digital-OSD version %01d.%02d, %d x %d characters\n", > +
Re: [U-Boot] [PATCH v2 07/19] tpm: add possible traces to analyze buffers returned by the TPM
On 29 March 2018 at 15:43, Miquel Raynalwrote: > When debugging, it is welcome to get more information about what the TPM > returns. Add the possibility to print the packets received to show their > exact content. > > Signed-off-by: Miquel Raynal > --- > lib/tpm.c | 12 +++- > 1 file changed, 11 insertions(+), 1 deletion(-) Reviewed-by: Simon Glass You might consider using the new logging support for this? See log.h - Simon ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 00/18] Introduce SPI TPM v2.0 support
Hi Miquel, On 29 March 2018 at 15:39, Miquel Raynalwrote: > Hi Simon and Tom, > > On Fri, 23 Mar 2018 08:42:02 -0600, Simon Glass > wrote: > >> Hi Miquel, >> >> On 21 March 2018 at 07:49, Tom Rini wrote: >> > On Tue, Mar 20, 2018 at 03:51:22PM +0100, Miquel Raynal wrote: >> >> Hi Tom, >> >> >> >> On Tue, 20 Mar 2018 10:04:55 -0400, Tom Rini wrote: >> >> >> >> > On Tue, Mar 20, 2018 at 02:36:56PM +0100, Miquel Raynal wrote: >> >> > > Hi Tom, >> >> > > >> >> > > Sorry for the delay. >> >> > > >> >> > > On Fri, 9 Mar 2018 07:18:40 -0500, Tom Rini >> >> > > wrote: >> >> > > >> >> > > > On Fri, Mar 09, 2018 at 08:53:40AM +0100, Miquel Raynal wrote: >> >> > > > > Hi Tom, >> >> > > > > >> >> > > > > On Thu, 8 Mar 2018 12:20:30 -0500, Tom Rini >> >> > > > > wrote: >> >> > > > > >> >> > > > > > On Thu, Mar 08, 2018 at 04:40:03PM +0100, Miquel Raynal wrote: >> >> > > > > > >> >> > > > > > > Current U-Boot supports TPM v1.2 specification. The new >> >> > > > > > > specification >> >> > > > > > > (v2.0) is not backward compatible and renames/introduces >> >> > > > > > > several >> >> > > > > > > functions. >> >> > > > > > > >> >> > > > > > > This series introduces a new SPI driver following the TPM v2.0 >> >> > > > > > > specification. It has been tested on a ST TPM but should be >> >> > > > > > > usable with >> >> > > > > > > others v2.0 compliant chips. >> >> > > > > > > >> >> > > > > > > Then, basic functionalities are introduced one by one for the >> >> > > > > > > v2.0 >> >> > > > > > > specification. The INIT command now can receive a parameter to >> >> > > > > > > distinguish further TPMv1/TPMv2 commands. After that, the >> >> > > > > > > library itself >> >> > > > > > > will know which one is pertinent and will return a special >> >> > > > > > > error if the >> >> > > > > > > desired command is not supported for the selected >> >> > > > > > > specification. >> >> > > > > > >> >> > > > > > Thanks for doing all of this. Can you please enable this >> >> > > > > > feature on >> >> > > > > > sandbox and/or an x86 QEMU variant where I assume we could also >> >> > > > > > then >> >> > > > > > setup automated testing? >> >> > > > > > >> >> > > > > >> >> > > > > Not sure I understand your request correctly: the TPM commands are >> >> > > > > already available in the sandbox (I don't see what I could add), >> >> > > > > I just >> >> > > > > extended the current set of commands. >> >> > > > > >> >> > > > > However, even with these commands, we won't be able to test them >> >> > > > > in a >> >> > > > > sandbox unless with an actual device. >> >> > > > > >> >> > > > > I probably miss something, can you explain a bit more what you >> >> > > > > would >> >> > > > > like? >> >> > > > >> >> > > > Can we add a valid TPM via QEMU and then test it that way? If so, >> >> > > > we >> >> > > > should enable the TPM code on qemu-x86_64 (and, well, if we can >> >> > > > pass it >> >> > > > on other arches, other QEMU targets) and write some test/py/tests/ >> >> > > > code >> >> > > > that exercises the TPM commands. Does that make sense? >> >> > > > >> >> > > >> >> > > I suppose this is doable, but for what I know, the effort is >> >> > > consequent. TPM 2.0 are not compatible at all with TPM 1.x , the >> >> > > packets exchanged at TPM level are completely different. Hence, I >> >> > > think there is almost nothing that we can take from the TPM 1.x >> >> > > implementation already existing in QEMU. >> >> > >> >> > Ah, OK. I thought QEMU had a TPM 2.0 implementation now too, but I see >> >> > I'm mistaken. >> >> > >> >> > > I am certain we all would benefit such a contribution, however I'm >> >> > > not sure I could handle that anytime soon. >> >> > > >> >> > > About the series, I think it would be better that I change a macro >> >> > > name >> >> > > ("STRINGIFY", which is wrongly named), I will send a v2 soon, can you >> >> > > tell me its status otherwise? >> >> > >> >> > We have the usual linux/stringify.h header available, so yes, you should >> >> > make use of that. >> >> >> >> Actually the name is misleading as I don't want to "stringify". >> >> >> >> I am looking for a way to easily fill a buffer of bytes from integer >> >> values, ie: >> >> >> >> u32 value = 0x12345678; >> >> u8 buf[x] = { MACRO(value), ...} to be {0x12, 0x34, 0x56, 0x78, ...} >> >> >> >> >> >> > And I still would like to see tests written, even if >> >> > they can only be executed on $board with $TPM attached via $interface, >> >> > with those 3 variables documented so that others can try it out too. >> >> > Does that make sense? Thanks! >> >> >> >> I see some TPM tests for v1.x, I can probably add some there. This will >> >> test the library functions but not the "user" commands. >> >> >> >> To test the commands, I suggest following the lines I inserted in my >> >> cover letter, but maybe I can put
Re: [U-Boot] [PATCH v2 05/19] tpm: prepare support for TPMv2 commands
Hi Miquel, On 29 March 2018 at 15:43, Miquel Raynalwrote: > Later choice between v1 and v2 compliant functions will be handled by a > global value in lib/tpm.c that will be accessible through set/get > accessors from lib/cmd.c. > > This global value is set during the initialization phase if the TPM2 > handle is given to the init command. > > Signed-off-by: Miquel Raynal > --- > cmd/tpm.c | 37 +- > include/tpm.h | 20 ++ > lib/tpm.c | 83 > +-- > 3 files changed, 131 insertions(+), 9 deletions(-) > > diff --git a/cmd/tpm.c b/cmd/tpm.c > index f456396d75..1d32028b64 100644 > --- a/cmd/tpm.c > +++ b/cmd/tpm.c > @@ -89,12 +89,16 @@ static void *parse_byte_string(char *bytes, uint8_t > *data, size_t *count_ptr) > */ > static int report_return_code(int return_code) > { > - if (return_code) { > - printf("Error: %d\n", return_code); > - return CMD_RET_FAILURE; > - } else { > + if (!return_code) > return CMD_RET_SUCCESS; > - } > + > + if (return_code == -EOPNOTSUPP) > + printf("TPMv%d error: unavailable command with this spec\n", > + tpm_get_specification()); > + else > + printf("TPM error: %d\n", return_code); > + > + return CMD_RET_FAILURE; > } > > /** > @@ -427,6 +431,24 @@ static int do_tpm_get_capability(cmd_tbl_t *cmdtp, int > flag, > return report_return_code(rc); > } > > +static int do_tpm_init(cmd_tbl_t *cmdtp, int flag, > + int argc, char * const argv[]) > +{ > + if (argc > 2) > + return CMD_RET_USAGE; > + > + if (argc == 2) { > + if (!strcasecmp("TPM1", argv[1])) > + tpm_set_specification(1); > + else if (!strcasecmp("TPM2", argv[1])) > + tpm_set_specification(2); > + else > + return CMD_RET_USAGE; > + } > + I don't like the idea of setting a global before calling tpm_init(). Can we instead make it an arg to tpm_init()? Also, instead of 1 and 2, can you create an enum? > + return report_return_code(tpm_init()); > +} > + > #define TPM_COMMAND_NO_ARG(cmd)\ > static int do_##cmd(cmd_tbl_t *cmdtp, int flag,\ > int argc, char * const argv[]) \ > @@ -436,7 +458,6 @@ static int do_##cmd(cmd_tbl_t *cmdtp, int flag, > \ > return report_return_code(cmd()); \ > } > > -TPM_COMMAND_NO_ARG(tpm_init) > TPM_COMMAND_NO_ARG(tpm_self_test_full) > TPM_COMMAND_NO_ARG(tpm_continue_self_test) > TPM_COMMAND_NO_ARG(tpm_force_clear) > @@ -902,8 +923,10 @@ U_BOOT_CMD(tpm, CONFIG_SYS_MAXARGS, 1, do_tpm, > "- Issue TPM command with arguments .\n" > "Admin Startup and State Commands:\n" > " info - Show information about the TPM\n" > -" init\n" > +" init []\n" > "- Put TPM into a state where it waits for 'startup' command.\n" > +" is one of TPM1 (default) or TPM2. This choice impacts the > way\n" > +" other functions will behave.\n" > " startup mode\n" > "- Issue TPM_Starup command. is one of TPM_ST_CLEAR,\n" > " TPM_ST_STATE, and TPM_ST_DEACTIVATED.\n" > diff --git a/include/tpm.h b/include/tpm.h > index 760d94865c..0ec3428ea4 100644 > --- a/include/tpm.h > +++ b/include/tpm.h > @@ -30,6 +30,11 @@ enum tpm_startup_type { > TPM_ST_DEACTIVATED = 0x0003, > }; > > +enum tpm2_startup_types { Please add a comment as to what this is for. > + TPM2_SU_CLEAR = 0x, > + TPM2_SU_STATE = 0x0001, > +}; > + > enum tpm_physical_presence { > TPM_PHYSICAL_PRESENCE_HW_DISABLE= 0x0200, > TPM_PHYSICAL_PRESENCE_CMD_DISABLE = 0x0100, > @@ -417,6 +422,21 @@ int tpm_xfer(struct udevice *dev, const uint8_t > *sendbuf, size_t send_size, > */ > int tpm_init(void); > > +/** > + * Assign a value to the global is_nfcv2 boolean to discriminate in the lib > + * between the available specifications. > + * > + * @version: 1 or 2, depending on the supported specification > + */ > +int tpm_set_specification(int version); > + > +/** > + * Return the current value of the specification. > + * > + * @return: 1 or 2, depending on the supported specification > + */ > +int tpm_get_specification(void); > + > /** > * Issue a TPM_Startup command. > * > diff --git a/lib/tpm.c b/lib/tpm.c > index 99556b1cf6..38b76b4961 100644 > --- a/lib/tpm.c > +++ b/lib/tpm.c > @@ -15,6 +15,9 @@ > /* Internal error of TPM command library */ > #define TPM_LIB_ERROR ((uint32_t)~0u) > > +/* Global boolean to discriminate TPMv2.x from TPMv1.x functions */ > +static bool is_tpmv2; Can this go in the TPM uclass as uclass-private data? See struct uclass member 'priv'. > + > /* Useful constants
Re: [U-Boot] [PATCH v2 03/19] tpm: add support for TPMv2 SPI modules
Hi Miquel, On 29 March 2018 at 15:43, Miquel Raynalwrote: > Add the tpm_tis_spi driver that should support any TPMv2 compliant (SPI) > module. > > Signed-off-by: Miquel Raynal > --- > drivers/tpm/Kconfig | 9 + > drivers/tpm/Makefile | 1 + > drivers/tpm/tpm_tis.h | 3 + > drivers/tpm/tpm_tis_spi.c | 656 > ++ > 4 files changed, 669 insertions(+) > create mode 100644 drivers/tpm/tpm_tis_spi.c I think this came up in another context. Would it make sense to create a common interface to i2c and SPI and then have a common driver? Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 10/19] tpm: add TPM2_SelfTest command support
Hi Miquel, On 29 March 2018 at 15:43, Miquel Raynalwrote: > Add support for the TPM2_Selftest command. > > Change the command file and the help accordingly. > > Signed-off-by: Miquel Raynal > --- > include/tpm.h | 9 +++-- > lib/tpm.c | 36 > 2 files changed, 35 insertions(+), 10 deletions(-) > > diff --git a/include/tpm.h b/include/tpm.h > index ba71bac885..38d7cb899d 100644 > --- a/include/tpm.h > +++ b/include/tpm.h > @@ -31,6 +31,11 @@ enum tpm2_structures { > TPM2_ST_SESSIONS= 0x8002, > }; > > +enum tpm2_yes_no { > + TPMI_YES= 1, > + TPMI_NO = 0, > +}; > + > enum tpm_startup_type { > TPM_ST_CLEAR= 0x0001, > TPM_ST_STATE= 0x0002, > @@ -476,14 +481,14 @@ int tpm_startup(enum tpm_startup_type mode); > * > * @return return code of the operation > */ > -uint32_t tpm_self_test_full(void); > +int tpm_self_test_full(void); > > /** > * Issue a TPM_ContinueSelfTest command. > * > * @return return code of the operation > */ > -uint32_t tpm_continue_self_test(void); > +int tpm_continue_self_test(void); > > /** > * Issue a TPM_NV_DefineSpace command. The implementation is limited > diff --git a/lib/tpm.c b/lib/tpm.c > index 0c57ef8dc7..3cc2888267 100644 > --- a/lib/tpm.c > +++ b/lib/tpm.c > @@ -341,20 +341,40 @@ int tpm_startup(enum tpm_startup_type mode) > return 0; > } > > -uint32_t tpm_self_test_full(void) > +int tpm_self_test_full(void) > { > - const uint8_t command[10] = { > - 0x0, 0xc1, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0x50, > + const u8 command_v1[10] = { > + U16_TO_ARRAY(0xc1), Here I can see some benefit to your macros because the data is better structured. But why not use the pack_byte_string() function? > + U32_TO_ARRAY(10), > + U32_TO_ARRAY(0x50), > }; > - return tpm_sendrecv_command(command, NULL, NULL); > + const u8 command_v2[12] = { > + U16_TO_ARRAY(TPM2_ST_NO_SESSIONS), > + U32_TO_ARRAY(11), > + U32_TO_ARRAY(TPM2_CC_SELF_TEST), > + TPMI_YES, > + }; > + > + return tpm_sendrecv_command(is_tpmv2 ? command_v2 : command_v1, NULL, > + NULL); > } > > -uint32_t tpm_continue_self_test(void) > +int tpm_continue_self_test(void) > { > - const uint8_t command[10] = { > - 0x0, 0xc1, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0x53, > + const u8 command_v1[10] = { > + U16_TO_ARRAY(0xc1), > + U32_TO_ARRAY(10), > + U32_TO_ARRAY(0x53), > }; > - return tpm_sendrecv_command(command, NULL, NULL); > + const u8 command_v2[12] = { > + U16_TO_ARRAY(TPM2_ST_NO_SESSIONS), > + U32_TO_ARRAY(11), > + U32_TO_ARRAY(TPM2_CC_SELF_TEST), > + TPMI_NO, > + }; > + > + return tpm_sendrecv_command(is_tpmv2 ? command_v2 : command_v1, NULL, > + NULL); > } > > uint32_t tpm_nv_define_space(uint32_t index, uint32_t perm, uint32_t size) > -- > 2.14.1 > Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 01/19] tpm: add Revision ID field in the chip structure
On 29 March 2018 at 15:43, Miquel Raynalwrote: > TPM are shipped with a few read-only register from which we can retrieve > for instance: > - vendor ID > - product ID > - revision ID > > Product and vendor ID share the same register and are already referenced > in the tpm_chip structure. Add the revision ID entry which is missing. > > Signed-off-by: Miquel Raynal > --- > drivers/tpm/tpm_tis.h | 1 + > 1 file changed, 1 insertion(+) Reviewed-by: Simon Glass ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 08/19] tpm: handle different buffer sizes
On 29 March 2018 at 15:43, Miquel Raynalwrote: > Usual buffer sizes for TPMv1 and TPMv2 are different. Change TPMv1 > buffer size definition for that and declare another size for TPMv2 > buffers. > > Signed-off-by: Miquel Raynal > --- > cmd/tpm.c | 5 +++-- > include/tpm.h | 2 ++ > lib/tpm.c | 60 > +-- > 3 files changed, 34 insertions(+), 33 deletions(-) > Reviewed-by: Simon Glass Suggest TPM1_DIGEST_LEN which is a bit shorter. - Simon ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] serial: meson: Update compatible with new Linux bindings
On 29 March 2018 at 20:56, Neil Armstrongwrote: > The Amlogic Meson SoCs serial bindings were not written when serial > support was pushed into Linux and U-Boot. > A clean bindings document has been merged into Linux tree to correctly > handle the multiple clocks feeding the serial peripheral. > This update the U-Boot serial_meson driver with the new compatible > string for Amlogic Meson GX Socs. > > Signed-off-by: Neil Armstrong > --- > drivers/serial/serial_meson.c | 1 + > 1 file changed, 1 insertion(+) > Reviewed-by: Simon Glass ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 04/19] tpm: fix indentation in command list before adding more
On 29 March 2018 at 15:43, Miquel Raynalwrote: > Prepare the addition of more commands by first indenting correctly the > current list. > > Signed-off-by: Miquel Raynal > --- > cmd/tpm.c | 40 > 1 file changed, 20 insertions(+), 20 deletions(-) > Reviewed-by: Simon Glass ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 3/4] clk: add Amlogic meson clock driver
Hi Neil, On 29 March 2018 at 16:42, Neil Armstrongwrote: > Hi Beniamino, > > On 03/12/2017 10:17, Beniamino Galvani wrote: >> Introduce a basic clock driver for Amlogic Meson SoCs which supports >> enabling/disabling clock gates and getting their frequency. >> >> Signed-off-by: Beniamino Galvani >> --- >> arch/arm/mach-meson/Kconfig | 2 + >> drivers/clk/Makefile| 1 + >> drivers/clk/clk_meson.c | 196 >> >> 3 files changed, 199 insertions(+) >> create mode 100644 drivers/clk/clk_meson.c >> >> diff --git a/arch/arm/mach-meson/Kconfig b/arch/arm/mach-meson/Kconfig >> index d4bd230be3..7acee3bc5c 100644 >> --- a/arch/arm/mach-meson/Kconfig >> +++ b/arch/arm/mach-meson/Kconfig > > [...] >> + >> +static int meson_set_gate(struct clk *clk, bool on) >> +{ >> + struct meson_clk *priv = dev_get_priv(clk->dev); >> + struct meson_gate *gate; >> + >> + if (clk->id >= ARRAY_SIZE(gates)) >> + return -ENOENT; > > This should be -ENOSYS, otherwise it breaks the ethernet driver since it > waits -ENOSYS if clock cannot be enabled. Perhaps, but this is a genuine error, so it is OK to break the Ethernet driver, isn't it? We don't want errors to be silently ignored. Not having a device is one thing, but having a device that does not work is bad. Also I have tried to keep -ENOSYS for cases where the driver does not support the operation. We should be very clear in clk-uclass.h as to what errors are returned. At present I don't see ENOSYS mentioned. At the very least we should update the docs if certain behaviour is expected. I would also expect us to have a sandbox test for it. > >> + >> + gate = [clk->id]; >> + >> + if (gate->reg == 0) >> + return -ENOENT; > > Same here -ENOSYS > >> + >> + clrsetbits_le32(priv->addr + gate->reg, >> + BIT(gate->bit), on ? BIT(gate->bit) : 0); >> + return 0; >> +} >> + >> +static int meson_clk_enable(struct clk *clk) >> +{ >> + return meson_set_gate(clk, true); >> +} >> + >> +static int meson_clk_disable(struct clk *clk) >> +{ >> + return meson_set_gate(clk, false); >> +} >> + >> +static ulong meson_clk_get_rate(struct clk *clk) >> +{ >> + struct meson_clk *priv = dev_get_priv(clk->dev); >> + >> + if (clk->id != CLKID_CLK81) { >> + if (clk->id >= ARRAY_SIZE(gates)) >> + return -ENOENT; > > Same here -ENOSYS > >> + if (gates[clk->id].reg == 0) >> + return -ENOENT; > > Same here -ENOSYS > >> + } >> + >> + /* Use cached value if available */ >> + if (priv->rate) >> + return priv->rate; >> + >> + priv->rate = meson_measure_clk_rate(CLK_81); >> + >> + return priv->rate; >> +} >> + > > [...] > > Neil Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 02/19] tpm: rename tpm_tis_infineon in tpm_tis_infineon_i2c
On 29 March 2018 at 15:43, Miquel Raynalwrote: > As the chips driven by tpm_tis_infineon.c are only I2C chips, rename the > driver with the _i2c suffix to prepare the venue of its _spi cousin. > > Also change the driver name in the U_BOOT_DRIVER structure. > > Signed-off-by: Miquel Raynal > --- > drivers/tpm/Kconfig| 4 ++-- > drivers/tpm/Makefile | 2 +- > drivers/tpm/{tpm_tis_infineon.c => tpm_tis_infineon_i2c.c} | 2 +- > 3 files changed, 4 insertions(+), 4 deletions(-) > rename drivers/tpm/{tpm_tis_infineon.c => tpm_tis_infineon_i2c.c} (99%) Reviewed-by: Simon Glass ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] timer: Add High Precision Event Timers (HPET) support
Hi, On 29 March 2018 at 18:52, Andy Shevchenkowrote: > On Wed, 2018-03-28 at 17:58 -0700, Ivan Gorinov wrote: >> Adding HPET as an alternative timer for x86 (default is TSC). >> HPET main counter has constant clock frequency, calibration is not >> required. >> This change also makes TSC timer driver optional on x86 platforms. >> If X86_TSC is disabled, early timer functions are provided by HPET. >> >> HPET can be selected as the tick timer in the Device Tree "chosen" >> node: >> >> /include/ "hpet.dtsi" >> >> chosen { >> tick-timer = "/hpet0"; >> }; >> > > > First question is how this will work in case of Broadwell and Ivybridge > that have something to do with HPET in their CPU code, i.e. > > arch/x86/cpu/broadwell/pch.c > arch/x86/cpu/ivybridge/lpc.c > > ? > > Look for > > clrsetbits_le32(RCB_REG(HPTC), 3, 1 << 7); > >> +static int hpet_timer_get_count(struct udevice *dev, u64 *count) > >> +static int hpet_timer_probe(struct udevice *dev) > >> +#ifndef CONFIG_X86_TSC_TIMER > >> +#define EARLY_HPET_BASE 0xfed0 > > HPET address is fixed, AFAIU, on x86, and provided by config option in > U-Boot. > >> +unsigned long notrace timer_early_get_rate(void) > >> +u64 notrace timer_early_get_count(void) > >> +int timer_init(void) > > These functions have too much code duplication with above. Perhaps that code can be removed in favour of this driver? I am happy to test on these platforms if it helps. Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 0/4] efi_loader: fixes for loaded image protocol
This patch series fixes various bugs in the handling of loaded images. Heinrich Schuchardt (4): efi_loader: used efi_uintn_t for LoadImage efi_loader: correctly set ImageBase for loaded image efi_loader: ImageSize must be multiple of SectionAlignment efi_loader: correct types for EFI_LOADED_IMAGE_PROTOCOL include/efi_api.h | 6 +++--- lib/efi_loader/efi_boottime.c | 4 ++-- lib/efi_loader/efi_image_loader.c | 9 - 3 files changed, 9 insertions(+), 10 deletions(-) -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 4/4] efi_loader: correct types for EFI_LOADED_IMAGE_PROTOCOL
We should not use void * but specific types for * device_handle * file_path Signed-off-by: Heinrich Schuchardt--- include/efi_api.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/efi_api.h b/include/efi_api.h index f138fc90ec..833ef8b4a6 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -318,8 +318,8 @@ struct efi_loaded_image { u32 revision; void *parent_handle; struct efi_system_table *system_table; - void *device_handle; - void *file_path; + efi_handle_t device_handle; + struct efi_device_path *file_path; void *reserved; u32 load_options_size; void *load_options; -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 2/4] efi_loader: correctly set ImageBase for loaded image
In the EFI_LOADED_IMAGE_PROTOCOL ImageBase and ImageSize should reflect where the loaded image can be found in memory. If we do a relocation this is the relocated location and size. Signed-off-by: Heinrich Schuchardt--- lib/efi_loader/efi_image_loader.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/efi_loader/efi_image_loader.c b/lib/efi_loader/efi_image_loader.c index cac64ba9fe..5125340fc0 100644 --- a/lib/efi_loader/efi_image_loader.c +++ b/lib/efi_loader/efi_image_loader.c @@ -124,7 +124,6 @@ void *efi_load_pe(void *efi, struct efi_loaded_image *loaded_image_info) unsigned long rel_size; int rel_idx = IMAGE_DIRECTORY_ENTRY_BASERELOC; void *entry; - uint64_t image_size; unsigned long virt_size = 0; bool can_run_nt64 = true; bool can_run_nt32 = true; @@ -163,7 +162,6 @@ void *efi_load_pe(void *efi, struct efi_loaded_image *loaded_image_info) (nt->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR64_MAGIC)) { IMAGE_NT_HEADERS64 *nt64 = (void *)nt; IMAGE_OPTIONAL_HEADER64 *opt = >OptionalHeader; - image_size = opt->SizeOfImage; efi_set_code_and_data_type(loaded_image_info, opt->Subsystem); efi_reloc = efi_alloc(virt_size, loaded_image_info->image_code_type); @@ -178,7 +176,6 @@ void *efi_load_pe(void *efi, struct efi_loaded_image *loaded_image_info) } else if (can_run_nt32 && (nt->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC)) { IMAGE_OPTIONAL_HEADER32 *opt = >OptionalHeader; - image_size = opt->SizeOfImage; efi_set_code_and_data_type(loaded_image_info, opt->Subsystem); efi_reloc = efi_alloc(virt_size, loaded_image_info->image_code_type); @@ -219,8 +216,8 @@ void *efi_load_pe(void *efi, struct efi_loaded_image *loaded_image_info) invalidate_icache_all(); /* Populate the loaded image interface bits */ - loaded_image_info->image_base = efi; - loaded_image_info->image_size = image_size; + loaded_image_info->image_base = efi_reloc; + loaded_image_info->image_size = virt_size; return entry; } -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 3/4] efi_loader: ImageSize must be multiple of SectionAlignment
According to the Portable Executable and Common Object File Format Specification the image size must be a multiple of the alignment of sections. Signed-off-by: Heinrich Schuchardt--- lib/efi_loader/efi_image_loader.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/efi_loader/efi_image_loader.c b/lib/efi_loader/efi_image_loader.c index 5125340fc0..07251693cb 100644 --- a/lib/efi_loader/efi_image_loader.c +++ b/lib/efi_loader/efi_image_loader.c @@ -173,6 +173,7 @@ void *efi_load_pe(void *efi, struct efi_loaded_image *loaded_image_info) entry = efi_reloc + opt->AddressOfEntryPoint; rel_size = opt->DataDirectory[rel_idx].Size; rel = efi_reloc + opt->DataDirectory[rel_idx].VirtualAddress; + virt_size = ALIGN(virt_size, opt->SectionAlignment); } else if (can_run_nt32 && (nt->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC)) { IMAGE_OPTIONAL_HEADER32 *opt = >OptionalHeader; @@ -187,6 +188,7 @@ void *efi_load_pe(void *efi, struct efi_loaded_image *loaded_image_info) entry = efi_reloc + opt->AddressOfEntryPoint; rel_size = opt->DataDirectory[rel_idx].Size; rel = efi_reloc + opt->DataDirectory[rel_idx].VirtualAddress; + virt_size = ALIGN(virt_size, opt->SectionAlignment); } else { printf("%s: Invalid optional header magic %x\n", __func__, nt->OptionalHeader.Magic); -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 1/4] efi_loader: used efi_uintn_t for LoadImage
We generally use efi_uintn_t where the UEFI spec uses UINTN. Signed-off-by: Heinrich Schuchardt--- include/efi_api.h | 2 +- lib/efi_loader/efi_boottime.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/efi_api.h b/include/efi_api.h index 28de93a132..f138fc90ec 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -107,7 +107,7 @@ struct efi_boot_services { efi_status_t (EFIAPI *load_image)(bool boot_policiy, efi_handle_t parent_image, struct efi_device_path *file_path, void *source_buffer, - unsigned long source_size, efi_handle_t *image); + efi_uintn_t source_size, efi_handle_t *image); efi_status_t (EFIAPI *start_image)(efi_handle_t handle, unsigned long *exitdata_size, s16 **exitdata); diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index fd35ffa359..d15a131e74 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -1568,14 +1568,14 @@ static efi_status_t EFIAPI efi_load_image(bool boot_policy, efi_handle_t parent_image, struct efi_device_path *file_path, void *source_buffer, - unsigned long source_size, + efi_uintn_t source_size, efi_handle_t *image_handle) { struct efi_loaded_image *info; struct efi_object *obj; efi_status_t ret; - EFI_ENTRY("%d, %p, %pD, %p, %ld, %p", boot_policy, parent_image, + EFI_ENTRY("%d, %p, %pD, %p, %zd, %p", boot_policy, parent_image, file_path, source_buffer, source_size, image_handle); if (!image_handle || !parent_image) { -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2] timer: add High Precision Event Timers (HPET) support
Adding HPET as an alternative timer for x86 (default is TSC). HPET counter has constant frequency and does not need calibration. This change also makes TSC timer driver optional on x86. If X86_TSC is disabled, early timer functions are provided by HPET. Signed-off-by: Ivan Gorinov--- arch/Kconfig | 2 +- arch/x86/dts/hpet.dtsi | 7 ++ drivers/timer/Kconfig | 6 ++ drivers/timer/Makefile | 1 + drivers/timer/hpet_timer.c | 191 + 5 files changed, 206 insertions(+), 1 deletion(-) create mode 100644 arch/x86/dts/hpet.dtsi create mode 100644 drivers/timer/hpet_timer.c diff --git a/arch/Kconfig b/arch/Kconfig index e599e7a..37dabae 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -104,7 +104,7 @@ config X86 select DM_PCI select PCI select TIMER - select X86_TSC_TIMER + imply X86_TSC_TIMER imply BLK imply DM_ETH imply DM_GPIO diff --git a/arch/x86/dts/hpet.dtsi b/arch/x86/dts/hpet.dtsi new file mode 100644 index 000..037dc7e --- /dev/null +++ b/arch/x86/dts/hpet.dtsi @@ -0,0 +1,7 @@ +/ { + hpet0: hpet@fed0 { + compatible = "hpet-x86"; + u-boot,dm-pre-reloc; + reg = <0xfed0 0x1000>; + }; +}; diff --git a/drivers/timer/Kconfig b/drivers/timer/Kconfig index 2c96896..72ae6c5 100644 --- a/drivers/timer/Kconfig +++ b/drivers/timer/Kconfig @@ -65,6 +65,12 @@ config X86_TSC_TIMER help Select this to enable Time-Stamp Counter (TSC) timer for x86. +config HPET_TIMER + bool "High Precision Event Timers (HPET) support" + depends on TIMER && X86 + help + Select this to enable High Precision Event Timers (HPET) for x86. + config OMAP_TIMER bool "Omap timer support" depends on TIMER diff --git a/drivers/timer/Makefile b/drivers/timer/Makefile index a6e7832..557fecc 100644 --- a/drivers/timer/Makefile +++ b/drivers/timer/Makefile @@ -8,6 +8,7 @@ obj-y += timer-uclass.o obj-$(CONFIG_ALTERA_TIMER) += altera_timer.o obj-$(CONFIG_SANDBOX_TIMER)+= sandbox_timer.o obj-$(CONFIG_X86_TSC_TIMER)+= tsc_timer.o +obj-$(CONFIG_HPET_TIMER) += hpet_timer.o obj-$(CONFIG_OMAP_TIMER) += omap-timer.o obj-$(CONFIG_AST_TIMER)+= ast_timer.o obj-$(CONFIG_STI_TIMER)+= sti-timer.o diff --git a/drivers/timer/hpet_timer.c b/drivers/timer/hpet_timer.c new file mode 100644 index 000..0bef859 --- /dev/null +++ b/drivers/timer/hpet_timer.c @@ -0,0 +1,191 @@ +/* + * Copyright (c) 2017 Intel Corporation + * + * SPDX-License-Identifier:GPL-2.0+ + */ + +#include +#include +#include +#include +#include +#include +#include + +#define HPET_PERIOD_REG 0x004 +#define HPET_CONFIG_REG 0x010 +#define HPET_MAIN_COUNT_L 0x0f0 +#define HPET_MAIN_COUNT_H 0x0f4 + +#define HPET_MAX_PERIOD 1 + +DECLARE_GLOBAL_DATA_PTR; + +struct hpet_timer_priv { + void *regs; +}; + +/* + * Returns HPET clock frequency in HZ + * (rounding to the nearest integer), + * or 0 if HPET is not available. + */ +static inline u32 get_clock_frequency(void *regs) +{ + u64 d = 1000ull; + u32 period; + + period = readl(regs + HPET_PERIOD_REG); + if (period == 0) + return 0; + if (period > HPET_MAX_PERIOD) + return 0; + + d += period / 2; + + return d / period; +} + +/* + * Reset and start the main counter. + */ +static void start_main_counter(void *regs) +{ + u32 config; + + config = readl(regs + HPET_CONFIG_REG); + config &= ~1; + writel(config, regs + HPET_CONFIG_REG); + writel(0, regs + HPET_MAIN_COUNT_L); + writel(0, regs + HPET_MAIN_COUNT_H); + config |= 1; + writel(config, regs + HPET_CONFIG_REG); +} + +/* + * Read the main counter as two 32-bit registers, + * repeat if rollover happens. + */ +static u64 read_main_counter(void *regs) +{ + u64 now_tick; + u32 tl, th, th0; + + th = readl(regs + HPET_MAIN_COUNT_H); + do { + th0 = th; + tl = readl(regs + HPET_MAIN_COUNT_L); + th = readl(regs + HPET_MAIN_COUNT_H); + } while (th != th0); + + now_tick = th; + now_tick <<= 32; + now_tick |= tl; + + return now_tick; +} + +static int hpet_timer_get_count(struct udevice *dev, u64 *count) +{ + struct hpet_timer_priv *priv = dev_get_priv(dev); + + *count = read_main_counter(priv->regs); + + return 0; +} + +static int hpet_timer_probe(struct udevice *dev) +{ + struct timer_dev_priv *uc_priv = dev_get_uclass_priv(dev); + struct hpet_timer_priv *priv = dev_get_priv(dev); + u32 rate; + + rate = get_clock_frequency(priv->regs); + if (rate == 0) + return -ENODEV; + + start_main_counter(priv->regs); + + uc_priv->clock_rate = rate; + + return 0;
Re: [U-Boot] [PATCH] timer: Add High Precision Event Timers (HPET) support
On Thu, Mar 29, 2018 at 01:52:10PM +0300, Andy Shevchenko wrote: > On Wed, 2018-03-28 at 17:58 -0700, Ivan Gorinov wrote: > > Adding HPET as an alternative timer for x86 (default is TSC). > > HPET main counter has constant clock frequency, calibration is not > > required. > > This change also makes TSC timer driver optional on x86 platforms. > > If X86_TSC is disabled, early timer functions are provided by HPET. > > > > HPET can be selected as the tick timer in the Device Tree "chosen" > > node: > > > > /include/ "hpet.dtsi" > > > > chosen { > > tick-timer = "/hpet0"; > > }; > > First question is how this will work in case of Broadwell and Ivybridge > that have something to do with HPET in their CPU code, i.e. > > arch/x86/cpu/broadwell/pch.c > arch/x86/cpu/ivybridge/lpc.c The platform-specific code maps HPET registers to make sure they are available to the timer driver added by this patch. Apparently, HPET is also used by the DRAM initialization code (MRC) on Ivy Bridge, before the U-Boot timer driver starts. > Look for > > clrsetbits_le32(RCB_REG(HPTC), 3, 1 << 7); > > > +static int hpet_timer_get_count(struct udevice *dev, u64 *count) > > > +static int hpet_timer_probe(struct udevice *dev) > > > +#ifndef CONFIG_X86_TSC_TIMER > > > +#define EARLY_HPET_BASE 0xfed0 > > HPET address is fixed, AFAIU, on x86, and provided by config option in > U-Boot. Found it. Thank you! > > +unsigned long notrace timer_early_get_rate(void) > > +u64 notrace timer_early_get_count(void) > > +int timer_init(void) > These functions have too much code duplication with above. I will move the duplicated code into static functions. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 2/2] arm: print information about loaded UEFI images
If an exception occurs in a UEFI loaded image we need the start address of the image to determine the relocation offset. This patch adds the necessary lines after the registers in the crash dump. A possible output would be: UEFI image start 0x7fdb4000, size 0xa7b60 pc offset 0x72ca /\snp.efi With the offset 0x72ca we can now find the relevant instruction in the disassembled 'snp.efi' binary. Signed-off-by: Heinrich Schuchardt--- arch/arm/lib/interrupts.c | 17 + 1 file changed, 17 insertions(+) diff --git a/arch/arm/lib/interrupts.c b/arch/arm/lib/interrupts.c index 80869adb61..a28fef8f46 100644 --- a/arch/arm/lib/interrupts.c +++ b/arch/arm/lib/interrupts.c @@ -20,6 +20,7 @@ */ #include +#include #include #include #include @@ -51,6 +52,14 @@ void bad_mode (void) reset_cpu (0); } +static void show_efi_loaded_images(struct pt_regs *regs) +{ +#if defined(CONFIG_EFI_LOADER) && \ + !defined(CONFIG_SPL_BUILD) && !defined(API_BUILD) + efi_print_image_infos((void *)instruction_pointer(regs)); +#endif +} + void show_regs (struct pt_regs *regs) { unsigned long __maybe_unused flags; @@ -77,6 +86,7 @@ void show_regs (struct pt_regs *regs) printf("sp : %08lx ip : %08lx fp : %08lx\n", regs->ARM_sp, regs->ARM_ip, regs->ARM_fp); printf ("r10: %08lx r9 : %08lx r8 : %08lx\n", + regs->ARM_r10, regs->ARM_r9, regs->ARM_r8); printf ("r7 : %08lx r6 : %08lx r5 : %08lx r4 : %08lx\n", regs->ARM_r7, regs->ARM_r6, regs->ARM_r5, regs->ARM_r4); @@ -106,6 +116,7 @@ void do_undefined_instruction (struct pt_regs *pt_regs) printf ("undefined instruction\n"); fixup_pc(pt_regs, -4); show_regs (pt_regs); + show_efi_loaded_images(pt_regs); bad_mode (); } @@ -115,6 +126,7 @@ void do_software_interrupt (struct pt_regs *pt_regs) printf ("software interrupt\n"); fixup_pc(pt_regs, -4); show_regs (pt_regs); + show_efi_loaded_images(pt_regs); bad_mode (); } @@ -124,6 +136,7 @@ void do_prefetch_abort (struct pt_regs *pt_regs) printf ("prefetch abort\n"); fixup_pc(pt_regs, -8); show_regs (pt_regs); + show_efi_loaded_images(pt_regs); bad_mode (); } @@ -133,6 +146,7 @@ void do_data_abort (struct pt_regs *pt_regs) printf ("data abort\n"); fixup_pc(pt_regs, -8); show_regs (pt_regs); + show_efi_loaded_images(pt_regs); bad_mode (); } @@ -142,6 +156,7 @@ void do_not_used (struct pt_regs *pt_regs) printf ("not used\n"); fixup_pc(pt_regs, -8); show_regs (pt_regs); + show_efi_loaded_images(pt_regs); bad_mode (); } @@ -151,6 +166,7 @@ void do_fiq (struct pt_regs *pt_regs) printf ("fast interrupt request\n"); fixup_pc(pt_regs, -8); show_regs (pt_regs); + show_efi_loaded_images(pt_regs); bad_mode (); } @@ -160,5 +176,6 @@ void do_irq (struct pt_regs *pt_regs) printf ("interrupt request\n"); fixup_pc(pt_regs, -8); show_regs (pt_regs); + show_efi_loaded_images(pt_regs); bad_mode (); } -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 0/2] efi_loader: print information about loaded UEFI images
If an exception occurs in a UEFI loaded image we need the start address of the image to determine the relocation offset. This patch series adds the necessary lines after the registers in the crash dump. A possible output would be: UEFI image start 0x7fdb4000, size 0xa7b60 pc offset 0x72ca /\snp.efi With the offset 0x72ca we can now find the relevant instruction in the disassembled 'snp.efi' binary. Heinrich Schuchardt (2): efi_loader: new functions to print loaded image information arm: print information about loaded UEFI images arch/arm/lib/interrupts.c | 17 +++ include/efi_loader.h | 4 lib/efi_loader/efi_image_loader.c | 45 +++ 3 files changed, 66 insertions(+) -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 1/2] efi_loader: new functions to print loaded image information
Introduce functions to print information about loaded images. If we want to analyze an exception in an EFI image we need the offset between the PC and the start of the loaded image. With efi_print_image_info() we can print the necessary information for a single image, e.g. UEFI image start 0x7fdb4000, size 0xa7b60 pc offset 0x72ca /\snp.efi efi_print_image_infos() provides output for all loaded images. Signed-off-by: Heinrich Schuchardt--- include/efi_loader.h | 4 lib/efi_loader/efi_image_loader.c | 45 +++ 2 files changed, 49 insertions(+) diff --git a/include/efi_loader.h b/include/efi_loader.h index 07730c3f39..5ed6ff04d8 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -284,6 +284,10 @@ efi_status_t efi_setup_loaded_image( struct efi_device_path *file_path); efi_status_t efi_load_image_from_path(struct efi_device_path *file_path, void **buffer); +/* Print information about a loaded image */ +efi_status_t efi_print_image_info(struct efi_loaded_image *image, void *pc); +/* Print information about all loaded images */ +void efi_print_image_infos(void *pc); #ifdef CONFIG_EFI_LOADER_BOUNCE_BUFFER extern void *efi_bounce_buffer; diff --git a/lib/efi_loader/efi_image_loader.c b/lib/efi_loader/efi_image_loader.c index cac64ba9fe..9750da551a 100644 --- a/lib/efi_loader/efi_image_loader.c +++ b/lib/efi_loader/efi_image_loader.c @@ -22,6 +22,51 @@ const efi_guid_t efi_simple_file_system_protocol_guid = EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID; const efi_guid_t efi_file_info_guid = EFI_FILE_INFO_GUID; +/* + * Print information about a loaded image. + * + * If the program counter is located within the image the offset to the base + * address is shown. + * + * @image: loaded image + * @pc:program counter (use NULL to suppress offset output) + * @return:status code + */ +efi_status_t efi_print_image_info(struct efi_loaded_image *image, void *pc) +{ + if (!image) + return EFI_INVALID_PARAMETER; + printf("UEFI image\nstart 0x%p, size 0x%llx\n", + image->image_base, image->image_size); + if (pc && pc >= image->image_base && + pc < image->image_base + image->image_size) + printf("pc offset 0x%zx\n", pc - image->image_base); + if (image->file_path) + printf("%pD\n", image->file_path); + return EFI_SUCCESS; +} + +/* + * Print information about all loaded images. + * + * @pc:program counter (use NULL to suppress offset output) + */ +void efi_print_image_infos(void *pc) +{ + struct efi_object *efiobj; + struct efi_handler *handler; + + list_for_each_entry(efiobj, _obj_list, link) { + list_for_each_entry(handler, >protocols, link) { + if (!guidcmp(handler->guid, _guid_loaded_image)) { + printf("\n"); + efi_print_image_info( + handler->protocol_interface, pc); + } + } + } +} + static efi_status_t efi_loader_relocate(const IMAGE_BASE_RELOCATION *rel, unsigned long rel_size, void *efi_reloc) { -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 1/1] arm: armv7: enable unaligned access
We use the command bootefi to run UEFI executables like GRUB and iPXE. The UEFI spec requires that unaligned access is enabled if the CPU supports it. This is true for armv7. So we should not set bit 1 of the system control register, the alignment bit. Without this patch iPXE snp.efi cannot be executed on the Allwinner A20. Signed-off-by: Heinrich Schuchardt--- arch/arm/cpu/armv7/start.S | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S index 7e2695761e..1771741119 100644 --- a/arch/arm/cpu/armv7/start.S +++ b/arch/arm/cpu/armv7/start.S @@ -150,7 +150,6 @@ ENTRY(cpu_init_cp15) mrc p15, 0, r0, c1, c0, 0 bic r0, r0, #0x2000 @ clear bits 13 (--V-) bic r0, r0, #0x0007 @ clear bits 2:0 (-CAM) - orr r0, r0, #0x0002 @ set bit 1 (--A-) Align orr r0, r0, #0x0800 @ set bit 11 (Z---) BTB #ifdef CONFIG_SYS_ICACHE_OFF bic r0, r0, #0x1000 @ clear bit 12 (I) I-cache -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v1 0/5] Build AM335x when CONFIG_NET isn't defined
Attempting to build AM335x without CONFIG_NET defined fails in assorted ways. This series fixes up those failures. Alex Kiernan (5): Migrate CONFIG_DRIVER_TI_CPSW to Kconfig ti: am335x: Fix bootargs when building without NET usb: gadget: USB_ETHER requires network support ti: am335x: Fix build when networking is disabled net: Avoid build fail on am335x when NET is disabled board/ti/am335x/board.c| 8 cmd/nvedit.c | 30 ++ drivers/net/Kconfig| 8 drivers/usb/gadget/Kconfig | 1 + include/common.h | 4 include/configs/am335x_evm.h | 16 ++-- include/configs/am335x_shc.h | 1 - include/configs/am43xx_evm.h | 1 - include/configs/am57xx_evm.h | 1 - include/configs/bur_am335x_common.h| 1 - include/configs/cl-som-am57x.h | 1 - include/configs/cm_t43.h | 1 - include/configs/dra7xx_evm.h | 1 - include/configs/siemens-am33x-common.h | 1 - include/configs/ti814x_evm.h | 1 - include/configs/ti_am335x_common.h | 1 - include/net.h | 3 --- net/eth_common.c | 30 -- scripts/config_whitelist.txt | 1 - 19 files changed, 61 insertions(+), 50 deletions(-) -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] arm: stm32mp1: add PSCI support
Hi Mark, > -Original Message- > From: Mark Rutland [mailto:mark.rutl...@arm.com] > > Hi, > > On Tue, Mar 20, 2018 at 01:59:03PM +0100, Patrick Delaunay wrote: > > Add minimal PSCI support for Linux. > > > > Signed-off-by: Patrick Delaunay> > > +int __secure psci_features(unsigned int psci_fid) { > > + switch (psci_fid) { > > + case ARM_PSCI_0_2_FN_PSCI_VERSION: > > + case ARM_PSCI_0_2_FN_CPU_ON: > > + case ARM_PSCI_0_2_FN_CPU_OFF: > > + case ARM_PSCI_0_2_FN_SYSTEM_RESET: > > + return 0x0; > > + } > > + return ARM_PSCI_RET_NI; > > +} > > > > +unsigned int __secure psci_version(void) { > > + return ARM_PSCI_VER_1_0; > > +} > > I'm a bit worried, because while PSCI_VERSION reports PSCI 1.0, this does not > appear to be conformant with teh PSCI 1.0 spec, as some mandatory functions > are missing: > > * AFFINITY_INFO -- Linux relies on this to ensure that CPUs have exited > the kernel when calling CPU_OFF (e.g. so that we don't free any data / > code that said CPU may be using on the path to calling CPU_OFF). > > * SYSTEM_OFF -- Can you implement this similarly to SYSTEM_RESET? I push this patch for STM32MP1 to be able to boot the Kernel version on board (requested by ST Linux team : https://patchwork.kernel.org/patch/10167343/) This patch a minimal PSCI support to be able to boot And I miss these part of the requirement PSCI v1.0 and also in issue in Linux trace: [0.00] psci: probing for conduit method from DT. [0.00] psci: PSCIv1.0 detected in firmware. [0.00] psci: Using standard PSCI v0.2 function IDs [0.00] psci: MIGRATE_INFO_TYPE not supported. Thanks to point these point . So I will add them in a second patch " arm: stm32mp1: complete PSCI v1.0 support" I want keep this patch in v1, to have it merged in v2018.05-rc1, I hope... Even if it is only a first step for a full PSCI v1.0 support, that allow linux kernel boot. And I need some time to check how to handle SYSTEM_OFF , to do the "completely removes power" because I don't think if it is possible today. > > +int __secure psci_cpu_on(u32 __always_unused unused, u32 mpidr, u32 > > +pc) { > > What about the context_id? PSCI 0.2+ mandates it, and some project rely upon > it (though Linux currently does not). Yes context_id is not used in my code. In fact, I use the same psci_cpu_on prototypes and logic than other platform : ./arch/arm/cpu/armv7/sunxi/psci.c:246 ./arch/arm/mach-uniphier/arm32/psci.c:134 ./arch/arm/cpu/armv7/ls102xa/psci.S:117 => all are based on psci_save_target_pc() to save the PC in secure context (psci_target_pc[]) ./arch/arm/cpu/armv7/psci-common.c:29 But context is not saved or used in generic PSCI code, only pc is restored => ./arch/arm/cpu/armv7/psci.S:330 r0 = psci_get_target_pc() is called before _do_nonsec_entry I will check deeper in this U-Boot PSCI code. => I try to solve the problem and push a RFC or a patch to have feedback form other PSCI user. Even it is not block for Linux point of view, as context ID is not used in linux code always = 0: ./drivers/firmware/psci.c: static int psci_cpu_on(unsigned long cpuid, unsigned long entry_point) err = invoke_psci_fn(fn, cpuid, entry_point, 0); > Does some other part of U-Boot do some state tracking? What happens if this is > called for a CPU that's already online? No issue, the CPU continue to run TAMP register is only used by BootRom to unpark the cpu on boot, update of the backup have no impact when the CPU is running. I will add a comment in the next patch " arm: stm32mp1: complete PSCI v1.0 support" and also check if I can add test the cpu state to manage other possible return value (never used in U-Boot): PSCI_RET_ALREADY_ON PSCI_RET_ON_PENDING > > Thanks, > Mark. Very thanks for the review. That allows me to read deeper the PSCI documents. Tom: do you think that this patch can be merged in v2018.05-rc1 ? and I will sent a 2nd patch for full PCSI v1.0 support and correct the missing parts reported by Mark. Thanks Patrick ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 3/9] net: Move the DHCP command below the BOOTP command
From: Joe HershbergerTo: u-boot@lists.denx.de Cc: Heinrich ; Michal Simek ; Simon Glass ; Duncan Hare ; Tom Rini ; Maxime Ripard ; Joe Hershberger Sent: Wednesday, March 28, 2018 1:53 PM Subject: [PATCH 3/9] net: Move the DHCP command below the BOOTP command Move DHCP to directly follow BOOTP so that Kconfig can show the dependency as a hierarchy. Signed-off-by: Joe Hershberger --- cmd/Kconfig | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/Kconfig b/cmd/Kconfig index d714f73..7ef9501 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1024,6 +1024,12 @@ config CMD_BOOTP help bootp - boot image via network using BOOTP/TFTP protocol +config CMD_DHCP + bool "dhcp" + depends on CMD_BOOTP + help + Boot image via network using DHCP/TFTP protocol + config BOOTP_BOOTPATH bool "Enable BOOTP BOOTPATH" depends on CMD_BOOTP @@ -1097,12 +1103,6 @@ config CMD_RARP help Boot image via network using RARP/TFTP protocol -config CMD_DHCP - bool "dhcp" - depends on CMD_BOOTP - help - Boot image via network using DHCP/TFTP protocol - config CMD_PXE bool "pxe" select MENU -- 1.7.11.5 Reviewed by: Duncan Hare d...@synoia.com ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v1 1/2] imx: board: Add support for the K+P's kp_imx6q_tpc board
Hi Stefano, > Hi Lukasz, > > On 14/03/2018 11:07, Lukasz Majewski wrote: > > This commit provides support for Kieback & Peter GmbH IMX6Q based > > TPC board. > > > > Maybe you can add the U-Boot output (as done by other boards) to make > clear which peripherals are available. Ok. > > > Signed-off-by: Lukasz Majewski> > > > --- > > > > arch/arm/mach-imx/mx6/Kconfig | 11 ++ > > board/k+p/kp_imx6q_tpc/Kconfig| 12 ++ > > board/k+p/kp_imx6q_tpc/MAINTAINERS| 6 + > > board/k+p/kp_imx6q_tpc/Makefile | 11 ++ > > board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c | 302 > > ++ > > board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c | 283 > > > > configs/kp_imx6q_tpc_defconfig| 42 + > > include/configs/kp_imx6q_tpc.h| 128 + 8 > > files changed, 795 insertions(+) create mode 100644 > > board/k+p/kp_imx6q_tpc/Kconfig create mode 100644 > > board/k+p/kp_imx6q_tpc/MAINTAINERS create mode 100644 > > board/k+p/kp_imx6q_tpc/Makefile create mode 100644 > > board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c create mode 100644 > > board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c create mode 100644 > > configs/kp_imx6q_tpc_defconfig create mode 100644 > > include/configs/kp_imx6q_tpc.h > > > > diff --git a/arch/arm/mach-imx/mx6/Kconfig > > b/arch/arm/mach-imx/mx6/Kconfig index d4ce38db8d..aa6f5facbf 100644 > > --- a/arch/arm/mach-imx/mx6/Kconfig > > +++ b/arch/arm/mach-imx/mx6/Kconfig > > @@ -387,6 +387,16 @@ config TARGET_TBS2910 > > config TARGET_TITANIUM > > bool "titanium" > > > > +config TARGET_KP_IMX6Q_TPC > > + bool "K+P KP_IMX6Q_TPC i.MX6 Quad" > > + select MX6QDL > > + select BOARD_LATE_INIT > > + select BOARD_EARLY_INIT_F > > + select SUPPORT_SPL > > + select DM > > + select DM_THERMAL > > + imply CMD_SPL > > + > > config TARGET_TQMA6 > > bool "TQ Systems TQMa6 board" > > select BOARD_LATE_INIT > > @@ -493,6 +503,7 @@ source "board/tbs/tbs2910/Kconfig" > > source "board/tqc/tqma6/Kconfig" > > source "board/toradex/apalis_imx6/Kconfig" > > source "board/toradex/colibri_imx6/Kconfig" > > +source "board/k+p/kp_imx6q_tpc/Kconfig" > > source "board/udoo/Kconfig" > > source "board/udoo/neo/Kconfig" > > source "board/wandboard/Kconfig" > > diff --git a/board/k+p/kp_imx6q_tpc/Kconfig > > b/board/k+p/kp_imx6q_tpc/Kconfig new file mode 100644 > > index 00..62e34978ec > > --- /dev/null > > +++ b/board/k+p/kp_imx6q_tpc/Kconfig > > @@ -0,0 +1,12 @@ > > +if TARGET_KP_IMX6Q_TPC > > + > > +config SYS_BOARD > > + default "kp_imx6q_tpc" > > + > > +config SYS_VENDOR > > + default "k+p" > > + > > +config SYS_CONFIG_NAME > > + default "kp_imx6q_tpc" > > + > > +endif > > diff --git a/board/k+p/kp_imx6q_tpc/MAINTAINERS > > b/board/k+p/kp_imx6q_tpc/MAINTAINERS new file mode 100644 > > index 00..6c4c8dd28e > > --- /dev/null > > +++ b/board/k+p/kp_imx6q_tpc/MAINTAINERS > > @@ -0,0 +1,6 @@ > > +KP_IMX6Q_TPC BOARD > > +M: Lukasz Majewski > > +S: Maintained > > +F: board/k+p/kp_imx6q_tpc/ > > +F: include/configs/kp_imx6q_tpc.h > > +F: configs/kp_imx6q_tpc_defconfig > > diff --git a/board/k+p/kp_imx6q_tpc/Makefile > > b/board/k+p/kp_imx6q_tpc/Makefile new file mode 100644 > > index 00..51cbd3e843 > > --- /dev/null > > +++ b/board/k+p/kp_imx6q_tpc/Makefile > > @@ -0,0 +1,11 @@ > > +# > > +# Copyright (C) 2018 Lukasz Majewski > > +# > > +# SPDX-License-Identifier: GPL-2.0+ > > +# > > + > > +ifdef CONFIG_SPL_BUILD > > +obj-y := kp_imx6q_tpc_spl.o > > +else > > +obj-y := kp_imx6q_tpc.o > > +endif > > diff --git a/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c > > b/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c new file mode 100644 > > index 00..9a5b88029f > > --- /dev/null > > +++ b/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c > > @@ -0,0 +1,302 @@ > > +/* > > + * K+P iMX6Q KP_IMX6Q_TPC board configuration > > + * > > + * Copyright (C) 2018 Lukasz Majewski > > + * > > + * SPDX-License-Identifier:GPL-2.0+ > > + */ > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +DECLARE_GLOBAL_DATA_PTR; > > + > > +#define > > ENET_PAD_CTRL > > \ > > + (PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | > > PAD_CTL_DSE_40ohm | \ > > +PAD_CTL_HYS) > > + > > +#define > > I2C_PAD_CTRL > > \ > > + (PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | > > PAD_CTL_DSE_40ohm | \ > > + PAD_CTL_HYS | PAD_CTL_ODE | PAD_CTL_SRE_FAST) > > + > > +#define PC MUX_PAD_CTRL(I2C_PAD_CTRL) > > + > > +static struct i2c_pads_info kp_imx6q_tpc_i2c_pad_info0 = { > > + .scl = { > > + .i2c_mode = MX6Q_PAD_CSI0_DAT9__I2C1_SCL | PC,
Re: [U-Boot] [PATCH 5/9] net: Add the BOOTP_DNS2 option to Kconfig
From: Joe HershbergerTo: u-boot@lists.denx.de Cc: Heinrich ; Michal Simek ; Simon Glass ; Duncan Hare ; Tom Rini ; Maxime Ripard ; Joe Hershberger Sent: Wednesday, March 28, 2018 1:53 PM Subject: [PATCH 5/9] net: Add the BOOTP_DNS2 option to Kconfig Commit 3b3ea2c56ec4bc5 ("Kconfig: cmd: Make networking command dependent on NET") removed the help documentation from the README but didn't add it back to Kconfig. Signed-off-by: Joe Hershberger --- cmd/Kconfig | 11 +++ 1 file changed, 11 insertions(+) diff --git a/cmd/Kconfig b/cmd/Kconfig index 76fd111..db75759 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1045,6 +1045,17 @@ config BOOTP_DNS returned, you must set BOOTP_DNS2 to store that second server IP also. +config BOOTP_DNS2 + bool "Store 'dnsip2' from BOOTP/DHCP server" + depends on BOOTP_DNS + help + If a DHCP client requests the DNS server IP from a DHCP server, + it is possible that more than one DNS serverip is offered to the + client. If CONFIG_BOOTP_DNS2 is enabled, the secondary DNS + server IP will be stored in the additional environment + variable "dnsip2". The first DNS serverip is always + stored in the variable "dnsip", when BOOTP_DNS is defined. + config BOOTP_GATEWAY bool "Request & store 'gatewayip' from BOOTP/DHCP server" depends on CMD_BOOTP -- 1.7.11.5Joe Good. Thanks. Reviewed by: Duncan Hare d...@synoia.com ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 6/9] net: Improve BOOTP PXE config option
From: Joe HershbergerTo: u-boot@lists.denx.de Cc: Heinrich ; Michal Simek ; Simon Glass ; Duncan Hare ; Tom Rini ; Maxime Ripard ; Joe Hershberger Sent: Wednesday, March 28, 2018 1:53 PM Subject: [PATCH 6/9] net: Improve BOOTP PXE config option Improve the documentation and correct the listed dependencies. Signed-off-by: Joe Hershberger --- cmd/Kconfig | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/Kconfig b/cmd/Kconfig index db75759..cc059c4 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1071,12 +1071,14 @@ config BOOTP_SUBNETMASK depends on CMD_BOOTP config BOOTP_PXE - bool "Enable BOOTP PXE" - depends on CMD_BOOTP + bool "Send PXE client arch to BOOTP/DHCP server" + depends on CMD_BOOTP && CMD_PXE + help + Supported for ARM, ARM64, and x86 for now. config BOOTP_PXE_CLIENTARCH hex - depends on CMD_BOOTP + depends on BOOTP_PXE default 0x16 if ARM64 default 0x15 if ARM default 0 if X86 -- 1.7.11.5 Reviewed by: Duncan Hare d...@synoia.com ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 7/9] net: Make the BOOTP options default
From: Joe HershbergerTo: u-boot@lists.denx.de Cc: Heinrich ; Michal Simek ; Simon Glass ; Duncan Hare ; Tom Rini ; Maxime Ripard ; Joe Hershberger Sent: Wednesday, March 28, 2018 1:53 PM Subject: [PATCH 7/9] net: Make the BOOTP options default The BOOTP options used to be and should still be default for all boards with CMD_NET enabled. One should not be forced to use DISTRO_DEFAULTS to get them. Signed-off-by: Joe Hershberger --- Kconfig | 6 -- cmd/Kconfig | 6 ++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Kconfig b/Kconfig index 6670913..17e6212 100644 --- a/Kconfig +++ b/Kconfig @@ -79,12 +79,6 @@ config DISTRO_DEFAULTS select CMD_PING if NET select CMD_PART if PARTITIONS select HUSH_PARSER - select BOOTP_BOOTPATH if NET && CMD_NET - select BOOTP_DNS if NET && CMD_NET - select BOOTP_GATEWAY if NET && CMD_NET - select BOOTP_HOSTNAME if NET && CMD_NET - select BOOTP_PXE if NET && CMD_NET - select BOOTP_SUBNETMASK if NET && CMD_NET select CMDLINE_EDITING select AUTO_COMPLETE select SYS_LONGHELP diff --git a/cmd/Kconfig b/cmd/Kconfig index cc059c4..6eff18f 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1032,6 +1032,7 @@ config CMD_DHCP config BOOTP_BOOTPATH bool "Request & store 'rootpath' from BOOTP/DHCP server" + default y depends on CMD_BOOTP help Even though the config is called BOOTP_BOOTPATH, it stores the @@ -1039,6 +1040,7 @@ config BOOTP_BOOTPATH config BOOTP_DNS bool "Request & store 'dnsip' from BOOTP/DHCP server" + default y depends on CMD_BOOTP help The primary DNS server is stored as 'dnsip'. If two servers are @@ -1058,20 +1060,24 @@ config BOOTP_DNS2 config BOOTP_GATEWAY bool "Request & store 'gatewayip' from BOOTP/DHCP server" + default y depends on CMD_BOOTP config BOOTP_HOSTNAME bool "Request & store 'hostname' from BOOTP/DHCP server" + default y depends on CMD_BOOTP help The name may or may not be qualified with the local domain name. config BOOTP_SUBNETMASK bool "Request & store 'netmask' from BOOTP/DHCP server" + default y depends on CMD_BOOTP config BOOTP_PXE bool "Send PXE client arch to BOOTP/DHCP server" + default y depends on CMD_BOOTP && CMD_PXE help Supported for ARM, ARM64, and x86 for now. -- 1.7.11.5 Reviewed by: Duncan Hare d...@synoia.com ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 8/9] net: Make core net code depend on NET instead of CMD_NET
From: Joe HershbergerTo: u-boot@lists.denx.de Cc: Heinrich ; Michal Simek ; Simon Glass ; Duncan Hare ; Tom Rini ; Maxime Ripard ; Joe Hershberger Sent: Wednesday, March 28, 2018 1:53 PM Subject: [PATCH 8/9] net: Make core net code depend on NET instead of CMD_NET No commands are necessary to have a network stack. Signed-off-by: Joe Hershberger --- net/Makefile | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/net/Makefile b/net/Makefile index ed102ec..95e9f63 100644 --- a/net/Makefile +++ b/net/Makefile @@ -8,18 +8,18 @@ #ccflags-y += -DDEBUG obj-y += checksum.o -obj-$(CONFIG_CMD_NET) += arp.o +obj-$(CONFIG_NET) += arp.o obj-$(CONFIG_CMD_BOOTP) += bootp.o obj-$(CONFIG_CMD_CDP) += cdp.o obj-$(CONFIG_CMD_DNS) += dns.o ifdef CONFIG_DM_ETH -obj-$(CONFIG_CMD_NET) += eth-uclass.o +obj-$(CONFIG_NET) += eth-uclass.o else -obj-$(CONFIG_CMD_NET) += eth_legacy.o +obj-$(CONFIG_NET) += eth_legacy.o endif -obj-$(CONFIG_CMD_NET) += eth_common.o +obj-$(CONFIG_NET) += eth_common.o obj-$(CONFIG_CMD_LINK_LOCAL) += link_local.o -obj-$(CONFIG_CMD_NET) += net.o +obj-$(CONFIG_NET) += net.o obj-$(CONFIG_CMD_NFS) += nfs.o obj-$(CONFIG_CMD_PING) += ping.o obj-$(CONFIG_CMD_RARP) += rarp.o -- 1.7.11.5 Reviewed by Duncan Hare d...@synoia.com ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 9/9] Revert "Kconfig: cmd: Make networking command dependent on NET"
From: Joe HershbergerTo: u-boot@lists.denx.de Cc: Heinrich ; Michal Simek ; Simon Glass ; Duncan Hare ; Tom Rini ; Maxime Ripard ; Joe Hershberger Sent: Wednesday, March 28, 2018 1:53 PM Subject: [PATCH 9/9] Revert "Kconfig: cmd: Make networking command dependent on NET" This reverts the parts of commit 3b3ea2c56ec4bc5588281fd103c744e608f8b25c where it changed the EFI dependency on NET. Signed-off-by: Joe Hershberger --- Kconfig | 2 +- cmd/bootefi.c | 4 ++-- lib/efi_loader/Makefile | 2 +- lib/efi_loader/efi_device_path.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Kconfig b/Kconfig index 17e6212..89f685b 100644 --- a/Kconfig +++ b/Kconfig @@ -70,7 +70,7 @@ config DISTRO_DEFAULTS select CMD_BOOTZ if ARM && !ARM64 select CMD_BOOTI if ARM64 select CMD_DHCP if NET && CMD_NET - select CMD_PXE if NET && CMD_NET + select CMD_PXE if NET select CMD_EXT2 select CMD_EXT4 select CMD_FAT diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 6546272..7b1c09f 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -42,7 +42,7 @@ static void efi_init_obj_list(void) #if defined(CONFIG_LCD) || defined(CONFIG_DM_VIDEO) efi_gop_register(); #endif -#ifdef CONFIG_CMD_NET +#ifdef CONFIG_NET efi_net_register(); #endif #ifdef CONFIG_GENERATE_SMBIOS_TABLE @@ -450,7 +450,7 @@ void efi_set_bootdev(const char *dev, const char *devnr, const char *path) bootefi_device_path = efi_dp_from_part(desc, part); } else { -#ifdef CONFIG_CMD_NET +#ifdef CONFIG_NET bootefi_device_path = efi_dp_from_eth(); #endif } diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile index 2a87d9e..2722265 100644 --- a/lib/efi_loader/Makefile +++ b/lib/efi_loader/Makefile @@ -21,5 +21,5 @@ obj-y += efi_file.o efi_variable.o efi_bootmgr.o efi_watchdog.o obj-$(CONFIG_LCD) += efi_gop.o obj-$(CONFIG_DM_VIDEO) += efi_gop.o obj-$(CONFIG_PARTITIONS) += efi_disk.o -obj-$(CONFIG_CMD_NET) += efi_net.o +obj-$(CONFIG_NET) += efi_net.o obj-$(CONFIG_GENERATE_SMBIOS_TABLE) += efi_smbios.o diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c index 3c735e6..ecc4eda 100644 --- a/lib/efi_loader/efi_device_path.c +++ b/lib/efi_loader/efi_device_path.c @@ -746,7 +746,7 @@ struct efi_device_path *efi_dp_from_file(struct blk_desc *desc, int part, return start; } -#ifdef CONFIG_CMD_NET +#ifdef CONFIG_NET struct efi_device_path *efi_dp_from_eth(void) { struct efi_device_path_mac_addr *ndp; -- 1.7.11.5 Reviewed by Duncan Hare d...@synoia.com ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v1 5/5] net: Avoid build fail on am335x when NET is disabled
On Thu, Mar 29, 2018 at 4:53 PM, Joe Hershbergerwrote: > On Thu, Mar 29, 2018 at 10:17 AM, Alex Kiernan wrote: >> Commit f411b5cca48f ("board: am335x: Always set eth/eth1addr environment >> variable") adds support for Ethernet in Linux, but not U-Boot. >> >> Ensure that we can do this even when U-Boot is compiled without >> network support. > > Please improve this commit log. It should have a subject that says > what it does (Move enetaddr env access code to env config instead of > net config) Then talk about why you are doing it in the body (i.e. the > current subject). > >> >> Signed-off-by: Alex Kiernan >> --- >> >> cmd/nvedit.c | 30 ++ >> include/common.h | 4 >> include/net.h| 3 --- >> net/eth_common.c | 30 -- >> 4 files changed, 34 insertions(+), 33 deletions(-) >> >> diff --git a/cmd/nvedit.c b/cmd/nvedit.c >> index 4cb25b8..4008de1 100644 >> --- a/cmd/nvedit.c >> +++ b/cmd/nvedit.c >> @@ -341,6 +341,36 @@ ulong env_get_hex(const char *varname, ulong >> default_val) >> return value; >> } >> >> +void eth_parse_enetaddr(const char *addr, uchar *enetaddr) >> +{ >> + char *end; >> + int i; >> + >> + for (i = 0; i < 6; ++i) { >> + enetaddr[i] = addr ? simple_strtoul(addr, , 16) : 0; >> + if (addr) >> + addr = (*end) ? end + 1 : end; >> + } >> +} >> + >> +int eth_env_get_enetaddr(const char *name, uchar *enetaddr) >> +{ >> + eth_parse_enetaddr(env_get(name), enetaddr); >> + return is_valid_ethaddr(enetaddr); >> +} >> + >> +int eth_env_set_enetaddr(const char *name, const uchar *enetaddr) >> +{ >> + char buf[ARP_HLEN_ASCII + 1]; >> + >> + if (eth_env_get_enetaddr(name, (uchar *)buf)) >> + return -EEXIST; >> + >> + sprintf(buf, "%pM", enetaddr); >> + >> + return env_set(name, buf); >> +} >> + >> #ifndef CONFIG_SPL_BUILD >> static int do_env_set(cmd_tbl_t *cmdtp, int flag, int argc, char * const >> argv[]) >> { >> diff --git a/include/common.h b/include/common.h >> index 3087505..b7280eb 100644 >> --- a/include/common.h >> +++ b/include/common.h >> @@ -243,6 +243,10 @@ static inline int env_set_addr(const char *varname, >> const void *addr) >> return env_set_hex(varname, (ulong)addr); >> } >> >> +void eth_parse_enetaddr(const char *addr, uchar *enetaddr); >> +int eth_env_get_enetaddr(const char *name, uchar *enetaddr); >> +int eth_env_set_enetaddr(const char *name, const uchar *enetaddr); > > Please move this to include/environment.h > Will do, thanks for the feedback. -- Alex Kiernan ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/9] net: Make CMD_NET a menuconfig
From: Joe HershbergerTo: u-boot@lists.denx.de Cc: Heinrich ; Michal Simek ; Simon Glass ; Duncan Hare ; Tom Rini ; Maxime Ripard ; Joe Hershberger Sent: Wednesday, March 28, 2018 1:53 PM Subject: [PATCH 1/9] net: Make CMD_NET a menuconfig Previously, CMD_NET was an alias for 2 commands (bootp and tftpboot) and they we not able to be disabled. Separate out those 2 commands and move CMD_NET up to the menu level, which more accurately represents the code. Signed-off-by: Joe Hershberger --- cmd/Kconfig | 25 + cmd/net.c | 4 net/Kconfig | 19 +-- net/Makefile | 4 ++-- 4 files changed, 32 insertions(+), 20 deletions(-) diff --git a/cmd/Kconfig b/cmd/Kconfig index 136836d..f2a12ce 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1010,25 +1010,35 @@ config CMD_SETEXPR endmenu -menu "Network commands" - if NET -config CMD_NET - bool "bootp, tftpboot" +menuconfig CMD_NET + bool "Network commands" + default y + +if CMD_NET + +config CMD_BOOTP + bool "bootp" default y help - Network commands. bootp - boot image via network using BOOTP/TFTP protocol + +config CMD_TFTPBOOT + bool "tftpboot" + default y + help tftpboot - boot image via network using TFTP protocol config CMD_TFTPPUT bool "tftp put" + depends on CMD_TFTPBOOT help TFTP put command, for uploading files to a server config CMD_TFTPSRV bool "tftpsrv" + depends on CMD_TFTPBOOT help Act as a TFTP server and boot the first received file @@ -1039,13 +1049,12 @@ config CMD_RARP config CMD_DHCP bool "dhcp" - depends on CMD_NET + depends on CMD_BOOTP help Boot image via network using DHCP/TFTP protocol config CMD_PXE bool "pxe" - depends on CMD_NET select MENU help Boot image via network using PXE protocol @@ -1096,7 +1105,7 @@ config CMD_ETHSW endif -endmenu +endif menu "Misc commands" diff --git a/cmd/net.c b/cmd/net.c index d7c776a..67888d4 100644 --- a/cmd/net.c +++ b/cmd/net.c @@ -14,6 +14,7 @@ static int netboot_common(enum proto_t, cmd_tbl_t *, int, char * const []); +#ifdef CONFIG_CMD_BOOTP static int do_bootp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { return netboot_common(BOOTP, cmdtp, argc, argv); @@ -24,7 +25,9 @@ U_BOOT_CMD( "boot image via network using BOOTP/TFTP protocol", "[loadAddress] [[hostIPaddr:]bootfilename]" ); +#endif +#ifdef CONFIG_CMD_TFTPBOOT int do_tftpb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { int ret; @@ -40,6 +43,7 @@ U_BOOT_CMD( "boot image via network using TFTP protocol", "[loadAddress] [[hostIPaddr:]bootfilename]" ); +#endif #ifdef CONFIG_CMD_TFTPPUT static int do_tftpput(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) diff --git a/net/Kconfig b/net/Kconfig index 143c441..d421a34 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -24,7 +24,7 @@ config NETCONSOLE config NET_TFTP_VARS bool "Control TFTP timeout and count through environment" - depends on CMD_NET + depends on CMD_TFTPBOOT default y help If set, allows controlling the TFTP timeout through the @@ -35,39 +35,38 @@ config NET_TFTP_VARS config BOOTP_BOOTPATH bool "Enable BOOTP BOOTPATH" - depends on CMD_NET + depends on CMD_BOOTP config BOOTP_DNS bool "Enable bootp DNS" - depends on CMD_NET + depends on CMD_BOOTP config BOOTP_GATEWAY bool "Enable BOOTP gateway" - depends on CMD_NET + depends on CMD_BOOTP config BOOTP_HOSTNAME bool "Enable BOOTP hostname" - depends on CMD_NET + depends on CMD_BOOTP config BOOTP_PXE bool "Enable BOOTP PXE" - depends on CMD_NET + depends on CMD_BOOTP config BOOTP_SUBNETMASK bool "Enable BOOTP subnetmask" - depends on CMD_NET - depends on CMD_NET + depends on CMD_BOOTP config BOOTP_PXE_CLIENTARCH hex - depends on CMD_NET + depends on CMD_BOOTP default 0x16 if ARM64 default 0x15 if ARM default 0 if X86 config BOOTP_VCI_STRING string - depends on CMD_NET + depends on CMD_BOOTP default "U-Boot.armv7" if CPU_V7 || CPU_V7M default "U-Boot.armv8" if ARM64 default "U-Boot.arm" if ARM diff --git a/net/Makefile b/net/Makefile index ae54eee..ed102ec 100644 --- a/net/Makefile +++ b/net/Makefile @@ -9,7 +9,7 @@ obj-y += checksum.o obj-$(CONFIG_CMD_NET) += arp.o -obj-$(CONFIG_CMD_NET) += bootp.o +obj-$(CONFIG_CMD_BOOTP) += bootp.o obj-$(CONFIG_CMD_CDP) += cdp.o obj-$(CONFIG_CMD_DNS) += dns.o ifdef CONFIG_DM_ETH @@ -24,7 +24,7 @@ obj-$(CONFIG_CMD_NFS) += nfs.o obj-$(CONFIG_CMD_PING) += ping.o obj-$(CONFIG_CMD_RARP) += rarp.o
Re: [U-Boot] [PATCH 0/9] net: Clean up the menus and dependencies among commands and options
From: Joe HershbergerTo: u-boot@lists.denx.de Cc: Heinrich ; Michal Simek ; Simon Glass ; Duncan Hare ; Tom Rini ; Maxime Ripard ; Joe Hershberger Sent: Wednesday, March 28, 2018 1:53 PM Subject: [PATCH 0/9] net: Clean up the menus and dependencies among commands and options There have been a few issues persisting in the net menus and a recent change that went in (Kconfig: cmd: Make networking command dependent on NET) caused a few new issues. Clean up these things and further move to separate CMD_NET from NET along appropriate boundaries. Joe Hershberger (9): net: Make CMD_NET a menuconfig net: Move net command options to the cmd menu net: Move the DHCP command below the BOOTP command net: Improve menu options and help for BOOTP options net: Add the BOOTP_DNS2 option to Kconfig net: Improve BOOTP PXE config option net: Make the BOOTP options default net: Make core net code depend on NET instead of CMD_NET Revert "Kconfig: cmd: Make networking command dependent on NET" Kconfig | 8 +-- cmd/Kconfig | 113 ++- cmd/bootefi.c | 4 +- cmd/net.c | 4 ++ lib/efi_loader/Makefile | 2 +- lib/efi_loader/efi_device_path.c | 2 +- net/Kconfig | 51 -- net/Makefile | 14 ++--- 8 files changed, 116 insertions(+), 82 deletions(-) -- 1.7.11.5 Reviewed by Duncan Hare, d...@synoia.com ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v1 2/2] boot: script: The boot.scr file for K+P's boards
On 14/03/2018 11:07, Lukasz Majewski wrote: > By using this file one can avoid cluttering .h file with u-boot > HUSH commands necessary for booting target device. > > With such approach the commands are stored only in one place and can be > reused if needed. > > Signed-off-by: Lukasz Majewski> > --- > > board/k+p/bootscripts/tpcboot.cmd | 96 > +++ > 1 file changed, 96 insertions(+) > create mode 100644 board/k+p/bootscripts/tpcboot.cmd > > diff --git a/board/k+p/bootscripts/tpcboot.cmd > b/board/k+p/bootscripts/tpcboot.cmd > new file mode 100644 > index 00..f6d59a1186 > --- /dev/null > +++ b/board/k+p/bootscripts/tpcboot.cmd > @@ -0,0 +1,96 @@ > +# > +# Copyright (C) 2018 > +# Lukasz Majewski, DENX Software Engineering, lu...@denx.de > +# > +# > +# This is an example file to generate boot.scr - a boot script for U-Boot > +# Generate boot.scr: > +# ./tools/mkimage -c none -A arm -T script -d tpcboot.cmd boot.scr > +# > +# SPDX-License-Identifier: GPL-2.0+ > + > + > +# Input envs (to be set in environment) > +# Mandatory: > +# kernel_file = "fitImage" > +# boardname = "" // set automatically in u-boot > +# boardsoc = "imx6q" // set automatically in u-boot > +# > +# Optional: > +# bootcmd_force = "nfs" "tftp_kernel" > +# If not set - eMMC/SD boot > + > +# Generic setup > +setenv mmcroot "/dev/mmcblk${devnum}p2 rootwait rw" > +setenv displayargs "" > +setenv mmcargs "setenv bootargs console=${console} ${smp} root=${mmcroot} \ > + ${displayargs}" > +setenv boot_fitImage " > + setenv fdt_conf 'conf@${boardsoc}-${boardname}.dtb'; > + setenv itbcfg "\"#\${fdt_conf}\""; > + print itbcfg; > + bootm '${loadaddr}${itbcfg}';" > + > +# > +# > +# Provide default 'bootcmd' command > +# > +setenv bootcmd " > +if test -e ${devtype} ${devnum}:${distro_bootpart} ${kernel_file}; then > + echo Found kernel image: ${kernel_file}; > + if load ${devtype} ${devnum}:${distro_bootpart} ${loadaddr} \ > +${kernel_file}; then > + run mmcargs; > + run boot_fitImage; > + fi; > +fi;" > + > +# > +# > +# Provide 'boot_tftp_kernel' command > +# > +setenv download_kernel "tftpboot ${loadaddr} ${kernel_file}" > + > +setenv boot_tftp_kernel " > +if run download_kernel; then > + run mmcargs; > + run boot_fitImage; > +fi" > + > +# > +# > +# Provide 'boot_nfs' command > +# > +setenv rootpath "/srv/tftp/KP/rootfs" > +setenv nfsargs "setenv bootargs root=/dev/nfs rw \ > + nfsroot=${serverip}:${rootpath},nolock,nfsvers=3" > +setenv addip "setenv bootargs ${bootargs} \ > + ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:\ > + ${hostname}:eth0:on" > + > +setenv boot_nfs " > +if run download_kernel; then > + run nfsargs; > + run addip; > + setenv bootargs ${bootargs} console=${console}; > + > + run boot_fitImage; > +fi" > + > +# > +# > +# Set correct boot flow > +# > + > +setenv bcmd " > +if test ! -n ${bootcmd_force}; then > + run bootcmd; > +fi; > +if test ${bootcmd_force} = nfs; then > + run boot_nfs; > +else if test ${bootcmd_force} = tftp_kernel; then > + run boot_tftp_kernel; > + fi; > +fi" > + > +run bcmd > Reviewed-by: Stefano Babic Best regards, Stefano Babic -- = 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 v1 1/2] imx: board: Add support for the K+P's kp_imx6q_tpc board
Hi Lukasz, On 14/03/2018 11:07, Lukasz Majewski wrote: > This commit provides support for Kieback & Peter GmbH IMX6Q based > TPC board. > Maybe you can add the U-Boot output (as done by other boards) to make clear which peripherals are available. > Signed-off-by: Lukasz Majewski> > --- > > arch/arm/mach-imx/mx6/Kconfig | 11 ++ > board/k+p/kp_imx6q_tpc/Kconfig| 12 ++ > board/k+p/kp_imx6q_tpc/MAINTAINERS| 6 + > board/k+p/kp_imx6q_tpc/Makefile | 11 ++ > board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c | 302 > ++ > board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c | 283 > configs/kp_imx6q_tpc_defconfig| 42 + > include/configs/kp_imx6q_tpc.h| 128 + > 8 files changed, 795 insertions(+) > create mode 100644 board/k+p/kp_imx6q_tpc/Kconfig > create mode 100644 board/k+p/kp_imx6q_tpc/MAINTAINERS > create mode 100644 board/k+p/kp_imx6q_tpc/Makefile > create mode 100644 board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c > create mode 100644 board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c > create mode 100644 configs/kp_imx6q_tpc_defconfig > create mode 100644 include/configs/kp_imx6q_tpc.h > > diff --git a/arch/arm/mach-imx/mx6/Kconfig b/arch/arm/mach-imx/mx6/Kconfig > index d4ce38db8d..aa6f5facbf 100644 > --- a/arch/arm/mach-imx/mx6/Kconfig > +++ b/arch/arm/mach-imx/mx6/Kconfig > @@ -387,6 +387,16 @@ config TARGET_TBS2910 > config TARGET_TITANIUM > bool "titanium" > > +config TARGET_KP_IMX6Q_TPC > + bool "K+P KP_IMX6Q_TPC i.MX6 Quad" > + select MX6QDL > + select BOARD_LATE_INIT > + select BOARD_EARLY_INIT_F > + select SUPPORT_SPL > + select DM > + select DM_THERMAL > + imply CMD_SPL > + > config TARGET_TQMA6 > bool "TQ Systems TQMa6 board" > select BOARD_LATE_INIT > @@ -493,6 +503,7 @@ source "board/tbs/tbs2910/Kconfig" > source "board/tqc/tqma6/Kconfig" > source "board/toradex/apalis_imx6/Kconfig" > source "board/toradex/colibri_imx6/Kconfig" > +source "board/k+p/kp_imx6q_tpc/Kconfig" > source "board/udoo/Kconfig" > source "board/udoo/neo/Kconfig" > source "board/wandboard/Kconfig" > diff --git a/board/k+p/kp_imx6q_tpc/Kconfig b/board/k+p/kp_imx6q_tpc/Kconfig > new file mode 100644 > index 00..62e34978ec > --- /dev/null > +++ b/board/k+p/kp_imx6q_tpc/Kconfig > @@ -0,0 +1,12 @@ > +if TARGET_KP_IMX6Q_TPC > + > +config SYS_BOARD > + default "kp_imx6q_tpc" > + > +config SYS_VENDOR > + default "k+p" > + > +config SYS_CONFIG_NAME > + default "kp_imx6q_tpc" > + > +endif > diff --git a/board/k+p/kp_imx6q_tpc/MAINTAINERS > b/board/k+p/kp_imx6q_tpc/MAINTAINERS > new file mode 100644 > index 00..6c4c8dd28e > --- /dev/null > +++ b/board/k+p/kp_imx6q_tpc/MAINTAINERS > @@ -0,0 +1,6 @@ > +KP_IMX6Q_TPC BOARD > +M: Lukasz Majewski > +S: Maintained > +F: board/k+p/kp_imx6q_tpc/ > +F: include/configs/kp_imx6q_tpc.h > +F: configs/kp_imx6q_tpc_defconfig > diff --git a/board/k+p/kp_imx6q_tpc/Makefile b/board/k+p/kp_imx6q_tpc/Makefile > new file mode 100644 > index 00..51cbd3e843 > --- /dev/null > +++ b/board/k+p/kp_imx6q_tpc/Makefile > @@ -0,0 +1,11 @@ > +# > +# Copyright (C) 2018 Lukasz Majewski > +# > +# SPDX-License-Identifier: GPL-2.0+ > +# > + > +ifdef CONFIG_SPL_BUILD > +obj-y:= kp_imx6q_tpc_spl.o > +else > +obj-y:= kp_imx6q_tpc.o > +endif > diff --git a/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c > b/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c > new file mode 100644 > index 00..9a5b88029f > --- /dev/null > +++ b/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c > @@ -0,0 +1,302 @@ > +/* > + * K+P iMX6Q KP_IMX6Q_TPC board configuration > + * > + * Copyright (C) 2018 Lukasz Majewski > + * > + * SPDX-License-Identifier: GPL-2.0+ > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +DECLARE_GLOBAL_DATA_PTR; > + > +#define ENET_PAD_CTRL > \ > + (PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | \ > + PAD_CTL_HYS) > + > +#define I2C_PAD_CTRL \ > + (PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | \ > + PAD_CTL_HYS | PAD_CTL_ODE | PAD_CTL_SRE_FAST) > + > +#define PC MUX_PAD_CTRL(I2C_PAD_CTRL) > + > +static struct i2c_pads_info kp_imx6q_tpc_i2c_pad_info0 = { > + .scl = { > + .i2c_mode = MX6Q_PAD_CSI0_DAT9__I2C1_SCL | PC, > + .gpio_mode = MX6Q_PAD_CSI0_DAT9__GPIO5_IO27 | PC, > + .gp = IMX_GPIO_NR(5, 27) > + }, > + .sda = { > + .i2c_mode =
Re: [U-Boot] [PATCH 1/1] wandboard: remove superfluous include
On 09/03/2018 00:56, Fabio Estevam wrote: > On Thu, Mar 8, 2018 at 7:00 PM, Heinrich Schuchardt> wrote: >> No definition provided by input.h is used in the board file. >> >> Signed-off-by: Heinrich Schuchardt > > Reviewed-by: Fabio Estevam > Applied to u-boot-imx, thanks ! Best regards, Stefano Babic -- = 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 2/2] imx7: spl: Check for Serial Downloader in spl_boot_device
On 06/03/2018 15:38, Eran Matityahu wrote: > Similarly to imx6, before reading the boot device, first check > bmode to see if the serial downloader has been selected > explicitly, then check whether the serial downloader has been > activated due to unbootable primary boot devices (e.g. empty eMMC). > > If the serial downloader is activated, return BOOT_DEVICE_BOARD. > This allows SPL with SDP support to wait for the U-Boot image > to be loaded via the serial download protocol using imx_usb_loader. > > Signed-off-by: Eran Matityahu> --- > arch/arm/mach-imx/spl.c | 23 +++ > 1 file changed, 23 insertions(+) > > diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c > index b2521b2..6fc2463 100644 > --- a/arch/arm/mach-imx/spl.c > +++ b/arch/arm/mach-imx/spl.c > @@ -101,6 +101,29 @@ u32 spl_boot_device(void) > /* Translate iMX7/MX8M boot device to the SPL boot device enumeration */ > u32 spl_boot_device(void) > { > +#if defined(CONFIG_MX7) > + unsigned int bmode = readl(_base->sbmr2); > + > + /* > + * Check for BMODE if serial downloader is enabled > + * BOOT_MODE - see IMX7DRM Table 6-24 > + */ > + if (((bmode >> 24) & 0x03) == 0x01) /* Serial Downloader */ > + return BOOT_DEVICE_BOARD; > + > + /* > + * The above method does not detect that the boot ROM used > + * serial downloader in case the boot ROM decided to use the > + * serial downloader as a fall back (primary boot source failed). > + * > + * Infer that the boot ROM used the USB serial downloader by > + * checking whether the USB PHY is currently active... This > + * assumes that SPL did not (yet) initialize the USB PHY... > + */ > + if (is_boot_from_usb()) > + return BOOT_DEVICE_BOARD; > +#endif > + > enum boot_device boot_device_spl = get_boot_device(); > > switch (boot_device_spl) { > Applied to u-boot-imx, thanks ! Best regards, Stefano Babic -- = 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 1/2] imx7: Add src_base structure define macro
On 06/03/2018 15:37, Eran Matityahu wrote: > Add src_base structure global define macro, similarly to imx6 > > Signed-off-by: Eran Matityahu> --- > arch/arm/include/asm/arch-mx7/imx-regs.h | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/arch/arm/include/asm/arch-mx7/imx-regs.h > b/arch/arm/include/asm/arch-mx7/imx-regs.h > index 3726f02..0cdb508 100644 > --- a/arch/arm/include/asm/arch-mx7/imx-regs.h > +++ b/arch/arm/include/asm/arch-mx7/imx-regs.h > @@ -264,6 +264,8 @@ struct src { > u32 ddrc_rcr; > }; > > +#define src_base ((struct src *)SRC_BASE_ADDR) > + > #define SRC_M4_REG_OFFSET0xC > #define SRC_M4C_NON_SCLR_RST_OFFSET 0 > #define SRC_M4C_NON_SCLR_RST_MASKBIT(0) > Applied to u-boot-imx, thanks ! Best regards, Stefano Babic -- = 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 1/2] mx7_common: Fix SPL compilation with secure boot support enabled
On 28/02/2018 08:51, Eran Matityahu wrote: > The SPL MISC driver support must be enabled, so that the driver can use OTP > fuse > to check if HAB is enabled. > > Signed-off-by: Eran Matityahu> --- > include/configs/mx7_common.h | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/include/configs/mx7_common.h b/include/configs/mx7_common.h > index defb38c..6ebf2e1 100644 > --- a/include/configs/mx7_common.h > +++ b/include/configs/mx7_common.h > @@ -59,6 +59,9 @@ > /* Secure boot (HAB) support */ > #ifdef CONFIG_SECURE_BOOT > #define CONFIG_CSF_SIZE 0x2000 > +#ifdef CONFIG_SPL_BUILD > +#define CONFIG_SPL_DRIVERS_MISC_SUPPORT > +#endif > #endif > > #endif > Applied to u-boot-imx, thanks ! Best regards, Stefano Babic -- = 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 2/2] Makefile: Build firmware-ivt image type for HAB verification also for mx7
On 28/02/2018 08:51, Eran Matityahu wrote: > Create u-boot-ivt.img and u-boot-ivt.img.log when building U-Boot > with SPL and Secure Boot enabled for imx7 (like it is done for imx6). > > See commit d21bd69b6e95ca7824941e7f527871cd5c63c7f7 for more info. > > Signed-off-by: Eran Matityahu> --- > Makefile | 4 > 1 file changed, 4 insertions(+) > > diff --git a/Makefile b/Makefile > index 57cb4b8..9650df5 100644 > --- a/Makefile > +++ b/Makefile > @@ -781,8 +781,12 @@ ALL-$(CONFIG_SPL) += spl/u-boot-spl.bin > ifeq ($(CONFIG_MX6)$(CONFIG_SECURE_BOOT), yy) > ALL-$(CONFIG_SPL_FRAMEWORK) += u-boot-ivt.img > else > +ifeq ($(CONFIG_MX7)$(CONFIG_SECURE_BOOT), yy) > +ALL-$(CONFIG_SPL_FRAMEWORK) += u-boot-ivt.img > +else > ALL-$(CONFIG_SPL_FRAMEWORK) += u-boot.img > endif > +endif > ALL-$(CONFIG_TPL) += tpl/u-boot-tpl.bin > ALL-$(CONFIG_OF_SEPARATE) += u-boot.dtb > ifeq ($(CONFIG_SPL_FRAMEWORK),y) > Applied to u-boot-imx, thanks ! Best regards, Stefano Babic -- = 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 2/2] ARM: dts: imx6ull: add wdog3
On 25/02/2018 18:12, Jörg Krause wrote: > The i.MX6ULL has a WDOG3 located at start address 0x021E in the > AIPS-2 memory region [1]. > > [1] i.MX 6ULL Applications Processor Reference Manual, Rev. 1, 11/2017, > Table 2-3. AIPS-2 memory map, p. 178 > > Signed-off-by: Jörg Krause> --- > arch/arm/dts/imx6ull.dtsi | 8 > 1 file changed, 8 insertions(+) > > diff --git a/arch/arm/dts/imx6ull.dtsi b/arch/arm/dts/imx6ull.dtsi > index 28b8422f31..f8ec649460 100644 > --- a/arch/arm/dts/imx6ull.dtsi > +++ b/arch/arm/dts/imx6ull.dtsi > @@ -1026,6 +1026,14 @@ > status = "disabled"; > }; > > + wdog3: wdog@021e4000 { > + compatible = "fsl,imx6ul-wdt", "fsl,imx21-wdt"; > + reg = <0x021e4000 0x4000>; > + interrupts = ; > + clocks = < IMX6UL_CLK_WDOG3>; > + status = "disabled"; > + }; > + > uart2: serial@021e8000 { > compatible = "fsl,imx6ul-uart", >"fsl,imx6q-uart", "fsl,imx21-uart"; > Applied to u-boot-imx, thanks ! Best regards, Stefano Babic -- = 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 1/2] ARM: dts: imx6ul: add wdog3
Hi Jörg, On 25/02/2018 18:12, Jörg Krause wrote: > The i.MX6UL has a WDOG3 located at start address 0x021E in the > AIPS-2 memory region [1]. > > [1] i.MX 6UltraLite Applications Processor Reference Manual, Rev. 1, > 04/2016, Table-2-3 AIPS-2 memory map, p. 166 > > Signed-off-by: Jörg Krause> --- > arch/arm/dts/imx6ul.dtsi | 8 > 1 file changed, 8 insertions(+) > > diff --git a/arch/arm/dts/imx6ul.dtsi b/arch/arm/dts/imx6ul.dtsi > index 7affab866f..b63f5a53ac 100644 > --- a/arch/arm/dts/imx6ul.dtsi > +++ b/arch/arm/dts/imx6ul.dtsi > @@ -881,6 +881,14 @@ > status = "disabled"; > }; > > + wdog3: wdog@021e4000 { > + compatible = "fsl,imx6ul-wdt", "fsl,imx21-wdt"; > + reg = <0x021e4000 0x4000>; > + interrupts = ; > + clocks = < IMX6UL_CLK_WDOG3>; > + status = "disabled"; > + }; > + > uart2: serial@021e8000 { > compatible = "fsl,imx6ul-uart", >"fsl,imx6q-uart"; > Applied to u-boot-imx, thanks ! Best regards, Stefano Babic -- = 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] [PATCHv1] board: ge: ppd: Fix environment variable location
On 15/02/2018 11:41, Sebastian Reichel wrote: > From: Nandor Han> > This fixes environment variable location to avoid overlapping with > U-Boot itself. Also more space for environment variables has been > reserved to prevent future issues. > > Signed-off-by: Nandor Han > Signed-off-by: Sebastian Reichel > --- > include/configs/mx53ppd.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/include/configs/mx53ppd.h b/include/configs/mx53ppd.h > index d0848254d6a1..d20996afdd31 100644 > --- a/include/configs/mx53ppd.h > +++ b/include/configs/mx53ppd.h > @@ -206,8 +206,8 @@ > (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET) > > /* FLASH and environment organization */ > -#define CONFIG_ENV_OFFSET (6 * 64 * 1024) > -#define CONFIG_ENV_SIZE(8 * 1024) > +#define CONFIG_ENV_OFFSET (12 * 64 * 1024) > +#define CONFIG_ENV_SIZE(10 * 1024) > #define CONFIG_ENV_IS_IN_MMC > #define CONFIG_SYS_MMC_ENV_DEV 0 > > Applied to u-boot-imx, thanks ! Best regards, Stefano Babic -- -- = 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] [PATCHv1] board: ge: bx50v3: enable backlight on demand
On 09/03/2018 15:41, Sebastian Reichel wrote: > From: Ian Ray> > Enable display backlight only if a message needs to be displayed. > The kernel re-initializes the backlight, which results in some > unwanted artifacts. > > Signed-off-by: Ian Ray > Signed-off-by: Sebastian Reichel > --- > board/ge/bx50v3/bx50v3.c| 43 ++- > include/configs/ge_bx50v3.h | 1 + > 2 files changed, 27 insertions(+), 17 deletions(-) > > diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c > index c7a29185bf49..35efe159d598 100644 > --- a/board/ge/bx50v3/bx50v3.c > +++ b/board/ge/bx50v3/bx50v3.c > @@ -786,23 +786,6 @@ int board_late_init(void) > add_board_boot_modes(board_boot_modes); > #endif > > -#ifdef CONFIG_VIDEO_IPUV3 > - /* We need at least 200ms between power on and backlight on > - * as per specifications from CHI MEI */ > - mdelay(250); > - > - /* enable backlight PWM 1 */ > - pwm_init(0, 0, 0); > - > - /* duty cycle 500ns, period: 500ns */ > - pwm_config(0, 500, 500); > - > - /* Backlight Power */ > - gpio_direction_output(LVDS_BACKLIGHT_GP, 1); > - > - pwm_enable(0); > -#endif > - > /* board specific pmic init */ > pmic_init(); > > @@ -843,3 +826,29 @@ int checkboard(void) > printf("BOARD: %s\n", CONFIG_BOARD_NAME); > return 0; > } > + > +static int do_backlight_enable(void) Function must return an int > +{ > +#ifdef CONFIG_VIDEO_IPUV3 > + /* We need at least 200ms between power on and backlight on > + * as per specifications from CHI MEI */ > + mdelay(250); > + > + /* enable backlight PWM 1 */ > + pwm_init(0, 0, 0); > + > + /* duty cycle 500ns, period: 500ns */ > + pwm_config(0, 500, 500); > + > + /* Backlight Power */ > + gpio_direction_output(LVDS_BACKLIGHT_GP, 1); > + > + pwm_enable(0); No return value. This generates warning, please fix and repost - thanks. Best regards, Stefano Babic > +#endif > +} > + > +U_BOOT_CMD( > + bx50_backlight_enable, 1, 1, do_backlight_enable, > + "enable Bx50 backlight", > + "no parameters" > +); > diff --git a/include/configs/ge_bx50v3.h b/include/configs/ge_bx50v3.h > index cbfe30d536d0..925507fe81f1 100644 > --- a/include/configs/ge_bx50v3.h > +++ b/include/configs/ge_bx50v3.h > @@ -128,6 +128,7 @@ > "swappartitions=" \ > "setexpr partnum 3 - ${partnum}\0" \ > "failbootcmd=" \ > + "bx50_backlight_enable; " \ > "msg=\"Monitor failed to start. Try again, or contact GE > Service for support.\"; " \ > "echo $msg; " \ > "setenv stdout vga; " \ > -- = 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 v1 5/5] net: Avoid build fail on am335x when NET is disabled
On Thu, Mar 29, 2018 at 10:17 AM, Alex Kiernanwrote: > Commit f411b5cca48f ("board: am335x: Always set eth/eth1addr environment > variable") adds support for Ethernet in Linux, but not U-Boot. > > Ensure that we can do this even when U-Boot is compiled without > network support. Please improve this commit log. It should have a subject that says what it does (Move enetaddr env access code to env config instead of net config) Then talk about why you are doing it in the body (i.e. the current subject). > > Signed-off-by: Alex Kiernan > --- > > cmd/nvedit.c | 30 ++ > include/common.h | 4 > include/net.h| 3 --- > net/eth_common.c | 30 -- > 4 files changed, 34 insertions(+), 33 deletions(-) > > diff --git a/cmd/nvedit.c b/cmd/nvedit.c > index 4cb25b8..4008de1 100644 > --- a/cmd/nvedit.c > +++ b/cmd/nvedit.c > @@ -341,6 +341,36 @@ ulong env_get_hex(const char *varname, ulong default_val) > return value; > } > > +void eth_parse_enetaddr(const char *addr, uchar *enetaddr) > +{ > + char *end; > + int i; > + > + for (i = 0; i < 6; ++i) { > + enetaddr[i] = addr ? simple_strtoul(addr, , 16) : 0; > + if (addr) > + addr = (*end) ? end + 1 : end; > + } > +} > + > +int eth_env_get_enetaddr(const char *name, uchar *enetaddr) > +{ > + eth_parse_enetaddr(env_get(name), enetaddr); > + return is_valid_ethaddr(enetaddr); > +} > + > +int eth_env_set_enetaddr(const char *name, const uchar *enetaddr) > +{ > + char buf[ARP_HLEN_ASCII + 1]; > + > + if (eth_env_get_enetaddr(name, (uchar *)buf)) > + return -EEXIST; > + > + sprintf(buf, "%pM", enetaddr); > + > + return env_set(name, buf); > +} > + > #ifndef CONFIG_SPL_BUILD > static int do_env_set(cmd_tbl_t *cmdtp, int flag, int argc, char * const > argv[]) > { > diff --git a/include/common.h b/include/common.h > index 3087505..b7280eb 100644 > --- a/include/common.h > +++ b/include/common.h > @@ -243,6 +243,10 @@ static inline int env_set_addr(const char *varname, > const void *addr) > return env_set_hex(varname, (ulong)addr); > } > > +void eth_parse_enetaddr(const char *addr, uchar *enetaddr); > +int eth_env_get_enetaddr(const char *name, uchar *enetaddr); > +int eth_env_set_enetaddr(const char *name, const uchar *enetaddr); Please move this to include/environment.h > + > #ifdef CONFIG_AUTO_COMPLETE > int env_complete(char *var, int maxv, char *cmdv[], int maxsz, char *buf); > #endif > diff --git a/include/net.h b/include/net.h > index 455b48f..c339b9d 100644 > --- a/include/net.h > +++ b/include/net.h > @@ -238,9 +238,6 @@ void eth_try_another(int first_restart);/* Change the > device */ > void eth_set_current(void);/* set nterface to ethcur var */ > > int eth_get_dev_index(void); /* get the device index */ > -void eth_parse_enetaddr(const char *addr, uchar *enetaddr); > -int eth_env_get_enetaddr(const char *name, uchar *enetaddr); > -int eth_env_set_enetaddr(const char *name, const uchar *enetaddr); > > /** > * eth_env_set_enetaddr_by_index() - set the MAC address environment variable > diff --git a/net/eth_common.c b/net/eth_common.c > index 66d0d22..cb7f029 100644 > --- a/net/eth_common.c > +++ b/net/eth_common.c > @@ -12,36 +12,6 @@ > #include > #include "eth_internal.h" > > -void eth_parse_enetaddr(const char *addr, uchar *enetaddr) > -{ > - char *end; > - int i; > - > - for (i = 0; i < 6; ++i) { > - enetaddr[i] = addr ? simple_strtoul(addr, , 16) : 0; > - if (addr) > - addr = (*end) ? end + 1 : end; > - } > -} > - > -int eth_env_get_enetaddr(const char *name, uchar *enetaddr) > -{ > - eth_parse_enetaddr(env_get(name), enetaddr); > - return is_valid_ethaddr(enetaddr); > -} > - > -int eth_env_set_enetaddr(const char *name, const uchar *enetaddr) > -{ > - char buf[ARP_HLEN_ASCII + 1]; > - > - if (eth_env_get_enetaddr(name, (uchar *)buf)) > - return -EEXIST; > - > - sprintf(buf, "%pM", enetaddr); > - > - return env_set(name, buf); > -} > - > int eth_env_get_enetaddr_by_index(const char *base_name, int index, > uchar *enetaddr) > { > -- > 2.7.4 > > ___ > U-Boot mailing list > U-Boot@lists.denx.de > https://lists.denx.de/listinfo/u-boot ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v1 3/5] usb: gadget: USB_ETHER requires network support
On Thu, Mar 29, 2018 at 10:17 AM, Alex Kiernanwrote: > In order to compile the USB Ethernet gadget support we require that NET > is enabled, add that dependency here. > > Signed-off-by: Alex Kiernan Acked-by: Joe Hershberger ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v1 2/5] ti: am335x: Fix bootargs when building without NET
On Thu, Mar 29, 2018 at 10:17 AM, Alex Kiernanwrote: > If DHCP/PXE commands are disabled then the compilation fails due to > bootargs attempting to use them: > > include/config_distro_bootcmd.h:319:2: error: expected ‘}’ before > ‘BOOT_TARGET_DEVICES_references_PXE_without_CONFIG_CMD_DHCP_or_PXE’ > > Ensure that if the command aren't enabled, we don't try and use them. > > Signed-off-by: Alex Kiernan Acked-by: Joe Hershberger ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v1 1/5] Migrate CONFIG_DRIVER_TI_CPSW to Kconfig
On Thu, Mar 29, 2018 at 10:17 AM, Alex Kiernanwrote: > This converts CONFIG_DRIVER_TI_CPSW to Kconfig > > Signed-off-by: Alex Kiernan Acked-by: Joe Hershberger ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] imx: fix CAAM base for i.MX6UL
On 11/01/2018 15:14, Anatolij Gustschin wrote: > HW accelerated "hash sha256 ..." command doesn't work on i.MX6UL, we get > "CAAM was not setup properly or it is faulty" error message. > > This is due to wrong CAAM base 0x0210, on i.MX6UL the CAAM base > address is 0x0214. Fix it. > > Note: with this patch applied the "hash sha256" commant still has some > issues on i.MX6UL ("Invalid KEY Command" or other errors). With data > cache off the "hash sha256" command works as expected. > > Signed-off-by: Anatolij Gustschin> --- > arch/arm/include/asm/arch-mx6/imx-regs.h | 4 > 1 file changed, 4 insertions(+) > > diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h > b/arch/arm/include/asm/arch-mx6/imx-regs.h > index 48ce0edd06..6cab049648 100644 > --- a/arch/arm/include/asm/arch-mx6/imx-regs.h > +++ b/arch/arm/include/asm/arch-mx6/imx-regs.h > @@ -232,7 +232,11 @@ > #define AIPS2_OFF_BASE_ADDR (ATZ2_BASE_ADDR + 0x8) > #define AIPS3_ON_BASE_ADDR (ATZ3_BASE_ADDR + 0x7C000) > #define AIPS3_OFF_BASE_ADDR (ATZ3_BASE_ADDR + 0x8) > +#if defined(CONFIG_MX6UL) > +#define CAAM_BASE_ADDR (ATZ2_BASE_ADDR + 0x4) > +#else > #define CAAM_BASE_ADDR (ATZ2_BASE_ADDR) > +#endif > #define ARM_BASE_ADDR(ATZ2_BASE_ADDR + 0x4) > > #define CONFIG_SYS_FSL_SEC_OFFSET 0 > Applied to u-boot-imx, thanks ! Best regards, Stefano Babic -- = 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 1/2] drivers: i2c: mxc: Update SYS_I2C_MXC_I2C support in Kconfig
On 13/03/2018 11:11, Sriram Dash wrote: > > >> From: Sriram Dash >> Subject: [PATCH 1/2] drivers: i2c: mxc: Update SYS_I2C_MXC_I2C support in >> Kconfig >> >> NXP layerscape platforms like ls1088a, ls2088a uses MXC I2C Controller. >> -Remove dependency of MX6 for the same. >> >> Update related configs to use Kconfig file. >> -Add SYS_I2C_MXC_I2C1,_I2C2,_I2C3,_I2C4 in Kconfig -Add >> CONFIG_SYS_MXC_I2C1_SPEED,_I2C2_,_I2C3_,_I2C4_ in Kconfig -Add >> CONFIG_SYS_MXC_I2C1_SLAVE,_I2C2_,_I2C3_,_I2C4_ in Kconfig >> >> Signed-off-by: Sriram Dash>> Signed-off-by: Priyanka Jain >> --- > > Hello Stefano, > > Any updates. > Sorry for late answer - I have no comments about these patches, I have not seen any comments at all, I will aply them. Regards, Stefano >> arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 23 >> drivers/i2c/Kconfig | 89 >> +-- >> include/configs/ls1012a_common.h | 3 -- >> include/configs/ls1043a_common.h | 5 -- >> include/configs/ls1046a_common.h | 5 -- >> include/configs/ls1088a_common.h | 5 -- >> include/configs/ls2080a_common.h | 5 -- >> include/configs/ls2080a_emu.h | 3 -- >> include/configs/ls2080a_simu.h| 3 -- >> 9 files changed, 109 insertions(+), 32 deletions(-) >> >> diff --git a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig >> b/arch/arm/cpu/armv8/fsl- >> layerscape/Kconfig >> index cefbdfe..ebccd16 100644 >> --- a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig >> +++ b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig >> @@ -12,6 +12,9 @@ config ARCH_LS1012A >> select SYS_FSL_ERRATUM_A009008 >> select ARCH_EARLY_INIT_R >> select BOARD_EARLY_INIT_F >> +select SYS_I2C_MXC >> +select SYS_I2C_MXC_I2C1 >> +select SYS_I2C_MXC_I2C2 >> imply PANIC_HANG >> >> config ARCH_LS1043A >> @@ -37,6 +40,11 @@ config ARCH_LS1043A >> select SYS_FSL_HAS_DDR4 >> select ARCH_EARLY_INIT_R >> select BOARD_EARLY_INIT_F >> +select SYS_I2C_MXC >> +select SYS_I2C_MXC_I2C1 >> +select SYS_I2C_MXC_I2C2 >> +select SYS_I2C_MXC_I2C3 >> +select SYS_I2C_MXC_I2C4 >> imply SCSI >> imply SCSI_AHCI >> imply CMD_PCI >> @@ -64,6 +72,11 @@ config ARCH_LS1046A >> select SYS_FSL_SRDS_2 >> select ARCH_EARLY_INIT_R >> select BOARD_EARLY_INIT_F >> +select SYS_I2C_MXC >> +select SYS_I2C_MXC_I2C1 >> +select SYS_I2C_MXC_I2C2 >> +select SYS_I2C_MXC_I2C3 >> +select SYS_I2C_MXC_I2C4 >> imply SCSI >> imply SCSI_AHCI >> >> @@ -94,6 +107,11 @@ config ARCH_LS1088A >> select FSL_TZASC_1 >> select ARCH_EARLY_INIT_R >> select BOARD_EARLY_INIT_F >> +select SYS_I2C_MXC >> +select SYS_I2C_MXC_I2C1 >> +select SYS_I2C_MXC_I2C2 >> +select SYS_I2C_MXC_I2C3 >> +select SYS_I2C_MXC_I2C4 >> imply SCSI >> imply PANIC_HANG >> >> @@ -134,6 +152,11 @@ config ARCH_LS2080A >> select SYS_FSL_ERRATUM_A009203 >> select ARCH_EARLY_INIT_R >> select BOARD_EARLY_INIT_F >> +select SYS_I2C_MXC >> +select SYS_I2C_MXC_I2C1 >> +select SYS_I2C_MXC_I2C2 >> +select SYS_I2C_MXC_I2C3 >> +select SYS_I2C_MXC_I2C4 >> imply PANIC_HANG >> >> config FSL_LSCH2 >> diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig index 17d21bb..7cad493 >> 100644 >> --- a/drivers/i2c/Kconfig >> +++ b/drivers/i2c/Kconfig >> @@ -149,13 +149,96 @@ config SYS_I2C_MESON >>both 7-bit and 10-bit addresses. >> >> config SYS_I2C_MXC >> -bool "NXP i.MX I2C driver" >> -depends on MX6 >> +bool "NXP MXC I2C driver" >> help >> - Add support for the NXP i.MX I2C driver. This supports upto for bus >> + Add support for the NXP I2C driver. This supports upto for bus >>channels and operating on standard mode upto 100 kbits/s and fast >>mode upto 400 kbits/s. >> >> +if SYS_I2C_MXC >> +config SYS_I2C_MXC_I2C1 >> +bool "NXP MXC I2C1" >> +help >> + Add support for NXP MXC I2C Controller 1. >> + Required for SoCs which have I2C MXC controller 1 eg LS1088A, LS2080A >> + >> +config SYS_I2C_MXC_I2C2 >> +bool "NXP MXC I2C2" >> +help >> + Add support for NXP MXC I2C Controller 2. >> + Required for SoCs which have I2C MXC controller 2 eg LS1088A, LS2080A >> + >> +config SYS_I2C_MXC_I2C3 >> +bool "NXP MXC I2C3" >> +help >> + Add support for NXP MXC I2C Controller 3. >> + Required for SoCs which have I2C MXC controller 3 eg LS1088A, LS2080A >> + >> +config SYS_I2C_MXC_I2C4 >> +bool "NXP MXC I2C4" >> +help >> + Add support for NXP MXC I2C Controller 4. >> + Required for SoCs which have I2C MXC controller 4 eg LS1088A, LS2080A >> +endif >> + >> +if SYS_I2C_MXC_I2C1 >> +config SYS_MXC_I2C1_SPEED >> +int "I2C Channel 1 speed" >> +default 4000 if TARGET_LS2080A_SIMU || TARGET_LS2080A_EMU >> +default 10 >> +help >> + MXC
[U-Boot] [PATCH v1 5/5] net: Avoid build fail on am335x when NET is disabled
Commit f411b5cca48f ("board: am335x: Always set eth/eth1addr environment variable") adds support for Ethernet in Linux, but not U-Boot. Ensure that we can do this even when U-Boot is compiled without network support. Signed-off-by: Alex Kiernan--- cmd/nvedit.c | 30 ++ include/common.h | 4 include/net.h| 3 --- net/eth_common.c | 30 -- 4 files changed, 34 insertions(+), 33 deletions(-) diff --git a/cmd/nvedit.c b/cmd/nvedit.c index 4cb25b8..4008de1 100644 --- a/cmd/nvedit.c +++ b/cmd/nvedit.c @@ -341,6 +341,36 @@ ulong env_get_hex(const char *varname, ulong default_val) return value; } +void eth_parse_enetaddr(const char *addr, uchar *enetaddr) +{ + char *end; + int i; + + for (i = 0; i < 6; ++i) { + enetaddr[i] = addr ? simple_strtoul(addr, , 16) : 0; + if (addr) + addr = (*end) ? end + 1 : end; + } +} + +int eth_env_get_enetaddr(const char *name, uchar *enetaddr) +{ + eth_parse_enetaddr(env_get(name), enetaddr); + return is_valid_ethaddr(enetaddr); +} + +int eth_env_set_enetaddr(const char *name, const uchar *enetaddr) +{ + char buf[ARP_HLEN_ASCII + 1]; + + if (eth_env_get_enetaddr(name, (uchar *)buf)) + return -EEXIST; + + sprintf(buf, "%pM", enetaddr); + + return env_set(name, buf); +} + #ifndef CONFIG_SPL_BUILD static int do_env_set(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { diff --git a/include/common.h b/include/common.h index 3087505..b7280eb 100644 --- a/include/common.h +++ b/include/common.h @@ -243,6 +243,10 @@ static inline int env_set_addr(const char *varname, const void *addr) return env_set_hex(varname, (ulong)addr); } +void eth_parse_enetaddr(const char *addr, uchar *enetaddr); +int eth_env_get_enetaddr(const char *name, uchar *enetaddr); +int eth_env_set_enetaddr(const char *name, const uchar *enetaddr); + #ifdef CONFIG_AUTO_COMPLETE int env_complete(char *var, int maxv, char *cmdv[], int maxsz, char *buf); #endif diff --git a/include/net.h b/include/net.h index 455b48f..c339b9d 100644 --- a/include/net.h +++ b/include/net.h @@ -238,9 +238,6 @@ void eth_try_another(int first_restart);/* Change the device */ void eth_set_current(void);/* set nterface to ethcur var */ int eth_get_dev_index(void); /* get the device index */ -void eth_parse_enetaddr(const char *addr, uchar *enetaddr); -int eth_env_get_enetaddr(const char *name, uchar *enetaddr); -int eth_env_set_enetaddr(const char *name, const uchar *enetaddr); /** * eth_env_set_enetaddr_by_index() - set the MAC address environment variable diff --git a/net/eth_common.c b/net/eth_common.c index 66d0d22..cb7f029 100644 --- a/net/eth_common.c +++ b/net/eth_common.c @@ -12,36 +12,6 @@ #include #include "eth_internal.h" -void eth_parse_enetaddr(const char *addr, uchar *enetaddr) -{ - char *end; - int i; - - for (i = 0; i < 6; ++i) { - enetaddr[i] = addr ? simple_strtoul(addr, , 16) : 0; - if (addr) - addr = (*end) ? end + 1 : end; - } -} - -int eth_env_get_enetaddr(const char *name, uchar *enetaddr) -{ - eth_parse_enetaddr(env_get(name), enetaddr); - return is_valid_ethaddr(enetaddr); -} - -int eth_env_set_enetaddr(const char *name, const uchar *enetaddr) -{ - char buf[ARP_HLEN_ASCII + 1]; - - if (eth_env_get_enetaddr(name, (uchar *)buf)) - return -EEXIST; - - sprintf(buf, "%pM", enetaddr); - - return env_set(name, buf); -} - int eth_env_get_enetaddr_by_index(const char *base_name, int index, uchar *enetaddr) { -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v1 4/5] ti: am335x: Fix build when networking is disabled
When compiling without CONFIG_CLOCK_SYNTHESIZER (which is implied by CONFIG_DRIVER_TI_CPSW for am335x_evm), exclude the network setup for AM335x-ICEv2 to avoid link time failures: board/ti/am335x/board.c:683: undefined reference to `setup_clock_synthesizer' Signed-off-by: Alex Kiernan--- board/ti/am335x/board.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c index f802657..5709afb 100644 --- a/board/ti/am335x/board.c +++ b/board/ti/am335x/board.c @@ -563,8 +563,8 @@ void sdram_init(void) } #endif -#if !defined(CONFIG_SPL_BUILD) || \ - (defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD)) +#if defined(CONFIG_CLOCK_SYNTHESIZER) && (!defined(CONFIG_SPL_BUILD) || \ + (defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD))) static void request_and_set_gpio(int gpio, char *name, int val) { int ret; @@ -621,8 +621,8 @@ int board_init(void) gpmc_init(); #endif -#if !defined(CONFIG_SPL_BUILD) || \ - (defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD)) +#if defined(CONFIG_CLOCK_SYNTHESIZER) && (!defined(CONFIG_SPL_BUILD) || \ + (defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD))) if (board_is_icev2()) { int rv; u32 reg; -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v1 3/5] usb: gadget: USB_ETHER requires network support
In order to compile the USB Ethernet gadget support we require that NET is enabled, add that dependency here. Signed-off-by: Alex Kiernan--- drivers/usb/gadget/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 6825e6b..26b4d12 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -158,6 +158,7 @@ endif # USB_GADGET_DOWNLOAD config USB_ETHER bool "USB Ethernet Gadget" + depends on NET default y if ARCH_SUNXI && USB_MUSB_GADGET help Creates an Ethernet network device through a USB peripheral -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v1 2/5] ti: am335x: Fix bootargs when building without NET
If DHCP/PXE commands are disabled then the compilation fails due to bootargs attempting to use them: include/config_distro_bootcmd.h:319:2: error: expected ‘}’ before ‘BOOT_TARGET_DEVICES_references_PXE_without_CONFIG_CMD_DHCP_or_PXE’ Ensure that if the command aren't enabled, we don't try and use them. Signed-off-by: Alex Kiernan--- include/configs/am335x_evm.h | 16 ++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h index 158b7d4..e8b4125 100644 --- a/include/configs/am335x_evm.h +++ b/include/configs/am335x_evm.h @@ -74,14 +74,26 @@ #define BOOTENV_DEV_NAME_NAND(devtypeu, devtypel, instance) \ #devtypel #instance " " +#if CONFIG_IS_ENABLED(CMD_PXE) +# define BOOT_TARGET_PXE(func) func(PXE, pxe, na) +#else +# define BOOT_TARGET_PXE(func) +#endif + +#if CONFIG_IS_ENABLED(CMD_DHCP) +# define BOOT_TARGET_DHCP(func) func(DHCP, dhcp, na) +#else +# define BOOT_TARGET_DHCP(func) +#endif + #define BOOT_TARGET_DEVICES(func) \ func(MMC, mmc, 0) \ func(LEGACY_MMC, legacy_mmc, 0) \ func(MMC, mmc, 1) \ func(LEGACY_MMC, legacy_mmc, 1) \ func(NAND, nand, 0) \ - func(PXE, pxe, na) \ - func(DHCP, dhcp, na) + BOOT_TARGET_PXE(func) \ + BOOT_TARGET_DHCP(func) #include -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v1 1/5] Migrate CONFIG_DRIVER_TI_CPSW to Kconfig
This converts CONFIG_DRIVER_TI_CPSW to Kconfig Signed-off-by: Alex Kiernan--- drivers/net/Kconfig| 8 include/configs/am335x_shc.h | 1 - include/configs/am43xx_evm.h | 1 - include/configs/am57xx_evm.h | 1 - include/configs/bur_am335x_common.h| 1 - include/configs/cl-som-am57x.h | 1 - include/configs/cm_t43.h | 1 - include/configs/dra7xx_evm.h | 1 - include/configs/siemens-am33x-common.h | 1 - include/configs/ti814x_evm.h | 1 - include/configs/ti_am335x_common.h | 1 - scripts/config_whitelist.txt | 1 - 12 files changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index f589978..920927c 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -283,6 +283,14 @@ config SH_ETHER help This driver supports the Ethernet for Renesas SH and ARM SoCs. +config DRIVER_TI_CPSW + bool "TI Common Platform Ethernet Switch" + select PHYLIB + default y if ARCH_OMAP2PLUS + help + This driver supports the TI three port switch gigabit ethernet + subsystem found in the TI SoCs. + config XILINX_AXIEMAC depends on DM_ETH && (MICROBLAZE || ARCH_ZYNQ || ARCH_ZYNQMP) select PHYLIB diff --git a/include/configs/am335x_shc.h b/include/configs/am335x_shc.h index 6fa117e..5314aba 100644 --- a/include/configs/am335x_shc.h +++ b/include/configs/am335x_shc.h @@ -251,7 +251,6 @@ #undef CONFIG_TIMER #endif -#define CONFIG_DRIVER_TI_CPSW #define CONFIG_MII #define CONFIG_BOOTP_DEFAULT #define CONFIG_BOOTP_DNS2 diff --git a/include/configs/am43xx_evm.h b/include/configs/am43xx_evm.h index 663f861..c1a6f00 100644 --- a/include/configs/am43xx_evm.h +++ b/include/configs/am43xx_evm.h @@ -221,7 +221,6 @@ #define CONFIG_NET_RETRY_COUNT 10 #endif -#define CONFIG_DRIVER_TI_CPSW #define PHY_ANEG_TIMEOUT 8000 /* PHY needs longer aneg time at 1G */ #define CONFIG_SYS_RX_ETH_BUFFER 64 diff --git a/include/configs/am57xx_evm.h b/include/configs/am57xx_evm.h index c079a3a..7211cde 100644 --- a/include/configs/am57xx_evm.h +++ b/include/configs/am57xx_evm.h @@ -78,7 +78,6 @@ #define CONFIG_BOOTP_DNS2 #define CONFIG_BOOTP_SEND_HOSTNAME #define CONFIG_NET_RETRY_COUNT 10 -#define CONFIG_DRIVER_TI_CPSW /* Driver for IP block */ #define CONFIG_MII /* Required in net/eth.c */ #define PHY_ANEG_TIMEOUT 8000/* PHY needs longer aneg time at 1G */ diff --git a/include/configs/bur_am335x_common.h b/include/configs/bur_am335x_common.h index e8abe53..6f4c710 100644 --- a/include/configs/bur_am335x_common.h +++ b/include/configs/bur_am335x_common.h @@ -29,7 +29,6 @@ #define CONFIG_SYS_NS16550_COM10x44e09000 /* UART0 */ /* Network defines */ -#define CONFIG_DRIVER_TI_CPSW /* Driver for IP block */ #define CONFIG_MII /* Required in net/eth.c */ #define CONFIG_PHY_NATSEMI diff --git a/include/configs/cl-som-am57x.h b/include/configs/cl-som-am57x.h index 596e060..4b2a0c3 100644 --- a/include/configs/cl-som-am57x.h +++ b/include/configs/cl-som-am57x.h @@ -81,7 +81,6 @@ /* USB Networking options */ /* CPSW Ethernet */ -#define CONFIG_DRIVER_TI_CPSW #define CONFIG_MII #define CONFIG_BOOTP_DEFAULT #define CONFIG_BOOTP_SEND_HOSTNAME diff --git a/include/configs/cm_t43.h b/include/configs/cm_t43.h index da78519..07395de 100644 --- a/include/configs/cm_t43.h +++ b/include/configs/cm_t43.h @@ -45,7 +45,6 @@ 50, 51, 52, 53, 54, 55, 56, 57, } /* CPSW Ethernet support */ -#define CONFIG_DRIVER_TI_CPSW #define CONFIG_MII #define CONFIG_BOOTP_DEFAULT #define CONFIG_BOOTP_SEND_HOSTNAME diff --git a/include/configs/dra7xx_evm.h b/include/configs/dra7xx_evm.h index e82de2a..13efc3e 100644 --- a/include/configs/dra7xx_evm.h +++ b/include/configs/dra7xx_evm.h @@ -97,7 +97,6 @@ #define CONFIG_BOOTP_DNS2 #define CONFIG_BOOTP_SEND_HOSTNAME #define CONFIG_NET_RETRY_COUNT 10 -#define CONFIG_DRIVER_TI_CPSW /* Driver for IP block */ #define CONFIG_MII /* Required in net/eth.c */ #define CONFIG_PHY_TI diff --git a/include/configs/siemens-am33x-common.h b/include/configs/siemens-am33x-common.h index b23e20a..dfa7114 100644 --- a/include/configs/siemens-am33x-common.h +++ b/include/configs/siemens-am33x-common.h @@ -192,7 +192,6 @@ # define CONFIG_ENV_SECT_SIZE (4 << 10) /* 4 KB sectors */ #endif /* SPI support */ -#define CONFIG_DRIVER_TI_CPSW #define CONFIG_MII #define CONFIG_BOOTP_DEFAULT #define CONFIG_BOOTP_DNS2 diff --git a/include/configs/ti814x_evm.h b/include/configs/ti814x_evm.h index 2f9056c..55df77d 100644 --- a/include/configs/ti814x_evm.h +++ b/include/configs/ti814x_evm.h @@ -155,7 +155,6 @@ #endif /* Ethernet */ -#define CONFIG_DRIVER_TI_CPSW
[U-Boot] [PATCH] x86: Update the io.h file to use {out|in}_{be|le}X macros
The commit 3f70a6f57734 ("x86: Add clr/setbits functions") introduced the {read|write}_ macros to manipulate data. Those macros are not used by any code in the u-boot project (despite the io.h itself). Other architectures use io.h with {in|out}_* macros. This commit brings some unification across u-boot supported architectures. Signed-off-by: Lukasz Majewski--- arch/x86/include/asm/io.h | 34 +- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h index 263dd8fd17..3f6385bdca 100644 --- a/arch/x86/include/asm/io.h +++ b/arch/x86/include/asm/io.h @@ -76,34 +76,34 @@ #define memcpy_fromio(a,b,c) memcpy((a),(b),(c)) #define memcpy_toio(a,b,c) memcpy((a),(b),(c)) -#define write_arch(type, endian, a, v) __raw_write##type(cpu_to_##endian(v), a) -#define read_arch(type, endian, a) endian##_to_cpu(__raw_read##type(a)) +#define out_arch(type, endian, a, v) __raw_write##type(cpu_to_##endian(v), a) +#define in_arch(type, endian, a) endian##_to_cpu(__raw_read##type(a)) -#define write_le64(a, v) write_arch(q, le64, a, v) -#define write_le32(a, v) write_arch(l, le32, a, v) -#define write_le16(a, v) write_arch(w, le16, a, v) +#define out_le64(a, v) out_arch(q, le64, a, v) +#define out_le32(a, v) out_arch(l, le32, a, v) +#define out_le16(a, v) out_arch(w, le16, a, v) -#define read_le64(a) read_arch(q, le64, a) -#define read_le32(a) read_arch(l, le32, a) -#define read_le16(a) read_arch(w, le16, a) +#define in_le64(a) in_arch(q, le64, a) +#define in_le32(a) in_arch(l, le32, a) +#define in_le16(a) in_arch(w, le16, a) -#define write_be32(a, v) write_arch(l, be32, a, v) -#define write_be16(a, v) write_arch(w, be16, a, v) +#define out_be32(a, v) out_arch(l, be32, a, v) +#define out_be16(a, v) out_arch(w, be16, a, v) -#define read_be32(a) read_arch(l, be32, a) -#define read_be16(a) read_arch(w, be16, a) +#define in_be32(a) in_arch(l, be32, a) +#define in_be16(a) in_arch(w, be16, a) -#define write_8(a, v) __raw_writeb(v, a) -#define read_8(a) __raw_readb(a) +#define out_8(a, v)__raw_writeb(v, a) +#define in_8(a)__raw_readb(a) #define clrbits(type, addr, clear) \ - write_##type((addr), read_##type(addr) & ~(clear)) + out_##type((addr), in_##type(addr) & ~(clear)) #define setbits(type, addr, set) \ - write_##type((addr), read_##type(addr) | (set)) + out_##type((addr), in_##type(addr) | (set)) #define clrsetbits(type, addr, clear, set) \ - write_##type((addr), (read_##type(addr) & ~(clear)) | (set)) + out_##type((addr), (in_##type(addr) & ~(clear)) | (set)) #define clrbits_be32(addr, clear) clrbits(be32, addr, clear) #define setbits_be32(addr, set) setbits(be32, addr, set) -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH u-boot 1/3] usb: host: Add simple of glue driver for DWC3 USB Controllers integration
On 03/29/2018 04:27 PM, Neil Armstrong wrote: > On 29/03/2018 16:24, Marek Vasut wrote: >> On 03/29/2018 04:23 PM, Neil Armstrong wrote: >>> On 29/03/2018 15:52, Marek Vasut wrote: On 03/29/2018 03:42 PM, Neil Armstrong wrote: > Signed-off-by: Neil Armstrong> --- > drivers/usb/host/Kconfig | 7 ++ > drivers/usb/host/Makefile | 1 + > drivers/usb/host/dwc3-of-simple.c | 187 > ++ > 3 files changed, 195 insertions(+) > create mode 100644 drivers/usb/host/dwc3-of-simple.c > > diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig > index a7249b7..6caa615 100644 > --- a/drivers/usb/host/Kconfig > +++ b/drivers/usb/host/Kconfig > @@ -21,6 +21,13 @@ config USB_XHCI_DWC3 > Say Y or if your system has a Dual Role SuperSpeed > USB controller based on the DesignWare USB3 IP Core. > > +config USB_XHCI_DWC3_OF_SIMPLE > + bool "DesignWare USB3 DRD Generic OF Simple Glue Layer" > + select MISC > + help > + Support USB2/3 functionality in simple SoC integrations with > + USB controller based on the DesignWare USB3 IP Core. > + > config USB_XHCI_MVEBU > bool "MVEBU USB 3.0 support" > default y > diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile > index 9819489..abe4f90 100644 > --- a/drivers/usb/host/Makefile > +++ b/drivers/usb/host/Makefile > @@ -49,6 +49,7 @@ obj-$(CONFIG_USB_EHCI_ZYNQ) += ehci-zynq.o > # xhci > obj-$(CONFIG_USB_XHCI_HCD) += xhci.o xhci-mem.o xhci-ring.o > obj-$(CONFIG_USB_XHCI_DWC3) += xhci-dwc3.o > +obj-$(CONFIG_USB_XHCI_DWC3_OF_SIMPLE) += dwc3-of-simple.o > obj-$(CONFIG_USB_XHCI_ROCKCHIP) += xhci-rockchip.o > obj-$(CONFIG_USB_XHCI_ZYNQMP) += xhci-zynqmp.o > obj-$(CONFIG_USB_XHCI_KEYSTONE) += xhci-keystone.o > diff --git a/drivers/usb/host/dwc3-of-simple.c > b/drivers/usb/host/dwc3-of-simple.c > new file mode 100644 > index 000..826a996 > --- /dev/null > +++ b/drivers/usb/host/dwc3-of-simple.c > @@ -0,0 +1,187 @@ > +/* > + * dwc3-of-simple.c - OF glue layer for simple integrations > + * > + * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com > + * > + * Author: Felipe Balbi > + * > + * Copyright (C) 2018 BayLibre, SAS > + * Author: Neil Armstrong > + * > + * SPDX-License-Identifier: GPL-2.0+ > + */ > + > +#include > +#include > +#include > +#include > +#include > + > +DECLARE_GLOBAL_DATA_PTR; > + > +struct dwc3_of_simple { > +#if CONFIG_IS_ENABLED(CLK) > + struct clk *clks; > + int num_clocks; > +#endif > +#if CONFIG_IS_ENABLED(DM_RESET) > + struct reset_ctl*resets; > + int num_resets; > +#endif > +}; > + > +#if CONFIG_IS_ENABLED(DM_RESET) > +static int dwc3_of_simple_reset_init(struct udevice *dev, > + struct dwc3_of_simple *simple, > + int count) > +{ > + int i, ret, err; > + > + if (!count) > + return 0; > + > + simple->resets = devm_kcalloc(dev, count, sizeof(struct reset_ctl), > + GFP_KERNEL); > + if (!simple->resets) > + return -ENOMEM; > + > + for (i = 0; i < count; i++) { > + ret = reset_get_by_index(dev, i, >resets[i]); > + if (ret < 0) > + break; > + > + ret = reset_request(>resets[i]); > + if (ret) { > + pr_err("failed to request reset line %d\n", i); > + reset_free(>resets[i]); > + goto reset_err; > + } > + > + > + ++simple->num_resets; > + } > + > + for (i = 0; i < simple->num_resets; i++) { > + ret = reset_deassert(>resets[i]); > + if (ret && ret != -ENOSYS && ret != -ENOTSUPP) { > + pr_err("failed to deassert reset line %d\n", i); > + goto reset_err; > + } > + } > + > + return 0; This looks like some driver I've seen before. Isn't there similar code for simple EHCI or OHCI driver already ? >>> >>> Hi, >>> >>> This is not an EHCI/OHCI driver, only the glue to init the clocks and reset, >>> it's the exact same as the drivers/usb/dwc3/dwc3-of-simple.c adapted to >>> U-Boot. >>> >>> yes, similar code exists in drivers/usb/host/ehci-generic.c and >>> drivers/usb/host/ohci-generic.c but the goal here is not to initialize the >>> controller >>> but only the glue. >> >> Can't we recycle that code instead of having three copies of similar stuff ? >> > > Sure,
Re: [U-Boot] [PATCH u-boot 1/3] usb: host: Add simple of glue driver for DWC3 USB Controllers integration
On 29/03/2018 16:24, Marek Vasut wrote: > On 03/29/2018 04:23 PM, Neil Armstrong wrote: >> On 29/03/2018 15:52, Marek Vasut wrote: >>> On 03/29/2018 03:42 PM, Neil Armstrong wrote: Signed-off-by: Neil Armstrong--- drivers/usb/host/Kconfig | 7 ++ drivers/usb/host/Makefile | 1 + drivers/usb/host/dwc3-of-simple.c | 187 ++ 3 files changed, 195 insertions(+) create mode 100644 drivers/usb/host/dwc3-of-simple.c diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index a7249b7..6caa615 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -21,6 +21,13 @@ config USB_XHCI_DWC3 Say Y or if your system has a Dual Role SuperSpeed USB controller based on the DesignWare USB3 IP Core. +config USB_XHCI_DWC3_OF_SIMPLE + bool "DesignWare USB3 DRD Generic OF Simple Glue Layer" + select MISC + help +Support USB2/3 functionality in simple SoC integrations with +USB controller based on the DesignWare USB3 IP Core. + config USB_XHCI_MVEBU bool "MVEBU USB 3.0 support" default y diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile index 9819489..abe4f90 100644 --- a/drivers/usb/host/Makefile +++ b/drivers/usb/host/Makefile @@ -49,6 +49,7 @@ obj-$(CONFIG_USB_EHCI_ZYNQ) += ehci-zynq.o # xhci obj-$(CONFIG_USB_XHCI_HCD) += xhci.o xhci-mem.o xhci-ring.o obj-$(CONFIG_USB_XHCI_DWC3) += xhci-dwc3.o +obj-$(CONFIG_USB_XHCI_DWC3_OF_SIMPLE) += dwc3-of-simple.o obj-$(CONFIG_USB_XHCI_ROCKCHIP) += xhci-rockchip.o obj-$(CONFIG_USB_XHCI_ZYNQMP) += xhci-zynqmp.o obj-$(CONFIG_USB_XHCI_KEYSTONE) += xhci-keystone.o diff --git a/drivers/usb/host/dwc3-of-simple.c b/drivers/usb/host/dwc3-of-simple.c new file mode 100644 index 000..826a996 --- /dev/null +++ b/drivers/usb/host/dwc3-of-simple.c @@ -0,0 +1,187 @@ +/* + * dwc3-of-simple.c - OF glue layer for simple integrations + * + * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com + * + * Author: Felipe Balbi + * + * Copyright (C) 2018 BayLibre, SAS + * Author: Neil Armstrong + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include +#include +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +struct dwc3_of_simple { +#if CONFIG_IS_ENABLED(CLK) + struct clk *clks; + int num_clocks; +#endif +#if CONFIG_IS_ENABLED(DM_RESET) + struct reset_ctl*resets; + int num_resets; +#endif +}; + +#if CONFIG_IS_ENABLED(DM_RESET) +static int dwc3_of_simple_reset_init(struct udevice *dev, + struct dwc3_of_simple *simple, + int count) +{ + int i, ret, err; + + if (!count) + return 0; + + simple->resets = devm_kcalloc(dev, count, sizeof(struct reset_ctl), +GFP_KERNEL); + if (!simple->resets) + return -ENOMEM; + + for (i = 0; i < count; i++) { + ret = reset_get_by_index(dev, i, >resets[i]); + if (ret < 0) + break; + + ret = reset_request(>resets[i]); + if (ret) { + pr_err("failed to request reset line %d\n", i); + reset_free(>resets[i]); + goto reset_err; + } + + + ++simple->num_resets; + } + + for (i = 0; i < simple->num_resets; i++) { + ret = reset_deassert(>resets[i]); + if (ret && ret != -ENOSYS && ret != -ENOTSUPP) { + pr_err("failed to deassert reset line %d\n", i); + goto reset_err; + } + } + + return 0; >>> >>> This looks like some driver I've seen before. Isn't there similar code >>> for simple EHCI or OHCI driver already ? >>> >> >> Hi, >> >> This is not an EHCI/OHCI driver, only the glue to init the clocks and reset, >> it's the exact same as the drivers/usb/dwc3/dwc3-of-simple.c adapted to >> U-Boot. >> >> yes, similar code exists in drivers/usb/host/ehci-generic.c and >> drivers/usb/host/ohci-generic.c but the goal here is not to initialize the >> controller >> but only the glue. > > Can't we recycle that code instead of having three copies of similar stuff ? > Sure, where should I put this code ? the clock and resets are stored in the driver's platdata. Neil ___
Re: [U-Boot] [PATCH u-boot 1/3] usb: host: Add simple of glue driver for DWC3 USB Controllers integration
On 03/29/2018 04:23 PM, Neil Armstrong wrote: > On 29/03/2018 15:52, Marek Vasut wrote: >> On 03/29/2018 03:42 PM, Neil Armstrong wrote: >>> Signed-off-by: Neil Armstrong>>> --- >>> drivers/usb/host/Kconfig | 7 ++ >>> drivers/usb/host/Makefile | 1 + >>> drivers/usb/host/dwc3-of-simple.c | 187 >>> ++ >>> 3 files changed, 195 insertions(+) >>> create mode 100644 drivers/usb/host/dwc3-of-simple.c >>> >>> diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig >>> index a7249b7..6caa615 100644 >>> --- a/drivers/usb/host/Kconfig >>> +++ b/drivers/usb/host/Kconfig >>> @@ -21,6 +21,13 @@ config USB_XHCI_DWC3 >>> Say Y or if your system has a Dual Role SuperSpeed >>> USB controller based on the DesignWare USB3 IP Core. >>> >>> +config USB_XHCI_DWC3_OF_SIMPLE >>> + bool "DesignWare USB3 DRD Generic OF Simple Glue Layer" >>> + select MISC >>> + help >>> + Support USB2/3 functionality in simple SoC integrations with >>> + USB controller based on the DesignWare USB3 IP Core. >>> + >>> config USB_XHCI_MVEBU >>> bool "MVEBU USB 3.0 support" >>> default y >>> diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile >>> index 9819489..abe4f90 100644 >>> --- a/drivers/usb/host/Makefile >>> +++ b/drivers/usb/host/Makefile >>> @@ -49,6 +49,7 @@ obj-$(CONFIG_USB_EHCI_ZYNQ) += ehci-zynq.o >>> # xhci >>> obj-$(CONFIG_USB_XHCI_HCD) += xhci.o xhci-mem.o xhci-ring.o >>> obj-$(CONFIG_USB_XHCI_DWC3) += xhci-dwc3.o >>> +obj-$(CONFIG_USB_XHCI_DWC3_OF_SIMPLE) += dwc3-of-simple.o >>> obj-$(CONFIG_USB_XHCI_ROCKCHIP) += xhci-rockchip.o >>> obj-$(CONFIG_USB_XHCI_ZYNQMP) += xhci-zynqmp.o >>> obj-$(CONFIG_USB_XHCI_KEYSTONE) += xhci-keystone.o >>> diff --git a/drivers/usb/host/dwc3-of-simple.c >>> b/drivers/usb/host/dwc3-of-simple.c >>> new file mode 100644 >>> index 000..826a996 >>> --- /dev/null >>> +++ b/drivers/usb/host/dwc3-of-simple.c >>> @@ -0,0 +1,187 @@ >>> +/* >>> + * dwc3-of-simple.c - OF glue layer for simple integrations >>> + * >>> + * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com >>> + * >>> + * Author: Felipe Balbi >>> + * >>> + * Copyright (C) 2018 BayLibre, SAS >>> + * Author: Neil Armstrong >>> + * >>> + * SPDX-License-Identifier: GPL-2.0+ >>> + */ >>> + >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> + >>> +DECLARE_GLOBAL_DATA_PTR; >>> + >>> +struct dwc3_of_simple { >>> +#if CONFIG_IS_ENABLED(CLK) >>> + struct clk *clks; >>> + int num_clocks; >>> +#endif >>> +#if CONFIG_IS_ENABLED(DM_RESET) >>> + struct reset_ctl*resets; >>> + int num_resets; >>> +#endif >>> +}; >>> + >>> +#if CONFIG_IS_ENABLED(DM_RESET) >>> +static int dwc3_of_simple_reset_init(struct udevice *dev, >>> +struct dwc3_of_simple *simple, >>> +int count) >>> +{ >>> + int i, ret, err; >>> + >>> + if (!count) >>> + return 0; >>> + >>> + simple->resets = devm_kcalloc(dev, count, sizeof(struct reset_ctl), >>> + GFP_KERNEL); >>> + if (!simple->resets) >>> + return -ENOMEM; >>> + >>> + for (i = 0; i < count; i++) { >>> + ret = reset_get_by_index(dev, i, >resets[i]); >>> + if (ret < 0) >>> + break; >>> + >>> + ret = reset_request(>resets[i]); >>> + if (ret) { >>> + pr_err("failed to request reset line %d\n", i); >>> + reset_free(>resets[i]); >>> + goto reset_err; >>> + } >>> + >>> + >>> + ++simple->num_resets; >>> + } >>> + >>> + for (i = 0; i < simple->num_resets; i++) { >>> + ret = reset_deassert(>resets[i]); >>> + if (ret && ret != -ENOSYS && ret != -ENOTSUPP) { >>> + pr_err("failed to deassert reset line %d\n", i); >>> + goto reset_err; >>> + } >>> + } >>> + >>> + return 0; >> >> This looks like some driver I've seen before. Isn't there similar code >> for simple EHCI or OHCI driver already ? >> > > Hi, > > This is not an EHCI/OHCI driver, only the glue to init the clocks and reset, > it's the exact same as the drivers/usb/dwc3/dwc3-of-simple.c adapted to > U-Boot. > > yes, similar code exists in drivers/usb/host/ehci-generic.c and > drivers/usb/host/ohci-generic.c but the goal here is not to initialize the > controller > but only the glue. Can't we recycle that code instead of having three copies of similar stuff ? -- Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH u-boot 3/3] phy: Add Amlogic Meson USB2 & USB3 Generic PHY drivers
On 29/03/2018 15:54, Marek Vasut wrote: > On 03/29/2018 03:42 PM, Neil Armstrong wrote: >> Signed-off-by: Neil Armstrong>> --- >> drivers/phy/Kconfig | 8 ++ >> drivers/phy/Makefile | 1 + >> drivers/phy/meson-gxl-usb2.c | 238 >> +++ >> drivers/phy/meson-gxl-usb3.c | 201 >> 4 files changed, 448 insertions(+) >> create mode 100644 drivers/phy/meson-gxl-usb2.c >> create mode 100644 drivers/phy/meson-gxl-usb3.c > > Commit message is missing, otherwise looks reasonable. > OOps, will add in v2. Thanks, Neil ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH u-boot 2/3] usb: host: dwc3: Add support for multiple PHYs
On 29/03/2018 15:53, Marek Vasut wrote: > On 03/29/2018 03:42 PM, Neil Armstrong wrote: >> DWC3 Ips can have more than 1 PHY for USB2 and 1 PHY for USB3, add support >> for a generic number of PHYs and adapt the code to handle a generic >> number of PHYs. >> >> Signed-off-by: Neil Armstrong>> --- >> drivers/usb/host/xhci-dwc3.c | 105 >> --- >> 1 file changed, 58 insertions(+), 47 deletions(-) >> >> diff --git a/drivers/usb/host/xhci-dwc3.c b/drivers/usb/host/xhci-dwc3.c >> index 1022dd5..da29162 100644 >> --- a/drivers/usb/host/xhci-dwc3.c >> +++ b/drivers/usb/host/xhci-dwc3.c >> @@ -22,8 +22,8 @@ >> DECLARE_GLOBAL_DATA_PTR; >> >> struct xhci_dwc3_platdata { >> -struct phy usb_phy; >> -struct phy usb3_phy; >> +struct phy *usb_phys; >> +int num_phys; >> }; >> >> void dwc3_set_mode(struct dwc3 *dwc3_reg, u32 mode) >> @@ -113,45 +113,74 @@ void dwc3_set_fladj(struct dwc3 *dwc3_reg, u32 val) >> } >> >> #ifdef CONFIG_DM_USB >> -static int xhci_dwc3_setup_phy(struct udevice *dev, int index, struct phy >> *phy) >> +static int xhci_dwc3_setup_phy(struct udevice *dev, int count) >> { >> -int ret = 0; >> +struct xhci_dwc3_platdata *plat = dev_get_platdata(dev); >> +int i, ret; >> + >> +if (!count) >> +return 0; >> >> -ret = generic_phy_get_by_index(dev, index, phy); >> -if (ret) { >> -if (ret != -ENOENT) { >> -pr_err("Failed to get USB PHY for %s\n", dev->name); >> +plat->usb_phys = devm_kcalloc(dev, count, sizeof(struct phy), >> +GFP_KERNEL); >> +if (!plat->usb_phys) >> +return -ENOMEM; >> + >> +for (i = 0; i < count; i++) { >> +ret = generic_phy_get_by_index(dev, i, >usb_phys[i]); >> +if (ret && ret != -ENOENT) { >> +pr_err("Failed to get USB PHY%d for %s\n", >> + i, dev->name); >> return ret; >> } >> -} else { >> -ret = generic_phy_init(phy); >> + >> +++plat->num_phys; >> +} >> + >> +for (i = 0; i < plat->num_phys; i++) { >> +ret = generic_phy_init(>usb_phys[i]); >> if (ret) { >> -pr_err("Can't init USB PHY for %s\n", dev->name); >> -return ret; >> +pr_err("Can't init USB PHY%d for %s\n", >> + i, dev->name); >> +goto phys_err; >> } >> -ret = generic_phy_power_on(phy); >> +} >> + >> +for (i = 0; i < plat->num_phys; i++) { >> +ret = generic_phy_power_on(>usb_phys[i]); >> if (ret) { >> -pr_err("Can't power on USB PHY for %s\n", dev->name); >> -generic_phy_exit(phy); >> -return ret; >> +pr_err("Can't power USB PHY%d for %s\n", >> + i, dev->name); >> +goto phys_err; >> } >> } >> >> return 0; >> + >> +phys_err: >> +for (; i >= 0; i--) { >> +generic_phy_power_off(>usb_phys[i]); >> +generic_phy_exit(>usb_phys[i]); >> +} > > This will not work if all the PHYs are inited, but the power up function > fails -- at that point the phy_exit will not be called for all inited PHys. > Ok will split in 2 parts. Neil ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH u-boot 1/3] usb: host: Add simple of glue driver for DWC3 USB Controllers integration
On 29/03/2018 15:52, Marek Vasut wrote: > On 03/29/2018 03:42 PM, Neil Armstrong wrote: >> Signed-off-by: Neil Armstrong>> --- >> drivers/usb/host/Kconfig | 7 ++ >> drivers/usb/host/Makefile | 1 + >> drivers/usb/host/dwc3-of-simple.c | 187 >> ++ >> 3 files changed, 195 insertions(+) >> create mode 100644 drivers/usb/host/dwc3-of-simple.c >> >> diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig >> index a7249b7..6caa615 100644 >> --- a/drivers/usb/host/Kconfig >> +++ b/drivers/usb/host/Kconfig >> @@ -21,6 +21,13 @@ config USB_XHCI_DWC3 >>Say Y or if your system has a Dual Role SuperSpeed >>USB controller based on the DesignWare USB3 IP Core. >> >> +config USB_XHCI_DWC3_OF_SIMPLE >> +bool "DesignWare USB3 DRD Generic OF Simple Glue Layer" >> +select MISC >> +help >> + Support USB2/3 functionality in simple SoC integrations with >> + USB controller based on the DesignWare USB3 IP Core. >> + >> config USB_XHCI_MVEBU >> bool "MVEBU USB 3.0 support" >> default y >> diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile >> index 9819489..abe4f90 100644 >> --- a/drivers/usb/host/Makefile >> +++ b/drivers/usb/host/Makefile >> @@ -49,6 +49,7 @@ obj-$(CONFIG_USB_EHCI_ZYNQ) += ehci-zynq.o >> # xhci >> obj-$(CONFIG_USB_XHCI_HCD) += xhci.o xhci-mem.o xhci-ring.o >> obj-$(CONFIG_USB_XHCI_DWC3) += xhci-dwc3.o >> +obj-$(CONFIG_USB_XHCI_DWC3_OF_SIMPLE) += dwc3-of-simple.o >> obj-$(CONFIG_USB_XHCI_ROCKCHIP) += xhci-rockchip.o >> obj-$(CONFIG_USB_XHCI_ZYNQMP) += xhci-zynqmp.o >> obj-$(CONFIG_USB_XHCI_KEYSTONE) += xhci-keystone.o >> diff --git a/drivers/usb/host/dwc3-of-simple.c >> b/drivers/usb/host/dwc3-of-simple.c >> new file mode 100644 >> index 000..826a996 >> --- /dev/null >> +++ b/drivers/usb/host/dwc3-of-simple.c >> @@ -0,0 +1,187 @@ >> +/* >> + * dwc3-of-simple.c - OF glue layer for simple integrations >> + * >> + * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com >> + * >> + * Author: Felipe Balbi >> + * >> + * Copyright (C) 2018 BayLibre, SAS >> + * Author: Neil Armstrong >> + * >> + * SPDX-License-Identifier: GPL-2.0+ >> + */ >> + >> +#include >> +#include >> +#include >> +#include >> +#include >> + >> +DECLARE_GLOBAL_DATA_PTR; >> + >> +struct dwc3_of_simple { >> +#if CONFIG_IS_ENABLED(CLK) >> +struct clk *clks; >> +int num_clocks; >> +#endif >> +#if CONFIG_IS_ENABLED(DM_RESET) >> +struct reset_ctl*resets; >> +int num_resets; >> +#endif >> +}; >> + >> +#if CONFIG_IS_ENABLED(DM_RESET) >> +static int dwc3_of_simple_reset_init(struct udevice *dev, >> + struct dwc3_of_simple *simple, >> + int count) >> +{ >> +int i, ret, err; >> + >> +if (!count) >> +return 0; >> + >> +simple->resets = devm_kcalloc(dev, count, sizeof(struct reset_ctl), >> + GFP_KERNEL); >> +if (!simple->resets) >> +return -ENOMEM; >> + >> +for (i = 0; i < count; i++) { >> +ret = reset_get_by_index(dev, i, >resets[i]); >> +if (ret < 0) >> +break; >> + >> +ret = reset_request(>resets[i]); >> +if (ret) { >> +pr_err("failed to request reset line %d\n", i); >> +reset_free(>resets[i]); >> +goto reset_err; >> +} >> + >> + >> +++simple->num_resets; >> +} >> + >> +for (i = 0; i < simple->num_resets; i++) { >> +ret = reset_deassert(>resets[i]); >> +if (ret && ret != -ENOSYS && ret != -ENOTSUPP) { >> +pr_err("failed to deassert reset line %d\n", i); >> +goto reset_err; >> +} >> +} >> + >> +return 0; > > This looks like some driver I've seen before. Isn't there similar code > for simple EHCI or OHCI driver already ? > Hi, This is not an EHCI/OHCI driver, only the glue to init the clocks and reset, it's the exact same as the drivers/usb/dwc3/dwc3-of-simple.c adapted to U-Boot. yes, similar code exists in drivers/usb/host/ehci-generic.c and drivers/usb/host/ohci-generic.c but the goal here is not to initialize the controller but only the glue. The device tree representation is : glue@ { compatible = "amlogic,meson-gxl-dwc3"; clocks = <>; resets = <>; dwc3@ { compatible = "snps,dwc3"; clocks = <>; phys = <>; }; }; Neil ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] MPC8548 U boot
Hi All, I working on Uboot for the MPC8548, and I using your git repo -I built the Uboot with* ppc_85xx- *toolchain, -The Entry Point Address of elf file is *0xfffa*, - My Memory map is ; 0x_ | 256MB | 0x0FFF_ | DDR SDRAM 0x5000_ | 64MB | 0x53FF_ | PCI 1 Prefetchable Memory 0x5400_ | 64MB | 0x57FF_ | PCI 1 Non-Prefetchable Memory 0x5800_ | 64MB | 0x5BFF_ | PCI 1 IO 0x6000_ | 64MB | 0x63FF_ | PCI Express Prefetchable Memory 0x6400_ | 64MB | 0x67FF_ | PCI Express Non-Prefetchable Memory 0x6800_ | 64MB | 0x6BFF_ | PCI Express IO 0xF8B0_ | 16MB | 0xF7FF_ | NVRAM/CADMUS 0xF000_ | 64MB | 0xFBFF_ | LBC SDRAM 0xE000_ | 1MB | 0xFE0F_ | Configuration Control Registers 0xD000_ | 64MB | 0xD3FF_ | SODIMM Flash 0xFF80_ | 8MB | 0x_ | Boot Flash After the install program to board, program stay at *0xf290* address, I did comparison with elf file, its *InstructionTLBError*. How can I fix this, I need suggestions. I look forward to your replies. Your Sincerely. Yigit YASAR ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] sunxi: improve throughput in the sunxi_mmc driver
Hello, On Wed, 21 Mar 2018 12:18:58 +0100 Maxime Ripardwrote: > From: Philipp Tomsich > > Throughput tests have shown the sunxi_mmc driver to take over 10s to > read 10MB from a fast eMMC device due to excessive delays in polling > loops. > > This commit restructures the main polling loops to use get_timer(...) > to determine whether a (millisecond) timeout has expired. We choose > not to use the wait_bit function, as we don't need interruptability > with ctrl-c and have at least one case where two bits (one for an > error condition and another one for completion) need to be read and > using wait_bit would have not added to the clarity. > > The observed speedup in testing on a A31 is greater than 10x (e.g. a > 10MB write decreases from 9.302s to 0.884s). > > Signed-off-by: Philipp Tomsich > Signed-off-by: Maxime Ripard Tested-by: Mylène Josserand Thanks, -- Mylène Josserand, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering http://bootlin.com ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH u-boot 2/3] usb: host: dwc3: Add support for multiple PHYs
On 03/29/2018 03:42 PM, Neil Armstrong wrote: > DWC3 Ips can have more than 1 PHY for USB2 and 1 PHY for USB3, add support > for a generic number of PHYs and adapt the code to handle a generic > number of PHYs. > > Signed-off-by: Neil Armstrong> --- > drivers/usb/host/xhci-dwc3.c | 105 > --- > 1 file changed, 58 insertions(+), 47 deletions(-) > > diff --git a/drivers/usb/host/xhci-dwc3.c b/drivers/usb/host/xhci-dwc3.c > index 1022dd5..da29162 100644 > --- a/drivers/usb/host/xhci-dwc3.c > +++ b/drivers/usb/host/xhci-dwc3.c > @@ -22,8 +22,8 @@ > DECLARE_GLOBAL_DATA_PTR; > > struct xhci_dwc3_platdata { > - struct phy usb_phy; > - struct phy usb3_phy; > + struct phy *usb_phys; > + int num_phys; > }; > > void dwc3_set_mode(struct dwc3 *dwc3_reg, u32 mode) > @@ -113,45 +113,74 @@ void dwc3_set_fladj(struct dwc3 *dwc3_reg, u32 val) > } > > #ifdef CONFIG_DM_USB > -static int xhci_dwc3_setup_phy(struct udevice *dev, int index, struct phy > *phy) > +static int xhci_dwc3_setup_phy(struct udevice *dev, int count) > { > - int ret = 0; > + struct xhci_dwc3_platdata *plat = dev_get_platdata(dev); > + int i, ret; > + > + if (!count) > + return 0; > > - ret = generic_phy_get_by_index(dev, index, phy); > - if (ret) { > - if (ret != -ENOENT) { > - pr_err("Failed to get USB PHY for %s\n", dev->name); > + plat->usb_phys = devm_kcalloc(dev, count, sizeof(struct phy), > + GFP_KERNEL); > + if (!plat->usb_phys) > + return -ENOMEM; > + > + for (i = 0; i < count; i++) { > + ret = generic_phy_get_by_index(dev, i, >usb_phys[i]); > + if (ret && ret != -ENOENT) { > + pr_err("Failed to get USB PHY%d for %s\n", > +i, dev->name); > return ret; > } > - } else { > - ret = generic_phy_init(phy); > + > + ++plat->num_phys; > + } > + > + for (i = 0; i < plat->num_phys; i++) { > + ret = generic_phy_init(>usb_phys[i]); > if (ret) { > - pr_err("Can't init USB PHY for %s\n", dev->name); > - return ret; > + pr_err("Can't init USB PHY%d for %s\n", > +i, dev->name); > + goto phys_err; > } > - ret = generic_phy_power_on(phy); > + } > + > + for (i = 0; i < plat->num_phys; i++) { > + ret = generic_phy_power_on(>usb_phys[i]); > if (ret) { > - pr_err("Can't power on USB PHY for %s\n", dev->name); > - generic_phy_exit(phy); > - return ret; > + pr_err("Can't power USB PHY%d for %s\n", > +i, dev->name); > + goto phys_err; > } > } > > return 0; > + > +phys_err: > + for (; i >= 0; i--) { > + generic_phy_power_off(>usb_phys[i]); > + generic_phy_exit(>usb_phys[i]); > + } This will not work if all the PHYs are inited, but the power up function fails -- at that point the phy_exit will not be called for all inited PHys. -- Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH u-boot 3/3] phy: Add Amlogic Meson USB2 & USB3 Generic PHY drivers
On 03/29/2018 03:42 PM, Neil Armstrong wrote: > Signed-off-by: Neil Armstrong> --- > drivers/phy/Kconfig | 8 ++ > drivers/phy/Makefile | 1 + > drivers/phy/meson-gxl-usb2.c | 238 > +++ > drivers/phy/meson-gxl-usb3.c | 201 > 4 files changed, 448 insertions(+) > create mode 100644 drivers/phy/meson-gxl-usb2.c > create mode 100644 drivers/phy/meson-gxl-usb3.c Commit message is missing, otherwise looks reasonable. -- Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH u-boot 1/3] usb: host: Add simple of glue driver for DWC3 USB Controllers integration
On 03/29/2018 03:42 PM, Neil Armstrong wrote: > Signed-off-by: Neil Armstrong> --- > drivers/usb/host/Kconfig | 7 ++ > drivers/usb/host/Makefile | 1 + > drivers/usb/host/dwc3-of-simple.c | 187 > ++ > 3 files changed, 195 insertions(+) > create mode 100644 drivers/usb/host/dwc3-of-simple.c > > diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig > index a7249b7..6caa615 100644 > --- a/drivers/usb/host/Kconfig > +++ b/drivers/usb/host/Kconfig > @@ -21,6 +21,13 @@ config USB_XHCI_DWC3 > Say Y or if your system has a Dual Role SuperSpeed > USB controller based on the DesignWare USB3 IP Core. > > +config USB_XHCI_DWC3_OF_SIMPLE > + bool "DesignWare USB3 DRD Generic OF Simple Glue Layer" > + select MISC > + help > + Support USB2/3 functionality in simple SoC integrations with > + USB controller based on the DesignWare USB3 IP Core. > + > config USB_XHCI_MVEBU > bool "MVEBU USB 3.0 support" > default y > diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile > index 9819489..abe4f90 100644 > --- a/drivers/usb/host/Makefile > +++ b/drivers/usb/host/Makefile > @@ -49,6 +49,7 @@ obj-$(CONFIG_USB_EHCI_ZYNQ) += ehci-zynq.o > # xhci > obj-$(CONFIG_USB_XHCI_HCD) += xhci.o xhci-mem.o xhci-ring.o > obj-$(CONFIG_USB_XHCI_DWC3) += xhci-dwc3.o > +obj-$(CONFIG_USB_XHCI_DWC3_OF_SIMPLE) += dwc3-of-simple.o > obj-$(CONFIG_USB_XHCI_ROCKCHIP) += xhci-rockchip.o > obj-$(CONFIG_USB_XHCI_ZYNQMP) += xhci-zynqmp.o > obj-$(CONFIG_USB_XHCI_KEYSTONE) += xhci-keystone.o > diff --git a/drivers/usb/host/dwc3-of-simple.c > b/drivers/usb/host/dwc3-of-simple.c > new file mode 100644 > index 000..826a996 > --- /dev/null > +++ b/drivers/usb/host/dwc3-of-simple.c > @@ -0,0 +1,187 @@ > +/* > + * dwc3-of-simple.c - OF glue layer for simple integrations > + * > + * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com > + * > + * Author: Felipe Balbi > + * > + * Copyright (C) 2018 BayLibre, SAS > + * Author: Neil Armstrong > + * > + * SPDX-License-Identifier: GPL-2.0+ > + */ > + > +#include > +#include > +#include > +#include > +#include > + > +DECLARE_GLOBAL_DATA_PTR; > + > +struct dwc3_of_simple { > +#if CONFIG_IS_ENABLED(CLK) > + struct clk *clks; > + int num_clocks; > +#endif > +#if CONFIG_IS_ENABLED(DM_RESET) > + struct reset_ctl*resets; > + int num_resets; > +#endif > +}; > + > +#if CONFIG_IS_ENABLED(DM_RESET) > +static int dwc3_of_simple_reset_init(struct udevice *dev, > + struct dwc3_of_simple *simple, > + int count) > +{ > + int i, ret, err; > + > + if (!count) > + return 0; > + > + simple->resets = devm_kcalloc(dev, count, sizeof(struct reset_ctl), > + GFP_KERNEL); > + if (!simple->resets) > + return -ENOMEM; > + > + for (i = 0; i < count; i++) { > + ret = reset_get_by_index(dev, i, >resets[i]); > + if (ret < 0) > + break; > + > + ret = reset_request(>resets[i]); > + if (ret) { > + pr_err("failed to request reset line %d\n", i); > + reset_free(>resets[i]); > + goto reset_err; > + } > + > + > + ++simple->num_resets; > + } > + > + for (i = 0; i < simple->num_resets; i++) { > + ret = reset_deassert(>resets[i]); > + if (ret && ret != -ENOSYS && ret != -ENOTSUPP) { > + pr_err("failed to deassert reset line %d\n", i); > + goto reset_err; > + } > + } > + > + return 0; This looks like some driver I've seen before. Isn't there similar code for simple EHCI or OHCI driver already ? -- Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH u-boot 3/3] phy: Add Amlogic Meson USB2 & USB3 Generic PHY drivers
Signed-off-by: Neil Armstrong--- drivers/phy/Kconfig | 8 ++ drivers/phy/Makefile | 1 + drivers/phy/meson-gxl-usb2.c | 238 +++ drivers/phy/meson-gxl-usb3.c | 201 4 files changed, 448 insertions(+) create mode 100644 drivers/phy/meson-gxl-usb2.c create mode 100644 drivers/phy/meson-gxl-usb3.c diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 3b9a09c..99a6d95 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -85,4 +85,12 @@ config STI_USB_PHY used by USB2 and USB3 Host controllers available on STiH407 SoC families. +config MESON_GXL_USB_PHY + bool "Amlogic Meson GXL USB PHYs" + depends on PHY && ARCH_MESON && MESON_GXL + imply REGMAP + help + This is the generic phy driver for the Amlogic Meson GXL + USB2 and USB3 PHYS. + endmenu diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index 668040b..6c1610e 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile @@ -10,3 +10,4 @@ obj-$(CONFIG_$(SPL_)NOP_PHY) += nop-phy.o obj-$(CONFIG_PHY_SANDBOX) += sandbox-phy.o obj-$(CONFIG_$(SPL_)PIPE3_PHY) += ti-pipe3-phy.o obj-$(CONFIG_STI_USB_PHY) += sti_usb_phy.o +obj-$(CONFIG_MESON_GXL_USB_PHY) += meson-gxl-usb2.o meson-gxl-usb3.o diff --git a/drivers/phy/meson-gxl-usb2.c b/drivers/phy/meson-gxl-usb2.c new file mode 100644 index 000..15c9c89 --- /dev/null +++ b/drivers/phy/meson-gxl-usb2.c @@ -0,0 +1,238 @@ +/* + * Meson GXL and GXM USB2 PHY driver + * + * Copyright (C) 2017 Martin Blumenstingl + * Copyright (C) 2018 BayLibre, SAS + * Author: Neil Armstrong + * + * SPDX-License-Identifier:GPL-2.0+ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +/* bits [31:27] are read-only */ +#define U2P_R0 0x0 + #define U2P_R0_BYPASS_SEL BIT(0) + #define U2P_R0_BYPASS_DM_EN BIT(1) + #define U2P_R0_BYPASS_DP_EN BIT(2) + #define U2P_R0_TXBITSTUFF_ENH BIT(3) + #define U2P_R0_TXBITSTUFF_ENBIT(4) + #define U2P_R0_DM_PULLDOWN BIT(5) + #define U2P_R0_DP_PULLDOWN BIT(6) + #define U2P_R0_DP_VBUS_VLD_EXT_SEL BIT(7) + #define U2P_R0_DP_VBUS_VLD_EXT BIT(8) + #define U2P_R0_ADP_PRB_EN BIT(9) + #define U2P_R0_ADP_DISCHARGEBIT(10) + #define U2P_R0_ADP_CHARGE BIT(11) + #define U2P_R0_DRV_VBUS BIT(12) + #define U2P_R0_ID_PULLUPBIT(13) + #define U2P_R0_LOOPBACK_EN_BBIT(14) + #define U2P_R0_OTG_DISABLE BIT(15) + #define U2P_R0_COMMON_ONN BIT(16) + #define U2P_R0_FSEL_MASKGENMASK(19, 17) + #define U2P_R0_REF_CLK_SEL_MASK GENMASK(21, 20) + #define U2P_R0_POWER_ON_RESET BIT(22) + #define U2P_R0_V_ATE_TEST_EN_B_MASK GENMASK(24, 23) + #define U2P_R0_ID_SET_ID_DQ BIT(25) + #define U2P_R0_ATE_RESETBIT(26) + #define U2P_R0_FSV_MINUSBIT(27) + #define U2P_R0_FSV_PLUS BIT(28) + #define U2P_R0_BYPASS_DM_DATA BIT(29) + #define U2P_R0_BYPASS_DP_DATA BIT(30) + +#define U2P_R1 0x4 + #define U2P_R1_BURN_IN_TEST BIT(0) + #define U2P_R1_ACA_ENABLE BIT(1) + #define U2P_R1_DCD_ENABLE BIT(2) + #define U2P_R1_VDAT_SRC_EN_BBIT(3) + #define U2P_R1_VDAT_DET_EN_BBIT(4) + #define U2P_R1_CHARGES_SEL BIT(5) + #define U2P_R1_TX_PREEMP_PULSE_TUNE BIT(6) + #define U2P_R1_TX_PREEMP_AMP_TUNE_MASK GENMASK(8, 7) + #define U2P_R1_TX_RES_TUNE_MASK GENMASK(10, 9) + #define U2P_R1_TX_RISE_TUNE_MASKGENMASK(12, 11) + #define U2P_R1_TX_VREF_TUNE_MASKGENMASK(16, 13) + #define U2P_R1_TX_FSLS_TUNE_MASKGENMASK(20, 17) +
[U-Boot] [PATCH u-boot 2/3] usb: host: dwc3: Add support for multiple PHYs
DWC3 Ips can have more than 1 PHY for USB2 and 1 PHY for USB3, add support for a generic number of PHYs and adapt the code to handle a generic number of PHYs. Signed-off-by: Neil Armstrong--- drivers/usb/host/xhci-dwc3.c | 105 --- 1 file changed, 58 insertions(+), 47 deletions(-) diff --git a/drivers/usb/host/xhci-dwc3.c b/drivers/usb/host/xhci-dwc3.c index 1022dd5..da29162 100644 --- a/drivers/usb/host/xhci-dwc3.c +++ b/drivers/usb/host/xhci-dwc3.c @@ -22,8 +22,8 @@ DECLARE_GLOBAL_DATA_PTR; struct xhci_dwc3_platdata { - struct phy usb_phy; - struct phy usb3_phy; + struct phy *usb_phys; + int num_phys; }; void dwc3_set_mode(struct dwc3 *dwc3_reg, u32 mode) @@ -113,45 +113,74 @@ void dwc3_set_fladj(struct dwc3 *dwc3_reg, u32 val) } #ifdef CONFIG_DM_USB -static int xhci_dwc3_setup_phy(struct udevice *dev, int index, struct phy *phy) +static int xhci_dwc3_setup_phy(struct udevice *dev, int count) { - int ret = 0; + struct xhci_dwc3_platdata *plat = dev_get_platdata(dev); + int i, ret; + + if (!count) + return 0; - ret = generic_phy_get_by_index(dev, index, phy); - if (ret) { - if (ret != -ENOENT) { - pr_err("Failed to get USB PHY for %s\n", dev->name); + plat->usb_phys = devm_kcalloc(dev, count, sizeof(struct phy), + GFP_KERNEL); + if (!plat->usb_phys) + return -ENOMEM; + + for (i = 0; i < count; i++) { + ret = generic_phy_get_by_index(dev, i, >usb_phys[i]); + if (ret && ret != -ENOENT) { + pr_err("Failed to get USB PHY%d for %s\n", + i, dev->name); return ret; } - } else { - ret = generic_phy_init(phy); + + ++plat->num_phys; + } + + for (i = 0; i < plat->num_phys; i++) { + ret = generic_phy_init(>usb_phys[i]); if (ret) { - pr_err("Can't init USB PHY for %s\n", dev->name); - return ret; + pr_err("Can't init USB PHY%d for %s\n", + i, dev->name); + goto phys_err; } - ret = generic_phy_power_on(phy); + } + + for (i = 0; i < plat->num_phys; i++) { + ret = generic_phy_power_on(>usb_phys[i]); if (ret) { - pr_err("Can't power on USB PHY for %s\n", dev->name); - generic_phy_exit(phy); - return ret; + pr_err("Can't power USB PHY%d for %s\n", + i, dev->name); + goto phys_err; } } return 0; + +phys_err: + for (; i >= 0; i--) { + generic_phy_power_off(>usb_phys[i]); + generic_phy_exit(>usb_phys[i]); + } + + return ret; } -static int xhci_dwc3_shutdown_phy(struct phy *phy) +static int xhci_dwc3_shutdown_phy(struct udevice *dev) { - int ret = 0; + struct xhci_dwc3_platdata *plat = dev_get_platdata(dev); + int i, ret; - if (generic_phy_valid(phy)) { - ret = generic_phy_power_off(phy); - if (ret) - return ret; + for (i = 0; i < plat->num_phys; i++) { + if (!generic_phy_valid(>usb_phys[i])) + continue; - ret = generic_phy_exit(phy); - if (ret) - return ret; + ret = generic_phy_power_off(>usb_phys[i]); + ret |= generic_phy_exit(>usb_phys[i]); + if (ret) { + pr_err("Can't shutdown USB PHY%d for %s\n", + i, dev->name); + } } return 0; @@ -159,7 +188,6 @@ static int xhci_dwc3_shutdown_phy(struct phy *phy) static int xhci_dwc3_probe(struct udevice *dev) { - struct xhci_dwc3_platdata *plat = dev_get_platdata(dev); struct xhci_hcor *hcor; struct xhci_hccr *hccr; struct dwc3 *dwc3_reg; @@ -170,18 +198,10 @@ static int xhci_dwc3_probe(struct udevice *dev) hcor = (struct xhci_hcor *)((uintptr_t)hccr + HC_LENGTH(xhci_readl(&(hccr)->cr_capbase))); - ret = xhci_dwc3_setup_phy(dev, 0, >usb_phy); - if (ret) { - pr_err("Failed to setup USB PHY for %s\n", dev->name); - return ret; - } - - ret = xhci_dwc3_setup_phy(dev, 1, >usb3_phy); - if (ret) { - pr_err("Failed to setup USB3 PHY for %s\n", dev->name); - xhci_dwc3_shutdown_phy(>usb_phy); + ret = xhci_dwc3_setup_phy(dev, dev_count_phandle_with_args( +
[U-Boot] [PATCH u-boot 1/3] usb: host: Add simple of glue driver for DWC3 USB Controllers integration
Signed-off-by: Neil Armstrong--- drivers/usb/host/Kconfig | 7 ++ drivers/usb/host/Makefile | 1 + drivers/usb/host/dwc3-of-simple.c | 187 ++ 3 files changed, 195 insertions(+) create mode 100644 drivers/usb/host/dwc3-of-simple.c diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index a7249b7..6caa615 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -21,6 +21,13 @@ config USB_XHCI_DWC3 Say Y or if your system has a Dual Role SuperSpeed USB controller based on the DesignWare USB3 IP Core. +config USB_XHCI_DWC3_OF_SIMPLE + bool "DesignWare USB3 DRD Generic OF Simple Glue Layer" + select MISC + help + Support USB2/3 functionality in simple SoC integrations with + USB controller based on the DesignWare USB3 IP Core. + config USB_XHCI_MVEBU bool "MVEBU USB 3.0 support" default y diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile index 9819489..abe4f90 100644 --- a/drivers/usb/host/Makefile +++ b/drivers/usb/host/Makefile @@ -49,6 +49,7 @@ obj-$(CONFIG_USB_EHCI_ZYNQ) += ehci-zynq.o # xhci obj-$(CONFIG_USB_XHCI_HCD) += xhci.o xhci-mem.o xhci-ring.o obj-$(CONFIG_USB_XHCI_DWC3) += xhci-dwc3.o +obj-$(CONFIG_USB_XHCI_DWC3_OF_SIMPLE) += dwc3-of-simple.o obj-$(CONFIG_USB_XHCI_ROCKCHIP) += xhci-rockchip.o obj-$(CONFIG_USB_XHCI_ZYNQMP) += xhci-zynqmp.o obj-$(CONFIG_USB_XHCI_KEYSTONE) += xhci-keystone.o diff --git a/drivers/usb/host/dwc3-of-simple.c b/drivers/usb/host/dwc3-of-simple.c new file mode 100644 index 000..826a996 --- /dev/null +++ b/drivers/usb/host/dwc3-of-simple.c @@ -0,0 +1,187 @@ +/* + * dwc3-of-simple.c - OF glue layer for simple integrations + * + * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com + * + * Author: Felipe Balbi + * + * Copyright (C) 2018 BayLibre, SAS + * Author: Neil Armstrong + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include +#include +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +struct dwc3_of_simple { +#if CONFIG_IS_ENABLED(CLK) + struct clk *clks; + int num_clocks; +#endif +#if CONFIG_IS_ENABLED(DM_RESET) + struct reset_ctl*resets; + int num_resets; +#endif +}; + +#if CONFIG_IS_ENABLED(DM_RESET) +static int dwc3_of_simple_reset_init(struct udevice *dev, +struct dwc3_of_simple *simple, +int count) +{ + int i, ret, err; + + if (!count) + return 0; + + simple->resets = devm_kcalloc(dev, count, sizeof(struct reset_ctl), + GFP_KERNEL); + if (!simple->resets) + return -ENOMEM; + + for (i = 0; i < count; i++) { + ret = reset_get_by_index(dev, i, >resets[i]); + if (ret < 0) + break; + + ret = reset_request(>resets[i]); + if (ret) { + pr_err("failed to request reset line %d\n", i); + reset_free(>resets[i]); + goto reset_err; + } + + + ++simple->num_resets; + } + + for (i = 0; i < simple->num_resets; i++) { + ret = reset_deassert(>resets[i]); + if (ret && ret != -ENOSYS && ret != -ENOTSUPP) { + pr_err("failed to deassert reset line %d\n", i); + goto reset_err; + } + } + + return 0; + +reset_err: + err = reset_release_all(simple->resets, simple->num_resets); + if (err) + pr_err("failed to disable all clocks\n"); + + return ret; +} +#endif + +#if CONFIG_IS_ENABLED(CLK) +static int dwc3_of_simple_clk_init(struct udevice *dev, + struct dwc3_of_simple *simple, + int count) +{ + int i, ret, err; + + if (!count) + return 0; + + simple->clks = devm_kcalloc(dev, count, sizeof(struct clk), + GFP_KERNEL); + if (!simple->clks) + return -ENOMEM; + + for (i = 0; i < count; i++) { + ret = clk_get_by_index(dev, i, >clks[i]); + if (ret < 0) + break; + + ret = clk_enable(>clks[i]); + if (ret && ret != -ENOSYS && ret != -ENOTSUPP) { + pr_err("failed to enable clock %d\n", i); + clk_free(>clks[i]); + goto clk_err; + } + + ++simple->num_clocks; + } + + return 0; + +clk_err: + err = clk_release_all(simple->clks, simple->num_clocks); + if (err) + pr_err("failed to
[U-Boot] [PATCH u-boot 0/3] Add USB Support for Amlogic Meson GXL SoCs
This patchset adds support for USB for the Amlogic Meson GXL SoCs following the work done for Linux by Martin Blumenstingl at [1] [2] [3]. The support consist of : - A port of dwc3-of-simple from Linux to U-boot - A change to support more than 2 PHYs in the DWC3 DM driver - An USB2 PHY Driver and an USB3 PHY Driver The DWC3 Controller has up to 4 PHYs connected : - 2 USB2 PHYs and an USB3 PHY for GXL SoCs - 3 USB2 PHYs and an USB3 PHY for the GXM SoC Variant This is enabled by the "usb: host: dwc3: Add support for multiple PHYs" patch. This patch is based on the "xhci-dwc3: Couple of fixes for USB3 support" serie from Vignesh R, on the u-boot-usb tree. The DWC3 Controller glue is generic enough to use the dwc3-of-simple from Linux and can be easily ported to U-Boot as a Simple-Bus with Glue-Specific clocks and Reset lines setup. The USB PHY driver supports the standard generic PHY interface and supports the power-on/off calls and set the Host mode by default. They are based on the excellent work from Martin Blumenstingl merged in linux. [1] https://lkml.kernel.org/r/20180303184700.21480-1-martin.blumensti...@googlemail.com [2] https://lkml.kernel.org/r/20180128202245.25021-1-martin.blumensti...@googlemail.com [3] https://lkml.kernel.org/r/20180303214309.25643-1-martin.blumensti...@googlemail.com Neil Armstrong (3): usb: host: Add simple of glue driver for DWC3 USB Controllers integration usb: host: dwc3: Add support for multiple PHYs phy: Add Amlogic Meson USB2 & USB3 Generic PHY drivers drivers/phy/Kconfig | 8 ++ drivers/phy/Makefile | 1 + drivers/phy/meson-gxl-usb2.c | 238 +++ drivers/phy/meson-gxl-usb3.c | 201 4 files changed, 448 insertions(+) create mode 100644 drivers/phy/meson-gxl-usb2.c create mode 100644 drivers/phy/meson-gxl-usb3.c -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/1] sunxi: mmc: Fix phase delays
On Tue, Mar 27, 2018 at 04:57:23PM +0300, Stefan Mavrodiev wrote: > U-boot driver for sunxi-mmc uses PLL6, unlike linux kernel where > PLL5 is used, with clock rates respectively 600MHz and 768MHz. > Thus there are different phase degree steps - 24 for the kernel and > 30 for u-boot. > > In the kernel driver the phase is set 90 deg for output and 120 for > sample. Dividing by 30 will result values 3 and 4. Those are the > values set in the u-boot driver. > > However, the condition defining delays is wrong. MMC core driver > requests clock of 52MHz, sunxi-driver sets clock of 50MHz, but > phase is set 30 deg for output and 120 deg for sample. > > Apparently this works for most cards. > On A20-SOM204-EVB-eMMC there is eMMC card (KLMAG2GEND) which complains > about it. Maybe there is other boards with similar problem? > So the fix is to match delays for both u-boot and kernel. > > Signed-off-by: Stefan MavrodievAcked-by: Maxime Ripard Maxime -- Maxime Ripard, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] serial: meson: Update compatible with new Linux bindings
The Amlogic Meson SoCs serial bindings were not written when serial support was pushed into Linux and U-Boot. A clean bindings document has been merged into Linux tree to correctly handle the multiple clocks feeding the serial peripheral. This update the U-Boot serial_meson driver with the new compatible string for Amlogic Meson GX Socs. Signed-off-by: Neil Armstrong--- drivers/serial/serial_meson.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/serial/serial_meson.c b/drivers/serial/serial_meson.c index 363affb..6412ca6 100644 --- a/drivers/serial/serial_meson.c +++ b/drivers/serial/serial_meson.c @@ -125,6 +125,7 @@ static const struct dm_serial_ops meson_serial_ops = { static const struct udevice_id meson_serial_ids[] = { { .compatible = "amlogic,meson-uart" }, + { .compatible = "amlogic,meson-gx-uart" }, { } }; -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH u-boot] reset: Add Amlogic Meson Reset Controller
The Amlogic Meson SoCs embeds up to 256 reset lines, add the corresponding driver. Signed-off-by: Neil Armstrong--- drivers/reset/Kconfig | 8 drivers/reset/Makefile | 1 + drivers/reset/reset-meson.c | 90 + 3 files changed, 99 insertions(+) create mode 100644 drivers/reset/reset-meson.c diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig index 3964b9e..fffa41e 100644 --- a/drivers/reset/Kconfig +++ b/drivers/reset/Kconfig @@ -83,4 +83,12 @@ config RESET_ROCKCHIP though is that some reset signals, like I2C or MISC reset multiple devices. +config RESET_MESON + bool "Reset controller driver for Amlogic Meson SoCs" + depends on DM_RESET && ARCH_MESON + imply REGMAP + default y + help + Support for reset controller on Amlogic Meson SoC. + endmenu diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile index 7d7e080..d1d5146 100644 --- a/drivers/reset/Makefile +++ b/drivers/reset/Makefile @@ -13,3 +13,4 @@ obj-$(CONFIG_RESET_BCM6345) += reset-bcm6345.o obj-$(CONFIG_RESET_UNIPHIER) += reset-uniphier.o obj-$(CONFIG_AST2500_RESET) += ast2500-reset.o obj-$(CONFIG_RESET_ROCKCHIP) += reset-rockchip.o +obj-$(CONFIG_RESET_MESON) += reset-meson.o diff --git a/drivers/reset/reset-meson.c b/drivers/reset/reset-meson.c new file mode 100644 index 000..5324f86 --- /dev/null +++ b/drivers/reset/reset-meson.c @@ -0,0 +1,90 @@ +/* + * Amlogic Meson Reset Controller driver + * + * Copyright (c) 2018 BayLibre, SAS. + * Author: Neil Armstrong + * + * SPDX-License-Identifier: GPL-2.0 + */ + +#include +#include +#include +#include + +#define REG_COUNT 8 +#define BITS_PER_REG 32 +#define LEVEL_OFFSET 0x7c + +struct meson_reset_priv { + struct regmap *regmap; +}; + +static int meson_reset_request(struct reset_ctl *reset_ctl) +{ + if (reset_ctl->id > (REG_COUNT * BITS_PER_REG)) + return -EINVAL; + + return 0; +} + +static int meson_reset_free(struct reset_ctl *reset_ctl) +{ + return 0; +} + +static int meson_reset_level(struct reset_ctl *reset_ctl, bool assert) +{ + struct meson_reset_priv *priv = dev_get_priv(reset_ctl->dev); + uint bank = reset_ctl->id / BITS_PER_REG; + uint offset = reset_ctl->id % BITS_PER_REG; + uint reg_offset = LEVEL_OFFSET + (bank << 2); + uint val; + + regmap_read(priv->regmap, reg_offset, ); + if (assert) + val &= ~BIT(offset); + else + val |= BIT(offset); + regmap_write(priv->regmap, reg_offset, val); + + return 0; +} + +static int meson_reset_assert(struct reset_ctl *reset_ctl) +{ + return meson_reset_level(reset_ctl, true); +} + +static int meson_reset_deassert(struct reset_ctl *reset_ctl) +{ + return meson_reset_level(reset_ctl, false); +} + +struct reset_ops meson_reset_ops = { + .request = meson_reset_request, + .free = meson_reset_free, + .rst_assert = meson_reset_assert, + .rst_deassert = meson_reset_deassert, +}; + +static const struct udevice_id meson_reset_ids[] = { + { .compatible = "amlogic,meson-gxbb-reset" }, + { } +}; + +static int meson_reset_probe(struct udevice *dev) +{ + struct meson_reset_priv *priv = dev_get_priv(dev); + + return regmap_init_mem(dev, >regmap); +} + +U_BOOT_DRIVER(meson_reset) = { + .name = "meson_reset", + .id = UCLASS_RESET, + .of_match = meson_reset_ids, + .probe = meson_reset_probe, + .ops = _reset_ops, + .priv_auto_alloc_size = sizeof(struct meson_reset_priv), +}; -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 5/6] sunxi: add code for recalculating the DRAM size in U-Boot
Hi, On 29/03/18 10:37, Maxime Ripard wrote: > On Wed, Mar 28, 2018 at 07:31:51PM +0800, Icenowy Zheng wrote: >> 于 2018年3月28日 GMT+08:00 下午7:28:07, Maxime Ripard>> 写到: >>> On Mon, Mar 26, 2018 at 03:11:04PM +0800, Icenowy Zheng wrote: 于 2018年3月26日 GMT+08:00 下午3:06:33, Maxime Ripard >>> 写到: > On Fri, Mar 23, 2018 at 05:41:43PM +0800, Icenowy Zheng wrote: >> >> >> 于 2018年3月23日 GMT+08:00 下午5:40:41, Maxime Ripard > 写到: >>> On Fri, Mar 23, 2018 at 04:18:56PM +0800, Icenowy Zheng wrote: The get_ram_size() function in U-Boot can only deal with memory > size smaller than 2GiB. To enable the support of 3GiB DRAM on newer > 64-bit SoCs, an alternative way to detect DRAM size is needed. >>> >>> Why not just fixing get_ram_size then? >> >> Even if it's fixed it won't support 3GiB DRAM at all. > > Why? It has an assumption that the size is pow of 2. >>> >>> I guess this would be fixable too? (or one could create a variant >>> without that assumption). >> >> I don't think its principle allows such kind of fix, as it just >> checks writing then reading at some offset that is pow if 2. > > You could do have a bunch of algorithm actually. One would be to write > the address in memory and try to detect where exactly it starts to > loop. > > You could do a bisection in the opposite direction once you settled > for the upper limit (so you would have for example a workable 2G, a > non-workable 4G, and then you try intervals that you always divide by > two, so testing then 3G (that works), then halfway between 3G and 4G, > etc. > >> For hacking it, see my implementation in v1, which assumes the >> only size supported bigger than 2GiB is 3GiB (which is >> acceptable on sunxi, but might not work on other platforms). >> >> As Andre said, that function has another big problem -- it detects >> memory with writing to it. This is risky. > > How is it risky when it's done by the SPL? Originally that was my confusion as well: It's not the SPL calling that function. The DRAM controller init function in there knows very precisely how much DRAM we have, but we don't communicate this to U-Boot proper. So U-Boot *proper* goes ahead and probes the DRAM. This means it could step into secure memory, for instance. On sunxi64 we have the ATF running between SPL and U-Boot, also all kind of secure payloads could already have been registered. So I wonder if it would be easier to somehow pass on this *one* word of information between SPL and U-Boot proper to avoid calling this function altogether? Cheers, Andre. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] timer: Add High Precision Event Timers (HPET) support
On Wed, 2018-03-28 at 17:58 -0700, Ivan Gorinov wrote: > Adding HPET as an alternative timer for x86 (default is TSC). > HPET main counter has constant clock frequency, calibration is not > required. > This change also makes TSC timer driver optional on x86 platforms. > If X86_TSC is disabled, early timer functions are provided by HPET. > > HPET can be selected as the tick timer in the Device Tree "chosen" > node: > > /include/ "hpet.dtsi" > > chosen { > tick-timer = "/hpet0"; > }; > First question is how this will work in case of Broadwell and Ivybridge that have something to do with HPET in their CPU code, i.e. arch/x86/cpu/broadwell/pch.c arch/x86/cpu/ivybridge/lpc.c ? Look for clrsetbits_le32(RCB_REG(HPTC), 3, 1 << 7); > +static int hpet_timer_get_count(struct udevice *dev, u64 *count) > +static int hpet_timer_probe(struct udevice *dev) > +#ifndef CONFIG_X86_TSC_TIMER > +#define EARLY_HPET_BASE 0xfed0 HPET address is fixed, AFAIU, on x86, and provided by config option in U-Boot. > +unsigned long notrace timer_early_get_rate(void) > +u64 notrace timer_early_get_count(void) > +int timer_init(void) These functions have too much code duplication with above. > +#endif -- Andy ShevchenkoIntel Finland Oy ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot