Re: [U-Boot] [PATCH v1 00/19] DM_I2C_COMPAT removal for all ti platforms

2018-10-05 Thread Adam Ford
On Thu, Oct 4, 2018 at 8:48 AM Jean-Jacques Hiblot  wrote:
>
> This series remove the usage of the DM_I2C_COMPAT option for all the ti
> platforms. It also takes this opportunity to not disable DM_I2C in the SPL.
>
> There are a couples of issues to fix:
> - CMD_EEPROM does not support the DM API. Fixed by removing this option
>   when DM_I2C is used without DM_I2C_COMPAT
> - i2c_get_chip_for_busnum() does not work when OF_CONTROL is not used
>   (as is the case with am33xx SPL).
> - The I2C driver do not support DM_I2C without OF_CONTROL.
> - Most of the PMIC drivers do not support the I2C DM API.
> - Board detection is done prior DM initialization. Fixed by moving it after
>   DM is initialized. That move breaks the DRA7 platforms (The fixes for
>   that are at the last 5 patches this series)
>
> When all this is taken care of DM_I2C_COMPAT can be removed and DM_I2C
> enabled in the SPL.
>
> This has been tested with the following boards:
> - am437x SK
> - am335x SK
> - am335x beaglebone (both DM and non-DM config)
> - dra76 evm
> - am572 evm
> - k2g evm
>
>
>
The whole series applied and

Tested-by: Adam Ford  #omap3_logic

adam
> Andreas Dannenberg (1):
>   ti: common: board_detect: Allow DM I2C without CONFIG_DM_I2C_COMPAT
>
> Jean-Jacques Hiblot (17):
>   cmd: Kconfig: Do not include EEPROM if DM_I2C is used without
> DM_I2C_COMPAT
>   dm: i2c: Add dm_i2c_probe_device() to test the presence of a chip
>   dm: device: Allow using uclass_find_device_by_seq() without OF_CONTROL
>   configs: am335x: am57x: dra7x: Enable CONFIG_SPL_DM_SEQ_ALIAS
>   i2c: omap24xx_i2c: Use platdata to probe the device
>   am335x: Register the I2C controllers if DM_I2C is used.
>   dts: am43x: omap5: Add node for I2C in SPL
>   omap: detect the board after DM is available
>   power: make most tps drivers and the twl4030 driver compatible with
> DM_I2C
>   configs: am335x_pdu001: Explicitly enable CONFIG_I2C_COMPAT
>   ti: remove usage of DM_I2C_COMPAT and don't disable DM_I2C in SPL
>   am57xx: remove non-DM I2C code
>   configs: dra7xx-evm: increase the size of the malloc's pool before
> relocation
>   lib: fdtdec: Add function re-setup the fdt more effeciently
>   drivers: core: Add the option SPL_DM_DEVICE_REMOVE to the Kconfig
>   drivers: core: nullify gd->dm_root after dm_uninit()
>   dra7: Allow selecting a new dtb after board detection.
>
> Vignesh R (1):
>   i2c: omap24xx_i2c: Move away from SoC specific headers for reg offset
>
>  arch/arm/dts/am437x-gp-evm-u-boot.dtsi   |   4 +
>  arch/arm/dts/omap5-u-boot.dtsi   |   4 +
>  arch/arm/include/asm/arch-am33xx/i2c.h   |  47 +--
>  arch/arm/include/asm/arch-omap3/i2c.h|  47 ---
>  arch/arm/include/asm/arch-omap4/i2c.h|  45 ---
>  arch/arm/include/asm/arch-omap5/i2c.h|  45 ---
>  arch/arm/include/asm/omap_i2c.h  |  24 ++
>  arch/arm/mach-keystone/ddr3_spd.c|   7 +
>  arch/arm/mach-omap2/am33xx/board.c   |  24 +-
>  arch/arm/mach-omap2/am33xx/clk_synthesizer.c |  56 +++-
>  arch/arm/mach-omap2/clocks-common.c  |   2 +
>  arch/arm/mach-omap2/hwinit-common.c  |  23 +-
>  board/ti/am335x/board.c  |  17 +-
>  board/ti/am335x/mux.c|  14 +
>  board/ti/am43xx/board.c  |  35 +-
>  board/ti/am57xx/board.c  |  25 +-
>  board/ti/common/board_detect.c   | 110 +++
>  board/ti/ks2_evm/board_k2g.c |  11 +
>  cmd/Kconfig  |   1 +
>  configs/am335x_pdu001_defconfig  |   2 +
>  configs/am57xx_evm_defconfig |   1 +
>  configs/am57xx_hs_evm_defconfig  |   1 +
>  configs/dra7xx_evm_defconfig |   4 +-
>  configs/dra7xx_hs_evm_defconfig  |   1 +
>  configs/omap3_logic_defconfig|   1 +
>  drivers/core/Kconfig |  12 +-
>  drivers/core/device.c|  10 +-
>  drivers/core/root.c  |   1 +
>  drivers/core/uclass.c|  24 ++
>  drivers/i2c/i2c-uclass.c |   8 +
>  drivers/i2c/omap24xx_i2c.c   | 467 
> ++-
>  drivers/power/palmas.c   |  39 +++
>  drivers/power/pmic/pmic_tps62362.c   |  27 ++
>  drivers/power/pmic/pmic_tps65217.c   |  47 ++-
>  drivers/power/pmic/pmic_tps65218.c   |  88 +
>  drivers/power/pmic/pmic_tps65910.c   |  60 +++-
>  drivers/power/twl4030.c  |  39 +++
>  include/asm-generic/global_data.h|   4 +
>  include/configs/am43xx_evm.h |   2 +
>  include/configs/ti_armv7_common.h|  18 +-
>  include/dm/uclass-internal.h |  13 +
>  include/fdtdec.h |  17 +
>  include/i2c.h|  13 +
>  include/palmas.h   

Re: [U-Boot] [PULL] rockchip patch-queue 2018-10-05

2018-10-05 Thread Tom Rini
On Fri, Oct 05, 2018 at 11:01:38PM +0200, Philipp Tomsich wrote:

> Tom,
> 
> Another set of fixes for u-boot-rockchip is ready for integration.
> A Travis-CI report is at 
> https://travis-ci.org/ptomsich/u-boot-rockchip/builds/437333443
> 
> Thanks,
> Philipp.
> 
> 
> The following changes since commit a1588ac8228881f9fe65539fa8e31f0ee3556864:
> 
>  Merge tag 'rockchip-for-v2018.11' of git://git.denx.de/u-boot-rockchip 
> (2018-10-03 12:09:19 -0400)
> 
> are available in the git repository at:
> 
>  git://git.denx.de/u-boot-rockchip.git tags/rockchip-for-v2018.11-rc2
> 
> for you to fetch changes up to f25c1755a715d0d1794bd0827549367c20182501:
> 
>  rockchip: Fix rkimage format for SPL boot over USB (2018-10-04 22:55:47 
> +0200)
> 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] Please pull ARC changes

2018-10-05 Thread Tom Rini
On Fri, Oct 05, 2018 at 02:10:16PM +, Alexey Brodkin wrote:

> Hi Tom,
> 
> he following changes since commit a1588ac8228881f9fe65539fa8e31f0ee3556864:
> 
>   Merge tag 'rockchip-for-v2018.11' of git://git.denx.de/u-boot-rockchip 
> (2018-10-03 12:09:19 -0400)
> 
> are available in the Git repository at:
> 
>   git://git.denx.de/u-boot-arc.git tags/arc-updates-for-2018.11-rc2
> 
> for you to fetch changes up to 5396e8b1dd0ad9741b04f506ef88b5fb49d4c82a:
> 
>   arc: Add support for IoT development kit (2018-10-05 16:57:00 +0300)
> 

Applied to u-boot/master, thanks!

-- 
Tom


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


[U-Boot] [PULL] u-boot-socfpga/master

2018-10-05 Thread Marek Vasut
The following changes since commit 592cd5defd4f71d34ffcbd8dd3326bc10f662e20:

  Merge branch 'master' of git://git.denx.de/u-boot-spi (2018-10-02
17:01:46 -0400)

are available in the Git repository at:

  git://git.denx.de/u-boot-socfpga.git master

for you to fetch changes up to 8be11fb3c1d8d89ff6b60bd3937efcea2dc9c91d:

  arm: socfpga: stratix10: add sgmii in phymode setup (2018-10-03
12:56:50 +0200)


Atsushi Nemoto (1):
  tools: socfpga: fix sfp_verify_header

Ley Foon Tan (2):
  gpio: dwapb_gpio: Change to use devm_kcalloc()
  arm: socfpga: Remove unused function socfpga_emac_manage_reset()

Ooi, Joyce (1):
  arm: socfpga: stratix10: add sgmii in phymode setup

 arch/arm/mach-socfpga/include/mach/reset_manager_s10.h |  2 --
 arch/arm/mach-socfpga/misc_s10.c   |  5 +++--
 arch/arm/mach-socfpga/reset_manager_s10.c  | 35
---
 drivers/gpio/dwapb_gpio.c  | 11 ++-
 tools/socfpgaimage.c   |  1 +
 5 files changed, 6 insertions(+), 48 deletions(-)
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PULL] u-boot-sh/master

2018-10-05 Thread Marek Vasut
The following changes since commit 592cd5defd4f71d34ffcbd8dd3326bc10f662e20:

  Merge branch 'master' of git://git.denx.de/u-boot-spi (2018-10-02
17:01:46 -0400)

are available in the Git repository at:

  git://git.denx.de/u-boot-sh.git master

for you to fetch changes up to 806df252c1dafea0bee40f70f7bae050c07ee0c9:

  ARM: rmobile: Enable PHY framework on Gen3 (2018-10-03 12:56:13 +0200)


Marek Vasut (5):
  ARM: dts: rmobile: Reinstate missing i2c6 on Porter
  ARM: rmobile: Repair TMU clock on Gen2
  ARM: rmobile: Mark 4-64GiB as DRAM on Gen3
  phy: rcar: Add R-Car Gen3 PHY driver
  ARM: rmobile: Enable PHY framework on Gen3

 arch/arm/dts/r8a7791-porter.dts |   5 +
 arch/arm/mach-rmobile/Kconfig   |   1 +
 arch/arm/mach-rmobile/memmap-gen3.c |   6 ++
 drivers/phy/Kconfig |   8 
 drivers/phy/Makefile|   1 +
 drivers/phy/phy-rcar-gen3.c | 161
+++
 include/configs/rcar-gen2-common.h  |   2 +-
 7 files changed, 183 insertions(+), 1 deletion(-)
 create mode 100644 drivers/phy/phy-rcar-gen3.c
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v1 1/4] arm: socfpga: stratix10: Add macros for mailbox's arguments

2018-10-05 Thread Marek Vasut
On 10/05/2018 07:12 PM, chee.hong@intel.com wrote:
> From: "Ang, Chee Hong" 
> 
> Add macros for specifying number of arguments in mailbox command.
> 
> Signed-off-by: Ang, Chee Hong 
> ---
>  arch/arm/mach-socfpga/include/mach/mailbox_s10.h | 6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/arch/arm/mach-socfpga/include/mach/mailbox_s10.h 
> b/arch/arm/mach-socfpga/include/mach/mailbox_s10.h
> index 660df35..94f60aa 100644
> --- a/arch/arm/mach-socfpga/include/mach/mailbox_s10.h
> +++ b/arch/arm/mach-socfpga/include/mach/mailbox_s10.h
> @@ -107,6 +107,12 @@ enum ALT_SDM_MBOX_RESP_CODE {
>  #define RECONFIG_STATUS_PIN_STATUS   2
>  #define RECONFIG_STATUS_SOFTFUNC_STATUS  3
>  
> +/* Macros for specifying number of arguments in mailbox command */
> +#define MBOX_NUM_ARGS(n, b)  ((n & 0xFF) << b)

(n) and (b)

> +#define MBOX_DIRECT_COUNT(n) MBOX_NUM_ARGS(n, 0)

(n) , fix globally

> +#define MBOX_ARG_DESC_COUNT(n)   
> MBOX_NUM_ARGS(n, 8)
> +#define MBOX_RESP_DESC_COUNT(n)  
> MBOX_NUM_ARGS(n, 16)
> +
>  #define MBOX_CFGSTAT_STATE_IDLE  0x
>  #define MBOX_CFGSTAT_STATE_CONFIG0x1000
>  #define MBOX_CFGSTAT_STATE_FAILACK   0x0800
> 


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


Re: [U-Boot] [PATCH v1 2/4] arm: socfpga: stratix10: Add Stratix 10 FPGA Reconfiguration Driver

2018-10-05 Thread Marek Vasut
On 10/05/2018 07:12 PM, chee.hong@intel.com wrote:
> From: "Ang, Chee Hong" 
> 
> Enable FPGA reconfiguration support for Stratix 10 SoC.
> 
> Signed-off-by: Ang, Chee Hong 
> ---
>  drivers/fpga/Kconfig |  11 ++
>  drivers/fpga/Makefile|   1 +
>  drivers/fpga/stratix10.c | 290 
> +++
>  include/altera.h |   4 +
>  4 files changed, 306 insertions(+)
>  create mode 100644 drivers/fpga/stratix10.c
> 
> diff --git a/drivers/fpga/Kconfig b/drivers/fpga/Kconfig
> index 50e9019..8f59193 100644
> --- a/drivers/fpga/Kconfig
> +++ b/drivers/fpga/Kconfig
> @@ -31,6 +31,17 @@ config FPGA_CYCLON2
> Enable FPGA driver for loading bitstream in BIT and BIN format
> on Altera Cyclone II device.
>  
> +config FPGA_STRATIX10
> + bool "Enable Altera FPGA driver for Stratix 10"
> + depends on TARGET_SOCFPGA_STRATIX10
> + select FPGA_ALTERA
> + help
> +   Say Y here to enable the Altera Stratix 10 FPGA specific driver
> +
> +   This provides common functionality for Altera Stratix 10 devices.
> +   Enable FPGA driver for writing bitstream into Altera Stratix10
> +   device.
> +
>  config FPGA_XILINX
>   bool "Enable Xilinx FPGA drivers"
>   select FPGA
> diff --git a/drivers/fpga/Makefile b/drivers/fpga/Makefile
> index 97d7d5d..5a778c1 100644
> --- a/drivers/fpga/Makefile
> +++ b/drivers/fpga/Makefile
> @@ -17,6 +17,7 @@ obj-$(CONFIG_FPGA_ACEX1K) += ACEX1K.o
>  obj-$(CONFIG_FPGA_CYCLON2) += cyclon2.o
>  obj-$(CONFIG_FPGA_STRATIX_II) += stratixII.o
>  obj-$(CONFIG_FPGA_STRATIX_V) += stratixv.o
> +obj-$(CONFIG_FPGA_STRATIX10) += stratix10.o
>  obj-$(CONFIG_FPGA_SOCFPGA) += socfpga.o
>  obj-$(CONFIG_TARGET_SOCFPGA_GEN5) += socfpga_gen5.o
>  obj-$(CONFIG_TARGET_SOCFPGA_ARRIA10) += socfpga_arria10.o
> diff --git a/drivers/fpga/stratix10.c b/drivers/fpga/stratix10.c
> new file mode 100644
> index 000..50e1544
> --- /dev/null
> +++ b/drivers/fpga/stratix10.c
> @@ -0,0 +1,290 @@
> +/*
> + * Copyright (C) 2017 Intel Corporation 
> + *
> + * SPDX-License-Identifier:  GPL-2.0
> + */
> +
> +#include 
> +#include 
> +#include 
> +
> +#define RECONFIG_STATUS_POLL_RESP_TIMEOUT_MS 6
> +#define RECONFIG_STATUS_INTERVAL_DELAY_US100
> +
> +static const struct mbox_cfgstat_state {
> + int err_no;
> + const char  *error_name;
> +} mbox_cfgstat_state[] = {
> + {MBOX_CFGSTAT_STATE_IDLE, "FPGA in idle mode."},
> + {MBOX_CFGSTAT_STATE_CONFIG, "FPGA in config mode."},
> + {MBOX_CFGSTAT_STATE_FAILACK, "Acknowledgement failed!"},
> + {MBOX_CFGSTAT_STATE_ERROR_INVALID, "Invalid bitstream!"},
> + {MBOX_CFGSTAT_STATE_ERROR_CORRUPT, "Corrupted bitstream!"},
> + {MBOX_CFGSTAT_STATE_ERROR_AUTH, "Authentication failed!"},
> + {MBOX_CFGSTAT_STATE_ERROR_CORE_IO, "I/O error!"},
> + {MBOX_CFGSTAT_STATE_ERROR_HARDWARE, "Hardware error!"},
> + {MBOX_CFGSTAT_STATE_ERROR_FAKE, "Fake error!"},
> + {MBOX_CFGSTAT_STATE_ERROR_BOOT_INFO, "Error in boot info!"},
> + {MBOX_CFGSTAT_STATE_ERROR_QSPI_ERROR, "Error in QSPI!"},
> + {MBOX_RESP_ERROR, "Mailbox general error!"},
> + {-ETIMEDOUT, "I/O timeout error"},
> + {-1, "Unknown error!"}
> +};
> +
> +#define MBOX_CFGSTAT_MAX \
> +   (sizeof(mbox_cfgstat_state) / sizeof(struct mbox_cfgstat_state))

Is that some form of ARRAY_SIZE() ?

> +static const char *mbox_cfgstat_to_str(int err)
> +{
> + int i;
> +
> + for (i = 0; i < MBOX_CFGSTAT_MAX - 1; i++) {
> + if (mbox_cfgstat_state[i].err_no == err)
> + return mbox_cfgstat_state[i].error_name;
> + }
> +
> + return mbox_cfgstat_state[MBOX_CFGSTAT_MAX - 1].error_name;
> +}
> +
> +/*
> + * Add the ongoing transaction's command ID into pending list and return
> + * the command ID for next transfer.
> + */
> +static u8 add_transfer(u32 *xfer_pending_list, size_t list_size, u8 id)
> +{
> + int i;
> +
> + for (i = 0; i < list_size; i++) {
> + if (!xfer_pending_list[i]) {

if (xfer...)
 continue;

...

> + xfer_pending_list[i] = id;
> + debug("Added xfer ID = %d\n", id);

Meaningful debug message would be nice.

> + /*
> +  * Increment command ID for next transaction.
> +  * Valid command ID (4 bits) is from 1 to 15.
> +  */
> + id = (id % 15) + 1;
> + break;
> + }
> + }
> +
> + return id;
> +}
> +
> +/*
> + * Check whether response ID match the command ID in the transfer
> + * pending list. If a match is found in the transfer pending list,
> + * it clears the transfer pending list and return the matched
> + * command ID.
> + */
> +static int get_and_clr_transfer(u32 *xfer_pending_list, size_t list_size,
> + u8 id)
> +{
> + int i;
> +
> + for (i = 0; i < 

Re: [U-Boot] [PATCH v1 3/4] arm: socfpga: stratix10: Add Stratix10 FPGA into FPGA device table

2018-10-05 Thread Marek Vasut
On 10/05/2018 07:12 PM, chee.hong@intel.com wrote:
> From: "Ang, Chee Hong" 
> 
> Enable 'fpga' command in u-boot. User will be able to use the fpga
> command to program the FPGA on Stratix10 SoC.
> 
> Signed-off-by: Ang, Chee Hong 
> ---
>  arch/arm/mach-socfpga/misc.c | 22 ++
>  arch/arm/mach-socfpga/misc_s10.c |  4 
>  drivers/fpga/altera.c|  6 ++
>  include/altera.h |  4 
>  4 files changed, 36 insertions(+)
> 
> diff --git a/arch/arm/mach-socfpga/misc.c b/arch/arm/mach-socfpga/misc.c
> index a4f6d5c..350aad1 100644
> --- a/arch/arm/mach-socfpga/misc.c
> +++ b/arch/arm/mach-socfpga/misc.c
> @@ -88,6 +88,27 @@ int overwrite_console(void)
>  #endif
>  
>  #ifdef CONFIG_FPGA
> +#ifdef CONFIG_FPGA_STRATIX10
> +/*
> + * FPGA programming support for SoC FPGA Stratix 10
> + */
> +static Altera_desc altera_fpga[] = {
> + {
> + /* Family */
> + Intel_FPGA_Stratix10,
> + /* Interface type */
> + secure_device_manager_mailbox,
> + /* No limitation as additional data will be ignored */
> + -1,
> + /* No device function table */
> + NULL,
> + /* Base interface address specified in driver */
> + NULL,
> + /* No cookie implementation */
> + 0
> + },
> +};
> +#else
>  /*
>   * FPGA programming support for SoC FPGA Cyclone V
>   */
> @@ -107,6 +128,7 @@ static Altera_desc altera_fpga[] = {
>   0
>   },
>  };
> +#endif
>  
>  /* add device descriptor to FPGA device table */
>  void socfpga_fpga_add(void)
> diff --git a/arch/arm/mach-socfpga/misc_s10.c 
> b/arch/arm/mach-socfpga/misc_s10.c
> index 918baac..7fb945c 100644
> --- a/arch/arm/mach-socfpga/misc_s10.c
> +++ b/arch/arm/mach-socfpga/misc_s10.c
> @@ -124,6 +124,10 @@ int arch_misc_init(void)
>  
>  int arch_early_init_r(void)
>  {
> +#ifdef CONFIG_FPGA
> + socfpga_fpga_add();

Can we have an empty implementation of this if CONFIG_FPGA is not
defined to avoid proliferation of ifdefs ?

> +#endif
> +
>   return 0;
>  }
>  
> diff --git a/drivers/fpga/altera.c b/drivers/fpga/altera.c
> index 9605554..7c8f518 100644
> --- a/drivers/fpga/altera.c
> +++ b/drivers/fpga/altera.c
> @@ -39,6 +39,9 @@ static const struct altera_fpga {
>  #if defined(CONFIG_FPGA_STRATIX_V)
>   { Altera_StratixV, "StratixV", stratixv_load, NULL, NULL },
>  #endif
> +#if defined(CONFIG_FPGA_STRATIX10)
> + { Intel_FPGA_Stratix10, "Stratix10", stratix10_load, NULL, NULL },
> +#endif
>  #if defined(CONFIG_FPGA_SOCFPGA)
>   { Altera_SoCFPGA, "SoC FPGA", socfpga_load, NULL, NULL },
>  #endif
> @@ -154,6 +157,9 @@ int altera_info(Altera_desc *desc)
>   case fast_passive_parallel_security:
>   printf("Fast Passive Parallel with Security (FPPS)\n");
>   break;
> + case secure_device_manager_mailbox:
> + puts("Secure Device Manager (SDM) Mailbox\n");
> + break;
>   /* Add new interface types here */
>   default:
>   printf("Unsupported interface type, %d\n", desc->iface);
> diff --git a/include/altera.h b/include/altera.h
> index 233b467..22d55cf 100644
> --- a/include/altera.h
> +++ b/include/altera.h
> @@ -39,6 +39,8 @@ enum altera_iface {
>   fast_passive_parallel,
>   /* fast passive parallel with security (FPPS) */
>   fast_passive_parallel_security,
> + /* secure device manager (SDM) mailbox */
> + secure_device_manager_mailbox,
>   /* insert all new types before this */
>   max_altera_iface_type,
>  };
> @@ -54,6 +56,8 @@ enum altera_family {
>   Altera_StratixII,
>   /* StratixV Family */
>   Altera_StratixV,
> + /* Stratix10 Family */
> + Intel_FPGA_Stratix10,
>   /* SoCFPGA Family */
>   Altera_SoCFPGA,
>  
> 


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


Re: [U-Boot] [PATCH v2] arm: socfpga: stratix10: Add generic FPGA reconfig mailbox API for S10

2018-10-05 Thread Marek Vasut
On 10/05/2018 07:05 PM, chee.hong@intel.com wrote:
> From: "Ang, Chee Hong" 
> 
> Add a generic mailbox API for FPGA reconfig status which can be
> called by others. This new function accepts 2 different mailbox
> commands: CONFIG_STATUS or RECONFIG_STATUS.
> 
> Signed-off-by: Ang, Chee Hong 

Applied, thanks

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


[U-Boot] [PULL] rockchip patch-queue 2018-10-05

2018-10-05 Thread Philipp Tomsich
Tom,

Another set of fixes for u-boot-rockchip is ready for integration.
A Travis-CI report is at 
https://travis-ci.org/ptomsich/u-boot-rockchip/builds/437333443

Thanks,
Philipp.


The following changes since commit a1588ac8228881f9fe65539fa8e31f0ee3556864:

 Merge tag 'rockchip-for-v2018.11' of git://git.denx.de/u-boot-rockchip 
(2018-10-03 12:09:19 -0400)

are available in the git repository at:

 git://git.denx.de/u-boot-rockchip.git tags/rockchip-for-v2018.11-rc2

for you to fetch changes up to f25c1755a715d0d1794bd0827549367c20182501:

 rockchip: Fix rkimage format for SPL boot over USB (2018-10-04 22:55:47 +0200)


Rockchip-focused changes for v2018.11-rc2:
- fixes to rkimage for SPL boot via USB
- fixes to make_fit_atf.py, incl. entry-point calculation and python3
  compatibility
- OP-TEE support for ARMv7-based SoCs
- fixes to RGMII/GMII selection on the RK3328


Andreas Färber (1):
 rockchip: make_fit_atf.py depends on u-boot

Daniel Gröber (1):
 rockchip: Fix rkimage format for SPL boot over USB

Janine Hagemann (2):
 net: gmac_rockchip: Fix a register write in rk3328_gmac_set_to_rgmii
 net: gmac_rockchip: Add handling for RGMII_ID/RXID/TXID

Kever Yang (3):
 rockchip: make_fit_atf: fix warning unit_address_vs_reg
 spl: add support to booting with OP-TEE
 rockchip: add fit source file for pack itb with op-tee

Mian Yousaf Kaukab (2):
 rockchip: make_fit_atf: use elf entry point
 rockchip: make_fit_atf: make python3 compatible

Makefile |  5 -
arch/arm/mach-rockchip/fit_spl_optee.its | 50 
++
arch/arm/mach-rockchip/make_fit_atf.py   | 96 
+---
common/spl/Kconfig   |  7 +++
common/spl/Makefile  |  1 +
common/spl/spl.c |  7 +++
common/spl/spl_optee.S   | 12 
drivers/net/gmac_rockchip.c  | 80 
+++-
include/spl.h| 13 +
tools/rkimage.c  |  5 ++---
10 files changed, 208 insertions(+), 68 deletions(-)
create mode 100644 arch/arm/mach-rockchip/fit_spl_optee.its
create mode 100644 common/spl/spl_optee.S

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


Re: [U-Boot] [PATCH] sf: Add auto detection of 4-byte mode (vs standard 3-byte mode)

2018-10-05 Thread Simon Goldschmidt

On 04.10.2018 17:16, Stefan Roese wrote:

Some SPI NOR chips only support 4-byte mode addressing. Here the default
3-byte mode does not work and leads to incorrect accesses. This patch
now reads the 4-byte mode status bit (in this case in the CR register
of the Macronix SPI NOR) and configures the SPI transfers accordingly.

This was noticed on the LinkIt Smart 7688 modul, which is equipped with
an Macronix MX25L25635F device. But this device does *NOT* support
switching to 3-byte mode via the EX4B command.

This should also work when the bootrom configures the SPI flash to
4-byte mode and runs U-Boot after this. U-Boot should dectect this

S/dectect/detect/

mode (if the 4-byte mode detection is available for this chip) and
use the correct OPs in this case.

Signed-off-by: Stefan Roese 
Cc: Jagan Teki 
Cc: Simon Goldschmidt 


I've successfully tested this on my socfpga_cyclone5 board. But I had to 
implement the detection for 'stmicro' flash. See below.



---
Please note that this patch replaces this one:

[PATCH] sf: Add SPI_FLASH_4BYTE_MODE_ONLY option to support 4-byte mode

which introduced a CONFIG option to enable this 4-byte mode. In discussion
with Simon we agreed, that an auto detection would be much better. Hence
this new version now.

  drivers/mtd/spi/sf_internal.h |  3 +-
  drivers/mtd/spi/spi_flash.c   | 94 +++
  include/spi_flash.h   |  5 ++
  3 files changed, 81 insertions(+), 21 deletions(-)

diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
index 4f63cacc64..eb076401d1 100644
--- a/drivers/mtd/spi/sf_internal.h
+++ b/drivers/mtd/spi/sf_internal.h
@@ -26,7 +26,8 @@ enum spi_nor_option_flags {
  };
  
  #define SPI_FLASH_3B_ADDR_LEN		3

-#define SPI_FLASH_CMD_LEN  (1 + SPI_FLASH_3B_ADDR_LEN)
+#define SPI_FLASH_4B_ADDR_LEN  4
+#define SPI_FLASH_CMD_MAX_LEN  (1 + SPI_FLASH_4B_ADDR_LEN)
  #define SPI_FLASH_16MB_BOUN   0x100
  
  /* CFI Manufacture ID's */

diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index c159124259..357b4f2422 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -20,12 +20,19 @@
  
  #include "sf_internal.h"
  
-static void spi_flash_addr(u32 addr, u8 *cmd)

+static void spi_flash_addr(struct spi_flash *flash, u32 addr, u8 *cmd)
  {
/* cmd[0] is actual command */
-   cmd[1] = addr >> 16;
-   cmd[2] = addr >> 8;
-   cmd[3] = addr >> 0;
+   if (flash->in_4byte_mode) {
+   cmd[1] = addr >> 24;
+   cmd[2] = addr >> 16;
+   cmd[3] = addr >> 8;
+   cmd[4] = addr >> 0;
+   } else {
+   cmd[1] = addr >> 16;
+   cmd[2] = addr >> 8;
+   cmd[3] = addr >> 0;
+   }
  }
  
  static int read_sr(struct spi_flash *flash, u8 *rs)

@@ -110,6 +117,33 @@ static int write_cr(struct spi_flash *flash, u8 wc)
  }
  #endif
  
+#if defined(CONFIG_SPI_FLASH_MACRONIX)

+static bool flash_in_4byte_mode(struct spi_flash *flash)


I renamed this function 'flash_in_4byte_mode_macronix()' as the current 
generic function name gives me name clashes when compiling with MACRONIX 
and STMICRO enabled, see below.



+{
+   int ret;
+   u8 cr;
+   u8 cmd;
+
+   cmd = 0x15; /* Macronix: read configuration register RDCR */
+   ret = spi_flash_read_common(flash, , 1, , 1);
+   if (ret < 0) {
+   debug("SF: fail to read config register\n");
+   return false;
+   }
+
+   /* Return true, if 4-byte mode is enabled */
+   if (cr & BIT(5))
+   return true;
+
+   return false;
+}
+#else


Here, I've added this function for STMICRO:
    #if defined(CONFIG_SPI_FLASH_STMICRO)
    static bool flash_in_4byte_mode_stmicro(struct spi_flash *flash)
    {
        int ret;
        u8 fsr;
        u8 cmd;

        cmd = 0x70;    /* STMicro/Micron: read flag status register */
        ret = spi_flash_read_common(flash, , 1, , 1);
        if (ret < 0) {
            debug("SF: fail to read config register\n");
            return false;
        }

        printf("flash_in_4byte_mode_stmicro(): fsr: 0x%02x\n", fsr);
        /* Return true, if 4-byte mode is enabled */
        if (fsr & BIT(0)) {
            return true;
        }

        return false;
    }
    #endif


+static bool flash_in_4byte_mode(struct spi_flash *flash)
+{
+   return false;
+}
+#endif
+
  #ifdef CONFIG_SPI_FLASH_BAR
  /*
   * This "clean_bar" is necessary in a situation when one was accessing
@@ -314,7 +348,7 @@ int spi_flash_write_common(struct spi_flash *flash, const 
u8 *cmd,
  int spi_flash_cmd_erase_ops(struct spi_flash *flash, u32 offset, size_t len)
  {
u32 erase_size, erase_addr;
-   u8 cmd[SPI_FLASH_CMD_LEN];
+   u8 cmd[SPI_FLASH_CMD_MAX_LEN];
int ret = -1;
  
  	erase_size = flash->erase_size;

@@ -344,12 +378,13 @@ int spi_flash_cmd_erase_ops(struct spi_flash *flash, u32 

[U-Boot] [PATCH v1 3/4] arm: socfpga: stratix10: Add Stratix10 FPGA into FPGA device table

2018-10-05 Thread chee . hong . ang
From: "Ang, Chee Hong" 

Enable 'fpga' command in u-boot. User will be able to use the fpga
command to program the FPGA on Stratix10 SoC.

Signed-off-by: Ang, Chee Hong 
---
 arch/arm/mach-socfpga/misc.c | 22 ++
 arch/arm/mach-socfpga/misc_s10.c |  4 
 drivers/fpga/altera.c|  6 ++
 include/altera.h |  4 
 4 files changed, 36 insertions(+)

diff --git a/arch/arm/mach-socfpga/misc.c b/arch/arm/mach-socfpga/misc.c
index a4f6d5c..350aad1 100644
--- a/arch/arm/mach-socfpga/misc.c
+++ b/arch/arm/mach-socfpga/misc.c
@@ -88,6 +88,27 @@ int overwrite_console(void)
 #endif
 
 #ifdef CONFIG_FPGA
+#ifdef CONFIG_FPGA_STRATIX10
+/*
+ * FPGA programming support for SoC FPGA Stratix 10
+ */
+static Altera_desc altera_fpga[] = {
+   {
+   /* Family */
+   Intel_FPGA_Stratix10,
+   /* Interface type */
+   secure_device_manager_mailbox,
+   /* No limitation as additional data will be ignored */
+   -1,
+   /* No device function table */
+   NULL,
+   /* Base interface address specified in driver */
+   NULL,
+   /* No cookie implementation */
+   0
+   },
+};
+#else
 /*
  * FPGA programming support for SoC FPGA Cyclone V
  */
@@ -107,6 +128,7 @@ static Altera_desc altera_fpga[] = {
0
},
 };
+#endif
 
 /* add device descriptor to FPGA device table */
 void socfpga_fpga_add(void)
diff --git a/arch/arm/mach-socfpga/misc_s10.c b/arch/arm/mach-socfpga/misc_s10.c
index 918baac..7fb945c 100644
--- a/arch/arm/mach-socfpga/misc_s10.c
+++ b/arch/arm/mach-socfpga/misc_s10.c
@@ -124,6 +124,10 @@ int arch_misc_init(void)
 
 int arch_early_init_r(void)
 {
+#ifdef CONFIG_FPGA
+   socfpga_fpga_add();
+#endif
+
return 0;
 }
 
diff --git a/drivers/fpga/altera.c b/drivers/fpga/altera.c
index 9605554..7c8f518 100644
--- a/drivers/fpga/altera.c
+++ b/drivers/fpga/altera.c
@@ -39,6 +39,9 @@ static const struct altera_fpga {
 #if defined(CONFIG_FPGA_STRATIX_V)
{ Altera_StratixV, "StratixV", stratixv_load, NULL, NULL },
 #endif
+#if defined(CONFIG_FPGA_STRATIX10)
+   { Intel_FPGA_Stratix10, "Stratix10", stratix10_load, NULL, NULL },
+#endif
 #if defined(CONFIG_FPGA_SOCFPGA)
{ Altera_SoCFPGA, "SoC FPGA", socfpga_load, NULL, NULL },
 #endif
@@ -154,6 +157,9 @@ int altera_info(Altera_desc *desc)
case fast_passive_parallel_security:
printf("Fast Passive Parallel with Security (FPPS)\n");
break;
+   case secure_device_manager_mailbox:
+   puts("Secure Device Manager (SDM) Mailbox\n");
+   break;
/* Add new interface types here */
default:
printf("Unsupported interface type, %d\n", desc->iface);
diff --git a/include/altera.h b/include/altera.h
index 233b467..22d55cf 100644
--- a/include/altera.h
+++ b/include/altera.h
@@ -39,6 +39,8 @@ enum altera_iface {
fast_passive_parallel,
/* fast passive parallel with security (FPPS) */
fast_passive_parallel_security,
+   /* secure device manager (SDM) mailbox */
+   secure_device_manager_mailbox,
/* insert all new types before this */
max_altera_iface_type,
 };
@@ -54,6 +56,8 @@ enum altera_family {
Altera_StratixII,
/* StratixV Family */
Altera_StratixV,
+   /* Stratix10 Family */
+   Intel_FPGA_Stratix10,
/* SoCFPGA Family */
Altera_SoCFPGA,
 
-- 
2.7.4

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


[U-Boot] [PATCH v1 4/4] arm: socfpga: stratix10: Enable Stratix10 FPGA Reconfiguration

2018-10-05 Thread chee . hong . ang
From: "Ang, Chee Hong" 

Enable Stratix10 FPGA reconfiguration support in defconfig.

Signed-off-by: Ang, Chee Hong 
---
 configs/socfpga_stratix10_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/socfpga_stratix10_defconfig 
b/configs/socfpga_stratix10_defconfig
index c78a11e..a1c94b0 100644
--- a/configs/socfpga_stratix10_defconfig
+++ b/configs/socfpga_stratix10_defconfig
@@ -10,6 +10,7 @@ CONFIG_NR_DRAM_BANKS=1
 CONFIG_BOOTDELAY=5
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_HUSH_PARSER=y
+CONFIG_FPGA_STRATIX10=y
 CONFIG_SYS_PROMPT="SOCFPGA_STRATIX10 # "
 CONFIG_CMD_MEMTEST=y
 # CONFIG_CMD_FLASH is not set
-- 
2.7.4

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


[U-Boot] [PATCH v1 2/4] arm: socfpga: stratix10: Add Stratix 10 FPGA Reconfiguration Driver

2018-10-05 Thread chee . hong . ang
From: "Ang, Chee Hong" 

Enable FPGA reconfiguration support for Stratix 10 SoC.

Signed-off-by: Ang, Chee Hong 
---
 drivers/fpga/Kconfig |  11 ++
 drivers/fpga/Makefile|   1 +
 drivers/fpga/stratix10.c | 290 +++
 include/altera.h |   4 +
 4 files changed, 306 insertions(+)
 create mode 100644 drivers/fpga/stratix10.c

diff --git a/drivers/fpga/Kconfig b/drivers/fpga/Kconfig
index 50e9019..8f59193 100644
--- a/drivers/fpga/Kconfig
+++ b/drivers/fpga/Kconfig
@@ -31,6 +31,17 @@ config FPGA_CYCLON2
  Enable FPGA driver for loading bitstream in BIT and BIN format
  on Altera Cyclone II device.
 
+config FPGA_STRATIX10
+   bool "Enable Altera FPGA driver for Stratix 10"
+   depends on TARGET_SOCFPGA_STRATIX10
+   select FPGA_ALTERA
+   help
+ Say Y here to enable the Altera Stratix 10 FPGA specific driver
+
+ This provides common functionality for Altera Stratix 10 devices.
+ Enable FPGA driver for writing bitstream into Altera Stratix10
+ device.
+
 config FPGA_XILINX
bool "Enable Xilinx FPGA drivers"
select FPGA
diff --git a/drivers/fpga/Makefile b/drivers/fpga/Makefile
index 97d7d5d..5a778c1 100644
--- a/drivers/fpga/Makefile
+++ b/drivers/fpga/Makefile
@@ -17,6 +17,7 @@ obj-$(CONFIG_FPGA_ACEX1K) += ACEX1K.o
 obj-$(CONFIG_FPGA_CYCLON2) += cyclon2.o
 obj-$(CONFIG_FPGA_STRATIX_II) += stratixII.o
 obj-$(CONFIG_FPGA_STRATIX_V) += stratixv.o
+obj-$(CONFIG_FPGA_STRATIX10) += stratix10.o
 obj-$(CONFIG_FPGA_SOCFPGA) += socfpga.o
 obj-$(CONFIG_TARGET_SOCFPGA_GEN5) += socfpga_gen5.o
 obj-$(CONFIG_TARGET_SOCFPGA_ARRIA10) += socfpga_arria10.o
diff --git a/drivers/fpga/stratix10.c b/drivers/fpga/stratix10.c
new file mode 100644
index 000..50e1544
--- /dev/null
+++ b/drivers/fpga/stratix10.c
@@ -0,0 +1,290 @@
+/*
+ * Copyright (C) 2017 Intel Corporation 
+ *
+ * SPDX-License-Identifier:GPL-2.0
+ */
+
+#include 
+#include 
+#include 
+
+#define RECONFIG_STATUS_POLL_RESP_TIMEOUT_MS   6
+#define RECONFIG_STATUS_INTERVAL_DELAY_US  100
+
+static const struct mbox_cfgstat_state {
+   int err_no;
+   const char  *error_name;
+} mbox_cfgstat_state[] = {
+   {MBOX_CFGSTAT_STATE_IDLE, "FPGA in idle mode."},
+   {MBOX_CFGSTAT_STATE_CONFIG, "FPGA in config mode."},
+   {MBOX_CFGSTAT_STATE_FAILACK, "Acknowledgement failed!"},
+   {MBOX_CFGSTAT_STATE_ERROR_INVALID, "Invalid bitstream!"},
+   {MBOX_CFGSTAT_STATE_ERROR_CORRUPT, "Corrupted bitstream!"},
+   {MBOX_CFGSTAT_STATE_ERROR_AUTH, "Authentication failed!"},
+   {MBOX_CFGSTAT_STATE_ERROR_CORE_IO, "I/O error!"},
+   {MBOX_CFGSTAT_STATE_ERROR_HARDWARE, "Hardware error!"},
+   {MBOX_CFGSTAT_STATE_ERROR_FAKE, "Fake error!"},
+   {MBOX_CFGSTAT_STATE_ERROR_BOOT_INFO, "Error in boot info!"},
+   {MBOX_CFGSTAT_STATE_ERROR_QSPI_ERROR, "Error in QSPI!"},
+   {MBOX_RESP_ERROR, "Mailbox general error!"},
+   {-ETIMEDOUT, "I/O timeout error"},
+   {-1, "Unknown error!"}
+};
+
+#define MBOX_CFGSTAT_MAX \
+ (sizeof(mbox_cfgstat_state) / sizeof(struct mbox_cfgstat_state))
+
+static const char *mbox_cfgstat_to_str(int err)
+{
+   int i;
+
+   for (i = 0; i < MBOX_CFGSTAT_MAX - 1; i++) {
+   if (mbox_cfgstat_state[i].err_no == err)
+   return mbox_cfgstat_state[i].error_name;
+   }
+
+   return mbox_cfgstat_state[MBOX_CFGSTAT_MAX - 1].error_name;
+}
+
+/*
+ * Add the ongoing transaction's command ID into pending list and return
+ * the command ID for next transfer.
+ */
+static u8 add_transfer(u32 *xfer_pending_list, size_t list_size, u8 id)
+{
+   int i;
+
+   for (i = 0; i < list_size; i++) {
+   if (!xfer_pending_list[i]) {
+   xfer_pending_list[i] = id;
+   debug("Added xfer ID = %d\n", id);
+   /*
+* Increment command ID for next transaction.
+* Valid command ID (4 bits) is from 1 to 15.
+*/
+   id = (id % 15) + 1;
+   break;
+   }
+   }
+
+   return id;
+}
+
+/*
+ * Check whether response ID match the command ID in the transfer
+ * pending list. If a match is found in the transfer pending list,
+ * it clears the transfer pending list and return the matched
+ * command ID.
+ */
+static int get_and_clr_transfer(u32 *xfer_pending_list, size_t list_size,
+   u8 id)
+{
+   int i;
+
+   for (i = 0; i < list_size; i++) {
+   if (id == xfer_pending_list[i]) {
+   xfer_pending_list[i] = 0;
+   return id;
+   }
+   }
+
+   return 0;
+}
+
+/*
+ * Polling the FPGA configuration status.
+ * Return 0 for success, non-zero for error.
+ */
+static int 

[U-Boot] [PATCH v1 0/4] Stratix10 FPGA reconfiguration support

2018-10-05 Thread chee . hong . ang
From: "Ang, Chee Hong" 

This patch enable FPGA reconfiguration for Stratix10 SoC.
This patch works on top of:
https://lists.denx.de/pipermail/u-boot/2018-September/342465.html

Ang, Chee Hong (4):
  arm: socfpga: stratix10: Add macros for mailbox's arguments
  arm: socfpga: stratix10: Add Stratix 10 FPGA Reconfiguration Driver
  arm: socfpga: stratix10: Add Stratix10 FPGA into FPGA device table
  arm: socfpga: stratix10: Enable Stratix10 FPGA Reconfiguration

 arch/arm/mach-socfpga/include/mach/mailbox_s10.h |   6 +
 arch/arm/mach-socfpga/misc.c |  22 ++
 arch/arm/mach-socfpga/misc_s10.c |   4 +
 configs/socfpga_stratix10_defconfig  |   1 +
 drivers/fpga/Kconfig |  11 +
 drivers/fpga/Makefile|   1 +
 drivers/fpga/altera.c|   6 +
 drivers/fpga/stratix10.c | 290 +++
 include/altera.h |   8 +
 9 files changed, 349 insertions(+)
 create mode 100644 drivers/fpga/stratix10.c

-- 
2.7.4

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


[U-Boot] [PATCH v1 1/4] arm: socfpga: stratix10: Add macros for mailbox's arguments

2018-10-05 Thread chee . hong . ang
From: "Ang, Chee Hong" 

Add macros for specifying number of arguments in mailbox command.

Signed-off-by: Ang, Chee Hong 
---
 arch/arm/mach-socfpga/include/mach/mailbox_s10.h | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/mach-socfpga/include/mach/mailbox_s10.h 
b/arch/arm/mach-socfpga/include/mach/mailbox_s10.h
index 660df35..94f60aa 100644
--- a/arch/arm/mach-socfpga/include/mach/mailbox_s10.h
+++ b/arch/arm/mach-socfpga/include/mach/mailbox_s10.h
@@ -107,6 +107,12 @@ enum ALT_SDM_MBOX_RESP_CODE {
 #define RECONFIG_STATUS_PIN_STATUS 2
 #define RECONFIG_STATUS_SOFTFUNC_STATUS3
 
+/* Macros for specifying number of arguments in mailbox command */
+#define MBOX_NUM_ARGS(n, b)((n & 0xFF) << b)
+#define MBOX_DIRECT_COUNT(n)   MBOX_NUM_ARGS(n, 0)
+#define MBOX_ARG_DESC_COUNT(n) MBOX_NUM_ARGS(n, 8)
+#define MBOX_RESP_DESC_COUNT(n)
MBOX_NUM_ARGS(n, 16)
+
 #define MBOX_CFGSTAT_STATE_IDLE0x
 #define MBOX_CFGSTAT_STATE_CONFIG  0x1000
 #define MBOX_CFGSTAT_STATE_FAILACK 0x0800
-- 
2.7.4

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


[U-Boot] [PATCH v2] Add generic FPGA reconfig mailbox API for S10

2018-10-05 Thread chee . hong . ang
From: "Ang, Chee Hong" 

This patch is v2 for:
https://lists.denx.de/pipermail/u-boot/2018-September/342465.html

Ang, Chee Hong (1):
  arm: socfpga: stratix10: Add generic FPGA reconfig mailbox API for S10

 arch/arm/mach-socfpga/include/mach/mailbox_s10.h |  3 +-
 arch/arm/mach-socfpga/mailbox_s10.c  | 48 
 2 files changed, 50 insertions(+), 1 deletion(-)

-- 
2.7.4

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


[U-Boot] [PATCH v2] arm: socfpga: stratix10: Add generic FPGA reconfig mailbox API for S10

2018-10-05 Thread chee . hong . ang
From: "Ang, Chee Hong" 

Add a generic mailbox API for FPGA reconfig status which can be
called by others. This new function accepts 2 different mailbox
commands: CONFIG_STATUS or RECONFIG_STATUS.

Signed-off-by: Ang, Chee Hong 
---
 arch/arm/mach-socfpga/include/mach/mailbox_s10.h |  3 +-
 arch/arm/mach-socfpga/mailbox_s10.c  | 48 
 2 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-socfpga/include/mach/mailbox_s10.h 
b/arch/arm/mach-socfpga/include/mach/mailbox_s10.h
index 81a609d..660df35 100644
--- a/arch/arm/mach-socfpga/include/mach/mailbox_s10.h
+++ b/arch/arm/mach-socfpga/include/mach/mailbox_s10.h
@@ -140,5 +140,6 @@ int mbox_qspi_open(void);
 #endif
 
 int mbox_reset_cold(void);
-
+int mbox_get_fpga_config_status(u32 cmd);
+int mbox_get_fpga_config_status_psci(u32 cmd);
 #endif /* _MAILBOX_S10_H_ */
diff --git a/arch/arm/mach-socfpga/mailbox_s10.c 
b/arch/arm/mach-socfpga/mailbox_s10.c
index 0d906c3..3c33223 100644
--- a/arch/arm/mach-socfpga/mailbox_s10.c
+++ b/arch/arm/mach-socfpga/mailbox_s10.c
@@ -342,6 +342,54 @@ int mbox_reset_cold(void)
return 0;
 }
 
+/* Accepted commands: CONFIG_STATUS or RECONFIG_STATUS */
+static __always_inline int mbox_get_fpga_config_status_common(u32 cmd)
+{
+   u32 reconfig_status_resp_len;
+   u32 reconfig_status_resp[RECONFIG_STATUS_RESPONSE_LEN];
+   int ret;
+
+   reconfig_status_resp_len = RECONFIG_STATUS_RESPONSE_LEN;
+   ret = mbox_send_cmd_common(MBOX_ID_UBOOT, cmd,
+  MBOX_CMD_DIRECT, 0, NULL, 0,
+  _status_resp_len,
+  reconfig_status_resp);
+
+   if (ret)
+   return ret;
+
+   /* Check for any error */
+   ret = reconfig_status_resp[RECONFIG_STATUS_STATE];
+   if (ret && ret != MBOX_CFGSTAT_STATE_CONFIG)
+   return ret;
+
+   /* Make sure nStatus is not 0 */
+   ret = reconfig_status_resp[RECONFIG_STATUS_PIN_STATUS];
+   if (!(ret & RCF_PIN_STATUS_NSTATUS))
+   return MBOX_CFGSTAT_STATE_ERROR_HARDWARE;
+
+   ret = reconfig_status_resp[RECONFIG_STATUS_SOFTFUNC_STATUS];
+   if (ret & RCF_SOFTFUNC_STATUS_SEU_ERROR)
+   return MBOX_CFGSTAT_STATE_ERROR_HARDWARE;
+
+   if ((ret & RCF_SOFTFUNC_STATUS_CONF_DONE) &&
+   (ret & RCF_SOFTFUNC_STATUS_INIT_DONE) &&
+   !reconfig_status_resp[RECONFIG_STATUS_STATE])
+   return 0;   /* configuration success */
+
+   return MBOX_CFGSTAT_STATE_CONFIG;
+}
+
+int mbox_get_fpga_config_status(u32 cmd)
+{
+   return mbox_get_fpga_config_status_common(cmd);
+}
+
+int __secure mbox_get_fpga_config_status_psci(u32 cmd)
+{
+   return mbox_get_fpga_config_status_common(cmd);
+}
+
 int mbox_send_cmd(u8 id, u32 cmd, u8 is_indirect, u32 len, u32 *arg,
  u8 urgent, u32 *resp_buf_len, u32 *resp_buf)
 {
-- 
2.7.4

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


[U-Boot] [PATCH v2 00/19] DM_I2C_COMPAT removal for all ti platforms

2018-10-05 Thread Jean-Jacques Hiblot
This series remove the usage of the DM_I2C_COMPAT option for all the ti
platforms. It also takes this opportunity to not disable DM_I2C in the SPL.

There are a couples of issues to fix:
- CMD_EEPROM does not support the DM API. Fixed by removing this option
  when DM_I2C is used without DM_I2C_COMPAT
- i2c_get_chip_for_busnum() does not work when OF_CONTROL is not used
  (as is the case with am33xx SPL).
- The I2C driver do not support DM_I2C without OF_CONTROL.
- Most of the PMIC drivers do not support the I2C DM API.
- Board detection is done prior DM initialization. Fixed by moving it after
  DM is initialized. That move breaks the DRA7 platforms (The fixes for
  that are at the last 5 patches this series)

When all this is taken care of DM_I2C_COMPAT can be removed and DM_I2C
enabled in the SPL.

This has been tested with the following boards:
- am437x SK
- am335x SK
- am335x beaglebone (both DM and non-DM config)
- dra76 evm
- am572 evm
- k2g evm

The following targets may be impacted by the changes related to
SPL_OF_CONTROL and SPL_OF_PLATDATA:
- am3517_evm_defconfig
- omap3_logic_defconfig
- chromebit_mickey_defconfig
- chromebook_jerry_defconfig
- chromebook_minnie_defconfig
- evb-rk3399_defconfig
- rock_defconfig

It would be nice it some of you could try to boot them.


Changes in v2:
- Add missing commit log to the commit disabling CMD_EEPROM when non-DM API
  is not available
- don't use the DT to find the req_seq number if SPL_OF_PLATDATA is used.
  Instead do it as if SPL_OF_CONTROL is not defined.
- Also add DM_I2C support to the twl6030 driver
- remove the remaining non-DM I2C API call for pdu001 board.
- Fixed warning in power_init_board() for the am43xx ti boards.

Andreas Dannenberg (1):
  ti: common: board_detect: Allow DM I2C without CONFIG_DM_I2C_COMPAT

Jean-Jacques Hiblot (17):
  cmd: Kconfig: Do not include EEPROM if DM_I2C is used without
DM_I2C_COMPAT
  dm: i2c: Add dm_i2c_probe_device() to test the presence of a chip
  dm: device: Allow using uclass_find_device_by_seq() without OF_CONTROL
  configs: am335x: am57x: dra7x: Enable CONFIG_SPL_DM_SEQ_ALIAS
  i2c: omap24xx_i2c: Use platdata to probe the device
  am335x: Register the I2C controllers if DM_I2C is used.
  dts: am43x: omap5: Add node for I2C in SPL
  omap: detect the board after DM is available
  power: make most tps drivers and the twl4030 driver compatible with
DM_I2C
  configs: am335x_pdu001: remove CONFIG_DM_I2C_COMPAT
  ti: remove usage of DM_I2C_COMPAT and don't disable DM_I2C in SPL
  am57xx: remove non-DM I2C code
  configs: dra7xx-evm: increase the size of the malloc's pool before
relocation
  lib: fdtdec: Add function re-setup the fdt more effeciently
  drivers: core: Add the option SPL_DM_DEVICE_REMOVE to the Kconfig
  drivers: core: nullify gd->dm_root after dm_uninit()
  dra7: Allow selecting a new dtb after board detection.

Vignesh R (1):
  i2c: omap24xx_i2c: Move away from SoC specific headers for reg offset

 arch/arm/dts/am437x-gp-evm-u-boot.dtsi   |   4 +
 arch/arm/dts/omap5-u-boot.dtsi   |   4 +
 arch/arm/include/asm/arch-am33xx/i2c.h   |  47 +--
 arch/arm/include/asm/arch-omap3/i2c.h|  47 ---
 arch/arm/include/asm/arch-omap4/i2c.h|  45 ---
 arch/arm/include/asm/arch-omap5/i2c.h|  45 ---
 arch/arm/include/asm/omap_i2c.h  |  24 ++
 arch/arm/mach-keystone/ddr3_spd.c|   7 +
 arch/arm/mach-omap2/am33xx/board.c   |  24 +-
 arch/arm/mach-omap2/am33xx/clk_synthesizer.c |  56 +++-
 arch/arm/mach-omap2/clocks-common.c  |   2 +
 arch/arm/mach-omap2/hwinit-common.c  |  23 +-
 board/eets/pdu001/board.c|   1 -
 board/ti/am335x/board.c  |  17 +-
 board/ti/am335x/mux.c|  14 +
 board/ti/am43xx/board.c  |  46 ++-
 board/ti/am57xx/board.c  |  25 +-
 board/ti/common/board_detect.c   | 110 +++
 board/ti/ks2_evm/board_k2g.c |  11 +
 cmd/Kconfig  |   1 +
 configs/am335x_pdu001_defconfig  |   1 +
 configs/am57xx_evm_defconfig |   1 +
 configs/am57xx_hs_evm_defconfig  |   1 +
 configs/dra7xx_evm_defconfig |   4 +-
 configs/dra7xx_hs_evm_defconfig  |   1 +
 configs/omap3_logic_defconfig|   1 +
 drivers/core/Kconfig |  12 +-
 drivers/core/device.c|  10 +-
 drivers/core/root.c  |   1 +
 drivers/core/uclass.c|  24 ++
 drivers/i2c/i2c-uclass.c |   8 +
 drivers/i2c/omap24xx_i2c.c   | 467 ++-
 drivers/power/palmas.c   |  39 +++
 drivers/power/pmic/pmic_tps62362.c   |  27 ++
 drivers/power/pmic/pmic_tps65217.c   |  47 ++-
 drivers/power/pmic/pmic_tps65218.c   |  88 +
 

Re: [U-Boot] [PATCH v2 00/19] DM_I2C_COMPAT removal for all ti platforms

2018-10-05 Thread Adam Ford
On Fri, Oct 5, 2018 at 11:45 AM Jean-Jacques Hiblot  wrote:
>
> This series remove the usage of the DM_I2C_COMPAT option for all the ti
> platforms. It also takes this opportunity to not disable DM_I2C in the SPL.
>
> There are a couples of issues to fix:
> - CMD_EEPROM does not support the DM API. Fixed by removing this option
>   when DM_I2C is used without DM_I2C_COMPAT
> - i2c_get_chip_for_busnum() does not work when OF_CONTROL is not used
>   (as is the case with am33xx SPL).
> - The I2C driver do not support DM_I2C without OF_CONTROL.
> - Most of the PMIC drivers do not support the I2C DM API.
> - Board detection is done prior DM initialization. Fixed by moving it after
>   DM is initialized. That move breaks the DRA7 platforms (The fixes for
>   that are at the last 5 patches this series)
>
> When all this is taken care of DM_I2C_COMPAT can be removed and DM_I2C
> enabled in the SPL.
>
> This has been tested with the following boards:
> - am437x SK
> - am335x SK
> - am335x beaglebone (both DM and non-DM config)
> - dra76 evm
> - am572 evm
> - k2g evm
>
> The following targets may be impacted by the changes related to
> SPL_OF_CONTROL and SPL_OF_PLATDATA:
> - am3517_evm_defconfig
> - omap3_logic_defconfig
> - chromebit_mickey_defconfig
> - chromebook_jerry_defconfig
> - chromebook_minnie_defconfig
> - evb-rk3399_defconfig
> - rock_defconfig
>
> It would be nice it some of you could try to boot them.

I was planning on running some tests this afternoon.  IIRC, the
PLATDATA was required in SPL on omap3_logic because the OF code didn't
fit into the limited space.  I was also going to see if that's
changed. Ideally, I'd like to lose the PLATDATA flag as well, but it's
been a few releases, and GCC is newer now, so things may have changed.
:-)

Once I've run those build tests on omap3_logic and am3517_evm, I'll
run some additional tests on the TWL4030 to see if the reset of the
features work (like USB tranceiver), and I'll report back my findings.
If you've got it building, then I have a much better shot.

adam
>
>
> Changes in v2:
> - Add missing commit log to the commit disabling CMD_EEPROM when non-DM API
>   is not available
> - don't use the DT to find the req_seq number if SPL_OF_PLATDATA is used.
>   Instead do it as if SPL_OF_CONTROL is not defined.
> - Also add DM_I2C support to the twl6030 driver
> - remove the remaining non-DM I2C API call for pdu001 board.
> - Fixed warning in power_init_board() for the am43xx ti boards.
>
> Andreas Dannenberg (1):
>   ti: common: board_detect: Allow DM I2C without CONFIG_DM_I2C_COMPAT
>
> Jean-Jacques Hiblot (17):
>   cmd: Kconfig: Do not include EEPROM if DM_I2C is used without
> DM_I2C_COMPAT
>   dm: i2c: Add dm_i2c_probe_device() to test the presence of a chip
>   dm: device: Allow using uclass_find_device_by_seq() without OF_CONTROL
>   configs: am335x: am57x: dra7x: Enable CONFIG_SPL_DM_SEQ_ALIAS
>   i2c: omap24xx_i2c: Use platdata to probe the device
>   am335x: Register the I2C controllers if DM_I2C is used.
>   dts: am43x: omap5: Add node for I2C in SPL
>   omap: detect the board after DM is available
>   power: make most tps drivers and the twl4030 driver compatible with
> DM_I2C
>   configs: am335x_pdu001: remove CONFIG_DM_I2C_COMPAT
>   ti: remove usage of DM_I2C_COMPAT and don't disable DM_I2C in SPL
>   am57xx: remove non-DM I2C code
>   configs: dra7xx-evm: increase the size of the malloc's pool before
> relocation
>   lib: fdtdec: Add function re-setup the fdt more effeciently
>   drivers: core: Add the option SPL_DM_DEVICE_REMOVE to the Kconfig
>   drivers: core: nullify gd->dm_root after dm_uninit()
>   dra7: Allow selecting a new dtb after board detection.
>
> Vignesh R (1):
>   i2c: omap24xx_i2c: Move away from SoC specific headers for reg offset
>
>  arch/arm/dts/am437x-gp-evm-u-boot.dtsi   |   4 +
>  arch/arm/dts/omap5-u-boot.dtsi   |   4 +
>  arch/arm/include/asm/arch-am33xx/i2c.h   |  47 +--
>  arch/arm/include/asm/arch-omap3/i2c.h|  47 ---
>  arch/arm/include/asm/arch-omap4/i2c.h|  45 ---
>  arch/arm/include/asm/arch-omap5/i2c.h|  45 ---
>  arch/arm/include/asm/omap_i2c.h  |  24 ++
>  arch/arm/mach-keystone/ddr3_spd.c|   7 +
>  arch/arm/mach-omap2/am33xx/board.c   |  24 +-
>  arch/arm/mach-omap2/am33xx/clk_synthesizer.c |  56 +++-
>  arch/arm/mach-omap2/clocks-common.c  |   2 +
>  arch/arm/mach-omap2/hwinit-common.c  |  23 +-
>  board/eets/pdu001/board.c|   1 -
>  board/ti/am335x/board.c  |  17 +-
>  board/ti/am335x/mux.c|  14 +
>  board/ti/am43xx/board.c  |  46 ++-
>  board/ti/am57xx/board.c  |  25 +-
>  board/ti/common/board_detect.c   | 110 +++
>  board/ti/ks2_evm/board_k2g.c |  11 +
>  cmd/Kconfig  |   1 +
>  configs/am335x_pdu001_defconfig  |   1 +
>  

Re: [U-Boot] [PATCH v1 00/19] DM_I2C_COMPAT removal for all ti platforms

2018-10-05 Thread Jean-Jacques Hiblot



On 05/10/2018 13:59, Lokesh Vutla wrote:

Hi JJ,

On Thursday 04 October 2018 07:17 PM, Jean-Jacques Hiblot wrote:

This series remove the usage of the DM_I2C_COMPAT option for all the ti
platforms. It also takes this opportunity to not disable DM_I2C in 
the SPL.


There are a couples of issues to fix:
- CMD_EEPROM does not support the DM API. Fixed by removing this option
   when DM_I2C is used without DM_I2C_COMPAT
- i2c_get_chip_for_busnum() does not work when OF_CONTROL is not used
   (as is the case with am33xx SPL).
- The I2C driver do not support DM_I2C without OF_CONTROL.
- Most of the PMIC drivers do not support the I2C DM API.
- Board detection is done prior DM initialization. Fixed by moving it 
after

   DM is initialized. That move breaks the DRA7 platforms (The fixes for
   that are at the last 5 patches this series)

When all this is taken care of DM_I2C_COMPAT can be removed and DM_I2C
enabled in the SPL.

This has been tested with the following boards:
- am437x SK
- am335x SK
- am335x beaglebone (both DM and non-DM config)
- dra76 evm
- am572 evm
- k2g evm


I triggered a Travis-CI buid[1] for this series and there are 2 build 
failures. Can you check?
Should be fixed in the v2. It passes buildman on my machine, but we may 
not have the same default compiler flags.

Thanks,
JJ


[1] https://travis-ci.org/lokeshvutla/u-boot/builds/437487725

Thanks and regards,
Lokesh



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


Re: [U-Boot] [PATCH v2 00/19] DM_I2C_COMPAT removal for all ti platforms

2018-10-05 Thread Jean-Jacques Hiblot



On 05/10/2018 18:53, Adam Ford wrote:

On Fri, Oct 5, 2018 at 11:45 AM Jean-Jacques Hiblot  wrote:

This series remove the usage of the DM_I2C_COMPAT option for all the ti
platforms. It also takes this opportunity to not disable DM_I2C in the SPL.

There are a couples of issues to fix:
- CMD_EEPROM does not support the DM API. Fixed by removing this option
   when DM_I2C is used without DM_I2C_COMPAT
- i2c_get_chip_for_busnum() does not work when OF_CONTROL is not used
   (as is the case with am33xx SPL).
- The I2C driver do not support DM_I2C without OF_CONTROL.
- Most of the PMIC drivers do not support the I2C DM API.
- Board detection is done prior DM initialization. Fixed by moving it after
   DM is initialized. That move breaks the DRA7 platforms (The fixes for
   that are at the last 5 patches this series)

When all this is taken care of DM_I2C_COMPAT can be removed and DM_I2C
enabled in the SPL.

This has been tested with the following boards:
- am437x SK
- am335x SK
- am335x beaglebone (both DM and non-DM config)
- dra76 evm
- am572 evm
- k2g evm

The following targets may be impacted by the changes related to
SPL_OF_CONTROL and SPL_OF_PLATDATA:
- am3517_evm_defconfig
- omap3_logic_defconfig
- chromebit_mickey_defconfig
- chromebook_jerry_defconfig
- chromebook_minnie_defconfig
- evb-rk3399_defconfig
- rock_defconfig

It would be nice it some of you could try to boot them.

I was planning on running some tests this afternoon.  IIRC, the
PLATDATA was required in SPL on omap3_logic because the OF code didn't
fit into the limited space.  I was also going to see if that's
changed. Ideally, I'd like to lose the PLATDATA flag as well, but it's
been a few releases, and GCC is newer now, so things may have changed.
:-)

Once I've run those build tests on omap3_logic and am3517_evm, I'll
run some additional tests on the TWL4030 to see if the reset of the
features work (like USB tranceiver), and I'll report back my findings.
If you've got it building, then I have a much better shot.

Thanks for testing.
You shouldn't need either SPL_OF_CONTROL or SPL_OF_PLATDATA: the dtb 
produced for the SPL of omap3_logic_defconfig is empty

You can check with: dtc -I dtb -O dts spl/u-boot-spl.dtb

JJ


adam


Changes in v2:
- Add missing commit log to the commit disabling CMD_EEPROM when non-DM API
   is not available
- don't use the DT to find the req_seq number if SPL_OF_PLATDATA is used.
   Instead do it as if SPL_OF_CONTROL is not defined.
- Also add DM_I2C support to the twl6030 driver
- remove the remaining non-DM I2C API call for pdu001 board.
- Fixed warning in power_init_board() for the am43xx ti boards.

Andreas Dannenberg (1):
   ti: common: board_detect: Allow DM I2C without CONFIG_DM_I2C_COMPAT

Jean-Jacques Hiblot (17):
   cmd: Kconfig: Do not include EEPROM if DM_I2C is used without
 DM_I2C_COMPAT
   dm: i2c: Add dm_i2c_probe_device() to test the presence of a chip
   dm: device: Allow using uclass_find_device_by_seq() without OF_CONTROL
   configs: am335x: am57x: dra7x: Enable CONFIG_SPL_DM_SEQ_ALIAS
   i2c: omap24xx_i2c: Use platdata to probe the device
   am335x: Register the I2C controllers if DM_I2C is used.
   dts: am43x: omap5: Add node for I2C in SPL
   omap: detect the board after DM is available
   power: make most tps drivers and the twl4030 driver compatible with
 DM_I2C
   configs: am335x_pdu001: remove CONFIG_DM_I2C_COMPAT
   ti: remove usage of DM_I2C_COMPAT and don't disable DM_I2C in SPL
   am57xx: remove non-DM I2C code
   configs: dra7xx-evm: increase the size of the malloc's pool before
 relocation
   lib: fdtdec: Add function re-setup the fdt more effeciently
   drivers: core: Add the option SPL_DM_DEVICE_REMOVE to the Kconfig
   drivers: core: nullify gd->dm_root after dm_uninit()
   dra7: Allow selecting a new dtb after board detection.

Vignesh R (1):
   i2c: omap24xx_i2c: Move away from SoC specific headers for reg offset

  arch/arm/dts/am437x-gp-evm-u-boot.dtsi   |   4 +
  arch/arm/dts/omap5-u-boot.dtsi   |   4 +
  arch/arm/include/asm/arch-am33xx/i2c.h   |  47 +--
  arch/arm/include/asm/arch-omap3/i2c.h|  47 ---
  arch/arm/include/asm/arch-omap4/i2c.h|  45 ---
  arch/arm/include/asm/arch-omap5/i2c.h|  45 ---
  arch/arm/include/asm/omap_i2c.h  |  24 ++
  arch/arm/mach-keystone/ddr3_spd.c|   7 +
  arch/arm/mach-omap2/am33xx/board.c   |  24 +-
  arch/arm/mach-omap2/am33xx/clk_synthesizer.c |  56 +++-
  arch/arm/mach-omap2/clocks-common.c  |   2 +
  arch/arm/mach-omap2/hwinit-common.c  |  23 +-
  board/eets/pdu001/board.c|   1 -
  board/ti/am335x/board.c  |  17 +-
  board/ti/am335x/mux.c|  14 +
  board/ti/am43xx/board.c  |  46 ++-
  board/ti/am57xx/board.c  |  25 +-
  board/ti/common/board_detect.c   | 110 +++
  board/ti/ks2_evm/board_k2g.c |  

[U-Boot] [PATCH v2 15/19] configs: dra7xx-evm: increase the size of the malloc's pool before relocation

2018-10-05 Thread Jean-Jacques Hiblot
This is required to take advantage of MULTI_DTB_FIT before relocation.
If it is too low, DM will be initialized only after relocation has
taken place. That is too late for the DRA7 because I2C DM is used before
the relocation to setup the voltages required, among other things, to
properly initialize the DRAM.

Signed-off-by: Jean-Jacques Hiblot 
---

Changes in v2: None

 configs/dra7xx_evm_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configs/dra7xx_evm_defconfig b/configs/dra7xx_evm_defconfig
index 14adaab..9546b5e 100644
--- a/configs/dra7xx_evm_defconfig
+++ b/configs/dra7xx_evm_defconfig
@@ -1,7 +1,7 @@
 CONFIG_ARM=y
 CONFIG_ARCH_OMAP2PLUS=y
 CONFIG_TI_COMMON_CMD_OPTIONS=y
-CONFIG_SYS_MALLOC_F_LEN=0x2000
+CONFIG_SYS_MALLOC_F_LEN=0x18000
 CONFIG_OMAP54XX=y
 CONFIG_TARGET_DRA7XX_EVM=y
 CONFIG_SPL=y
-- 
2.7.4

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


[U-Boot] [PATCH v2 18/19] drivers: core: nullify gd->dm_root after dm_uninit()

2018-10-05 Thread Jean-Jacques Hiblot
To reset the DM after a new dtb is loaded, we need to call dm_uninit()
and then dm_init(). This fails however because gd->dm_root is not nullified
by dm_uninit().
Fixing it by setting gd->dm_root in dm_uninit().

Signed-off-by: Jean-Jacques Hiblot 
---

Changes in v2: None

 drivers/core/root.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/core/root.c b/drivers/core/root.c
index 47d10b8..ce59697 100644
--- a/drivers/core/root.c
+++ b/drivers/core/root.c
@@ -187,6 +187,7 @@ int dm_uninit(void)
 {
device_remove(dm_root(), DM_REMOVE_NORMAL);
device_unbind(dm_root());
+   gd->dm_root = NULL;
 
return 0;
 }
-- 
2.7.4

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


[U-Boot] [PATCH v2 14/19] am57xx: remove non-DM I2C code

2018-10-05 Thread Jean-Jacques Hiblot
am57xx configs uses DM_I2C both in SPL and u-boot.
Remove code for non-DM I2C support.

Signed-off-by: Jean-Jacques Hiblot 
---

Changes in v2: None

 board/ti/am57xx/board.c | 36 +++-
 1 file changed, 3 insertions(+), 33 deletions(-)

diff --git a/board/ti/am57xx/board.c b/board/ti/am57xx/board.c
index 355ea55..9738beb 100644
--- a/board/ti/am57xx/board.c
+++ b/board/ti/am57xx/board.c
@@ -623,7 +623,7 @@ void am57x_idk_lcd_detect(void)
 {
int r = -ENODEV;
char *idk_lcd = "no";
-   u8 buf = 0;
+   struct udevice *dev;
 
/* Only valid for IDKs */
if (board_is_x15() || board_is_am572x_evm())
@@ -633,34 +633,6 @@ void am57x_idk_lcd_detect(void)
if (board_is_am571x_idk() && !am571x_idk_needs_lcd())
goto out;
 
-#ifndef CONFIG_DM_I2C
-   r = i2c_set_bus_num(OSD_TS_FT_BUS_ADDRESS);
-   if (r) {
-   printf("%s: Failed to set bus address to %d: %d\n",
-  __func__, OSD_TS_FT_BUS_ADDRESS, r);
-   goto out;
-   }
-   r = i2c_probe(OSD_TS_FT_CHIP_ADDRESS);
-   if (r) {
-   /* AM572x IDK has no explicit settings for optional LCD kit */
-   if (board_is_am571x_idk()) {
-   printf("%s: Touch screen detect failed: %d!\n",
-  __func__, r);
-   }
-   goto out;
-   }
-
-   /* Read FT ID */
-   r = i2c_read(OSD_TS_FT_CHIP_ADDRESS, OSD_TS_FT_REG_ID, 1, , 1);
-   if (r) {
-   printf("%s: Touch screen ID read %d:0x%02x[0x%02x] failed:%d\n",
-  __func__, OSD_TS_FT_BUS_ADDRESS, OSD_TS_FT_CHIP_ADDRESS,
-  OSD_TS_FT_REG_ID, r);
-   goto out;
-   }
-#else
-   struct udevice *dev;
-
r = i2c_get_chip_for_busnum(OSD_TS_FT_BUS_ADDRESS,
OSD_TS_FT_CHIP_ADDRESS, 1, );
if (r) {
@@ -682,10 +654,8 @@ void am57x_idk_lcd_detect(void)
   OSD_TS_FT_REG_ID, r);
goto out;
}
-   buf = (u8)r;
-#endif
 
-   switch (buf) {
+   switch (r) {
case OSD_TS_FT_ID_5606:
idk_lcd = "osd101t2045";
break;
@@ -694,7 +664,7 @@ void am57x_idk_lcd_detect(void)
break;
default:
printf("%s: Unidentifed Touch screen ID 0x%02x\n",
-  __func__, buf);
+  __func__, r);
/* we will let default be "no lcd" */
}
 out:
-- 
2.7.4

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


[U-Boot] [PATCH v2 10/19] power: make most tps drivers and the twl4030 driver compatible with DM_I2C

2018-10-05 Thread Jean-Jacques Hiblot
Those driver are not DM drivers per se (not using the PMIC/regulator
framework) and are using the legacy I2C API. Make them compatible with
the DM_I2C API.

This impacts the following drivers:
- palmas (used by am57xx/dra7xx evms)
- tps65218 (used by am43xx evms)
- tps65217 and tps65910 (used by am335x evms and am335x boneblack vboot)
- twl4030 (used by omap3_logicpd)
- tps65217 (used by brppt1)
- twl6030

Signed-off-by: Jean-Jacques Hiblot 

---

Changes in v2:
- Also add DM_I2C support to the twl6030 driver

 drivers/power/palmas.c | 39 +
 drivers/power/pmic/pmic_tps62362.c | 27 
 drivers/power/pmic/pmic_tps65217.c | 47 +++-
 drivers/power/pmic/pmic_tps65218.c | 88 ++
 drivers/power/pmic/pmic_tps65910.c | 60 ++
 drivers/power/twl4030.c| 39 +
 drivers/power/twl6030.c| 39 +
 include/palmas.h   |  5 +++
 include/power/tps65217.h   |  2 +
 include/power/tps65910.h   |  1 +
 include/twl4030.h  |  6 ++-
 include/twl6030.h  |  5 +++
 12 files changed, 347 insertions(+), 11 deletions(-)

diff --git a/drivers/power/palmas.c b/drivers/power/palmas.c
index 6d5abba..2584bea 100644
--- a/drivers/power/palmas.c
+++ b/drivers/power/palmas.c
@@ -175,3 +175,42 @@ int twl603x_enable_bb_charge(u8 bb_fields)
   val, err);
return err;
 }
+
+#ifdef CONFIG_DM_I2C
+int palmas_i2c_write_u8(u8 chip_no, u8 reg, u8 val)
+{
+   struct udevice *dev;
+   int ret;
+
+   ret = i2c_get_chip_for_busnum(0, chip_no, 1, );
+   if (ret) {
+   pr_err("unable to get I2C bus. ret %d\n", ret);
+   return ret;
+   }
+   ret = dm_i2c_reg_write(dev, reg, val);
+   if (ret) {
+   pr_err("writing to palmas failed. ret %d\n", ret);
+   return ret;
+   }
+   return 0;
+}
+
+int palmas_i2c_read_u8(u8 chip_no, u8 reg, u8 *valp)
+{
+   struct udevice *dev;
+   int ret;
+
+   ret = i2c_get_chip_for_busnum(0, chip_no, 1, );
+   if (ret) {
+   pr_err("unable to get I2C bus. ret %d\n", ret);
+   return ret;
+   }
+   ret = dm_i2c_reg_read(dev, reg);
+   if (ret < 0) {
+   pr_err("reading from palmas failed. ret %d\n", ret);
+   return ret;
+   }
+   *valp = (u8)ret;
+   return 0;
+}
+#endif
diff --git a/drivers/power/pmic/pmic_tps62362.c 
b/drivers/power/pmic/pmic_tps62362.c
index f2987de..d2fd955 100644
--- a/drivers/power/pmic/pmic_tps62362.c
+++ b/drivers/power/pmic/pmic_tps62362.c
@@ -10,6 +10,10 @@
 #include 
 #include 
 
+#ifdef CONFIG_DM_I2C
+struct udevice *tps62362_dev __attribute__((section(".data"))) = NULL;
+#endif
+
 /**
  * tps62362_voltage_update() - Function to change a voltage level, as this
  *is a multi-step process.
@@ -22,9 +26,16 @@ int tps62362_voltage_update(unsigned char reg, unsigned char 
volt_sel)
if (reg > TPS62362_NUM_REGS)
return 1;
 
+#ifndef CONFIG_DM_I2C
return i2c_write(TPS62362_I2C_ADDR, reg, 1, _sel, 1);
+#else
+   if (!tps62362_dev)
+   return -ENODEV;
+   return dm_i2c_reg_write(tps62362_dev, reg, volt_sel);
+#endif
 }
 
+#ifndef CONFIG_DM_I2C
 int power_tps62362_init(unsigned char bus)
 {
static const char name[] = "TPS62362";
@@ -44,3 +55,19 @@ int power_tps62362_init(unsigned char bus)
 
return 0;
 }
+#else
+int power_tps62362_init(unsigned char bus)
+{
+   struct udevice *dev = NULL;
+   int rc;
+
+   rc = i2c_get_chip_for_busnum(bus, TPS62362_I2C_ADDR, 1, );
+   if (rc)
+   return rc;
+   rc = dm_i2c_probe_device(dev);
+   if (rc)
+   return rc;
+   tps62362_dev = dev;
+   return 0;
+}
+#endif
diff --git a/drivers/power/pmic/pmic_tps65217.c 
b/drivers/power/pmic/pmic_tps65217.c
index 01c0ad1..773eb74 100644
--- a/drivers/power/pmic/pmic_tps65217.c
+++ b/drivers/power/pmic/pmic_tps65217.c
@@ -8,6 +8,8 @@
 #include 
 #include 
 
+struct udevice *tps65217_dev __attribute__((section(".data"))) = NULL;
+
 /**
  * tps65217_reg_read() - Generic function that can read a TPS65217 register
  * @src_reg:Source register address
@@ -16,7 +18,11 @@
  */
 int tps65217_reg_read(uchar src_reg, uchar *src_val)
 {
+#ifndef CONFIG_DM_I2C
return i2c_read(TPS65217_CHIP_PM, src_reg, 1, src_val, 1);
+#else
+   return dm_i2c_read(tps65217_dev, src_reg,  src_val, 1);
+#endif
 }
 
 /**
@@ -46,9 +52,14 @@ int tps65217_reg_write(uchar prot_level, uchar dest_reg, 
uchar dest_val,
 * mask
 */
if (mask != TPS65217_MASK_ALL_BITS) {
+#ifndef CONFIG_DM_I2C
ret = i2c_read(TPS65217_CHIP_PM, dest_reg, 1, _val, 1);
+#else
+   ret = dm_i2c_read(tps65217_dev, dest_reg, _val, 1);
+#endif
if 

[U-Boot] [PATCH v2 16/19] lib: fdtdec: Add function re-setup the fdt more effeciently

2018-10-05 Thread Jean-Jacques Hiblot
In some cases it may be useful to be able to change the fdt we have been
using and use another one instead. For example, the TI platforms uses an
EEPROM to store board information and, based on the type of board,
different dtbs are used by the SPL. When DM_I2C is used, a first dtb must
be used before the I2C is initialized and only then the final dtb can be
selected.
To speed up the process and reduce memory usage, introduce a new function
fdtdec_setup_best_match() that re-use the DTBs loaded in memory by
fdtdec_setup() to select the best match.

Signed-off-by: Jean-Jacques Hiblot 
---

Changes in v2: None

 include/asm-generic/global_data.h |  4 
 include/fdtdec.h  | 17 +
 lib/fdtdec.c  | 38 +-
 3 files changed, 58 insertions(+), 1 deletion(-)

diff --git a/include/asm-generic/global_data.h 
b/include/asm-generic/global_data.h
index c83fc01..49287fa 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -77,6 +77,10 @@ typedef struct global_data {
 #ifdef CONFIG_OF_LIVE
struct device_node *of_root;
 #endif
+
+#if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
+   const void *multi_dtb_fit;
+#endif
struct jt_funcs *jt;/* jump table */
char env_buf[32];   /* buffer for env_get() before reloc. */
 #ifdef CONFIG_TRACE
diff --git a/include/fdtdec.h b/include/fdtdec.h
index 83be064..2cb3da2 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -996,6 +996,23 @@ int fdtdec_setup_memory_banksize(void);
  */
 int fdtdec_setup(void);
 
+#if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
+/**
+ * fdtdec_resetup()  - Set up the device tree ready for use again.
+ *
+ * The main difference with fdtdec_setup() is that it returns if the fdt has
+ * changed because a better match has been found.
+ * This is typically used for boards that rely on a DM driver to detect the
+ * board type.
+ *
+ * @param rescan Return a flag indicating that fdt has changed and rescaning 
the
+ *   fdt is required.
+ *
+ * @return 0 if OK, -ve on error
+ */
+int fdtdec_resetup(int *rescan);
+#endif
+
 /**
  * Board-specific FDT initialization. Returns the address to a device tree 
blob.
  * Called when CONFIG_OF_BOARD is defined, or if CONFIG_OF_SEPARATE is defined
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 74196ce..3b80bd4 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -1353,14 +1353,50 @@ int fdtdec_setup(void)
 * If so, pick the most relevant
 */
fdt_blob = locate_dtb_in_fit(gd->fdt_blob);
-   if (fdt_blob)
+   if (fdt_blob) {
+   gd->multi_dtb_fit = gd->fdt_blob;
gd->fdt_blob = fdt_blob;
+   }
+
 # endif
 #endif
 
return fdtdec_prepare_fdt();
 }
 
+#if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
+int fdtdec_resetup(int *rescan)
+{
+   void *fdt_blob;
+
+   /*
+* If the current DTB is part of a compressed FIT image,
+* try to locate the best match from the uncompressed
+* FIT image stillpresent there. Save the time and space
+* required to uncompress it again.
+*/
+   if (gd->multi_dtb_fit) {
+   fdt_blob = locate_dtb_in_fit(gd->multi_dtb_fit);
+
+   if (fdt_blob == gd->fdt_blob) {
+   /*
+* The best match did not change. no need to tear down
+* the DM and rescan the fdt.
+*/
+   *rescan = 0;
+   return 0;
+   }
+
+   *rescan = 1;
+   gd->fdt_blob = fdt_blob;
+   return fdtdec_prepare_fdt();
+   }
+
+   *rescan = 1;
+   return fdtdec_setup();
+}
+#endif
+
 #ifdef CONFIG_NR_DRAM_BANKS
 int fdtdec_decode_ram_size(const void *blob, const char *area, int board_id,
   phys_addr_t *basep, phys_size_t *sizep, bd_t *bd)
-- 
2.7.4

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


[U-Boot] [PATCH v2 08/19] dts: am43x: omap5: Add node for I2C in SPL

2018-10-05 Thread Jean-Jacques Hiblot
Signed-off-by: Jean-Jacques Hiblot 
---

Changes in v2: None

 arch/arm/dts/am437x-gp-evm-u-boot.dtsi | 4 
 arch/arm/dts/omap5-u-boot.dtsi | 4 
 2 files changed, 8 insertions(+)

diff --git a/arch/arm/dts/am437x-gp-evm-u-boot.dtsi 
b/arch/arm/dts/am437x-gp-evm-u-boot.dtsi
index 530f549..03a1c1d 100644
--- a/arch/arm/dts/am437x-gp-evm-u-boot.dtsi
+++ b/arch/arm/dts/am437x-gp-evm-u-boot.dtsi
@@ -36,3 +36,7 @@
 _sel {
u-boot,dm-spl;
 };
+
+ {
+   u-boot,dm-spl;
+};
diff --git a/arch/arm/dts/omap5-u-boot.dtsi b/arch/arm/dts/omap5-u-boot.dtsi
index bf2684c..30833a3 100644
--- a/arch/arm/dts/omap5-u-boot.dtsi
+++ b/arch/arm/dts/omap5-u-boot.dtsi
@@ -91,3 +91,7 @@
  {
u-boot,dm-spl;
 };
+
+ {
+   u-boot,dm-spl;
+};
-- 
2.7.4

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


[U-Boot] [PATCH v2 13/19] ti: remove usage of DM_I2C_COMPAT and don't disable DM_I2C in SPL

2018-10-05 Thread Jean-Jacques Hiblot
DM_I2C_COMPAT is a compatibility layer that allows using the non-DM I2C
API when DM_I2C is used. The goal is to eventually remove DM_I2C_COMPAT
when all I2C "clients" have been migrated to use the DM API.
This a step in that direction for the TI based platforms.
Build tested with buildman:
buildman -dle am33xx ti omap3 omap4 omap5 davinci keystone

boot tested with:
am335x_evm, am335x_boneblack, am335x_boneblack_vboot (DM version),
am57xx_evm, dra7xx_evm, k2g_evm, am437x_evm

Signed-off-by: Jean-Jacques Hiblot 

---

Changes in v2:
- Fixed warning in power_init_board() for the am43xx ti boards.

 arch/arm/mach-keystone/ddr3_spd.c|  7 
 arch/arm/mach-omap2/am33xx/clk_synthesizer.c | 56 +-
 arch/arm/mach-omap2/clocks-common.c  |  2 +
 board/ti/am335x/board.c  | 17 +++-
 board/ti/am335x/mux.c| 14 +++
 board/ti/am43xx/board.c  | 46 -
 board/ti/am57xx/board.c  | 29 +-
 board/ti/common/board_detect.c   | 60 ++--
 board/ti/ks2_evm/board_k2g.c | 11 +
 include/configs/am43xx_evm.h |  2 +
 include/configs/ti_armv7_common.h| 18 +
 11 files changed, 164 insertions(+), 98 deletions(-)

diff --git a/arch/arm/mach-keystone/ddr3_spd.c 
b/arch/arm/mach-keystone/ddr3_spd.c
index 2613092..6eee9ad 100644
--- a/arch/arm/mach-keystone/ddr3_spd.c
+++ b/arch/arm/mach-keystone/ddr3_spd.c
@@ -403,6 +403,7 @@ static void init_ddr3param(struct ddr3_spd_cb *spd_cb,
 static int ddr3_read_spd(ddr3_spd_eeprom_t *spd_params)
 {
int ret;
+#ifndef CONFIG_DM_I2C
int old_bus;
 
i2c_init(CONFIG_SYS_DAVINCI_I2C_SPEED, CONFIG_SYS_DAVINCI_I2C_SLAVE);
@@ -413,7 +414,13 @@ static int ddr3_read_spd(ddr3_spd_eeprom_t *spd_params)
ret = i2c_read(0x53, 0, 1, (unsigned char *)spd_params, 256);
 
i2c_set_bus_num(old_bus);
+#else
+   struct udevice *dev;
 
+   ret = i2c_get_chip_for_busnum(1, 0x53, 1, );
+   if (!ret)
+   ret = dm_i2c_read(dev, 0, (unsigned char *)spd_params, 256);
+#endif
if (ret) {
printf("Cannot read DIMM params\n");
return 1;
diff --git a/arch/arm/mach-omap2/am33xx/clk_synthesizer.c 
b/arch/arm/mach-omap2/am33xx/clk_synthesizer.c
index 0e7ad1d..ff1bfaf 100644
--- a/arch/arm/mach-omap2/am33xx/clk_synthesizer.c
+++ b/arch/arm/mach-omap2/am33xx/clk_synthesizer.c
@@ -14,6 +14,7 @@
 
 /**
  * clk_synthesizer_reg_read - Read register from synthesizer.
+ * dev:i2c bus device (not used if CONFIG_DM_I2C is not set)
  * @addr:  addr within the i2c device
  * buf:Buffer to which value is to be read.
  *
@@ -21,13 +22,14 @@
  * be send along with enabling byte read more, and then read can happen.
  * Returns 0 on success
  */
-static int clk_synthesizer_reg_read(int addr, uint8_t *buf)
+static int clk_synthesizer_reg_read(struct udevice *dev, int addr, u8 *buf)
 {
int rc;
 
/* Enable Bye read */
addr = addr | CLK_SYNTHESIZER_BYTE_MODE;
 
+#ifndef CONFIG_DM_I2C
/* Send the command byte */
rc = i2c_write(CLK_SYNTHESIZER_I2C_ADDR, addr, 1, buf, 1);
if (rc)
@@ -35,26 +37,46 @@ static int clk_synthesizer_reg_read(int addr, uint8_t *buf)
 
/* Read the Data */
return i2c_read(CLK_SYNTHESIZER_I2C_ADDR, addr, 1, buf, 1);
+#else
+   /* Send the command byte */
+   rc = dm_i2c_reg_write(dev, addr, *buf);
+   if (rc)
+   printf("Failed to send command to clock synthesizer\n");
+
+   /* Read the Data */
+   rc = dm_i2c_reg_read(dev, addr);
+   if (rc < 0)
+   return rc;
+
+   *buf = (u8)rc;
+   return 0;
+#endif
+
 }
 
 /**
  * clk_synthesizer_reg_write - Write a value to register in synthesizer.
+ * dev:i2c bus device (not used if CONFIG_DM_I2C is not set)
  * @addr:  addr within the i2c device
  * val:Value to be written in the addr.
  *
  * Enable the byte read mode in the address and start the i2c transfer.
  * Returns 0 on success
  */
-static int clk_synthesizer_reg_write(int addr, uint8_t val)
+static int clk_synthesizer_reg_write(struct udevice *dev, int addr, u8 val)
 {
-   uint8_t cmd[2];
+   u8 cmd[2];
int rc = 0;
 
/* Enable byte write */
cmd[0] = addr | CLK_SYNTHESIZER_BYTE_MODE;
cmd[1] = val;
 
+#ifndef CONFIG_DM_I2C
rc = i2c_write(CLK_SYNTHESIZER_I2C_ADDR, addr, 1, cmd, 2);
+#else
+   rc = dm_i2c_write(dev, addr, cmd, 2);
+#endif
if (rc)
printf("Clock synthesizer reg write failed at addr = 0x%x\n",
   addr);
@@ -72,30 +94,42 @@ static int clk_synthesizer_reg_write(int addr, uint8_t val)
 int setup_clock_synthesizer(struct clk_synth *data)
 {
int rc;
-   uint8_t val;
-
+   u8 val = 0;

[U-Boot] [PATCH v2 17/19] drivers: core: Add the option SPL_DM_DEVICE_REMOVE to the Kconfig

2018-10-05 Thread Jean-Jacques Hiblot
Signed-off-by: Jean-Jacques Hiblot 
---

Changes in v2: None

 drivers/core/Kconfig | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/core/Kconfig b/drivers/core/Kconfig
index e8ba20c..046b87a 100644
--- a/drivers/core/Kconfig
+++ b/drivers/core/Kconfig
@@ -57,13 +57,21 @@ config DM_DEVICE_REMOVE
default y
help
  We can save some code space by dropping support for removing a
- device. This is not normally required in SPL, so by default this
- option is disabled for SPL.
+ device.
 
  Note that this may have undesirable results in the USB subsystem as
  it causes unplugged devices to linger around in the dm-tree, and it
  causes USB host controllers to not be stopped when booting the OS.
 
+config SPL_DM_DEVICE_REMOVE
+   bool "Support device removal in SPL"
+   depends on SPL_DM
+   default n
+   help
+ We can save some code space by dropping support for removing a
+ device. This is not normally required in SPL, so by default this
+ option is disabled for SPL.
+
 config DM_STDIO
bool "Support stdio registration"
depends on DM
-- 
2.7.4

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


[U-Boot] [PATCH v2 19/19] dra7: Allow selecting a new dtb after board detection.

2018-10-05 Thread Jean-Jacques Hiblot
The DRA7 platforms requires that the dtb used in the SPL really matches the
platform  to have the best MMC performances.
To detect the board type/version an I2C EEPROM is read. This requires that
DM is initialized before the detection. As a consequence we must reset the
DM after the board detection is a new dtb would better match the platform.

Signed-off-by: Jean-Jacques Hiblot 

---

Changes in v2: None

 arch/arm/mach-omap2/hwinit-common.c | 20 
 configs/dra7xx_evm_defconfig|  2 ++
 2 files changed, 22 insertions(+)

diff --git a/arch/arm/mach-omap2/hwinit-common.c 
b/arch/arm/mach-omap2/hwinit-common.c
index d0781d7..772b4c4 100644
--- a/arch/arm/mach-omap2/hwinit-common.c
+++ b/arch/arm/mach-omap2/hwinit-common.c
@@ -12,6 +12,7 @@
  */
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -19,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -171,6 +173,10 @@ void __weak init_package_revision(void)
  */
 void early_system_init(void)
 {
+#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_MULTI_DTB_FIT)
+   int ret;
+   int rescan;
+#endif
init_omap_revision();
hw_data_init();
init_package_revision();
@@ -186,6 +192,7 @@ void early_system_init(void)
do_io_settings();
 #endif
setup_early_clocks();
+
 #ifdef CONFIG_SPL_BUILD
/*
 * Save the boot parameters passed from romcode.
@@ -197,6 +204,19 @@ void early_system_init(void)
 #endif
do_board_detect();
 
+#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_MULTI_DTB_FIT)
+   /*
+* Board detection has been done.
+* Let us see if another dtb wouldn't be a better match
+* for our board
+*/
+   ret = fdtdec_resetup();
+   if (!ret && rescan) {
+   dm_uninit();
+   dm_init_and_scan(true);
+   }
+#endif
+
vcores_init();
 #ifdef CONFIG_DEBUG_UART_OMAP
debug_uart_init();
diff --git a/configs/dra7xx_evm_defconfig b/configs/dra7xx_evm_defconfig
index 9546b5e..b4825a5 100644
--- a/configs/dra7xx_evm_defconfig
+++ b/configs/dra7xx_evm_defconfig
@@ -34,11 +34,13 @@ CONFIG_SPL_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="dra7-evm"
 CONFIG_OF_LIST="dra7-evm dra72-evm dra72-evm-revc dra71-evm dra76-evm"
 CONFIG_SPL_MULTI_DTB_FIT=y
+CONFIG_SPL_MULTI_DTB_FIT_UNCOMPRESS_SZ=0x9000
 CONFIG_OF_SPL_REMOVE_PROPS="clocks clock-names interrupt-parent"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_DM=y
 CONFIG_SPL_DM=y
+CONFIG_SPL_DM_DEVICE_REMOVE=y
 CONFIG_SPL_DM_SEQ_ALIAS=y
 CONFIG_SPL_REGMAP=y
 CONFIG_SPL_SYSCON=y
-- 
2.7.4

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


[U-Boot] [PATCH v2 11/19] ti: common: board_detect: Allow DM I2C without CONFIG_DM_I2C_COMPAT

2018-10-05 Thread Jean-Jacques Hiblot
From: Andreas Dannenberg 

The EEPROM reading in the board detection code is done through legacy
I2C functions which on platforms using DM_I2C this functionality is
provided via the CONFIG_DM_I2C_COMPAT layer. To allow newer platforms
to use the board detection code without relying on CONFIG_DM_I2C_COMPAT
go ahead and add an I2C handling implementation that directly uses the
I2C DM functionality.

Signed-off-by: Andreas Dannenberg 
Signed-off-by: Jean-Jacques Hiblot 
---

Changes in v2: None

 board/ti/common/board_detect.c | 54 --
 1 file changed, 52 insertions(+), 2 deletions(-)

diff --git a/board/ti/common/board_detect.c b/board/ti/common/board_detect.c
index c475f10..085e732 100644
--- a/board/ti/common/board_detect.c
+++ b/board/ti/common/board_detect.c
@@ -50,6 +50,7 @@ int __maybe_unused ti_i2c_set_alen(int bus_addr, int 
dev_addr, int alen)
 }
 #endif
 
+#if !defined(CONFIG_DM_I2C) || defined(CONFIG_DM_I2C_COMPAT)
 /**
  * ti_i2c_eeprom_init - Initialize an i2c bus and probe for a device
  * @i2c_bus: i2c bus number to initialize
@@ -94,6 +95,7 @@ static int __maybe_unused ti_i2c_eeprom_read(int dev_addr, 
int offset,
 
return i2c_read(dev_addr, offset, alen, ep, epsize);
 }
+#endif
 
 /**
  * ti_eeprom_string_cleanup() - Handle eeprom programming errors
@@ -122,9 +124,57 @@ __weak void gpi2c_init(void)
 static int __maybe_unused ti_i2c_eeprom_get(int bus_addr, int dev_addr,
u32 header, u32 size, uint8_t *ep)
 {
-   u32 byte, hdr_read;
+   u32 hdr_read;
int rc;
 
+#if defined(CONFIG_DM_I2C) && !defined(CONFIG_DM_I2C_COMPAT)
+   struct udevice *dev;
+   struct udevice *bus;
+
+   rc = uclass_get_device_by_seq(UCLASS_I2C, bus_addr, );
+   if (rc)
+   return rc;
+   rc = i2c_get_chip(bus, dev_addr, 1, );
+   if (rc)
+   return rc;
+
+   /*
+* Read the header first then only read the other contents.
+*/
+   rc = i2c_set_chip_offset_len(dev, 2);
+   if (rc)
+   return rc;
+
+   rc = dm_i2c_read(dev, 0, (uint8_t *)_read, 4);
+   if (rc)
+   return rc;
+
+   /* Corrupted data??? */
+   if (hdr_read != header) {
+   rc = dm_i2c_read(dev, 0, (uint8_t *)_read, 4);
+   /*
+* read the eeprom header using i2c again, but use only a
+* 1 byte address (some legacy boards need this..)
+*/
+   if (rc) {
+   rc =  i2c_set_chip_offset_len(dev, 1);
+   if (rc)
+   return rc;
+
+   rc = dm_i2c_read(dev, 0, (uint8_t *)_read, 4);
+   }
+   if (rc)
+   return rc;
+   }
+   if (hdr_read != header)
+   return -1;
+
+   rc = dm_i2c_read(dev, 0, ep, size);
+   if (rc)
+   return rc;
+#else
+   u32 byte;
+
gpi2c_init();
rc = ti_i2c_eeprom_init(bus_addr, dev_addr);
if (rc)
@@ -168,7 +218,7 @@ static int __maybe_unused ti_i2c_eeprom_get(int bus_addr, 
int dev_addr,
rc = i2c_read(dev_addr, 0x0, byte, ep, size);
if (rc)
return rc;
-
+#endif
return 0;
 }
 
-- 
2.7.4

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


[U-Boot] [PATCH v2 05/19] i2c: omap24xx_i2c: Move away from SoC specific headers for reg offset

2018-10-05 Thread Jean-Jacques Hiblot
From: Vignesh R 

Move away from SoC specific headers to handle different register layout.
Instead use driver data to get appropriate register layouts like in the
kernel. While at it, perform some mostly cosmetic alignment/cleanup in
the functions being updated.

Signed-off-by: Vignesh R 
Signed-off-by: Andreas Dannenberg 
Signed-off-by: Jean-Jacques Hiblot 
---

Changes in v2: None

 arch/arm/include/asm/arch-am33xx/i2c.h |  45 
 arch/arm/include/asm/arch-omap3/i2c.h  |  47 
 arch/arm/include/asm/arch-omap4/i2c.h  |  45 
 arch/arm/include/asm/arch-omap5/i2c.h  |  45 
 drivers/i2c/omap24xx_i2c.c | 458 ++---
 5 files changed, 314 insertions(+), 326 deletions(-)

diff --git a/arch/arm/include/asm/arch-am33xx/i2c.h 
b/arch/arm/include/asm/arch-am33xx/i2c.h
index 491fca9..b3cc3df 100644
--- a/arch/arm/include/asm/arch-am33xx/i2c.h
+++ b/arch/arm/include/asm/arch-am33xx/i2c.h
@@ -12,51 +12,6 @@
 
 #define I2C_DEFAULT_BASE   I2C_BASE1
 
-struct i2c {
-   unsigned short revnb_lo;/* 0x00 */
-   unsigned short res1;
-   unsigned short revnb_hi;/* 0x04 */
-   unsigned short res2[5];
-   unsigned short sysc;/* 0x10 */
-   unsigned short res3[9];
-   unsigned short irqstatus_raw;   /* 0x24 */
-   unsigned short res4;
-   unsigned short stat;/* 0x28 */
-   unsigned short res5;
-   unsigned short ie;  /* 0x2C */
-   unsigned short res6;
-   unsigned short irqenable_clr;   /* 0x30 */
-   unsigned short res7;
-   unsigned short iv;  /* 0x34 */
-   unsigned short res8[45];
-   unsigned short syss;/* 0x90 */
-   unsigned short res9;
-   unsigned short buf; /* 0x94 */
-   unsigned short res10;
-   unsigned short cnt; /* 0x98 */
-   unsigned short res11;
-   unsigned short data;/* 0x9C */
-   unsigned short res13;
-   unsigned short res14;   /* 0xA0 */
-   unsigned short res15;
-   unsigned short con; /* 0xA4 */
-   unsigned short res16;
-   unsigned short oa;  /* 0xA8 */
-   unsigned short res17;
-   unsigned short sa;  /* 0xAC */
-   unsigned short res18;
-   unsigned short psc; /* 0xB0 */
-   unsigned short res19;
-   unsigned short scll;/* 0xB4 */
-   unsigned short res20;
-   unsigned short sclh;/* 0xB8 */
-   unsigned short res21;
-   unsigned short systest; /* 0xBC */
-   unsigned short res22;
-   unsigned short bufstat; /* 0xC0 */
-   unsigned short res23;
-};
-
 #define I2C_IP_CLK 4800
 #define I2C_INTERNAL_SAMPLING_CLK  1200
 
diff --git a/arch/arm/include/asm/arch-omap3/i2c.h 
b/arch/arm/include/asm/arch-omap3/i2c.h
index 5ddaa0d..b04c012 100644
--- a/arch/arm/include/asm/arch-omap3/i2c.h
+++ b/arch/arm/include/asm/arch-omap3/i2c.h
@@ -8,51 +8,4 @@
 
 #define I2C_DEFAULT_BASE   I2C_BASE1
 
-struct i2c {
-   unsigned short rev; /* 0x00 */
-   unsigned short res1;
-   unsigned short ie;  /* 0x04 */
-   unsigned short res2;
-   unsigned short stat;/* 0x08 */
-   unsigned short res3;
-   unsigned short we;  /* 0x0C */
-   unsigned short res4;
-   unsigned short syss;/* 0x10 */
-   unsigned short res4a;
-   unsigned short buf; /* 0x14 */
-   unsigned short res5;
-   unsigned short cnt; /* 0x18 */
-   unsigned short res6;
-   unsigned short data;/* 0x1C */
-   unsigned short res7;
-   unsigned short sysc;/* 0x20 */
-   unsigned short res8;
-   unsigned short con; /* 0x24 */
-   unsigned short res9;
-   unsigned short oa;  /* 0x28 */
-   unsigned short res10;
-   unsigned short sa;  /* 0x2C */
-   unsigned short res11;
-   unsigned short psc; /* 0x30 */
-   unsigned short res12;
-   unsigned short scll;/* 0x34 */
-   unsigned short res13;
-   unsigned short sclh;/* 0x38 */
-   unsigned short res14;
-   unsigned short systest; /* 0x3c */
-   unsigned short res15;
-   unsigned short bufstat; /* 0x40 */
-   unsigned short res16;
-   unsigned short oa1; /* 0x44 */
-   unsigned short res17;
-   unsigned short oa2; /* 0x48 */
-   unsigned short res18;
-   unsigned short oa3; /* 0x4c */
-   unsigned short res19;
-   unsigned short actoa;   /* 0x50 */
-   unsigned short res20;
-   unsigned short sblock;  /* 0x54 */
-   unsigned short res21;
-};
-
 #endif /* _OMAP3_I2C_H_ */
diff --git a/arch/arm/include/asm/arch-omap4/i2c.h 
b/arch/arm/include/asm/arch-omap4/i2c.h
index c60aac7..c8f2f97 100644
--- a/arch/arm/include/asm/arch-omap4/i2c.h
+++ b/arch/arm/include/asm/arch-omap4/i2c.h
@@ -8,49 +8,4 @@
 
 #define 

[U-Boot] [PATCH v2 09/19] omap: detect the board after DM is available

2018-10-05 Thread Jean-Jacques Hiblot
In order to use DM_I2C, we need to move the board detection after the
early SPL initialization.

Signed-off-by: Jean-Jacques Hiblot 
---

Changes in v2: None

 arch/arm/mach-omap2/am33xx/board.c  | 9 ++---
 arch/arm/mach-omap2/hwinit-common.c | 5 ++---
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/am33xx/board.c 
b/arch/arm/mach-omap2/am33xx/board.c
index c121f27..2fc364d 100644
--- a/arch/arm/mach-omap2/am33xx/board.c
+++ b/arch/arm/mach-omap2/am33xx/board.c
@@ -472,12 +472,15 @@ void early_system_init(void)
 #ifdef CONFIG_DEBUG_UART_OMAP
debug_uart_init();
 #endif
-#ifdef CONFIG_TI_I2C_BOARD_DETECT
-   do_board_detect();
-#endif
+
 #ifdef CONFIG_SPL_BUILD
spl_early_init();
 #endif
+
+#ifdef CONFIG_TI_I2C_BOARD_DETECT
+   do_board_detect();
+#endif
+
 #if defined(CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSC)
/* Enable RTC32K clock */
rtc32k_enable();
diff --git a/arch/arm/mach-omap2/hwinit-common.c 
b/arch/arm/mach-omap2/hwinit-common.c
index 1a24acb..d0781d7 100644
--- a/arch/arm/mach-omap2/hwinit-common.c
+++ b/arch/arm/mach-omap2/hwinit-common.c
@@ -193,11 +193,10 @@ void early_system_init(void)
 * to prevent overwrites.
 */
save_omap_boot_params();
-#endif
-   do_board_detect();
-#ifdef CONFIG_SPL_BUILD
spl_early_init();
 #endif
+   do_board_detect();
+
vcores_init();
 #ifdef CONFIG_DEBUG_UART_OMAP
debug_uart_init();
-- 
2.7.4

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


[U-Boot] [PATCH v2 07/19] am335x: Register the I2C controllers if DM_I2C is used.

2018-10-05 Thread Jean-Jacques Hiblot
If DM_I2C is used , the I2C controllers must be registered as U_BOOT_DEVICE
because OF_CONTROL is not used in the SPL.

Signed-off-by: Jean-Jacques Hiblot 
---

Changes in v2: None

 arch/arm/mach-omap2/am33xx/board.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/arch/arm/mach-omap2/am33xx/board.c 
b/arch/arm/mach-omap2/am33xx/board.c
index f5f2bd5..c121f27 100644
--- a/arch/arm/mach-omap2/am33xx/board.c
+++ b/arch/arm/mach-omap2/am33xx/board.c
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -93,6 +94,20 @@ U_BOOT_DEVICES(am33xx_uarts) = {
 #  endif
 };
 
+#ifdef CONFIG_DM_I2C
+static const struct omap_i2c_platdata am33xx_i2c[] = {
+   { I2C_BASE1, 10, OMAP_I2C_REV_V2},
+   { I2C_BASE2, 10, OMAP_I2C_REV_V2},
+   { I2C_BASE3, 10, OMAP_I2C_REV_V2},
+};
+
+U_BOOT_DEVICES(am33xx_i2c) = {
+   { "i2c_omap", _i2c[0] },
+   { "i2c_omap", _i2c[1] },
+   { "i2c_omap", _i2c[2] },
+};
+#endif
+
 #ifdef CONFIG_DM_GPIO
 static const struct omap_gpio_platdata am33xx_gpio[] = {
{ 0, AM33XX_GPIO0_BASE },
-- 
2.7.4

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


[U-Boot] [PATCH v2 12/19] configs: am335x_pdu001: remove CONFIG_DM_I2C_COMPAT

2018-10-05 Thread Jean-Jacques Hiblot
Remove the last call to the non-DM I2C API.
Also remove the #undef CONFIG_DM_I2C_COMPAT because it is not defined
in the common header file anymore.

Signed-off-by: Jean-Jacques Hiblot 

---

Changes in v2:
- remove the remaining non-DM I2C API call for pdu001 board.

 board/eets/pdu001/board.c | 1 -
 include/configs/pdu001.h  | 6 --
 2 files changed, 7 deletions(-)

diff --git a/board/eets/pdu001/board.c b/board/eets/pdu001/board.c
index b4b8081..b857a5a 100644
--- a/board/eets/pdu001/board.c
+++ b/board/eets/pdu001/board.c
@@ -209,7 +209,6 @@ void am33xx_spl_board_init(void)
 const struct dpll_params *get_dpll_ddr_params(void)
 {
enable_i2c0_pin_mux();
-   i2c_init(CONFIG_SYS_OMAP24_I2C_SPEED, CONFIG_SYS_OMAP24_I2C_SLAVE);
 
return _ddr;
 }
diff --git a/include/configs/pdu001.h b/include/configs/pdu001.h
index 7b809e2..e4c2872 100644
--- a/include/configs/pdu001.h
+++ b/include/configs/pdu001.h
@@ -12,12 +12,6 @@
 
 #include 
 
-/* No more need for I2C legacy compatibility for this board.
- * CONFIG_DM_I2C_COMPAT is defined in ti_armv7_common.h. See the comment there
- * for the right moment to delete the following line.
- */
-#undef CONFIG_DM_I2C_COMPAT
-
 /* Using 32K of volatile storage for environment */
 #define CONFIG_ENV_SIZE0x4000
 
-- 
2.7.4

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


[U-Boot] [PATCH v2 01/19] cmd: Kconfig: Do not include EEPROM if DM_I2C is used without DM_I2C_COMPAT

2018-10-05 Thread Jean-Jacques Hiblot
The implementation of the EEPROM commands does not support the DM I2C API.
Prevent compilation breakage by not enabling it if the non-DM API is not
available (if DM_I2C is used without DM_I2C_COMPAT)

Signed-off-by: Jean-Jacques Hiblot 

---

Changes in v2:
- Add missing commit log to the commit disabling CMD_EEPROM when non-DM API
  is not available

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

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 7ed3c9c..b4e1cbf 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -445,6 +445,7 @@ config CRC32_VERIFY
 
 config CMD_EEPROM
bool "eeprom - EEPROM subsystem"
+   depends on !DM_I2C || DM_I2C_COMPAT
help
  (deprecated, needs conversion to driver model)
  Provides commands to read and write EEPROM (Electrically Erasable
-- 
2.7.4

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


[U-Boot] [PATCH v2 04/19] configs: am335x: am57x: dra7x: Enable CONFIG_SPL_DM_SEQ_ALIAS

2018-10-05 Thread Jean-Jacques Hiblot
Those platforms need CONFIG_SPL_DM_SEQ_ALIAS because they enable both
DM_I2C and SPL_DM. Without CONFIG_SPL_DM_SEQ_ALIAS, it is not possible to
get the I2C bus with i2c_get_chip_for_busnum().

Signed-off-by: Jean-Jacques Hiblot 
---

Changes in v2: None

 configs/am335x_pdu001_defconfig | 1 +
 configs/am57xx_evm_defconfig| 1 +
 configs/am57xx_hs_evm_defconfig | 1 +
 configs/dra7xx_hs_evm_defconfig | 1 +
 configs/omap3_logic_defconfig   | 1 +
 5 files changed, 5 insertions(+)

diff --git a/configs/am335x_pdu001_defconfig b/configs/am335x_pdu001_defconfig
index 8a61d84..a666318 100644
--- a/configs/am335x_pdu001_defconfig
+++ b/configs/am335x_pdu001_defconfig
@@ -35,6 +35,7 @@ CONFIG_OF_EMBED=y
 CONFIG_DEFAULT_DEVICE_TREE="am335x-pdu001"
 # CONFIG_NET is not set
 CONFIG_SPL_DM=y
+CONFIG_SPL_DM_SEQ_ALIAS=y
 CONFIG_DM_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_MMC_OMAP_HS=y
diff --git a/configs/am57xx_evm_defconfig b/configs/am57xx_evm_defconfig
index da347f3..56335f4 100644
--- a/configs/am57xx_evm_defconfig
+++ b/configs/am57xx_evm_defconfig
@@ -37,6 +37,7 @@ CONFIG_ENV_IS_IN_MMC=y
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_DM=y
 CONFIG_SPL_DM=y
+CONFIG_SPL_DM_SEQ_ALIAS=y
 CONFIG_SCSI_AHCI=y
 # CONFIG_BLK is not set
 CONFIG_DFU_MMC=y
diff --git a/configs/am57xx_hs_evm_defconfig b/configs/am57xx_hs_evm_defconfig
index 6cf4f9a..7c404d3 100644
--- a/configs/am57xx_hs_evm_defconfig
+++ b/configs/am57xx_hs_evm_defconfig
@@ -40,6 +40,7 @@ CONFIG_ENV_IS_IN_MMC=y
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_DM=y
 CONFIG_SPL_DM=y
+CONFIG_SPL_DM_SEQ_ALIAS=y
 CONFIG_SCSI_AHCI=y
 # CONFIG_BLK is not set
 CONFIG_DFU_MMC=y
diff --git a/configs/dra7xx_hs_evm_defconfig b/configs/dra7xx_hs_evm_defconfig
index bd4ae0e..35c626d 100644
--- a/configs/dra7xx_hs_evm_defconfig
+++ b/configs/dra7xx_hs_evm_defconfig
@@ -41,6 +41,7 @@ CONFIG_ENV_IS_IN_MMC=y
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_DM=y
 CONFIG_SPL_DM=y
+CONFIG_SPL_DM_SEQ_ALIAS=y
 CONFIG_SPL_REGMAP=y
 CONFIG_SPL_SYSCON=y
 CONFIG_DWC_AHCI=y
diff --git a/configs/omap3_logic_defconfig b/configs/omap3_logic_defconfig
index 9b50a30..b8c8738 100644
--- a/configs/omap3_logic_defconfig
+++ b/configs/omap3_logic_defconfig
@@ -34,6 +34,7 @@ CONFIG_SPL_OF_PLATDATA=y
 # CONFIG_ENV_IS_IN_FAT is not set
 CONFIG_ENV_IS_IN_NAND=y
 CONFIG_SPL_DM=y
+CONFIG_SPL_DM_SEQ_ALIAS=y
 CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_FASTBOOT_BUF_ADDR=0x8200
 CONFIG_DM_I2C=y
-- 
2.7.4

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


[U-Boot] [PATCH v2 06/19] i2c: omap24xx_i2c: Use platdata to probe the device

2018-10-05 Thread Jean-Jacques Hiblot
This allows the driver to be used without OF_CONTROL.
AM335x support DM_SPL but does not use SPL_OF_CONTROL. Enabling DM_I2C in
SPL thus requires that the omap I2C can be passed platdata.

Signed-off-by: Jean-Jacques Hiblot 
---

Changes in v2: None

 arch/arm/include/asm/arch-am33xx/i2c.h |  2 ++
 arch/arm/include/asm/omap_i2c.h| 24 
 drivers/i2c/omap24xx_i2c.c | 21 +++--
 3 files changed, 37 insertions(+), 10 deletions(-)
 create mode 100644 arch/arm/include/asm/omap_i2c.h

diff --git a/arch/arm/include/asm/arch-am33xx/i2c.h 
b/arch/arm/include/asm/arch-am33xx/i2c.h
index b3cc3df..c2a9850 100644
--- a/arch/arm/include/asm/arch-am33xx/i2c.h
+++ b/arch/arm/include/asm/arch-am33xx/i2c.h
@@ -6,6 +6,8 @@
 #ifndef _I2C_AM33XX_H_
 #define _I2C_AM33XX_H_
 
+#include 
+
 #define  I2C_BASE1 0x44E0B000
 #define  I2C_BASE2 0x4802A000
 #define  I2C_BASE3 0x4819C000
diff --git a/arch/arm/include/asm/omap_i2c.h b/arch/arm/include/asm/omap_i2c.h
new file mode 100644
index 000..c1695cb
--- /dev/null
+++ b/arch/arm/include/asm/omap_i2c.h
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef _OMAP_I2C_H
+#define _OMAP_I2C_H
+
+#include 
+
+#ifdef CONFIG_DM_I2C
+
+/* Information about a GPIO bank */
+struct omap_i2c_platdata {
+   ulong base; /* address of registers in physical memory */
+   int speed;
+   int ip_rev;
+};
+
+#endif
+
+enum {
+   OMAP_I2C_REV_V1 = 0,
+   OMAP_I2C_REV_V2 = 1,
+};
+
+#endif /* _OMAP_I2C_H */
diff --git a/drivers/i2c/omap24xx_i2c.c b/drivers/i2c/omap24xx_i2c.c
index dacaded..134d622 100644
--- a/drivers/i2c/omap24xx_i2c.c
+++ b/drivers/i2c/omap24xx_i2c.c
@@ -43,6 +43,7 @@
 #include 
 
 #include 
+#include 
 
 /*
  * Provide access to architecture-specific I2C header files for platforms
@@ -62,11 +63,6 @@
 #define I2C_WAIT   200
 
 enum {
-   OMAP_I2C_REV_V1 = 0,
-   OMAP_I2C_REV_V2 = 1,
-};
-
-enum {
OMAP_I2C_REV_REG = 0,   /* Only on IP V1 (OMAP34XX) */
OMAP_I2C_IE_REG,/* Only on IP V1 (OMAP34XX) */
OMAP_I2C_STAT_REG,
@@ -1051,8 +1047,12 @@ static int omap_i2c_probe_chip(struct udevice *bus, uint 
chip_addr,
 static int omap_i2c_probe(struct udevice *bus)
 {
struct omap_i2c *priv = dev_get_priv(bus);
+   struct omap_i2c_platdata *plat = dev_get_platdata(bus);
 
-   priv->ip_rev = dev_get_driver_data(bus);
+   priv->speed = plat->speed;
+   priv->regs = map_physmem(plat->base, sizeof(void *),
+MAP_NOCACHE);
+   priv->ip_rev = plat->ip_rev;
 
__omap24_i2c_init(priv->regs, priv->ip_rev, priv->speed, 0,
  >waitdelay);
@@ -1063,11 +1063,11 @@ static int omap_i2c_probe(struct udevice *bus)
 #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
 static int omap_i2c_ofdata_to_platdata(struct udevice *bus)
 {
-   struct omap_i2c *priv = dev_get_priv(bus);
+   struct omap_i2c_platdata *plat = dev_get_platdata(bus);
 
-   priv->regs = map_physmem(devfdt_get_addr(bus), sizeof(void *),
-MAP_NOCACHE);
-   priv->speed = CONFIG_SYS_OMAP24_I2C_SPEED;
+   plat->base = devfdt_get_addr(bus);
+   plat->speed = dev_read_u32_default(bus, "clock-frequency", 10);
+   plat->ip_rev = dev_get_driver_data(bus);
 
return 0;
 }
@@ -1091,6 +1091,7 @@ U_BOOT_DRIVER(i2c_omap) = {
 #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
.of_match = omap_i2c_ids,
.ofdata_to_platdata = omap_i2c_ofdata_to_platdata,
+   .platdata_auto_alloc_size = sizeof(struct omap_i2c_platdata),
 #endif
.probe  = omap_i2c_probe,
.priv_auto_alloc_size = sizeof(struct omap_i2c),
-- 
2.7.4

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


[U-Boot] [PATCH v2 02/19] dm: i2c: Add dm_i2c_probe_device() to test the presence of a chip

2018-10-05 Thread Jean-Jacques Hiblot
In a non-DM environment, it is possible to test the presence of a chip
using i2c_probe(chip_addr).
dm_i2c_probe_device() brings the same functionality with a DM interface.
The intent is to be able to test the presence of a chip for the device has
been created with i2c_get_chip_for_busnum(bus_num, chip_addr, ...)

Signed-off-by: Jean-Jacques Hiblot 
---

Changes in v2: None

 drivers/i2c/i2c-uclass.c |  8 
 include/i2c.h| 13 +
 2 files changed, 21 insertions(+)

diff --git a/drivers/i2c/i2c-uclass.c b/drivers/i2c/i2c-uclass.c
index c5a3c4e..ec88168 100644
--- a/drivers/i2c/i2c-uclass.c
+++ b/drivers/i2c/i2c-uclass.c
@@ -378,6 +378,14 @@ int dm_i2c_probe(struct udevice *bus, uint chip_addr, uint 
chip_flags,
return ret;
 }
 
+int dm_i2c_probe_device(struct udevice *dev)
+{
+   struct udevice *bus = dev_get_parent(dev);
+   struct dm_i2c_chip *chip = dev_get_parent_platdata(dev);
+
+   return i2c_probe_chip(bus, chip->chip_addr, chip->flags);
+}
+
 int dm_i2c_set_bus_speed(struct udevice *bus, unsigned int speed)
 {
struct dm_i2c_ops *ops = i2c_get_ops(bus);
diff --git a/include/i2c.h b/include/i2c.h
index d33f827..3c8fde2 100644
--- a/include/i2c.h
+++ b/include/i2c.h
@@ -167,6 +167,19 @@ int dm_i2c_probe(struct udevice *bus, uint chip_addr, uint 
chip_flags,
 struct udevice **devp);
 
 /**
+ * dm_i2c_probe_dev() - probe the presence of a I2C device
+ *
+ * This can be useful to check for the existence of a chip already probed
+ * (software wise).
+ * It is typically implemented by writing the chip address to the bus
+ * and checking that the chip replies with an ACK.
+ *
+ * @bus:   Device to probe
+ * @return 0 if a chip was found at that address, -ve if not
+ */
+int dm_i2c_probe_device(struct udevice *dev);
+
+/**
  * dm_i2c_reg_read() - Read a value from an I2C register
  *
  * This reads a single value from the given address in an I2C chip
-- 
2.7.4

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


[U-Boot] [PATCH v2 03/19] dm: device: Allow using uclass_find_device_by_seq() without OF_CONTROL

2018-10-05 Thread Jean-Jacques Hiblot
If OF_CONTROL is not enabled and DM_SEQ_ALIAS is enabled, we must
assign an alias (requested sequence number) to devices that belongs to a
class with the DM_UC_FLAG_SEQ_ALIAS flag. Otherwise
uclass_find_device_by_seq() cannot be used to get/probe a device. In
particular i2c_get_chip_for_busnum() cannot be used.

Signed-off-by: Jean-Jacques Hiblot 

---

Changes in v2:
- don't use the DT to find the req_seq number if SPL_OF_PLATDATA is used.
  Instead do it as if SPL_OF_CONTROL is not defined.

 drivers/core/device.c| 10 ++
 drivers/core/uclass.c| 24 
 include/dm/uclass-internal.h | 13 +
 3 files changed, 43 insertions(+), 4 deletions(-)

diff --git a/drivers/core/device.c b/drivers/core/device.c
index feed43c..67c8d36 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -70,7 +70,8 @@ static int device_bind_common(struct udevice *parent, const 
struct driver *drv,
 
dev->seq = -1;
dev->req_seq = -1;
-   if (CONFIG_IS_ENABLED(OF_CONTROL) && CONFIG_IS_ENABLED(DM_SEQ_ALIAS)) {
+   if (CONFIG_IS_ENABLED(DM_SEQ_ALIAS) &&
+   (uc->uc_drv->flags & DM_UC_FLAG_SEQ_ALIAS)) {
/*
 * Some devices, such as a SPI bus, I2C bus and serial ports
 * are numbered using aliases.
@@ -78,10 +79,11 @@ static int device_bind_common(struct udevice *parent, const 
struct driver *drv,
 * This is just a 'requested' sequence, and will be
 * resolved (and ->seq updated) when the device is probed.
 */
-   if (uc->uc_drv->flags & DM_UC_FLAG_SEQ_ALIAS) {
-   if (uc->uc_drv->name && ofnode_valid(node)) {
+   if (CONFIG_IS_ENABLED(OF_CONTROL) && 
!CONFIG_IS_ENABLED(OF_PLATDATA)) {
+   if (uc->uc_drv->name && ofnode_valid(node))
dev_read_alias_seq(dev, >req_seq);
-   }
+   } else {
+   dev->req_seq = uclass_find_next_free_req_seq(drv->id);
}
}
 
diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index 3113d6a..07dd6f9 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -269,6 +269,30 @@ int uclass_find_device_by_name(enum uclass_id id, const 
char *name,
return -ENODEV;
 }
 
+#if !CONFIG_IS_ENABLED(OF_CONTROL) || CONFIG_IS_ENABLED(OF_PLATDATA)
+int uclass_find_next_free_req_seq(enum uclass_id id)
+{
+   struct uclass *uc;
+   struct udevice *dev;
+   int ret;
+   int max = -1;
+
+   ret = uclass_get(id, );
+   if (ret)
+   return ret;
+
+   list_for_each_entry(dev, >dev_head, uclass_node) {
+   if ((dev->req_seq != -1) && (dev->req_seq > max))
+   max = dev->req_seq;
+   }
+
+   if (max == -1)
+   return 0;
+
+   return max + 1;
+}
+#endif
+
 int uclass_find_device_by_seq(enum uclass_id id, int seq_or_req_seq,
  bool find_req_seq, struct udevice **devp)
 {
diff --git a/include/dm/uclass-internal.h b/include/dm/uclass-internal.h
index 30d5a4f..18a838c 100644
--- a/include/dm/uclass-internal.h
+++ b/include/dm/uclass-internal.h
@@ -12,6 +12,19 @@
 #include 
 
 /**
+ * uclass_find_next_free_req_seq() - Get the next free req_seq number
+ *
+ * This returns the next free req_seq number. This is useful only if
+ * OF_CONTROL is not used. The next free req_seq number is simply the
+ * maximum req_seq of the uclass + 1.
+ * This allows assiging req_seq number in the binding order.
+ *
+ * @id:Id number of the uclass
+ * @return The next free req_seq number
+ */
+int uclass_find_next_free_req_seq(enum uclass_id id);
+
+/**
  * uclass_get_device_tail() - handle the end of a get_device call
  *
  * This handles returning an error or probing a device as needed.
-- 
2.7.4

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


Re: [U-Boot] [PATCH 02/11] efi_loader: Initial HII protocols

2018-10-05 Thread Heinrich Schuchardt
On 10/05/2018 11:49 AM, Leif Lindholm wrote:
> On Fri, Oct 05, 2018 at 05:52:09PM +0900, AKASHI, Takahiro wrote:
 2. If a platform includes a configuration infrastructure, then the
 EFI_HII_DATABASE_PROTOCOL, EFI_HII_STRING_PROTOCOL,
 EFI_HII_CONFIG_ROUTING_PROTOCOL, and EFI_HII_CONFIG_ACCESS_PROTOCOL are
 required.
>>>
>>> Do you think efi implementation on u-boot also wants those protocols?
>>> (Apparently, config access protocol can be optional for shell unless
>>> we want driver configuration?)
>>
>> One more question:
>> Does u-boot support any kind of "UEFI driver"?

I am currently working on patches to fix StartImage(), Exit(), and
UnloadImage() that will enable installing EFI drivers.

Currently the image handle is destroyed when a driver calls Exit().

Regards

Heinrich

>> If yes, is there any good example?
>> If no, do you expect that it should be supported?
> 
> I don't think full-on option ROMs with configuration menus are
> something we care about for EBBR-style implementations.
> What could be useful is things like shim - a simple driver installing
> a protocol that lets other applications running at boot-time access
> it. But I think that is already (mostly?) supported.
> 
> If someone at a later date decides that they want to support option
> ROMs, basically using U-Boot for an SBBR implementation, that will
> come with additional work required for the menu support. And should be
> possible to configure out at build time for users who don't want it.
> 
> /
> Leif
> 

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


Re: [U-Boot] [PATCH v3 1/2] arm: new board - Emlid Neutis N5 support

2018-10-05 Thread Maxime Ripard
On Fri, Oct 05, 2018 at 03:55:59PM +0300, Aleksandr Aleksandrov wrote:
> Emlid Neutis N5 is a SoM based on Allwinner H5, has a WiFi & BT
> module, DDR3 RAM and eMMC.
> 
> - add neutis-devboard target to dtb makefile
> - add dtsi file for Neutis N5 needs
> - add config file for Neutis N5 Dev board
> 
> Signed-off-by: Aleksandr Aleksandrov 
> Cc: Jagan Teki 
> Cc: Maxime Ripard 

Acked-by: Maxime Ripard 

Maxime

-- 
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


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


Re: [U-Boot] Pull request: u-boot-spi/master

2018-10-05 Thread Tom Rini
On Thu, Oct 04, 2018 at 06:46:57PM +0530, Jagan Teki wrote:

> Hi Tom,
> 
> Please pull this PR.
> 
> thanks,
> Jagan.
> 
> The following changes since commit 94228a9188803473206544c8f33649ea72bf1ee1:
> 
>   Merge git://git.denx.de/u-boot-riscv (2018-10-03 08:09:53 -0400)
> 
> are available in the Git repository at:
> 
>   git://git.denx.de/u-boot-spi.git master
> 
> for you to fetch changes up to 5eee9dee419f940ea75977df8b7ed8bb12bc029f:
> 
>   spi: Add SPI driver for MT76xx SoCs (2018-10-04 18:27:28 +0530)
> 

Applied to u-boot/master, thanks!

-- 
Tom


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


[U-Boot] Please pull ARC changes

2018-10-05 Thread Alexey Brodkin
Hi Tom,

he following changes since commit a1588ac8228881f9fe65539fa8e31f0ee3556864:

  Merge tag 'rockchip-for-v2018.11' of git://git.denx.de/u-boot-rockchip 
(2018-10-03 12:09:19 -0400)

are available in the Git repository at:

  git://git.denx.de/u-boot-arc.git tags/arc-updates-for-2018.11-rc2

for you to fetch changes up to 5396e8b1dd0ad9741b04f506ef88b5fb49d4c82a:

  arc: Add support for IoT development kit (2018-10-05 16:57:00 +0300)


Here we do a couple of impovements for all ARC boards
as well as introduce yet another developemnt board.

1. Now for ARC boards we print CPU and board info
   which is useful for users and helps with
   analysis of logs "post-mortem".

2. Synopsys IoT development kit support is added
   This one might be a bit too late as we're past RC1
   but:
1) This doesn't affect any other arches etc
   as we change purely ARC code.
2) I've got a chance to talk about U-Boot on
   IoT platforms during ELCE (my proposal was on
   a wait list and only this week I've got
   an update and invitation to talk) so it would
   be good to have this board as a primer in upstream
   code-base by the time of ELCE 2018.
3) For complete support of IoT devkit I'm yet to
   significantly rework regmap subsystem in U-Boot
   but that's a different topic and hopefully it will
   be done sometime soon... though not this release
   cycle for sure.


Alexey Brodkin (5):
  ARC: Don't pre-define CROSS_COMPILE
  ARC: Add model property to boards .dts
  ARC: Implement print_cpuinfo()
  ARC: Enable DISPLAY_CPUINFO & DISPLAY_BOARDINFO
  arc: Add support for IoT development kit

 arch/arc/Kconfig   |   5 +
 arch/arc/config.mk |   6 --
 arch/arc/dts/Makefile  |   1 +
 arch/arc/dts/abilis_tb100.dts  |   2 ++
 arch/arc/dts/axs101.dts|   2 ++
 arch/arc/dts/axs103.dts|   2 ++
 arch/arc/dts/emdk.dts  |   2 ++
 arch/arc/dts/hsdk.dts  |   2 ++
 arch/arc/dts/iot_devkit.dts|  45 

 arch/arc/dts/nsim.dts  |   2 ++
 arch/arc/lib/cpu.c |  35 
++-
 board/synopsys/iot_devkit/Kconfig  |  12 
 board/synopsys/iot_devkit/MAINTAINERS  |   5 +
 board/synopsys/iot_devkit/Makefile |   7 +++
 board/synopsys/iot_devkit/config.mk|   2 ++
 board/synopsys/iot_devkit/iot_devkit.c | 168
++
+++
 board/synopsys/iot_devkit/u-boot.lds   |  77 

 common/Kconfig |   4 ++--
 configs/iot_devkit_defconfig   |  38 
++
 include/configs/iot_devkit.h   |  84 
+++
 20 files changed, 492 insertions(+), 9 deletions(-)
 create mode 100644 arch/arc/dts/iot_devkit.dts
 create mode 100644 board/synopsys/iot_devkit/Kconfig
 create mode 100644 board/synopsys/iot_devkit/MAINTAINERS
 create mode 100644 board/synopsys/iot_devkit/Makefile
 create mode 100644 board/synopsys/iot_devkit/config.mk
 create mode 100644 board/synopsys/iot_devkit/iot_devkit.c
 create mode 100644 board/synopsys/iot_devkit/u-boot.lds
 create mode 100644 configs/iot_devkit_defconfig
 create mode 100644 include/configs/iot_devkit.h

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


Re: [U-Boot] Fwd: build u-boot failed with config CONFIG_ARMV8_PSCI by aarch linux gcc 8.1

2018-10-05 Thread Renlin Li
CC u-boot mailing list to make people aware of the discussion.

By the way, I also noticed that, the final linking command is using:
'''-pie -Bstatic --no-dynamic-linker'''
And there are self-relocating code in Start.S.

BUT it is not included when u-boot is not configured using
"POSITION_INDEPENDENT"
Which means, PIE feature cannot be used at load time.
I am not sure about the code design and use cases, but '''LDFLAGS_u-boot +=
-pie''' may need to be guarded with '''CONFIG_POSITION_INDEPENDENT''' as
well? Otherwise what is the purpose of pie without processing the dynamic
relocations?

I tried to do that, and with some fixes in other places to change the
checks for relocations, it could generate a binary without any relocations.
Though, I am NOT sure about the CORRECTNESS of the binary.

In the original code, R_AARCH64_ABS32 relocation is used to resolve an
address at static linking time. It seems works fine originally (which
doesn't mean it is not bugous). I assume it is because, no one is trying to
use pie feature really.

If people is using pie feature to load the binary in a different address,
proper relocations are required, as well as the self-relocating code.

The linker won't generate a dynamic RELATIVE relocation for _AARCH64_ABS32.
SO the address in the table won't be updated by the fixup code. However,
bfd linker will generate a dynamic RELATIVE relocation for R_AARCH64_ABS64
relocation, and it could be processed by self-relocating code, taking the
load address into account.


Regards,
Renlin


On Tue, Oct 2, 2018 at 11:45 AM Renlin Li  wrote:

> Hi Meng,
>
> Thanks for raising the issue!
> I could reproduce the issue with the information you gave.
>
> It seems to me that, the change I made earlier catches an issue here.
> in /arch/arm/cpu/armv8/psci.S
>
> */* PSCI function and ID table definition*/*
> *#define PSCI_TABLE(__id, __fn) \*
> * .word __id; \*
> * .word __fn*
>
> "*.word*" is used to hold the address of a function.
>
> The toolchain you used is aarch64-linux, which by default supports LP64
> ABI.
> This means Long and void * (pointer) data type is 64-bit.
>
> IIUC, a "*.xword*" should be used instead. Otherwise, you should use
> ILP32 ABI. But be aware, the support for ILP32 might not be complete.
>
> Regards,
> Renlin
>
>
>
>>
>> Hi All,
>> Could you please help to have a look whether below issue is valuable?
>> I got u-boot source code from https://github.com/u-boot/u-boot.git,
>> branch =
>> is master.
>> I got toolchain from
>> https://mirrors.edge.kernel.org/pub/tools/crosstool/fi=
>> les/bin/x86_64/8.1.0/
>> I built stratix10(socfpga) platform with below commands:
>> export
>> CROSS_COMPILE=3Dxxx/gcc-8.1.0-nolibc/aarch64-linux/bin/aarch64-linux=
>> -
>> export ARCH=3Darm64
>> make mrproper
>> make socfpga_stratix10_defconfig
>> make menuconfig, and then enable CONFIG_ARMV8_PSCI
>> make
>> there will be below error:
>>   LD  u-boot
>>
>> /home/wrsadmin/Project/Native/SDK/Altera-Arria-10/gcc-8.1.0-nolibc/aarch64-=
>> linux/bin/aarch64-linux-ld.bfd: arch/arm/cpu/armv8/built-in.o: relocation
>> R=
>> _AARCH64_ABS32 against `psci_cpu_suspend' can not be used when making a
>> sha=
>> red object
>
>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v1 12/19] configs: am335x_pdu001: Explicitly enable CONFIG_I2C_COMPAT

2018-10-05 Thread Felix Brack
Hello Jean-Jacques,

On 05.10.2018 15:09, Jean-Jacques Hiblot wrote:
> Hi Felix,
> 
> On 05/10/2018 14:25, Felix Brack wrote:
>> Hello Jean-Jacques,
>>
>> On 04.10.2018 15:47, Jean-Jacques Hiblot wrote:
>>> CONFIG_I2C_COMPAT is currently enabled in ti_armv7_common.h
>>> Let us use the Kconfig option instead so that any change to
>>> CONFIG_I2C_COMPAT in ti_armv7_common.h doesn't break this platform.
>>>
>> As I can't find CONFIG_I2C_COMPAT anywhere I guess it is a typo and you
>> had meant CONFIG_DM_I2C_COMPAT.
> 
>>
>>> Signed-off-by: Jean-Jacques Hiblot 
>>> ---
>>>
>>>   configs/am335x_pdu001_defconfig | 1 +
>>>   1 file changed, 1 insertion(+)
>>>
>>> diff --git a/configs/am335x_pdu001_defconfig
>>> b/configs/am335x_pdu001_defconfig
>>> index a666318..6e66e68 100644
>>> --- a/configs/am335x_pdu001_defconfig
>>> +++ b/configs/am335x_pdu001_defconfig
>>> @@ -38,6 +38,7 @@ CONFIG_SPL_DM=y
>>>   CONFIG_SPL_DM_SEQ_ALIAS=y
>>>   CONFIG_DM_GPIO=y
>>>   CONFIG_DM_I2C=y
>>> +CONFIG_DM_I2C_COMPAT=y
>> This is neither required nor wanted. CONFIG_DM_I2C_COMPAT is _undefined_
>> in file pdu001.h, from which I quote lines 15-19:
>>
>> ---
>> /* No more need for I2C legacy compatibility for this board.
>>   * CONFIG_DM_I2C_COMPAT is defined in ti_armv7_common.h. See the comment
>> there
>>   * for the right moment to delete the following line.
>>   */
>> #undef CONFIG_DM_I2C_COMPAT
>> ---
>>
>> Once CONFIG_DM_I2C_COMPAT is removed from ti_armv7_common.h the above
>> #undef could be removed as well.
> Nevertheless there is a call to i2c_init() in get_dpll_ddr_params()
> (board.c:212).
Correct, looks like a leftover. I have just tested and can confirm that
the board runs fine without the call to i2c_init().

> I'll remove this call in v2 and DM_I2C_COMPAT from config file
> 
Yes, many thanks for your work!

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


Re: [U-Boot] [PATCH v1 12/19] configs: am335x_pdu001: Explicitly enable CONFIG_I2C_COMPAT

2018-10-05 Thread Jean-Jacques Hiblot

Hi Felix,

On 05/10/2018 14:25, Felix Brack wrote:

Hello Jean-Jacques,

On 04.10.2018 15:47, Jean-Jacques Hiblot wrote:

CONFIG_I2C_COMPAT is currently enabled in ti_armv7_common.h
Let us use the Kconfig option instead so that any change to
CONFIG_I2C_COMPAT in ti_armv7_common.h doesn't break this platform.


As I can't find CONFIG_I2C_COMPAT anywhere I guess it is a typo and you
had meant CONFIG_DM_I2C_COMPAT.





Signed-off-by: Jean-Jacques Hiblot 
---

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

diff --git a/configs/am335x_pdu001_defconfig b/configs/am335x_pdu001_defconfig
index a666318..6e66e68 100644
--- a/configs/am335x_pdu001_defconfig
+++ b/configs/am335x_pdu001_defconfig
@@ -38,6 +38,7 @@ CONFIG_SPL_DM=y
  CONFIG_SPL_DM_SEQ_ALIAS=y
  CONFIG_DM_GPIO=y
  CONFIG_DM_I2C=y
+CONFIG_DM_I2C_COMPAT=y

This is neither required nor wanted. CONFIG_DM_I2C_COMPAT is _undefined_
in file pdu001.h, from which I quote lines 15-19:

---
/* No more need for I2C legacy compatibility for this board.
  * CONFIG_DM_I2C_COMPAT is defined in ti_armv7_common.h. See the comment
there
  * for the right moment to delete the following line.
  */
#undef CONFIG_DM_I2C_COMPAT
---

Once CONFIG_DM_I2C_COMPAT is removed from ti_armv7_common.h the above
#undef could be removed as well.
Nevertheless there is a call to i2c_init() in get_dpll_ddr_params() 
(board.c:212).

I'll remove this call in v2 and DM_I2C_COMPAT from config file



regards, Felix


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


Re: [U-Boot] [PATCH 02/11] efi_loader: Initial HII protocols

2018-10-05 Thread Alexander Graf

On 10/05/2018 11:49 AM, Leif Lindholm wrote:

On Fri, Oct 05, 2018 at 05:52:09PM +0900, AKASHI, Takahiro wrote:

2. If a platform includes a configuration infrastructure, then the
EFI_HII_DATABASE_PROTOCOL, EFI_HII_STRING_PROTOCOL,
EFI_HII_CONFIG_ROUTING_PROTOCOL, and EFI_HII_CONFIG_ACCESS_PROTOCOL are
required.

Do you think efi implementation on u-boot also wants those protocols?
(Apparently, config access protocol can be optional for shell unless
we want driver configuration?)

One more question:
Does u-boot support any kind of "UEFI driver"?
If yes, is there any good example?
If no, do you expect that it should be supported?

I don't think full-on option ROMs with configuration menus are
something we care about for EBBR-style implementations.
What could be useful is things like shim - a simple driver installing
a protocol that lets other applications running at boot-time access
it. But I think that is already (mostly?) supported.


That works, iPXE also works. But neither use HII from what I'm aware of.


If someone at a later date decides that they want to support option
ROMs, basically using U-Boot for an SBBR implementation, that will
come with additional work required for the menu support. And should be
possible to configure out at build time for users who don't want it.


Yeah, IMHO for HII we can treat it as a Shell.efi only wart we have to 
live with, but implement as little as we can get away with.



Alex

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


[U-Boot] [PATCH v3 1/2] arm: new board - Emlid Neutis N5 support

2018-10-05 Thread Aleksandr Aleksandrov
Emlid Neutis N5 is a SoM based on Allwinner H5, has a WiFi & BT
module, DDR3 RAM and eMMC.

- add neutis-devboard target to dtb makefile
- add dtsi file for Neutis N5 needs
- add config file for Neutis N5 Dev board

Signed-off-by: Aleksandr Aleksandrov 
Cc: Jagan Teki 
Cc: Maxime Ripard 
---
 arch/arm/dts/Makefile  |   1 +
 .../arm/dts/sun50i-h5-emlid-neutis-n5-devboard.dts | 184 +
 arch/arm/dts/sun50i-h5-emlid-neutis-n5.dtsi|  96 +++
 configs/emlid_neutis_n5_devboard_defconfig |  13 ++
 4 files changed, 294 insertions(+)
 create mode 100644 arch/arm/dts/sun50i-h5-emlid-neutis-n5-devboard.dts
 create mode 100644 arch/arm/dts/sun50i-h5-emlid-neutis-n5.dtsi
 create mode 100644 configs/emlid_neutis_n5_devboard_defconfig

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 44ebc50..0a5e93e 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -385,6 +385,7 @@ dtb-$(CONFIG_MACH_SUN8I_R40) += \
 dtb-$(CONFIG_MACH_SUN8I_V3S) += \
sun8i-v3s-licheepi-zero.dtb
 dtb-$(CONFIG_MACH_SUN50I_H5) += \
+   sun50i-h5-emlid-neutis-n5-devboard.dtb \
sun50i-h5-libretech-all-h3-cc.dtb \
sun50i-h5-nanopi-neo2.dtb \
sun50i-h5-nanopi-neo-plus2.dtb \
diff --git a/arch/arm/dts/sun50i-h5-emlid-neutis-n5-devboard.dts 
b/arch/arm/dts/sun50i-h5-emlid-neutis-n5-devboard.dts
new file mode 100644
index 000..493947c
--- /dev/null
+++ b/arch/arm/dts/sun50i-h5-emlid-neutis-n5-devboard.dts
@@ -0,0 +1,184 @@
+/*
+ * Copyright (C) 2018 Aleksandr Aleksandrov 
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+
+#include "sun50i-h5-emlid-neutis-n5.dtsi"
+
+/ {
+   model = "Emlid Neutis N5 Developer board";
+   compatible = "emlid,emlid-neutis-n5-devboard",
+   "emlid,emlid-neutis-n5",
+   "allwinner,sun50i-h5";
+
+   aliases {
+   serial0 = 
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   connector {
+   compatible = "hdmi-connector";
+   type = "a";
+
+   port {
+   hdmi_con_in: endpoint {
+   remote-endpoint = <_out_con>;
+   };
+   };
+   };
+
+   reg_usb0_vbus: usb0-vbus {
+   compatible = "regulator-fixed";
+   regulator-name = "usb0-vbus";
+   regulator-min-microvolt = <500>;
+   regulator-max-microvolt = <500>;
+   enable-active-high;
+   gpio = <_pio 0 9 GPIO_ACTIVE_HIGH>;   /* PL9 */
+   status = "okay";
+   };
+
+   vdd_cpux: gpio-regulator {
+   compatible = "regulator-gpio";
+   pinctrl-names = "default";
+   regulator-name = "vdd-cpux";
+   regulator-type = "voltage";
+   regulator-boot-on;
+   regulator-always-on;
+   regulator-min-microvolt = <110>;
+   regulator-max-microvolt = 

[U-Boot] [PATCH v3 0/2] Neutis N5 support

2018-10-05 Thread Aleksandr Aleksandrov
This series of pathes addes Neutis N5 support.
Emlid Neutis N5 is a SoM based on Allwinner H5.
1st patch includes device tree file and defconfig for
Dev board and dtsi file for SoM needs.

Changes from v1 (4 oct 2018): add to maintainers myself and
separate dts file: dtsi for SoM and motherboard dts file that
inlcudes dtsi file.

Changes from v2 (5 oct 2018):
1/2: - put Jagan Teki and Maxime Ripard in Cc
 - copy DT files from Linux
 - makefile: dtb-$(CONFIG_MACH_SUN50I_H5) - ordered alphabetically
2/2: - put Tom Rini in Cc

Aleksandr Aleksandrov (2):
  arm: new board - Emlid Neutis N5 support
  sunxi MAINTAINERS: add new entry for Emlid Neutis N5

 arch/arm/dts/Makefile  |   1 +
 .../arm/dts/sun50i-h5-emlid-neutis-n5-devboard.dts | 184 +
 arch/arm/dts/sun50i-h5-emlid-neutis-n5.dtsi|  96 +++
 board/sunxi/MAINTAINERS|   5 +
 configs/emlid_neutis_n5_devboard_defconfig |  13 ++
 5 files changed, 299 insertions(+)
 create mode 100644 arch/arm/dts/sun50i-h5-emlid-neutis-n5-devboard.dts
 create mode 100644 arch/arm/dts/sun50i-h5-emlid-neutis-n5.dtsi
 create mode 100644 configs/emlid_neutis_n5_devboard_defconfig

-- 
2.7.4

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


[U-Boot] [PATCH v3 2/2] sunxi MAINTAINERS: add new entry for Emlid Neutis N5

2018-10-05 Thread Aleksandr Aleksandrov
Signed-off-by: Aleksandr Aleksandrov 
Cc: Tom Rini 
---
 board/sunxi/MAINTAINERS | 5 +
 1 file changed, 5 insertions(+)

diff --git a/board/sunxi/MAINTAINERS b/board/sunxi/MAINTAINERS
index 2f95976..ad7d660 100644
--- a/board/sunxi/MAINTAINERS
+++ b/board/sunxi/MAINTAINERS
@@ -177,6 +177,11 @@ M: Chen-Yu Tsai 
 S: Maintained
 F: configs/Cubietruck_plus_defconfig
 
+EMLID NEUTIS N5 DEV BOARD
+M: Aleksandr Aleksandrov 
+S: Maintained
+F: configs/emlid_neutis_n5_devboard_defconfig
+
 GEMEI-G9 TABLET
 M: Priit Laes 
 S: Maintained
-- 
2.7.4

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


Re: [U-Boot] [PATCH v1 12/19] configs: am335x_pdu001: Explicitly enable CONFIG_I2C_COMPAT

2018-10-05 Thread Felix Brack
Hello Jean-Jacques,

On 04.10.2018 15:47, Jean-Jacques Hiblot wrote:
> CONFIG_I2C_COMPAT is currently enabled in ti_armv7_common.h
> Let us use the Kconfig option instead so that any change to
> CONFIG_I2C_COMPAT in ti_armv7_common.h doesn't break this platform.
> 
As I can't find CONFIG_I2C_COMPAT anywhere I guess it is a typo and you
had meant CONFIG_DM_I2C_COMPAT.

> Signed-off-by: Jean-Jacques Hiblot 
> ---
> 
>  configs/am335x_pdu001_defconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/configs/am335x_pdu001_defconfig b/configs/am335x_pdu001_defconfig
> index a666318..6e66e68 100644
> --- a/configs/am335x_pdu001_defconfig
> +++ b/configs/am335x_pdu001_defconfig
> @@ -38,6 +38,7 @@ CONFIG_SPL_DM=y
>  CONFIG_SPL_DM_SEQ_ALIAS=y
>  CONFIG_DM_GPIO=y
>  CONFIG_DM_I2C=y
> +CONFIG_DM_I2C_COMPAT=y
This is neither required nor wanted. CONFIG_DM_I2C_COMPAT is _undefined_
in file pdu001.h, from which I quote lines 15-19:

---
/* No more need for I2C legacy compatibility for this board.
 * CONFIG_DM_I2C_COMPAT is defined in ti_armv7_common.h. See the comment
there
 * for the right moment to delete the following line.
 */
#undef CONFIG_DM_I2C_COMPAT
---

Once CONFIG_DM_I2C_COMPAT is removed from ti_armv7_common.h the above
#undef could be removed as well.

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


Re: [U-Boot] [PATCH v1 00/19] DM_I2C_COMPAT removal for all ti platforms

2018-10-05 Thread Lokesh Vutla

Hi JJ,

On Thursday 04 October 2018 07:17 PM, Jean-Jacques Hiblot wrote:

This series remove the usage of the DM_I2C_COMPAT option for all the ti
platforms. It also takes this opportunity to not disable DM_I2C in the SPL.

There are a couples of issues to fix:
- CMD_EEPROM does not support the DM API. Fixed by removing this option
   when DM_I2C is used without DM_I2C_COMPAT
- i2c_get_chip_for_busnum() does not work when OF_CONTROL is not used
   (as is the case with am33xx SPL).
- The I2C driver do not support DM_I2C without OF_CONTROL.
- Most of the PMIC drivers do not support the I2C DM API.
- Board detection is done prior DM initialization. Fixed by moving it after
   DM is initialized. That move breaks the DRA7 platforms (The fixes for
   that are at the last 5 patches this series)

When all this is taken care of DM_I2C_COMPAT can be removed and DM_I2C
enabled in the SPL.

This has been tested with the following boards:
- am437x SK
- am335x SK
- am335x beaglebone (both DM and non-DM config)
- dra76 evm
- am572 evm
- k2g evm


I triggered a Travis-CI buid[1] for this series and there are 2 build failures. 
Can you check?


[1] https://travis-ci.org/lokeshvutla/u-boot/builds/437487725

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


Re: [U-Boot] [PATCH v1 00/19] DM_I2C_COMPAT removal for all ti platforms

2018-10-05 Thread Jean-Jacques Hiblot

Adam,


On 04/10/2018 23:55, Adam Ford wrote:

On Thu, Oct 4, 2018 at 8:48 AM Jean-Jacques Hiblot  wrote:

This series remove the usage of the DM_I2C_COMPAT option for all the ti
platforms. It also takes this opportunity to not disable DM_I2C in the SPL.

Thanks for doing that, but I have some bad news.  I started testing
omap3_logic from a fresh pull of master, and I applied the entire 19
patch series. I did a distclean, then make omap3_logic, but I am
getting build errors:

drivers/built-in.o: In function `dev_read_alias_seq':
/home/aford/src/u-boot/include/dm/read.h:600: undefined reference to
`fdtdec_get_alias_seq'
scripts/Makefile.spl:357: recipe for target 'spl/u-boot-spl' failed
make[1]: *** [spl/u-boot-spl] Error 1
Makefile:1534: recipe for target 'spl/u-boot-spl' failed
make: *** [spl/u-boot-spl] Error 2

The good news is that the main U-Boot built, and I was able to test a
few of the PMIC features (like poweroff), but I haven't had a chance
to test other PMIC features (like the USB transceiver yet), but I'll
do a more thorough test once SPL can correctly build.

The quick fix is

--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -79,7 +79,7 @@ static int device_bind_common(struct udevice *parent, 
const struct driver *drv,

 * This is just a 'requested' sequence, and will be
 * resolved (and ->seq updated) when the device is probed.
 */
-   if (CONFIG_IS_ENABLED(OF_CONTROL)) {
+   if (CONFIG_IS_ENABLED(OF_CONTROL) && 
!CONFIG_IS_ENABLED(OF_PLATDATA)) {

    if (uc->uc_drv->name && ofnode_valid(node))
    dev_read_alias_seq(dev, >req_seq);
    } else {

--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -269,7 +269,7 @@ int uclass_find_device_by_name(enum uclass_id id, 
const char *name,

    return -ENODEV;
 }

-#if !CONFIG_IS_ENABLED(OF_CONTROL)
+#if !CONFIG_IS_ENABLED(OF_CONTROL) || CONFIG_IS_ENABLED(OF_PLATDATA)
 int uclass_find_next_free_req_seq(enum uclass_id id)
 {
    struct uclass *uc;

It will be part of a v2.
Thanks for catching this.

Can you also try to boot without OF_CONTROL and OF_PLATDATA (basically 
reverting e3b1aaa4 and  6931ab2f) ?

Thanks,
JJ




adam


There are a couples of issues to fix:
- CMD_EEPROM does not support the DM API. Fixed by removing this option
   when DM_I2C is used without DM_I2C_COMPAT
- i2c_get_chip_for_busnum() does not work when OF_CONTROL is not used
   (as is the case with am33xx SPL).
- The I2C driver do not support DM_I2C without OF_CONTROL.
- Most of the PMIC drivers do not support the I2C DM API.
- Board detection is done prior DM initialization. Fixed by moving it after
   DM is initialized. That move breaks the DRA7 platforms (The fixes for
   that are at the last 5 patches this series)

When all this is taken care of DM_I2C_COMPAT can be removed and DM_I2C
enabled in the SPL.

This has been tested with the following boards:
- am437x SK
- am335x SK
- am335x beaglebone (both DM and non-DM config)
- dra76 evm
- am572 evm
- k2g evm



Andreas Dannenberg (1):
   ti: common: board_detect: Allow DM I2C without CONFIG_DM_I2C_COMPAT

Jean-Jacques Hiblot (17):
   cmd: Kconfig: Do not include EEPROM if DM_I2C is used without
 DM_I2C_COMPAT
   dm: i2c: Add dm_i2c_probe_device() to test the presence of a chip
   dm: device: Allow using uclass_find_device_by_seq() without OF_CONTROL
   configs: am335x: am57x: dra7x: Enable CONFIG_SPL_DM_SEQ_ALIAS
   i2c: omap24xx_i2c: Use platdata to probe the device
   am335x: Register the I2C controllers if DM_I2C is used.
   dts: am43x: omap5: Add node for I2C in SPL
   omap: detect the board after DM is available
   power: make most tps drivers and the twl4030 driver compatible with
 DM_I2C
   configs: am335x_pdu001: Explicitly enable CONFIG_I2C_COMPAT
   ti: remove usage of DM_I2C_COMPAT and don't disable DM_I2C in SPL
   am57xx: remove non-DM I2C code
   configs: dra7xx-evm: increase the size of the malloc's pool before
 relocation
   lib: fdtdec: Add function re-setup the fdt more effeciently
   drivers: core: Add the option SPL_DM_DEVICE_REMOVE to the Kconfig
   drivers: core: nullify gd->dm_root after dm_uninit()
   dra7: Allow selecting a new dtb after board detection.

Vignesh R (1):
   i2c: omap24xx_i2c: Move away from SoC specific headers for reg offset

  arch/arm/dts/am437x-gp-evm-u-boot.dtsi   |   4 +
  arch/arm/dts/omap5-u-boot.dtsi   |   4 +
  arch/arm/include/asm/arch-am33xx/i2c.h   |  47 +--
  arch/arm/include/asm/arch-omap3/i2c.h|  47 ---
  arch/arm/include/asm/arch-omap4/i2c.h|  45 ---
  arch/arm/include/asm/arch-omap5/i2c.h|  45 ---
  arch/arm/include/asm/omap_i2c.h  |  24 ++
  arch/arm/mach-keystone/ddr3_spd.c|   7 +
  arch/arm/mach-omap2/am33xx/board.c   |  24 +-
  arch/arm/mach-omap2/am33xx/clk_synthesizer.c |  56 +++-
  arch/arm/mach-omap2/clocks-common.c  

[U-Boot] [PATCH] add default-option to bootmenu

2018-10-05 Thread Frank Wunderlich
From 6304b2ee2d2e9be47672d3559fee8d879b7328ff Mon Sep 17 00:00:00 2001
From: Frank Wunderlich 
Date: Fri, 5 Oct 2018 11:41:59 +0200
Subject: [PATCH] add default-option to bootmenu
with this patch the selected Entry in bootmenu can be set by
environment-var bootmenu_default=
Signed-off-by: Frank Wunderlich 
---
 cmd/bootmenu.c   |   5 +
 files/u-boot.bin | Bin 278424 -> 278480 bytes
 uEnv.txt |   2 ++
 3 files changed, 7 insertions(+)
diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c
index 21f353ffd3..979ac4a638 100644
--- a/cmd/bootmenu.c
+++ b/cmd/bootmenu.c
@@ -253,6 +253,7 @@ static struct bootmenu_data *bootmenu_create(int delay)
 
    int len;
    char *sep;
+   char *default_str;
    struct bootmenu_entry *entry;
 
    menu = malloc(sizeof(struct bootmenu_data));
@@ -263,6 +264,10 @@ static struct bootmenu_data *bootmenu_create(int delay)
    menu->active = 0;
    menu->first = NULL;
 
+   default_str = env_get("bootmenu_default");
+   if (default_str)
+   menu->active = (int)simple_strtol(default_str, NULL, 10);
+
    while ((option = bootmenu_getoption(i))) {
    sep = strchr(option, '=');
    if (!sep) {
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v1 03/19] dm: device: Allow using uclass_find_device_by_seq() without OF_CONTROL

2018-10-05 Thread Jean-Jacques Hiblot



On 05/10/2018 10:50, Jean-Jacques Hiblot wrote:

Hi Adam,



On 05/10/2018 00:42, Adam Ford wrote:
On Thu, Oct 4, 2018 at 8:48 AM Jean-Jacques Hiblot  
wrote:

If OF_CONTROL is not enabled and DM_SEQ_ALIAS is enabled, we must
assign an alias (requested sequence number) to devices that belongs 
to a

class with the DM_UC_FLAG_SEQ_ALIAS flag. Otherwise

What about conditions where both OF_CONTROL and PLATDATA are set?  I
am not sure what it all does, so maybe it's OK, but I know PLATDATA is
a reduced library which I know the omap3_logic uses to keep SPL small.

Thanks for the review and for trying the patches.

if OF_PLATDATA is used, dts is not parsed at all, so alias can't be 
read from dt => the seq_alias should be computed as if OF_CONTROL is 
not set.


Now I'm curious how enabling OF_PLATDATA even works on omap3_logic. 
Most TI drivers (all ?) do not support it.

I don't have any omap3 board, but I'll give it a try on beaglebone.

OK. So I think I understand a bit more what is happening here.
The omap3_logic does not actually take advantage of SPL_OF_PLATDATA nor 
SPL_OF_CONTROL. Devices are instantiated by the SPL the old way, using 
U_BOOT_DEVICE() (board/logicpd/omap3logic.c:45-70). In the SPL, the I2C 
instantiation is missing, but I guess that it is ok because nobody 
checks the return value of the calls to twl4030 functions.


You probably can remove SPL_OF_PLATDATA and SPL_OF_CONTROL and still be 
able to boot.


JJ






uclass_find_device_by_seq() cannot be used to get/probe a device. In
particular i2c_get_chip_for_busnum() cannot be used.

Signed-off-by: Jean-Jacques Hiblot 
---

  drivers/core/device.c    | 10 ++
  drivers/core/uclass.c    | 24 
  include/dm/uclass-internal.h | 13 +
  3 files changed, 43 insertions(+), 4 deletions(-)

diff --git a/drivers/core/device.c b/drivers/core/device.c
index feed43c..e441021 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -70,7 +70,8 @@ static int device_bind_common(struct udevice 
*parent, const struct driver *drv,


 dev->seq = -1;
 dev->req_seq = -1;
-   if (CONFIG_IS_ENABLED(OF_CONTROL) && 
CONFIG_IS_ENABLED(DM_SEQ_ALIAS)) {

+   if (CONFIG_IS_ENABLED(DM_SEQ_ALIAS) &&

Is there are reason these cannot be #if statements (opposed to just
'if') to let the pre-compiler enable/disable code?  I am assuming
these values won't change, but I could be wrong.

The solution woulb de to use
if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA))
instead of
if (CONFIG_IS_ENABLED(OF_CONTROL)



+   (uc->uc_drv->flags & DM_UC_FLAG_SEQ_ALIAS)) {
 /*
  * Some devices, such as a SPI bus, I2C bus and 
serial ports

  * are numbered using aliases.
@@ -78,10 +79,11 @@ static int device_bind_common(struct udevice 
*parent, const struct driver *drv,

  * This is just a 'requested' sequence, and will be
  * resolved (and ->seq updated) when the device is 
probed.

  */
-   if (uc->uc_drv->flags & DM_UC_FLAG_SEQ_ALIAS) {
-   if (uc->uc_drv->name && ofnode_valid(node)) {
+   if (CONFIG_IS_ENABLED(OF_CONTROL)) {
+   if (uc->uc_drv->name && ofnode_valid(node))
 dev_read_alias_seq(dev, 
>req_seq);

-   }
+   } else {
+   dev->req_seq = 
uclass_find_next_free_req_seq(drv->id);

 }
 }

diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index 3113d6a..376f882 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -269,6 +269,30 @@ int uclass_find_device_by_name(enum uclass_id 
id, const char *name,

 return -ENODEV;
  }

+#if !CONFIG_IS_ENABLED(OF_CONTROL)

ditto

+int uclass_find_next_free_req_seq(enum uclass_id id)
+{
+   struct uclass *uc;
+   struct udevice *dev;
+   int ret;
+   int max = -1;
+
+   ret = uclass_get(id, );
+   if (ret)
+   return ret;
+
+   list_for_each_entry(dev, >dev_head, uclass_node) {
+   if ((dev->req_seq != -1) && (dev->req_seq > max))
+   max = dev->req_seq;
+   }
+
+   if (max == -1)
+   return 0;
+
+   return max + 1;
+}
+#endif
+
  int uclass_find_device_by_seq(enum uclass_id id, int seq_or_req_seq,
   bool find_req_seq, struct udevice 
**devp)

  {
diff --git a/include/dm/uclass-internal.h 
b/include/dm/uclass-internal.h

index 30d5a4f..18a838c 100644
--- a/include/dm/uclass-internal.h
+++ b/include/dm/uclass-internal.h
@@ -12,6 +12,19 @@
  #include 

  /**
+ * uclass_find_next_free_req_seq() - Get the next free req_seq number
+ *
+ * This returns the next free req_seq number. This is useful only if
+ * OF_CONTROL is not used. The next free req_seq number is simply the
+ * maximum req_seq of the uclass + 1.
+ * This 

Re: [U-Boot] [PATCH V5 32/32] imx: add i.MX8QXP MEK board support

2018-10-05 Thread Stefano Babic
On 05/10/2018 12:57, Peng Fan wrote:
> Hi Stefano,
> 
>> -Original Message-
>> From: Stefano Babic [mailto:sba...@denx.de]
>> Sent: 2018年10月5日 18:54
>> To: Peng Fan ; sba...@denx.de; ag...@denx.de
>> Cc: u-boot@lists.denx.de; Fabio Estevam 
>> Subject: Re: [PATCH V5 32/32] imx: add i.MX8QXP MEK board support
>>
>> Hi Peng,
>>
>> I am fine with most patches of this series. 
> 
> Thanks.
> 
> Anyway, I see that to build the image
>> you are using a "fork" of mkimage...
> 
> Yes. I am developing the i.MX8X mkimage support in U-Boot.
> I think It could catch up next release.

ok - thanks !

Best regards,
Stefano

> 
> Thanks,
> Peng.
> 
>>
>>
>> On 26/09/2018 15:52, Peng Fan wrote:
>>> Add i.MX8QXP MEK board support
>>> Enabled pinctrl/clk/power domain/mmc/i2c driver.
>>> Added README file.
>>>
>>> Signed-off-by: Peng Fan 
>>> Cc: Stefano Babic 
>>> Cc: Fabio Estevam 
>>> Cc: Anatolij Gustschin 
>>> ---
>>>  arch/arm/dts/Makefile |   2 +
>>>  arch/arm/dts/fsl-imx8qxp-mek.dts  | 136
>> ++
>>>  arch/arm/mach-imx/imx8/Kconfig|  13 +++
>>>  board/freescale/imx8qxp_mek/Kconfig   |  14 +++
>>>  board/freescale/imx8qxp_mek/MAINTAINERS   |   6 ++
>>>  board/freescale/imx8qxp_mek/Makefile  |   7 ++
>>>  board/freescale/imx8qxp_mek/README|  72 ++
>>>  board/freescale/imx8qxp_mek/imx8qxp_mek.c | 152
>> +
>>>  board/freescale/mx8mq_evk/README  |  81
>> 
>>>  configs/imx8qxp_mek_defconfig |  38 
>>>  include/configs/imx8qxp_mek.h | 156
>> ++
>>>  11 files changed, 677 insertions(+)
>>>  create mode 100644 arch/arm/dts/fsl-imx8qxp-mek.dts  create mode
>>> 100644 board/freescale/imx8qxp_mek/Kconfig
>>>  create mode 100644 board/freescale/imx8qxp_mek/MAINTAINERS
>>>  create mode 100644 board/freescale/imx8qxp_mek/Makefile
>>>  create mode 100644 board/freescale/imx8qxp_mek/README
>>>  create mode 100644 board/freescale/imx8qxp_mek/imx8qxp_mek.c
>>>  create mode 100644 board/freescale/mx8mq_evk/README  create mode
>>> 100644 configs/imx8qxp_mek_defconfig  create mode 100644
>>> include/configs/imx8qxp_mek.h
>>>
>>> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index
>>> 44ebc50bfa..61598bdfeb 100644
>>> --- a/arch/arm/dts/Makefile
>>> +++ b/arch/arm/dts/Makefile
>>> @@ -452,6 +452,8 @@ dtb-$(CONFIG_MX7) += imx7-colibri.dtb \
>>>
>>>  dtb-$(CONFIG_ARCH_MX7ULP) += imx7ulp-evk.dtb
>>>
>>> +dtb-$(CONFIG_ARCH_IMX8) += fsl-imx8qxp-mek.dtb
>>> +
>>>  dtb-$(CONFIG_RCAR_GEN3) += \
>>> r8a7795-h3ulcb.dtb \
>>> r8a7795-salvator-x.dtb \
>>> diff --git a/arch/arm/dts/fsl-imx8qxp-mek.dts
>>> b/arch/arm/dts/fsl-imx8qxp-mek.dts
>>> new file mode 100644
>>> index 00..6c3bc1dc4d
>>> --- /dev/null
>>> +++ b/arch/arm/dts/fsl-imx8qxp-mek.dts
>>> @@ -0,0 +1,136 @@
>>> +// SPDX-License-Identifier: GPL-2.0+
>>> +/*
>>> + * Copyright 2017-2018 NXP
>>> + */
>>> +
>>> +/dts-v1/;
>>> +
>>> +#include "fsl-imx8qxp.dtsi"
>>> +
>>> +/ {
>>> +   model = "Freescale i.MX8QXP MEK";
>>> +   compatible = "fsl,imx8qxp-mek", "fsl,imx8qxp";
>>> +
>>> +   chosen {
>>> +   bootargs = "console=ttyLP0,115200
>> earlycon=lpuart32,0x5a06,115200";
>>> +   stdout-path = 
>>> +   };
>>> +
>>> +   regulators {
>>> +   compatible = "simple-bus";
>>> +   #address-cells = <1>;
>>> +   #size-cells = <0>;
>>> +
>>> +   reg_usdhc2_vmmc: usdhc2-vmmc {
>>> +   compatible = "regulator-fixed";
>>> +   regulator-name = "SD1_SPWR";
>>> +   regulator-min-microvolt = <300>;
>>> +   regulator-max-microvolt = <300>;
>>> +   gpio = < 19 GPIO_ACTIVE_HIGH>;
>>> +   off-on-delay = <3480>;
>>> +   enable-active-high;
>>> +   };
>>> +   };
>>> +};
>>> +
>>> + {
>>> +   pinctrl-names = "default";
>>> +   pinctrl-0 = <_hog>;
>>> +
>>> +   imx8qxp-mek {
>>> +   pinctrl_hog: hoggrp {
>>> +   fsl,pins = <
>>> +   SC_P_MCLK_OUT0_ADMA_ACM_MCLK_OUT0
>>  0x064c
>>> +   SC_P_COMP_CTL_GPIO_1V8_3V3_GPIORHB_PAD
>>  0x000514a0
>>> +   >;
>>> +   };
>>> +
>>> +   pinctrl_ioexp_rst: ioexp-rst-grp {
>>> +   fsl,pins = <
>>> +   SC_P_SPI2_SDO_LSIO_GPIO1_IO01   0x0621
>>> +   >;
>>> +   };
>>> +
>>> +   pinctrl_lpi2c1: lpi1cgrp {
>>> +   fsl,pins = <
>>> +   SC_P_USB_SS3_TC1_ADMA_I2C1_SCL  0x0621
>>> +   SC_P_USB_SS3_TC3_ADMA_I2C1_SDA  0x0621
>>> +   >;
>>> +   };
>>> +
>>> +   pinctrl_lpuart0: lpuart0grp {
>>> +   fsl,pins = <
>>> +   SC_P_UART0_RX_ADMA_UART0_RX 

Re: [U-Boot] [PATCH V5 32/32] imx: add i.MX8QXP MEK board support

2018-10-05 Thread Peng Fan
Hi Stefano,

> -Original Message-
> From: Stefano Babic [mailto:sba...@denx.de]
> Sent: 2018年10月5日 18:54
> To: Peng Fan ; sba...@denx.de; ag...@denx.de
> Cc: u-boot@lists.denx.de; Fabio Estevam 
> Subject: Re: [PATCH V5 32/32] imx: add i.MX8QXP MEK board support
> 
> Hi Peng,
> 
> I am fine with most patches of this series. 

Thanks.

Anyway, I see that to build the image
> you are using a "fork" of mkimage...

Yes. I am developing the i.MX8X mkimage support in U-Boot.
I think It could catch up next release.

Thanks,
Peng.

> 
> 
> On 26/09/2018 15:52, Peng Fan wrote:
> > Add i.MX8QXP MEK board support
> > Enabled pinctrl/clk/power domain/mmc/i2c driver.
> > Added README file.
> >
> > Signed-off-by: Peng Fan 
> > Cc: Stefano Babic 
> > Cc: Fabio Estevam 
> > Cc: Anatolij Gustschin 
> > ---
> >  arch/arm/dts/Makefile |   2 +
> >  arch/arm/dts/fsl-imx8qxp-mek.dts  | 136
> ++
> >  arch/arm/mach-imx/imx8/Kconfig|  13 +++
> >  board/freescale/imx8qxp_mek/Kconfig   |  14 +++
> >  board/freescale/imx8qxp_mek/MAINTAINERS   |   6 ++
> >  board/freescale/imx8qxp_mek/Makefile  |   7 ++
> >  board/freescale/imx8qxp_mek/README|  72 ++
> >  board/freescale/imx8qxp_mek/imx8qxp_mek.c | 152
> +
> >  board/freescale/mx8mq_evk/README  |  81
> 
> >  configs/imx8qxp_mek_defconfig |  38 
> >  include/configs/imx8qxp_mek.h | 156
> ++
> >  11 files changed, 677 insertions(+)
> >  create mode 100644 arch/arm/dts/fsl-imx8qxp-mek.dts  create mode
> > 100644 board/freescale/imx8qxp_mek/Kconfig
> >  create mode 100644 board/freescale/imx8qxp_mek/MAINTAINERS
> >  create mode 100644 board/freescale/imx8qxp_mek/Makefile
> >  create mode 100644 board/freescale/imx8qxp_mek/README
> >  create mode 100644 board/freescale/imx8qxp_mek/imx8qxp_mek.c
> >  create mode 100644 board/freescale/mx8mq_evk/README  create mode
> > 100644 configs/imx8qxp_mek_defconfig  create mode 100644
> > include/configs/imx8qxp_mek.h
> >
> > diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index
> > 44ebc50bfa..61598bdfeb 100644
> > --- a/arch/arm/dts/Makefile
> > +++ b/arch/arm/dts/Makefile
> > @@ -452,6 +452,8 @@ dtb-$(CONFIG_MX7) += imx7-colibri.dtb \
> >
> >  dtb-$(CONFIG_ARCH_MX7ULP) += imx7ulp-evk.dtb
> >
> > +dtb-$(CONFIG_ARCH_IMX8) += fsl-imx8qxp-mek.dtb
> > +
> >  dtb-$(CONFIG_RCAR_GEN3) += \
> > r8a7795-h3ulcb.dtb \
> > r8a7795-salvator-x.dtb \
> > diff --git a/arch/arm/dts/fsl-imx8qxp-mek.dts
> > b/arch/arm/dts/fsl-imx8qxp-mek.dts
> > new file mode 100644
> > index 00..6c3bc1dc4d
> > --- /dev/null
> > +++ b/arch/arm/dts/fsl-imx8qxp-mek.dts
> > @@ -0,0 +1,136 @@
> > +// SPDX-License-Identifier: GPL-2.0+
> > +/*
> > + * Copyright 2017-2018 NXP
> > + */
> > +
> > +/dts-v1/;
> > +
> > +#include "fsl-imx8qxp.dtsi"
> > +
> > +/ {
> > +   model = "Freescale i.MX8QXP MEK";
> > +   compatible = "fsl,imx8qxp-mek", "fsl,imx8qxp";
> > +
> > +   chosen {
> > +   bootargs = "console=ttyLP0,115200
> earlycon=lpuart32,0x5a06,115200";
> > +   stdout-path = 
> > +   };
> > +
> > +   regulators {
> > +   compatible = "simple-bus";
> > +   #address-cells = <1>;
> > +   #size-cells = <0>;
> > +
> > +   reg_usdhc2_vmmc: usdhc2-vmmc {
> > +   compatible = "regulator-fixed";
> > +   regulator-name = "SD1_SPWR";
> > +   regulator-min-microvolt = <300>;
> > +   regulator-max-microvolt = <300>;
> > +   gpio = < 19 GPIO_ACTIVE_HIGH>;
> > +   off-on-delay = <3480>;
> > +   enable-active-high;
> > +   };
> > +   };
> > +};
> > +
> > + {
> > +   pinctrl-names = "default";
> > +   pinctrl-0 = <_hog>;
> > +
> > +   imx8qxp-mek {
> > +   pinctrl_hog: hoggrp {
> > +   fsl,pins = <
> > +   SC_P_MCLK_OUT0_ADMA_ACM_MCLK_OUT0
>   0x064c
> > +   SC_P_COMP_CTL_GPIO_1V8_3V3_GPIORHB_PAD
>   0x000514a0
> > +   >;
> > +   };
> > +
> > +   pinctrl_ioexp_rst: ioexp-rst-grp {
> > +   fsl,pins = <
> > +   SC_P_SPI2_SDO_LSIO_GPIO1_IO01   0x0621
> > +   >;
> > +   };
> > +
> > +   pinctrl_lpi2c1: lpi1cgrp {
> > +   fsl,pins = <
> > +   SC_P_USB_SS3_TC1_ADMA_I2C1_SCL  0x0621
> > +   SC_P_USB_SS3_TC3_ADMA_I2C1_SDA  0x0621
> > +   >;
> > +   };
> > +
> > +   pinctrl_lpuart0: lpuart0grp {
> > +   fsl,pins = <
> > +   SC_P_UART0_RX_ADMA_UART0_RX 0x0620
> > +   SC_P_UART0_TX_ADMA_UART0_TX 0x0620
> > +   >;
> > +  

Re: [U-Boot] [PATCH V5 32/32] imx: add i.MX8QXP MEK board support

2018-10-05 Thread Stefano Babic
Hi Peng,

I am fine with most patches of this series. Anyway, I see that to build
the image you are using a "fork" of mkimage...


On 26/09/2018 15:52, Peng Fan wrote:
> Add i.MX8QXP MEK board support
> Enabled pinctrl/clk/power domain/mmc/i2c driver.
> Added README file.
> 
> Signed-off-by: Peng Fan 
> Cc: Stefano Babic 
> Cc: Fabio Estevam 
> Cc: Anatolij Gustschin 
> ---
>  arch/arm/dts/Makefile |   2 +
>  arch/arm/dts/fsl-imx8qxp-mek.dts  | 136 ++
>  arch/arm/mach-imx/imx8/Kconfig|  13 +++
>  board/freescale/imx8qxp_mek/Kconfig   |  14 +++
>  board/freescale/imx8qxp_mek/MAINTAINERS   |   6 ++
>  board/freescale/imx8qxp_mek/Makefile  |   7 ++
>  board/freescale/imx8qxp_mek/README|  72 ++
>  board/freescale/imx8qxp_mek/imx8qxp_mek.c | 152 +
>  board/freescale/mx8mq_evk/README  |  81 
>  configs/imx8qxp_mek_defconfig |  38 
>  include/configs/imx8qxp_mek.h | 156 
> ++
>  11 files changed, 677 insertions(+)
>  create mode 100644 arch/arm/dts/fsl-imx8qxp-mek.dts
>  create mode 100644 board/freescale/imx8qxp_mek/Kconfig
>  create mode 100644 board/freescale/imx8qxp_mek/MAINTAINERS
>  create mode 100644 board/freescale/imx8qxp_mek/Makefile
>  create mode 100644 board/freescale/imx8qxp_mek/README
>  create mode 100644 board/freescale/imx8qxp_mek/imx8qxp_mek.c
>  create mode 100644 board/freescale/mx8mq_evk/README
>  create mode 100644 configs/imx8qxp_mek_defconfig
>  create mode 100644 include/configs/imx8qxp_mek.h
> 
> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
> index 44ebc50bfa..61598bdfeb 100644
> --- a/arch/arm/dts/Makefile
> +++ b/arch/arm/dts/Makefile
> @@ -452,6 +452,8 @@ dtb-$(CONFIG_MX7) += imx7-colibri.dtb \
>  
>  dtb-$(CONFIG_ARCH_MX7ULP) += imx7ulp-evk.dtb
>  
> +dtb-$(CONFIG_ARCH_IMX8) += fsl-imx8qxp-mek.dtb
> +
>  dtb-$(CONFIG_RCAR_GEN3) += \
>   r8a7795-h3ulcb.dtb \
>   r8a7795-salvator-x.dtb \
> diff --git a/arch/arm/dts/fsl-imx8qxp-mek.dts 
> b/arch/arm/dts/fsl-imx8qxp-mek.dts
> new file mode 100644
> index 00..6c3bc1dc4d
> --- /dev/null
> +++ b/arch/arm/dts/fsl-imx8qxp-mek.dts
> @@ -0,0 +1,136 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright 2017-2018 NXP
> + */
> +
> +/dts-v1/;
> +
> +#include "fsl-imx8qxp.dtsi"
> +
> +/ {
> + model = "Freescale i.MX8QXP MEK";
> + compatible = "fsl,imx8qxp-mek", "fsl,imx8qxp";
> +
> + chosen {
> + bootargs = "console=ttyLP0,115200 
> earlycon=lpuart32,0x5a06,115200";
> + stdout-path = 
> + };
> +
> + regulators {
> + compatible = "simple-bus";
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + reg_usdhc2_vmmc: usdhc2-vmmc {
> + compatible = "regulator-fixed";
> + regulator-name = "SD1_SPWR";
> + regulator-min-microvolt = <300>;
> + regulator-max-microvolt = <300>;
> + gpio = < 19 GPIO_ACTIVE_HIGH>;
> + off-on-delay = <3480>;
> + enable-active-high;
> + };
> + };
> +};
> +
> + {
> + pinctrl-names = "default";
> + pinctrl-0 = <_hog>;
> +
> + imx8qxp-mek {
> + pinctrl_hog: hoggrp {
> + fsl,pins = <
> + SC_P_MCLK_OUT0_ADMA_ACM_MCLK_OUT0   
> 0x064c
> + SC_P_COMP_CTL_GPIO_1V8_3V3_GPIORHB_PAD  
> 0x000514a0
> + >;
> + };
> +
> + pinctrl_ioexp_rst: ioexp-rst-grp {
> + fsl,pins = <
> + SC_P_SPI2_SDO_LSIO_GPIO1_IO01   0x0621
> + >;
> + };
> +
> + pinctrl_lpi2c1: lpi1cgrp {
> + fsl,pins = <
> + SC_P_USB_SS3_TC1_ADMA_I2C1_SCL  0x0621
> + SC_P_USB_SS3_TC3_ADMA_I2C1_SDA  0x0621
> + >;
> + };
> +
> + pinctrl_lpuart0: lpuart0grp {
> + fsl,pins = <
> + SC_P_UART0_RX_ADMA_UART0_RX 0x0620
> + SC_P_UART0_TX_ADMA_UART0_TX 0x0620
> + >;
> + };
> +
> + pinctrl_usdhc1: usdhc1grp {
> + fsl,pins = <
> + SC_P_EMMC0_CLK_CONN_EMMC0_CLK   
> 0x0641
> + SC_P_EMMC0_CMD_CONN_EMMC0_CMD   
> 0x0021
> + SC_P_EMMC0_DATA0_CONN_EMMC0_DATA0   
> 0x0021
> + SC_P_EMMC0_DATA1_CONN_EMMC0_DATA1   
> 0x0021
> + SC_P_EMMC0_DATA2_CONN_EMMC0_DATA2   
> 0x0021
> +   

Re: [U-Boot] [PATCH 02/11] efi_loader: Initial HII protocols

2018-10-05 Thread Leif Lindholm
On Fri, Oct 05, 2018 at 05:52:09PM +0900, AKASHI, Takahiro wrote:
> > > 2. If a platform includes a configuration infrastructure, then the
> > > EFI_HII_DATABASE_PROTOCOL, EFI_HII_STRING_PROTOCOL,
> > > EFI_HII_CONFIG_ROUTING_PROTOCOL, and EFI_HII_CONFIG_ACCESS_PROTOCOL are
> > > required.
> >
> > Do you think efi implementation on u-boot also wants those protocols?
> > (Apparently, config access protocol can be optional for shell unless
> > we want driver configuration?)
> 
> One more question:
> Does u-boot support any kind of "UEFI driver"?
> If yes, is there any good example?
> If no, do you expect that it should be supported?

I don't think full-on option ROMs with configuration menus are
something we care about for EBBR-style implementations.
What could be useful is things like shim - a simple driver installing
a protocol that lets other applications running at boot-time access
it. But I think that is already (mostly?) supported.

If someone at a later date decides that they want to support option
ROMs, basically using U-Boot for an SBBR implementation, that will
come with additional work required for the menu support. And should be
possible to configure out at build time for users who don't want it.

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


[U-Boot] [PATCH 3/5] arm: remove prototype for udelay_masked

2018-10-05 Thread Patrick Delaunay
The interruption support had be removed for ARM architecture and
the function udelay_masked() is no more used except in some timer.c
files  and have the same content than udelay() or __udelay().

This patch update each timer.c implementing this function and
remove the associated prototype in u-boot-arm.h.

Signed-off-by: Patrick Delaunay 
---

 arch/arm/cpu/arm920t/imx/timer.c | 7 +--
 arch/arm/cpu/arm926ejs/spear/timer.c | 5 -
 arch/arm/cpu/armv7/stv0991/timer.c   | 5 -
 arch/arm/cpu/sa1100/timer.c  | 7 +--
 arch/arm/include/asm/u-boot-arm.h| 1 -
 arch/arm/mach-at91/arm920t/timer.c   | 7 +--
 board/armltd/integrator/timer.c  | 6 --
 7 files changed, 3 insertions(+), 35 deletions(-)

diff --git a/arch/arm/cpu/arm920t/imx/timer.c b/arch/arm/cpu/arm920t/imx/timer.c
index cd9b546..9289905 100644
--- a/arch/arm/cpu/arm920t/imx/timer.c
+++ b/arch/arm/cpu/arm920t/imx/timer.c
@@ -46,7 +46,7 @@ ulong get_timer_masked (void)
return TCN1;
 }
 
-void udelay_masked (unsigned long usec)
+void __udelay (unsigned long usec)
 {
ulong endtime = get_timer_masked() + usec;
signed long diff;
@@ -57,11 +57,6 @@ void udelay_masked (unsigned long usec)
} while (diff >= 0);
 }
 
-void __udelay (unsigned long usec)
-{
-   udelay_masked(usec);
-}
-
 /*
  * This function is derived from PowerPC code (read timebase as long long).
  * On ARM it just returns the timer value.
diff --git a/arch/arm/cpu/arm926ejs/spear/timer.c 
b/arch/arm/cpu/arm926ejs/spear/timer.c
index e9ba87a..a6637c0 100644
--- a/arch/arm/cpu/arm926ejs/spear/timer.c
+++ b/arch/arm/cpu/arm926ejs/spear/timer.c
@@ -98,11 +98,6 @@ ulong get_timer_masked(void)
return timestamp;
 }
 
-void udelay_masked(unsigned long usec)
-{
-   return udelay(usec);
-}
-
 /*
  * This function is derived from PowerPC code (read timebase as long long).
  * On ARM it just returns the timer value.
diff --git a/arch/arm/cpu/armv7/stv0991/timer.c 
b/arch/arm/cpu/armv7/stv0991/timer.c
index 5784b06..2b1fd1b 100644
--- a/arch/arm/cpu/armv7/stv0991/timer.c
+++ b/arch/arm/cpu/armv7/stv0991/timer.c
@@ -89,11 +89,6 @@ ulong get_timer_masked(void)
return timestamp;
 }
 
-void udelay_masked(unsigned long usec)
-{
-   return udelay(usec);
-}
-
 /*
  * This function is derived from PowerPC code (read timebase as long long).
  * On ARM it just returns the timer value.
diff --git a/arch/arm/cpu/sa1100/timer.c b/arch/arm/cpu/sa1100/timer.c
index 12514e4..c7829c9 100644
--- a/arch/arm/cpu/sa1100/timer.c
+++ b/arch/arm/cpu/sa1100/timer.c
@@ -17,17 +17,12 @@ ulong get_timer (ulong base)
return get_timer_masked ();
 }
 
-void __udelay (unsigned long usec)
-{
-   udelay_masked (usec);
-}
-
 ulong get_timer_masked (void)
 {
return OSCR;
 }
 
-void udelay_masked (unsigned long usec)
+void __udelay (unsigned long usec)
 {
ulong tmo;
ulong endtime;
diff --git a/arch/arm/include/asm/u-boot-arm.h 
b/arch/arm/include/asm/u-boot-arm.h
index f1da115..97983de 100644
--- a/arch/arm/include/asm/u-boot-arm.h
+++ b/arch/arm/include/asm/u-boot-arm.h
@@ -40,7 +40,6 @@ int   board_init(void);
 
 /* cpu/.../interrupt.c */
 ulong  get_timer_masked(void);
-void   udelay_masked   (unsigned long usec);
 
 /* calls to c from vectors.S */
 struct pt_regs;
diff --git a/arch/arm/mach-at91/arm920t/timer.c 
b/arch/arm/mach-at91/arm920t/timer.c
index bbe90ae..6a98d7c 100644
--- a/arch/arm/mach-at91/arm920t/timer.c
+++ b/arch/arm/mach-at91/arm920t/timer.c
@@ -58,11 +58,6 @@ ulong get_timer(ulong base)
return get_timer_masked() - base;
 }
 
-void __udelay(unsigned long usec)
-{
-   udelay_masked(usec);
-}
-
 ulong get_timer_raw(void)
 {
at91_tc_t *tc = (at91_tc_t *) ATMEL_BASE_TC;
@@ -87,7 +82,7 @@ ulong get_timer_masked(void)
return get_timer_raw()/TIMER_LOAD_VAL;
 }
 
-void udelay_masked(unsigned long usec)
+void __udelay(unsigned long usec)
 {
u32 tmo;
u32 endtime;
diff --git a/board/armltd/integrator/timer.c b/board/armltd/integrator/timer.c
index 3063884..53086c7 100644
--- a/board/armltd/integrator/timer.c
+++ b/board/armltd/integrator/timer.c
@@ -138,12 +138,6 @@ ulong get_timer_masked (void)
return timestamp;
 }
 
-/* waits specified delay value and resets timestamp */
-void udelay_masked (unsigned long usec)
-{
-   udelay(usec);
-}
-
 /*
  * This function is derived from PowerPC code (read timebase as long long).
  * On ARM it just returns the timer value.
-- 
2.7.4

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


[U-Boot] [PATCH 0/5] arm: cleanup prototypes in u-boot-arm.h

2018-10-05 Thread Patrick Delaunay

When I check the patch
http://patchwork.ozlabs.org/patch/978762/

I see that some prototypes in u-boot-arm.h are
not needed as they are unused or only used locally.

This patset removes them in u-boot-arm.h;
3 patch are simple but in 2 patches I need to udpate
timer.c files in many architecture but without functional
change: functions modified to static, sometime I need to
reorder the function.

Compilation tested on v2018.11-rc1 for arm boards with buildman:

tools/buildman/buildman arm aarch64
540  2704 /814
=> no new warning introduced (only device tree issue)



Patrick Delaunay (5):
  arm: remove prototype for arch_interrupt_init
  arm: remove prototype for reset_timer_masked
  arm: remove prototype for udelay_masked
  arm: remove prototype for get_timer_masked
  arm: remove duplicated prototypes in u-boot.arm.h

 arch/arm/cpu/arm920t/ep93xx/timer.c  |  7 +
 arch/arm/cpu/arm920t/imx/timer.c | 15 ---
 arch/arm/cpu/arm926ejs/armada100/timer.c |  2 +-
 arch/arm/cpu/arm926ejs/mx27/timer.c  |  2 +-
 arch/arm/cpu/arm926ejs/mxs/timer.c   |  7 +
 arch/arm/cpu/arm926ejs/spear/timer.c |  9 +++
 arch/arm/cpu/armv7/ls102xa/timer.c   |  7 +
 arch/arm/cpu/armv7/s5p-common/timer.c|  3 ++-
 arch/arm/cpu/armv7/stv0991/timer.c   |  9 +++
 arch/arm/cpu/armv7/sunxi/timer.c | 12 -
 arch/arm/cpu/armv7/vf610/timer.c |  7 +
 arch/arm/cpu/sa1100/timer.c  | 15 ---
 arch/arm/include/asm/u-boot-arm.h|  9 ---
 arch/arm/mach-at91/arm920t/timer.c   | 19 +-
 arch/arm/mach-imx/syscounter.c   |  7 +
 arch/arm/mach-omap2/timer.c  |  3 ++-
 arch/arm/mach-orion5x/timer.c|  2 +-
 board/armltd/integrator/timer.c  | 45 ++--
 18 files changed, 61 insertions(+), 119 deletions(-)

-- 
2.7.4

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


[U-Boot] [PATCH 4/5] arm: remove prototype for get_timer_masked

2018-10-05 Thread Patrick Delaunay
The interruption support had be removed for ARM architecture and
the function get_timer_masked() is no more used except in some
the timer.c files.

This patch clean each timer.c which implement this function and
remove the associated prototype in u-boot-arm.h

For timer.c, I don't verify if the weak version of get_timer
(in lib/time.c) can be used

Signed-off-by: Patrick Delaunay 
---

 arch/arm/cpu/arm920t/ep93xx/timer.c  |  7 +
 arch/arm/cpu/arm920t/imx/timer.c |  8 +++---
 arch/arm/cpu/arm926ejs/armada100/timer.c |  2 +-
 arch/arm/cpu/arm926ejs/mx27/timer.c  |  2 +-
 arch/arm/cpu/arm926ejs/mxs/timer.c   |  7 +
 arch/arm/cpu/arm926ejs/spear/timer.c |  4 ++-
 arch/arm/cpu/armv7/ls102xa/timer.c   |  7 +
 arch/arm/cpu/armv7/stv0991/timer.c   |  4 ++-
 arch/arm/cpu/armv7/sunxi/timer.c | 12 -
 arch/arm/cpu/armv7/vf610/timer.c |  7 +
 arch/arm/cpu/sa1100/timer.c  |  8 +++---
 arch/arm/include/asm/u-boot-arm.h|  3 ---
 arch/arm/mach-at91/arm920t/timer.c   | 12 -
 arch/arm/mach-imx/syscounter.c   |  7 +
 arch/arm/mach-omap2/timer.c  |  3 ++-
 arch/arm/mach-orion5x/timer.c|  2 +-
 board/armltd/integrator/timer.c  | 45 
 17 files changed, 59 insertions(+), 81 deletions(-)

diff --git a/arch/arm/cpu/arm920t/ep93xx/timer.c 
b/arch/arm/cpu/arm920t/ep93xx/timer.c
index 5f3609a..49bf49b 100644
--- a/arch/arm/cpu/arm920t/ep93xx/timer.c
+++ b/arch/arm/cpu/arm920t/ep93xx/timer.c
@@ -66,14 +66,9 @@ unsigned long long get_ticks(void)
return sys_ticks;
 }
 
-unsigned long get_timer_masked(void)
-{
-   return get_ticks();
-}
-
 unsigned long get_timer(unsigned long base)
 {
-   return get_timer_masked() - base;
+   return get_ticks() - base;
 }
 
 void __udelay(unsigned long usec)
diff --git a/arch/arm/cpu/arm920t/imx/timer.c b/arch/arm/cpu/arm920t/imx/timer.c
index 9289905..96fff3f 100644
--- a/arch/arm/cpu/arm920t/imx/timer.c
+++ b/arch/arm/cpu/arm920t/imx/timer.c
@@ -36,14 +36,14 @@ int timer_init (void)
 /*
  * timer without interrupts
  */
-ulong get_timer (ulong base)
+static ulong get_timer_masked (void)
 {
-   return get_timer_masked() - base;
+   return TCN1;
 }
 
-ulong get_timer_masked (void)
+ulong get_timer (ulong base)
 {
-   return TCN1;
+   return get_timer_masked() - base;
 }
 
 void __udelay (unsigned long usec)
diff --git a/arch/arm/cpu/arm926ejs/armada100/timer.c 
b/arch/arm/cpu/arm926ejs/armada100/timer.c
index f10f678..d2ecbd0 100644
--- a/arch/arm/cpu/arm926ejs/armada100/timer.c
+++ b/arch/arm/cpu/arm926ejs/armada100/timer.c
@@ -61,7 +61,7 @@ ulong read_timer(void)
return(readl(>cvwr));
 }
 
-ulong get_timer_masked(void)
+static ulong get_timer_masked(void)
 {
ulong now = read_timer();
 
diff --git a/arch/arm/cpu/arm926ejs/mx27/timer.c 
b/arch/arm/cpu/arm926ejs/mx27/timer.c
index 9399320..94b5d45 100644
--- a/arch/arm/cpu/arm926ejs/mx27/timer.c
+++ b/arch/arm/cpu/arm926ejs/mx27/timer.c
@@ -126,7 +126,7 @@ unsigned long long get_ticks(void)
return timestamp;
 }
 
-ulong get_timer_masked(void)
+static ulong get_timer_masked(void)
 {
/*
 * get_ticks() returns a long long (64 bit), it wraps in
diff --git a/arch/arm/cpu/arm926ejs/mxs/timer.c 
b/arch/arm/cpu/arm926ejs/mxs/timer.c
index 517cadb..7492ba4 100644
--- a/arch/arm/cpu/arm926ejs/mxs/timer.c
+++ b/arch/arm/cpu/arm926ejs/mxs/timer.c
@@ -110,14 +110,9 @@ unsigned long long get_ticks(void)
return timestamp;
 }
 
-ulong get_timer_masked(void)
-{
-   return tick_to_time(get_ticks());
-}
-
 ulong get_timer(ulong base)
 {
-   return get_timer_masked() - base;
+   return tick_to_time(get_ticks()) - base;
 }
 
 /* We use the HW_DIGCTL_MICROSECONDS register for sub-millisecond timer. */
diff --git a/arch/arm/cpu/arm926ejs/spear/timer.c 
b/arch/arm/cpu/arm926ejs/spear/timer.c
index a6637c0..e7b5bda 100644
--- a/arch/arm/cpu/arm926ejs/spear/timer.c
+++ b/arch/arm/cpu/arm926ejs/spear/timer.c
@@ -21,6 +21,8 @@ static struct misc_regs *const misc_regs_p =
 
 DECLARE_GLOBAL_DATA_PTR;
 
+static ulong get_timer_masked(void);
+
 #define timestamp gd->arch.tbl
 #define lastdec gd->arch.lastinc
 
@@ -82,7 +84,7 @@ void __udelay(unsigned long usec)
;
 }
 
-ulong get_timer_masked(void)
+static ulong get_timer_masked(void)
 {
ulong now = READ_TIMER();
 
diff --git a/arch/arm/cpu/armv7/ls102xa/timer.c 
b/arch/arm/cpu/armv7/ls102xa/timer.c
index 35a557b..e79360a 100644
--- a/arch/arm/cpu/armv7/ls102xa/timer.c
+++ b/arch/arm/cpu/armv7/ls102xa/timer.c
@@ -90,14 +90,9 @@ unsigned long long get_ticks(void)
return now;
 }
 
-unsigned long get_timer_masked(void)
-{
-   return tick_to_time(get_ticks());
-}
-
 unsigned long get_timer(ulong base)
 {
-   return get_timer_masked() - base;
+   return tick_to_time(get_ticks()) - base;
 }
 
 /* delay x useconds and preserve 

[U-Boot] [PATCH 5/5] arm: remove duplicated prototypes in u-boot.arm.h

2018-10-05 Thread Patrick Delaunay
Remove the function prototypes duplicated between u-boot.arm.h
and init.h/common.h

Signed-off-by: Patrick Delaunay 
---

 arch/arm/include/asm/u-boot-arm.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/arch/arm/include/asm/u-boot-arm.h 
b/arch/arm/include/asm/u-boot-arm.h
index 2eaefb4..2e8c8e5 100644
--- a/arch/arm/include/asm/u-boot-arm.h
+++ b/arch/arm/include/asm/u-boot-arm.h
@@ -24,16 +24,13 @@ extern ulong _datarelro_start_ofs;
 extern ulong IRQ_STACK_START_IN;   /* 8 bytes in IRQ stack */
 
 /* cpu/.../cpu.c */
-intcpu_init(void);
 intcleanup_before_linux(void);
 
 /* Set up ARMv7 MMU, caches and TLBs */
 void   cpu_init_cp15(void);
 
 /* cpu/.../arch/cpu.c */
-intarch_cpu_init(void);
 intarch_misc_init(void);
-intarch_early_init_r(void);
 
 /* board/.../... */
 intboard_init(void);
-- 
2.7.4

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


[U-Boot] [PATCH 2/5] arm: remove prototype for reset_timer_masked

2018-10-05 Thread Patrick Delaunay
Remove prototype for function only used in one file

Signed-off-by: Patrick Delaunay 
---

 arch/arm/cpu/armv7/s5p-common/timer.c | 3 ++-
 arch/arm/include/asm/u-boot-arm.h | 1 -
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/cpu/armv7/s5p-common/timer.c 
b/arch/arm/cpu/armv7/s5p-common/timer.c
index b37892c..0048cd8 100644
--- a/arch/arm/cpu/armv7/s5p-common/timer.c
+++ b/arch/arm/cpu/armv7/s5p-common/timer.c
@@ -19,6 +19,7 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 unsigned long get_current_tick(void);
+static void reset_timer_masked(void);
 
 /* macro to read the 16 bit timer */
 static inline struct s5p_timer *s5p_get_base_timer(void)
@@ -106,7 +107,7 @@ void __udelay(unsigned long usec)
;
 }
 
-void reset_timer_masked(void)
+static void reset_timer_masked(void)
 {
struct s5p_timer *const timer = s5p_get_base_timer();
 
diff --git a/arch/arm/include/asm/u-boot-arm.h 
b/arch/arm/include/asm/u-boot-arm.h
index e08435a..f1da115 100644
--- a/arch/arm/include/asm/u-boot-arm.h
+++ b/arch/arm/include/asm/u-boot-arm.h
@@ -39,7 +39,6 @@ int   arch_early_init_r(void);
 intboard_init(void);
 
 /* cpu/.../interrupt.c */
-void   reset_timer_masked  (void);
 ulong  get_timer_masked(void);
 void   udelay_masked   (unsigned long usec);
 
-- 
2.7.4

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


[U-Boot] [PATCH 1/5] arm: remove prototype for arch_interrupt_init

2018-10-05 Thread Patrick Delaunay
Remove prototype for no more existing function

Signed-off-by: Patrick Delaunay 
---

 arch/arm/include/asm/u-boot-arm.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/include/asm/u-boot-arm.h 
b/arch/arm/include/asm/u-boot-arm.h
index cc828c4..e08435a 100644
--- a/arch/arm/include/asm/u-boot-arm.h
+++ b/arch/arm/include/asm/u-boot-arm.h
@@ -39,7 +39,6 @@ int   arch_early_init_r(void);
 intboard_init(void);
 
 /* cpu/.../interrupt.c */
-intarch_interrupt_init (void);
 void   reset_timer_masked  (void);
 ulong  get_timer_masked(void);
 void   udelay_masked   (unsigned long usec);
-- 
2.7.4

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


Re: [U-Boot] [PATCH 02/11] efi_loader: Initial HII protocols

2018-10-05 Thread AKASHI, Takahiro
On Wed, 3 Oct 2018 at 16:37, AKASHI, Takahiro
 wrote:
>
> Alex,
>
> On Sun, Sep 23, 2018 at 12:11:08PM +0200, Alexander Graf wrote:
> >
> >
> > On 22.09.18 12:34, Heinrich Schuchardt wrote:
> > > On 10/10/2017 02:22 PM, Rob Clark wrote:
> > >> From: Leif Lindholm 
> > >>
> > >> Enough implementation of the following protocols to run Shell.efi and
> > >> SCT.efi:
> > >>
> > >>   EfiHiiConfigRoutingProtocolGuid
> > >>   EfiHiiDatabaseProtocol
> > >>   EfiHiiStringProtocol
> > >
> > > The i386 Shell.efi also tries to open these before failing:
> > >
> > > EfiHiiFontProtocol
> > > EfiHiiImageProtocol
> >
> > That sounds like a bug. The UEFI spec only mandates the following in
> > section 2.6.2:
> >
> > 2. If a platform includes a configuration infrastructure, then the
> > EFI_HII_DATABASE_PROTOCOL, EFI_HII_STRING_PROTOCOL,
> > EFI_HII_CONFIG_ROUTING_PROTOCOL, and EFI_HII_CONFIG_ACCESS_PROTOCOL are
> > required.
>
> Do you think efi implementation on u-boot also wants those protocols?
> (Apparently, config access protocol can be optional for shell unless
> we want driver configuration?)

One more question:
Does u-boot support any kind of "UEFI driver"?
If yes, is there any good example?
If no, do you expect that it should be supported?

Thanks,
-Takahiro Akashi

> Among others, UEFI spec defines lots of "packages" for HII database:
>string, guid, font, image, device path, keyboard layout and etc.
>
> Do you expect all of them be supported from the beginning?
> If not, what criteria do you think is reasonable so that you feel
> comfortable in accepting an initial commit of HII database support?
>
> Thanks,
> -Takahiro Akashi
>
> > If you support bitmapped fonts, you must support
> > EFI_HII_FONT_PROTOCOL.
>
> > Well, in my book the whole fact that the UEFI shell requires HII sounds
> > like a bad design decision, but it should at least not require the font
> > protocol :).
> >
> > Also, I have built my own x86_64 shell.efi from latest edk2 git manually
> > and that works fine (even in sandbox). Maybe that is only the minimal
> > shell though? Their build system is still a bit of a mystery to me :).
> >
> >
> > Alex
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v1 03/19] dm: device: Allow using uclass_find_device_by_seq() without OF_CONTROL

2018-10-05 Thread Jean-Jacques Hiblot

Hi Adam,



On 05/10/2018 00:42, Adam Ford wrote:

On Thu, Oct 4, 2018 at 8:48 AM Jean-Jacques Hiblot  wrote:

If OF_CONTROL is not enabled and DM_SEQ_ALIAS is enabled, we must
assign an alias (requested sequence number) to devices that belongs to a
class with the DM_UC_FLAG_SEQ_ALIAS flag. Otherwise

What about conditions where both OF_CONTROL and PLATDATA are set?  I
am not sure what it all does, so maybe it's OK, but I know PLATDATA is
a reduced library which I know the omap3_logic uses to keep SPL small.

Thanks for the review and for trying the patches.

if OF_PLATDATA is used, dts is not parsed at all, so alias can't be read 
from dt => the seq_alias should be computed as if OF_CONTROL is not set.


Now I'm curious how enabling OF_PLATDATA even works on omap3_logic. Most 
TI drivers (all ?) do not support it.

I don't have any omap3 board, but I'll give it a try on beaglebone.




uclass_find_device_by_seq() cannot be used to get/probe a device. In
particular i2c_get_chip_for_busnum() cannot be used.

Signed-off-by: Jean-Jacques Hiblot 
---

  drivers/core/device.c| 10 ++
  drivers/core/uclass.c| 24 
  include/dm/uclass-internal.h | 13 +
  3 files changed, 43 insertions(+), 4 deletions(-)

diff --git a/drivers/core/device.c b/drivers/core/device.c
index feed43c..e441021 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -70,7 +70,8 @@ static int device_bind_common(struct udevice *parent, const 
struct driver *drv,

 dev->seq = -1;
 dev->req_seq = -1;
-   if (CONFIG_IS_ENABLED(OF_CONTROL) && CONFIG_IS_ENABLED(DM_SEQ_ALIAS)) {
+   if (CONFIG_IS_ENABLED(DM_SEQ_ALIAS) &&

Is there are reason these cannot be #if statements (opposed to just
'if') to let the pre-compiler enable/disable code?  I am assuming
these values won't change, but I could be wrong.

The solution woulb de to use
if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA))
instead of
if (CONFIG_IS_ENABLED(OF_CONTROL)



+   (uc->uc_drv->flags & DM_UC_FLAG_SEQ_ALIAS)) {
 /*
  * Some devices, such as a SPI bus, I2C bus and serial ports
  * are numbered using aliases.
@@ -78,10 +79,11 @@ static int device_bind_common(struct udevice *parent, const 
struct driver *drv,
  * This is just a 'requested' sequence, and will be
  * resolved (and ->seq updated) when the device is probed.
  */
-   if (uc->uc_drv->flags & DM_UC_FLAG_SEQ_ALIAS) {
-   if (uc->uc_drv->name && ofnode_valid(node)) {
+   if (CONFIG_IS_ENABLED(OF_CONTROL)) {
+   if (uc->uc_drv->name && ofnode_valid(node))
 dev_read_alias_seq(dev, >req_seq);
-   }
+   } else {
+   dev->req_seq = uclass_find_next_free_req_seq(drv->id);
 }
 }

diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index 3113d6a..376f882 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -269,6 +269,30 @@ int uclass_find_device_by_name(enum uclass_id id, const 
char *name,
 return -ENODEV;
  }

+#if !CONFIG_IS_ENABLED(OF_CONTROL)

ditto

+int uclass_find_next_free_req_seq(enum uclass_id id)
+{
+   struct uclass *uc;
+   struct udevice *dev;
+   int ret;
+   int max = -1;
+
+   ret = uclass_get(id, );
+   if (ret)
+   return ret;
+
+   list_for_each_entry(dev, >dev_head, uclass_node) {
+   if ((dev->req_seq != -1) && (dev->req_seq > max))
+   max = dev->req_seq;
+   }
+
+   if (max == -1)
+   return 0;
+
+   return max + 1;
+}
+#endif
+
  int uclass_find_device_by_seq(enum uclass_id id, int seq_or_req_seq,
   bool find_req_seq, struct udevice **devp)
  {
diff --git a/include/dm/uclass-internal.h b/include/dm/uclass-internal.h
index 30d5a4f..18a838c 100644
--- a/include/dm/uclass-internal.h
+++ b/include/dm/uclass-internal.h
@@ -12,6 +12,19 @@
  #include 

  /**
+ * uclass_find_next_free_req_seq() - Get the next free req_seq number
+ *
+ * This returns the next free req_seq number. This is useful only if
+ * OF_CONTROL is not used. The next free req_seq number is simply the
+ * maximum req_seq of the uclass + 1.
+ * This allows assiging req_seq number in the binding order.
+ *
+ * @id:Id number of the uclass
+ * @return The next free req_seq number
+ */
+int uclass_find_next_free_req_seq(enum uclass_id id);
+
+/**
   * uclass_get_device_tail() - handle the end of a get_device call
   *
   * This handles returning an error or probing a device as needed.
--
2.7.4

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


___
U-Boot mailing list

Re: [U-Boot] rockchip: Fix rkimage format for SPL boot over USB

2018-10-05 Thread Philipp Tomsich
> The 'rkimage' format used for booting rockchip boards over USB seems to
> have been broken since commit 7bf274b9caab ("rockchip: mkimage: use
> imagename to select spl hdr & spl size"). That commit adds an offset of
> RK_SPL_HDR_START(=2048) to the location the 'RKxx' header is written
> at. However the bootrom expects this header to be the first four bytes of
> the image, not at offset 2048. This appears to have been a copy paste
> error since the 'rksd' and 'rkspi' image types do require this offset.
> 
> Furthermore commit 111bcc4fb6cb ("rockchip: mkimage: pad the header to
> 8-bytes (using a 'nop') for RK3399"), commit 3d54eabcafec9 ("rockchip:
> spl: RK3399: use boot0 hook to create space for SPL magic") and
> commit 308277569229 ("rockchip: mkimage: update rkimage to support
> pre-padded payloads") changed the way the space for the 'RKxx' header is
> allocated and written to the image without adjusting 'rkimage'.
> 
> This commit fixes those mistakes and makes it possible to load u-boot SPL
> over USB once more.
> 
> (Tested on RK3399)
> 
> Signed-off-by: Daniel Gröber 
> Reviewed-by: Philipp Tomsich 
> ---
> 
>  tools/rkimage.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 

Applied to u-boot-rockchip, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] Revert "test/py: Import 'configparser' lower case to be python 3.x safe"

2018-10-05 Thread Michal Simek
On 4.10.2018 18:00, Stephen Warren wrote:
> On 10/04/2018 01:37 AM, Michal Simek wrote:
>> This reverts commit 052ca37daa20a9825d7ce905d632e349f434058d.
>> This patch introduced bug which hasn't been resolved for quite a long
>> time. Full failed log is placed below but the major sign is
>> "codec can't decode byte 0x80 in position".
>> This issue is at least on my Ubuntu 14.04 system but others reported
>> similar issue.
> 
> Simon Glass sent the patch linked below to fix this. Does this work for
> you?
> 
> http://patchwork.ozlabs.org/patch/977604/
> [U-Boot,v2,04/17] test/py: Fix unicode handling for log filtering

yep that is solving the problem. I have replied that thread.

Thanks,
Michal

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


[U-Boot] [PATCH 3/3] power: regulator: add driver for Dialog DA9063 PMIC

2018-10-05 Thread Martin Fuzzey
Add a driver for the regulators in the the DA9063 PMIC.

Signed-off-by: Martin Fuzzey 
---
 drivers/power/regulator/Kconfig  |  10 +
 drivers/power/regulator/Makefile |   1 +
 drivers/power/regulator/da9063.c | 395 +++
 3 files changed, 406 insertions(+)
 create mode 100644 drivers/power/regulator/da9063.c

diff --git a/drivers/power/regulator/Kconfig b/drivers/power/regulator/Kconfig
index 414f4a5..0fc6a0d 100644
--- a/drivers/power/regulator/Kconfig
+++ b/drivers/power/regulator/Kconfig
@@ -43,6 +43,16 @@ config REGULATOR_AS3722
  but does not yet support change voltages. Currently this must be
  done using direct register writes to the PMIC.
 
+config DM_REGULATOR_DA9063
+   bool "Enable Driver Model for REGULATOR DA9063"
+   depends on DM_REGULATOR && DM_PMIC_DA9063
+   help
+ This config enables implementation of driver-model regulator uclass
+ features for REGULATOR DA9063.
+ The driver implements get/set api for value, enable and mode for all
+ regulators. It also implements the get/set api for current for the
+ buck regulators.
+
 config DM_REGULATOR_PFUZE100
bool "Enable Driver Model for REGULATOR PFUZE100"
depends on DM_REGULATOR && DM_PMIC_PFUZE100
diff --git a/drivers/power/regulator/Makefile b/drivers/power/regulator/Makefile
index 16208af..f0f6541 100644
--- a/drivers/power/regulator/Makefile
+++ b/drivers/power/regulator/Makefile
@@ -8,6 +8,7 @@
 obj-$(CONFIG_$(SPL_)DM_REGULATOR) += regulator-uclass.o
 obj-$(CONFIG_REGULATOR_ACT8846) += act8846.o
 obj-$(CONFIG_REGULATOR_AS3722) += as3722_regulator.o
+obj-$(CONFIG_DM_REGULATOR_DA9063) += da9063.o
 obj-$(CONFIG_DM_REGULATOR_MAX77686) += max77686.o
 obj-$(CONFIG_$(SPL_)DM_PMIC_PFUZE100) += pfuze100.o
 obj-$(CONFIG_REGULATOR_PWM) += pwm_regulator.o
diff --git a/drivers/power/regulator/da9063.c b/drivers/power/regulator/da9063.c
new file mode 100644
index 000..98cb7ac
--- /dev/null
+++ b/drivers/power/regulator/da9063.c
@@ -0,0 +1,395 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ *  Copyright (C) 2018 Flowbird
+ *  Martin Fuzzey  
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#defineDA9063_BUCK_EN  0x01
+#defineDA9063_LDO_EN   0x01
+#define DA9063_VBUCK_MASK  0x7F
+#define DA9063_BUCK_SL 0x80
+#define DA9063_LDO_SL  0x80
+
+#define DA9063_VLDO1_MASK  0x3F
+#define DA9063_VLDO2_MASK  0x3F
+#define DA9063_VLDO3_MASK  0x7F
+#define DA9063_VLDO4_MASK  0x7F
+#define DA9063_VLDO5_MASK  0x3F
+#define DA9063_VLDO6_MASK  0x3F
+#define DA9063_VLDO7_MASK  0x3F
+#define DA9063_VLDO8_MASK  0x3F
+#define DA9063_VLDO9_MASK  0x3F
+#define DA9063_VLDO10_MASK 0x3F
+#define DA9063_VLDO11_MASK 0x3F
+
+#define DA9063_BUCK_MODE_MASK  0xC0
+#defineDA9063_BUCK_MODE_MANUAL 0x00
+#defineDA9063_BUCK_MODE_SLEEP  0x40
+#defineDA9063_BUCK_MODE_SYNC   0x80
+#defineDA9063_BUCK_MODE_AUTO   0xC0
+
+#define DA9063_BIO_ILIM_MASK   0x0F
+#define DA9063_BMEM_ILIM_MASK  0xF0
+#define DA9063_BPRO_ILIM_MASK  0x0F
+#define DA9063_BPERI_ILIM_MASK 0xF0
+#define DA9063_BCORE1_ILIM_MASK0x0F
+#define DA9063_BCORE2_ILIM_MASK0xF0
+
+struct da9063_reg_info {
+   uint min_uV;
+   uint step_uV;
+   uint max_uV;
+   uint min_uA;
+   uint step_uA;
+   uint max_uA;
+   uint en_reg;
+   uint vsel_reg;
+   uint mode_reg;
+   uint ilim_reg;
+   u8 en_mask;
+   u8 vsel_mask;
+   u8 ilim_mask;
+   const char *dt_node_name;
+   const int *current_limits;
+};
+
+struct da9063_priv {
+   const struct da9063_reg_info *reg_info;
+};
+
+enum {
+   LDOMODE_SLEEP,
+   LDOMODE_NORMAL
+};
+
+static struct dm_regulator_mode da9063_ldo_modes[] = {
+   { .id = LDOMODE_SLEEP,
+   .register_value = DA9063_LDO_SL, .name = "SLEEP" },
+   { .id = LDOMODE_NORMAL,
+   .register_value = 0, .name = "NORMAL" },
+};
+
+#define DA9063_LDO(regl_name, min_mV, step_mV, max_mV) \
+   .min_uV = (min_mV) * 1000, \
+   .step_uV = (step_mV) * 1000, \
+   .max_uV = (max_mV) * 1000, \
+   .en_reg = DA9063_REG_##regl_name##_CONT, \
+   .en_mask = DA9063_LDO_EN, \
+   .vsel_reg = DA9063_REG_V##regl_name##_A, \
+   .vsel_mask = DA9063_V##regl_name##_MASK, \
+   .mode_reg = DA9063_REG_V##regl_name##_A \
+
+/* This array is directly indexed so must stay in numerical order */
+static const struct da9063_reg_info da9063_ldo_info[] = {
+   { DA9063_LDO(LDO1, 600, 20, 1860) },
+   { DA9063_LDO(LDO2, 600, 20, 1860) },
+   { DA9063_LDO(LDO3, 900, 20, 3440) },
+   { DA9063_LDO(LDO4, 900, 20, 3440) },
+   { DA9063_LDO(LDO5, 900, 50, 3600) },
+   { DA9063_LDO(LDO6, 900, 50, 3600) },
+   { DA9063_LDO(LDO7, 900, 50, 3600) },
+   { DA9063_LDO(LDO8, 900, 50, 3600) },
+   { DA9063_LDO(LDO9, 950, 50, 3600) 

[U-Boot] [PATCH 2/3] power: pmic: add driver for Dialog DA9063 PMIC

2018-10-05 Thread Martin Fuzzey
This adds the basic register access operations and child regulator
binding (if a regulator driver exists).

Signed-off-by: Martin Fuzzey 
---
 drivers/power/pmic/Kconfig  |   7 +
 drivers/power/pmic/Makefile |   1 +
 drivers/power/pmic/da9063.c | 187 +++
 include/power/da9063_pmic.h | 308 
 4 files changed, 503 insertions(+)
 create mode 100644 drivers/power/pmic/da9063.c
 create mode 100644 include/power/da9063_pmic.h

diff --git a/drivers/power/pmic/Kconfig b/drivers/power/pmic/Kconfig
index cba48e1..2c10cb6 100644
--- a/drivers/power/pmic/Kconfig
+++ b/drivers/power/pmic/Kconfig
@@ -40,6 +40,13 @@ config PMIC_ACT8846
functions. It uses an I2C interface and is designed for use with
tablets and smartphones.
 
+config DM_PMIC_DA9063
+   bool "Enable Driver Model for the Dialog DA9063 PMIC"
+   depends on DM_PMIC
+   help
+ This config enables implementation of driver-model pmic uclass 
features
+ for PMIC DA9063. The driver implements read/write operations.
+
 config PMIC_AS3722
bool "Enable support for the Austria Micro Systems (AMS) AS7322 PMIC"
help
diff --git a/drivers/power/pmic/Makefile b/drivers/power/pmic/Makefile
index 29ca442..b3f9e0e 100644
--- a/drivers/power/pmic/Makefile
+++ b/drivers/power/pmic/Makefile
@@ -4,6 +4,7 @@
 # Lukasz Majewski 
 
 obj-$(CONFIG_DM_PMIC) += pmic-uclass.o
+obj-$(CONFIG_DM_PMIC_DA9063) += da9063.o
 obj-$(CONFIG_DM_PMIC_MAX77686) += max77686.o
 obj-$(CONFIG_DM_PMIC_MAX8998) += max8998.o
 obj-$(CONFIG_DM_PMIC_MC34708) += mc34708.o
diff --git a/drivers/power/pmic/da9063.c b/drivers/power/pmic/da9063.c
new file mode 100644
index 000..d4c272a
--- /dev/null
+++ b/drivers/power/pmic/da9063.c
@@ -0,0 +1,187 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ *  Copyright (C) 2018 Flowbird
+ *  Martin Fuzzey  
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static const struct pmic_child_info pmic_children_info[] = {
+   { .prefix = "ldo", .driver = DA9063_LDO_DRIVER },
+   { .prefix = "b", .driver = DA9063_BUCK_DRIVER },
+   { },
+};
+
+struct da9063_priv {
+   u8  cur_page;
+
+   /* We only support I2C for the moment so these are constant but,
+* storing them here will simplify a future SPI implementation
+*/
+   u8  page_mask;
+   u8  offset_mask;
+};
+
+/*
+ * The register map is non contiguous and attempts to read in the holes fail.
+ * But "pmic dump" tries to dump the full register map.
+ * So define the holes here so we can fix that.
+ */
+struct da9063_reg_hole {
+   u16 first;
+   u16 last;
+};
+
+static const struct da9063_reg_hole da9063_reg_holes[] = {
+   DA9063_REG_HOLE_1,
+   DA9063_REG_HOLE_2,
+   DA9063_REG_HOLE_3,
+   /* These aren't readable. I can't see why from the datasheet but
+* attempts to read fail and the kernel marks them unreadable too,
+*/
+   {DA9063_REG_OTP_COUNT, DA9063_REG_OTP_DATA},
+};
+
+static int da9063_reg_count(struct udevice *dev)
+{
+   return DA9063_NUM_OF_REGS;
+}
+
+static bool da9063_reg_valid(uint reg)
+{
+   int i;
+
+   for (i = 0; i < ARRAY_SIZE(da9063_reg_holes); i++) {
+   const struct da9063_reg_hole *hole = _reg_holes[i];
+
+   if (reg >= hole->first && reg <= hole->last)
+   return false;
+   }
+
+   return true;
+}
+
+/* Select page for register
+ * return offset or negative error code
+ */
+static int da9063_select_page(struct udevice *dev, uint reg)
+{
+   struct da9063_priv *priv = dev->priv;
+   u8 page = (reg / 128) & priv->page_mask;
+   uint offset = reg & priv->offset_mask;
+   int ret;
+
+   if (page == priv->cur_page)
+   return offset;
+
+   if (offset == DA9063_REG_PAGE_CON) /* Available on all pages */
+   return offset;
+
+   ret = dm_i2c_write(dev, DA9063_REG_PAGE_CON, , 1);
+   if (ret < 0) {
+   pr_err("error on device %p selecting page %u for reg %#x",
+  dev, page, reg);
+   return ret;
+   }
+
+   priv->cur_page = page;
+
+   return offset;
+}
+
+static int da9063_write(struct udevice *dev, uint reg, const uint8_t *buff,
+   int len)
+{
+   int offset;
+
+   offset = da9063_select_page(dev, reg);
+   if (offset < 0)
+   return offset;
+
+   if (dm_i2c_write(dev, offset, buff, len)) {
+   pr_err("write error to device: %p register: %#x!", dev, reg);
+   return -EIO;
+   }
+
+   return 0;
+}
+
+static int da9063_read(struct udevice *dev, uint reg, uint8_t *buff, int len)
+{
+   int offset;
+
+   if (!da9063_reg_valid(reg))
+   return -ENODATA;
+
+   offset = da9063_select_page(dev, reg);
+   if (offset < 0)
+   return offset;
+
+   

[U-Boot] [PATCH 0/3] power: Add support for the Dialog DA9063 PMIC

2018-10-05 Thread Martin Fuzzey
Add basic support for the Dialog DA9063 PMIC.
Only the regulators are supported for the moment.

Also teach "pmic dump" to handle non contiguous register maps.

Martin Fuzzey (3):
  pmic: allow dump command for non contiguous register maps
  power: pmic: add driver for Dialog DA9063 PMIC
  power: regulator: add driver for Dialog DA9063 PMIC

 cmd/pmic.c   |  12 +-
 drivers/power/pmic/Kconfig   |   7 +
 drivers/power/pmic/Makefile  |   1 +
 drivers/power/pmic/da9063.c  | 187 ++
 drivers/power/regulator/Kconfig  |  10 +
 drivers/power/regulator/Makefile |   1 +
 drivers/power/regulator/da9063.c | 395 +++
 include/power/da9063_pmic.h  | 308 ++
 8 files changed, 919 insertions(+), 2 deletions(-)
 create mode 100644 drivers/power/pmic/da9063.c
 create mode 100644 drivers/power/regulator/da9063.c
 create mode 100644 include/power/da9063_pmic.h

-- 
1.9.1

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


[U-Boot] [PATCH 1/3] pmic: allow dump command for non contiguous register maps

2018-10-05 Thread Martin Fuzzey
Some PMICs (such as the DA9063) have non-contiguous register maps.
Attempting to read the non implemented registers returns an error
rather than a dummy value which causes 'pmic dump' to terminate
prematurely.

Fix this by allowing the PMIC driver to return -ENODATA for such
registers, which will then be displayed as '--' by pmic dump.

Use a single error code rather than any error code so that
we can distinguish between a hardware failure reading the PMIC
and a non implemented register known to the driver.

Signed-off-by: Martin Fuzzey 
---
 cmd/pmic.c | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/cmd/pmic.c b/cmd/pmic.c
index e46d813..2400bfb 100644
--- a/cmd/pmic.c
+++ b/cmd/pmic.c
@@ -95,7 +95,7 @@ static int do_dump(cmd_tbl_t *cmdtp, int flag, int argc, char 
* const argv[])
 
for (reg = 0; reg < pmic_reg_count(dev); reg++) {
ret = pmic_reg_read(dev, reg);
-   if (ret < 0) {
+   if (ret < 0 && ret != -ENODATA) {
printf("Can't read register: %d\n", reg);
return failure(ret);
}
@@ -103,7 +103,15 @@ static int do_dump(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
if (!(reg % 16))
printf("\n0x%02x: ", reg);
 
-   printf(fmt, ret);
+   if (ret == -ENODATA) {
+   int i;
+
+   for (i = 0; i < priv->trans_len; i++)
+   puts("--");
+   puts(" ");
+   } else {
+   printf(fmt, ret);
+   }
}
printf("\n");
 
-- 
1.9.1

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


Re: [U-Boot] [PATCH v2 04/17] test/py: Fix unicode handling for log filtering

2018-10-05 Thread Michal Simek
On 2.10.2018 05:12, Simon Glass wrote:
> At present the unicode filtering seems to get confused at times with
> this error:
> 
>   UnicodeDecodeError: 'ascii' codec can't decode byte 0x80 in position
>  32: ordinal not in range(128)
> 
> It seems to be due to self._nonprint being interpreted as UTF-8. Fix it
> by using ordinals instead of characters, changing the string to set.
> 
> Signed-off-by: Simon Glass 
> Reviewed-by: Stephen Warren 
> ---
> 
> Changes in v2: None
> 
>  test/py/multiplexed_log.py | 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/test/py/multiplexed_log.py b/test/py/multiplexed_log.py
> index f23d5dec68c..637a3bd257b 100644
> --- a/test/py/multiplexed_log.py
> +++ b/test/py/multiplexed_log.py
> @@ -314,8 +314,9 @@ $(document).ready(function () {
>  
>  # The set of characters that should be represented as hexadecimal codes 
> in
>  # the log file.
> -_nonprint = ('%' + ''.join(chr(c) for c in range(0, 32) if c not in (9, 
> 10)) +
> - ''.join(chr(c) for c in range(127, 256)))
> +_nonprint = {ord('%')}
> +_nonprint.update({c for c in range(0, 32) if c not in (9, 10)})
> +_nonprint.update({c for c in range(127, 256)})
>  
>  def _escape(self, data):
>  """Render data format suitable for inclusion in an HTML document.
> @@ -331,7 +332,7 @@ $(document).ready(function () {
>  """
>  
>  data = data.replace(chr(13), '')
> -data = ''.join((c in self._nonprint) and ('%%%02x' % ord(c)) or
> +data = ''.join((ord(c) in self._nonprint) and ('%%%02x' % ord(c)) or
> c for c in data)
>  data = cgi.escape(data)
>  return data
> 

Tested-by: Michal Simek 

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP SoCs

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


[U-Boot] [PATCH] arm64: zynqmp: Enable CDC ethernet gadget for zcu100/Ultra96

2018-10-05 Thread Michal Simek
Ethernet is not present on this board that's why there are two other
options how to wire the board to ethernet. The first is asix_eth usb
host converter which is already enabled by default. The second option is
to use USB CDC/RNDIS ethernet gadget.

This patch is enabling CDC which is working with Linux.
With new bind/unbind command there is no need to call usb_ether_init()
from platform code and use for example these commands:

bind /amba/usb0@ff9d/dwc3@fe20 usb_ether
dhcp
unbind /amba/usb0@ff9d/dwc3@fe20

Signed-off-by: Michal Simek 
---

 configs/avnet_ultra96_rev1_defconfig| 5 +
 configs/xilinx_zynqmp_zcu100_revC_defconfig | 5 +
 2 files changed, 10 insertions(+)

diff --git a/configs/avnet_ultra96_rev1_defconfig 
b/configs/avnet_ultra96_rev1_defconfig
index 3d073670075f..c49c9f23465d 100644
--- a/configs/avnet_ultra96_rev1_defconfig
+++ b/configs/avnet_ultra96_rev1_defconfig
@@ -21,6 +21,7 @@ CONFIG_SPL_ATF=y
 CONFIG_SYS_PROMPT="ZynqMP> "
 CONFIG_CMD_BOOTMENU=y
 CONFIG_CMD_MEMTEST=y
+CONFIG_CMD_BIND=y
 CONFIG_CMD_CLK=y
 CONFIG_CMD_DFU=y
 # CONFIG_CMD_FLASH is not set
@@ -65,6 +66,8 @@ CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_SPI_FLASH_WINBOND=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
+CONFIG_DM_ETH=y
+# CONFIG_NETDEVICES is not set
 CONFIG_DEBUG_UART_ZYNQ=y
 CONFIG_DEBUG_UART_ANNOUNCE=y
 CONFIG_ZYNQ_SERIAL=y
@@ -83,6 +86,8 @@ CONFIG_USB_ULPI=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_DOWNLOAD=y
+CONFIG_USB_ETHER=y
+CONFIG_USB_ETH_CDC=y
 CONFIG_USB_HOST_ETHER=y
 CONFIG_USB_ETHER_ASIX=y
 CONFIG_WDT=y
diff --git a/configs/xilinx_zynqmp_zcu100_revC_defconfig 
b/configs/xilinx_zynqmp_zcu100_revC_defconfig
index d21abe253a26..dc1e7cd8240f 100644
--- a/configs/xilinx_zynqmp_zcu100_revC_defconfig
+++ b/configs/xilinx_zynqmp_zcu100_revC_defconfig
@@ -21,6 +21,7 @@ CONFIG_SPL_ATF=y
 CONFIG_SYS_PROMPT="ZynqMP> "
 CONFIG_CMD_BOOTMENU=y
 CONFIG_CMD_MEMTEST=y
+CONFIG_CMD_BIND=y
 CONFIG_CMD_CLK=y
 CONFIG_CMD_DFU=y
 # CONFIG_CMD_FLASH is not set
@@ -65,6 +66,8 @@ CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_SPI_FLASH_WINBOND=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
+CONFIG_DM_ETH=y
+# CONFIG_NETDEVICES is not set
 CONFIG_DEBUG_UART_ZYNQ=y
 CONFIG_DEBUG_UART_ANNOUNCE=y
 CONFIG_ZYNQ_SERIAL=y
@@ -83,6 +86,8 @@ CONFIG_USB_ULPI=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_DOWNLOAD=y
+CONFIG_USB_ETHER=y
+CONFIG_USB_ETH_CDC=y
 CONFIG_USB_HOST_ETHER=y
 CONFIG_USB_ETHER_ASIX=y
 CONFIG_WDT=y
-- 
1.9.1

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