Re: [U-Boot] [U-Boot, v2, 6/9] pinctrl: rockchip: Add common rockchip pinctrl driver

2019-01-31 Thread Philipp Tomsich
> Use this driver to fit all Rockchip SOCs and to support
> the desired pinctrl configuration via DTS.
> 
> Signed-off-by: David Wu 
> Acked-by: Heiko Stuebner 
> Reviewed-by: Kever Yang 
> ---
> 
> Changes in v2:
> - Remove px30, rk2928, rk3066*.
> - Split it to multiple files for the relevant per-SoC data structures.
> 
>  drivers/pinctrl/Kconfig   |  91 +-
>  drivers/pinctrl/Makefile  |   2 +-
>  drivers/pinctrl/rockchip/Kconfig  |  17 +
>  drivers/pinctrl/rockchip/Makefile |  19 +-
>  drivers/pinctrl/rockchip/pinctrl-rk3036.c |  65 ++
>  drivers/pinctrl/rockchip/pinctrl-rk3128.c | 155 
>  drivers/pinctrl/rockchip/pinctrl-rk3188.c |  82 ++
>  drivers/pinctrl/rockchip/pinctrl-rk322x.c | 215 +
>  drivers/pinctrl/rockchip/pinctrl-rk3288.c | 157 
>  drivers/pinctrl/rockchip/pinctrl-rk3328.c | 227 +
>  drivers/pinctrl/rockchip/pinctrl-rk3368.c | 116 +++
>  drivers/pinctrl/rockchip/pinctrl-rk3399.c | 193 +
>  .../pinctrl/rockchip/pinctrl-rockchip-core.c  | 788 ++
>  drivers/pinctrl/rockchip/pinctrl-rockchip.h   | 302 +++
>  drivers/pinctrl/rockchip/pinctrl-rv1108.c | 203 +
>  15 files changed, 2532 insertions(+), 100 deletions(-)
>  create mode 100644 drivers/pinctrl/rockchip/Kconfig
>  create mode 100644 drivers/pinctrl/rockchip/pinctrl-rk3036.c
>  create mode 100644 drivers/pinctrl/rockchip/pinctrl-rk3128.c
>  create mode 100644 drivers/pinctrl/rockchip/pinctrl-rk3188.c
>  create mode 100644 drivers/pinctrl/rockchip/pinctrl-rk322x.c
>  create mode 100644 drivers/pinctrl/rockchip/pinctrl-rk3288.c
>  create mode 100644 drivers/pinctrl/rockchip/pinctrl-rk3328.c
>  create mode 100644 drivers/pinctrl/rockchip/pinctrl-rk3368.c
>  create mode 100644 drivers/pinctrl/rockchip/pinctrl-rk3399.c
>  create mode 100644 drivers/pinctrl/rockchip/pinctrl-rockchip-core.c
>  create mode 100644 drivers/pinctrl/rockchip/pinctrl-rockchip.h
>  create mode 100644 drivers/pinctrl/rockchip/pinctrl-rv1108.c
> 

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


Re: [U-Boot] [U-Boot, v2, 4/9] ARM: rockchip: Remove the pinctrl request at rk3288-board-spl

2019-01-31 Thread Philipp Tomsich
> If we use the new pinctrl driver, the pinctrl setup will be done
> by device probe. Remove the pinctrl setup at rk3288-board-spl.
> 
> Signed-off-by: David Wu 
> Reviewed-by: Philipp Tomsich 
> Reviewed-by: Kever Yang 
> ---
> 
> Changes in v2: None
> 
>  arch/arm/mach-rockchip/rk3288-board-spl.c | 79 ---
>  1 file changed, 79 deletions(-)
> 

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


Re: [U-Boot] [PATCH 1/2] cmd: binop: Use new environment api

2019-01-31 Thread Simon Glass
On Mon, 28 Jan 2019 at 01:44, Mario Six  wrote:
>
> Since the binop command was introduced, the environment API was changed.
> Use the new API to make the command work again.
>
> Signed-off-by: Mario Six 
> ---
>  cmd/binop.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>

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


Re: [U-Boot] [PATCH v2 01/17] dm: Fix documentation entry as there is no UCLASS_CLOCK uclass

2019-01-31 Thread Simon Glass
On Thu, 31 Jan 2019 at 02:04, Lukasz Majewski  wrote:
>
> There is no UCLASS_CLOCK uclass defined. Instead we do use the UCLASS_CLK.
>
> Signed-off-by: Lukasz Majewski 
> ---
>
> Changes in v2: None
>
>  include/clk.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

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


Re: [U-Boot] [PATCH v4 1/1] avb: add support for named persistent values

2019-01-31 Thread Simon Glass
Hi Igor,

On Sun, 27 Jan 2019 at 07:34, Igor Opaniuk  wrote:
>
> AVB version 1.1 introduces support for named persistent values
> that must be tamper evident and allows AVB to store arbitrary key-value
> pairs [1].
>
> Introduce implementation of two additional AVB operations
> read_persistent_value()/write_persistent_value() for retrieving/storing
> named persistent values.
>
> Correspondent pull request in the OP-TEE OS project repo [2].
>
> [1]: 
> https://android.googlesource.com/platform/external/avb/+/android-9.0.0_r22
> [2]: https://github.com/OP-TEE/optee_os/pull/2699
>
> Signed-off-by: Igor Opaniuk 
> ---
>
> v4:
> - extend tee sandbox tee driver to support persistent values
> - fix/re-test avb_persistent test on sandbox configuration:
> $ ./test/py/test.py --bd sandbox --build -s -i avb_per
>
> U-Boot 2019.01-06051-gd01806a-dirty (Jan 27 2019 - 11:56:41 +0200)
>
> Model: sandbox
> DRAM:  128 MiB
> MMC:   MMC probed
> MMC probed
> MMC probed
> mmc2: 2 (SD), mmc1: 1 (SD), mmc0: 0 (SD)
> In:serial
> Out:   vidconsole
> Err:   vidconsole
> Model: sandbox
> SCSI:
> Net:   eth0: eth@10002000, eth5: eth@10003000, eth3: sbe5, eth1: eth@10004000
> Hit any key to stop autoboot:  0
> => => avb init 1
> => => avb write_pvalue test value_value
> Wrote 12 bytes
> => => avb read_pvalue test 12
> Read 12 bytes, value = value_value
> =>
> test/py/tests/test_avb.py .
>
> = 464 tests deselected by '-kavb_per' ==
> === 1 passed, 464 deselected in 0.16 seconds ===
>
> v3:
> - fix possible mem lick in avb_read_persistent/avb_write_persistent
> - add additional sanity checks
> - cover avb read_pvalue/write_pvalue commands with python tests
>
> v2:
> - fix output format for avb read_pvalue/write_pvalue commands
> - fix issue with named value buffer size
>
>  cmd/avb.c  |  78 
>  common/avb_verify.c| 125 
> +
>  drivers/tee/sandbox.c  |  80 +
>  include/tee.h  |   2 +
>  include/tee/optee_ta_avb.h |  16 ++
>  test/py/tests/test_avb.py  |  16 ++
>  6 files changed, 317 insertions(+)

This looks OK. My only comment is that the variables at the top of the
sandbox driver should really be in a driver-private data struct, using
priv_auto_alloc_size, etc.

Reviewed-by: Simon Glass 

I'm assuming that this test runs with 'make qcheck'?


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


Re: [U-Boot] [PATCH 1/1] test: provide unit test for memory functions

2019-01-31 Thread Simon Glass
On Tue, 29 Jan 2019 at 23:53, Heinrich Schuchardt  wrote:
>
> Memory functions may have architecture specific implementations. These
> should be tested.
>
> Provide unit tests for memset(), memcpy(), memmove().
>
> Provide a 'ut lib' sub-command to execute the tests.
>
> Signed-off-by: Heinrich Schuchardt 
> ---
> v2
> vary alignment and length of copied or set memory region
> ---
>  include/test/lib.h|  14 +++
>  include/test/suites.h |   1 +
>  test/Kconfig  |   8 ++
>  test/cmd_ut.c |   6 ++
>  test/lib/Makefile |   2 +
>  test/lib/cmd_ut_lib.c |  20 +
>  test/lib/string.c | 194 ++
>  7 files changed, 245 insertions(+)
>  create mode 100644 include/test/lib.h
>  create mode 100644 test/lib/cmd_ut_lib.c
>  create mode 100644 test/lib/string.c
>

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


Re: [U-Boot] [PATCH 2/2] cmd: binop: Use hex2bin

2019-01-31 Thread Simon Glass
On Mon, 28 Jan 2019 at 01:44, Mario Six  wrote:
>
> Use the new hex2bin function in the binop command instead of converting
> the data manually.
>
> Signed-off-by: Mario Six 
> ---
>  cmd/binop.c | 28 +++-
>  1 file changed, 3 insertions(+), 25 deletions(-)

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


Re: [U-Boot] [PATCH v2 02/17] cmd: Do not show frequency for clocks which .get_rate() return error

2019-01-31 Thread Simon Glass
+Stephen

On Thu, 31 Jan 2019 at 02:04, Lukasz Majewski  wrote:
>
> It may happen that some UCLASS_CLK clocks drivers work as a "managers",
> to call other, proper clocks. This situation is present in the iMX{6|8}
> clocks when supporting CONFIG_CLK (and CCF).
>
> To avoid bogus output of "clk dump" we omit clocks which return error
> value - allowing reusing default implementation of this command.
>
> Signed-off-by: Lukasz Majewski 
> ---
>
> Changes in v2: None
>
>  cmd/clk.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)

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


Re: [U-Boot] [PATCH] core: ofnode: Add ofnode_pci_get_devfn()

2019-01-31 Thread Simon Glass
Hi Stefan,

On Tue, 22 Jan 2019 at 02:36, Stefan Roese  wrote:
>
> Hi Simon,
>
> (added Bin, whom I forgot in this PCI patches)
>
> On 21.01.19 19:15, Simon Glass wrote:
> > On Sat, 19 Jan 2019 at 00:46, Stefan Roese  wrote:
> >>
> >> This function will be used by the Marvell Armada XP/38x PCIe driver,
> >> which is moved to DM right now. It's mostly copied from the Linux
> >> version.
> >>
> >> Signed-off-by: Stefan Roese 
> >> Cc: Simon Glass 
> >> ---
> >>   drivers/core/ofnode.c | 12 
> >>   include/dm/ofnode.h   | 11 +++
> >>   2 files changed, 23 insertions(+)
> >
> > The code to do this right now is in pci_uclass_child_post_bind(). Do
> > you think you could break that out into a pci_... function that you
> > can call from your new function?
>
> Sure, I'll give it a try. While working on it, I noticed this difference
> in the current DEVFN usage in this pci_uclass_child_post_bind()
> implementation:
>
> pplat->devfn = addr.phys_hi & 0xff00;
>
> So, pplat->devfn uses bits 15-8 for DEVFN. Linux uses this definition
> instead:
>
> include/uapi/linux/pci.h:
> /*
>   * The PCI interface treats multi-function devices as independent
>   * devices.  The slot/function address of each device is encoded
>   * in a single byte as follows:
>   *
>   * 7:3 = slot
>   * 2:0 = function
>   */
> #define PCI_DEVFN(slot, func)   slot) & 0x1f) << 3) | ((func) & 0x07))
> #define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f)
> #define PCI_FUNC(devfn) ((devfn) & 0x07)
>
> So here devfn uses bits 7-0 instead, which is what the MVEBU PCIe
> driver also expects. Do you know why there is this different
> implementation for devfn here in pci_uclass_child_post_bind()?
> Is this a bug which I should fix by shifting the bits correspondingly?

Yes I think it should be consistent. I hope this is a simple fix and
does not affect the drivers much.

>
> > Also I had a look at the code you wrote that calls this. Ideally we
> > would have the PCIe nodes have their own driver so that driver model
> > will automatically bind them, but I am not sure that is feasible.
>
> IIRC, this approach of the MISC bind function creating the PCI device
> instances for the child nodes was suggested by you when I wrote the
> Marvell MVPP2 ethernet driver (drivers/net/mvpp2.c) a few years ago.

OK. Can these be added to the device tree, or are they bound dynamically?

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


Re: [U-Boot] [PATCH v2 03/17] dm: clk: Define clk_get_parent_rate() for clk operations

2019-01-31 Thread Simon Glass
+Stephen

Hi Lukasz,

On Thu, 31 Jan 2019 at 02:04, Lukasz Majewski  wrote:
>
> This commit adds the clk_get_parent_rate() function, which is responsible
> for getting the rate of parent clock.
> Unfortunately, u-boot's DM support for getting parent is different
> (the parent relationship is in udevice) than the one in common clock
> framework (CCF) in Linux.
>
> To alleviate this problem - the clk_get_parent_rate() function has been
> introduced to clk-uclass.c.
>
> As written in the in-code comment - some clocks do not set clk->id (and
> require it to be set to 0) and hence the standard ckl_{request|get_rate|
> free} API is used.
>
> Signed-off-by: Lukasz Majewski 
> ---
>
> Changes in v2: None
>
>  drivers/clk/clk-uclass.c | 41 +
>  include/clk.h|  9 +
>  2 files changed, 50 insertions(+)

Can we please call this from test/dm/clk.c?

>
> diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
> index 6d7a514006..f1640dda67 100644
> --- a/drivers/clk/clk-uclass.c
> +++ b/drivers/clk/clk-uclass.c
> @@ -340,6 +340,47 @@ ulong clk_get_rate(struct clk *clk)
> return ops->get_rate(clk);
>  }
>
> +ulong clk_get_parent_rate(struct clk *clk)
> +{
> +   const struct clk_ops *ops;
> +   struct udevice *pdev;
> +   struct clk pclk;
> +   ulong rate;
> +   int ret;
> +
> +   debug("%s(clk=%p)\n", __func__, clk);
> +
> +   pdev = clk->dev->parent;

dev_get_parent(clk->dev)

> +   if (!pdev)
> +   return -ENODEV;

Not needed, all devices have parents except the root, which is not in UCLASS_CLK

> +
> +   ops = clk_dev_ops(pdev);
> +   if (!ops->get_rate)
> +   return -ENOSYS;
> +
> +   /*
> +* We do use memset, clk_{request|get_rate|free}
> +* as there are clocks - like the "fixed" ones, which
> +* doesn't posses the clk wrapper struct (just added to
> +* UCLASS_CLK) and explicitly check if clk->id = 0.
> +*
> +* In fact the "clock" resources (like ops, description)
> +* are accessed via udevice structure (pdev - parent's one)
> +*/
> +

drop blank line. Also is that comment wrapped to use the full number of columns?

Also, this seems like a bug that should be fixed?

> +   memset(&pclk, 0, sizeof(pclk));
> +   ret = clk_request(pdev, &pclk);
> +   if (ret) {
> +   printf("%s: pclk: %s request failed!\n", __func__, 
> pdev->name);
> +   return ret;
> +   }
> +
> +   rate = clk_get_rate(&pclk);
> +   clk_free(&pclk);
> +
> +   return rate;
> +}
> +
>  ulong clk_set_rate(struct clk *clk, ulong rate)
>  {
> const struct clk_ops *ops = clk_dev_ops(clk->dev);
> diff --git a/include/clk.h b/include/clk.h
> index f6fbcc6634..8224295ec3 100644
> --- a/include/clk.h
> +++ b/include/clk.h
> @@ -238,6 +238,15 @@ int clk_free(struct clk *clk);
>  ulong clk_get_rate(struct clk *clk);
>
>  /**
> + * clk_get_parent_rate() - Get parent of current clock rate.
> + *
> + * @clk:   A clock struct that was previously successfully requested by
> + * clk_request/get_by_*().
> + * @return clock rate in Hz, or -ve error code.
> + */
> +ulong clk_get_parent_rate(struct clk *clk);
> +
> +/**
>   * clk_set_rate() - Set current clock rate.
>   *
>   * @clk:   A clock struct that was previously successfully requested by
> --
> 2.11.0
>

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


Re: [U-Boot] [PATCH 2/4] fdt: Introduce fdtdec_get_alias_highest_id()

2019-01-31 Thread Simon Glass
Hi Michal,

On Fri, 18 Jan 2019 at 08:13, Michal Simek  wrote:
>
> Find out the highest alias ID used for certain subsystem.
> This call will be used for alocating IDs for i2c buses which are not
> described in DT.
>
> Signed-off-by: Michal Simek 
> ---
>
>  include/fdtdec.h | 13 +
>  lib/fdtdec.c | 33 +
>  2 files changed, 46 insertions(+)
>
> diff --git a/include/fdtdec.h b/include/fdtdec.h
> index f1bcbf837ffb..c2dd87ede226 100644
> --- a/include/fdtdec.h
> +++ b/include/fdtdec.h
> @@ -626,6 +626,19 @@ int fdtdec_get_alias_seq(const void *blob, const char 
> *base, int node,
>  int *seqp);
>
>  /**
> + * Get the highest alias number for susbystem.
> + *
> + * It parses all aliases and find out highest recorded alias for subsystem.
> + * Aliases are of the form  where  is the sequence number.
> + *
> + * @param blob Device tree blob (if NULL, then error is returned)
> + * @param base Base name for alias susbystem (before the number)
> + *
> + * @return 0 highest alias ID, -1 if not found
> + */
> +int fdtdec_get_alias_highest_id(const void *blob, const char *base);
> +
> +/**
>   * Get a property from the /chosen node
>   *
>   * @param blob Device tree blob (if NULL, then NULL is returned)
> diff --git a/lib/fdtdec.c b/lib/fdtdec.c
> index 18663ce6bdac..55811975ef54 100644
> --- a/lib/fdtdec.c
> +++ b/lib/fdtdec.c
> @@ -549,6 +549,39 @@ int fdtdec_get_alias_seq(const void *blob, const char 
> *base, int offset,
> return -ENOENT;
>  }
>
> +int fdtdec_get_alias_highest_id(const void *blob, const char *base)
> +{
> +   int base_len = strlen(base);
> +   int prop_offset;
> +   int aliases;
> +   int max = -1;
> +
> +   debug("Looking for highest alias id for '%s'\n", base);
> +
> +   aliases = fdt_path_offset(blob, "/aliases");
> +   for (prop_offset = fdt_first_property_offset(blob, aliases);
> +prop_offset > 0;
> +prop_offset = fdt_next_property_offset(blob, prop_offset)) {
> +   const char *prop;
> +   const char *name;
> +   int len, val;
> +
> +   prop = fdt_getprop_by_offset(blob, prop_offset, &name, &len);
> +   debug("   - %s, %s\n", name, prop);
> +   if (*prop != '/' || prop[len - 1] ||
> +   strncmp(name, base, base_len))
> +   continue;
> +
> +   val = trailing_strtol(name);
> +   if (val > max) {
> +   debug("Found seq %d\n", val);
> +   max = val;
> +   }
> +   }
> +
> +   return max;

This looks right to me. Can you please add a test that calls this for
a few sandbox aliases?

> +}
> +
>  const char *fdtdec_get_chosen_prop(const void *blob, const char *name)
>  {
> int chosen_node;
> --
> 1.9.1
>

Regards,
Simon


On Fri, 18 Jan 2019 at 08:13, Michal Simek  wrote:
>
> Find out the highest alias ID used for certain subsystem.
> This call will be used for alocating IDs for i2c buses which are not
> described in DT.
>
> Signed-off-by: Michal Simek 
> ---
>
>  include/fdtdec.h | 13 +
>  lib/fdtdec.c | 33 +
>  2 files changed, 46 insertions(+)
>
> diff --git a/include/fdtdec.h b/include/fdtdec.h
> index f1bcbf837ffb..c2dd87ede226 100644
> --- a/include/fdtdec.h
> +++ b/include/fdtdec.h
> @@ -626,6 +626,19 @@ int fdtdec_get_alias_seq(const void *blob, const char 
> *base, int node,
>  int *seqp);
>
>  /**
> + * Get the highest alias number for susbystem.
> + *
> + * It parses all aliases and find out highest recorded alias for subsystem.
> + * Aliases are of the form  where  is the sequence number.
> + *
> + * @param blob Device tree blob (if NULL, then error is returned)
> + * @param base Base name for alias susbystem (before the number)
> + *
> + * @return 0 highest alias ID, -1 if not found
> + */
> +int fdtdec_get_alias_highest_id(const void *blob, const char *base);
> +
> +/**
>   * Get a property from the /chosen node
>   *
>   * @param blob Device tree blob (if NULL, then NULL is returned)
> diff --git a/lib/fdtdec.c b/lib/fdtdec.c
> index 18663ce6bdac..55811975ef54 100644
> --- a/lib/fdtdec.c
> +++ b/lib/fdtdec.c
> @@ -549,6 +549,39 @@ int fdtdec_get_alias_seq(const void *blob, const char 
> *base, int offset,
> return -ENOENT;
>  }
>
> +int fdtdec_get_alias_highest_id(const void *blob, const char *base)
> +{
> +   int base_len = strlen(base);
> +   int prop_offset;
> +   int aliases;
> +   int max = -1;
> +
> +   debug("Looking for highest alias id for '%s'\n", base);
> +
> +   aliases = fdt_path_offset(blob, "/aliases");
> +   for (prop_offset = fdt_first_property_offset(blob, aliases);
> +prop_offset > 0;
> +prop_offset = fdt_next_property_offset(blob, prop_offset)) {
> +  

Re: [U-Boot] [PATCH 8/9] arm: sunxi: Enable DM_MMC

2019-01-31 Thread Simon Glass
On Fri, 18 Jan 2019 at 18:33, Andre Przywara  wrote:
>
> From: Jagan Teki 
>
> Enable DM_MMC for all Allwinner SoCs, this will eventually
> enable BLK.
>
> Also removed DM_MMC enablement in few parts of sunxi
> configurations.
>
> Signed-off-by: Jagan Teki 
> Signed-off-by: Andre Przywara 
> ---
>  arch/arm/Kconfig  | 1 +
>  arch/arm/mach-sunxi/Kconfig   | 1 -
>  configs/Linksprite_pcDuino3_defconfig | 1 -
>  3 files changed, 1 insertion(+), 2 deletions(-)

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


Re: [U-Boot] [PATCH v3] misc: fs_loader: Add support for initializing block device

2019-01-31 Thread Simon Glass
Hi,

On Thu, 24 Jan 2019 at 03:24,  wrote:
>
> From: Tien Fong Chee 
>
> Firmware loader would encounter problem if the block device is accessed
> before initializing it. This patch would adding the support of probing
> block device and initializing block before the block device is accessed by
> firmware loader.
>
> Signed-off-by: Tien Fong Chee 
>
> ---
>
> Changes in v3:
> - Initializing block device through probing the blk device
>
> Changes in v2:
> - Initializing MMC through probing the blk device
> ---
>  drivers/misc/fs_loader.c | 26 ++
>  1 file changed, 26 insertions(+)

Looks good, a few nits below.

Also at some point (separate patch) we really shoud have a test for
UCLASS_FS_FIRMWARE_LOADER,.

>
> diff --git a/drivers/misc/fs_loader.c b/drivers/misc/fs_loader.c
> index 57a14a3..df35ec6 100644
> --- a/drivers/misc/fs_loader.c
> +++ b/drivers/misc/fs_loader.c
> @@ -12,6 +12,7 @@
>  #include 
>  #include 
>  #include 
> +#include 

Can you drop this now?

>  #include 
>
>  DECLARE_GLOBAL_DATA_PTR;
> @@ -252,6 +253,31 @@ static int fs_loader_ofdata_to_platdata(struct udevice 
> *dev)
>
>  static int fs_loader_probe(struct udevice *dev)
>  {
> +#if CONFIG_IS_ENABLED(DM) && CONFIG_IS_ENABLED(BLK)
> +   int ret;
> +   struct device_platdata *plat = dev->platdata;
> +
> +   if (plat->phandlepart.phandle) {
> +   ofnode node = 
> ofnode_get_by_phandle(plat->phandlepart.phandle);
> +

drop extra blank line

> +   struct udevice *parent_dev = NULL;
> +
> +   ret = device_get_global_by_ofnode(node, &parent_dev);
> +

here too


> +   if (!ret) {
> +   struct udevice *dev;
> +
> +   ret = blk_get_from_parent(parent_dev, &dev);
> +   if (ret) {
> +   debug("fs_loader: No block device: %d\n",
> +   ret);
> +
> +   return ret;
> +   }
> +   }
> +   }
> +#endif
> +
> return 0;
>  };
>
> --
> 2.2.0
>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/4 v3] pci: Add pci_get_devfn() to extract devfn from the fdt_pci_addr

2019-01-31 Thread Simon Glass
On Fri, 25 Jan 2019 at 03:52, Stefan Roese  wrote:
>
> This function will be used by the Marvell Armada XP/38x PCIe driver,
> which is moved to DM right now. So let's extract the functionality
> from pci_uclass_child_post_bind() to make it available.
>
> Signed-off-by: Stefan Roese 
> Cc: Simon Glass 
> Cc: Bin Meng 
> ---
> v3:
> - New patch, replaces "[PATCH] core: ofnode: Add ofnode_pci_get_devfn()"
>
>  drivers/pci/pci-uclass.c | 28 +++-
>  include/pci.h| 10 ++
>  2 files changed, 29 insertions(+), 9 deletions(-)

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


Re: [U-Boot] [PATCH 1/4] dm: core: Add of_alias_get_highest_id()

2019-01-31 Thread Simon Glass
Hi Michal,

On Fri, 18 Jan 2019 at 08:13, Michal Simek  wrote:
>
> The same functionality was added to Linux for i2c bus registration with this
> commit message:
>
> "
> of: base: add function to get highest id of an alias stem
>
> I2C supports adding adapters using either a dynamic or fixed id. The
> latter is provided by aliases in the DT case. To prevent id collisions
> of those two types, install this function which gives us the highest
> fixed id, so we can then let the dynamically created ones come after
> this highest number.
>
> Signed-off-by: Wolfram Sang 
> Acked-by: Rob Herring 
> Signed-off-by: Wolfram Sang 
> "
>
> Add it also to U-Boot for DM I2C support.
>
> Signed-off-by: Michal Simek 
> ---
>
>  drivers/core/of_access.c | 18 ++
>  include/dm/of_access.h   |  9 +
>  2 files changed, 27 insertions(+)
>
> diff --git a/drivers/core/of_access.c b/drivers/core/of_access.c
> index 14c020a687b7..7c2df2354109 100644
> --- a/drivers/core/of_access.c
> +++ b/drivers/core/of_access.c
> @@ -812,6 +812,24 @@ int of_alias_get_id(const struct device_node *np, const 
> char *stem)
> return id;
>  }
>
> +int of_alias_get_highest_id(const char *stem)
> +{
> +   struct alias_prop *app;
> +   int id = -ENODEV;
> +
> +   mutex_lock(&of_mutex);
> +   list_for_each_entry(app, &aliases_lookup, link) {
> +   if (strcmp(app->stem, stem) != 0)
> +   continue;
> +
> +   if (app->id > id)
> +   id = app->id;
> +   }
> +   mutex_unlock(&of_mutex);
> +
> +   return id;
> +}
> +
>  struct device_node *of_get_stdout(void)
>  {
> return of_stdout;
> diff --git a/include/dm/of_access.h b/include/dm/of_access.h
> index 5ed1a0cdb427..5cbfd220bfd4 100644
> --- a/include/dm/of_access.h
> +++ b/include/dm/of_access.h
> @@ -425,6 +425,15 @@ int of_alias_scan(void);
>  int of_alias_get_id(const struct device_node *np, const char *stem);
>
>  /**
> + * of_alias_get_highest_id - Get highest alias id for the given stem
> + * @stem:  Alias stem to be examined
> + *
> + * The function travels the lookup table to get the highest alias id for the
> + * given alias stem. It returns the alias id if found.

@return

> + */
> +int of_alias_get_highest_id(const char *stem);
> +
> +/**
>   * of_get_stdout() - Get node to use for stdout
>   *
>   * @return node referred to by stdout-path alias, or NULL if none
> --
> 1.9.1
>

Can we place have a test that calls this for a few values?

Also see uclass_find_next_free_req_seq() and uclass_resolve_seq()
which is what U-Boot does today. It is first in, first served. This is
supposed to mean that devices without an alias don't get a req_seq
value, meaning that the seq value is set to the next available value.

I suspect it is OK to change the behaviour though. It might affect
some boards which rely on not having aliases but still getting bus
numbers.

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


Re: [U-Boot] [PATCH 4/4] i2c: mux: Add support for not listed sub-buses

2019-01-31 Thread Simon Glass
Hi Michal,

On Fri, 18 Jan 2019 at 08:13, Michal Simek  wrote:
>
> Before this patch is applied all i2c sub-buses are using number -1 and
> they can't be addresses(switch to). If all busses are listed in DT alias
> they will get proper numbers and U-Boot can work with them.
> In Linux buses which are not listed in DT alias get uniq number which
> starts from the first highest free ID.
>
> This is the behavior on ZynqMP zcu100-revA before this patch is applied.
>
> Bus 0:  i2c@ff02
>20: gpio@20, offset len 1, flags 0
>21: gpio@21, offset len 1, flags 0
>75: i2c-mux@75, offset len 1, flags 0
> Bus -1: i2c@0
> Bus -1: i2c@1
> Bus -1: i2c@2
> Bus 1:  i2c@ff03
>74: i2c-mux@74, offset len 1, flags 0
>75: i2c-mux@75, offset len 1, flags 0
> Bus -1: i2c@0
> Bus -1: i2c@1
> Bus -1: i2c@2
> Bus -1: i2c@3
> Bus -1: i2c@4
> Bus -1: i2c@0
> Bus -1: i2c@1
> Bus -1: i2c@2
> Bus -1: i2c@3
> Bus -1: i2c@4
> Bus -1: i2c@5
> Bus -1: i2c@6
> Bus -1: i2c@7
>
> When the patch is applied also i2c-mux busses are listed properly.
>
> ZynqMP> i2c bus
> Bus 0:  i2c@ff02
>20: gpio@20, offset len 1, flags 0
>21: gpio@21, offset len 1, flags 0
>75: i2c-mux@75, offset len 1, flags 0
> Bus 2:  i2c@ff02->i2c-mux@75->i2c@0
> Bus 3:  i2c@ff02->i2c-mux@75->i2c@1
> Bus 4:  i2c@ff02->i2c-mux@75->i2c@2
> Bus 1:  i2c@ff03  (active 1)
>74: i2c-mux@74, offset len 1, flags 0
>75: i2c-mux@75, offset len 1, flags 0
> Bus 5:  i2c@ff03->i2c-mux@74->i2c@0 (active 5)
>54: generic_54, offset len 1, flags 0
> Bus 6:  i2c@ff03->i2c-mux@74->i2c@1
> Bus 7:  i2c@ff03->i2c-mux@74->i2c@2
> Bus 8:  i2c@ff03->i2c-mux@74->i2c@3
> Bus 9:  i2c@ff03->i2c-mux@74->i2c@4
> Bus 10: i2c@ff03->i2c-mux@75->i2c@0
> Bus 11: i2c@ff03->i2c-mux@75->i2c@1
> Bus 12: i2c@ff03->i2c-mux@75->i2c@2
> Bus 13: i2c@ff03->i2c-mux@75->i2c@3
> Bus 14: i2c@ff03->i2c-mux@75->i2c@4
> Bus 15: i2c@ff03->i2c-mux@75->i2c@5
> Bus 16: i2c@ff03->i2c-mux@75->i2c@6
> Bus 17: i2c@ff03->i2c-mux@75->i2c@7
>
> Signed-off-by: Michal Simek 
> ---
>
> zcu102-revA
>
> Before this patch applied for !DM case with static description
> ZynqMP> i2c bus
> Bus 0:  zynq_0
> Bus 1:  zynq_0->PCA9544A@0x75:0
> Bus 2:  zynq_0->PCA9544A@0x75:1
> Bus 3:  zynq_0->PCA9544A@0x75:2
> Bus 4:  zynq_1
> Bus 5:  zynq_1->PCA9548@0x74:0
> Bus 6:  zynq_1->PCA9548@0x74:1
> Bus 7:  zynq_1->PCA9548@0x74:2
> Bus 8:  zynq_1->PCA9548@0x74:3
> Bus 9:  zynq_1->PCA9548@0x74:4
> Bus 10: zynq_1->PCA9548@0x75:0
> Bus 11: zynq_1->PCA9548@0x75:1
> Bus 12: zynq_1->PCA9548@0x75:2
> Bus 13: zynq_1->PCA9548@0x75:3
> Bus 14: zynq_1->PCA9548@0x75:4
> Bus 15: zynq_1->PCA9548@0x75:5
> Bus 16: zynq_1->PCA9548@0x75:6
> Bus 17: zynq_1->PCA9548@0x75:7
>
> When Patch is applied with OF_LIVE - of_alias_get_highest_id() is used
> ZynqMP> i2c bus
> Bus 0:  i2c@ff02
>75: i2c-mux@75, offset len 1, flags 0
> Bus 2:  i2c@ff02->i2c-mux@75->i2c@0
> Bus 3:  i2c@ff02->i2c-mux@75->i2c@1
> Bus 4:  i2c@ff02->i2c-mux@75->i2c@2
> Bus 1:  i2c@ff03
>74: i2c-mux@74, offset len 1, flags 0
>75: i2c-mux@75, offset len 1, flags 0
> Bus 5:  i2c@ff03->i2c-mux@74->i2c@0
> Bus 6:  i2c@ff03->i2c-mux@74->i2c@1
> Bus 7:  i2c@ff03->i2c-mux@74->i2c@2
> Bus 8:  i2c@ff03->i2c-mux@74->i2c@3
> Bus 9:  i2c@ff03->i2c-mux@74->i2c@4
> Bus 10: i2c@ff03->i2c-mux@75->i2c@0
> Bus 11: i2c@ff03->i2c-mux@75->i2c@1
> Bus 12: i2c@ff03->i2c-mux@75->i2c@2
> Bus 13: i2c@ff03->i2c-mux@75->i2c@3
> Bus 14: i2c@ff03->i2c-mux@75->i2c@4
> Bus 15: i2c@ff03->i2c-mux@75->i2c@5
> Bus 16: i2c@ff03->i2c-mux@75->i2c@6
> Bus 17: i2c@ff03->i2c-mux@75->i2c@7
>
> For !OF_LIVE - hardcoded number is used
> ZynqMP> i2c bus
> Bus 0:  i2c@ff02
>75: i2c-mux@75, offset len 1, flags 0
> Bus 21: i2c@ff02->i2c-mux@75->i2c@0
> Bus 22: i2c@ff02->i2c-mux@75->i2c@1
> Bus 23: i2c@ff02->i2c-mux@75->i2c@2
> Bus 1:  i2c@ff03
>74: i2c-mux@74, offset len 1, flags 0
>75: i2c-mux@75, offset len 1, flags 0
> Bus 24: i2c@ff03->i2c-mux@74->i2c@0
> Bus 25: i2c@ff03->i2c-mux@74->i2c@1
> Bus 26: i2c@ff03->i2c-mux@74->i2c@2
> Bus 27: i2c@ff03->i2c-mux@74->i2c@3
> Bus 28: i2c@ff03->i2c-mux@74->i2c@4
> Bus 29: i2c@ff03->i2c-mux@75->i2c@0
> Bus 30: i2c@ff03->i2c-mux@75->i2c@1
> Bus 31: i2c@ff03->i2c-mux@75->i2c@2
> Bus 32: i2c@ff03->i2c-mux@75->i2c@3
> Bus 33: i2c@ff03->i2c-mux@75->i2c@4
> Bus 34: i2c@ff03->i2c-mux@75->i2c@5
> Bus 35: i2c@ff03->i2c-mux@75->i2c@6
> Bus 36: i2c@ff03->i2c-mux@75->i2c@7
>
> ---
>  drivers/i2c/muxes/i2c-mux-uclass.c | 35 +--
>  1 file changed, 33 insertions(+), 2 deletions(-)

This is quite a complicated issue...

>
> diff --git a/drivers/i2c/muxes/i2c-mux-uclass.c 
> b/drivers/i2c/muxes/i2c-mux-uclass.c
> index a680ee176253..cb69d053fd59 100644
> --- a/drivers/i2c/muxes/i2c-mux-uclass.c
> +++ b/drivers/i2c/muxes/i2

Re: [U-Boot] [PATCH 3/4] i2c: dm: Record maximum id of devices before probing devices

2019-01-31 Thread Simon Glass
Hi Michal,

On Fri, 18 Jan 2019 at 08:13, Michal Simek  wrote:
>
> There is a need to find out the first free i2c ID which can be used for
> i2s buses (including i2c buses connected to i2c mux). Do it early in
> init and share this variable with other i2c classes for uniq bus
> identification.
>
> Signed-off-by: Michal Simek 
> ---
>
>  drivers/i2c/i2c-uclass.c | 19 +++
>  include/i2c.h|  3 +++
>  2 files changed, 22 insertions(+)
>
> diff --git a/drivers/i2c/i2c-uclass.c b/drivers/i2c/i2c-uclass.c
> index 975318e5f254..aaece115f02f 100644
> --- a/drivers/i2c/i2c-uclass.c
> +++ b/drivers/i2c/i2c-uclass.c
> @@ -23,6 +23,8 @@ enum {
> PIN_COUNT,
>  };
>
> +int i2c_highest_id = -1;
> +
>  /* Useful debugging function */
>  void i2c_dump_msgs(struct i2c_msg *msg, int nmsgs)
>  {
> @@ -619,10 +621,27 @@ static int i2c_child_post_bind(struct udevice *dev)
>  #endif
>  }
>
> +int i2c_uclass_init(struct uclass *class)
> +{
> +#ifdef CONFIG_OF_LIVE
> +   int ret;
> +
> +   ret = of_alias_get_highest_id("i2c");
> +   if (ret >= 0)
> +   i2c_highest_id = ret;
> +#else
> +   i2c_highest_id = fdtdec_get_alias_highest_id(gd->fdt_blob, "i2c");
> +#endif

This should call dev_read_alias_highest_id() or similar, which does
the logic you have here.

> +   debug("%s: i2c highest_id %d\n", __func__, i2c_highest_id);
> +
> +   return 0;
> +}
> +
>  UCLASS_DRIVER(i2c) = {
> .id = UCLASS_I2C,
> .name   = "i2c",
> .flags  = DM_UC_FLAG_SEQ_ALIAS,
> +   .init   = i2c_uclass_init,
>  #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
> .post_bind  = dm_scan_fdt_dev,
>  #endif
> diff --git a/include/i2c.h b/include/i2c.h
> index ccffc1955275..c69e26deaeed 100644
> --- a/include/i2c.h
> +++ b/include/i2c.h
> @@ -16,6 +16,9 @@
>  #ifndef _I2C_H_
>  #define _I2C_H_
>
> +/* Stores maximum highest i2c alias number */
> +extern int i2c_highest_id;

This should be in uclass-private data, not a global.

But also I feel that the behaviour needs to be consistent for all
U-Boot buses, not just I2C. So can we modify the existing core DM code
instead? I think a change to uclass_resolve_seq() might be enough.

> +
>  /*
>   * For now there are essentially two parts to this file - driver model
>   * here at the top, and the older code below (with CONFIG_SYS_I2C being
> --
> 1.9.1
>

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


Re: [U-Boot] [PATCH v2 1/2] dm: device: fail uclass_find_first_device() if list_empty

2019-01-31 Thread Simon Glass
On Fri, 25 Jan 2019 at 05:40, Marcel Ziswiler  wrote:
>
> From: Marcel Ziswiler 
>
> While uclass_find_device() fails with -ENODEV in case of list_empty
> strangely uclass_find_first_device() returns 0.
>
> Fix uclass_find_first_device() to also fail with -ENODEV instead.
>
> Signed-off-by: Marcel Ziswiler 
>
> ---
>
> Changes in v2:
> - Update dm_test_uclass_devices_find() to test this behaviour as
>   suggested by Simon.
>
>  drivers/core/uclass.c | 2 +-
>  test/dm/core.c| 4 
>  2 files changed, 5 insertions(+), 1 deletion(-)

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


Re: [U-Boot] [RFC] arch/arm/lib/reloc_aarch64_efi.c

2019-01-31 Thread Simon Glass
Hi Heinrich,

On Sun, 20 Jan 2019 at 17:26, Heinrich Schuchardt  wrote:
>
> Hello Simon,
>
> unfortunately I could not find any documentation for
> arch/arm/lib/reloc_aarch64_efi.c.
>
> EFI binaries never rely on dynamically loaded libraries.
> So there will never be any dynamic symbols in an EFI binary.
> There will not be any GOT either.
>
> Relocation is handled by the firmware (e.g. in our efi_load_pe()).
>
> So it is unclear to me why the function _relocate() is needed which
> tries to deal with dynamic symbols.
>
> elf.h defines an array _DYNAMIC[] used as argument for _relocate(). But
> I could not find any place where it is actually implemented. So I assume
> that the output of _relocate() is rather undefined.
>
> As the function _relocate() was once introduced by one of your patches I
> hope you can provide me some insight, please.

The code is designed to relocate itself. If I recall correctly it came
from Linux (see headers in the files added). Perhaps Linux has to do
this since it doesn't rely on having a proper boot loader like U-Boot
to do this relocation?

So perhaps we don't need this code?

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


Re: [U-Boot] [PATCH v2 04/17] dm: clk: Define clk_get_by_id() for clk operations

2019-01-31 Thread Simon Glass
On Thu, 31 Jan 2019 at 02:04, Lukasz Majewski  wrote:
>
> This commit adds the clk_get_by_id() function, which is responsible
> for getting the udevice with matching clk->id. Such approach allows
> re-usage of inherit DM list relationship for the same class (UCLASS_CLK).
> As a result - we don't need any other external list - it is just enough
> to look for UCLASS_CLK related udevices.
>
> Signed-off-by: Lukasz Majewski 
> ---
>
> Changes in v2: None
>
>  drivers/clk/clk-uclass.c | 22 ++
>  include/clk.h| 11 +++
>  2 files changed, 33 insertions(+)
>

Please add a test that calls this.

> diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
> index f1640dda67..12ec0baa74 100644
> --- a/drivers/clk/clk-uclass.c
> +++ b/drivers/clk/clk-uclass.c
> @@ -455,6 +455,28 @@ int clk_disable_bulk(struct clk_bulk *bulk)
> return 0;
>  }
>
> +int clk_get_by_id(ulong id, struct clk **c)

Can you use clkp instead of c?

> +{
> +   struct udevice *dev;
> +   struct uclass *uc;
> +   int ret;
> +
> +   ret = uclass_get(UCLASS_CLK, &uc);
> +   if (ret)
> +   return ret;
> +
> +   uclass_foreach_dev(dev, uc) {
> +   struct clk *clk = (struct clk *)dev_get_driver_data(dev);
> +
> +   if (clk->id == id) {
> +   *c = clk;
> +   return 0;
> +   }
> +   }
> +
> +   return -ENODEV;

I wonder if -ENOENT would be better?

> +}
> +
>  UCLASS_DRIVER(clk) = {
> .id = UCLASS_CLK,
> .name   = "clk",
> diff --git a/include/clk.h b/include/clk.h
> index 8224295ec3..045e60357d 100644
> --- a/include/clk.h
> +++ b/include/clk.h
> @@ -315,4 +315,15 @@ static inline bool clk_valid(struct clk *clk)
>  {
> return !!clk->dev;
>  }
> +
> +/**
> + * clk_get_by_id() - Get the clock by knowing its ID
> + *
> + * @id:The clock ID to search for
> + *
> + * @c: A pointer to clock struct that has been found among added clocks
> + *  to UCLASS_CLK
> + * @return zero on success, or -ve error code.

-NOENT on error? I think you can be specific here

> + */
> +int clk_get_by_id(ulong id, struct clk **c);
>  #endif
> --
> 2.11.0
>

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


Re: [U-Boot] [PATCH 04/11] net: macb: Fix clk API usage for RISC-V systems

2019-01-31 Thread Simon Glass
Hi,

On Fri, 18 Jan 2019 at 06:35, Alexander Graf  wrote:
>
>
>
> On 18.01.19 14:28, Anup Patel wrote:
> >
> >
> >> -Original Message-
> >> From: Alexander Graf [mailto:ag...@suse.de]
> >> Sent: Friday, January 18, 2019 5:05 PM
> >> To: Anup Patel 
> >> Cc: Rick Chen ; Bin Meng ;
> >> Joe Hershberger ; Lukas Auer
> >> ; Masahiro Yamada
> >> ; Simon Glass ;
> >> Palmer Dabbelt ; Paul Walmsley
> >> ; Atish Patra ;
> >> Christoph Hellwig ; U-Boot Mailing List  >> b...@lists.denx.de>
> >> Subject: Re: [PATCH 04/11] net: macb: Fix clk API usage for RISC-V systems
> >>
> >>
> >>
> >>> Am 18.01.2019 um 07:05 schrieb Anup Patel :
> >>>
> >>>
> >>>
>  -Original Message-
>  From: Alexander Graf [mailto:ag...@suse.de]
>  Sent: Thursday, January 17, 2019 11:37 PM
>  To: Anup Patel ; Rick Chen
> >> ;
>  Bin Meng ; Joe Hershberger
>  ; Lukas Auer
>  ; Masahiro Yamada
>  ; Simon Glass 
>  Cc: Palmer Dabbelt ; Paul Walmsley
>  ; Atish Patra ;
>  Christoph Hellwig ; U-Boot Mailing List   b...@lists.denx.de>
>  Subject: Re: [PATCH 04/11] net: macb: Fix clk API usage for RISC-V
>  systems
> 
> > On 01/17/2019 11:38 AM, Anup Patel wrote:
> > This patch does following fixes in MACB ethernet driver for using it
> > on RISC-V systems (particularly QEMU sifive_u
> > machine):
> > 1. asm/arch/clk.h is not available on RISC-V port so include
> >it only for non-RISC-V systems.
> > 2. Don't fail in macb_enable_clk() if clk_enable() returns
> >-ENOSYS because we get -ENOSYS for fixed-rate clocks.
> >
> > Signed-off-by: Anup Patel 
> > Reviewed-by: Bin Meng 
> > ---
> >  drivers/net/macb.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/macb.c b/drivers/net/macb.c index
> > 94c89c762b..9a06b523cc 100644
> > --- a/drivers/net/macb.c
> > +++ b/drivers/net/macb.c
> > @@ -38,7 +38,9 @@
> >  #include 
> >  #include 
> >  #include 
> > +#ifndef CONFIG_RISCV
> >  #include 
> > +#endif
> >  #include 
> >
> >  #include "macb.h"
> > @@ -1066,7 +1068,7 @@ static int macb_enable_clk(struct udevice
> >> *dev)
> >   */
> >  #ifndef CONFIG_MACB_ZYNQ
> >  ret = clk_enable(&clk);
> 
>  If clk.h is not available, who exports clk_enable() then; and why is
>  the included needed in the first place?
> >>>
> >>> For some of the ARM boards, clk instances are provided directly by
> >>> arch/arm/mach-xyz sources. For such boards, asm/arch/clk.h is
> >>> required. I think these boards should move to DT based clk drivers.
> >>
> >> Can you at least make this a positive #ifdef then rather than ifndef? We 
> >> want
> >> to isolate the odd case, not the normal one.
> >>
> >> Maybe you can even find a config option that isolates it further?
> >
> > With the additional check "ret != -ENOSYS", we don't require the #ifndef but
> > someone with Zynq SOC board need to confirm that removing #ifndef won't
> > hurt.
>
> In that case let's CC Michal :).

Yes, although putting an arch-specific #ifdef in a driver is not
correct, so I think the onus would be on Michal to fix that if it were
a problem.

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


Re: [U-Boot] [PATCH 9/9] mmc: sunxi: Mark end of DM_MMC #ifdefs

2019-01-31 Thread Simon Glass
Hi Andre,

On Fri, 18 Jan 2019 at 18:33, Andre Przywara  wrote:
>
> The Allwinner MMC supports both the legacy approach and the driver model,
> at the cost of quite some #ifdefs.
>
> Mark the closing #endifs with their respective config symbol, to make it
> more obvious where each part ends and begins.
>
> Signed-off-by: Andre Przywara 
> ---
>  drivers/mmc/sunxi_mmc.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Reviewed-by: Simon Glass 

We should be able to remove the non-DM_MMC code now.

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


Re: [U-Boot] [PATCH] ihs_mdio: Use new regmap interface

2019-01-31 Thread Simon Glass
On Mon, 28 Jan 2019 at 01:49, Mario Six  wrote:
>
> For the DM case, use the proper parameter for the regmap_init_mem call
> (which is the ofnode, not the udevice).
>
> Signed-off-by: Mario Six 
> ---
>  board/gdsys/common/ihs_mdio.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

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


Re: [U-Boot] [PATCH] lmb: handle more than one DRAM BANK

2019-01-31 Thread Simon Glass
Hi Simon,

On Sat, 26 Jan 2019 at 14:13, Simon Goldschmidt
 wrote:
>
> This fixes the automatic lmb initialization and reservation for boards
> with more than one DRAM bank.
>
> This fixes the CVE-2018-18439 and -18440 fixes that only allowed to load
> files into the firs DRAM bank from fs and via tftp.
>
> Found-by: Heinrich Schuchardt 
> Signed-off-by: Simon Goldschmidt 
> ---
>
>  common/bootm.c |  4 ++--
>  fs/fs.c|  3 +--
>  include/lmb.h  |  7 +--
>  lib/lmb.c  | 37 -
>  net/tftp.c |  3 +--
>  5 files changed, 41 insertions(+), 13 deletions(-)

Reviewed-by: Simon Glass 

Do we need a test update to cover this?


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


Re: [U-Boot] [PATCH v2 07/11] clk: Add fixed-factor clock driver

2019-01-31 Thread Simon Glass
Hi Anup,

On Fri, 18 Jan 2019 at 04:19, Anup Patel  wrote:
>
> This patch adds fixed-factor clock driver which derives clock
> rate by dividing (div) and multiplying (mult) fixed factors
> to a parent clock.
>
> Signed-off-by: Atish Patra 
> Signed-off-by: Anup Patel 
> ---
>  drivers/clk/Makefile   |  4 +-
>  drivers/clk/clk_fixed_factor.c | 74 ++
>  2 files changed, 77 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/clk/clk_fixed_factor.c

Can you please update test/dm/clk.c to test this? You'll need to add
this clock to sandbox.

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


Re: [U-Boot] [RFC PATCH] dm: device: Do not probe parents which are probed already

2019-01-31 Thread Simon Glass
Hi Michal,

On Fri, 18 Jan 2019 at 02:41, Michal Simek  wrote:
>
> From the first look there is no reason to probe parent nodes if they are
> active already.
>
> Signed-off-by: Michal Simek 
> ---
>
> I have created this just for showing status of parent device.
> Maybe there is any strong reason to do this but I just wanted to check
> this because it looks like just wasting of time.
>
> Just revert this condition when you want to see outputs.
> if (dev->parent && !(dev->parent->flags & DM_FLAG_ACTIVATED)) {
>
> Without this line
>
> 99   amba @ 7df04d20
> 100   amba @ 7df04d20
> 99 * root_driver @ 7df04960, seq 0, (req -1)
> 100 * root_driver @ 7df04960, seq 0, (req -1)
> 99 * root_driver @ 7df04960, seq 0, (req -1)
> 100 * root_driver @ 7df04960, seq 0, (req -1)
> 99 * root_driver @ 7df04960, seq 0, (req -1)
> 100 * root_driver @ 7df04960, seq 0, (req -1)
> 99 * root_driver @ 7df04960, seq 0, (req -1)
> 100 * root_driver @ 7df04960, seq 0, (req -1)
> 99 * root_driver @ 7df04960, seq 0, (req -1)
> 100 * root_driver @ 7df04960, seq 0, (req -1)
> 99 * root_driver @ 7df04960, seq 0, (req -1)
> 100 * root_driver @ 7df04960, seq 0, (req -1)
> 99 * root_driver @ 7df04960, seq 0, (req -1)
> 100 * root_driver @ 7df04960, seq 0, (req -1)
> MMC:   99 * amba @ 7df04d20, seq 0, (req -1)
> 100 * amba @ 7df04d20, seq 0, (req -1)
>
> ZynqMP> i2c dev 0
> Setting bus to 0
> 99 * amba @ 7df04d20, seq 0, (req -1)
> 100 * amba @ 7df04d20, seq 0, (req -1)
>
> with this line added
>
> 99   amba @ 7df04d20
> 100   amba @ 7df04d20
> 99 * root_driver @ 7df04960, seq 0, (req -1)
> 99 * root_driver @ 7df04960, seq 0, (req -1)
> 99 * root_driver @ 7df04960, seq 0, (req -1)
> 99 * root_driver @ 7df04960, seq 0, (req -1)
> 99 * root_driver @ 7df04960, seq 0, (req -1)
> 99 * root_driver @ 7df04960, seq 0, (req -1)
> 99 * root_driver @ 7df04960, seq 0, (req -1)
> MMC:   99 * amba @ 7df04d20, seq 0, (req -1)
>
> ZynqMP> i2c dev 0
> Setting bus to 0
> 99 * amba @ 7df04d20, seq 0, (req -1)
>
> ---
>  drivers/core/device.c | 7 ++-
>  drivers/core/dump.c   | 2 +-
>  2 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/core/device.c b/drivers/core/device.c
> index 0d15e5062b66..114888a8f7cf 100644
> --- a/drivers/core/device.c
> +++ b/drivers/core/device.c
> @@ -341,8 +341,13 @@ int device_probe(struct udevice *dev)
> }
> }
>
> +   if (dev->parent)
> +   dm_display_line(dev->parent, 99);
> +
> /* Ensure all parents are probed */
> -   if (dev->parent) {
> +   if (dev->parent && !(dev->parent->flags & DM_FLAG_ACTIVATED)) {
> +   dm_display_line(dev->parent, 100);
> +

Yes this looks like a good change in principle.

But we still need to execute the code below even if the parent is
probed, so that we allocate the child's parent data:

> size = dev->parent->driver->per_child_auto_alloc_size;
> if (!size) {
> size = dev->parent->uclass->uc_drv->

...

So can you please rework this to allow for that?

Overall I think your change saves a function call. As you can see the
flag is checked right at the top of device_probe().

> diff --git a/drivers/core/dump.c b/drivers/core/dump.c
> index 8fbfd93fb5e4..95ba7dcb9193 100644
> --- a/drivers/core/dump.c
> +++ b/drivers/core/dump.c
> @@ -62,7 +62,7 @@ void dm_dump_all(void)
>   *
>   * @dev:   Device to display
>   */
> -static void dm_display_line(struct udevice *dev, int index)
> +void dm_display_line(struct udevice *dev, int index)
>  {
> printf("%i %c %s @ %08lx", index,
>dev->flags & DM_FLAG_ACTIVATED ? '*' : ' ',
> --
> 1.9.1
>

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


Re: [U-Boot] [PATCH v2 02/10] spl: misc: Allow misc drivers in SPL and TPL

2019-01-31 Thread Jean-Jacques Hiblot


On 31/01/2019 03:57, Simon Glass wrote:

Hi Jean-Jacques,

On Tue, 20 Nov 2018 at 06:49, Jean-Jacques Hiblot  wrote:

Hi Simon,

On 18/11/2018 16:14, Simon Glass wrote:

In some cases it is necessary to read the keyboard in early phases of
U-Boot. The cros_ec keyboard is kept in the misc directory. Update the
config to allow this.

Signed-off-by: Simon Glass 
---

Changes in v2:
- Leave the misc uclass alone since it stops sandbox_spl working

   drivers/misc/Kconfig  | 72 +++
   drivers/misc/Makefile |  8 +++--
   2 files changed, 77 insertions(+), 3 deletions(-)

diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 48febc47d26..802046cf966 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -13,6 +13,24 @@ config MISC
 set of generic read, write and ioctl methods may be used to
 access the device.

+config SPL_MISC
+ bool "Enable Driver Model for Misc drivers in SPL"
+ depends on SPL_DM
+ help
+   Enable driver model for miscellaneous devices. This class is
+   used only for those do not fit other more general classes. A
+   set of generic read, write and ioctl methods may be used to
+   access the device.

Platforms currently use CONFIG_SPL_DRIVERS_MISC_SUPPORT and CONFIG_MISC
to enable the MISC drivers in the SPL.

This is a bit confusing but that is not my understanding of the situation.

CONFIG_MISC enables UCLASS_MISC devices. The 'misc' drivers directory
is included always in U-Boot proper. Yes the
CONFIG_SPL_DRIVERS_MISC_SUPPORT option is for SPL only.

But in my case I want an option to enable driver-model MISC devices in
SPL/TPL. Oddly this is orthogonal to whether the drivers/misc
directory itself is included in the build.


Ok. that makes sense now.




Regards,
Simon


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


Re: [U-Boot] [PATCH v3] moveconfig: add a second pass for empty #if/#endif blocks

2019-01-31 Thread Chris Packham
On Thu, 31 Jan 2019 19:26 Masahiro Yamada  On Wed, Jan 30, 2019 at 5:55 PM Masahiro Yamada
>  wrote:
> >
> > On Wed, Jan 30, 2019 at 4:23 PM Chris Packham 
> wrote:
> > >
> > > Moveconfig already attempts to remove empty #if/#endif blocks when
> there
> > > is a matching CONFIG_ being moved. Add a second pass which covers files
> > > without a match.
> > >
> > > Signed-off-by: Chris Packham 
> > > ---
> > > This was previously submitted as
> > > http://patchwork.ozlabs.org/patch/924901/ there still seems to be
> cases
> > > of #if/#endif left over from Kconfig migrations so perhaps this is
> still
> > > needed/wanted.
> > >
> > > I've plumbed this in as a second pass because ultimately we may want to
> > > make this a separate option. Also I couldn't figure out how to
> implement
> > > this without using re.M so I couldn't make it work in with the line by
> > > line parsing of cleanup_one_header().
> >
> >
> > This seems useful to find leftover code
> > regardless of the CONFIG options you are moving.
> >
> > One drawback is, it may fold unrelated cleanups.
> >
> > Maybe, it would be useful to add a separate option to turn on this
> feature,
> > or make it into a separate tool.
> >
> >
> >
>
>
> I tested this patch.
> It detected one empty block.
>
>
> diff --git a/include/configs/omap3_cairo.h b/include/configs/omap3_cairo.h
> index 04bce2f..ac1a6cb 100644
> --- a/include/configs/omap3_cairo.h
> +++ b/include/configs/omap3_cairo.h
> @@ -197,8 +197,6 @@
>   * are needed and peripheral clocks for UART2 must be enabled in
>   * function per_clocks_enable().
>   */
> -#ifdef CONFIG_SPL_BUILD
> -#endif
>
>  /* Provide the MACH_TYPE value the vendor kernel requires */
>  #define CONFIG_MACH_TYPE   3063
>
>
>
>
>
>
>
> This seems a leftover of 9baa2bce.
>

Yes. I sent a patch for this as I was testing.


>
> $ git show 9baa2bce -- include/configs/omap3_cairo.h
> commit 9baa2bce28901321d6f62399b5ebeb3fcb8e8a57
> Author: Adam Ford 
> Date:   Tue Aug 7 07:08:32 2018 -0500
>
> Removed unused references to CONFIG_SERIALx
>
> After creating CONS_INDEX and migrating a bunch of boards to it,
> there are a bunch of defined references to CONFIG_SERIALx which
> are not referenced in any C code or #ifdef, so they can now be
> removed
>
> Signed-off-by: Adam Ford 
>
> diff --git a/include/configs/omap3_cairo.h b/include/configs/omap3_cairo.h
> index 0133416..04bce2f 100644
> --- a/include/configs/omap3_cairo.h
> +++ b/include/configs/omap3_cairo.h
> @@ -198,8 +198,6 @@
>   * function per_clocks_enable().
>   */
>  #ifdef CONFIG_SPL_BUILD
> -#undef CONFIG_SERIAL3
> -#define CONFIG_SERIAL2
>  #endif
>
>  /* Provide the MACH_TYPE value the vendor kernel requires */
>
>
>
>
>
> However, I doubt it used the moveconfig tool.
>
>
> I re-ran the tool against the previous commit.
>
>
> $ git checkout 9baa2bce2890^
> $ tools/moveconfig.py -H SERIAL0 SERIAL1 SERIAL2 SERIAL3
> Clean up headers? [y/n]: y
> y
> ...
> $ git diff -- include/configs/omap3_cairo.h
> diff --git a/include/configs/omap3_cairo.h b/include/configs/omap3_cairo.h
> index 0133416..ac1a6cb 100644
> --- a/include/configs/omap3_cairo.h
> +++ b/include/configs/omap3_cairo.h
> @@ -197,10 +197,6 @@
>   * are needed and peripheral clocks for UART2 must be enabled in
>   * function per_clocks_enable().
>   */
> -#ifdef CONFIG_SPL_BUILD
> -#undef CONFIG_SERIAL3
> -#define CONFIG_SERIAL2
> -#endif
>
>  /* Provide the MACH_TYPE value the vendor kernel requires */
>  #define CONFIG_MACH_TYPE   3063
>
>
>
>
>
> cleanup_one_header() did a good job.
>
> Is there a particular case that the second path is needed?
>

Has moveconfig been updated to handle such cases in another way? I only
re-sent this because I found it while cleaning up some old branches. I
believe at the time I originally wrote it there were many more instances of
empty guards (most if which I submitted patches for).

I agree that if moveconfig already handles this there is no point in adding
a second pass (baring cases of double nesting).

There still may be benefit in running something as a one-off pass over all
files to remove existing empty guards but there's no need to store such a
script in the repository.

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


[U-Boot] [PATCH v2 13/17] Kconfig: Make CMD_SPL_NAND_OFS only available when proper memory is used

2019-01-31 Thread Lukasz Majewski
This commit makes the CMD_SPL_NAND_OFS only visible when we use NAND
memory.
Before this change it was present when only CMD_SPL was enabled (and
would stay when board with other falcon boot medium is used).

Signed-off-by: Lukasz Majewski 
---

Changes in v2: None

 cmd/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index ea1a325eb3..bc08b935a5 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -316,6 +316,7 @@ config CMD_SPL
 config CMD_SPL_NAND_OFS
hex "Offset of OS command line args for Falcon-mode NAND boot"
depends on CMD_SPL
+   depends on CMD_SPL && (TPL_NAND_SUPPORT || SPL_NAND_SUPPORT)
default 0
help
  This provides the offset of the command line arguments for Linux
-- 
2.11.0

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


[U-Boot] [PATCH v2 14/17] Kconfig: cosmetic: Update description of CMD_SPL_NAND_OFS

2019-01-31 Thread Lukasz Majewski
The CMD_SPL_NAND_OFS description was a bit misleading, has
been updated.

Signed-off-by: Lukasz Majewski 
---

Changes in v2: None

 cmd/Kconfig | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index bc08b935a5..f9a668b80f 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -314,8 +314,7 @@ config CMD_SPL
  command.
 
 config CMD_SPL_NAND_OFS
-   hex "Offset of OS command line args for Falcon-mode NAND boot"
-   depends on CMD_SPL
+   hex "Offset of OS args or dtb for Falcon-mode NAND boot"
depends on CMD_SPL && (TPL_NAND_SUPPORT || SPL_NAND_SUPPORT)
default 0
help
-- 
2.11.0

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


[U-Boot] [PATCH v2 15/17] Kconfig: Add CMD_SPL_NOR_OFS config for falcon boot argument offset

2019-01-31 Thread Lukasz Majewski
This option will provide the offset in the parallel NOR flash memory to,
which the falcon boot data is stored.

Signed-off-by: Lukasz Majewski 
---

Changes in v2: None

 cmd/Kconfig | 8 
 1 file changed, 8 insertions(+)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index f9a668b80f..e37d28e86a 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -323,6 +323,14 @@ config CMD_SPL_NAND_OFS
  for full information about how to use this option (and also see
  board/gateworks/gw_ventana/README for an example).
 
+config CMD_SPL_NOR_OFS
+   hex "Offset of OS args or dtb for Falcon-mode NOR boot"
+   depends on CMD_SPL && SPL_NOR_SUPPORT
+   default 0
+   help
+ This provides the offset of the command line arguments or dtb for
+ Linux when booting from NOR in Falcon mode.
+
 config CMD_SPL_WRITE_SIZE
hex "Size of argument area"
depends on CMD_SPL
-- 
2.11.0

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


[U-Boot] [PATCH v2 12/17] ARM: imx: Disable 1Gbps support on MCCMON6's KSZ9031 PHY

2019-01-31 Thread Lukasz Majewski
mccmon6 works in 10/100 MiB Ethernet environment, so disabling 1GiB support
improves robustness of the network after power up (as one don't need to
wait for autoneg).

Signed-off-by: Lukasz Majewski 

---

Changes in v2:
- Port the Common Clock Framework from Linux to U-boot (tag: 5.0-rc3)

 include/configs/mccmon6.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/configs/mccmon6.h b/include/configs/mccmon6.h
index f72d8cba2b..b25aacbf41 100644
--- a/include/configs/mccmon6.h
+++ b/include/configs/mccmon6.h
@@ -65,6 +65,7 @@
"fdt_high=0x\0" \
"initrd_high=0x\0" \
"boot_os=yes\0" \
+   "disable_giga=yes\0" \
"download_kernel=" \
"tftpboot ${kernel_addr} ${kernel_file};" \
"tftpboot ${fdt_addr} ${fdtfile};\0" \
-- 
2.11.0

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


[U-Boot] [PATCH v2 16/17] doc: Update parallel NOR flash related information in README.falcon

2019-01-31 Thread Lukasz Majewski
This commit updates the doc/README.falcon regarding Falcon boot on
NOR flash memories.

Signed-off-by: Lukasz Majewski 
---

Changes in v2: None

 doc/README.falcon | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/doc/README.falcon b/doc/README.falcon
index 9a7f0bc235..204f4b12b6 100644
--- a/doc/README.falcon
+++ b/doc/README.falcon
@@ -67,6 +67,9 @@ CONFIG_SYS_NAND_SPL_KERNEL_OFFS   Offset in NAND where 
the kernel is stored
 
 CONFIG_CMD_SPL_NAND_OFSOffset in NAND where the parameters area was 
saved.
 
+CONFIG_CMD_SPL_NOR_OFS Offset in NOR where the parameters area was saved.
+   (Please refer to MCCMON6 board's configuraiton)
+
 CONFIG_CMD_SPL_WRITE_SIZE  Size of the parameters area to be copied
 
 CONFIG_SPL_OS_BOOT Activate Falcon Mode.
-- 
2.11.0

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


[U-Boot] [PATCH v2 05/17] clk: Port Linux common clock framework [CCF] for imx6q to U-boot (tag: 5.0-rc3)

2019-01-31 Thread Lukasz Majewski
This commit brings the files from Linux kernel to provide clocks support
as it is used on the Linux kernel with common clock framework [CCF] setup.

The directory structure has been preserved. The ported code only supports
reading information from PLL, MUX, Divider, etc and enabling/disabling
the clocks USDHCx/ECSPIx depending on used bus. Moreover, it is agnostic
to the alias numbering as the information about the clock is read from
device tree.

One needs to pay attention to the comments indicating necessary for U-boot's
DM changes.

If needed the code can be extended to support the "set" part of the clock
management.

Signed-off-by: Lukasz Majewski 

---

Changes in v2: None

Design decisions/issues:

- U-boot's DM for clk differs from Linux CCF. The most notably difference
is the lack of support for hierarchical clocks and "clock as a manager
driver" (single clock DTS node acts as a starting point for all other
clocks).

- The "central" structure of this patch series is struct udevice and its
driver_data field contains the struct clk pointer (to the originally created
one).

- Clocks access (rate reading) is by following API: clk_request(..,clk),
clk_get_rate(clk), clk_free(clk).

Now U-boot only relies on udevice's dev pointer in struct clk and passes
cleared clk (memset(clk,0,sizeof(clk)). This is necessary for e.g.
clk_fixed_rate.c clocks (and checked explicitly).

- The clk_get_rate() is recursive now (we go up till "osc" clock). This
could be improved if necessary

- On purpose the "manager" clk driver (clk-imx6q.c) is not using large
table to store pointers to clocks - e.g. clk[IMX6QDL_CLK_USDHC2_SEL] = 
Instead we use udevice's linked list for the same class (UCLASS_CLK).
The rationale - when porting the code as is from Linux, one would need
~1KiB of RAM to store it. This is way too much if we do plan to use this
driver in SPL.

---
 drivers/clk/Kconfig|   7 ++
 drivers/clk/Makefile   |   2 +
 drivers/clk/clk-divider.c  | 148 ++
 drivers/clk/clk-fixed-factor.c |  87 
 drivers/clk/clk-mux.c  | 164 +
 drivers/clk/clk.c  |  56 +
 drivers/clk/imx/Kconfig|   8 ++
 drivers/clk/imx/Makefile   |   2 +
 drivers/clk/imx/clk-gate2.c| 113 ++
 drivers/clk/imx/clk-imx6q.c| 179 +
 drivers/clk/imx/clk-pfd.c  |  91 +
 drivers/clk/imx/clk-pllv3.c|  83 +++
 drivers/clk/imx/clk.h  |  75 +
 include/linux/clk-provider.h   |  94 ++
 14 files changed, 1109 insertions(+)
 create mode 100644 drivers/clk/clk-divider.c
 create mode 100644 drivers/clk/clk-fixed-factor.c
 create mode 100644 drivers/clk/clk-mux.c
 create mode 100644 drivers/clk/clk.c
 create mode 100644 drivers/clk/imx/clk-gate2.c
 create mode 100644 drivers/clk/imx/clk-imx6q.c
 create mode 100644 drivers/clk/imx/clk-pfd.c
 create mode 100644 drivers/clk/imx/clk-pllv3.c
 create mode 100644 drivers/clk/imx/clk.h
 create mode 100644 include/linux/clk-provider.h

diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
index 51c931b906..d37c0e86b5 100644
--- a/drivers/clk/Kconfig
+++ b/drivers/clk/Kconfig
@@ -46,6 +46,13 @@ config CLK_BOSTON
help
  Enable this to support the clocks
 
+config CLK_CCF
+   bool "Common Clock Framework [CCF] support "
+   depends on CLK
+   help
+ Enable this option if you want to (re-)use the Linux kernel's Common
+ Clock Framework [CCF] code in U-Boot's clock driver.
+
 config CLK_STM32F
bool "Enable clock driver support for STM32F family"
depends on CLK && (STM32F7 || STM32F4)
diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
index 6a4ff9143b..d426414ca6 100644
--- a/drivers/clk/Makefile
+++ b/drivers/clk/Makefile
@@ -5,6 +5,8 @@
 #
 
 obj-$(CONFIG_$(SPL_TPL_)CLK) += clk-uclass.o clk_fixed_rate.o
+obj-$(CONFIG_$(SPL_TPL_)CLK_CCF) += clk-fixed-factor.o clk.o clk-divider.o \
+   clk-mux.o
 
 obj-y += imx/
 obj-y += tegra/
diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c
new file mode 100644
index 00..fa013dd9db
--- /dev/null
+++ b/drivers/clk/clk-divider.c
@@ -0,0 +1,148 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2019 DENX Software Engineering
+ * Lukasz Majewski, DENX Software Engineering, lu...@denx.de
+ *
+ * Copyright (C) 2011 Sascha Hauer, Pengutronix 
+ * Copyright (C) 2011 Richard Zhao, Linaro 
+ * Copyright (C) 2011-2012 Mike Turquette, Linaro Ltd 
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "clk.h"
+
+#define UBOOT_DM_CLK_IMX_DIVIDER "imx_clk_divider"
+
+static unsigned int _get_table_div(const struct clk_div_table *table,
+  unsigned int val

[U-Boot] [PATCH v2 11/17] ARM: imx: Decouple mccmon6's SPL and u-boot proper code

2019-01-31 Thread Lukasz Majewski
The mccmon6 has been used a "mixed" approach between SPL and u-boot
proper sources.

This commit decoupes SPL and u-boot proper, which allows clear
distinction between those two code bases and facilitates conversion
to DM/DTS on this particular board.

Signed-off-by: Lukasz Majewski 
---

Changes in v2: None

 board/liebherr/mccmon6/Makefile  |   7 +-
 board/liebherr/mccmon6/mccmon6.c | 285 ---
 board/liebherr/mccmon6/spl.c | 266 +++-
 3 files changed, 268 insertions(+), 290 deletions(-)

diff --git a/board/liebherr/mccmon6/Makefile b/board/liebherr/mccmon6/Makefile
index ead6750ebf..3c9786c6b7 100644
--- a/board/liebherr/mccmon6/Makefile
+++ b/board/liebherr/mccmon6/Makefile
@@ -2,5 +2,8 @@
 #
 # (C) Copyright 2016-2017
 # Lukasz Majewski, DENX Software Engineering, lu...@denx.de
-
-obj-y  := mccmon6.o spl.o
+ifdef CONFIG_SPL_BUILD
+obj-y  := spl.o
+else
+obj-y  := mccmon6.o
+endif
diff --git a/board/liebherr/mccmon6/mccmon6.c b/board/liebherr/mccmon6/mccmon6.c
index 497095572e..33b28aca11 100644
--- a/board/liebherr/mccmon6/mccmon6.c
+++ b/board/liebherr/mccmon6/mccmon6.c
@@ -8,37 +8,11 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#define UART_PAD_CTRL  (PAD_CTL_PUS_100K_UP |  \
-   PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | \
-   PAD_CTL_SRE_FAST  | PAD_CTL_HYS)
-
-#define USDHC_PAD_CTRL (PAD_CTL_PUS_47K_UP |   \
-   PAD_CTL_SPEED_LOW | PAD_CTL_DSE_80ohm | \
-   PAD_CTL_SRE_FAST  | PAD_CTL_HYS)
-
-#define WEIM_NOR_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE |  \
-   PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED |   \
-   PAD_CTL_DSE_40ohm   | PAD_CTL_SRE_FAST)
-
-#define USDHC2_CD_GPIO IMX_GPIO_NR(1, 4)
-#define NOR_WP IMX_GPIO_NR(1, 1)
-#define DISPLAY_EN IMX_GPIO_NR(1, 2)
-
 int dram_init(void)
 {
gd->ram_size = imx_ddr_size();
@@ -46,198 +20,11 @@ int dram_init(void)
return 0;
 }
 
-static iomux_v3_cfg_t const uart1_pads[] = {
-   IOMUX_PADS(PAD_CSI0_DAT10__UART1_TX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL)),
-   IOMUX_PADS(PAD_CSI0_DAT11__UART1_RX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL)),
-};
-
-static iomux_v3_cfg_t const usdhc2_pads[] = {
-   IOMUX_PADS(PAD_SD2_CLK__SD2_CLK| MUX_PAD_CTRL(USDHC_PAD_CTRL)),
-   IOMUX_PADS(PAD_SD2_CMD__SD2_CMD| MUX_PAD_CTRL(USDHC_PAD_CTRL)),
-   IOMUX_PADS(PAD_SD2_DAT0__SD2_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
-   IOMUX_PADS(PAD_SD2_DAT1__SD2_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
-   IOMUX_PADS(PAD_SD2_DAT2__SD2_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
-   IOMUX_PADS(PAD_SD2_DAT3__SD2_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
-   /* Carrier MicroSD Card Detect */
-   IOMUX_PADS(PAD_GPIO_4__GPIO1_IO04  | MUX_PAD_CTRL(NO_PAD_CTRL)),
-};
-
-static iomux_v3_cfg_t const usdhc3_pads[] = {
-   IOMUX_PADS(PAD_SD3_CLK__SD3_CLK| MUX_PAD_CTRL(USDHC_PAD_CTRL)),
-   IOMUX_PADS(PAD_SD3_CMD__SD3_CMD| MUX_PAD_CTRL(USDHC_PAD_CTRL)),
-   IOMUX_PADS(PAD_SD3_DAT0__SD3_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
-   IOMUX_PADS(PAD_SD3_DAT1__SD3_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
-   IOMUX_PADS(PAD_SD3_DAT2__SD3_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
-   IOMUX_PADS(PAD_SD3_DAT3__SD3_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
-   IOMUX_PADS(PAD_SD3_DAT4__SD3_DATA4 | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
-   IOMUX_PADS(PAD_SD3_DAT5__SD3_DATA5 | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
-   IOMUX_PADS(PAD_SD3_DAT6__SD3_DATA6 | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
-   IOMUX_PADS(PAD_SD3_DAT7__SD3_DATA7 | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
-   IOMUX_PADS(PAD_SD3_RST__SD3_RESET  | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
-};
-
-static void setup_iomux_uart(void)
-{
-   SETUP_IOMUX_PADS(uart1_pads);
-}
-
-static struct fsl_esdhc_cfg usdhc_cfg[2] = {
-   {USDHC3_BASE_ADDR},
-   {USDHC2_BASE_ADDR},
-};
-
-int board_mmc_getcd(struct mmc *mmc)
-{
-   struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
-   int ret = 0;
-
-   switch (cfg->esdhc_base) {
-   case USDHC2_BASE_ADDR:
-   ret = !gpio_get_value(USDHC2_CD_GPIO);
-   break;
-   case USDHC3_BASE_ADDR:
-   /*
-* eMMC don't have card detect pin - since it is soldered to the
-* PCB board
-*/
-   ret = 1;
-   break;
-   }
-   return ret;
-}
-
-int board_mmc_init(bd_t *bis)
-{
-   int ret;
-   u32 index = 0;
-
-   /*
-* MMC MAP
-* (U-Boot device node)(Physical Port)
-* mmc0Soldered on board eMMC device
-* mmc1MicroSD card
-*/
-   for (index = 0; index < CONFIG_SYS_FSL_USDHC_NUM; ++index) {
-

[U-Boot] [PATCH v2 10/17] ARM: imx: Covnert mccmon6 to use DM/DTS in the u-boot proper

2019-01-31 Thread Lukasz Majewski
This commit converts mccmon6's u-boot proper (in a single commit to avoid
build breaks) to use solely DM/DTS.

The DTS description of the mccmon6 has been ported from Linux kernel
(v4.20, SHA1: 8fe28cb58bcb235034b64cbbb7550a8a43fd88be)

Signed-off-by: Lukasz Majewski 
---

Changes in v2: None

 arch/arm/dts/imx6q-mccmon6.dts   | 382 +++
 arch/arm/mach-imx/mx6/Kconfig|   7 +
 board/liebherr/mccmon6/mccmon6.c | 161 -
 configs/mccmon6_nor_defconfig|  30 ++-
 configs/mccmon6_sd_defconfig |  29 ++-
 include/configs/mccmon6.h|  18 --
 6 files changed, 444 insertions(+), 183 deletions(-)
 create mode 100644 arch/arm/dts/imx6q-mccmon6.dts

diff --git a/arch/arm/dts/imx6q-mccmon6.dts b/arch/arm/dts/imx6q-mccmon6.dts
new file mode 100644
index 00..27cde56115
--- /dev/null
+++ b/arch/arm/dts/imx6q-mccmon6.dts
@@ -0,0 +1,382 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2019
+ * Lukasz Majewski, DENX Software Engineering, lu...@denx.de
+ *
+ * SPDX-License-Identifier: GPL-2.0+ or X11
+ */
+
+/dts-v1/;
+#include 
+#include "imx6q.dtsi"
+
+/ {
+   model = "Liebherr Nenzig (LWN) iMX6Q";
+   compatible = "lwn,imx6-mccmon6", "fsl,imx6";
+
+   aliases {
+   mmc0 = &usdhc3;
+   mmc1 = &usdhc2;
+   spi0 = &ecspi3;
+   };
+
+   chosen {
+   stdout-path = &uart1;
+   };
+
+   memory@1000 {
+   reg = <0x1000 0x8000>;
+   };
+};
+
+&ecspi3 {
+   cs-gpios = <&gpio4 24 GPIO_ACTIVE_LOW>;
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_ecspi3 &pinctrl_ecspi3_cs &pinctrl_ecspi3_flwp>;
+   spi-max-frequency = <2500>;
+   status = "okay";
+
+   s25sl032p: flash@0 {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   compatible = "jedec,spi-nor";
+   spi-max-frequency = <4000>;
+   reg = <0>;
+   };
+};
+
+&fec {
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_enet>;
+   phy-mode = "rgmii";
+   phy-reset-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>;
+   phy-reset-duration = <10>;
+   phy-reset-post-delay = <1>;
+   /* KSZ9031 PHY SKEW setup - old values * 60 ps */
+   rxc-skew-ps = <1860>;
+   txc-skew-ps = <1860>;
+   txen-skew-ps = <900>;
+   rxdv-skew-ps = <900>;
+   rxd0-skew-ps = <180>;
+   rxd1-skew-ps = <180>;
+   rxd2-skew-ps = <180>;
+   rxd3-skew-ps = <180>;
+   txd0-skew-ps = <120>;
+   txd1-skew-ps = <300>;
+   txd2-skew-ps = <0>;
+   txd3-skew-ps = <120>;
+   status = "okay";
+};
+
+&i2c1 {
+   clock-frequency = <10>;
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_i2c1>;
+   status = "okay";
+};
+
+&i2c2 {
+   clock-frequency = <10>;
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_i2c2>;
+   status = "okay";
+
+   pfuze100: pmic@8 {
+   compatible = "fsl,pfuze100";
+   reg = <0x08>;
+
+   regulators {
+   sw1a_reg: sw1ab {
+   regulator-min-microvolt = <30>;
+   regulator-max-microvolt = <1875000>;
+   regulator-boot-on;
+   regulator-always-on;
+   regulator-ramp-delay = <6250>;
+   };
+
+   sw1c_reg: sw1c {
+   regulator-min-microvolt = <30>;
+   regulator-max-microvolt = <1875000>;
+   regulator-boot-on;
+   regulator-always-on;
+   regulator-ramp-delay = <6250>;
+   };
+
+   sw2_reg: sw2 {
+   regulator-min-microvolt = <80>;
+   regulator-max-microvolt = <395>;
+   regulator-boot-on;
+   regulator-always-on;
+   };
+
+   sw3a_reg: sw3a {
+   regulator-min-microvolt = <40>;
+   regulator-max-microvolt = <1975000>;
+   regulator-boot-on;
+   regulator-always-on;
+   };
+
+   sw3b_reg: sw3b {
+   regulator-min-microvolt = <40>;
+   regulator-max-microvolt = <1975000>;
+   regulator-boot-on;
+   regulator-always-on;
+   };
+
+   sw4_reg: sw4 {
+   regulator-min-microvolt = <80>;
+   regulator-max-microvolt = <330>;
+   };

[U-Boot] [PATCH v2 17/17] imx: Convert mccmon6 to use fitImage instead of uImage+DTB

2019-01-31 Thread Lukasz Majewski
This commit enabled support for fitImage on mccmon6 when we
switch to DT/DTS.

Moreover, it provides Falcon boot functionality to parallel
NOR flash memories (spl_nor.c).

Signed-off-by: Lukasz Majewski 
---

Changes in v2: None

 board/liebherr/mccmon6/spl.c  |  7 ++
 common/spl/spl_nor.c  |  5 
 configs/mccmon6_nor_defconfig |  8 +-
 configs/mccmon6_sd_defconfig  |  6 -
 include/configs/mccmon6.h | 57 +--
 5 files changed, 47 insertions(+), 36 deletions(-)

diff --git a/board/liebherr/mccmon6/spl.c b/board/liebherr/mccmon6/spl.c
index afd080fe26..c5cfea2a55 100644
--- a/board/liebherr/mccmon6/spl.c
+++ b/board/liebherr/mccmon6/spl.c
@@ -324,6 +324,13 @@ void board_boot_order(u32 *spl_boot_list)
}
 }
 
+#ifdef CONFIG_SPL_LOAD_FIT
+int board_fit_config_name_match(const char *name)
+{
+   return 0;
+}
+#endif
+
 #ifdef CONFIG_SPL_OS_BOOT
 int spl_start_uboot(void)
 {
diff --git a/common/spl/spl_nor.c b/common/spl/spl_nor.c
index 969e319de0..c9364072f3 100644
--- a/common/spl/spl_nor.c
+++ b/common/spl/spl_nor.c
@@ -48,6 +48,11 @@ static int spl_nor_load_image(struct spl_image_info 
*spl_image,
  CONFIG_SYS_OS_BASE,
  (void *)header);
 
+#ifdef CONFIG_SYS_SPL_ARGS_ADDR
+   memcpy((void *)CONFIG_SYS_SPL_ARGS_ADDR,
+  (void *)CONFIG_CMD_SPL_NOR_OFS,
+  CONFIG_CMD_SPL_WRITE_SIZE);
+#endif
return ret;
}
 #endif
diff --git a/configs/mccmon6_nor_defconfig b/configs/mccmon6_nor_defconfig
index 93290fcbaf..c69e482eef 100644
--- a/configs/mccmon6_nor_defconfig
+++ b/configs/mccmon6_nor_defconfig
@@ -10,12 +10,18 @@ CONFIG_SPL=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_FIT=y
+CONFIG_SPL_LOAD_FIT=y
 
CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/liebherr/mccmon6/mon6_imximage_nor.cfg"
 # CONFIG_USE_BOOTCOMMAND is not set
 CONFIG_BOUNCE_BUFFER=y
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_ENV_SUPPORT=y
 CONFIG_SPL_NOR_SUPPORT=y
+CONFIG_SPL_OS_BOOT=y
+CONFIG_SYS_OS_BASE=0x818
+CONFIG_CMD_SPL=y
+CONFIG_CMD_SPL_NOR_OFS=0x0960
+CONFIG_CMD_SPL_WRITE_SIZE=0x2
 CONFIG_CMD_CLK=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
@@ -28,7 +34,7 @@ CONFIG_CMD_REGULATOR=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_MTDPARTS=y
 CONFIG_MTDIDS_DEFAULT="nor0=800.nor"
-CONFIG_MTDPARTS_DEFAULT="mtdparts=800.nor:32m@0x0(mccmon6-image.nor),256k@0x4(u-boot-env.nor),1m@0x8(u-boot.nor),8m@0x18(kernel.nor),8m@0x98(swupdate-kernel.nor),8m@0x118(swupdate-rootfs.nor),128k@0x198(kernel-dtb.nor),128k@0x19C(swupdate-kernel-dtb.nor)"
+CONFIG_MTDPARTS_DEFAULT="mtdparts=800.nor:32m@0x0(mccmon6-image.nor),256k@0x4(u-boot-env.nor),1m@0x8(u-boot.nor),8m@0x18(kernel.nor),8m@0x98(swupdate-kernel.nor),8m@0x118(swupdate-rootfs.nor)"
 CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="imx6q-mccmon6"
 CONFIG_ENV_IS_IN_FLASH=y
diff --git a/configs/mccmon6_sd_defconfig b/configs/mccmon6_sd_defconfig
index caa8ec70f9..cb0f5698b1 100644
--- a/configs/mccmon6_sd_defconfig
+++ b/configs/mccmon6_sd_defconfig
@@ -11,12 +11,16 @@ CONFIG_SPL=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_FIT=y
+CONFIG_SPL_LOAD_FIT=y
 
CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/liebherr/mccmon6/mon6_imximage_sd.cfg"
 # CONFIG_USE_BOOTCOMMAND is not set
 CONFIG_BOUNCE_BUFFER=y
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_ENV_SUPPORT=y
 CONFIG_SPL_NOR_SUPPORT=y
+CONFIG_CMD_SPL=y
+CONFIG_CMD_SPL_NOR_OFS=0x0960
+CONFIG_CMD_SPL_WRITE_SIZE=0x2
 CONFIG_CMD_CLK=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
@@ -29,7 +33,7 @@ CONFIG_CMD_REGULATOR=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_MTDPARTS=y
 CONFIG_MTDIDS_DEFAULT="nor0=800.nor"
-CONFIG_MTDPARTS_DEFAULT="mtdparts=800.nor:32m@0x0(mccmon6-image.nor),256k@0x4(u-boot-env.nor),1m@0x8(u-boot.nor),8m@0x18(kernel.nor),8m@0x98(swupdate-kernel.nor),8m@0x118(swupdate-rootfs.nor),128k@0x198(kernel-dtb.nor),128k@0x19C(swupdate-kernel-dtb.nor)"
+CONFIG_MTDPARTS_DEFAULT="mtdparts=800.nor:32m@0x0(mccmon6-image.nor),256k@0x4(u-boot-env.nor),1m@0x8(u-boot.nor),8m@0x18(kernel.nor),8m@0x98(swupdate-kernel.nor),8m@0x118(swupdate-rootfs.nor)"
 CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="imx6q-mccmon6"
 CONFIG_ENV_IS_IN_FLASH=y
diff --git a/include/configs/mccmon6.h b/include/configs/mccmon6.h
index b25aacbf41..c685de6551 100644
--- a/include/configs/mccmon6.h
+++ b/include/configs/mccmon6.h
@@ -14,10 +14,6 @@
 
 #define CONFIG_SYS_UBOOT_START CONFIG_SYS_TEXT_BASE
 #define CONFIG_SYS_UBOOT_BASE (CONFIG_SYS_FLASH_BASE + 0x8)
-#define CONFIG_SPL_OS_BOOT
-#define CONFIG_SYS_OS_BASE (CONFIG_SYS_FLASH_BASE + 0x18)
-#define CONFIG_SYS_FDT_BASE (CONFIG_SYS_FLASH_BASE + 0x198)
-#define CONFIG_SYS_FDT_SIZE (48 * SZ_1K)
 #define CONFIG_SYS_SPL_ARGS_ADDR

[U-Boot] [PATCH v2 04/17] dm: clk: Define clk_get_by_id() for clk operations

2019-01-31 Thread Lukasz Majewski
This commit adds the clk_get_by_id() function, which is responsible
for getting the udevice with matching clk->id. Such approach allows
re-usage of inherit DM list relationship for the same class (UCLASS_CLK).
As a result - we don't need any other external list - it is just enough
to look for UCLASS_CLK related udevices.

Signed-off-by: Lukasz Majewski 
---

Changes in v2: None

 drivers/clk/clk-uclass.c | 22 ++
 include/clk.h| 11 +++
 2 files changed, 33 insertions(+)

diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
index f1640dda67..12ec0baa74 100644
--- a/drivers/clk/clk-uclass.c
+++ b/drivers/clk/clk-uclass.c
@@ -455,6 +455,28 @@ int clk_disable_bulk(struct clk_bulk *bulk)
return 0;
 }
 
+int clk_get_by_id(ulong id, struct clk **c)
+{
+   struct udevice *dev;
+   struct uclass *uc;
+   int ret;
+
+   ret = uclass_get(UCLASS_CLK, &uc);
+   if (ret)
+   return ret;
+
+   uclass_foreach_dev(dev, uc) {
+   struct clk *clk = (struct clk *)dev_get_driver_data(dev);
+
+   if (clk->id == id) {
+   *c = clk;
+   return 0;
+   }
+   }
+
+   return -ENODEV;
+}
+
 UCLASS_DRIVER(clk) = {
.id = UCLASS_CLK,
.name   = "clk",
diff --git a/include/clk.h b/include/clk.h
index 8224295ec3..045e60357d 100644
--- a/include/clk.h
+++ b/include/clk.h
@@ -315,4 +315,15 @@ static inline bool clk_valid(struct clk *clk)
 {
return !!clk->dev;
 }
+
+/**
+ * clk_get_by_id() - Get the clock by knowing its ID
+ *
+ * @id:The clock ID to search for
+ *
+ * @c: A pointer to clock struct that has been found among added clocks
+ *  to UCLASS_CLK
+ * @return zero on success, or -ve error code.
+ */
+int clk_get_by_id(ulong id, struct clk **c);
 #endif
-- 
2.11.0

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


[U-Boot] [PATCH v2 08/17] net: imx: Add support for waiting some time after FEC gpio reset

2019-01-31 Thread Lukasz Majewski
The support for in-kernel (v4.20) "phy-reset-post-delay" property has
been implemented in u-boot's FEC IMX driver. It has the same range (1 to
1000ms) as in Linux.

Some PHYs require waiting some time after the reset to be accessible
via MII bus. This problem has been observed on mccmon6 board with KSZ9031
PHY IC, when DM_ETH was enabled (as DM slightly changes time between
PHY initialization and first access).

Signed-off-by: Lukasz Majewski 
---

Changes in v2: None

 drivers/net/fec_mxc.c | 11 +++
 drivers/net/fec_mxc.h |  1 +
 2 files changed, 12 insertions(+)

diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 1a59026a62..6305aa5c05 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -1315,6 +1315,8 @@ static void fec_gpio_reset(struct fec_priv *priv)
dm_gpio_set_value(&priv->phy_reset_gpio, 1);
mdelay(priv->reset_delay);
dm_gpio_set_value(&priv->phy_reset_gpio, 0);
+   if (priv->post_reset_delay)
+   mdelay(priv->post_reset_delay);
}
 }
 #endif
@@ -1474,6 +1476,15 @@ static int fecmxc_ofdata_to_platdata(struct udevice *dev)
/* property value wrong, use default value */
priv->reset_delay = 1;
}
+
+   priv->post_reset_delay = dev_read_u32_default(dev,
+ "phy-reset-post-delay",
+ 0);
+   if (priv->post_reset_delay > 1000) {
+   printf("FEC MXC: phy reset post delay should be <= 1000ms\n");
+   /* property value wrong, use default value */
+   priv->post_reset_delay = 0;
+   }
 #endif
 
return 0;
diff --git a/drivers/net/fec_mxc.h b/drivers/net/fec_mxc.h
index e9a661f0a1..d069af533a 100644
--- a/drivers/net/fec_mxc.h
+++ b/drivers/net/fec_mxc.h
@@ -258,6 +258,7 @@ struct fec_priv {
 #ifdef CONFIG_DM_GPIO
struct gpio_desc phy_reset_gpio;
uint32_t reset_delay;
+   u32 post_reset_delay;
 #endif
 #ifdef CONFIG_DM_ETH
u32 interface;
-- 
2.11.0

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


[U-Boot] [PATCH v2 09/17] spi: imx: Add support for 'per' clock enabling via driver model

2019-01-31 Thread Lukasz Majewski
With this commit one can enable ECSPI clock on imx6q without the need to
define direct call to it in the board file (as it is done up to now).

The information regarding proper clocks is provided via DTS description.

Signed-off-by: Lukasz Majewski 
---

Changes in v2: None

 drivers/spi/mxc_spi.c | 17 +
 1 file changed, 17 insertions(+)

diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c
index 6846762719..f34506099e 100644
--- a/drivers/spi/mxc_spi.c
+++ b/drivers/spi/mxc_spi.c
@@ -7,6 +7,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -50,6 +51,9 @@ struct mxc_spi_slave {
unsigned intmax_hz;
unsigned intmode;
struct gpio_desc ss;
+#if CONFIG_IS_ENABLED(CLK)
+   struct clk per_clk;
+#endif
 };
 
 static inline struct mxc_spi_slave *to_mxc_spi_slave(struct spi_slave *slave)
@@ -494,6 +498,19 @@ static int mxc_spi_probe(struct udevice *bus)
const void *blob = gd->fdt_blob;
int ret;
 
+#if CONFIG_IS_ENABLED(CLK)
+   ret = clk_get_by_name(bus, "per", &mxcs->per_clk);
+   if (ret) {
+   printf("%s: Failed to get per_clk\n", __func__);
+   return ret;
+   }
+
+   ret = clk_enable(&mxcs->per_clk);
+   if (ret) {
+   printf("%s: Failed to enable per_clk\n", __func__);
+   return ret;
+   }
+#endif
if (gpio_request_by_name(bus, "cs-gpios", 0, &plat->ss,
 GPIOD_IS_OUT)) {
dev_err(bus, "No cs-gpios property\n");
-- 
2.11.0

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


[U-Boot] [PATCH v2 06/17] ARM: imx: cosmetic: Remove not needed comment from the mccmon6.h file

2019-01-31 Thread Lukasz Majewski
This comment is a leftover from the Kconfig CONFIG_*MTD* move.

Signed-off-by: Lukasz Majewski 
---

Changes in v2: None

 include/configs/mccmon6.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/include/configs/mccmon6.h b/include/configs/mccmon6.h
index 644f339993..86ab66f3ab 100644
--- a/include/configs/mccmon6.h
+++ b/include/configs/mccmon6.h
@@ -70,8 +70,6 @@
 #define CONFIG_SYS_FLASH_BANKS_LIST{ (CONFIG_SYS_FLASH_BASE) }
 #define CONFIG_SYS_FLASH_BANKS_SIZES   { (32 * SZ_1M) }
 
-/* MTD support */
-
 /* USB Configs */
 #define CONFIG_USB_MAX_CONTROLLER_COUNT2
 #define CONFIG_MXC_USB_PORTSC  (PORT_PTS_UTMI | PORT_PTS_PTW)
-- 
2.11.0

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


[U-Boot] [PATCH v2 07/17] ARM: imx: config: Disable support for USB on MCCMON6

2019-01-31 Thread Lukasz Majewski
The IMX6Q based MCCMON6 is not using USB for any purpose.

Signed-off-by: Lukasz Majewski 
---

Changes in v2: None

 configs/mccmon6_nor_defconfig | 2 --
 configs/mccmon6_sd_defconfig  | 2 --
 include/configs/mccmon6.h | 5 -
 3 files changed, 9 deletions(-)

diff --git a/configs/mccmon6_nor_defconfig b/configs/mccmon6_nor_defconfig
index 1ab29c1ca6..18070cd0b1 100644
--- a/configs/mccmon6_nor_defconfig
+++ b/configs/mccmon6_nor_defconfig
@@ -19,7 +19,6 @@ CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_SF=y
-CONFIG_CMD_USB=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_MTDPARTS=y
@@ -46,5 +45,4 @@ CONFIG_MII=y
 CONFIG_SPI=y
 CONFIG_MXC_SPI=y
 CONFIG_DM_THERMAL=y
-CONFIG_USB=y
 CONFIG_OF_LIBFDT=y
diff --git a/configs/mccmon6_sd_defconfig b/configs/mccmon6_sd_defconfig
index 6d47db57ee..d1d1313e1e 100644
--- a/configs/mccmon6_sd_defconfig
+++ b/configs/mccmon6_sd_defconfig
@@ -20,7 +20,6 @@ CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_SF=y
-CONFIG_CMD_USB=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_MTDPARTS=y
@@ -47,5 +46,4 @@ CONFIG_MII=y
 CONFIG_SPI=y
 CONFIG_MXC_SPI=y
 CONFIG_DM_THERMAL=y
-CONFIG_USB=y
 CONFIG_OF_LIBFDT=y
diff --git a/include/configs/mccmon6.h b/include/configs/mccmon6.h
index 86ab66f3ab..5ca9bc6848 100644
--- a/include/configs/mccmon6.h
+++ b/include/configs/mccmon6.h
@@ -70,11 +70,6 @@
 #define CONFIG_SYS_FLASH_BANKS_LIST{ (CONFIG_SYS_FLASH_BASE) }
 #define CONFIG_SYS_FLASH_BANKS_SIZES   { (32 * SZ_1M) }
 
-/* USB Configs */
-#define CONFIG_USB_MAX_CONTROLLER_COUNT2
-#define CONFIG_MXC_USB_PORTSC  (PORT_PTS_UTMI | PORT_PTS_PTW)
-#define CONFIG_MXC_USB_FLAGS   0
-
 /* Ethernet Configuration */
 #define CONFIG_FEC_MXC
 #define IMX_FEC_BASE   ENET_BASE_ADDR
-- 
2.11.0

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


[U-Boot] [PATCH v2 03/17] dm: clk: Define clk_get_parent_rate() for clk operations

2019-01-31 Thread Lukasz Majewski
This commit adds the clk_get_parent_rate() function, which is responsible
for getting the rate of parent clock.
Unfortunately, u-boot's DM support for getting parent is different
(the parent relationship is in udevice) than the one in common clock
framework (CCF) in Linux.

To alleviate this problem - the clk_get_parent_rate() function has been
introduced to clk-uclass.c.

As written in the in-code comment - some clocks do not set clk->id (and
require it to be set to 0) and hence the standard ckl_{request|get_rate|
free} API is used.

Signed-off-by: Lukasz Majewski 
---

Changes in v2: None

 drivers/clk/clk-uclass.c | 41 +
 include/clk.h|  9 +
 2 files changed, 50 insertions(+)

diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
index 6d7a514006..f1640dda67 100644
--- a/drivers/clk/clk-uclass.c
+++ b/drivers/clk/clk-uclass.c
@@ -340,6 +340,47 @@ ulong clk_get_rate(struct clk *clk)
return ops->get_rate(clk);
 }
 
+ulong clk_get_parent_rate(struct clk *clk)
+{
+   const struct clk_ops *ops;
+   struct udevice *pdev;
+   struct clk pclk;
+   ulong rate;
+   int ret;
+
+   debug("%s(clk=%p)\n", __func__, clk);
+
+   pdev = clk->dev->parent;
+   if (!pdev)
+   return -ENODEV;
+
+   ops = clk_dev_ops(pdev);
+   if (!ops->get_rate)
+   return -ENOSYS;
+
+   /*
+* We do use memset, clk_{request|get_rate|free}
+* as there are clocks - like the "fixed" ones, which
+* doesn't posses the clk wrapper struct (just added to
+* UCLASS_CLK) and explicitly check if clk->id = 0.
+*
+* In fact the "clock" resources (like ops, description)
+* are accessed via udevice structure (pdev - parent's one)
+*/
+
+   memset(&pclk, 0, sizeof(pclk));
+   ret = clk_request(pdev, &pclk);
+   if (ret) {
+   printf("%s: pclk: %s request failed!\n", __func__, pdev->name);
+   return ret;
+   }
+
+   rate = clk_get_rate(&pclk);
+   clk_free(&pclk);
+
+   return rate;
+}
+
 ulong clk_set_rate(struct clk *clk, ulong rate)
 {
const struct clk_ops *ops = clk_dev_ops(clk->dev);
diff --git a/include/clk.h b/include/clk.h
index f6fbcc6634..8224295ec3 100644
--- a/include/clk.h
+++ b/include/clk.h
@@ -238,6 +238,15 @@ int clk_free(struct clk *clk);
 ulong clk_get_rate(struct clk *clk);
 
 /**
+ * clk_get_parent_rate() - Get parent of current clock rate.
+ *
+ * @clk:   A clock struct that was previously successfully requested by
+ * clk_request/get_by_*().
+ * @return clock rate in Hz, or -ve error code.
+ */
+ulong clk_get_parent_rate(struct clk *clk);
+
+/**
  * clk_set_rate() - Set current clock rate.
  *
  * @clk:   A clock struct that was previously successfully requested by
-- 
2.11.0

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


[U-Boot] [PATCH v2 02/17] cmd: Do not show frequency for clocks which .get_rate() return error

2019-01-31 Thread Lukasz Majewski
It may happen that some UCLASS_CLK clocks drivers work as a "managers",
to call other, proper clocks. This situation is present in the iMX{6|8}
clocks when supporting CONFIG_CLK (and CCF).

To avoid bogus output of "clk dump" we omit clocks which return error
value - allowing reusing default implementation of this command.

Signed-off-by: Lukasz Majewski 
---

Changes in v2: None

 cmd/clk.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/cmd/clk.c b/cmd/clk.c
index fd4231589c..2ea82176aa 100644
--- a/cmd/clk.c
+++ b/cmd/clk.c
@@ -16,6 +16,7 @@ int __weak soc_clk_dump(void)
struct udevice *dev;
struct uclass *uc;
struct clk clk;
+   ulong rate;
int ret;
 
/* Device addresses start at 1 */
@@ -37,7 +38,9 @@ int __weak soc_clk_dump(void)
continue;
}
 
-   printf("%-30.30s : %lu Hz\n", dev->name, clk_get_rate(&clk));
+   rate = clk_get_rate(&clk);
+   if (!IS_ERR_VALUE(rate))
+   printf("%-30.30s : %lu Hz\n", dev->name, rate);
 
clk_free(&clk);
}
-- 
2.11.0

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


[U-Boot] [PATCH v2 01/17] dm: Fix documentation entry as there is no UCLASS_CLOCK uclass

2019-01-31 Thread Lukasz Majewski
There is no UCLASS_CLOCK uclass defined. Instead we do use the UCLASS_CLK.

Signed-off-by: Lukasz Majewski 
---

Changes in v2: None

 include/clk.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/clk.h b/include/clk.h
index 8e366163f9..f6fbcc6634 100644
--- a/include/clk.h
+++ b/include/clk.h
@@ -19,7 +19,7 @@
  * clock provider. This API provides a standard means for drivers to enable and
  * disable clocks, and to set the rate at which they oscillate.
  *
- * A driver that implements UCLASS_CLOCK is a clock provider. A provider will
+ * A driver that implements UCLASS_CLK is a clock provider. A provider will
  * often implement multiple separate clocks, since the hardware it manages
  * often has this capability. clk-uclass.h describes the interface which
  * clock providers must implement.
-- 
2.11.0

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


[U-Boot] [RESEND 3/3] armv8: fsl-layerscape: avoid DT fixup warning

2019-01-31 Thread laurentiu . tudor
From: Laurentiu Tudor 

sec_firmware reserves JR3 for it's own usage and deletes the JR3 node
from the device tree. This causes this warning to be issued when doing
the device tree fixup:

WARNING could not find node fsl,sec-v4.0-job-ring: FDT_ERR_NOTFOUND.

Fix it by excluding the device tree fixup for the JR reserved by
sec_firmware.

Signed-off-by: Laurentiu Tudor 
---
 arch/arm/include/asm/arch-fsl-layerscape/fsl_icid.h | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/arch-fsl-layerscape/fsl_icid.h 
b/arch/arm/include/asm/arch-fsl-layerscape/fsl_icid.h
index e7a8801262..f971af8d26 100644
--- a/arch/arm/include/asm/arch-fsl-layerscape/fsl_icid.h
+++ b/arch/arm/include/asm/arch-fsl-layerscape/fsl_icid.h
@@ -9,6 +9,7 @@
 #include 
 #include 
 #include 
+#include 
 
 struct icid_id_table {
const char *compat;
@@ -98,7 +99,13 @@ void fdt_fixup_icid(void *blob);
CONFIG_SYS_FSL_SEC_ADDR)
 
 #define SET_SEC_JR_ICID_ENTRY(jr_num, streamid) \
-   SET_ICID_ENTRY("fsl,sec-v4.0-job-ring", streamid, \
+   SET_ICID_ENTRY( \
+   (CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT && \
+   (FSL_SEC_JR##jr_num##_OFFSET ==  \
+   SEC_JR3_OFFSET + CONFIG_SYS_FSL_SEC_OFFSET) \
+   ? NULL \
+   : "fsl,sec-v4.0-job-ring"), \
+   streamid, \
(((streamid) << 16) | (streamid)), \
offsetof(ccsr_sec_t, jrliodnr[jr_num].ls) + \
CONFIG_SYS_FSL_SEC_ADDR, \
-- 
2.17.1

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


[U-Boot] [RESEND 2/3] armv8: fsl-layerscape: fix SEC QI ICID setup

2019-01-31 Thread laurentiu . tudor
From: Laurentiu Tudor 

The SEC QI ICID setup in the QIIC_LS register is actually an offset
that is being added to the ICID coming from the qman portal. Setting
it with a non-zero value breaks SMMU setup as the resulting ICID is
not known. On top of that, the SEC QI ICID must match the qman portal
ICIDs in order to share the isolation context.

Signed-off-by: Laurentiu Tudor 
---
 arch/arm/cpu/armv8/fsl-layerscape/ls1043_ids.c  | 2 +-
 arch/arm/cpu/armv8/fsl-layerscape/ls1046_ids.c  | 2 +-
 arch/arm/include/asm/arch-fsl-layerscape/fsl_icid.h | 3 +--
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/ls1043_ids.c 
b/arch/arm/cpu/armv8/fsl-layerscape/ls1043_ids.c
index 0e8649427e..3bd993bebf 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/ls1043_ids.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/ls1043_ids.c
@@ -43,7 +43,7 @@ struct icid_id_table icid_tbl[] = {
SET_DEBUG_ICID(FSL_DEBUG_STREAM_ID),
SET_QE_ICID(FSL_QE_STREAM_ID),
 #ifdef CONFIG_FSL_CAAM
-   SET_SEC_QI_ICID(FSL_DPAA1_STREAM_ID_START + 2),
+   SET_SEC_QI_ICID(FSL_DPAA1_STREAM_ID_END),
SET_SEC_JR_ICID_ENTRY(0, FSL_DPAA1_STREAM_ID_START + 3),
SET_SEC_JR_ICID_ENTRY(1, FSL_DPAA1_STREAM_ID_START + 4),
SET_SEC_JR_ICID_ENTRY(2, FSL_DPAA1_STREAM_ID_START + 5),
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/ls1046_ids.c 
b/arch/arm/cpu/armv8/fsl-layerscape/ls1046_ids.c
index 2da9adab5b..abd847b5be 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/ls1046_ids.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/ls1046_ids.c
@@ -41,7 +41,7 @@ struct icid_id_table icid_tbl[] = {
SET_ETR_ICID(FSL_ETR_STREAM_ID),
SET_DEBUG_ICID(FSL_DEBUG_STREAM_ID),
 #ifdef CONFIG_FSL_CAAM
-   SET_SEC_QI_ICID(FSL_DPAA1_STREAM_ID_START + 2),
+   SET_SEC_QI_ICID(FSL_DPAA1_STREAM_ID_END),
SET_SEC_JR_ICID_ENTRY(0, FSL_DPAA1_STREAM_ID_START + 3),
SET_SEC_JR_ICID_ENTRY(1, FSL_DPAA1_STREAM_ID_START + 4),
SET_SEC_JR_ICID_ENTRY(2, FSL_DPAA1_STREAM_ID_START + 5),
diff --git a/arch/arm/include/asm/arch-fsl-layerscape/fsl_icid.h 
b/arch/arm/include/asm/arch-fsl-layerscape/fsl_icid.h
index f375fe7115..e7a8801262 100644
--- a/arch/arm/include/asm/arch-fsl-layerscape/fsl_icid.h
+++ b/arch/arm/include/asm/arch-fsl-layerscape/fsl_icid.h
@@ -93,8 +93,7 @@ void fdt_fixup_icid(void *blob);
 
 #define SET_SEC_QI_ICID(streamid) \
SET_ICID_ENTRY("fsl,sec-v4.0", streamid, \
-   (((streamid) << 16) | (streamid)), \
-   offsetof(ccsr_sec_t, qilcr_ls) + \
+   0, offsetof(ccsr_sec_t, qilcr_ls) + \
CONFIG_SYS_FSL_SEC_ADDR, \
CONFIG_SYS_FSL_SEC_ADDR)
 
-- 
2.17.1

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


[U-Boot] [RESEND 1/3] fsl_sec: fix register layout on Layerscape architectures

2019-01-31 Thread laurentiu . tudor
From: Laurentiu Tudor 

On Layerscape architectures the SEC memory map is 1MB and the
register blocks contained in it are 64KB aligned, not 4KB as
the ccsr_sec structure currently assumes. Fix the layout of
the structure for these architectures.

Signed-off-by: Laurentiu Tudor 
---
 include/fsl_sec.h | 8 
 1 file changed, 8 insertions(+)

diff --git a/include/fsl_sec.h b/include/fsl_sec.h
index 16e3fcb5a1..be08a2b88b 100644
--- a/include/fsl_sec.h
+++ b/include/fsl_sec.h
@@ -121,10 +121,18 @@ typedef struct ccsr_sec {
u32 chanum_ls;  /* CHA Number Register, LS */
u32 secvid_ms;  /* SEC Version ID Register, MS */
u32 secvid_ls;  /* SEC Version ID Register, LS */
+#if defined(CONFIG_FSL_LSCH2) || defined(CONFIG_FSL_LSCH3)
+   u8  res9[0x6f020];
+#else
u8  res9[0x6020];
+#endif
u32 qilcr_ms;   /* Queue Interface LIODN CFG Register, MS */
u32 qilcr_ls;   /* Queue Interface LIODN CFG Register, LS */
+#if defined(CONFIG_FSL_LSCH2) || defined(CONFIG_FSL_LSCH3)
+   u8  res10[0x8ffd8];
+#else
u8  res10[0x8fd8];
+#endif
 } ccsr_sec_t;
 
 #define SEC_CTPR_MS_AXI_LIODN  0x0800
-- 
2.17.1

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


Re: [U-Boot] [upstream-release] [PATCH] pci: layerscape: add option to statically allocate PCI StreamIDs

2019-01-31 Thread Laurentiu Tudor
Hi Bharat,

Actually I've sent this patch by mistake, sorry for that.
I'll drop it and resend the patch series.

---
Best Regards, Laurentiu

On 30.01.2019 16:41, Bharat Bhushan wrote:
> 
> 
>> -Original Message-
>> From: upstream-release-boun...@linux.nxdi.nxp.com > boun...@linux.nxdi.nxp.com> On Behalf Of laurentiu.tu...@nxp.com
>> Sent: Wednesday, January 30, 2019 5:31 PM
>> To: u-boot@lists.denx.de; Prabhakar Kushwaha
>> ; York Sun 
>> Cc: Laurentiu Tudor 
>> Subject: [upstream-release] [PATCH] pci: layerscape: add option to statically
>> allocate PCI StreamIDs
>>
>> From: Laurentiu Tudor 
>>
>> Certain PCI scenarios have more dynamic requirements, e.g. endpoints are
>> "hot-plugged" later in the system lifetime. Add a Kconfig option that allows
>> specifying a maximum number of end-points, per PCI controller and allocate
>> a StreamID for each one.
>>
>> Signed-off-by: Laurentiu Tudor 
>> ---
>>   arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 28 +
>>   drivers/pci/pcie_layerscape_fixup.c   | 38 +++
>>   2 files changed, 66 insertions(+)
>>
>> diff --git a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
>> b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
>> index 2b086da79b..1d633d71a8 100644
>> --- a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
>> +++ b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
>> @@ -571,3 +571,31 @@ config TFABOOT
>>  help
>>Enabling this will make a U-Boot binary that is capable of being
>>booted via TFA.
>> +
>> +menuconfig FSL_PCIE_STATIC_STREAM_IDS
>> +bool "Allocate PCI streamIDs statically"
>> +default n
>> +depends on PCIE_LAYERSCAPE
>> +help
>> +  Statically allocate a certain number of StreamIDs for each PCI
>> +  controller, instead of enumerating the connected endpoints and
>> +  allocate a StreamID for each one. This allocation method can
>> +  be used in more dynamic PCI scenarios, e.g. where endpoints are
>> +  "hot-plugged" later in the system bringup, by statically specifying
>> +  a maximum number of StreamIDs expected for each PCI controller.
>> +
>> +if FSL_PCIE_STATIC_STREAM_IDS
>> +
>> +config FSL_PCIE1_STREAM_IDS_COUNT
>> +default 3
>> +int "Maximum number of streamIDs to allocate for PCI1 controller"
>> +
>> +config FSL_PCIE2_STREAM_IDS_COUNT
>> +default 3
>> +int "Maximum number of streamIDs to allocate for PCI2 controller"
>> +
>> +config FSL_PCIE3_STREAM_IDS_COUNT
>> +default 3
>> +int "Maximum number of streamIDs to allocate for PCI3 controller"
>> +
>> +endif
>> diff --git a/drivers/pci/pcie_layerscape_fixup.c
>> b/drivers/pci/pcie_layerscape_fixup.c
>> index 1a17bd98aa..32355cbf2e 100644
>> --- a/drivers/pci/pcie_layerscape_fixup.c
>> +++ b/drivers/pci/pcie_layerscape_fixup.c
>> @@ -177,6 +177,7 @@ static void fdt_pcie_set_iommu_map_entry(void
>> *blob, struct ls_pcie *pcie,
>>
>>   static void fdt_fixup_pcie(void *blob)
>>   {
>> +#if !CONFIG_FSL_PCIE_STATIC_STREAM_IDS
>>  struct udevice *dev, *bus;
>>  struct ls_pcie *pcie;
>>  int streamid;
>> @@ -215,6 +216,43 @@ static void fdt_fixup_pcie(void *blob)
>>  fdt_pcie_set_iommu_map_entry(blob, pcie, bdf >> 8,
>>   streamid);
>>  }
>> +#else
>> +static const int streamid_cnt[] = {
>> +CONFIG_FSL_PCIE1_STREAM_IDS_COUNT,
>> +CONFIG_FSL_PCIE2_STREAM_IDS_COUNT,
>> +CONFIG_FSL_PCIE3_STREAM_IDS_COUNT
> 
> Why 3 controllers?
> 
>> +};
>> +struct ls_pcie *pcie;
>> +int i, streamid, index;
>> +pci_dev_t bdf;
>> +
>> +list_for_each_entry(pcie, &ls_pcie_list, list) {
>> +for (i = 0; i < streamid_cnt[pcie->idx]; i++) {
>> +streamid = ls_pcie_next_streamid();
>> +if (streamid < 0) {
>> +debug("ERROR: no stream ids free\n");
>> +continue;
> 
> Why to continue if we are out of stream-ids?
> 
>> +}
>> +
>> +index = ls_pcie_next_lut_index(pcie);
>> +if (index < 0) {
>> +debug("ERROR: no LUT indexes free\n");
>> +continue;
> 
> We can error out when out of LUT entry
> 
>> +}
>> +
>> +bdf = PCI_BDF(i, 0, 0);
>> +/* map PCI b.d.f to streamID in LUT */
>> +ls_pcie_lut_set_mapping(pcie, index, bdf >> 8,
>> +streamid);
>> +/* update msi-map in device tree */
>> +fdt_pcie_set_msi_map_entry(blob, pcie, bdf >> 8,
>> +   streamid);
>> +/* update iommu-map in device tree */
>> +fdt_pcie_set_iommu_map_entry(blob, pcie, bdf >>
>> 8,
>> + streamid);
>> +}
>> +   

[U-Boot] [PULL u-boot] Please pull u-boot-amlogic-20190131

2019-01-31 Thread Neil Armstrong
[Oops, wrong subject, now fixed]

Hi Tom,

This PR adds support for HDMI & CVBS video output support for Amlogic GX SoCs.
For simplicity, Anatolij acked to include the video patches along the platform
changes in this PR.
Video has been enabled only on libretech-cc, but will be enabled on the other
boards after broader testing.

Thanks,
Neil


The following changes since commit 535d74a8ae8d194269cefdf59ae17a92cd6e75dc:

  MAINTAINERS: Add Amlogic entry (2019-01-30 21:22:53 -0500)

are available in the Git repository at:

  git://git.denx.de/u-boot-amlogic.git tags/u-boot-amlogic-20190131

for you to fetch changes up to fce1069bfb9b0b12fb760c408833c33243492257:

  arm: libretech-cc: enable video by default (2019-01-31 09:35:01 +0100)


- Add features and fixups to support video on Amlogic GX SoCs
- Add video support for Amlogic GX SoC
- Add DT fixups
- Enable Video and USB Console for libretech-cc board


Jorge Ramirez-Ortiz (2):
  video: dw_hdmi: support SoC specific read/write ops
  video: dw_hdmi: add support for color conversion

Maxime Jourdan (6):
  power: domain: meson-gx-pwrc-vpu: add missing depends
  arm64: dts: meson-gx: vpu should be probed before relocation
  arm64: dts: meson-gx: add hhi reg entry to hdmi_tx
  arm: meson: board-gx: Setup VPU in fdt
  arm: meson64: enable console mux and console env by default
  arm: libretech-cc: enable video by default

Neil Armstrong (3):
  video: Add Meson Video Processing Unit Driver
  arm64: dts: meson-gx: Add hdmi_5v regulator as hdmi tx supply
  configs: meson64: use vidconsole and usbkbd if enabled

 arch/arm/dts/meson-gx-u-boot.dtsi  |   21 +
 arch/arm/dts/meson-gxbb-nanopi-k2-u-boot.dtsi  |7 +
 arch/arm/dts/meson-gxbb-odroidc2-u-boot.dtsi   |7 +
 .../arm/dts/meson-gxl-s905x-khadas-vim-u-boot.dtsi |7 +
 arch/arm/dts/meson-gxl-s905x-khadas-vim.dts|1 +
 .../dts/meson-gxl-s905x-libretech-cc-u-boot.dtsi   |7 +
 arch/arm/dts/meson-gxl-s905x-libretech-cc.dts  |1 +
 arch/arm/dts/meson-gxl-s905x-p212-u-boot.dtsi  |7 +
 arch/arm/dts/meson-gxl-s905x-p212.dts  |1 +
 arch/arm/dts/meson-gxm-khadas-vim2-u-boot.dtsi |7 +
 arch/arm/dts/meson-gxm-khadas-vim2.dts |1 +
 arch/arm/include/asm/arch-meson/meson-vpu.h|   13 +
 arch/arm/mach-meson/board-gx.c |5 +
 configs/khadas-vim2_defconfig  |2 +
 configs/khadas-vim_defconfig   |2 +
 configs/libretech-cc_defconfig |8 +
 configs/odroid-c2_defconfig|2 +
 configs/p212_defconfig |2 +
 drivers/power/domain/Kconfig   |2 +-
 drivers/video/Kconfig  |2 +
 drivers/video/Makefile |1 +
 drivers/video/dw_hdmi.c|  267 +++-
 drivers/video/meson/Kconfig|   12 +
 drivers/video/meson/Makefile   |9 +
 drivers/video/meson/meson_canvas.c |   45 +
 drivers/video/meson/meson_dw_hdmi.c|  445 ++
 drivers/video/meson/meson_dw_hdmi.h|  134 ++
 drivers/video/meson/meson_plane.c  |  177 +++
 drivers/video/meson/meson_registers.h  | 1393 +++
 drivers/video/meson/meson_vclk.c   |  893 
 drivers/video/meson/meson_venc.c   | 1464 
 drivers/video/meson/meson_vpu.c|  211 +++
 drivers/video/meson/meson_vpu.h|   97 ++
 drivers/video/meson/meson_vpu_init.c   |  440 ++
 drivers/video/meson/simplefb_common.c  |   29 +
 drivers/video/meson/simplefb_common.h  |   21 +
 include/configs/meson64.h  |   23 +
 include/dw_hdmi.h  |   74 +
 include/media_bus_format.h |  156 +++
 39 files changed, 5992 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm/dts/meson-gx-u-boot.dtsi
 create mode 100644 arch/arm/dts/meson-gxbb-nanopi-k2-u-boot.dtsi
 create mode 100644 arch/arm/dts/meson-gxbb-odroidc2-u-boot.dtsi
 create mode 100644 arch/arm/dts/meson-gxl-s905x-khadas-vim-u-boot.dtsi
 create mode 100644 arch/arm/dts/meson-gxl-s905x-libretech-cc-u-boot.dtsi
 create mode 100644 arch/arm/dts/meson-gxl-s905x-p212-u-boot.dtsi
 create mode 100644 arch/arm/dts/meson-gxm-khadas-vim2-u-boot.dtsi
 create mode 100644 arch/arm/include/asm/arch-meson/meson-vpu.h
 create mode 100644 drivers/video/meson/Kconfig
 create mode 100644 drivers/video/meson/Makefile
 create mode 100644 drivers/video/meson/meson_canvas.c
 create mode 100644 drivers/video/meson/meson_dw_hdmi.c
 cr

[U-Boot] [PULL u-boot] Please pull u-boot-amlogic-20190129

2019-01-31 Thread Neil Armstrong
Hi Tom,

This PR adds support for HDMI & CVBS video output support for Amlogic GX SoCs.
For simplicity, Anatolij acked to include the video patches along the platform
changes in this PR.
Video has been enabled only on libretech-cc, but will be enabled on the other
boards after broader testing.

Thanks,
Neil


The following changes since commit 535d74a8ae8d194269cefdf59ae17a92cd6e75dc:

  MAINTAINERS: Add Amlogic entry (2019-01-30 21:22:53 -0500)

are available in the Git repository at:

  git://git.denx.de/u-boot-amlogic.git tags/u-boot-amlogic-20190131

for you to fetch changes up to fce1069bfb9b0b12fb760c408833c33243492257:

  arm: libretech-cc: enable video by default (2019-01-31 09:35:01 +0100)


- Add features and fixups to support video on Amlogic GX SoCs
- Add video support for Amlogic GX SoC
- Add DT fixups
- Enable Video and USB Console for libretech-cc board


Jorge Ramirez-Ortiz (2):
  video: dw_hdmi: support SoC specific read/write ops
  video: dw_hdmi: add support for color conversion

Maxime Jourdan (6):
  power: domain: meson-gx-pwrc-vpu: add missing depends
  arm64: dts: meson-gx: vpu should be probed before relocation
  arm64: dts: meson-gx: add hhi reg entry to hdmi_tx
  arm: meson: board-gx: Setup VPU in fdt
  arm: meson64: enable console mux and console env by default
  arm: libretech-cc: enable video by default

Neil Armstrong (3):
  video: Add Meson Video Processing Unit Driver
  arm64: dts: meson-gx: Add hdmi_5v regulator as hdmi tx supply
  configs: meson64: use vidconsole and usbkbd if enabled

 arch/arm/dts/meson-gx-u-boot.dtsi  |   21 +
 arch/arm/dts/meson-gxbb-nanopi-k2-u-boot.dtsi  |7 +
 arch/arm/dts/meson-gxbb-odroidc2-u-boot.dtsi   |7 +
 .../arm/dts/meson-gxl-s905x-khadas-vim-u-boot.dtsi |7 +
 arch/arm/dts/meson-gxl-s905x-khadas-vim.dts|1 +
 .../dts/meson-gxl-s905x-libretech-cc-u-boot.dtsi   |7 +
 arch/arm/dts/meson-gxl-s905x-libretech-cc.dts  |1 +
 arch/arm/dts/meson-gxl-s905x-p212-u-boot.dtsi  |7 +
 arch/arm/dts/meson-gxl-s905x-p212.dts  |1 +
 arch/arm/dts/meson-gxm-khadas-vim2-u-boot.dtsi |7 +
 arch/arm/dts/meson-gxm-khadas-vim2.dts |1 +
 arch/arm/include/asm/arch-meson/meson-vpu.h|   13 +
 arch/arm/mach-meson/board-gx.c |5 +
 configs/khadas-vim2_defconfig  |2 +
 configs/khadas-vim_defconfig   |2 +
 configs/libretech-cc_defconfig |8 +
 configs/odroid-c2_defconfig|2 +
 configs/p212_defconfig |2 +
 drivers/power/domain/Kconfig   |2 +-
 drivers/video/Kconfig  |2 +
 drivers/video/Makefile |1 +
 drivers/video/dw_hdmi.c|  267 +++-
 drivers/video/meson/Kconfig|   12 +
 drivers/video/meson/Makefile   |9 +
 drivers/video/meson/meson_canvas.c |   45 +
 drivers/video/meson/meson_dw_hdmi.c|  445 ++
 drivers/video/meson/meson_dw_hdmi.h|  134 ++
 drivers/video/meson/meson_plane.c  |  177 +++
 drivers/video/meson/meson_registers.h  | 1393 +++
 drivers/video/meson/meson_vclk.c   |  893 
 drivers/video/meson/meson_venc.c   | 1464 
 drivers/video/meson/meson_vpu.c|  211 +++
 drivers/video/meson/meson_vpu.h|   97 ++
 drivers/video/meson/meson_vpu_init.c   |  440 ++
 drivers/video/meson/simplefb_common.c  |   29 +
 drivers/video/meson/simplefb_common.h  |   21 +
 include/configs/meson64.h  |   23 +
 include/dw_hdmi.h  |   74 +
 include/media_bus_format.h |  156 +++
 39 files changed, 5992 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm/dts/meson-gx-u-boot.dtsi
 create mode 100644 arch/arm/dts/meson-gxbb-nanopi-k2-u-boot.dtsi
 create mode 100644 arch/arm/dts/meson-gxbb-odroidc2-u-boot.dtsi
 create mode 100644 arch/arm/dts/meson-gxl-s905x-khadas-vim-u-boot.dtsi
 create mode 100644 arch/arm/dts/meson-gxl-s905x-libretech-cc-u-boot.dtsi
 create mode 100644 arch/arm/dts/meson-gxl-s905x-p212-u-boot.dtsi
 create mode 100644 arch/arm/dts/meson-gxm-khadas-vim2-u-boot.dtsi
 create mode 100644 arch/arm/include/asm/arch-meson/meson-vpu.h
 create mode 100644 drivers/video/meson/Kconfig
 create mode 100644 drivers/video/meson/Makefile
 create mode 100644 drivers/video/meson/meson_canvas.c
 create mode 100644 drivers/video/meson/meson_dw_hdmi.c
 create mode 100644 drivers/video/m

Re: [U-Boot] [PATCH 1/1] x86: #define CONFIG_LOADADDR 0x1100000

2019-01-31 Thread Bin Meng
On Thu, Jan 31, 2019 at 4:04 PM Alexander Graf  wrote:
>
>
>
> On 31.01.19 08:59, Bin Meng wrote:
> > Hi Alex,
> >
> > On Thu, Jan 31, 2019 at 3:57 PM Alexander Graf  wrote:
> >>
> >>
> >>
> >>> Am 31.01.2019 um 08:50 schrieb Bin Meng :
> >>>
> >>> Hi Heinrich,
> >>>
>  On Fri, Jan 25, 2019 at 4:18 AM Heinrich Schuchardt  
>  wrote:
> 
>  arch/x86/dts/qemu-x86_i440fx.dts reserves memory for PCI at 0x100.
> >>>
> >>> I think you misread the codes. 0x100 means PCI I/O space, not the
> >>> actual address here. See FDT_PCI_SPACE_IO in fdtdec.h.
> >>
> >> It still crashes. Can you explain why? :)
> >>
> >
> > I did a 'dhcp' just now, no crashes. What test cases are you using?
> >
> > logs:
> >
> > U-Boot SPL 2019.01-00430-g6b4b811 (Jan 31 2019 - 15:55:57 +0800)
> > CPU: x86_64, vendor AMD, device 663h
> > Trying to boot from SPI
> > Jumping to 64-bit U-Boot: Note many features are missing
> >
> >
> > U-Boot 2019.01-00430-g6b4b811 (Jan 31 2019 - 15:55:57 +0800)
> >
> > CPU:   QEMU Virtual CPU version 2.5+
> > DRAM:  128 MiB
> > Incorrect expansion ROM header signature 4baa
> > Model: QEMU x86 (I440FX)
> > Net:   e1000: 52:54:00:12:34:56
> >
> > Warning: e1000#0 using MAC address from ROM
> > eth0: e1000#0
> > Hit any key to stop autoboot:  0
> > => dhcp
> > BOOTP broadcast 1
> > BOOTP broadcast 2
> > BOOTP broadcast 3
> > BOOTP broadcast 4
> > BOOTP broadcast 5
> > BOOTP broadcast 6
> > BOOTP broadcast 7
> > BOOTP broadcast 8
> > BOOTP broadcast 9
> > BOOTP broadcast 10
> > BOOTP broadcast 11
> > BOOTP broadcast 12
> > BOOTP broadcast 13
> > BOOTP broadcast 14
> > BOOTP broadcast 15
> > BOOTP broadcast 16
> > BOOTP broadcast 17
> >
> > Retry time exceeded; starting again
> > =>
>
> Well, it doesn't actually load any file.
>
> Try:
>
>  $ qemu-system-x86_64 -bios u-boot.rom -nographic -net nic -net
> user,tftp=.,bootfile=u-boot
>
> That should crash once you run "dhcp".
>

OK, I've reproduced this. It turns out 0x100 is where the page
table locates in the 64-bit mode, so we can't overwrite its contents.
I will send a patch to change that address.

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


[U-Boot] [PATCH] board/BuR/brppt1: drop DM_I2C_COMPAT

2019-01-31 Thread Hannes Schmelzer
The TPS62517 PMIC driver has been partially converted to DM, so the
legacy I2C access layer isn't needed anymore.

Signed-off-by: Hannes Schmelzer 

---

 board/BuR/brppt1/board.c  | 5 ++---
 board/BuR/brxre1/board.c  | 2 +-
 board/BuR/common/bur_common.h | 2 +-
 board/BuR/common/common.c | 7 ---
 configs/brppt1_mmc_defconfig  | 1 -
 configs/brppt1_nand_defconfig | 1 -
 configs/brppt1_spi_defconfig  | 1 -
 7 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/board/BuR/brppt1/board.c b/board/BuR/brppt1/board.c
index d2e7c72..b8ab19c 100644
--- a/board/BuR/brppt1/board.c
+++ b/board/BuR/brppt1/board.c
@@ -106,9 +106,8 @@ void am33xx_spl_board_init(void)
 
/* setup I2C */
enable_i2c_pin_mux();
-   i2c_set_bus_num(0);
-   i2c_init(CONFIG_SYS_OMAP24_I2C_SPEED, CONFIG_SYS_OMAP24_I2C_SLAVE);
-   pmicsetup(0);
+
+   pmicsetup(0, 0);
 
/* peripheral reset */
rc = gpio_request(64 + 29, "GPMC_WAIT1");
diff --git a/board/BuR/brxre1/board.c b/board/BuR/brxre1/board.c
index 41ed28b..82c53d5 100644
--- a/board/BuR/brxre1/board.c
+++ b/board/BuR/brxre1/board.c
@@ -132,7 +132,7 @@ void am33xx_spl_board_init(void)
puts("ERROR: i2c_set_bus_speed failed! (turn on PWR_nEN)\n");
}
 
-   pmicsetup(0);
+   pmicsetup(0, 0);
 }
 
 const struct dpll_params *get_dpll_ddr_params(void)
diff --git a/board/BuR/common/bur_common.h b/board/BuR/common/bur_common.h
index 5f2d0d0..f743194 100644
--- a/board/BuR/common/bur_common.h
+++ b/board/BuR/common/bur_common.h
@@ -15,7 +15,7 @@
 
 int load_lcdtiming(struct am335x_lcdpanel *panel);
 void br_summaryscreen(void);
-void pmicsetup(u32 mpupll);
+void pmicsetup(u32 mpupll, unsigned int bus);
 void enable_uart0_pin_mux(void);
 void enable_i2c_pin_mux(void);
 void enable_board_pin_mux(void);
diff --git a/board/BuR/common/common.c b/board/BuR/common/common.c
index f3eae5c..a1f7c44 100644
--- a/board/BuR/common/common.c
+++ b/board/BuR/common/common.c
@@ -269,13 +269,14 @@ int ft_board_setup(void *blob, bd_t *bd)
 
 static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
 
-void pmicsetup(u32 mpupll)
+void pmicsetup(u32 mpupll, unsigned int bus)
 {
int mpu_vdd;
int usb_cur_lim;
 
-   if (i2c_probe(TPS65217_CHIP_PM)) {
-   puts("PMIC (0x24) not found! skip further initalization.\n");
+   if (power_tps65217_init(bus)) {
+   printf("WARN: cannot setup PMIC 0x24 @ bus #%d, not found!.\n",
+  bus);
return;
}
 
diff --git a/configs/brppt1_mmc_defconfig b/configs/brppt1_mmc_defconfig
index 083b5f7..f2d8220 100644
--- a/configs/brppt1_mmc_defconfig
+++ b/configs/brppt1_mmc_defconfig
@@ -71,7 +71,6 @@ CONFIG_SPL_DM_SEQ_ALIAS=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_DM_GPIO=y
 CONFIG_DM_I2C=y
-CONFIG_DM_I2C_COMPAT=y
 CONFIG_I2C_SET_DEFAULT_BUS_NUM=y
 CONFIG_MISC=y
 CONFIG_DM_MMC=y
diff --git a/configs/brppt1_nand_defconfig b/configs/brppt1_nand_defconfig
index 1cfd5fc..275727d 100644
--- a/configs/brppt1_nand_defconfig
+++ b/configs/brppt1_nand_defconfig
@@ -73,7 +73,6 @@ CONFIG_BLK=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_DM_GPIO=y
 CONFIG_DM_I2C=y
-CONFIG_DM_I2C_COMPAT=y
 CONFIG_I2C_SET_DEFAULT_BUS_NUM=y
 CONFIG_MISC=y
 # CONFIG_MMC is not set
diff --git a/configs/brppt1_spi_defconfig b/configs/brppt1_spi_defconfig
index 3737396..668c4c2 100644
--- a/configs/brppt1_spi_defconfig
+++ b/configs/brppt1_spi_defconfig
@@ -76,7 +76,6 @@ CONFIG_SPL_DM_SEQ_ALIAS=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_DM_GPIO=y
 CONFIG_DM_I2C=y
-CONFIG_DM_I2C_COMPAT=y
 CONFIG_I2C_SET_DEFAULT_BUS_NUM=y
 CONFIG_MISC=y
 CONFIG_DM_MMC=y
-- 
2.7.4


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


Re: [U-Boot] [PATCH 1/1] x86: #define CONFIG_LOADADDR 0x1100000

2019-01-31 Thread Alexander Graf


On 31.01.19 08:59, Bin Meng wrote:
> Hi Alex,
> 
> On Thu, Jan 31, 2019 at 3:57 PM Alexander Graf  wrote:
>>
>>
>>
>>> Am 31.01.2019 um 08:50 schrieb Bin Meng :
>>>
>>> Hi Heinrich,
>>>
 On Fri, Jan 25, 2019 at 4:18 AM Heinrich Schuchardt  
 wrote:

 arch/x86/dts/qemu-x86_i440fx.dts reserves memory for PCI at 0x100.
>>>
>>> I think you misread the codes. 0x100 means PCI I/O space, not the
>>> actual address here. See FDT_PCI_SPACE_IO in fdtdec.h.
>>
>> It still crashes. Can you explain why? :)
>>
> 
> I did a 'dhcp' just now, no crashes. What test cases are you using?
> 
> logs:
> 
> U-Boot SPL 2019.01-00430-g6b4b811 (Jan 31 2019 - 15:55:57 +0800)
> CPU: x86_64, vendor AMD, device 663h
> Trying to boot from SPI
> Jumping to 64-bit U-Boot: Note many features are missing
> 
> 
> U-Boot 2019.01-00430-g6b4b811 (Jan 31 2019 - 15:55:57 +0800)
> 
> CPU:   QEMU Virtual CPU version 2.5+
> DRAM:  128 MiB
> Incorrect expansion ROM header signature 4baa
> Model: QEMU x86 (I440FX)
> Net:   e1000: 52:54:00:12:34:56
> 
> Warning: e1000#0 using MAC address from ROM
> eth0: e1000#0
> Hit any key to stop autoboot:  0
> => dhcp
> BOOTP broadcast 1
> BOOTP broadcast 2
> BOOTP broadcast 3
> BOOTP broadcast 4
> BOOTP broadcast 5
> BOOTP broadcast 6
> BOOTP broadcast 7
> BOOTP broadcast 8
> BOOTP broadcast 9
> BOOTP broadcast 10
> BOOTP broadcast 11
> BOOTP broadcast 12
> BOOTP broadcast 13
> BOOTP broadcast 14
> BOOTP broadcast 15
> BOOTP broadcast 16
> BOOTP broadcast 17
> 
> Retry time exceeded; starting again
> =>

Well, it doesn't actually load any file.

Try:

 $ qemu-system-x86_64 -bios u-boot.rom -nographic -net nic -net
user,tftp=.,bootfile=u-boot

That should crash once you run "dhcp".


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


Re: [U-Boot] imx8mq-evk: Outbound network packets lost

2019-01-31 Thread Chris Spencer
On Wed, 30 Jan 2019 at 00:44, Sergey Kubushyn  wrote:
> OK, I've got it working. The problem was DM FEC driver does _NOT_ do pin
> muxing and FEC pins in i.MX8MQ come up as GPIOs after rest so no wonder it
> can't talk to the PHY or whatever else.
>
> I don't know yet if there is some setting that I've missed to force it to do
> pin muxing but didn't find anything appropriate in reference fsl-imx8mq-evk
> board configs or board source files.
>
> Once pin muxing is done in the board file FEC comes up as expected, finds
> the PHY and all network stuff works as expected.
>
> Dedicated "regulator" and PHY reset works OK from DTB provided FEC driver is
> patched for regulator (regulator_set_enable instead of regulator_autoset)
> and PHY reset GPIO set "ACTIVE_LOW" in the board's DTS file (fec driver sets
> it to "1" to reset then resets it to "0").
>
> So it is either pin muxing is missing and one should do it in his board's
> file or I've missed some setting that I can't find to get the DM FEC driver
> to do it itself from DTS file.

Welp. There's no pinctrl driver. That would explain a lot...

The attached patches fix the networking in U-Boot for me (I can at
least ping; haven't tried anything else). If it works for you then I
will submit the patches properly with your Tested-by.

Weirdly, I still get the issue in Linux where it intermittently uses
the wrong phy driver, but, with this change, the generic phy driver
now seems to work fine. I guess maybe U-Boot is now leaving the phy in
a different state that happens to work.

Chris
From 5af35b93185541245b7d77fd8e73e616c4219086 Mon Sep 17 00:00:00 2001
From: Chris Spencer 
Date: Wed, 30 Jan 2019 18:02:02 +
Subject: [PATCH 2/2] imx8mq_evk_defconfig: Enable pinctrl driver

The Ethernet controller is not able to initialise correctly without the
pinctrl driver.

Fixes: 86ac7a9a5d0c ("imx: add i.MX8MQ EVK support")
Signed-off-by: Chris Spencer 
---
 configs/imx8mq_evk_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/imx8mq_evk_defconfig b/configs/imx8mq_evk_defconfig
index 53025e45bc..68656b0cd3 100644
--- a/configs/imx8mq_evk_defconfig
+++ b/configs/imx8mq_evk_defconfig
@@ -29,6 +29,7 @@ CONFIG_SYS_I2C_MXC=y
 CONFIG_DM_MMC=y
 CONFIG_DM_ETH=y
 CONFIG_PINCTRL=y
+CONFIG_PINCTRL_IMX8M=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_REGULATOR_GPIO=y
-- 
2.17.1

From d37b1c7f1049a9db95cdb8e90fc1d770267894ac Mon Sep 17 00:00:00 2001
From: Chris Spencer 
Date: Wed, 30 Jan 2019 17:52:35 +
Subject: [PATCH 1/2] pinctrl: Add pinctrl driver for i.MX8M

This driver is required by fsl-imx8mq.dtsi but was not previously
added.

Fixes: 52df705c9669 ("imx: imx8mq: add dtsi file")
Signed-off-by: Chris Spencer 
---
 drivers/pinctrl/nxp/Kconfig | 14 
 drivers/pinctrl/nxp/Makefile|  1 +
 drivers/pinctrl/nxp/pinctrl-imx8m.c | 35 +
 3 files changed, 50 insertions(+)
 create mode 100644 drivers/pinctrl/nxp/pinctrl-imx8m.c

diff --git a/drivers/pinctrl/nxp/Kconfig b/drivers/pinctrl/nxp/Kconfig
index f1d5a5c50d..61f93be42d 100644
--- a/drivers/pinctrl/nxp/Kconfig
+++ b/drivers/pinctrl/nxp/Kconfig
@@ -75,6 +75,20 @@ config PINCTRL_IMX8
 	  only parses the 'fsl,pins' property and configures related
 	  registers.
 
+config PINCTRL_IMX8M
+	bool "IMX8M pinctrl driver"
+	depends on ARCH_IMX8M && PINCTRL_FULL
+	select DEVRES
+	select PINCTRL_IMX
+	help
+	  Say Y here to enable the imx8m pinctrl driver
+
+	  This provides a simple pinctrl driver for i.MX8M SoC familiy.
+	  This feature depends on device tree configuration. This driver
+	  is different from the linux one, this is a simple implementation,
+	  only parses the 'fsl,pins' property and configure related
+	  registers.
+
 config PINCTRL_VYBRID
 	bool "Vybrid (vf610) pinctrl driver"
 	depends on ARCH_VF610 && PINCTRL_FULL
diff --git a/drivers/pinctrl/nxp/Makefile b/drivers/pinctrl/nxp/Makefile
index 891ee6e477..b340d9448a 100644
--- a/drivers/pinctrl/nxp/Makefile
+++ b/drivers/pinctrl/nxp/Makefile
@@ -5,4 +5,5 @@ obj-$(CONFIG_PINCTRL_IMX7)		+= pinctrl-imx7.o
 obj-$(CONFIG_PINCTRL_IMX7ULP)		+= pinctrl-imx7ulp.o
 obj-$(CONFIG_PINCTRL_IMX_SCU)		+= pinctrl-scu.o
 obj-$(CONFIG_PINCTRL_IMX8)		+= pinctrl-imx8.o
+obj-$(CONFIG_PINCTRL_IMX8M)		+= pinctrl-imx8m.o
 obj-$(CONFIG_PINCTRL_VYBRID)		+= pinctrl-vf610.o
diff --git a/drivers/pinctrl/nxp/pinctrl-imx8m.c b/drivers/pinctrl/nxp/pinctrl-imx8m.c
new file mode 100644
index 00..471e0c8170
--- /dev/null
+++ b/drivers/pinctrl/nxp/pinctrl-imx8m.c
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2017 NXP
+ */
+
+#include 
+#include 
+
+#include "pinctrl-imx.h"
+
+static struct imx_pinctrl_soc_info imx8mq_pinctrl_soc_info;
+
+static int imx8mq_pinctrl_probe(struct udevice *dev)
+{
+	struct imx_pinctrl_soc_info *info =
+		(struct imx_pinctrl_soc_info *)dev_get_driver_data(dev);
+
+	return imx_pinctrl_probe(dev, info);
+}
+
+static const struct udevice_id imx8m_pinctrl_match[

Re: [U-Boot] [PATCH 1/1] x86: #define CONFIG_LOADADDR 0x1100000

2019-01-31 Thread Bin Meng
Hi Alex,

On Thu, Jan 31, 2019 at 3:57 PM Alexander Graf  wrote:
>
>
>
> > Am 31.01.2019 um 08:50 schrieb Bin Meng :
> >
> > Hi Heinrich,
> >
> >> On Fri, Jan 25, 2019 at 4:18 AM Heinrich Schuchardt  
> >> wrote:
> >>
> >> arch/x86/dts/qemu-x86_i440fx.dts reserves memory for PCI at 0x100.
> >
> > I think you misread the codes. 0x100 means PCI I/O space, not the
> > actual address here. See FDT_PCI_SPACE_IO in fdtdec.h.
>
> It still crashes. Can you explain why? :)
>

I did a 'dhcp' just now, no crashes. What test cases are you using?

logs:

U-Boot SPL 2019.01-00430-g6b4b811 (Jan 31 2019 - 15:55:57 +0800)
CPU: x86_64, vendor AMD, device 663h
Trying to boot from SPI
Jumping to 64-bit U-Boot: Note many features are missing


U-Boot 2019.01-00430-g6b4b811 (Jan 31 2019 - 15:55:57 +0800)

CPU:   QEMU Virtual CPU version 2.5+
DRAM:  128 MiB
Incorrect expansion ROM header signature 4baa
Model: QEMU x86 (I440FX)
Net:   e1000: 52:54:00:12:34:56

Warning: e1000#0 using MAC address from ROM
eth0: e1000#0
Hit any key to stop autoboot:  0
=> dhcp
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
BOOTP broadcast 4
BOOTP broadcast 5
BOOTP broadcast 6
BOOTP broadcast 7
BOOTP broadcast 8
BOOTP broadcast 9
BOOTP broadcast 10
BOOTP broadcast 11
BOOTP broadcast 12
BOOTP broadcast 13
BOOTP broadcast 14
BOOTP broadcast 15
BOOTP broadcast 16
BOOTP broadcast 17

Retry time exceeded; starting again
=>

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


<    1   2   3