Re: [PATCH 1/1] doc: random number generation

2020-06-16 Thread Heinrich Schuchardt

On 6/17/20 5:12 AM, Simon Glass wrote:

On Sat, 13 Jun 2020 at 04:59, Heinrich Schuchardt  wrote:


Add random number generation APIs to the HTML documentation.
Fix style issues.

Signed-off-by: Heinrich Schuchardt 
---
  MAINTAINERS   |  1 +
  doc/api/index.rst |  1 +
  doc/api/rng.rst   | 17 +
  include/rand.h|  6 +++---
  include/rng.h | 26 ++
  5 files changed, 40 insertions(+), 11 deletions(-)
  create mode 100644 doc/api/rng.rst


Reviewed-by: Simon Glass 

Maybe it is too late, but I prefer 'rand' to 'rng'. I find 'hwrng'
particularly unreadable...



The patch is already merged. So if you want to rename something you
would have to provide a new patch.

Best regards

Heinrich


Re: [PATCH v3 03/15] configs: ns3: enable clock subsystem

2020-06-16 Thread Rayagonda Kokatanur
Hi Simon,

On Wed, Jun 17, 2020 at 8:42 AM Simon Glass  wrote:
>
> On Wed, 10 Jun 2020 at 04:41, Rayagonda Kokatanur
>  wrote:
> >
> > Enable clock subsystem for ns3.
> >
> > Signed-off-by: Rayagonda Kokatanur 
> > ---
> >  configs/bcm_ns3_defconfig | 2 ++
> >  1 file changed, 2 insertions(+)
>
> It feels like I have already reviewed some of these patches. Can you
> check if you added my review tag correctly?

You reviewed other config patches, not this one. I already put a
review tag for those patches.
Anyway I will put a review tag for this as well.

Thank you,
Rayagonda

>
>
> Regards,
> Simon


Re: [PATCH v3 1/6] drivers: Add a new framework for multiplexer devices

2020-06-16 Thread Simon Glass
On Thu, 11 Jun 2020 at 13:45, Pratyush Yadav  wrote:
>
> From: Jean-Jacques Hiblot 
>
> Add a new subsystem that handles multiplexer controllers. The API is the
> same as in Linux.
>
> Signed-off-by: Jean-Jacques Hiblot 
> Signed-off-by: Pratyush Yadav 
> ---
>  drivers/Kconfig   |   2 +
>  drivers/Makefile  |   1 +
>  drivers/mux/Kconfig   |  11 ++
>  drivers/mux/Makefile  |   6 +
>  drivers/mux/mux-uclass.c  | 311 ++
>  include/dm/uclass-id.h|   1 +
>  include/dt-bindings/mux/mux.h |  17 ++
>  include/mux-internal.h| 109 
>  include/mux.h | 147 
>  9 files changed, 605 insertions(+)
>  create mode 100644 drivers/mux/Kconfig
>  create mode 100644 drivers/mux/Makefile
>  create mode 100644 drivers/mux/mux-uclass.c
>  create mode 100644 include/dt-bindings/mux/mux.h
>  create mode 100644 include/mux-internal.h
>  create mode 100644 include/mux.h

Reviewed-by: Simon Glass 


Re: [PATCH v2 08/10] led: gpio: Default to using node name if label is absent

2020-06-16 Thread Sean Anderson


On 6/16/20 11:11 PM, Simon Glass wrote:
> On Sun, 7 Jun 2020 at 19:27, Sean Anderson  wrote:
>>
>> This more closely mirrors Linux's behaviour, and will make it easier to
>> transition to using function+color in the future.
>>
>> Signed-off-by: Sean Anderson 
>> ---
>> This patch was previously submitted as part of
>> https://patchwork.ozlabs.org/project/uboot/list/?series=161576
>>
>> (no changes since v1)
>>
>>  drivers/led/led_gpio.c | 7 ++-
>>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> Reviewed-by: Simon Glass 
> 
> Is there no test for this?
> 

There is not; I can add one in the next revision if you'd like. We
probably just need to delete a label from the test device tree.

--Sean


Re: [PATCH v2 02/10] test: pinmux: Add test for pin muxing

2020-06-16 Thread Sean Anderson
On 6/16/20 11:11 PM, Simon Glass wrote:
> Hi Sean,
> 
> On Sun, 7 Jun 2020 at 19:27, Sean Anderson  wrote:
>>
>> This extends the pinctrl-sandbox driver to support pin muxing, and adds a
>> test for that behaviour. The test is done in C and not python (like the
>> existing tests for the pinctrl uclass) because it needs to call
>> pinctrl_select_state.  Another option could be to add a command that
>> invokes pinctrl_select_state and then test everything in
>> test/py/tests/test_pinmux.py.
>>
>> The pinctrl-sandbox driver now mimics the way that many pinmux devices
>> work.  There are two groups of pins which are muxed together, as well as
>> four pins which are muxed individually. I have tried to test all normal
>> paths. However, very few error cases are explicitly checked for.
>>
>> Signed-off-by: Sean Anderson 
>> ---
>>
>> Changes in v2:
>> - New
>>
>>  arch/sandbox/dts/test.dts |  45 +++--
>>  drivers/pinctrl/pinctrl-sandbox.c | 155 +++---
>>  test/dm/Makefile  |   3 +
>>  test/py/tests/test_pinmux.py  |  36 +++
>>  4 files changed, 178 insertions(+), 61 deletions(-)
>>
> 
> [..]
> 
> 
>> diff --git a/test/dm/Makefile b/test/dm/Makefile
>> index 0d1c66fa1e..9e273ee02d 100644
>> --- a/test/dm/Makefile
>> +++ b/test/dm/Makefile
>> @@ -76,4 +76,7 @@ obj-$(CONFIG_DM_RNG) += rng.o
>>  obj-$(CONFIG_CLK_K210_SET_RATE) += k210_pll.o
>>  obj-$(CONFIG_SIMPLE_PM_BUS) += simple-pm-bus.o
>>  obj-$(CONFIG_RESET_SYSCON) += syscon-reset.o
>> +ifneq ($(CONFIG_PINMUX),)
>> +obj-$(CONFIG_PINCONF) += pinmux.o
> 
> I don't see this file in your patch.

Whoops, will add it next revision.

> 
>> +endif
>>  endif
>> diff --git a/test/py/tests/test_pinmux.py b/test/py/tests/test_pinmux.py
>> index 4e6df992a4..0cbbae000c 100644
>> --- a/test/py/tests/test_pinmux.py
>> +++ b/test/py/tests/test_pinmux.py
>> @@ -28,15 +28,15 @@ def test_pinmux_status_all(u_boot_console):
> 
> Feel free to convert this to C also if you like. It is faster,
> although perhaps not much faster since it only runs a few commands?

Ok, I can have a look.

Should C be preferred for new tests?

--Sean


Re: [PATCH v2 2/2] test: gpio: Add tests for the managed API

2020-06-16 Thread Simon Glass
On Fri, 29 May 2020 at 15:38, Pratyush Yadav  wrote:
>
> From: Jean-Jacques Hiblot 
>
> Add a test to verify that GPIOs can be acquired/released using the managed
> API. Also check that the GPIOs are released when the consumer device is
> removed.
>
> Signed-off-by: Jean-Jacques Hiblot 
> ---
>  arch/sandbox/dts/test.dts |  10 
>  test/dm/gpio.c| 102 ++
>  2 files changed, 112 insertions(+)

Reviewed-by: Simon Glass 


Re: [PATCH v3 4/6] cmd: Add a mux command

2020-06-16 Thread Simon Glass
On Thu, 11 Jun 2020 at 13:45, Pratyush Yadav  wrote:
>
> This command lets the user list, select, and deselect mux controllers
> introduced with the mux framework on the fly. It has 3 subcommands:
> list, select, and deselect.
>
> List: Lists all the mux present on the system. The muxes are listed for
> each chip. The chip is identified by its device name. Each chip can have
> a number of mux controllers. Each is listed in sequence and is assigned
> a sequential ID based on its position in the mux chip. It lists details
> like ID, whether the mux is currently selected or not, the current
> state, the idle state, and the number of states.
>
> A sample output would look something like:
>
> => mux list
> a-mux-controller:
> ID  SelectedCurrent State   Idle State  Num States
> 0   no  unknown as-is   0x4
> 1   no  0x2 0x2 0x10
> 2   no  0x730x730x100
>
> another-mux-controller:
> ID  SelectedCurrent State   Idle State  Num States
> 0   no  0x1 0x1 0x4
> 1   no  0x2 0x2 0x4
>
> Select: Selects a given mux and puts it in the specified state. This
> subcommand takes 3 arguments: mux chip, mux ID, state to set
> the mux in. The arguments mux chip and mux ID are used to identify which
> mux needs to be selected, and then it is selected to the given state.
> The mux needs to be deselected before it can be selected again in
> another state. The state should be a hexadecimal number.
>
> For example:
> => mux list
> a-mux-controller:
> ID  SelectedCurrent State   Idle State  Num States
> 0   no  0x1 0x1 0x4
> 1   no  0x1 0x1 0x4
> => mux select a-mux-controller 0 0x3
> => mux list
> a-mux-controller:
> ID  SelectedCurrent State   Idle State  Num States
> 0   yes 0x3 0x1 0x4
> 1   no  0x1 0x1 0x4
>
> Deselect: Deselects a given mux and puts it in its idle state. This
> subcommand takes 2 arguments: the mux chip and mux ID to identify which
> mux needs to be deselected. So in the above example, we can deselect mux
> 0 using:
>
> => mux deselect a-mux-controller 0
> => mux list
> a-mux-controller:
> ID  SelectedCurrent State   Idle State  Num States
> 0   no  0x1 0x1 0x4
> 1   no  0x1 0x1 0x4
>
> Signed-off-by: Pratyush Yadav 
> ---
>  cmd/Kconfig  |   6 ++
>  cmd/Makefile |   1 +
>  cmd/mux.c| 161 +++
>  3 files changed, 168 insertions(+)
>  create mode 100644 cmd/mux.c

Reviewed-by: Simon Glass 

Please can you add a patch with a test for this? See
ut_assert_nextline(), etc. and my 'memory search' series.


Re: [PATCH] test_sleep.py: make sleep time and margin configurable

2020-06-16 Thread Simon Glass
Hi Stephen,

On Mon, 8 Jun 2020 at 11:25, Stephen Warren  wrote:
>
> On 6/8/20 11:12 AM, Simon Glass wrote:
> > Hi Stephen,
> >
> > On Mon, 8 Jun 2020 at 10:43, Stephen Warren  wrote:
> >>
> >> On 6/7/20 7:45 AM, Simon Glass wrote:
> >>> On Thu, 4 Jun 2020 at 09:24, Heiko Schocher  wrote:
> 
>  make the sleep time and the margin configurable.
> 
>  Signed-off-by: Heiko Schocher 
>  ---
> 
>  travis build:
>  https://travis-ci.org/github/hsdenx/u-boot-test/builds/694545225
> 
>  This patch is needed as I start test/py now within tbot [1]. On
>  some configurations U-Boot is compiled on a build machine for
>  example in munich, while the board under test is in my lab in
>  hungary.
> 
>  So the 0.25 seconds default margin is often to low because
>  of latencies on the net.
> 
>  See as an example configuration (within tbot):
> 
>  https://github.com/EmbLux-Kft/tbot-tbot2go/blob/devel/boards/aristainetos.py#L29
> 
>  [1] http://tbot.tools/modules/tc.html#u-boot-test-py
> 
>   test/py/tests/test_sleep.py | 14 +++---
>   1 file changed, 11 insertions(+), 3 deletions(-)
> >>>
> >>> Reviewed-by: Simon Glass 
> >>>
> >>> Related, at some point we should change sandbox to fake the time
> >>> movement since this test currently waits for three seconds even on
> >>> sandbox.
> >>
> >> We definitely shouldn't do that; that's the exact kind of failure this
> >> test is intended to detect.
> >
> > No, we're not looking for bugs in sandbox's time handling. We are just
> > testing the plumbing associated with delaying (timer driver, etc.).
>
> The entire purpose of the test is to look for bugs in the backend
> implementation of the time handling. I should know; I wrote the test!

OK and we have time_ut.c as well.

Perhaps we should disable this test on sandbox then? It really doesn't
make sense to be testing timeouts on sandbox IMO and it costs us 3
seconds on each test run.

Regards,
Simon


Re: [PATCH v3 4/5] test/dm: fdtdec: Corect a typo in dm_test_fdtdec_set_carveout()

2020-06-16 Thread Simon Glass
On Tue, 9 Jun 2020 at 23:36, Bin Meng  wrote:
>
> From: Bin Meng 
>
> It should be "writable".
>
> Signed-off-by: Bin Meng 
> ---
>
> (no changes since v1)
>
>  test/dm/fdtdec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

Reviewed-by: Simon Glass 


Re: [PATCH] i2c: eeprom: Use reg property instead of offset and size

2020-06-16 Thread Simon Glass
Hi Michal,

On Wed, 10 Jun 2020 at 07:18, Michal Simek  wrote:
>
> Remove adhoc dt binding for fixed-partition definition for i2c eeprom.
> fixed-partition are using reg property instead of offset/size pair.
>
> Signed-off-by: Michal Simek 
> ---
>
> Just build tested - ge_bx50v3_defconfig
> Definitely please retest on hardware.
> ---
>  arch/arm/dts/imx53-ppd-uboot.dtsi| 12 ++--
>  arch/arm/dts/imx6q-bx50v3-uboot.dtsi | 10 +-
>  drivers/misc/i2c_eeprom.c| 15 +--
>  3 files changed, 16 insertions(+), 21 deletions(-)

Can the sandbox tests update for this?

Regards,
Simon


Re: [PATCH v2] i2c: eeprom: Use reg property instead of offset and size

2020-06-16 Thread Simon Glass
Hi Michal,

On Tue, 16 Jun 2020 at 07:53, Michal Simek  wrote:
>
>
>
> On 16. 06. 20 15:43, Simon Glass wrote:
> > On Mon, 15 Jun 2020 at 07:41, Michal Simek  wrote:
> >>
> >> Remove adhoc dt binding for fixed-partition definition for i2c eeprom.
> >> fixed-partition are using reg property instead of offset/size pair.
> >>
> >> Signed-off-by: Michal Simek 
> >> ---
> >>
> >> Changes in v2:
> >> - Bootcount tested on zynqmp zcu104
> >> - Add missing address/size cells
> >> - Use dev_read_addr_size_index
> >> - Check parameters
> >>
> >> Just build tested - ge_bx50v3_defconfig
> >> Definitely please retest on hardware.
> >>
> >> ---
> >>  arch/arm/dts/imx53-ppd-uboot.dtsi| 15 +--
> >>  arch/arm/dts/imx6q-bx50v3-uboot.dtsi | 12 +++-
> >>  drivers/misc/i2c_eeprom.c| 20 ++--
> >>  3 files changed, 26 insertions(+), 21 deletions(-)
> >>
> >
> > We have a sandbox I2C EEPROM, so you should be able to use the
> > existing test, right?
>
> The way how I have tested it was via drivers/bootcount/i2c-eeprom.c
> driver which define which eeprom stores it.
> Do you have any existing tests for bootcount done via sandbox?
>
> If bootcount is not the right way to go then doing this code should be
> better way. It means just define some partitions (0 size - for failure,
> then proper range, proper write, write behind size for failure).

Can you use drivers/misc/i2c_eeprom.c?

See test/dm/bootcount.c for the sandbox tests for bootcount.

Regards,
Simon
>


Re: [PATCH v3 5/6] sandbox: Enable memio operations in board_init

2020-06-16 Thread Simon Glass
Hi Pratyush,

On Thu, 11 Jun 2020 at 13:45, Pratyush Yadav  wrote:
>
> initr_dm_devices() is called somewhere after board_init(). It can be
> used by drivers to initialize devices to some default bootup state.
> Those devices might use mmio read/write operations to perform the
> initialization.
>
> One such example is the mux devices. The mux framework initializes the
> muxes to their default state after idle state in
> mux_uclass_post_probe(). One type of mux controller is the MMIO mux
> controller. Initializing a MMIO mux to idle state can require a mmio
> read and write operation.
>
> With memio disabled, the reads return 0 and the writes go off into the
> void. This makes it impossible to initialize muxes to their idle state
> on boot, and consequentially makes it impossible to test that in
> sandbox.
>
> These same initializations work fine on actual hardware (tested on TI
> J721E EVM). So, enable memio operations on boot so devices like mux can
> perform whatever initialization they need. state_reset_for_test() will
> disable it before running tests so tests still need to enable memio
> manually.

We have a similar issue with PCI and we only enable it when needed.
Can we do something similar here?

>
> Signed-off-by: Pratyush Yadav 
> ---
>  board/sandbox/sandbox.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/board/sandbox/sandbox.c b/board/sandbox/sandbox.c
> index 1372003018..d7eb207822 100644
> --- a/board/sandbox/sandbox.c
> +++ b/board/sandbox/sandbox.c
> @@ -55,6 +55,8 @@ int board_init(void)
> if (IS_ENABLED(CONFIG_LED))
> led_default_state();
>
> +   sandbox_set_enable_memio(true);
> +
> return 0;
>  }
>
> --
> 2.27.0
>

Regards,
Simon


Re: [RFC PATCH 1/4] common/image.c: image_decomp: put IH_COMP_XXX cases inside ifndef USE_HOSTCC

2020-06-16 Thread Simon Glass
Hi Rasmus,

On Fri, 12 Jun 2020 at 05:02, Rasmus Villemoes
 wrote:
>
> When building host tools, the CONFIG_GZIP etc. symbols are not defined
> anyway, so this does not (should not) change anything [1]. However,
> since the host tools also don't include linux/kconfig.h, one cannot
> use the CONFIG_IS_ENABLED() smartness in a preprocessor conditional,
> which in turn prevents one from adding, say, an
>
>   #if CONFIG_IS_ENABLED(ZSTD)
>
> case.
>
> OTOH, with this, one can do that, and it also makes it possible to
> convert say, "#ifdef CONFIG_GZIP" to "#if CONFIG_IS_ENABLED(GZIP)" to
> make those other cases SPL-or-not-SPL-aware.
>
> [1] The gzip.h header is only included under !USE_HOSTCC, and removing
> the CONFIG_GZIP conditional hence both gives an "no declaration of
> gunzip" warning as well as breaks the link of the host tools, since
> the gunzip code is indeed not linked in.
>
> Signed-off-by: Rasmus Villemoes 
> ---
>  common/image.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/common/image.c b/common/image.c
> index e1ca1a7905..73f6845274 100644
> --- a/common/image.c
> +++ b/common/image.c
> @@ -458,6 +458,7 @@ int image_decomp(int comp, ulong load, ulong image_start, 
> int type,
> else
> ret = -ENOSPC;
> break;
> +#ifndef USE_HOSTCC

In general I'm not a fan of the USE_HOSTCC stuff. I suspect HOST
should be a Kconfig like anything else, although perhaps magically
inserted somehow. Then we can do more things at compile-time.

>  #ifdef CONFIG_GZIP
> case IH_COMP_GZIP: {
> ret = gunzip(load_buf, unc_len, image_buf, &image_len);
> @@ -508,6 +509,7 @@ int image_decomp(int comp, ulong load, ulong image_start, 
> int type,
> break;
> }
>  #endif /* CONFIG_LZ4 */
> +#endif /* !USE_HOSTCC */
> default:
> printf("Unimplemented compression type %d\n", comp);
> return -ENOSYS;
> --
> 2.23.0
>

Regards,
Simon


Re: [PATCH v3 03/15] configs: ns3: enable clock subsystem

2020-06-16 Thread Simon Glass
On Wed, 10 Jun 2020 at 04:41, Rayagonda Kokatanur
 wrote:
>
> Enable clock subsystem for ns3.
>
> Signed-off-by: Rayagonda Kokatanur 
> ---
>  configs/bcm_ns3_defconfig | 2 ++
>  1 file changed, 2 insertions(+)

It feels like I have already reviewed some of these patches. Can you
check if you added my review tag correctly?

Regards,
Simon


Re: [PATCH v3 3/5] test/dm: fdtdec: Add the missing gd declaration

2020-06-16 Thread Simon Glass
On Tue, 9 Jun 2020 at 23:36, Bin Meng  wrote:
>
> From: Bin Meng 
>
> Add DECLARE_GLOBAL_DATA_PTR since it is referenced in the test codes.
>
> Signed-off-by: Bin Meng 
> ---
>
> (no changes since v1)
>
>  test/dm/fdtdec.c | 2 ++
>  1 file changed, 2 insertions(+)

Reviewed-by: Simon Glass 

You may need to rebase this series on u-boot-dm/next


Re: [PATCH v2 9/9] test: sandbox: add test for erase command

2020-06-16 Thread Simon Glass
On Tue, 16 Jun 2020 at 01:41, Patrick Delaunay  wrote:
>
> Add test for the erase command tested on ENV in EXT4.
>
> Signed-off-by: Patrick Delaunay 
> ---
>
> (no changes since v1)
>
>  configs/sandbox64_defconfig|  1 +
>  configs/sandbox_defconfig  |  1 +
>  configs/sandbox_flattree_defconfig |  1 +
>  configs/sandbox_spl_defconfig  |  1 +
>  test/py/tests/test_env.py  | 16 
>  5 files changed, 20 insertions(+)
>

Reviewed-by: Simon Glass 


Re: [PATCH v2 5/9] sandbox: support the change of env location

2020-06-16 Thread Simon Glass
On Tue, 16 Jun 2020 at 01:40, Patrick Delaunay  wrote:
>
> Add support of environment location with a new sandbox command
> 'env_loc'.
>
> When the user change the environment location with the command
> 'env_loc ' the env is reinitialized and saved;
> the GD_FLG_ENV_DEFAULT flag is also updated.
>
> When the user set the same env location, the environment is
> re-loaded.
>
> Signed-off-by: Patrick Delaunay 
> ---
>
> Changes in v2:
> - change cmd_tbl_t to struct cmd_tbl
>
>  board/sandbox/sandbox.c | 42 -
>  1 file changed, 41 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass 


Re: [PATCH v2 2/2] test: reset: Add tests for the managed API

2020-06-16 Thread Simon Glass
On Fri, 12 Jun 2020 at 06:08, Pratyush Yadav  wrote:
>
> From: Jean-Jacques Hiblot 
>
> The tests are basically the same as for the regular API. Except that
> the reset are initialized using the managed API, and no freed manually.
>
> Signed-off-by: Jean-Jacques Hiblot 
> Signed-off-by: Pratyush Yadav 
> ---
>  arch/sandbox/include/asm/reset.h   |  3 ++
>  drivers/reset/sandbox-reset-test.c | 51 ++---
>  drivers/reset/sandbox-reset.c  | 19 ++
>  test/dm/reset.c| 60 ++
>  4 files changed, 127 insertions(+), 6 deletions(-)
>

Reviewed-by: Simon Glass 


Re: Raspberry PI 4 and U-boot

2020-06-16 Thread Simon Glass
Hi Duncan,

On Mon, 15 Jun 2020 at 11:31, Duncan Hare  wrote:
>
> Is there U-Boot with Ethernet available in U-Boot for the Raspberry PI 4?
>
> If not is u-boot without Ethernet available for the Raspberry Pi 4, and and 
> interface spec available for the and Pi 4 Ethernet driver?
>
> I have read that the Ethernet  driver for the Pi 4 is different from the PI 3.

It looks like there are patches on the list for this now.

Regards,
Simon


Re: [PATCH v3 2/6] dm: board: complete the initialization of the muxes in initr_dm()

2020-06-16 Thread Simon Glass
On Thu, 11 Jun 2020 at 13:45, Pratyush Yadav  wrote:
>
> From: Jean-Jacques Hiblot 
>
> This will probe the multiplexer devices that have a "u-boot,mux-autoprobe"
> property. As a consequence they will be put in their idle state.
>
> Signed-off-by: Jean-Jacques Hiblot 
> Signed-off-by: Pratyush Yadav 
> ---
>  common/board_r.c | 12 
>  drivers/mux/mux-uclass.c | 23 +++
>  include/mux.h| 12 
>  3 files changed, 47 insertions(+)
>

Reviewed-by: Simon Glass 


Re: [PATCH 1/1] doc: random number generation

2020-06-16 Thread Simon Glass
On Sat, 13 Jun 2020 at 04:59, Heinrich Schuchardt  wrote:
>
> Add random number generation APIs to the HTML documentation.
> Fix style issues.
>
> Signed-off-by: Heinrich Schuchardt 
> ---
>  MAINTAINERS   |  1 +
>  doc/api/index.rst |  1 +
>  doc/api/rng.rst   | 17 +
>  include/rand.h|  6 +++---
>  include/rng.h | 26 ++
>  5 files changed, 40 insertions(+), 11 deletions(-)
>  create mode 100644 doc/api/rng.rst

Reviewed-by: Simon Glass 

Maybe it is too late, but I prefer 'rand' to 'rng'. I find 'hwrng'
particularly unreadable...


Re: [PATCH v3 3/6] drivers: mux: mmio-based syscon mux controller

2020-06-16 Thread Simon Glass
Hi Pratyush,

On Thu, 11 Jun 2020 at 13:45, Pratyush Yadav  wrote:
>
> From: Jean-Jacques Hiblot 
>
> This adds a driver for mmio-based syscon multiplexers controlled by
> bitfields in a syscon register range.
> This is heavily based on the linux mmio-mux driver.
>
> Signed-off-by: Jean-Jacques Hiblot 
> Reviewed-by: Simon Glass 
> Signed-off-by: Pratyush Yadav 
> ---
>  drivers/mux/Kconfig  |  14 +
>  drivers/mux/Makefile |   1 +
>  drivers/mux/mmio.c   | 143 +++
>  3 files changed, 158 insertions(+)
>  create mode 100644 drivers/mux/mmio.c

Reviewed-by: Simon Glass 

nit below

>
> diff --git a/drivers/mux/Kconfig b/drivers/mux/Kconfig
> index 35c1c5673c..f15ee4f833 100644
> --- a/drivers/mux/Kconfig
> +++ b/drivers/mux/Kconfig
> @@ -8,4 +8,18 @@ config MULTIPLEXER
>  controllers. It provides the same API as Linux and mux drivers should
>  be portable with a minimum effort.
>
> +if MULTIPLEXER
> +
> +config MUX_MMIO
> +   bool "MMIO register bitfield-controlled Multiplexer"
> +   depends on MULTIPLEXER && SYSCON
> +   help
> + MMIO register bitfield-controlled Multiplexer controller.
> +
> + The driver builds multiplexer controllers for bitfields in a syscon
> + register. For N bit wide bitfields, there will be 2^N possible
> + multiplexer states.
> +
> +endif
> +
>  endmenu
> diff --git a/drivers/mux/Makefile b/drivers/mux/Makefile
> index 351e4363d3..78ebf04c7a 100644
> --- a/drivers/mux/Makefile
> +++ b/drivers/mux/Makefile
> @@ -4,3 +4,4 @@
>  # Jean-Jacques Hiblot 
>
>  obj-$(CONFIG_$(SPL_)MULTIPLEXER) += mux-uclass.o
> +obj-$(CONFIG_$(SPL_)MUX_MMIO) += mmio.o
> diff --git a/drivers/mux/mmio.c b/drivers/mux/mmio.c
> new file mode 100644
> index 00..573e599dd1
> --- /dev/null
> +++ b/drivers/mux/mmio.c
> @@ -0,0 +1,143 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * MMIO register bitfield-controlled multiplexer driver
> + * Based on the linux mmio multiplexer driver
> + *
> + * Copyright (C) 2017 Pengutronix, Philipp Zabel 
> + * Copyright (C) 2019 Texas Instrument, Jean-jacques Hiblot 
> + */
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +static int mux_mmio_set(struct mux_control *mux, int state)
> +{
> +   struct regmap_field **fields = dev_get_priv(mux->dev);
> +
> +   return regmap_field_write(fields[mux_control_get_index(mux)], state);
> +}
> +
> +static const struct mux_control_ops mux_mmio_ops = {
> +   .set = mux_mmio_set,
> +};
> +
> +static const struct udevice_id mmio_mux_of_match[] = {
> +   { .compatible = "mmio-mux" },
> +   { /* sentinel */ },
> +};
> +
> +static int mmio_mux_probe(struct udevice *dev)
> +{
> +   struct regmap_field **fields;
> +   struct mux_chip *mux_chip = dev_get_uclass_priv(dev);
> +   struct regmap *regmap;
> +   u32 *mux_reg_masks;
> +   u32 *idle_states;
> +   int num_fields;
> +   int ret;
> +   int i;
> +
> +   regmap = syscon_node_to_regmap(dev_ofnode(dev->parent));
> +   if (IS_ERR(regmap)) {
> +   ret = PTR_ERR(regmap);
> +   dev_err(dev, "failed to get regmap: %d\n", ret);
> +   return ret;
> +   }
> +
> +   num_fields = dev_read_size(dev, "mux-reg-masks");
> +   if (num_fields < 0)
> +   return log_msg_ret("mux-reg-masks missing or invalid", 
> -EINVAL);

It occurred to me at some point that all we really need here is a
short string, like "mux-reg-masks" since we only need to find the
unique string within the function (which logging automatically
records). If we use very long strings then enabling the message
logging will cause a very large increase in code size.

Regards,
Simon


Re: [PATCH v3 02/15] arm: cpu: armv8: add L3 memory flush support

2020-06-16 Thread Simon Glass
On Wed, 10 Jun 2020 at 04:41, Rayagonda Kokatanur
 wrote:
>
> Add L3 memory flush support for NS3.
>
> Signed-off-by: Rayagonda Kokatanur 
> ---
>  arch/arm/cpu/armv8/Makefile  |  1 +
>  arch/arm/cpu/armv8/bcmns3/Makefile   |  5 ++
>  arch/arm/cpu/armv8/bcmns3/lowlevel.S | 90 
>  3 files changed, 96 insertions(+)
>  create mode 100644 arch/arm/cpu/armv8/bcmns3/Makefile
>  create mode 100644 arch/arm/cpu/armv8/bcmns3/lowlevel.S
>
> diff --git a/arch/arm/cpu/armv8/Makefile b/arch/arm/cpu/armv8/Makefile
> index 2e48df0eb9..7e33a183d5 100644
> --- a/arch/arm/cpu/armv8/Makefile
> +++ b/arch/arm/cpu/armv8/Makefile
> @@ -39,3 +39,4 @@ obj-$(CONFIG_S32V234) += s32v234/
>  obj-$(CONFIG_TARGET_HIKEY) += hisilicon/
>  obj-$(CONFIG_ARMV8_PSCI) += psci.o
>  obj-$(CONFIG_ARCH_SUNXI) += lowlevel_init.o
> +obj-$(CONFIG_TARGET_BCMNS3) += bcmns3/
> diff --git a/arch/arm/cpu/armv8/bcmns3/Makefile 
> b/arch/arm/cpu/armv8/bcmns3/Makefile
> new file mode 100644
> index 00..a35e29d11a
> --- /dev/null
> +++ b/arch/arm/cpu/armv8/bcmns3/Makefile
> @@ -0,0 +1,5 @@
> +# SPDX-License-Identifier: GPL-2.0+
> +#
> +# Copyright 2020 Broadcom.
> +
> +obj-y  += lowlevel.o
> diff --git a/arch/arm/cpu/armv8/bcmns3/lowlevel.S 
> b/arch/arm/cpu/armv8/bcmns3/lowlevel.S
> new file mode 100644
> index 00..202286248e
> --- /dev/null
> +++ b/arch/arm/cpu/armv8/bcmns3/lowlevel.S
> @@ -0,0 +1,90 @@
> +/* SPDX-License-Identifier: GPL-2.0+ */
> +/*
> + * Copyright 2020 Broadcom
> + *
> + * Extracted from fsl-layerscape/lowlevel.S

Should this file be common, then? Is the (c) correct?


Re: [PATCH v3 5/5] test/dm: fdtdec: Add tests for fdtdec_add_reserved_memory()

2020-06-16 Thread Simon Glass
On Tue, 9 Jun 2020 at 23:36, Bin Meng  wrote:
>
> From: Bin Meng 
>
> This adds a test case to test the functionality of the fdtdec API
> fdtdec_add_reserved_memory().
>
> Signed-off-by: Bin Meng 
> ---
>
> Changes in v3:
> - correct typo in the comments, and some minor rewording
>
>  test/dm/fdtdec.c | 69 
> 
>  1 file changed, 69 insertions(+)
>

Reviewed-by: Simon Glass 

I think this is useful. But do note that upstream libfdt has some tess also.


Re: [PATCH v3 01/15] board: ns3: add support for Broadcom Northstar 3

2020-06-16 Thread Simon Glass
On Wed, 10 Jun 2020 at 04:41, Rayagonda Kokatanur
 wrote:
>
> Add support for Broadcom Northstar 3 SoC.
> NS3 is a octo-core 64-bit ARMv8 Cortex-A72 processors
> targeting a broad range of networking applications.
>
> Signed-off-by: Rayagonda Kokatanur 
> ---
>  arch/arm/Kconfig   | 10 ++
>  arch/arm/dts/Makefile  |  2 ++
>  arch/arm/dts/ns3-board.dts | 24 +
>  arch/arm/dts/ns3.dtsi  | 34 ++
>  board/broadcom/bcmns3/Kconfig  | 15 
>  board/broadcom/bcmns3/Makefile |  5 +++
>  board/broadcom/bcmns3/ns3.c| 64 ++
>  configs/bcm_ns3_defconfig  | 20 +++
>  include/configs/bcm_ns3.h  | 40 +
>  9 files changed, 214 insertions(+)
>  create mode 100644 arch/arm/dts/ns3-board.dts
>  create mode 100644 arch/arm/dts/ns3.dtsi
>  create mode 100644 board/broadcom/bcmns3/Kconfig
>  create mode 100644 board/broadcom/bcmns3/Makefile
>  create mode 100644 board/broadcom/bcmns3/ns3.c
>  create mode 100644 configs/bcm_ns3_defconfig
>  create mode 100644 include/configs/bcm_ns3.h
>

Reviewed-by: Simon Glass 


Re: [PATCH v2 05/10] gpio: dw: Fix warnings about casting int to pointer

2020-06-16 Thread Simon Glass
On Sun, 7 Jun 2020 at 19:27, Sean Anderson  wrote:
>
> Change the type of gpio_dwabp_platdata.base from fdt_addr_t to a void
> pointer, since we pass it to readl.
>
> Signed-off-by: Sean Anderson 
> Reviewed-by: Bin Meng 
> ---
> This patch was previously submitted as part of
> https://patchwork.ozlabs.org/project/uboot/list/?series=161576
>
> (no changes since v1)
>
>  drivers/gpio/dwapb_gpio.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Simon Glass 


Re: [RFC PATCH 1/1] gpio: Handle NULL pointers gracefully

2020-06-16 Thread Simon Glass
Hi Pratyush,

On Mon, 8 Jun 2020 at 06:37, Pratyush Yadav  wrote:
>
> On 01/06/20 11:08AM, Simon Glass wrote:
> > Hi Pratyush,
> >
> > On Fri, 29 May 2020 at 16:04, Pratyush Yadav  wrote:
> > >
> > > Prepare the way for a managed GPIO API by handling NULL pointers without
> > > crashing or failing. validate_desc() comes from Linux with the prints
> > > removed to reduce code size.
> >
> > Please can you add a little detail as to why this is needed? Are you
> > trying to pass a NULL GPIO descriptor to the function?
>
> Copy-pasting from the cover letter:
>
>   Patch [0] added devm_gpiod_get_index_optional() which would return NULL
>   when when no GPIO was assigned to the requested function. This is
>   convenient for drivers that need to handle optional GPIOs.
>
>   We need to take a stance on who is responsible for the NULL check: the
>   driver or the GPIO core? Do we want to trust drivers to take care of the
>   NULL checks, or do we want to distrust them and make sure they don't
>   send us anything bogus in the GPIO core. Linux does not generally trust
>   drivers and usually verifies anything it gets from them. And FWIW, I see
>   that the clk and phy subsystems in U-Boot also perform checks like this.
>
>   The downside of the checks is of course that they increase code size.
>   They might also slightly decrease performance. The benefit is that we
>   don't burden drivers with taking care of this.

U-Boot has code-size constraints so I would rather rely on automated
testing than run-time checks. Linux has unlimited code size and few
automated tests so it is a different situation.

>   The patch itself is based on a similar patch by Jean-Jacques.
>
>   [0] 
> https://patchwork.ozlabs.org/project/uboot/patch/20200529213808.2815-2-p.ya...@ti.com/
>
> Maybe I should put this in the commit message?

Yes
[..]

> > > +
> > >  /**
> > >   * gpio_desc_init() - Initialize the GPIO descriptor
> > >   *
> > > @@ -303,11 +322,19 @@ int gpio_hog_lookup_name(const char *name, struct 
> > > gpio_desc **desc)
> > >
> > >  int dm_gpio_request(struct gpio_desc *desc, const char *label)
> > >  {
> > > -   struct udevice *dev = desc->dev;
> > > +   struct udevice *dev;
> > > struct gpio_dev_priv *uc_priv;
> > > char *str;
> > > int ret;
> > >
> > > +#ifdef CONFIG_GPIO_VALIDATE_DESC
> >
> > Please drop the #ifdefs and use the static inline thing from above.
>
> Ok.
>
> > > +   ret = validate_desc(desc);
> > > +   if (ret <= 0)
> > > +   return ret;
> >
> > Here you are returning 0 when you did not successfully request the
> > GPIO.You should return -ENOENT, otherwise callers have no idea what
> > happened and will get confused.
>
> Ok. To be clear, it is ok to return 0 in other places this check is
> done, right?

I'm not a fan of that, but I think you can put the checking in your own layer?

>
> > > +#endif
> > > +
> > > +   dev = desc->dev;
> > > +
> > > uc_priv = dev_get_uclass_priv(dev);
> > > if (uc_priv->name[desc->offset])
> > > return -EBUSY;
> > > @@ -434,6 +461,14 @@ static int check_reserved(const struct gpio_desc 
> > > *desc, const char *func)
> > >  {
> > > struct gpio_dev_priv *uc_priv;
> > >
> > > +#ifdef CONFIG_GPIO_VALIDATE_DESC

if (CONFIG_IS_ENABLED(...))

> > > +   int ret;
> > > +
> > > +   ret = validate_desc(desc);
> > > +   if (ret <= 0)
> > > +   return ret;
> > > +#endif

So if validate_desc() is a static function you can always call it, and
have it do nothing (and return 0) if the CONFIG is not enabled.

[..]

> > > diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
> > > index e16c2f31d9..46007b1283 100644
> > > --- a/include/asm-generic/gpio.h
> > > +++ b/include/asm-generic/gpio.h
> > > @@ -149,7 +149,7 @@ struct gpio_desc {
> > >   */
> > >  static inline bool dm_gpio_is_valid(const struct gpio_desc *desc)
> > >  {
> > > -   return desc->dev != NULL;
> > > +   return desc && desc->dev;
> >
> > Needs IS_ENABLED(CONFIG_GPIO_VALIDATE_DESC) somewhere here.
>
> Since this already checks for desc->dev != NULL, I figured it would be
> OK to check for desc being valid too before dereferencing it without
> adding a config check. Are you sure we want to make the desc check
> optional here?

Yes because you are changing the meaning here. I am a little worried
as to where this is heading.

Regards,
Simon


Re: [PATCH v2 0/2] gpio: Add a managed API

2020-06-16 Thread Simon Glass
Hi Pratyush,

On Mon, 8 Jun 2020 at 12:05, Pratyush Yadav  wrote:
>
> Hi Simon,
>
> On 01/06/20 08:45AM, Simon Glass wrote:
> > Hi Pratyush,
> >
> > On Mon, 1 Jun 2020 at 05:22, Pratyush Yadav  wrote:
> > >
> > > On 31/05/20 08:08AM, Simon Glass wrote:
> > > > Hi Pratyush,
> > > >
> > > > On Fri, 29 May 2020 at 15:39, Pratyush Yadav  wrote:
> > > > >
> > > > > Hi,
> > > > >
> > > > > This is a re-submission of Jean-Jacques' earlier work in October last
> > > > > year. It can be found at [0]. The goal is to facilitate porting 
> > > > > drivers
> > > > > from the linux kernel. Most of the series will be about adding managed
> > > > > API to existing infrastructure (GPIO, reset, regmap (already
> > > > > submitted)).
> > > > >
> > > > > This particular series is about GPIOs. It adds a managed API using the
> > > > > API as Linux. To make it 100% compatible with linux, there is a small
> > > > > deviation from u-boot's way of naming the gpio lists: the managed
> > > > > equivalent of gpio_request_by_name(..,"blabla-gpios", ...) is
> > > > > devm_gpiod_get_index(..., "blabla", ...)
> > > > >
> > > > > Changes in v2:
> > > > > - The original series had a patch that checked for NULL pointers in 
> > > > > the
> > > > >   core GPIO functions. The checks were needed because of the addition 
> > > > > of
> > > > >   devm_gpiod_get_index_optional() which would return NULL when when no
> > > > >   GPIO was assigned to the requested function. This is convenient for
> > > > >   drivers that need to handle optional GPIOs.
> > > > >
> > > > >   Simon argued that those should be behind a Kconfig option because of
> > > > >   code size concerns. He also argued against implicit return in the
> > > > >   macro that checked for the optional GPIOs.
> > > > >
> > > > >   This submission removes the controversial patch so that base
> > > > >   functionality can get unblocked.
> > > > >
> > > > >   We still need to take a stance on who is responsible for the NULL
> > > > >   check: the driver or the GPIO core? Do we want to trust drivers to
> > > > >   take care of the NULL checks, or do we want to distrust them and 
> > > > > make
> > > > >   sure they don't send us anything bogus in the GPIO core. For now the
> > > > >   responsibility lies on the drivers by default. I will send a 
> > > > > separate
> > > > >   RFC of the NULL check patch and we can probably discuss the issue
> > > > >   there.
> > > > >
> > > > > [0] 
> > > > > https://patchwork.ozlabs.org/project/uboot/cover/20191001115130.18886-1-jjhib...@ti.com/
> > > > >
> > > > > Jean-Jacques Hiblot (2):
> > > > >   drivers: gpio: Add a managed API to get a GPIO from the device-tree
> > > > >   test: gpio: Add tests for the managed API
> > > > >
> > > > >  arch/sandbox/dts/test.dts  |  10 
> > > > >  drivers/gpio/gpio-uclass.c |  70 +
> > > > >  include/asm-generic/gpio.h |  47 +
> > > > >  test/dm/gpio.c | 102 
> > > > > +
> > > > >  4 files changed, 229 insertions(+)
> > > > >
> > > > > --
> > > > > 2.26.2
> > > > >
> > > >
> > > > The first question I have is why do you want to allocate the gpio_desc
> > > > and return it? Doesn't the caller have a place for that in its private
> > > > struct?
> > >
> > > Ask the Linux folks that ;-)
> > >
> > > The main aim of this series is to make it easier to port and maintain
> > > drivers from Linux. The less changes we have to make when porting a
> > > driver, the easier it is to port future fixes and features.
> > >
> > > Linux drivers (like the TI J721E WIZ [0] for which this effort is mainly
> > > being made) use these APIs. FWIW, the docs in Linux say the optional
> > > wrappers to the functions are added as a convenience for drivers that
> > > need to handle optional GPIOs.
> >
> > U-Boot already supports optional GPIOs.
>
> I seem to have mixed up some things when sending the reply. Sorry. This
> patchset doesn't really have all that much to do with optional GPIOs. It
> is about adding managed counterparts to the GPIO APIs.
>
> > Can we put this behind a CONFIG_LINUX_COMPAT_GPIO flag perhaps, so
> > people know they are trading off code / memory size for compatibility?
>
> The decision to put these behind a config depends on what U-Boot's
> stance is on the "devm_*" functions in general. I see that there are
> devm_clk_*() functions in mainline already and they aren't beind a
> Kconfig option. A quick search tells me as of now no other subsystem has
> devm_* functions in mainline, though you did drop your Reviewed-by on
> the regmap patch that adds devm_regmap_init() [0] and it isn't guarded
> by a Kconfig option.

It is OK to add new functionality that doesn't increase size if it
isn't used. But I worry with this API that we are changing the
semantics of functions and adding more checks, which does increase
code size, and sow confusion.

>
> So as of now I see the stance is to add devm_* functions without
> wrapping them in a comp

Re: [PATCH 1/1] sandbox: make RAM size configurable

2020-06-16 Thread Simon Glass
On Sun, 7 Jun 2020 at 10:47, Heinrich Schuchardt  wrote:
>
> Up to now the RAM size of the sandbox is hard coded as 128 MiB. This does
> not allow testing the correct handling of addresses outside the 32bit
> range. 128 MiB is also rather small when tracing functions where the trace
> is written to RAM.
>
> Provide configuration variable CONFIG_SANDBOX_RAM_SIZE_MB to set the RAM
> size in MiB. It defaults to 128 MiB with a minimum of 64 MiB.
>
> Signed-off-by: Heinrich Schuchardt 
> ---
>  arch/sandbox/Kconfig | 10 ++
>  arch/sandbox/include/asm/state.h |  2 +-
>  include/configs/sandbox.h|  5 -
>  3 files changed, 15 insertions(+), 2 deletions(-)

Reviewed-by: Simon Glass 


Re: [PATCH v2 08/10] led: gpio: Default to using node name if label is absent

2020-06-16 Thread Simon Glass
On Sun, 7 Jun 2020 at 19:27, Sean Anderson  wrote:
>
> This more closely mirrors Linux's behaviour, and will make it easier to
> transition to using function+color in the future.
>
> Signed-off-by: Sean Anderson 
> ---
> This patch was previously submitted as part of
> https://patchwork.ozlabs.org/project/uboot/list/?series=161576
>
> (no changes since v1)
>
>  drivers/led/led_gpio.c | 7 ++-
>  1 file changed, 2 insertions(+), 5 deletions(-)

Reviewed-by: Simon Glass 

Is there no test for this?


Re: [PATCH v2 01/10] pinctrl: Add pinmux property support to pinctrl-generic

2020-06-16 Thread Simon Glass
Hi Sean,

On Sun, 7 Jun 2020 at 19:27, Sean Anderson  wrote:
>
> The pinmux property allows for smaller and more compact device trees,
> especially when there are many pins which need to be assigned individually.
> Instead of specifying an array of strings to be parsed as pins and a
> function property, the pinmux property contains an array of integers
> representing pinmux groups. A pinmux group consists of the pin identifier
> and mux settings represented as a single integer or an array of integers.
> Each individual pin controller driver specifies the exact format of a
> pinmux group. As specified in the Linux documentation, a pinmux group may
> be multiple integers long. However, no existing drivers use multi-integer
> pinmux groups, so I have chosen to omit this feature. This makes the
> implementation easier, since there is no need to allocate a buffer to do
> endian conversions.
>
> Support for the pinmux property is done differently than in Linux.  As far
> as I can tell, inversion of control is used when implementing support for
> the pins and groups properties to avoid allocating. This results in some
> duplication of effort; every property in a config node is parsed once for
> each pin in that node. This is not such an overhead with pins and groups
> properties, since having multiple pins in one config node does not occur
> especially often. However, the semantics of the pinmux property make such a
> configuration much more appealing. A future patch could parse all config
> properties at once and store them in an array. This would make it easier to
> create drivers which do not function solely as callbacks from
> pinctrl-generic.
>
> This commit increases the size of the sandbox build by approximately 48
> bytes.  However, it also decreases the size of the K210 device tree by 2
> KiB from the previous version of this series.
>
> The documentation has been updated from the last Linux commit before it was
> split off into yaml files.
>
> Signed-off-by: Sean Anderson 
> ---
>
> Changes in v2:
> - New
>
>  .../pinctrl/pinctrl-bindings.txt  |  65 -
>  drivers/pinctrl/pinctrl-generic.c | 125 ++
>  include/dm/pinctrl.h  |  21 +--
>  3 files changed, 168 insertions(+), 43 deletions(-)

Reviewed-by: Simon Glass 


[..]

> diff --git a/include/dm/pinctrl.h b/include/dm/pinctrl.h
> index 692e5fc8cb..d50af1ce38 100644
> --- a/include/dm/pinctrl.h
> +++ b/include/dm/pinctrl.h
> @@ -34,29 +34,33 @@ struct pinconf_param {
>   * depending on your necessity.
>   *
>   * @get_pins_count: return number of selectable named pins available
> - * in this driver.  (necessary to parse "pins" property in DTS)
> + * in this driver. (necessary to parse "pins" property in DTS)

What is happening here? I don't think we want the period.

>   * @get_pin_name: return the pin name of the pin selector,
>   * called by the core to figure out which pin it shall do
> - * operations to.  (necessary to parse "pins" property in DTS)
> + * operations to. (necessary to parse "pins" property in DTS)
>   * @get_groups_count: return number of selectable named groups available
> - * in this driver.  (necessary to parse "groups" property in DTS)
> + * in this driver. (necessary to parse "groups" property in DTS)
>   * @get_group_name: return the group name of the group selector,
>   * called by the core to figure out which pin group it shall do
> - * operations to.  (necessary to parse "groups" property in DTS)
> + * operations to. (necessary to parse "groups" property in DTS)
>   * @get_functions_count: return number of selectable named functions 
> available
> - * in this driver.  (necessary for pin-muxing)
> + * in this driver. (necessary for pin-muxing)
>   * @get_function_name: return the function name of the muxing selector,
>   * called by the core to figure out which mux setting it shall map a
> - * certain device to.  (necessary for pin-muxing)
> + * certain device to. (necessary for pin-muxing)
>   * @pinmux_set: enable a certain muxing function with a certain pin.
>   * The @func_selector selects a certain function whereas @pin_selector
>   * selects a certain pin to be used. On simple controllers one of them
> - * may be ignored.  (necessary for pin-muxing against a single pin)
> + * may be ignored. (necessary for pin-muxing against a single pin)
>   * @pinmux_group_set: enable a certain muxing function with a certain pin
> - * group.  The @func_selector selects a certain function whereas
> + * group. The @func_selector selects a certain function whereas
>   * @group_selector selects a certain set of pins to be used. On simple
>   * controllers one of them may be ignored.
>   * (necessary for pin-muxing against a pin group)
> + * @pinmux_property_set: enable a pinmux group. @pinmux_group should specify 
> the
> + *  pin identifier and mux settings. The exact for

Re: [PATCH v2 02/10] test: pinmux: Add test for pin muxing

2020-06-16 Thread Simon Glass
Hi Sean,

On Sun, 7 Jun 2020 at 19:27, Sean Anderson  wrote:
>
> This extends the pinctrl-sandbox driver to support pin muxing, and adds a
> test for that behaviour. The test is done in C and not python (like the
> existing tests for the pinctrl uclass) because it needs to call
> pinctrl_select_state.  Another option could be to add a command that
> invokes pinctrl_select_state and then test everything in
> test/py/tests/test_pinmux.py.
>
> The pinctrl-sandbox driver now mimics the way that many pinmux devices
> work.  There are two groups of pins which are muxed together, as well as
> four pins which are muxed individually. I have tried to test all normal
> paths. However, very few error cases are explicitly checked for.
>
> Signed-off-by: Sean Anderson 
> ---
>
> Changes in v2:
> - New
>
>  arch/sandbox/dts/test.dts |  45 +++--
>  drivers/pinctrl/pinctrl-sandbox.c | 155 +++---
>  test/dm/Makefile  |   3 +
>  test/py/tests/test_pinmux.py  |  36 +++
>  4 files changed, 178 insertions(+), 61 deletions(-)
>

[..]


> diff --git a/test/dm/Makefile b/test/dm/Makefile
> index 0d1c66fa1e..9e273ee02d 100644
> --- a/test/dm/Makefile
> +++ b/test/dm/Makefile
> @@ -76,4 +76,7 @@ obj-$(CONFIG_DM_RNG) += rng.o
>  obj-$(CONFIG_CLK_K210_SET_RATE) += k210_pll.o
>  obj-$(CONFIG_SIMPLE_PM_BUS) += simple-pm-bus.o
>  obj-$(CONFIG_RESET_SYSCON) += syscon-reset.o
> +ifneq ($(CONFIG_PINMUX),)
> +obj-$(CONFIG_PINCONF) += pinmux.o

I don't see this file in your patch.

> +endif
>  endif
> diff --git a/test/py/tests/test_pinmux.py b/test/py/tests/test_pinmux.py
> index 4e6df992a4..0cbbae000c 100644
> --- a/test/py/tests/test_pinmux.py
> +++ b/test/py/tests/test_pinmux.py
> @@ -28,15 +28,15 @@ def test_pinmux_status_all(u_boot_console):

Feel free to convert this to C also if you like. It is faster,
although perhaps not much faster since it only runs a few commands?

>  assert ('a6: gpio output .' in output)
>
>  assert ('pinctrl:' in output)
> -assert ('SCL   : I2C SCL.' in output)
> -assert ('SDA   : I2C SDA.' in output)
> -assert ('TX: Uart TX.' in output)
> -assert ('RX: Uart RX.' in output)
> -assert ('W1: 1-wire gpio.' in output)
> -assert ('GPIO0 : gpio bias-pull-up input-disable.' in output)
> -assert ('GPIO1 : gpio drive-open-drain.' in output)
> -assert ('GPIO2 : gpio bias-pull-down input-enable.' in output)
> -assert ('GPIO3 : gpio bias-disable.' in output)
> +assert ('P0: UART TX.' in output)
> +assert ('P1: UART RX.' in output)
> +assert ('P2: I2S SCK.' in output)
> +assert ('P3: I2S SD.' in output)
> +assert ('P4: I2S WS.' in output)
> +assert ('P5: GPIO0 bias-pull-up input-disable.' in output)
> +assert ('P6: GPIO1 drive-open-drain.' in output)
> +assert ('P7: GPIO2 bias-pull-down input-enable.' in output)
> +assert ('P8: GPIO3 bias-disable.' in output)
>
>  @pytest.mark.buildconfigspec('cmd_pinmux')
>  @pytest.mark.boardspec('sandbox')
> @@ -73,12 +73,12 @@ def test_pinmux_status(u_boot_console):
>  assert (not 'pinctrl-gpio:' in output)
>  assert (not 'pinctrl:' in output)
>
> -assert ('SCL   : I2C SCL.' in output)
> -assert ('SDA   : I2C SDA.' in output)
> -assert ('TX: Uart TX.' in output)
> -assert ('RX: Uart RX.' in output)
> -assert ('W1: 1-wire gpio.' in output)
> -assert ('GPIO0 : gpio bias-pull-up input-disable.' in output)
> -assert ('GPIO1 : gpio drive-open-drain.' in output)
> -assert ('GPIO2 : gpio bias-pull-down input-enable.' in output)
> -assert ('GPIO3 : gpio bias-disable.' in output)
> +assert ('P0: UART TX.' in output)
> +assert ('P1: UART RX.' in output)
> +assert ('P2: I2S SCK.' in output)
> +assert ('P3: I2S SD.' in output)
> +assert ('P4: I2S WS.' in output)
> +assert ('P5: GPIO0 bias-pull-up input-disable.' in output)
> +assert ('P6: GPIO1 drive-open-drain.' in output)
> +assert ('P7: GPIO2 bias-pull-down input-enable.' in output)
> +assert ('P8: GPIO3 bias-disable.' in output)
> --
> 2.26.2
>

Regards,
Simon


[PATCH v2 16/17] test/py: add a test for efi firmware update capsule of FIT image

2020-06-16 Thread AKASHI Takahiro
The test can run on sandbox build and it attempts to execute a firmware
update via a capsule-on-disk, using a FIT image capsule,
CONFIG_EFI_CAPSULE_FIT.

To run this test successfully, you need configure U-Boot specifically;
See test_capsule_firmware.py for requirements, and hence it won't run
on Travis CI.

Signed-off-by: AKASHI Takahiro 
---
 test/py/tests/test_efi_capsule/conftest.py| 102 ++
 test/py/tests/test_efi_capsule/defs.py|  24 ++
 .../test_efi_capsule/test_capsule_firmware.py | 308 ++
 .../tests/test_efi_capsule/uboot_bin_env.its  |  36 ++
 test/py/tests/test_efi_capsule/uboot_env.its  |  25 ++
 5 files changed, 495 insertions(+)
 create mode 100644 test/py/tests/test_efi_capsule/conftest.py
 create mode 100644 test/py/tests/test_efi_capsule/defs.py
 create mode 100644 test/py/tests/test_efi_capsule/test_capsule_firmware.py
 create mode 100644 test/py/tests/test_efi_capsule/uboot_bin_env.its
 create mode 100644 test/py/tests/test_efi_capsule/uboot_env.its

diff --git a/test/py/tests/test_efi_capsule/conftest.py 
b/test/py/tests/test_efi_capsule/conftest.py
new file mode 100644
index ..58daf63f1e52
--- /dev/null
+++ b/test/py/tests/test_efi_capsule/conftest.py
@@ -0,0 +1,102 @@
+# SPDX-License-Identifier:  GPL-2.0+
+# Copyright (c) 2020, Linaro Limited
+# Author: AKASHI Takahiro 
+
+import os
+import os.path
+import re
+from subprocess import call, check_call, check_output, CalledProcessError
+import pytest
+from defs import *
+
+#
+# Fixture for UEFI secure boot test
+#
+
+
+@pytest.fixture(scope='session')
+def efi_capsule_data(request, u_boot_config):
+"""Set up a file system to be used in UEFI capsule test.
+
+Args:
+request: Pytest request object.
+u_boot_config: U-boot configuration.
+
+Return:
+A path to disk image to be used for testing
+"""
+image_path = u_boot_config.persistent_data_dir
+image_path = image_path + '/' + EFI_BOOTDEV_IMAGE_NAME
+
+try:
+# create U-Boot environment storage
+check_call('dd if=/dev/zero of=./spi.bin bs=1MiB count=16', shell=True)
+
+# create a disk/partition
+check_call('dd if=/dev/zero of=%s bs=1MiB count=%d'
+   % (image_path, EFI_BOOTDEV_IMAGE_SIZE), shell=True)
+check_call(
+'sgdisk %s -n 1:0:+%dMiB -A 1:set:0 -t 
1:C12A7328-F81F-11D2-BA4B-00A0C93EC93B' %
+(image_path, EFI_BOOTDEV_PART_SIZE), shell=True)
+# create a file system
+check_call('dd if=/dev/zero of=%s.tmp bs=1MiB count=%d'
+   % (image_path, EFI_BOOTDEV_PART_SIZE), shell=True)
+check_call('mkfs -t %s %s.tmp'
+   % (EFI_BOOTDEV_FS_TYPE, image_path), shell=True)
+check_call('dd if=%s.tmp of=%s bs=1MiB seek=1 count=%d conv=notrunc'
+   % (image_path, image_path, 1), shell=True)
+check_call('rm %s.tmp' % image_path, shell=True)
+loop_dev = check_output(
+'sudo losetup -o 1MiB --sizelimit %dMiB --show -f %s | tr -d "\n"' 
%
+(EFI_BOOTDEV_PART_SIZE, image_path), shell=True).decode()
+check_call('sudo mkdir -p %s' % MNT_PNT, shell=True)
+check_call('sudo mount -t %s -o umask=000 %s %s'
+   % (EFI_BOOTDEV_FS_TYPE, loop_dev, MNT_PNT),
+   shell=True)
+check_call('mkdir -p %s%s' % (MNT_PNT, CAPSULE_DATA_DIR), shell=True)
+check_call(
+'mkdir -p %s%s' %
+(MNT_PNT, CAPSULE_INSTALL_DIR), shell=True)
+
+# Create its'
+# one region for U-Boot env in FIT image
+check_call(
+'sed -e \"s?BINFILE?%s%s/%s?\" 
%s/test/py/tests/test_efi_capsule/uboot_env.its > %s%s/uboot_env.its' %
+(MNT_PNT, CAPSULE_DATA_DIR, FW_BIN, u_boot_config.source_dir, 
MNT_PNT, CAPSULE_DATA_DIR), shell=True)
+
+# two regions: one for u-boot.bin and the other for u-boot.env
+check_call(
+'echo -n u-boot:Old > %s%s/u-boot.bin.old; echo -n u-boot:New > 
%s%s/u-boot.bin.new; echo -n u-boot-env:Old -> %s%s/u-boot.env.old; echo -n 
u-boot-env:New > %s%s/u-boot.env.new' %
+(MNT_PNT,
+ CAPSULE_DATA_DIR,
+ MNT_PNT,
+ CAPSULE_DATA_DIR,
+ MNT_PNT,
+ CAPSULE_DATA_DIR,
+ MNT_PNT,
+ CAPSULE_DATA_DIR),
+shell=True)
+check_call(
+'sed -e \"s?BINFILE1?%s%s/u-boot.bin.new?\" -e 
\"s?BINFILE2?%s%s/u-boot.env.new?\" 
%s/test/py/tests/test_efi_capsule/uboot_bin_env.its > %s%s/uboot_bin_env.its' %
+(MNT_PNT,
+ CAPSULE_DATA_DIR,
+ MNT_PNT,
+ CAPSULE_DATA_DIR,
+ u_boot_config.source_dir,
+ MNT_PNT,
+ CAPSULE_DATA_DIR),
+shell=True)
+
+# cleanup
+call('sudo umount %s' % loop_dev, shell=True)
+call('sudo losetup -d %s' % loop_dev, shell=True)
+
+except CalledProc

[PATCH v2 12/17] dfu: add dfu_write_by_alt()

2020-06-16 Thread AKASHI Takahiro
This function is a variant of dfu_write_by_name() and takes a DFU alt
setting number for dfu configuration.

It will be utilised to implement UEFI capsule management protocol for
raw image in a later commit.

Signed-off-by: AKASHI Takahiro 
---
 drivers/dfu/dfu_alt.c | 47 +++
 include/dfu.h | 26 +++-
 2 files changed, 72 insertions(+), 1 deletion(-)

diff --git a/drivers/dfu/dfu_alt.c b/drivers/dfu/dfu_alt.c
index 5b1b13d7170d..bd846bdefffd 100644
--- a/drivers/dfu/dfu_alt.c
+++ b/drivers/dfu/dfu_alt.c
@@ -76,3 +76,50 @@ done:
 
return ret;
 }
+
+/**
+ * dfu_write_by_alt() - write data to DFU medium
+ * @dfu_alt_num:DFU alt setting number
+ * @addr:   Address of data buffer to write
+ * @len:Number of bytes
+ * @interface:  Destination DFU medium (e.g. "mmc")
+ * @devstring:  Instance number of destination DFU medium (e.g. "1")
+ *
+ * This function is storing data received on DFU supported medium which
+ * is specified by @dfu_alt_name.
+ *
+ * Return:  0 - on success, error code - otherwise
+ */
+int dfu_write_by_alt(int dfu_alt_num, unsigned int addr, unsigned int len,
+char *interface, char *devstring)
+{
+   struct dfu_entity *dfu;
+   int ret;
+
+   debug("%s: alt: %d addr: 0x%x len: %d device: %s:%s\n", __func__,
+ dfu_alt_num, addr, len, interface, devstring);
+
+   ret = dfu_init_env_entities(interface, devstring);
+   if (ret)
+   goto done;
+
+   if (dfu_alt_num < 0) {
+   pr_err("Invalid alt number: %d", dfu_alt_num);
+   ret = -ENODEV;
+   goto done;
+   }
+
+   dfu = dfu_get_entity(dfu_alt_num);
+   if (!dfu) {
+   pr_err("DFU entity for alt: %d not found!", dfu_alt_num);
+   ret = -ENODEV;
+   goto done;
+   }
+
+   ret = dfu_write_from_mem_addr(dfu, (void *)(uintptr_t)addr, len);
+
+done:
+   dfu_free_entities();
+
+   return ret;
+}
diff --git a/include/dfu.h b/include/dfu.h
index e9af9503d685..36c80c28f081 100644
--- a/include/dfu.h
+++ b/include/dfu.h
@@ -496,6 +496,7 @@ static inline int dfu_fill_entity_virt(struct dfu_entity 
*dfu, char *devstr,
 }
 #endif
 
+#if CONFIG_IS_ENABLED(DFU_ALT)
 /**
  * dfu_write_by_name() - write data to DFU medium
  * @dfu_entity_name:   Name of DFU entity to write
@@ -509,9 +510,24 @@ static inline int dfu_fill_entity_virt(struct dfu_entity 
*dfu, char *devstr,
  *
  * Return: 0 - on success, error code - otherwise
  */
-#if CONFIG_IS_ENABLED(DFU_ALT)
 int dfu_write_by_name(char *dfu_entity_name, unsigned int addr,
  unsigned int len, char *interface, char *devstring);
+
+/**
+ * dfu_write_by_alt() - write data to DFU medium
+ * @dfu_alt_num:   DFU alt setting number
+ * @addr:  Address of data buffer to write
+ * @len:   Number of bytes
+ * @interface: Destination DFU medium (e.g. "mmc")
+ * @devstring: Instance number of destination DFU medium (e.g. "1")
+ *
+ * This function is storing data received on DFU supported medium which
+ * is specified by @dfu_alt_name.
+ *
+ * Return: 0 - on success, error code - otherwise
+ */
+int dfu_write_by_alt(int dfu_alt_num, unsigned int addr, unsigned int len,
+char *interface, char *devstring);
 #else
 static inline int dfu_write_by_name(char *dfu_entity_name, unsigned int addr,
unsigned int len, char *interface,
@@ -520,6 +536,14 @@ static inline int dfu_write_by_name(char *dfu_entity_name, 
unsigned int addr,
puts("write support for DFU not available!\n");
return -ENOSYS;
 }
+
+static inline int dfu_write_by_alt(int dfu_alt_num, unsigned int addr,
+  unsigned int len, char *interface,
+  char *devstring)
+{
+   puts("write support for DFU not available!\n");
+   return -ENOSYS;
+}
 #endif
 
 int dfu_add(struct usb_configuration *c);
-- 
2.27.0



[PATCH v2 14/17] cmd: add "efidebug capsule" command

2020-06-16 Thread AKASHI Takahiro
"efidebug capsule" is more or less a debugging utility.
  efidebug capsule update: invoke UpdateCapsule against data on memory
  efidebug capsule show: show a capsule header
  efidebug capsule result: dump a capsule result variable

Signed-off-by: AKASHI Takahiro 
---
 cmd/efidebug.c | 235 +
 1 file changed, 235 insertions(+)

diff --git a/cmd/efidebug.c b/cmd/efidebug.c
index 58018f700cd4..29054d09daba 100644
--- a/cmd/efidebug.c
+++ b/cmd/efidebug.c
@@ -18,6 +18,228 @@
 #include 
 
 #define BS systab.boottime
+#define RT systab.runtime
+
+#ifdef CONFIG_EFI_HAVE_CAPSULE_SUPPORT
+/**
+ * do_efi_capsule_update() - process a capsule update
+ *
+ * @cmdtp: Command table
+ * @flag:  Command flag
+ * @argc:  Number of arguments
+ * @argv:  Argument array
+ * Return: CMD_RET_SUCCESS on success, CMD_RET_RET_FAILURE on failure
+ *
+ * Implement efidebug "capsule update" sub-command.
+ * process a capsule update.
+ *
+ * efidebug capsule update [-v] 
+ */
+static int do_efi_capsule_update(struct cmd_tbl *cmdtp, int flag,
+int argc, char * const argv[])
+{
+   struct efi_capsule_header *capsule;
+   int verbose = 0;
+   char *endp;
+   efi_status_t ret;
+
+   if (argc != 2 && argc != 3)
+   return CMD_RET_USAGE;
+
+   if (argc == 3) {
+   if (strcmp(argv[1], "-v"))
+   return CMD_RET_USAGE;
+
+   verbose = 1;
+   argc--;
+   argv++;
+   }
+
+   capsule = (typeof(capsule))simple_strtoul(argv[1], &endp, 16);
+   if (endp == argv[1]) {
+   printf("Invalid address: %s", argv[1]);
+   return CMD_RET_FAILURE;
+   }
+
+   if (verbose) {
+   printf("Capsule guid: %pUl\n", &capsule->capsule_guid);
+   printf("Capsule flags: 0x%x\n", capsule->flags);
+   printf("Capsule header size: 0x%x\n", capsule->header_size);
+   printf("Capsule image size: 0x%x\n",
+  capsule->capsule_image_size);
+   }
+
+   ret = EFI_CALL(RT->update_capsule(&capsule, 1, (u64)NULL));
+   if (ret) {
+   printf("Cannot handle a capsule at %p", capsule);
+   return CMD_RET_FAILURE;
+   }
+
+   return CMD_RET_SUCCESS;
+}
+
+/**
+ * do_efi_capsule_show() - show capsule information
+ *
+ * @cmdtp: Command table
+ * @flag:  Command flag
+ * @argc:  Number of arguments
+ * @argv:  Argument array
+ * Return: CMD_RET_SUCCESS on success, CMD_RET_RET_FAILURE on failure
+ *
+ * Implement efidebug "capsule show" sub-command.
+ * show capsule information.
+ *
+ * efidebug capsule show 
+ */
+static int do_efi_capsule_show(struct cmd_tbl *cmdtp, int flag,
+  int argc, char * const argv[])
+{
+   struct efi_capsule_header *capsule;
+   char *endp;
+
+   if (argc != 2)
+   return CMD_RET_USAGE;
+
+   capsule = (typeof(capsule))simple_strtoul(argv[1], &endp, 16);
+   if (endp == argv[1]) {
+   printf("Invalid address: %s", argv[1]);
+   return CMD_RET_FAILURE;
+   }
+
+   printf("Capsule guid: %pUl\n", &capsule->capsule_guid);
+   printf("Capsule flags: 0x%x\n", capsule->flags);
+   printf("Capsule header size: 0x%x\n", capsule->header_size);
+   printf("Capsule image size: 0x%x\n",
+  capsule->capsule_image_size);
+
+   return CMD_RET_SUCCESS;
+}
+
+/**
+ * do_efi_capsule_res() - show a capsule update result
+ *
+ * @cmdtp: Command table
+ * @flag:  Command flag
+ * @argc:  Number of arguments
+ * @argv:  Argument array
+ * Return: CMD_RET_SUCCESS on success, CMD_RET_RET_FAILURE on failure
+ *
+ * Implement efidebug "capsule result" sub-command.
+ * show a capsule update result.
+ * If result number is not specified, CapsuleLast will be shown.
+ *
+ * efidebug capsule result []
+ */
+static int do_efi_capsule_res(struct cmd_tbl *cmdtp, int flag,
+ int argc, char * const argv[])
+{
+   int capsule_id;
+   char *endp;
+   char var_name[12];
+   u16 var_name16[12], *p;
+   efi_guid_t guid;
+   struct efi_capsule_result_variable_header *result = NULL;
+   efi_uintn_t size;
+   efi_status_t ret;
+
+   if (argc != 1 && argc != 2)
+   return CMD_RET_USAGE;
+
+   guid = efi_guid_capsule_report;
+   if (argc == 1) {
+   size = sizeof(var_name16);
+   ret = EFI_CALL(RT->get_variable(L"CapsuleLast", &guid, NULL,
+   &size, var_name16));
+   if (ret != EFI_SUCCESS) {
+   if (ret == EFI_NOT_FOUND)
+   printf("CapsuleLast doesn't exist\n");
+   else
+   printf("Failed to get CapsuleLast\n");
+
+

[PATCH v2 15/17] tools: add mkeficapsule command for UEFI capsule update

2020-06-16 Thread AKASHI Takahiro
This is a utility mainly for test purpose.
  mkeficapsule -f: create a test capsule file for FIT image firmware

Having said that, you will be able to customize the code to fit
your specific requirements for your platform.

Signed-off-by: AKASHI Takahiro 
---
 tools/Makefile   |   3 +
 tools/mkeficapsule.c | 237 +++
 2 files changed, 240 insertions(+)
 create mode 100644 tools/mkeficapsule.c

diff --git a/tools/Makefile b/tools/Makefile
index 879c3fd4a748..4833e6842e55 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -217,6 +217,9 @@ hostprogs-$(CONFIG_MIPS) += mips-relocs
 hostprogs-$(CONFIG_ASN1_COMPILER)  += asn1_compiler
 HOSTCFLAGS_asn1_compiler.o = -idirafter $(srctree)/include
 
+# TODO: only build this for capsule pytest
+hostprogs-$(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) += mkeficapsule
+
 # We build some files with extra pedantic flags to try to minimize things
 # that won't build on some weird host compiler -- though there are lots of
 # exceptions for files that aren't complaint.
diff --git a/tools/mkeficapsule.c b/tools/mkeficapsule.c
new file mode 100644
index ..93f22192fdb4
--- /dev/null
+++ b/tools/mkeficapsule.c
@@ -0,0 +1,237 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2018 Linaro Limited
+ * Author: AKASHI Takahiro
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+typedef __u8 u8;
+typedef __u16 u16;
+typedef __u32 u32;
+typedef __u64 u64;
+typedef __s16 s16;
+typedef __s32 s32;
+
+#define aligned_u64 __aligned_u64
+
+#ifndef __packed
+#define __packed __attribute__((packed))
+#endif
+
+#include 
+#include 
+
+static const char *tool_name = "mkeficapsule";
+
+efi_guid_t efi_guid_fm_capsule = EFI_FIRMWARE_MANAGEMENT_CAPSULE_ID_GUID;
+efi_guid_t efi_guid_image_type_uboot_fit =
+   EFI_FIRMWARE_IMAGE_TYPE_UBOOT_FIT_GUID;
+efi_guid_t efi_guid_image_type_uboot_raw =
+   EFI_FIRMWARE_IMAGE_TYPE_UBOOT_RAW_GUID;
+
+static struct option options[] = {
+   {"fit", required_argument, NULL, 'f'},
+   {"raw", required_argument, NULL, 'r'},
+   {"index", required_argument, NULL, 'i'},
+   {"instance", required_argument, NULL, 'I'},
+   {"version", required_argument, NULL, 'v'},
+   {"help", no_argument, NULL, 'h'},
+   {NULL, 0, NULL, 0},
+};
+
+static void print_usage(void)
+{
+   printf("Usage: %s [options] \n"
+  "Options:\n"
+  "\t--fit   new FIT image file\n"
+  "\t--raw   new raw image file\n"
+  "\t--index update image index\n"
+  "\t--instance   update hardware instance\n"
+  "\t--version firmware version\n"
+  "\t--help print a help message\n",
+  tool_name);
+}
+
+static int create_fwbin(char *path, char *bin, efi_guid_t *guid,
+   unsigned long version, unsigned long index,
+   unsigned long instance)
+{
+   struct efi_capsule_header header;
+   struct efi_firmware_management_capsule_header capsule;
+   struct efi_firmware_management_capsule_image_header image;
+   FILE *f, *g;
+   struct stat bin_stat;
+   u8 *data;
+   size_t size;
+
+#ifdef DEBUG
+   printf("For output: %s\n", path);
+   printf("\tbin: %s\n\ttype: %pUl\n" bin, guid);
+   printf("\tversion: %ld\n\tindex: %ld\n\tinstance: %ld\n",
+  version, index, instance);
+#endif
+
+   g = fopen(bin, "r");
+   if (!g) {
+   printf("cannot open %s\n", bin);
+   return -1;
+   }
+   if (stat(bin, &bin_stat) < 0) {
+   printf("cannot determine the size of %s\n", bin);
+   goto err_1;
+   }
+   data = malloc(bin_stat.st_size);
+   if (!data) {
+   printf("cannot allocate memory: %lx\n", bin_stat.st_size);
+   goto err_1;
+   }
+   f = fopen(path, "w");
+   if (!f) {
+   printf("cannot open %s\n", path);
+   goto err_2;
+   }
+   header.capsule_guid = efi_guid_fm_capsule;
+   header.header_size = sizeof(header);
+   header.flags = CAPSULE_FLAGS_PERSIST_ACROSS_RESET; /* TODO */
+   header.capsule_image_size = sizeof(header)
+   + sizeof(capsule) + sizeof(u64)
+   + sizeof(image)
+   + bin_stat.st_size;
+
+   size = fwrite(&header, 1, sizeof(header), f);
+   if (size < sizeof(header)) {
+   printf("write failed (%lx)\n", size);
+   goto err_3;
+   }
+
+   capsule.version = 0x0001;
+   capsule.embedded_driver_count = 0;
+   capsule.payload_item_count = 1;
+   capsule.item_offset_list[0] = sizeof(capsule) + sizeof(u64);
+   size = fwrite(&capsule, 1, sizeof(capsule) + sizeof(u64), f);
+   if (size < (sizeof(ca

[PATCH v2 17/17] test/py: add a test for uefi firmware update capsule of raw image

2020-06-16 Thread AKASHI Takahiro
The test can run on sandbox build and it attempts to execute a firmware
update via a capsule-on-disk, using a raw image capsule,
CONFIG_EFI_CAPSULE_RAW.

To run this test successfully, you need configure U-Boot specifically;
See test_capsule_firmware.py for requirements, and hence it won't run
on Travis CI.

Signed-off-by: AKASHI Takahiro 
---
 .../test_efi_capsule/test_capsule_firmware.py | 75 +++
 1 file changed, 75 insertions(+)

diff --git a/test/py/tests/test_efi_capsule/test_capsule_firmware.py 
b/test/py/tests/test_efi_capsule/test_capsule_firmware.py
index 490dc039d81f..e7c88c796a65 100644
--- a/test/py/tests/test_efi_capsule/test_capsule_firmware.py
+++ b/test/py/tests/test_efi_capsule/test_capsule_firmware.py
@@ -306,3 +306,78 @@ class TestEfiCapsuleFirmwareFit(object):
 'sf read 400 15 10',
 'md.b 400 10'])
 assert 'u-boot-env:New' in ''.join(output)
+
+def test_efi_capsule_fw4(
+self, u_boot_config, u_boot_console, efi_capsule_data):
+"""
+Test Case 4 - Update U-Boot on SPI Flash, raw image format
+  0x10-0x15: U-Boot binary (but dummy)
+"""
+# "-T" (or "-D") is required to enable spi flash on sandbox
+u_boot_console.restart_uboot_with_flags('-T')
+
+disk_img = efi_capsule_data
+with u_boot_console.log.section('Test Case 4-a, before reboot'):
+output = u_boot_console.run_command_list([
+'host bind 0 %s' % disk_img,
+'efidebug boot add 1 TEST host 0:1 /helloworld.efi ""',
+'efidebug boot order 1',
+'env set -e -nv -bs -rt OsIndications =0x0004',
+'env set dfu_alt_info sf 0:0=u-boot-bin raw 0x10 
0x5\;u-boot-env raw 0x15 0x20',
+'env save'])
+
+# initialize content
+output = u_boot_console.run_command_list(
+['sf probe 0:0', 'fatload host 0:1 400 %s/u-boot.bin.old' %
+ CAPSULE_DATA_DIR, 'sf write 400 10 10',
+ 'sf read 500 10 10', 'md.b 500 10'])
+assert 'Old' in ''.join(output)
+
+# create a capsule file
+try:
+loop_dev = check_output(
+'sudo losetup -o 1MiB --sizelimit %dMiB --show -f %s | tr -d 
"\n"' %
+(EFI_BOOTDEV_PART_SIZE, disk_img), shell=True).decode()
+check_call('sudo mount -t %s -o umask=000 %s %s'
+   % (EFI_BOOTDEV_FS_TYPE, loop_dev, MNT_PNT), shell=True)
+check_call(
+'%s/tools/mkeficapsule --raw %s%s/u-boot.bin.new --version 1 
--index 1 %s%s/Test01' %
+(u_boot_config.build_dir,
+ MNT_PNT,
+ CAPSULE_DATA_DIR,
+ MNT_PNT,
+ CAPSULE_INSTALL_DIR),
+shell=True)
+check_call('ls -l %s/%s' % (MNT_PNT, CAPSULE_INSTALL_DIR),
+   shell=True)
+check_call('sudo umount %s' % loop_dev, shell=True)
+check_call('sudo losetup -d %s' % loop_dev, shell=True)
+except CalledProcessError as exception:
+assert 'failed to create firmware capsule: %s' % exception.cmd
+
+# reboot
+u_boot_console.restart_uboot_with_flags('-T')
+
+capsule_early = u_boot_config.buildconfig.get(
+'config_efi_capsule_on_disk_early')
+with u_boot_console.log.section('Test Case 4-b, after reboot'):
+if not capsule_early:
+output = u_boot_console.run_command_list([
+'host bind 0 %s' % disk_img,
+'fatls host 0:1 %s' % CAPSULE_INSTALL_DIR])
+assert 'Test01' in ''.join(output)
+
+# need to run uefi command to initiate capsule handling
+output = u_boot_console.run_command(
+'env print -e -all Capsule')
+
+output = u_boot_console.run_command_list([
+'host bind 0 %s' % disk_img,
+'fatls host 0:1 %s' % CAPSULE_INSTALL_DIR])
+assert 'Test01' not in ''.join(output)
+
+output = u_boot_console.run_command_list([
+'sf probe 0:0',
+'sf read 400 10 10',
+'md.b 400 10'])
+assert 'u-boot:New' in ''.join(output)
-- 
2.27.0



[PATCH v2 13/17] efi_loader: add firmware management protocol for raw image

2020-06-16 Thread AKASHI Takahiro
In this commit, a very simple firmware management protocol driver
is implemented. It will take a binary image in a capsule file and
apply the data using dfu backend storage drivers via dfu_write_by_alt()
interface.

So "dfu_alt_info" variable should be properly set to specify a device
and location to be updated. Please read README.dfu.

Signed-off-by: AKASHI Takahiro 
---
 include/efi_api.h |   4 +
 include/efi_loader.h  |   1 +
 lib/efi_loader/Kconfig|  16 ++
 lib/efi_loader/Makefile   |   2 +-
 lib/efi_loader/efi_capsule.c  |   8 +
 lib/efi_loader/efi_firmware.c | 273 --
 6 files changed, 256 insertions(+), 48 deletions(-)

diff --git a/include/efi_api.h b/include/efi_api.h
index c3fc4edbedc4..afd7ff922ee4 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -1847,6 +1847,10 @@ struct efi_signature_list {
EFI_GUID(0xae13ff2d, 0x9ad4, 0x4e25, 0x9a, 0xc8, \
 0x6d, 0x80, 0xb3, 0xb2, 0x21, 0x47)
 
+#define EFI_FIRMWARE_IMAGE_TYPE_UBOOT_RAW_GUID \
+   EFI_GUID(0xe2bb9c06, 0x70e9, 0x4b14, 0x97, 0xa3, \
+0x5a, 0x79, 0x13, 0x17, 0x6e, 0x3f)
+
 #define EFI_IMAGE_ATTRIBUTE_IMAGE_UPDATABLE0x1
 #define EFI_IMAGE_ATTRIBUTE_RESET_REQUIRED 0x2
 #define EFI_IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED0x4
diff --git a/include/efi_loader.h b/include/efi_loader.h
index 5f574533e732..5c5f0e165d11 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -788,6 +788,7 @@ bool efi_image_parse(void *efi, size_t len, struct 
efi_image_regions **regp,
 WIN_CERTIFICATE **auth, size_t *auth_len);
 
 extern const struct efi_firmware_management_protocol efi_fmp_fit;
+extern const struct efi_firmware_management_protocol efi_fmp_raw;
 
 /* Capsule update */
 efi_status_t EFIAPI efi_update_capsule(
diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index 305751f4b15c..eed33744a019 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -78,6 +78,10 @@ config EFI_CAPSULE_ON_DISK_EARLY
  executed as part of U-Boot initialisation so that they will
  surely take place whatever is set to distro_bootcmd.
 
+config EFI_CAPSULE_FIRMWARE
+   bool
+   default n
+
 config EFI_CAPSULE_FIRMWARE_MANAGEMENT
bool "Capsule: Firmware Management Protocol"
depends on EFI_HAVE_CAPSULE_SUPPORT
@@ -92,11 +96,23 @@ config EFI_CAPSULE_FIRMWARE_FIT
depends on FIT
select UPDATE_FIT
select DFU
+   select EFI_CAPSULE_FIRMWARE
default n
help
  Select this option if you want to enable firmware management protocol
  driver for FIT image
 
+config EFI_CAPSULE_FIRMWARE_RAW
+   bool "FMP driver for raw image"
+   depends on EFI_CAPSULE_FIRMWARE_MANAGEMENT
+   select DFU
+   select DFU_ALT
+   select EFI_CAPSULE_FIRMWARE
+   default n
+   help
+ Select this option if you want to enable firmware management protocol
+ driver for raw image
+
 config EFI_DEVICE_PATH_TO_TEXT
bool "Device path to text protocol"
default y
diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile
index ea1fbc4a9deb..08ce3bf56429 100644
--- a/lib/efi_loader/Makefile
+++ b/lib/efi_loader/Makefile
@@ -24,7 +24,7 @@ obj-$(CONFIG_CMD_BOOTEFI_HELLO) += helloworld_efi.o
 obj-y += efi_bootmgr.o
 obj-y += efi_boottime.o
 obj-$(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) += efi_capsule.o
-obj-$(CONFIG_EFI_CAPSULE_FIRMWARE_FIT) += efi_firmware.o
+obj-$(CONFIG_EFI_CAPSULE_FIRMWARE) += efi_firmware.o
 obj-y += efi_console.o
 obj-y += efi_device_path.o
 obj-$(CONFIG_EFI_DEVICE_PATH_TO_TEXT) += efi_device_path_to_text.o
diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
index c2cd1d23f9ce..360b40011417 100644
--- a/lib/efi_loader/efi_capsule.c
+++ b/lib/efi_loader/efi_capsule.c
@@ -811,6 +811,14 @@ efi_status_t __weak arch_efi_load_capsule_drivers(void)
&efi_fmp_fit, NULL));
}
 
+   if (IS_ENABLED(CONFIG_EFI_CAPSULE_FIRMWARE_RAW)) {
+   handle = NULL;
+   ret = EFI_CALL(efi_install_multiple_protocol_interfaces(
+   &efi_root,
+   &efi_guid_firmware_management_protocol,
+   &efi_fmp_raw, NULL));
+   }
+
return ret;
 }
 
diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c
index 28ce5647a2cc..db8fdf30ace0 100644
--- a/lib/efi_loader/efi_firmware.c
+++ b/lib/efi_loader/efi_firmware.c
@@ -13,6 +13,68 @@
 #include 
 #include 
 
+/* Place holder; not supported */
+static
+efi_status_t EFIAPI efi_firmware_get_image_unsupported(
+   struct efi_firmware_management_protocol *this,
+   u8 image_index,
+   void *image,
+   efi_uintn_t *image_size)
+{
+   EFI_ENTRY("%p %d %p %p\n", this, image_index, image, image_size);
+
+   return EFI_EXIT(EFI_UNSUPPORTED);
+}
+

[PATCH v2 11/17] efi_loader: add firmware management protocol for FIT image

2020-06-16 Thread AKASHI Takahiro
In this commit, a very simple firmware management protocol driver
is implemented. It will take a common FIT image firmware in a capsule
file and apply the data using dfu backend storage drivers via
update_fit() interface.

So "dfu_alt_info" variable should be properly set to specify a device
and location to be updated. Please read README.dfu.

Fit image is a common file format for firmware update on U-Boot, and
this protocol works neatly just as a wrapper for one.

Signed-off-by: AKASHI Takahiro 
---
 include/efi_api.h |   4 +
 include/efi_loader.h  |   2 +
 lib/efi_loader/Kconfig|  11 ++
 lib/efi_loader/Makefile   |   1 +
 lib/efi_loader/efi_capsule.c  |  12 +-
 lib/efi_loader/efi_firmware.c | 253 ++
 6 files changed, 282 insertions(+), 1 deletion(-)
 create mode 100644 lib/efi_loader/efi_firmware.c

diff --git a/include/efi_api.h b/include/efi_api.h
index b062720e8220..c3fc4edbedc4 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -1843,6 +1843,10 @@ struct efi_signature_list {
EFI_GUID(0x86c77a67, 0x0b97, 0x4633, 0xa1, 0x87, \
 0x49, 0x10, 0x4d, 0x06, 0x85, 0xc7)
 
+#define EFI_FIRMWARE_IMAGE_TYPE_UBOOT_FIT_GUID \
+   EFI_GUID(0xae13ff2d, 0x9ad4, 0x4e25, 0x9a, 0xc8, \
+0x6d, 0x80, 0xb3, 0xb2, 0x21, 0x47)
+
 #define EFI_IMAGE_ATTRIBUTE_IMAGE_UPDATABLE0x1
 #define EFI_IMAGE_ATTRIBUTE_RESET_REQUIRED 0x2
 #define EFI_IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED0x4
diff --git a/include/efi_loader.h b/include/efi_loader.h
index bc58c7e3c1d7..5f574533e732 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -787,6 +787,8 @@ bool efi_secure_boot_enabled(void);
 bool efi_image_parse(void *efi, size_t len, struct efi_image_regions **regp,
 WIN_CERTIFICATE **auth, size_t *auth_len);
 
+extern const struct efi_firmware_management_protocol efi_fmp_fit;
+
 /* Capsule update */
 efi_status_t EFIAPI efi_update_capsule(
struct efi_capsule_header **capsule_header_array,
diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index e1413c35e33c..305751f4b15c 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -86,6 +86,17 @@ config EFI_CAPSULE_FIRMWARE_MANAGEMENT
  Select this option if you want to enable capsule-based
  firmware update using Firmware Management Protocol.
 
+config EFI_CAPSULE_FIRMWARE_FIT
+   bool "FMP driver for FIT image"
+   depends on EFI_CAPSULE_FIRMWARE_MANAGEMENT
+   depends on FIT
+   select UPDATE_FIT
+   select DFU
+   default n
+   help
+ Select this option if you want to enable firmware management protocol
+ driver for FIT image
+
 config EFI_DEVICE_PATH_TO_TEXT
bool "Device path to text protocol"
default y
diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile
index 67bc5c9c0907..ea1fbc4a9deb 100644
--- a/lib/efi_loader/Makefile
+++ b/lib/efi_loader/Makefile
@@ -24,6 +24,7 @@ obj-$(CONFIG_CMD_BOOTEFI_HELLO) += helloworld_efi.o
 obj-y += efi_bootmgr.o
 obj-y += efi_boottime.o
 obj-$(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) += efi_capsule.o
+obj-$(CONFIG_EFI_CAPSULE_FIRMWARE_FIT) += efi_firmware.o
 obj-y += efi_console.o
 obj-y += efi_device_path.o
 obj-$(CONFIG_EFI_DEVICE_PATH_TO_TEXT) += efi_device_path_to_text.o
diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
index 22d15bc4d8cd..c2cd1d23f9ce 100644
--- a/lib/efi_loader/efi_capsule.c
+++ b/lib/efi_loader/efi_capsule.c
@@ -801,7 +801,17 @@ static void efi_capsule_scan_done(void)
  */
 efi_status_t __weak arch_efi_load_capsule_drivers(void)
 {
-   return EFI_SUCCESS;
+   __maybe_unused efi_handle_t handle;
+   efi_status_t ret = EFI_SUCCESS;
+
+   if (IS_ENABLED(CONFIG_EFI_CAPSULE_FIRMWARE_FIT)) {
+   handle = NULL;
+   ret = EFI_CALL(efi_install_multiple_protocol_interfaces(
+   &handle, &efi_guid_firmware_management_protocol,
+   &efi_fmp_fit, NULL));
+   }
+
+   return ret;
 }
 
 /**
diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c
new file mode 100644
index ..28ce5647a2cc
--- /dev/null
+++ b/lib/efi_loader/efi_firmware.c
@@ -0,0 +1,253 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * EFI Firmware management protocol
+ *
+ *  Copyright (c) 2020 Linaro Limited
+ * Author: AKASHI Takahiro
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/*
+ * This FIRMWARE_MANAGEMENT_PROTOCOL driver provides a firmware update
+ * method with existing FIT image format, and handles
+ *   - multiple regions of firmware via DFU
+ * but doesn't support
+ *   - versioning of firmware image
+ *   - package information
+ */
+const efi_guid_t efi_firmware_image_type_uboot_fit =
+   EFI_FIRMWARE_IMAGE_TYPE_UBOOT_FIT_GUID;
+
+/**
+ * efi_firmware_fit_get_image_info - return inf

[PATCH v2 08/17] efi_loader: capsule: add capsule_on_disk support

2020-06-16 Thread AKASHI Takahiro
Capsule data can be loaded into the system either via UpdateCapsule
runtime service or files on a file system (of boot device).
The latter case is called "capsules on disk", and actual updates will
take place at the next boot time.

In this commit, we will support capsule on disk mechanism.

Please note that U-Boot itself has no notion of "boot device" and
all the capsule files to be executed will be detected only if they
are located in a specific directory, \EFI\UpdateCapsule, on a device
that is identified as a boot device by "Boot" variables.

Signed-off-by: AKASHI Takahiro 
---
 common/main.c|   4 +
 include/efi_loader.h |  16 ++
 lib/efi_loader/Kconfig   |  22 ++
 lib/efi_loader/efi_capsule.c | 510 +++
 lib/efi_loader/efi_setup.c   |   8 +
 5 files changed, 560 insertions(+)

diff --git a/common/main.c b/common/main.c
index 4b3cd302c3e2..ae5bcdb32f8b 100644
--- a/common/main.c
+++ b/common/main.c
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 
 static void run_preboot_environment_command(void)
 {
@@ -53,6 +54,9 @@ void main_loop(void)
if (IS_ENABLED(CONFIG_UPDATE_TFTP))
update_tftp(0UL, NULL, NULL);
 
+   if (IS_ENABLED(CONFIG_EFI_CAPSULE_ON_DISK_EARLY))
+   efi_launch_capsules();
+
s = bootdelay_process();
if (cli_process_fdt(&s))
cli_secure_boot_cmd(s);
diff --git a/include/efi_loader.h b/include/efi_loader.h
index 20b263201ec5..81b940fa88db 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -796,6 +796,18 @@ efi_status_t EFIAPI efi_query_capsule_caps(
u64 *maximum_capsule_size,
u32 *reset_type);
 
+#ifdef CONFIG_EFI_CAPSULE_ON_DISK
+#define EFI_CAPSULE_DIR L"\\EFI\\UpdateCapsule\\"
+
+/* Hook at initialization */
+efi_status_t efi_launch_capsules(void);
+#else
+static inline efi_status_t efi_launch_capsules(void)
+{
+   return EFI_SUCCESS;
+}
+#endif /* CONFIG_EFI_CAPSULE_ON_DISK */
+
 #else /* CONFIG_IS_ENABLED(EFI_LOADER) */
 
 /* Without CONFIG_EFI_LOADER we don't have a runtime section, stub it out */
@@ -812,6 +824,10 @@ static inline void efi_set_bootdev(const char *dev, const 
char *devnr,
   const char *path) { }
 static inline void efi_net_set_dhcp_ack(void *pkt, int len) { }
 static inline void efi_print_image_infos(void *pc) { }
+static inline efi_status_t efi_launch_capsules(void)
+{
+   return EFI_SUCCESS;
+}
 
 #endif /* CONFIG_IS_ENABLED(EFI_LOADER) */
 
diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index 356f4ac60e92..621d3c579eb7 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -56,6 +56,28 @@ config EFI_RUNTIME_UPDATE_CAPSULE
  Select this option if you want to use UpdateCapsule and
  QueryCapsuleCapabilities API's.
 
+config EFI_CAPSULE_ON_DISK
+   bool "Enable capsule-on-disk support"
+   select EFI_HAVE_CAPSULE_SUPPORT
+   default n
+   help
+ Select this option if you want to use capsule-on-disk feature,
+ that is, capsules can be fetched and executed from files
+ under a specific directory on UEFI system partition instead of
+ via UpdateCapsule API.
+
+config EFI_CAPSULE_ON_DISK_EARLY
+   bool "Initiate capsule-on-disk at U-Boot boottime"
+   depends on EFI_CAPSULE_ON_DISK
+   default y
+   select EFI_SETUP_EARLY
+   help
+ Normally, without this option enabled, capsules will be
+ executed only at the first time of invoking one of efi command.
+ If this option is enabled, capsules will be enforced to be
+ executed as part of U-Boot initialisation so that they will
+ surely take place whatever is set to distro_bootcmd.
+
 config EFI_DEVICE_PATH_TO_TEXT
bool "Device path to text protocol"
default y
diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
index cfe422bee924..2a224546dd11 100644
--- a/lib/efi_loader/efi_capsule.c
+++ b/lib/efi_loader/efi_capsule.c
@@ -10,10 +10,16 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 const efi_guid_t efi_guid_capsule_report = EFI_CAPSULE_REPORT_GUID;
 
+#ifdef CONFIG_EFI_CAPSULE_ON_DISK
+/* for file system access */
+static struct efi_file_handle *bootdev_root;
+#endif
+
 /**
  * get_last_capsule - get the last capsule number
  *
@@ -166,3 +172,507 @@ efi_status_t EFIAPI efi_query_capsule_caps(
 out:
return EFI_EXIT(ret);
 }
+
+#ifdef CONFIG_EFI_CAPSULE_ON_DISK
+/**
+ * get_dp_device - retrieve a device  path from boot variable
+ * @boot_var:  Boot variable name
+ * @device_dp  Device path
+ *
+ * Retrieve a device patch from boot variable, @boot_var.
+ *
+ * Return: status code
+ */
+static efi_status_t get_dp_device(u16 *boot_var,
+ struct efi_device_path **device_dp)
+{
+   void *buf = NULL;
+   efi_uintn_t size;
+   struct efi_load_option lo;
+ 

[PATCH v2 07/17] efi_loader: define UpdateCapsule api

2020-06-16 Thread AKASHI Takahiro
In this commit, skeleton functions for capsule-related API's are
added under CONFIG_EFI_UPDATE_CAPSULE configuration.
Detailed implementation for a specific capsule type will be added
in the succeeding patches.

Signed-off-by: AKASHI Takahiro 
---
 include/efi_api.h|  12 +++
 include/efi_loader.h |  13 +++
 lib/efi_loader/Kconfig   |  11 +++
 lib/efi_loader/Makefile  |   1 +
 lib/efi_loader/efi_capsule.c | 168 +++
 lib/efi_loader/efi_runtime.c | 104 +-
 lib/efi_loader/efi_setup.c   |  31 +--
 7 files changed, 289 insertions(+), 51 deletions(-)
 create mode 100644 lib/efi_loader/efi_capsule.c

diff --git a/include/efi_api.h b/include/efi_api.h
index 759d9118758e..4be01495f096 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -217,6 +217,10 @@ enum efi_reset_type {
 #define CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE0x0002
 #define CAPSULE_FLAGS_INITIATE_RESET   0x0004
 
+#define EFI_CAPSULE_REPORT_GUID \
+   EFI_GUID(0x39b68c46, 0xf7fb, 0x441b, 0xb6, 0xec, \
+0x16, 0xb0, 0xf6, 0x98, 0x21, 0xf3)
+
 struct efi_capsule_header {
efi_guid_t capsule_guid;
u32 header_size;
@@ -224,6 +228,14 @@ struct efi_capsule_header {
u32 capsule_image_size;
 } __packed;
 
+struct efi_capsule_result_variable_header {
+   u32 variable_total_size;
+   u32 reserved;
+   efi_guid_t capsule_guid;
+   struct efi_time capsule_processed;
+   efi_status_t capsule_status;
+} __packed;
+
 #define EFI_RT_SUPPORTED_GET_TIME  0x0001
 #define EFI_RT_SUPPORTED_SET_TIME  0x0002
 #define EFI_RT_SUPPORTED_GET_WAKEUP_TIME   0x0004
diff --git a/include/efi_loader.h b/include/efi_loader.h
index c2cae814b652..20b263201ec5 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -205,6 +205,8 @@ extern const efi_guid_t efi_guid_cert_type_pkcs7;
 
 /* GUID of RNG protocol */
 extern const efi_guid_t efi_guid_rng_protocol;
+/* GUID of capsule update result */
+extern const efi_guid_t efi_guid_capsule_report;
 
 extern unsigned int __efi_runtime_start, __efi_runtime_stop;
 extern unsigned int __efi_runtime_rel_start, __efi_runtime_rel_stop;
@@ -783,6 +785,17 @@ bool efi_secure_boot_enabled(void);
 bool efi_image_parse(void *efi, size_t len, struct efi_image_regions **regp,
 WIN_CERTIFICATE **auth, size_t *auth_len);
 
+/* Capsule update */
+efi_status_t EFIAPI efi_update_capsule(
+   struct efi_capsule_header **capsule_header_array,
+   efi_uintn_t capsule_count,
+   u64 scatter_gather_list);
+efi_status_t EFIAPI efi_query_capsule_caps(
+   struct efi_capsule_header **capsule_header_array,
+   efi_uintn_t capsule_count,
+   u64 *maximum_capsule_size,
+   u32 *reset_type);
+
 #else /* CONFIG_IS_ENABLED(EFI_LOADER) */
 
 /* Without CONFIG_EFI_LOADER we don't have a runtime section, stub it out */
diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index 37034894870e..356f4ac60e92 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -45,6 +45,17 @@ config EFI_SET_TIME
  Provide the SetTime() runtime service at boottime. This service
  can be used by an EFI application to adjust the real time clock.
 
+config EFI_HAVE_CAPSULE_SUPPORT
+   bool
+
+config EFI_RUNTIME_UPDATE_CAPSULE
+   bool "UpdateCapsule() runtime service"
+   default n
+   select EFI_HAVE_CAPSULE_SUPPORT
+   help
+ Select this option if you want to use UpdateCapsule and
+ QueryCapsuleCapabilities API's.
+
 config EFI_DEVICE_PATH_TO_TEXT
bool "Device path to text protocol"
default y
diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile
index 57c7e66ea0e2..67bc5c9c0907 100644
--- a/lib/efi_loader/Makefile
+++ b/lib/efi_loader/Makefile
@@ -23,6 +23,7 @@ endif
 obj-$(CONFIG_CMD_BOOTEFI_HELLO) += helloworld_efi.o
 obj-y += efi_bootmgr.o
 obj-y += efi_boottime.o
+obj-$(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) += efi_capsule.o
 obj-y += efi_console.o
 obj-y += efi_device_path.o
 obj-$(CONFIG_EFI_DEVICE_PATH_TO_TEXT) += efi_device_path_to_text.o
diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
new file mode 100644
index ..cfe422bee924
--- /dev/null
+++ b/lib/efi_loader/efi_capsule.c
@@ -0,0 +1,168 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ *  EFI Capsule
+ *
+ *  Copyright (c) 2018 Linaro Limited
+ * Author: AKASHI Takahiro
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+const efi_guid_t efi_guid_capsule_report = EFI_CAPSULE_REPORT_GUID;
+
+/**
+ * get_last_capsule - get the last capsule number
+ *
+ * Retrieve the number of capsule invoked last time from "CapsuleLast"
+ * variable.
+ *
+ * Return:
+ * * > 0   - the last capsule number invoked
+ * * 0x- on error, or no capsule invoked yet
+ */
+st

[PATCH v2 10/17] efi_loader: capsule: support firmware update

2020-06-16 Thread AKASHI Takahiro
A capsule tagged with the guid, EFI_FIRMWARE_MANAGEMENT_CAPSULE_ID_GUID,
is handled as a firmware update object.
What efi_update_capsule() basically does is to load any firmware management
protocol (or fmp) drivers contained in a capsule, find out an appropriate
fmp driver and then invoke its set_image() interface against each binary
in a capsule.
In this commit, however, loading drivers is not supported.

The result of applying a capsule is set to be stored in "Capsule"
variable, but its implementation is deferred to a fmp driver.

Signed-off-by: AKASHI Takahiro 
---
 include/efi_api.h| 123 +++
 include/efi_loader.h |   2 +
 lib/efi_loader/Kconfig   |   8 ++
 lib/efi_loader/efi_capsule.c | 229 +++
 lib/efi_loader/efi_setup.c   |   4 +
 5 files changed, 366 insertions(+)

diff --git a/include/efi_api.h b/include/efi_api.h
index eeec08efccb1..b062720e8220 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -225,6 +225,10 @@ enum efi_reset_type {
EFI_GUID(0xde9f0ec, 0x88b6, 0x428f, 0x97, 0x7a, \
 0x25, 0x8f, 0x1d, 0xe, 0x5e, 0x72)
 
+#define EFI_FIRMWARE_MANAGEMENT_CAPSULE_ID_GUID \
+   EFI_GUID(0x6dcbd5ed, 0xe82d, 0x4c44, 0xbd, 0xa1, \
+0x71, 0x94, 0x19, 0x9a, 0xd9, 0x2a)
+
 struct efi_capsule_header {
efi_guid_t capsule_guid;
u32 header_size;
@@ -253,6 +257,32 @@ struct efi_memory_range_capsule {
struct efi_memory_range memory_ranges[];
 } __packed;
 
+struct efi_firmware_management_capsule_header {
+   u32 version;
+   u16 embedded_driver_count;
+   u16 payload_item_count;
+   u64 item_offset_list[];
+} __packed;
+
+struct efi_firmware_management_capsule_image_header {
+   u32 version;
+   efi_guid_t update_image_type_id;
+   u8 update_image_index;
+   u8 reserved[3];
+   u32 update_image_size;
+   u32 update_vendor_code_size;
+   u64 update_hardware_instance;
+} __packed;
+
+struct efi_capsule_result_variable_fmp {
+   u16 version;
+   u8 payload_index;
+   u8 update_image_index;
+   efi_guid_t update_image_type_id;
+   // u16 capsule_file_name[];
+   // u16 capsule_target[];
+} __packed;
+
 #define EFI_RT_SUPPORTED_GET_TIME  0x0001
 #define EFI_RT_SUPPORTED_SET_TIME  0x0002
 #define EFI_RT_SUPPORTED_GET_WAKEUP_TIME   0x0004
@@ -1806,4 +1836,97 @@ struct efi_signature_list {
 /* struct efi_signature_data signatures[...][signature_size]; */
 } __attribute__((__packed__));
 
+/*
+ * Firmware management protocol
+ */
+#define EFI_FIRMWARE_MANAGEMENT_PROTOCOL_GUID \
+   EFI_GUID(0x86c77a67, 0x0b97, 0x4633, 0xa1, 0x87, \
+0x49, 0x10, 0x4d, 0x06, 0x85, 0xc7)
+
+#define EFI_IMAGE_ATTRIBUTE_IMAGE_UPDATABLE0x1
+#define EFI_IMAGE_ATTRIBUTE_RESET_REQUIRED 0x2
+#define EFI_IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED0x4
+#define EFI_IMAGE_ATTRIBUTE_IN_USE 0x8
+#define EFI_IMAGE_ATTRIBUTE_UEFI_IMAGE 0x10
+
+#define EFI_IMAGE_COMPATIBILITY_CHECK_SUPPORTED0x1
+#define EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION  4
+
+#define EFI_IMAGE_UPDATABLE_VALID  0x1
+#define EFI_IMAGE_UPDATABLE_INVALID0x2
+#define EFI_IMAGE_UPDATABLE_INVALID_TYPE   0x4
+#define EFI_IMAGE_UPDATABLE_INVALID_OLLD   0x8
+#define EFI_IMAGE_UPDATABLE_VALID_WITH_VENDOR_CODE 0x10
+
+#define EFI_PACKAGE_ATTRIBUTE_VERSION_UPDATABLE0x1
+#define EFI_PACKAGE_ATTRIBUTE_RESET_REQUIRED   0x2
+#define EFI_PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED  0x4
+
+typedef struct efi_firmware_image_dependencies {
+   u8 dependencies[0];
+} efi_fmp_dep_t;
+
+struct efi_firmware_image_descriptor {
+   u8 image_index;
+   efi_guid_t image_type_id;
+   u64 image_id;
+   u16 *image_id_name;
+   u32 version;
+   u16 *version_name;
+   efi_uintn_t size;
+   u64 attributes_supported;
+   u64 attributes_setting;
+   u64 compatibilities;
+   u32 lowest_supported_image_version;
+   u32 last_attempt_version;
+   u32 last_attempt_status;
+   u64 hardware_instance;
+   efi_fmp_dep_t *dependencies;
+};
+
+struct efi_firmware_management_protocol {
+   efi_status_t (EFIAPI *get_image_info)(
+   struct efi_firmware_management_protocol *this,
+   efi_uintn_t *image_info_size,
+   struct efi_firmware_image_descriptor *image_info,
+   u32 *descriptor_version,
+   u8 *descriptor_count,
+   efi_uintn_t *descriptor_size,
+   u32 *package_version,
+   u16 **package_version_name);
+   efi_status_t (EFIAPI *get_image)(
+   struct efi_firmware_management_protocol *this,
+   u8 ima

[PATCH v2 09/17] efi_loader: capsule: add memory range capsule definitions

2020-06-16 Thread AKASHI Takahiro
Memory range capsule gives us a way to notify that some memory regions
should be left untouched across the next reset.
See UEFI specification, section 8.5.3.

Since how we should handle this kind of capsule is totally up to
the system, no implementation will be added in this commit.

Signed-off-by: AKASHI Takahiro 
---
 include/efi_api.h | 17 +
 1 file changed, 17 insertions(+)

diff --git a/include/efi_api.h b/include/efi_api.h
index 4be01495f096..eeec08efccb1 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -221,6 +221,10 @@ enum efi_reset_type {
EFI_GUID(0x39b68c46, 0xf7fb, 0x441b, 0xb6, 0xec, \
 0x16, 0xb0, 0xf6, 0x98, 0x21, 0xf3)
 
+#define EFI_MEMORY_RANGE_CAPSULE_GUID \
+   EFI_GUID(0xde9f0ec, 0x88b6, 0x428f, 0x97, 0x7a, \
+0x25, 0x8f, 0x1d, 0xe, 0x5e, 0x72)
+
 struct efi_capsule_header {
efi_guid_t capsule_guid;
u32 header_size;
@@ -236,6 +240,19 @@ struct efi_capsule_result_variable_header {
efi_status_t capsule_status;
 } __packed;
 
+struct efi_memory_range {
+   efi_physical_addr_t address;
+   u64 length;
+};
+
+struct efi_memory_range_capsule {
+   struct efi_capsule_header *header;
+   /* EFI_MEMORY_TYPE: 0x8000-0x */
+   enum efi_mem_type os_requested_memory_type;
+   u64 number_of_memory_ranges;
+   struct efi_memory_range memory_ranges[];
+} __packed;
+
 #define EFI_RT_SUPPORTED_GET_TIME  0x0001
 #define EFI_RT_SUPPORTED_SET_TIME  0x0002
 #define EFI_RT_SUPPORTED_GET_WAKEUP_TIME   0x0004
-- 
2.27.0



[PATCH v2 06/17] efi_loader: add option to initialise EFI subsystem early

2020-06-16 Thread AKASHI Takahiro
If this option, CONFIG_EFI_SETUP_EARLY, is enabled, the initialisation
of UEFI subsystem will be done as part of U-Boot initialisation.

Please note that this option won't be enabled explicitly by users,
instead, should be enabled implicitly by other configuration options.

Specifically, this feature will be utilised in implementing capsule-on-disk
feature.

Signed-off-by: AKASHI Takahiro 
---
 common/board_r.c   | 6 ++
 lib/efi_loader/Kconfig | 4 
 2 files changed, 10 insertions(+)

diff --git a/common/board_r.c b/common/board_r.c
index fa57fa9b6993..dcb8c6f79d2f 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -68,6 +68,9 @@
 #if defined(CONFIG_GPIO_HOG)
 #include 
 #endif
+#ifdef CONFIG_EFI_SETUP_EARLY
+#include 
+#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -858,6 +861,9 @@ static init_fnc_t init_sequence_r[] = {
 #endif
 #if defined(CONFIG_M68K) && defined(CONFIG_BLOCK_CACHE)
blkcache_init,
+#endif
+#ifdef CONFIG_EFI_SETUP_EARLY
+   (init_fnc_t)efi_init_obj_list,
 #endif
run_main_loop,
 };
diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index aad37b715505..37034894870e 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -25,6 +25,10 @@ config EFI_LOADER
 
 if EFI_LOADER
 
+config EFI_SETUP_EARLY
+   bool
+   default n
+
 config EFI_GET_TIME
bool "GetTime() runtime service"
depends on DM_RTC
-- 
2.27.0



[PATCH v2 03/17] dfu: rename dfu_tftp_write() to dfu_write_by_name()

2020-06-16 Thread AKASHI Takahiro
This function is essentially independent from tffp, and will also be
utilised in implementing UEFI capsule update in a later commit.
So just give it a more generic name.
In addition, a new configuration option, CONFIG_DFU_ALT, was introduced
so that the file will be compiled with different options, particularly
one added in a later commit.

Signed-off-by: AKASHI Takahiro 
---
 drivers/dfu/Kconfig   |  5 +
 drivers/dfu/Makefile  |  2 +-
 drivers/dfu/{dfu_tftp.c => dfu_alt.c} | 17 --
 include/dfu.h | 32 +--
 4 files changed, 37 insertions(+), 19 deletions(-)
 rename drivers/dfu/{dfu_tftp.c => dfu_alt.c} (67%)

diff --git a/drivers/dfu/Kconfig b/drivers/dfu/Kconfig
index cafb6a34090e..1bddaef45532 100644
--- a/drivers/dfu/Kconfig
+++ b/drivers/dfu/Kconfig
@@ -15,8 +15,13 @@ config DFU_OVER_TFTP
select UPDATE_TFTP
 
 if DFU
+config DFU_ALT
+   bool
+   default n
+
 config DFU_TFTP
bool "DFU via TFTP"
+   select DFU_ALT
select DFU_OVER_TFTP
help
  This option allows performing update of DFU-managed medium with data
diff --git a/drivers/dfu/Makefile b/drivers/dfu/Makefile
index 0d7925c083ef..cc7de1d3ed9b 100644
--- a/drivers/dfu/Makefile
+++ b/drivers/dfu/Makefile
@@ -9,5 +9,5 @@ obj-$(CONFIG_$(SPL_)DFU_MTD) += dfu_mtd.o
 obj-$(CONFIG_$(SPL_)DFU_NAND) += dfu_nand.o
 obj-$(CONFIG_$(SPL_)DFU_RAM) += dfu_ram.o
 obj-$(CONFIG_$(SPL_)DFU_SF) += dfu_sf.o
-obj-$(CONFIG_$(SPL_)DFU_TFTP) += dfu_tftp.o
+obj-$(CONFIG_$(SPL_)DFU_ALT) += dfu_alt.o
 obj-$(CONFIG_$(SPL_)DFU_VIRT) += dfu_virt.o
diff --git a/drivers/dfu/dfu_tftp.c b/drivers/dfu/dfu_alt.c
similarity index 67%
rename from drivers/dfu/dfu_tftp.c
rename to drivers/dfu/dfu_alt.c
index ffae4bb54f80..5b1b13d7170d 100644
--- a/drivers/dfu/dfu_tftp.c
+++ b/drivers/dfu/dfu_alt.c
@@ -10,8 +10,21 @@
 #include 
 #include 
 
-int dfu_tftp_write(char *dfu_entity_name, unsigned int addr, unsigned int len,
-  char *interface, char *devstring)
+/**
+ * dfu_write_by_name() - write data to DFU medium
+ * @dfu_entity_name:Name of DFU entity to write
+ * @addr:   Address of data buffer to write
+ * @len:Number of bytes
+ * @interface:  Destination DFU medium (e.g. "mmc")
+ * @devstring:  Instance number of destination DFU medium (e.g. "1")
+ *
+ * This function is storing data received on DFU supported medium which
+ * is specified by @dfu_entity_name.
+ *
+ * Return:  0 - on success, error code - otherwise
+ */
+int dfu_write_by_name(char *dfu_entity_name, unsigned int addr,
+ unsigned int len, char *interface, char *devstring)
 {
char *s, *sb;
int alt_setting_num, ret;
diff --git a/include/dfu.h b/include/dfu.h
index 6fa450593605..94b0a9e68317 100644
--- a/include/dfu.h
+++ b/include/dfu.h
@@ -494,27 +494,27 @@ static inline int dfu_fill_entity_virt(struct dfu_entity 
*dfu, char *devstr,
 #endif
 
 /**
- * dfu_tftp_write() - write TFTP data to DFU medium
+ * dfu_write_by_name() - write data to DFU medium
+ * @dfu_entity_name:   Name of DFU entity to write
+ * @addr:  Address of data buffer to write
+ * @len:   Number of bytes
+ * @interface: Destination DFU medium (e.g. "mmc")
+ * @devstring: Instance number of destination DFU medium (e.g. "1")
  *
- * This function is storing data received via TFTP on DFU supported medium.
+ * This function is storing data received on DFU supported medium which
+ * is specified by @dfu_entity_name.
  *
- * @dfu_entity_name:   name of DFU entity to write
- * @addr:  address of data buffer to write
- * @len:   number of bytes
- * @interface: destination DFU medium (e.g. "mmc")
- * @devstring: instance number of destination DFU medium (e.g. "1")
- *
- * Return: 0 on success, otherwise error code
+ * Return: 0 - on success, error code - otherwise
  */
-#if CONFIG_IS_ENABLED(DFU_TFTP)
-int dfu_tftp_write(char *dfu_entity_name, unsigned int addr, unsigned int len,
-  char *interface, char *devstring);
+#if CONFIG_IS_ENABLED(DFU_ALT)
+int dfu_write_by_name(char *dfu_entity_name, unsigned int addr,
+ unsigned int len, char *interface, char *devstring);
 #else
-static inline int dfu_tftp_write(char *dfu_entity_name, unsigned int addr,
-unsigned int len, char *interface,
-char *devstring)
+static inline int dfu_write_by_name(char *dfu_entity_name, unsigned int addr,
+   unsigned int len, char *interface,
+   char *devstring)
 {
-   puts("TFTP write support for DFU not available!\n");
+   puts("write support for DFU not available!\n");
return -ENOSYS;
 }
 #endif
-- 
2.27.0



[PATCH v2 04/17] common: update: add a generic interface for FIT image

2020-06-16 Thread AKASHI Takahiro
The main purpose of this patch is to separate a generic interface for
updating firmware using DFU drivers from "auto-update" via tftp.

This function will also be used in implementing UEFI capsule update
in a later commit.

Signed-off-by: AKASHI Takahiro 
---
 common/Kconfig  | 16 +++
 common/Makefile |  2 +-
 common/update.c | 75 +++--
 include/image.h | 12 
 4 files changed, 102 insertions(+), 3 deletions(-)

diff --git a/common/Kconfig b/common/Kconfig
index 2d86dd7e63c6..a51d2a7b9d2a 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -985,9 +985,16 @@ endmenu
 
 menu "Update support"
 
+config UPDATE_COMMON
+   bool
+   default n
+   select DFU_ALT
+
 config UPDATE_TFTP
bool "Auto-update using fitImage via TFTP"
depends on FIT
+   depends on DFU
+   select UPDATE_COMMON
help
  This option allows performing update of NOR with data in fitImage
  sent via TFTP boot.
@@ -1002,6 +1009,15 @@ config UPDATE_TFTP_MSEC_MAX
default 100
depends on UPDATE_TFTP
 
+config UPDATE_FIT
+   bool "Firmware update using fitImage"
+   depends on FIT
+   depends on DFU
+   select UPDATE_COMMON
+   help
+ This option allows performing update of DFU-capable storage with
+ data in fitImage.
+
 config ANDROID_AB
bool "Android A/B updates"
default n
diff --git a/common/Makefile b/common/Makefile
index 2e7a090588d9..c238db8108e7 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -53,7 +53,7 @@ obj-$(CONFIG_LCD_ROTATION) += lcd_console_rotation.o
 obj-$(CONFIG_LCD_DT_SIMPLEFB) += lcd_simplefb.o
 obj-$(CONFIG_LYNXKDI) += lynxkdi.o
 obj-$(CONFIG_MENU) += menu.o
-obj-$(CONFIG_UPDATE_TFTP) += update.o
+obj-$(CONFIG_UPDATE_COMMON) += update.o
 obj-$(CONFIG_DFU_TFTP) += update.o
 obj-$(CONFIG_USB_KEYBOARD) += usb_kbd.o
 obj-$(CONFIG_CMDLINE) += cli_readline.o cli_simple.o
diff --git a/common/update.c b/common/update.c
index 3547dc68bf7c..a8151383fae7 100644
--- a/common/update.c
+++ b/common/update.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 
+#ifdef CONFIG_UPDATE_TFTP
 /* env variable holding the location of the update file */
 #define UPDATE_FILE_ENV"updatefile"
 
@@ -211,6 +212,7 @@ static int update_flash(ulong addr_source, ulong 
addr_first, ulong size)
return 1;
 #endif
 }
+#endif /* CONFIG_UPDATE_TFTP */
 
 static int update_fit_getparams(const void *fit, int noffset, ulong *addr,
ulong *fladdr, ulong *size)
@@ -228,6 +230,7 @@ static int update_fit_getparams(const void *fit, int 
noffset, ulong *addr,
return 0;
 }
 
+#ifdef CONFIG_UPDATE_TFTP
 int update_tftp(ulong addr, char *interface, char *devstring)
 {
char *filename, *env_addr, *fit_image_name;
@@ -322,8 +325,9 @@ got_update_file:
}
} else if (fit_image_check_type(fit, noffset,
IH_TYPE_FIRMWARE)) {
-   ret = dfu_tftp_write(fit_image_name, update_addr,
-update_size, interface, devstring);
+   ret = dfu_write_by_name(fit_image_name, update_addr,
+   update_size, interface,
+   devstring);
if (ret)
return ret;
}
@@ -333,3 +337,70 @@ next_node:
 
return ret;
 }
+#endif
+
+#ifdef CONFIG_UPDATE_FIT
+/**
+ * fit_update - update storage with FIT image
+ * @fit:   Pointer to FIT image
+ *
+ * Update firmware on storage using FIT image as input.
+ * The storage area to be update will be identified by the name
+ * in FIT and matching it to "dfu_alt_info" variable.
+ *
+ * Return:  0 - on success, non-zero - otherwise
+ */
+int fit_update(const void *fit)
+{
+   char *fit_image_name;
+   ulong update_addr, update_fladdr, update_size;
+   int images_noffset, ndepth, noffset;
+   int ret = 0;
+
+   if (!fit)
+   return -EINVAL;
+
+   if (!fit_check_format((void *)fit)) {
+   printf("Bad FIT format of the update file, aborting 
auto-update\n");
+   return -EINVAL;
+   }
+
+   /* process updates */
+   images_noffset = fdt_path_offset(fit, FIT_IMAGES_PATH);
+
+   ndepth = 0;
+   noffset = fdt_next_node(fit, images_noffset, &ndepth);
+   while (noffset >= 0 && ndepth > 0) {
+   if (ndepth != 1)
+   goto next_node;
+
+   fit_image_name = (char *)fit_get_name(fit, noffset, NULL);
+   printf("Processing update '%s' :", fit_image_name);
+
+   if (!fit_image_verify(fit, noffset)) {
+   printf("Error: invalid update hash, aborting\n");
+   ret = 1;
+   goto next_node;
+

[PATCH v2 02/17] dfu: add a hidden reverse-dependency on UPDATE_TFTP

2020-06-16 Thread AKASHI Takahiro
DFU_OVER_TFTP support on "dfu" command relies on update_tftp()
being available. Just explicitly add this dependency.

Signed-off-by: AKASHI Takahiro 
---
 drivers/dfu/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/dfu/Kconfig b/drivers/dfu/Kconfig
index 5d45d7d7c2d7..cafb6a34090e 100644
--- a/drivers/dfu/Kconfig
+++ b/drivers/dfu/Kconfig
@@ -12,6 +12,7 @@ config DFU_OVER_USB
 config DFU_OVER_TFTP
bool
depends on NET
+   select UPDATE_TFTP
 
 if DFU
 config DFU_TFTP
-- 
2.27.0



[PATCH v2 05/17] dfu: export dfu_list

2020-06-16 Thread AKASHI Takahiro
This variable will be utilized to enumerate all dfu entities
for UEFI capsule firmware update in a later commit.

Signed-off-by: AKASHI Takahiro 
---
 drivers/dfu/dfu.c | 2 +-
 include/dfu.h | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
index a298c2c43999..501a60b34400 100644
--- a/drivers/dfu/dfu.c
+++ b/drivers/dfu/dfu.c
@@ -18,7 +18,7 @@
 #include 
 #include 
 
-static LIST_HEAD(dfu_list);
+LIST_HEAD(dfu_list);
 static int dfu_alt_num;
 static int alt_num_cnt;
 static struct hash_algo *dfu_hash_algo;
diff --git a/include/dfu.h b/include/dfu.h
index 94b0a9e68317..e9af9503d685 100644
--- a/include/dfu.h
+++ b/include/dfu.h
@@ -158,6 +158,9 @@ struct dfu_entity {
unsigned int inited:1;
 };
 
+struct list_head;
+extern struct list_head dfu_list;
+
 #ifdef CONFIG_SET_DFU_ALT_INFO
 /**
  * set_dfu_alt_info() - set dfu_alt_info environment variable
-- 
2.27.0



[PATCH v2 01/17] common: update_tftp: remove unnecessary build check

2020-06-16 Thread AKASHI Takahiro
Logically, the current update_tftp() should and does compile and work
correctly even without satisfying the following condition:

> #if defined(CONFIG_UPDATE_TFTP) && !defined(CONFIG_MTD_NOR_FLASH)
> #error "CONFIG_UPDATE_TFTP and !CONFIG_MTD_NOR_FLASH needed for
>  legacy behaviour"
> #endif

It would be better to just drop it so that this function will be
used on wider range of platforms.

Signed-off-by: AKASHI Takahiro 
---
 common/update.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/common/update.c b/common/update.c
index c8dd346a0956..3547dc68bf7c 100644
--- a/common/update.c
+++ b/common/update.c
@@ -14,10 +14,6 @@
 #error "CONFIG_FIT and CONFIG_OF_LIBFDT are required for auto-update feature"
 #endif
 
-#if defined(CONFIG_UPDATE_TFTP) && !defined(CONFIG_MTD_NOR_FLASH)
-#error "CONFIG_UPDATE_TFTP and !CONFIG_MTD_NOR_FLASH needed for legacy 
behaviour"
-#endif
-
 #include 
 #include 
 #include 
@@ -210,8 +206,10 @@ static int update_flash(ulong addr_source, ulong 
addr_first, ulong size)
printf("Error: could not protect flash sectors\n");
return 1;
}
-#endif
return 0;
+#else
+   return 1;
+#endif
 }
 
 static int update_fit_getparams(const void *fit, int noffset, ulong *addr,
-- 
2.27.0



[PATCH v2 00/17] efi_loader: add capsule update support

2020-06-16 Thread AKASHI Takahiro
Summary
===
'UpdateCapsule' is one of runtime services defined in UEFI specification
and its aim is to allow a caller (OS) to pass information to the firmware,
i.e. U-Boot. This is mostly used to update firmware binary on devices by
instructions from OS.

While 'UpdateCapsule' is a runtime services function, it is, at least
initially, supported only before exiting boot services alike other runtime
functions, [Get/]SetVariable. This is because modifying storage which may
be shared with OS must be carefully designed and there is no general
assumption that we can do it.

Therefore, we practically support only "capsule on disk"; any capsule can
be handed over to UEFI subsystem as a file on a specific file system.

In this patch series, all the related definitions and structures are given
as UEFI specification describes, and basic framework for capsule support
is provided. Currently supported is
 * firmware update (Firmware Management Protocol or simply FMP)

Most of functionality of firmware update is provided by FMP driver and
it can be, by nature, system/platform-specific. So you can and should
implement your own FMP driver(s) based on your system requirements.
Under the current implementation, we provide two basic but generic
drivers with two formats:
  * FIT image format (as used in TFTP update and dfu)
  * raw image format

It's totally up to users which one, or both, should be used on users'
system depending on user requirements.

Quick usage
===
1. You can create a capsule file with the following host command:

  $ mkeficapsule [--fit  | --raw ] 

2. Put the file under:

  /EFI/UpdateCapsule of UEFI system partition

3. Specify firmware storage to be updated in "dfu_alt_info" variable
   (Please follow README.dfu for details.)

  ==> env set dfu_alt_info '...'

4. After setting up UEFI's OsIndications variable, reboot U-Boot:

  OsIndications <= EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED

Patch structure
===
Patch#1-#5,#12: preparatory patches
Patch#6-#11,#13: main part of implementation
Patch#14-#15: utilities
Patch#16-#17: pytests

[1] https://git.linaro.org/people/takahiro.akashi/u-boot.git efi/capsule

Prerequisite patches

(None as all have been merged as of v2020.07-rc4)

Test

* passed all the pytests which are included in this patch series
  on sandbox build.
* passed Travis CI, except "buildman samsumg softfpga".
  (I don't know what this build failed yet.)

Please note that, while Travic CI passed, the capsule pytest
itself won't be run in the CI because some specific configuration
for sandbox build is required. See test_efi_capsule_firmware.py.

Issues
==
* Timing of executing capsules-on-disk
  Currently, processing a capsule is triggered only as part of
  UEFI subsystem initialization. This means that, for example,
  firmware update, may not take place at system booting time and
  will potentially be delayed until a first call of any UEFI functions.
=> See patch#6 for my proposal
* A bunch of warnings like
WARNING: Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef'
where possible
  I don't think that fixing those doesn't improve anything.
* Add a document in uefi.rst

TODO's
==
(Won't be addressed in this series.)
* capsule authentication
* capsule dependency (dependency expression instruction set)
* loading drivers in a capsule
* handling RESET flag in a capsule and QeuryCapsuleCaps
* full semantics of ESRT (EFI System Resource Table)
* enabling capsule API at runtime
* json capsule
* recovery from update failure

Changes
===
v2 (June 17, 2020)
* rebased to v2020.07-rc4
* add preparatory patches for dfu (Patch#1-#5, #12)
* rework FIT capsule driver to utilize dfu_alt_info instead of CONFIG_xxx
  (patch#11)
* extend get_image_info() to correspond to dfu_alt_info
  (patch#11)
* add a 'raw binary' capsule support
  (patch#13, #17)
* allow multiple capsule formats (with different GUIDs) to be installed
  (patch#11, #13)
* extend mkeficapsule command to accept additional parameters, like
version/index/hardware instance for a capsule header info.
  (patch#15)
* mkeficapsule can now also generate raw-binary capsule
  (patch#16)
* add function descriptions
* apply autopep8 to pytests and fix more against pylint

v1 (April 27, 2020)
* rebased to v2020.07-rc
* removed already-merged patches (RFC's #1 to #4)
* dropped 'variable update' capsule support (RFC's patch#10)
* dropped 'variable configuration table' support (RFC's patch#11)
  (Those two should be discussed separately.)
* add preparatory patches (patch#1/#2)
* fix several build errors
* rename some Kconfig options to be aligned with UEFI specification's terms
  (patch#3,4,6,7)
* enforce UpdateCapsule API to be disabled after ExitBootServices (patch#3)
* use config table, runtime_services_supported, instead of variable (patch#3)
* make EFI_CAPSULE_ON_DISK buildable even if UpdateCapsule API is disabled
  (patch4)
* support OsIndications, invoking capsu

[PATCHv2 29/31] spi: Enable missing CONFIG_SPL_DM_SPI support

2020-06-16 Thread Tom Rini
Due to how the Makefile logic is we currently get DM_SPI support in SPL
enabled by having DM_SPI enabled for full U-Boot but not having
CONFIG_SPL_DM_SPI set.  Add this missing option to boards that were
inadvertently making use of it.

Cc: Adam Ford 
Cc: Akash Gajjar 
Cc: Anatolij Gustschin 
Cc: Andy Yan 
Cc: Anup Patel 
Cc: Atish Patra 
Cc: Bin Meng 
Cc: Chee Hong Ang 
Cc: Chin-Liang See 
Cc: Dalon Westergreen 
Cc: Dinh Nguyen 
Cc: Eugen Hristev 
Cc: Hannes Schmelzer 
Cc: Heiko Schocher 
Cc: Jagan Teki 
Cc: Klaus Goger 
Cc: Levin Du 
Cc: Ley Foon Tan 
Cc: Lokesh Vutla 
Cc: Luca Ceresoli 
Cc: Marek Vasut 
Cc: Michal Simek 
Cc: Mike Looijmans 
Cc: Nicolas Ferre 
Cc: Nikita Kiryanov 
Cc: Palmer Dabbelt 
Cc: Patrick Delaunay 
Cc: Paul Walmsley 
Cc: Pavel Machek 
Cc: Peter Robinson 
Cc: Philipp Tomsich 
Cc: Simon Glass 
Cc: Stefan Roese 
Cc: Suniel Mahesh 
Cc: Vitaly Andrianov 
Cc: Wolfgang Grandegger 
Signed-off-by: Tom Rini 
---
Changes in v2:
- Add k2 family
---
 configs/am57xx_evm_defconfig   | 1 +
 configs/am57xx_hs_evm_defconfig| 1 +
 configs/am57xx_hs_evm_usb_defconfig| 1 +
 configs/am65x_evm_a53_defconfig| 1 +
 configs/am65x_evm_r5_defconfig | 1 +
 configs/am65x_hs_evm_a53_defconfig | 1 +
 configs/am65x_hs_evm_r5_defconfig  | 1 +
 configs/avnet_ultrazedev_cc_v1_0_ultrazedev_som_v1_0_defconfig | 1 +
 configs/axm_defconfig  | 1 +
 configs/brppt1_spi_defconfig   | 1 +
 configs/brsmarc1_defconfig | 1 +
 configs/chromebit_mickey_defconfig | 1 +
 configs/chromebook_bob_defconfig   | 1 +
 configs/chromebook_coral_defconfig | 1 +
 configs/chromebook_jerry_defconfig | 1 +
 configs/chromebook_link64_defconfig| 1 +
 configs/chromebook_minnie_defconfig| 1 +
 configs/chromebook_samus_tpl_defconfig | 1 +
 configs/chromebook_speedy_defconfig| 1 +
 configs/cm_t43_defconfig   | 1 +
 configs/da850evm_defconfig | 1 +
 configs/da850evm_nand_defconfig| 1 +
 configs/dra7xx_evm_defconfig   | 1 +
 configs/dra7xx_hs_evm_defconfig| 1 +
 configs/dra7xx_hs_evm_usb_defconfig| 1 +
 configs/evb-px5_defconfig  | 1 +
 configs/j721e_evm_a72_defconfig| 1 +
 configs/j721e_evm_r5_defconfig | 1 +
 configs/j721e_hs_evm_a72_defconfig | 1 +
 configs/j721e_hs_evm_r5_defconfig  | 1 +
 configs/k2e_evm_defconfig  | 1 +
 configs/k2g_evm_defconfig  | 1 +
 configs/k2hk_evm_defconfig | 1 +
 configs/k2l_evm_defconfig  | 1 +
 configs/lion-rk3368_defconfig  | 1 +
 configs/pinebook-pro-rk3399_defconfig  | 1 +
 configs/puma-rk3399_defconfig  | 1 +
 configs/qemu-x86_64_defconfig  | 1 +
 configs/roc-pc-mezzanine-rk3399_defconfig  | 1 +
 configs/roc-pc-rk3399_defconfig| 1 +
 configs/rockpro64-rk3399_defconfig | 1 +
 configs/sama5d27_wlsom1_ek_qspiflash_defconfig | 1 +
 configs/sama5d2_xplained_spiflash_defconfig| 1 +
 configs/sama5d3xek_spiflash_defconfig  | 1 +
 configs/sama5d4_xplained_spiflash_defconfig| 1 +
 configs/sama5d4ek_spiflash_defconfig   | 1 +
 configs/sifive_fu540_defconfig | 1 +
 configs/socfpga_agilex_defconfig   | 1 +
 configs/socfpga_arria10_defconfig  | 1 +
 configs/socfpga_arria5_defconfig   | 1 +
 configs/socfpga_cyclone5_defconfig | 1 +
 configs/socfpga_dbm_soc1_defconfig | 1 +
 configs/socfpga_de0_nano_soc_defconfig | 1 +
 configs/socfpga_de10_nano_defconfig| 1 +
 configs/socfpga_de1_soc_defconfig  | 1 +
 configs/socfpga_is1_defconfig  | 1 +
 configs/socfpga_mcvevk_defconfig   | 1 +
 configs/socfpga_sockit_defconfi

Re: [PATCHv2 29/31] spi: Enable missing CONFIG_SPL_DM_SPI support

2020-06-16 Thread Simon Glass
On Tue, 16 Jun 2020 at 17:07, Tom Rini  wrote:
>
> Due to how the Makefile logic is we currently get DM_SPI support in SPL
> enabled by having DM_SPI enabled for full U-Boot but not having
> CONFIG_SPL_DM_SPI set.  Add this missing option to boards that were
> inadvertently making use of it.
>
> Cc: Adam Ford 
> Cc: Akash Gajjar 
> Cc: Anatolij Gustschin 
> Cc: Andy Yan 
> Cc: Anup Patel 
> Cc: Atish Patra 
> Cc: Bin Meng 
> Cc: Chee Hong Ang 
> Cc: Chin-Liang See 
> Cc: Dalon Westergreen 
> Cc: Dinh Nguyen 
> Cc: Eugen Hristev 
> Cc: Hannes Schmelzer 
> Cc: Heiko Schocher 
> Cc: Jagan Teki 
> Cc: Klaus Goger 
> Cc: Levin Du 
> Cc: Ley Foon Tan 
> Cc: Lokesh Vutla 
> Cc: Luca Ceresoli 
> Cc: Marek Vasut 
> Cc: Michal Simek 
> Cc: Mike Looijmans 
> Cc: Nicolas Ferre 
> Cc: Nikita Kiryanov 
> Cc: Palmer Dabbelt 
> Cc: Patrick Delaunay 
> Cc: Paul Walmsley 
> Cc: Pavel Machek 
> Cc: Peter Robinson 
> Cc: Philipp Tomsich 
> Cc: Simon Glass 
> Cc: Stefan Roese 
> Cc: Suniel Mahesh 
> Cc: Vitaly Andrianov 
> Cc: Wolfgang Grandegger 
> Signed-off-by: Tom Rini 
> ---
> Changes in v2:
> - Add k2 family
> ---
>  configs/am57xx_evm_defconfig   | 1 +
>  configs/am57xx_hs_evm_defconfig| 1 +
>  configs/am57xx_hs_evm_usb_defconfig| 1 +
>  configs/am65x_evm_a53_defconfig| 1 +
>  configs/am65x_evm_r5_defconfig | 1 +
>  configs/am65x_hs_evm_a53_defconfig | 1 +
>  configs/am65x_hs_evm_r5_defconfig  | 1 +
>  configs/avnet_ultrazedev_cc_v1_0_ultrazedev_som_v1_0_defconfig | 1 +
>  configs/axm_defconfig  | 1 +
>  configs/brppt1_spi_defconfig   | 1 +
>  configs/brsmarc1_defconfig | 1 +
>  configs/chromebit_mickey_defconfig | 1 +
>  configs/chromebook_bob_defconfig   | 1 +
>  configs/chromebook_coral_defconfig | 1 +
>  configs/chromebook_jerry_defconfig | 1 +
>  configs/chromebook_link64_defconfig| 1 +
>  configs/chromebook_minnie_defconfig| 1 +
>  configs/chromebook_samus_tpl_defconfig | 1 +
>  configs/chromebook_speedy_defconfig| 1 +
>  configs/cm_t43_defconfig   | 1 +
>  configs/da850evm_defconfig | 1 +
>  configs/da850evm_nand_defconfig| 1 +
>  configs/dra7xx_evm_defconfig   | 1 +
>  configs/dra7xx_hs_evm_defconfig| 1 +
>  configs/dra7xx_hs_evm_usb_defconfig| 1 +
>  configs/evb-px5_defconfig  | 1 +
>  configs/j721e_evm_a72_defconfig| 1 +
>  configs/j721e_evm_r5_defconfig | 1 +
>  configs/j721e_hs_evm_a72_defconfig | 1 +
>  configs/j721e_hs_evm_r5_defconfig  | 1 +
>  configs/k2e_evm_defconfig  | 1 +
>  configs/k2g_evm_defconfig  | 1 +
>  configs/k2hk_evm_defconfig | 1 +
>  configs/k2l_evm_defconfig  | 1 +
>  configs/lion-rk3368_defconfig  | 1 +
>  configs/pinebook-pro-rk3399_defconfig  | 1 +
>  configs/puma-rk3399_defconfig  | 1 +
>  configs/qemu-x86_64_defconfig  | 1 +
>  configs/roc-pc-mezzanine-rk3399_defconfig  | 1 +
>  configs/roc-pc-rk3399_defconfig| 1 +
>  configs/rockpro64-rk3399_defconfig | 1 +
>  configs/sama5d27_wlsom1_ek_qspiflash_defconfig | 1 +
>  configs/sama5d2_xplained_spiflash_defconfig| 1 +
>  configs/sama5d3xek_spiflash_defconfig  | 1 +
>  configs/sama5d4_xplained_spiflash_defconfig| 1 +
>  configs/sama5d4ek_spiflash_defconfig   | 1 +
>  configs/sifive_fu540_defconfig | 1 +
>  configs/socfpga_agilex_defconfig   | 1 +
>  configs/socfpga_arria10_defconfig  | 1 +
>  configs/socfpga_arria5_defconfig   | 1 +
>  configs/socfpga_cyclone5_defconfig | 1 +
>  configs/socfpga_dbm_soc1_defconfig | 1 +
>  configs/socfpga_de0_nano_soc_defconfig | 1 +
>  configs/socfpga_de10_nano_defconfig

Re: [PATCH v2 1/2] drivers: gpio: Add a managed API to get a GPIO from the device-tree

2020-06-16 Thread Simon Glass
Hi Pratyush,

On Fri, 29 May 2020 at 15:38, Pratyush Yadav  wrote:
>
> From: Jean-Jacques Hiblot 
>
> Add managed functions to get a gpio from the devce-tree, based on a
> property name (minus the '-gpios' suffix) and optionally an index.
>
> When the device is unbound, the GPIO is automatically released and the
> data structure is freed.
>
> Signed-off-by: Jean-Jacques Hiblot 
> ---
>  drivers/gpio/gpio-uclass.c | 70 ++
>  include/asm-generic/gpio.h | 47 +
>  2 files changed, 117 insertions(+)

Is there a change log for this one?

Regards,
Simon


Re: [RFC PATCH] allow choosing -Os/-O2 separately for SPL and TPL

2020-06-16 Thread Simon Glass
On Fri, 5 Jun 2020 at 02:37, Rasmus Villemoes
 wrote:
>
> It can be useful to build U-Boot proper with -O2, but still optimize
> the SPL for size. So add separate config options for SPL and TPL.
>
> I had to move the Makefile logic to config.mk, since otherwise
> SPL_TPL_ didn't seem to be known. Unfortunately, the SPL translation
> units end up getting both -O2 and -Os passed (assuming
> CC_OPTIMIZE_FOR_SIZE=n, SPL_CC_OPTIMIZE_FOR_SIZE=y) - it ends up with
> the intended effect, but it is still not very pretty.
>
> My Kbuild fu is pretty weak; I wonder how the two uses of $(SPL_) in
> the main Makefile works when apparently $(SPL_TPL_) didn't.

They are defined in Makefile.spl and Kbuild/include.

But SPL_TPL_ is never defined unless CONFIG_SPL_BUILD is defined, i.e.
only in Makefile.spl I think.

+Masahiro Yamada who may know

>
> Signed-off-by: Rasmus Villemoes 
> ---
>  Kconfig   | 20 
>  Makefile  |  6 --
>  config.mk |  6 ++
>  3 files changed, 26 insertions(+), 6 deletions(-)

Reviewed-by: Simon Glass 


Re: [PATCH v4 4/5] dm: pci: Assign controller device node to root bridge

2020-06-16 Thread Simon Glass
Hi Nicolas,

On Tue, 16 Jun 2020 at 08:09, Nicolas Saenz Julienne
 wrote:
>
> On Tue, 2020-06-16 at 07:43 -0600, Simon Glass wrote:
> > Hi Nicolas,
> >
> > On Fri, 12 Jun 2020 at 10:47, Nicolas Saenz Julienne
> >  wrote:
> > > There is no distinction in DT between the PCI controller device and the
> > > root bridge, whereas such distinction exists from dm's perspective. Make
> > > sure the root bridge ofnode is assigned to the controller's platform
> > > device node.
> > >
> > > This permits setups like this to work correctly:
> > >
> > > pcie {
> > > compatible = "...";
> > > ...
> > > dev {
> > > reg = <0 0 0 0 0>;
> > > ...
> > > };
> > > };
> > >
> > > Without this the dev node is assigned to the root bridge and the
> > > actual device search starts one level lower than expected.
> > >
> > > Signed-off-by: Nicolas Saenz Julienne 
> > > ---
> > >  drivers/pci/pci-uclass.c | 15 ++-
> > >  1 file changed, 14 insertions(+), 1 deletion(-)
> >
> > Can you update the tests to handle this case please?
>
> I'd be glad to, but I'm not familiar with the test FW in u-booy, coud give me
> some pointers on where/how to test this?
>

Yes it is at test/dm/pci.c and the device tree is test.dts

'make qcheck' to run all tests. To run one test, build for sandbox and
then something like

u-boot -T -c "ut dm pci_swapcase"

for example.

You can perhaps use an existing PCI controller in test.dts but feel
free to add one more if you need it for your test. Make sure that you
don't break other tests.

Regards,
Simon


Re: [PATCH v3 2/2] log: use BIT() instead of 1 <

2020-06-16 Thread Simon Glass
On Mon, 15 Jun 2020 at 13:24, Heinrich Schuchardt  wrote:
>
> Use the BIT() macro when creating a bitmask for the logging fields.
>
> Signed-off-by: Heinrich Schuchardt 
> ---
> v3:
> new patch
> ---
>  common/log_console.c | 14 +++---
>  common/log_syslog.c  | 14 +++---
>  2 files changed, 14 insertions(+), 14 deletions(-)
>

Reviewed-by: Simon Glass 


Re: [PATCH v3 1/2] log: don't show function by default

2020-06-16 Thread Simon Glass
Hi Heinrich,

On Mon, 15 Jun 2020 at 13:24, Heinrich Schuchardt  wrote:
>
> The name of the function emitting a log message may be of interest for a
> developer but is distracting for normal users. See the example below:
>
> try_load_entry() Booting: Debian
>
> Make the default format for log messages customizable. By default show
> only the message text.
>
> Signed-off-by: Heinrich Schuchardt 
> ---
> v3:
> replace #ifdef by IS_ENABLED()
> ---
>  cmd/log.c |  4 ++--
>  common/Kconfig| 18 ++
>  common/log.c  |  2 +-
>  include/log.h | 19 +--
>  test/log/syslog_test.c| 20 ++--
>  test/py/tests/test_log.py |  2 ++
>  6 files changed, 54 insertions(+), 11 deletions(-)
>

Reviewed-by: Simon Glass 

nit below

[..]

> diff --git a/include/log.h b/include/log.h
> index df65398c04..21f9b75278 100644
> --- a/include/log.h
> +++ b/include/log.h
> @@ -12,6 +12,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>
>  struct cmd_tbl;
> @@ -409,9 +410,7 @@ enum log_fmt {
> LOGF_LINE,
> LOGF_FUNC,
> LOGF_MSG,
> -

Can we keep that? I makes it easier to see the 'real' enum values and
the ones that are used for maintenance below:

> LOGF_COUNT,
> -   LOGF_DEFAULT = (1 << LOGF_FUNC) | (1 << LOGF_MSG),
> LOGF_ALL = 0x3f,
>  };
>
> @@ -460,4 +459,20 @@ static inline int log_init(void)
>  }
>  #endif
>

Regards,
Simon


[PATCHv2 30/31] spi: Update build guard for DM objects to cover SPL/TPL

2020-06-16 Thread Tom Rini
We need to ensure that in the cases where SPL / TPL do not use DM we do
not try and build the core nor drivers that require DM.

Cc: Jagan Teki 
Signed-off-by: Tom Rini 
---
 drivers/spi/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index 54881a74124d..9559e938d262 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -4,7 +4,7 @@
 # Wolfgang Denk, DENX Software Engineering, w...@denx.de.
 
 # There are many options which enable SPI, so make this library available
-ifdef CONFIG_DM_SPI
+ifdef CONFIG_$(SPL_TPL_)DM_SPI
 obj-y += spi-uclass.o
 obj-$(CONFIG_SANDBOX) += spi-emul-uclass.o
 obj-$(CONFIG_SOFT_SPI) += soft_spi.o
-- 
2.17.1



[PATCHv2 27/31] Convert CONFIG_BOOTM_NETBSD to Kconfig

2020-06-16 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_BOOTM_NETBSD

Signed-off-by: Tom Rini 
---
 configs/deneb_defconfig| 1 +
 configs/giedi_defconfig| 1 +
 configs/imx8qm_rom7720_a1_4G_defconfig | 1 +
 include/configs/capricorn-common.h | 4 
 include/configs/imx8qm_rom7720.h   | 2 --
 5 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/configs/deneb_defconfig b/configs/deneb_defconfig
index 5377b4fed513..c0e7725f64e5 100644
--- a/configs/deneb_defconfig
+++ b/configs/deneb_defconfig
@@ -37,6 +37,7 @@ CONFIG_AUTOBOOT_PROMPT="Autobooting in %d seconds, press 
\"\" to stop\
 CONFIG_AUTOBOOT_STOP_STR="\x1b\x1b"
 CONFIG_AUTOBOOT_KEYED_CTRLC=y
 CONFIG_CMD_CPU=y
+# CONFIG_BOOTM_NETBSD is not set
 # CONFIG_CMD_EXPORTENV is not set
 # CONFIG_CMD_IMPORTENV is not set
 # CONFIG_CMD_CRC32 is not set
diff --git a/configs/giedi_defconfig b/configs/giedi_defconfig
index dfac924bbb08..d2b0f13f61f1 100644
--- a/configs/giedi_defconfig
+++ b/configs/giedi_defconfig
@@ -37,6 +37,7 @@ CONFIG_AUTOBOOT_PROMPT="Autobooting in %d seconds, press 
\"\" to stop\
 CONFIG_AUTOBOOT_STOP_STR="\x1b\x1b"
 CONFIG_AUTOBOOT_KEYED_CTRLC=y
 CONFIG_CMD_CPU=y
+# CONFIG_BOOTM_NETBSD is not set
 # CONFIG_CMD_EXPORTENV is not set
 # CONFIG_CMD_IMPORTENV is not set
 # CONFIG_CMD_CRC32 is not set
diff --git a/configs/imx8qm_rom7720_a1_4G_defconfig 
b/configs/imx8qm_rom7720_a1_4G_defconfig
index 305c4e827c66..8af2b239d6e8 100644
--- a/configs/imx8qm_rom7720_a1_4G_defconfig
+++ b/configs/imx8qm_rom7720_a1_4G_defconfig
@@ -27,6 +27,7 @@ CONFIG_SPL_POWER_DOMAIN=y
 CONFIG_SPL_WATCHDOG_SUPPORT=y
 CONFIG_HUSH_PARSER=y
 CONFIG_CMD_CPU=y
+# CONFIG_BOOTM_NETBSD is not set
 # CONFIG_CMD_IMPORTENV is not set
 CONFIG_CMD_CLK=y
 CONFIG_CMD_DM=y
diff --git a/include/configs/capricorn-common.h 
b/include/configs/capricorn-common.h
index b107e0ce3f96..38a56e897e82 100644
--- a/include/configs/capricorn-common.h
+++ b/include/configs/capricorn-common.h
@@ -42,10 +42,6 @@
 
 #define CONFIG_REMAKE_ELF
 
-/* Commands */
-
-#undef CONFIG_BOOTM_NETBSD
-
 /* ENET Config */
 #define CONFIG_FEC_XCV_TYPERMII
 #define FEC_QUIRK_ENET_MAC
diff --git a/include/configs/imx8qm_rom7720.h b/include/configs/imx8qm_rom7720.h
index 9808e72474f0..5621ba8232da 100644
--- a/include/configs/imx8qm_rom7720.h
+++ b/include/configs/imx8qm_rom7720.h
@@ -15,8 +15,6 @@
 #define CONFIG_SPL_BSS_START_ADDR  0x00128000
 #define CONFIG_SPL_BSS_MAX_SIZE0x1000  /* 4 KB */
 
-#undef CONFIG_BOOTM_NETBSD
-
 #define CONFIG_FSL_USDHC
 #define CONFIG_SYS_BOOTMAPSZ   (256 << 20)
 #define CONFIG_SYS_FSL_ESDHC_ADDR  0
-- 
2.17.1



[PATCHv2 31/31] Convert CONFIG_CADENCE_QSPI to Kconfig

2020-06-16 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_CADENCE_QSPI

Signed-off-by: Tom Rini 
---
 configs/k2g_evm_defconfig| 1 +
 configs/k2g_hs_evm_defconfig | 1 +
 drivers/spi/Makefile | 2 +-
 include/configs/k2g_evm.h| 1 -
 4 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/configs/k2g_evm_defconfig b/configs/k2g_evm_defconfig
index c763ead401b1..b7310900e4c5 100644
--- a/configs/k2g_evm_defconfig
+++ b/configs/k2g_evm_defconfig
@@ -74,6 +74,7 @@ CONFIG_DM_SERIAL=y
 CONFIG_SYS_NS16550=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
+CONFIG_CADENCE_QSPI=y
 CONFIG_DAVINCI_SPI=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
diff --git a/configs/k2g_hs_evm_defconfig b/configs/k2g_hs_evm_defconfig
index f089be4f563a..adedfddf4f50 100644
--- a/configs/k2g_hs_evm_defconfig
+++ b/configs/k2g_hs_evm_defconfig
@@ -62,6 +62,7 @@ CONFIG_DM_SERIAL=y
 CONFIG_SYS_NS16550=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
+CONFIG_CADENCE_QSPI=y
 CONFIG_DAVINCI_SPI=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index 9559e938d262..4e7461771f2b 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -6,6 +6,7 @@
 # There are many options which enable SPI, so make this library available
 ifdef CONFIG_$(SPL_TPL_)DM_SPI
 obj-y += spi-uclass.o
+obj-$(CONFIG_CADENCE_QSPI) += cadence_qspi.o cadence_qspi_apb.o
 obj-$(CONFIG_SANDBOX) += spi-emul-uclass.o
 obj-$(CONFIG_SOFT_SPI) += soft_spi.o
 obj-$(CONFIG_SPI_MEM) += spi-mem.o
@@ -22,7 +23,6 @@ obj-$(CONFIG_ATMEL_SPI) += atmel_spi.o
 obj-$(CONFIG_BCM63XX_HSSPI) += bcm63xx_hsspi.o
 obj-$(CONFIG_BCM63XX_SPI) += bcm63xx_spi.o
 obj-$(CONFIG_BCMSTB_SPI) += bcmstb_spi.o
-obj-$(CONFIG_CADENCE_QSPI) += cadence_qspi.o cadence_qspi_apb.o
 obj-$(CONFIG_CF_SPI) += cf_spi.o
 obj-$(CONFIG_DAVINCI_SPI) += davinci_spi.o
 obj-$(CONFIG_DESIGNWARE_SPI) += designware_spi.o
diff --git a/include/configs/k2g_evm.h b/include/configs/k2g_evm.h
index 25f3959533c6..83466b9e0cfa 100644
--- a/include/configs/k2g_evm.h
+++ b/include/configs/k2g_evm.h
@@ -82,7 +82,6 @@
 #define PHY_ANEG_TIMEOUT   1 /* PHY needs longer aneg time */
 
 #ifndef CONFIG_SPL_BUILD
-#define CONFIG_CADENCE_QSPI
 #define CONFIG_CQSPI_REF_CLK 38400
 #endif
 
-- 
2.17.1



[PATCHv2 28/31] Kconfig: Remove CONFIG_CLOCKS_IN_MHZ

2020-06-16 Thread Tom Rini
This variable is unset anywhere and only unset on a number of platforms.
Remove all relevant code.

Signed-off-by: Tom Rini 
---
 README | 13 -
 include/configs/MPC8536DS.h|  2 --
 include/configs/MPC8540ADS.h   |  2 --
 include/configs/MPC8541CDS.h   |  2 --
 include/configs/MPC8544DS.h|  2 --
 include/configs/MPC8548CDS.h   |  1 -
 include/configs/MPC8555CDS.h   |  2 --
 include/configs/MPC8560ADS.h   |  2 --
 include/configs/MPC8568MDS.h   |  2 --
 include/configs/MPC8569MDS.h   |  2 --
 include/configs/MPC8572DS.h|  2 --
 include/configs/MPC8610HPCD.h  |  2 --
 include/configs/MPC8641HPCN.h  |  2 --
 include/configs/UCP1020.h  |  2 --
 include/configs/p1_p2_rdb_pc.h |  2 --
 include/configs/sbc8548.h  |  2 --
 include/configs/sbc8641d.h |  2 --
 include/env_default.h  |  3 ---
 18 files changed, 47 deletions(-)

diff --git a/README b/README
index a0f54645fc26..11273726d323 100644
--- a/README
+++ b/README
@@ -559,19 +559,6 @@ The following options need to be configured:
such as ARM architectural timer initialization.
 
 - Linux Kernel Interface:
-   CONFIG_CLOCKS_IN_MHZ
-
-   U-Boot stores all clock information in Hz
-   internally. For binary compatibility with older Linux
-   kernels (which expect the clocks passed in the
-   bd_info data to be in MHz) the environment variable
-   "clocks_in_mhz" can be defined so that U-Boot
-   converts clock data to MHZ before passing it to the
-   Linux kernel.
-   When CONFIG_CLOCKS_IN_MHZ is defined, a definition of
-   "clocks_in_mhz=1" is automatically included in the
-   default environment.
-
CONFIG_MEMSIZE_IN_BYTES [relevant for MIPS only]
 
When transferring memsize parameter to Linux, some versions
diff --git a/include/configs/MPC8536DS.h b/include/configs/MPC8536DS.h
index 340574a98526..3956bdd2512c 100644
--- a/include/configs/MPC8536DS.h
+++ b/include/configs/MPC8536DS.h
@@ -124,8 +124,6 @@
 #error ("CONFIG_SPD_EEPROM is required")
 #endif
 
-#undef CONFIG_CLOCKS_IN_MHZ
-
 /*
  * Memory map -- xxx -this is wrong, needs updating
  *
diff --git a/include/configs/MPC8540ADS.h b/include/configs/MPC8540ADS.h
index f78782a1c140..f15af931483c 100644
--- a/include/configs/MPC8540ADS.h
+++ b/include/configs/MPC8540ADS.h
@@ -112,8 +112,6 @@
 
 #define CONFIG_SYS_FLASH_EMPTY_INFO
 
-#undef CONFIG_CLOCKS_IN_MHZ
-
 /*
  * Local Bus Definitions
  */
diff --git a/include/configs/MPC8541CDS.h b/include/configs/MPC8541CDS.h
index b2a320107203..9c77dcecd99a 100644
--- a/include/configs/MPC8541CDS.h
+++ b/include/configs/MPC8541CDS.h
@@ -57,8 +57,6 @@ extern unsigned long get_clock_freq(void);
 #error ("CONFIG_SPD_EEPROM is required by MPC8CDS")
 #endif
 
-#undef CONFIG_CLOCKS_IN_MHZ
-
 /*
  * Local Bus Definitions
  */
diff --git a/include/configs/MPC8544DS.h b/include/configs/MPC8544DS.h
index c9f193fc4672..49c2a4acca27 100644
--- a/include/configs/MPC8544DS.h
+++ b/include/configs/MPC8544DS.h
@@ -63,8 +63,6 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
 #error ("CONFIG_SPD_EEPROM is required")
 #endif
 
-#undef CONFIG_CLOCKS_IN_MHZ
-
 /*
  * Memory map
  *
diff --git a/include/configs/MPC8548CDS.h b/include/configs/MPC8548CDS.h
index de2bfd8f2f4a..933417483483 100644
--- a/include/configs/MPC8548CDS.h
+++ b/include/configs/MPC8548CDS.h
@@ -73,7 +73,6 @@ extern unsigned long get_clock_freq(void);
 #error ("CONFIG_SPD_EEPROM is required")
 #endif
 
-#undef CONFIG_CLOCKS_IN_MHZ
 /*
  * Physical Address Map
  *
diff --git a/include/configs/MPC8555CDS.h b/include/configs/MPC8555CDS.h
index d964b4e12173..9a14323b52ef 100644
--- a/include/configs/MPC8555CDS.h
+++ b/include/configs/MPC8555CDS.h
@@ -55,8 +55,6 @@ extern unsigned long get_clock_freq(void);
 #error ("CONFIG_SPD_EEPROM is required by MPC8CDS")
 #endif
 
-#undef CONFIG_CLOCKS_IN_MHZ
-
 /*
  * Local Bus Definitions
  */
diff --git a/include/configs/MPC8560ADS.h b/include/configs/MPC8560ADS.h
index 97d8cc48edf7..250f2de86060 100644
--- a/include/configs/MPC8560ADS.h
+++ b/include/configs/MPC8560ADS.h
@@ -113,8 +113,6 @@
 
 #define CONFIG_SYS_FLASH_EMPTY_INFO
 
-#undef CONFIG_CLOCKS_IN_MHZ
-
 /*
  * Local Bus Definitions
  */
diff --git a/include/configs/MPC8568MDS.h b/include/configs/MPC8568MDS.h
index a0bd5f4d40f6..46d6b16d34d2 100644
--- a/include/configs/MPC8568MDS.h
+++ b/include/configs/MPC8568MDS.h
@@ -59,8 +59,6 @@ extern unsigned long get_clock_freq(void);
 #error ("CONFIG_SPD_EEPROM is required")
 #endif
 
-#undef CONFIG_CLOCKS_IN_MHZ
-
 /*
  * Local Bus Definitions
  */
diff --git a/include/configs/MPC8569MDS.h b/include/configs/MPC8569MDS.h
index beba848214e7..bbc75e35a7f8 100644
--- a/include/configs/MPC8569MDS.h
+++ b/include/configs/MPC8569MDS.h
@@ -109,8 +109,6 @@ extern unsigned long get_clock_freq(void);
 #define CONFIG_S

[PATCHv2 24/31] arm: imx: Finish migration from CONFIG_SECURE_BOOT to CONFIG_IMX_HAB

2020-06-16 Thread Tom Rini
There are a few remaining places where we say CONFIG_SECURE_BOOT rather
than CONFIG_IMX HAB.  Update these instances.

Cc: Stefano Babic 
Cc: Fabio Estevam 
Cc: NXP i.MX U-Boot Team 
Cc: Eddy Petrișor 
Cc: Shawn Guo 
Cc: Priyanka Jain 
Fixes: d714a75fd4dc ("imx: replace CONFIG_SECURE_BOOT with CONFIG_IMX_HAB")
Signed-off-by: Tom Rini 
---
Changes in v2:
- Drop layerscape portion to its own patch
---
 arch/arm/mach-imx/spl_qspi.cfg| 2 +-
 board/ea/mx7ulp_com/imximage.cfg  | 2 +-
 board/freescale/s32v234evb/s32v234evb.cfg | 2 +-
 board/novtech/meerkat96/imximage.cfg  | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-imx/spl_qspi.cfg b/arch/arm/mach-imx/spl_qspi.cfg
index 88956e626ffd..1e39ae2f01f7 100644
--- a/arch/arm/mach-imx/spl_qspi.cfg
+++ b/arch/arm/mach-imx/spl_qspi.cfg
@@ -12,6 +12,6 @@ BOOT_FROM qspi
 /*
  * Secure boot support
  */
-#ifdef CONFIG_SECURE_BOOT
+#ifdef CONFIG_IMX_HAB
 CSF CONFIG_CSF_SIZE
 #endif
diff --git a/board/ea/mx7ulp_com/imximage.cfg b/board/ea/mx7ulp_com/imximage.cfg
index d298d17c1e92..1b218996aea9 100644
--- a/board/ea/mx7ulp_com/imximage.cfg
+++ b/board/ea/mx7ulp_com/imximage.cfg
@@ -28,7 +28,7 @@ BOOT_FROM sd
 PLUGIN board/freescale/mx7ulp_evk/plugin.bin 0x2F02
 #else
 
-#ifdef CONFIG_SECURE_BOOT
+#ifdef CONFIG_IMX_HAB
 CSF CONFIG_CSF_SIZE
 #endif
 /*
diff --git a/board/freescale/s32v234evb/s32v234evb.cfg 
b/board/freescale/s32v234evb/s32v234evb.cfg
index 7881512139d0..d7f722006312 100644
--- a/board/freescale/s32v234evb/s32v234evb.cfg
+++ b/board/freescale/s32v234evb/s32v234evb.cfg
@@ -23,6 +23,6 @@ BOOT_FROM sd
  */
 
 
-#ifdef CONFIG_SECURE_BOOT
+#ifdef CONFIG_IMX_HAB
 SECURE_BOOT
 #endif
diff --git a/board/novtech/meerkat96/imximage.cfg 
b/board/novtech/meerkat96/imximage.cfg
index 3bd8cc55e53c..86275b84d9c8 100644
--- a/board/novtech/meerkat96/imximage.cfg
+++ b/board/novtech/meerkat96/imximage.cfg
@@ -25,7 +25,7 @@ BOOT_FROM sd
 /*
  * Secure boot support
  */
-#ifdef CONFIG_SECURE_BOOT
+#ifdef CONFIG_IMX_HAB
 CSF CONFIG_CSF_SIZE
 #endif
 
-- 
2.17.1



[PATCHv2 23/31] Convert CONFIG_CONSOLE_SCROLL_LINES to Kconfig

2020-06-16 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_CONSOLE_SCROLL_LINES

Signed-off-by: Tom Rini 
---
 include/configs/evb_px5.h| 1 -
 include/configs/evb_rk3308.h | 2 --
 include/configs/evb_rk3328.h | 2 --
 include/configs/firefly_rk3308.h | 2 --
 include/configs/geekbox.h| 2 --
 include/configs/sheep_rk3368.h   | 2 --
 6 files changed, 11 deletions(-)

diff --git a/include/configs/evb_px5.h b/include/configs/evb_px5.h
index e9304206bb12..ed801dd84556 100644
--- a/include/configs/evb_px5.h
+++ b/include/configs/evb_px5.h
@@ -8,7 +8,6 @@
 
 #include 
 
-#define CONFIG_CONSOLE_SCROLL_LINES10
 #define CONFIG_SYS_MMC_ENV_DEV 0
 
 #endif
diff --git a/include/configs/evb_rk3308.h b/include/configs/evb_rk3308.h
index 4d40606e4bd3..0d2cb21ac679 100644
--- a/include/configs/evb_rk3308.h
+++ b/include/configs/evb_rk3308.h
@@ -14,7 +14,5 @@
 #define ROCKCHIP_DEVICE_SETTINGS \
"stdout=serial,vidconsole\0" \
"stderr=serial,vidconsole\0"
-#undef CONFIG_CONSOLE_SCROLL_LINES
-#define CONFIG_CONSOLE_SCROLL_LINES10
 
 #endif
diff --git a/include/configs/evb_rk3328.h b/include/configs/evb_rk3328.h
index ed5888bfd3e9..26687e638616 100644
--- a/include/configs/evb_rk3328.h
+++ b/include/configs/evb_rk3328.h
@@ -12,6 +12,4 @@
 
 #define SDRAM_BANK_SIZE(2UL << 30)
 
-#define CONFIG_CONSOLE_SCROLL_LINES10
-
 #endif
diff --git a/include/configs/firefly_rk3308.h b/include/configs/firefly_rk3308.h
index 2cc7b4a153f8..7b8b62fbcb15 100644
--- a/include/configs/firefly_rk3308.h
+++ b/include/configs/firefly_rk3308.h
@@ -14,7 +14,5 @@
 #define ROCKCHIP_DEVICE_SETTINGS \
"stdout=serial,vidconsole\0" \
"stderr=serial,vidconsole\0"
-#undef CONFIG_CONSOLE_SCROLL_LINES
-#define CONFIG_CONSOLE_SCROLL_LINES10
 
 #endif
diff --git a/include/configs/geekbox.h b/include/configs/geekbox.h
index 91f4feb73708..4b12eb7af9a8 100644
--- a/include/configs/geekbox.h
+++ b/include/configs/geekbox.h
@@ -8,6 +8,4 @@
 
 #include 
 
-#define CONFIG_CONSOLE_SCROLL_LINES10
-
 #endif
diff --git a/include/configs/sheep_rk3368.h b/include/configs/sheep_rk3368.h
index 238838fd7d05..550597c957d0 100644
--- a/include/configs/sheep_rk3368.h
+++ b/include/configs/sheep_rk3368.h
@@ -13,6 +13,4 @@
 #define DTB_LOAD_ADDR  0x560
 #define INITRD_LOAD_ADDR   0x5bf
 
-#define CONFIG_CONSOLE_SCROLL_LINES10
-
 #endif
-- 
2.17.1



[PATCHv2 26/31] arm: imx: Finish migration of CONFIG_CSF_SIZE to Kconfig

2020-06-16 Thread Tom Rini
While in most cases CSF_SIZE is handled via Kconfig we have some i.MX8M
platforms that set the size based on the now-renamed CONFIG_SECURE_BOOT
symbol.  Update things so that CSF_SIZE itself depends on IMX_HAB being
enabled and provide the default value for i.MX8M family of parts.

Cc: Stefano Babic 
Cc: Fabio Estevam 
Cc: Ye Li 
Cc: NXP i.MX U-Boot Team 
Fixes: d714a75fd4dc ("imx: replace CONFIG_SECURE_BOOT with CONFIG_IMX_HAB")
Signed-off-by: Tom Rini 
---
Changes in v2:
- Make CSF_SIZE depend on IMX_HAB and update to be default 0x2000 if
  ARCH_IMX8M after comments from Ye Li
- Reword the commit slightly
---
 arch/arm/mach-imx/Kconfig   | 2 ++
 include/configs/imx8mm_beacon.h | 4 
 include/configs/imx8mm_evk.h| 4 
 include/configs/imx8mn_evk.h| 4 
 include/configs/imx8mp_evk.h| 4 
 include/configs/verdin-imx8mm.h | 4 
 6 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 6c3fedf665d6..1531d09f3bea 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -52,6 +52,8 @@ config IMX_HAB
 
 config CSF_SIZE
hex "Maximum size for Command Sequence File (CSF) binary"
+   depends on IMX_HAB
+   default 0x2000 if ARCH_IMX8M
default 0x2060
help
  Define the maximum size for Command Sequence File (CSF) binary
diff --git a/include/configs/imx8mm_beacon.h b/include/configs/imx8mm_beacon.h
index 21102d3c14d2..ce3ba7492435 100644
--- a/include/configs/imx8mm_beacon.h
+++ b/include/configs/imx8mm_beacon.h
@@ -9,10 +9,6 @@
 #include 
 #include 
 
-#ifdef CONFIG_SECURE_BOOT
-#define CONFIG_CSF_SIZESZ_8K
-#endif
-
 #define CONFIG_SPL_MAX_SIZE(148 * 1024)
 #define CONFIG_SYS_MONITOR_LEN SZ_512K
 #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
diff --git a/include/configs/imx8mm_evk.h b/include/configs/imx8mm_evk.h
index 901a1bed6dd1..382ba620ccf4 100644
--- a/include/configs/imx8mm_evk.h
+++ b/include/configs/imx8mm_evk.h
@@ -10,10 +10,6 @@
 #include 
 #include 
 
-#ifdef CONFIG_SECURE_BOOT
-#define CONFIG_CSF_SIZESZ_8K
-#endif
-
 #define CONFIG_SPL_MAX_SIZE(148 * 1024)
 #define CONFIG_SYS_MONITOR_LEN SZ_512K
 #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
diff --git a/include/configs/imx8mn_evk.h b/include/configs/imx8mn_evk.h
index a07440c73ba8..4350b5a62aff 100644
--- a/include/configs/imx8mn_evk.h
+++ b/include/configs/imx8mn_evk.h
@@ -10,10 +10,6 @@
 #include 
 #include 
 
-#ifdef CONFIG_SECURE_BOOT
-#define CONFIG_CSF_SIZESZ_8K
-#endif
-
 #define CONFIG_SPL_MAX_SIZE(148 * 1024)
 #define CONFIG_SYS_MONITOR_LEN SZ_512K
 #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
diff --git a/include/configs/imx8mp_evk.h b/include/configs/imx8mp_evk.h
index 7f38f21c09c5..9c13235982c6 100644
--- a/include/configs/imx8mp_evk.h
+++ b/include/configs/imx8mp_evk.h
@@ -10,10 +10,6 @@
 #include 
 #include 
 
-#ifdef CONFIG_SECURE_BOOT
-#define CONFIG_CSF_SIZE0x2000 /* 8K region */
-#endif
-
 #define CONFIG_SPL_MAX_SIZE(152 * 1024)
 #define CONFIG_SYS_MONITOR_LEN (512 * 1024)
 #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
diff --git a/include/configs/verdin-imx8mm.h b/include/configs/verdin-imx8mm.h
index ca528598f2f1..878c4996df42 100644
--- a/include/configs/verdin-imx8mm.h
+++ b/include/configs/verdin-imx8mm.h
@@ -9,10 +9,6 @@
 #include 
 #include 
 
-#ifdef CONFIG_SECURE_BOOT
-#define CONFIG_CSF_SIZESZ_8K
-#endif
-
 #define CONFIG_SPL_MAX_SIZE(148 * 1024)
 #define CONFIG_SYS_MONITOR_LEN SZ_512K
 #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
-- 
2.17.1



[PATCHv2 22/31] arm: toradex: Convert CONFIG_CONSOLE_MUX to Kconfig

2020-06-16 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_CONSOLE_MUX

Cc: Igor Opaniuk 
Signed-off-by: Tom Rini 
---
 configs/apalis_imx6_defconfig  | 2 --
 configs/colibri_imx6_defconfig | 2 --
 include/configs/apalis_imx6.h  | 1 -
 include/configs/colibri_imx6.h | 1 -
 4 files changed, 6 deletions(-)

diff --git a/configs/apalis_imx6_defconfig b/configs/apalis_imx6_defconfig
index 6b0f0e463896..e9d9b3f30239 100644
--- a/configs/apalis_imx6_defconfig
+++ b/configs/apalis_imx6_defconfig
@@ -19,8 +19,6 @@ CONFIG_DISTRO_DEFAULTS=y
 CONFIG_FIT=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg,MX6Q"
 CONFIG_BOOTDELAY=1
-# CONFIG_CONSOLE_MUX is not set
-CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 CONFIG_MISC_INIT_R=y
 CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
diff --git a/configs/colibri_imx6_defconfig b/configs/colibri_imx6_defconfig
index 44a3ff859c2d..8bdae00129c3 100644
--- a/configs/colibri_imx6_defconfig
+++ b/configs/colibri_imx6_defconfig
@@ -18,8 +18,6 @@ CONFIG_DISTRO_DEFAULTS=y
 CONFIG_FIT=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg,MX6DL"
 CONFIG_BOOTDELAY=1
-# CONFIG_CONSOLE_MUX is not set
-CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 CONFIG_MISC_INIT_R=y
 CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
diff --git a/include/configs/apalis_imx6.h b/include/configs/apalis_imx6.h
index d5a0625e0282..b2d87019c8e7 100644
--- a/include/configs/apalis_imx6.h
+++ b/include/configs/apalis_imx6.h
@@ -74,7 +74,6 @@
 #define CONFIG_BMP_16BPP
 #define CONFIG_VIDEO_LOGO
 #define CONFIG_VIDEO_BMP_LOGO
-#define CONFIG_CONSOLE_MUX
 #define CONFIG_IMX_HDMI
 #define CONFIG_IMX_VIDEO_SKIP
 
diff --git a/include/configs/colibri_imx6.h b/include/configs/colibri_imx6.h
index 6beef250942b..a0ee4d48ad06 100644
--- a/include/configs/colibri_imx6.h
+++ b/include/configs/colibri_imx6.h
@@ -62,7 +62,6 @@
 #define CONFIG_BMP_16BPP
 #define CONFIG_VIDEO_LOGO
 #define CONFIG_VIDEO_BMP_LOGO
-#define CONFIG_CONSOLE_MUX
 #define CONFIG_IMX_HDMI
 #define CONFIG_IMX_VIDEO_SKIP
 
-- 
2.17.1



[PATCHv2 25/31] nxp: Finish switch to CONFIG_NXP_ESBC

2020-06-16 Thread Tom Rini
There are two remaining users of the CONFIG_SECURE_BOOT symbol that have
not been migrated to another symbol.  In this case, they should be using
CONFIG_NXP_ESBC as their guard.

Cc: Vladimir Oltean 
Fixes: 5536c3c9d0d1 ("freescale/layerscape: Rename the config 
CONFIG_SECURE_BOOT name")
Signed-off-by: Tom Rini 
---
Changes in v2:
- New patch
---
 Makefile | 2 +-
 include/configs/ls1021atsn.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 149f83994814..035b2cc6685a 100644
--- a/Makefile
+++ b/Makefile
@@ -887,7 +887,7 @@ ALL-$(CONFIG_ONENAND_U_BOOT) += u-boot-onenand.bin
 ifeq ($(CONFIG_SPL_FSL_PBL),y)
 ALL-$(CONFIG_RAMBOOT_PBL) += u-boot-with-spl-pbl.bin
 else
-ifneq ($(CONFIG_SECURE_BOOT), y)
+ifneq ($(CONFIG_NXP_ESBC), y)
 # For Secure Boot The Image needs to be signed and Header must also
 # be included. So The image has to be built explicitly
 ALL-$(CONFIG_RAMBOOT_PBL) += u-boot.pbl
diff --git a/include/configs/ls1021atsn.h b/include/configs/ls1021atsn.h
index e76e54e97fc9..72aed8fed61c 100644
--- a/include/configs/ls1021atsn.h
+++ b/include/configs/ls1021atsn.h
@@ -60,9 +60,9 @@
 #define CONFIG_SYS_FSL_PBL_RCW \
"board/freescale/ls1021atsn/ls102xa_rcw_sd.cfg"
 
-#ifdef CONFIG_SECURE_BOOT
+#ifdef CONFIG_NXP_ESBC
 #define CONFIG_U_BOOT_HDR_SIZE (16 << 10)
-#endif /* ifdef CONFIG_SECURE_BOOT */
+#endif /* ifdef CONFIG_NXP_ESBC */
 
 #define CONFIG_SPL_MAX_SIZE0x1a000
 #define CONFIG_SPL_STACK   0x1001d000
-- 
2.17.1



[PATCHv2 20/31] Convert CONFIG_CMDLINE_EDITING to Kconfig

2020-06-16 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_CMDLINE_EDITING

Signed-off-by: Tom Rini 
---
 include/configs/ls1028a_common.h | 4 
 1 file changed, 4 deletions(-)

diff --git a/include/configs/ls1028a_common.h b/include/configs/ls1028a_common.h
index 44f2dc8f9b41..c191f74a3a61 100644
--- a/include/configs/ls1028a_common.h
+++ b/include/configs/ls1028a_common.h
@@ -87,10 +87,6 @@
sizeof(CONFIG_SYS_PROMPT) + 16)
 #define CONFIG_SYS_BARGSIZECONFIG_SYS_CBSIZE /* Boot args buffer */
 
-#ifndef CONFIG_CMDLINE_EDITING
-#define CONFIG_CMDLINE_EDITING 1
-#endif
-
 #define CONFIG_SYS_MAXARGS 64  /* max command args */
 
 #define CONFIG_SYS_BOOTM_LEN   (64 << 20)  /* Increase max gunzip size */
-- 
2.17.1



[PATCHv2 19/31] Convert CONFIG_BUILD_TARGET to Kconfig

2020-06-16 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_BUILD_TARGET

Signed-off-by: Tom Rini 
---
 include/configs/db-88f6281-bp.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/configs/db-88f6281-bp.h b/include/configs/db-88f6281-bp.h
index cc51e6646ee3..e234b0bf9826 100644
--- a/include/configs/db-88f6281-bp.h
+++ b/include/configs/db-88f6281-bp.h
@@ -11,7 +11,6 @@
 #define CONFIG_SKIP_LOWLEVEL_INIT  /* disable board lowlevel_init */
 #define CONFIG_SYS_TCLK16667
 #define CONFIG_SYS_KWD_CONFIG  $(CONFIG_BOARDDIR)/kwbimage.cfg
-#define CONFIG_BUILD_TARGET"u-boot.kwb"
 
 /* additions for new ARM relocation support */
 #define CONFIG_SYS_SDRAM_BASE  0x
-- 
2.17.1



[PATCHv2 21/31] Convert CONFIG_CONS_INDEX to Kconfig

2020-06-16 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_CONS_INDEX

Signed-off-by: Tom Rini 
---
 configs/am43xx_evm_defconfig   | 1 -
 configs/am43xx_evm_qspiboot_defconfig  | 2 +-
 configs/am43xx_evm_rtconly_defconfig   | 1 -
 configs/am43xx_evm_usbhost_boot_defconfig  | 1 -
 configs/am43xx_hs_evm_defconfig| 1 -
 configs/birdland_bav335a_defconfig | 1 -
 configs/birdland_bav335b_defconfig | 1 -
 configs/gardena-smart-gateway-mt7688_defconfig | 1 +
 configs/linkit-smart-7688_defconfig| 2 ++
 configs/ls1028aqds_tfa_lpuart_defconfig| 1 +
 configs/mscc_jr2_defconfig | 1 +
 configs/mscc_luton_defconfig   | 1 +
 configs/mscc_ocelot_defconfig  | 1 +
 configs/mscc_serval_defconfig  | 1 +
 configs/mscc_servalt_defconfig | 1 +
 configs/mt7628_rfb_defconfig   | 1 -
 configs/x530_defconfig | 1 +
 include/configs/SBx81LIFKW.h   | 2 --
 include/configs/SBx81LIFXCAT.h | 2 --
 include/configs/brsmarc1.h | 2 --
 include/configs/db-88f6281-bp.h| 7 ---
 include/configs/gardena-smart-gateway-mt7688.h | 1 -
 include/configs/linkit-smart-7688.h| 1 -
 include/configs/ls1021atsn.h   | 1 -
 include/configs/ls1028a_common.h   | 1 -
 include/configs/mt7628.h   | 1 -
 include/configs/vcoreiii.h | 2 --
 include/configs/vocore2.h  | 1 -
 include/configs/x530.h | 2 --
 29 files changed, 11 insertions(+), 31 deletions(-)

diff --git a/configs/am43xx_evm_defconfig b/configs/am43xx_evm_defconfig
index df02489b3b6e..be88f28e9e3d 100644
--- a/configs/am43xx_evm_defconfig
+++ b/configs/am43xx_evm_defconfig
@@ -10,7 +10,6 @@ CONFIG_SPL_DRIVERS_MISC_SUPPORT=y
 CONFIG_SPL=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_SPL_LOAD_FIT=y
-CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=1"
 # CONFIG_USE_BOOTCOMMAND is not set
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 # CONFIG_MISC_INIT_R is not set
diff --git a/configs/am43xx_evm_qspiboot_defconfig 
b/configs/am43xx_evm_qspiboot_defconfig
index 459096db4f55..fea5aa01745a 100644
--- a/configs/am43xx_evm_qspiboot_defconfig
+++ b/configs/am43xx_evm_qspiboot_defconfig
@@ -10,7 +10,7 @@ CONFIG_DM_GPIO=y
 CONFIG_AM43XX=y
 CONFIG_ENV_OFFSET_REDUND=0x12
 CONFIG_DISTRO_DEFAULTS=y
-CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=1,QSPI,QSPI_BOOT"
+CONFIG_SYS_EXTRA_OPTIONS="QSPI,QSPI_BOOT"
 CONFIG_QSPI_BOOT=y
 # CONFIG_USE_BOOTCOMMAND is not set
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
diff --git a/configs/am43xx_evm_rtconly_defconfig 
b/configs/am43xx_evm_rtconly_defconfig
index 66fe74407f12..8f1e60fd3e5d 100644
--- a/configs/am43xx_evm_rtconly_defconfig
+++ b/configs/am43xx_evm_rtconly_defconfig
@@ -10,7 +10,6 @@ CONFIG_SPL_RTC_DDR_SUPPORT=y
 CONFIG_SPL=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_SPL_LOAD_FIT=y
-CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=1"
 # CONFIG_USE_BOOTCOMMAND is not set
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 # CONFIG_MISC_INIT_R is not set
diff --git a/configs/am43xx_evm_usbhost_boot_defconfig 
b/configs/am43xx_evm_usbhost_boot_defconfig
index d1a6fbe75387..7afd328a4983 100644
--- a/configs/am43xx_evm_usbhost_boot_defconfig
+++ b/configs/am43xx_evm_usbhost_boot_defconfig
@@ -9,7 +9,6 @@ CONFIG_AM43XX=y
 CONFIG_SPL=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_SPL_LOAD_FIT=y
-CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=1"
 # CONFIG_USE_BOOTCOMMAND is not set
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 # CONFIG_MISC_INIT_R is not set
diff --git a/configs/am43xx_hs_evm_defconfig b/configs/am43xx_hs_evm_defconfig
index deaa19007fae..79a0466b5ac2 100644
--- a/configs/am43xx_hs_evm_defconfig
+++ b/configs/am43xx_hs_evm_defconfig
@@ -19,7 +19,6 @@ CONFIG_FIT_IMAGE_POST_PROCESS=y
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_FIT_IMAGE_POST_PROCESS=y
 CONFIG_OF_BOARD_SETUP=y
-CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=1"
 # CONFIG_USE_BOOTCOMMAND is not set
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 # CONFIG_MISC_INIT_R is not set
diff --git a/configs/birdland_bav335a_defconfig 
b/configs/birdland_bav335a_defconfig
index 2eb03ff67cc3..a20798be5443 100644
--- a/configs/birdland_bav335a_defconfig
+++ b/configs/birdland_bav335a_defconfig
@@ -13,7 +13,6 @@ CONFIG_SPL_FS_FAT=y
 CONFIG_SPL_LIBDISK_SUPPORT=y
 CONFIG_BAV_VERSION=1
 CONFIG_DISTRO_DEFAULTS=y
-CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=1"
 # CONFIG_USE_BOOTCOMMAND is not set
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_VERSION_VARIABLE=y
diff --git a/configs/birdland_bav335b_defconfig 
b/configs/birdland_bav335b_defconfig
index 851d6fddafa5..f5d7e3f50a11 100644
--- a/configs/birdland_bav335b_defconfig
+++ b/configs/birdland_bav335b_defconfig
@@ -13,7 +13,6 @@ CONFIG_SPL_FS_FAT=y
 CONFIG_SPL_LIBDISK_SUPPORT=y
 CONFIG_BAV_VERSION=2
 CONFIG_DISTRO_DEFAULTS=y
-CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=1"
 # CONFIG_USE_BOOTCOMMAND is not set
 CONFIG_SYS_CONSOLE_INFO_QUI

[PATCHv2 17/31] Convert CONFIG_BOOTP_DNS2 to Kconfig

2020-06-16 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_BOOTP_DNS2
   CONFIG_BOOTP_PXE_CLIENTARCH

Signed-off-by: Tom Rini 
---
 configs/am335x_baltos_defconfig   | 1 +
 configs/am335x_boneblack_vboot_defconfig  | 1 +
 configs/am335x_evm_defconfig  | 1 +
 configs/am335x_guardian_defconfig | 1 +
 configs/am335x_hs_evm_defconfig   | 1 +
 configs/am335x_hs_evm_uart_defconfig  | 1 +
 configs/am335x_igep003x_defconfig | 1 +
 configs/am335x_shc_defconfig  | 1 +
 configs/am335x_shc_ict_defconfig  | 1 +
 configs/am335x_shc_netboot_defconfig  | 1 +
 configs/am335x_shc_sdboot_defconfig   | 1 +
 configs/am335x_sl50_defconfig | 1 +
 configs/am3517_evm_defconfig  | 1 +
 configs/am43xx_evm_defconfig  | 1 +
 configs/am43xx_evm_qspiboot_defconfig | 1 +
 configs/am43xx_evm_rtconly_defconfig  | 1 +
 configs/am43xx_evm_usbhost_boot_defconfig | 1 +
 configs/am43xx_hs_evm_defconfig   | 1 +
 configs/am57xx_evm_defconfig  | 1 +
 configs/am57xx_hs_evm_defconfig   | 1 +
 configs/am57xx_hs_evm_usb_defconfig   | 1 +
 configs/apf27_defconfig   | 1 +
 configs/birdland_bav335a_defconfig| 1 +
 configs/birdland_bav335b_defconfig| 1 +
 configs/chiliboard_defconfig  | 1 +
 configs/cm_t335_defconfig | 1 +
 configs/da850evm_defconfig| 1 +
 configs/da850evm_direct_nor_defconfig | 1 +
 configs/da850evm_nand_defconfig   | 1 +
 configs/devkit8000_defconfig  | 1 +
 configs/draco_defconfig   | 1 +
 configs/etamin_defconfig  | 1 +
 configs/k2e_evm_defconfig | 1 +
 configs/k2e_hs_evm_defconfig  | 1 +
 configs/k2g_evm_defconfig | 1 +
 configs/k2g_hs_evm_defconfig  | 1 +
 configs/k2hk_evm_defconfig| 1 +
 configs/k2hk_hs_evm_defconfig | 1 +
 configs/k2l_evm_defconfig | 1 +
 configs/k2l_hs_evm_defconfig  | 1 +
 configs/omapl138_lcdk_defconfig   | 1 +
 configs/pengwyn_defconfig | 1 +
 configs/pepper_defconfig  | 1 +
 configs/phycore-am335x-r2-wega_defconfig  | 1 +
 configs/pxm2_defconfig| 1 +
 configs/rastaban_defconfig| 1 +
 configs/rut_defconfig | 1 +
 configs/sandbox64_defconfig   | 1 +
 configs/sandbox_defconfig | 1 +
 configs/sandbox_flattree_defconfig| 1 +
 configs/sandbox_spl_defconfig | 1 +
 configs/thuban_defconfig  | 1 +
 configs/ti814x_evm_defconfig  | 1 +
 configs/ti816x_evm_defconfig  | 1 +
 configs/tools-only_defconfig  | 1 +
 include/configs/am335x_shc.h  | 1 -
 include/configs/am3517_evm.h  | 1 -
 include/configs/am43xx_evm.h  | 1 -
 include/configs/am57xx_evm.h  | 1 -
 include/configs/apf27.h   | 1 -
 include/configs/da850evm.h| 1 -
 include/configs/devkit8000.h  | 1 -
 include/configs/omapl138_lcdk.h   | 1 -
 include/configs/s32v234evb.h  | 5 -
 include/configs/sandbox.h | 1 -
 include/configs/siemens-am33x-common.h| 1 -
 include/configs/tam3517-common.h  | 1 -
 include/configs/ti814x_evm.h  | 1 -
 include/configs/ti816x_evm.h  | 1 -
 include/configs/ti_am335x_common.h| 1 -
 include/configs/ti_armv7_keystone2.h  | 1 -
 71 files changed, 55 insertions(+), 20 deletions(-)

diff --git a/configs/am335x_baltos_defconfig b/configs/am335x_baltos_defconfig
index 2781d49daf5f..76f2a9421b34 100644
--- a/configs/am335x_baltos_defconfig
+++ b/configs/am335x_baltos_defconfig
@@ -34,6 +34,7 @@ CONFIG_CMD_NAND=y
 CONFIG_CMD_SPI=y
 CONFIG_CMD_USB=y
 # CONFIG_CMD_SETEXPR is not set
+CONFIG_BOOTP_DNS2=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_MTDPARTS=y
 CONFIG_MTDIDS_DEFAULT="nand0=omap2-nand.0"
diff --git a/configs/am335x_boneblack_vboot_defconfig 
b/configs/am335x_boneblack_vboot_defconfig
index 64c1c537f933..b161b3bbc3cf 100644
--- a/configs/am335x_boneblack_vboot_defconfig
+++ b/configs/am335x_boneblack_vboot_defconfig
@@ -29,6 +29,7 @@ CONFIG_AUTOBOOT_STOP_STR=" "
 CONFIG_CMD_SPL=y
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_SETEXPR is not set
+CONFIG_BOOTP_DNS2=y
 CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="am335x-boneblack"
 CONFIG_ENV_IS_IN_MMC=y
diff --git a/configs/am335x_evm_defconfig b/configs/am335x_evm_defconfig
index 8d8276ba5612..b8333eb4b8bc 100644
--- a/configs/am335x_evm_defconfig
+++ b/configs/am335x_evm_defconfig
@@ -27,6 +27,7 @@ CONFIG_CMD_SPL_NAND_OFS=0x0008
 # CONFIG_CMD_FLASH is not set
 CONFIG_CMD_NAND=y
 # CONFIG_CMD_SETEXPR is not set
+CONFIG_BOOTP_DNS2=y
 CONFIG_CMD_MTDPARTS=y
 CONFIG_MTDIDS_DEFAULT="nand0=nand.0"
 
CONFIG_MTDPARTS_DEFAULT="mtdparts=nand.0:128k(NAND

[PATCHv2 16/31] arm: abb secu1: Convert CONFIG_BOOTDELAY to Kconfig

2020-06-16 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_BOOTDELAY

Cc: Holger Brunck 
Signed-off-by: Tom Rini 
---
 include/configs/socfpga_arria5_secu1.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/configs/socfpga_arria5_secu1.h 
b/include/configs/socfpga_arria5_secu1.h
index 77914438bfa0..eb17470ae6bc 100644
--- a/include/configs/socfpga_arria5_secu1.h
+++ b/include/configs/socfpga_arria5_secu1.h
@@ -28,7 +28,6 @@
 #define CONFIG_SYS_I2C_RTC_ADDR 0x68
 
 /* Booting Linux */
-#define CONFIG_BOOTDELAY   2
 #define CONFIG_BOOTFILE"zImage"
 
 #define CONFIG_BOOTCOMMAND \
-- 
2.17.1



[PATCHv2 18/31] Convert CONFIG_BOUNCE_BUFFER to Kconfig

2020-06-16 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_BOUNCE_BUFFER

Signed-off-by: Tom Rini 
---
 include/configs/px30_common.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/include/configs/px30_common.h b/include/configs/px30_common.h
index d6c70601dd01..76d6ab1c8b4e 100644
--- a/include/configs/px30_common.h
+++ b/include/configs/px30_common.h
@@ -32,9 +32,6 @@
 
 #define CONFIG_SYS_BOOTM_LEN   (64 << 20)  /* 64M */
 
-/* MMC/SD IP block */
-//#define CONFIG_BOUNCE_BUFFER
-
 #define CONFIG_SYS_SDRAM_BASE  0
 #define SDRAM_MAX_SIZE 0xff00
 #define SDRAM_BANK_SIZE(2UL << 30)
-- 
2.17.1



[PATCHv2 12/31] Convert CONFIG_BOOTARGS to Kconfig

2020-06-16 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_BOOTARGS

Signed-off-by: Tom Rini 
---
 configs/grpeach_defconfig  | 2 ++
 configs/imx28_xea_defconfig| 2 ++
 configs/sama5d2_icp_mmc_defconfig  | 1 +
 configs/socfpga_agilex_defconfig   | 2 ++
 configs/socfpga_secu1_defconfig| 2 ++
 configs/socfpga_stratix10_defconfig| 2 ++
 configs/stmark2_defconfig  | 2 ++
 configs/wb45n_defconfig| 2 ++
 configs/wb50n_defconfig| 2 ++
 include/configs/grpeach.h  | 3 ---
 include/configs/sama5d27_som1_ek.h | 6 --
 include/configs/sama5d2_icp.h  | 3 ---
 include/configs/socfpga_arria5_secu1.h | 4 
 include/configs/socfpga_soc64_common.h | 1 -
 include/configs/stmark2.h  | 6 --
 include/configs/wb45n.h| 4 
 include/configs/wb50n.h| 3 ---
 include/configs/xea.h  | 1 -
 18 files changed, 17 insertions(+), 31 deletions(-)

diff --git a/configs/grpeach_defconfig b/configs/grpeach_defconfig
index 417938a512ed..c4a2b449d676 100644
--- a/configs/grpeach_defconfig
+++ b/configs/grpeach_defconfig
@@ -9,6 +9,8 @@ CONFIG_DM_GPIO=y
 CONFIG_RZA1=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_BOOTDELAY=3
+CONFIG_USE_BOOTARGS=y
+CONFIG_BOOTARGS="ignore_loglevel"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_HUSH_PARSER=y
 # CONFIG_CMD_ELF is not set
diff --git a/configs/imx28_xea_defconfig b/configs/imx28_xea_defconfig
index d4feb661629f..592f3e387cc0 100644
--- a/configs/imx28_xea_defconfig
+++ b/configs/imx28_xea_defconfig
@@ -22,6 +22,8 @@ CONFIG_SPL_TEXT_BASE=0x1000
 CONFIG_SPL_PAYLOAD="u-boot.img"
 CONFIG_FIT=y
 CONFIG_OF_BOARD_SETUP=y
+CONFIG_USE_BOOTARGS=y
+CONFIG_BOOTARGS="console=ttyAMA0,115200n8"
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
diff --git a/configs/sama5d2_icp_mmc_defconfig 
b/configs/sama5d2_icp_mmc_defconfig
index dc4e815ec127..8f3efd81a032 100644
--- a/configs/sama5d2_icp_mmc_defconfig
+++ b/configs/sama5d2_icp_mmc_defconfig
@@ -25,6 +25,7 @@ CONFIG_SYS_EXTRA_OPTIONS="SAMA5D2"
 CONFIG_SD_BOOT=y
 CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTARGS=y
+CONFIG_BOOTARGS="console=ttyS0,115200 earlyprintk root=/dev/mmcblk0p2 rw 
rootwait"
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_SPL_SEPARATE_BSS=y
 CONFIG_SPL_DISPLAY_PRINT=y
diff --git a/configs/socfpga_agilex_defconfig b/configs/socfpga_agilex_defconfig
index 35316d7c252f..60397a8ccea6 100644
--- a/configs/socfpga_agilex_defconfig
+++ b/configs/socfpga_agilex_defconfig
@@ -12,6 +12,8 @@ CONFIG_IDENT_STRING="socfpga_agilex"
 CONFIG_SPL_FS_FAT=y
 CONFIG_SPL_TEXT_BASE=0xFFE0
 CONFIG_BOOTDELAY=5
+CONFIG_USE_BOOTARGS=y
+CONFIG_BOOTARGS="earlycon"
 CONFIG_SPL_CACHE=y
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_HUSH_PARSER=y
diff --git a/configs/socfpga_secu1_defconfig b/configs/socfpga_secu1_defconfig
index df30c7c5f0e2..8ebbf73148a4 100644
--- a/configs/socfpga_secu1_defconfig
+++ b/configs/socfpga_secu1_defconfig
@@ -14,6 +14,8 @@ CONFIG_SPL_TEXT_BASE=0x
 CONFIG_BUILD_TARGET="u-boot-with-nand-spl.sfp"
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_FIT=y
+CONFIG_USE_BOOTARGS=y
+CONFIG_BOOTARGS="console=ttyS0,115200 ubi.fm_autoconvert=1 
uio_pdrv_genirq.of_id=\"idq,regbank\""
 # CONFIG_USE_BOOTCOMMAND is not set
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
diff --git a/configs/socfpga_stratix10_defconfig 
b/configs/socfpga_stratix10_defconfig
index 21014f9f8cde..16ae0feb6807 100644
--- a/configs/socfpga_stratix10_defconfig
+++ b/configs/socfpga_stratix10_defconfig
@@ -12,6 +12,8 @@ CONFIG_IDENT_STRING="socfpga_stratix10"
 CONFIG_SPL_FS_FAT=y
 CONFIG_SPL_TEXT_BASE=0xFFE0
 CONFIG_BOOTDELAY=5
+CONFIG_USE_BOOTARGS=y
+CONFIG_BOOTARGS="earlycon"
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PROMPT="SOCFPGA_STRATIX10 # "
diff --git a/configs/stmark2_defconfig b/configs/stmark2_defconfig
index 036ff707d19a..262f169d6cca 100644
--- a/configs/stmark2_defconfig
+++ b/configs/stmark2_defconfig
@@ -5,6 +5,8 @@ CONFIG_ENV_OFFSET=0x4
 CONFIG_ENV_SECT_SIZE=0x1
 CONFIG_TARGET_STMARK2=y
 CONFIG_SYS_EXTRA_OPTIONS="CF_SBF,SYS_SERIAL_BOOT,SYS_INPUT_CLKSRC=3000"
+CONFIG_USE_BOOTARGS=y
+CONFIG_BOOTARGS="console=ttyS0,115200 root=/dev/ram0 rw rootfstype=ramfs 
rdinit=/bin/init devtmpfs.mount=1"
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_HUSH_PARSER=y
 # CONFIG_CMDLINE_EDITING is not set
diff --git a/configs/wb45n_defconfig b/configs/wb45n_defconfig
index ef069a672cc2..0a0120fe5edf 100644
--- a/configs/wb45n_defconfig
+++ b/configs/wb45n_defconfig
@@ -15,6 +15,8 @@ CONFIG_SPL_TEXT_BASE=0x30
 CONFIG_FIT=y
 CONFIG_SYS_EXTRA_OPTIONS="AT91SAM9X5,SYS_USE_NANDFLASH"
 CONFIG_BOOTDELAY=3
+CONFIG_USE_BOOTARGS=y
+CONFIG_BOOTARGS="console=ttyS0,115200 earlyprintk rw noinitrd mem=64M 
rootfstype=ubifs root=ubi0:rootfs ubi.mtd=6"
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SPL_NAND_SUPPORT=y
 CONFIG_HUSH_PARSER=y
diff --git a/configs/wb50n_defconfig b/confi

[PATCHv2 15/31] arm: capricorn: Convert CONFIG_BOOTCOUNT_ENV et al to Kconfig

2020-06-16 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_BOOTCOUNT_ENV
   CONFIG_BOOTCOUNT_LIMIT

Cc: Anatolij Gustschin 
Signed-off-by: Tom Rini 
---
 configs/deneb_defconfig| 2 ++
 configs/giedi_defconfig| 2 ++
 include/configs/capricorn-common.h | 3 ---
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/configs/deneb_defconfig b/configs/deneb_defconfig
index 31a68f824025..5377b4fed513 100644
--- a/configs/deneb_defconfig
+++ b/configs/deneb_defconfig
@@ -62,6 +62,8 @@ CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_SPL_DM=y
+CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_ENV=y
 CONFIG_SPL_CLK=y
 CONFIG_CLK_IMX8=y
 CONFIG_CPU=y
diff --git a/configs/giedi_defconfig b/configs/giedi_defconfig
index 5dd34227af01..dfac924bbb08 100644
--- a/configs/giedi_defconfig
+++ b/configs/giedi_defconfig
@@ -62,6 +62,8 @@ CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_SPL_DM=y
+CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_ENV=y
 CONFIG_SPL_CLK=y
 CONFIG_CLK_IMX8=y
 CONFIG_CPU=y
diff --git a/include/configs/capricorn-common.h 
b/include/configs/capricorn-common.h
index c2e9d0f11f9c..b107e0ce3f96 100644
--- a/include/configs/capricorn-common.h
+++ b/include/configs/capricorn-common.h
@@ -138,9 +138,6 @@
 #define CONFIG_SYS_LOAD_ADDR   CONFIG_LOADADDR
 #define CONFIG_SYS_INIT_SP_ADDR0x8020
 
-#define CONFIG_BOOTCOUNT_LIMIT
-#define CONFIG_BOOTCOUNT_ENV
-
 /* Environment organisation */
 #define CONFIG_ENV_OVERWRITE
 #define CONFIG_SYS_MMC_ENV_DEV 0   /* USDHC1, eMMC */
-- 
2.17.1



[PATCHv2 10/31] Convert CONFIG_BAUDRATE to Kconfig

2020-06-16 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_BAUDRATE

Signed-off-by: Tom Rini 
---
 README| 5 -
 include/configs/apalis-imx8.h | 3 ---
 include/configs/bcm_northstar2.h  | 1 -
 include/configs/bcmstb.h  | 1 -
 include/configs/colibri-imx8x.h   | 3 ---
 include/configs/controlcenterdc.h | 2 --
 include/configs/dh_imx6.h | 1 -
 include/configs/display5.h| 1 -
 include/configs/grpeach.h | 3 ---
 include/configs/imx8mq_evk.h  | 2 --
 include/configs/imx8qm_mek.h  | 3 ---
 include/configs/imx8qm_rom7720.h  | 3 ---
 include/configs/imx8qxp_mek.h | 3 ---
 include/configs/ls1021atsn.h  | 2 --
 include/configs/ls1028a_common.h  | 1 -
 include/configs/ls1088a_common.h  | 1 -
 include/configs/lx2160a_common.h  | 1 -
 include/configs/mx53ppd.h | 1 -
 include/configs/mx6memcal.h   | 1 -
 include/configs/mx7ulp_evk.h  | 1 -
 include/configs/owl-common.h  | 3 ---
 include/configs/pdu001.h  | 1 -
 include/configs/pico-imx8mq.h | 2 --
 include/configs/presidio_asic.h   | 1 -
 include/configs/rk3128_common.h   | 1 -
 include/configs/rk3368_common.h   | 1 -
 include/configs/wb50n.h   | 2 --
 27 files changed, 50 deletions(-)

diff --git a/README b/README
index bcf198363111..a0f54645fc26 100644
--- a/README
+++ b/README
@@ -670,11 +670,6 @@ The following options need to be configured:
Define this variable to enable hw flow control in serial driver.
Current user of this option is drivers/serial/nsl16550.c driver
 
-- Console Baudrate:
-   CONFIG_BAUDRATE - in bps
-   Select one of the baudrates listed in
-   CONFIG_SYS_BAUDRATE_TABLE, see below.
-
 - Autoboot Command:
CONFIG_BOOTCOMMAND
Only needed when CONFIG_BOOTDELAY is enabled;
diff --git a/include/configs/apalis-imx8.h b/include/configs/apalis-imx8.h
index 08d34db1061e..6dad8216e969 100644
--- a/include/configs/apalis-imx8.h
+++ b/include/configs/apalis-imx8.h
@@ -103,9 +103,6 @@
 #define PHYS_SDRAM_1_SIZE  SZ_2G   /* 2 GB */
 #define PHYS_SDRAM_2_SIZE  SZ_2G   /* 2 GB */
 
-/* Serial */
-#define CONFIG_BAUDRATE115200
-
 /* Monitor Command Prompt */
 #define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
 #define CONFIG_SYS_CBSIZE  SZ_2K
diff --git a/include/configs/bcm_northstar2.h b/include/configs/bcm_northstar2.h
index 45dc7b29c9e4..fbfab288b372 100644
--- a/include/configs/bcm_northstar2.h
+++ b/include/configs/bcm_northstar2.h
@@ -31,7 +31,6 @@
 #define CONFIG_SYS_NS16550_COM20x6611
 #define CONFIG_SYS_NS16550_COM30x6612
 #define CONFIG_SYS_NS16550_COM40x6613
-#define CONFIG_BAUDRATE115200
 
 /* console configuration */
 #define CONFIG_SYS_CBSIZE  SZ_1K
diff --git a/include/configs/bcmstb.h b/include/configs/bcmstb.h
index 24569f7d94a8..01cfed0b869d 100644
--- a/include/configs/bcmstb.h
+++ b/include/configs/bcmstb.h
@@ -115,7 +115,6 @@ extern phys_addr_t prior_stage_fdt_address;
 /*
  * Serial console configuration.
  */
-#define CONFIG_BAUDRATE115200
 #define CONFIG_SYS_BAUDRATE_TABLE  {4800, 9600, 19200, 38400, 57600, \
 115200}
 
diff --git a/include/configs/colibri-imx8x.h b/include/configs/colibri-imx8x.h
index da9226e2fbed..0ac4e7095de9 100644
--- a/include/configs/colibri-imx8x.h
+++ b/include/configs/colibri-imx8x.h
@@ -135,9 +135,6 @@
 #define PHYS_SDRAM_1_SIZE  SZ_2G   /* 2 GB */
 #define PHYS_SDRAM_2_SIZE  0x  /* 0 GB */
 
-/* Serial */
-#define CONFIG_BAUDRATE115200
-
 /* Monitor Command Prompt */
 #define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
 #define CONFIG_SYS_CBSIZE  SZ_2K
diff --git a/include/configs/controlcenterdc.h 
b/include/configs/controlcenterdc.h
index 00e5c8f7943e..0c36ea661057 100644
--- a/include/configs/controlcenterdc.h
+++ b/include/configs/controlcenterdc.h
@@ -112,8 +112,6 @@
  */
 #define CONFIG_ENV_OVERWRITE
 
-#define CONFIG_BAUDRATE 115200
-
 #define CONFIG_HOSTNAME"ccdc"
 #define CONFIG_ROOTPATH"/opt/nfsroot"
 #define CONFIG_BOOTFILE"ccdc.img"
diff --git a/include/configs/dh_imx6.h b/include/configs/dh_imx6.h
index 5bfdf4044bee..0b6617fa82e9 100644
--- a/include/configs/dh_imx6.h
+++ b/include/configs/dh_imx6.h
@@ -62,7 +62,6 @@
 /* UART */
 #define CONFIG_MXC_UART
 #define CONFIG_MXC_UART_BASE   UART1_BASE
-#define CONFIG_BAUDRATE115200
 
 /* USB Configs */
 #ifdef CONFIG_CMD_USB
diff --git a/include/configs/display5.h b/include/configs/display5.h
index 3348ecc7c7ba..94baa6561022 100644
--- a/include/configs/display5.h
+++ b/include/configs/display5.h
@@ -66,7 +66,6 @@
 
 /* allow t

[PATCHv2 11/31] Convert CONFIG_BOARD_EARLY_INIT_F et al to Kconfig

2020-06-16 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_BOARD_EARLY_INIT_F
   CONFIG_BOARD_EARLY_INIT_R

Signed-off-by: Tom Rini 
---
 configs/avnet_ultrazedev_cc_v1_0_ultrazedev_som_v1_0_defconfig | 1 +
 configs/deneb_defconfig| 1 +
 configs/giedi_defconfig| 1 +
 configs/imx8mq_evk_defconfig   | 1 +
 configs/imx8mq_phanbell_defconfig  | 1 +
 configs/imx8qm_mek_defconfig   | 1 +
 configs/imx8qxp_mek_defconfig  | 1 +
 configs/mscc_jr2_defconfig | 1 +
 configs/mscc_luton_defconfig   | 1 +
 configs/mscc_ocelot_defconfig  | 1 +
 configs/mscc_serval_defconfig  | 1 +
 configs/mscc_servalt_defconfig | 1 +
 configs/mx7ulp_evk_defconfig   | 1 +
 configs/mx7ulp_evk_plugin_defconfig| 1 +
 configs/pico-imx8mq_defconfig  | 1 +
 configs/xilinx_zynqmp_mini_defconfig   | 1 +
 configs/xilinx_zynqmp_mini_emmc0_defconfig | 1 +
 configs/xilinx_zynqmp_mini_emmc1_defconfig | 1 +
 configs/xilinx_zynqmp_mini_nand_defconfig  | 1 +
 configs/xilinx_zynqmp_mini_nand_single_defconfig   | 1 +
 configs/xilinx_zynqmp_mini_qspi_defconfig  | 1 +
 configs/xilinx_zynqmp_virt_defconfig   | 1 +
 include/configs/capricorn-common.h | 2 --
 include/configs/imx8mq_evk.h   | 2 --
 include/configs/imx8mq_phanbell.h  | 2 --
 include/configs/imx8qm_mek.h   | 2 --
 include/configs/imx8qxp_mek.h  | 2 --
 include/configs/lx2160a_common.h   | 1 -
 include/configs/mx7ulp_evk.h   | 2 --
 include/configs/pico-imx8mq.h  | 2 --
 include/configs/vcoreiii.h | 1 -
 include/configs/xilinx_zynqmp.h| 2 --
 32 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/configs/avnet_ultrazedev_cc_v1_0_ultrazedev_som_v1_0_defconfig 
b/configs/avnet_ultrazedev_cc_v1_0_ultrazedev_som_v1_0_defconfig
index 030d28a5dfc7..227a5416c63f 100644
--- a/configs/avnet_ultrazedev_cc_v1_0_ultrazedev_som_v1_0_defconfig
+++ b/configs/avnet_ultrazedev_cc_v1_0_ultrazedev_som_v1_0_defconfig
@@ -15,6 +15,7 @@ CONFIG_FIT_VERBOSE=y
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_BOOTDELAY=0
 # CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SPL_OS_BOOT=y
 CONFIG_CMD_MEMTEST=y
 CONFIG_SYS_MEMTEST_START=0x
diff --git a/configs/deneb_defconfig b/configs/deneb_defconfig
index 9682cb7ca1a2..31a68f824025 100644
--- a/configs/deneb_defconfig
+++ b/configs/deneb_defconfig
@@ -23,6 +23,7 @@ CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/siemens/capricorn/imximage.cfg"
 CONFIG_BOOTDELAY=3
 CONFIG_LOG=y
+CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_SEPARATE_BSS=y
diff --git a/configs/giedi_defconfig b/configs/giedi_defconfig
index 4e22a02aacd5..5dd34227af01 100644
--- a/configs/giedi_defconfig
+++ b/configs/giedi_defconfig
@@ -23,6 +23,7 @@ CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/siemens/capricorn/imximage.cfg"
 CONFIG_BOOTDELAY=3
 CONFIG_LOG=y
+CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_SEPARATE_BSS=y
diff --git a/configs/imx8mq_evk_defconfig b/configs/imx8mq_evk_defconfig
index 871f784b49b0..caa56e38c525 100644
--- a/configs/imx8mq_evk_defconfig
+++ b/configs/imx8mq_evk_defconfig
@@ -15,6 +15,7 @@ CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_FIT_GENERATOR="arch/arm/mach-imx/mkimage_fit_atf.sh"
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/imx8m/imximage.cfg"
 CONFIG_BOARD_LATE_INIT=y
+CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_HUSH_PARSER=y
 # CONFIG_BOOTM_NETBSD is not set
diff --git a/configs/imx8mq_phanbell_defconfig 
b/configs/imx8mq_phanbell_defconfig
index 5364b58b7bff..65d952503f74 100644
--- a/configs/imx8mq_phanbell_defconfig
+++ b/configs/imx8mq_phanbell_defconfig
@@ -16,6 +16,7 @@ CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_FIT_GENERATOR="arch/arm/mach-imx/mkimage_fit_atf.sh"
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/imx8m/imximage.cfg"
 CONFIG_SD_BOOT=y
+CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_HUSH_PARSER=y
 # CONFIG_BOOTM_NETBSD is not set
diff --git a/configs/imx8qm_mek_defconfig b/configs/imx8qm_mek_defconfig
index dc490bcf573a..5f68f9cac258 100644
--- a/configs/imx8qm_mek_defconfig
+

[PATCHv2 13/31] Convert CONFIG_BCH to Kconfig

2020-06-16 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_BCH

Signed-off-by: Tom Rini 
---
 configs/ge_bx50v3_defconfig | 1 +
 configs/mx53ppd_defconfig   | 1 +
 include/configs/ge_bx50v3.h | 2 --
 include/configs/mx53ppd.h   | 2 --
 4 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/configs/ge_bx50v3_defconfig b/configs/ge_bx50v3_defconfig
index 58778e670c99..d61c23804656 100644
--- a/configs/ge_bx50v3_defconfig
+++ b/configs/ge_bx50v3_defconfig
@@ -99,4 +99,5 @@ CONFIG_SYS_WHITE_ON_BLACK=y
 CONFIG_VIDEO_IPUV3=y
 CONFIG_WATCHDOG_TIMEOUT_MSECS=6000
 CONFIG_IMX_WATCHDOG=y
+CONFIG_BCH=y
 # CONFIG_EFI_LOADER is not set
diff --git a/configs/mx53ppd_defconfig b/configs/mx53ppd_defconfig
index 1dca2455c819..4b561adc7d31 100644
--- a/configs/mx53ppd_defconfig
+++ b/configs/mx53ppd_defconfig
@@ -77,3 +77,4 @@ CONFIG_SYS_WHITE_ON_BLACK=y
 CONFIG_VIDEO_IPUV3=y
 CONFIG_WATCHDOG_TIMEOUT_MSECS=8000
 CONFIG_IMX_WATCHDOG=y
+CONFIG_BCH=y
diff --git a/include/configs/ge_bx50v3.h b/include/configs/ge_bx50v3.h
index 47c5974b2ed8..a959488cb9bd 100644
--- a/include/configs/ge_bx50v3.h
+++ b/include/configs/ge_bx50v3.h
@@ -176,6 +176,4 @@
 #define CONFIG_PCIE_IMX_PERST_GPIO IMX_GPIO_NR(7, 12)
 #define CONFIG_PCIE_IMX_POWER_GPIO IMX_GPIO_NR(1, 5)
 
-#define CONFIG_BCH
-
 #endif /* __GE_BX50V3_CONFIG_H */
diff --git a/include/configs/mx53ppd.h b/include/configs/mx53ppd.h
index 2ee66612c21b..8c7d1395d087 100644
--- a/include/configs/mx53ppd.h
+++ b/include/configs/mx53ppd.h
@@ -144,8 +144,6 @@
 
 #define CONFIG_FSL_IIM
 
-#define CONFIG_BCH
-
 /* Backlight Control */
 #define CONFIG_IMX6_PWM_PER_CLK 6000
 
-- 
2.17.1



[PATCHv2 14/31] Convert CONFIG_BOARD_TYPES to Kconfig

2020-06-16 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_BOARD_TYPES

Signed-off-by: Tom Rini 
---
 configs/brsmarc1_defconfig | 1 +
 configs/mscc_jr2_defconfig | 1 +
 configs/mscc_luton_defconfig   | 1 +
 configs/mscc_ocelot_defconfig  | 1 +
 configs/mscc_serval_defconfig  | 1 +
 configs/mscc_servalt_defconfig | 1 +
 include/configs/brsmarc1.h | 1 -
 include/configs/vcoreiii.h | 2 --
 8 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/configs/brsmarc1_defconfig b/configs/brsmarc1_defconfig
index a7cf98fc746c..8333038c61b7 100644
--- a/configs/brsmarc1_defconfig
+++ b/configs/brsmarc1_defconfig
@@ -30,6 +30,7 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_CPUINFO is not set
 # CONFIG_DISPLAY_BOARDINFO is not set
+CONFIG_BOARD_TYPES=y
 CONFIG_ARCH_MISC_INIT=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
diff --git a/configs/mscc_jr2_defconfig b/configs/mscc_jr2_defconfig
index ab4f9b6255ba..d9173f408666 100644
--- a/configs/mscc_jr2_defconfig
+++ b/configs/mscc_jr2_defconfig
@@ -19,6 +19,7 @@ CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyS0,115200"
 CONFIG_LOGLEVEL=7
 CONFIG_DISPLAY_CPUINFO=y
+CONFIG_BOARD_TYPES=y
 CONFIG_BOARD_EARLY_INIT_R=y
 CONFIG_SYS_PROMPT="jr2 # "
 # CONFIG_CMD_BDI is not set
diff --git a/configs/mscc_luton_defconfig b/configs/mscc_luton_defconfig
index 55edb13b..d5639016958d 100644
--- a/configs/mscc_luton_defconfig
+++ b/configs/mscc_luton_defconfig
@@ -21,6 +21,7 @@ CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyS0,115200"
 CONFIG_LOGLEVEL=7
 CONFIG_DISPLAY_CPUINFO=y
+CONFIG_BOARD_TYPES=y
 CONFIG_BOARD_EARLY_INIT_R=y
 CONFIG_SYS_PROMPT="luton # "
 # CONFIG_CMD_BDI is not set
diff --git a/configs/mscc_ocelot_defconfig b/configs/mscc_ocelot_defconfig
index 3fe9e060bb56..a0e04bd4c749 100644
--- a/configs/mscc_ocelot_defconfig
+++ b/configs/mscc_ocelot_defconfig
@@ -18,6 +18,7 @@ CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyS0,115200"
 CONFIG_LOGLEVEL=7
 CONFIG_DISPLAY_CPUINFO=y
+CONFIG_BOARD_TYPES=y
 CONFIG_BOARD_EARLY_INIT_R=y
 CONFIG_SYS_PROMPT="ocelot # "
 # CONFIG_CMD_BDI is not set
diff --git a/configs/mscc_serval_defconfig b/configs/mscc_serval_defconfig
index e423fc4efc52..1c86c0dca39b 100644
--- a/configs/mscc_serval_defconfig
+++ b/configs/mscc_serval_defconfig
@@ -16,6 +16,7 @@ CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyS0,115200"
 CONFIG_LOGLEVEL=7
 CONFIG_DISPLAY_CPUINFO=y
+CONFIG_BOARD_TYPES=y
 CONFIG_BOARD_EARLY_INIT_R=y
 CONFIG_SYS_PROMPT="serval # "
 # CONFIG_CMD_BDI is not set
diff --git a/configs/mscc_servalt_defconfig b/configs/mscc_servalt_defconfig
index 49d8468226fc..91347682eef3 100644
--- a/configs/mscc_servalt_defconfig
+++ b/configs/mscc_servalt_defconfig
@@ -15,6 +15,7 @@ CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyS0,115200"
 CONFIG_LOGLEVEL=7
 CONFIG_DISPLAY_CPUINFO=y
+CONFIG_BOARD_TYPES=y
 CONFIG_BOARD_EARLY_INIT_R=y
 CONFIG_SYS_PROMPT="servalt # "
 # CONFIG_CMD_BDI is not set
diff --git a/include/configs/brsmarc1.h b/include/configs/brsmarc1.h
index 5aa68d1d4695..acf13b830a2e 100644
--- a/include/configs/brsmarc1.h
+++ b/include/configs/brsmarc1.h
@@ -16,7 +16,6 @@
 #include 
 #include 
 /* - */
-#define CONFIG_BOARD_TYPES
 
 /* memory */
 #define CONFIG_SYS_MALLOC_LEN  (5 * 1024 * 1024)
diff --git a/include/configs/vcoreiii.h b/include/configs/vcoreiii.h
index 020f02caae9c..460433cb00bf 100644
--- a/include/configs/vcoreiii.h
+++ b/include/configs/vcoreiii.h
@@ -23,8 +23,6 @@
 #endif
 #define CONFIG_SYS_NS16550_CLK CONFIG_SYS_MIPS_TIMER_FREQ
 
-#define CONFIG_BOARD_TYPES
-
 #define CONFIG_SYS_SDRAM_BASE  0x8000
 #if defined(CONFIG_DDRTYPE_H5TQ1G63BFA) || defined(CONFIG_DDRTYPE_MT47H128M8HQ)
 #define CONFIG_SYS_SDRAM_SIZE  (128 * SZ_1M)
-- 
2.17.1



[PATCHv2 09/31] bk4r1: Re-convert CONFIG_AUTOBOOT_PROMPT et al to Kconfig

2020-06-16 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_AUTOBOOT_PROMPT
   CONFIG_AUTOBOOT_KEYED
   CONFIG_AUTOBOOT_STOP_STR

Signed-off-by: Tom Rini 
---
 configs/bk4r1_defconfig | 3 +++
 include/configs/bk4r1.h | 6 --
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/configs/bk4r1_defconfig b/configs/bk4r1_defconfig
index 8c2bda6984ae..bcad243dd2bd 100644
--- a/configs/bk4r1_defconfig
+++ b/configs/bk4r1_defconfig
@@ -18,6 +18,9 @@ CONFIG_BOOTDELAY=3
 CONFIG_USE_PREBOOT=y
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_HUSH_PARSER=y
+CONFIG_AUTOBOOT_KEYED=y
+CONFIG_AUTOBOOT_PROMPT="Enter passphrase to stop autoboot, booting in %d 
seconds\n"
+CONFIG_AUTOBOOT_STOP_STR="123"
 # CONFIG_CMD_ELF is not set
 CONFIG_CMD_MEMTEST=y
 CONFIG_SYS_MEMTEST_START=0x8001
diff --git a/include/configs/bk4r1.h b/include/configs/bk4r1.h
index f88172a05c55..300b9c7b7afb 100644
--- a/include/configs/bk4r1.h
+++ b/include/configs/bk4r1.h
@@ -57,12 +57,6 @@
"saveenv; " \
"fi; "
 
-/* Autoboot options */
-#define CONFIG_AUTOBOOT_KEYED
-#define CONFIG_AUTOBOOT_PROMPT \
-   "Enter passphrase to stop autoboot, booting in %d seconds\n"
-#define CONFIG_AUTOBOOT_STOP_STR "123"
-
 #include 
 #include 
 
-- 
2.17.1



[PATCHv2 07/31] Convert CONFIG_ATMEL_NAND_HW_PMECC et al to Kconfig

2020-06-16 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_ATMEL_NAND_HW_PMECC
   CONFIG_ATMEL_NAND_HWECC
   CONFIG_NAND_ATMEL
   CONFIG_PMECC_CAP
   CONFIG_PMECC_SECTOR_SIZE

Signed-off-by: Tom Rini 
---
 configs/sam9x60ek_nandflash_defconfig | 4 
 configs/sam9x60ek_qspiflash_defconfig | 4 
 include/configs/sam9x60ek.h   | 7 ---
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/configs/sam9x60ek_nandflash_defconfig 
b/configs/sam9x60ek_nandflash_defconfig
index b59e4be4be80..d09f78828fa8 100644
--- a/configs/sam9x60ek_nandflash_defconfig
+++ b/configs/sam9x60ek_nandflash_defconfig
@@ -50,6 +50,10 @@ CONFIG_MICROCHIP_FLEXCOM=y
 CONFIG_DM_MMC=y
 CONFIG_GENERIC_ATMEL_MCI=y
 CONFIG_MTD=y
+# CONFIG_SYS_NAND_USE_FLASH_BBT is not set
+CONFIG_NAND_ATMEL=y
+CONFIG_ATMEL_NAND_HW_PMECC=y
+CONFIG_PMECC_CAP=8
 CONFIG_PHY_MICREL=y
 CONFIG_DM_ETH=y
 CONFIG_MACB=y
diff --git a/configs/sam9x60ek_qspiflash_defconfig 
b/configs/sam9x60ek_qspiflash_defconfig
index 37de4044e9dc..6c4f534974e8 100644
--- a/configs/sam9x60ek_qspiflash_defconfig
+++ b/configs/sam9x60ek_qspiflash_defconfig
@@ -60,6 +60,10 @@ CONFIG_GENERIC_ATMEL_MCI=y
 CONFIG_MTD=y
 CONFIG_DM_MTD=y
 CONFIG_MTD_RAW_NAND=y
+# CONFIG_SYS_NAND_USE_FLASH_BBT is not set
+CONFIG_NAND_ATMEL=y
+CONFIG_ATMEL_NAND_HW_PMECC=y
+CONFIG_PMECC_CAP=8
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH_MACRONIX=y
 CONFIG_SPI_FLASH_SPANSION=y
diff --git a/include/configs/sam9x60ek.h b/include/configs/sam9x60ek.h
index 9b439a644161..19714402ca45 100644
--- a/include/configs/sam9x60ek.h
+++ b/include/configs/sam9x60ek.h
@@ -44,7 +44,6 @@
 
 /* NAND flash */
 #ifdef CONFIG_CMD_NAND
-#define CONFIG_NAND_ATMEL
 #define CONFIG_SYS_MAX_NAND_DEVICE 1
 #define CONFIG_SYS_NAND_BASE   0x4000
 #define CONFIG_SYS_NAND_MASK_ALE   BIT(21)
@@ -54,12 +53,6 @@
 #define CONFIG_SYS_NAND_ONFI_DETECTION
 #endif
 
-/* PMECC & PMERRLOC */
-#define CONFIG_ATMEL_NAND_HWECC
-#define CONFIG_ATMEL_NAND_HW_PMECC
-#define CONFIG_PMECC_CAP   8
-#define CONFIG_PMECC_SECTOR_SIZE   512
-
 #define CONFIG_SYS_LOAD_ADDR   0x2200  /* load address */
 
 #ifdef CONFIG_SD_BOOT
-- 
2.17.1



[PATCHv2 05/31] Convert CONFIG_AT91_GPIO to Kconfig

2020-06-16 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_AT91_GPIO

Signed-off-by: Tom Rini 
---
 arch/arm/mach-at91/include/mach/at91rm9200.h | 2 --
 configs/at91rm9200ek_defconfig   | 1 +
 configs/at91rm9200ek_ram_defconfig   | 1 +
 configs/axm_defconfig| 1 +
 configs/corvus_defconfig | 1 +
 configs/gurnard_defconfig| 1 +
 configs/picosam9g45_defconfig| 1 +
 configs/smartweb_defconfig   | 1 +
 configs/snapper9260_defconfig| 1 +
 configs/snapper9g20_defconfig| 1 +
 configs/taurus_defconfig | 1 +
 configs/vinco_defconfig  | 1 +
 configs/wb45n_defconfig  | 1 +
 configs/wb50n_defconfig  | 1 +
 drivers/gpio/Kconfig | 1 -
 include/configs/at91-sama5_common.h  | 5 -
 include/configs/corvus.h | 1 -
 include/configs/picosam9g45.h| 1 -
 include/configs/smartweb.h   | 1 -
 include/configs/snapper9260.h| 1 -
 include/configs/snapper9g45.h| 1 -
 include/configs/taurus.h | 1 -
 include/configs/wb45n.h  | 1 -
 include/configs/wb50n.h  | 3 ---
 24 files changed, 13 insertions(+), 18 deletions(-)

diff --git a/arch/arm/mach-at91/include/mach/at91rm9200.h 
b/arch/arm/mach-at91/include/mach/at91rm9200.h
index 3412df0f06c7..309039347c84 100644
--- a/arch/arm/mach-at91/include/mach/at91rm9200.h
+++ b/arch/arm/mach-at91/include/mach/at91rm9200.h
@@ -5,8 +5,6 @@
 #ifndef __AT91RM9200_H__
 #define __AT91RM9200_H__
 
-#define CONFIG_AT91_GPIO   /* and require always gpio features */
-
 /* Periperial Identifiers */
 
 #define ATMEL_ID_SYS   1   /* System Peripheral */
diff --git a/configs/at91rm9200ek_defconfig b/configs/at91rm9200ek_defconfig
index 0b025911d69c..2aaf87904562 100644
--- a/configs/at91rm9200ek_defconfig
+++ b/configs/at91rm9200ek_defconfig
@@ -22,6 +22,7 @@ CONFIG_CMD_PING=y
 CONFIG_CMD_FAT=y
 CONFIG_ENV_IS_IN_FLASH=y
 CONFIG_ENV_ADDR=0x1004
+CONFIG_AT91_GPIO=y
 # CONFIG_MMC is not set
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
diff --git a/configs/at91rm9200ek_ram_defconfig 
b/configs/at91rm9200ek_ram_defconfig
index 09c996b8b225..9d2fc473430b 100644
--- a/configs/at91rm9200ek_ram_defconfig
+++ b/configs/at91rm9200ek_ram_defconfig
@@ -23,6 +23,7 @@ CONFIG_CMD_PING=y
 CONFIG_CMD_FAT=y
 CONFIG_ENV_IS_IN_FLASH=y
 CONFIG_ENV_ADDR=0x1004
+CONFIG_AT91_GPIO=y
 # CONFIG_MMC is not set
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
diff --git a/configs/axm_defconfig b/configs/axm_defconfig
index 78e6c8d34569..1615d8af0eba 100644
--- a/configs/axm_defconfig
+++ b/configs/axm_defconfig
@@ -58,6 +58,7 @@ CONFIG_BLK=y
 CONFIG_HAVE_BLOCK_DEVICE=y
 CONFIG_CLK=y
 CONFIG_CLK_AT91=y
+CONFIG_AT91_GPIO=y
 # CONFIG_MMC is not set
 CONFIG_MTD=y
 CONFIG_MTD_RAW_NAND=y
diff --git a/configs/corvus_defconfig b/configs/corvus_defconfig
index 0eedaa93667a..c6e5955bf329 100644
--- a/configs/corvus_defconfig
+++ b/configs/corvus_defconfig
@@ -48,6 +48,7 @@ CONFIG_BLK=y
 CONFIG_CLK=y
 CONFIG_CLK_AT91=y
 CONFIG_DFU_NAND=y
+CONFIG_AT91_GPIO=y
 # CONFIG_MMC is not set
 CONFIG_MTD=y
 CONFIG_MTD_RAW_NAND=y
diff --git a/configs/gurnard_defconfig b/configs/gurnard_defconfig
index 0d1a46315bd3..a679c0f6700b 100644
--- a/configs/gurnard_defconfig
+++ b/configs/gurnard_defconfig
@@ -32,6 +32,7 @@ CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="at91sam9g45-gurnard"
 CONFIG_ENV_IS_IN_NAND=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_AT91_GPIO=y
 CONFIG_MTD=y
 CONFIG_MTD_RAW_NAND=y
 # CONFIG_SYS_NAND_USE_FLASH_BBT is not set
diff --git a/configs/picosam9g45_defconfig b/configs/picosam9g45_defconfig
index 0157f5172e13..2921f2dfd4f7 100644
--- a/configs/picosam9g45_defconfig
+++ b/configs/picosam9g45_defconfig
@@ -39,6 +39,7 @@ CONFIG_ENV_IS_IN_FAT=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_DM=y
 CONFIG_SPL_DM=y
+CONFIG_AT91_GPIO=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
diff --git a/configs/smartweb_defconfig b/configs/smartweb_defconfig
index 8f9a19f695ba..4545c7075b3f 100644
--- a/configs/smartweb_defconfig
+++ b/configs/smartweb_defconfig
@@ -49,6 +49,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_CLK=y
 CONFIG_CLK_AT91=y
 CONFIG_DFU_NAND=y
+CONFIG_AT91_GPIO=y
 # CONFIG_MMC is not set
 CONFIG_MTD=y
 CONFIG_MTD_RAW_NAND=y
diff --git a/configs/snapper9260_defconfig b/configs/snapper9260_defconfig
index c684e2b20a11..9e44395f03f0 100644
--- a/configs/snapper9260_defconfig
+++ b/configs/snapper9260_defconfig
@@ -30,6 +30,7 @@ CONFIG_CMD_PING=y
 CONFIG_CMD_FAT=y
 CONFIG_ENV_IS_IN_NAND=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_AT91_GPIO=y
 CONFIG_CMD_PCA953X=y
 # CONFIG_MMC is not set
 CONFIG_MTD=y
diff --git a/configs/snapper9g20_defconfig b/configs/snapper9g20_defconfig
index 3ef091fab48f..e1c5c2ef4c1f 100644
--- a/configs/s

[PATCHv2 08/31] Convert CONFIG_ATMEL_USART to Kconfig

2020-06-16 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_ATMEL_USART

Signed-off-by: Tom Rini 
---
 configs/at91rm9200ek_defconfig | 1 +
 configs/at91rm9200ek_ram_defconfig | 1 +
 configs/gurnard_defconfig  | 1 +
 configs/picosam9g45_defconfig  | 1 +
 configs/smartweb_defconfig | 1 +
 configs/snapper9260_defconfig  | 1 +
 configs/snapper9g20_defconfig  | 1 +
 configs/vinco_defconfig| 1 +
 configs/wb45n_defconfig| 1 +
 configs/wb50n_defconfig| 1 +
 include/configs/at91rm9200ek.h | 1 -
 include/configs/picosam9g45.h  | 1 -
 include/configs/smartweb.h | 1 -
 include/configs/snapper9260.h  | 1 -
 include/configs/snapper9g45.h  | 1 -
 include/configs/vinco.h| 1 -
 include/configs/wb45n.h| 1 -
 include/configs/wb50n.h| 1 -
 18 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/configs/at91rm9200ek_defconfig b/configs/at91rm9200ek_defconfig
index 2aaf87904562..a990360794f4 100644
--- a/configs/at91rm9200ek_defconfig
+++ b/configs/at91rm9200ek_defconfig
@@ -29,6 +29,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
 CONFIG_MII=y
+CONFIG_ATMEL_USART=y
 CONFIG_USB=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_KEYBOARD=y
diff --git a/configs/at91rm9200ek_ram_defconfig 
b/configs/at91rm9200ek_ram_defconfig
index 9d2fc473430b..143346158b47 100644
--- a/configs/at91rm9200ek_ram_defconfig
+++ b/configs/at91rm9200ek_ram_defconfig
@@ -30,6 +30,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
 CONFIG_MII=y
+CONFIG_ATMEL_USART=y
 CONFIG_USB=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_KEYBOARD=y
diff --git a/configs/gurnard_defconfig b/configs/gurnard_defconfig
index a679c0f6700b..5e0d6f7c2329 100644
--- a/configs/gurnard_defconfig
+++ b/configs/gurnard_defconfig
@@ -39,6 +39,7 @@ CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_ATMEL=y
 CONFIG_ATMEL_NAND_HWECC=y
 CONFIG_PHYLIB=y
+CONFIG_ATMEL_USART=y
 CONFIG_TIMER=y
 CONFIG_ATMEL_PIT_TIMER=y
 CONFIG_USB=y
diff --git a/configs/picosam9g45_defconfig b/configs/picosam9g45_defconfig
index 2921f2dfd4f7..03783a2af067 100644
--- a/configs/picosam9g45_defconfig
+++ b/configs/picosam9g45_defconfig
@@ -40,6 +40,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_DM=y
 CONFIG_SPL_DM=y
 CONFIG_AT91_GPIO=y
+CONFIG_ATMEL_USART=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
diff --git a/configs/smartweb_defconfig b/configs/smartweb_defconfig
index 4545c7075b3f..e7edb01c41d9 100644
--- a/configs/smartweb_defconfig
+++ b/configs/smartweb_defconfig
@@ -56,6 +56,7 @@ CONFIG_MTD_RAW_NAND=y
 # CONFIG_SYS_NAND_USE_FLASH_BBT is not set
 CONFIG_NAND_ATMEL=y
 CONFIG_PHYLIB=y
+CONFIG_ATMEL_USART=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_GADGET=y
diff --git a/configs/snapper9260_defconfig b/configs/snapper9260_defconfig
index 9e44395f03f0..fa4697989b85 100644
--- a/configs/snapper9260_defconfig
+++ b/configs/snapper9260_defconfig
@@ -37,5 +37,6 @@ CONFIG_MTD=y
 CONFIG_MTD_RAW_NAND=y
 # CONFIG_SYS_NAND_USE_FLASH_BBT is not set
 CONFIG_NAND_ATMEL=y
+CONFIG_ATMEL_USART=y
 CONFIG_USB=y
 CONFIG_USB_STORAGE=y
diff --git a/configs/snapper9g20_defconfig b/configs/snapper9g20_defconfig
index e1c5c2ef4c1f..abe033373459 100644
--- a/configs/snapper9g20_defconfig
+++ b/configs/snapper9g20_defconfig
@@ -36,5 +36,6 @@ CONFIG_MTD=y
 CONFIG_MTD_RAW_NAND=y
 # CONFIG_SYS_NAND_USE_FLASH_BBT is not set
 CONFIG_NAND_ATMEL=y
+CONFIG_ATMEL_USART=y
 CONFIG_USB=y
 CONFIG_USB_STORAGE=y
diff --git a/configs/vinco_defconfig b/configs/vinco_defconfig
index 8ca7556772b8..d4852eafe0d4 100644
--- a/configs/vinco_defconfig
+++ b/configs/vinco_defconfig
@@ -38,6 +38,7 @@ CONFIG_SF_DEFAULT_MODE=0
 CONFIG_SF_DEFAULT_SPEED=5000
 CONFIG_PHY_SMSC=y
 CONFIG_ETH_DESIGNWARE=y
+CONFIG_ATMEL_USART=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
diff --git a/configs/wb45n_defconfig b/configs/wb45n_defconfig
index d770e007a655..ef069a672cc2 100644
--- a/configs/wb45n_defconfig
+++ b/configs/wb45n_defconfig
@@ -40,6 +40,7 @@ CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_ATMEL=y
 CONFIG_PMECC_CAP=4
 CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER=y
+CONFIG_ATMEL_USART=y
 CONFIG_LZMA=y
 CONFIG_LZO=y
 CONFIG_OF_LIBFDT=y
diff --git a/configs/wb50n_defconfig b/configs/wb50n_defconfig
index e764c303d069..1b444f07529d 100644
--- a/configs/wb50n_defconfig
+++ b/configs/wb50n_defconfig
@@ -43,5 +43,6 @@ CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER=y
 CONFIG_PHYLIB=y
 CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ90X1=y
+CONFIG_ATMEL_USART=y
 CONFIG_LZMA=y
 CONFIG_OF_LIBFDT=y
diff --git a/include/configs/at91rm9200ek.h b/include/configs/at91rm9200ek.h
index 378f9dc48be4..5e1e59074758 100644
--- a/include/configs/at91rm9200ek.h
+++ b/include/configs/at91rm9200ek.h
@@ -96,7 +96,6 @@
  * CONFIG_DBGU is DBGU unit on J10
  * CONFIG_USART1 is USART1 on J14
  */
-#define CONFIG_ATMEL_USART
 #define CONFIG_USART_BASE  ATMEL_BASE_DBGU
 #define CONFIG_USART_ID0/* ignored in arm */

[PATCHv2 04/31] Convert CONFIG_ARMV7_PSCI et al to Kconfig

2020-06-16 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_ARMV7_PSCI
   CONFIG_ARMV7_PSCI_NR_CPUS

Cc: Tom Warren 
Cc: peter.ch...@data61.csiro.au
Signed-off-by: Tom Rini 
---
 arch/arm/mach-tegra/tegra124/Kconfig | 1 +
 include/configs/cei-tk1-som.h| 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm/mach-tegra/tegra124/Kconfig 
b/arch/arm/mach-tegra/tegra124/Kconfig
index 6fa31ea0a16c..fb016aa46c90 100644
--- a/arch/arm/mach-tegra/tegra124/Kconfig
+++ b/arch/arm/mach-tegra/tegra124/Kconfig
@@ -19,6 +19,7 @@ config TARGET_JETSON_TK1
 
 config TARGET_CEI_TK1_SOM
bool "Colorado Engineering Inc Tegra124 TK1-som board"
+   select ARCH_SUPPORT_PSCI
select BOARD_LATE_INIT
select CPU_V7_HAS_NONSEC if !SPL_BUILD
select CPU_V7_HAS_VIRT if !SPL_BUILD
diff --git a/include/configs/cei-tk1-som.h b/include/configs/cei-tk1-som.h
index dbebef34e386..2541f2fc27c2 100644
--- a/include/configs/cei-tk1-som.h
+++ b/include/configs/cei-tk1-som.h
@@ -32,8 +32,6 @@
 #include "tegra-common-usb-gadget.h"
 #include "tegra-common-post.h"
 
-#define CONFIG_ARMV7_PSCI  1
-#define CONFIG_ARMV7_PSCI_NR_CPUS  4
 /* Reserve top 1M for secure RAM */
 #define CONFIG_ARMV7_SECURE_BASE   0xfff0
 #define CONFIG_ARMV7_SECURE_RESERVE_SIZE   0x0010
-- 
2.17.1



[PATCHv2 06/31] Convert CONFIG_ATMEL_HLCD to Kconfig

2020-06-16 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_ATMEL_HLCD

Signed-off-by: Tom Rini 
---
 configs/at91sam9n12ek_mmc_defconfig   | 1 +
 configs/at91sam9n12ek_nandflash_defconfig | 1 +
 configs/at91sam9n12ek_spiflash_defconfig  | 1 +
 drivers/video/Kconfig | 1 -
 include/configs/at91sam9n12ek.h   | 1 -
 5 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/configs/at91sam9n12ek_mmc_defconfig 
b/configs/at91sam9n12ek_mmc_defconfig
index 6f159aaccfa0..5a147a0bf628 100644
--- a/configs/at91sam9n12ek_mmc_defconfig
+++ b/configs/at91sam9n12ek_mmc_defconfig
@@ -61,4 +61,5 @@ CONFIG_ATMEL_PIT_TIMER=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_STORAGE=y
+CONFIG_ATMEL_HLCD=y
 CONFIG_LCD=y
diff --git a/configs/at91sam9n12ek_nandflash_defconfig 
b/configs/at91sam9n12ek_nandflash_defconfig
index 490addbedfd6..8263ffb1312e 100644
--- a/configs/at91sam9n12ek_nandflash_defconfig
+++ b/configs/at91sam9n12ek_nandflash_defconfig
@@ -62,4 +62,5 @@ CONFIG_ATMEL_PIT_TIMER=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_STORAGE=y
+CONFIG_ATMEL_HLCD=y
 CONFIG_LCD=y
diff --git a/configs/at91sam9n12ek_spiflash_defconfig 
b/configs/at91sam9n12ek_spiflash_defconfig
index 688f0c3a286e..0e95cff73363 100644
--- a/configs/at91sam9n12ek_spiflash_defconfig
+++ b/configs/at91sam9n12ek_spiflash_defconfig
@@ -63,4 +63,5 @@ CONFIG_ATMEL_PIT_TIMER=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_STORAGE=y
+CONFIG_ATMEL_HLCD=y
 CONFIG_LCD=y
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 05c173b9331c..026c6572489d 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -469,7 +469,6 @@ config NXP_TDA19988
 
 config ATMEL_HLCD
bool "Enable ATMEL video support using HLCDC"
-   depends on DM_VIDEO
help
   HLCDC supports video output to an attached LCD panel.
 
diff --git a/include/configs/at91sam9n12ek.h b/include/configs/at91sam9n12ek.h
index 706217fef9a4..c2d4e485a9d3 100644
--- a/include/configs/at91sam9n12ek.h
+++ b/include/configs/at91sam9n12ek.h
@@ -25,7 +25,6 @@
 #define CONFIG_LCD_LOGO
 #define CONFIG_LCD_INFO
 #define CONFIG_LCD_INFO_BELOW_LOGO
-#define CONFIG_ATMEL_HLCD
 #define CONFIG_ATMEL_LCD_RGB565
 
 /*
-- 
2.17.1



[PATCHv2 03/31] Convert CONFIG_ARM_PL180_MMCI to Kconfig

2020-06-16 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_ARM_PL180_MMCI

Signed-off-by: Tom Rini 
---
 configs/vexpress_ca15_tc2_defconfig | 1 +
 configs/vexpress_ca5x2_defconfig| 1 +
 configs/vexpress_ca9x4_defconfig| 1 +
 drivers/mmc/Kconfig | 1 -
 include/configs/vexpress_common.h   | 1 -
 5 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/configs/vexpress_ca15_tc2_defconfig 
b/configs/vexpress_ca15_tc2_defconfig
index d2a59774420d..2c78e12df6a1 100644
--- a/configs/vexpress_ca15_tc2_defconfig
+++ b/configs/vexpress_ca15_tc2_defconfig
@@ -23,6 +23,7 @@ CONFIG_CMD_MMC=y
 CONFIG_CMD_UBI=y
 CONFIG_ENV_IS_IN_FLASH=y
 CONFIG_ENV_ADDR=0xFF8
+CONFIG_ARM_PL180_MMCI=y
 CONFIG_MTD=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
diff --git a/configs/vexpress_ca5x2_defconfig b/configs/vexpress_ca5x2_defconfig
index bedf99a7e163..8395bb74cdb2 100644
--- a/configs/vexpress_ca5x2_defconfig
+++ b/configs/vexpress_ca5x2_defconfig
@@ -22,6 +22,7 @@ CONFIG_CMD_MMC=y
 CONFIG_CMD_UBI=y
 CONFIG_ENV_IS_IN_FLASH=y
 CONFIG_ENV_ADDR=0xFF8
+CONFIG_ARM_PL180_MMCI=y
 CONFIG_MTD=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
diff --git a/configs/vexpress_ca9x4_defconfig b/configs/vexpress_ca9x4_defconfig
index 8234b5d1bbcf..1811782128ff 100644
--- a/configs/vexpress_ca9x4_defconfig
+++ b/configs/vexpress_ca9x4_defconfig
@@ -23,6 +23,7 @@ CONFIG_CMD_MMC=y
 CONFIG_CMD_UBI=y
 CONFIG_ENV_IS_IN_FLASH=y
 CONFIG_ENV_ADDR=0x47F8
+CONFIG_ARM_PL180_MMCI=y
 CONFIG_MTD=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
index 8f56572c39a0..33b128ddc5a4 100644
--- a/drivers/mmc/Kconfig
+++ b/drivers/mmc/Kconfig
@@ -66,7 +66,6 @@ config MMC_SPI_CRC_ON
 
 config ARM_PL180_MMCI
bool "ARM AMBA Multimedia Card Interface and compatible support"
-   depends on DM_MMC && OF_CONTROL
help
  This selects the ARM(R) AMBA(R) PrimeCell Multimedia Card
  Interface (PL180, PL181 and compatible) support.
diff --git a/include/configs/vexpress_common.h 
b/include/configs/vexpress_common.h
index ca765579e821..ffc3b43fc557 100644
--- a/include/configs/vexpress_common.h
+++ b/include/configs/vexpress_common.h
@@ -135,7 +135,6 @@
 #define CONFIG_SYS_SERIAL0 V2M_UART0
 #define CONFIG_SYS_SERIAL1 V2M_UART1
 
-#define CONFIG_ARM_PL180_MMCI
 #define CONFIG_ARM_PL180_MMCI_BASE V2M_MMCI
 #define CONFIG_SYS_MMC_MAX_BLK_COUNT   127
 #define CONFIG_ARM_PL180_MMCI_CLOCK_FREQ 625
-- 
2.17.1



[PATCHv2 02/31] Convert CONFIG_ARCH_MISC_INIT to Kconfig

2020-06-16 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_ARCH_MISC_INIT

Signed-off-by: Tom Rini 
---
 configs/apalis-tk1_defconfig | 1 +
 configs/chiliboard_defconfig | 1 +
 include/configs/apalis-tk1.h | 2 --
 include/configs/chiliboard.h | 1 -
 4 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/configs/apalis-tk1_defconfig b/configs/apalis-tk1_defconfig
index 868303a29cca..6538f9a5b8cd 100644
--- a/configs/apalis-tk1_defconfig
+++ b/configs/apalis-tk1_defconfig
@@ -17,6 +17,7 @@ CONFIG_SYS_STDIO_DEREGISTER=y
 CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
+CONFIG_ARCH_MISC_INIT=y
 CONFIG_SYS_PROMPT="Apalis TK1 # "
 # CONFIG_CMD_IMI is not set
 CONFIG_CMD_GPIO=y
diff --git a/configs/chiliboard_defconfig b/configs/chiliboard_defconfig
index 30100a3151d0..afc73dc89c52 100644
--- a/configs/chiliboard_defconfig
+++ b/configs/chiliboard_defconfig
@@ -19,6 +19,7 @@ CONFIG_BOOTDELAY=1
 # CONFIG_USE_BOOTCOMMAND is not set
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_DEFAULT_FDT_FILE="am335x-chiliboard.dtb"
+CONFIG_ARCH_MISC_INIT=y
 CONFIG_SPL_I2C_SUPPORT=y
 CONFIG_SPL_POWER_SUPPORT=y
 CONFIG_SPL_WATCHDOG_SUPPORT=y
diff --git a/include/configs/apalis-tk1.h b/include/configs/apalis-tk1.h
index 965259c5e1e9..af008e4f4404 100644
--- a/include/configs/apalis-tk1.h
+++ b/include/configs/apalis-tk1.h
@@ -12,8 +12,6 @@
 
 #include "tegra124-common.h"
 
-#define CONFIG_ARCH_MISC_INIT
-
 /* Board-specific serial config */
 #define CONFIG_TEGRA_ENABLE_UARTA
 #define CONFIG_SYS_NS16550_COM1NV_PA_APB_UARTA_BASE
diff --git a/include/configs/chiliboard.h b/include/configs/chiliboard.h
index f4dcc54508ce..a2d198c5197b 100644
--- a/include/configs/chiliboard.h
+++ b/include/configs/chiliboard.h
@@ -147,7 +147,6 @@
 /* NAND: SPL related configs */
 
 /* USB configuration */
-#define CONFIG_ARCH_MISC_INIT
 #define CONFIG_AM335X_USB1
 #define CONFIG_AM335X_USB1_MODE MUSB_HOST
 
-- 
2.17.1



[PATCHv2 01/31] Convert CONFIG_AM335X_LCD to Kconfig

2020-06-16 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_AM335X_LCD

Signed-off-by: Tom Rini 
---
 configs/brxre1_defconfig | 1 +
 drivers/video/Kconfig| 1 -
 include/configs/brxre1.h | 3 ---
 3 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/configs/brxre1_defconfig b/configs/brxre1_defconfig
index 5d3246ac8c72..456e4507c8c6 100644
--- a/configs/brxre1_defconfig
+++ b/configs/brxre1_defconfig
@@ -89,6 +89,7 @@ CONFIG_USB_MUSB_TI=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_GADGET=y
 CONFIG_SYS_WHITE_ON_BLACK=y
+CONFIG_AM335X_LCD=y
 CONFIG_LCD=y
 CONFIG_SPL_TINY_MEMSET=y
 # CONFIG_OF_LIBFDT_OVERLAY is not set
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 38123543a539..05c173b9331c 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -475,7 +475,6 @@ config ATMEL_HLCD
 
 config AM335X_LCD
bool "Enable AM335x video support"
-   depends on DM_VIDEO
help
   Supports video output to an attached LCD panel.
 
diff --git a/include/configs/brxre1.h b/include/configs/brxre1.h
index 9db011358eba..3a18aec5d332 100644
--- a/include/configs/brxre1.h
+++ b/include/configs/brxre1.h
@@ -15,9 +15,6 @@
 #include 
 #include 
 /* - */
-#if !defined(CONFIG_AM335X_LCD)
-#define CONFIG_AM335X_LCD
-#endif
 #define LCD_BPPLCD_COLOR32
 
 /* memory */
-- 
2.17.1



Re: U-Boot atheros PHY support and cubox ethernet

2020-06-16 Thread Tom Rini
On Tue, Jun 16, 2020 at 06:01:24PM -0300, Fabio Estevam wrote:
> On Tue, Jun 16, 2020 at 5:58 PM Tom Rini  wrote:
> 
> > I'm looking at the conversion now, thanks.
> 
> When doing the DM_ETH conversion, this kernel commit may also help as
> 'qca,clk-out-frequency' is also supported in U-Boot:
> 
> commit 86b08bd5b99480b79a25343f24c1b8c4ddcb5c09
> Author: Russell King 
> Date:   Wed Apr 15 16:44:17 2020 +0100
> 
> ARM: dts: imx6-sr-som: add ethernet PHY configuration
> 
> Add ethernet PHY configuration ahead of removing the quirk that
> configures the clocking mode for the PHY.  The RGMII delay is
> already set correctly.
> 
> Signed-off-by: Russell King 
> Reviewed-by: Fabio Estevam 
> Signed-off-by: Shawn Guo 

Yeah, OK, I got far enough on trying to convert this that I see I don't
quite have time to pick it up and run with it.  It looks like there's
going to be some extra fun around resetting the PHY perhaps?  My quick
pass got things seeing a generic PHY and not the atheros one.  If you
have time to make something you'd like me to test for conversion let me
know.  But I'm going to pick up debugging the problem I see on the
platform right now in case there's a wider problem it's showing.

-- 
Tom


signature.asc
Description: PGP signature


Re: U-Boot atheros PHY support and cubox ethernet

2020-06-16 Thread Vladimir Oltean
On Wed, 17 Jun 2020 at 00:35, Tom Rini  wrote:
>
> On Tue, Jun 16, 2020 at 11:37:17PM +0300, Vladimir Oltean wrote:
> > On Tue, 16 Jun 2020 at 23:31, Tom Rini  wrote:
> > >
> > > On Tue, Jun 16, 2020 at 11:21:08PM +0300, Vladimir Oltean wrote:
> > > > On Tue, 16 Jun 2020 at 23:10, Tom Rini  wrote:
> > > > >
> > > > > On Tue, Jun 16, 2020 at 10:58:26PM +0300, Vladimir Oltean wrote:
> > > > > > Hi Tom,
> > > > > >
> > > > > > On Tue, 16 Jun 2020 at 22:55, Tom Rini  wrote:
> > > > > > >
> > > > > > > Hey all,
> > > > > > >
> > > > > > > In commit 4346df3392c0 ("phy: atheros: Make RGMII Tx delays 
> > > > > > > actually
> > > > > > > configurable for AR8035") we brought in changes to get in to line 
> > > > > > > with
> > > > > > > upstream linux kernel support for this PHY and in turn deal with 
> > > > > > > more
> > > > > > > "driver was wrong, DT was wrong too" changes.  Now the problem I 
> > > > > > > have is
> > > > > > > that ethernet on my Hummingboard doesn't work AND as far as I can 
> > > > > > > tell,
> > > > > > > the DTB is correct and saying phy-mode = "rgmii-id" now not 
> > > > > > > "rgmii".  It
> > > > > > > also looks to match what's in v5.7 for the kernel.  What do I 
> > > > > > > need to do
> > > > > > > here next?  Thanks!
> > > > > > >
> > > > > > > --
> > > > > > > Tom
> > > > > >
> > > > > > Reverting 4346df3392c0 makes your interface work?
> > > > >
> > > > > Yup.
> > > > >
> > > > > > What is the DTS path that your hummingboard uses?
> > > > >
> > > > > Good question.  Per board/solidrun/mx6cuboxi/mx6cuboxi.c:
> > > > > /*
> > > > >  * This is not a perfect match. Avoid dependency on the DM GPIO driver
> > > > >  * needed
> > > > >  * for accurate board detection. Hummingboard2 DT is good enough for
> > > > >  * U-Boot on
> > > > >  * all Hummingboard/Cubox-i platforms.
> > > > >  */
> > > > > so arch/arm/dts/imx6dl-hummingboard2-emmc-som-v15.dts is the base.  
> > > > > But
> > > > > the board really is the original hummingboard platform.  Thanks!
> > > > >
> > > > > --
> > > > > Tom
> > > >
> > > > Does it work if you say PHY_INTERFACE_MODE_RGMII_ID here?
> > > > https://gitlab.denx.de/u-boot/u-boot/-/blob/master/drivers/net/fec_mxc.c#L1232
> > >
> > > No change.  And to be clear, I bisect'd the issue down and at that
> > > commit, reverting it fixes ethernet.  It doesn't revert cleanly (nor
> > > obviously to me) on master.
> > >
> > > --
> > > Tom
> >
> > On master, the revert would look like this:
> >
> > diff --git a/drivers/net/phy/atheros.c b/drivers/net/phy/atheros.c
> > index 13f7275d1706..5ba639e8119f 100644
> > --- a/drivers/net/phy/atheros.c
> > +++ b/drivers/net/phy/atheros.c
> > @@ -124,6 +124,7 @@ static int ar8021_config(struct phy_device *phydev)
> >
> >  static int ar803x_delay_config(struct phy_device *phydev)
> >  {
> > +   int regval;
> > int ret;
> >
> > if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID ||
> > @@ -138,6 +139,10 @@ static int ar803x_delay_config(struct phy_device 
> > *phydev)
> > else
> > ret = ar803x_enable_rx_delay(phydev, false);
> >
> > +   phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x05);
> > +   regval = phy_read(phydev, MDIO_DEVAD_NONE, 0x1e);
> > +   phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, (regval|0x0100));
> > +
> > return ret;
> >  }
>
> This alone is not enough.
>

So if this is not enough, then I'd go back to bisecting. I'd rebase
right after 8737c65fe4e3 ("phy: atheros: consolidate
{ar8031|ar8035}_config()"), create a new patch on
board/solidrun/mx6cuboxi/mx6cuboxi.c which changes RGMII to RGMII_ID,
confirm it works (according to what you've said so far, it should),
then bless it as "git bisect good", and let the fun start :)


Re: U-Boot atheros PHY support and cubox ethernet

2020-06-16 Thread Tom Rini
On Wed, Jun 17, 2020 at 12:01:39AM +0300, Vladimir Oltean wrote:
> On Tue, 16 Jun 2020 at 23:58, Tom Rini  wrote:
> >
> > On Tue, Jun 16, 2020 at 05:55:10PM -0300, Fabio Estevam wrote:
> > > On Tue, Jun 16, 2020 at 5:51 PM Tom Rini  wrote:
> > >
> > > > Ah.  So this is probably why the DT being right isn't helping then.  If
> > > > you want to blind-convert I'm happy to test, otherwise do you have a
> > > > similar board conversion for me to look at?  Thanks!
> > >
> > > Please try Vladimir's suggestion as it seems to be the less intrusive 
> > > approach:
> > >
> > > --- a/board/solidrun/mx6cuboxi/mx6cuboxi.c
> > > +++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c
> > > @@ -321,7 +321,7 @@ int board_eth_init(bd_t *bis)
> > > if (!bus)
> > > return -EINVAL;
> > >
> > > -   phydev = phy_find_by_mask(bus, ETH_PHY_MASK, 
> > > PHY_INTERFACE_MODE_RGMII);
> > > +   phydev = phy_find_by_mask(bus, ETH_PHY_MASK,
> > > PHY_INTERFACE_MODE_RGMII_ID);
> > > if (!phydev) {
> > > ret = -EINVAL;
> > > goto free_bus;
> > >
> >
> > OK, tried that and not enough.  Console says PHY autoneg completes, but
> > DHCP still doesn't reply.
> >
> 
> What about with the manual revert in place? What does
> phydev->interface print? Not only in atheros.c, but also in
> mx6cuboxi.c, right below this phy_find_by_mask call.
> Trying to understand if this is your only problem or if there are more.

In both functions the value printed out for phydev->interface is the
value passed to phy_find_by_mask(...).

-- 
Tom


signature.asc
Description: PGP signature


Re: U-Boot atheros PHY support and cubox ethernet

2020-06-16 Thread Vladimir Oltean
On Wed, 17 Jun 2020 at 00:57, Tom Rini  wrote:
>
> On Wed, Jun 17, 2020 at 12:04:16AM +0300, Vladimir Oltean wrote:
> > On Wed, 17 Jun 2020 at 00:01, Vladimir Oltean  wrote:
> > >
> > > On Tue, 16 Jun 2020 at 23:58, Tom Rini  wrote:
> > > >
> > > > On Tue, Jun 16, 2020 at 05:55:10PM -0300, Fabio Estevam wrote:
> > > > > On Tue, Jun 16, 2020 at 5:51 PM Tom Rini  wrote:
> > > > >
> > > > > > Ah.  So this is probably why the DT being right isn't helping then. 
> > > > > >  If
> > > > > > you want to blind-convert I'm happy to test, otherwise do you have a
> > > > > > similar board conversion for me to look at?  Thanks!
> > > > >
> > > > > Please try Vladimir's suggestion as it seems to be the less intrusive 
> > > > > approach:
> > > > >
> > > > > --- a/board/solidrun/mx6cuboxi/mx6cuboxi.c
> > > > > +++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c
> > > > > @@ -321,7 +321,7 @@ int board_eth_init(bd_t *bis)
> > > > > if (!bus)
> > > > > return -EINVAL;
> > > > >
> > > > > -   phydev = phy_find_by_mask(bus, ETH_PHY_MASK, 
> > > > > PHY_INTERFACE_MODE_RGMII);
> > > > > +   phydev = phy_find_by_mask(bus, ETH_PHY_MASK,
> > > > > PHY_INTERFACE_MODE_RGMII_ID);
> > > > > if (!phydev) {
> > > > > ret = -EINVAL;
> > > > > goto free_bus;
> > > > >
> > > >
> > > > OK, tried that and not enough.  Console says PHY autoneg completes, but
> > > > DHCP still doesn't reply.
> > > >
> > >
> > > What about with the manual revert in place? What does
> > > phydev->interface print? Not only in atheros.c, but also in
> > > mx6cuboxi.c, right below this phy_find_by_mask call.
> > > Trying to understand if this is your only problem or if there are more.
> >
> > In fact there's one more 'manual' thing you can do.
>
> For this test, based on your previous email and the kernel dts files, I
> made the change to mx6cuboxi.c to pass PHY_INTERFACE_MODE_RGMII_ID to
> phy_find_by_mask(...).
>
> > Check if RX delay is enabled (bit 15 of debug register 0):
> > => mdio write eTSEC1 0x1D 0
> > => mdio read eTSEC1 0x1E
> > => mdio write eTSEC1 0x1E 
>
> => mdio list
> FEC:
> 0 - AR8035 <--> FEC
> => mdio write FEC 0x1D 0
> => mdio read FEC 0x1E
> Reading from bus FEC
> PHY at address 0:
> 30 - 0x82ee
> ... so it's enabled already.
>
> > Check if TX delay is enabled (bit 8 of debug register 5):
> > => mdio write eTSEC1 0x1D 5
> > => mdio read eTSEC1 0x1E
> > => mdio write eTSEC1 0x1E 
>
> => mdio write FEC 0x1D 5
> => mdio read FEC 0x1E
> Reading from bus FEC
> PHY at address 0:
> 30 - 0x2d47
> ... so it's enabled already.
>
> Or did I make a mistake?  Thanks!
>
> --
> Tom

Yes, the PHY has RGMII delays enabled in both directions.


Re: U-Boot atheros PHY support and cubox ethernet

2020-06-16 Thread Tom Rini
On Wed, Jun 17, 2020 at 12:04:16AM +0300, Vladimir Oltean wrote:
> On Wed, 17 Jun 2020 at 00:01, Vladimir Oltean  wrote:
> >
> > On Tue, 16 Jun 2020 at 23:58, Tom Rini  wrote:
> > >
> > > On Tue, Jun 16, 2020 at 05:55:10PM -0300, Fabio Estevam wrote:
> > > > On Tue, Jun 16, 2020 at 5:51 PM Tom Rini  wrote:
> > > >
> > > > > Ah.  So this is probably why the DT being right isn't helping then.  
> > > > > If
> > > > > you want to blind-convert I'm happy to test, otherwise do you have a
> > > > > similar board conversion for me to look at?  Thanks!
> > > >
> > > > Please try Vladimir's suggestion as it seems to be the less intrusive 
> > > > approach:
> > > >
> > > > --- a/board/solidrun/mx6cuboxi/mx6cuboxi.c
> > > > +++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c
> > > > @@ -321,7 +321,7 @@ int board_eth_init(bd_t *bis)
> > > > if (!bus)
> > > > return -EINVAL;
> > > >
> > > > -   phydev = phy_find_by_mask(bus, ETH_PHY_MASK, 
> > > > PHY_INTERFACE_MODE_RGMII);
> > > > +   phydev = phy_find_by_mask(bus, ETH_PHY_MASK,
> > > > PHY_INTERFACE_MODE_RGMII_ID);
> > > > if (!phydev) {
> > > > ret = -EINVAL;
> > > > goto free_bus;
> > > >
> > >
> > > OK, tried that and not enough.  Console says PHY autoneg completes, but
> > > DHCP still doesn't reply.
> > >
> >
> > What about with the manual revert in place? What does
> > phydev->interface print? Not only in atheros.c, but also in
> > mx6cuboxi.c, right below this phy_find_by_mask call.
> > Trying to understand if this is your only problem or if there are more.
> 
> In fact there's one more 'manual' thing you can do.

For this test, based on your previous email and the kernel dts files, I
made the change to mx6cuboxi.c to pass PHY_INTERFACE_MODE_RGMII_ID to
phy_find_by_mask(...).

> Check if RX delay is enabled (bit 15 of debug register 0):
> => mdio write eTSEC1 0x1D 0
> => mdio read eTSEC1 0x1E
> => mdio write eTSEC1 0x1E 

=> mdio list
FEC:
0 - AR8035 <--> FEC
=> mdio write FEC 0x1D 0
=> mdio read FEC 0x1E
Reading from bus FEC
PHY at address 0:
30 - 0x82ee
... so it's enabled already.

> Check if TX delay is enabled (bit 8 of debug register 5):
> => mdio write eTSEC1 0x1D 5
> => mdio read eTSEC1 0x1E
> => mdio write eTSEC1 0x1E 

=> mdio write FEC 0x1D 5
=> mdio read FEC 0x1E
Reading from bus FEC
PHY at address 0:
30 - 0x2d47
... so it's enabled already.

Or did I make a mistake?  Thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: U-Boot atheros PHY support and cubox ethernet

2020-06-16 Thread Tom Rini
On Tue, Jun 16, 2020 at 11:30:00PM +0200, Michael Walle wrote:
> Am 16. Juni 2020 22:21:08 MESZ schrieb Vladimir Oltean :
> >On Tue, 16 Jun 2020 at 23:10, Tom Rini  wrote:
> >>
> >> On Tue, Jun 16, 2020 at 10:58:26PM +0300, Vladimir Oltean wrote:
> >> > Hi Tom,
> >> >
> >> > On Tue, 16 Jun 2020 at 22:55, Tom Rini  wrote:
> >> > >
> >> > > Hey all,
> >> > >
> >> > > In commit 4346df3392c0 ("phy: atheros: Make RGMII Tx delays
> >actually
> >> > > configurable for AR8035") we brought in changes to get in to line
> >with
> >> > > upstream linux kernel support for this PHY and in turn deal with
> >more
> >> > > "driver was wrong, DT was wrong too" changes.  Now the problem I
> >have is
> >> > > that ethernet on my Hummingboard doesn't work AND as far as I can
> >tell,
> >> > > the DTB is correct and saying phy-mode = "rgmii-id" now not
> >"rgmii".  It
> >> > > also looks to match what's in v5.7 for the kernel.  What do I
> >need to do
> >> > > here next?  Thanks!
> >> > >
> >> > > --
> >> > > Tom
> >> >
> >> > Reverting 4346df3392c0 makes your interface work?
> >>
> >> Yup.
> >>
> >> > What is the DTS path that your hummingboard uses?
> >>
> >> Good question.  Per board/solidrun/mx6cuboxi/mx6cuboxi.c:
> >> /*
> >>  * This is not a perfect match. Avoid dependency on the DM GPIO
> >driver
> >>  * needed
> >>  * for accurate board detection. Hummingboard2 DT is good enough for
> >>  * U-Boot on
> >>  * all Hummingboard/Cubox-i platforms.
> >>  */
> >> so arch/arm/dts/imx6dl-hummingboard2-emmc-som-v15.dts is the base. 
> >But
> >> the board really is the original hummingboard platform.  Thanks!
> >>
> >> --
> >> Tom
> >
> >Does it work if you say PHY_INTERFACE_MODE_RGMII_ID here?
> >https://gitlab.denx.de/u-boot/u-boot/-/blob/master/drivers/net/fec_mxc.c#L1232
> 
> it should be PHY_INTERFACE_MODE_RGMII_TXID to get the original behavior, 
> shouldn't it? The commit in question only removes the hardcoded TX delay. 

This change alone also still fails on master for me.

-- 
Tom


signature.asc
Description: PGP signature


Re: U-Boot atheros PHY support and cubox ethernet

2020-06-16 Thread Tom Rini
On Tue, Jun 16, 2020 at 11:37:17PM +0300, Vladimir Oltean wrote:
> On Tue, 16 Jun 2020 at 23:31, Tom Rini  wrote:
> >
> > On Tue, Jun 16, 2020 at 11:21:08PM +0300, Vladimir Oltean wrote:
> > > On Tue, 16 Jun 2020 at 23:10, Tom Rini  wrote:
> > > >
> > > > On Tue, Jun 16, 2020 at 10:58:26PM +0300, Vladimir Oltean wrote:
> > > > > Hi Tom,
> > > > >
> > > > > On Tue, 16 Jun 2020 at 22:55, Tom Rini  wrote:
> > > > > >
> > > > > > Hey all,
> > > > > >
> > > > > > In commit 4346df3392c0 ("phy: atheros: Make RGMII Tx delays actually
> > > > > > configurable for AR8035") we brought in changes to get in to line 
> > > > > > with
> > > > > > upstream linux kernel support for this PHY and in turn deal with 
> > > > > > more
> > > > > > "driver was wrong, DT was wrong too" changes.  Now the problem I 
> > > > > > have is
> > > > > > that ethernet on my Hummingboard doesn't work AND as far as I can 
> > > > > > tell,
> > > > > > the DTB is correct and saying phy-mode = "rgmii-id" now not 
> > > > > > "rgmii".  It
> > > > > > also looks to match what's in v5.7 for the kernel.  What do I need 
> > > > > > to do
> > > > > > here next?  Thanks!
> > > > > >
> > > > > > --
> > > > > > Tom
> > > > >
> > > > > Reverting 4346df3392c0 makes your interface work?
> > > >
> > > > Yup.
> > > >
> > > > > What is the DTS path that your hummingboard uses?
> > > >
> > > > Good question.  Per board/solidrun/mx6cuboxi/mx6cuboxi.c:
> > > > /*
> > > >  * This is not a perfect match. Avoid dependency on the DM GPIO driver
> > > >  * needed
> > > >  * for accurate board detection. Hummingboard2 DT is good enough for
> > > >  * U-Boot on
> > > >  * all Hummingboard/Cubox-i platforms.
> > > >  */
> > > > so arch/arm/dts/imx6dl-hummingboard2-emmc-som-v15.dts is the base.  But
> > > > the board really is the original hummingboard platform.  Thanks!
> > > >
> > > > --
> > > > Tom
> > >
> > > Does it work if you say PHY_INTERFACE_MODE_RGMII_ID here?
> > > https://gitlab.denx.de/u-boot/u-boot/-/blob/master/drivers/net/fec_mxc.c#L1232
> >
> > No change.  And to be clear, I bisect'd the issue down and at that
> > commit, reverting it fixes ethernet.  It doesn't revert cleanly (nor
> > obviously to me) on master.
> >
> > --
> > Tom
> 
> On master, the revert would look like this:
> 
> diff --git a/drivers/net/phy/atheros.c b/drivers/net/phy/atheros.c
> index 13f7275d1706..5ba639e8119f 100644
> --- a/drivers/net/phy/atheros.c
> +++ b/drivers/net/phy/atheros.c
> @@ -124,6 +124,7 @@ static int ar8021_config(struct phy_device *phydev)
> 
>  static int ar803x_delay_config(struct phy_device *phydev)
>  {
> +   int regval;
> int ret;
> 
> if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID ||
> @@ -138,6 +139,10 @@ static int ar803x_delay_config(struct phy_device *phydev)
> else
> ret = ar803x_enable_rx_delay(phydev, false);
> 
> +   phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x05);
> +   regval = phy_read(phydev, MDIO_DEVAD_NONE, 0x1e);
> +   phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, (regval|0x0100));
> +
> return ret;
>  }

This alone is not enough.

> The next thing to check is to print the value of phydev->interface there.
> 7 is PHY_INTERFACE_MODE_RGMII,
> 8 is PHY_INTERFACE_MODE_RGMII_ID,
> 9 is PHY_INTERFACE_MODE_RGMII_RXID,
> 10 is PHY_INTERFACE_MODE_RGMII_TXID,

With only this patch, it's 7.  With this added to mx6cuboxi.c:
-   phydev = phy_find_by_mask(bus, ETH_PHY_MASK, PHY_INTERFACE_MODE_RGMII);
+   phydev = phy_find_by_mask(bus, ETH_PHY_MASK, 
PHY_INTERFACE_MODE_RGMII_ID);
it's 8, and doesn't work either.  Moving on to the next emails now.

-- 
Tom


signature.asc
Description: PGP signature


Re: U-Boot atheros PHY support and cubox ethernet

2020-06-16 Thread Michael Walle
Am 16. Juni 2020 22:21:08 MESZ schrieb Vladimir Oltean :
>On Tue, 16 Jun 2020 at 23:10, Tom Rini  wrote:
>>
>> On Tue, Jun 16, 2020 at 10:58:26PM +0300, Vladimir Oltean wrote:
>> > Hi Tom,
>> >
>> > On Tue, 16 Jun 2020 at 22:55, Tom Rini  wrote:
>> > >
>> > > Hey all,
>> > >
>> > > In commit 4346df3392c0 ("phy: atheros: Make RGMII Tx delays
>actually
>> > > configurable for AR8035") we brought in changes to get in to line
>with
>> > > upstream linux kernel support for this PHY and in turn deal with
>more
>> > > "driver was wrong, DT was wrong too" changes.  Now the problem I
>have is
>> > > that ethernet on my Hummingboard doesn't work AND as far as I can
>tell,
>> > > the DTB is correct and saying phy-mode = "rgmii-id" now not
>"rgmii".  It
>> > > also looks to match what's in v5.7 for the kernel.  What do I
>need to do
>> > > here next?  Thanks!
>> > >
>> > > --
>> > > Tom
>> >
>> > Reverting 4346df3392c0 makes your interface work?
>>
>> Yup.
>>
>> > What is the DTS path that your hummingboard uses?
>>
>> Good question.  Per board/solidrun/mx6cuboxi/mx6cuboxi.c:
>> /*
>>  * This is not a perfect match. Avoid dependency on the DM GPIO
>driver
>>  * needed
>>  * for accurate board detection. Hummingboard2 DT is good enough for
>>  * U-Boot on
>>  * all Hummingboard/Cubox-i platforms.
>>  */
>> so arch/arm/dts/imx6dl-hummingboard2-emmc-som-v15.dts is the base. 
>But
>> the board really is the original hummingboard platform.  Thanks!
>>
>> --
>> Tom
>
>Does it work if you say PHY_INTERFACE_MODE_RGMII_ID here?
>https://gitlab.denx.de/u-boot/u-boot/-/blob/master/drivers/net/fec_mxc.c#L1232

it should be PHY_INTERFACE_MODE_RGMII_TXID to get the original behavior, 
shouldn't it? The commit in question only removes the hardcoded TX delay. 

-michael



Re: Can't access mmc #0 on mt7623 when booted from external SD

2020-06-16 Thread David Woodhouse
On Tue, 2020-06-16 at 21:38 +0200, Michael Nazzareno Trimarchi wrote:
> Have you already tried to dump the pinmux using the cmd? in both
> situation?

U-Boot> pinmux status -a
--  
pinctrl@10005000:   
Ops get_pin_muxing error (-38)  
Can't display pin muxing for pinctrl@10005000   
exit not allowed from main input shell. 


smime.p7s
Description: S/MIME cryptographic signature


Re: U-Boot atheros PHY support and cubox ethernet

2020-06-16 Thread Vladimir Oltean
On Wed, 17 Jun 2020 at 00:01, Vladimir Oltean  wrote:
>
> On Tue, 16 Jun 2020 at 23:58, Tom Rini  wrote:
> >
> > On Tue, Jun 16, 2020 at 05:55:10PM -0300, Fabio Estevam wrote:
> > > On Tue, Jun 16, 2020 at 5:51 PM Tom Rini  wrote:
> > >
> > > > Ah.  So this is probably why the DT being right isn't helping then.  If
> > > > you want to blind-convert I'm happy to test, otherwise do you have a
> > > > similar board conversion for me to look at?  Thanks!
> > >
> > > Please try Vladimir's suggestion as it seems to be the less intrusive 
> > > approach:
> > >
> > > --- a/board/solidrun/mx6cuboxi/mx6cuboxi.c
> > > +++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c
> > > @@ -321,7 +321,7 @@ int board_eth_init(bd_t *bis)
> > > if (!bus)
> > > return -EINVAL;
> > >
> > > -   phydev = phy_find_by_mask(bus, ETH_PHY_MASK, 
> > > PHY_INTERFACE_MODE_RGMII);
> > > +   phydev = phy_find_by_mask(bus, ETH_PHY_MASK,
> > > PHY_INTERFACE_MODE_RGMII_ID);
> > > if (!phydev) {
> > > ret = -EINVAL;
> > > goto free_bus;
> > >
> >
> > OK, tried that and not enough.  Console says PHY autoneg completes, but
> > DHCP still doesn't reply.
> >
>
> What about with the manual revert in place? What does
> phydev->interface print? Not only in atheros.c, but also in
> mx6cuboxi.c, right below this phy_find_by_mask call.
> Trying to understand if this is your only problem or if there are more.

In fact there's one more 'manual' thing you can do.

Check if RX delay is enabled (bit 15 of debug register 0):
=> mdio write eTSEC1 0x1D 0
=> mdio read eTSEC1 0x1E
=> mdio write eTSEC1 0x1E 

Check if TX delay is enabled (bit 8 of debug register 5):
=> mdio write eTSEC1 0x1D 5
=> mdio read eTSEC1 0x1E
=> mdio write eTSEC1 0x1E 

(replace eTSEC1 with your mdio bus name from "mdio list")


Re: U-Boot atheros PHY support and cubox ethernet

2020-06-16 Thread Vladimir Oltean
On Tue, 16 Jun 2020 at 23:58, Tom Rini  wrote:
>
> On Tue, Jun 16, 2020 at 05:55:10PM -0300, Fabio Estevam wrote:
> > On Tue, Jun 16, 2020 at 5:51 PM Tom Rini  wrote:
> >
> > > Ah.  So this is probably why the DT being right isn't helping then.  If
> > > you want to blind-convert I'm happy to test, otherwise do you have a
> > > similar board conversion for me to look at?  Thanks!
> >
> > Please try Vladimir's suggestion as it seems to be the less intrusive 
> > approach:
> >
> > --- a/board/solidrun/mx6cuboxi/mx6cuboxi.c
> > +++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c
> > @@ -321,7 +321,7 @@ int board_eth_init(bd_t *bis)
> > if (!bus)
> > return -EINVAL;
> >
> > -   phydev = phy_find_by_mask(bus, ETH_PHY_MASK, 
> > PHY_INTERFACE_MODE_RGMII);
> > +   phydev = phy_find_by_mask(bus, ETH_PHY_MASK,
> > PHY_INTERFACE_MODE_RGMII_ID);
> > if (!phydev) {
> > ret = -EINVAL;
> > goto free_bus;
> >
>
> OK, tried that and not enough.  Console says PHY autoneg completes, but
> DHCP still doesn't reply.
>

What about with the manual revert in place? What does
phydev->interface print? Not only in atheros.c, but also in
mx6cuboxi.c, right below this phy_find_by_mask call.
Trying to understand if this is your only problem or if there are more.


Re: U-Boot atheros PHY support and cubox ethernet

2020-06-16 Thread Fabio Estevam
On Tue, Jun 16, 2020 at 5:58 PM Tom Rini  wrote:

> I'm looking at the conversion now, thanks.

When doing the DM_ETH conversion, this kernel commit may also help as
'qca,clk-out-frequency' is also supported in U-Boot:

commit 86b08bd5b99480b79a25343f24c1b8c4ddcb5c09
Author: Russell King 
Date:   Wed Apr 15 16:44:17 2020 +0100

ARM: dts: imx6-sr-som: add ethernet PHY configuration

Add ethernet PHY configuration ahead of removing the quirk that
configures the clocking mode for the PHY.  The RGMII delay is
already set correctly.

Signed-off-by: Russell King 
Reviewed-by: Fabio Estevam 
Signed-off-by: Shawn Guo 


Re: U-Boot atheros PHY support and cubox ethernet

2020-06-16 Thread Tom Rini
On Tue, Jun 16, 2020 at 05:55:10PM -0300, Fabio Estevam wrote:
> On Tue, Jun 16, 2020 at 5:51 PM Tom Rini  wrote:
> 
> > Ah.  So this is probably why the DT being right isn't helping then.  If
> > you want to blind-convert I'm happy to test, otherwise do you have a
> > similar board conversion for me to look at?  Thanks!
> 
> Please try Vladimir's suggestion as it seems to be the less intrusive 
> approach:
> 
> --- a/board/solidrun/mx6cuboxi/mx6cuboxi.c
> +++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c
> @@ -321,7 +321,7 @@ int board_eth_init(bd_t *bis)
> if (!bus)
> return -EINVAL;
> 
> -   phydev = phy_find_by_mask(bus, ETH_PHY_MASK, 
> PHY_INTERFACE_MODE_RGMII);
> +   phydev = phy_find_by_mask(bus, ETH_PHY_MASK,
> PHY_INTERFACE_MODE_RGMII_ID);
> if (!phydev) {
> ret = -EINVAL;
> goto free_bus;
> 

OK, tried that and not enough.  Console says PHY autoneg completes, but
DHCP still doesn't reply.

> Here is a similar DM_ETH board conversion:
> 
> commit 02ee7a4aa57b37d6003263b69b1852c4cda5975e
> Author: Alifer Moraes 
> Date:   Mon Feb 10 11:28:01 2020 -0300
> 
> mx6sabresd: Convert ethernet to driver model
> 
> Convert imx6sabresd ethernet to driver model to fix the following warning:
> 
> = WARNING ==
> This board does not use CONFIG_DM_ETH (Driver Model
> for Ethernet drivers). Please update the board to use
> CONFIG_DM_ETH before the v2020.07 release. Failure to
> update by the deadline may result in board removal.
> See doc/driver-model/migration.rst for more info.
> 
> 
> Signed-off-by: Alifer Moraes 
> Reviewed-by: Fabio Estevam 
> 
> Let us know if this helps.

I'm looking at the conversion now, thanks.

-- 
Tom


signature.asc
Description: PGP signature


  1   2   3   >