Re: [U-Boot] build fail due to dependence error

2018-07-09 Thread Patrick DELAUNAY
> From: U-Boot  On Behalf Of Masahiro Yamada
> Sent: lundi 9 juillet 2018 07:27
> Subject: Re: [U-Boot] build fail due to dependence error
> 
> Hi.
> 
> 
> 2018-07-09 11:39 GMT+09:00 Simon Glass :
> > +Masahiro who might know
> >
> > On 2 July 2018 at 01:23, Dr. Philipp Tomsich
> >  wrote:
> >> Kever,
> >>
> >> Could you check the build artifacts in Jenkins to see whether after
> >> the ‘make [configname]_defconfig’, the link for asm/arch is correctly
> >> set up?
> >>
> >> Thanks,
> >> Philipp.
> >>
> >> On 2 Jul 2018, at 09:54, Kever Yang  wrote:
> >>
> >> Hi Simon,
> >>
> >>
> >> On 06/30/2018 12:19 PM, Simon Glass wrote:
> >>
> >> Hi,
> >>
> >> On 28 June 2018 at 01:41, Dr. Philipp Tomsich
> >>  wrote:
> >>
> >> Kever,
> >>
> >> is the link for ‘asm’ set up correctly?
> >>
> >> Thanks,
> >> Philipp.
> >>
> >> On 28 Jun 2018, at 10:38, Kever Yang  wrote:
> >>
> >> Hi Simon,
> >>
> >>Do you have any idea about this error?
> >>
> >>
> >> CC  lib/asm-offsets.s
> >>  CC  arch/arm/lib/asm-offsets.s
> >> fixdep: error opening config file:
> >> arch/arm/include/asm/arch/hardware.h: No such file or directory
> >> Kbuild:64: recipe for target 'arch/arm/lib/asm-offsets.s' failed
> >> make[1]: *** [arch/arm/lib/asm-offsets.s] Error 2
> >> make[1]: *** 正在等待未完成的任务
> >>  CHK include/config.h
> >> Makefile:1340: recipe for target 'prepare0' failed
> >>
> >> Thanks,
> >> - Kever
> >>
> >> On 06/01/2018 05:59 PM, Kever Yang wrote:
> >>
> >> Hi Guys,
> >>
> >> I met below error from time to time when build U-Boot project.
> >>
> >> fixdep: error opening config file:
> >> arch/arm/include/asm/arch/hardware.h: No such file or directory
> >>
> >>The folder 'arch/arm/include/asm/arch' is a link for
> >> 'arch/arm/include/asm/arch-rockchip',
> >>
> >> which is dynamic generate by build system, I thinks there should be
> >> some dependency issue?
> >>
> >>How to fix this kind of issue?
> >>
> >> I am not sure what is going on there. I don't see this.
> >>
> >> Are you using 'make distclean' or 'make mrproper' on your object tree
> >> every now and then?
> >>
> >>
> >> This is happen sometimes in our Jenkins verify, It will gone when I
> >> rebase the patch(re-build without any change), we do 'make distclean'
> >> every time before a new build.
> 
> 
> Hmm, I cannot reproduce this error.
> 
> 
> I have no clue about this.

Just for information, I have also the same issue sometime in the same context 
(Jenkins build) for stm32mp1 board.

The error is : "Missing stm32.h file in the directory include/asm/arch/"

I try to understood the dependency issue, but I don't found any issue: 
the needed symbolic link is done just before in the trace of the artifact...

2018-03-03-17-00-02] | if [ -d 
/opt/STM/workspace/workdir/rdk/build-stm32mp1/tmp-glibc/work/stm32mp1-stm32mpvalid-linux-gnueabi/u-boot-basic-stm32mp/2018.01-git-AUTOINC+d741b91b3c.r0/git/arch/arm/mach-stm32mp/include/mach
 ]; then   \
[2018-03-03-17-00-02] |dest=arch/arm/mach-stm32mp/include/mach; 
\
[2018-03-03-17-00-02] | else
 \
[2018-03-03-17-00-02] |dest=arch/arm/include/asm/arch-stm32mp;   \
[2018-03-03-17-00-02] | fi; 
 \
[2018-03-03-17-00-02] | ln -fsn 
/opt/STM/workspace/workdir/rdk/build-stm32mp1/tmp-glibc/work/stm32mp1-stm32mpvalid-linux-gnueabi/u-boot-basic-stm32mp/2018.01-git-AUTOINC+d741b91b3c.r0/git/$dest
 include/asm/arch
[2018-03-03-17-00-02] | fixdep: error opening config file: 
include/asm/arch/stm32.h: No such file or directory

I don't understood why the dependency failed

Perhaps it is because in our Jenkins task the parallel compilation is requested 
with high value... (-J 8)
and the dependency check is done in parallel of the link creation

The  dependancy are :
./arch/arm/lib/asm-offsets.c => Kbuild 

with:
lib/asm-offsets.s: lib/asm-offsets.c FORCE
 

but the link on the directory is requested only by the rules about config.h not 
for stm32.h (or hardware.h in your case):
./scripts/Makefile.autoconf:115:include/config.h: scripts/Makefile.autoconf 
create_symlink FORCE

Perhaps add  a simple rule in some makefile can solve the issue

For me

include/asm/arch/stm32.h: create_symlink

or for you :

include/asm/arch/hardware.h: create_symlink


or it is better to add generic dependancy in ./scripts/Makefile.autoconf ?

include/asm/arch/*.h: create_symlink


> --
> Best Regards
> Masahiro Yamada

Regards

Patrick.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] cmd: ubi: change 'default y' for SUNXI to 'imply' in Kconfig

2018-07-09 Thread Maxime Ripard
On Mon, Jul 09, 2018 at 03:12:37PM +0900, Masahiro Yamada wrote:
> It is not preferred to put SUNXI-specific code in the common place.

I think Tom has been saying the exact opposite a number of times,
since there's some circular dependencies issues that arise when using
imply.

Maxime

> Change it to 'imply' property of ARCH_SUNXI.
> 
> Signed-off-by: Masahiro Yamada 
> ---
> 
>  arch/arm/Kconfig | 1 +
>  cmd/Kconfig  | 1 -
>  2 files changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 7d394f2..a6ce155 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -796,6 +796,7 @@ config ARCH_SUNXI
>   select USB_KEYBOARD if DISTRO_DEFAULTS
>   select USE_TINY_PRINTF
>   imply CMD_GPT
> + imply CMD_UBI if NAND
>   imply DISTRO_DEFAULTS
>   imply FAT_WRITE
>   imply OF_LIBFDT_OVERLAY
> diff --git a/cmd/Kconfig b/cmd/Kconfig
> index aec2090..159ebaa 100644
> --- a/cmd/Kconfig
> +++ b/cmd/Kconfig
> @@ -1792,7 +1792,6 @@ config CMD_UBI
>   select CRC32
>   select MTD_UBI
>   select CMD_MTDPARTS
> - default y if NAND_SUNXI
>   help
> UBI is a software layer above MTD layer which admits use of LVM-like
> logical volumes on top of MTD devices, hides some complexities of
> -- 
> 2.7.4
> 

-- 
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


Re: [U-Boot] [PATCH v2 2/2] net: mvgbe: convert to DM

2018-07-09 Thread Chris Packham
On Mon, Jul 9, 2018 at 9:05 AM Michael Walle  wrote:
>
>
> Hi Chris,
>
> thanks for your efforts. This basically works for me on my Kirkwood
> LSCHLv2 board. So you may add
>
> Tested-by: Michael Walle 
>
> But there are some issues. See below.
>
>
> [snip]
>
> > -#if defined(CONFIG_PHYLIB)
> > +#if defined(CONFIG_PHYLIB) || defined(CONFIG_DM_ETH)
> > +#if defined(CONFIG_DM_ETH)
> > +static struct phy_device *__mvgbe_phy_init(struct udevice *dev,
> > +struct mii_dev *bus,
> > +phy_interface_t phy_interface,
> > +int phyid)
> > +#else
> > +static struct phy_device *__mvgbe_phy_init(struct eth_device *dev,
> > +struct mii_dev *bus,
> > +phy_interface_t phy_interface,
> > +int phyid)
> > +#endif
> > +{
> > + struct phy_device *phydev;
> > +
> > + /* Set phy address of the port */
> > + miiphy_write(dev->name, MV_PHY_ADR_REQUEST, MV_PHY_ADR_REQUEST,
> > +  phyid);
> > +
> > + phydev = phy_connect(bus, phyid, dev, phy_interface);
>
> So CONFIG_PHYLIB is required if CONFIG_DM_ETH is enabled? If so, then
> can we add
>
> selects PHYLIB if DM_ETH
>
> to the CONFIG_MVGBE Kconfig part?
>

Yes will do. I even erroneously added it at one point (without the if DM_ETH).

> > + if (!phydev) {
> > + printf("phy_connect failed\n");
> > + return NULL;
> > + }
> > +
> > + phy_config(phydev);
> > + phy_startup(phydev);
> > +
> > + return phydev;
> > +}
> > +#endif /* CONFIG_PHYLIB || CONFIG_DM_ETH */
> > +
>
> [snip]
>
> > +static int mvgbe_ofdata_to_platdata(struct udevice *dev)
> > +{
> > + struct eth_pdata *pdata = dev_get_platdata(dev);
> > + struct mvgbe_device *dmvgbe = dev_get_priv(dev);
> > + void *blob = (void *)gd->fdt_blob;
> > + int node = dev_of_offset(dev);
> > + const char *phy_mode;
> > + int fl_node;
> > + unsigned long addr;
> > +
> > + pdata->iobase = devfdt_get_addr(dev);
> > +
> > + /* Get phy-mode / phy_interface from DT */
> > + pdata->phy_interface = -1;
> > + phy_mode = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "phy-mode",
> > +NULL);
> > + if (phy_mode)
> > + pdata->phy_interface = phy_get_interface_by_name(phy_mode);
> > + if (pdata->phy_interface == -1) {
> > + debug("%s: Invalid PHY interface '%s'\n", __func__, phy_mode);
> > + return -EINVAL;
> > + }
> > +
> > + dmvgbe->phy_interface = pdata->phy_interface;
> > +
> > + /* fetch 'fixed-link' property */
> > + fl_node = fdt_subnode_offset(blob, node, "fixed-link");
> > + if (fl_node != -FDT_ERR_NOTFOUND) {
> > + /* set phy_addr to invalid value for fixed link */
> > + dmvgbe->phyaddr = PHY_MAX_ADDR + 1;
> > + dmvgbe->duplex = fdtdec_get_bool(blob, fl_node, 
> > "full-duplex");
> > + dmvgbe->speed = fdtdec_get_int(blob, fl_node, "speed", 0);
> > + } else {
> > + /* Now read phyaddr from DT */
> > + addr = fdtdec_get_int(blob, node, "phy", 0);
>
> Should be "phy-handle", shouldn't it? And isn't there already function
> for this which gets the phy address? Also, the phy-handle is on the port
> subnode in the device tree. I guess, this applies to phy-mode, too.
>

Hmm my hacky dts for testing this called it "phy" and attached it to
the eth node. I'll look at a couple of proper boards and code to them.

> > + addr = fdt_node_offset_by_phandle(blob, addr);
> > + dmvgbe->phyaddr = fdtdec_get_int(blob, addr, "reg", 0);
> > + }
> > +
> > + return 0;
> > +}
>
>
> -michael
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v4 1/2] dm: mdio: add a uclass for MDIO

2018-07-09 Thread Michal Simek
On 5.7.2018 09:34, m...@marvell.com wrote:
> From: Ken Ma 
> 
> Add a uclass which provides access to MDIO busses and includes
> operations required by MDIO.
> The implementation is based on the existing mii/phy/mdio data
> structures and APIs.
> This patch also adds device tree binding for MDIO bus.
> 
> Signed-off-by: Ken Ma 
> Reviewed-by: s...@chromium.org, joe.hershber...@ni.com
> ---
> 
> Changes in v4:
> - Minor updates for comments and Maintainer.
> 
> Changes in v3:
> - Move mdio uclass implementation to driver/net folder;
> - Replace flat-tree functions with livetree functions and update codes
>   and comments to be consistent with driver-model codes style;
> - Put struct mii_dev to uclass platdata to avoid the mdio alloc and
>   let driver model framework to alloc the memroy automatically,
>   meanwhile the mii bus link initialization is added.
> 
> Changes in v2:
> - Fix error printing:
> - Change some debug to pr_err;
> - mii bus has no parent member and it is not a udevice, so dev_err
>   is changed to pr_err for mii bus error printings.
> 
>  MAINTAINERS   |   1 +
>  doc/device-tree-bindings/net/mdio-bus.txt |  54 ++
>  drivers/Kconfig   |   2 +
>  drivers/net/Makefile  |   1 +
>  drivers/net/mdio/Kconfig  |  18 +
>  drivers/net/mdio/Makefile |   6 ++
>  drivers/net/mdio/mdio-uclass.c| 112 
> ++
>  include/dm/uclass-id.h|   1 +
>  include/net/mdio.h|  62 +
>  9 files changed, 257 insertions(+)
>  create mode 100644 doc/device-tree-bindings/net/mdio-bus.txt
>  create mode 100644 drivers/net/mdio/Kconfig
>  create mode 100644 drivers/net/mdio/Makefile
>  create mode 100644 drivers/net/mdio/mdio-uclass.c
>  create mode 100644 include/net/mdio.h
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 642c448..07f7c66 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -432,6 +432,7 @@ M:Joe Hershberger 
>  S:   Maintained
>  T:   git git://git.denx.de/u-boot-net.git
>  F:   drivers/net/
> +F:   drivers/net/mdio/
>  F:   net/
>  
>  NIOS
> diff --git a/doc/device-tree-bindings/net/mdio-bus.txt 
> b/doc/device-tree-bindings/net/mdio-bus.txt
> new file mode 100644
> index 000..68d8b25
> --- /dev/null
> +++ b/doc/device-tree-bindings/net/mdio-bus.txt
> @@ -0,0 +1,54 @@
> +MDIO (Management Data Input/Output) busses
> +
> +MDIO busses can be described with a node for the MDIO master device
> +and a set of child nodes for each phy on the bus.
> +
> +The MDIO node requires the following properties:
> +- #address-cells  - number of cells required to define phy address on
> +the MDIO bus.
> +- #size-cells - should be zero.
> +- compatible  - name of MDIO bus controller following generic names
> +recommended practice.
> +- reg  - address and length of the MDIO register.
> +
> +Optional property:
> +- mdio-name   - MDIO bus name
> +
> +The child nodes of the MDIO driver are the individual PHY devices
> +connected to this MDIO bus. They must have a "reg" property given the
> +PHY address on the MDIO bus.
> +- reg - (required) phy address in MDIO bus.
> +
> +Example for cp110 MDIO node at the SoC level:
> + cp0_mdio: mdio@12a200 {
> + #address-cells = <1>;
> + #size-cells = <0>;
> + compatible = "marvell,orion-mdio";
> + reg = <0x12a200 0x10>;
> + mdio-name = "cp0-mdio";
> + };
> +
> + cp0_xmdio: mdio@12a600 {
> + #address-cells = <1>;
> + #size-cells = <0>;
> + compatible = "marvell,xmdio";
> + reg = <0x12a600 0x200>;
> + mdio-name = "cp0-xmdio";
> + };
> +
> +And at the board level, example for armada-8040-mcbin board:
> + &cp0_mdio {
> + ge_phy: ethernet-phy@0 {
> + reg = <0>;
> + };
> + };
> +
> + &cp0_xmdio {
> + phy0: ethernet-phy@0 {
> + reg = <0>;
> + };
> +
> + phy8: ethernet-phy@8 {
> + reg = <8>;
> + };
> + };

this binding should be in separate patch and it is not align with what
it is in the kernel. mdio-name is not there. You should send a patch to
kernel.

Thanks,
Michal
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] SoCFPGA PL330 DMA driver and ECC scrubbing

2018-07-09 Thread Marek Vasut
On 07/07/2018 12:56 AM, Jason Rush wrote:
> On 7/5/2018 6:10 PM, Marek Vasut wrote:
>> On 07/06/2018 01:11 AM, Jason Rush wrote:
>>> On 7/4/2018 2:23 AM, Marek Vasut wrote:
 On 07/04/2018 01:45 AM, Jason Rush wrote:
> On 7/3/2018 9:08 AM, Marek Vasut wrote:
>> On 07/03/2018 03:58 PM, Jason Rush wrote:
>>> On 6/29/2018 10:17 AM, Marek Vasut wrote:
 On 06/29/2018 05:06 PM, Jason Rush wrote:
> On 6/29/2018 9:52 AM, Marek Vasut wrote:
>> On 06/29/2018 04:44 PM, Jason Rush wrote:
>>> On 6/29/2018 9:34 AM, Marek Vasut wrote:
 On 06/29/2018 04:31 PM, Jason Rush wrote:
> Dinh,
 Hi,

> A while ago, you posted the following patchset for SoCFPGA to add 
> the PL330
> DMA driver, and updated the SoCFPGA SDRAM init to write zeros to 
> SDRAM to
> initialize the ECC bits if ECC was enabled:
>
> https://lists.denx.de/pipermail/u-boot/2016-October/269643.html
>
> I know it's been a long time, so I'll summarize some of the 
> conversation...
>
> At the time, you had a problem with the patchset causing the SPL 
> to fail to
> find the MMC.  You had tracked it down to an issue with the 
> following commit
> "a78cd8613204 ARM: Rework and correct barrier definitions".  You 
> and Marek
> discussed it a bit, but I don't think there was a real 
> conclusion.  You
> submitted a second version of the patchset asking for advice on 
> debugging
> the issue:
>
> https://lists.denx.de/pipermail/u-boot/2016-December/275822.html
>
> No real conversation came from the second patchset, and that was 
> the end of
> the patch.
>
> I was hoping we could revisit adding your patchset again. I am 
> working on a
> custom SoCFPGA board with a Cyclone V and ECC SDRAM. I rebased 
> your patchset
> against v2018.05 and it is working on my custom board (although I 
> don't have
> an MMC). I also tested it on a SoCKit booting from an MMC (I 
> forced it to
> scrub the SDRAM on the SoCKit, because it doesn't have ECC RAM), 
> and the
> SoCKit finds the MMC and boots.
>
> I don't have any suggestions on why it is working now on my board 
> and not
> back when you first submitted the patchset.  Maybe something else 
> was fixed
> in the MMC? I was hoping you and Marek could test this patch 
> again on some
> different SoCFPGA boards to see if you get the same results.
 Look at this patch
 http://git.denx.de/?p=u-boot/u-boot-socfpga.git;a=commit;h=9bb8a249b292d26f152c20e3641600b3d7b3924b

 You likely want similar approach, it's faster then the DMA and 
 much simpler.

>>> Thanks Marek.  I'll give it a try.  Would you be interested in a 
>>> similar patch for the Gen 5?
>> I don't have any Gen5 board which uses ECC, do you ?
>> If so, yes, prepare a patch, it should be very similar.
>>
>> Make sure to measure how long it takes to scrub the memory and how 
>> much
>> memory you have, I'd be interested in the numbers.
>>
> Looking at the master branch, it doesn't look like that code is ever 
> being called?
> The sdram_init_ecc_bits() function is called from the 
> ddr_calibration_sequence function(),
> but I can't find where ddr_calibration_sequence is called().
 git grep for it, it's called from somewhere in the 
 arch/arm/mach-socfpga/

> Either way, I can test it. I have a custom Cyclone V board with ECC, 
> and the Intel Arria V SoC
> Dev Kit I can test it on too which I think has ECC.
 Please do.

>>> I implemented a similar memset approach for the gen 5 socfpga.  It's 
>>> basically the same
>>> code as in that patch; however, when I performed a single memset the 
>>> processor would
>>> reset for some reason.  I changed it to loop over calling memset with a 
>>> size of 32MB over
>>> the entire address the address, and that worked as opposed to doing a 
>>> single memset on
>>> the RAM.
>> Can you do grep MEMSET .config in your U-Boot build dir ? The arch
>> memset is implemented in assembler and doesn't trigger WDT , so if it
>> takes too long, it could be that the WDT resets the platform.
> Both CONFIG_USE_ARCH_MEMSET and CONFIG_SPL_USE_ARCH_MEMSET
> are set in my .config, so it must be the

Re: [U-Boot] build fail due to dependence error

2018-07-09 Thread Dr. Philipp Tomsich

> On 9 Jul 2018, at 09:18, Patrick DELAUNAY  wrote:
> 
>> From: U-Boot  On Behalf Of Masahiro Yamada
>> Sent: lundi 9 juillet 2018 07:27
>> Subject: Re: [U-Boot] build fail due to dependence error
>> 
>> Hi.
>> 
>> 
>> 2018-07-09 11:39 GMT+09:00 Simon Glass :
>>> +Masahiro who might know
>>> 
>>> On 2 July 2018 at 01:23, Dr. Philipp Tomsich
>>>  wrote:
 Kever,
 
 Could you check the build artifacts in Jenkins to see whether after
 the ‘make [configname]_defconfig’, the link for asm/arch is correctly
 set up?
 
 Thanks,
 Philipp.
 
 On 2 Jul 2018, at 09:54, Kever Yang  wrote:
 
 Hi Simon,
 
 
 On 06/30/2018 12:19 PM, Simon Glass wrote:
 
 Hi,
 
 On 28 June 2018 at 01:41, Dr. Philipp Tomsich
  wrote:
 
 Kever,
 
 is the link for ‘asm’ set up correctly?
 
 Thanks,
 Philipp.
 
 On 28 Jun 2018, at 10:38, Kever Yang  wrote:
 
 Hi Simon,
 
   Do you have any idea about this error?
 
 
 CC  lib/asm-offsets.s
 CC  arch/arm/lib/asm-offsets.s
 fixdep: error opening config file:
 arch/arm/include/asm/arch/hardware.h: No such file or directory
 Kbuild:64: recipe for target 'arch/arm/lib/asm-offsets.s' failed
 make[1]: *** [arch/arm/lib/asm-offsets.s] Error 2
 make[1]: *** 正在等待未完成的任务
 CHK include/config.h
 Makefile:1340: recipe for target 'prepare0' failed
 
 Thanks,
 - Kever
 
 On 06/01/2018 05:59 PM, Kever Yang wrote:
 
 Hi Guys,
 
I met below error from time to time when build U-Boot project.
 
 fixdep: error opening config file:
 arch/arm/include/asm/arch/hardware.h: No such file or directory
 
   The folder 'arch/arm/include/asm/arch' is a link for
 'arch/arm/include/asm/arch-rockchip',
 
 which is dynamic generate by build system, I thinks there should be
 some dependency issue?
 
   How to fix this kind of issue?
 
 I am not sure what is going on there. I don't see this.
 
 Are you using 'make distclean' or 'make mrproper' on your object tree
 every now and then?
 
 
 This is happen sometimes in our Jenkins verify, It will gone when I
 rebase the patch(re-build without any change), we do 'make distclean'
 every time before a new build.
>> 
>> 
>> Hmm, I cannot reproduce this error.
>> 
>> 
>> I have no clue about this.
> 
> Just for information, I have also the same issue sometime in the same context 
> (Jenkins build) for stm32mp1 board.
> 
> The error is : "Missing stm32.h file in the directory include/asm/arch/"
> 
> I try to understood the dependency issue, but I don't found any issue: 
> the needed symbolic link is done just before in the trace of the artifact...
> 
> 2018-03-03-17-00-02] | if [ -d 
> /opt/STM/workspace/workdir/rdk/build-stm32mp1/tmp-glibc/work/stm32mp1-stm32mpvalid-linux-gnueabi/u-boot-basic-stm32mp/2018.01-git-AUTOINC+d741b91b3c.r0/git/arch/arm/mach-stm32mp/include/mach
>  ]; then   \
> [2018-03-03-17-00-02] |dest=arch/arm/mach-stm32mp/include/mach;   
>   \
> [2018-03-03-17-00-02] | else  
>\
> [2018-03-03-17-00-02] |dest=arch/arm/include/asm/arch-stm32mp;   \
> [2018-03-03-17-00-02] | fi;   
>\
> [2018-03-03-17-00-02] | ln -fsn 
> /opt/STM/workspace/workdir/rdk/build-stm32mp1/tmp-glibc/work/stm32mp1-stm32mpvalid-linux-gnueabi/u-boot-basic-stm32mp/2018.01-git-AUTOINC+d741b91b3c.r0/git/$dest
>  include/asm/arch
> [2018-03-03-17-00-02] | fixdep: error opening config file: 
> include/asm/arch/stm32.h: No such file or directory
> 
> I don't understood why the dependency failed
> 
> Perhaps it is because in our Jenkins task the parallel compilation is 
> requested with high value... (-J 8)
> and the dependency check is done in parallel of the link creation….

For what it’s worth: I always build with -j8 on my main development system and 
have
never (my expectation would be that it should have cropped up at least a few 
times
over the years) encountered this. 

> The  dependancy are :
> ./arch/arm/lib/asm-offsets.c => Kbuild 
> 
> with:
> lib/asm-offsets.s: lib/asm-offsets.c FORCE
> 
> 
> but the link on the directory is requested only by the rules about config.h 
> not for stm32.h (or hardware.h in your case):
> ./scripts/Makefile.autoconf:115:include/config.h: scripts/Makefile.autoconf 
> create_symlink FORCE
> 
> Perhaps add  a simple rule in some makefile can solve the issue
> 
> For me
> 
>   include/asm/arch/stm32.h: create_symlink
> 
> or for you :
> 
>   include/asm/arch/hardware.h: create_symlink
> 
> 
> or it is better to add generic dependancy in ./scripts/Makefile.autoconf ?
> 
>   include/asm/arch/*.h: create_symlink
> 
> 
>> --
>> Best Regards
>> Masahiro Yamada
> 
> Regards
> 
> Patrick.

Re: [U-Boot] [PATCH 2/3] net: phy: xilinx_phy: Add suuport for livetree

2018-07-09 Thread Michal Simek
On 6.7.2018 12:10, Siva Durga Prasad Paladugu wrote:
> This patch adds support for livetree by using dev_..
> calls instead of fdtdec_.. .
> 

typo in subject.

M

> Signed-off-by: Siva Durga Prasad Paladugu 
> ---
>  drivers/net/phy/xilinx_phy.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/phy/xilinx_phy.c b/drivers/net/phy/xilinx_phy.c
> index 004cfcf..2e2a5cd 100644
> --- a/drivers/net/phy/xilinx_phy.c
> +++ b/drivers/net/phy/xilinx_phy.c
> @@ -103,8 +103,8 @@ static int xilinxphy_of_init(struct phy_device *phydev)
>   u32 phytype;
>  
>   debug("%s\n", __func__);
> - phytype = fdtdec_get_int(gd->fdt_blob, dev_of_offset(phydev->dev),
> -  "xlnx,phy-type", -1);
> + phytype = dev_read_u32_default(phydev->dev,
> +"xlnx,phy-type", -1);
>   if (phytype == XAE_PHY_TYPE_1000BASE_X)
>   phydev->flags |= XAE_PHY_TYPE_1000BASE_X;
>  
> 

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v3 2/2] net: mvgbe: convert to DM

2018-07-09 Thread Chris Packham
Add driver model support to the mvgbe driver. As a temporary measure
both DM and non-DM uses are supported. Once all the users have been
converted the non-DM support can be dropped.

Signed-off-by: Chris Packham 
---

Changes in v3:
- select PHYLIB (thanks Michael)
- parse phy info from subnode

Changes in v2:
- create __mvgbe_phy_init and mvgbe_alloc_buffers helper functions
- move device tree reads to mvgbe_ofdata_to_platdata

 drivers/net/Kconfig |   1 +
 drivers/net/mvgbe.c | 306 +---
 drivers/net/mvgbe.h |  16 +++
 3 files changed, 275 insertions(+), 48 deletions(-)

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index e88f056d8448..7256d4167666 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -181,6 +181,7 @@ config FTMAC100
 config MVGBE
bool "Marvell Orion5x/Kirkwood network interface support"
depends on KIRKWOOD || ORION5X
+   select PHYLIB if DM_ETH
help
  This driver supports the network interface units in the
  Marvell Orion5x and Kirkwood SoCs
diff --git a/drivers/net/mvgbe.c b/drivers/net/mvgbe.c
index 96ca35512f01..d9d76a8ce0cc 100644
--- a/drivers/net/mvgbe.c
+++ b/drivers/net/mvgbe.c
@@ -12,6 +12,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -127,8 +128,12 @@ static int __mvgbe_mdio_read(struct mvgbe_device *dmvgbe, 
int phy_adr,
 static int smi_reg_read(struct mii_dev *bus, int phy_adr, int devad,
int reg_ofs)
 {
+#ifdef CONFIG_DM_ETH
+   struct mvgbe_device *dmvgbe = bus->priv;
+#else
struct eth_device *dev = eth_get_dev_by_name(bus->name);
struct mvgbe_device *dmvgbe = to_mvgbe(dev);
+#endif
 
return __mvgbe_mdio_read(dmvgbe, phy_adr, devad, reg_ofs);
 }
@@ -180,8 +185,12 @@ static int __mvgbe_mdio_write(struct mvgbe_device *dmvgbe, 
int phy_adr,
 static int smi_reg_write(struct mii_dev *bus, int phy_adr, int devad,
 int reg_ofs, u16 data)
 {
+#ifdef CONFIG_DM_ETH
+   struct mvgbe_device *dmvgbe = bus->priv;
+#else
struct eth_device *dev = eth_get_dev_by_name(bus->name);
struct mvgbe_device *dmvgbe = to_mvgbe(dev);
+#endif
 
return __mvgbe_mdio_write(dmvgbe, phy_adr, devad, reg_ofs, data);
 }
@@ -415,11 +424,12 @@ static void mvgbe_init_rx_desc_ring(struct mvgbe_device 
*dmvgbe)
dmvgbe->p_rxdesc_curr = dmvgbe->p_rxdesc;
 }
 
-static int __mvgbe_init(struct mvgbe_device *dmvgbe)
+static int __mvgbe_init(struct mvgbe_device *dmvgbe, u8 *enetaddr)
 {
struct mvgbe_registers *regs = dmvgbe->regs;
 #if (defined(CONFIG_MII) || defined(CONFIG_CMD_MII)) &&  \
!defined(CONFIG_PHYLIB) &&   \
+   !defined(CONFIG_DM_ETH) &&   \
defined(CONFIG_SYS_FAULT_ECHO_LINK_DOWN)
int i;
 #endif
@@ -436,7 +446,7 @@ static int __mvgbe_init(struct mvgbe_device *dmvgbe)
 
set_dram_access(regs);
port_init_mac_tables(regs);
-   port_uc_addr_set(dmvgbe, dmvgbe->dev.enetaddr);
+   port_uc_addr_set(dmvgbe, enetaddr);
 
/* Assign port configuration and command. */
MVGBE_REG_WR(regs->pxc, PRT_CFG_VAL);
@@ -473,6 +483,7 @@ static int __mvgbe_init(struct mvgbe_device *dmvgbe)
 
 #if (defined(CONFIG_MII) || defined(CONFIG_CMD_MII)) && \
!defined(CONFIG_PHYLIB) && \
+   !defined(CONFIG_DM_ETH) && \
defined(CONFIG_SYS_FAULT_ECHO_LINK_DOWN)
/* Wait up to 5s for the link status */
for (i = 0; i < 5; i++) {
@@ -492,12 +503,14 @@ static int __mvgbe_init(struct mvgbe_device *dmvgbe)
return 0;
 }
 
+#ifndef CONFIG_DM_ETH
 static int mvgbe_init(struct eth_device *dev)
 {
struct mvgbe_device *dmvgbe = to_mvgbe(dev);
 
-   return __mvgbe_init(dmvgbe);
+   return __mvgbe_init(dmvgbe, dmvgbe->dev.enetaddr);
 }
+#endif
 
 static void __mvgbe_halt(struct mvgbe_device *dmvgbe)
 {
@@ -524,6 +537,7 @@ static void __mvgbe_halt(struct mvgbe_device *dmvgbe)
MVGBE_REG_WR(regs->peim, 0);
 }
 
+#ifndef CONFIG_DM_ETH
 static int mvgbe_halt(struct eth_device *dev)
 {
struct mvgbe_device *dmvgbe = to_mvgbe(dev);
@@ -532,7 +546,18 @@ static int mvgbe_halt(struct eth_device *dev)
 
return 0;
 }
+#endif
 
+#ifdef CONFIG_DM_ETH
+static int mvgbe_write_hwaddr(struct udevice *dev)
+{
+   struct eth_pdata *pdata = dev_get_platdata(dev);
+
+   port_uc_addr_set(dev_get_priv(dev), pdata->enetaddr);
+
+   return 0;
+}
+#else
 static int mvgbe_write_hwaddr(struct eth_device *dev)
 {
struct mvgbe_device *dmvgbe = to_mvgbe(dev);
@@ -541,6 +566,7 @@ static int mvgbe_write_hwaddr(struct eth_device *dev)
port_uc_addr_set(dmvgbe, dmvgbe->dev.enetaddr);
return 0;
 }
+#endif
 
 static int __mvgbe_send(struct mvgbe_device *dmvgbe, void *dataptr,
int datasize)
@@ -597,12 +623,14 @@ static int __mvgbe_send(struct mvgbe_device *dmvgbe, void 
*dataptr,
return 0;
 }
 
+#ifndef 

[U-Boot] [PATCH v3 1/2] net: mvgbe: prepare for conversion to driver model

2018-07-09 Thread Chris Packham
Extract some function bodies to helper functions that can be reused in
the DM/non-DM implementations.

Signed-off-by: Chris Packham 
Acked-by: Joe Hershberger 
---

Changes in v3: None
Changes in v2: None

 drivers/net/mvgbe.c | 109 
 1 file changed, 80 insertions(+), 29 deletions(-)

diff --git a/drivers/net/mvgbe.c b/drivers/net/mvgbe.c
index e6585ef8b3e7..96ca35512f01 100644
--- a/drivers/net/mvgbe.c
+++ b/drivers/net/mvgbe.c
@@ -55,20 +55,13 @@ static int smi_wait_ready(struct mvgbe_device *dmvgbe)
return 0;
 }
 
-/*
- * smi_reg_read - miiphy_read callback function.
- *
- * Returns 16bit phy register value, or -EFAULT on error
- */
-static int smi_reg_read(struct mii_dev *bus, int phy_adr, int devad,
-   int reg_ofs)
+static int __mvgbe_mdio_read(struct mvgbe_device *dmvgbe, int phy_adr,
+int devad, int reg_ofs)
 {
-   u16 data = 0;
-   struct eth_device *dev = eth_get_dev_by_name(bus->name);
-   struct mvgbe_device *dmvgbe = to_mvgbe(dev);
struct mvgbe_registers *regs = dmvgbe->regs;
u32 smi_reg;
u32 timeout;
+   u16 data = 0;
 
/* Phyadr read request */
if (phy_adr == MV_PHY_ADR_REQUEST &&
@@ -127,15 +120,22 @@ static int smi_reg_read(struct mii_dev *bus, int phy_adr, 
int devad,
 }
 
 /*
- * smi_reg_write - miiphy_write callback function.
+ * smi_reg_read - miiphy_read callback function.
  *
- * Returns 0 if write succeed, -EFAULT on error
+ * Returns 16bit phy register value, or -EFAULT on error
  */
-static int smi_reg_write(struct mii_dev *bus, int phy_adr, int devad,
-int reg_ofs, u16 data)
+static int smi_reg_read(struct mii_dev *bus, int phy_adr, int devad,
+   int reg_ofs)
 {
struct eth_device *dev = eth_get_dev_by_name(bus->name);
struct mvgbe_device *dmvgbe = to_mvgbe(dev);
+
+   return __mvgbe_mdio_read(dmvgbe, phy_adr, devad, reg_ofs);
+}
+
+static int __mvgbe_mdio_write(struct mvgbe_device *dmvgbe, int phy_adr,
+ int devad, int reg_ofs, u16 data)
+{
struct mvgbe_registers *regs = dmvgbe->regs;
u32 smi_reg;
 
@@ -171,6 +171,20 @@ static int smi_reg_write(struct mii_dev *bus, int phy_adr, 
int devad,
 
return 0;
 }
+
+/*
+ * smi_reg_write - miiphy_write callback function.
+ *
+ * Returns 0 if write succeed, -EFAULT on error
+ */
+static int smi_reg_write(struct mii_dev *bus, int phy_adr, int devad,
+int reg_ofs, u16 data)
+{
+   struct eth_device *dev = eth_get_dev_by_name(bus->name);
+   struct mvgbe_device *dmvgbe = to_mvgbe(dev);
+
+   return __mvgbe_mdio_write(dmvgbe, phy_adr, devad, reg_ofs, data);
+}
 #endif
 
 /* Stop and checks all queues */
@@ -357,8 +371,9 @@ static int port_uc_addr(struct mvgbe_registers *regs, u8 
uc_nibble,
 /*
  * port_uc_addr_set - This function Set the port Unicast address.
  */
-static void port_uc_addr_set(struct mvgbe_registers *regs, u8 * p_addr)
+static void port_uc_addr_set(struct mvgbe_device *dmvgbe, u8 *p_addr)
 {
+   struct mvgbe_registers *regs = dmvgbe->regs;
u32 mac_h;
u32 mac_l;
 
@@ -400,9 +415,8 @@ static void mvgbe_init_rx_desc_ring(struct mvgbe_device 
*dmvgbe)
dmvgbe->p_rxdesc_curr = dmvgbe->p_rxdesc;
 }
 
-static int mvgbe_init(struct eth_device *dev)
+static int __mvgbe_init(struct mvgbe_device *dmvgbe)
 {
-   struct mvgbe_device *dmvgbe = to_mvgbe(dev);
struct mvgbe_registers *regs = dmvgbe->regs;
 #if (defined(CONFIG_MII) || defined(CONFIG_CMD_MII)) &&  \
!defined(CONFIG_PHYLIB) &&   \
@@ -422,7 +436,7 @@ static int mvgbe_init(struct eth_device *dev)
 
set_dram_access(regs);
port_init_mac_tables(regs);
-   port_uc_addr_set(regs, dmvgbe->dev.enetaddr);
+   port_uc_addr_set(dmvgbe, dmvgbe->dev.enetaddr);
 
/* Assign port configuration and command. */
MVGBE_REG_WR(regs->pxc, PRT_CFG_VAL);
@@ -478,9 +492,15 @@ static int mvgbe_init(struct eth_device *dev)
return 0;
 }
 
-static int mvgbe_halt(struct eth_device *dev)
+static int mvgbe_init(struct eth_device *dev)
 {
struct mvgbe_device *dmvgbe = to_mvgbe(dev);
+
+   return __mvgbe_init(dmvgbe);
+}
+
+static void __mvgbe_halt(struct mvgbe_device *dmvgbe)
+{
struct mvgbe_registers *regs = dmvgbe->regs;
 
/* Disable all gigE address decoder */
@@ -502,6 +522,13 @@ static int mvgbe_halt(struct eth_device *dev)
MVGBE_REG_WR(regs->ice, 0);
MVGBE_REG_WR(regs->pim, 0);
MVGBE_REG_WR(regs->peim, 0);
+}
+
+static int mvgbe_halt(struct eth_device *dev)
+{
+   struct mvgbe_device *dmvgbe = to_mvgbe(dev);
+
+   __mvgbe_halt(dmvgbe);
 
return 0;
 }
@@ -509,16 +536,15 @@ static int mvgbe_halt(struct eth_device *dev)
 static int mvgbe_write_hwaddr(struct eth_device *dev)
 {
struct mvgbe_device *dmvgbe = to_mvgbe(dev

Re: [U-Boot] [PATCH] cmd: ubi: change 'default y' for SUNXI to 'imply' in Kconfig

2018-07-09 Thread Masahiro Yamada
2018-07-09 16:20 GMT+09:00 Maxime Ripard :
> On Mon, Jul 09, 2018 at 03:12:37PM +0900, Masahiro Yamada wrote:
>> It is not preferred to put SUNXI-specific code in the common place.
>
> I think Tom has been saying the exact opposite a number of times,
> since there's some circular dependencies issues that arise when using
> imply.


Platforms select/imply necessary drivers or features.
This is what we usually do.


ARCH_SUNXI already uses select / imply in arch/arm/Kconfig.
(Also ARCH_SUNXI does so in arch/arm/mach-sunxi/Kconfig in Linux Kernel)


On the other hand, no drivers or features select / imply ARCH_SUNXI.


To sum up, select or imply should be used
in the following direction.

   Platform  ---(select or imply)--->  features


If you follow this rule,
circular dependency will not happen.






> Maxime
>
>> Change it to 'imply' property of ARCH_SUNXI.
>>
>> Signed-off-by: Masahiro Yamada 
>> ---
>>
>>  arch/arm/Kconfig | 1 +
>>  cmd/Kconfig  | 1 -
>>  2 files changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
>> index 7d394f2..a6ce155 100644
>> --- a/arch/arm/Kconfig
>> +++ b/arch/arm/Kconfig
>> @@ -796,6 +796,7 @@ config ARCH_SUNXI
>>   select USB_KEYBOARD if DISTRO_DEFAULTS
>>   select USE_TINY_PRINTF
>>   imply CMD_GPT
>> + imply CMD_UBI if NAND
>>   imply DISTRO_DEFAULTS
>>   imply FAT_WRITE
>>   imply OF_LIBFDT_OVERLAY
>> diff --git a/cmd/Kconfig b/cmd/Kconfig
>> index aec2090..159ebaa 100644
>> --- a/cmd/Kconfig
>> +++ b/cmd/Kconfig
>> @@ -1792,7 +1792,6 @@ config CMD_UBI
>>   select CRC32
>>   select MTD_UBI
>>   select CMD_MTDPARTS
>> - default y if NAND_SUNXI
>>   help
>> UBI is a software layer above MTD layer which admits use of LVM-like
>> logical volumes on top of MTD devices, hides some complexities of
>> --
>> 2.7.4
>>
>
> --
> Maxime Ripard, Bootlin (formerly Free Electrons)
> Embedded Linux and Kernel engineering
> https://bootlin.com
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
>



-- 
Best Regards
Masahiro Yamada
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] tools/imximage: get HAB information from header

2018-07-09 Thread Bryan O'Donoghue



On 06/07/18 15:10, Holger Dengler wrote:

Signing parts of a u-boot imximage for image verification in High
Assurance Boot (HAB) in a post-build process, requires some
information from the imximage header. Currently, this information is
only provided during the image build, which makes the transfer of this
information to the post-build process harder than necessary.

The i.MX HAB information (start and length) can be calculated either
by using information from the image-configuration file, or from the
information in the flash header of the imximage.
The advantage of using information from flash header is, that they are
not only available during image creation, but also available if
existing images are processed.

Example:
$ tools/mkimage -l u-boot.imx
Image Type:   Freescale IMX Boot Image
Image Ver:2 (i.MX53/6/7 compatible)
Mode: DCD
Data Size:483328 Bytes = 472.00 KiB = 0.46 MiB
Load Address: 877ff420
Entry Point:  8780
HAB Blocks:   0x877ff400 0x 0x00071c00
DCD Blocks:   0x0091 0x002c 0x0208

Signed-off-by: Holger Dengler 
---

  tools/imximage.c | 13 +
  1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/tools/imximage.c b/tools/imximage.c
index 5f63bf8759..d7c0b6e883 100644
--- a/tools/imximage.c
+++ b/tools/imximage.c
@@ -506,8 +506,7 @@ static void print_hdr_v2(struct imx_header *imx_hdr)
genimg_print_size(hdr_v2->boot_data.size);
printf("Load Address: %08x\n", 
(uint32_t)fhdr_v2->boot_data_ptr);
printf("Entry Point:  %08x\n", (uint32_t)fhdr_v2->entry);
-   if (fhdr_v2->csf && (imximage_ivt_offset != UNDEFINED) &&
-   (imximage_csf_size != UNDEFINED)) {
+   if (fhdr_v2->csf) {
uint16_t dcdlen;
int offs;
  
@@ -515,10 +514,16 @@ static void print_hdr_v2(struct imx_header *imx_hdr)

offs = (char *)&hdr_v2->data.dcd_table
- (char *)hdr_v2;
  
+			/*

+* The HAB block is the first part of the image, from
+* start of IVT header (fhdr_v2->self) to the start of
+* the CSF block (fhdr_v2->csf). So HAB size is
+* calculated as:
+* HAB_size = fhdr_v2->csf - fhdr_v2->self
+*/
printf("HAB Blocks:   0x%08x 0x%08x 0x%08x\n",
   (uint32_t)fhdr_v2->self, 0,
-  hdr_v2->boot_data.size - imximage_ivt_offset -
-  imximage_csf_size);
+  (uint32_t)(fhdr_v2->csf - fhdr_v2->self));
printf("DCD Blocks:   0x0091 0x%08x 0x%08x\n",
   offs, be16_to_cpu(dcdlen));
}



Good call.

Tested-by: Bryan O'Donoghue 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/3] armv8: dts: fsl-ls1043a: add sata node support

2018-07-09 Thread peng . ma
From: Peng Ma 

Add sata node to support ls1043a.

Signed-off-by: Peng Ma 
---
 arch/arm/dts/fsl-ls1043a-qds.dtsi |4 
 arch/arm/dts/fsl-ls1043a.dtsi |8 
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/arch/arm/dts/fsl-ls1043a-qds.dtsi 
b/arch/arm/dts/fsl-ls1043a-qds.dtsi
index addb9ab..3841aee 100644
--- a/arch/arm/dts/fsl-ls1043a-qds.dtsi
+++ b/arch/arm/dts/fsl-ls1043a-qds.dtsi
@@ -174,3 +174,7 @@
 &lpuart0 {
status = "okay";
 };
+
+&sata {
+   status = "okay";
+};
diff --git a/arch/arm/dts/fsl-ls1043a.dtsi b/arch/arm/dts/fsl-ls1043a.dtsi
index a804f51..bb70992 100644
--- a/arch/arm/dts/fsl-ls1043a.dtsi
+++ b/arch/arm/dts/fsl-ls1043a.dtsi
@@ -287,5 +287,13 @@
ranges = <0x8100 0x0 0x 0x50 0x0002 0x0 
0x0001   /* downstream I/O */
  0x8200 0x0 0x4000 0x50 0x4000 0x0 
0x4000>; /* non-prefetchable memory */
};
+
+   sata: sata@320 {
+   compatible = "fsl,ls1043a-ahci";
+   reg = <0x0 0x320 0x0 0x1>;
+   interrupts = <0 69 4>;
+   clocks = <&clockgen 4 0>;
+   status = "disabled";
+   };
};
 };
-- 
1.7.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/6] drivers: rtc: resolve year 2038 problem in rtc_to_tm

2018-07-09 Thread Arnd Bergmann
On Sun, Jul 8, 2018 at 11:32 PM, Alexander Graf  wrote:
>
>
> On 07.07.18 23:39, Heinrich Schuchardt wrote:
>> Our implementation of rtc_to_tm() cannot handle dates of more than
>> 0x7fff seconds after 1970-01-01.
>>
>> Adopt the Linux kernel implementation.
>>
>> Signed-off-by: Heinrich Schuchardt 
>
> This patch is slightly out of scope for efi-next and the other patches
> are independent of it FWIW, so I'll leave it to others to review.
>
> I'll CC Arnd though, as I'm quite sure he has a good grip on anything
> 2038 :)

Ok, I'll point out some common issues with RTC devices:

>> diff --git a/drivers/rtc/i2c_rtc_emul.c b/drivers/rtc/i2c_rtc_emul.c
>> index bad61c377f..d4b33e59d6 100644
>> --- a/drivers/rtc/i2c_rtc_emul.c
>> +++ b/drivers/rtc/i2c_rtc_emul.c
>> @@ -96,7 +96,9 @@ static int sandbox_i2c_rtc_get(struct udevice *dev, struct 
>> rtc_time *time)
>>   now = plat->base_time;
>>   }
>>
>> - return rtc_to_tm(now + plat->offset, time);
>> + rtc_to_tm(now + plat->offset, time);
>> +
>> + return 0;
>>  }

Looking at the sources here:
https://github.com/u-boot/u-boot/blob/master/drivers/rtc/i2c_rtc_emul.c

I found that 'now' is sometimes an 'int' and sometimes a 'long', but
both of them
are typically signed 32-bit numbers that still overflow. To actually make this
patch have any effect, u-boot would consistently need to use 64-bit signed
numbers in all the common code as well as in drivers for devices that support
times after 2038.

In particular the rtc_mktime() should use the same types as rtc_to_tm(), since
it does the reverse operation.

>> diff --git a/include/rtc.h b/include/rtc.h
>> index 746624d799..0d964d56d5 100644
>> --- a/include/rtc.h
>> +++ b/include/rtc.h
>> @@ -208,7 +208,18 @@ void rtc_write32(int reg, u32 value);
>>   * rtc_init() - Set up the real time clock ready for use
>>   */
>>  void rtc_init(void);
>> -#endif
>> +#endif /* CONFIG_DM_RTC */
>> +
>> +/**
>> + * is_leap_year - Check if year is a leap year
>> + *
>> + * @year Year
>> + * @return   1 if leap year
>> + */
>> +static inline bool is_leap_year(unsigned int year)
>> +{
>> + return (!(year % 4) && (year % 100)) || !(year % 400);
>> +}

Note that many hardware RTC implementations get the the
leap year computation wrong: Since 2000 was a leap year but
2100 is not, a typical shortcut was to assume that every fourth
year is a leap year. In RTC devices that have a two-digit
BCD number for storing the year, this means we can use the 00-99
range either to encode years 2000 through 2099, or (using the
typical wrapping) assuming that all numbers larger 69 are 1970 through
1999, while numbers from 00 to 69 are 2000 through 2099.

The i2c test driver has an unsigned 8-bit number for the year, starting
at 1900, so it could support years up to 2155, which is also a common
value in hardware RTCs, but I would assume that many of those also
have a problem on March 1, 2100, working on the assumption that there
is a Feb 29 that year, which requires adding another day to the
calculation after that day.

  Arnd
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/4] armv8: dts: fsl-ls1046a: add sata node support

2018-07-09 Thread peng . ma
From: Peng Ma 

One ls1046a, there is one SATA 3.0 advanced host controller interface
which is a high-performance SATA solution that delivers comprehensive
and fully-compliant generation 3 (1.5 Gb/s - 6.0 Gb/s) serial ATA
capabilities, in accordance with the serial ATA revision 3.0 of Serial
ATA International Organization.
Add sata node to support this feature.

Signed-off-by: Peng Ma 
---
 arch/arm/dts/fsl-ls1046a-qds.dtsi |4 
 arch/arm/dts/fsl-ls1046a-rdb.dts  |4 
 arch/arm/dts/fsl-ls1046a.dtsi |8 
 3 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/arch/arm/dts/fsl-ls1046a-qds.dtsi 
b/arch/arm/dts/fsl-ls1046a-qds.dtsi
index ba36853..ada8a85 100644
--- a/arch/arm/dts/fsl-ls1046a-qds.dtsi
+++ b/arch/arm/dts/fsl-ls1046a-qds.dtsi
@@ -76,3 +76,7 @@
 &lpuart0 {
status = "okay";
 };
+
+&sata {
+   status = "okay";
+};
diff --git a/arch/arm/dts/fsl-ls1046a-rdb.dts b/arch/arm/dts/fsl-ls1046a-rdb.dts
index 136de24..ba30fd2 100644
--- a/arch/arm/dts/fsl-ls1046a-rdb.dts
+++ b/arch/arm/dts/fsl-ls1046a-rdb.dts
@@ -39,3 +39,7 @@
reg = <1>;
 };
 };
+
+&sata {
+   status = "okay";
+};
diff --git a/arch/arm/dts/fsl-ls1046a.dtsi b/arch/arm/dts/fsl-ls1046a.dtsi
index 7687d12..5ac10e0 100644
--- a/arch/arm/dts/fsl-ls1046a.dtsi
+++ b/arch/arm/dts/fsl-ls1046a.dtsi
@@ -291,5 +291,13 @@
ranges = <0x8100 0x0 0x 0x50 0x0002 0x0 
0x0001   /* downstream I/O */
  0x8200 0x0 0x4000 0x50 0x4000 0x0 
0x4000>; /* non-prefetchable memory */
};
+
+   sata: sata@320 {
+   compatible = "fsl,ls1046a-ahci";
+   reg = <0x0 0x320 0x0 0x1>;
+   interrupts = <0 69 4>;
+   clocks = <&clockgen 4 1>;
+   status = "disabled";
+   };
};
 };
-- 
1.7.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] u-boot serial uart command?

2018-07-09 Thread Dell Green
Hi Guys,

Brand new to this mailing list.

I have a Dart-MX6 imx6 Module that has a number of uarts. I have one of
the uarts connected to an external micro controller that excepts
commands via a basic binary messaging protocol. In linux I can
communicate with it using standard linux /dev/ttymxcN device.

In an effort to learn more about u-boot and how it works, I was
wondering if it was possible in u-boot shell to communicate with the
same uart device using the same messaging protocol. I see from the
source code there is code for serial.c and serial_mxc.c, but I'm not an
experienced u-boot developer to know if this is possible and how one
would approach it.

any help/pointers would be greatly appreciated.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 2/3] scsi: ceva: add ls1043a soc support

2018-07-09 Thread peng . ma
From: Peng Ma 

Add ahci compatible support for ls1043a soc.

Signed-off-by: Peng Ma 
---
depend on:
patchwork.ozlabs.org/patch/924896/

 drivers/ata/sata_ceva.c |   16 +---
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/ata/sata_ceva.c b/drivers/ata/sata_ceva.c
index 4c9ebe4..39269fe 100644
--- a/drivers/ata/sata_ceva.c
+++ b/drivers/ata/sata_ceva.c
@@ -7,7 +7,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 
@@ -90,6 +89,7 @@
 enum ceva_soc {
CEVA_1V84,
CEVA_LS1012A,
+   CEVA_LS1043A,
 };
 
 struct ceva_sata_priv {
@@ -98,6 +98,13 @@ struct ceva_sata_priv {
ulong flag;
 };
 
+static const struct udevice_id sata_ceva_ids[] = {
+   { .compatible = "ceva,ahci-1v84", .data = CEVA_1V84 },
+   { .compatible = "fsl,ls1012a-ahci", .data = CEVA_LS1012A },
+   { .compatible = "fsl,ls1043a-ahci", .data = CEVA_LS1043A },
+   { }
+};
+
 static int ceva_init_sata(struct ceva_sata_priv *priv)
 {
ulong base = priv->base;
@@ -116,6 +123,7 @@ static int ceva_init_sata(struct ceva_sata_priv *priv)
break;
 
case CEVA_LS1012A:
+   case CEVA_LS1043A:
writel(ECC_DIS_ADDR_CH2, ECC_DIS_VAL_CH2);
writel(CEVA_PHY1_CFG, base + AHCI_VEND_PPCFG);
writel(CEVA_TRANS_CFG, base + AHCI_VEND_PTC);
@@ -143,12 +151,6 @@ static int sata_ceva_probe(struct udevice *dev)
return ahci_probe_scsi(dev, priv->base);
 }
 
-static const struct udevice_id sata_ceva_ids[] = {
-   { .compatible = "ceva,ahci-1v84", .data = CEVA_1V84 },
-   { .compatible = "fsl,ls1012a-ahci", .data = CEVA_LS1012A },
-   { }
-};
-
 static int sata_ceva_ofdata_to_platdata(struct udevice *dev)
 {
struct ceva_sata_priv *priv = dev_get_priv(dev);
-- 
1.7.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 3/7] misc: fsl_portals: setup QMAN_BAR{E} also on ARM platforms

2018-07-09 Thread Bharat Bhushan


> -Original Message-
> From: Laurentiu Tudor [mailto:laurentiu.tu...@nxp.com]
> Sent: Wednesday, July 4, 2018 7:44 PM
> To: York Sun ; Prabhakar Kushwaha
> ; u-boot@lists.denx.de
> Cc: Bharat Bhushan ; Laurentiu Tudor
> 
> Subject: [PATCH v3 3/7] misc: fsl_portals: setup QMAN_BAR{E} also on ARM
> platforms
> 
> QMAN_BAR{E} register setup was disabled on ARM platforms, however the
> register does need to be set. Enable the code also on ARMs and fix the
> CONFIG_SYS_QMAN_MEM_PHYS define to the correct value so that the
> newly
> enabled code works.
> 
> Signed-off-by: Laurentiu Tudor 
> ---
>  arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h | 3 +--
>  drivers/misc/fsl_portals.c | 2 --
>  2 files changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h
> b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h
> index 644a16dd30..d22ec70aa5 100644
> --- a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h
> +++ b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h
> @@ -57,8 +57,7 @@
>  #define CONFIG_SYS_BMAN_SWP_ISDR_REG0x3E80
>  #define CONFIG_SYS_QMAN_NUM_PORTALS  10
>  #define CONFIG_SYS_QMAN_MEM_BASE 0x5
> -#define CONFIG_SYS_QMAN_MEM_PHYS (0xfull + \
> -
>   CONFIG_SYS_QMAN_MEM_BASE)
> +#define CONFIG_SYS_QMAN_MEM_PHYS
>   CONFIG_SYS_QMAN_MEM_BASE

Are you sure that these changes works for PowerPC ?

Thanks
-Bharat

>  #define CONFIG_SYS_QMAN_MEM_SIZE 0x0800
>  #define CONFIG_SYS_QMAN_SP_CENA_SIZE0x1
>  #define CONFIG_SYS_QMAN_SP_CINH_SIZE0x1
> diff --git a/drivers/misc/fsl_portals.c b/drivers/misc/fsl_portals.c
> index 7c22b8d209..22faf16751 100644
> --- a/drivers/misc/fsl_portals.c
> +++ b/drivers/misc/fsl_portals.c
> @@ -24,7 +24,6 @@ void setup_qbman_portals(void)
>   CONFIG_SYS_BMAN_SWP_ISDR_REG;
>   void __iomem *qpaddr = (void *)CONFIG_SYS_QMAN_CINH_BASE +
>   CONFIG_SYS_QMAN_SWP_ISDR_REG;
> -#ifdef CONFIG_PPC
>   struct ccsr_qman *qman = (void *)CONFIG_SYS_FSL_QMAN_ADDR;
> 
>   /* Set the Qman initiator BAR to match the LAW (for DQRR stashing)
> */
> @@ -32,7 +31,6 @@ void setup_qbman_portals(void)
>   out_be32(&qman->qcsp_bare,
> (u32)(CONFIG_SYS_QMAN_MEM_PHYS >> 32));
>  #endif
>   out_be32(&qman->qcsp_bar,
> (u32)CONFIG_SYS_QMAN_MEM_PHYS);
> -#endif
>  #ifdef CONFIG_FSL_CORENET
>   int i;
> 
> --
> 2.17.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 5/7] armv8: ls1046a: initial icid setup support

2018-07-09 Thread Bharat Bhushan


> -Original Message-
> From: Laurentiu Tudor [mailto:laurentiu.tu...@nxp.com]
> Sent: Wednesday, July 4, 2018 7:44 PM
> To: York Sun ; Prabhakar Kushwaha
> ; u-boot@lists.denx.de
> Cc: Bharat Bhushan ; Laurentiu Tudor
> 
> Subject: [PATCH v3 5/7] armv8: ls1046a: initial icid setup support
> 
> Add infrastructure for ICID setup and device tree fixup on ARM platforms.
> This include basic ICID setup for several devices.
> 
> Signed-off-by: Laurentiu Tudor 
> ---
>  arch/arm/cpu/armv8/fsl-layerscape/Makefile|   1 +
>  arch/arm/cpu/armv8/fsl-layerscape/icid.c  | 111 ++
>  .../arm/cpu/armv8/fsl-layerscape/ls1046_ids.c |  29 +
>  arch/arm/cpu/armv8/fsl-layerscape/soc.c   |   3 +
>  .../asm/arch-fsl-layerscape/fsl_icid.h|  80 +
>  board/freescale/ls1046aqds/ls1046aqds.c   |   2 +
>  board/freescale/ls1046ardb/ls1046ardb.c   |   3 +
>  7 files changed, 229 insertions(+)
>  create mode 100644 arch/arm/cpu/armv8/fsl-layerscape/icid.c
>  create mode 100644 arch/arm/cpu/armv8/fsl-layerscape/ls1046_ids.c
>  create mode 100644 arch/arm/include/asm/arch-fsl-layerscape/fsl_icid.h
> 
> diff --git a/arch/arm/cpu/armv8/fsl-layerscape/Makefile
> b/arch/arm/cpu/armv8/fsl-layerscape/Makefile
> index 1e9e4680fe..5d6f68aad6 100644
> --- a/arch/arm/cpu/armv8/fsl-layerscape/Makefile
> +++ b/arch/arm/cpu/armv8/fsl-layerscape/Makefile
> @@ -37,6 +37,7 @@ endif
> 
>  ifneq ($(CONFIG_ARCH_LS1046A),)
>  obj-$(CONFIG_SYS_HAS_SERDES) += ls1046a_serdes.o
> +obj-y += icid.o ls1046_ids.o
>  endif
> 
>  ifneq ($(CONFIG_ARCH_LS1088A),)
> diff --git a/arch/arm/cpu/armv8/fsl-layerscape/icid.c
> b/arch/arm/cpu/armv8/fsl-layerscape/icid.c
> new file mode 100644
> index 00..8694bd6fa1
> --- /dev/null
> +++ b/arch/arm/cpu/armv8/fsl-layerscape/icid.c
> @@ -0,0 +1,111 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright 2018 NXP
> + */
> +
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +
> +static void set_icid(struct icid_id_table *tbl, int size) {
> + int i;
> +
> + for (i = 0; i < size; i++)
> + out_be32((u32 *)(tbl[i].reg_addr), tbl[i].reg); }
> +
> +void set_icids(void)
> +{
> + /* setup general icid offsets */
> + set_icid(icid_tbl, icid_tbl_sz);
> +}
> +
> +int fdt_set_iommu_prop(void *blob, int off, int smmu_ph, u32 *ids, int
> +num_ids) {
> + int i, ret;
> + u32 prop[8];
> +
> + for (i = 0; i < num_ids; i++) {
> + prop[i * 2] = cpu_to_fdt32(smmu_ph);
> + prop[i * 2 + 1] = cpu_to_fdt32(ids[i]);
> + }
> + ret = fdt_setprop(blob, off, "iommus",
> +   prop, sizeof(u32) * num_ids * 2);
> + if (ret > 0) {
> + printf("WARNING unable to set iommus: %s\n",
> fdt_strerror(off));
> + return off;
> + }
> + ret = fdt_setprop_empty(blob, off, "dma-coherent");

This forces "dma-coherent" for all SOCs, although there is no current known 
SOCs which does not support non-coherent but maybe safe not to set from common 
code.

> + if (ret > 0) {
> + printf("WARNING unable to set dma-coherent: %s\n",
> +fdt_strerror(off));
> + return off;
> + }
> +
> + return 0;
> +}
> +
> +int fdt_fixup_icid_tbl(void *blob, int smmu_ph,
> +struct icid_id_table *tbl, int size) {
> + int i, err, off;
> +
> + for (i = 0; i < size; i++) {
> + if (!tbl[i].compat)
> + continue;
> +
> + off = fdt_node_offset_by_compat_reg(blob,
> + tbl[i].compat,
> + tbl[i].compat_addr);
> + if (off > 0) {
> + err = fdt_set_iommu_prop(blob, off, smmu_ph,
> +  &tbl[i].id, 1);
> + if (err)
> + return err;
> + } else {
> + printf("WARNING could not find node %s: %s.\n",
> +tbl[i].compat, fdt_strerror(off));
> + }
> + }
> +
> + return 0;
> +}
> +
> +int fdt_get_smmu_phandle(void *blob)
> +{
> + int noff, smmu_ph;
> +
> + noff = fdt_node_offset_by_compatible(blob, -1, "arm,mmu-500");
> + if (noff < 0) {
> + printf("WARNING failed to get smmu node: %s\n",
> +fdt_strerror(noff));
> + return noff;
> + }
> +
> + smmu_ph = fdt_get_phandle(blob, noff);
> + if (!smmu_ph) {
> + smmu_ph = fdt_create_phandle(blob, noff);
> + if (!smmu_ph) {
> + printf("WARNING failed to get smmu phandle\n");
> + return -1;
> + }
> + }
> +
> + return smmu_ph;
> +}
> +
> +void fdt_fixup_icid(void *blob)
> +{
> + int smmu_ph;
> +
> + smmu_ph = fdt_get_smmu_phandle(blob);
> + if (smmu_ph < 0)
> +   

[U-Boot] [PATCH 1/1] avb2.0: add get_size_of_partition()

2018-07-09 Thread Igor Opaniuk
Implement get_size_of_partition() operation,
which is required by the latest upstream libavb [1].

[1] https://android.googlesource.com/platform/external/avb/+/master/README.md

Signed-off-by: Igor Opaniuk 
---
 common/avb_verify.c | 33 -
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/common/avb_verify.c b/common/avb_verify.c
index f9a00f8..5eabab0 100644
--- a/common/avb_verify.c
+++ b/common/avb_verify.c
@@ -699,6 +699,37 @@ static AvbIOResult get_unique_guid_for_partition(AvbOps 
*ops,
 }
 
 /**
+ * get_size_of_partition() - gets the size of a partition identified
+ * by a string name
+ *
+ * @ops: contains AVB ops handlers
+ * @partition: partition name (NUL-terminated UTF-8 string)
+ * @out_size_num_bytes: returns the value of a partition size
+ *
+ * @return:
+ *  AVB_IO_RESULT_OK, on success (GUID found)
+ *  AVB_IO_RESULT_ERROR_IO, out_size_num_bytes is NULL
+ *  AVB_IO_RESULT_ERROR_NO_SUCH_PARTITION, if partition was not found
+ */
+static AvbIOResult get_size_of_partition(AvbOps *ops,
+const char *partition,
+u64 *out_size_num_bytes)
+{
+   struct mmc_part *part;
+
+   if (!out_size_num_bytes)
+   return AVB_IO_RESULT_ERROR_IO;
+
+   part = get_partition(ops, partition);
+   if (!part)
+   return AVB_IO_RESULT_ERROR_NO_SUCH_PARTITION;
+
+   *out_size_num_bytes = part->info.blksz * part->info.size;
+
+   return AVB_IO_RESULT_OK;
+}
+
+/**
  * 
  * AVB2.0 AvbOps alloc/initialisation/free
  * 
@@ -721,7 +752,7 @@ AvbOps *avb_ops_alloc(int boot_device)
ops_data->ops.read_is_device_unlocked = read_is_device_unlocked;
ops_data->ops.get_unique_guid_for_partition =
get_unique_guid_for_partition;
-
+   ops_data->ops.get_size_of_partition = get_size_of_partition;
ops_data->mmc_dev = boot_device;
 
return &ops_data->ops;
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 6/7] armv8: ls1046a: add icid setup for qman portals

2018-07-09 Thread Bharat Bhushan


> -Original Message-
> From: Laurentiu Tudor [mailto:laurentiu.tu...@nxp.com]
> Sent: Wednesday, July 4, 2018 7:44 PM
> To: York Sun ; Prabhakar Kushwaha
> ; u-boot@lists.denx.de
> Cc: Bharat Bhushan ; Laurentiu Tudor
> 
> Subject: [PATCH v3 6/7] armv8: ls1046a: add icid setup for qman portals
> 
> Add support for ICID setting of qman portals and
> the required device tree fixups.
> Also fix an endiness issue in portal setup code.
> 
> Signed-off-by: Laurentiu Tudor 
> ---
>  .../arm/cpu/armv8/fsl-layerscape/ls1046_ids.c | 16 +++
>  .../asm/arch-fsl-layerscape/fsl_portals.h | 23 ++
>  drivers/misc/fsl_portals.c| 43 +++
>  3 files changed, 74 insertions(+), 8 deletions(-)
>  create mode 100644 arch/arm/include/asm/arch-fsl-layerscape/fsl_portals.h
> 
> diff --git a/arch/arm/cpu/armv8/fsl-layerscape/ls1046_ids.c
> b/arch/arm/cpu/armv8/fsl-layerscape/ls1046_ids.c
> index 1c528ab751..80e1ceadc0 100644
> --- a/arch/arm/cpu/armv8/fsl-layerscape/ls1046_ids.c
> +++ b/arch/arm/cpu/armv8/fsl-layerscape/ls1046_ids.c
> @@ -6,6 +6,22 @@
>  #include 
>  #include 
>  #include 
> +#include 
> +
> +#ifdef CONFIG_SYS_DPAA_QBMAN
> +struct qportal_info qp_info[CONFIG_SYS_QMAN_NUM_PORTALS] = {
> + SET_QP_INFO(FSL_DPAA1_STREAM_ID_END, 0),
> + SET_QP_INFO(FSL_DPAA1_STREAM_ID_END, 0),
> + SET_QP_INFO(FSL_DPAA1_STREAM_ID_END, 0),
> + SET_QP_INFO(FSL_DPAA1_STREAM_ID_END, 0),
> + SET_QP_INFO(FSL_DPAA1_STREAM_ID_END, 0),
> + SET_QP_INFO(FSL_DPAA1_STREAM_ID_END, 0),
> + SET_QP_INFO(FSL_DPAA1_STREAM_ID_END, 0),
> + SET_QP_INFO(FSL_DPAA1_STREAM_ID_END, 0),
> + SET_QP_INFO(FSL_DPAA1_STREAM_ID_END, 0),
> + SET_QP_INFO(FSL_DPAA1_STREAM_ID_END, 0),

FSL_DPAA1_STREAM_ID_END is "Stream-ID" while SET_QP_INFO is defined as

 #define SET_QP_INFO(_icid, dest) \
{ .dicid = _icid, .ficid = _icid, .icid = _icid, .sdest = dest }
 
It expects "icid"

Can we use consistent names, either "streamed" or "icid" at both places. 
In fact this structure is used to finally program the h/w, so we should use 
same name as in h/w to avoid any confusion.

Thanks
-Bharat

> +};
> +#endif
> 
>  struct icid_id_table icid_tbl[] = {
>  #ifdef CONFIG_SYS_DPAA_QBMAN
> diff --git a/arch/arm/include/asm/arch-fsl-layerscape/fsl_portals.h
> b/arch/arm/include/asm/arch-fsl-layerscape/fsl_portals.h
> new file mode 100644
> index 00..bd8d3fb49a
> --- /dev/null
> +++ b/arch/arm/include/asm/arch-fsl-layerscape/fsl_portals.h
> @@ -0,0 +1,23 @@
> +/* SPDX-License-Identifier: GPL-2.0+ */
> +/*
> + * Copyright 2018 NXP
> + */
> +
> +#ifndef _FSL_PORTALS_H_
> +#define _FSL_PORTALS_H_
> +
> +struct qportal_info {
> + u16 dicid;  /* DQRR ICID */
> + u16 ficid;  /* frame data ICID */
> + u16 icid;
> + u8  sdest;
> +};
> +
> +#define SET_QP_INFO(_icid, dest) \
> + { .dicid = _icid, .ficid = _icid, .icid = _icid, .sdest = dest }
> +
> +extern struct qportal_info qp_info[];
> +void fdt_portal(void *blob, const char *compat, const char *container,
> + u64 addr, u32 size);
> +
> +#endif
> diff --git a/drivers/misc/fsl_portals.c b/drivers/misc/fsl_portals.c
> index 22faf16751..a524510707 100644
> --- a/drivers/misc/fsl_portals.c
> +++ b/drivers/misc/fsl_portals.c
> @@ -13,6 +13,9 @@
>  #ifdef CONFIG_PPC
>  #include 
>  #include 
> +#else
> +#include 
> +#include 
>  #endif
>  #include 
> 
> @@ -45,6 +48,22 @@ void setup_qbman_portals(void)
>   /* set frame liodn */
>   out_be32(&qman->qcsp[i].qcsp_io_cfg, (sdest << 16) |
> fliodn);
>   }
> +#else
> +#ifdef CONFIG_ARM
> + int i;
> +
> + for (i = 0; i < CONFIG_SYS_QMAN_NUM_PORTALS; i++) {
> + u8 sdest = qp_info[i].sdest;
> + u16 ficid = qp_info[i].ficid;
> + u16 dicid = qp_info[i].dicid;
> + u16 icid = qp_info[i].icid;
> +
> + out_be32(&qman->qcsp[i].qcsp_lio_cfg, (icid << 16) |
> + dicid);
> + /* set frame icid */
> + out_be32(&qman->qcsp[i].qcsp_io_cfg, (sdest << 16) | ficid);
> + }
> +#endif
>  #endif
> 
>   /* Change default state of BMan ISDR portals to all 1s */
> @@ -178,6 +197,10 @@ void fdt_fixup_qportals(void *blob)
>   char compat[64];
>   int compat_len;
> 
> +#ifndef CONFIG_PPC
> + int smmu_ph = fdt_get_smmu_phandle(blob);
> +#endif
> +
>   maj = (rev_1 >> 8) & 0xff;
>   min = rev_1 & 0xff;
>   ip_cfg = rev_2 & 0xff;
> @@ -188,7 +211,6 @@ void fdt_fixup_qportals(void *blob)
> 
>   off = fdt_node_offset_by_compatible(blob, -1, "fsl,qman-portal");
>   while (off != -FDT_ERR_NOTFOUND) {
> -#ifdef CONFIG_PPC
>  #ifdef CONFIG_FSL_CORENET
>   u32 liodns[2];
>  #endif
> @@ -198,12 +220,7 @@ void fdt_fixup_qportals(void *blob)
>   if (!ci)
>   goto err;
> 
> - i = *ci;
> -#ifdef CONFIG_SYS_DPAA_FMAN
> - int j;
> -#endi

Re: [U-Boot] [PATCH v3 7/7] armv8: ls1046a: setup fman ports ICIDs and device tree

2018-07-09 Thread Bharat Bhushan


> -Original Message-
> From: Laurentiu Tudor [mailto:laurentiu.tu...@nxp.com]
> Sent: Wednesday, July 4, 2018 7:44 PM
> To: York Sun ; Prabhakar Kushwaha
> ; u-boot@lists.denx.de
> Cc: Bharat Bhushan ; Laurentiu Tudor
> 
> Subject: [PATCH v3 7/7] armv8: ls1046a: setup fman ports ICIDs and device
> tree
> 
> Add support for ICID setting of fman ports and
> the required device tree fixups.
> 
> Signed-off-by: Laurentiu Tudor 
> ---
>  arch/arm/cpu/armv8/fsl-layerscape/icid.c  | 82 +++
>  .../arm/cpu/armv8/fsl-layerscape/ls1046_ids.c | 30 +++
>  .../asm/arch-fsl-layerscape/fsl_icid.h| 10 +++
>  3 files changed, 122 insertions(+)
> 
> diff --git a/arch/arm/cpu/armv8/fsl-layerscape/icid.c
> b/arch/arm/cpu/armv8/fsl-layerscape/icid.c
> index 8694bd6fa1..9502f83ac8 100644
> --- a/arch/arm/cpu/armv8/fsl-layerscape/icid.c
> +++ b/arch/arm/cpu/armv8/fsl-layerscape/icid.c
> @@ -10,6 +10,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
> 
>  static void set_icid(struct icid_id_table *tbl, int size)
>  {
> @@ -19,10 +20,27 @@ static void set_icid(struct icid_id_table *tbl, int size)
>   out_be32((u32 *)(tbl[i].reg_addr), tbl[i].reg);
>  }
> 
> +#ifdef CONFIG_SYS_FMAN_V3
> +void set_fman_icids(struct fman_icid_id_table *tbl, int size)
> +{
> + int i;
> + ccsr_fman_t *fm = (void *)CONFIG_SYS_FSL_FM1_ADDR;
> +
> + for (i = 0; i < size; i++) {
> + out_be32(&fm->fm_bmi_common.fmbm_ppid[tbl[i].port_id
> - 1],
> +  tbl[i].icid);
> + }
> +}
> +#endif
> +
>  void set_icids(void)
>  {
>   /* setup general icid offsets */
>   set_icid(icid_tbl, icid_tbl_sz);
> +
> +#ifdef CONFIG_SYS_FMAN_V3
> + set_fman_icids(fman_icid_tbl, fman_icid_tbl_sz);
> +#endif
>  }
> 
>  int fdt_set_iommu_prop(void *blob, int off, int smmu_ph, u32 *ids, int
> num_ids)
> @@ -76,6 +94,66 @@ int fdt_fixup_icid_tbl(void *blob, int smmu_ph,
>   return 0;
>  }
> 
> +#ifdef CONFIG_SYS_FMAN_V3
> +int get_fman_port_icid(int port_id, struct fman_icid_id_table *tbl,
> +const int size)
> +{
> + int i;
> +
> + for (i = 0; i < size; i++) {
> + if (tbl[i].port_id == port_id)
> + return tbl[i].icid;
> + }
> +
> + return -1;
> +}
> +
> +void fdt_fixup_fman_port_icid_by_compat(void *blob, int smmu_ph,
> + const char *compat)
> +{
> + int noff, len, icid;
> + const u32 *prop;
> +
> + noff = fdt_node_offset_by_compatible(blob, -1, compat);
> + while (noff > 0) {
> + prop = fdt_getprop(blob, noff, "cell-index", &len);
> + if (!prop) {
> + printf("WARNING missing cell-index for fman
> port\n");
> + continue;
> + }
> + if (len != 4) {
> + printf("WARNING bad cell-index size for fman
> port\n");
> + continue;
> + }
> +
> + icid = get_fman_port_icid(fdt32_to_cpu(*prop),
> +   fman_icid_tbl, fman_icid_tbl_sz);
> + if (icid < 0) {
> + printf("WARNING unknown ICID for fman port
> %d\n",
> +*prop);
> + continue;
> + }
> +
> + fdt_set_iommu_prop(blob, noff, smmu_ph, (u32 *)&icid, 1);
> +
> + noff = fdt_node_offset_by_compatible(blob, noff, compat);
> + }
> +}
> +
> +void fdt_fixup_fman_icids(void *blob, int smmu_ph)
> +{
> + static const char * const compats[] = {
> + "fsl,fman-v3-port-oh",
> + "fsl,fman-v3-port-rx",
> + "fsl,fman-v3-port-tx",
> + };
> + int i;
> +
> + for (i = 0; i < ARRAY_SIZE(compats); i++)
> + fdt_fixup_fman_port_icid_by_compat(blob, smmu_ph,
> compats[i]);
> +}
> +#endif
> +
>  int fdt_get_smmu_phandle(void *blob)
>  {
>   int noff, smmu_ph;
> @@ -108,4 +186,8 @@ void fdt_fixup_icid(void *blob)
>   return;
> 
>   fdt_fixup_icid_tbl(blob, smmu_ph, icid_tbl, icid_tbl_sz);
> +
> +#ifdef CONFIG_SYS_FMAN_V3
> + fdt_fixup_fman_icids(blob, smmu_ph);
> +#endif
>  }
> diff --git a/arch/arm/cpu/armv8/fsl-layerscape/ls1046_ids.c
> b/arch/arm/cpu/armv8/fsl-layerscape/ls1046_ids.c
> index 80e1ceadc0..30c7d8d28a 100644
> --- a/arch/arm/cpu/armv8/fsl-layerscape/ls1046_ids.c
> +++ b/arch/arm/cpu/armv8/fsl-layerscape/ls1046_ids.c
> @@ -43,3 +43,33 @@ struct icid_id_table icid_tbl[] = {
>  };
> 
>  int icid_tbl_sz = ARRAY_SIZE(icid_tbl);
> +
> +#ifdef CONFIG_SYS_DPAA_FMAN
> +struct fman_icid_id_table fman_icid_tbl[] = {
> + /* port id, icid */
> + SET_FMAN_ICID_ENTRY(0x02, FSL_DPAA1_STREAM_ID_END),
> + SET_FMAN_ICID_ENTRY(0x03, FSL_DPAA1_STREAM_ID_END),
> + SET_FMAN_ICID_ENTRY(0x04, FSL_DPAA1_STREAM_ID_END),
> + SET_FMAN_ICID_ENTRY(0x05, FSL_DPAA1_STREAM_ID_END),
> + SET_FMAN_ICID_ENTRY(0x06, FSL_DPAA1_STREAM_ID_END),
> + 

Re: [U-Boot] [PATCH v3 3/7] misc: fsl_portals: setup QMAN_BAR{E} also on ARM platforms

2018-07-09 Thread Laurentiu Tudor
Hi Bharat,

On 09.07.2018 15:06, Bharat Bhushan wrote:
> 
> 
>> -Original Message-
>> From: Laurentiu Tudor [mailto:laurentiu.tu...@nxp.com]
>> Sent: Wednesday, July 4, 2018 7:44 PM
>> To: York Sun ; Prabhakar Kushwaha
>> ; u-boot@lists.denx.de
>> Cc: Bharat Bhushan ; Laurentiu Tudor
>> 
>> Subject: [PATCH v3 3/7] misc: fsl_portals: setup QMAN_BAR{E} also on ARM
>> platforms
>>
>> QMAN_BAR{E} register setup was disabled on ARM platforms, however the
>> register does need to be set. Enable the code also on ARMs and fix the
>> CONFIG_SYS_QMAN_MEM_PHYS define to the correct value so that the
>> newly
>> enabled code works.
>>
>> Signed-off-by: Laurentiu Tudor 
>> ---
>>   arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h | 3 +--
>>   drivers/misc/fsl_portals.c | 2 --
>>   2 files changed, 1 insertion(+), 4 deletions(-)
>>
>> diff --git a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h
>> b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h
>> index 644a16dd30..d22ec70aa5 100644
>> --- a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h
>> +++ b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h
>> @@ -57,8 +57,7 @@
>>   #define CONFIG_SYS_BMAN_SWP_ISDR_REG0x3E80
>>   #define CONFIG_SYS_QMAN_NUM_PORTALS10
>>   #define CONFIG_SYS_QMAN_MEM_BASE   0x5
>> -#define CONFIG_SYS_QMAN_MEM_PHYS(0xfull + \
>> -
>>  CONFIG_SYS_QMAN_MEM_BASE)
>> +#define CONFIG_SYS_QMAN_MEM_PHYS
>>  CONFIG_SYS_QMAN_MEM_BASE
> 
> Are you sure that these changes works for PowerPC ?
> 

Can't imagine how it could happen. immap_lsch2.h is a ls104xa specific file.

---
Thanks & Best Regards, Laurentiu
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 3/7] misc: fsl_portals: setup QMAN_BAR{E} also on ARM platforms

2018-07-09 Thread Bharat Bhushan


> -Original Message-
> From: Laurentiu Tudor
> Sent: Monday, July 9, 2018 6:10 PM
> To: Bharat Bhushan ; York Sun
> ; Prabhakar Kushwaha
> ; u-boot@lists.denx.de
> Subject: Re: [PATCH v3 3/7] misc: fsl_portals: setup QMAN_BAR{E} also on
> ARM platforms
> 
> Hi Bharat,
> 
> On 09.07.2018 15:06, Bharat Bhushan wrote:
> >
> >
> >> -Original Message-
> >> From: Laurentiu Tudor [mailto:laurentiu.tu...@nxp.com]
> >> Sent: Wednesday, July 4, 2018 7:44 PM
> >> To: York Sun ; Prabhakar Kushwaha
> >> ; u-boot@lists.denx.de
> >> Cc: Bharat Bhushan ; Laurentiu Tudor
> >> 
> >> Subject: [PATCH v3 3/7] misc: fsl_portals: setup QMAN_BAR{E} also on
> >> ARM platforms
> >>
> >> QMAN_BAR{E} register setup was disabled on ARM platforms, however
> the
> >> register does need to be set. Enable the code also on ARMs and fix
> >> the CONFIG_SYS_QMAN_MEM_PHYS define to the correct value so that
> the
> >> newly enabled code works.
> >>
> >> Signed-off-by: Laurentiu Tudor 
> >> ---
> >>   arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h | 3 +--
> >>   drivers/misc/fsl_portals.c | 2 --
> >>   2 files changed, 1 insertion(+), 4 deletions(-)
> >>
> >> diff --git a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h
> >> b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h
> >> index 644a16dd30..d22ec70aa5 100644
> >> --- a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h
> >> +++ b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h
> >> @@ -57,8 +57,7 @@
> >>   #define CONFIG_SYS_BMAN_SWP_ISDR_REG0x3E80
> >>   #define CONFIG_SYS_QMAN_NUM_PORTALS  10
> >>   #define CONFIG_SYS_QMAN_MEM_BASE 0x5
> >> -#define CONFIG_SYS_QMAN_MEM_PHYS  (0xfull + \
> >> -
> >>CONFIG_SYS_QMAN_MEM_BASE)
> >> +#define CONFIG_SYS_QMAN_MEM_PHYS
> >>CONFIG_SYS_QMAN_MEM_BASE
> >
> > Are you sure that these changes works for PowerPC ?
> >
> 
> Can't imagine how it could happen. immap_lsch2.h is a ls104xa specific file.

Ahh yes, just missed 😊

Thanks
-Bharat


> 
> ---
> Thanks & Best Regards, Laurentiu
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] sysreset: syscon: update regmap access to syscon

2018-07-09 Thread Patrick Delaunay
Use new API syscon_node_to_regmap in sysreset_syscon driver
for compatible "syscon-reboot"; that's avoid the need of explicit
syscon binding for "regmap" handle.

Signed-off-by: Patrick Delaunay 
---

 drivers/sysreset/sysreset_syscon.c | 16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/sysreset/sysreset_syscon.c 
b/drivers/sysreset/sysreset_syscon.c
index f19e80e..3450640 100644
--- a/drivers/sysreset/sysreset_syscon.c
+++ b/drivers/sysreset/sysreset_syscon.c
@@ -35,18 +35,20 @@ static struct sysreset_ops syscon_reboot_ops = {
 
 int syscon_reboot_probe(struct udevice *dev)
 {
-   struct udevice *syscon;
struct syscon_reboot_priv *priv = dev_get_priv(dev);
int err;
+   u32 phandle;
+   ofnode node;
 
-   err = uclass_get_device_by_phandle(UCLASS_SYSCON, dev,
-  "regmap", &syscon);
-   if (err) {
-   pr_err("unable to find syscon device\n");
+   err = ofnode_read_u32(dev_ofnode(dev), "regmap", &phandle);
+   if (err)
return err;
-   }
 
-   priv->regmap = syscon_get_regmap(syscon);
+   node = ofnode_get_by_phandle(phandle);
+   if (!ofnode_valid(node))
+   return -EINVAL;
+
+   priv->regmap = syscon_node_to_regmap(node);
if (!priv->regmap) {
pr_err("unable to find regmap\n");
return -ENODEV;
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] cmd: ubi: change 'default y' for SUNXI to 'imply' in Kconfig

2018-07-09 Thread Tom Rini
On Mon, Jul 09, 2018 at 08:14:28PM +0900, Masahiro Yamada wrote:
> 2018-07-09 16:20 GMT+09:00 Maxime Ripard :
> > On Mon, Jul 09, 2018 at 03:12:37PM +0900, Masahiro Yamada wrote:
> >> It is not preferred to put SUNXI-specific code in the common place.
> >
> > I think Tom has been saying the exact opposite a number of times,
> > since there's some circular dependencies issues that arise when using
> > imply.
> 
> 
> Platforms select/imply necessary drivers or features.
> This is what we usually do.
> 
> 
> ARCH_SUNXI already uses select / imply in arch/arm/Kconfig.
> (Also ARCH_SUNXI does so in arch/arm/mach-sunxi/Kconfig in Linux Kernel)
> 
> 
> On the other hand, no drivers or features select / imply ARCH_SUNXI.
> 
> 
> To sum up, select or imply should be used
> in the following direction.
> 
>Platform  ---(select or imply)--->  features
> 
> 
> If you follow this rule,
> circular dependency will not happen.

I think what ends up being confusing about this is that we must do:
default 0xDEADBEEF if ARCH_FOO

as we cannot:
imply FOO_OPTION 0xDEADBEEF if FOO_DRIVER

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 5/7] armv8: ls1046a: initial icid setup support

2018-07-09 Thread Laurentiu Tudor
Hi Bharat,

On 09.07.2018 15:13, Bharat Bhushan wrote:
> 
> 
>> -Original Message-
>> From: Laurentiu Tudor [mailto:laurentiu.tu...@nxp.com]
>> Sent: Wednesday, July 4, 2018 7:44 PM
>> To: York Sun ; Prabhakar Kushwaha
>> ; u-boot@lists.denx.de
>> Cc: Bharat Bhushan ; Laurentiu Tudor
>> 
>> Subject: [PATCH v3 5/7] armv8: ls1046a: initial icid setup support
>>
>> Add infrastructure for ICID setup and device tree fixup on ARM platforms.
>> This include basic ICID setup for several devices.
>>
>> Signed-off-by: Laurentiu Tudor 
>> ---
>>   arch/arm/cpu/armv8/fsl-layerscape/Makefile|   1 +
>>   arch/arm/cpu/armv8/fsl-layerscape/icid.c  | 111 ++
>>   .../arm/cpu/armv8/fsl-layerscape/ls1046_ids.c |  29 +
>>   arch/arm/cpu/armv8/fsl-layerscape/soc.c   |   3 +
>>   .../asm/arch-fsl-layerscape/fsl_icid.h|  80 +
>>   board/freescale/ls1046aqds/ls1046aqds.c   |   2 +
>>   board/freescale/ls1046ardb/ls1046ardb.c   |   3 +
>>   7 files changed, 229 insertions(+)
>>   create mode 100644 arch/arm/cpu/armv8/fsl-layerscape/icid.c
>>   create mode 100644 arch/arm/cpu/armv8/fsl-layerscape/ls1046_ids.c
>>   create mode 100644 arch/arm/include/asm/arch-fsl-layerscape/fsl_icid.h
>>
>> diff --git a/arch/arm/cpu/armv8/fsl-layerscape/Makefile
>> b/arch/arm/cpu/armv8/fsl-layerscape/Makefile
>> index 1e9e4680fe..5d6f68aad6 100644
>> --- a/arch/arm/cpu/armv8/fsl-layerscape/Makefile
>> +++ b/arch/arm/cpu/armv8/fsl-layerscape/Makefile
>> @@ -37,6 +37,7 @@ endif
>>
>>   ifneq ($(CONFIG_ARCH_LS1046A),)
>>   obj-$(CONFIG_SYS_HAS_SERDES) += ls1046a_serdes.o
>> +obj-y += icid.o ls1046_ids.o
>>   endif
>>
>>   ifneq ($(CONFIG_ARCH_LS1088A),)
>> diff --git a/arch/arm/cpu/armv8/fsl-layerscape/icid.c
>> b/arch/arm/cpu/armv8/fsl-layerscape/icid.c
>> new file mode 100644
>> index 00..8694bd6fa1
>> --- /dev/null
>> +++ b/arch/arm/cpu/armv8/fsl-layerscape/icid.c
>> @@ -0,0 +1,111 @@
>> +// SPDX-License-Identifier: GPL-2.0+
>> +/*
>> + * Copyright 2018 NXP
>> + */
>> +
>> +#include 
>> +#include 
>> +#include 
>> +
>> +#include 
>> +#include 
>> +#include 
>> +
>> +static void set_icid(struct icid_id_table *tbl, int size) {
>> +int i;
>> +
>> +for (i = 0; i < size; i++)
>> +out_be32((u32 *)(tbl[i].reg_addr), tbl[i].reg); }
>> +
>> +void set_icids(void)
>> +{
>> +/* setup general icid offsets */
>> +set_icid(icid_tbl, icid_tbl_sz);
>> +}
>> +
>> +int fdt_set_iommu_prop(void *blob, int off, int smmu_ph, u32 *ids, int
>> +num_ids) {
>> +int i, ret;
>> +u32 prop[8];
>> +
>> +for (i = 0; i < num_ids; i++) {
>> +prop[i * 2] = cpu_to_fdt32(smmu_ph);
>> +prop[i * 2 + 1] = cpu_to_fdt32(ids[i]);
>> +}
>> +ret = fdt_setprop(blob, off, "iommus",
>> +  prop, sizeof(u32) * num_ids * 2);
>> +if (ret > 0) {
>> +printf("WARNING unable to set iommus: %s\n",
>> fdt_strerror(off));
>> +return off;
>> +}
>> +ret = fdt_setprop_empty(blob, off, "dma-coherent");
> 
> This forces "dma-coherent" for all SOCs, although there is no current known 
> SOCs which does not support non-coherent but maybe safe not to set from 
> common code.

I see your point and will drop this.
Now, regarding a replacement solution, I don't have any other idea than 
updating the device trees directly. Thoughts?

>> +if (ret > 0) {
>> +printf("WARNING unable to set dma-coherent: %s\n",
>> +   fdt_strerror(off));
>> +return off;
>> +}
>> +
>> +return 0;
>> +}
>> +
>> +int fdt_fixup_icid_tbl(void *blob, int smmu_ph,
>> +   struct icid_id_table *tbl, int size) {
>> +int i, err, off;
>> +
>> +for (i = 0; i < size; i++) {
>> +if (!tbl[i].compat)
>> +continue;
>> +
>> +off = fdt_node_offset_by_compat_reg(blob,
>> +tbl[i].compat,
>> +tbl[i].compat_addr);
>> +if (off > 0) {
>> +err = fdt_set_iommu_prop(blob, off, smmu_ph,
>> + &tbl[i].id, 1);
>> +if (err)
>> +return err;
>> +} else {
>> +printf("WARNING could not find node %s: %s.\n",
>> +   tbl[i].compat, fdt_strerror(off));
>> +}
>> +}
>> +
>> +return 0;
>> +}
>> +
>> +int fdt_get_smmu_phandle(void *blob)
>> +{
>> +int noff, smmu_ph;
>> +
>> +noff = fdt_node_offset_by_compatible(blob, -1, "arm,mmu-500");
>> +if (noff < 0) {
>> +printf("WARNING failed to get smmu node: %s\n",
>> +   fdt_strerror(noff));
>> +return noff;
>> +}
>> +
>> +smmu_ph = fdt_get_phandle(blob, noff);
>> +if (!smmu_ph) {
>> +smmu_ph = fdt_create_phandle(blob, noff);
>> +if (!smmu_ph) {
>> + 

[U-Boot] [PATCH 1/6] dts: import stm32mp1 device tree from linux kernel

2018-07-09 Thread Patrick Delaunay
This patch rebase the stm32mp1 device tree source from
linux kernel v4.18-rc1.

Signed-off-by: Patrick Delaunay 
---

 arch/arm/dts/stm32mp15-ddr.dtsi|  12 +-
 arch/arm/dts/stm32mp157-pinctrl.dtsi   | 359 
 arch/arm/dts/stm32mp157-u-boot.dtsi|  20 +-
 arch/arm/dts/stm32mp157.dtsi   | 380 -
 arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi   |   2 +-
 arch/arm/dts/stm32mp157c-ed1.dts   | 156 +---
 arch/arm/dts/stm32mp157c.dtsi  | 935 +
 include/dt-bindings/clock/stm32mp1-clks.h  | 445 +-
 include/dt-bindings/pinctrl/stm32-pinfunc.h|   6 +
 .../dt-bindings/reset-controller/stm32mp1-resets.h |  97 ---
 include/dt-bindings/reset/stm32mp1-resets.h| 108 +++
 11 files changed, 1676 insertions(+), 844 deletions(-)
 create mode 100644 arch/arm/dts/stm32mp157-pinctrl.dtsi
 delete mode 100644 arch/arm/dts/stm32mp157.dtsi
 create mode 100644 arch/arm/dts/stm32mp157c.dtsi
 delete mode 100644 include/dt-bindings/reset-controller/stm32mp1-resets.h
 create mode 100644 include/dt-bindings/reset/stm32mp1-resets.h

diff --git a/arch/arm/dts/stm32mp15-ddr.dtsi b/arch/arm/dts/stm32mp15-ddr.dtsi
index 094f842..4172c02 100644
--- a/arch/arm/dts/stm32mp15-ddr.dtsi
+++ b/arch/arm/dts/stm32mp15-ddr.dtsi
@@ -13,12 +13,12 @@
reg = <0x5A003000 0x550
   0x5A004000 0x234>;
 
-   clocks = <&rcc_clk AXIDCG>,
-<&rcc_clk DDRC1>,
-<&rcc_clk DDRC2>,
-<&rcc_clk DDRPHYC>,
-<&rcc_clk DDRCAPB>,
-<&rcc_clk DDRPHYCAPB>;
+   clocks = <&rcc AXIDCG>,
+<&rcc DDRC1>,
+<&rcc DDRC2>,
+<&rcc DDRPHYC>,
+<&rcc DDRCAPB>,
+<&rcc DDRPHYCAPB>;
 
clock-names = "axidcg",
  "ddrc1",
diff --git a/arch/arm/dts/stm32mp157-pinctrl.dtsi 
b/arch/arm/dts/stm32mp157-pinctrl.dtsi
new file mode 100644
index 000..c69c397
--- /dev/null
+++ b/arch/arm/dts/stm32mp157-pinctrl.dtsi
@@ -0,0 +1,359 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
+/*
+ * Copyright (C) STMicroelectronics 2017 - All Rights Reserved
+ * Author: Ludovic Barre  for STMicroelectronics.
+ */
+#include 
+
+/ {
+   soc {
+   pinctrl: pin-controller@50002000 {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   compatible = "st,stm32mp157-pinctrl";
+   ranges = <0 0x50002000 0xa400>;
+   interrupt-parent = <&exti>;
+   st,syscfg = <&exti 0x60 0xff>;
+   pins-are-numbered;
+
+   gpioa: gpio@50002000 {
+   gpio-controller;
+   #gpio-cells = <2>;
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   reg = <0x0 0x400>;
+   clocks = <&rcc GPIOA>;
+   st,bank-name = "GPIOA";
+   ngpios = <16>;
+   gpio-ranges = <&pinctrl 0 0 16>;
+   };
+
+   gpiob: gpio@50003000 {
+   gpio-controller;
+   #gpio-cells = <2>;
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   reg = <0x1000 0x400>;
+   clocks = <&rcc GPIOB>;
+   st,bank-name = "GPIOB";
+   ngpios = <16>;
+   gpio-ranges = <&pinctrl 0 16 16>;
+   };
+
+   gpioc: gpio@50004000 {
+   gpio-controller;
+   #gpio-cells = <2>;
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   reg = <0x2000 0x400>;
+   clocks = <&rcc GPIOC>;
+   st,bank-name = "GPIOC";
+   ngpios = <16>;
+   gpio-ranges = <&pinctrl 0 32 16>;
+   };
+
+   gpiod: gpio@50005000 {
+   gpio-controller;
+   #gpio-cells = <2>;
+   interrupt-controller;
+   #interrupt-cells = <2>;
+

[U-Boot] [PATCH 3/6] stm32mp1: activate MISC support in SPL

2018-07-09 Thread Patrick Delaunay
needed for RCC MISC driver and sysreset with syscon
in SPL

Signed-off-by: Patrick Delaunay 
---

 arch/arm/mach-stm32mp/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-stm32mp/Kconfig b/arch/arm/mach-stm32mp/Kconfig
index aa26999..5b24235 100644
--- a/arch/arm/mach-stm32mp/Kconfig
+++ b/arch/arm/mach-stm32mp/Kconfig
@@ -5,6 +5,7 @@ config SPL
select SPL_CLK
select SPL_DM
select SPL_DM_SEQ_ALIAS
+   select SPL_DRIVERS_MISC_SUPPORT
select SPL_FRAMEWORK
select SPL_GPIO_SUPPORT
select SPL_LIBCOMMON_SUPPORT
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 2/6] misc: stm32: Add STM32MP1 support

2018-07-09 Thread Patrick Delaunay
Following next kernel rcc bindings, we must use a MFD
RCC driver which is able to bind both clock and reset
drivers.

We can reuse and adapt RCC MFD driver already available
for MCU SoCs (F4/F7/H7).

Signed-off-by: Patrice Chotard 
Signed-off-by: Patrick Delaunay 
---

 arch/arm/mach-stm32mp/Kconfig |  1 +
 drivers/clk/clk_stm32mp1.c|  6 --
 drivers/misc/Kconfig  |  2 +-
 drivers/misc/stm32_rcc.c  | 19 +++
 drivers/reset/stm32-reset.c   | 16 +++-
 include/stm32_rcc.h   |  1 +
 6 files changed, 21 insertions(+), 24 deletions(-)

diff --git a/arch/arm/mach-stm32mp/Kconfig b/arch/arm/mach-stm32mp/Kconfig
index abceede..aa26999 100644
--- a/arch/arm/mach-stm32mp/Kconfig
+++ b/arch/arm/mach-stm32mp/Kconfig
@@ -29,6 +29,7 @@ config TARGET_STM32MP1
select CPU_V7_HAS_NONSEC
select CPU_V7_HAS_VIRT
select PINCTRL_STM32
+   select STM32_RCC
select STM32_RESET
select SYS_ARCH_TIMER
select SYSRESET_SYSCON
diff --git a/drivers/clk/clk_stm32mp1.c b/drivers/clk/clk_stm32mp1.c
index 1a77eba..af7d05f 100644
--- a/drivers/clk/clk_stm32mp1.c
+++ b/drivers/clk/clk_stm32mp1.c
@@ -1764,15 +1764,9 @@ static const struct clk_ops stm32mp1_clk_ops = {
.get_rate = stm32mp1_clk_get_rate,
 };
 
-static const struct udevice_id stm32mp1_clk_ids[] = {
-   { .compatible = "st,stm32mp1-rcc-clk" },
-   { }
-};
-
 U_BOOT_DRIVER(stm32mp1_clock) = {
.name = "stm32mp1_clk",
.id = UCLASS_CLK,
-   .of_match = stm32mp1_clk_ids,
.ops = &stm32mp1_clk_ops,
.priv_auto_alloc_size = sizeof(struct stm32mp1_clk_priv),
.probe = stm32mp1_clk_probe,
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 17b3a80..c031dfd 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -169,7 +169,7 @@ config STM32MP_FUSE
 
 config STM32_RCC
bool "Enable RCC driver for the STM32 SoC's family"
-   depends on STM32 && MISC
+   depends on (STM32 || ARCH_STM32MP) && MISC
help
  Enable the STM32 RCC driver. The RCC block (Reset and Clock Control
  block) is responsible of the management of the clock and reset
diff --git a/drivers/misc/stm32_rcc.c b/drivers/misc/stm32_rcc.c
index 980b3a5..13d7069 100644
--- a/drivers/misc/stm32_rcc.c
+++ b/drivers/misc/stm32_rcc.c
@@ -30,6 +30,11 @@ struct stm32_rcc_clk stm32_rcc_clk_h7 = {
.drv_name = "stm32h7_rcc_clock",
 };
 
+struct stm32_rcc_clk stm32_rcc_clk_mp1 = {
+   .drv_name = "stm32mp1_clk",
+   .soc = STM32MP1,
+};
+
 static int stm32_rcc_bind(struct udevice *dev)
 {
struct udevice *child;
@@ -39,7 +44,6 @@ static int stm32_rcc_bind(struct udevice *dev)
int ret;
 
debug("%s(dev=%p)\n", __func__, dev);
-
drv = lists_driver_lookup_name(rcc_clk->drv_name);
if (!drv) {
debug("Cannot find driver '%s'\n", rcc_clk->drv_name);
@@ -53,9 +57,15 @@ static int stm32_rcc_bind(struct udevice *dev)
if (ret)
return ret;
 
-   return device_bind_driver_to_node(dev, "stm32_rcc_reset",
- "stm32_rcc_reset",
- dev_ofnode(dev), &child);
+   drv = lists_driver_lookup_name("stm32_rcc_reset");
+   if (!drv) {
+   dev_err(dev, "Cannot find driver stm32_rcc_reset'\n");
+   return -ENOENT;
+   }
+
+   return device_bind_with_driver_data(dev, drv, "stm32_rcc_reset",
+   rcc_clk->soc,
+   dev_ofnode(dev), &child);
 }
 
 static const struct misc_ops stm32_rcc_ops = {
@@ -66,6 +76,7 @@ static const struct udevice_id stm32_rcc_ids[] = {
{.compatible = "st,stm32f469-rcc", .data = (ulong)&stm32_rcc_clk_f469 },
{.compatible = "st,stm32f746-rcc", .data = (ulong)&stm32_rcc_clk_f7 },
{.compatible = "st,stm32h743-rcc", .data = (ulong)&stm32_rcc_clk_h7 },
+   {.compatible = "st,stm32mp1-rcc", .data = (ulong)&stm32_rcc_clk_mp1 },
{ }
 };
 
diff --git a/drivers/reset/stm32-reset.c b/drivers/reset/stm32-reset.c
index c21ede2..16d3dba 100644
--- a/drivers/reset/stm32-reset.c
+++ b/drivers/reset/stm32-reset.c
@@ -8,16 +8,12 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 /* reset clear offset for STM32MP RCC */
 #define RCC_CL 0x4
 
-enum rcc_type {
-   RCC_STM32 = 0,
-   RCC_STM32MP,
-};
-
 struct stm32_reset_priv {
fdt_addr_t base;
 };
@@ -40,7 +36,7 @@ static int stm32_reset_assert(struct reset_ctl *reset_ctl)
debug("%s: reset id = %ld bank = %d offset = %d)\n", __func__,
  reset_ctl->id, bank, offset);
 
-   if (dev_get_driver_data(reset_ctl->dev) == RCC_STM32MP)
+   if (dev_get_driver_data(reset_ctl->dev) == STM32MP1)
/* reset assert is done in rcc set register */
writel(BIT(offset), priv->base + bank);
else
@@ -57,7 +53,7 @@

[U-Boot] [PATCH 4/6] stm32mp1: add support for stm32mp157c-ev1 board

2018-07-09 Thread Patrick Delaunay
Add support of stm32mp157c-ev1, the evaluation board with pmic stpmu1
(ev1 = mother board + daughter ed1) with device tree.
EV1 is the selected board by default in basic defconfig.

PS: CONFIG_PINCTRL_FULL activation avoid to increase
SYS_MALLOC_F_LEN (Early malloc usage: 2034)

Signed-off-by: Patrick Delaunay 
---

 arch/arm/dts/Makefile|   3 +-
 arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi |  62 +++
 arch/arm/dts/stm32mp157c-ev1.dts | 101 +++
 board/st/stm32mp1/README |  53 ++--
 configs/stm32mp15_basic_defconfig|   3 +-
 5 files changed, 215 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi
 create mode 100644 arch/arm/dts/stm32mp157c-ev1.dts

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 64f6d21..2d74d3a 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -533,7 +533,8 @@ dtb-$(CONFIG_ARCH_ASPEED) += ast2500-evb.dtb
 dtb-$(CONFIG_ARCH_STI) += stih410-b2260.dtb
 
 dtb-$(CONFIG_TARGET_STM32MP1) += \
-   stm32mp157c-ed1.dtb
+   stm32mp157c-ed1.dtb \
+   stm32mp157c-ev1.dtb
 
 targets += $(dtb-y)
 
diff --git a/arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi 
b/arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi
new file mode 100644
index 000..2f4de3a
--- /dev/null
+++ b/arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi
@@ -0,0 +1,62 @@
+// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
+/*
+ * Copyright : STMicroelectronics 2018
+ */
+
+#include "stm32mp157c-ed1-u-boot.dtsi"
+
+/ {
+   aliases {
+   spi0 = &qspi;
+   i2c1 = &i2c2;
+   i2c4 = &i2c5;
+   };
+};
+
+&flash0 {
+   compatible = "spi-flash";
+};
+
+&flash1 {
+   compatible = "spi-flash";
+};
+
+&v3v3 {
+   regulator-always-on;
+};
+
+/* SPL part **/
+&qspi {
+   u-boot,dm-spl;
+};
+
+&qspi_clk_pins_a {
+   u-boot,dm-spl;
+   pins {
+   u-boot,dm-spl;
+   };
+};
+
+&qspi_bk1_pins_a {
+   u-boot,dm-spl;
+   pins1 {
+   u-boot,dm-spl;
+   };
+   pins2 {
+   u-boot,dm-spl;
+   };
+};
+
+&qspi_bk2_pins_a {
+   u-boot,dm-spl;
+   pins1 {
+   u-boot,dm-spl;
+   };
+   pins2 {
+   u-boot,dm-spl;
+   };
+};
+
+&flash0 {
+   u-boot,dm-spl;
+};
diff --git a/arch/arm/dts/stm32mp157c-ev1.dts b/arch/arm/dts/stm32mp157c-ev1.dts
new file mode 100644
index 000..d6934f7
--- /dev/null
+++ b/arch/arm/dts/stm32mp157c-ev1.dts
@@ -0,0 +1,101 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
+/*
+ * Copyright (C) STMicroelectronics 2017 - All Rights Reserved
+ * Author: Ludovic Barre  for STMicroelectronics.
+ */
+/dts-v1/;
+
+#include "stm32mp157c-ed1.dts"
+
+/ {
+   model = "STMicroelectronics STM32MP157C eval daughter on eval mother";
+   compatible = "st,stm32mp157c-ev1", "st,stm32mp157c-ed1", 
"st,stm32mp157";
+
+};
+
+&cec {
+   pinctrl-names = "default";
+   pinctrl-0 = <&cec_pins_a>;
+   status = "okay";
+};
+
+&i2c2 {
+   pinctrl-names = "default";
+   pinctrl-0 = <&i2c2_pins_a>;
+   i2c-scl-rising-time-ns = <185>;
+   i2c-scl-falling-time-ns = <20>;
+   status = "okay";
+};
+
+&i2c5 {
+   pinctrl-names = "default";
+   pinctrl-0 = <&i2c5_pins_a>;
+   i2c-scl-rising-time-ns = <185>;
+   i2c-scl-falling-time-ns = <20>;
+   status = "okay";
+};
+
+&qspi {
+   pinctrl-names = "default";
+   pinctrl-0 = <&qspi_clk_pins_a &qspi_bk1_pins_a &qspi_bk2_pins_a>;
+   reg = <0x58003000 0x1000>, <0x7000 0x400>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   status = "okay";
+
+   flash0: mx66l51235l@0 {
+   reg = <0>;
+   spi-rx-bus-width = <4>;
+   spi-max-frequency = <10800>;
+   #address-cells = <1>;
+   #size-cells = <1>;
+   };
+
+   flash1: mx66l51235l@1 {
+   reg = <1>;
+   spi-rx-bus-width = <4>;
+   spi-max-frequency = <10800>;
+   #address-cells = <1>;
+   #size-cells = <1>;
+   };
+};
+
+&timers2 {
+   status = "disabled";
+   pwm {
+   pinctrl-0 = <&pwm2_pins_a>;
+   pinctrl-names = "default";
+   status = "okay";
+   };
+   timer@1 {
+   status = "okay";
+   };
+};
+
+&timers8 {
+   status = "disabled";
+   pwm {
+   pinctrl-0 = <&pwm8_pins_a>;
+   pinctrl-names = "default";
+   status = "okay";
+   };
+   timer@7 {
+   status = "okay";
+   };
+};
+
+&timers12 {
+   status = "disabled";
+   pwm {
+   pinctrl-0 = <&pwm12_pins_a>;
+   pinctrl-names = "default";
+   status = "okay";
+   };
+   timer@11 {
+   status = "okay";
+   };
+}

[U-Boot] [PATCH 5/6] stm32mp1: activate FIXED regulator

2018-07-09 Thread Patrick Delaunay
Signed-off-by: Patrick Delaunay 
---

 configs/stm32mp15_basic_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/stm32mp15_basic_defconfig 
b/configs/stm32mp15_basic_defconfig
index 87f60be..c72a440 100644
--- a/configs/stm32mp15_basic_defconfig
+++ b/configs/stm32mp15_basic_defconfig
@@ -37,6 +37,7 @@ CONFIG_DM_PMIC=y
 # CONFIG_SPL_PMIC_CHILDREN is not set
 CONFIG_PMIC_STPMU1=y
 CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_REGULATOR_GPIO=y
 CONFIG_DM_REGULATOR_STM32_VREFBUF=y
 CONFIG_DM_REGULATOR_STPMU1=y
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 6/6] stm32mp1: clock tree update

2018-07-09 Thread Patrick Delaunay
Configure clock tree for all the devices.

Signed-off-by: Patrick Delaunay 
---

 arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi | 46 
 1 file changed, 35 insertions(+), 11 deletions(-)

diff --git a/arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi 
b/arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi
index f6d1528..39a0ebc 100644
--- a/arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi
+++ b/arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi
@@ -73,18 +73,41 @@
>;
 
st,pkcs = <
-   CLK_CKPER_DISABLED
+   CLK_CKPER_HSE
+   CLK_FMC_ACLK
+   CLK_QSPI_ACLK
+   CLK_ETH_DISABLED
CLK_SDMMC12_PLL3R
+   CLK_DSI_DSIPLL
CLK_STGEN_HSE
-   CLK_I2C46_PCLK5
-   CLK_I2C12_PCLK1
+   CLK_USBPHY_HSE
+   CLK_SPI2S1_PLL3Q
+   CLK_SPI2S23_PLL3Q
+   CLK_SPI45_HSI
+   CLK_SPI6_HSI
+   CLK_I2C46_HSI
CLK_SDMMC3_PLL3R
-   CLK_I2C35_PCLK1
-   CLK_UART1_PCLK5
-   CLK_UART24_PCLK1
-   CLK_UART35_PCLK1
-   CLK_UART6_PCLK2
-   CLK_UART78_PCLK1
+   CLK_USBO_USBPHY
+   CLK_ADC_CKPER
+   CLK_CEC_LSE
+   CLK_I2C12_HSI
+   CLK_I2C35_HSI
+   CLK_UART1_HSI
+   CLK_UART24_HSI
+   CLK_UART35_HSI
+   CLK_UART6_HSI
+   CLK_UART78_HSI
+   CLK_SPDIF_PLL3Q
+   CLK_FDCAN_PLL4Q
+   CLK_SAI1_PLL3Q
+   CLK_SAI2_PLL3Q
+   CLK_SAI3_PLL3Q
+   CLK_SAI4_PLL3Q
+   CLK_RNG1_CSI
+   CLK_RNG2_CSI
+   CLK_LPTIM1_PCLK1
+   CLK_LPTIM23_PCLK3
+   CLK_LPTIM45_PCLK3
>;
 
/* VCO = 1300.0 MHz => P = 650 (CPU) */
@@ -101,9 +124,10 @@
u-boot,dm-pre-reloc;
};
 
-   /* VCO = 774.0 MHz => P = 194, Q = 37, R = 97 */
+   /* VCO = 786.4 MHz => P = 197, Q = 49, R = 98 */
pll3: st,pll@2 {
-   cfg = < 3 128 3 20 7 PQR(1,1,1) >;
+   cfg = < 2 97 3 15 7 PQR(1,1,1) >;
+   frac = < 0x9ba >;
u-boot,dm-pre-reloc;
};
 
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] login-password.

2018-07-09 Thread Mehmet Ali İPİN

Dear Fabio,

I hope you and all members of denx are good and wish you healthy life..

After studying and testing too many things, I managed our i.mx6dl board to boot 
rootfs with nfs. Then I see the login/password queries at the terminal as 
following lines. I entered the ROOT/root as login and empty(enter) for password 
as explained in the i.mx6 linux users manual, but it did not work.

May be you know the login/password or a method to bypass this query in u-boot 
or kernel files.

Thanks for your helps and Best regards.

Mehmet Ali Ipin


imx6dlsabresd login: root
login: can't set groups: Operatio
Freescale i.MX Release Distro 3.14.52-1.1.1 imx6dlsabresd /dev/ttymxc0

imx6dlsabresd login: random: nonblocking pool is initialized
imx6dlsabresd login: random: nonblocking pool is initialized
Password:
Login incorrect
imx6dlsabresd login:
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v1 0/2] Update STM32 QSPI driver

2018-07-09 Thread Patrice Chotard

This series :
  _ assign operation mode in _stm32_qspi_gen_ccr()
  _ rework mode management to solve quad read issue
with Macronix/Micron spi nor.


Christophe Kerello (2):
  spi: stm32_qspi: assign functional operation mode in
_stm32_qspi_gen_ccr
  spi: stm32_qspi: rework mode management

 drivers/spi/stm32_qspi.c | 45 ++---
 1 file changed, 22 insertions(+), 23 deletions(-)

-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v1 2/2] spi: stm32_qspi: rework mode management

2018-07-09 Thread Patrice Chotard
From: Christophe Kerello 

This patch solves quad read issue with Macronix/Micron spi nor.

Signed-off-by: Christophe Kerello 
Signed-off-by: Patrice Chotard 
---

 drivers/spi/stm32_qspi.c | 28 ++--
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/spi/stm32_qspi.c b/drivers/spi/stm32_qspi.c
index 81b84625ba5b..3b92254a5ce1 100644
--- a/drivers/spi/stm32_qspi.c
+++ b/drivers/spi/stm32_qspi.c
@@ -229,21 +229,21 @@ static unsigned int _stm32_qspi_gen_ccr(struct 
stm32_qspi_priv *priv, u8 fmode)
 
imode = STM32_QSPI_CCR_IMODE_ONE_LINE;
admode = STM32_QSPI_CCR_ADMODE_ONE_LINE;
-
-   if (mode & SPI_RX_QUAD) {
-   dmode = STM32_QSPI_CCR_DMODE_FOUR_LINE;
-   if (mode & SPI_TX_QUAD) {
-   imode = STM32_QSPI_CCR_IMODE_FOUR_LINE;
-   admode = STM32_QSPI_CCR_ADMODE_FOUR_LINE;
-   }
-   } else if (mode & SPI_RX_DUAL) {
-   dmode = STM32_QSPI_CCR_DMODE_TWO_LINE;
-   if (mode & SPI_TX_DUAL) {
-   imode = STM32_QSPI_CCR_IMODE_TWO_LINE;
-   admode = STM32_QSPI_CCR_ADMODE_TWO_LINE;
+   dmode = STM32_QSPI_CCR_DMODE_ONE_LINE;
+
+   if ((priv->command & CMD_HAS_ADR) && (priv->command & CMD_HAS_DATA)) {
+   if (fmode == STM32_QSPI_CCR_IND_WRITE) {
+   if (mode & SPI_TX_QUAD)
+   dmode = STM32_QSPI_CCR_DMODE_FOUR_LINE;
+   else if (mode & SPI_TX_DUAL)
+   dmode = STM32_QSPI_CCR_DMODE_TWO_LINE;
+   } else if ((fmode == STM32_QSPI_CCR_MEM_MAP) ||
+(fmode == STM32_QSPI_CCR_IND_READ)) {
+   if (mode & SPI_RX_QUAD)
+   dmode = STM32_QSPI_CCR_DMODE_FOUR_LINE;
+   else if (mode & SPI_RX_DUAL)
+   dmode = STM32_QSPI_CCR_DMODE_TWO_LINE;
}
-   } else {
-   dmode = STM32_QSPI_CCR_DMODE_ONE_LINE;
}
 
if (priv->command & CMD_HAS_DATA)
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v1 1/2] spi: stm32_qspi: assign functional operation mode in _stm32_qspi_gen_ccr

2018-07-09 Thread Patrice Chotard
From: Christophe Kerello 

This patch assigns the functional operation mode in _stm32_qspi_gen_ccr
function.

Signed-off-by: Christophe Kerello 
Signed-off-by: Patrice Chotard 
---

 drivers/spi/stm32_qspi.c | 17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/spi/stm32_qspi.c b/drivers/spi/stm32_qspi.c
index f6cc35336320..81b84625ba5b 100644
--- a/drivers/spi/stm32_qspi.c
+++ b/drivers/spi/stm32_qspi.c
@@ -220,7 +220,7 @@ static void _stm32_qspi_set_cs(struct stm32_qspi_priv 
*priv, unsigned int cs)
cs ? STM32_QSPI_CR_FSEL : 0);
 }
 
-static unsigned int _stm32_qspi_gen_ccr(struct stm32_qspi_priv *priv)
+static unsigned int _stm32_qspi_gen_ccr(struct stm32_qspi_priv *priv, u8 fmode)
 {
unsigned int ccr_reg = 0;
u8 imode, admode, dmode;
@@ -258,8 +258,11 @@ static unsigned int _stm32_qspi_gen_ccr(struct 
stm32_qspi_priv *priv)
<< STM32_QSPI_CCR_ADSIZE_SHIFT);
ccr_reg |= (admode << STM32_QSPI_CCR_ADMODE_SHIFT);
}
+
+   ccr_reg |= (fmode << STM32_QSPI_CCR_FMODE_SHIFT);
ccr_reg |= (imode << STM32_QSPI_CCR_IMODE_SHIFT);
ccr_reg |= cmd;
+
return ccr_reg;
 }
 
@@ -272,8 +275,7 @@ static void _stm32_qspi_enable_mmap(struct stm32_qspi_priv 
*priv,
| CMD_HAS_DUMMY;
priv->dummycycles = flash->dummy_byte * 8;
 
-   ccr_reg = _stm32_qspi_gen_ccr(priv);
-   ccr_reg |= (STM32_QSPI_CCR_MEM_MAP << STM32_QSPI_CCR_FMODE_SHIFT);
+   ccr_reg = _stm32_qspi_gen_ccr(priv, STM32_QSPI_CCR_MEM_MAP);
 
_stm32_qspi_wait_for_not_busy(priv);
 
@@ -359,9 +361,8 @@ static int _stm32_qspi_xfer(struct stm32_qspi_priv *priv,
}
 
if (flags & SPI_XFER_END) {
-   ccr_reg = _stm32_qspi_gen_ccr(priv);
-   ccr_reg |= STM32_QSPI_CCR_IND_WRITE
-   << STM32_QSPI_CCR_FMODE_SHIFT;
+   ccr_reg = _stm32_qspi_gen_ccr(priv,
+ STM32_QSPI_CCR_IND_WRITE);
 
_stm32_qspi_wait_for_not_busy(priv);
 
@@ -392,9 +393,7 @@ static int _stm32_qspi_xfer(struct stm32_qspi_priv *priv,
}
}
} else if (din) {
-   ccr_reg = _stm32_qspi_gen_ccr(priv);
-   ccr_reg |= STM32_QSPI_CCR_IND_READ
-   << STM32_QSPI_CCR_FMODE_SHIFT;
+   ccr_reg = _stm32_qspi_gen_ccr(priv, STM32_QSPI_CCR_IND_READ);
 
_stm32_qspi_wait_for_not_busy(priv);
 
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 6/7] armv8: ls1046a: add icid setup for qman portals

2018-07-09 Thread Laurentiu Tudor
Hi Bharat,

On 09.07.2018 15:21, Bharat Bhushan wrote:
> 
> 
>> -Original Message-
>> From: Laurentiu Tudor [mailto:laurentiu.tu...@nxp.com]
>> Sent: Wednesday, July 4, 2018 7:44 PM
>> To: York Sun ; Prabhakar Kushwaha
>> ; u-boot@lists.denx.de
>> Cc: Bharat Bhushan ; Laurentiu Tudor
>> 
>> Subject: [PATCH v3 6/7] armv8: ls1046a: add icid setup for qman portals
>>
>> Add support for ICID setting of qman portals and
>> the required device tree fixups.
>> Also fix an endiness issue in portal setup code.
>>
>> Signed-off-by: Laurentiu Tudor 
>> ---
>>   .../arm/cpu/armv8/fsl-layerscape/ls1046_ids.c | 16 +++
>>   .../asm/arch-fsl-layerscape/fsl_portals.h | 23 ++
>>   drivers/misc/fsl_portals.c| 43 +++
>>   3 files changed, 74 insertions(+), 8 deletions(-)
>>   create mode 100644 arch/arm/include/asm/arch-fsl-layerscape/fsl_portals.h
>>
>> diff --git a/arch/arm/cpu/armv8/fsl-layerscape/ls1046_ids.c
>> b/arch/arm/cpu/armv8/fsl-layerscape/ls1046_ids.c
>> index 1c528ab751..80e1ceadc0 100644
>> --- a/arch/arm/cpu/armv8/fsl-layerscape/ls1046_ids.c
>> +++ b/arch/arm/cpu/armv8/fsl-layerscape/ls1046_ids.c
>> @@ -6,6 +6,22 @@
>>   #include 
>>   #include 
>>   #include 
>> +#include 
>> +
>> +#ifdef CONFIG_SYS_DPAA_QBMAN
>> +struct qportal_info qp_info[CONFIG_SYS_QMAN_NUM_PORTALS] = {
>> +SET_QP_INFO(FSL_DPAA1_STREAM_ID_END, 0),
>> +SET_QP_INFO(FSL_DPAA1_STREAM_ID_END, 0),
>> +SET_QP_INFO(FSL_DPAA1_STREAM_ID_END, 0),
>> +SET_QP_INFO(FSL_DPAA1_STREAM_ID_END, 0),
>> +SET_QP_INFO(FSL_DPAA1_STREAM_ID_END, 0),
>> +SET_QP_INFO(FSL_DPAA1_STREAM_ID_END, 0),
>> +SET_QP_INFO(FSL_DPAA1_STREAM_ID_END, 0),
>> +SET_QP_INFO(FSL_DPAA1_STREAM_ID_END, 0),
>> +SET_QP_INFO(FSL_DPAA1_STREAM_ID_END, 0),
>> +SET_QP_INFO(FSL_DPAA1_STREAM_ID_END, 0),
> 
> FSL_DPAA1_STREAM_ID_END is "Stream-ID" while SET_QP_INFO is defined as
> 
>   #define SET_QP_INFO(_icid, dest) \
>   { .dicid = _icid, .ficid = _icid, .icid = _icid, .sdest = dest }
>   
> It expects "icid"
> 
> Can we use consistent names, either "streamed" or "icid" at both places.

The problem is that the streamid defines where defined some time ago 
(see file ./arch/arm/include/asm/arch-fsl-layerscape/stream_id_lsch2.h).

> In fact this structure is used to finally program the h/w, so we should use 
> same name as in h/w to avoid any confusion.

The RefMan uses the term "icid" so i'd stick with it.

In order to make this consistent I think i should rename the existing 
*_STREAM_ID_* defines to *_ICID_* but also the header that contains them 
from stream_id_lsch2.h to something like icid_lsch2.h. This implies that 
also the PCI related defines would be renamed. Is that ok?
Let me know what you think.

---
Best Regards, Laurentiu

> 
> Thanks
> -Bharat
> 
>> +};
>> +#endif
>>
>>   struct icid_id_table icid_tbl[] = {
>>   #ifdef CONFIG_SYS_DPAA_QBMAN
>> diff --git a/arch/arm/include/asm/arch-fsl-layerscape/fsl_portals.h
>> b/arch/arm/include/asm/arch-fsl-layerscape/fsl_portals.h
>> new file mode 100644
>> index 00..bd8d3fb49a
>> --- /dev/null
>> +++ b/arch/arm/include/asm/arch-fsl-layerscape/fsl_portals.h
>> @@ -0,0 +1,23 @@
>> +/* SPDX-License-Identifier: GPL-2.0+ */
>> +/*
>> + * Copyright 2018 NXP
>> + */
>> +
>> +#ifndef _FSL_PORTALS_H_
>> +#define _FSL_PORTALS_H_
>> +
>> +struct qportal_info {
>> +u16 dicid;  /* DQRR ICID */
>> +u16 ficid;  /* frame data ICID */
>> +u16 icid;
>> +u8  sdest;
>> +};
>> +
>> +#define SET_QP_INFO(_icid, dest) \
>> +{ .dicid = _icid, .ficid = _icid, .icid = _icid, .sdest = dest }
>> +
>> +extern struct qportal_info qp_info[];
>> +void fdt_portal(void *blob, const char *compat, const char *container,
>> +u64 addr, u32 size);
>> +
>> +#endif
>> diff --git a/drivers/misc/fsl_portals.c b/drivers/misc/fsl_portals.c
>> index 22faf16751..a524510707 100644
>> --- a/drivers/misc/fsl_portals.c
>> +++ b/drivers/misc/fsl_portals.c
>> @@ -13,6 +13,9 @@
>>   #ifdef CONFIG_PPC
>>   #include 
>>   #include 
>> +#else
>> +#include 
>> +#include 
>>   #endif
>>   #include 
>>
>> @@ -45,6 +48,22 @@ void setup_qbman_portals(void)
>>  /* set frame liodn */
>>  out_be32(&qman->qcsp[i].qcsp_io_cfg, (sdest << 16) |
>> fliodn);
>>  }
>> +#else
>> +#ifdef CONFIG_ARM
>> +int i;
>> +
>> +for (i = 0; i < CONFIG_SYS_QMAN_NUM_PORTALS; i++) {
>> +u8 sdest = qp_info[i].sdest;
>> +u16 ficid = qp_info[i].ficid;
>> +u16 dicid = qp_info[i].dicid;
>> +u16 icid = qp_info[i].icid;
>> +
>> +out_be32(&qman->qcsp[i].qcsp_lio_cfg, (icid << 16) |
>> +dicid);
>> +/* set frame icid */
>> +out_be32(&qman->qcsp[i].qcsp_io_cfg, (sdest << 16) | ficid);
>> +}
>> +#endif
>>   #endif
>>
>>  /* Change default state of BMan ISDR portals to all 1s */
>> @@ -178,6 +197,10 @@ void fdt_fixup_qportals

[U-Boot] [ANN] U-Boot v2018.07 released

2018-07-09 Thread Tom Rini
Hey all,

It's release day, and here we are doing the release.  It's live on git
and FTP and ACD (along with the PGP sig file).

Looking over the release email for v2018.05, I see I had a lot to say
then.  This time?  Not quite so much.  On the ARM side of things, we
have the framework in, and in some cases, it is now enabled, what
portion of the "Spectre" work-arounds.  Since dealing with the issues
entirely is a system-level problem and not just "whack some bits once
and you're good" I want to stress that to deal with the issue entirely
you're going to need more than just these changes enabled.

Next, the deadline for migration to CONFIG_BLK was supposed to be
v2018.05, but we didn't enforce it.  I'd really like to enforce this for
the v2018.09 release, and at least right now the only big hang-up is
USB.  That's a pretty big hang-up, but I am hopeful.

Finally, DM_SPI migration has a deadline of also v2018.09 and I'd like
to see if we can stick to it.

Thanks all!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [GIT] Pull request: u-boot-dfu (09.07.2018)

2018-07-09 Thread Lukasz Majewski
Dear Marek,

The following changes since commit
3f0492f20755b9cd3b32ea7253169655489bab63:

  Merge branch 'master' of git://git.denx.de/u-boot-video (2018-07-08
  18:56:07 -0400)

are available in the git repository at:

  git://git.denx.de/u-boot-dfu.git 

for you to fetch changes up to 45af84b87c521f258109e3d35359837e06036e88:

  gadget: f_thor: fix hang-up with ctrl-c (2018-07-09 16:32:33 +0200)


Seung-Woo Kim (1):
  gadget: f_thor: fix hang-up with ctrl-c

 drivers/usb/gadget/f_thor.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de


pgpjEbnYy6b2K.pgp
Description: OpenPGP digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] u-boot serial uart command?

2018-07-09 Thread Lukasz Majewski
Hi Dell,

> Hi Guys,
> 
> Brand new to this mailing list.
> 
> I have a Dart-MX6 imx6 Module that has a number of uarts. I have one
> of the uarts connected to an external micro controller that excepts
> commands via a basic binary messaging protocol. In linux I can
> communicate with it using standard linux /dev/ttymxcN device.
> 
> In an effort to learn more about u-boot and how it works, I was
> wondering if it was possible in u-boot shell to communicate with the
> same uart device using the same messaging protocol. 

Have I understood you correctly that you would like to send data to
this device via u-boot shell (like echo "FOO" > /dev/ttySX) ?

As fair as I can tell there are some commands which allow you to
load/send data via uart (like i.e. loadb).

However, I also assume that you would like to keep the "console" and
have the possibility to send data from it to other uart?

To do this you probably would need to:

1. Add new command - e.g. serialfoomagic

2. Setup this extra serial port (in DT for your board) for your iMX
device.

3. Use this command to send data/commands  -> e.g. serialfoomagic cmd1

> I see from the
> source code there is code for serial.c and serial_mxc.c, but I'm not
> an experienced u-boot developer to know if this is possible and how
> one would approach it.
> 
> any help/pointers would be greatly appreciated.
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de


pgpgSOz3A78Kc.pgp
Description: OpenPGP digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 7/7] cmd: Add bind/unbind commands to bind a device to a driver from the command line

2018-07-09 Thread Tom Rini
On Mon, Jul 09, 2018 at 08:19:44AM +0200, Michal Simek wrote:
> On 30.6.2018 06:19, Simon Glass wrote:
> > On 27 June 2018 at 07:13, Michal Simek  wrote:
> >> On 22.6.2018 14:25, Jean-Jacques Hiblot wrote:
> >>> In some cases it can be useful to be able to bind a device to a driver 
> >>> from
> >>> the command line.
> >>> The obvious example is for versatile devices such as USB gadget.
> >>> Another use case is when the devices are not yet ready at startup and
> >>> require some setup before the drivers are bound (ex: FPGA which bitsream 
> >>> is
> >>> fetched from a mass storage or ethernet)
> >>>
> >>> usage example:
> >>>
> >>> bind usb_dev_generic 0 usb_ether
> >>> unbind usb_dev_generic 0 usb_ether
> >>> or
> >>> unbind eth 1
> >>>
> >>> bind /ocp/omap_dwc3@4838/usb@4839 usb_ether
> >>> unbind /ocp/omap_dwc3@4838/usb@4839
> >>>
> >>> Signed-off-by: Jean-Jacques Hiblot 
> >>>
> >>> ---
> >>>
> >>> Changes in v3:
> >>> - factorize code based on comments from ML
> >>> - remove the devices before unbinding them
> >>> - use device_find_global_by_ofnode() to get a device by its node.
> >>> - Added tests
> >>>
> >>> Changes in v2:
> >>> - Make the bind/unbind command generic, not specific to usb device.
> >>> - Update the API to be able to bind/unbind based on DTS node path
> >>> - Add a Kconfig option to select the bind/unbind commands
> >>>
> >>>  arch/sandbox/dts/test.dts  |  11 ++
> >>>  cmd/Kconfig|   9 ++
> >>>  cmd/Makefile   |   1 +
> >>>  cmd/bind.c | 255 
> >>> +
> >>>  configs/sandbox_defconfig  |   1 +
> >>>  test/py/tests/test_bind.py | 178 +++
> >>>  6 files changed, 455 insertions(+)
> >>>  create mode 100644 cmd/bind.c
> >>>  create mode 100644 test/py/tests/test_bind.py
> > 
> > Reviewed-by: Simon Glass 
> > 
> > Nice work
> > 
> > [...]
> > 
> >>
> >> I have tested bind/unbind with dwc3 on zynqmp for ethernet gadget and it
> >> is working fine for me.
> >> I have also tried to use bind/unbind for gpio zynqmp driver and it is
> >> also working fine.
> >>
> >> It means
> >> Tested-by: Michal Simek 
> >>
> >> I would prefer if these commands are called as dm bind and dm unbind
> >> instead of simply bind/unbind which should also fit to dm command
> >> description "dm - Driver model low level access".
> > 
> > Yes i can see the point. But after thinking about it, maybe it is best
> > as it is? After all driver model is fundamental to U-Boot and it's not
> > clear what else we might bind/unbind.
> > 
> > I'd like to get other opinions here, too.
> 
> Tom/Marek: Any opinion?

I think dm bind/unbind makes sense, yes.  "bind" and "unbind" are pretty
generic terms and making it clear it's part of working "inside" of DM to
hook/unhook things by making it a sub-command of dm sounds good.
Thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] m68k: m5253evbe: Remove this board

2018-07-09 Thread Tom Rini
The m5253evbe board has been marked as orphan since June of 2014 and
should have been dropped a while ago.  Do so now.

Signed-off-by: Tom Rini 
---
 arch/m68k/Kconfig |   5 --
 board/freescale/m5253evbe/Kconfig |  15 
 board/freescale/m5253evbe/MAINTAINERS |   6 --
 board/freescale/m5253evbe/Makefile|   6 --
 board/freescale/m5253evbe/README  | 102 -
 board/freescale/m5253evbe/m5253evbe.c | 128 --
 configs/M5253EVBE_defconfig   |  16 
 include/configs/M5253EVBE.h   | 163 --
 8 files changed, 441 deletions(-)
 delete mode 100644 board/freescale/m5253evbe/Kconfig
 delete mode 100644 board/freescale/m5253evbe/MAINTAINERS
 delete mode 100644 board/freescale/m5253evbe/Makefile
 delete mode 100644 board/freescale/m5253evbe/README
 delete mode 100644 board/freescale/m5253evbe/m5253evbe.c
 delete mode 100644 configs/M5253EVBE_defconfig
 delete mode 100644 include/configs/M5253EVBE.h

diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 42fb91539af6..1f6df5c87044 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -144,10 +144,6 @@ config TARGET_M5253DEMO
bool "Support M5253DEMO"
select M5253
 
-config TARGET_M5253EVBE
-   bool "Support M5253EVBE"
-   select M5253
-
 config TARGET_M5272C3
bool "Support M5272C3"
select M5272
@@ -214,7 +210,6 @@ source "board/freescale/m52277evb/Kconfig"
 source "board/freescale/m5235evb/Kconfig"
 source "board/freescale/m5249evb/Kconfig"
 source "board/freescale/m5253demo/Kconfig"
-source "board/freescale/m5253evbe/Kconfig"
 source "board/freescale/m5272c3/Kconfig"
 source "board/freescale/m5275evb/Kconfig"
 source "board/freescale/m5282evb/Kconfig"
diff --git a/board/freescale/m5253evbe/Kconfig 
b/board/freescale/m5253evbe/Kconfig
deleted file mode 100644
index d97b87c4caec..
--- a/board/freescale/m5253evbe/Kconfig
+++ /dev/null
@@ -1,15 +0,0 @@
-if TARGET_M5253EVBE
-
-config SYS_CPU
-   default "mcf52x2"
-
-config SYS_BOARD
-   default "m5253evbe"
-
-config SYS_VENDOR
-   default "freescale"
-
-config SYS_CONFIG_NAME
-   default "M5253EVBE"
-
-endif
diff --git a/board/freescale/m5253evbe/MAINTAINERS 
b/board/freescale/m5253evbe/MAINTAINERS
deleted file mode 100644
index 74acd1eee504..
--- a/board/freescale/m5253evbe/MAINTAINERS
+++ /dev/null
@@ -1,6 +0,0 @@
-M5253EVBE BOARD
-#M:Hayden Fraser 
-S: Orphan (since 2014-06)
-F: board/freescale/m5253evbe/
-F: include/configs/M5253EVBE.h
-F: configs/M5253EVBE_defconfig
diff --git a/board/freescale/m5253evbe/Makefile 
b/board/freescale/m5253evbe/Makefile
deleted file mode 100644
index 79e20b7365b8..
--- a/board/freescale/m5253evbe/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0+
-#
-# (C) Copyright 2000-2006
-# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
-
-obj-y  = m5253evbe.o
diff --git a/board/freescale/m5253evbe/README b/board/freescale/m5253evbe/README
deleted file mode 100644
index f4eae67fc010..
--- a/board/freescale/m5253evbe/README
+++ /dev/null
@@ -1,102 +0,0 @@
-Freescale Amadeus Plus M5253EVBE board
-==
-
-Hayden Fraser(hayden.fra...@freescale.com)
-Created 06/05/2007
-===
-
-
-1. SWITCH SETTINGS
-==
-1.1 N/A
-
-
-2. MEMORY MAP UNDER U-BOOT AND LINUX KERNEL
-===
-2.1. For the initial bringup, we adopted a consistent memory scheme between 
U-Boot and
-   linux kernel, you can customize it based on your system requirements:
-   SDR:0x-0x00ff
-   SRAM0:  0x2001-0x20017fff
-   SRAM1:  0x2000-0x2000
-   MBAR1:  0x1000-0x4fff
-   MBAR2:  0x8000-0xCfff
-   Flash:  0xffe0-0x
-
-3. DEFINITIONS AND COMPILATION
-==
-3.1 Explanation on NEW definitions in include/configs/M5253EVBE.h
-   CONFIG_MCF52x2  Processor family
-   CONFIG_MCF5253  MCF5253 specific
-   CONFIG_SYS_CLK  Define Amadeus Plus CPU Clock
-   CONFIG_SYS_MBAR MBAR base address
-   CONFIG_SYS_MBAR2MBAR2 base address
-
-3.2 Compilation
-   export CROSS_COMPILE=/usr/local/freescale-coldfire-4.1-elf/bin/m68k-elf-
-   cd u-boot-1-2-x
-   make distclean
-   make M5253EVBE_config
-   make
-
-
-4. SCREEN DUMP
-==
-4.1 U-Boot 1.2.0 (Jun 18 2007 - 18:20:00)
-
-CPU:   Freescale Coldfire MCF5253 at 62 MHz
-Board: Freescale MCF5253 EVBE
-DRAM:  16 MB
-FLASH:  2 MB
-In:serial
-Out:   serial
-Err:   serial
-=> flinfo
-
-Bank # 1: CFI conformant FLASH (16 x 16)  Size: 2 MB in 35 Sectors
-  AMD Standard command set, Manufacturer ID: 0x01, Device ID: 0x49
-  Erase timeout: 16384 ms, write timeout: 1 ms
-
-  Sector Start Addresses:
-  FFE0 

Re: [U-Boot] [PATCH 1/1] avb2.0: add get_size_of_partition()

2018-07-09 Thread Sam Protsenko
On Mon, Jul 9, 2018 at 3:15 PM, Igor Opaniuk  wrote:
> Implement get_size_of_partition() operation,
> which is required by the latest upstream libavb [1].
>
> [1] https://android.googlesource.com/platform/external/avb/+/master/README.md
>
> Signed-off-by: Igor Opaniuk 
> ---

Reviewed-by: Sam Protsenko 

>  common/avb_verify.c | 33 -
>  1 file changed, 32 insertions(+), 1 deletion(-)
>
> diff --git a/common/avb_verify.c b/common/avb_verify.c
> index f9a00f8..5eabab0 100644
> --- a/common/avb_verify.c
> +++ b/common/avb_verify.c
> @@ -699,6 +699,37 @@ static AvbIOResult get_unique_guid_for_partition(AvbOps 
> *ops,
>  }
>
>  /**
> + * get_size_of_partition() - gets the size of a partition identified
> + * by a string name
> + *
> + * @ops: contains AVB ops handlers
> + * @partition: partition name (NUL-terminated UTF-8 string)
> + * @out_size_num_bytes: returns the value of a partition size
> + *
> + * @return:
> + *  AVB_IO_RESULT_OK, on success (GUID found)
> + *  AVB_IO_RESULT_ERROR_IO, out_size_num_bytes is NULL
> + *  AVB_IO_RESULT_ERROR_NO_SUCH_PARTITION, if partition was not found
> + */
> +static AvbIOResult get_size_of_partition(AvbOps *ops,
> +const char *partition,
> +u64 *out_size_num_bytes)
> +{
> +   struct mmc_part *part;
> +
> +   if (!out_size_num_bytes)
> +   return AVB_IO_RESULT_ERROR_IO;
> +
> +   part = get_partition(ops, partition);
> +   if (!part)
> +   return AVB_IO_RESULT_ERROR_NO_SUCH_PARTITION;
> +
> +   *out_size_num_bytes = part->info.blksz * part->info.size;
> +
> +   return AVB_IO_RESULT_OK;
> +}
> +
> +/**
>   * 
> 
>   * AVB2.0 AvbOps alloc/initialisation/free
>   * 
> 
> @@ -721,7 +752,7 @@ AvbOps *avb_ops_alloc(int boot_device)
> ops_data->ops.read_is_device_unlocked = read_is_device_unlocked;
> ops_data->ops.get_unique_guid_for_partition =
> get_unique_guid_for_partition;
> -
> +   ops_data->ops.get_size_of_partition = get_size_of_partition;
> ops_data->mmc_dev = boot_device;
>
> return &ops_data->ops;
> --
> 2.7.4
>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 0/2] Fix USB and enable ADC on Khadas VIM

2018-07-09 Thread Loic Devulder
This patch series add power supply entry for P212 like meson-gx boards.
It also enable ADC support for Khadas VIM board.

Based on the Neil Armstrong's patches.

Note: it's my first (small!) patch for U-Boot,
I tried to add all needed and useful informations :-)

Loic Devulder (2):
  ARM64: meson: Add 'usb2_phy0' in P212 DT file
  configs: Update Meson GX configs

 arch/arm/dts/meson-gxl-s905x-p212.dtsi | 8 
 configs/khadas-vim_defconfig   | 5 +
 2 files changed, 13 insertions(+)

-- 
2.13.7

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/2] ARM64: meson: Add 'usb2_phy0' in P212 DT file

2018-07-09 Thread Loic Devulder
Enable power supply for USB Amlogic Meson GXL P212 based boards.

Signed-off-by: Loic Devulder 
---
 arch/arm/dts/meson-gxl-s905x-p212.dtsi | 8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/dts/meson-gxl-s905x-p212.dtsi 
b/arch/arm/dts/meson-gxl-s905x-p212.dtsi
index 0cfd701809..4e61ec8f5b 100644
--- a/arch/arm/dts/meson-gxl-s905x-p212.dtsi
+++ b/arch/arm/dts/meson-gxl-s905x-p212.dtsi
@@ -189,3 +189,11 @@
 &usb0 {
status = "okay";
 };
+
+&usb2_phy0 {
+/*
+ * even though the schematics don't show it:
+ * HDMI_5V is also used as supply for the USB VBUS.
+ */
+phy-supply = <&hdmi_5v>;
+};
-- 
2.13.7

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 2/2] configs: Update Meson GX configs

2018-07-09 Thread Loic Devulder
Enable ADC support on the Khadas VIM board.

Signed-off-by: Loic Devulder 
---
 configs/khadas-vim_defconfig | 5 +
 1 file changed, 5 insertions(+)

diff --git a/configs/khadas-vim_defconfig b/configs/khadas-vim_defconfig
index 1eb13df4b4..116acb5507 100644
--- a/configs/khadas-vim_defconfig
+++ b/configs/khadas-vim_defconfig
@@ -13,18 +13,23 @@ CONFIG_OF_BOARD_SETUP=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 # CONFIG_CMD_BDI is not set
 # CONFIG_CMD_IMI is not set
+CONFIG_CMD_ADC=y
 CONFIG_CMD_GPIO=y
 # CONFIG_CMD_LOADS is not set
 CONFIG_CMD_MMC=y
 CONFIG_CMD_USB=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_REGULATOR=y
+CONFIG_ADC=y
+CONFIG_SARADC_MESON=y
 CONFIG_OF_CONTROL=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM_GPIO=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_RESET=y
+CONFIG_ADC=y
++CONFIG_SARADC_MESON=y
 CONFIG_DM_MMC=y
 CONFIG_MMC_MESON_GX=y
 CONFIG_PHY_ADDR_ENABLE=y
-- 
2.13.7

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/1] avb2.0: add get_size_of_partition()

2018-07-09 Thread Andrew F. Davis
On 07/09/2018 09:52 AM, Sam Protsenko wrote:
> On Mon, Jul 9, 2018 at 3:15 PM, Igor Opaniuk  wrote:
>> Implement get_size_of_partition() operation,
>> which is required by the latest upstream libavb [1].
>>
>> [1] https://android.googlesource.com/platform/external/avb/+/master/README.md
>>


I may have missed it, where in here do we need this information? I looks
to be passed in on the command line for most ops. Has a new function
been added?


>> Signed-off-by: Igor Opaniuk 
>> ---
> 
> Reviewed-by: Sam Protsenko 
> 
>>  common/avb_verify.c | 33 -
>>  1 file changed, 32 insertions(+), 1 deletion(-)
>>
>> diff --git a/common/avb_verify.c b/common/avb_verify.c
>> index f9a00f8..5eabab0 100644
>> --- a/common/avb_verify.c
>> +++ b/common/avb_verify.c
>> @@ -699,6 +699,37 @@ static AvbIOResult get_unique_guid_for_partition(AvbOps 
>> *ops,
>>  }
>>
>>  /**
>> + * get_size_of_partition() - gets the size of a partition identified
>> + * by a string name
>> + *
>> + * @ops: contains AVB ops handlers
>> + * @partition: partition name (NUL-terminated UTF-8 string)
>> + * @out_size_num_bytes: returns the value of a partition size
>> + *
>> + * @return:
>> + *  AVB_IO_RESULT_OK, on success (GUID found)
>> + *  AVB_IO_RESULT_ERROR_IO, out_size_num_bytes is NULL


This does not seems to be the right error code for this, this implies a
hardware error, maybe AVB_IO_RESULT_ERROR_INSUFFICIENT_SPACE is a better
choice? 'out_size_num_bytes' is a buffer in a way (to 8 bytes)..

Andrew


>> + *  AVB_IO_RESULT_ERROR_NO_SUCH_PARTITION, if partition was not found
>> + */
>> +static AvbIOResult get_size_of_partition(AvbOps *ops,
>> +const char *partition,
>> +u64 *out_size_num_bytes)
>> +{
>> +   struct mmc_part *part;
>> +
>> +   if (!out_size_num_bytes)
>> +   return AVB_IO_RESULT_ERROR_IO;
>> +
>> +   part = get_partition(ops, partition);
>> +   if (!part)
>> +   return AVB_IO_RESULT_ERROR_NO_SUCH_PARTITION;
>> +
>> +   *out_size_num_bytes = part->info.blksz * part->info.size;
>> +
>> +   return AVB_IO_RESULT_OK;
>> +}
>> +
>> +/**
>>   * 
>> 
>>   * AVB2.0 AvbOps alloc/initialisation/free
>>   * 
>> 
>> @@ -721,7 +752,7 @@ AvbOps *avb_ops_alloc(int boot_device)
>> ops_data->ops.read_is_device_unlocked = read_is_device_unlocked;
>> ops_data->ops.get_unique_guid_for_partition =
>> get_unique_guid_for_partition;
>> -
>> +   ops_data->ops.get_size_of_partition = get_size_of_partition;
>> ops_data->mmc_dev = boot_device;
>>
>> return &ops_data->ops;
>> --
>> 2.7.4
>>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RFC PATCH] spl: Add option SPL_PAYLOAD

2018-07-09 Thread York Sun
On 06/14/2018 02:39 PM, York Sun wrote:
> Some legacy boards use RAW image for SPL boot. Add Kconfig option
> SPL_PAYLOAD to set alternative image.
> 
> Signed-off-by: York Sun 
> 
> ---
> 
>  Makefile   |  4 ++--
>  common/spl/Kconfig | 10 ++
>  2 files changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 6a190e7..36459f1 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1115,8 +1115,8 @@ u-boot.sha1:u-boot.bin
>  u-boot.dis:  u-boot
>   $(OBJDUMP) -d $< > $@
>  
> -ifdef CONFIG_TPL
> -SPL_PAYLOAD := tpl/u-boot-with-tpl.bin
> +ifneq ($(CONFIG_SPL_PAYLOAD),)
> +SPL_PAYLOAD := $(CONFIG_SPL_PAYLOAD:"%"=%)
>  else
>  SPL_PAYLOAD := u-boot.bin
>  endif
> diff --git a/common/spl/Kconfig b/common/spl/Kconfig
> index 1f14797..72b77d7 100644
> --- a/common/spl/Kconfig
> +++ b/common/spl/Kconfig
> @@ -552,6 +552,16 @@ config SYS_OS_BASE
>  
>  endif # SPL_OS_BOOT
>  
> +config SPL_PAYLOAD
> + string "SPL payload"
> + default "tpl/u-boot-with-tpl.bin" if TPL
> + default "u-boot.bin"
> + help
> +   Payload for SPL boot. For backward compability, default to
> +   u-boot.bin, i.e. RAW image without any header. In case of
> +   TPL, tpl/u-boot-with-tpl.bin. For new boards, suggest to
> +   use u-boot.img.
> +
>  config SPL_PCI_SUPPORT
>   bool "Support PCI drivers"
>   help
> 

Any comment?

York
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/1] avb2.0: add get_size_of_partition()

2018-07-09 Thread Eugeniu Rosca
On Mon, Jul 09, 2018 at 03:15:54PM +0300, Igor Opaniuk wrote:
> Implement get_size_of_partition() operation,
> which is required by the latest upstream libavb [1].
> 
> [1] https://android.googlesource.com/platform/external/avb/+/master/README.md
> 
> Signed-off-by: Igor Opaniuk 
> ---
>  common/avb_verify.c | 33 -
>  1 file changed, 32 insertions(+), 1 deletion(-)


Hi Igor,

Is there a way to play with and smoke-test libavb on sandbox?
FWIW currently, independently on this patch, menuconfig interface allows me
to select CONFIG_LIBAVB, but then U-Boot compilation fails as below:

$ make defconfig
$ make menuconfig => select LIBAVB=y
$ make

---8<---
In file included from common/avb_verify.c:7:0:
include/avb_verify.h: In function ‘get_sector_buf_size’:
include/avb_verify.h:70:17: error: ‘CONFIG_FASTBOOT_BUF_SIZE’ undeclared (first 
use in this function); did you mean ‘CONFIG_PRE_CON_BUF_SZ’?
  return (size_t)CONFIG_FASTBOOT_BUF_SIZE;
 ^~~~
 CONFIG_PRE_CON_BUF_SZ
include/avb_verify.h:70:17: note: each undeclared identifier is reported only 
once for each function it appears in
include/avb_verify.h: In function ‘get_sector_buf’:
include/avb_verify.h:75:17: error: ‘CONFIG_FASTBOOT_BUF_ADDR’ undeclared (first 
use in this function); did you mean ‘CONFIG_PRE_CON_BUF_ADDR’?
  return (void *)CONFIG_FASTBOOT_BUF_ADDR;
 ^~~~
 CONFIG_PRE_CON_BUF_ADDR
  CC  env/attr.o
---8<---

If there were an easy way to smoke-test libavb on sandbox, I think
people like me would be more motivated to provide their Tested-by
in addition to their review (just my feeling).

Best regards,
Eugeniu.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 2/2] configs: Update Meson GX configs

2018-07-09 Thread Loic Devulder
Enable ADC support on the Khadas VIM board.

Signed-off-by: Loic Devulder 
---
 configs/khadas-vim_defconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/configs/khadas-vim_defconfig b/configs/khadas-vim_defconfig
index 1eb13df4b4..fd1ec8157b 100644
--- a/configs/khadas-vim_defconfig
+++ b/configs/khadas-vim_defconfig
@@ -13,12 +13,15 @@ CONFIG_OF_BOARD_SETUP=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 # CONFIG_CMD_BDI is not set
 # CONFIG_CMD_IMI is not set
+CONFIG_CMD_ADC=y
 CONFIG_CMD_GPIO=y
 # CONFIG_CMD_LOADS is not set
 CONFIG_CMD_MMC=y
 CONFIG_CMD_USB=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_REGULATOR=y
+CONFIG_ADC=y
+CONFIG_SARADC_MESON=y
 CONFIG_OF_CONTROL=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM_GPIO=y
-- 
2.13.7

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 1/2] ARM64: meson: Add 'usb2_phy0' in P212 DT file

2018-07-09 Thread Loic Devulder
Enable power supply for USB Amlogic Meson GXL P212 based boards.

Signed-off-by: Loic Devulder 
---
 arch/arm/dts/meson-gxl-s905x-p212.dtsi | 8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/dts/meson-gxl-s905x-p212.dtsi 
b/arch/arm/dts/meson-gxl-s905x-p212.dtsi
index 0cfd701809..4e61ec8f5b 100644
--- a/arch/arm/dts/meson-gxl-s905x-p212.dtsi
+++ b/arch/arm/dts/meson-gxl-s905x-p212.dtsi
@@ -189,3 +189,11 @@
 &usb0 {
status = "okay";
 };
+
+&usb2_phy0 {
+/*
+ * even though the schematics don't show it:
+ * HDMI_5V is also used as supply for the USB VBUS.
+ */
+phy-supply = <&hdmi_5v>;
+};
-- 
2.13.7

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 0/2] Fix USB and enable ADC on Khadas VIM

2018-07-09 Thread Loic Devulder
This patch series add power supply entry for P212 like meson-gx boards.
It also enable ADC support for Khadas VIM board.

Based on the Neil Armstrong's patches.

Note: it's my first (small!) patch for U-Boot,
I tried to add all needed and useful informations :-)

Changes since v1:
 - remove duplicated lines in configs/khadas-vim_defconfig

Loic Devulder (2):
  ARM64: meson: Add 'usb2_phy0' in P212 DT file
  configs: Update Meson GX configs

 arch/arm/dts/meson-gxl-s905x-p212.dtsi | 8 
 configs/khadas-vim_defconfig   | 5 +
 2 files changed, 13 insertions(+)

-- 
2.13.7

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/8] Enable CONFIG_BLK and CONFIG_DM_MMC to Kconfig

2018-07-09 Thread York Sun
On 07/08/2018 09:46 PM, Yinbo Zhu wrote:
> This enables the folowing to Kconfig:
>   CONFIG_BLK
>   CONFIG_DM_MMC

The order of patches seems wrong. Don't you need patch 2 & 3 before
enabling these options?

York
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RFC PATCH] spl: Add option SPL_PAYLOAD

2018-07-09 Thread Tom Rini
On Mon, Jul 09, 2018 at 03:26:14PM +, York Sun wrote:
> On 06/14/2018 02:39 PM, York Sun wrote:
> > Some legacy boards use RAW image for SPL boot. Add Kconfig option
> > SPL_PAYLOAD to set alternative image.
> > 
> > Signed-off-by: York Sun 
> > 
> > ---
> > 
> >  Makefile   |  4 ++--
> >  common/spl/Kconfig | 10 ++
> >  2 files changed, 12 insertions(+), 2 deletions(-)
> > 
> > diff --git a/Makefile b/Makefile
> > index 6a190e7..36459f1 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -1115,8 +1115,8 @@ u-boot.sha1:  u-boot.bin
> >  u-boot.dis:u-boot
> > $(OBJDUMP) -d $< > $@
> >  
> > -ifdef CONFIG_TPL
> > -SPL_PAYLOAD := tpl/u-boot-with-tpl.bin
> > +ifneq ($(CONFIG_SPL_PAYLOAD),)
> > +SPL_PAYLOAD := $(CONFIG_SPL_PAYLOAD:"%"=%)
> >  else
> >  SPL_PAYLOAD := u-boot.bin
> >  endif
> > diff --git a/common/spl/Kconfig b/common/spl/Kconfig
> > index 1f14797..72b77d7 100644
> > --- a/common/spl/Kconfig
> > +++ b/common/spl/Kconfig
> > @@ -552,6 +552,16 @@ config SYS_OS_BASE
> >  
> >  endif # SPL_OS_BOOT
> >  
> > +config SPL_PAYLOAD
> > +   string "SPL payload"
> > +   default "tpl/u-boot-with-tpl.bin" if TPL
> > +   default "u-boot.bin"
> > +   help
> > + Payload for SPL boot. For backward compability, default to
> > + u-boot.bin, i.e. RAW image without any header. In case of
> > + TPL, tpl/u-boot-with-tpl.bin. For new boards, suggest to
> > + use u-boot.img.
> > +
> >  config SPL_PCI_SUPPORT
> > bool "Support PCI drivers"
> > help
> > 
> 
> Any comment?

Reviewed-by: Tom Rini 

And feel free to take it via your tree with other patches if needed,
thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/1] avb2.0: add get_size_of_partition()

2018-07-09 Thread Igor Opaniuk
Hi Eugeniu,

Thanks for reporting this issue,
LIBAVB should depend on CONFIG_FASTBOOT, as fastboot buffer is re-used
(which initially
is used in the fastboot protocol for downloads) for
mmc read/write AvbOps (and buffer size is configured by setting
CONFIG_FASTBOOT_BUF_ADDR
and CONFIG_FASTBOOT_BUF_SIZE)

The problem is that both CONFIG_FASTBOOT_BUF_ADDR and CONFIG_FASTBOOT_BUF_SIZE
are defined for most platforms, and this is how I missed this issue.

Will fix today and re-test,
Thanks

On 9 July 2018 at 18:33, Eugeniu Rosca  wrote:
> On Mon, Jul 09, 2018 at 03:15:54PM +0300, Igor Opaniuk wrote:
>> Implement get_size_of_partition() operation,
>> which is required by the latest upstream libavb [1].
>>
>> [1] https://android.googlesource.com/platform/external/avb/+/master/README.md
>>
>> Signed-off-by: Igor Opaniuk 
>> ---
>>  common/avb_verify.c | 33 -
>>  1 file changed, 32 insertions(+), 1 deletion(-)
>
>
> Hi Igor,
>
> Is there a way to play with and smoke-test libavb on sandbox?
> FWIW currently, independently on this patch, menuconfig interface allows me
> to select CONFIG_LIBAVB, but then U-Boot compilation fails as below:
>
> $ make defconfig
> $ make menuconfig => select LIBAVB=y
> $ make
>
> ---8<---
> In file included from common/avb_verify.c:7:0:
> include/avb_verify.h: In function ‘get_sector_buf_size’:
> include/avb_verify.h:70:17: error: ‘CONFIG_FASTBOOT_BUF_SIZE’ undeclared 
> (first use in this function); did you mean ‘CONFIG_PRE_CON_BUF_SZ’?
>   return (size_t)CONFIG_FASTBOOT_BUF_SIZE;
>  ^~~~
>  CONFIG_PRE_CON_BUF_SZ
> include/avb_verify.h:70:17: note: each undeclared identifier is reported only 
> once for each function it appears in
> include/avb_verify.h: In function ‘get_sector_buf’:
> include/avb_verify.h:75:17: error: ‘CONFIG_FASTBOOT_BUF_ADDR’ undeclared 
> (first use in this function); did you mean ‘CONFIG_PRE_CON_BUF_ADDR’?
>   return (void *)CONFIG_FASTBOOT_BUF_ADDR;
>  ^~~~
>  CONFIG_PRE_CON_BUF_ADDR
>   CC  env/attr.o
> ---8<---
>
> If there were an easy way to smoke-test libavb on sandbox, I think
> people like me would be more motivated to provide their Tested-by
> in addition to their review (just my feeling).
>
> Best regards,
> Eugeniu.



-- 
Regards,
Igor Opaniuk
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/1] net: Store waiting packet in a different buffer when making ARP requests

2018-07-09 Thread Joe Hershberger
On Wed, Jul 4, 2018 at 9:13 PM, Tran Tien Dat
 wrote:
> U-Boot has 1 common buffer to send Ethernet frames, pointed to by
> net_tx_packet.  When sending to an IP address without knowing the MAC
> address, U-Boot makes an ARP request (using the arp_tx_packet buffer) to
> find out the MAC address of the IP addressr. When a matching ARP reply is
> received, U-Boot continues sending the frame stored in the net_tx_packet
> buffer.
>
> However, in the mean time, if U-Boot needs to send out any network packets
> (e.g. replying ping packets or ARP requests for its own IP address etc.),
> it will use the net_tx_packet buffer to prepare the new packet. Thus this
> buffer is no longer the original packet meant to be transmitted after the
> ARP reply. The original packet will be lost.
>
> U-Boot has another buffer, pointed to by arp_tx_packet which is used to
> prepare ARP requests. ARP requests use this buffer instead of the normal
> net_tx_packet in order to avoid modifying the waiting packet to be sent.
> However, this approach does not prevent other parts of the codes from
> modifying the waiting packet to be sent, as explained above. This patch
> repurposes the arp_tx_packet buffer to be used to store the waiting packet
> to be sent, and use the normal net_tx_packet buffer to send ARP request
> instead.
>
> Signed-off-by: Tran Tien Dat 

Seems good, thanks!

Acked-by: Joe Hershberger 

> ---
>
> Changes in v2:
> - Provide more detailed description
>
>  net/arp.c | 18 ++
>  net/arp.h |  1 +
>  net/net.c |  3 +++
>  3 files changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/net/arp.c b/net/arp.c
> index b8a71684cd..f5e2c0b0cf 100644
> --- a/net/arp.c
> +++ b/net/arp.c
> @@ -35,8 +35,8 @@ int   arp_wait_tx_packet_size;
>  ulong  arp_wait_timer_start;
>  intarp_wait_try;
>
> -static uchar   *arp_tx_packet; /* THE ARP transmit packet */
> -static uchar   arp_tx_packet_buf[PKTSIZE_ALIGN + PKTALIGN];
> +uchar   *arp_wait_tx_packet;   /* THE waiting transmit packet after ARP */
> +static uchar   arp_wait_tx_packet_buf[PKTSIZE_ALIGN + PKTALIGN];
>
>  void arp_init(void)
>  {
> @@ -45,8 +45,8 @@ void arp_init(void)
> net_arp_wait_packet_ip.s_addr = 0;
> net_arp_wait_reply_ip.s_addr = 0;
> arp_wait_tx_packet_size = 0;
> -   arp_tx_packet = &arp_tx_packet_buf[0] + (PKTALIGN - 1);
> -   arp_tx_packet -= (ulong)arp_tx_packet % PKTALIGN;
> +   arp_wait_tx_packet = &arp_wait_tx_packet_buf[0] + (PKTALIGN - 1);
> +   arp_wait_tx_packet -= (ulong)arp_wait_tx_packet % PKTALIGN;
>  }
>
>  void arp_raw_request(struct in_addr source_ip, const uchar *target_ethaddr,
> @@ -58,7 +58,7 @@ void arp_raw_request(struct in_addr source_ip, const uchar 
> *target_ethaddr,
>
> debug_cond(DEBUG_DEV_PKT, "ARP broadcast %d\n", arp_wait_try);
>
> -   pkt = arp_tx_packet;
> +   pkt = net_tx_packet;
>
> eth_hdr_size = net_set_ether(pkt, net_bcast_ethaddr, PROT_ARP);
> pkt += eth_hdr_size;
> @@ -76,7 +76,7 @@ void arp_raw_request(struct in_addr source_ip, const uchar 
> *target_ethaddr,
> memcpy(&arp->ar_tha, target_ethaddr, ARP_HLEN); /* target ET addr */
> net_write_ip(&arp->ar_tpa, target_ip);  /* target IP addr */
>
> -   net_send_packet(arp_tx_packet, eth_hdr_size + ARP_HDR_SIZE);
> +   net_send_packet(net_tx_packet, eth_hdr_size + ARP_HDR_SIZE);
>  }
>
>  void arp_request(void)
> @@ -217,9 +217,11 @@ void arp_receive(struct ethernet_hdr *et, struct 
> ip_udp_hdr *ip, int len)
>
> /* set the mac address in the waiting packet's header
>and transmit it */
> -   memcpy(((struct ethernet_hdr 
> *)net_tx_packet)->et_dest,
> +   memcpy(((struct ethernet_hdr *)arp_wait_tx_packet)
> +   ->et_dest,
>&arp->ar_sha, ARP_HLEN);
> -   net_send_packet(net_tx_packet, 
> arp_wait_tx_packet_size);
> +   net_send_packet(arp_wait_tx_packet,
> +   arp_wait_tx_packet_size);
>
> /* no arp request pending now */
> net_arp_wait_packet_ip.s_addr = 0;
> diff --git a/net/arp.h b/net/arp.h
> index afb86958f3..65d73927a7 100644
> --- a/net/arp.h
> +++ b/net/arp.h
> @@ -20,6 +20,7 @@ extern uchar *arp_wait_packet_ethaddr;
>  extern int arp_wait_tx_packet_size;
>  extern ulong arp_wait_timer_start;
>  extern int arp_wait_try;
> +extern uchar *arp_wait_tx_packet;
>
>  void arp_init(void);
>  void arp_request(void);
> diff --git a/net/net.c b/net/net.c
> index f35695b4fc..6325ad3e1a 100644
> --- a/net/net.c
> +++ b/net/net.c
> @@ -836,6 +836,9 @@ int net_send_udp_packet(uchar *ether, struct in_addr 
> dest, int dport, int sport,
>
> /* size of the waiting packet */
> arp_wait_tx_packet_size = pkt_hdr_size + payload_len

Re: [U-Boot] [PATCH v3 7/7] cmd: Add bind/unbind commands to bind a device to a driver from the command line

2018-07-09 Thread Joe Hershberger
On Mon, Jul 9, 2018 at 9:43 AM, Tom Rini  wrote:
> On Mon, Jul 09, 2018 at 08:19:44AM +0200, Michal Simek wrote:
>> On 30.6.2018 06:19, Simon Glass wrote:
>> > On 27 June 2018 at 07:13, Michal Simek  wrote:
>> >> On 22.6.2018 14:25, Jean-Jacques Hiblot wrote:
>> >>> In some cases it can be useful to be able to bind a device to a driver 
>> >>> from
>> >>> the command line.
>> >>> The obvious example is for versatile devices such as USB gadget.
>> >>> Another use case is when the devices are not yet ready at startup and
>> >>> require some setup before the drivers are bound (ex: FPGA which bitsream 
>> >>> is
>> >>> fetched from a mass storage or ethernet)
>> >>>
>> >>> usage example:
>> >>>
>> >>> bind usb_dev_generic 0 usb_ether
>> >>> unbind usb_dev_generic 0 usb_ether
>> >>> or
>> >>> unbind eth 1
>> >>>
>> >>> bind /ocp/omap_dwc3@4838/usb@4839 usb_ether
>> >>> unbind /ocp/omap_dwc3@4838/usb@4839
>> >>>
>> >>> Signed-off-by: Jean-Jacques Hiblot 
>> >>>
>> >>> ---
>> >>>
>> >>> Changes in v3:
>> >>> - factorize code based on comments from ML
>> >>> - remove the devices before unbinding them
>> >>> - use device_find_global_by_ofnode() to get a device by its node.
>> >>> - Added tests
>> >>>
>> >>> Changes in v2:
>> >>> - Make the bind/unbind command generic, not specific to usb device.
>> >>> - Update the API to be able to bind/unbind based on DTS node path
>> >>> - Add a Kconfig option to select the bind/unbind commands
>> >>>
>> >>>  arch/sandbox/dts/test.dts  |  11 ++
>> >>>  cmd/Kconfig|   9 ++
>> >>>  cmd/Makefile   |   1 +
>> >>>  cmd/bind.c | 255 
>> >>> +
>> >>>  configs/sandbox_defconfig  |   1 +
>> >>>  test/py/tests/test_bind.py | 178 +++
>> >>>  6 files changed, 455 insertions(+)
>> >>>  create mode 100644 cmd/bind.c
>> >>>  create mode 100644 test/py/tests/test_bind.py
>> >
>> > Reviewed-by: Simon Glass 
>> >
>> > Nice work
>> >
>> > [...]
>> >
>> >>
>> >> I have tested bind/unbind with dwc3 on zynqmp for ethernet gadget and it
>> >> is working fine for me.
>> >> I have also tried to use bind/unbind for gpio zynqmp driver and it is
>> >> also working fine.
>> >>
>> >> It means
>> >> Tested-by: Michal Simek 
>> >>
>> >> I would prefer if these commands are called as dm bind and dm unbind
>> >> instead of simply bind/unbind which should also fit to dm command
>> >> description "dm - Driver model low level access".
>> >
>> > Yes i can see the point. But after thinking about it, maybe it is best
>> > as it is? After all driver model is fundamental to U-Boot and it's not
>> > clear what else we might bind/unbind.
>> >
>> > I'd like to get other opinions here, too.
>>
>> Tom/Marek: Any opinion?
>
> I think dm bind/unbind makes sense, yes.  "bind" and "unbind" are pretty
> generic terms and making it clear it's part of working "inside" of DM to
> hook/unhook things by making it a sub-command of dm sounds good.
> Thanks!

I agree with Simon here. I think bind and unbind won't have any
plausible other meaning in U-Boot and DM is core to U-Boot
functionality in the new world. I think it would be OK to have "dm
bind" alias to "bind" if that's a point of confusion, but having it
top-level seems good to me.

-Joe

> --
> Tom
>
> ___
> 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


[U-Boot] [PATCH v6 1/6] env: add the same prefix to error messages to make it detectable by tests

2018-07-09 Thread Quentin Schulz
The error message should start with `## Error: ` so that it's easily
detectable by tests without needing to have a complex regexp for
matching all possible error message patterns.

Let's add the `## Error: ` prefix to the error messages since it's the
one already in use.

Suggested-by: Stephen Warren 
Signed-off-by: Quentin Schulz 
Reviewed-by: Simon Glass 
Reviewed-by: Stephen Warren 
Tested-by: Stephen Warren 
---

added in v5

 cmd/nvedit.c | 12 
 env/common.c |  3 ++-
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/cmd/nvedit.c b/cmd/nvedit.c
index ddc888a..70d7068 100644
--- a/cmd/nvedit.c
+++ b/cmd/nvedit.c
@@ -959,7 +959,8 @@ NXTARG: ;
H_MATCH_KEY | H_MATCH_IDENT,
&ptr, size, argc, argv);
if (len < 0) {
-   pr_err("Cannot export environment: errno = %d\n", 
errno);
+   pr_err("## Error: Cannot export environment: errno = 
%d\n",
+  errno);
return 1;
}
sprintf(buf, "%zX", (size_t)len);
@@ -979,7 +980,8 @@ NXTARG: ;
H_MATCH_KEY | H_MATCH_IDENT,
&res, ENV_SIZE, argc, argv);
if (len < 0) {
-   pr_err("Cannot export environment: errno = %d\n", errno);
+   pr_err("## Error: Cannot export environment: errno = %d\n",
+  errno);
return 1;
}
 
@@ -994,7 +996,8 @@ NXTARG: ;
return 0;
 
 sep_err:
-   printf("## %s: only one of \"-b\", \"-c\" or \"-t\" allowed\n", cmd);
+   printf("## Error: %s: only one of \"-b\", \"-c\" or \"-t\" allowed\n",
+  cmd);
return 1;
 }
 #endif
@@ -1114,7 +1117,8 @@ static int do_env_import(cmd_tbl_t *cmdtp, int flag,
 
if (himport_r(&env_htab, ptr, size, sep, del ? 0 : H_NOCLEAR,
crlf_is_lf, 0, NULL) == 0) {
-   pr_err("Environment import failed: errno = %d\n", errno);
+   pr_err("## Error: Environment import failed: errno = %d\n",
+  errno);
return 1;
}
gd->flags |= GD_FLG_ENV_READY;
diff --git a/env/common.c b/env/common.c
index dc8a14f..7bd2790 100644
--- a/env/common.c
+++ b/env/common.c
@@ -83,7 +83,8 @@ void set_default_env(const char *s)
if (himport_r(&env_htab, (char *)default_environment,
sizeof(default_environment), '\0', flags, 0,
0, NULL) == 0)
-   pr_err("Environment import failed: errno = %d\n", errno);
+   pr_err("## Error: Environment import failed: errno = %d\n",
+  errno);
 
gd->flags |= GD_FLG_ENV_READY;
gd->flags |= GD_FLG_ENV_DEFAULT;

base-commit: 22d58e60ffb5484d912f26b9c3533eff1d3d3de9
-- 
git-series 0.9.1
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v6 2/6] test/py: return a RAM address different from 0 as it can be interpreted as NULL

2018-07-09 Thread Quentin Schulz
Some functions test that the given address is not NULL (0) and fail or
have a different behaviour if that's the case (e.g. hexport_r).

Let's make the RAM base address to be not zero by setting it to 2MiB if
that's the case.

2MiB is chosen because it represents the size of an ARM LPAE/v8 section.

Suggested-by: Stephen Warren 
Signed-off-by: Quentin Schulz 
Reviewed-by: Simon Glass 
Reviewed-by: Stephen Warren 
Tested-by: Stephen Warren 
---

added in v5

 test/py/u_boot_utils.py | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/test/py/u_boot_utils.py b/test/py/u_boot_utils.py
index bb31e57..07520ac 100644
--- a/test/py/u_boot_utils.py
+++ b/test/py/u_boot_utils.py
@@ -236,6 +236,12 @@ def find_ram_base(u_boot_console):
 ram_base = -1
 raise Exception('Failed to find RAM bank start in `bdinfo`')
 
+# We don't want ram_base to be zero as some functions test if the given
+# address is NULL (0). Let's add 2MiB then (size of an ARM LPAE/v8 
section).
+
+if ram_base == 0:
+ram_base += 1024 * 1024 * 2
+
 return ram_base
 
 class PersistentFileHelperCtxMgr(object):
-- 
git-series 0.9.1
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v6 4/6] hashtable: do not recreate whole hash table if vars are passed to himport_r

2018-07-09 Thread Quentin Schulz
When vars are passed to the himport_r function with H_NOCLEAR flag,
those vars will be overridden in the current environment and if one of
those vars is not in the imported environment, it'll be deleted in the
current environment whatever the flag passed to himport_r.

The H_NOCLEAR flag is used to clear the whole environment whether vars
are passed to the function or not.

This leads to incoherent behaviour. If one passes vars to himport_r
with the H_NOCLEAR flag, if a var in vars is not in the imported env,
that var will be removed from the current env.

If one passes vars to himport_r without the H_NOCLEAR flag, the whole
environment will be removed and vars will be imported from the
environment in RAM.

It makes more sense to keep the variable that is in the current
environment but not in the imported environment if the H_NOCLEAR flag is
set and remove only that variable if the H_NOCLEAR flag is not set.

Let's clear the whole environment only if H_NOCLEAR and vars are not
passed to himport_r.

Let's remove variables that are in the current environment but not in
the imported env only if the H_NOCLEAR flag is not passed.

Suggested-by: Wolfgang Denk 
Signed-off-by: Quentin Schulz 
---

added in v6

 lib/hashtable.c | 13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/lib/hashtable.c b/lib/hashtable.c
index 52aab6d..ffaa5b6 100644
--- a/lib/hashtable.c
+++ b/lib/hashtable.c
@@ -749,8 +749,11 @@ static int drop_var_from_set(const char *name, int nvars, 
char * vars[])
  *
  * The "flag" argument can be used to control the behaviour: when the
  * H_NOCLEAR bit is set, then an existing hash table will kept, i. e.
- * new data will be added to an existing hash table; otherwise, old
- * data will be discarded and a new hash table will be created.
+ * new data will be added to an existing hash table; otherwise, if no
+ * vars are passed, old data will be discarded and a new hash table
+ * will be created. If vars are passed, passed vars that are not in
+ * the linear list of "name=value" pairs will be removed from the
+ * current hash table.
  *
  * The separator character for the "name=value" pairs can be selected,
  * so we both support importing from externally stored environment
@@ -801,7 +804,7 @@ int himport_r(struct hsearch_data *htab,
if (nvars)
memcpy(localvars, vars, sizeof(vars[0]) * nvars);
 
-   if ((flag & H_NOCLEAR) == 0) {
+   if ((flag & H_NOCLEAR) == 0 && !nvars) {
/* Destroy old hash table if one exists */
debug("Destroy Hash Table: %p table = %p\n", htab,
   htab->table);
@@ -933,6 +936,9 @@ int himport_r(struct hsearch_data *htab,
debug("INSERT: free(data = %p)\n", data);
free(data);
 
+   if (flag & H_NOCLEAR)
+   goto end;
+
/* process variables which were not considered */
for (i = 0; i < nvars; i++) {
if (localvars[i] == NULL)
@@ -951,6 +957,7 @@ int himport_r(struct hsearch_data *htab,
printf("WARNING: '%s' not in imported env, deleting 
it!\n", localvars[i]);
}
 
+end:
debug("INSERT: done\n");
return 1;   /* everything OK */
 }
-- 
git-series 0.9.1
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v6 5/6] cmd: nvedit: env import can now import only variables passed as parameters

2018-07-09 Thread Quentin Schulz
While the `env export` can take as parameters variables to be exported,
`env import` does not have such a mechanism of variable selection.

Let's add the ability to add parameters at the end of the command for
variables to be imported.

Every env variable from the env to be imported passed by parameter to
this command will override the value of the variable in the current env.

If a variable exists in the current env but not in the imported env, if
this variable is passed as a parameter to env import, the variable will
be unset ONLY if the -d option is passed to env import, otherwise the
current value of the variable is kept.

If a variable exists in the imported env, the variable in the current
env will be set to the value of the one from the imported env.

All the remaining variables are left untouched.

As the size parameter of env import is positional but optional, let's
add the possibility to use the sentinel '-' for when we don't want to
give the size parameter (when the env is '\0' terminated) but we pass a
list of variables at the end of the command.

env import addr
env import addr -
env import addr size
env import addr - foo1 foo2
env import addr size foo1 foo2

are all valid.

env import -c addr
env import -c addr -
env import -c addr - foo1 foo2

are all invalid because they don't pass the size parameter required for
checking, while the following are valid.

env import addr size
env import addr size foo1 foo2

Nothing's changed for the other parameters or the overall behaviour.

One of its use case could be to load a secure environment from the
signed U-Boot binary and load only a handful of variables from an
other, unsecure, environment without completely losing control of
U-Boot.

Signed-off-by: Quentin Schulz 
Tested-by: Alex Kiernan 
Tested-by: Stephen Warren 
---

v6:
  - fix commit log and add comment on -d option to reflect changes introduced by
  patch 4,

v4:
  - add tested-by by Alex,

v3:
  - migrate to env import addr size var... instead of env import -w addr
  size so that the list of variables to load is more explicit and the
  behaviour of env import is closer to the one of env export,

v2:
  - use strdup instead of malloc + strcpy,
  - NULL-check the result of strdup,
  - add common exit path for freeing memory in one unique place,
  - store token pointer from strtok within the char** array instead of
  strdup-ing token within elements of array,

 cmd/nvedit.c | 26 +++---
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/cmd/nvedit.c b/cmd/nvedit.c
index 70d7068..5de9d38 100644
--- a/cmd/nvedit.c
+++ b/cmd/nvedit.c
@@ -1004,8 +1004,11 @@ sep_err:
 
 #ifdef CONFIG_CMD_IMPORTENV
 /*
- * env import [-d] [-t [-r] | -b | -c] addr [size]
- * -d: delete existing environment before importing;
+ * env import [-d] [-t [-r] | -b | -c] addr [size] [var ...]
+ * -d: delete existing environment before importing if no var is
+ * passed; if vars are passed, if one var is in the current
+ * environment but not in the environment at addr, delete var from
+ * current environment;
  * otherwise overwrite / append to existing definitions
  * -t: assume text format; either "size" must be given or the
  * text data must be '\0' terminated
@@ -1018,6 +1021,11 @@ sep_err:
  * addr:   memory address to read from
  * size:   length of input data; if missing, proper '\0'
  * termination is mandatory
+ * if var is set and size should be missing (i.e. '\0'
+ * termination), set size to '-'
+ * var...  List of the names of the only variables that get imported from
+ * the environment at address 'addr'. Without arguments, the whole
+ * environment gets imported.
  */
 static int do_env_import(cmd_tbl_t *cmdtp, int flag,
 int argc, char * const argv[])
@@ -1029,6 +1037,7 @@ static int do_env_import(cmd_tbl_t *cmdtp, int flag,
int fmt = 0;
int del = 0;
int crlf_is_lf = 0;
+   int wl = 0;
size_t  size;
 
cmd = *argv;
@@ -1077,9 +1086,9 @@ static int do_env_import(cmd_tbl_t *cmdtp, int flag,
addr = simple_strtoul(argv[0], NULL, 16);
ptr = map_sysmem(addr, 0);
 
-   if (argc == 2) {
+   if (argc >= 2 && strcmp(argv[1], "-")) {
size = simple_strtoul(argv[1], NULL, 16);
-   } else if (argc == 1 && chk) {
+   } else if (chk) {
puts("## Error: external checksum format must pass size\n");
return CMD_RET_FAILURE;
} else {
@@ -1101,6 +1110,9 @@ static int do_env_import(cmd_tbl_t *cmdtp, int flag,
printf("## Info: input data size = %zu = 0x%zX\n", size, size);
}
 
+   if (argc > 2)
+   wl = 1;
+
if (chk) {
uint32_t crc;
env_t *ep = (env_t *)ptr;
@@ -1115,8 +1127,8 @@ static int do_env_impo

[U-Boot] [PATCH v6 3/6] test/py: remove hacks for non-zero RAM base address in tests

2018-07-09 Thread Quentin Schulz
Some functions have different behaviour when the given address is 0
(assumed to be NULL by the function).

find_ram_base() does not return 0 anymore so it's safe to remove those
offsets.

Suggested-by: Stephen Warren 
Signed-off-by: Quentin Schulz 
Reviewed-by: Stephen Warren 
Tested-by: Stephen Warren 
---

added in v5

 test/py/tests/test_efi_loader.py | 2 +-
 test/py/tests/test_net.py| 4 ++--
 test/py/tests/test_tpm2.py   | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/test/py/tests/test_efi_loader.py b/test/py/tests/test_efi_loader.py
index 35bd419..a66c6e6 100644
--- a/test/py/tests/test_efi_loader.py
+++ b/test/py/tests/test_efi_loader.py
@@ -118,7 +118,7 @@ def fetch_tftp_file(u_boot_console, env_conf):
 
 addr = f.get('addr', None)
 if not addr:
-addr = u_boot_utils.find_ram_base(u_boot_console) + (1024 * 1024 * 4)
+addr = u_boot_utils.find_ram_base(u_boot_console)
 
 fn = f['fn']
 output = u_boot_console.run_command('tftpboot %x %s' % (addr, fn))
diff --git a/test/py/tests/test_net.py b/test/py/tests/test_net.py
index f2e432b..2821ce6 100644
--- a/test/py/tests/test_net.py
+++ b/test/py/tests/test_net.py
@@ -146,7 +146,7 @@ def test_net_tftpboot(u_boot_console):
 
 addr = f.get('addr', None)
 if not addr:
-addr = u_boot_utils.find_ram_base(u_boot_console) + (1024 * 1024 * 4)
+addr = u_boot_utils.find_ram_base(u_boot_console)
 
 fn = f['fn']
 output = u_boot_console.run_command('tftpboot %x %s' % (addr, fn))
@@ -186,7 +186,7 @@ def test_net_nfs(u_boot_console):
 
 addr = f.get('addr', None)
 if not addr:
-addr = u_boot_utils.find_ram_base(u_boot_console) + (1024 * 1024 * 4)
+addr = u_boot_utils.find_ram_base(u_boot_console)
 
 fn = f['fn']
 output = u_boot_console.run_command('nfs %x %s' % (addr, fn))
diff --git a/test/py/tests/test_tpm2.py b/test/py/tests/test_tpm2.py
index 01ffb31..ef7b86a 100644
--- a/test/py/tests/test_tpm2.py
+++ b/test/py/tests/test_tpm2.py
@@ -183,7 +183,7 @@ def test_tpm2_pcr_read(u_boot_console):
 """
 
 force_init(u_boot_console)
-ram = u_boot_utils.find_ram_base(u_boot_console) + 1024
+ram = u_boot_utils.find_ram_base(u_boot_console)
 
 read_pcr = u_boot_console.run_command('tpm pcr_read 0 0x%x' % ram)
 output = u_boot_console.run_command('echo $?')
@@ -210,7 +210,7 @@ def test_tpm2_pcr_extend(u_boot_console):
 """
 
 force_init(u_boot_console)
-ram = u_boot_utils.find_ram_base(u_boot_console) + 1024
+ram = u_boot_utils.find_ram_base(u_boot_console)
 
 u_boot_console.run_command('tpm pcr_extend 0 0x%x' % ram)
 output = u_boot_console.run_command('echo $?')
-- 
git-series 0.9.1
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v6 6/6] test/py: add test for whitelist of variables while importing environment

2018-07-09 Thread Quentin Schulz
This tests that the importing of an environment with a specified
whitelist works as intended.

If there are variables passed as parameter to the env import command,
those only should be imported in the current environment.

For each variable passed as parameter, if
 - foo is bar in current env and bar2 in exported env, after importing
 exported env, foo shall be bar2,
 - foo does not exist in current env and foo is bar2 in exported env,
 after importing exported env, foo shall be bar2,
 - foo is bar in current env and does not exist in exported env (but is
 passed as parameter), after importing exported env, foo shall be empty
 ONLY if the -d option is passed to env import, otherwise foo shall be
 bar,

Any variable not passed as parameter should be left untouched.

Two other tests are made to test that size cannot be '-' if the checksum
protection is enabled.

Signed-off-by: Quentin Schulz 
Reviewed-by: Simon Glass 
Reviewed-by: Stephen Warren 
Tested-by: Stephen Warren 
---

v6:
  - fix commit log to reflect changes introduced by patch 4,
  - fix existing test to reflect changes introduced by patch 4,
  - add test to test env import with the -d option,
  - undo what's done in the test at the end of it so we have a clean
  environment,

v5:
  - add reviewed-by by Stephen,

v4:
  - add reviewed-by by Simon,
  - fix double quotes instead of simple ones for strings,
  - fix missing space after # starting a comment,

v3:
  - update whitelist test to reflect changes made in patch 1,
  - add two tests for no size parameter passed but checksum protection is
  enabled because I added the possibility to have a sentinel in place of
  size parameter,
  - I intentionally didn't put the Reviewed and Acked-by of Simon and
  Stephen since the code changed since v2,

added in v2

 test/py/tests/test_env.py | 97 -
 1 file changed, 97 insertions(+)

diff --git a/test/py/tests/test_env.py b/test/py/tests/test_env.py
index bfb5fc0..9bdaef9 100644
--- a/test/py/tests/test_env.py
+++ b/test/py/tests/test_env.py
@@ -5,6 +5,7 @@
 # Test operation of shell commands relating to environment variables.
 
 import pytest
+import u_boot_utils
 
 # FIXME: This might be useful for other tests;
 # perhaps refactor it into ConsoleBase or some other state object?
@@ -239,3 +240,99 @@ def test_env_expansion_spaces(state_test_env):
 unset_var(state_test_env, var_space)
 if var_test:
 unset_var(state_test_env, var_test)
+
+@pytest.mark.buildconfigspec('cmd_importenv')
+def test_env_import_checksum_no_size(state_test_env):
+"""Test that omitted ('-') size parameter with checksum validation fails 
the
+   env import function.
+"""
+c = state_test_env.u_boot_console
+ram_base = u_boot_utils.find_ram_base(state_test_env.u_boot_console)
+addr = '%08x' % ram_base
+
+with c.disable_check('error_notification'):
+response = c.run_command('env import -c %s -' % addr)
+assert(response == '## Error: external checksum format must pass size')
+
+@pytest.mark.buildconfigspec('cmd_importenv')
+def test_env_import_whitelist_checksum_no_size(state_test_env):
+"""Test that omitted ('-') size parameter with checksum validation fails 
the
+   env import function when variables are passed as parameters.
+"""
+c = state_test_env.u_boot_console
+ram_base = u_boot_utils.find_ram_base(state_test_env.u_boot_console)
+addr = '%08x' % ram_base
+
+with c.disable_check('error_notification'):
+response = c.run_command('env import -c %s - foo1 foo2 foo4' % addr)
+assert(response == '## Error: external checksum format must pass size')
+
+@pytest.mark.buildconfigspec('cmd_exportenv')
+@pytest.mark.buildconfigspec('cmd_importenv')
+def test_env_import_whitelist(state_test_env):
+"""Test importing only a handful of env variables from an environment."""
+c = state_test_env.u_boot_console
+ram_base = u_boot_utils.find_ram_base(state_test_env.u_boot_console)
+addr = '%08x' % ram_base
+
+set_var(state_test_env, 'foo1', 'bar1')
+set_var(state_test_env, 'foo2', 'bar2')
+set_var(state_test_env, 'foo3', 'bar3')
+
+c.run_command('env export %s' % addr)
+
+unset_var(state_test_env, 'foo1')
+set_var(state_test_env, 'foo2', 'test2')
+set_var(state_test_env, 'foo4', 'bar4')
+
+# no foo1 in current env, foo2 overridden, foo3 should be of the value
+# before exporting and foo4 should be of the value before importing.
+c.run_command('env import %s - foo1 foo2 foo4' % addr)
+
+validate_set(state_test_env, 'foo1', 'bar1')
+validate_set(state_test_env, 'foo2', 'bar2')
+validate_set(state_test_env, 'foo3', 'bar3')
+validate_set(state_test_env, 'foo4', 'bar4')
+
+# Cleanup test environment
+unset_var(state_test_env, 'foo1')
+unset_var(state_test_env, 'foo2')
+unset_var(state_test_env, 'foo3')
+unset_var(state_test_env, 'foo4')
+
+@pytest.mark.buildconfigspec('c

Re: [U-Boot] [PATCH v6 1/6] env: add the same prefix to error messages to make it detectable by tests

2018-07-09 Thread Quentin Schulz
Hi all,

This series was tested with Travis:

https://travis-ci.org/QSchulz/u-boot/builds/401644733

I can't explain why 45, 46 and 49 are failing but they have the
following error message:
The command "sudo apt-get install libisl15 -y" failed and exited with
100 during .

It's unrelated to this patch series (happened multiple times without my
patch series) as far as I can tell.

Quentin

On Mon, Jul 09, 2018 at 07:16:25PM +0200, Quentin Schulz wrote:
> The error message should start with `## Error: ` so that it's easily
> detectable by tests without needing to have a complex regexp for
> matching all possible error message patterns.
> 
> Let's add the `## Error: ` prefix to the error messages since it's the
> one already in use.
> 
> Suggested-by: Stephen Warren 
> Signed-off-by: Quentin Schulz 
> Reviewed-by: Simon Glass 
> Reviewed-by: Stephen Warren 
> Tested-by: Stephen Warren 
> ---
> 
> added in v5
> 
>  cmd/nvedit.c | 12 
>  env/common.c |  3 ++-
>  2 files changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/cmd/nvedit.c b/cmd/nvedit.c
> index ddc888a..70d7068 100644
> --- a/cmd/nvedit.c
> +++ b/cmd/nvedit.c
> @@ -959,7 +959,8 @@ NXTARG:   ;
>   H_MATCH_KEY | H_MATCH_IDENT,
>   &ptr, size, argc, argv);
>   if (len < 0) {
> - pr_err("Cannot export environment: errno = %d\n", 
> errno);
> + pr_err("## Error: Cannot export environment: errno = 
> %d\n",
> +errno);
>   return 1;
>   }
>   sprintf(buf, "%zX", (size_t)len);
> @@ -979,7 +980,8 @@ NXTARG:   ;
>   H_MATCH_KEY | H_MATCH_IDENT,
>   &res, ENV_SIZE, argc, argv);
>   if (len < 0) {
> - pr_err("Cannot export environment: errno = %d\n", errno);
> + pr_err("## Error: Cannot export environment: errno = %d\n",
> +errno);
>   return 1;
>   }
>  
> @@ -994,7 +996,8 @@ NXTARG:   ;
>   return 0;
>  
>  sep_err:
> - printf("## %s: only one of \"-b\", \"-c\" or \"-t\" allowed\n", cmd);
> + printf("## Error: %s: only one of \"-b\", \"-c\" or \"-t\" allowed\n",
> +cmd);
>   return 1;
>  }
>  #endif
> @@ -1114,7 +1117,8 @@ static int do_env_import(cmd_tbl_t *cmdtp, int flag,
>  
>   if (himport_r(&env_htab, ptr, size, sep, del ? 0 : H_NOCLEAR,
>   crlf_is_lf, 0, NULL) == 0) {
> - pr_err("Environment import failed: errno = %d\n", errno);
> + pr_err("## Error: Environment import failed: errno = %d\n",
> +errno);
>   return 1;
>   }
>   gd->flags |= GD_FLG_ENV_READY;
> diff --git a/env/common.c b/env/common.c
> index dc8a14f..7bd2790 100644
> --- a/env/common.c
> +++ b/env/common.c
> @@ -83,7 +83,8 @@ void set_default_env(const char *s)
>   if (himport_r(&env_htab, (char *)default_environment,
>   sizeof(default_environment), '\0', flags, 0,
>   0, NULL) == 0)
> - pr_err("Environment import failed: errno = %d\n", errno);
> + pr_err("## Error: Environment import failed: errno = %d\n",
> +errno);
>  
>   gd->flags |= GD_FLG_ENV_READY;
>   gd->flags |= GD_FLG_ENV_DEFAULT;
> 
> base-commit: 22d58e60ffb5484d912f26b9c3533eff1d3d3de9
> -- 
> git-series 0.9.1


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] net: phy: ti: Modify to support livetree

2018-07-09 Thread Grygorii Strashko



On 07/06/2018 05:10 AM, Siva Durga Prasad Paladugu wrote:

This patch adds support for livetree by using
dev_.. calls instead of fdtdec_..

Signed-off-by: Siva Durga Prasad Paladugu 
---
  drivers/net/phy/ti.c | 16 +++-
  1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/net/phy/ti.c b/drivers/net/phy/ti.c
index 8f3ed8a..945d9e9 100644
--- a/drivers/net/phy/ti.c
+++ b/drivers/net/phy/ti.c
@@ -173,24 +173,22 @@ static int dp83867_of_init(struct phy_device *phydev)
  {
struct dp83867_private *dp83867 = phydev->priv;
struct udevice *dev = phydev->dev;
-   int node = dev_of_offset(dev);
const void *fdt = gd->fdt_blob;
  
-	if (fdtdec_get_bool(fdt, node, "ti,max-output-impedance"))

+   if (dev_read_bool(dev, "ti,max-output-impedance"))
dp83867->io_impedance = DP83867_IO_MUX_CFG_IO_IMPEDANCE_MAX;
-   else if (fdtdec_get_bool(fdt, node, "ti,min-output-impedance"))
+   else if (dev_read_bool(dev, "ti,min-output-impedance"))
dp83867->io_impedance = DP83867_IO_MUX_CFG_IO_IMPEDANCE_MIN;
else
dp83867->io_impedance = -EINVAL;
  
-	dp83867->rx_id_delay = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),

-"ti,rx-internal-delay", -1);
+   dp83867->rx_id_delay = dev_read_u32_default(dev, "ti,rx-internal-delay",
+   -1);
  
-	dp83867->tx_id_delay = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),

-"ti,tx-internal-delay", -1);
+   dp83867->tx_id_delay = dev_read_u32_default(dev, "ti,tx-internal-delay",
+   -1);
  
-	dp83867->fifo_depth = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),

-"ti,fifo-depth", -1);
+   dp83867->fifo_depth = dev_read_u32_default(dev, "ti,fifo-depth", -1);
  
  	return 0;

  }



NACK. Pls, check
https://patchwork.ozlabs.org/cover/936370/
and
https://patchwork.ozlabs.org/cover/936380/

any comments, tested-by are very welcome.

--
regards,
-grygorii
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 2/3] net: phy: xilinx_phy: Add suuport for livetree

2018-07-09 Thread Grygorii Strashko



On 07/06/2018 05:10 AM, Siva Durga Prasad Paladugu wrote:

This patch adds support for livetree by using dev_..
calls instead of fdtdec_.. .

Signed-off-by: Siva Durga Prasad Paladugu 
---
  drivers/net/phy/xilinx_phy.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/xilinx_phy.c b/drivers/net/phy/xilinx_phy.c
index 004cfcf..2e2a5cd 100644
--- a/drivers/net/phy/xilinx_phy.c
+++ b/drivers/net/phy/xilinx_phy.c
@@ -103,8 +103,8 @@ static int xilinxphy_of_init(struct phy_device *phydev)
u32 phytype;
  
  	debug("%s\n", __func__);

-   phytype = fdtdec_get_int(gd->fdt_blob, dev_of_offset(phydev->dev),
-"xlnx,phy-type", -1);
+   phytype = dev_read_u32_default(phydev->dev,
+  "xlnx,phy-type", -1);
if (phytype == XAE_PHY_TYPE_1000BASE_X)
phydev->flags |= XAE_PHY_TYPE_1000BASE_X;
  



The same. NACK. Pls, check
https://patchwork.ozlabs.org/cover/936370/
and
https://patchwork.ozlabs.org/cover/936380/

any comments, tested-by are very welcome.


--
regards,
-grygorii
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] tegra: p2771: Add CONFIG_EFI_LOADER_BOUNCE_BUFFER

2018-07-09 Thread Stephen Warren

On 07/06/2018 04:12 AM, Peter Robinson wrote:

The Jetson TX2 needs EFI loader bounce buffer enabled otherwise grub doesn't see
the storage when it loads.


I suspect the need for this option is imposed by the SoC HW not the 
board design? If so, shouldn't the SoC Kconfig symbol select this EFI 
bounce buffer Kconfig symbol?

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] ARM: dts: socfpga: Adjust NAND register layout on Arria10

2018-07-09 Thread Dinh Nguyen


On 05/29/2018 11:36 AM, Marek Vasut wrote:
> Adjust the NAND register size on Arria10 to reflect reality.
> 
> Signed-off-by: Marek Vasut 
> Cc: Chin Liang See 
> Cc: Dinh Nguyen 
> ---
>  arch/arm/dts/socfpga_arria10.dtsi | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/dts/socfpga_arria10.dtsi 
> b/arch/arm/dts/socfpga_arria10.dtsi
> index b51febda9c..2f935a21e9 100644
> --- a/arch/arm/dts/socfpga_arria10.dtsi
> +++ b/arch/arm/dts/socfpga_arria10.dtsi
> @@ -637,8 +637,8 @@
>   #address-cells = <1>;
>   #size-cells = <1>;
>   compatible = "denali,denali-nand-dt", 
> "altr,socfpga-denali-nand";
> - reg = <0xffb9 0x72000>,
> -   <0xffb8 0x1>;
> + reg = <0xffb9 0x20>,
> +   <0xffb8 0x1000>;
>   reg-names = "nand_data", "denali_reg";
>   interrupts = <0 99 4>;
>   dma-mask = <0x>;
> 

Acked-by: Dinh Nguyen 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] tegra: p2771: Add CONFIG_EFI_LOADER_BOUNCE_BUFFER

2018-07-09 Thread Peter Robinson
On Mon, Jul 9, 2018 at 6:41 PM, Stephen Warren  wrote:
> On 07/06/2018 04:12 AM, Peter Robinson wrote:
>>
>> The Jetson TX2 needs EFI loader bounce buffer enabled otherwise grub
>> doesn't see
>> the storage when it loads.
>
>
> I suspect the need for this option is imposed by the SoC HW not the board
> design? If so, shouldn't the SoC Kconfig symbol select this EFI bounce
> buffer Kconfig symbol?

Possibly but all the other devices using this option are setting it in
their configs AFAICT so that's why I went this route, I suspect also
the Jetson X1 might need it too but I've not had time to test that
yet.

Peter
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 5/5] arm: dts: socfpga: stratix10: update pdma

2018-07-09 Thread Dinh Nguyen


On 05/31/2018 03:08 AM, tien.fong.c...@intel.com wrote:
> From: Tien Fong Chee 
> 
> Update pdma properties for Stratix 10
> 
> Signed-off-by: Tien Fong Chee 
> ---
>  arch/arm/dts/socfpga_stratix10.dtsi | 20 
>  1 file changed, 20 insertions(+)
> 
> diff --git a/arch/arm/dts/socfpga_stratix10.dtsi 
> b/arch/arm/dts/socfpga_stratix10.dtsi
> index ccd3f32..311ba09 100644
> --- a/arch/arm/dts/socfpga_stratix10.dtsi
> +++ b/arch/arm/dts/socfpga_stratix10.dtsi
> @@ -82,6 +82,26 @@
>   ranges = <0 0 0 0x>;
>   u-boot,dm-pre-reloc;
>  
> + amba {
> + u-boot,dm-pre-reloc;
> + compatible = "arm,amba-bus";
> + #address-cells = <1>;
> + #size-cells = <1>;
> + ranges;
> +
> + pdma: pdma@ffda {
> + u-boot,dm-pre-reloc;
> + compatible = "arm,pl330", "arm,dma330";

I think you got "arm,dma330" binding wrong. I don't see any binding with
that name.

Dinh
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/2] ARM64: meson: Add 'usb2_phy0' in P212 DT file

2018-07-09 Thread Neil Armstrong
Hi Loic,

On 09/07/2018 17:34, Loic Devulder wrote:
> Enable power supply for USB Amlogic Meson GXL P212 based boards.
> 
> Signed-off-by: Loic Devulder 

We like to keep the u-boot and linux DTS synced, this changed was backported on 
Linux v4.17.5,
can you instead precise you backported the last fix from the 4.17 stable branch 
?

Thanks,
Neil

> ---
>  arch/arm/dts/meson-gxl-s905x-p212.dtsi | 8 
>  1 file changed, 8 insertions(+)
> 
> diff --git a/arch/arm/dts/meson-gxl-s905x-p212.dtsi 
> b/arch/arm/dts/meson-gxl-s905x-p212.dtsi
> index 0cfd701809..4e61ec8f5b 100644
> --- a/arch/arm/dts/meson-gxl-s905x-p212.dtsi
> +++ b/arch/arm/dts/meson-gxl-s905x-p212.dtsi
> @@ -189,3 +189,11 @@
>  &usb0 {
>   status = "okay";
>  };
> +
> +&usb2_phy0 {
> +/*
> + * even though the schematics don't show it:
> + * HDMI_5V is also used as supply for the USB VBUS.
> + */
> +phy-supply = <&hdmi_5v>;
> +};
> 

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 2/2] configs: Update Meson GX configs

2018-07-09 Thread Neil Armstrong
On 09/07/2018 17:34, Loic Devulder wrote:
> Enable ADC support on the Khadas VIM board.
> 
> Signed-off-by: Loic Devulder 
> ---
>  configs/khadas-vim_defconfig | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/configs/khadas-vim_defconfig b/configs/khadas-vim_defconfig
> index 1eb13df4b4..fd1ec8157b 100644
> --- a/configs/khadas-vim_defconfig
> +++ b/configs/khadas-vim_defconfig
> @@ -13,12 +13,15 @@ CONFIG_OF_BOARD_SETUP=y
>  # CONFIG_DISPLAY_BOARDINFO is not set
>  # CONFIG_CMD_BDI is not set
>  # CONFIG_CMD_IMI is not set
> +CONFIG_CMD_ADC=y
>  CONFIG_CMD_GPIO=y
>  # CONFIG_CMD_LOADS is not set
>  CONFIG_CMD_MMC=y
>  CONFIG_CMD_USB=y
>  # CONFIG_CMD_SETEXPR is not set
>  CONFIG_CMD_REGULATOR=y
> +CONFIG_ADC=y
> +CONFIG_SARADC_MESON=y
>  CONFIG_OF_CONTROL=y
>  CONFIG_NET_RANDOM_ETHADDR=y
>  CONFIG_DM_GPIO=y
> 

Acked-by: Neil Armstrong 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [RFC 0/8] i.MX: Add initial CLK support

2018-07-09 Thread Jagan Teki
One of the blocking area where fec_mxc is unlikely
to move dm can be CLK support, this series trying
to add support for it and concentrated on ENET clocking
for i.MX6QDL and i.MX6UL.

I've verified this on i.MX6QDL, but the reason for
sending this is an 'RFC' is there are some quite few
issues with existing fec_mxc driver regarding mdio handling.
The dm vs non-dm code in fec_mxc looks very uncomfortable
to read and add new support, so I would like create one
separate dm driver to make dm related changes if all agree?

know issues:
- CLK driver still using enable_fec_anatop_clock function
  to set the clock, but if we handling this in CLK we need
  anatop via OF_LIVE. will try this next version
- fec_mxc is passing input ref clock, ENET_50MHZ. don't
  know how to make this dynamic, or this based on MII or 
  any other feature, need help.
- ipu_common has legacy clk support, since may boards are using
  ipu_common better to handle this via CLK so-that move to CLK
  become easy and meaningful.  

patch 1, clk/kconfig ordering

patch 2, sample i.MX6QDL DM CLK template

patch 3, 4 Implement ENET clocks for i.MX6QDL and i.MX6UL

patch 5, add generic_clk_valid function

patch 6, add CLK support in fec_mxc.c

patch 7,8 enable CLK support on engicam boards

Jagan Teki (8):
  clk: Kconfig: Ascending order to sub directiory kconfigs
  clk: Add DM CLK driver template for i.MX6QDL
  clk: imx: imx6q: Implement ENET clocks
  clk: imx: imx6ul: Implement ENET clocks
  clk: Add generic_clk_valid
  net: fec_mxc: Add clock support via CLK
  imx6ul: engicam: Enable CLK_IMX
  configs: icorem6_rqs: Enable CLK_IMX

 arch/arm/mach-imx/mx6/Kconfig   |  2 +
 configs/imx6qdl_icore_rqs_defconfig |  1 +
 drivers/clk/Kconfig |  9 +--
 drivers/clk/Makefile|  1 +
 drivers/clk/imx/Kconfig | 25 
 drivers/clk/imx/Makefile|  8 +++
 drivers/clk/imx/clk_imx6q.c | 89 +++
 drivers/clk/imx/clk_imx6ul.c| 95 +
 drivers/net/fec_mxc.c   | 58 ++
 drivers/net/fec_mxc.h   |  6 ++
 drivers/video/ipu_common.c  |  8 +++
 include/clk-uclass.h| 10 +++
 12 files changed, 308 insertions(+), 4 deletions(-)
 create mode 100644 drivers/clk/imx/Kconfig
 create mode 100644 drivers/clk/imx/Makefile
 create mode 100644 drivers/clk/imx/clk_imx6q.c
 create mode 100644 drivers/clk/imx/clk_imx6ul.c

-- 
2.17.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [RFC 1/8] clk: Kconfig: Ascending order to sub directiory kconfigs

2018-07-09 Thread Jagan Teki
sourcing of sub directiory kconfig files are not in
proper order, so keep them in ascending order.

Signed-off-by: Jagan Teki 
---
 drivers/clk/Kconfig | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
index edb4ca58ea..3e66dd97c1 100644
--- a/drivers/clk/Kconfig
+++ b/drivers/clk/Kconfig
@@ -83,12 +83,12 @@ config CLK_STM32MP1
  Enable the STM32 clock (RCC) driver. Enable support for
  manipulating STM32MP1's on-SoC clocks.
 
-source "drivers/clk/tegra/Kconfig"
-source "drivers/clk/uniphier/Kconfig"
-source "drivers/clk/exynos/Kconfig"
 source "drivers/clk/at91/Kconfig"
-source "drivers/clk/renesas/Kconfig"
+source "drivers/clk/exynos/Kconfig"
 source "drivers/clk/mvebu/Kconfig"
+source "drivers/clk/renesas/Kconfig"
+source "drivers/clk/tegra/Kconfig"
+source "drivers/clk/uniphier/Kconfig"
 
 config ICS8N3QV01
bool "Enable ICS8N3QV01 VCXO driver"
-- 
2.17.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [RFC 7/8] imx6ul: engicam: Enable CLK_IMX

2018-07-09 Thread Jagan Teki
CLK support for imx6ul is available, so enable
CLK_IMX for Engicam i.MX6UL boards.

Signed-off-by: Jagan Teki 
---
 arch/arm/mach-imx/mx6/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-imx/mx6/Kconfig b/arch/arm/mach-imx/mx6/Kconfig
index 4410f53b55..4ea43db34c 100644
--- a/arch/arm/mach-imx/mx6/Kconfig
+++ b/arch/arm/mach-imx/mx6/Kconfig
@@ -338,6 +338,7 @@ config TARGET_MX6UL_ENGICAM
select BOARD_LATE_INIT
select MX6UL
select OF_CONTROL
+   select CLK_IMX
select DM
select DM_ETH
select DM_GPIO
-- 
2.17.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [RFC 2/8] clk: Add DM CLK driver template for i.MX6QDL

2018-07-09 Thread Jagan Teki
Add DM CLK driver for iMX6QDL platform.
- basic template for clk_imx6qdl.c
- Kconfig support

Signed-off-by: Jagan Teki 
---
 arch/arm/mach-imx/mx6/Kconfig |  1 +
 drivers/clk/Kconfig   |  1 +
 drivers/clk/Makefile  |  1 +
 drivers/clk/imx/Kconfig   | 18 +
 drivers/clk/imx/Makefile  |  7 
 drivers/clk/imx/clk_imx6q.c   | 76 +++
 drivers/video/ipu_common.c|  8 
 7 files changed, 112 insertions(+)
 create mode 100644 drivers/clk/imx/Kconfig
 create mode 100644 drivers/clk/imx/Makefile
 create mode 100644 drivers/clk/imx/clk_imx6q.c

diff --git a/arch/arm/mach-imx/mx6/Kconfig b/arch/arm/mach-imx/mx6/Kconfig
index 521fad74b5..4410f53b55 100644
--- a/arch/arm/mach-imx/mx6/Kconfig
+++ b/arch/arm/mach-imx/mx6/Kconfig
@@ -257,6 +257,7 @@ config TARGET_MX6Q_ENGICAM
select MX6QDL
select OF_CONTROL
select SPL_OF_LIBFDT
+   select CLK_IMX
select DM
select DM_ETH
select DM_GPIO
diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
index 3e66dd97c1..7404f96dab 100644
--- a/drivers/clk/Kconfig
+++ b/drivers/clk/Kconfig
@@ -85,6 +85,7 @@ config CLK_STM32MP1
 
 source "drivers/clk/at91/Kconfig"
 source "drivers/clk/exynos/Kconfig"
+source "drivers/clk/imx/Kconfig"
 source "drivers/clk/mvebu/Kconfig"
 source "drivers/clk/renesas/Kconfig"
 source "drivers/clk/tegra/Kconfig"
diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
index 426c67db9b..e73a386c5b 100644
--- a/drivers/clk/Makefile
+++ b/drivers/clk/Makefile
@@ -17,6 +17,7 @@ obj-$(CONFIG_CLK_BCM6345) += clk_bcm6345.o
 obj-$(CONFIG_CLK_BOSTON) += clk_boston.o
 obj-$(CONFIG_CLK_EXYNOS) += exynos/
 obj-$(CONFIG_CLK_HSDK) += clk-hsdk-cgu.o
+obj-$(CONFIG_CLK_IMX) += imx/
 obj-$(CONFIG_CLK_RENESAS) += renesas/
 obj-$(CONFIG_CLK_STM32F) += clk_stm32f.o
 obj-$(CONFIG_CLK_STM32MP1) += clk_stm32mp1.o
diff --git a/drivers/clk/imx/Kconfig b/drivers/clk/imx/Kconfig
new file mode 100644
index 00..f8de5554c8
--- /dev/null
+++ b/drivers/clk/imx/Kconfig
@@ -0,0 +1,18 @@
+config CLK_IMX
+   bool "Clock support for i.MX SoCs"
+   depends on ARCH_MX6
+   select CLK
+   help
+ This enables support for common clock driver API on i.MX
+ SoCs.
+
+if CLK_IMX
+
+config CLK_IMX6Q
+   bool "Clock driver for i.MX6QDL"
+   default MX6QDL
+   help
+ This enables common clock driver support for platforms based
+ on i.MX6 QDL SoC.
+
+endif # CLK_IMX
diff --git a/drivers/clk/imx/Makefile b/drivers/clk/imx/Makefile
new file mode 100644
index 00..8ae3a50eba
--- /dev/null
+++ b/drivers/clk/imx/Makefile
@@ -0,0 +1,7 @@
+#
+# Copyright (c) 2018 Arm Ltd.
+#
+# SPDX-License-Identifier:  GPL-2.0+
+#
+
+obj-$(CONFIG_CLK_IMX6Q) += clk_imx6q.o
diff --git a/drivers/clk/imx/clk_imx6q.c b/drivers/clk/imx/clk_imx6q.c
new file mode 100644
index 00..3019218411
--- /dev/null
+++ b/drivers/clk/imx/clk_imx6q.c
@@ -0,0 +1,76 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (C) 2018 Amarula Solutions B.V.
+ * Author: Jagan Teki 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+struct imx6q_clk_priv {
+   void *base;
+};
+
+static ulong imx6q_clk_get_rate(struct clk *clk)
+{
+   debug("%s(#%ld)\n", __func__, clk->id);
+
+   debug("  unhandled\n");
+   return -EINVAL;
+}
+
+static ulong imx6q_clk_set_rate(struct clk *clk, ulong rate)
+{
+   debug("%s(#%ld, rate: %lu)\n", __func__, clk->id, rate);
+
+   debug("  unhandled\n");
+   return -EINVAL;
+}
+
+static int imx6q_clk_enable(struct clk *clk)
+{
+   debug("%s(#%ld)\n", __func__, clk->id);
+
+   debug("  unhandled\n");
+   return -EINVAL;
+}
+
+static struct clk_ops imx6q_clk_ops = {
+   .get_rate = imx6q_clk_get_rate,
+   .set_rate = imx6q_clk_set_rate,
+   .enable = imx6q_clk_enable,
+};
+
+static int imx6q_clk_probe(struct udevice *dev)
+{
+   return 0;
+}
+
+static int imx6q_clk_ofdata_to_platdata(struct udevice *dev)
+{
+   struct imx6q_clk_priv *priv = dev_get_priv(dev);
+
+   priv->base = dev_read_addr_ptr(dev);
+
+   return 0;
+}
+
+static const struct udevice_id imx6q_clk_ids[] = {
+   { .compatible = "fsl,imx6q-ccm" },
+   { }
+};
+
+U_BOOT_DRIVER(fsl_imx6q_ccm) = {
+   .name   = "fsl_imx6q_ccm",
+   .id = UCLASS_CLK,
+   .of_match   = imx6q_clk_ids,
+   .priv_auto_alloc_size   = sizeof(struct imx6q_clk_priv),
+   .ofdata_to_platdata = imx6q_clk_ofdata_to_platdata,
+   .ops= &imx6q_clk_ops,
+   .probe  = imx6q_clk_probe,
+};
diff --git a/drivers/video/ipu_common.c b/drivers/video/ipu_common.c
index cbe1984e4f..9725f76477 100644
--- a/drivers/video/ipu_common.c
+++ b/drivers/video/ipu_common.c
@@ -86,6 +86,7 @@ struct ipu_ch_param {
 #define IPUV3_CLK_MX6Q 26400
 #define IPUV3_CLK_MX6DL19800
 
+#ifndef CONFIG_C

[U-Boot] [RFC 3/8] clk: imx: imx6q: Implement ENET clocks

2018-07-09 Thread Jagan Teki
Add support for ENET clock on i.MX6QDL platform.

Signed-off-by: Jagan Teki 
---
 drivers/clk/imx/clk_imx6q.c | 23 ++-
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/drivers/clk/imx/clk_imx6q.c b/drivers/clk/imx/clk_imx6q.c
index 3019218411..f0cb7ece1f 100644
--- a/drivers/clk/imx/clk_imx6q.c
+++ b/drivers/clk/imx/clk_imx6q.c
@@ -26,18 +26,31 @@ static ulong imx6q_clk_get_rate(struct clk *clk)
 
 static ulong imx6q_clk_set_rate(struct clk *clk, ulong rate)
 {
-   debug("%s(#%ld, rate: %lu)\n", __func__, clk->id, rate);
+   debug("%s(#%ld)\n", __func__, clk->id);
 
-   debug("  unhandled\n");
-   return -EINVAL;
+   switch (clk->id) {
+   case IMX6QDL_CLK_ENET_REF:
+   return enable_fec_anatop_clock(0, rate);
+   default:
+   printf("  unhandled\n");
+   return -ENODEV;
+   }
 }
 
 static int imx6q_clk_enable(struct clk *clk)
 {
+   struct imx6q_clk_priv *priv = dev_get_priv(clk->dev);
+
debug("%s(#%ld)\n", __func__, clk->id);
 
-   debug("  unhandled\n");
-   return -EINVAL;
+   switch (clk->id) {
+   case IMX6QDL_CLK_ENET:
+   setbits_le32(priv->base + 0x6c, GENMASK(11, 10));
+   return 0;
+   default:
+   printf("  unhandled\n");
+   return -ENODEV;
+   }
 }
 
 static struct clk_ops imx6q_clk_ops = {
-- 
2.17.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [RFC 8/8] configs: icorem6_rqs: Enable CLK_IMX

2018-07-09 Thread Jagan Teki
CLK support for imx6qdl is available, so enable
CLK_IMX for Engicam i.CoreM6 QDL RQS boards.

Signed-off-by: Jagan Teki 
---
 configs/imx6qdl_icore_rqs_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/imx6qdl_icore_rqs_defconfig 
b/configs/imx6qdl_icore_rqs_defconfig
index 6fa494a6f9..6036719a31 100644
--- a/configs/imx6qdl_icore_rqs_defconfig
+++ b/configs/imx6qdl_icore_rqs_defconfig
@@ -46,3 +46,4 @@ CONFIG_FEC_MXC=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX6=y
 CONFIG_MXC_UART=y
+CONFIG_CLK_IMX=y
-- 
2.17.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [RFC 4/8] clk: imx: imx6ul: Implement ENET clocks

2018-07-09 Thread Jagan Teki
Add support for ENET clock on i.MX6UL platform.

Signed-off-by: Jagan Teki 
---
 drivers/clk/imx/Kconfig  |  7 +++
 drivers/clk/imx/Makefile |  1 +
 drivers/clk/imx/clk_imx6ul.c | 95 
 3 files changed, 103 insertions(+)
 create mode 100644 drivers/clk/imx/clk_imx6ul.c

diff --git a/drivers/clk/imx/Kconfig b/drivers/clk/imx/Kconfig
index f8de5554c8..cfb9cfe2eb 100644
--- a/drivers/clk/imx/Kconfig
+++ b/drivers/clk/imx/Kconfig
@@ -15,4 +15,11 @@ config CLK_IMX6Q
  This enables common clock driver support for platforms based
  on i.MX6 QDL SoC.
 
+config CLK_IMX6UL
+   bool "Clock driver for i.MX6UL"
+   default MX6UL
+   help
+ This enables common clock driver support for platforms based
+ on i.MX6 UL SoC.
+
 endif # CLK_IMX
diff --git a/drivers/clk/imx/Makefile b/drivers/clk/imx/Makefile
index 8ae3a50eba..67d6f9a19f 100644
--- a/drivers/clk/imx/Makefile
+++ b/drivers/clk/imx/Makefile
@@ -5,3 +5,4 @@
 #
 
 obj-$(CONFIG_CLK_IMX6Q) += clk_imx6q.o
+obj-$(CONFIG_CLK_IMX6UL) += clk_imx6ul.o
diff --git a/drivers/clk/imx/clk_imx6ul.c b/drivers/clk/imx/clk_imx6ul.c
new file mode 100644
index 00..9cf00154e3
--- /dev/null
+++ b/drivers/clk/imx/clk_imx6ul.c
@@ -0,0 +1,95 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (C) 2018 Amarula Solutions B.V.
+ * Author: Jagan Teki 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+struct imx6ul_clk_priv {
+   void *base;
+};
+
+static ulong imx6ul_clk_get_rate(struct clk *clk)
+{
+   debug("%s(#%ld)\n", __func__, clk->id);
+
+   debug("  unhandled\n");
+   return -EINVAL;
+}
+
+static ulong imx6ul_clk_set_rate(struct clk *clk, ulong rate)
+{
+   debug("%s(#%ld)\n", __func__, clk->id);
+
+   switch (clk->id) {
+   case IMX6UL_CLK_ENET_PTP:
+   /* ref clock handling done via IMX6UL_CLK_ENET_REF */
+   clk = NULL;
+   return 0;
+   case IMX6UL_CLK_ENET_REF:
+   return enable_fec_anatop_clock(0, rate);
+   case IMX6UL_CLK_ENET2_REF_125M:
+   return enable_fec_anatop_clock(1, rate);
+   default:
+   printf("  unhandled\n");
+   return -ENODEV;
+   }
+}
+
+static int imx6ul_clk_enable(struct clk *clk)
+{
+   struct imx6ul_clk_priv *priv = dev_get_priv(clk->dev);
+
+   debug("%s(#%ld)\n", __func__, clk->id);
+
+   switch (clk->id) {
+   case IMX6UL_CLK_ENET_AHB:
+   setbits_le32(priv->base + 0x74, GENMASK(5, 4));
+   return 0;
+   default:
+   printf("  unhandled\n");
+   return -ENODEV;
+   }
+}
+
+static struct clk_ops imx6ul_clk_ops = {
+   .get_rate = imx6ul_clk_get_rate,
+   .set_rate = imx6ul_clk_set_rate,
+   .enable = imx6ul_clk_enable,
+};
+
+static int imx6ul_clk_probe(struct udevice *dev)
+{
+   return 0;
+}
+
+static int imx6ul_clk_ofdata_to_platdata(struct udevice *dev)
+{
+   struct imx6ul_clk_priv *priv = dev_get_priv(dev);
+
+   priv->base = dev_read_addr_ptr(dev);
+
+   return 0;
+}
+
+static const struct udevice_id imx6ul_clk_ids[] = {
+   { .compatible = "fsl,imx6ul-ccm" },
+   { }
+};
+
+U_BOOT_DRIVER(fsl_imx6ul_ccm) = {
+   .name   = "fsl_imx6ul_ccm",
+   .id = UCLASS_CLK,
+   .of_match   = imx6ul_clk_ids,
+   .priv_auto_alloc_size   = sizeof(struct imx6ul_clk_priv),
+   .ofdata_to_platdata = imx6ul_clk_ofdata_to_platdata,
+   .ops= &imx6ul_clk_ops,
+   .probe  = imx6ul_clk_probe,
+};
-- 
2.17.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [RFC 6/8] net: fec_mxc: Add clock support via CLK

2018-07-09 Thread Jagan Teki
Now enet clock support available for imx6qdl and imx6ul,
via CLK framework, so add enable, set_rate support in
drivers.

Signed-off-by: Jagan Teki 
---
 drivers/net/fec_mxc.c | 58 +++
 drivers/net/fec_mxc.h |  6 +
 2 files changed, 64 insertions(+)

diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 694a0b2f7e..7998c8b8b2 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -8,6 +8,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1245,6 +1246,41 @@ static int fec_phy_init(struct fec_priv *priv, struct 
udevice *dev)
return 0;
 }
 
+#if CONFIG_IS_ENABLED(CLK)
+static int fec_clk_enable(struct fec_priv *priv)
+{
+   int ret;
+
+   ret = clk_enable(&priv->clk_ahb);
+   if (ret) {
+   printf("failed to enable ahb clk\n");
+   return ret;
+   }
+
+   if (generic_clk_valid(&priv->clk_ptp)) {
+   ret = clk_set_rate(&priv->clk_ptp, ENET_50MHZ);
+   if (ret) {
+   printf("failed to set 50MHz rate to ptp clk\n");
+   goto failed_clk_ahb;
+   }
+   }
+
+   if (generic_clk_valid(&priv->clk_enet_out)) {
+   ret = clk_set_rate(&priv->clk_enet_out, ENET_50MHZ);
+   if (ret) {
+   printf("failed to set 50MHz rate to enet_out clk\n");
+   goto failed_clk_ahb;
+   }
+   }
+
+   return 0;
+
+failed_clk_ahb:
+   clk_disable(&priv->clk_ahb);
+   return ret;
+}
+#endif
+
 static int fecmxc_probe(struct udevice *dev)
 {
struct eth_pdata *pdata = dev_get_platdata(dev);
@@ -1253,6 +1289,12 @@ static int fecmxc_probe(struct udevice *dev)
uint32_t start;
int ret;
 
+#if CONFIG_IS_ENABLED(CLK)
+   ret = fec_clk_enable(priv);
+   if (ret)
+   return ret;
+#endif
+
ret = fec_alloc_descs(priv);
if (ret)
return ret;
@@ -1331,6 +1373,22 @@ static int fecmxc_ofdata_to_platdata(struct udevice *dev)
return -EINVAL;
}
 
+#if CONFIG_IS_ENABLED(CLK)
+   int ret;
+
+   ret = clk_get_by_name(dev, "ahb", &priv->clk_ahb);
+   if (ret)
+   ret = PTR_ERR(&priv->clk_ahb);
+
+   ret = clk_get_by_name(dev, "ptp", &priv->clk_ptp);
+   if (ret)
+   dev_dbg(dev, "Warning: failed to get ptp clk\n");
+
+   ret = clk_get_by_name(dev, "enet_out", &priv->clk_enet_out);
+   if (ret)
+   dev_dbg(dev, "Warning: failed to get enet_out clk\n");
+#endif
+
/* TODO
 * Need to get the reset-gpio and related properties from DT
 * and implemet the enet reset code on .probe call
diff --git a/drivers/net/fec_mxc.h b/drivers/net/fec_mxc.h
index 3b935afe2c..78899e7603 100644
--- a/drivers/net/fec_mxc.h
+++ b/drivers/net/fec_mxc.h
@@ -253,6 +253,12 @@ struct fec_priv {
 
 #ifdef CONFIG_DM_ETH
u32 interface;
+
+#if CONFIG_IS_ENABLED(CLK)
+   struct clk clk_ahb;
+   struct clk clk_ptp;
+   struct clk clk_enet_out;
+#endif
 #endif
 };
 
-- 
2.17.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [RFC 5/8] clk: Add generic_clk_valid

2018-07-09 Thread Jagan Teki
Add clock validate function for validating
specific clock to do further clock operations.

Signed-off-by: Jagan Teki 
---
 include/clk-uclass.h | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/include/clk-uclass.h b/include/clk-uclass.h
index e76d98e2f6..452eed008e 100644
--- a/include/clk-uclass.h
+++ b/include/clk-uclass.h
@@ -100,4 +100,14 @@ struct clk_ops {
int (*disable)(struct clk *clk);
 };
 
+/**
+ * generic_clk_valid() - check if clk port is valid
+ *
+ * @clk:   the clk port to check
+ * @return TRUE if valid, or FALSE
+ */
+static inline bool generic_clk_valid(struct clk *clk)
+{
+   return clk->dev != NULL;
+}
 #endif
-- 
2.17.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] spi: kirkwood: add orion-spi compatible string

2018-07-09 Thread Michael Walle

Am 2018-05-08 00:54, schrieb Chris Packham:

This matches the compatible string used by the Linux kernel. This will
allow u-boot to use the same device tree files.


This patch is still missing to make SPI on kirkwoods work. Is there 
anything missing which prevents it from being applied?


-michael



Signed-off-by: Chris Packham 
---
This applies on top of Jagan's series
http://patchwork.ozlabs.org/project/uboot/list/?series=33927

 drivers/spi/kirkwood_spi.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/spi/kirkwood_spi.c b/drivers/spi/kirkwood_spi.c
index 036fc36b8329..6a5ab8a1cba4 100644
--- a/drivers/spi/kirkwood_spi.c
+++ b/drivers/spi/kirkwood_spi.c
@@ -226,6 +226,10 @@ static int mvebu_spi_ofdata_to_platdata(struct
udevice *bus)
return 0;
 }

+static const struct mvebu_spi_dev orion_spi_dev_data = {
+   .is_errata_50mhz_ac = false,
+};
+
 static const struct mvebu_spi_dev armada_xp_spi_dev_data = {
.is_errata_50mhz_ac = false,
 };
@@ -239,6 +243,10 @@ static const struct mvebu_spi_dev
armada_380_spi_dev_data = {
 };

 static const struct udevice_id mvebu_spi_ids[] = {
+   {
+   .compatible = "marvell,orion-spi",
+   .data = (ulong)&orion_spi_dev_data
+   },
{
.compatible = "marvell,armada-375-spi",
.data = (ulong)&armada_375_spi_dev_data

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 2/2] net: mvgbe: convert to DM

2018-07-09 Thread Michael Walle

Am 2018-07-09 11:34, schrieb Chris Packham:

Add driver model support to the mvgbe driver. As a temporary measure
both DM and non-DM uses are supported. Once all the users have been
converted the non-DM support can be dropped.

Signed-off-by: Chris Packham 


Works for me now, after adding the phy-mode property to my dts ;) Will 
post a patch for lsxl later.


Tested-by: Michael Walle 



---

Changes in v3:
- select PHYLIB (thanks Michael)
- parse phy info from subnode

Changes in v2:
- create __mvgbe_phy_init and mvgbe_alloc_buffers helper functions
- move device tree reads to mvgbe_ofdata_to_platdata

 drivers/net/Kconfig |   1 +
 drivers/net/mvgbe.c | 306 +---
 drivers/net/mvgbe.h |  16 +++
 3 files changed, 275 insertions(+), 48 deletions(-)

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index e88f056d8448..7256d4167666 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -181,6 +181,7 @@ config FTMAC100
 config MVGBE
bool "Marvell Orion5x/Kirkwood network interface support"
depends on KIRKWOOD || ORION5X
+   select PHYLIB if DM_ETH
help
  This driver supports the network interface units in the
  Marvell Orion5x and Kirkwood SoCs
diff --git a/drivers/net/mvgbe.c b/drivers/net/mvgbe.c
index 96ca35512f01..d9d76a8ce0cc 100644
--- a/drivers/net/mvgbe.c
+++ b/drivers/net/mvgbe.c
@@ -12,6 +12,7 @@
  */

 #include 
+#include 
 #include 
 #include 
 #include 
@@ -127,8 +128,12 @@ static int __mvgbe_mdio_read(struct mvgbe_device
*dmvgbe, int phy_adr,
 static int smi_reg_read(struct mii_dev *bus, int phy_adr, int devad,
int reg_ofs)
 {
+#ifdef CONFIG_DM_ETH
+   struct mvgbe_device *dmvgbe = bus->priv;
+#else
struct eth_device *dev = eth_get_dev_by_name(bus->name);
struct mvgbe_device *dmvgbe = to_mvgbe(dev);
+#endif

return __mvgbe_mdio_read(dmvgbe, phy_adr, devad, reg_ofs);
 }
@@ -180,8 +185,12 @@ static int __mvgbe_mdio_write(struct mvgbe_device
*dmvgbe, int phy_adr,
 static int smi_reg_write(struct mii_dev *bus, int phy_adr, int devad,
 int reg_ofs, u16 data)
 {
+#ifdef CONFIG_DM_ETH
+   struct mvgbe_device *dmvgbe = bus->priv;
+#else
struct eth_device *dev = eth_get_dev_by_name(bus->name);
struct mvgbe_device *dmvgbe = to_mvgbe(dev);
+#endif

return __mvgbe_mdio_write(dmvgbe, phy_adr, devad, reg_ofs, data);
 }
@@ -415,11 +424,12 @@ static void mvgbe_init_rx_desc_ring(struct
mvgbe_device *dmvgbe)
dmvgbe->p_rxdesc_curr = dmvgbe->p_rxdesc;
 }

-static int __mvgbe_init(struct mvgbe_device *dmvgbe)
+static int __mvgbe_init(struct mvgbe_device *dmvgbe, u8 *enetaddr)
 {
struct mvgbe_registers *regs = dmvgbe->regs;
 #if (defined(CONFIG_MII) || defined(CONFIG_CMD_MII)) &&  \
!defined(CONFIG_PHYLIB) &&   \
+   !defined(CONFIG_DM_ETH) &&   \
defined(CONFIG_SYS_FAULT_ECHO_LINK_DOWN)
int i;
 #endif
@@ -436,7 +446,7 @@ static int __mvgbe_init(struct mvgbe_device 
*dmvgbe)


set_dram_access(regs);
port_init_mac_tables(regs);
-   port_uc_addr_set(dmvgbe, dmvgbe->dev.enetaddr);
+   port_uc_addr_set(dmvgbe, enetaddr);

/* Assign port configuration and command. */
MVGBE_REG_WR(regs->pxc, PRT_CFG_VAL);
@@ -473,6 +483,7 @@ static int __mvgbe_init(struct mvgbe_device 
*dmvgbe)


 #if (defined(CONFIG_MII) || defined(CONFIG_CMD_MII)) && \
!defined(CONFIG_PHYLIB) && \
+   !defined(CONFIG_DM_ETH) && \
defined(CONFIG_SYS_FAULT_ECHO_LINK_DOWN)
/* Wait up to 5s for the link status */
for (i = 0; i < 5; i++) {
@@ -492,12 +503,14 @@ static int __mvgbe_init(struct mvgbe_device 
*dmvgbe)

return 0;
 }

+#ifndef CONFIG_DM_ETH
 static int mvgbe_init(struct eth_device *dev)
 {
struct mvgbe_device *dmvgbe = to_mvgbe(dev);

-   return __mvgbe_init(dmvgbe);
+   return __mvgbe_init(dmvgbe, dmvgbe->dev.enetaddr);
 }
+#endif

 static void __mvgbe_halt(struct mvgbe_device *dmvgbe)
 {
@@ -524,6 +537,7 @@ static void __mvgbe_halt(struct mvgbe_device 
*dmvgbe)

MVGBE_REG_WR(regs->peim, 0);
 }

+#ifndef CONFIG_DM_ETH
 static int mvgbe_halt(struct eth_device *dev)
 {
struct mvgbe_device *dmvgbe = to_mvgbe(dev);
@@ -532,7 +546,18 @@ static int mvgbe_halt(struct eth_device *dev)

return 0;
 }
+#endif

+#ifdef CONFIG_DM_ETH
+static int mvgbe_write_hwaddr(struct udevice *dev)
+{
+   struct eth_pdata *pdata = dev_get_platdata(dev);
+
+   port_uc_addr_set(dev_get_priv(dev), pdata->enetaddr);
+
+   return 0;
+}
+#else
 static int mvgbe_write_hwaddr(struct eth_device *dev)
 {
struct mvgbe_device *dmvgbe = to_mvgbe(dev);
@@ -541,6 +566,7 @@ static int mvgbe_write_hwaddr(struct eth_device 
*dev)

port_uc_addr_set(dmvgbe, dmvgbe->dev.enetaddr);
return 0;
 }
+#endif

 static int __mvgbe_send(struct mvgbe_device *dmvgbe, voi

[U-Boot] [PATCH 1/2] mips: dbau1x00: Remove this board

2018-07-09 Thread Tom Rini
This platform has been marked as orphan since June of 2016 and should
have been removed some time ago.  Do so now.

Cc: Daniel Schwierzeck 
Signed-off-by: Tom Rini 
---
 arch/mips/Kconfig   |  11 -
 arch/mips/mach-au1x00/au1x00_eth.c  |   5 -
 arch/mips/mach-au1x00/include/mach/au1x00.h |  31 --
 board/dbau1x00/Kconfig  |  46 ---
 board/dbau1x00/MAINTAINERS  |  10 -
 board/dbau1x00/Makefile |   7 -
 board/dbau1x00/README   |  63 ---
 board/dbau1x00/dbau1x00.c   | 118 --
 board/dbau1x00/lowlevel_init.S  | 589 
 configs/dbau1000_defconfig  |  21 -
 configs/dbau1100_defconfig  |  21 -
 configs/dbau1500_defconfig  |  21 -
 configs/dbau1550_defconfig  |  16 -
 configs/dbau1550_el_defconfig   |  17 -
 include/configs/dbau1x00.h  | 172 
 15 files changed, 1148 deletions(-)
 delete mode 100644 board/dbau1x00/Kconfig
 delete mode 100644 board/dbau1x00/MAINTAINERS
 delete mode 100644 board/dbau1x00/Makefile
 delete mode 100644 board/dbau1x00/README
 delete mode 100644 board/dbau1x00/dbau1x00.c
 delete mode 100644 board/dbau1x00/lowlevel_init.S
 delete mode 100644 configs/dbau1000_defconfig
 delete mode 100644 configs/dbau1100_defconfig
 delete mode 100644 configs/dbau1500_defconfig
 delete mode 100644 configs/dbau1550_defconfig
 delete mode 100644 configs/dbau1550_el_defconfig
 delete mode 100644 include/configs/dbau1x00.h

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index d07b92d1b442..d58fcdbd742c 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -51,16 +51,6 @@ config TARGET_VCT
select SYS_MIPS_CACHE_INIT_RAM_LOAD
select ROM_EXCEPTION_VECTORS
 
-config TARGET_DBAU1X00
-   bool "Support dbau1x00"
-   select SUPPORTS_BIG_ENDIAN
-   select SUPPORTS_LITTLE_ENDIAN
-   select SUPPORTS_CPU_MIPS32_R1
-   select SUPPORTS_CPU_MIPS32_R2
-   select SYS_MIPS_CACHE_INIT_RAM_LOAD
-   select ROM_EXCEPTION_VECTORS
-   select MIPS_TUNE_4KC
-
 config TARGET_PB1X00
bool "Support pb1x00"
select SUPPORTS_LITTLE_ENDIAN
@@ -125,7 +115,6 @@ config TARGET_XILFPGA
 
 endchoice
 
-source "board/dbau1x00/Kconfig"
 source "board/imgtec/boston/Kconfig"
 source "board/imgtec/malta/Kconfig"
 source "board/imgtec/xilfpga/Kconfig"
diff --git a/arch/mips/mach-au1x00/au1x00_eth.c 
b/arch/mips/mach-au1x00/au1x00_eth.c
index 84a1f59ba072..ef9be891ec1f 100644
--- a/arch/mips/mach-au1x00/au1x00_eth.c
+++ b/arch/mips/mach-au1x00/au1x00_eth.c
@@ -27,15 +27,10 @@
 #define ETH0_BASE AU1500_ETH0_BASE
 #define MAC0_ENABLE AU1500_MAC0_ENABLE
 #else
-#ifdef CONFIG_SOC_AU1550
-#define ETH0_BASE AU1550_ETH0_BASE
-#define MAC0_ENABLE AU1550_MAC0_ENABLE
-#else
 #error "No valid cpu set"
 #endif
 #endif
 #endif
-#endif
 
 #include 
 #include 
diff --git a/arch/mips/mach-au1x00/include/mach/au1x00.h 
b/arch/mips/mach-au1x00/include/mach/au1x00.h
index e24248997864..1fabcba65d29 100644
--- a/arch/mips/mach-au1x00/include/mach/au1x00.h
+++ b/arch/mips/mach-au1x00/include/mach/au1x00.h
@@ -118,27 +118,6 @@ static __inline__ int au_ffs(int x)
 #define CP0_DEBUG  $23
 
 /* SDRAM Controller */
-#ifdef CONFIG_SOC_AU1550
-
-#define MEM_SDMODE00xB4000800
-#define MEM_SDMODE10xB4000808
-#define MEM_SDMODE20xB4000810
-
-#define MEM_SDADDR00xB4000820
-#define MEM_SDADDR10xB4000828
-#define MEM_SDADDR20xB4000830
-
-#define MEM_SDCONFIGA  0xB4000840
-#define MEM_SDCONFIGB  0xB4000848
-#define MEM_SDPRECMD   0xB40008c0
-#define MEM_SDAUTOREF  0xB40008c8
-
-#define MEM_SDWRMD00xB4000880
-#define MEM_SDWRMD10xB4000888
-#define MEM_SDWRMD20xB4000890
-
-#else /* CONFIG_SOC_AU1550 */
-
 #define MEM_SDMODE00xB400
 #define MEM_SDMODE10xB404
 #define MEM_SDMODE20xB408
@@ -155,8 +134,6 @@ static __inline__ int au_ffs(int x)
 #define MEM_SDWRMD10xB428
 #define MEM_SDWRMD20xB42C
 
-#endif /* CONFIG_SOC_AU1550 */
-
 #define MEM_SDSLEEP0xB430
 #define MEM_SDSMCKE0xB434
 
@@ -483,8 +460,6 @@ static __inline__ int au_ffs(int x)
 #define AU1500_ETH0_BASE 0xB150
 #define AU1500_ETH1_BASE 0xB151
 #define AU1100_ETH0_BASE 0xB050
-#define AU1550_ETH0_BASE 0xB050
-#define AU1550_ETH1_BASE 0xB051
 
 /* 4 byte offsets from AU1000_ETH_BASE */
 #define MAC_CONTROL 0x0
@@ -534,8 +509,6 @@ static __inline__ int au_ffs(int x)
 #define AU1500_MAC0_ENABLE   0xB152
 #define AU1500_MAC1_ENABLE   0xB1520004
 #define AU1100_MAC0_ENABLE   0xB05

[U-Boot] [PATCH 0/8] musb: sunxi: Few fixes/improvements

2018-07-09 Thread Jagan Teki
All these changes mostly related to musb/sunxi.c and 
msub core files with few fixes on sunxi front and
some code improvements on musb while handling shutdown code.

One patch mark it as 'RFC' about "including UCLASS_USB_DEV_GENERIC
into shutdown caller" so expecting some inputs on the same.

patch 1, fix improper musb host pointer

patch 2, musb-new/sunxi allocate phy in private

patch 3, use phy_passby even for PHY#0

patch 4, don't set usb_clk_cfg in PHY probe 

patch 5, update PHY#4 rst_mask for H3_H5

patch 6, shutdown UCLASS_USB_DEV_GENERIC

patch 7, musb-new/sunxi add proper exit

patch 8, call musb_platform_exit from musb_stop

Jagan Teki (8):
  usb: musb-new: Fix improper musb host pointer
  usb: musb-new: sunxi: Allocate struct phy in private
  phy: sun4i-usb: Call phy_passby even for PHY#0
  phy: sun4i-usb: Remove usb_clk_cfg set in probe
  phy: sun4i-usb: Update PHY#3 rst_mask only for H3_H5
  dm: usb: Add UCLASS_USB_DEV_GENERIC shutdown
  usb: musb-new: sunxi: Add proper musb exit support
  usb: musb-new: core: Call musb_platform_exit from musb_stop

 board/compulab/cm_t3517/cm_t3517.c|  4 +-
 drivers/phy/allwinner/phy-sun4i-usb.c |  7 +--
 drivers/usb/host/usb-uclass.c | 43 +++
 drivers/usb/musb-new/musb_core.c  |  1 +
 drivers/usb/musb-new/musb_uboot.c | 10 ++--
 drivers/usb/musb-new/pic32.c  |  6 ++-
 drivers/usb/musb-new/sunxi.c  | 76 +++
 include/linux/usb/musb.h  |  4 +-
 8 files changed, 101 insertions(+), 50 deletions(-)

-- 
2.17.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/8] usb: musb-new: Fix improper musb host pointer

2018-07-09 Thread Jagan Teki
When MUSB is operating in peripheral mode, probe registering
musb core using musb_register which intern return int value
for validation. so there is no scope to preserve struct musb
pointer but the same can be used in .remove musb_stop.
So fix this by return musb_register with struct musb pointer.

Signed-off-by: Jagan Teki 
---
 board/compulab/cm_t3517/cm_t3517.c |  4 ++--
 drivers/usb/musb-new/musb_uboot.c  | 10 +-
 drivers/usb/musb-new/pic32.c   |  6 --
 drivers/usb/musb-new/sunxi.c   |  8 +---
 include/linux/usb/musb.h   |  4 ++--
 5 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/board/compulab/cm_t3517/cm_t3517.c 
b/board/compulab/cm_t3517/cm_t3517.c
index 09cb27def0..668bb7631a 100644
--- a/board/compulab/cm_t3517/cm_t3517.c
+++ b/board/compulab/cm_t3517/cm_t3517.c
@@ -74,8 +74,8 @@ static void cm_t3517_musb_init(void)
CONF2_REFFREQ_13MHZ | CONF2_SESENDEN |
CONF2_VBDTCTEN | CONF2_DATPOL);
 
-   if (musb_register(&cm_t3517_musb_pdata, &cm_t3517_musb_board_data,
- (void *)AM35XX_IPSS_USBOTGSS_BASE))
+   if (!musb_register(&cm_t3517_musb_pdata, &cm_t3517_musb_board_data,
+  (void *)AM35XX_IPSS_USBOTGSS_BASE))
printf("Failed initializing AM35x MUSB!\n");
 }
 #else
diff --git a/drivers/usb/musb-new/musb_uboot.c 
b/drivers/usb/musb-new/musb_uboot.c
index 2b04fbd046..3cd89793c9 100644
--- a/drivers/usb/musb-new/musb_uboot.c
+++ b/drivers/usb/musb-new/musb_uboot.c
@@ -419,8 +419,8 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver 
*driver)
 }
 #endif /* CONFIG_USB_MUSB_GADGET */
 
-int musb_register(struct musb_hdrc_platform_data *plat, void *bdata,
-   void *ctl_regs)
+struct musb *musb_register(struct musb_hdrc_platform_data *plat, void *bdata,
+  void *ctl_regs)
 {
struct musb **musbp;
 
@@ -436,14 +436,14 @@ int musb_register(struct musb_hdrc_platform_data *plat, 
void *bdata,
break;
 #endif
default:
-   return -EINVAL;
+   return NULL;
}
 
*musbp = musb_init_controller(plat, (struct device *)bdata, ctl_regs);
if (!*musbp) {
printf("Failed to init the controller\n");
-   return -EIO;
+   return NULL;
}
 
-   return 0;
+   return *musbp;
 }
diff --git a/drivers/usb/musb-new/pic32.c b/drivers/usb/musb-new/pic32.c
index f04719d7af..3a19900e21 100644
--- a/drivers/usb/musb-new/pic32.c
+++ b/drivers/usb/musb-new/pic32.c
@@ -251,9 +251,11 @@ static int musb_usb_probe(struct udevice *dev)
ret = musb_lowlevel_init(mdata);
 #else
pic32_musb_plat.mode = MUSB_PERIPHERAL;
-   ret = musb_register(&pic32_musb_plat, &pdata->dev, mregs);
+   mdata->host = musb_register(&pic32_musb_plat, &pdata->dev, mregs);
+   if (!mdata->host)
+   return -EIO;
 #endif
-   if (ret == 0)
+   if ((ret == 0) && mdata->host)
printf("PIC32 MUSB OTG\n");
 
return ret;
diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c
index 08de9c69c7..b846afb094 100644
--- a/drivers/usb/musb-new/sunxi.c
+++ b/drivers/usb/musb-new/sunxi.c
@@ -444,9 +444,11 @@ static int musb_usb_probe(struct udevice *dev)
printf("Allwinner mUSB OTG (Host)\n");
 #else
pdata.mode = MUSB_PERIPHERAL;
-   ret = musb_register(&pdata, &glue->dev, base);
-   if (!ret)
-   printf("Allwinner mUSB OTG (Peripheral)\n");
+   host->host = musb_register(&pdata, &glue->dev, base);
+   if (!host->host)
+   return -EIO;
+
+   printf("Allwinner mUSB OTG (Peripheral)\n");
 #endif
 
return ret;
diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h
index 9104414cf0..a31ce67a81 100644
--- a/include/linux/usb/musb.h
+++ b/include/linux/usb/musb.h
@@ -150,7 +150,7 @@ extern int tusb6010_platform_retime(unsigned is_refclk);
 /*
  * U-Boot specfic stuff
  */
-int musb_register(struct musb_hdrc_platform_data *plat, void *bdata,
-   void *ctl_regs);
+struct musb *musb_register(struct musb_hdrc_platform_data *plat, void *bdata,
+  void *ctl_regs);
 
 #endif /* __LINUX_USB_MUSB_H */
-- 
2.17.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 4/8] phy: sun4i-usb: Remove usb_clk_cfg set in probe

2018-07-09 Thread Jagan Teki
usb_clk_cfg is setting CTRL_PHYGATE bit value in probe
which is BIT 0 for sun4i, 6i and 8 for a83t but all
these were handling in phy ops init exit calls.

Signed-off-by: Jagan Teki 
---
 drivers/phy/allwinner/phy-sun4i-usb.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c 
b/drivers/phy/allwinner/phy-sun4i-usb.c
index 01f585a283..3096f12c1c 100644
--- a/drivers/phy/allwinner/phy-sun4i-usb.c
+++ b/drivers/phy/allwinner/phy-sun4i-usb.c
@@ -462,8 +462,6 @@ static int sun4i_usb_phy_probe(struct udevice *dev)
phy->rst_mask = info->rst_mask;
};
 
-   setbits_le32(&data->ccm->usb_clk_cfg, CCM_USB_CTRL_PHYGATE);
-
debug("Allwinner Sun4I USB PHY driver loaded\n");
return 0;
 }
-- 
2.17.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 2/8] usb: musb-new: sunxi: Allocate struct phy in private

2018-07-09 Thread Jagan Teki
Allocate struct phy in private structure instead of allocating
locally and assign it to a pointer. This eventually fix miss
alignment phy which is used in another functions.

Signed-off-by: Jagan Teki 
---
 drivers/usb/musb-new/sunxi.c | 24 +++-
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c
index b846afb094..aa2880eeb9 100644
--- a/drivers/usb/musb-new/sunxi.c
+++ b/drivers/usb/musb-new/sunxi.c
@@ -87,7 +87,7 @@ struct sunxi_glue {
struct sunxi_ccm_reg *ccm;
struct sunxi_musb_config *cfg;
struct device dev;
-   struct phy *phy;
+   struct phy phy;
 };
 #define to_sunxi_glue(d)   container_of(d, struct sunxi_glue, dev)
 
@@ -235,19 +235,19 @@ static int sunxi_musb_enable(struct musb *musb)
musb_writeb(musb->mregs, USBC_REG_o_VEND0, 0);
 
if (is_host_enabled(musb)) {
-   ret = sun4i_usb_phy_vbus_detect(glue->phy);
+   ret = sun4i_usb_phy_vbus_detect(&glue->phy);
if (ret == 1) {
printf("A charger is plugged into the OTG: ");
return -ENODEV;
}
 
-   ret = sun4i_usb_phy_id_detect(glue->phy);
+   ret = sun4i_usb_phy_id_detect(&glue->phy);
if (ret == 1) {
printf("No host cable detected: ");
return -ENODEV;
}
 
-   ret = generic_phy_power_on(glue->phy);
+   ret = generic_phy_power_on(&glue->phy);
if (ret) {
pr_err("failed to power on USB PHY\n");
return ret;
@@ -271,7 +271,7 @@ static void sunxi_musb_disable(struct musb *musb)
return;
 
if (is_host_enabled(musb)) {
-   ret = generic_phy_power_off(glue->phy);
+   ret = generic_phy_power_off(&glue->phy);
if (ret) {
pr_err("failed to power off USB PHY\n");
return;
@@ -291,7 +291,7 @@ static int sunxi_musb_init(struct musb *musb)
 
pr_debug("%s():\n", __func__);
 
-   ret = generic_phy_init(glue->phy);
+   ret = generic_phy_init(&glue->phy);
if (ret) {
pr_err("failed to init USB PHY\n");
return ret;
@@ -330,14 +330,14 @@ static void sunxi_musb_pre_root_reset_end(struct musb 
*musb)
 {
struct sunxi_glue *glue = to_sunxi_glue(musb->controller);
 
-   sun4i_usb_phy_set_squelch_detect(glue->phy, false);
+   sun4i_usb_phy_set_squelch_detect(&glue->phy, false);
 }
 
 static void sunxi_musb_post_root_reset_end(struct musb *musb)
 {
struct sunxi_glue *glue = to_sunxi_glue(musb->controller);
 
-   sun4i_usb_phy_set_squelch_detect(glue->phy, true);
+   sun4i_usb_phy_set_squelch_detect(&glue->phy, true);
 }
 
 static const struct musb_platform_ops sunxi_musb_ops = {
@@ -405,7 +405,6 @@ static int musb_usb_probe(struct udevice *dev)
struct usb_bus_priv *priv = dev_get_uclass_priv(dev);
struct musb_hdrc_platform_data pdata;
void *base = dev_read_addr_ptr(dev);
-   struct phy phy;
int ret;
 
if (!base)
@@ -419,13 +418,12 @@ static int musb_usb_probe(struct udevice *dev)
if (IS_ERR(glue->ccm))
return PTR_ERR(glue->ccm);
 
-   ret = generic_phy_get_by_name(dev, "usb", &phy);
+   ret = generic_phy_get_by_name(dev, "usb", &glue->phy);
if (ret) {
pr_err("failed to get usb PHY\n");
return ret;
}
 
-   glue->phy = &phy;
priv->desc_before_addr = true;
 
memset(&pdata, 0, sizeof(pdata));
@@ -460,8 +458,8 @@ static int musb_usb_remove(struct udevice *dev)
struct musb_host_data *host = &glue->mdata;
int ret;
 
-   if (generic_phy_valid(glue->phy)) {
-   ret = generic_phy_exit(glue->phy);
+   if (generic_phy_valid(&glue->phy)) {
+   ret = generic_phy_exit(&glue->phy);
if (ret) {
pr_err("failed to exit %s USB PHY\n", dev->name);
return ret;
-- 
2.17.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 7/8] usb: musb-new: sunxi: Add proper musb exit support

2018-07-09 Thread Jagan Teki
musb have platform ops to do proper graceful exit,
so add the exit call and move musb platform exit code
instead of keeping it in driver remove.
This make proper shutdown of musb where .remove will
call disable, exit serially via musb_stop.

Signed-off-by: Jagan Teki 
---
 drivers/usb/musb-new/sunxi.c | 48 +---
 1 file changed, 28 insertions(+), 20 deletions(-)

diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c
index aa2880eeb9..9f71b84fd1 100644
--- a/drivers/usb/musb-new/sunxi.c
+++ b/drivers/usb/musb-new/sunxi.c
@@ -326,6 +326,33 @@ static int sunxi_musb_init(struct musb *musb)
return 0;
 }
 
+static int sunxi_musb_exit(struct musb *musb)
+{
+   struct sunxi_glue *glue = to_sunxi_glue(musb->controller);
+   int ret = 0;
+
+   if (generic_phy_valid(&glue->phy)) {
+   ret = generic_phy_exit(&glue->phy);
+   if (ret) {
+   dev_err(dev, "failed to power off usb phy\n");
+   return ret;
+   }
+   }
+
+#ifdef CONFIG_SUNXI_GEN_SUN6I
+   clrbits_le32(&glue->ccm->ahb_reset0_cfg, BIT(AHB_GATE_OFFSET_USB0));
+   if (glue->cfg->rst_bit)
+   clrbits_le32(&glue->ccm->ahb_reset0_cfg,
+BIT(glue->cfg->rst_bit));
+#endif
+   clrbits_le32(&glue->ccm->ahb_gate0, BIT(AHB_GATE_OFFSET_USB0));
+   if (glue->cfg->clkgate_bit)
+   clrbits_le32(&glue->ccm->ahb_gate0,
+BIT(glue->cfg->clkgate_bit));
+
+   return 0;
+}
+
 static void sunxi_musb_pre_root_reset_end(struct musb *musb)
 {
struct sunxi_glue *glue = to_sunxi_glue(musb->controller);
@@ -342,6 +369,7 @@ static void sunxi_musb_post_root_reset_end(struct musb 
*musb)
 
 static const struct musb_platform_ops sunxi_musb_ops = {
.init   = sunxi_musb_init,
+   .exit   = sunxi_musb_exit,
.enable = sunxi_musb_enable,
.disable= sunxi_musb_disable,
.pre_root_reset_end = sunxi_musb_pre_root_reset_end,
@@ -456,29 +484,9 @@ static int musb_usb_remove(struct udevice *dev)
 {
struct sunxi_glue *glue = dev_get_priv(dev);
struct musb_host_data *host = &glue->mdata;
-   int ret;
-
-   if (generic_phy_valid(&glue->phy)) {
-   ret = generic_phy_exit(&glue->phy);
-   if (ret) {
-   pr_err("failed to exit %s USB PHY\n", dev->name);
-   return ret;
-   }
-   }
 
musb_stop(host->host);
 
-#ifdef CONFIG_SUNXI_GEN_SUN6I
-   clrbits_le32(&glue->ccm->ahb_reset0_cfg, BIT(AHB_GATE_OFFSET_USB0));
-   if (glue->cfg->rst_bit)
-   clrbits_le32(&glue->ccm->ahb_reset0_cfg,
-BIT(glue->cfg->rst_bit));
-#endif
-   clrbits_le32(&glue->ccm->ahb_gate0, BIT(AHB_GATE_OFFSET_USB0));
-   if (glue->cfg->clkgate_bit)
-   clrbits_le32(&glue->ccm->ahb_gate0,
-BIT(glue->cfg->clkgate_bit));
-
free(host->host);
host->host = NULL;
 
-- 
2.17.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 5/8] phy: sun4i-usb: Update PHY#3 rst_mask only for H3_H5

2018-07-09 Thread Jagan Teki
Only H3 and H5 have 4 PHYS so restrict rst_mask only for them.

Signed-off-by: Jagan Teki 
---
 drivers/phy/allwinner/phy-sun4i-usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c 
b/drivers/phy/allwinner/phy-sun4i-usb.c
index 3096f12c1c..81fcd1f910 100644
--- a/drivers/phy/allwinner/phy-sun4i-usb.c
+++ b/drivers/phy/allwinner/phy-sun4i-usb.c
@@ -117,7 +117,7 @@ struct sun4i_usb_phy_info {
.gpio_vbus = CONFIG_USB3_VBUS_PIN,
.gpio_vbus_det = NULL,
.gpio_id_det = NULL,
-#ifdef CONFIG_MACH_SUN6I
+#ifdef CONFIG_MACH_SUNXI_H3_H5
.rst_mask = (CCM_USB_CTRL_PHY3_RST | CCM_USB_CTRL_PHY3_CLK),
 #endif
},
-- 
2.17.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 3/8] phy: sun4i-usb: Call phy_passby even for PHY#0

2018-07-09 Thread Jagan Teki
phy_passby is not calling for phy id 0 in legacy code,
which has no information on why it restricted.
Since Linux phy driver doesn't restrict like this,
so call it directly with out any condition

Signed-off-by: Jagan Teki 
---
 drivers/phy/allwinner/phy-sun4i-usb.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c 
b/drivers/phy/allwinner/phy-sun4i-usb.c
index 2b3cf48025..01f585a283 100644
--- a/drivers/phy/allwinner/phy-sun4i-usb.c
+++ b/drivers/phy/allwinner/phy-sun4i-usb.c
@@ -300,8 +300,7 @@ static int sun4i_usb_phy_init(struct phy *phy)
data->cfg->disc_thresh, PHY_DISCON_TH_LEN);
}
 
-   if (usb_phy->id != 0)
-   sun4i_usb_phy_passby(phy, true);
+   sun4i_usb_phy_passby(phy, true);
 
sun4i_usb_phy0_reroute(data, true);
 
-- 
2.17.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 8/8] usb: musb-new: core: Call musb_platform_exit from musb_stop

2018-07-09 Thread Jagan Teki
musb_stop is shutdown code for musb where it call platform and
generic disable. So add platform exit, for proper graceful shutdown.

Signed-off-by: Jagan Teki 
---
 drivers/usb/musb-new/musb_core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/musb-new/musb_core.c b/drivers/usb/musb-new/musb_core.c
index 8fec6f38ad..afea9fbcef 100644
--- a/drivers/usb/musb-new/musb_core.c
+++ b/drivers/usb/musb-new/musb_core.c
@@ -1007,6 +1007,7 @@ void musb_stop(struct musb *musb)
 *  - ...
 */
musb_platform_try_idle(musb, 0);
+   musb_platform_exit(musb);
 }
 
 #ifndef __UBOOT__
-- 
2.17.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH RFC 6/8] dm: usb: Add UCLASS_USB_DEV_GENERIC shutdown

2018-07-09 Thread Jagan Teki
Some OTG controllers which operates on Peripheral
mode are registered as UCLASS_USB_DEV_GENERIC.

So add support to shutdown them as well. shutdown
happened during 'usb reset' and U-Boot handoff code
for Linux boot.

controller restarting in 'usb reset' like probing
again is still missing for this type of UCLASS.

Cc: Simon Glass 
Signed-off-by: Jagan Teki 
---
Note:
I tried of traversing for multiple UCLASS in removal
code in usb_stop, but couldn't come with proper solutions.
I don't think any other area of code need a requirement like
this, or may be I'm missing. any help would appreciate. 

 drivers/usb/host/usb-uclass.c | 43 +++
 1 file changed, 43 insertions(+)

diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c
index 611ea97a72..99cf3d2b49 100644
--- a/drivers/usb/host/usb-uclass.c
+++ b/drivers/usb/host/usb-uclass.c
@@ -158,6 +158,45 @@ int usb_get_max_xfer_size(struct usb_device *udev, size_t 
*size)
return ops->get_max_xfer_size(bus, size);
 }
 
+int __usb_stop(void)
+{
+   struct udevice *bus;
+   struct udevice *rh;
+   struct uclass *uc;
+   struct usb_uclass_priv *uc_priv;
+   int err = 0, ret;
+
+   /* De-activate any devices that have been activated */
+   ret = uclass_get(UCLASS_USB_DEV_GENERIC, &uc);
+   if (ret)
+   return ret;
+
+   uc_priv = uc->priv;
+
+   uclass_foreach_dev(bus, uc) {
+   ret = device_remove(bus, DM_REMOVE_NORMAL);
+   if (ret && !err)
+   err = ret;
+
+   /* Locate root hub device */
+   device_find_first_child(bus, &rh);
+   if (rh) {
+   /*
+* All USB devices are children of root hub.
+* Unbinding root hub will unbind all of its children.
+*/
+   ret = device_unbind(rh);
+   if (ret && !err)
+   err = ret;
+   }
+   }
+
+   uc_priv->companion_device_count = 0;
+   usb_started = 0;
+
+   return err;
+}
+
 int usb_stop(void)
 {
struct udevice *bus;
@@ -166,6 +205,10 @@ int usb_stop(void)
struct usb_uclass_priv *uc_priv;
int err = 0, ret;
 
+   ret = __usb_stop();
+   if (ret)
+   return ret;
+
/* De-activate any devices that have been activated */
ret = uclass_get(UCLASS_USB, &uc);
if (ret)
-- 
2.17.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] sandbox: Don't disable ctrlc() on sandbox if in raw mode

2018-07-09 Thread Joe Hershberger
On Sun, Jul 8, 2018 at 9:39 PM, Simon Glass  wrote:
> Hi Joe,
>
> On 2 July 2018 at 18:06, Joe Hershberger  wrote:
>> In raw mode, handle ctrl-c as normal. This allows normal ctrl-c behavior
>> such as aborting a command that is timing out without completely
>> terminating the sandbox executable.
>>
>> In [1], Simon disabled this.  His reason for it was that it interferes
>> with piping test scripts. Piping should be done in cooked mode, so this
>> change should still not interfere.
>>
>> [1] commit 8969ea3e9f2db04a6b3675 ("sandbox: Disable Ctrl-C")
>>
>> Signed-off-by: Joe Hershberger 
>>
>> ---
>>
>>  common/console.c | 2 --
>>  drivers/serial/sandbox.c | 3 +++
>>  2 files changed, 3 insertions(+), 2 deletions(-)
>
> It is designed so that ctrl-C exits in raw mode. That is the normal
> behaviour for an application and I don't think sandbox should be any
> different.
>
> How about using cooked mode instead?

That seems backward. Only in raw mode (STATE_TERM_RAW) is the console
not interfering with keyboard inputs and changing behaviors based on
interpreting control codes. In raw mode, U-Boot sandbox can handle
things the way it does in real hardware.

To be clear, this is not the default case (STATE_TERM_RAW_WITH_SIGS)
where ctrl-C exits. In fully raw mode (STATE_TERM_RAW), ctrl-C does
absolutely nothing without this patch.

Also, if cooked mode were used, it would once again break the test
script piping that your previous commit talked about. I'm not sure
exactly what that applies to (would it affect Travis such that I can
validate interference?) so I'm not sure I've tested that use-case
effectively.

Thanks,
-Joe
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 01/11] fdt: Add device tree memory bindings

2018-07-09 Thread Simon Glass
On 11 June 2018 at 13:07, Simon Glass  wrote:
>
> From: Michael Pratt 
>
> Support a default memory bank, specified in reg, as well as
> board-specific memory banks in subtree board-id nodes.
>
> This allows memory information to be provided in the device tree,
> rather than hard-coded in, which will make it simpler to handle
> similar devices with different memory banks, as the board-id values
> or masks can be used to match devices.
>
> Signed-off-by: Michael Pratt 
> Signed-off-by: Simon Glass 
> Reviewed-by: Vadim Bendebury 
> ---
>
>  doc/device-tree-bindings/memory/memory.txt |  67 +
>  include/asm-generic/global_data.h  |   1 +
>  include/fdt_support.h  |  10 ++
>  include/fdtdec.h   |  38 ++-
>  lib/fdtdec.c   | 109 +
>  5 files changed, 224 insertions(+), 1 deletion(-)
>  create mode 100644 doc/device-tree-bindings/memory/memory.txt

Applied to u-boot-dm
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 02/11] dm: core: Add ofnode function to read a 64-bit int

2018-07-09 Thread Simon Glass
On 11 June 2018 at 13:07, Simon Glass  wrote:
> We have a 32-bit version of this function. Add a 64-bit version as well so
> we can easily read 64-bit ints from the device tree.
>
> Signed-off-by: Simon Glass 
> ---
>
>  drivers/core/of_access.c | 19 +++
>  drivers/core/ofnode.c| 32 
>  include/dm/of_access.h   | 16 
>  include/dm/ofnode.h  | 10 ++
>  4 files changed, 77 insertions(+)
>

Applied to u-boot-dm
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 06/11] log: Add a way to log a return value with a message

2018-07-09 Thread Simon Glass
On 11 June 2018 at 13:07, Simon Glass  wrote:
> It is sometimes useful to show a message when logging an error return
> value, perhaps to add a few details about the problem. Add a function to
> support this.
>
> Signed-off-by: Simon Glass 
> ---
>
>  include/log.h | 8 
>  1 file changed, 8 insertions(+)

Applied to u-boot-dm
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 07/11] dm: core: Add a way to bind a device by ofnode

2018-07-09 Thread Simon Glass
On 11 June 2018 at 13:07, Simon Glass  wrote:
> Add a new device_bind_ofnode() function which can bind a device given its
> ofnode. This allows binding devices more easily with livetree nodes.
>
> Signed-off-by: Simon Glass 
> ---
>
>  drivers/core/device.c| 8 
>  include/dm/device-internal.h | 4 
>  2 files changed, 12 insertions(+)

Applied to u-boot-dm
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 03/11] dm: core: Fix a few ofnode function comments

2018-07-09 Thread Simon Glass
On 11 June 2018 at 13:07, Simon Glass  wrote:
> Tidy up three return-value errors.
>
> Signed-off-by: Simon Glass 
> ---
>
>  include/dm/ofnode.h | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Applied to u-boot-dm
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 04/11] dm: core: Add comments to ofnode_read_resource() functoins

2018-07-09 Thread Simon Glass
On 11 June 2018 at 13:07, Simon Glass  wrote:
> These functions are missing comments. Add some.
>
> Signed-off-by: Simon Glass 
> ---
>
>  include/dm/ofnode.h | 23 +++
>  1 file changed, 23 insertions(+)

Applied to u-boot-dm
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


  1   2   >