Re: [U-Boot] [PATCH v3 1/4] ata: mvebu: move mvebu sata driver to drivers/ata directory

2018-05-24 Thread Stefan Roese

On 25.05.2018 04:06, m...@marvell.com wrote:

From: Ken Ma 

Currently mvebu sata driver is in arch/arm/mach_mvebu directory, this
patch moves it to drivers/ata directory with renaming "sata.c" to
"ahci_mvebu.c" which is aligned to Linux.
New ahci driver's kconfig option is added as AHCI_MVEBU which selects
DM_SCSI.

Signed-off-by: Ken Ma 
Reviewed-by: Stefan Roese 
Reviewed-by: Simon Glass 
---

Changes in v3:
- Use the new SPDX tags.

  MAINTAINERS| 1 +
  arch/arm/mach-mvebu/Makefile   | 1 -
  drivers/ata/Kconfig| 9 +
  drivers/ata/Makefile   | 1 +
  arch/arm/mach-mvebu/sata.c => drivers/ata/ahci_mvebu.c | 5 +
  5 files changed, 12 insertions(+), 5 deletions(-)
  rename arch/arm/mach-mvebu/sata.c => drivers/ata/ahci_mvebu.c (93%)

diff --git a/MAINTAINERS b/MAINTAINERS
index 077828c..97c0752 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -134,6 +134,7 @@ S:  Maintained
  T:git git://git.denx.de/u-boot-marvell.git
  F:arch/arm/mach-kirkwood/
  F:arch/arm/mach-mvebu/
+F: drivers/ata/ahci_mvebu.c
  
  ARM MARVELL PXA

  M:Marek Vasut 
diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile
index d4210af..7f0d692 100644
--- a/arch/arm/mach-mvebu/Makefile
+++ b/arch/arm/mach-mvebu/Makefile
@@ -9,7 +9,6 @@ ifdef CONFIG_ARM64
  obj-$(CONFIG_ARMADA_3700) += armada3700/
  obj-$(CONFIG_ARMADA_8K) += armada8k/
  obj-y += arm64-common.o
-obj-y += sata.o
  
  else # CONFIG_ARM64
  
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig

index 86ec628..9ef4589 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -99,4 +99,13 @@ config SATA_SIL3114
help
  Enable this driver to support the SIL3114 SATA controllers.
  
+config AHCI_MVEBU

+   bool "Marvell EBU AHCI SATA support"
+   depends on ARCH_MVEBU
+   select DM_SCSI
+   help
+ This option enables support for the Marvell EBU SoC's
+ onboard AHCI SATA.
+
+ If unsure, say N.
  endmenu
diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile
index a94c804..0254640 100644
--- a/drivers/ata/Makefile
+++ b/drivers/ata/Makefile
@@ -19,3 +19,4 @@ obj-$(CONFIG_SATA_MV) += sata_mv.o
  obj-$(CONFIG_SATA_SIL3114) += sata_sil3114.o
  obj-$(CONFIG_SATA_SIL) += sata_sil.o
  obj-$(CONFIG_SANDBOX) += sata_sandbox.o
+obj-$(CONFIG_AHCI_MVEBU) += ahci_mvebu.o
diff --git a/arch/arm/mach-mvebu/sata.c b/drivers/ata/ahci_mvebu.c
similarity index 93%
rename from arch/arm/mach-mvebu/sata.c
rename to drivers/ata/ahci_mvebu.c
index 5d8032b..3ae8dae 100644
--- a/arch/arm/mach-mvebu/sata.c
+++ b/drivers/ata/ahci_mvebu.c
@@ -1,15 +1,12 @@
+// SPDX-License-Identifier: GPL-2.0+
  /*
   * Copyright (C) 2016 Stefan Roese 
- *
- * SPDX-License-Identifier:GPL-2.0+
   */


You should have no such changes in your new file, since you are
moving the file which already has the new SPDX tags. So please make
sure to base your patches on top of the latest mainline git version.

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


Re: [U-Boot] [PATCH] efi_selftest: check for buffer overflow in efi_get_variable

2018-05-24 Thread Heinrich Schuchardt
On 05/25/2018 02:09 AM, Ivan Gorinov wrote:
> Check if GetVariable writes past the end of the output data buffer.
> 
> Signed-off-by: Ivan Gorinov 

The patch produces build warnings:

lib/efi_selftest/efi_selftest_variables.c: In function ‘execute’:
lib/efi_selftest/efi_selftest_variables.c:75:10: warning: assignment
makes pointer from integer without a cast [-Wint-conversion]
  data[3] = 0xff;
  ^
lib/efi_selftest/efi_selftest_variables.c:87:14: warning: comparison
between pointer and integer
  if (data[3] != 0xff) {

This is due to an inappropriate definition in my prior patch. Could you,
please, add this change:

-u8 *data[EFI_ST_MAX_DATA_SIZE];
+u8 data[EFI_ST_MAX_DATA_SIZE];

Otherwise your patch is fine.

Best regards

Heinrich

> ---
>  lib/efi_selftest/efi_selftest_variables.c | 16 
>  1 file changed, 16 insertions(+)
> 
> diff --git a/lib/efi_selftest/efi_selftest_variables.c 
> b/lib/efi_selftest/efi_selftest_variables.c
> index f5e8eb6..8a02dbc 100644
> --- a/lib/efi_selftest/efi_selftest_variables.c
> +++ b/lib/efi_selftest/efi_selftest_variables.c
> @@ -72,6 +72,22 @@ static int execute(void)
>   efi_st_error("SetVariable failed\n");
>   return EFI_ST_FAILURE;
>   }
> + data[3] = 0xff;
> + len = 3;
> + ret = runtime->get_variable(L"efi_st_var0", _vendor0,
> + , , data);
> + if (ret != EFI_SUCCESS) {
> + efi_st_error("GetVariable failed\n");
> + return EFI_ST_FAILURE;
> + }
> + if (efi_st_memcmp(data, v + 4, 3)) {
> + efi_st_error("GetVariable returned wrong value\n");
> + return EFI_ST_FAILURE;
> + }
> + if (data[3] != 0xff) {
> + efi_st_error("GetVariable wrote past the end of the buffer\n");
> + return EFI_ST_FAILURE;
> + }
>   /* Set variable 1 */
>   ret = runtime->set_variable(L"efi_st_var1", _vendor1,
>   EFI_VARIABLE_BOOTSERVICE_ACCESS,
> 

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


[U-Boot] [PATCH v3] gadget: f_thor: Fix memory leaks of usb request and its buffer

2018-05-24 Thread Seung-Woo Kim
There are memory leaks of usb request and its buffer for ep0,
in_ep, and out ep. Fix memory leaks of usb request and its buffer.

Signed-off-by: Seung-Woo Kim 
---
Change from v2
- replace only once used local function, thor_start_ep(), with generic functions
  as Lukasz commented

Change from v1
- remove allocation of out_ep request instead of allocating and freeing
- fix use error path instead of duplicated error handling code
---
---
 drivers/usb/gadget/f_thor.c |   65 +--
 1 file changed, 32 insertions(+), 33 deletions(-)

diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c
index c8eda05..1aa6be4 100644
--- a/drivers/usb/gadget/f_thor.c
+++ b/drivers/usb/gadget/f_thor.c
@@ -620,22 +620,6 @@ static void thor_rx_tx_complete(struct usb_ep *ep, struct 
usb_request *req)
  status, req->actual, req->length);
 }
 
-static struct usb_request *thor_start_ep(struct usb_ep *ep)
-{
-   struct usb_request *req;
-
-   req = alloc_ep_req(ep, THOR_PACKET_SIZE);
-   debug("%s: ep:%p req:%p\n", __func__, ep, req);
-
-   if (!req)
-   return NULL;
-
-   memset(req->buf, 0, req->length);
-   req->complete = thor_rx_tx_complete;
-
-   return req;
-}
-
 static void thor_setup_complete(struct usb_ep *ep, struct usb_request *req)
 {
if (req->status || req->actual != req->length)
@@ -752,6 +736,13 @@ int thor_handle(void)
return 0;
 }
 
+static void free_ep_req(struct usb_ep *ep, struct usb_request *req)
+{
+   if (req->buf)
+   free(req->buf);
+   usb_ep_free_request(ep, req);
+}
+
 static int thor_func_bind(struct usb_configuration *c, struct usb_function *f)
 {
struct usb_gadget *gadget = c->cdev->gadget;
@@ -860,21 +851,18 @@ static int thor_func_bind(struct usb_configuration *c, 
struct usb_function *f)
return 0;
 
  fail:
+   if (dev->req)
+   free_ep_req(gadget->ep0, dev->req);
free(dev);
return status;
 }
 
-static void free_ep_req(struct usb_ep *ep, struct usb_request *req)
-{
-   free(req->buf);
-   usb_ep_free_request(ep, req);
-}
-
 static void thor_unbind(struct usb_configuration *c, struct usb_function *f)
 {
struct f_thor *f_thor = func_to_thor(f);
struct thor_dev *dev = f_thor->dev;
 
+   free_ep_req(dev->gadget->ep0, dev->req);
free(dev);
memset(thor_func, 0, sizeof(*thor_func));
thor_func = NULL;
@@ -895,8 +883,6 @@ static void thor_func_disable(struct usb_function *f)
}
 
if (dev->out_ep->driver_data) {
-   free(dev->out_req->buf);
-   dev->out_req->buf = NULL;
usb_ep_free_request(dev->out_ep, dev->out_req);
usb_ep_disable(dev->out_ep);
dev->out_ep->driver_data = NULL;
@@ -924,16 +910,17 @@ static int thor_eps_setup(struct usb_function *f)
 
result = usb_ep_enable(ep, d);
if (result)
-   goto exit;
+   goto err;
 
ep->driver_data = cdev; /* claim */
-   req = thor_start_ep(ep);
+   req = alloc_ep_req(ep, THOR_PACKET_SIZE);
if (!req) {
-   usb_ep_disable(ep);
result = -EIO;
-   goto exit;
+   goto err_disable_in_ep;
}
 
+   memset(req->buf, 0, req->length);
+   req->complete = thor_rx_tx_complete;
dev->in_req = req;
ep = dev->out_ep;
d = ep_desc(gadget, _out_desc, _out_desc);
@@ -941,22 +928,34 @@ static int thor_eps_setup(struct usb_function *f)
 
result = usb_ep_enable(ep, d);
if (result)
-   goto exit;
+   goto err_free_in_req;
 
ep->driver_data = cdev; /* claim */
-   req = thor_start_ep(ep);
+   req = usb_ep_alloc_request(ep, 0);
if (!req) {
-   usb_ep_disable(ep);
result = -EIO;
-   goto exit;
+   goto err_disable_out_ep;
}
 
+   req->complete = thor_rx_tx_complete;
dev->out_req = req;
/* ACM control EP */
ep = dev->int_ep;
ep->driver_data = cdev; /* claim */
 
- exit:
+   return 0;
+
+ err_disable_out_ep:
+   usb_ep_disable(dev->out_ep);
+
+ err_free_in_req:
+   free_ep_req(dev->in_ep, dev->in_req);
+   dev->in_req = NULL;
+
+ err_disable_in_ep:
+   usb_ep_disable(dev->in_ep);
+
+ err:
return result;
 }
 
-- 
1.7.9.5

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


[U-Boot] [PATCH 1/2] mmc: sdhci: Update sdhci_send_command() to handle HS200

2018-05-24 Thread Siva Durga Prasad Paladugu
This patch updates sdhci_send_command() to handle MMC
HS200 tuning command.

Signed-off-by: Siva Durga Prasad Paladugu 
---
 drivers/mmc/sdhci.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index 400f87e..1bbcf4b 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -161,7 +161,8 @@ static int sdhci_send_command(struct mmc *mmc, struct 
mmc_cmd *cmd,
/* We shouldn't wait for data inihibit for stop commands, even
   though they might use busy signaling */
if (cmd->cmdidx == MMC_CMD_STOP_TRANSMISSION ||
-   cmd->cmdidx ==  MMC_CMD_SEND_TUNING_BLOCK)
+   cmd->cmdidx ==  MMC_CMD_SEND_TUNING_BLOCK ||
+   cmd->cmdidx ==  MMC_CMD_SEND_TUNING_BLOCK_HS200)
mask &= ~SDHCI_DATA_INHIBIT;

while (sdhci_readl(host, SDHCI_PRESENT_STATE) & mask) {
@@ -183,7 +184,8 @@ static int sdhci_send_command(struct mmc *mmc, struct 
mmc_cmd *cmd,
sdhci_writel(host, SDHCI_INT_ALL_MASK, SDHCI_INT_STATUS);

mask = SDHCI_INT_RESPONSE;
-   if (cmd->cmdidx == MMC_CMD_SEND_TUNING_BLOCK)
+   if (cmd->cmdidx == MMC_CMD_SEND_TUNING_BLOCK ||
+   cmd->cmdidx ==  MMC_CMD_SEND_TUNING_BLOCK_HS200)
mask = SDHCI_INT_DATA_AVAIL;

if (!(cmd->resp_type & MMC_RSP_PRESENT))
@@ -201,7 +203,8 @@ static int sdhci_send_command(struct mmc *mmc, struct 
mmc_cmd *cmd,
flags |= SDHCI_CMD_CRC;
if (cmd->resp_type & MMC_RSP_OPCODE)
flags |= SDHCI_CMD_INDEX;
-   if (data || cmd->cmdidx ==  MMC_CMD_SEND_TUNING_BLOCK)
+   if (data || cmd->cmdidx ==  MMC_CMD_SEND_TUNING_BLOCK ||
+   cmd->cmdidx ==  MMC_CMD_SEND_TUNING_BLOCK_HS200)
flags |= SDHCI_CMD_DATA;

/* Set Transfer mode regarding to data flag */
--
2.7.4

This email and any attachments are intended for the sole use of the named 
recipient(s) and contain(s) confidential information that may be proprietary, 
privileged or copyrighted under applicable law. If you are not the intended 
recipient, do not read, copy, or forward this email message or any attachments. 
Delete this email message and any attachments immediately.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 2/2] mmc: zynqmp: Add HS200 modes support for ZynqMP

2018-05-24 Thread Siva Durga Prasad Paladugu
This patch adds HS200 suuport for ZynqMP and enables
the same for ZC1751 DC1 board which has eMMC on it.

Signed-off-by: Siva Durga Prasad Paladugu 
---
 configs/xilinx_zynqmp_zc1751_xm015_dc1_defconfig |  1 +
 drivers/mmc/zynq_sdhci.c | 25 
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/configs/xilinx_zynqmp_zc1751_xm015_dc1_defconfig 
b/configs/xilinx_zynqmp_zc1751_xm015_dc1_defconfig
index f5a3334..96abf61 100644
--- a/configs/xilinx_zynqmp_zc1751_xm015_dc1_defconfig
+++ b/configs/xilinx_zynqmp_zc1751_xm015_dc1_defconfig
@@ -54,6 +54,7 @@ CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_CADENCE=y
 CONFIG_MISC=y
 CONFIG_DM_MMC=y
+CONFIG_MMC_HS200_SUPPORT=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_ZYNQ=y
 CONFIG_SPI_FLASH=y
diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c
index f99731f..32c2dc6 100644
--- a/drivers/mmc/zynq_sdhci.c
+++ b/drivers/mmc/zynq_sdhci.c
@@ -32,12 +32,21 @@ struct arasan_sdhci_priv {
 };

 #if defined(CONFIG_ARCH_ZYNQMP)
+#define MMC_HS200_BUS_SPEED5
+
 static const u8 mode2timing[] = {
-[UHS_SDR12] = UHS_SDR12_BUS_SPEED,
-[UHS_SDR25] = UHS_SDR25_BUS_SPEED,
-[UHS_SDR50] = UHS_SDR50_BUS_SPEED,
-[UHS_SDR104] = UHS_SDR104_BUS_SPEED,
-[UHS_DDR50] = UHS_DDR50_BUS_SPEED,
+ [MMC_LEGACY]  = UHS_SDR12_BUS_SPEED,
+ [SD_LEGACY]   = UHS_SDR12_BUS_SPEED,
+ [MMC_HS]  = HIGH_SPEED_BUS_SPEED,
+ [SD_HS]   = HIGH_SPEED_BUS_SPEED,
+ [MMC_HS_52]   = HIGH_SPEED_BUS_SPEED,
+ [MMC_DDR_52]  = HIGH_SPEED_BUS_SPEED,
+ [UHS_SDR12]   = UHS_SDR12_BUS_SPEED,
+ [UHS_SDR25]   = UHS_SDR25_BUS_SPEED,
+ [UHS_SDR50]   = UHS_SDR50_BUS_SPEED,
+ [UHS_DDR50]   = UHS_DDR50_BUS_SPEED,
+ [UHS_SDR104]  = UHS_SDR104_BUS_SPEED,
+ [MMC_HS_200]  = MMC_HS200_BUS_SPEED,
 };

 #define SDHCI_HOST_CTRL2   0x3E
@@ -160,9 +169,6 @@ static void arasan_sdhci_set_tapdelay(struct sdhci_host 
*host)
struct mmc *mmc = (struct mmc *)host->mmc;
u8 uhsmode;

-   if (!IS_SD(mmc))
-   return;
-
uhsmode = mode2timing[mmc->selected_mode];

if (uhsmode >= UHS_SDR25_BUS_SPEED)
@@ -175,6 +181,9 @@ static void arasan_sdhci_set_control_reg(struct sdhci_host 
*host)
struct mmc *mmc = (struct mmc *)host->mmc;
u32 reg;

+   if (!IS_SD(mmc))
+   return;
+
if (mmc->signal_voltage == MMC_SIGNAL_VOLTAGE_180) {
reg = sdhci_readw(host, SDHCI_HOST_CTRL2);
reg |= SDHCI_18V_SIGNAL;
--
2.7.4

This email and any attachments are intended for the sole use of the named 
recipient(s) and contain(s) confidential information that may be proprietary, 
privileged or copyrighted under applicable law. If you are not the intended 
recipient, do not read, copy, or forward this email message or any attachments. 
Delete this email message and any attachments immediately.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v1 1/2] buildman: Extract environment as part of each build

2018-05-24 Thread Alex Kiernan
As we're building the boards, extract the default U-Boot environment to
uboot.env so we can interrogate it later.

Signed-off-by: Alex Kiernan 
---

 tools/buildman/builderthread.py | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py
index 0efe80d945..688322ced2 100644
--- a/tools/buildman/builderthread.py
+++ b/tools/buildman/builderthread.py
@@ -351,6 +351,16 @@ class BuilderThread(threading.Thread):
 lines.append(size_result.stdout.splitlines()[1] + ' ' +
  rodata_size)
 
+# Extract the environment from U-Boot and dump it out
+cmd = ['%sobjcopy' % self.toolchain.cross, '-O', 'binary',
+   '-j', '.rodata.default_environment',
+   'env/built-in.o', 'uboot.env']
+command.RunPipe([cmd], capture=False,
+capture_stderr=False, cwd=result.out_dir,
+raise_on_error=False, env=env)
+ubootenv = os.path.join(result.out_dir, 'uboot.env')
+self.CopyFiles(result.out_dir, build_dir, '', ['uboot.env'])
+
 # Write out the image sizes file. This is similar to the output
 # of binutil's 'size' utility, but it omits the header line and
 # adds an additional hex value at the end of each line for the
-- 
2.17.0

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


[U-Boot] [PATCH v1 2/2] buildman: Add support for environment delta in summary

2018-05-24 Thread Alex Kiernan
When summarising the builds, add the -U option to emit delta lines for
the default environment built into U-Boot at each commit.

Signed-off-by: Alex Kiernan 
---

 tools/buildman/builder.py | 128 +-
 tools/buildman/cmdline.py |   2 +
 tools/buildman/control.py |   3 +-
 3 files changed, 117 insertions(+), 16 deletions(-)

diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index 2ccdee02a3..a5a2ffdfdf 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -127,6 +127,15 @@ class Config:
 val = val ^ hash(key) & hash(value)
 return val
 
+class Environment:
+"""Holds information about environment variables for a board."""
+def __init__(self, target):
+self.target = target
+self.environment = {}
+
+def Add(self, key, value):
+self.environment[key] = value
+
 class Builder:
 """Class for building U-Boot for a particular commit.
 
@@ -199,13 +208,17 @@ class Builder:
 value is itself a dictionary:
 key: config name
 value: config value
+environment: Dictionary keyed by environment variable, Each
+ value is the value of environment variable.
 """
-def __init__(self, rc, err_lines, sizes, func_sizes, config):
+def __init__(self, rc, err_lines, sizes, func_sizes, config,
+ environment):
 self.rc = rc
 self.err_lines = err_lines
 self.sizes = sizes
 self.func_sizes = func_sizes
 self.config = config
+self.environment = environment
 
 def __init__(self, toolchains, base_dir, git_dir, num_threads, num_jobs,
  gnu_make='make', checkout=True, show_unknown=True, step=1,
@@ -310,7 +323,8 @@ class Builder:
 
 def SetDisplayOptions(self, show_errors=False, show_sizes=False,
   show_detail=False, show_bloat=False,
-  list_error_boards=False, show_config=False):
+  list_error_boards=False, show_config=False,
+  show_environment=False):
 """Setup display options for the builder.
 
 show_errors: True to show summarised error/warning info
@@ -319,6 +333,7 @@ class Builder:
 show_bloat: Show detail for each function
 list_error_boards: Show the boards which caused each error/warning
 show_config: Show config deltas
+show_environment: Show environment deltas
 """
 self._show_errors = show_errors
 self._show_sizes = show_sizes
@@ -326,6 +341,7 @@ class Builder:
 self._show_bloat = show_bloat
 self._list_error_boards = list_error_boards
 self._show_config = show_config
+self._show_environment = show_environment
 
 def _AddTimestamp(self):
 """Add a new timestamp to the list and record the build period.
@@ -609,8 +625,33 @@ class Builder:
 config[key] = value
 return config
 
+def _ProcessEnvironment(self, fname):
+"""Read in a uboot.env file
+
+This function reads in environment variables from a file.
+
+Args:
+fname: Filename to read
+
+Returns:
+Dictionary:
+key: environment variable (e.g. bootlimit)
+value: value of environment variable (e.g. 1)
+"""
+environment = {}
+if os.path.exists(fname):
+with open(fname) as fd:
+for line in fd.read().split('\0'):
+try:
+key, value = line.split('=', 1)
+environment[key] = value
+except ValueError:
+# ignore lines we can't parse
+pass
+return environment
+
 def GetBuildOutcome(self, commit_upto, target, read_func_sizes,
-read_config):
+read_config, read_environment):
 """Work out the outcome of a build.
 
 Args:
@@ -618,6 +659,7 @@ class Builder:
 target: Target board to check
 read_func_sizes: True to read function size information
 read_config: True to read .config and autoconf.h files
+read_environment: True to read uboot.env files
 
 Returns:
 Outcome object
@@ -627,6 +669,7 @@ class Builder:
 sizes = {}
 func_sizes = {}
 config = {}
+environment = {}
 if os.path.exists(done_file):
 with open(done_file, 'r') as fd:
 return_code = int(fd.readline())
@@ -676,12 +719,18 @@ class Builder:
 fname = os.path.join(output_dir, name)
 config[name] = self._ProcessConfig(fname)
 
-return Builder.Outcome(rc, err_lines, sizes, 

Re: [U-Boot] [PATCH v1 2/2] Migrate bootlimit to Kconfig

2018-05-24 Thread Alex Kiernan
On Thu, May 24, 2018 at 11:14 PM Lukasz Majewski  wrote:

> Hi Alex,

> > Migrate boards which set bootlimit in the environment to Kconfig.
> >
> > We exclude three boards:
> >
> > - display5_factory_defconfig
> > - display5_defconfig
> > - gurnard_defconfig
> >
> > display5_defconfig and display5_factory_defconfig share a
> > SYS_CONFIG_NAME, but only display5_defconfig enables
> > CONFIG_BOOTCOUNT_LIMIT, so we'd fail to set bootlimit= in
> > display5_factory_defconfig if we moved it to Kconfig.

> For display5 board it would be OK to have the CONFIG_BOOTCOUNT_LIMIT
> defined for display5_defconfig.

> The display5_factory_defconfig doesn't need to have it set, as it is
> only meant to prepare the board in factory.


Thanks - reading through the bootcmd logic I suspected it was something
like that. I'll swap it over.

> >
> > gurnard_defconfig includes a bootlimit=, but doesn't set
> > CONFIG_BOOTCOUNT_LIMIT, so again we'd fail to include a bootlimit
> > setting if we migrated it.
> >
> > Signed-off-by: Alex Kiernan 
> > ---
> >
> >  configs/brppt1_mmc_defconfig   | 1 +
> >  configs/brppt1_nand_defconfig  | 1 +
> >  configs/brppt1_spi_defconfig   | 1 +
> >  configs/calimain_defconfig | 1 +
> >  configs/draco_defconfig| 1 +
> >  configs/etamin_defconfig   | 1 +
> >  configs/ge_bx50v3_defconfig| 1 +
> >  configs/km_kirkwood_128m16_defconfig   | 1 +
> >  configs/km_kirkwood_defconfig  | 1 +
> >  configs/km_kirkwood_pci_defconfig  | 1 +
> >  configs/kmcoge4_defconfig  | 1 +
> >  configs/kmcoge5ne_defconfig| 1 +
> >  configs/kmcoge5un_defconfig| 1 +
> >  configs/kmeter1_defconfig  | 1 +
> >  configs/kmlion1_defconfig  | 1 +
> >  configs/kmnusa_defconfig   | 1 +
> >  configs/kmopti2_defconfig  | 1 +
> >  configs/kmsugp1_defconfig  | 1 +
> >  configs/kmsupx5_defconfig  | 1 +
> >  configs/kmsuv31_defconfig  | 1 +
> >  configs/kmtegr1_defconfig  | 1 +
> >  configs/kmtepr2_defconfig  | 1 +
> >  configs/kmvect1_defconfig  | 1 +
> >  configs/mgcoge3un_defconfig| 1 +
> >  configs/mx53ppd_defconfig  | 1 +
> >  configs/portl2_defconfig   | 1 +
> >  configs/pxm2_defconfig | 1 +
> >  configs/rastaban_defconfig | 1 +
> >  configs/rut_defconfig  | 1 +
> >  configs/suvd3_defconfig| 1 +
> >  configs/thuban_defconfig   | 1 +
> >  configs/tuge1_defconfig| 1 +
> >  configs/tuxx1_defconfig| 1 +
> >  include/configs/brppt1.h   | 2 --
> >  include/configs/calimain.h | 1 -
> >  include/configs/ge_bx50v3.h| 1 -
> >  include/configs/km/keymile-common.h| 1 -
> >  include/configs/mx53ppd.h  | 1 -
> >  include/configs/siemens-am33x-common.h | 1 -
> >  39 files changed, 33 insertions(+), 7 deletions(-)
> >
> > diff --git a/configs/brppt1_mmc_defconfig
> > b/configs/brppt1_mmc_defconfig index 5511f2c78e..76d91d4d11 100644
> > --- a/configs/brppt1_mmc_defconfig
> > +++ b/configs/brppt1_mmc_defconfig
> > @@ -50,6 +50,7 @@ CONFIG_CMD_FS_GENERIC=y
> >  CONFIG_ENV_IS_IN_MMC=y
> >  CONFIG_NETCONSOLE=y
> >  CONFIG_BOOTCOUNT_LIMIT=y
> > +CONFIG_BOOTCOUNT_BOOTLIMIT=1
> >  CONFIG_MMC_OMAP_HS=y
> >  CONFIG_DRIVER_TI_CPSW=y
> >  CONFIG_SYS_NS16550=y
> > diff --git a/configs/brppt1_nand_defconfig
> > b/configs/brppt1_nand_defconfig index e00f409d7b..311050c64c 100644
> > --- a/configs/brppt1_nand_defconfig
> > +++ b/configs/brppt1_nand_defconfig
> > @@ -51,6 +51,7 @@
> >
CONFIG_MTDPARTS_DEFAULT="mtdparts=omap2-nand.0:128k(MLO),128k(MLO.backup),128k(d
> > CONFIG_ENV_IS_IN_NAND=y CONFIG_NETCONSOLE=y
> >  CONFIG_BOOTCOUNT_LIMIT=y
> > +CONFIG_BOOTCOUNT_BOOTLIMIT=1
> >  # CONFIG_MMC is not set
> >  CONFIG_NAND=y
> >  CONFIG_DRIVER_TI_CPSW=y
> > diff --git a/configs/brppt1_spi_defconfig
> > b/configs/brppt1_spi_defconfig index 8d4f1c1252..977ae73514 100644
> > --- a/configs/brppt1_spi_defconfig
> > +++ b/configs/brppt1_spi_defconfig
> > @@ -57,6 +57,7 @@ CONFIG_CMD_MTDPARTS=y
> >  CONFIG_ENV_IS_IN_SPI_FLASH=y
> >  CONFIG_NETCONSOLE=y
> >  CONFIG_BOOTCOUNT_LIMIT=y
> > +CONFIG_BOOTCOUNT_BOOTLIMIT=1
> >  CONFIG_MMC_OMAP_HS=y
> >  CONFIG_SPI_FLASH=y
> >  CONFIG_SPI_FLASH_STMICRO=y
> > diff --git a/configs/calimain_defconfig b/configs/calimain_defconfig
> > index 7908cfcc34..55782463ae 100644
> > --- a/configs/calimain_defconfig
> > +++ b/configs/calimain_defconfig
> > @@ -22,6 +22,7 @@ CONFIG_CMD_PING=y
> >  CONFIG_CMD_DIAG=y
> >  CONFIG_ENV_IS_IN_FLASH=y
> >  CONFIG_BOOTCOUNT_LIMIT=y
> > +CONFIG_BOOTCOUNT_BOOTLIMIT=3
> >  CONFIG_SYS_BOOTCOUNT_ADDR=0x01C23000
> >  # CONFIG_MMC is not set
> >  CONFIG_MTD_NOR_FLASH=y
> > diff --git a/configs/draco_defconfig b/configs/draco_defconfig
> > index 

Re: [U-Boot] [PATCH] x86: baytrail: Correct the comment of IACORE_VIDS bit ranges

2018-05-24 Thread Bin Meng
On Fri, May 25, 2018 at 10:41 AM, Simon Glass  wrote:
> On 24 May 2018 at 04:05, Bin Meng  wrote:
>>
>> The guaranteed vid bit ranges in IACORE_VIDS MSR is actually
>> [22:16]. This corrects the comment for it.
>>
>> Signed-off-by: Bin Meng 
>> ---
>>
>>  arch/x86/cpu/baytrail/cpu.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>
> Reviewed-by: Simon Glass 

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


Re: [U-Boot] [PATCH] x86: tsc: add support for reading CPU freq from cpuid

2018-05-24 Thread Bin Meng
On Wed, May 23, 2018 at 5:48 PM, Bin Meng  wrote:
> On Mon, May 14, 2018 at 5:32 PM, Christian Gmeiner
>  wrote:
>> Starting with cpuid level 0x16 (Skylake-based processors)
>> it is possible to get CPU base freq via cpuid.
>>
>> This fixes booting on a skylake based system.
>>
>> Signed-off-by: Christian Gmeiner 
>> ---
>>  drivers/timer/tsc_timer.c | 31 +--
>>  1 file changed, 25 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/timer/tsc_timer.c b/drivers/timer/tsc_timer.c
>> index c7fefd2031..96a3e55513 100644
>> --- a/drivers/timer/tsc_timer.c
>> +++ b/drivers/timer/tsc_timer.c
>> @@ -21,6 +21,17 @@
>>
>>  DECLARE_GLOBAL_DATA_PTR;
>>
>> +static unsigned long cpu_mhz_from_cpuid(void)
>> +{
>> +   if (gd->arch.x86_vendor != X86_VENDOR_INTEL)
>> +   return 0;
>> +
>> +   if (cpuid_eax(0) < 0x16)
>> +   return 0;
>> +
>> +   return cpuid_eax(0x16);
>> +}
>> +
>>  /*
>>   * According to Intel 64 and IA-32 System Programming Guide,
>>   * if MSR_PERF_STAT[31] is set, the maximum resolved bus ratio can be
>> @@ -343,14 +354,22 @@ static void tsc_timer_ensure_setup(void)
>> if (!gd->arch.clock_rate) {
>> unsigned long fast_calibrate;
>>
>> +   fast_calibrate = cpu_mhz_from_cpuid();
>> +   if (fast_calibrate)
>> +   goto done;
>> +
>> fast_calibrate = cpu_mhz_from_msr();
>> -   if (!fast_calibrate) {
>> -   fast_calibrate = quick_pit_calibrate();
>> -   if (!fast_calibrate)
>> -   panic("TSC frequency is ZERO");
>> -   }
>> +   if (fast_calibrate)
>> +   goto done;
>> +
>> +   fast_calibrate = quick_pit_calibrate();
>> +   if (fast_calibrate)
>> +   goto done;
>> +
>> +   panic("TSC frequency is ZERO");
>>
>> -   gd->arch.clock_rate = fast_calibrate * 100;
>> +   done:
>
> nits: this indention is wrong, and will cause checkpatch warnings.
>
>> +   gd->arch.clock_rate = fast_calibrate * 100;
>> }
>>  }
>
> Reviewed-by: Bin Meng 
>
> I can fix the nits when applying.

Fixed the nits and
applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v1] x86: acpi: Adopt new version of iASL compiler

2018-05-24 Thread Bin Meng
On Wed, May 23, 2018 at 6:29 PM, Andy Shevchenko
 wrote:
> On Wed, 2018-05-23 at 18:22 +0800, Bin Meng wrote:
>> Hi Andy,
>>
>> On Wed, May 23, 2018 at 5:38 PM, Andy Shevchenko
>>  wrote:
>> > The commit
>> >
>> >   f9a88a4c1cd0 ("iASL: Enhance the -tc option (create AML hex file
>> > in C)")
>> >
>> > in ACPICA project changed a template of the a of variable that is
>> > used
>>
>> a template of the a of variable? Cannot understand this.
>
> "a template of the variable"
>

Fixed this in the commit message

>>
>> > in the generated C-file. Now, instead of hard coded "AmlCode" the
>> > "%s_aml_code" is in use, where the prefix is a lowered case base
>> > name of
>> > the output file. In our case it will be "dsdt" producing a name as
>> > "dsdt_aml_code".
>> >
>> > The quick solution is to call sed which replaces new name by the old
>> > one
>> > to keep compatibility with old version of iASL.
>> >
>> > The long term solution would be to modify code to use the new name
>> > because it more scalable.
>>
>> it *is* more scalable.
>
> Yes, thanks.
>

and here, and

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


Re: [U-Boot] [PATCH] malloc: Use malloc simple before malloc is fully initialized in memalign()

2018-05-24 Thread Simon Glass
Hi,

On 24 May 2018 at 21:24, Ley Foon Tan  wrote:
>
> On Thu, May 24, 2018 at 12:33 AM, Simon Glass  wrote:
> > Hi,
> >
> > On 23 May 2018 at 00:32, Ley Foon Tan  wrote:
> >> On Sat, May 19, 2018 at 10:37 PM, Simon Glass  wrote:
> >>> Hi Ley,
> >>>
> >>> On 18 May 2018 at 04:03, Ley Foon Tan  wrote:
>  Follow implementation in mALLOc(). Check GD_FLG_FULL_MALLOC_INIT flag 
>  and use
>  malloc_simple if GD_FLG_FULL_MALLOC_INIT is unset. Adjust the malloc 
>  bytes
>  to align with the requested alignment.
> 
>  The original memalign() function will access mchunkptr struct to adjust 
>  the
>  alignment if there is misalignment happen, but mchunkptr struct is not 
>  being
>  initialized before full malloc is initialized. This cause the system 
>  crash.
> 
>  Signed-off-by: Ley Foon Tan 
>  ---
>   common/dlmalloc.c |7 +++
>   1 files changed, 7 insertions(+), 0 deletions(-)
> 
>  diff --git a/common/dlmalloc.c b/common/dlmalloc.c
>  index b395eef..edaad29 100644
>  --- a/common/dlmalloc.c
>  +++ b/common/dlmalloc.c
>  @@ -1891,6 +1891,13 @@ Void_t* mEMALIGn(alignment, bytes) size_t 
>  alignment; size_t bytes;
> 
> if ((long)bytes < 0) return NULL;
> 
>  +#if CONFIG_VAL(SYS_MALLOC_F_LEN)
> >>>
> >>> How about:
> >>>
> >>> if (IS_ENABLED(CONFIG_SYS_MALLOC_F))
> >>
> >> I think this is the reason it uses #if CONFIG_VAL(SYS_MALLOC_F_LEN),
> >> same for malloc().
> >>
> >> "spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN"
> >>
> >> http://git.denx.de/?p=u-boot.git;a=commit;h=f1896c45cb2f7d8dbed27e784a6459a129fc0762
> >
> > So how about
> >
> > if (CONFIG_IS_ENABLED(SYS_MALLOC_F_LEN)
> >
> > Or you could use #if if you need to
>
> Tested both #if (CONFIG_IS_ENABLED(SYS_MALLOC_F_LEN)) and if
> (CONFIG_IS_ENABLED(SYS_MALLOC_F_LEN)), both are not working.

Sorry I mean

CONFIG_IS_ENABLED(SYS_MALLOC_F)

That tells you whether the feature is enabled in U-Boot or SPL.

>
> It will not go into this code.
>
>
> >
> > To me it seems better to use the setting itself (i.e. whether the
> > pre-reloc malloc() is enabled) rather than one of its parameters (the
> > size of the region).

[..]

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


Re: [U-Boot] [PATCH] malloc: Use malloc simple before malloc is fully initialized in memalign()

2018-05-24 Thread Ley Foon Tan
On Thu, May 24, 2018 at 12:33 AM, Simon Glass  wrote:
> Hi,
>
> On 23 May 2018 at 00:32, Ley Foon Tan  wrote:
>> On Sat, May 19, 2018 at 10:37 PM, Simon Glass  wrote:
>>> Hi Ley,
>>>
>>> On 18 May 2018 at 04:03, Ley Foon Tan  wrote:
 Follow implementation in mALLOc(). Check GD_FLG_FULL_MALLOC_INIT flag and 
 use
 malloc_simple if GD_FLG_FULL_MALLOC_INIT is unset. Adjust the malloc bytes
 to align with the requested alignment.

 The original memalign() function will access mchunkptr struct to adjust the
 alignment if there is misalignment happen, but mchunkptr struct is not 
 being
 initialized before full malloc is initialized. This cause the system crash.

 Signed-off-by: Ley Foon Tan 
 ---
  common/dlmalloc.c |7 +++
  1 files changed, 7 insertions(+), 0 deletions(-)

 diff --git a/common/dlmalloc.c b/common/dlmalloc.c
 index b395eef..edaad29 100644
 --- a/common/dlmalloc.c
 +++ b/common/dlmalloc.c
 @@ -1891,6 +1891,13 @@ Void_t* mEMALIGn(alignment, bytes) size_t 
 alignment; size_t bytes;

if ((long)bytes < 0) return NULL;

 +#if CONFIG_VAL(SYS_MALLOC_F_LEN)
>>>
>>> How about:
>>>
>>> if (IS_ENABLED(CONFIG_SYS_MALLOC_F))
>>
>> I think this is the reason it uses #if CONFIG_VAL(SYS_MALLOC_F_LEN),
>> same for malloc().
>>
>> "spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN"
>>
>> http://git.denx.de/?p=u-boot.git;a=commit;h=f1896c45cb2f7d8dbed27e784a6459a129fc0762
>
> So how about
>
> if (CONFIG_IS_ENABLED(SYS_MALLOC_F_LEN)
>
> Or you could use #if if you need to

Tested both #if (CONFIG_IS_ENABLED(SYS_MALLOC_F_LEN)) and if
(CONFIG_IS_ENABLED(SYS_MALLOC_F_LEN)), both are not working.

It will not go into this code.


>
> To me it seems better to use the setting itself (i.e. whether the
> pre-reloc malloc() is enabled) rather than one of its parameters (the
> size of the region).
>
>>
>>
>>>
>>> ?
>>>
 +   if (!(gd->flags & GD_FLG_FULL_MALLOC_INIT)) {
 +   nb = roundup(bytes, alignment);
 +   return malloc_simple(nb);
 +   }
 +#endif
 +
/* If need less alignment than we give anyway, just relay to malloc */

if (alignment <= MALLOC_ALIGNMENT) return mALLOc(bytes);
 --
 1.7.1
> Regards,
> Simon

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


Re: [U-Boot] [U-Boot, v3, 1/3] mmc: dwmmc: socfpga: Add reset ctrl to driver

2018-05-24 Thread Ley Foon Tan
On Thu, May 24, 2018 at 8:39 PM, Tom Rini  wrote:
> On Tue, May 08, 2018 at 11:19:24AM +0800, Ley Foon Tan wrote:
>
>> Add code to reset all reset signals as in mmc DT node. A reset property is 
>> an optional feature,
>> so only print out a warning and do not fail if a reset property is not 
>> present.
>>
>> If a reset property is discovered, then use it to deassert, thus bringing the
>> IP out of reset.
>>
>> Signed-off-by: Ley Foon Tan 
>> Reviewed-by: Simon Glass 
>> ---
>>  drivers/mmc/socfpga_dw_mmc.c |   17 +
>>  1 files changed, 17 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/mmc/socfpga_dw_mmc.c b/drivers/mmc/socfpga_dw_mmc.c
>> index fa0e449..eb7e64e 100644
>> --- a/drivers/mmc/socfpga_dw_mmc.c
>> +++ b/drivers/mmc/socfpga_dw_mmc.c
>> @@ -13,6 +13,7 @@
>>  #include 
>>  #include 
>>  #include 
>> +#include 
>>
>>  DECLARE_GLOBAL_DATA_PTR;
>>
>> @@ -33,6 +34,20 @@ struct dwmci_socfpga_priv_data {
>>   unsigned intsmplsel;
>>  };
>>
>> +static void socfpga_dwmci_reset(struct udevice *dev)
>> +{
>> + struct reset_ctl_bulk reset_bulk;
>> + int ret;
>> +
>> + ret = reset_get_bulk(dev, _bulk);
>> + if (ret) {
>> + dev_warn(dev, "Can't get reset: %d\n", ret);
>> + return;
>> + }
>> +
>> + reset_deassert_bulk(_bulk);
>> +}
>
> The driver doesn't depend on DM_RESET and this code hunk doesn't either
> so it fails to build on a number of platforms.  This type of comment
> applies to the whole series, and may be fixed differently in different
> cases (it might be OK to enforce DM_RESET for this driver, but not for
> the ns16550 driver).
>
> --
> Tom
>
include/reset.h has the DM_RESET wrapper, so it will not cause the
compilation error if the CONFIG_DM_RESET is disabled.

I have tried compile the uboot with CONFIG_DM_RESET disabled,
compilation is fine.

Thanks.

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


Re: [U-Boot] [PATCH v3 09/11] board_f: Use static print_cpuinfo if CONFIG_CPU is active

2018-05-24 Thread Simon Glass
Hi Mario,

On 24 May 2018 at 02:42, Mario Six  wrote:
> When the DM CPU drivers are active, printing information about a CPU
> should be delegated to a matching driver.
>
> Hence, add a static print_cpuinfo that implements this delegation when
> DM CPU drivers are active.
>
> Signed-off-by: Mario Six 
>
> ---
>
> v2 -> v3:
> No changes
>
> v1 -> v2:
> New in v2
>
> ---
>  common/board_f.c | 16 
>  include/init.h   |  2 ++
>  2 files changed, 18 insertions(+)

Reviewed-by: Simon Glass 

See below

>
> diff --git a/common/board_f.c b/common/board_f.c
> index a716eeb8990..327c7d83e2c 100644
> --- a/common/board_f.c
> +++ b/common/board_f.c
> @@ -11,6 +11,7 @@
>
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -165,6 +166,21 @@ static int print_resetinfo(void)
>  }
>  #endif
>
> +#if defined(CONFIG_DISPLAY_CPUINFO) && defined(CONFIG_CPU)
> +static int print_cpuinfo(void)
> +{
> +   struct udevice *dev;
> +   char desc[512];
> +
> +   uclass_first_device_err(UCLASS_CPU, );
> +
> +   cpu_get_desc(dev, desc, sizeof(desc));

If this returns an error, I think you should print the error instead

> +   printf("%s", desc);
> +
> +   return 0;
> +}
> +#endif
> +
>  static int announce_dram_init(void)
>  {
> puts("DRAM:  ");
> diff --git a/include/init.h b/include/init.h
> index f114a889631..38c9680c7a7 100644
> --- a/include/init.h
> +++ b/include/init.h
> @@ -107,7 +107,9 @@ int arch_reserve_stacks(void);
>   */
>  int init_cache_f_r(void);
>
> +#ifndef CONFIG_CPU
>  int print_cpuinfo(void);
> +#endif
>  int timer_init(void);
>  int reserve_mmu(void);
>  int misc_init_f(void);
> --
> 2.11.0
>

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


Re: [U-Boot] [PATCH v3 11/11] misc: Add MPC83xx serdes driver

2018-05-24 Thread Simon Glass
On 24 May 2018 at 02:42, Mario Six  wrote:
> Add a driver to configure the SerDes (Serializer/Deserializer) lanes on
> the MPC83xx architecture.
>
> Signed-off-by: Mario Six 
>
> ---
>
> v2 -> v3:
> * Added driver file to MAINTAINERS
>
> v1 -> v2:
> No changes
>
> ---
>  MAINTAINERS   |   1 +
>  arch/powerpc/cpu/mpc83xx/serdes.c |   4 +
>  arch/powerpc/include/asm/fsl_mpc83xx_serdes.h |   4 +
>  drivers/misc/Kconfig  |   7 +
>  drivers/misc/Makefile |   1 +
>  drivers/misc/mpc83xx_serdes.c | 228 
> ++
>  6 files changed, 245 insertions(+)
>  create mode 100644 drivers/misc/mpc83xx_serdes.c

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


Re: [U-Boot] [PATCH v3 03/11] test: Add tests for sysreset_get_status

2018-05-24 Thread Simon Glass
On 24 May 2018 at 02:42, Mario Six  wrote:
> Add some tests for sysreset_get_status.
>
> Signed-off-by: Mario Six 
>
> ---
>
> v2 -> v3:
> New in v3.
>
> ---
>  drivers/sysreset/sysreset_sandbox.c | 16 
>  test/dm/sysreset.c  | 19 +++
>  2 files changed, 35 insertions(+)

Reviewed-by: Simon Glass 

>
> diff --git a/drivers/sysreset/sysreset_sandbox.c 
> b/drivers/sysreset/sysreset_sandbox.c
> index f12c4e84198..e03b5c122fe 100644
> --- a/drivers/sysreset/sysreset_sandbox.c
> +++ b/drivers/sysreset/sysreset_sandbox.c
> @@ -29,6 +29,13 @@ static int sandbox_warm_sysreset_request(struct udevice 
> *dev,
> return -EINPROGRESS;
>  }
>
> +int sandbox_warm_sysreset_get_status(struct udevice *dev, char *buf, int 
> size)
> +{
> +   strncpy(buf, "Reset Status: WARM", size);

strlcpy() might be better.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 10/11] cpu: Add MPC83xx CPU driver

2018-05-24 Thread Simon Glass
Hi Mario,

On 24 May 2018 at 02:42, Mario Six  wrote:
> Add a CPU driver for the MPC83xx architecture.
>
> Signed-off-by: Mario Six 
>
> ---
>
> v2 -> v3:
> * Added driver files to MAINTAINERS
>
> v1 -> v2:
> * Removed cpu_print_info
> * Fixed CPU info printing
> * Removed usage of uclass_{first,next}_device_compat
> * Removed printing of reset status
>
> ---
>  MAINTAINERS  |   2 +
>  arch/powerpc/cpu/mpc83xx/cpu.c   |   2 +
>  arch/powerpc/cpu/mpc83xx/cpu_init.c  |   2 +
>  arch/powerpc/include/asm/processor.h |   2 +
>  drivers/cpu/Kconfig  |   7 +
>  drivers/cpu/Makefile |   1 +
>  drivers/cpu/mpc83xx_cpu.c| 265 
> +++
>  drivers/cpu/mpc83xx_cpu.h| 172 +++
>  include/cpu.h|   1 +
>  9 files changed, 454 insertions(+)
>  create mode 100644 drivers/cpu/mpc83xx_cpu.c
>  create mode 100644 drivers/cpu/mpc83xx_cpu.h
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index f03cfcc73b0..11965be1402 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -475,6 +475,8 @@ F:  drivers/clk/mpc83xx_clk.c
>  F: drivers/clk/mpc83xx_clk.h
>  F: include/dt-bindings/clk/mpc83xx-clk.h
>  F: drivers/timer/mpc83xx_timer.c
> +F: drivers/cpu/mpc83xx_cpu.c
> +F: drivers/cpu/mpc83xx_cpu.h
>  F: arch/powerpc/cpu/mpc83xx/
>  F: arch/powerpc/include/asm/arch-mpc83xx/
>
> diff --git a/arch/powerpc/cpu/mpc83xx/cpu.c b/arch/powerpc/cpu/mpc83xx/cpu.c
> index ffb42415feb..b29f271e9bc 100644
> --- a/arch/powerpc/cpu/mpc83xx/cpu.c
> +++ b/arch/powerpc/cpu/mpc83xx/cpu.c
> @@ -25,6 +25,7 @@
>
>  DECLARE_GLOBAL_DATA_PTR;
>
> +#ifndef CONFIG_CPU_MPC83XX
>  int checkcpu(void)
>  {
> volatile immap_t *immr;
> @@ -114,6 +115,7 @@ int checkcpu(void)
>
> return 0;
>  }
> +#endif
>
>  #ifndef CONFIG_SYSRESET
>  int
> diff --git a/arch/powerpc/cpu/mpc83xx/cpu_init.c 
> b/arch/powerpc/cpu/mpc83xx/cpu_init.c
> index fcac9f63a81..1555205e069 100644
> --- a/arch/powerpc/cpu/mpc83xx/cpu_init.c
> +++ b/arch/powerpc/cpu/mpc83xx/cpu_init.c
> @@ -464,6 +464,7 @@ static int print_83xx_arb_event(int force)
>  }
>  #endif /* CONFIG_DISPLAY_AER_ */
>
> +#ifndef CONFIG_CPU_MPC83XX
>  /*
>   * Figure out the cause of the reset
>   */
> @@ -505,3 +506,4 @@ int prt_83xx_rsr(void)
>
> return 0;
>  }
> +#endif
> diff --git a/arch/powerpc/include/asm/processor.h 
> b/arch/powerpc/include/asm/processor.h
> index 6fbe8c46b31..f97ce48cc27 100644
> --- a/arch/powerpc/include/asm/processor.h
> +++ b/arch/powerpc/include/asm/processor.h
> @@ -1325,7 +1325,9 @@ void ll_puts(const char *);
>  /* In misc.c */
>  void _nmask_and_or_msr(unsigned long nmask, unsigned long or_val);
>
> +#ifndef CONFIG_CPU_MPC83XX
>  int prt_83xx_rsr(void);
> +#endif
>
>  #endif /* ndef ASSEMBLY*/
>
> diff --git a/drivers/cpu/Kconfig b/drivers/cpu/Kconfig
> index 0d1424d38e9..d4052005e24 100644
> --- a/drivers/cpu/Kconfig
> +++ b/drivers/cpu/Kconfig
> @@ -6,3 +6,10 @@ config CPU
>   multiple CPUs, then normally have to be set up in U-Boot so that
>   they can work correctly in the OS. This provides a framework for
>   finding out information about available CPUs and making changes.
> +
> +config CPU_MPC83XX
> +   bool "Enable MPC83xx CPU driver"
> +   depends on CPU
> +   select CLK_MPC83XX
> +   help
> + Support CPU cores for SoCs of the MPC83xx series.
> diff --git a/drivers/cpu/Makefile b/drivers/cpu/Makefile
> index db515f6f177..29d7da42fad 100644
> --- a/drivers/cpu/Makefile
> +++ b/drivers/cpu/Makefile
> @@ -7,3 +7,4 @@
>  obj-$(CONFIG_CPU) += cpu-uclass.o
>
>  obj-$(CONFIG_ARCH_BMIPS) += bmips_cpu.o
> +obj-$(CONFIG_CPU_MPC83XX) += mpc83xx_cpu.o
> diff --git a/drivers/cpu/mpc83xx_cpu.c b/drivers/cpu/mpc83xx_cpu.c
> new file mode 100644
> index 000..550a7ad89f1
> --- /dev/null
> +++ b/drivers/cpu/mpc83xx_cpu.c
> @@ -0,0 +1,265 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * (C) Copyright 2018
> + * Mario Six, Guntermann & Drunck GmbH, mario@gdsys.cc
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include "mpc83xx_cpu.h"
> +
> +struct mpc83xx_cpu_priv {
> +   struct mpc83xx_cpu_info info;
> +};
> +
> +int checkcpu(void)
> +{
> +   struct udevice *cpu;
> +
> +   for (uclass_first_device(UCLASS_CPU, );
> +cpu;
> +uclass_next_device()) {
> +   }

Can you please create a function in the CPU uclass to do this in a
separate patch? (probe all CPUs). It should return an error if
something goes wrong, but not print anything.

Then you can call it here.

[...]

> diff --git a/include/cpu.h b/include/cpu.h
> index 5cc7c5abd72..e1de356b543 100644
> --- a/include/cpu.h
> +++ b/include/cpu.h
> @@ -43,6 +43,7 @@ enum {
>  struct cpu_info {
> ulong cpu_freq;
> ulong features;
> +   void *specific_info;


Re: [U-Boot] [PATCH v4 03/16] efi: sandbox: Adjust memory usage for sandbox

2018-05-24 Thread Simon Glass
Hi Heinrick,

On 24 May 2018 at 13:16, Heinrich Schuchardt  wrote:
> On 05/16/2018 07:15 PM, Heinrich Schuchardt wrote:
>> On 05/16/2018 05:42 PM, Simon Glass wrote:
>>> With sandbox the U-Boot code is not mapped into the sandbox memory range
>>> so does not need to be excluded when allocating EFI memory. Update the EFI
>>> memory init code to take account of that.
>>>
>>> Also use mapmem instead of a cast to convert a memory address to a
>>> pointer.
>>>
>>> Signed-off-by: Simon Glass 
>>
>> running ./u-boot
>>
>> bootefi selftest
>> Found 0 disks
>> WARNING: booting without device tree
>>
>> Testing EFI API implementation
>>
>> Number of tests to execute: 17
>>
>> Setting up 'block device'
>> Setting up 'block device' succeeded
>>
>> Executing 'block device'
>> lib/efi_selftest/efi_selftest_block_device.c(378):
>> TODO: Wrong volume label 'xxa1', expected 'U-BOOT TEST'
>> FAT: Misaligned buffer address (7ff70aafe658)
>> Segmentation fault
>>
>> Please, fix the alignment fault. You have to ensure that the memory that
>> Sandbox has retrieved via malloc is reduced to 4k aligned pages before
>> being published to the EFI implementation in lib/efi_loader/efi_memory.c
>
> Hello Simon,
>
> couldn't we use mmap() instead of malloc() to allocate the memory used
> by the Sandbox? This would guarantee page aligned memory. mmap() with
> MAP_ANON is available both on POSIX and BSD systems.

We do use mmap() to allocate U-Boot's memory. I wonder why it is not
page-aligned?

See os_malloc() for the implementation. Perhaps it needs another arg added?

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


Re: [U-Boot] [PATCH] regmap: Separate memory-based operations

2018-05-24 Thread Simon Glass
Hi Alexey,

On 24 May 2018 at 06:36, Alexey Brodkin  wrote:
> One of important features of regmap [at least in Linux kernel]
> is an ability to seamlessly communicate to devices connected
> via different buses like: MMIO, SPI, I2C and many others.
>
> Current implementation in U-Boot only supports memory-mapped registers
> which is a vere valid case but we'll need more in the future.
>
> This change paves the way for support of other buses. Still all existing
> users of regmap in U-Boot shouldn't be affected because for now we don't
> change API which might be required once we start adding support of more
> complicated cases like 8/16/32/64-bit accessors, big- and little-endian
> flavours etc.
>
> It was inspired by discussion [1] of addition of even more accessors to
> a standard 16550 UART.
>
> [1] https://lists.denx.de/pipermail/u-boot/2018-March/322322.html
>
> Signed-off-by: Alexey Brodkin 
> Cc: Simon Glass 
> ---
>  drivers/core/Makefile   |  2 +-
>  drivers/core/{regmap.c => regmap-mem.c} | 79 ++-
>  drivers/core/regmap.c   | 85 +
>  include/regmap.h|  9 +++
>  4 files changed, 31 insertions(+), 144 deletions(-)
>  copy drivers/core/{regmap.c => regmap-mem.c} (60%)
>

Are there any changes needed to the regmap test with this?

[..]

> diff --git a/include/regmap.h b/include/regmap.h
> index 493a5d8eff84..f01c5733afac 100644
> --- a/include/regmap.h
> +++ b/include/regmap.h
> @@ -31,6 +31,8 @@ struct regmap {
> phys_addr_t base;
> int range_count;
> struct regmap_range *range, base_range;
> +   int (*reg_read)(struct regmap *map, uint reg, uint *val);
> +   int (*reg_write)(struct regmap *map, uint reg, uint val);

Can we use driver model for these somehow? E.g. we could create a
UCLASS_SIMPLE_REG driver for each of memory, i2c, SPI, etc.

When we want to use a particular I2C bus via regmap, we could bind the
I2C -> regmap driver as a child of the I2C bus driver.

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


Re: [U-Boot] [PATCH 1/1] Makefile: clean should delete *.so

2018-05-24 Thread Simon Glass
On 24 May 2018 at 11:34, Heinrich Schuchardt  wrote:
> Files *.so are generated files. So the clean target should delete them.
>
> Reported-by: Alexander Graf 
> Signed-off-by: Heinrich Schuchardt 
> ---
>  Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

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


Re: [U-Boot] [PATCH v3 07/11] timer: Add MPC83xx timer driver

2018-05-24 Thread Simon Glass
Hi Mario,

On 24 May 2018 at 02:42, Mario Six  wrote:
> Add a timer driver for the MPC83xx architecture.
>
> Signed-off-by: Mario Six 
>
> ---
>
> v2 -> v3:
> * Got rid of the static variables
> * Added driver files to MAINTAINERS
>
> v1 -> v2:
> * Removed now-superfluous comments
> * Removed usage of uclass_{first,next}_device_compat
> * Switched to usage of new board uclass (instead of devinfo)
>
> ---
>  MAINTAINERS|   1 +
>  arch/powerpc/cpu/mpc83xx/cpu.c |   4 +-
>  arch/powerpc/lib/Makefile  |   4 +
>  arch/powerpc/lib/interrupts.c  |   5 +-
>  drivers/timer/Kconfig  |   7 ++
>  drivers/timer/Makefile |   1 +
>  drivers/timer/mpc83xx_timer.c  | 182 
> +
>  7 files changed, 201 insertions(+), 3 deletions(-)
>  create mode 100644 drivers/timer/mpc83xx_timer.c
>
[..]

> diff --git a/drivers/timer/Makefile b/drivers/timer/Makefile
> index ee2fcb1fa71..75360d81de3 100644
> --- a/drivers/timer/Makefile
> +++ b/drivers/timer/Makefile
> @@ -16,3 +16,4 @@ obj-$(CONFIG_ATCPIT100_TIMER) += atcpit100_timer.o
>  obj-$(CONFIG_ROCKCHIP_TIMER) += rockchip_timer.o
>  obj-$(CONFIG_ATMEL_PIT_TIMER) += atmel_pit_timer.o
>  obj-$(CONFIG_STM32_TIMER)  += stm32_timer.o
> +obj-$(CONFIG_MPC83XX_TIMER) += mpc83xx_timer.o
> diff --git a/drivers/timer/mpc83xx_timer.c b/drivers/timer/mpc83xx_timer.c
> new file mode 100644
> index 000..148fb2550ca
> --- /dev/null
> +++ b/drivers/timer/mpc83xx_timer.c
> @@ -0,0 +1,182 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * (C) Copyright 2018
> + * Mario Six, Guntermann & Drunck GmbH, mario@gdsys.cc
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +struct mpc83xx_timer_priv {
> +   uint decrementer_count; /* count value for 1e6/HZ microseconds */
> +   ulong timestamp;
> +};
> +
> +static inline unsigned long get_dec(void)
> +{
> +   unsigned long val;
> +
> +   asm volatile ("mfdec %0" : "=r" (val) : );
> +
> +   return val;
> +}
> +
> +static inline void set_dec(unsigned long val)
> +{
> +   if (val)
> +   asm volatile ("mtdec %0"::"r" (val));
> +}
> +
> +/* TODO(mario@gdsys.cc): This should really be done by timer_init, and 
> the
> + * interrupt init should go into a interrupt driver.
> + */
> +int interrupt_init(void)
> +{
> +   immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
> +   struct udevice *csb;
> +   struct udevice *board;
> +   struct udevice *timer = gd->timer;
> +   struct mpc83xx_timer_priv *timer_priv = dev_get_priv(timer);
> +   struct clk clock;
> +   int ret;
> +
> +   if (get_board()) {
> +   debug("%s: board device could not be fetched.\n", __func__);
> +   return -ENOENT;
> +   }
> +
> +   ret = uclass_get_device_by_phandle(UCLASS_SIMPLE_BUS, board,
> +  "csb", );
> +   if (ret) {
> +   debug("%s: Could not retrieve CSB device (error: %d)",
> + __func__, ret);
> +   return ret;
> +   }
> +
> +   ret = clk_get_by_index(csb, 0, );
> +   if (ret) {
> +   debug("%s: Could not retrieve clock (error: %d)",
> + __func__, ret);
> +   return ret;
> +   }
> +
> +   timer_priv->decrementer_count = (clk_get_rate() / 4)
> +   / CONFIG_SYS_HZ;
> +   /* Enable e300 time base */
> +   setbits_be32(>sysconf.spcr, 0x0040);
> +
> +   set_dec(timer_priv->decrementer_count);
> +
> +   set_msr(get_msr() | MSR_EE);
> +
> +   return 0;
> +}
> +
> +void timer_interrupt(struct pt_regs *regs)
> +{
> +   struct udevice *timer = gd->timer;
> +   struct mpc83xx_timer_priv *priv = dev_get_priv(timer);
> +
> +   /* Restore Decrementer Count */
> +   set_dec(priv->decrementer_count);
> +
> +   priv->timestamp++;
> +
> +#if defined(CONFIG_WATCHDOG) || defined(CONFIG_HW_WATCHDOG)
> +   if ((timestamp % (CONFIG_SYS_WATCHDOG_FREQ)) == 0)
> +   WATCHDOG_RESET();
> +#endif/* CONFIG_WATCHDOG || CONFIG_HW_WATCHDOG */
> +
> +#ifdef CONFIG_LED_STATUS
> +   status_led_tick(priv->timestamp);
> +#endif /* CONFIG_LED_STATUS */
> +
> +#ifdef CONFIG_SHOW_ACTIVITY
> +   board_show_activity(priv->timestamp);
> +#endif /* CONFIG_SHOW_ACTIVITY */
> +}
> +
> +ulong get_timer(ulong base)

How come you are defining that? The standard one should work, and it
calls get_ticks() which should call your driver.

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


Re: [U-Boot] [PATCH v3 3/3] misc: Add gdsys_ioep driver

2018-05-24 Thread Simon Glass
On 23 May 2018 at 08:07, Mario Six  wrote:
> Add driver for the IHS IO endpoint on IHS FPGAs.
>
> Signed-off-by: Mario Six 
>
> ---
>
> v2 -> v3:
> No changes
>
> v1 -> v2:
> * Switched to regmap usage (instead of fpgamap)
>
> ---
>  drivers/misc/Kconfig  |   6 ++
>  drivers/misc/Makefile |   1 +
>  drivers/misc/gdsys_ioep.c | 155 
> ++
>  drivers/misc/gdsys_ioep.h |  73 ++
>  4 files changed, 235 insertions(+)
>  create mode 100644 drivers/misc/gdsys_ioep.c
>  create mode 100644 drivers/misc/gdsys_ioep.h
>

Reviewed-by: Simon Glass 

But you should check the error return value from regmap_init_mem()
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 1/3] misc: docs: Fix comments in misc.h

2018-05-24 Thread Simon Glass
+Marex

Hi Mario,

On 23 May 2018 at 08:07, Mario Six  wrote:
> The comments in misc.h are not in kernel-doc format. Correct the format.
>
> Signed-off-by: Mario Six 
>
> ---
>
> v2 -> v3:
> New in v3
>
> ---
>  include/misc.h | 66 
> +++---
>  1 file changed, 35 insertions(+), 31 deletions(-)
>

Not another format?! I have been following what I thought was docbook
format as proposed by Marek a few years ago.

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


Re: [U-Boot] [PATCH v3 06/11] clk: Add MPC83xx clock driver

2018-05-24 Thread Simon Glass
Hi Mario,

On 24 May 2018 at 02:42, Mario Six  wrote:
> Add a clock driver for the MPC83xx architecture.
>
> Signed-off-by: Mario Six 
>
> ---
>
> v2 -> v3:
> * Added driver files to MAINTAINERS
>
> v1 -> v2:
> * Added binding of sysreset driver
>
> ---
>  MAINTAINERS   |   3 +
>  arch/powerpc/cpu/mpc83xx/speed.c  |   4 +
>  arch/powerpc/include/asm/config.h |   2 +-
>  drivers/clk/Kconfig   |   6 +
>  drivers/clk/Makefile  |   1 +
>  drivers/clk/mpc83xx_clk.c | 426 
> ++
>  drivers/clk/mpc83xx_clk.h | 121 ++
>  include/dt-bindings/clk/mpc83xx-clk.h |  33 +++
>  8 files changed, 595 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/clk/mpc83xx_clk.c
>  create mode 100644 drivers/clk/mpc83xx_clk.h
>  create mode 100644 include/dt-bindings/clk/mpc83xx-clk.h
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index b43e4bc179d..ab0f6a0a5d0 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -471,6 +471,9 @@ T:  git git://git.denx.de/u-boot-mpc83xx.git
>  F: drivers/ram/mpc83xx_sdram.c
>  F: include/dt-bindings/memory/mpc83xx-sdram.h
>  F: drivers/sysreset/sysreset_mpc83xx.c
> +F: drivers/clk/mpc83xx_clk.c
> +F: drivers/clk/mpc83xx_clk.h
> +F: include/dt-bindings/clk/mpc83xx-clk.h
>  F: arch/powerpc/cpu/mpc83xx/
>  F: arch/powerpc/include/asm/arch-mpc83xx/
>
> diff --git a/arch/powerpc/cpu/mpc83xx/speed.c 
> b/arch/powerpc/cpu/mpc83xx/speed.c
> index f0945281cd2..39bc1c53406 100644
> --- a/arch/powerpc/cpu/mpc83xx/speed.c
> +++ b/arch/powerpc/cpu/mpc83xx/speed.c
> @@ -6,6 +6,8 @@
>   * Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
>   */
>
> +#ifndef CONFIG_CLK_MPC83XX
> +
>  #include 
>  #include 
>  #include 
> @@ -590,3 +592,5 @@ U_BOOT_CMD(clocks, 1, 0, do_clocks,
> "print clock configuration",
> "clocks"
>  );
> +
> +#endif
> diff --git a/arch/powerpc/include/asm/config.h 
> b/arch/powerpc/include/asm/config.h
> index 284cfe21ab0..7bc8f5006ec 100644
> --- a/arch/powerpc/include/asm/config.h
> +++ b/arch/powerpc/include/asm/config.h
> @@ -78,7 +78,7 @@
>  /* All PPC boards must swap IDE bytes */
>  #define CONFIG_IDE_SWAP_IO
>
> -#if defined(CONFIG_DM_SERIAL)
> +#if defined(CONFIG_DM_SERIAL) && !defined(CONFIG_CLK_MPC83XX)
>  /*
>   * TODO: Convert this to a clock driver exists that can give us the UART
>   * clock here.
> diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
> index edb4ca58ea5..e6ebff0a9d4 100644
> --- a/drivers/clk/Kconfig
> +++ b/drivers/clk/Kconfig
> @@ -98,4 +98,10 @@ config ICS8N3QV01
>   Crystal Oscillator). The output frequency can be programmed via an
>   I2C interface.
>
> +config CLK_MPC83XX
> +   bool "Enable MPC83xx clock driver"
> +   depends on CLK
> +   help
> + Support for the clock driver of the MPC83xx series of SoCs.
> +
>  endmenu
> diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
> index 58139b13a89..58f497d3a15 100644
> --- a/drivers/clk/Makefile
> +++ b/drivers/clk/Makefile
> @@ -16,6 +16,7 @@ obj-$(CONFIG_CLK_BCM6345) += clk_bcm6345.o
>  obj-$(CONFIG_CLK_BOSTON) += clk_boston.o
>  obj-$(CONFIG_CLK_EXYNOS) += exynos/
>  obj-$(CONFIG_CLK_HSDK) += clk-hsdk-cgu.o
> +obj-$(CONFIG_CLK_MPC83XX) += mpc83xx_clk.o
>  obj-$(CONFIG_CLK_RENESAS) += renesas/
>  obj-$(CONFIG_CLK_STM32F) += clk_stm32f.o
>  obj-$(CONFIG_CLK_STM32MP1) += clk_stm32mp1.o
> diff --git a/drivers/clk/mpc83xx_clk.c b/drivers/clk/mpc83xx_clk.c
> new file mode 100644
> index 000..80be597332d
> --- /dev/null
> +++ b/drivers/clk/mpc83xx_clk.c
> @@ -0,0 +1,426 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * (C) Copyright 2017
> + * Mario Six, Guntermann & Drunck GmbH, mario@gdsys.cc
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include "mpc83xx_clk.h"
> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +static u32 *speed;
> +
> +struct mpc83xx_clk_priv {
> +   u32 *speed;
> +};
> +
> +static const char * const names[] = {
> +   [MPC83XX_CLK_CORE] = "Core",
> +   [MPC83XX_CLK_CSB] = "Coherent System Bus",
> +   [MPC83XX_CLK_QE] = "QE",
> +   [MPC83XX_CLK_BRG] = "BRG",
> +   [MPC83XX_CLK_LBIU] = "Local Bus Controller",
> +   [MPC83XX_CLK_LCLK] = "Local Bus",
> +   [MPC83XX_CLK_MEM] = "DDR",
> +   [MPC83XX_CLK_MEM_SEC] = "DDR Secondary",
> +   [MPC83XX_CLK_ENC] = "SEC",
> +   [MPC83XX_CLK_I2C1] = "I2C1",
> +   [MPC83XX_CLK_I2C2] = "I2C2",
> +   [MPC83XX_CLK_TDM] = "TDM",
> +   [MPC83XX_CLK_SDHC] = "SDHC",
> +   [MPC83XX_CLK_TSEC1] = "TSEC1",
> +   [MPC83XX_CLK_TSEC2] = "TSEC2",
> +   [MPC83XX_CLK_USBDR] = "USB DR",
> +   [MPC83XX_CLK_USBMPH] = "USB MPH",
> +   [MPC83XX_CLK_PCIEXP1] = "PCIEXP1",
> +   [MPC83XX_CLK_PCIEXP2] = "PCIEXP2",
> +   [MPC83XX_CLK_SATA] = "SATA",
> +   [MPC83XX_CLK_DMAC] = "DMAC",
> +   

Re: [U-Boot] [PATCH v7 18/18] fastboot: Update fastboot documentation

2018-05-24 Thread Simon Glass
On 24 May 2018 at 07:29, Alex Kiernan  wrote:
> Update fastboot documentation to reflect merged USB/UDP implementation.
>
> Signed-off-by: Alex Kiernan 
> ---
>
> Changes in v7: None
> Changes in v6:
> - new
>
> Changes in v5: None
> Changes in v4: None
> Changes in v3: None
> Changes in v2: None
>
>  doc/README.android-fastboot | 240 +++-
>  1 file changed, 156 insertions(+), 84 deletions(-)
>

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


Re: [U-Boot] [EXT] Re: [PATCH 1/4] ata: mvebu: move mvebu sata driver to drivers/ata directory

2018-05-24 Thread Simon Glass
Hi Ken,

On 23 May 2018 at 20:24, Ken Ma  wrote:
> Hi Simon
>
> Patman is very helpful and useful!
> I have sent my patches v2 with patman.
>
> Thanks a lot for your kind help!

OK good! I find patman particularly helpful for collecting changing
logs once you get to v2, v3, etc.

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


Re: [U-Boot] [PATCH v2 2/7] axi: Add ihs_axi driver

2018-05-24 Thread Simon Glass
On 23 May 2018 at 06:10, Mario Six  wrote:
> Add a driver for the gdsys IHS AXI bus used on IHS FPGAs.
>
> Signed-off-by: Mario Six 
>
> ---
>
> v1 -> v2:
> New in v2
>
> ---
>  drivers/axi/Kconfig   |  12 
>  drivers/axi/Makefile  |   1 +
>  drivers/axi/ihs_axi.c | 179 
> ++
>  3 files changed, 192 insertions(+)
>  create mode 100644 drivers/axi/ihs_axi.c

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


Re: [U-Boot] [PATCH v4 04/16] sandbox: smbios: Update to support sandbox

2018-05-24 Thread Simon Glass
Hi Alex,

On 24 May 2018 at 06:24, Alexander Graf  wrote:
>
>
> On 16.05.18 17:42, Simon Glass wrote:
>> At present this code casts addresses to pointers so cannot be used with
>> sandbox. Update it to use mapmem instead.
>>
>> Signed-off-by: Simon Glass 
>
> I really dislike the whole fact that you have to call map_sysmem() at
> all. I don't quite understand the whole point of it either - it just
> seems to clutter the code and make it harder to follow.

The purpose is to map U-Boot addresses (e.g. 0x1234) to actual
user-space addresses in sandbox (gd->arch.ram_buf + 0x1234).

Otherwise we cannot write tests which use particular addresses, and
people have to worry about the host memory layout when using sandbox.

>
> Can't we just simply make sandbox behave like any other target instead?

Actually that's the goal of the sandbox support. Memory is modelled as
a contiguous chunk starting at 0x0, regardless of what the OS actually
gives U-Boot in terms of addresses.

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


Re: [U-Boot] [PATCH v2 5/7] test: Add AXI test

2018-05-24 Thread Simon Glass
On 23 May 2018 at 06:10, Mario Six  wrote:
> Add tests for the AXI uclass.
>
> Signed-off-by: Mario Six 
>
> ---
>
> v1 -> v2:
> * Fixed asserts (moved expected values first)
>
> ---
>  test/dm/Makefile |  1 +
>  test/dm/axi.c| 74 
> 
>  2 files changed, 75 insertions(+)
>  create mode 100644 test/dm/axi.c

Reviewed-by: Simon Glass 

Can you please use lower-case hex?
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 6/7] cmd: Add axi command

2018-05-24 Thread Simon Glass
Hi Mario,

On 23 May 2018 at 06:10, Mario Six  wrote:
> Add a command to debug the AXI bus.
>
> Signed-off-by: Mario Six 
>
> ---
>
> v1 -> v2:
> No changes
>
> ---
>  cmd/Kconfig  |   8 ++
>  cmd/Makefile |   1 +
>  cmd/axi.c| 310 
> +++
>  3 files changed, 319 insertions(+)
>  create mode 100644 cmd/axi.c

Reviewed-by: Simon Glass 

Comments below.

>
> diff --git a/cmd/Kconfig b/cmd/Kconfig
> index 38406fcfdac..0f730f7a397 100644
> --- a/cmd/Kconfig
> +++ b/cmd/Kconfig
> @@ -995,6 +995,14 @@ config CMD_USB_MASS_STORAGE
> help
>   USB mass storage support
>
> +config CMD_AXI
> +   bool "axi"
> +   depends on AXI
> +   help
> + Enable the command "axi" for accessing AXI (Advanced eXtensible
> + Interface) busses, a on-chip interconnect specification for managing
> + functional blocks in SoC designs, which is also often used in 
> designs
> + involving FPGAs (e.g.  communication with IP cores in Xilinx FPGAs).
>  endmenu
>
>
> diff --git a/cmd/Makefile b/cmd/Makefile
> index 0d7322ee0a4..cfca11499ec 100644
> --- a/cmd/Makefile
> +++ b/cmd/Makefile
> @@ -145,6 +145,7 @@ obj-$(CONFIG_CMD_ZFS) += zfs.o
>  obj-$(CONFIG_CMD_DFU) += dfu.o
>  obj-$(CONFIG_CMD_GPT) += gpt.o
>  obj-$(CONFIG_CMD_ETHSW) += ethsw.o
> +obj-$(CONFIG_CMD_AXI) += axi.o
>
>  # Power
>  obj-$(CONFIG_CMD_PMIC) += pmic.o
> diff --git a/cmd/axi.c b/cmd/axi.c
> new file mode 100644
> index 000..d8001875e2c
> --- /dev/null
> +++ b/cmd/axi.c
> @@ -0,0 +1,310 @@
> +/*
> + * (C) Copyright 2016
> + * Dirk Eibach,  Guntermann & Drunck GmbH, dirk.eib...@gdsys.cc
> + *
> + * (C) Copyright 2017
> + * Mario Six,  Guntermann & Drunck GmbH, mario@gdsys.cc
> + *
> + * SPDX-License-Identifier:GPL-2.0+
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +static struct udevice *axi_cur_bus;
> +static uint dp_last_size;
> +static uint dp_last_addr;
> +static uint dp_last_length = 0x40;
> +
> +static void show_bus(struct udevice *bus)
> +{
> +   struct udevice *dev;
> +
> +   printf("Bus %d:\t%s", bus->req_seq, bus->name);
> +   if (device_active(bus))
> +   printf("  (active %d)", bus->seq);
> +   printf("\n");
> +   for (device_find_first_child(bus, );
> +dev;
> +device_find_next_child())
> +   printf("  %s\n", dev->name);
> +}
> +
> +static int do_axi_show_bus(cmd_tbl_t *cmdtp, int flag, int argc,
> +  char * const argv[])
> +{
> +   if (argc == 1) {
> +   /* show all busses */
> +   struct udevice *bus;
> +
> +   for (uclass_first_device(UCLASS_AXI, );
> +bus;
> +uclass_next_device())
> +   show_bus(bus);
> +   } else {
> +   int i;
> +
> +   /* show specific bus */
> +   i = simple_strtoul(argv[1], NULL, 10);
> +
> +   struct udevice *bus;
> +   int ret;
> +
> +   ret = uclass_get_device_by_seq(UCLASS_AXI, i, );

Here you probe the bus, whereas above you don't. Is that intended?

> +   if (ret) {
> +   printf("Invalid bus %d: err=%d\n", i, ret);
> +   return CMD_RET_FAILURE;
> +   }
> +   show_bus(bus);
> +   }
> +
> +   return 0;
> +}
> +
> +static int cmd_axi_set_bus_num(unsigned int busnum)
> +{
> +   struct udevice *bus;
> +   struct udevice *dummy;
> +   int ret;
> +
> +   /* Make sure that all sequence numbers are initialized */
> +   for (uclass_first_device(UCLASS_AXI, );
> +dummy;
> +uclass_next_device())
> +   ;
> +
> +   ret = uclass_get_device_by_seq(UCLASS_AXI, busnum, );

Here you probe the bus which seems right to me.

> +   if (ret) {
> +   debug("%s: No bus %d\n", __func__, busnum);
> +   return ret;
> +   }
> +   axi_cur_bus = bus;
> +
> +   return 0;
> +}
> +
[..]

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


Re: [U-Boot] [PATCH v3 2/3] misc: uclass: Add enable/disable function

2018-05-24 Thread Simon Glass
Hi Mario,

On 23 May 2018 at 08:07, Mario Six  wrote:
> Add generic enable/disable function to the misc uclass.
>
> Signed-off-by: Mario Six 
>
> ---
>
> v2 -> v3:
> * Now return old state from misc_set_enabled
>
> v1 -> v2:
> * Merged the two functions into one function
> * Explained the semantics of enabling/disabling more throughly
>
> ---
>  drivers/misc/misc-uclass.c | 10 ++
>  include/misc.h | 27 +++
>  2 files changed, 37 insertions(+)
>

Reviewed-by: Simon Glass 

Can you please add a simple dm test for the misc device? Or if
drivers/mailbox/sandbox-mbox-test.c is sufficient, update it?

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


Re: [U-Boot] [PATCH v2 3/7] axi: Add AXI sandbox driver and simple emulator

2018-05-24 Thread Simon Glass
Hi Mario,

On 23 May 2018 at 06:10, Mario Six  wrote:
> Add test infrastructure and tests for the AXI uclass.
>
> Signed-off-by: Mario Six 
>
> ---
>
> v1 -> v2:
> * Spelled out abbreviations in Kconfig help
> * Expanded emulation documentation
> * Renamed storage pointer to storep
> * Expanded AXI emulator usage documentation
> * Switched AXI emulator to aligned access
>
> ---
>  drivers/axi/Kconfig   |   7 +++
>  drivers/axi/Makefile  |   3 ++
>  drivers/axi/axi-emul-uclass.c |  68 ++
>  drivers/axi/axi_sandbox.c |  77 +
>  drivers/axi/sandbox_store.c   | 110 
> ++
>  include/axi.h |  84 
>  include/dm/uclass-id.h|   1 +
>  7 files changed, 350 insertions(+)
>  create mode 100644 drivers/axi/axi-emul-uclass.c
>  create mode 100644 drivers/axi/axi_sandbox.c
>  create mode 100644 drivers/axi/sandbox_store.c
>

Reviewed-by: Simon Glass 

Some nits below.

> diff --git a/drivers/axi/axi_sandbox.c b/drivers/axi/axi_sandbox.c
> new file mode 100644
> index 000..7a485b114bf
> --- /dev/null
> +++ b/drivers/axi/axi_sandbox.c
> @@ -0,0 +1,77 @@
> +/*
> + * (C) Copyright 2018
> + * Mario Six, Guntermann & Drunck GmbH, mario@gdsys.cc
> + *
> + * SPDX-License-Identifier:GPL-2.0+
> + */
> +
> +#include 
> +#include 
> +#include 
> +
> +/*
> + * This driver implements a AXI bus for the sandbox architecture for testing
> + * purposes.
> + *
> + * The bus forwards every access to it to a special AXI emulation device 
> (which
> + * it gets via the axi_emul_get_ops function) that implements a simple
> + * read/write storage.
> + *
> + * The emulator device must still be contained in the device tree in the 
> usual
> + * way, since configuration data for the storage is read from the DT.
> + */
> +
> +int axi_sandbox_read(struct udevice *bus, ulong address, void *data,
> +enum axi_size_t size)

Can this and the write() function below be static?

> +{
> +   struct axi_emul_ops *ops;
> +   struct udevice *emul;
> +   int ret;
> +
> +   /* Get emulator device */
> +   ret = axi_sandbox_get_emul(bus, address, size, );
> +   if (ret)
> +   return ret == -ENODEV ? 0 : ret;
> +   /* Forward all reads to the AXI emulator */
> +   ops = axi_emul_get_ops(emul);
> +   if (!ops || !ops->read)
> +   return -ENOSYS;
> +
> +   return ops->read(emul, address, data, size);
> +}
> +
> +int axi_sandbox_write(struct udevice *bus, ulong address, void *data,
> + enum axi_size_t size)
> +{
> +   struct axi_emul_ops *ops;
> +   struct udevice *emul;
> +   int ret;
> +
> +   /* Get emulator device */
> +   ret = axi_sandbox_get_emul(bus, address, size, );
> +   if (ret)
> +   return ret == -ENODEV ? 0 : ret;
> +   /* Forward all writes to the AXI emulator */
> +   ops = axi_emul_get_ops(emul);
> +   if (!ops || !ops->write)
> +   return -ENOSYS;
> +
> +   return ops->write(emul, address, data, size);
> +}
> +
> +static const struct udevice_id axi_sandbox_ids[] = {
> +   { .compatible = "sandbox,axi" },
> +   { /* sentinel */ }
> +};
> +
> +static const struct axi_ops axi_sandbox_ops = {
> +   .read = axi_sandbox_read,
> +   .write = axi_sandbox_write,
> +};
> +
> +U_BOOT_DRIVER(axi_sandbox_bus) = {
> +   .name   = "axi_sandbox_bus",
> +   .id = UCLASS_AXI,
> +   .of_match   = axi_sandbox_ids,
> +   .ops= _sandbox_ops,
> +};
> diff --git a/drivers/axi/sandbox_store.c b/drivers/axi/sandbox_store.c
> new file mode 100644
> index 000..61c7aea22c8
> --- /dev/null
> +++ b/drivers/axi/sandbox_store.c
> @@ -0,0 +1,110 @@
> +/*
> + * (C) Copyright 2018
> + * Mario Six, Guntermann & Drunck GmbH, mario@gdsys.cc
> + *
> + * SPDX-License-Identifier:GPL-2.0+
> + */
> +
> +#include 
> +#include 
> +#include 
> +
> +struct sandbox_store_priv {
> +   u8 *store;
> +};
> +
> +void copy_axi_data(void *src, void *dst, enum axi_size_t size)
> +{
> +   u8 *dst8 = dst;
> +   u16 *dst16 = dst;
> +   u32 *dst32 = dst;

Can you put these declarations in the case statements instead? I'm not
sure what coverity with think of this aliasing.

> +
> +   switch (size) {
> +   case AXI_SIZE_8:
> +   *dst8 = *((u8 *)src);
> +   break;
> +   case AXI_SIZE_16:
> +   *dst16 = be16_to_cpu(*((u16 *)src));
> +   break;
> +   case AXI_SIZE_32:
> +   *dst32 = be32_to_cpu(*((u32 *)src));
> +   break;
> +   }
> +}
> +
> +int sandbox_store_read(struct udevice *dev, ulong address, void *data,
> +  enum axi_size_t size)
> +{
> +   struct sandbox_store_priv *priv = 

Re: [U-Boot] [PATCH v2 1/7] drivers: Add AXI uclass

2018-05-24 Thread Simon Glass
On 23 May 2018 at 06:10, Mario Six  wrote:
> Add a uclass for AXI (Advanced eXtensible Interface) busses, and a
> driver for the gdsys IHS AXI bus on IHS FPGAs.
>
> Signed-off-by: Mario Six 
>
> ---
>
> v1 -> v2:
> * Spelled out all abbreviations in the Kconfig help
> * Split commit into uclass addition and driver addition
>
> ---
>  drivers/Kconfig  |  2 ++
>  drivers/Makefile |  1 +
>  drivers/axi/Kconfig  | 13 +
>  drivers/axi/Makefile |  8 ++
>  drivers/axi/axi-uclass.c | 40 ++
>  include/axi.h| 75 
> 
>  include/dm/uclass-id.h   |  1 +
>  7 files changed, 140 insertions(+)
>  create mode 100644 drivers/axi/Kconfig
>  create mode 100644 drivers/axi/Makefile
>  create mode 100644 drivers/axi/axi-uclass.c
>  create mode 100644 include/axi.h

Reviewed-by: Simon Glass 

One little nit:

> diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h
> index d7f9df3583a..0aad4bc14d7 100644
> --- a/include/dm/uclass-id.h
> +++ b/include/dm/uclass-id.h
> @@ -43,6 +43,7 @@ enum uclass_id {
> UCLASS_I2C_GENERIC, /* Generic I2C device */
> UCLASS_I2C_MUX, /* I2C multiplexer */
> UCLASS_IDE, /* IDE device */
> +   UCLASS_AXI, /* AXI busses */

AXI bus

> UCLASS_IRQ, /* Interrupt controller */
> UCLASS_KEYBOARD,/* Keyboard input device */
> UCLASS_LED, /* Light-emitting diode (LED) */
> --
> 2.11.0
>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] x86: baytrail: Correct the comment of IACORE_VIDS bit ranges

2018-05-24 Thread Simon Glass
On 24 May 2018 at 04:05, Bin Meng  wrote:
>
> The guaranteed vid bit ranges in IACORE_VIDS MSR is actually
> [22:16]. This corrects the comment for it.
>
> Signed-off-by: Bin Meng 
> ---
>
>  arch/x86/cpu/baytrail/cpu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

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


Re: [U-Boot] [PATCH v2 1/4] ata: mvebu: move mvebu sata driver to drivers/ata directory

2018-05-24 Thread Ken Ma
Hi Stefan

I have done as your advice.
Thanks a lot for your kind help and guide on License and commit message.

Yours,
Ken

-Original Message-
From: Stefan Roese [mailto:s...@denx.de] 
Sent: 2018年5月24日 23:17
To: Ken Ma; U-Boot Mailing List
Cc: Luka Perkov; Heinrich Schuchardt; Alexander Graf; Andy Shevchenko; Prafulla 
Wadaskar; Eugeniy Paltsev
Subject: Re: [U-Boot] [PATCH v2 1/4] ata: mvebu: move mvebu sata driver to 
drivers/ata directory

On 24.05.2018 04:13, m...@marvell.com wrote:
> From: Ken Ma 
> 
> Currently mvebu sata driver is in arch/arm/mach_mvebu directory, this
> patch moves it to drivers/ata directory with renaming "sata.c" to
> "ahci_mvebu.c" which is aligned to Linux.
> New ahci driver's kconfig option is added as AHCI_MVEBU which selects
> DM_SCSI.
> 
> Signed-off-by: Ken Ma 
> ---
> 
> Changes in v2:
> - Add MAINTAINERS updating
> 
>   MAINTAINERS| 1 +
>   arch/arm/mach-mvebu/Makefile   | 1 -
>   drivers/ata/Kconfig| 9 +
>   drivers/ata/Makefile   | 1 +
>   arch/arm/mach-mvebu/sata.c => drivers/ata/ahci_mvebu.c | 6 +++---
>   5 files changed, 14 insertions(+), 4 deletions(-)
>   rename arch/arm/mach-mvebu/sata.c => drivers/ata/ahci_mvebu.c (89%)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 077828c..97c0752 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -134,6 +134,7 @@ S:Maintained
>   T:  git git://git.denx.de/u-boot-marvell.git
>   F:  arch/arm/mach-kirkwood/
>   F:  arch/arm/mach-mvebu/
> +F:   drivers/ata/ahci_mvebu.c
>   
>   ARM MARVELL PXA
>   M:  Marek Vasut 
> diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile
> index d4210af..7f0d692 100644
> --- a/arch/arm/mach-mvebu/Makefile
> +++ b/arch/arm/mach-mvebu/Makefile
> @@ -9,7 +9,6 @@ ifdef CONFIG_ARM64
>   obj-$(CONFIG_ARMADA_3700) += armada3700/
>   obj-$(CONFIG_ARMADA_8K) += armada8k/
>   obj-y += arm64-common.o
> -obj-y += sata.o
>   
>   else # CONFIG_ARM64
>   
> diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
> index 86ec628..9ef4589 100644
> --- a/drivers/ata/Kconfig
> +++ b/drivers/ata/Kconfig
> @@ -99,4 +99,13 @@ config SATA_SIL3114
>   help
> Enable this driver to support the SIL3114 SATA controllers.
>   
> +config AHCI_MVEBU
> + bool "Marvell EBU AHCI SATA support"
> + depends on ARCH_MVEBU
> + select DM_SCSI
> + help
> +   This option enables support for the Marvell EBU SoC's
> +   onboard AHCI SATA.
> +
> +   If unsure, say N.
>   endmenu
> diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile
> index a94c804..0254640 100644
> --- a/drivers/ata/Makefile
> +++ b/drivers/ata/Makefile
> @@ -19,3 +19,4 @@ obj-$(CONFIG_SATA_MV) += sata_mv.o
>   obj-$(CONFIG_SATA_SIL3114) += sata_sil3114.o
>   obj-$(CONFIG_SATA_SIL) += sata_sil.o
>   obj-$(CONFIG_SANDBOX) += sata_sandbox.o
> +obj-$(CONFIG_AHCI_MVEBU) += ahci_mvebu.o
> diff --git a/arch/arm/mach-mvebu/sata.c b/drivers/ata/ahci_mvebu.c
> similarity index 89%
> rename from arch/arm/mach-mvebu/sata.c
> rename to drivers/ata/ahci_mvebu.c
> index 5d8032b..5c1b293 100644
> --- a/arch/arm/mach-mvebu/sata.c
> +++ b/drivers/ata/ahci_mvebu.c
> @@ -1,15 +1,15 @@
>   /*
> + * Copyright (C) 2018 Marvell International Ltd.

Hmmm, are you doing some substantial changes to this file
that entitles you to add your Copyright here? Its mostly
a move of an existing file, right?

>* Copyright (C) 2016 Stefan Roese 
>*
> - * SPDX-License-Identifier:  GPL-2.0+
> + * SPDX-License-Identifier:   GPL-2.0+
> + * https://spdx.org/licenses
>*/

This does not seem to be based on top of the latest mainline
git version. We are using the new SPDX tags now at the beginning
of the file now - same as Linux does:

$ cat arch/arm/mach-mvebu/sata.c
// SPDX-License-Identifier: GPL-2.0+
/*
  * Copyright (C) 2016 Stefan Roese 
  */

#include 
#include 
#include 
...

So please base your patch series on top of the latest mainline
git version and resubmit. And please add my:

Reviewed-by: Stefan Roese 

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


[U-Boot] [PATCH v3 0/4] ahci mvebu driver updates

2018-05-24 Thread make
From: Ken Ma 


These patches move ahci mvebu driver to drivers/ata directory with bug
fixing and scsi supporting.

Changes in v3:
- Use the new SPDX tags.

David Sniatkiwicz (1):
  ata: ahci_mvebu: a8040 a0: remove bad port register offsets
workarounds

Ken Ma (3):
  ata: mvebu: move mvebu sata driver to drivers/ata directory
  ata: ahci_mvebu: add scsi support
  arm64: mvebu: defconfig: enable CONFIG_AHCI_MVEBU

 MAINTAINERS|  1 +
 arch/arm/mach-mvebu/Makefile   |  1 -
 configs/mvebu_db-88f3720_defconfig |  1 +
 configs/mvebu_db_armada8k_defconfig|  1 +
 configs/mvebu_espressobin-88f3720_defconfig|  1 +
 configs/mvebu_mcbin-88f8040_defconfig  |  1 +
 drivers/ata/Kconfig|  9 
 drivers/ata/Makefile   |  1 +
 .../mach-mvebu/sata.c => drivers/ata/ahci_mvebu.c  | 24 +-
 9 files changed, 29 insertions(+), 11 deletions(-)
 rename arch/arm/mach-mvebu/sata.c => drivers/ata/ahci_mvebu.c (68%)

-- 
1.9.1

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


[U-Boot] [PATCH v3 4/4] arm64: mvebu: defconfig: enable CONFIG_AHCI_MVEBU

2018-05-24 Thread make
From: Ken Ma 

This patch enables the new ahci mvebu driver for marvell arm64 platform
SOCs(A3k and A8k).

Signed-off-by: Ken Ma 
Reviewed-by: Stefan Roese 
Reviewed-by: Simon Glass 
---

Changes in v3: None

 configs/mvebu_db-88f3720_defconfig  | 1 +
 configs/mvebu_db_armada8k_defconfig | 1 +
 configs/mvebu_espressobin-88f3720_defconfig | 1 +
 configs/mvebu_mcbin-88f8040_defconfig   | 1 +
 4 files changed, 4 insertions(+)

diff --git a/configs/mvebu_db-88f3720_defconfig 
b/configs/mvebu_db-88f3720_defconfig
index 1d6233a..d40dd42 100644
--- a/configs/mvebu_db-88f3720_defconfig
+++ b/configs/mvebu_db-88f3720_defconfig
@@ -29,6 +29,7 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_MAC_PARTITION=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_SCSI_AHCI=y
+CONFIG_AHCI_MVEBU=y
 CONFIG_BLOCK_CACHE=y
 CONFIG_DM_GPIO=y
 # CONFIG_MVEBU_GPIO is not set
diff --git a/configs/mvebu_db_armada8k_defconfig 
b/configs/mvebu_db_armada8k_defconfig
index da67aad..72c86f3 100644
--- a/configs/mvebu_db_armada8k_defconfig
+++ b/configs/mvebu_db_armada8k_defconfig
@@ -30,6 +30,7 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_MAC_PARTITION=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_SCSI_AHCI=y
+CONFIG_AHCI_MVEBU=y
 CONFIG_BLOCK_CACHE=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_MVTWSI=y
diff --git a/configs/mvebu_espressobin-88f3720_defconfig 
b/configs/mvebu_espressobin-88f3720_defconfig
index 314d405..cc41711 100644
--- a/configs/mvebu_espressobin-88f3720_defconfig
+++ b/configs/mvebu_espressobin-88f3720_defconfig
@@ -28,6 +28,7 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_MAC_PARTITION=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_SCSI_AHCI=y
+CONFIG_AHCI_MVEBU=y
 CONFIG_BLOCK_CACHE=y
 CONFIG_DM_I2C=y
 CONFIG_MISC=y
diff --git a/configs/mvebu_mcbin-88f8040_defconfig 
b/configs/mvebu_mcbin-88f8040_defconfig
index e16a56e..dea0cd0 100644
--- a/configs/mvebu_mcbin-88f8040_defconfig
+++ b/configs/mvebu_mcbin-88f8040_defconfig
@@ -32,6 +32,7 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_MAC_PARTITION=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_SCSI_AHCI=y
+CONFIG_AHCI_MVEBU=y
 CONFIG_BLOCK_CACHE=y
 CONFIG_DM_GPIO=y
 CONFIG_DM_I2C=y
-- 
1.9.1

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


[U-Boot] [PATCH v3 1/4] ata: mvebu: move mvebu sata driver to drivers/ata directory

2018-05-24 Thread make
From: Ken Ma 

Currently mvebu sata driver is in arch/arm/mach_mvebu directory, this
patch moves it to drivers/ata directory with renaming "sata.c" to
"ahci_mvebu.c" which is aligned to Linux.
New ahci driver's kconfig option is added as AHCI_MVEBU which selects
DM_SCSI.

Signed-off-by: Ken Ma 
Reviewed-by: Stefan Roese 
Reviewed-by: Simon Glass 
---

Changes in v3:
- Use the new SPDX tags.

 MAINTAINERS| 1 +
 arch/arm/mach-mvebu/Makefile   | 1 -
 drivers/ata/Kconfig| 9 +
 drivers/ata/Makefile   | 1 +
 arch/arm/mach-mvebu/sata.c => drivers/ata/ahci_mvebu.c | 5 +
 5 files changed, 12 insertions(+), 5 deletions(-)
 rename arch/arm/mach-mvebu/sata.c => drivers/ata/ahci_mvebu.c (93%)

diff --git a/MAINTAINERS b/MAINTAINERS
index 077828c..97c0752 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -134,6 +134,7 @@ S:  Maintained
 T: git git://git.denx.de/u-boot-marvell.git
 F: arch/arm/mach-kirkwood/
 F: arch/arm/mach-mvebu/
+F: drivers/ata/ahci_mvebu.c
 
 ARM MARVELL PXA
 M: Marek Vasut 
diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile
index d4210af..7f0d692 100644
--- a/arch/arm/mach-mvebu/Makefile
+++ b/arch/arm/mach-mvebu/Makefile
@@ -9,7 +9,6 @@ ifdef CONFIG_ARM64
 obj-$(CONFIG_ARMADA_3700) += armada3700/
 obj-$(CONFIG_ARMADA_8K) += armada8k/
 obj-y += arm64-common.o
-obj-y += sata.o
 
 else # CONFIG_ARM64
 
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 86ec628..9ef4589 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -99,4 +99,13 @@ config SATA_SIL3114
help
  Enable this driver to support the SIL3114 SATA controllers.
 
+config AHCI_MVEBU
+   bool "Marvell EBU AHCI SATA support"
+   depends on ARCH_MVEBU
+   select DM_SCSI
+   help
+ This option enables support for the Marvell EBU SoC's
+ onboard AHCI SATA.
+
+ If unsure, say N.
 endmenu
diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile
index a94c804..0254640 100644
--- a/drivers/ata/Makefile
+++ b/drivers/ata/Makefile
@@ -19,3 +19,4 @@ obj-$(CONFIG_SATA_MV) += sata_mv.o
 obj-$(CONFIG_SATA_SIL3114) += sata_sil3114.o
 obj-$(CONFIG_SATA_SIL) += sata_sil.o
 obj-$(CONFIG_SANDBOX) += sata_sandbox.o
+obj-$(CONFIG_AHCI_MVEBU) += ahci_mvebu.o
diff --git a/arch/arm/mach-mvebu/sata.c b/drivers/ata/ahci_mvebu.c
similarity index 93%
rename from arch/arm/mach-mvebu/sata.c
rename to drivers/ata/ahci_mvebu.c
index 5d8032b..3ae8dae 100644
--- a/arch/arm/mach-mvebu/sata.c
+++ b/drivers/ata/ahci_mvebu.c
@@ -1,15 +1,12 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (C) 2016 Stefan Roese 
- *
- * SPDX-License-Identifier:GPL-2.0+
  */
 
 #include 
 #include 
 #include 
 
-DECLARE_GLOBAL_DATA_PTR;
-
 /*
  * Dummy implementation that can be overwritten by a board
  * specific function
-- 
1.9.1

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


[U-Boot] [PATCH v3 3/4] ata: ahci_mvebu: add scsi support

2018-05-24 Thread make
From: Ken Ma 

Mvebu AHCI is AHCI driver which uses SCSI under the hood.
This patch adjusts AHCI setup to support SCSI by creating
a SCSI device as a child.

Signed-off-by: Ken Ma 
Reviewed-by: Stefan Roese 
Reviewed-by: Simon Glass 
---

Changes in v3: None

 drivers/ata/ahci_mvebu.c | 17 -
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/ata/ahci_mvebu.c b/drivers/ata/ahci_mvebu.c
index c1d215f..6e3f17e 100644
--- a/drivers/ata/ahci_mvebu.c
+++ b/drivers/ata/ahci_mvebu.c
@@ -16,6 +16,20 @@ __weak int board_ahci_enable(void)
return 0;
 }
 
+static int mvebu_ahci_bind(struct udevice *dev)
+{
+   struct udevice *scsi_dev;
+   int ret;
+
+   ret = ahci_bind_scsi(dev, _dev);
+   if (ret) {
+   debug("%s: Failed to bind (err=%d\n)", __func__, ret);
+   return ret;
+   }
+
+   return 0;
+}
+
 static int mvebu_ahci_probe(struct udevice *dev)
 {
/*
@@ -24,7 +38,7 @@ static int mvebu_ahci_probe(struct udevice *dev)
 */
board_ahci_enable();
 
-   ahci_init(devfdt_get_addr_ptr(dev));
+   ahci_probe_scsi(dev, (ulong)devfdt_get_addr_ptr(dev));
 
return 0;
 }
@@ -39,5 +53,6 @@ U_BOOT_DRIVER(ahci_mvebu_drv) = {
.name   = "ahci_mvebu",
.id = UCLASS_AHCI,
.of_match   = mvebu_ahci_ids,
+   .bind   = mvebu_ahci_bind,
.probe  = mvebu_ahci_probe,
 };
-- 
1.9.1

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


[U-Boot] [PATCH v3 2/4] ata: ahci_mvebu: a8040 a0: remove bad port register offsets workarounds

2018-05-24 Thread make
From: David Sniatkiwicz 

This workaround was added for A8040/7040 A0.
A8040/7040 A0 is no longer supported so this workaround
can be removed.

Signed-off-by: David Sniatkiwicz 
Signed-off-by: Ken Ma 
Reviewed-by: Stefan Roese 
Reviewed-by: Simon Glass 
---

Changes in v3: None

 drivers/ata/ahci_mvebu.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/drivers/ata/ahci_mvebu.c b/drivers/ata/ahci_mvebu.c
index 3ae8dae..c1d215f 100644
--- a/drivers/ata/ahci_mvebu.c
+++ b/drivers/ata/ahci_mvebu.c
@@ -16,14 +16,6 @@ __weak int board_ahci_enable(void)
return 0;
 }
 
-#ifdef CONFIG_ARMADA_8K
-/* CP110 has different AHCI port addresses */
-void __iomem *ahci_port_base(void __iomem *base, u32 port)
-{
-   return base + 0x1 + (port * 0x1);
-}
-#endif
-
 static int mvebu_ahci_probe(struct udevice *dev)
 {
/*
-- 
1.9.1

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


Re: [U-Boot] [PATCH v2] gadget: f_thor: Fix memory leaks of usb request and its buffer

2018-05-24 Thread Seung-Woo Kim
Hello Lukasz,

On 2018년 05월 25일 07:52, Lukasz Majewski wrote:
> Hi Seung-Woo,
> 
>> There are memory leaks of usb request and its buffer for ep0,
>> in_ep, and out ep. Fix memory leaks of usb request and its buffer.
>>
>> Signed-off-by: Seung-Woo Kim 
>> ---
>> Change from v1
>> - remove allocation of out_ep request instead of allocating and
>> freeing
>> - fix use error path instead of duplicated error handling code
>> ---
>>  drivers/usb/gadget/f_thor.c |   45
>> --- 1 file changed, 29
>> insertions(+), 16 deletions(-)
>>
>> diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c
>> index c8eda05..02d6844 100644
>> --- a/drivers/usb/gadget/f_thor.c
>> +++ b/drivers/usb/gadget/f_thor.c
>> @@ -752,6 +752,13 @@ int thor_handle(void)
>>  return 0;
>>  }
>>  
>> +static void free_ep_req(struct usb_ep *ep, struct usb_request *req)
>> +{
>> +if (req->buf)
>> +free(req->buf);
>> +usb_ep_free_request(ep, req);
>> +}
>> +
>>  static int thor_func_bind(struct usb_configuration *c, struct
>> usb_function *f) {
>>  struct usb_gadget *gadget = c->cdev->gadget;
>> @@ -860,21 +867,18 @@ static int thor_func_bind(struct
>> usb_configuration *c, struct usb_function *f) return 0;
>>  
>>   fail:
>> +if (dev->req)
>> +free_ep_req(gadget->ep0, dev->req);
>>  free(dev);
>>  return status;
>>  }
>>  
>> -static void free_ep_req(struct usb_ep *ep, struct usb_request *req)
>> -{
>> -free(req->buf);
>> -usb_ep_free_request(ep, req);
>> -}
>> -
>>  static void thor_unbind(struct usb_configuration *c, struct
>> usb_function *f) {
>>  struct f_thor *f_thor = func_to_thor(f);
>>  struct thor_dev *dev = f_thor->dev;
>>  
>> +free_ep_req(dev->gadget->ep0, dev->req);
> 
> Till this change - no issues.
> 
>>  free(dev);
>>  memset(thor_func, 0, sizeof(*thor_func));
>>  thor_func = NULL;
>> @@ -895,8 +899,6 @@ static void thor_func_disable(struct usb_function
>> *f) }
>>  
>>  if (dev->out_ep->driver_data) {
>> -free(dev->out_req->buf);
>> -dev->out_req->buf = NULL;
>   
> I think that this setting (to NULL) was needed to be able to ctrl+C
> from thor command and then run it again (as some code checks if buf is
> NULL).

From the comment about usb_ep_free_request(), it frees request object.
So, it looks not required. Actually, dev->out_req = NULL; is more
necessary, but in my test, ctrl-c or thor communication failure also
flow till thor_unbind() where dev is also freed.

> 
>>  usb_ep_free_request(dev->out_ep, dev->out_req);
>>  usb_ep_disable(dev->out_ep);
>>  dev->out_ep->driver_data = NULL;
>> @@ -924,14 +926,13 @@ static int thor_eps_setup(struct usb_function
>> *f) 
>>  result = usb_ep_enable(ep, d);
>>  if (result)
>> -goto exit;
>> +goto err;
>>  
>>  ep->driver_data = cdev; /* claim */
>>  req = thor_start_ep(ep);
>>  if (!req) {
>> -usb_ep_disable(ep);
>>  result = -EIO;
>> -goto exit;
>> +goto err_disable_in_ep;
>>  }
>>  
>>  dev->in_req = req;
>> @@ -941,22 +942,34 @@ static int thor_eps_setup(struct usb_function
>> *f) 
>>  result = usb_ep_enable(ep, d);
>>  if (result)
>> -goto exit;
>> +goto err_free_in_req;
>>  
>>  ep->driver_data = cdev; /* claim */
>> -req = thor_start_ep(ep);
>> +req = usb_ep_alloc_request(ep, 0);
> 
> Is this safe to replace thor_start_ep() - which tunes the ep params -
> with generic function?

It is safe, because there is no tuning ep param. The function has 3
steps including usb_ep_alloc_request() and allocating buffer with
memalign() and setting complete() callback to thor_rx_tx_complete().
For out_req, buffer allocation is not required because buffer for
out_req is always set from thor_set_dma() usually with dfu_buffer before rx.

> 
> ( I do see the req->complete = thor_rx_tx_complete below ).
> 
> If the thor_start_ep can be replaced with generic code, then maybe we
> can remove it?

It is possible to replace in_req case. If you prefer that, I will send
v3 after replacing thor_start_ep() usage with generic functions.

Best Regards,
- Seung-Woo Kim


> 
>>  if (!req) {
>> -usb_ep_disable(ep);
>>  result = -EIO;
>> -goto exit;
>> +goto err_disable_out_ep;
>>  }
>>  
>> +req->complete = thor_rx_tx_complete;
>>  dev->out_req = req;
>>  /* ACM control EP */
>>  ep = dev->int_ep;
>>  ep->driver_data = cdev; /* claim */
>>  
>> - exit:
>> +return 0;
>> +
>> + err_disable_out_ep:
>> +usb_ep_disable(dev->out_ep);
>> +
>> + err_free_in_req:
>> +free_ep_req(dev->in_ep, dev->in_req);
>> +dev->in_req = NULL;
>> +
>> + err_disable_in_ep:
>> +usb_ep_disable(dev->in_ep);
>> +
>> + err:
>>  return result;
>>  }
>>  
> 
> 
> 
> 
> Best regards,

Re: [U-Boot] [U-Boot, v2, 1/2] common: Add support for Android DT image

2018-05-24 Thread Tom Rini
On Fri, May 18, 2018 at 09:47:55PM +0300, Sam Protsenko wrote:
> On 16 May 2018 at 15:08, Tom Rini  wrote:
> > On Thu, Apr 19, 2018 at 11:51:36PM +0300, Sam Protsenko wrote:
> >
> >> Android documentation recommends new image format for storing DTB/DTBO
> >> files: [1]. To support that format, two things should be done:
> >>
> >> 1. Add dt_table.h file from Android (BSD-3 relicensed version): [2].
> >>This header defines structures and constants that we need to work
> >>with that DT image format.
> >>
> >>Changes:
> >> - re-licensed from Apache to BSD-3
> >> - removed functions declarations
> >> - change the coding style to kernel (make checkpatch happy)
> >>
> >> 2. Add helper functions for Android DTB/DTBO format. In
> >>image-android-dt.* files you can find helper functions to work with
> >>Android DT image format, such us routines for:
> >> - printing the dump of image structure
> >> - getting the address and size of desired dtb/dtbo file
> >>
> >> [1] https://source.android.com/devices/architecture/dto/partitions
> >> [2] 
> >> https://android.googlesource.com/platform/system/libufdt/+/58a7582180f477032cd6c74f8d9afad0038e74c3/utils/src/dt_table.h
> >>
> >> Signed-off-by: Sam Protsenko 
> >
> > Why is it OK to change the license on the code?  AFAICT someone can't
> > just relicense Apache to BSD-3.  What happened for
> > include/android_image.h was that Google relicensed the Android code in
> > question to BSD-2 (which in turn allows us in GPL projects).  Thanks!
> 
> Ok, I will try to ask Google to do the same for the header I used. Do
> you know what exactly should be done? Do they need to publish
> relicensed file somewhere, or exactly in Android, or we just need a
> confirmation from their side? Also, which license is preferable for
> us?

I believe Alex helped us last time, and it was done, iirc, by someone
from Google submitting the file with the license we need and a
Signed-off-by from their google.com address.

-- 
Tom


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


[U-Boot] [PATCH] arm, imx6: fix NOR/OneNAND boot mode mix-up

2018-05-24 Thread Jay Carlson
From: Jay Carlson 

This patch fixes the ordering of the EMI enum to match Table 8-8 in the the 
i.MX6ULL Reference Manual, and has been spot-checked in two other i.MX 
reference manuals for accuracy.
---
 arch/arm/include/asm/mach-imx/sys_proto.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/mach-imx/sys_proto.h 
b/arch/arm/include/asm/mach-imx/sys_proto.h
index d1d6cbc462..0acc3640f9 100644
--- a/arch/arm/include/asm/mach-imx/sys_proto.h
+++ b/arch/arm/include/asm/mach-imx/sys_proto.h
@@ -63,8 +63,8 @@ enum imx6_bmode_serial_rom {
 };
 
 enum imx6_bmode_emi {
-   IMX6_BMODE_ONENAND,
IMX6_BMODE_NOR,
+   IMX6_BMODE_ONENAND
 };
 
 enum imx6_bmode {
-- 
2.16.1.windows.4

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


[U-Boot] [PATCH] arm, imx6: add support for SD/MMC Manufacture Mode

2018-05-24 Thread Jay Carlson
From: Jay Carlson 

This patch adds support for booting blank i.MX6 devices in SD/MMC Manufacture 
Mode: a fallback mode which the boot ROM enters when no fuses or boot mode pins 
have been set, the USB serial downloader connection is inactive, and there is 
an SD card inserted into uSDHC1. The i.MX7 and i.MX8, which both have a 
Boot_SW_Info data structure which can be parsed to determine boot source, is 
unaffected by this patch.
---
 arch/arm/mach-imx/spl.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c
index a20b30d154..8ecae8605c 100644
--- a/arch/arm/mach-imx/spl.c
+++ b/arch/arm/mach-imx/spl.c
@@ -43,6 +43,16 @@ u32 spl_boot_device(void)
 */
if (is_usbotg_phy_active())
return BOOT_DEVICE_BOARD;
+   
+   /**
+* To support SD/MMC Manufacture Mode, we check that BOOT_MODE == 0
+* and that BT_FUSE_SEL == 0. If this was disabled via
+* blowing DISABLE_SDMMC_MFG, or if SDMMC MFG mode failed,
+* we would be in USB download mode, which the previous line would 
+* have detected.
+*/
+   if (((bmode >> 24) & 0x03) == 0x00 && (bmode >> 4) == 0x00)
+   return BOOT_DEVICE_MMC1;
 
/* BOOT_CFG1[7:4] - see IMX6DQRM Table 8-8 */
switch ((reg & IMX6_BMODE_MASK) >> IMX6_BMODE_SHIFT) {
-- 
2.16.1.windows.4

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


[U-Boot] [PATCH] efi_selftest: check for buffer overflow in efi_get_variable

2018-05-24 Thread Ivan Gorinov
Check if GetVariable writes past the end of the output data buffer.

Signed-off-by: Ivan Gorinov 
---
 lib/efi_selftest/efi_selftest_variables.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/lib/efi_selftest/efi_selftest_variables.c 
b/lib/efi_selftest/efi_selftest_variables.c
index f5e8eb6..8a02dbc 100644
--- a/lib/efi_selftest/efi_selftest_variables.c
+++ b/lib/efi_selftest/efi_selftest_variables.c
@@ -72,6 +72,22 @@ static int execute(void)
efi_st_error("SetVariable failed\n");
return EFI_ST_FAILURE;
}
+   data[3] = 0xff;
+   len = 3;
+   ret = runtime->get_variable(L"efi_st_var0", _vendor0,
+   , , data);
+   if (ret != EFI_SUCCESS) {
+   efi_st_error("GetVariable failed\n");
+   return EFI_ST_FAILURE;
+   }
+   if (efi_st_memcmp(data, v + 4, 3)) {
+   efi_st_error("GetVariable returned wrong value\n");
+   return EFI_ST_FAILURE;
+   }
+   if (data[3] != 0xff) {
+   efi_st_error("GetVariable wrote past the end of the buffer\n");
+   return EFI_ST_FAILURE;
+   }
/* Set variable 1 */
ret = runtime->set_variable(L"efi_st_var1", _vendor1,
EFI_VARIABLE_BOOTSERVICE_ACCESS,
-- 
2.7.4

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


Re: [U-Boot] Please pull ARC changes

2018-05-24 Thread Tom Rini
On Thu, May 24, 2018 at 01:09:07PM +, Alexey Brodkin wrote:

> Hi Tom,
> 
> The following changes since commit 8a9dc16e4d07d29fff08b7caca36f0865065f7f7:
> 
>   spl: Add full fitImage support (2018-05-23 22:06:42 -0400)
> 
> are available in the Git repository at:
> 
>   git://git.denx.de/u-boot-arc.git tags/arc-uart-updates-for-2018.07-rc1
> 
> for you to fetch changes up to 0556b569e52caf3ab519c340435236e4940cc1cd:
> 
>   ARC: Enable debug UART on nSIM boards (2018-05-24 15:59:17 +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


Re: [U-Boot] [PULL] rpi patch queue 2018-05-24

2018-05-24 Thread Tom Rini
On Thu, May 24, 2018 at 10:36:31AM +0200, Alexander Graf wrote:

> Hi Tom,
> 
> This is my current patch queue for rpi.  Please pull.
> 
> Alex
> 
> 
> The following changes since commit dca268a8f987730978e1a23adfd0ac82db341a10:
> 
>   .travis.yml: Further optimizations (2018-05-22 22:08:57 -0400)
> 
> are available in the git repository at:
> 
>   git://github.com/agraf/u-boot.git tags/signed-rpi-next
> 
> for you to fetch changes up to 385cbe298a6ddcab2d6cc21fb6a549152572957b:
> 
>   rpi: Change load addresses to make more room for the kernel & DTB 
> (2018-05-24 10:20:53 +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] [PATCH v1 1/4] spl: record boot_device into spl_image and call spl_perform_fixups

2018-05-24 Thread Dr. Philipp Tomsich
Lukasz,

> On 25 May 2018, at 00:11, Lukasz Majewski  wrote:
> 
> Hi Philipp,
> 
>> On some boards, we want to give the board/architecture-specific code a
>> chance to look at where the next image has been loaded from and
>> perform fixups before starting the next image.  This is of particular
>> importance, when we probe multiple devices for bootable payloads and
>> boot the first one found.
>> 
>> This change adds the following:
>> - we record the boot_device used into the spl_image structure
>> - we provide an extension-point for boards/architectures that can
>>   perform late fixups depending on a fully populated spl_image
>>   structure (i.e. we'll know the final boot_device and have info
>>   on the image type and operating system to be booted).
>> 
>> Signed-off-by: Philipp Tomsich 
>> Tested-by: Klaus Goger 
>> ---
>> 
>> common/spl/spl.c | 12 +++-
>> include/spl.h|  7 +++
>> 2 files changed, 18 insertions(+), 1 deletion(-)
>> 
>> diff --git a/common/spl/spl.c b/common/spl/spl.c
>> index a09ada3..a1e7b9f 100644
>> --- a/common/spl/spl.c
>> +++ b/common/spl/spl.c
>> @@ -80,6 +80,11 @@ int __weak bootz_setup(ulong image, ulong *start,
>> ulong *end) }
>> #endif
>> 
>> +/* Weak default function for arch/board-specific fixups to the
>> spl_image_info */ +void __weak spl_perform_fixups(struct
>> spl_image_info *spl_image) +{
>> +}
>> +
>> void spl_fixup_fdt(void)
>> {
>> #if defined(CONFIG_SPL_OF_LIBFDT) &&
>> defined(CONFIG_SYS_SPL_ARGS_ADDR) @@ -445,8 +450,10 @@ static int
>> boot_from_devices(struct spl_image_info *spl_image, else
>>  puts("SPL: Unsupported Boot Device!\n");
>> #endif
>> -if (loader && !spl_load_image(spl_image, loader))
>> +if (loader && !spl_load_image(spl_image, loader)) {
>> +spl_image->boot_device = spl_boot_list[i];
>>  return 0;
>> +}
>>  }
>> 
>>  return -ENODEV;
>> @@ -498,6 +505,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
>> #ifdef CONFIG_SYS_SPL_ARGS_ADDR
>>  spl_image.arg = (void *)CONFIG_SYS_SPL_ARGS_ADDR;
>> #endif
>> +spl_image.boot_device = BOOT_DEVICE_NONE;
>>  board_boot_order(spl_boot_list);
>> 
>>  if (boot_from_devices(_image, spl_boot_list,
>> @@ -506,6 +514,8 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
>>  hang();
>>  }
>> 
>> +spl_perform_fixups(_image);
>> +
>> #ifdef CONFIG_CPU_V7M
>>  spl_image.entry_point |= 0x1;
>> #endif
>> diff --git a/include/spl.h b/include/spl.h
>> index 8454ea7..8628787 100644
>> --- a/include/spl.h
>> +++ b/include/spl.h
>> @@ -29,6 +29,7 @@ struct spl_image_info {
>> #if CONFIG_IS_ENABLED(LOAD_FIT)
>>  void *fdt_addr;
>> #endif
>> +u32 boot_device;
>>  u32 size;
>>  u32 flags;
>>  void *arg;
>> @@ -296,4 +297,10 @@ void spl_invoke_atf(struct spl_image_info
>> *spl_image);
>>  * can implement 'board_return_to_bootrom'.
>>  */
>> void board_return_to_bootrom(void);
>> +
>> +/**
>> + * spl_perform_fixups() - arch/board-specific callback before
>> processing
>> + *the boot-payload
>> + */
>> +void spl_perform_fixups(struct spl_image_info *spl_image);
>> #endif
> 
> Have I understood correctly that after applying this patch I can define
> my own spl_perform_fixup() function in my board's spl.c and then decide
> if I want to boot kernel/u-boot proper from eMMC, even if I started the
> boot process from SPI-NOR (where SPL is placed) ?

Starting from SPI-NOR and then continuing from eMMC is already possible
using other mechanisms (e.g. we use FIT images and the boot device list
infrastructure)… so no, this is something different.

This was implemented for the full U-Boot to decide where to boot the OS from.
Our use-case is that if SPL boots the full U-Boot from external storage, we’d 
like
to continue booting from external storage.

Patches 3 + 4 from the series show an example implementation for our RK3399-Q7:
- patch 3 injects a property into the DTS seen by the full U-Boot stage
- patch 4 uses this to change the order of mmc0 and mmc1 in the env for 
distroboot

> 
> 
> Best regards,
> 
> Lukasz Majewski
> 
> --
> 
> DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de 
> 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2] gadget: f_thor: Fix memory leaks of usb request and its buffer

2018-05-24 Thread Lukasz Majewski
Hi Seung-Woo,

> There are memory leaks of usb request and its buffer for ep0,
> in_ep, and out ep. Fix memory leaks of usb request and its buffer.
> 
> Signed-off-by: Seung-Woo Kim 
> ---
> Change from v1
> - remove allocation of out_ep request instead of allocating and
> freeing
> - fix use error path instead of duplicated error handling code
> ---
>  drivers/usb/gadget/f_thor.c |   45
> --- 1 file changed, 29
> insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c
> index c8eda05..02d6844 100644
> --- a/drivers/usb/gadget/f_thor.c
> +++ b/drivers/usb/gadget/f_thor.c
> @@ -752,6 +752,13 @@ int thor_handle(void)
>   return 0;
>  }
>  
> +static void free_ep_req(struct usb_ep *ep, struct usb_request *req)
> +{
> + if (req->buf)
> + free(req->buf);
> + usb_ep_free_request(ep, req);
> +}
> +
>  static int thor_func_bind(struct usb_configuration *c, struct
> usb_function *f) {
>   struct usb_gadget *gadget = c->cdev->gadget;
> @@ -860,21 +867,18 @@ static int thor_func_bind(struct
> usb_configuration *c, struct usb_function *f) return 0;
>  
>   fail:
> + if (dev->req)
> + free_ep_req(gadget->ep0, dev->req);
>   free(dev);
>   return status;
>  }
>  
> -static void free_ep_req(struct usb_ep *ep, struct usb_request *req)
> -{
> - free(req->buf);
> - usb_ep_free_request(ep, req);
> -}
> -
>  static void thor_unbind(struct usb_configuration *c, struct
> usb_function *f) {
>   struct f_thor *f_thor = func_to_thor(f);
>   struct thor_dev *dev = f_thor->dev;
>  
> + free_ep_req(dev->gadget->ep0, dev->req);

Till this change - no issues.

>   free(dev);
>   memset(thor_func, 0, sizeof(*thor_func));
>   thor_func = NULL;
> @@ -895,8 +899,6 @@ static void thor_func_disable(struct usb_function
> *f) }
>  
>   if (dev->out_ep->driver_data) {
> - free(dev->out_req->buf);
> - dev->out_req->buf = NULL;

I think that this setting (to NULL) was needed to be able to ctrl+C
from thor command and then run it again (as some code checks if buf is
NULL).

>   usb_ep_free_request(dev->out_ep, dev->out_req);
>   usb_ep_disable(dev->out_ep);
>   dev->out_ep->driver_data = NULL;
> @@ -924,14 +926,13 @@ static int thor_eps_setup(struct usb_function
> *f) 
>   result = usb_ep_enable(ep, d);
>   if (result)
> - goto exit;
> + goto err;
>  
>   ep->driver_data = cdev; /* claim */
>   req = thor_start_ep(ep);
>   if (!req) {
> - usb_ep_disable(ep);
>   result = -EIO;
> - goto exit;
> + goto err_disable_in_ep;
>   }
>  
>   dev->in_req = req;
> @@ -941,22 +942,34 @@ static int thor_eps_setup(struct usb_function
> *f) 
>   result = usb_ep_enable(ep, d);
>   if (result)
> - goto exit;
> + goto err_free_in_req;
>  
>   ep->driver_data = cdev; /* claim */
> - req = thor_start_ep(ep);
> + req = usb_ep_alloc_request(ep, 0);

Is this safe to replace thor_start_ep() - which tunes the ep params -
with generic function?

( I do see the req->complete = thor_rx_tx_complete below ).

If the thor_start_ep can be replaced with generic code, then maybe we
can remove it?

>   if (!req) {
> - usb_ep_disable(ep);
>   result = -EIO;
> - goto exit;
> + goto err_disable_out_ep;
>   }
>  
> + req->complete = thor_rx_tx_complete;
>   dev->out_req = req;
>   /* ACM control EP */
>   ep = dev->int_ep;
>   ep->driver_data = cdev; /* claim */
>  
> - exit:
> + return 0;
> +
> + err_disable_out_ep:
> + usb_ep_disable(dev->out_ep);
> +
> + err_free_in_req:
> + free_ep_req(dev->in_ep, dev->in_req);
> + dev->in_req = NULL;
> +
> + err_disable_in_ep:
> + usb_ep_disable(dev->in_ep);
> +
> + err:
>   return result;
>  }
>  




Best regards,

Lukasz Majewski

--

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


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


Re: [U-Boot] [PATCH v1 2/2] Migrate bootlimit to Kconfig

2018-05-24 Thread Lukasz Majewski
Hi Alex,

> Migrate boards which set bootlimit in the environment to Kconfig.
> 
> We exclude three boards:
> 
> - display5_factory_defconfig
> - display5_defconfig
> - gurnard_defconfig
> 
> display5_defconfig and display5_factory_defconfig share a
> SYS_CONFIG_NAME, but only display5_defconfig enables
> CONFIG_BOOTCOUNT_LIMIT, so we'd fail to set bootlimit= in
> display5_factory_defconfig if we moved it to Kconfig.

For display5 board it would be OK to have the CONFIG_BOOTCOUNT_LIMIT
defined for display5_defconfig.

The display5_factory_defconfig doesn't need to have it set, as it is
only meant to prepare the board in factory.

> 
> gurnard_defconfig includes a bootlimit=, but doesn't set
> CONFIG_BOOTCOUNT_LIMIT, so again we'd fail to include a bootlimit
> setting if we migrated it.
> 
> Signed-off-by: Alex Kiernan 
> ---
> 
>  configs/brppt1_mmc_defconfig   | 1 +
>  configs/brppt1_nand_defconfig  | 1 +
>  configs/brppt1_spi_defconfig   | 1 +
>  configs/calimain_defconfig | 1 +
>  configs/draco_defconfig| 1 +
>  configs/etamin_defconfig   | 1 +
>  configs/ge_bx50v3_defconfig| 1 +
>  configs/km_kirkwood_128m16_defconfig   | 1 +
>  configs/km_kirkwood_defconfig  | 1 +
>  configs/km_kirkwood_pci_defconfig  | 1 +
>  configs/kmcoge4_defconfig  | 1 +
>  configs/kmcoge5ne_defconfig| 1 +
>  configs/kmcoge5un_defconfig| 1 +
>  configs/kmeter1_defconfig  | 1 +
>  configs/kmlion1_defconfig  | 1 +
>  configs/kmnusa_defconfig   | 1 +
>  configs/kmopti2_defconfig  | 1 +
>  configs/kmsugp1_defconfig  | 1 +
>  configs/kmsupx5_defconfig  | 1 +
>  configs/kmsuv31_defconfig  | 1 +
>  configs/kmtegr1_defconfig  | 1 +
>  configs/kmtepr2_defconfig  | 1 +
>  configs/kmvect1_defconfig  | 1 +
>  configs/mgcoge3un_defconfig| 1 +
>  configs/mx53ppd_defconfig  | 1 +
>  configs/portl2_defconfig   | 1 +
>  configs/pxm2_defconfig | 1 +
>  configs/rastaban_defconfig | 1 +
>  configs/rut_defconfig  | 1 +
>  configs/suvd3_defconfig| 1 +
>  configs/thuban_defconfig   | 1 +
>  configs/tuge1_defconfig| 1 +
>  configs/tuxx1_defconfig| 1 +
>  include/configs/brppt1.h   | 2 --
>  include/configs/calimain.h | 1 -
>  include/configs/ge_bx50v3.h| 1 -
>  include/configs/km/keymile-common.h| 1 -
>  include/configs/mx53ppd.h  | 1 -
>  include/configs/siemens-am33x-common.h | 1 -
>  39 files changed, 33 insertions(+), 7 deletions(-)
> 
> diff --git a/configs/brppt1_mmc_defconfig
> b/configs/brppt1_mmc_defconfig index 5511f2c78e..76d91d4d11 100644
> --- a/configs/brppt1_mmc_defconfig
> +++ b/configs/brppt1_mmc_defconfig
> @@ -50,6 +50,7 @@ CONFIG_CMD_FS_GENERIC=y
>  CONFIG_ENV_IS_IN_MMC=y
>  CONFIG_NETCONSOLE=y
>  CONFIG_BOOTCOUNT_LIMIT=y
> +CONFIG_BOOTCOUNT_BOOTLIMIT=1
>  CONFIG_MMC_OMAP_HS=y
>  CONFIG_DRIVER_TI_CPSW=y
>  CONFIG_SYS_NS16550=y
> diff --git a/configs/brppt1_nand_defconfig
> b/configs/brppt1_nand_defconfig index e00f409d7b..311050c64c 100644
> --- a/configs/brppt1_nand_defconfig
> +++ b/configs/brppt1_nand_defconfig
> @@ -51,6 +51,7 @@
> CONFIG_MTDPARTS_DEFAULT="mtdparts=omap2-nand.0:128k(MLO),128k(MLO.backup),128k(d
> CONFIG_ENV_IS_IN_NAND=y CONFIG_NETCONSOLE=y
>  CONFIG_BOOTCOUNT_LIMIT=y
> +CONFIG_BOOTCOUNT_BOOTLIMIT=1
>  # CONFIG_MMC is not set
>  CONFIG_NAND=y
>  CONFIG_DRIVER_TI_CPSW=y
> diff --git a/configs/brppt1_spi_defconfig
> b/configs/brppt1_spi_defconfig index 8d4f1c1252..977ae73514 100644
> --- a/configs/brppt1_spi_defconfig
> +++ b/configs/brppt1_spi_defconfig
> @@ -57,6 +57,7 @@ CONFIG_CMD_MTDPARTS=y
>  CONFIG_ENV_IS_IN_SPI_FLASH=y
>  CONFIG_NETCONSOLE=y
>  CONFIG_BOOTCOUNT_LIMIT=y
> +CONFIG_BOOTCOUNT_BOOTLIMIT=1
>  CONFIG_MMC_OMAP_HS=y
>  CONFIG_SPI_FLASH=y
>  CONFIG_SPI_FLASH_STMICRO=y
> diff --git a/configs/calimain_defconfig b/configs/calimain_defconfig
> index 7908cfcc34..55782463ae 100644
> --- a/configs/calimain_defconfig
> +++ b/configs/calimain_defconfig
> @@ -22,6 +22,7 @@ CONFIG_CMD_PING=y
>  CONFIG_CMD_DIAG=y
>  CONFIG_ENV_IS_IN_FLASH=y
>  CONFIG_BOOTCOUNT_LIMIT=y
> +CONFIG_BOOTCOUNT_BOOTLIMIT=3
>  CONFIG_SYS_BOOTCOUNT_ADDR=0x01C23000
>  # CONFIG_MMC is not set
>  CONFIG_MTD_NOR_FLASH=y
> diff --git a/configs/draco_defconfig b/configs/draco_defconfig
> index 9ddb3d278d..0548b2c19b 100644
> --- a/configs/draco_defconfig
> +++ b/configs/draco_defconfig
> @@ -56,6 +56,7 @@ CONFIG_OF_EMBED=y
>  CONFIG_ENV_IS_IN_NAND=y
>  CONFIG_BOOTCOUNT_LIMIT=y
>  CONFIG_BOOTCOUNT_ENV=y
> +CONFIG_BOOTCOUNT_BOOTLIMIT=3
>  CONFIG_DFU_NAND=y
>  CONFIG_MMC_OMAP_HS=y
>  CONFIG_NAND=y
> diff --git a/configs/etamin_defconfig b/configs/etamin_defconfig
> index 6521aa8986..f4e986192f 

Re: [U-Boot] usb: Fail to get descriptor for USB 2.0 device

2018-05-24 Thread DATACOM - Paulo.Zaneti



On 24/05/2018 14:57, Marek Vasut wrote:

On 05/24/2018 06:23 PM, DATACOM - Paulo.Zaneti wrote:


On 23/05/2018 20:40, Bin Meng wrote:

Hi,

On Thu, May 24, 2018 at 4:51 AM, DATACOM - Paulo.Zaneti
 wrote:

On 23/05/2018 15:00, Marek Vasut wrote:

On 05/23/2018 07:52 PM, DATACOM - Paulo.Zaneti wrote:

On 23/05/2018 14:43, Marek Vasut wrote:

On 05/23/2018 07:37 PM, DATACOM - Paulo.Zaneti wrote:

On 23/05/2018 14:03, Marek Vasut wrote:

On 05/23/2018 07:00 PM, DATACOM - Paulo.Zaneti wrote:

Hi,

Hi,


When trying to migrate a board from u-boot version 2016.09 to
version
2018.03, I found a problem with a USB 2.0 device which used to
work
on
version 2016.09.

Does it still happen in u-boot/master ?

Yes, it still happens.

I just tested it with the following commit:
dca268a .travis.yml: Further optimizations

In u-boot version 2016.09 the device appears like this:

2: Mass Storage,  USB Revision 2.0
  - SanDisk Cruzer Blade 200443243002FB509E64

Let me guess, is this a DWC2-based host ? You didn't mention which
SoC
or USB controller it is.

Cfr https://lists.denx.de/pipermail/u-boot/2016-January/240090.html ,
DWC2 has problems with those sandisk sticks.

No, it is a NXP T1024 SoC.
Do you think it may be a problem with the SoC or NXP USB host driver ?


So that's chipidea ? That one should be reasonably sane.

I don't think so. It uses following drivers:
    drivers/usb/host/ehci-fsl.c
    drivers/usb/host/ehci-hcd.c


Submit the patch you had in mind and let's see what happens.

I just noticed that this stick needs more time after the
usb_set_address()
call.
I increased the mdelay(10) to mdelay(20) and the "usb start" command
worked.
But the problem is that I am still not convinced that this should be the
solution.


Agreed. Can you bisect to see which commit broke your stick?

Yes. The commit which broke my stick is:

commit c008faa77358bb5b313696dd1d5bb8afa03a6ca2
Author: Bin Meng 
Date:   Mon Sep 18 06:40:42 2017 -0700

     usb: Only get 64 bytes device descriptor for full speed devices


My first guess was that this commit should be adapted to
"get_descriptor_len()" for USB_SPEED_HIGH too.

But then, I realized that I can bypass this problem by increasing the
mdelay() after usb_set_address() from 10 to 20 msec.

So, I think commit c008faa77358bb5b313696dd1d5bb8afa03a6ca2 is not the
offender one. It probably uncovered another problem with this stick.

That particular lineup of sandisk sticks is trash, I have a few of those
here for testing too.


I will try to get a better understanding before submitting a patch.

Did usb_pgood_delay help ?

Yes. It worked. Thanks for the tip.




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


Re: [U-Boot] [PATCH v1 1/4] spl: record boot_device into spl_image and call spl_perform_fixups

2018-05-24 Thread Lukasz Majewski
Hi Philipp,

> On some boards, we want to give the board/architecture-specific code a
> chance to look at where the next image has been loaded from and
> perform fixups before starting the next image.  This is of particular
> importance, when we probe multiple devices for bootable payloads and
> boot the first one found.
> 
> This change adds the following:
>  - we record the boot_device used into the spl_image structure
>  - we provide an extension-point for boards/architectures that can
>perform late fixups depending on a fully populated spl_image
>structure (i.e. we'll know the final boot_device and have info
>on the image type and operating system to be booted).
> 
> Signed-off-by: Philipp Tomsich 
> Tested-by: Klaus Goger 
> ---
> 
>  common/spl/spl.c | 12 +++-
>  include/spl.h|  7 +++
>  2 files changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/common/spl/spl.c b/common/spl/spl.c
> index a09ada3..a1e7b9f 100644
> --- a/common/spl/spl.c
> +++ b/common/spl/spl.c
> @@ -80,6 +80,11 @@ int __weak bootz_setup(ulong image, ulong *start,
> ulong *end) }
>  #endif
>  
> +/* Weak default function for arch/board-specific fixups to the
> spl_image_info */ +void __weak spl_perform_fixups(struct
> spl_image_info *spl_image) +{
> +}
> +
>  void spl_fixup_fdt(void)
>  {
>  #if defined(CONFIG_SPL_OF_LIBFDT) &&
> defined(CONFIG_SYS_SPL_ARGS_ADDR) @@ -445,8 +450,10 @@ static int
> boot_from_devices(struct spl_image_info *spl_image, else
>   puts("SPL: Unsupported Boot Device!\n");
>  #endif
> - if (loader && !spl_load_image(spl_image, loader))
> + if (loader && !spl_load_image(spl_image, loader)) {
> + spl_image->boot_device = spl_boot_list[i];
>   return 0;
> + }
>   }
>  
>   return -ENODEV;
> @@ -498,6 +505,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
>  #ifdef CONFIG_SYS_SPL_ARGS_ADDR
>   spl_image.arg = (void *)CONFIG_SYS_SPL_ARGS_ADDR;
>  #endif
> + spl_image.boot_device = BOOT_DEVICE_NONE;
>   board_boot_order(spl_boot_list);
>  
>   if (boot_from_devices(_image, spl_boot_list,
> @@ -506,6 +514,8 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
>   hang();
>   }
>  
> + spl_perform_fixups(_image);
> +
>  #ifdef CONFIG_CPU_V7M
>   spl_image.entry_point |= 0x1;
>  #endif
> diff --git a/include/spl.h b/include/spl.h
> index 8454ea7..8628787 100644
> --- a/include/spl.h
> +++ b/include/spl.h
> @@ -29,6 +29,7 @@ struct spl_image_info {
>  #if CONFIG_IS_ENABLED(LOAD_FIT)
>   void *fdt_addr;
>  #endif
> + u32 boot_device;
>   u32 size;
>   u32 flags;
>   void *arg;
> @@ -296,4 +297,10 @@ void spl_invoke_atf(struct spl_image_info
> *spl_image);
>   * can implement 'board_return_to_bootrom'.
>   */
>  void board_return_to_bootrom(void);
> +
> +/**
> + * spl_perform_fixups() - arch/board-specific callback before
> processing
> + *the boot-payload
> + */
> +void spl_perform_fixups(struct spl_image_info *spl_image);
>  #endif

Have I understood correctly that after applying this patch I can define
my own spl_perform_fixup() function in my board's spl.c and then decide
if I want to boot kernel/u-boot proper from eMMC, even if I started the
boot process from SPI-NOR (where SPL is placed) ?


Best regards,

Lukasz Majewski

--

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


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


Re: [U-Boot] [PATCH v3 6/6] test: dm: Fix wrong aliases property names

2018-05-24 Thread Eugeniu Rosca
Hi Simon,

On Tue, May 22, 2018 at 05:30:40PM -0600, Simon Glass wrote:
> Hi Eugeniu,
> 
> On 19 May 2018 at 06:13, Eugeniu Rosca  wrote:

--snip--

> > v2->v3:
> > * Fixed an issue in the test code (test/dm/test-fdt.c) generated by the
> >   DTS update (arch/sandbox/dts/test.dts) in [PATCH v2].
> > * Changed commit summary line, to cover test/dm/test-fdt.c.
> > * Added: Reported-by: Petr Vorel 
> > * [Due to update] Dropped: Reviewed-by: Simon Glass 
> >
> > v1->v2:
> > * Newly pushed
> >
> >  arch/sandbox/dts/test.dts | 8 
> >  test/dm/test-fdt.c| 2 +-
> >  2 files changed, 5 insertions(+), 5 deletions(-)
> >
> 
> Reviewed-by: Simon Glass 
> 
> See below
> 
> > diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
> > index 683b1970e0af..3e87c5c0f3fd 100644
> > --- a/arch/sandbox/dts/test.dts
> > +++ b/arch/sandbox/dts/test.dts
> > @@ -27,10 +27,10 @@
> > testfdt3 = "/b-test";
> > testfdt5 = "/some-bus/c-test@5";
> > testfdt8 = "/a-test";
> > -   fdt_dummy0 = "/translation-test@8000/dev@0,0";
> > -   fdt_dummy1 = "/translation-test@8000/dev@1,100";
> > -   fdt_dummy2 = "/translation-test@8000/dev@2,200";
> > -   fdt_dummy3 = 
> > "/translation-test@8000/noxlatebus@3,300/dev@42";
> > +   fdt-dummy0 = "/translation-test@8000/dev@0,0";
> > +   fdt-dummy1 = "/translation-test@8000/dev@1,100";
> > +   fdt-dummy2 = "/translation-test@8000/dev@2,200";
> > +   fdt-dummy3 = 
> > "/translation-test@8000/noxlatebus@3,300/dev@42";
> > usb0 = _0;
> > usb1 = _1;
> > usb2 = _2;
> > diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c
> > index 8196844e89a7..66d0df5629a2 100644
> > --- a/test/dm/test-fdt.c
> > +++ b/test/dm/test-fdt.c
> > @@ -425,7 +425,7 @@ static const struct udevice_id fdt_dummy_ids[] = {
> >  };
> >
> >  UCLASS_DRIVER(fdt_dummy) = {
> > -   .name   = "fdt_dummy",
> > +   .name   = "fdt-dummy",
> 
> You should not need to change this one, and I worry that it is
> confusing since this is the driver name, not a compatible string.

I am not familiar with the in-tree U-boot unit tests, but doing a small
experiment I get clear evidence that there is a tight
relationship/dependency between the name of the entries in the aliases
DTS node and the "name" field of UCLASS_DRIVER using that DTS.

The experiment is running 'ut dm' in sandbox before and after below
patch (I also had to fix two null pointer dereferences in
test/dm/bus.c to avoid segmentation faults with the patch applied):

diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c
index 8196844e89a7..5b715e965269 100644
--- a/test/dm/test-fdt.c
+++ b/test/dm/test-fdt.c
@@ -94,7 +94,7 @@ int testfdt_ping(struct udevice *dev, int pingval, int 
*pingret)
 }
 
 UCLASS_DRIVER(testfdt) = {
-   .name   = "testfdt",
+   .name   = "test_fdt",
.id = UCLASS_TEST_FDT,
.flags  = DM_UC_FLAG_SEQ_ALIAS,
 };

Before the patch, I get: Failures: 9 
After the patch, I get: Failures: 25

So, while the aliases entries are certainly not compatible strings,
not keeping them aligned to UCLASS_DRIVER->name values leads to test
failures. I am not sure if this is something specific to architecture of
the tests or applies generically to any driver which fetches its
configuration from DTS. I was hoping to get an assessment from somebody
with more experience in this area.

Besides the above, it is not clear to me if your Reviewed-by applies to
to this patch partially (since you expressed some concerns) or applies
globally, in which case the concerns are not major?

> 
> > .id = UCLASS_TEST_DUMMY,
> > .flags  = DM_UC_FLAG_SEQ_ALIAS,
> >  };
> > --
> > 2.17.0
> >
> 
> Regards,
> Simon

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


[U-Boot] [PATCH] sf: Enable FSR polling on N25Q256(A)

2018-05-24 Thread Marek Vasut
The N25Q256(A) datasheet clearly states that this device does have
a Flag Status Register and does update FSR PEC bit 7 during Program
and Erase cycles to indicate the cycle is in progress. Enable the
FSR PEC bit polling on this device to prevent data corruption.

Signed-off-by: Marek Vasut 
Cc: Jagan Teki 
Cc: Tom Rini 
---
 drivers/mtd/spi/spi_flash_ids.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/spi/spi_flash_ids.c b/drivers/mtd/spi/spi_flash_ids.c
index 3b8f254ca2..fbc1bb6a5e 100644
--- a/drivers/mtd/spi/spi_flash_ids.c
+++ b/drivers/mtd/spi/spi_flash_ids.c
@@ -130,8 +130,8 @@ const struct spi_flash_info spi_flash_ids[] = {
{"n25q64a",INFO(0x20bb17, 0x0,  64 * 1024,   128, RD_FULL | 
WR_QPP | SECT_4K) },
{"n25q128",INFO(0x20ba18, 0x0,  64 * 1024,   256, RD_FULL | 
WR_QPP) },
{"n25q128a",   INFO(0x20bb18, 0x0,  64 * 1024,   256, RD_FULL | 
WR_QPP) },
-   {"n25q256",INFO(0x20ba19, 0x0,  64 * 1024,   512, RD_FULL | 
WR_QPP | SECT_4K) },
-   {"n25q256a",   INFO(0x20bb19, 0x0,  64 * 1024,   512, RD_FULL | 
WR_QPP | SECT_4K) },
+   {"n25q256",INFO(0x20ba19, 0x0,  64 * 1024,   512, RD_FULL | 
WR_QPP | E_FSR | SECT_4K) },
+   {"n25q256a",   INFO(0x20bb19, 0x0,  64 * 1024,   512, RD_FULL | 
WR_QPP | E_FSR | SECT_4K) },
{"n25q512",INFO(0x20ba20, 0x0,  64 * 1024,  1024, RD_FULL | 
WR_QPP | E_FSR | SECT_4K) },
{"n25q512a",   INFO(0x20bb20, 0x0,  64 * 1024,  1024, RD_FULL | 
WR_QPP | E_FSR | SECT_4K) },
{"n25q1024",   INFO(0x20ba21, 0x0,  64 * 1024,  2048, RD_FULL | 
WR_QPP | E_FSR | SECT_4K) },
-- 
2.16.2

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


[U-Boot] [PATCH] sf: Set current flash bank to 0 in clean_bar()

2018-05-24 Thread Marek Vasut
The clean_bar() function resets the SPI NOR BAR register to 0, but
does not set the flash->curr_bar to 0 , therefore those two can get
out of sync, which could ultimatelly result in corrupted flash content.

The simplest test case is this:

  => mw 0x1000 0x1234abcd 0x4000
  => sf probe
  => sf erase 0x100 0x1
  => sf write 0x1000 0x100 0x1

  => sf probe ; sf read 0x1200 0 0x1 ; md 0x1200

That is, erase a sector above the 16 MiB boundary and write it with
random pre-configured data. What will actually happen without this
patch is the sector will be erased, but the data will be written to
BAR 0 offset 0x0 in the flash.

This is because the erase command will call write_bar()+clean_bar(),
which will leave flash->bank_curr = 1 while the hardware BAR registers
will be set to 0 through clean_bar(). The subsequent write will also
trigger write_bar()+clean_bar(), but write_bar checks if the target
bank == flash->bank_curr and if so, does NOT reconfigure the BAR in
the SPI NOR. Since flash->bank_curr is still 1 and out of sync with
the HW, the condition matches, BAR programming is skipped and write
ends up at address 0x0, thus corrupting flash content.

Signed-off-by: Marek Vasut 
Cc: Jagan Teki 
Cc: Tom Rini 
---
 drivers/mtd/spi/spi_flash.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index 2911729b28..1b61095859 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -128,6 +128,7 @@ static int clean_bar(struct spi_flash *flash)
if (flash->bank_curr == 0)
return 0;
cmd = flash->bank_write_cmd;
+   flash->bank_curr = 0;
 
return spi_flash_write_common(flash, , 1, _sel, 1);
 }
-- 
2.16.2

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


[U-Boot] [PATCH 2/5] iotrace: add IO region limit

2018-05-24 Thread Ramon Fried
When dealing with a lot of IO regions, sometimes
it makes sense only to trace a specific one.
This patch adds support for region limits.
If region is not set, the iotrace works the same as it was.
If region is set, the iotrace only logs io operation that falls
in the defined region.

Signed-off-by: Ramon Fried 
---
 common/iotrace.c  | 27 +++
 include/iotrace.h | 24 
 2 files changed, 51 insertions(+)

diff --git a/common/iotrace.c b/common/iotrace.c
index b16b0d612d..f39885663a 100644
--- a/common/iotrace.c
+++ b/common/iotrace.c
@@ -42,6 +42,8 @@ struct iotrace_record {
  * @start: Start address of iotrace buffer
  * @size:  Size of iotrace buffer in bytes
  * @offset:Current write offset into iotrace buffer
+ * @region_start: Address of IO region to trace
+ * @region_size: Size of region to trace. if 0 will trace all address space
  * @crc32: Current value of CRC chceksum of trace records
  * @enabled:   true if enabled, false if disabled
  */
@@ -49,6 +51,8 @@ static struct iotrace {
ulong start;
ulong size;
ulong offset;
+   ulong region_start;
+   ulong region_size;
u32 crc32;
bool enabled;
 } iotrace;
@@ -66,6 +70,11 @@ static void add_record(int flags, const void *ptr, ulong 
value)
if (!(gd->flags & GD_FLG_RELOC) || !iotrace.enabled)
return;
 
+   if (iotrace.region_size)
+   if ((ulong)ptr < iotrace.region_start ||
+   (ulong)ptr > iotrace.region_start + iotrace.region_size)
+   return;
+
/* Store it if there is room */
if (iotrace.offset + sizeof(*rec) < iotrace.size) {
rec = (struct iotrace_record *)map_sysmem(
@@ -142,6 +151,24 @@ u32 iotrace_get_checksum(void)
return iotrace.crc32;
 }
 
+void iotrace_set_region(ulong start, ulong size)
+{
+   iotrace.region_start = start;
+   iotrace.region_size = size;
+}
+
+void iotrace_reset_region(void)
+{
+   iotrace.region_start = 0;
+   iotrace.region_size = 0;
+}
+
+void iotrace_get_region(ulong *start, ulong *size)
+{
+   *start = iotrace.region_start;
+   *size = iotrace.region_size;
+}
+
 void iotrace_set_enabled(int enable)
 {
iotrace.enabled = enable;
diff --git a/include/iotrace.h b/include/iotrace.h
index 9fe5733f87..1efb117343 100644
--- a/include/iotrace.h
+++ b/include/iotrace.h
@@ -58,6 +58,30 @@ void iotrace_reset_checksum(void);
  */
 u32 iotrace_get_checksum(void);
 
+/**
+ * iotrace_set_region() - Set whether iotrace is limited to a specific
+ * io region.
+ *
+ * Defines the address and size of the limited region.
+ *
+ * @start: address of the beginning of the region
+ * @size: size of the region in bytes.
+ */
+void iotrace_set_region(ulong start, ulong size);
+
+/**
+ * iotrace_reset_region() - Reset the region limit
+ */
+void iotrace_reset_region(void);
+
+/**
+ * iotrace_get_region() - Get region information
+ *
+ * @start: Returns start address of region
+ * @size: Returns size of region in bytes
+ */
+void iotrace_get_region(ulong *start, ulong *size);
+
 /**
  * iotrace_set_enabled() - Set whether iotracing is enabled or not
  *
-- 
2.17.0

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


[U-Boot] [PATCH 3/5] common: iotrace: add timestamp to iotrace records

2018-05-24 Thread Ramon Fried
Add timestamp to each iotrace record to aid in debugging
of IO timing access bugs.

Signed-off-by: Ramon Fried 
---
 common/iotrace.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/common/iotrace.c b/common/iotrace.c
index f39885663a..3530688ab1 100644
--- a/common/iotrace.c
+++ b/common/iotrace.c
@@ -27,11 +27,13 @@ enum iotrace_flags {
  * struct iotrace_record - Holds a single I/O trace record
  *
  * @flags: I/O access type
+ * @timestamp: Timestamp of access
  * @addr: Address of access
  * @value: Value written or read
  */
 struct iotrace_record {
enum iotrace_flags flags;
+   u64 timestamp;
phys_addr_t addr;
iovalue_t value;
 };
@@ -82,6 +84,7 @@ static void add_record(int flags, const void *ptr, ulong 
value)
sizeof(value));
}
 
+   rec->timestamp = get_ticks();
rec->flags = flags;
rec->addr = map_to_sysmem(ptr);
rec->value = value;
-- 
2.17.0

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


[U-Boot] [PATCH 1/5] cmd: iotrace: add set region command

2018-05-24 Thread Ramon Fried
Signed-off-by: Ramon Fried 
---
 cmd/iotrace.c | 22 ++
 1 file changed, 22 insertions(+)

diff --git a/cmd/iotrace.c b/cmd/iotrace.c
index e496787e0d..601b8c8e32 100644
--- a/cmd/iotrace.c
+++ b/cmd/iotrace.c
@@ -15,6 +15,9 @@ static void do_print_stats(void)
iotrace_get_buffer(, , , );
printf("Start:  %08lx\n", start);
printf("Size:   %08lx\n", size);
+   iotrace_get_region(, );
+   printf("Region: %08lx\n", start);
+   printf("Size:   %08lx\n", size);
printf("Offset: %08lx\n", offset);
printf("Output: %08lx\n", start + offset);
printf("Count:  %08lx\n", count);
@@ -37,6 +40,22 @@ static int do_set_buffer(int argc, char * const argv[])
return 0;
 }
 
+static int do_set_region(int argc, char * const argv[])
+{
+   ulong addr = 0, size = 0;
+
+   if (argc == 2) {
+   addr = simple_strtoul(*argv++, NULL, 16);
+   size = simple_strtoul(*argv++, NULL, 16);
+   } else if (argc != 0) {
+   return CMD_RET_USAGE;
+   }
+
+   iotrace_set_region(addr, size);
+
+   return 0;
+}
+
 int do_iotrace(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
const char *cmd = argc < 2 ? NULL : argv[1];
@@ -46,6 +65,8 @@ int do_iotrace(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
switch (*cmd) {
case 'b':
return do_set_buffer(argc - 2, argv + 2);
+   case 'l':
+   return do_set_region(argc - 2, argv + 2);
case 'p':
iotrace_set_enabled(0);
break;
@@ -67,6 +88,7 @@ U_BOOT_CMD(
"iotrace utility commands",
"stats- display iotrace stats\n"
"iotrace buffer- set iotrace buffer\n"
+   "iotrace limit - set iotrace region limit\n"
"iotrace pause- pause tracing\n"
"iotrace resume   - resume tracing"
 );
-- 
2.17.0

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


[U-Boot] [PATCH 4/5] iotrace: move record definitons to header file

2018-05-24 Thread Ramon Fried
The header definitions are needed for reading
record information in cmd/iotrace.c

Signed-off-by: Ramon Fried 
---
 common/iotrace.c  | 27 ---
 include/iotrace.h | 28 
 2 files changed, 28 insertions(+), 27 deletions(-)

diff --git a/common/iotrace.c b/common/iotrace.c
index 3530688ab1..74408a5dbb 100644
--- a/common/iotrace.c
+++ b/common/iotrace.c
@@ -11,33 +11,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-/* Support up to the machine word length for now */
-typedef ulong iovalue_t;
-
-enum iotrace_flags {
-   IOT_8 = 0,
-   IOT_16,
-   IOT_32,
-
-   IOT_READ = 0 << 3,
-   IOT_WRITE = 1 << 3,
-};
-
-/**
- * struct iotrace_record - Holds a single I/O trace record
- *
- * @flags: I/O access type
- * @timestamp: Timestamp of access
- * @addr: Address of access
- * @value: Value written or read
- */
-struct iotrace_record {
-   enum iotrace_flags flags;
-   u64 timestamp;
-   phys_addr_t addr;
-   iovalue_t value;
-};
-
 /**
  * struct iotrace - current trace status and checksum
  *
diff --git a/include/iotrace.h b/include/iotrace.h
index 1efb117343..b6e006ced0 100644
--- a/include/iotrace.h
+++ b/include/iotrace.h
@@ -7,6 +7,34 @@
 #define __IOTRACE_H
 
 #include 
+#include 
+
+/* Support up to the machine word length for now */
+typedef ulong iovalue_t;
+
+enum iotrace_flags {
+   IOT_8 = 0,
+   IOT_16,
+   IOT_32,
+
+   IOT_READ = 0 << 3,
+   IOT_WRITE = 1 << 3,
+};
+
+/**
+ * struct iotrace_record - Holds a single I/O trace record
+ *
+ * @flags: I/O access type
+ * @timestamp: Timestamp of access
+ * @addr: Address of access
+ * @value: Value written or read
+ */
+struct iotrace_record {
+   enum iotrace_flags flags;
+   u64 timestamp;
+   phys_addr_t addr;
+   iovalue_t value;
+};
 
 /*
  * This file is designed to be included in arch//include/asm/io.h.
-- 
2.17.0

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


[U-Boot] [PATCH 5/5] cmd: iotrace: add dump trace command

2018-05-24 Thread Ramon Fried
Add dump trace command which dump all trace
buffer content in a much more readable fashion
than md.

Signed-off-by: Ramon Fried 
---
 cmd/iotrace.c | 36 +++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/cmd/iotrace.c b/cmd/iotrace.c
index 601b8c8e32..f98eb54234 100644
--- a/cmd/iotrace.c
+++ b/cmd/iotrace.c
@@ -24,6 +24,36 @@ static void do_print_stats(void)
printf("CRC32:  %08lx\n", (ulong)iotrace_get_checksum());
 }
 
+static void do_print_trace(void)
+{
+   ulong start, size, offset, count;
+
+   struct iotrace_record *cur_record;
+
+   iotrace_get_buffer(, , , );
+
+   if (!start || !size || !count)
+   return;
+
+   printf("Timestamp  Value  Address\n");
+
+   cur_record = (struct iotrace_record *)start;
+   for (int i = 0; i < count; i++) {
+   if (cur_record->flags & IOT_WRITE)
+   printf("%08llu: 0x%08lx --> 0x%lx08\n",
+  cur_record->timestamp,
+   cur_record->value,
+   cur_record->addr);
+   else
+   printf("%08llu: 0x%08lx <-- 0x%lx08\n",
+  cur_record->timestamp,
+   cur_record->value,
+   cur_record->addr);
+
+   cur_record++;
+   }
+}
+
 static int do_set_buffer(int argc, char * const argv[])
 {
ulong addr = 0, size = 0;
@@ -76,6 +106,9 @@ int do_iotrace(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
case 's':
do_print_stats();
break;
+   case 'd':
+   do_print_trace();
+   break;
default:
return CMD_RET_USAGE;
}
@@ -90,5 +123,6 @@ U_BOOT_CMD(
"iotrace buffer- set iotrace buffer\n"
"iotrace limit - set iotrace region limit\n"
"iotrace pause- pause tracing\n"
-   "iotrace resume   - resume tracing"
+   "iotrace resume   - resume tracing\n"
+   "iotrace dump - dump iotrace buffer"
 );
-- 
2.17.0

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


[U-Boot] [PATCH 0/5] Iotrace improvements

2018-05-24 Thread Ramon Fried
These set of patches add few improvements to iotrace.
* Region limiting - allows setting an address and size where only
io operations that falls into that 
address are
logged.
* Timestamping - Timestamp every iotrace record with current timestamp
* dumping - iotrace dump command for dumping all records from buffer
in a readable fashion.

In terms of backwards compatibility, the timestamp is not backward
compatible as it changes the iotrace record. so if one developed an
offline parsing tool it will be broken.
I though of adding #ifdef specific for that, but eventually I didn't.

Ramon Fried (5):
  cmd: iotrace: add set region command
  iotrace: add IO region limit
  common: iotrace: add timestamp to iotrace records
  iotrace: move record definitons to header file
  cmd: iotrace: add dump trace command

 cmd/iotrace.c | 58 ++-
 common/iotrace.c  | 53 +++
 include/iotrace.h | 52 ++
 3 files changed, 137 insertions(+), 26 deletions(-)

-- 
2.17.0

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


[U-Boot] [PATCH v1 0/2] Add bootlimit to Kconfig

2018-05-24 Thread Alex Kiernan

This patch series adds the bootlimit environment variable to Kconfig
and migrates users to it.


Alex Kiernan (2):
  Add BOOTCOUNT_BOOTLIMIT to set reboot limit
  Migrate bootlimit to Kconfig

 configs/brppt1_mmc_defconfig   | 1 +
 configs/brppt1_nand_defconfig  | 1 +
 configs/brppt1_spi_defconfig   | 1 +
 configs/calimain_defconfig | 1 +
 configs/draco_defconfig| 1 +
 configs/etamin_defconfig   | 1 +
 configs/ge_bx50v3_defconfig| 1 +
 configs/km_kirkwood_128m16_defconfig   | 1 +
 configs/km_kirkwood_defconfig  | 1 +
 configs/km_kirkwood_pci_defconfig  | 1 +
 configs/kmcoge4_defconfig  | 1 +
 configs/kmcoge5ne_defconfig| 1 +
 configs/kmcoge5un_defconfig| 1 +
 configs/kmeter1_defconfig  | 1 +
 configs/kmlion1_defconfig  | 1 +
 configs/kmnusa_defconfig   | 1 +
 configs/kmopti2_defconfig  | 1 +
 configs/kmsugp1_defconfig  | 1 +
 configs/kmsupx5_defconfig  | 1 +
 configs/kmsuv31_defconfig  | 1 +
 configs/kmtegr1_defconfig  | 1 +
 configs/kmtepr2_defconfig  | 1 +
 configs/kmvect1_defconfig  | 1 +
 configs/mgcoge3un_defconfig| 1 +
 configs/mx53ppd_defconfig  | 1 +
 configs/portl2_defconfig   | 1 +
 configs/pxm2_defconfig | 1 +
 configs/rastaban_defconfig | 1 +
 configs/rut_defconfig  | 1 +
 configs/suvd3_defconfig| 1 +
 configs/thuban_defconfig   | 1 +
 configs/tuge1_defconfig| 1 +
 configs/tuxx1_defconfig| 1 +
 drivers/bootcount/Kconfig  | 8 
 include/configs/brppt1.h   | 2 --
 include/configs/calimain.h | 1 -
 include/configs/ge_bx50v3.h| 1 -
 include/configs/km/keymile-common.h| 1 -
 include/configs/mx53ppd.h  | 1 -
 include/configs/siemens-am33x-common.h | 1 -
 include/env_default.h  | 3 +++
 41 files changed, 44 insertions(+), 7 deletions(-)

-- 
2.17.0

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


Re: [U-Boot] Exception Level switching seems broken on RK3399

2018-05-24 Thread Vicente Bergas
Hello Philipp,
your answer is much appreciated.

On Thu, May 24, 2018 at 1:07 PM, Dr. Philipp Tomsich
 wrote:
> Vincente,
>
>> On 19 May 2018, at 16:58, Vicente Bergas  wrote:
>>
>> Hello,
>> I am writing this from a standalone Sapphire board [1],
>> that is, without the Excavator base board.
>> The CPU is the Rockchip RK3399, which implements ARMv8.0-A.
>>
>> Currently the boot process is:
>> 1.- Boot ROM
>> 2.- SPL, provided as closed source binary blob [2]
>
> SPL-support is available in mainline U-Boot.  We developed this for
> the RK3399-Q7 and it has been successfully used on other RK3399
> boards (e.g. I know that some Firefly-users are using this).

Thank you!

>
>> 3.- ATF, closed source binary blob [3]
>> (not using the one from [2] because of stability issues)
>
> Why use the closed-source blob, if the RK3399 is supported in the ATF
> mainline and an ATF can be compiled from source?

Currently I am using both binary blobs (SPL and ATF) because I could
not make it work another way. I'll give it another try.

>
>> 4.- Mainline u-boot, master branch
>> 5.- Mainline linux, master branch
>>
>> I would like to use an opensource boot process.
>> As a first approach I try to completely remove the ATF and
>> replace the SPL with the one from u-boot.
>> The modified boot process looks like:
>> 1.- Boot ROM
>> 2.- SPL, from mainline u-boot, master branch
>> 3.- Mainline u-boot, master branch
>> 4.- Mainline linux, master branch
>> But it is not working.
>>
>> The replaced SPL works fine and loads u-boot.
>> U-boot also works fine, loads linux and jumps into it.
>
> Yes, we’ve done some work to enable us to run U-Boot in EL3 on
> the RK3399 (as we use it for programming the secure e-fuses on
> the RK3399-Q7 in our factory programming setup).

I can indeed confirm that U-Boot runs fine in EL3.

>
>> But then, linux never gets executed.
>>
>> I have traced the issue to: arch/arm/include/asm/macro.h
>> 202: msr  spsr_el3, \tmp
>> 203: msr  elr_el3, \ep
>> 204: eret // This is the last instruction executed
>>
>> For testing, I have also set CONFIG_ARMV8_SWITCH_TO_EL1 and
>> checked that switch_to_el1 from arch/arm/lib/bootm.c is not reached.
>>
>> At this point I have a few questions:
>> 1.- Is my first approach feasible? That is, is it possible to boot
>> this CPU without ATF?
>
> It is feasible (i.e.: requires implementation work) but not recommended:
> Linux will use PSCI to bring up the secondary CPUs.  We have run Linux
> (limited to a single CPU) in EL3 on this CPU during our own board bringup,
> but I would strongly discourage this as it will entail unnecessary effort.

There is a misunderstanding here. My intention was to run U-Boot in EL3,
then switch to EL2 or EL1 from within U-Boot and afterwards run Linux
in the lower EL.

>
>> 2.- If so, what should I do to make it work? Probably it is just
>> a configuration issue, but I do not know what to check. [4]
>> 3.- Else, why do I need ATF?
>
> ATF is the secure monitor on ARMv8 and provides services such as PSCI
> to start up secondary CPUs.  It will usually also be part of power-management
> on most SoCs (after all: power configuration needs to be done in the secure
> envelope).

Do you mean that without ATF I can only run a single CPU core?

Regards,
  Vicenç.

>
> Regards,
> Philipp.
>
>>
>> Regards,
>>  Vicenç.
>>
>> [1] http://opensource.rock-chips.com/wiki_Excavator_sapphire_board
>> [2] https://github.com/rockchip-linux/rkbin/tree/29mirror
>> [3] 
>> https://raw.githubusercontent.com/nightseas/armbian-build/master/packages/blobs/rockchip64/trust.img
>> [4]
>> CONFIG_ARM=y
>> CONFIG_ARCH_ROCKCHIP=y
>> CONFIG_SYS_TEXT_BASE=0x0020
>> CONFIG_SPL_LIBCOMMON_SUPPORT=y
>> CONFIG_SPL_LIBGENERIC_SUPPORT=y
>> CONFIG_SYS_MALLOC_F_LEN=0x4000
>> CONFIG_ROCKCHIP_RK3399=y
>> CONFIG_ROCKCHIP_SPL_RESERVE_IRAM=0x4000
>> CONFIG_SPL_STACK_R_ADDR=0x8
>> # CONFIG_PSCI_RESET is not set
>> CONFIG_CMD_HDMIDETECT=y
>> CONFIG_DEFAULT_DEVICE_TREE="rk3399-evb"
>> CONFIG_DEBUG_UART=y
>> CONFIG_BOOTDELAY=1
>> # CONFIG_DISPLAY_CPUINFO is not set
>> # CONFIG_DISPLAY_BOARDINFO is not set
>> CONFIG_SPL_STACK_R=y
>> CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x4000
>> # CONFIG_CMD_IMI is not set
>> # CONFIG_CMD_XIMG is not set
>> # CONFIG_CMD_SAVEENV is not set
>> # CONFIG_CMD_FLASH is not set
>> # CONFIG_CMD_LOADB is not set
>> # CONFIG_CMD_LOADS is not set
>> CONFIG_CMD_MMC=y
>> CONFIG_CMD_USB=y
>> # CONFIG_CMD_SETEXPR is not set
>> # CONFIG_CMD_NET is not set
>> # CONFIG_DOS_PARTITION is not set
>> # CONFIG_ISO_PARTITION is not set
>> CONFIG_SPL_OF_CONTROL=y
>> CONFIG_REGMAP=y
>> CONFIG_SPL_REGMAP=y
>> CONFIG_SYSCON=y
>> CONFIG_SPL_SYSCON=y
>> CONFIG_CLK=y
>> CONFIG_SPL_CLK=y
>> CONFIG_ROCKCHIP_GPIO=y
>> CONFIG_SYS_I2C_ROCKCHIP=y
>> # CONFIG_MMC_WRITE is not set
>> # CONFIG_MMC_HW_PARTITIONING is not set
>> CONFIG_MMC_DW=y
>> CONFIG_MMC_SDHCI=y
>> CONFIG_MMC_SDHCI_ROCKCHIP=y
>> CONFIG_DM_ETH=y
>> # 

[U-Boot] [PATCH v1 2/2] Migrate bootlimit to Kconfig

2018-05-24 Thread Alex Kiernan
Migrate boards which set bootlimit in the environment to Kconfig.

We exclude three boards:

- display5_factory_defconfig
- display5_defconfig
- gurnard_defconfig

display5_defconfig and display5_factory_defconfig share a SYS_CONFIG_NAME,
but only display5_defconfig enables CONFIG_BOOTCOUNT_LIMIT, so we'd fail to
set bootlimit= in display5_factory_defconfig if we moved it to Kconfig.

gurnard_defconfig includes a bootlimit=, but doesn't set
CONFIG_BOOTCOUNT_LIMIT, so again we'd fail to include a bootlimit setting
if we migrated it.

Signed-off-by: Alex Kiernan 
---

 configs/brppt1_mmc_defconfig   | 1 +
 configs/brppt1_nand_defconfig  | 1 +
 configs/brppt1_spi_defconfig   | 1 +
 configs/calimain_defconfig | 1 +
 configs/draco_defconfig| 1 +
 configs/etamin_defconfig   | 1 +
 configs/ge_bx50v3_defconfig| 1 +
 configs/km_kirkwood_128m16_defconfig   | 1 +
 configs/km_kirkwood_defconfig  | 1 +
 configs/km_kirkwood_pci_defconfig  | 1 +
 configs/kmcoge4_defconfig  | 1 +
 configs/kmcoge5ne_defconfig| 1 +
 configs/kmcoge5un_defconfig| 1 +
 configs/kmeter1_defconfig  | 1 +
 configs/kmlion1_defconfig  | 1 +
 configs/kmnusa_defconfig   | 1 +
 configs/kmopti2_defconfig  | 1 +
 configs/kmsugp1_defconfig  | 1 +
 configs/kmsupx5_defconfig  | 1 +
 configs/kmsuv31_defconfig  | 1 +
 configs/kmtegr1_defconfig  | 1 +
 configs/kmtepr2_defconfig  | 1 +
 configs/kmvect1_defconfig  | 1 +
 configs/mgcoge3un_defconfig| 1 +
 configs/mx53ppd_defconfig  | 1 +
 configs/portl2_defconfig   | 1 +
 configs/pxm2_defconfig | 1 +
 configs/rastaban_defconfig | 1 +
 configs/rut_defconfig  | 1 +
 configs/suvd3_defconfig| 1 +
 configs/thuban_defconfig   | 1 +
 configs/tuge1_defconfig| 1 +
 configs/tuxx1_defconfig| 1 +
 include/configs/brppt1.h   | 2 --
 include/configs/calimain.h | 1 -
 include/configs/ge_bx50v3.h| 1 -
 include/configs/km/keymile-common.h| 1 -
 include/configs/mx53ppd.h  | 1 -
 include/configs/siemens-am33x-common.h | 1 -
 39 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/configs/brppt1_mmc_defconfig b/configs/brppt1_mmc_defconfig
index 5511f2c78e..76d91d4d11 100644
--- a/configs/brppt1_mmc_defconfig
+++ b/configs/brppt1_mmc_defconfig
@@ -50,6 +50,7 @@ CONFIG_CMD_FS_GENERIC=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_NETCONSOLE=y
 CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_BOOTLIMIT=1
 CONFIG_MMC_OMAP_HS=y
 CONFIG_DRIVER_TI_CPSW=y
 CONFIG_SYS_NS16550=y
diff --git a/configs/brppt1_nand_defconfig b/configs/brppt1_nand_defconfig
index e00f409d7b..311050c64c 100644
--- a/configs/brppt1_nand_defconfig
+++ b/configs/brppt1_nand_defconfig
@@ -51,6 +51,7 @@ 
CONFIG_MTDPARTS_DEFAULT="mtdparts=omap2-nand.0:128k(MLO),128k(MLO.backup),128k(d
 CONFIG_ENV_IS_IN_NAND=y
 CONFIG_NETCONSOLE=y
 CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_BOOTLIMIT=1
 # CONFIG_MMC is not set
 CONFIG_NAND=y
 CONFIG_DRIVER_TI_CPSW=y
diff --git a/configs/brppt1_spi_defconfig b/configs/brppt1_spi_defconfig
index 8d4f1c1252..977ae73514 100644
--- a/configs/brppt1_spi_defconfig
+++ b/configs/brppt1_spi_defconfig
@@ -57,6 +57,7 @@ CONFIG_CMD_MTDPARTS=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_NETCONSOLE=y
 CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_BOOTLIMIT=1
 CONFIG_MMC_OMAP_HS=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_STMICRO=y
diff --git a/configs/calimain_defconfig b/configs/calimain_defconfig
index 7908cfcc34..55782463ae 100644
--- a/configs/calimain_defconfig
+++ b/configs/calimain_defconfig
@@ -22,6 +22,7 @@ CONFIG_CMD_PING=y
 CONFIG_CMD_DIAG=y
 CONFIG_ENV_IS_IN_FLASH=y
 CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_BOOTLIMIT=3
 CONFIG_SYS_BOOTCOUNT_ADDR=0x01C23000
 # CONFIG_MMC is not set
 CONFIG_MTD_NOR_FLASH=y
diff --git a/configs/draco_defconfig b/configs/draco_defconfig
index 9ddb3d278d..0548b2c19b 100644
--- a/configs/draco_defconfig
+++ b/configs/draco_defconfig
@@ -56,6 +56,7 @@ CONFIG_OF_EMBED=y
 CONFIG_ENV_IS_IN_NAND=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_BOOTCOUNT_ENV=y
+CONFIG_BOOTCOUNT_BOOTLIMIT=3
 CONFIG_DFU_NAND=y
 CONFIG_MMC_OMAP_HS=y
 CONFIG_NAND=y
diff --git a/configs/etamin_defconfig b/configs/etamin_defconfig
index 6521aa8986..f4e986192f 100644
--- a/configs/etamin_defconfig
+++ b/configs/etamin_defconfig
@@ -56,6 +56,7 @@ CONFIG_OF_EMBED=y
 CONFIG_ENV_IS_IN_NAND=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_BOOTCOUNT_ENV=y
+CONFIG_BOOTCOUNT_BOOTLIMIT=3
 CONFIG_DFU_NAND=y
 CONFIG_MMC_OMAP_HS=y
 CONFIG_NAND=y
diff --git a/configs/ge_bx50v3_defconfig b/configs/ge_bx50v3_defconfig
index a37df05d09..d7f5f35f06 100644
--- a/configs/ge_bx50v3_defconfig
+++ b/configs/ge_bx50v3_defconfig
@@ -28,6 +28,7 @@ 

[U-Boot] [PATCH v1 1/2] Add BOOTCOUNT_BOOTLIMIT to set reboot limit

2018-05-24 Thread Alex Kiernan
Add ability to set environment bootlimit from Kconfig

Signed-off-by: Alex Kiernan 
---

 drivers/bootcount/Kconfig | 8 
 include/env_default.h | 3 +++
 2 files changed, 11 insertions(+)

diff --git a/drivers/bootcount/Kconfig b/drivers/bootcount/Kconfig
index d335ed14b9..9a0bd516d9 100644
--- a/drivers/bootcount/Kconfig
+++ b/drivers/bootcount/Kconfig
@@ -72,6 +72,14 @@ config BOOTCOUNT_AT91
 
 endchoice
 
+config BOOTCOUNT_BOOTLIMIT
+   int "Maximum number of reboot cycles allowed"
+   default 0
+   help
+ Set the Maximum number of reboot cycles allowed without the boot
+ counter being cleared.
+ If set to 0 do not set a boot limit in the environment.
+
 config BOOTCOUNT_ALEN
int "I2C address length"
default 1
diff --git a/include/env_default.h b/include/env_default.h
index 54d8124793..748076288e 100644
--- a/include/env_default.h
+++ b/include/env_default.h
@@ -104,6 +104,9 @@ const uchar default_environment[] = {
"soc="  CONFIG_SYS_SOC  "\0"
 #endif
 #endif
+#if defined(CONFIG_BOOTCOUNT_BOOTLIMIT) && (CONFIG_BOOTCOUNT_BOOTLIMIT > 0)
+   "bootlimit="__stringify(CONFIG_BOOTCOUNT_BOOTLIMIT)"\0"
+#endif
 #ifdef CONFIG_EXTRA_ENV_SETTINGS
CONFIG_EXTRA_ENV_SETTINGS
 #endif
-- 
2.17.0

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


Re: [U-Boot] [PATCH v4 03/16] efi: sandbox: Adjust memory usage for sandbox

2018-05-24 Thread Heinrich Schuchardt
On 05/16/2018 07:15 PM, Heinrich Schuchardt wrote:
> On 05/16/2018 05:42 PM, Simon Glass wrote:
>> With sandbox the U-Boot code is not mapped into the sandbox memory range
>> so does not need to be excluded when allocating EFI memory. Update the EFI
>> memory init code to take account of that.
>>
>> Also use mapmem instead of a cast to convert a memory address to a
>> pointer.
>>
>> Signed-off-by: Simon Glass 
> 
> running ./u-boot
> 
> bootefi selftest
> Found 0 disks
> WARNING: booting without device tree
> 
> Testing EFI API implementation
> 
> Number of tests to execute: 17
> 
> Setting up 'block device'
> Setting up 'block device' succeeded
> 
> Executing 'block device'
> lib/efi_selftest/efi_selftest_block_device.c(378):
> TODO: Wrong volume label 'xxa1', expected 'U-BOOT TEST'
> FAT: Misaligned buffer address (7ff70aafe658)
> Segmentation fault
> 
> Please, fix the alignment fault. You have to ensure that the memory that
> Sandbox has retrieved via malloc is reduced to 4k aligned pages before
> being published to the EFI implementation in lib/efi_loader/efi_memory.c

Hello Simon,

couldn't we use mmap() instead of malloc() to allocate the memory used
by the Sandbox? This would guarantee page aligned memory. mmap() with
MAP_ANON is available both on POSIX and BSD systems.

Best regards

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


Re: [U-Boot] usb: Fail to get descriptor for USB 2.0 device

2018-05-24 Thread Marek Vasut
On 05/24/2018 06:23 PM, DATACOM - Paulo.Zaneti wrote:
> 
> 
> On 23/05/2018 20:40, Bin Meng wrote:
>> Hi,
>>
>> On Thu, May 24, 2018 at 4:51 AM, DATACOM - Paulo.Zaneti
>>  wrote:
>>>
>>> On 23/05/2018 15:00, Marek Vasut wrote:
 On 05/23/2018 07:52 PM, DATACOM - Paulo.Zaneti wrote:
>
> On 23/05/2018 14:43, Marek Vasut wrote:
>> On 05/23/2018 07:37 PM, DATACOM - Paulo.Zaneti wrote:
>>> On 23/05/2018 14:03, Marek Vasut wrote:
 On 05/23/2018 07:00 PM, DATACOM - Paulo.Zaneti wrote:
> Hi,
 Hi,

> When trying to migrate a board from u-boot version 2016.09 to
> version
> 2018.03, I found a problem with a USB 2.0 device which used to
> work
> on
> version 2016.09.
 Does it still happen in u-boot/master ?
>>> Yes, it still happens.
>>>
>>> I just tested it with the following commit:
>>> dca268a .travis.yml: Further optimizations
> In u-boot version 2016.09 the device appears like this:
>
> 2: Mass Storage,  USB Revision 2.0
>  - SanDisk Cruzer Blade 200443243002FB509E64
>> Let me guess, is this a DWC2-based host ? You didn't mention which
>> SoC
>> or USB controller it is.
>>
>> Cfr https://lists.denx.de/pipermail/u-boot/2016-January/240090.html ,
>> DWC2 has problems with those sandisk sticks.
> No, it is a NXP T1024 SoC.
> Do you think it may be a problem with the SoC or NXP USB host driver ?
>
 So that's chipidea ? That one should be reasonably sane.
>>> I don't think so. It uses following drivers:
>>>    drivers/usb/host/ehci-fsl.c
>>>    drivers/usb/host/ehci-hcd.c
>>>
 Submit the patch you had in mind and let's see what happens.
>>> I just noticed that this stick needs more time after the
>>> usb_set_address()
>>> call.
>>> I increased the mdelay(10) to mdelay(20) and the "usb start" command
>>> worked.
>>> But the problem is that I am still not convinced that this should be the
>>> solution.
>>>
>> Agreed. Can you bisect to see which commit broke your stick?
> Yes. The commit which broke my stick is:
> 
> commit c008faa77358bb5b313696dd1d5bb8afa03a6ca2
> Author: Bin Meng 
> Date:   Mon Sep 18 06:40:42 2017 -0700
> 
>     usb: Only get 64 bytes device descriptor for full speed devices
> 
> 
> My first guess was that this commit should be adapted to
> "get_descriptor_len()" for USB_SPEED_HIGH too.
> 
> But then, I realized that I can bypass this problem by increasing the
> mdelay() after usb_set_address() from 10 to 20 msec.
> 
> So, I think commit c008faa77358bb5b313696dd1d5bb8afa03a6ca2 is not the
> offender one. It probably uncovered another problem with this stick.

That particular lineup of sandisk sticks is trash, I have a few of those
here for testing too.

> I will try to get a better understanding before submitting a patch.

Did usb_pgood_delay help ?

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


[U-Boot] [PATCH 1/1] Makefile: clean should delete *.so

2018-05-24 Thread Heinrich Schuchardt
Files *.so are generated files. So the clean target should delete them.

Reported-by: Alexander Graf 
Signed-off-by: Heinrich Schuchardt 
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index ac2624cef8a..cdca1dbe900 100644
--- a/Makefile
+++ b/Makefile
@@ -1620,7 +1620,7 @@ clean: $(clean-dirs)
-o -name '*.symtypes' -o -name 'modules.order' \
-o -name modules.builtin -o -name '.tmp_*.o.*' \
-o -name 'dsdt.aml' -o -name 'dsdt.asl.tmp' -o -name 'dsdt.c' \
-   -o -name '*.efi' -o -name '*.gcno' \) \
+   -o -name '*.efi' -o -name '*.gcno' -o -name '*.so' \) \
-type f -print | xargs rm -f
 
 # mrproper - Delete all generated files, including .config
-- 
2.17.0

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


Re: [U-Boot] RFC: Alternative boot_jump_linux() function

2018-05-24 Thread Ramon Fried
Ping

On Thu, May 17, 2018 at 7:48 PM, Ramon Fried  wrote:
> On Thu, May 17, 2018 at 5:22 PM, Tom Rini  wrote:
>> On Thu, May 17, 2018 at 02:01:55PM +0300, Ramon Fried wrote:
>>
>>> Hi.
>>> I'm currently working on snapdragon bootloader support and in the
>>> particular case where U-boot is running in Aarch32 and the kernel is
>>> Aarch64 the specific implementation is to jump to Linux through SCM
>>> call.
>>>
>>> I try to find the best possible way to provide an alternative boot function.
>>> Adding #ifdef ARCH_SNAPDRAGON will just be too specific in
>>> arm/lib/bootm.c in my opinion and I'm thinking of introducing kind of
>>> a callback function in gd. that if exists will jump there instead of
>>> executing boot_jump_linux().
>>>
>>> What do you think ?
>>
>> So, to be clear, we're on an aarch64 SoC, but U-Boot has been entered in
>> 32bit mode.  And we need to boot a 64bit Linux Kernel.  What else, if
>> anything, is also loaded/still in residence/etc?  Can you explain the
>> overall usecase a bit more and why we're in 32bit mode?  Thanks!
>>
> OK.
> Basically, Qualcomm has the following boot flow:
>
> PBL -> SBL -> LK -> Linux Kernel
>
> PBL - 32bit Primary boot loader(ROM) loads the SBL from eMMC.
>
> SBL - 32bit Secondary boot loader(eMMC/UFS), proprietary closed source,
> Initializes the DDR, starts the trustzone and can load either a 32bit
> or a 64bit (1)
> ELF bootloader, given that it's signed.
>
> LK - Little kernel, 32bit. Qualcomm maintains a downstream version, open 
> source.
> Loads 64bit Android boot image from eMMC and jumps to it using SMC
> call made to Trustzone.
>
> This was used primarily for Android, but when Dragonboards boards came
> out, Qualcomm and Linaro started
> distributing 64bit Linux OE & Debian builds that were booted by LK.
> Because U-boot is much more useful than LK, the first U-boot
> contribution was made by Mateusz Kulikowski.
>
> Basically, Mateusz port is wrapping U-boot to appear as a kernel so LK
> boots it, then it boots Linux.
> So basically, LK did the 32 -> 64 transition.
>
> Now, here where I appear in the story... :)
>
> I'm trying to get rid of LK and use U-boot as the real bootloader for Linux.
> I succeeded in that, and I have all the patches ready for submission,
> I just need to add a dedicated boot function
> that does the SMC call, hence this discussion.
>
> (1) - It implies that we can in practice just use 64bit U-boot for Snapdragon.
> The only problem I have right now is that there's isn't any
> open-source tool to sign the Bootloader that supports ELF64
> executable.
>
> Thanks,
> Ramon.
>
>
>> Tom
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] Exception Level switching seems broken on RK3399

2018-05-24 Thread Dr. Philipp Tomsich
Vincente,

> On 24 May 2018, at 18:48, Vicente Bergas  wrote:
> 
> Hello Philipp,
> your answer is much appreciated.
> 
> On Thu, May 24, 2018 at 1:07 PM, Dr. Philipp Tomsich
>  > wrote:
>> Vincente,
>> 
>>> On 19 May 2018, at 16:58, Vicente Bergas  wrote:
>>> 
>>> Hello,
>>> I am writing this from a standalone Sapphire board [1],
>>> that is, without the Excavator base board.
>>> The CPU is the Rockchip RK3399, which implements ARMv8.0-A.
>>> 
>>> Currently the boot process is:
>>> 1.- Boot ROM
>>> 2.- SPL, provided as closed source binary blob [2]
>> 
>> SPL-support is available in mainline U-Boot.  We developed this for
>> the RK3399-Q7 and it has been successfully used on other RK3399
>> boards (e.g. I know that some Firefly-users are using this).
> 
> Thank you!
> 
>> 
>>> 3.- ATF, closed source binary blob [3]
>>>(not using the one from [2] because of stability issues)
>> 
>> Why use the closed-source blob, if the RK3399 is supported in the ATF
>> mainline and an ATF can be compiled from source?
> 
> Currently I am using both binary blobs (SPL and ATF) because I could
> not make it work another way. I'll give it another try.
> 
>> 
>>> 4.- Mainline u-boot, master branch
>>> 5.- Mainline linux, master branch
>>> 
>>> I would like to use an opensource boot process.
>>> As a first approach I try to completely remove the ATF and
>>> replace the SPL with the one from u-boot.
>>> The modified boot process looks like:
>>> 1.- Boot ROM
>>> 2.- SPL, from mainline u-boot, master branch
>>> 3.- Mainline u-boot, master branch
>>> 4.- Mainline linux, master branch
>>> But it is not working.
>>> 
>>> The replaced SPL works fine and loads u-boot.
>>> U-boot also works fine, loads linux and jumps into it.
>> 
>> Yes, we’ve done some work to enable us to run U-Boot in EL3 on
>> the RK3399 (as we use it for programming the secure e-fuses on
>> the RK3399-Q7 in our factory programming setup).
> 
> I can indeed confirm that U-Boot runs fine in EL3.
> 
>> 
>>> But then, linux never gets executed.
>>> 
>>> I have traced the issue to: arch/arm/include/asm/macro.h
>>> 202: msr  spsr_el3, \tmp
>>> 203: msr  elr_el3, \ep
>>> 204: eret // This is the last instruction executed
>>> 
>>> For testing, I have also set CONFIG_ARMV8_SWITCH_TO_EL1 and
>>> checked that switch_to_el1 from arch/arm/lib/bootm.c is not reached.
>>> 
>>> At this point I have a few questions:
>>> 1.- Is my first approach feasible? That is, is it possible to boot
>>>this CPU without ATF?
>> 
>> It is feasible (i.e.: requires implementation work) but not recommended:
>> Linux will use PSCI to bring up the secondary CPUs.  We have run Linux
>> (limited to a single CPU) in EL3 on this CPU during our own board bringup,
>> but I would strongly discourage this as it will entail unnecessary effort.
> 
> There is a misunderstanding here. My intention was to run U-Boot in EL3,
> then switch to EL2 or EL1 from within U-Boot and afterwards run Linux
> in the lower EL.
> 
>> 
>>> 2.- If so, what should I do to make it work? Probably it is just
>>>a configuration issue, but I do not know what to check. [4]
>>> 3.- Else, why do I need ATF?
>> 
>> ATF is the secure monitor on ARMv8 and provides services such as PSCI
>> to start up secondary CPUs.  It will usually also be part of power-management
>> on most SoCs (after all: power configuration needs to be done in the secure
>> envelope).
> 
> Do you mean that without ATF I can only run a single CPU core?

Linux (on the RK3399) uses PSCI to start the secondary CPUs and uses SMC
(secure monitor call) to call into PSCI.  The PSCI handlers thus live within 
ATF.

While it is technically possible to start up the other cores using other 
mechanisms,
it is the ‘road less travelled’.

Cheers,
Philipp.

> 
> Regards,
>  Vicenç.
> 
>> 
>> Regards,
>> Philipp.
>> 
>>> 
>>> Regards,
>>> Vicenç.
>>> 
>>> [1] http://opensource.rock-chips.com/wiki_Excavator_sapphire_board
>>> [2] https://github.com/rockchip-linux/rkbin/tree/29mirror
>>> [3] 
>>> https://raw.githubusercontent.com/nightseas/armbian-build/master/packages/blobs/rockchip64/trust.img
>>> [4]
>>> CONFIG_ARM=y
>>> CONFIG_ARCH_ROCKCHIP=y
>>> CONFIG_SYS_TEXT_BASE=0x0020
>>> CONFIG_SPL_LIBCOMMON_SUPPORT=y
>>> CONFIG_SPL_LIBGENERIC_SUPPORT=y
>>> CONFIG_SYS_MALLOC_F_LEN=0x4000
>>> CONFIG_ROCKCHIP_RK3399=y
>>> CONFIG_ROCKCHIP_SPL_RESERVE_IRAM=0x4000
>>> CONFIG_SPL_STACK_R_ADDR=0x8
>>> # CONFIG_PSCI_RESET is not set
>>> CONFIG_CMD_HDMIDETECT=y
>>> CONFIG_DEFAULT_DEVICE_TREE="rk3399-evb"
>>> CONFIG_DEBUG_UART=y
>>> CONFIG_BOOTDELAY=1
>>> # CONFIG_DISPLAY_CPUINFO is not set
>>> # CONFIG_DISPLAY_BOARDINFO is not set
>>> CONFIG_SPL_STACK_R=y
>>> CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x4000
>>> # CONFIG_CMD_IMI is not set
>>> # CONFIG_CMD_XIMG is not set
>>> # CONFIG_CMD_SAVEENV is not set
>>> # CONFIG_CMD_FLASH is not set
>>> # CONFIG_CMD_LOADB is 

Re: [U-Boot] usb: Fail to get descriptor for USB 2.0 device

2018-05-24 Thread DATACOM - Paulo.Zaneti



On 23/05/2018 20:40, Bin Meng wrote:

Hi,

On Thu, May 24, 2018 at 4:51 AM, DATACOM - Paulo.Zaneti
 wrote:


On 23/05/2018 15:00, Marek Vasut wrote:

On 05/23/2018 07:52 PM, DATACOM - Paulo.Zaneti wrote:


On 23/05/2018 14:43, Marek Vasut wrote:

On 05/23/2018 07:37 PM, DATACOM - Paulo.Zaneti wrote:

On 23/05/2018 14:03, Marek Vasut wrote:

On 05/23/2018 07:00 PM, DATACOM - Paulo.Zaneti wrote:

Hi,

Hi,


When trying to migrate a board from u-boot version 2016.09 to version
2018.03, I found a problem with a USB 2.0 device which used to work
on
version 2016.09.

Does it still happen in u-boot/master ?

Yes, it still happens.

I just tested it with the following commit:
dca268a .travis.yml: Further optimizations

In u-boot version 2016.09 the device appears like this:

2: Mass Storage,  USB Revision 2.0
 - SanDisk Cruzer Blade 200443243002FB509E64

Let me guess, is this a DWC2-based host ? You didn't mention which SoC
or USB controller it is.

Cfr https://lists.denx.de/pipermail/u-boot/2016-January/240090.html ,
DWC2 has problems with those sandisk sticks.

No, it is a NXP T1024 SoC.
Do you think it may be a problem with the SoC or NXP USB host driver ?


So that's chipidea ? That one should be reasonably sane.

I don't think so. It uses following drivers:
   drivers/usb/host/ehci-fsl.c
   drivers/usb/host/ehci-hcd.c


Submit the patch you had in mind and let's see what happens.

I just noticed that this stick needs more time after the usb_set_address()
call.
I increased the mdelay(10) to mdelay(20) and the "usb start" command worked.
But the problem is that I am still not convinced that this should be the
solution.


Agreed. Can you bisect to see which commit broke your stick?

Yes. The commit which broke my stick is:

commit c008faa77358bb5b313696dd1d5bb8afa03a6ca2
Author: Bin Meng 
Date:   Mon Sep 18 06:40:42 2017 -0700

    usb: Only get 64 bytes device descriptor for full speed devices


My first guess was that this commit should be adapted to 
"get_descriptor_len()" for USB_SPEED_HIGH too.


But then, I realized that I can bypass this problem by increasing the 
mdelay() after usb_set_address() from 10 to 20 msec.


So, I think commit c008faa77358bb5b313696dd1d5bb8afa03a6ca2 is not the 
offender one. It probably uncovered another problem with this stick.


I will try to get a better understanding before submitting a patch.


Regards,
Bin

Thank you guys for all the help. I hope I can contribute back too.

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


Re: [U-Boot] [PATCH 1/2] rpi: Fix fdt_high & initrd_high for 64-bit builds

2018-05-24 Thread Alexander Graf


On 24.05.18 16:57, Tuomas Tynkkynen wrote:
> Hi Alex,
> 
> On Thu, 24 May 2018 09:51:57 +0200
> Alexander Graf  wrote:
> 
>> On 20.04.18 12:03, Tuomas Tynkkynen wrote:
>>> The magic value that disables relocation is dependent on the CPU word
>>> size, so the current '' is doing the wrong thing on aarch64.
>>>
>>> Signed-off-by: Tuomas Tynkkynen   
>>
>> The BCM283x series of SOCs is limited to 32bit address space, so I don't
>> quite see why the current (int)-1 is wrong?
>>
>>
> 
> The comparison for the magic "don't relocate value" is done by parsing
> the variable as ulong and then comparing to ~0. So on 64-bit, 
> gets interpreted as literal 0x limit for the relocation (which
> I think in practice is the same as not specifying initrd_high at all
> since the end of DRAM is lower than that) instead.

Ouch, that logic is terrible. But it means your patch is correct. I'll
apply it.


Thanks,

Alex

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


Re: [U-Boot] [PATCH v2 3/4] ata: ahci_mvebu: add scsi support

2018-05-24 Thread Stefan Roese

On 24.05.2018 04:13, m...@marvell.com wrote:

From: Ken Ma 

Mvebu AHCI is AHCI driver which uses SCSI under the hood.
This patch adjusts AHCI setup to support SCSI by creating
a SCSI device as a child.

Signed-off-by: Ken Ma 
---

Changes in v2: None

  drivers/ata/ahci_mvebu.c | 17 -
  1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/ata/ahci_mvebu.c b/drivers/ata/ahci_mvebu.c
index 97a04d9..9041a72 100644
--- a/drivers/ata/ahci_mvebu.c
+++ b/drivers/ata/ahci_mvebu.c
@@ -19,6 +19,20 @@ __weak int board_ahci_enable(void)
return 0;
  }
  
+static int mvebu_ahci_bind(struct udevice *dev)

+{
+   struct udevice *scsi_dev;
+   int ret;
+
+   ret = ahci_bind_scsi(dev, _dev);
+   if (ret) {
+   debug("%s: Failed to bind (err=%d\n)", __func__, ret);
+   return ret;
+   }
+
+   return 0;
+}
+
  static int mvebu_ahci_probe(struct udevice *dev)
  {
/*
@@ -27,7 +41,7 @@ static int mvebu_ahci_probe(struct udevice *dev)
 */
board_ahci_enable();
  
-	ahci_init(devfdt_get_addr_ptr(dev));

+   ahci_probe_scsi(dev, (ulong)devfdt_get_addr_ptr(dev));
  
  	return 0;

  }
@@ -42,5 +56,6 @@ U_BOOT_DRIVER(ahci_mvebu_drv) = {
.name   = "ahci_mvebu",
.id = UCLASS_AHCI,
.of_match   = mvebu_ahci_ids,
+   .bind   = mvebu_ahci_bind,
.probe  = mvebu_ahci_probe,
  };



Please don't drop the already collected tags here - in this
case the Reviewed-by from Simon.

Reviewed-by: Stefan Roese 

Thanks,
Stefan

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


Re: [U-Boot] [PATCH v2 2/4] ata: ahci_mvebu: a8040 a0: remove bad port register offsets workarounds

2018-05-24 Thread Stefan Roese

On 24.05.2018 04:13, m...@marvell.com wrote:

From: David Sniatkiwicz 

This workaround was added for A8040/7040 A0.
A8040/7040 A0 is no longer supported so this workaround
can be removed.

Signed-off-by: David Sniatkiwicz 
Signed-off-by: Ken Ma 
---

Changes in v2: None


Please don't drop the already collected tags here - in this
case the Reviewed-by from Simon.

Reviewed-by: Stefan Roese 

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


Re: [U-Boot] [PATCH v2 4/4] arm64: mvebu: defconfig: enable CONFIG_AHCI_MVEBU

2018-05-24 Thread Stefan Roese

On 24.05.2018 04:13, m...@marvell.com wrote:

From: Ken Ma 

This patch enables the new ahci mvebu driver for marvell arm64 platform
SOCs(A3k and A8k).

Signed-off-by: Ken Ma 
---

Changes in v2: None

  configs/mvebu_db-88f3720_defconfig  | 1 +
  configs/mvebu_db_armada8k_defconfig | 1 +
  configs/mvebu_espressobin-88f3720_defconfig | 1 +
  configs/mvebu_mcbin-88f8040_defconfig   | 1 +
  4 files changed, 4 insertions(+)


Please don't drop the already collected tags here - in this
case the Reviewed-by from Simon.

Reviewed-by: Stefan Roese 

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


Re: [U-Boot] [PATCH v2 1/4] ata: mvebu: move mvebu sata driver to drivers/ata directory

2018-05-24 Thread Stefan Roese

On 24.05.2018 04:13, m...@marvell.com wrote:

From: Ken Ma 

Currently mvebu sata driver is in arch/arm/mach_mvebu directory, this
patch moves it to drivers/ata directory with renaming "sata.c" to
"ahci_mvebu.c" which is aligned to Linux.
New ahci driver's kconfig option is added as AHCI_MVEBU which selects
DM_SCSI.

Signed-off-by: Ken Ma 
---

Changes in v2:
- Add MAINTAINERS updating

  MAINTAINERS| 1 +
  arch/arm/mach-mvebu/Makefile   | 1 -
  drivers/ata/Kconfig| 9 +
  drivers/ata/Makefile   | 1 +
  arch/arm/mach-mvebu/sata.c => drivers/ata/ahci_mvebu.c | 6 +++---
  5 files changed, 14 insertions(+), 4 deletions(-)
  rename arch/arm/mach-mvebu/sata.c => drivers/ata/ahci_mvebu.c (89%)

diff --git a/MAINTAINERS b/MAINTAINERS
index 077828c..97c0752 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -134,6 +134,7 @@ S:  Maintained
  T:git git://git.denx.de/u-boot-marvell.git
  F:arch/arm/mach-kirkwood/
  F:arch/arm/mach-mvebu/
+F: drivers/ata/ahci_mvebu.c
  
  ARM MARVELL PXA

  M:Marek Vasut 
diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile
index d4210af..7f0d692 100644
--- a/arch/arm/mach-mvebu/Makefile
+++ b/arch/arm/mach-mvebu/Makefile
@@ -9,7 +9,6 @@ ifdef CONFIG_ARM64
  obj-$(CONFIG_ARMADA_3700) += armada3700/
  obj-$(CONFIG_ARMADA_8K) += armada8k/
  obj-y += arm64-common.o
-obj-y += sata.o
  
  else # CONFIG_ARM64
  
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig

index 86ec628..9ef4589 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -99,4 +99,13 @@ config SATA_SIL3114
help
  Enable this driver to support the SIL3114 SATA controllers.
  
+config AHCI_MVEBU

+   bool "Marvell EBU AHCI SATA support"
+   depends on ARCH_MVEBU
+   select DM_SCSI
+   help
+ This option enables support for the Marvell EBU SoC's
+ onboard AHCI SATA.
+
+ If unsure, say N.
  endmenu
diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile
index a94c804..0254640 100644
--- a/drivers/ata/Makefile
+++ b/drivers/ata/Makefile
@@ -19,3 +19,4 @@ obj-$(CONFIG_SATA_MV) += sata_mv.o
  obj-$(CONFIG_SATA_SIL3114) += sata_sil3114.o
  obj-$(CONFIG_SATA_SIL) += sata_sil.o
  obj-$(CONFIG_SANDBOX) += sata_sandbox.o
+obj-$(CONFIG_AHCI_MVEBU) += ahci_mvebu.o
diff --git a/arch/arm/mach-mvebu/sata.c b/drivers/ata/ahci_mvebu.c
similarity index 89%
rename from arch/arm/mach-mvebu/sata.c
rename to drivers/ata/ahci_mvebu.c
index 5d8032b..5c1b293 100644
--- a/arch/arm/mach-mvebu/sata.c
+++ b/drivers/ata/ahci_mvebu.c
@@ -1,15 +1,15 @@
  /*
+ * Copyright (C) 2018 Marvell International Ltd.


Hmmm, are you doing some substantial changes to this file
that entitles you to add your Copyright here? Its mostly
a move of an existing file, right?


   * Copyright (C) 2016 Stefan Roese 
   *
- * SPDX-License-Identifier:GPL-2.0+
+ * SPDX-License-Identifier: GPL-2.0+
+ * https://spdx.org/licenses
   */


This does not seem to be based on top of the latest mainline
git version. We are using the new SPDX tags now at the beginning
of the file now - same as Linux does:

$ cat arch/arm/mach-mvebu/sata.c
// SPDX-License-Identifier: GPL-2.0+
/*
 * Copyright (C) 2016 Stefan Roese 
 */

#include 
#include 
#include 
...

So please base your patch series on top of the latest mainline
git version and resubmit. And please add my:

Reviewed-by: Stefan Roese 

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


[U-Boot] [PATCH v1 1/4] spl: record boot_device into spl_image and call spl_perform_fixups

2018-05-24 Thread Philipp Tomsich
On some boards, we want to give the board/architecture-specific code a
chance to look at where the next image has been loaded from and
perform fixups before starting the next image.  This is of particular
importance, when we probe multiple devices for bootable payloads and
boot the first one found.

This change adds the following:
 - we record the boot_device used into the spl_image structure
 - we provide an extension-point for boards/architectures that can
   perform late fixups depending on a fully populated spl_image
   structure (i.e. we'll know the final boot_device and have info
   on the image type and operating system to be booted).

Signed-off-by: Philipp Tomsich 
Tested-by: Klaus Goger 
---

 common/spl/spl.c | 12 +++-
 include/spl.h|  7 +++
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/common/spl/spl.c b/common/spl/spl.c
index a09ada3..a1e7b9f 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -80,6 +80,11 @@ int __weak bootz_setup(ulong image, ulong *start, ulong *end)
 }
 #endif
 
+/* Weak default function for arch/board-specific fixups to the spl_image_info 
*/
+void __weak spl_perform_fixups(struct spl_image_info *spl_image)
+{
+}
+
 void spl_fixup_fdt(void)
 {
 #if defined(CONFIG_SPL_OF_LIBFDT) && defined(CONFIG_SYS_SPL_ARGS_ADDR)
@@ -445,8 +450,10 @@ static int boot_from_devices(struct spl_image_info 
*spl_image,
else
puts("SPL: Unsupported Boot Device!\n");
 #endif
-   if (loader && !spl_load_image(spl_image, loader))
+   if (loader && !spl_load_image(spl_image, loader)) {
+   spl_image->boot_device = spl_boot_list[i];
return 0;
+   }
}
 
return -ENODEV;
@@ -498,6 +505,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 #ifdef CONFIG_SYS_SPL_ARGS_ADDR
spl_image.arg = (void *)CONFIG_SYS_SPL_ARGS_ADDR;
 #endif
+   spl_image.boot_device = BOOT_DEVICE_NONE;
board_boot_order(spl_boot_list);
 
if (boot_from_devices(_image, spl_boot_list,
@@ -506,6 +514,8 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
hang();
}
 
+   spl_perform_fixups(_image);
+
 #ifdef CONFIG_CPU_V7M
spl_image.entry_point |= 0x1;
 #endif
diff --git a/include/spl.h b/include/spl.h
index 8454ea7..8628787 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -29,6 +29,7 @@ struct spl_image_info {
 #if CONFIG_IS_ENABLED(LOAD_FIT)
void *fdt_addr;
 #endif
+   u32 boot_device;
u32 size;
u32 flags;
void *arg;
@@ -296,4 +297,10 @@ void spl_invoke_atf(struct spl_image_info *spl_image);
  * can implement 'board_return_to_bootrom'.
  */
 void board_return_to_bootrom(void);
+
+/**
+ * spl_perform_fixups() - arch/board-specific callback before processing
+ *the boot-payload
+ */
+void spl_perform_fixups(struct spl_image_info *spl_image);
 #endif
-- 
2.1.4

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


[U-Boot] [PATCH v1 3/4] rockchip: rk3399: inject 'u-boot, spl-boot-device' for next-stage

2018-05-24 Thread Philipp Tomsich
This implements the new 'spl_perform_fixups' hook for RK3399-based
boards and injects the /chosen/u-boot,spl-boot-device with an ofpath
corresponding to the boot device used.

The intended usage is for the full U-Boot stage to evaluate this in
scripts and then adapt its boot-order when using distro-boot.

Signed-off-by: Philipp Tomsich 
Tested-by: Klaus Goger 
---

 arch/arm/mach-rockchip/rk3399-board-spl.c | 48 +++
 1 file changed, 48 insertions(+)

diff --git a/arch/arm/mach-rockchip/rk3399-board-spl.c 
b/arch/arm/mach-rockchip/rk3399-board-spl.c
index d4e9a16..9b5dc41 100644
--- a/arch/arm/mach-rockchip/rk3399-board-spl.c
+++ b/arch/arm/mach-rockchip/rk3399-board-spl.c
@@ -57,6 +57,54 @@ u32 spl_boot_device(void)
return boot_device;
 }
 
+const char *spl_decode_boot_device(u32 boot_device)
+{
+   int i;
+   static const struct {
+   u32 boot_device;
+   const char *ofpath;
+   } spl_boot_devices_tbl[] = {
+   { BOOT_DEVICE_MMC1, "/dwmmc@fe32" },
+   { BOOT_DEVICE_MMC2, "/sdhci@fe33" },
+   { BOOT_DEVICE_SPI, "/spi@ff1d" },
+   };
+
+   for (i = 0; i < ARRAY_SIZE(spl_boot_devices_tbl); ++i)
+   if (spl_boot_devices_tbl[i].boot_device == boot_device)
+   return spl_boot_devices_tbl[i].ofpath;
+
+   return NULL;
+}
+
+void spl_perform_fixups(struct spl_image_info *spl_image)
+{
+   void *blob = spl_image->fdt_addr;
+   const char *boot_ofpath;
+   int chosen;
+
+   /*
+* Inject the ofpath of the device the full U-Boot (or Linux in
+* Falcon-mode) was booted from into the FDT, if a FDT has been
+* loaded at the same time.
+*/
+   if (!blob)
+   return;
+
+   boot_ofpath = spl_decode_boot_device(spl_image->boot_device);
+   if (!boot_ofpath) {
+   pr_err("%s: could not map boot_device to ofpath\n", __func__);
+   return;
+   }
+
+   chosen = fdt_find_or_add_subnode(blob, 0, "chosen");
+   if (chosen < 0) {
+   pr_err("%s: could not find/create '/chosen'\n", __func__);
+   return;
+   }
+   fdt_setprop_string(blob, chosen,
+  "u-boot,spl-boot-device", boot_ofpath);
+}
+
 #define TIMER_CHN10_BASE   0xff8680a0
 #define TIMER_END_COUNT_L  0x00
 #define TIMER_END_COUNT_H  0x04
-- 
2.1.4

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


[U-Boot] [PATCH v1 4/4] rockchip: rk3399: change boot_target based on u-boot, spl-boot-device

2018-05-24 Thread Philipp Tomsich
From: Klaus Goger 

The order distroboot searches for a boot.scr is fixed at compile time.
To make BIOS_DISABLE work as expected and boot from mmc1 instead of
mmc0 if enabled, we need to change the environment at runtime.
Especially as commit: 482cf22333 ("rockchip: rk3399-puma: add boot-on
regulator to override BIOS_DISABLE") enables the eMMC in U-Boot even
if BIOS_DISABLE is active.

Signed-off-by: Klaus Goger 
Signed-off-by: Philipp Tomsich 

---

 board/theobroma-systems/puma_rk3399/puma-rk3399.c | 74 +++
 1 file changed, 74 insertions(+)

diff --git a/board/theobroma-systems/puma_rk3399/puma-rk3399.c 
b/board/theobroma-systems/puma_rk3399/puma-rk3399.c
index 6af9411..573e691 100644
--- a/board/theobroma-systems/puma_rk3399/puma-rk3399.c
+++ b/board/theobroma-systems/puma_rk3399/puma-rk3399.c
@@ -196,11 +196,85 @@ static void setup_iodomain(void)
rk_setreg(>io_vsel, 1 << GRF_IO_VSEL_GPIO4CD_SHIFT);
 }
 
+/*
+ * Swap mmc0 and mmc1 in boot_targets if booted from SD-Card.
+ *
+ * If bootsource is uSD-card we can assume that we want to use the
+ * SD-Card instead of the eMMC as first boot_target for distroboot.
+ * We only want to swap the defaults and not any custom environment a
+ * user has set. We exit early if a changed boot_targets environment
+ * is detected.
+ */
+static int setup_boottargets(void)
+{
+   const char *boot_device =
+   ofnode_get_chosen_prop("u-boot,spl-boot-device");
+   char *env_default, *env;
+
+   if (!boot_device) {
+   debug("%s: /chosen/u-boot,spl-boot-device not set\n",
+ __func__);
+   return -1;
+   }
+   debug("%s: booted from %s\n", __func__, boot_device);
+
+   env_default = env_get_default("boot_targets");
+   env = env_get("boot_targets");
+   if (!env) {
+   debug("%s: boot_targets does not exist\n", __func__);
+   return -1;
+   }
+   debug("%s: boot_targets current: %s - default: %s\n",
+ __func__, env, env_default);
+
+   if (strcmp(env_default, env) != 0) {
+   debug("%s: boot_targets not default, don't change it\n",
+ __func__);
+   return 0;
+   }
+
+   /*
+* Only run, if booting from mmc1 (i.e. /dwmmc@fe32) and
+* only consider cases where the default boot-order first
+* tries to boot from mmc0 (eMMC) and then from mmc1
+* (i.e. external SD).
+*
+* In other words: the SD card will be moved to earlier in the
+* order, if U-Boot was also loaded from the SD-card.
+*/
+   if (!strcmp(boot_device, "/dwmmc@fe32")) {
+   char *mmc0, *mmc1;
+
+   debug("%s: booted from SD-Card\n", __func__);
+   mmc0 = strstr(env, "mmc0");
+   mmc1 = strstr(env, "mmc1");
+
+   if (!mmc0 || !mmc1) {
+   debug("%s: only one mmc boot_target found\n", __func__);
+   return -1;
+   }
+
+   /*
+* If mmc0 comes first in the boot order, we need to change
+* the strings to make mmc1 first.
+*/
+   if (mmc0 < mmc1) {
+   mmc0[3] = '1';
+   mmc1[3] = '0';
+   debug("%s: set boot_targets to: %s\n", __func__, env);
+   env_set("boot_targets", env);
+   }
+   }
+
+   return 0;
+}
+
 int misc_init_r(void)
 {
setup_serial();
setup_macaddr();
setup_iodomain();
+   setup_boottargets();
 
return 0;
 }
-- 
2.1.4

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


[U-Boot] [PATCH v1 0/4] Inject boot-device into DTS and use in distro-boot on the RK3399-Q7

2018-05-24 Thread Philipp Tomsich

The RK3399-Q7 has the ability to bypass the on-module eMMC and SPI
(which always come first in our boot-order) and force a boot from an
external SD card.  If this is the case, we want all later boot-stages
notified and will modify our environment for distro-boot to also try
to boot from the SD card before trying to boot from eMMC.


Klaus Goger (1):
  rockchip: rk3399: change boot_target based on u-boot,spl-boot-device

Philipp Tomsich (3):
  spl: record boot_device into spl_image and call spl_perform_fixups
  spl: document 'chosen/u-boot,spl-boot-device'
  rockchip: rk3399: inject 'u-boot,spl-boot-device' for next-stage

 arch/arm/mach-rockchip/rk3399-board-spl.c | 48 +++
 board/theobroma-systems/puma_rk3399/puma-rk3399.c | 74 +++
 common/spl/spl.c  | 12 +++-
 doc/device-tree-bindings/chosen.txt   | 10 +++
 include/spl.h |  7 +++
 5 files changed, 150 insertions(+), 1 deletion(-)

-- 
2.1.4

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


[U-Boot] [PATCH v1 2/4] spl: document 'chosen/u-boot, spl-boot-device'

2018-05-24 Thread Philipp Tomsich
To let the full U-Boot know where it was booted from (i.e. which of
the entries in /chosen/u-boot,spl-boot-order' contained a valid
image), we define (and document) /chosen/u-boot,spl-boot-device as the
property that could/should automatically be injected by SPL.

This commit only contains a documentation change, which documents the
new property and the intended usage.

Signed-off-by: Philipp Tomsich 
Tested-by: Klaus Goger 
---

 doc/device-tree-bindings/chosen.txt | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/doc/device-tree-bindings/chosen.txt 
b/doc/device-tree-bindings/chosen.txt
index c96b8f7..da7b4e6 100644
--- a/doc/device-tree-bindings/chosen.txt
+++ b/doc/device-tree-bindings/chosen.txt
@@ -73,3 +73,13 @@ Example
u-boot,spl-boot-order = "same-as-spl", , 
"/sdhci@fe33";
};
 };
+
+u-boot,spl-boot-device property
+---
+
+This property is a companion-property to the u-boot,spl-boot-order and
+will be injected automatically by the SPL stage to notify a later stage
+of where said later stage was booted from.
+
+You should not define this property yourself in the device-tree, as it
+may be overwritten without warning.
-- 
2.1.4

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


Re: [U-Boot] [PATCH] rockchip: xhci: remove DTS parsing for PHY (which is unused)

2018-05-24 Thread Marek Vasut
On 05/24/2018 05:11 PM, Philipp Tomsich wrote:
> The xhci wrapper-driver for Rockchip searches the DTS to find its
> child node compatbile with 'rockchip,rk3399-usb3-phy' to retrieve the
> base-address of the PHY.  However, this is currently broken (and
> always has been), returning NULL.  However, the (wrongly) retrieved
> base-address is never used.
> 
> We thus remove this code for now.
> 
> Signed-off-by: Philipp Tomsich 

Applied, thanks

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


[U-Boot] [PATCH] rockchip: xhci: remove DTS parsing for PHY (which is unused)

2018-05-24 Thread Philipp Tomsich
The xhci wrapper-driver for Rockchip searches the DTS to find its
child node compatbile with 'rockchip,rk3399-usb3-phy' to retrieve the
base-address of the PHY.  However, this is currently broken (and
always has been), returning NULL.  However, the (wrongly) retrieved
base-address is never used.

We thus remove this code for now.

Signed-off-by: Philipp Tomsich 
---

 drivers/usb/host/xhci-rockchip.c | 16 
 1 file changed, 16 deletions(-)

diff --git a/drivers/usb/host/xhci-rockchip.c b/drivers/usb/host/xhci-rockchip.c
index 060a6c4..f19bea3 100644
--- a/drivers/usb/host/xhci-rockchip.c
+++ b/drivers/usb/host/xhci-rockchip.c
@@ -17,7 +17,6 @@
 
 struct rockchip_xhci_platdata {
fdt_addr_t hcd_base;
-   fdt_addr_t phy_base;
struct udevice *vbus_supply;
 };
 
@@ -35,7 +34,6 @@ struct rockchip_xhci {
 static int xhci_usb_ofdata_to_platdata(struct udevice *dev)
 {
struct rockchip_xhci_platdata *plat = dev_get_platdata(dev);
-   struct udevice *child;
int ret = 0;
 
/*
@@ -47,20 +45,6 @@ static int xhci_usb_ofdata_to_platdata(struct udevice *dev)
return -ENXIO;
}
 
-   /* Get the base address for usbphy from the device node */
-   for (device_find_first_child(dev, ); child;
-device_find_next_child()) {
-   if (!device_is_compatible(child, "rockchip,rk3399-usb3-phy"))
-   continue;
-   plat->phy_base = devfdt_get_addr(child);
-   break;
-   }
-
-   if (plat->phy_base == FDT_ADDR_T_NONE) {
-   pr_err("Can't get the usbphy register address\n");
-   return -ENXIO;
-   }
-
/* Vbus regulator */
ret = device_get_supply_regulator(dev, "vbus-supply",
  >vbus_supply);
-- 
2.1.4

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


Re: [U-Boot] [PATCH 3/3] dts: mvebu: a80x0: Enable SD/eMMC interfaces

2018-05-24 Thread Stefan Roese

On 24.05.2018 10:20, xsw...@marvell.com wrote:

From: Konstantin Porotchkin 

Enable SDHCI interface on AP and CP0 in A80x0 DTS files

Signed-off-by: Konstantin Porotchkin 
Signed-off-by: Evan Wang 
---

  arch/arm/dts/armada-8040-db.dts| 14 ++
  arch/arm/dts/armada-8040-mcbin.dts |  8 
  2 files changed, 22 insertions(+)

diff --git a/arch/arm/dts/armada-8040-db.dts b/arch/arm/dts/armada-8040-db.dts
index fa58995..65b30bb 100644
--- a/arch/arm/dts/armada-8040-db.dts
+++ b/arch/arm/dts/armada-8040-db.dts
@@ -81,6 +81,13 @@
 1 3 0 0 0 0 0 0 0 3 >;
  };
  
+_sdhci0 {

+   pinctrl-names = "default";
+   pinctrl-0 = <_emmc_pins>;
+   bus-width = <8>;
+   status = "okay";
+};
+
  _pinctl {
/* MPP Bus:
 *  [0-31]  = 0xff: Keep default CP0_shared_pins
@@ -182,6 +189,13 @@
status = "okay";
  };
  
+_sdhci0 {

+   pinctrl-names = "default";
+   pinctrl-0 = <_sdhci_pins>;
+   bus-width = <4>;
+   status = "okay";
+};
+
  _pinctl {
/* MPP Bus:
 *  [0-11]  RGMII0
diff --git a/arch/arm/dts/armada-8040-mcbin.dts 
b/arch/arm/dts/armada-8040-mcbin.dts
index 991ddc0..46b32f2 100644
--- a/arch/arm/dts/armada-8040-mcbin.dts
+++ b/arch/arm/dts/armada-8040-mcbin.dts
@@ -156,6 +156,14 @@
status = "okay";
  };
  
+/* uSD slot */

+_sdhci0 {
+   pinctrl-names = "default";
+   pinctrl-0 = <_sdhci_pins>;
+   bus-width = <4>;
+   status = "okay";
+};
+
  _comphy {
/*
 * CP0 Serdes Configuration:



Reviewed-by: Stefan Roese 

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


Re: [U-Boot] [PATCH 2/3] mvebu: pinctrl: Add SD/eMMC PHY selector to the driver

2018-05-24 Thread Stefan Roese

On 24.05.2018 10:20, xsw...@marvell.com wrote:

From: Konstantin Porotchkin 

When the pin control driver selects SD/eMMC function for
a pin group, there is additional configuration to be done
for this case - switch the PHY to work with SDHCI interface.
This patch adds the missing functionality into the pin
control driver.

Signed-off-by: Konstantin Porotchkin 
Signed-off-by: Evan Wang 
---

  drivers/pinctrl/mvebu/pinctrl-mvebu.c | 59 +--
  1 file changed, 57 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/mvebu/pinctrl-mvebu.c 
b/drivers/pinctrl/mvebu/pinctrl-mvebu.c
index 556bf78..7d8a0b0 100644
--- a/drivers/pinctrl/mvebu/pinctrl-mvebu.c
+++ b/drivers/pinctrl/mvebu/pinctrl-mvebu.c
@@ -17,8 +17,48 @@
  #include 
  #include "pinctrl-mvebu.h"
  
+#define AP_EMMC_PHY_CTRL_REG		0x100

+#define CP_EMMC_PHY_CTRL_REG   0x424
+#define EMMC_PHY_CTRL_SDPHY_EN BIT(0)
+
+#define AP806_EMMC_CLK_PIN_ID  0
+#define AP806_EMMC_CLK_FUNC0x1
+#define CP110_EMMC_CLK_PIN_ID  56
+#define CP110_EMMC_CLK_FUNC0xe
+
  DECLARE_GLOBAL_DATA_PTR;
  
+/* mvebu_pinctl_emmc_set_mux: configure sd/mmc PHY mux

+ * To enable SDIO/eMMC in Armada-APN806/CP110, need to configure PHY mux.
+ * eMMC/SD PHY register responsible for muxing between MPPs and SD/eMMC
+ * controller:
+ * - Bit0 enabled SDIO/eMMC PHY is used as a MPP muxltiplexer,
+ * - Bit0 disabled SDIO/eMMC PHY is connected to SDIO/eMMC controller
+ * If pin function is set to eMMC/SD, then configure the eMMC/SD PHY
+ * muxltiplexer register to be on SDIO/eMMC controller
+ */
+void mvebu_pinctl_emmc_set_mux(struct udevice *dev, u32 pin, u32 func)
+{
+   const void *blob = gd->fdt_blob;
+   int node = dev_of_offset(dev);
+   struct mvebu_pinctrl_priv *priv = dev_get_priv(dev);
+
+   if (!fdt_node_check_compatible(blob, node, "marvell,ap806-pinctrl")) {
+   if ((pin == AP806_EMMC_CLK_PIN_ID) &&
+   (func == AP806_EMMC_CLK_FUNC)) {
+   clrbits_le32(priv->base_reg + AP_EMMC_PHY_CTRL_REG,
+EMMC_PHY_CTRL_SDPHY_EN);
+   }
+   } else if (!fdt_node_check_compatible(blob, node,
+   "marvell,armada-8k-cpm-pinctrl")) {
+   if ((pin == CP110_EMMC_CLK_PIN_ID) &&
+   (func == CP110_EMMC_CLK_FUNC)) {
+   clrbits_le32(priv->base_reg + CP_EMMC_PHY_CTRL_REG,
+EMMC_PHY_CTRL_SDPHY_EN);
+   }
+   }
+}
+
  /*
   * mvebu_pinctrl_set_state: configure pin functions.
   * @dev: the pinctrl device to be configured.
@@ -48,9 +88,16 @@ int mvebu_pinctrl_set_state(struct udevice *dev, struct 
udevice *config)
  
  	function = fdtdec_get_int(blob, node, "marvell,function", 0xff);
  
+	/*

+* Check if setup of PHY mux is needed for this pins group.
+* Only the first pin id in array is tested, all the rest use the same
+* pin function.
+*/
+   mvebu_pinctl_emmc_set_mux(dev, pin_arr[0], function);
+
for (i = 0; i < pin_count; i++) {
-   int reg_offset;
-   int field_offset;
+   int reg_offset;
+   int field_offset;
int pin = pin_arr[i];
  
  		if (function > priv->max_func) {

@@ -97,6 +144,14 @@ static int mvebu_pinctrl_set_state_all(struct udevice *dev,
return -EINVAL;
}
  
+	/* Check if setup of PHY mux is needed for this pins group. */

+   if (priv->pin_cnt < CP110_EMMC_CLK_PIN_ID)
+   mvebu_pinctl_emmc_set_mux(dev, AP806_EMMC_CLK_PIN_ID,
+ func_arr[AP806_EMMC_CLK_PIN_ID]);
+   else
+   mvebu_pinctl_emmc_set_mux(dev, CP110_EMMC_CLK_PIN_ID,
+ func_arr[CP110_EMMC_CLK_PIN_ID]);
+
for (pin = 0; pin < priv->pin_cnt; pin++) {
int reg_offset;
int field_offset;



Reviewed-by: Stefan Roese 

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


Re: [U-Boot] [PATCH 1/3] mvebu: pinctrl: sync compatible string with Linux 4.17-rc4

2018-05-24 Thread Stefan Roese

On 24.05.2018 10:20, xsw...@marvell.com wrote:

From: Evan Wang 

Signed-off-by: Evan Wang 


Even for minimal changes (which this patch is not btw), a small
commit text is mandatory. Please insert a short patch description
here in your v2.

Other than this, please add my:

Reviewed-by: Stefan Roese 

Thanks,
Stefan


---

  arch/arm/dts/armada-ap806.dtsi   |  2 +-
  arch/arm/dts/armada-cp110-master.dtsi|  4 ++--
  arch/arm/dts/armada-cp110-slave.dtsi |  2 +-
  .../pinctrl/marvell,mvebu-pinctrl.txt| 16 
  drivers/pinctrl/mvebu/pinctrl-mvebu.c|  8 
  5 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/arch/arm/dts/armada-ap806.dtsi b/arch/arm/dts/armada-ap806.dtsi
index e0d3016..ebdee51 100644
--- a/arch/arm/dts/armada-ap806.dtsi
+++ b/arch/arm/dts/armada-ap806.dtsi
@@ -141,7 +141,7 @@
};
  
  			ap_pinctl: ap-pinctl@6F4000 {

-   compatible = "marvell,armada-ap806-pinctrl";
+   compatible = "marvell,ap806-pinctrl";
bank-name ="apn-806";
reg = <0x6F4000 0x10>;
pin-count = <20>;
diff --git a/arch/arm/dts/armada-cp110-master.dtsi 
b/arch/arm/dts/armada-cp110-master.dtsi
index 8c336f2..551d00d 100644
--- a/arch/arm/dts/armada-cp110-master.dtsi
+++ b/arch/arm/dts/armada-cp110-master.dtsi
@@ -120,8 +120,8 @@
  
  			cpm_pinctl: cpm-pinctl@44 {

compatible = "marvell,mvebu-pinctrl",
-"marvell,a70x0-pinctrl",
-"marvell,a80x0-cp0-pinctrl";
+"marvell,armada-7k-pinctrl",
+"marvell,armada-8k-cpm-pinctrl";
bank-name ="cp0-110";
reg = <0x44 0x20>;
pin-count = <63>;
diff --git a/arch/arm/dts/armada-cp110-slave.dtsi 
b/arch/arm/dts/armada-cp110-slave.dtsi
index 0cdb3d3..2ea9004 100644
--- a/arch/arm/dts/armada-cp110-slave.dtsi
+++ b/arch/arm/dts/armada-cp110-slave.dtsi
@@ -120,7 +120,7 @@
  
  			cps_pinctl: cps-pinctl@44 {

compatible = "marvell,mvebu-pinctrl",
-"marvell,a80x0-cp1-pinctrl";
+"marvell,armada-8k-cps-pinctrl";
bank-name ="cp1-110";
reg = <0x44 0x20>;
pin-count = <63>;
diff --git a/doc/device-tree-bindings/pinctrl/marvell,mvebu-pinctrl.txt 
b/doc/device-tree-bindings/pinctrl/marvell,mvebu-pinctrl.txt
index 5f86c0a..1fc1bc6 100644
--- a/doc/device-tree-bindings/pinctrl/marvell,mvebu-pinctrl.txt
+++ b/doc/device-tree-bindings/pinctrl/marvell,mvebu-pinctrl.txt
@@ -6,10 +6,10 @@ mpp pins or group of pins and a mpp function common to all 
pins.
  
  Required properties for the pinctrl driver:

  - compatible: "marvell,mvebu-pinctrl",
-   "marvell,armada-ap806-pinctrl",
-   "marvell,a70x0-pinctrl",
-   "marvell,a80x0-cp0-pinctrl",
-   "marvell,a80x0-cp1-pinctrl"
+   "marvell,ap806-pinctrl",
+   "marvell,armada-7k-pinctrl",
+   "marvell,armada-8k-cpm-pinctrl",
+   "marvell,armada-8k-cps-pinctrl"
  - bank-name:  A string defining the pinc controller bank name
  - reg:A pair of values defining the pin controller base 
address
and the address space
@@ -31,7 +31,7 @@ Example:
config-space {
pinctl: pinctl@6F4000 {
compatible = "marvell,mvebu-pinctrl",
-"marvell,armada-ap806-pinctrl";
+"marvell,ap806-pinctrl";
bank-name ="apn-806";
reg = <0x6F4000 0x10>;
pin-count = <20>;
@@ -52,8 +52,8 @@ Example:
config-space {
cpm_pinctl: pinctl@44000 {
compatible = "marvell,mvebu-pinctrl",
-"marvell,a70x0-pinctrl",
-"marvell,a80x0-cp0-pinctrl";
+"marvell,armada-7k-pinctrl",
+"marvell,armada-8k-cpm-pinctrl";
bank-name ="cp0-110";
reg = <0x44 0x20>;
pin-count = <63>;
@@ -89,7 +89,7 @@ Example:
config-space {
  

Re: [U-Boot] [PATCH 1/2] rpi: Fix fdt_high & initrd_high for 64-bit builds

2018-05-24 Thread Tuomas Tynkkynen
Hi Alex,

On Thu, 24 May 2018 09:51:57 +0200
Alexander Graf  wrote:

> On 20.04.18 12:03, Tuomas Tynkkynen wrote:
> > The magic value that disables relocation is dependent on the CPU word
> > size, so the current '' is doing the wrong thing on aarch64.
> > 
> > Signed-off-by: Tuomas Tynkkynen   
> 
> The BCM283x series of SOCs is limited to 32bit address space, so I don't
> quite see why the current (int)-1 is wrong?
> 
> 

The comparison for the magic "don't relocate value" is done by parsing
the variable as ulong and then comparing to ~0. So on 64-bit, 
gets interpreted as literal 0x limit for the relocation (which
I think in practice is the same as not specifying initrd_high at all
since the end of DRAM is lower than that) instead.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] board: STiH410-B2260: Add pxefile_addr_r variable

2018-05-24 Thread riku . voipio
From: Riku Voipio 

Reading doc/README.distro , we see platform needs to set
pxefile_addr_r to support distro boot.

Signed-off-by: Riku Voipio 
---
 include/configs/stih410-b2260.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/configs/stih410-b2260.h b/include/configs/stih410-b2260.h
index b4e4619266..d8bf3b6580 100644
--- a/include/configs/stih410-b2260.h
+++ b/include/configs/stih410-b2260.h
@@ -31,6 +31,7 @@
"fdtfile=stih410-b2260.dtb\0"   \
"fdt_addr_r=0x4700\0"   \
"scriptaddr=0x5000\0"   \
+   "pxefile_addr_r=0x5010\0"   \
"fdt_high=0x\0" \
"initrd_high=0x\0"  \
"ramdisk_addr_r=0x4800\0"   \
-- 
2.17.0

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


[U-Boot] [PATCH 2/2] crypto: add Atmel hardware acceleration for SHA1 & 256

2018-05-24 Thread Ben Whitten
We can use the hardware hash block to reduce space, particularly useful
for verifying FIT signatures from SPL.

Signed-off-by: Ben Whitten 
---
 drivers/crypto/Kconfig |   5 +
 drivers/crypto/Makefile|   1 +
 drivers/crypto/atmel_sha.c | 289 +
 drivers/crypto/atmel_sha.h |  52 
 lib/Makefile   |   2 +
 5 files changed, 349 insertions(+)
 create mode 100644 drivers/crypto/atmel_sha.c
 create mode 100644 drivers/crypto/atmel_sha.h

diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig
index 1ea116b..7a20edb 100644
--- a/drivers/crypto/Kconfig
+++ b/drivers/crypto/Kconfig
@@ -2,4 +2,9 @@ menu "Hardware crypto devices"
 
 source drivers/crypto/fsl/Kconfig
 
+config ATMEL_SHA
+   bool "Atmel SHA Driver support"
+   help
+ Enables the Atmel SHA accelerator.
+
 endmenu
diff --git a/drivers/crypto/Makefile b/drivers/crypto/Makefile
index efbd1d3..07af449 100644
--- a/drivers/crypto/Makefile
+++ b/drivers/crypto/Makefile
@@ -4,5 +4,6 @@
 #  http://www.samsung.com
 
 obj-$(CONFIG_EXYNOS_ACE_SHA)   += ace_sha.o
+obj-$(CONFIG_ATMEL_SHA)+= atmel_sha.o
 obj-y += rsa_mod_exp/
 obj-y += fsl/
diff --git a/drivers/crypto/atmel_sha.c b/drivers/crypto/atmel_sha.c
new file mode 100644
index 000..ef969eb
--- /dev/null
+++ b/drivers/crypto/atmel_sha.c
@@ -0,0 +1,289 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Atmel SHA engine
+ * Copyright (c) 2018  Laird
+ */
+
+#include 
+#include 
+#include "atmel_sha.h"
+
+#ifdef CONFIG_SHA_HW_ACCEL
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+enum atmel_hash_algos {
+   ATMEL_HASH_SHA1,
+   ATMEL_HASH_SHA256
+};
+
+struct sha_ctx {
+   enum atmel_hash_algos algo;
+   u32 length;
+   u8  buffer[64];
+};
+
+const u8 sha256_der_prefix[SHA256_DER_LEN] = {
+   0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86,
+   0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05,
+   0x00, 0x04, 0x20
+};
+
+const u8 sha1_der_prefix[SHA1_DER_LEN] = {
+   0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e,
+   0x03, 0x02, 0x1a, 0x05, 0x00, 0x04, 0x14
+};
+
+static enum atmel_hash_algos get_hash_type(struct hash_algo *algo)
+{
+   if (!strcmp(algo->name, "sha1"))
+   return ATMEL_HASH_SHA1;
+   else
+   return ATMEL_HASH_SHA256;
+};
+
+static int atmel_sha_process(const u8 *in_addr, u8 buflen)
+{
+   struct atmel_sha *sha = (struct atmel_sha *)ATMEL_BASE_SHA;
+   int i;
+   u32 *addr_buf;
+
+   /* Copy data in */
+   addr_buf = (u32 *)in_addr;
+   for (i = 0; i < (buflen / 4); i++)
+   sha->idatarx[i] = addr_buf[i];
+   debug("Atmel sha, engine is loaded\n");
+
+   /* Wait for hash to complete */
+   while ((readl(>isr) & ATMEL_HASH_ISR_MASK)
+   != ATMEL_HASH_ISR_DATRDY)
+   ;
+   debug("Atmel sha, engine signaled completion\n");
+
+   return 0;
+}
+
+static int atmel_sha_chunk(struct sha_ctx *ctx, const u8 *buf, unsigned int 
size)
+{
+   u8 remaining, fill;
+
+   /* Chunk to 64 byte blocks */
+   remaining = ctx->length & 0x3F;
+   fill = 64 - remaining;
+
+   /* If we have things in the buffer transfer the remaining into it */
+   if (remaining && size >= fill) {
+   memcpy(ctx->buffer + remaining, buf, fill);
+
+   /* Process 64 byte chunk */
+   atmel_sha_process(ctx->buffer, 64);
+
+   size -= fill;
+   buf += fill;
+   ctx->length += fill;
+   remaining = 0;
+   }
+
+   /* We are aligned take from source for any additional */
+   while (size >= 64) {
+   /* Process 64 byte chunk */
+   atmel_sha_process(buf, 64);
+
+   size -= 64;
+   buf += 64;
+   ctx->length += 64;
+   }
+
+   if (size) {
+   memcpy(ctx->buffer + remaining, buf, size);
+   ctx->length += size;
+   }
+
+   return 0;
+}
+
+static int atmel_sha_fill_padding(struct sha_ctx *ctx)
+{
+   unsigned int index, padlen;
+   u64 size, bits;
+   u8 sha256_padding[64] = {
+   0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+   };
+
+   size = ctx->length;
+
+   bits = cpu_to_be64(size << 3);
+
+   /* 64 byte, 512 bit block size */
+   index = ctx->length & 0x3F;
+   padlen = (index < 56) ? (56 - index) : ((64 + 56) - index);
+
+   /* set last entry to be 0x80 then 0's*/
+   atmel_sha_chunk(ctx, sha256_padding, padlen);
+   /* Bolt number of bits to the end */
+   atmel_sha_chunk(ctx, (u8 *), 8);
+
+   if (ctx->length & 0x3F)
+   debug("ERROR, 

[U-Boot] [PATCH 1/2] fit: allow fit to call hardware accelerated hash

2018-05-24 Thread Ben Whitten
Move to calling the abstraction which allows for hardware acceleration.

Signed-off-by: Ben Whitten 
---
 common/image-fit.c | 26 --
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/common/image-fit.c b/common/image-fit.c
index 8c15ed1..01ea864 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -1082,19 +1082,25 @@ int fit_set_timestamp(void *fit, int noffset, time_t 
timestamp)
 int calculate_hash(const void *data, int data_len, const char *algo,
uint8_t *value, int *value_len)
 {
+   struct hash_algo *hash_algo;
+   int ret;
+
+   ret = hash_lookup_algo(algo, _algo);
+   if (ret)
+   return ret;
+
if (IMAGE_ENABLE_CRC32 && strcmp(algo, "crc32") == 0) {
-   *((uint32_t *)value) = crc32_wd(0, data, data_len,
-   CHUNKSZ_CRC32);
-   *((uint32_t *)value) = cpu_to_uimage(*((uint32_t *)value));
-   *value_len = 4;
+   hash_algo->hash_func_ws((unsigned char *)data, data_len,
+   (unsigned char *)value, hash_algo->chunk_size);
+   *value_len = hash_algo->digest_size;
} else if (IMAGE_ENABLE_SHA1 && strcmp(algo, "sha1") == 0) {
-   sha1_csum_wd((unsigned char *)data, data_len,
-(unsigned char *)value, CHUNKSZ_SHA1);
-   *value_len = 20;
+   hash_algo->hash_func_ws((unsigned char *)data, data_len,
+   (unsigned char *)value, hash_algo->chunk_size);
+   *value_len = hash_algo->digest_size;
} else if (IMAGE_ENABLE_SHA256 && strcmp(algo, "sha256") == 0) {
-   sha256_csum_wd((unsigned char *)data, data_len,
-  (unsigned char *)value, CHUNKSZ_SHA256);
-   *value_len = SHA256_SUM_LEN;
+   hash_algo->hash_func_ws((unsigned char *)data, data_len,
+   (unsigned char *)value, hash_algo->chunk_size);
+   *value_len = hash_algo->digest_size;
} else if (IMAGE_ENABLE_MD5 && strcmp(algo, "md5") == 0) {
md5_wd((unsigned char *)data, data_len, value, CHUNKSZ_MD5);
*value_len = 16;
-- 
2.7.4

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


Re: [U-Boot] [PATCH v6 17/18] usb: fastboot: Convert USB f_fastboot to shared fastboot

2018-05-24 Thread Alex Kiernan
Hi Sam

On Tue, May 22, 2018 at 8:16 PM Alex Kiernan  wrote:


> On Tue, May 22, 2018 at 7:41 PM Sam Protsenko 
> wrote:

> > On 22 May 2018 at 18:53, Alex Kiernan  wrote:
> > > On Tue, May 22, 2018 at 4:29 PM Sam Protsenko <
> semen.protse...@linaro.org>
> > > wrote:
> > >
> > >> On 22 May 2018 at 18:21, Sam Protsenko 
> wrote:
> > >> > On 22 May 2018 at 12:23, Alex Kiernan 
wrote:
> > >> >> Convert USB fastboot code to use shared fastboot protocol.
> > >> >>
> > >> >> Signed-off-by: Alex Kiernan 
> > >> >> ---
> > >> >>
> > >> >> Changes in v6:
> > >> >> - merged from RFC USB fastboot series
> > >> >> - when entering the DATA phase ensure we actually install the
> correct
> > > handler
> > >> >> - on completion of DATA call new fastboot_data_complete()
> > >> >> - previous changes:
> > >> >>   - remove redundant version.h
> > >> >>   - use new fastboot_get_bytes_remaining() function
> > >> >
> > >> > Hi Alex,
> > >> >
> > >> > I tested this new patch series (v6) on X15 board, and this patch
> still
> > >> > breaks "fastboot oem format". I see next messages.
> > >> >
> > >> > On host:
> > >> >
> > >> > FAILED (remote: unrecognized command)
> > >> >
> > >> > On device:
> > >> >
> > >> > command oem format not recognized.
> > >> >
> > >> > All other fastboot commands seem to work fine, though. Can you
please
> > >> > look into it? I can help you with testing on my boards, if you are
> > >> > unable to reproduce it. You can prepare GitHub branch for debugging
> > >> > and ask me to check that, I will send you the output.
> > >> >
> > >> > Thanks.
> > >
> > >> Btw, I looked in my .config, and I see that:
> > >
> > >>  # CONFIG_FASTBOOT_CMD_OEM_FORMAT is not set
> > >
> > >> What I think should be done, is in your patch:
> > >
> > >>  fastboot: Add support for 'oem format' command
> > >
> > >> make default=y for FASTBOOT_CMD_OEM_FORMAT. Or add that to all boards
> > >> that use "fastboot oem format". Not sure what is proper way here, but
> > >> defaulting it to "n" (like it's done now) might break a lot of
boards.
> > >
> > > Oh bother... and thank you for testing (again).
> > >
> > > I guess if we enable it on all boards that currently select USB
> fastboot as
> > > part of the patch that merges USB and UDP, then we'll get all existing
> > > boards and don't end up with a default y?
> > >

> > As I see it, the only correct approach in this case is to keep it as
> > it was before. So basically all configs that defined
> > FASTBOOT_FLASH_MMC_DEV option (explicitly or implicitly), should also
> > have FASTBOOT_CMD_OEM_FORMAT enabled.


> Yeah, that's more or less what I've done... I've added it to boards that
> match FASTBOOT_FLASH_MMC_DEV && CMD_GPT (since that's what the
> implementation uses) - there's 37 of them. There's another 7 that have
> FASTBOOT_FLASH_MMC_DEV but don't have CMD_GPT.


Just posted a version which includes these changes (in fact it's the only
change from v6).

It's also here - https://github.com/akiernan/u-boot/tree/us-fastboot-udp-v7

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


[U-Boot] [PATCH v7 01/18] fastboot: Move fastboot to drivers/fastboot

2018-05-24 Thread Alex Kiernan
Separate CMD_FASTBOOT from FASTBOOT and move code and configuration to
drivers/fastboot.

Switch dependencies on FASTBOOT to USB_FUNCTION_FASTBOOT as anyone who wants
FASTBOOT before this series wants USB_FUNCTION_FASTBOOT. Split
USB_FUNCTION_FASTBOOT from FASTBOOT so they retain their existing
behaviour.

Signed-off-by: Alex Kiernan 
Reviewed-by: Simon Glass 
Acked-by: Joe Hershberger 
---

Changes in v7: None
Changes in v6:
- accomodate master change and switch dependency on imx6dl_mamoj from
  FASTBOOT to USB_FUNCTION_FASTBOOT

Changes in v5:
- don't depend on UDP_FUNCTION_FASTBOOT until it exists
- squash in subsequent patch which updates defconfigs so we don't leave users
  of CONFIG_FASTBOOT without it enabled
- fix build in drivers/fastboot when we have CONFIG_FASTBOOT without flash
  or erase and we've not yet added fb_common.c to the build

Changes in v4: None
Changes in v3:
- move imply ANDROID_BOOT_IMAGE, CMD_FASTBOOT to FASTBOOT from
  USB_FUNCTION_FASTBOOT
- add depend on USB_FUNCTION_FASTBOOT to FASTBOOT_USB_DEV
- leave images-sparse.c in common to acommodate 2f83f21

Changes in v2: None

 arch/arm/Kconfig  |  2 --
 board/ti/common/Kconfig   |  1 -
 cmd/Kconfig   | 14 ++--
 common/Makefile   | 15 +---
 configs/am335x_boneblack_defconfig|  2 +-
 configs/am335x_boneblack_vboot_defconfig  |  2 +-
 configs/am335x_evm_defconfig  |  2 +-
 configs/am335x_evm_nor_defconfig  |  2 +-
 configs/am335x_evm_norboot_defconfig  |  2 +-
 configs/am335x_evm_spiboot_defconfig  |  2 +-
 configs/am335x_evm_usbspl_defconfig   |  2 +-
 configs/am57xx_evm_defconfig  |  2 +-
 configs/am57xx_hs_evm_defconfig   |  2 +-
 configs/bcm23550_w1d_defconfig|  2 +-
 configs/bcm28155_ap_defconfig |  2 +-
 configs/birdland_bav335a_defconfig|  2 +-
 configs/birdland_bav335b_defconfig|  2 +-
 configs/cgtqmx6eval_defconfig |  2 +-
 configs/dra7xx_evm_defconfig  |  2 +-
 configs/dra7xx_hs_evm_defconfig   |  2 +-
 configs/imx6dl_mamoj_defconfig|  2 +-
 configs/kc1_defconfig |  2 +-
 configs/mx6qsabrelite_defconfig   |  2 +-
 configs/mx6sabresd_defconfig  |  2 +-
 configs/nitrogen6dl2g_defconfig   |  2 +-
 configs/nitrogen6dl_defconfig |  2 +-
 configs/nitrogen6q2g_defconfig|  2 +-
 configs/nitrogen6q_defconfig  |  2 +-
 configs/nitrogen6s1g_defconfig|  2 +-
 configs/nitrogen6s_defconfig  |  2 +-
 configs/omap3_beagle_defconfig|  2 +-
 configs/omap3_evm_defconfig   |  2 +-
 configs/omap3_logic_defconfig |  2 +-
 configs/sniper_defconfig  |  2 +-
 configs/stih410-b2260_defconfig   |  2 +-
 .../xilinx_zynqmp_zc1751_xm015_dc1_defconfig  |  2 +-
 .../xilinx_zynqmp_zc1751_xm016_dc2_defconfig  |  2 +-
 configs/xilinx_zynqmp_zcu102_rev1_0_defconfig |  2 +-
 configs/xilinx_zynqmp_zcu102_revA_defconfig   |  2 +-
 configs/xilinx_zynqmp_zcu102_revB_defconfig   |  2 +-
 configs/xilinx_zynqmp_zcu106_revA_defconfig   |  2 +-
 drivers/Kconfig   |  2 ++
 drivers/Makefile  |  3 ++
 {cmd => drivers}/fastboot/Kconfig | 35 +++
 drivers/fastboot/Makefile |  8 +
 {common => drivers/fastboot}/fb_mmc.c |  0
 {common => drivers/fastboot}/fb_nand.c|  0
 47 files changed, 75 insertions(+), 79 deletions(-)
 rename {cmd => drivers}/fastboot/Kconfig (88%)
 create mode 100644 drivers/fastboot/Makefile
 rename {common => drivers/fastboot}/fb_mmc.c (100%)
 rename {common => drivers/fastboot}/fb_nand.c (100%)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index d273294afd..e4c4badfbf 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1256,9 +1256,7 @@ config ARCH_ROCKCHIP
select DM_REGULATOR
select ENABLE_ARM_SOC_BOOT0_HOOK
select SPI
-   imply CMD_FASTBOOT
imply DISTRO_DEFAULTS
-   imply FASTBOOT
imply FAT_WRITE
imply USB_FUNCTION_FASTBOOT
imply SPL_SYSRESET
diff --git a/board/ti/common/Kconfig b/board/ti/common/Kconfig
index c21eb8c2d2..b1956b8100 100644
--- a/board/ti/common/Kconfig
+++ b/board/ti/common/Kconfig
@@ -25,7 +25,6 @@ config TI_COMMON_CMD_OPTIONS
imply CMD_EXT2
imply CMD_EXT4
imply CMD_EXT4_WRITE
-   imply CMD_FASTBOOT if FASTBOOT
imply CMD_FAT
imply FAT_WRITE if CMD_FAT
imply CMD_FS_GENERIC
diff --git a/cmd/Kconfig b/cmd/Kconfig
index 38406fcfda..91f6dfef92 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig

[U-Boot] [PATCH v7 17/18] usb: fastboot: Convert USB f_fastboot to shared fastboot

2018-05-24 Thread Alex Kiernan
Convert USB fastboot code to use shared fastboot protocol.

Signed-off-by: Alex Kiernan 
---

Changes in v7:
- set FASTBOOT_CMD_OEM_FORMAT for all existing users of FASTBOOT_FLASH_MMC_DEV
  that also have CMD_GPT

Changes in v6:
- merged from RFC USB fastboot series
- when entering the DATA phase ensure we actually install the correct handler
- on completion of DATA call new fastboot_data_complete()
- previous changes:
  - remove redundant version.h
  - use new fastboot_get_bytes_remaining() function

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 configs/A13-OLinuXino_defconfig   |   1 +
 configs/A20-OLinuXino-Lime2-eMMC_defconfig|   1 +
 configs/A20-OLinuXino-Lime2_defconfig |   1 +
 configs/A20-Olimex-SOM204-EVB-eMMC_defconfig  |   1 +
 configs/A20-Olimex-SOM204-EVB_defconfig   |   1 +
 configs/Bananapi_m2m_defconfig|   1 +
 configs/Cubietruck_defconfig  |   1 +
 configs/Sinlinx_SinA33_defconfig  |   1 +
 configs/am335x_boneblack_defconfig|   7 +-
 configs/am57xx_evm_defconfig  |  13 +-
 configs/am57xx_hs_evm_defconfig   |  13 +-
 configs/chromebit_mickey_defconfig|   5 +-
 configs/chromebook_jerry_defconfig|   5 +-
 configs/chromebook_minnie_defconfig   |   5 +-
 configs/dra7xx_evm_defconfig  |  11 +-
 configs/dra7xx_hs_evm_defconfig   |  11 +-
 configs/evb-rk3036_defconfig  |   5 +-
 configs/evb-rk3128_defconfig  |   9 +-
 configs/evb-rk3229_defconfig  |   5 +-
 configs/evb-rk3288_defconfig  |   5 +-
 configs/evb-rk3328_defconfig  |   7 +-
 configs/fennec-rk3288_defconfig   |   5 +-
 configs/firefly-rk3288_defconfig  |   5 +-
 configs/kylin-rk3036_defconfig|   5 +-
 configs/miqi-rk3288_defconfig |   5 +-
 configs/parrot_r16_defconfig  |   1 +
 configs/phycore-rk3288_defconfig  |   5 +-
 configs/popmetal-rk3288_defconfig |   5 +-
 configs/rock2_defconfig   |   5 +-
 configs/stih410-b2260_defconfig   |  11 +-
 configs/tbs_a711_defconfig|   1 +
 configs/tinker-rk3288_defconfig   |   5 +-
 .../xilinx_zynqmp_zc1751_xm015_dc1_defconfig  |   7 +-
 configs/xilinx_zynqmp_zcu102_rev1_0_defconfig |   7 +-
 configs/xilinx_zynqmp_zcu102_revA_defconfig   |   7 +-
 configs/xilinx_zynqmp_zcu102_revB_defconfig   |   7 +-
 configs/xilinx_zynqmp_zcu106_revA_defconfig   |   7 +-
 drivers/fastboot/Makefile |   4 +-
 drivers/usb/gadget/f_fastboot.c   | 318 ++
 39 files changed, 156 insertions(+), 363 deletions(-)

diff --git a/configs/A13-OLinuXino_defconfig b/configs/A13-OLinuXino_defconfig
index 8e160d7cc4..b8ec1e54db 100644
--- a/configs/A13-OLinuXino_defconfig
+++ b/configs/A13-OLinuXino_defconfig
@@ -22,6 +22,7 @@ CONFIG_CMD_USB_MASS_STORAGE=y
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_PARTITION_UUIDS is not set
 CONFIG_DFU_RAM=y
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_AXP_ALDO3_VOLT=3300
 CONFIG_CONS_INDEX=2
 CONFIG_USB_EHCI_HCD=y
diff --git a/configs/A20-OLinuXino-Lime2-eMMC_defconfig 
b/configs/A20-OLinuXino-Lime2-eMMC_defconfig
index 9d043e856a..5657fc2594 100644
--- a/configs/A20-OLinuXino-Lime2-eMMC_defconfig
+++ b/configs/A20-OLinuXino-Lime2-eMMC_defconfig
@@ -20,6 +20,7 @@ CONFIG_CMD_USB_MASS_STORAGE=y
 # CONFIG_SPL_PARTITION_UUIDS is not set
 CONFIG_SCSI_AHCI=y
 CONFIG_DFU_RAM=y
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_RGMII=y
 CONFIG_SUN7I_GMAC=y
diff --git a/configs/A20-OLinuXino-Lime2_defconfig 
b/configs/A20-OLinuXino-Lime2_defconfig
index f2997c6fe5..134d1d3fef 100644
--- a/configs/A20-OLinuXino-Lime2_defconfig
+++ b/configs/A20-OLinuXino-Lime2_defconfig
@@ -19,6 +19,7 @@ CONFIG_CMD_USB_MASS_STORAGE=y
 # CONFIG_SPL_PARTITION_UUIDS is not set
 CONFIG_SCSI_AHCI=y
 CONFIG_DFU_RAM=y
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_RGMII=y
 CONFIG_SUN7I_GMAC=y
diff --git a/configs/A20-Olimex-SOM204-EVB-eMMC_defconfig 
b/configs/A20-Olimex-SOM204-EVB-eMMC_defconfig
index 847945b649..3bb8c4c7e6 100644
--- a/configs/A20-Olimex-SOM204-EVB-eMMC_defconfig
+++ b/configs/A20-Olimex-SOM204-EVB-eMMC_defconfig
@@ -18,6 +18,7 @@ CONFIG_SPL_I2C_SUPPORT=y
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_PARTITION_UUIDS is not set
 CONFIG_SCSI_AHCI=y
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_PHY_ADDR=3
 CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ90X1=y
diff --git a/configs/A20-Olimex-SOM204-EVB_defconfig 
b/configs/A20-Olimex-SOM204-EVB_defconfig
index e56f2c7110..cfb7ffa556 100644
--- a/configs/A20-Olimex-SOM204-EVB_defconfig
+++ b/configs/A20-Olimex-SOM204-EVB_defconfig
@@ -17,6 +17,7 @@ CONFIG_SPL_I2C_SUPPORT=y
 # CONFIG_SPL_DOS_PARTITION is not set
 # 

[U-Boot] [PATCH v7 00/18] Add fastboot UDP support

2018-05-24 Thread Alex Kiernan

This series merges the fastboot UDP support from AOSP into mainline
U-Boot.

Changes in UDP behaviour from the AOSP code, so it follows the existing USB
behaviour:

- 'boot' now follows the USB code and does 'bootm CONFIG_FASTBOOT_BUF_ADDR'.
  I've added 'fastboot_bootcmd' which if set overrides the boot command and
  allows the existing UDP behaviour to be preserved.
- 'continue' in UDP now exits the fastboot server rather than executing
  'run bootcmd'
- 'reboot-bootloader' no longer writes 'reboot-bootloader' to
  CONFIG_FASTBOOT_BUF_ADDR as its marker for the subsequent boot. The code
  which is in AOSP common/android_bootloader.c expects this marker, but
  we have prior art in the USB code using the weak function
  fastboot_set_reboot_flag
- 'getvar' in the UDP path now supports fetching 'fastboot.' prefixed
  variables (inherited from the USB path), these override the defaults

I've pushed both USB and UDP into a single consolidated protocol layer
now I've tested it on a BeagleBone Green.

Green Travis build: https://travis-ci.org/akiernan/u-boot/builds/383077278

Changes in v7:
- set FASTBOOT_CMD_OEM_FORMAT for all existing users of FASTBOOT_FLASH_MMC_DEV
  that also have CMD_GPT

Changes in v6:
- accomodate master change and switch dependency on imx6dl_mamoj from
  FASTBOOT to USB_FUNCTION_FASTBOOT
- delete redundant FASTBOOT_FLASH_NAND_DEV symbol
- add docbook comments
- add docbook comments
- rename fastboot_download_data() to fastboot_data_download(), rename
  fastboot_get_bytes_remaining() to fastboot_data_remaining()
- split fastboot_data_complete() out from fastboot_data_download() so we
  can call it at the end of the transfer phase for USB
- merged from RFC USB fastboot series
- when entering the DATA phase ensure we actually install the correct handler
- on completion of DATA call new fastboot_data_complete()
- previous changes:
  - remove redundant version.h
  - use new fastboot_get_bytes_remaining() function
- new

Changes in v5:
- don't depend on UDP_FUNCTION_FASTBOOT until it exists
- squash in subsequent patch which updates defconfigs so we don't leave users
  of CONFIG_FASTBOOT without it enabled
- fix build in drivers/fastboot when we have CONFIG_FASTBOOT without flash
  or erase and we've not yet added fb_common.c to the build
- fix docbook formatting
- new
- new
- rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
  and migrate it to Kconfig.
- make fastboot_bytes_received/expected static and add function
  fastboot_get_bytes_remaining()
- move fastboot_buf_addr/fastboot_buf_size/fastboot_progress_callback
  into fastboot-internal.h
- delete redundant fb_ prefixes from statics
- new

Changes in v4:
- add docbook comments
- leave strcmp_l1() in USB fastboot as we don't need it in UDP path
- add docbook comments
- new
- guard fb_getvar/fb_command with UDP_FUNCTION_FASTBOOT in Makefile
- add docbook comments
- remove parameter from fastboot_boot() since we always want
  fastboot_buf_addr (and if we're using fastboot_bootcmd then it's
  ignored)
- split oem format into new patch

Changes in v3:
- move imply ANDROID_BOOT_IMAGE, CMD_FASTBOOT to FASTBOOT from
  USB_FUNCTION_FASTBOOT
- add depend on USB_FUNCTION_FASTBOOT to FASTBOOT_USB_DEV
- leave images-sparse.c in common to acommodate 2f83f21
- refactor for changes in master
- Merge subsequent patch for formatting response strings into this one
- allow NULL to fastboot_okay() when there's no message to send
- guard FASTBOOT_GPT_NAME/FASTBOOT_MBR_NAME with EFI/DOS_PARTITION
- new
- new
- new
- new
- new
- new
- use FASTBOOT as our guard in Kconfig not a list of USB || UDP
- correct mis-translation from AOSP introduced when cleaning up for
  checkpatch - we should write when buffer is not NULL, rather than
  erasing, and erase when buffer is NULL
- use CMD_RET_USAGE from do_fastboot
- remove do_fastboot_udp from cmd/net.c and rewrite using net_loop()
- rename timed_send_info to fastboot_send_info, rename fastboot_send_info to
  fastboot_udp_send_info
- replace FASTBOOT_HEADER_SIZE with sizeof(struct fastboot_header)
- move start time into timed_send_info() rather than passing it in
- make calls to fastboot_udp_send_info a runtime dependency, not a compile
  time one
- set ${filesize} to size of downloaded image
- add progress meter from USB path during download
- add support for 'oem format' command from the USB path
- rename 'fastbootcmd' to 'fastboot_bootcmd' to make clear that this is the
  fastboot boot command
- make getvar implementation table driven
- add fastboot_buf_addr, fastboot_buf_size to override buffer address and
  size
- return correct filesystem type in getvar partition-type on MMC
- process "fastboot." prefixed env variables in getvar first so you
  can override the normal values (this also lets you set a fs type for
  NAND devices)
- squash subsequent patches which change this code into this one:
  - If the fastboot flash/erase commands are disabled, remove that support
so we still 

[U-Boot] [PATCH v7 09/18] fastboot: Extract common definitions from USB fastboot

2018-05-24 Thread Alex Kiernan
Move FASTBOOT_VERSION to include/fastboot.h so when we merge the UDP code
we only have one definition.

Signed-off-by: Alex Kiernan 
Reviewed-by: Simon Glass 
Acked-by: Joe Hershberger 
---

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4:
- leave strcmp_l1() in USB fastboot as we don't need it in UDP path

Changes in v3:
- new

Changes in v2: None

 drivers/usb/gadget/f_fastboot.c | 2 --
 include/fastboot.h  | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 697eee57d0..25784a193e 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -27,8 +27,6 @@
 #include 
 #endif
 
-#define FASTBOOT_VERSION   "0.4"
-
 #define FASTBOOT_INTERFACE_CLASS   0xff
 #define FASTBOOT_INTERFACE_SUB_CLASS   0x42
 #define FASTBOOT_INTERFACE_PROTOCOL0x03
diff --git a/include/fastboot.h b/include/fastboot.h
index 816e71b4d0..bf3d9e2f67 100644
--- a/include/fastboot.h
+++ b/include/fastboot.h
@@ -12,6 +12,8 @@
 #ifndef _FASTBOOT_H_
 #define _FASTBOOT_H_
 
+#define FASTBOOT_VERSION   "0.4"
+
 /* The 64 defined bytes plus \0 */
 #define FASTBOOT_RESPONSE_LEN  (64 + 1)
 
-- 
2.17.0

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


[U-Boot] [PATCH v7 15/18] net: fastboot: Merge AOSP UDP fastboot

2018-05-24 Thread Alex Kiernan
Merge UDP fastboot support from AOSP:

  
https://android.googlesource.com/platform/external/u-boot/+/android-o-mr1-iot-preview-8

Signed-off-by: Alex Kiernan 
Signed-off-by: Alex Deymo 
Signed-off-by: Jocelyn Bohr 
Reviewed-by: Simon Glass 
---

Changes in v7: None
Changes in v6:
- add docbook comments
- rename fastboot_download_data() to fastboot_data_download(), rename
  fastboot_get_bytes_remaining() to fastboot_data_remaining()
- split fastboot_data_complete() out from fastboot_data_download() so we
  can call it at the end of the transfer phase for USB

Changes in v5:
- make fastboot_bytes_received/expected static and add function
  fastboot_get_bytes_remaining()
- move fastboot_buf_addr/fastboot_buf_size/fastboot_progress_callback
  into fastboot-internal.h
- delete redundant fb_ prefixes from statics

Changes in v4:
- guard fb_getvar/fb_command with UDP_FUNCTION_FASTBOOT in Makefile
- add docbook comments
- remove parameter from fastboot_boot() since we always want
  fastboot_buf_addr (and if we're using fastboot_bootcmd then it's
  ignored)
- split oem format into new patch

Changes in v3:
- use FASTBOOT as our guard in Kconfig not a list of USB || UDP
- correct mis-translation from AOSP introduced when cleaning up for
  checkpatch - we should write when buffer is not NULL, rather than
  erasing, and erase when buffer is NULL
- use CMD_RET_USAGE from do_fastboot
- remove do_fastboot_udp from cmd/net.c and rewrite using net_loop()
- rename timed_send_info to fastboot_send_info, rename fastboot_send_info to
  fastboot_udp_send_info
- replace FASTBOOT_HEADER_SIZE with sizeof(struct fastboot_header)
- move start time into timed_send_info() rather than passing it in
- make calls to fastboot_udp_send_info a runtime dependency, not a compile
  time one
- set ${filesize} to size of downloaded image
- add progress meter from USB path during download
- add support for 'oem format' command from the USB path
- rename 'fastbootcmd' to 'fastboot_bootcmd' to make clear that this is the
  fastboot boot command
- make getvar implementation table driven
- add fastboot_buf_addr, fastboot_buf_size to override buffer address and
  size
- return correct filesystem type in getvar partition-type on MMC
- process "fastboot." prefixed env variables in getvar first so you
  can override the normal values (this also lets you set a fs type for
  NAND devices)
- squash subsequent patches which change this code into this one:
  - If the fastboot flash/erase commands are disabled, remove that support
so we still build correctly.
  - Add NAND support to fastboot UDP flash/erase commands
  - If we don't have a partition name passed, report it as not found.
  - Change the behaviour of the fastboot net code such that
"reboot-bootloader" is no longer written to CONFIG_FASTBOOT_BUF_ADDR for
use as a marker on reboot (the AOSP code in common/android-bootloader.c
uses this marker - this code could be reinstated there if that gets
merged).
  - Merge USB and UDP boot code. The USB implementation stays the same, but
UDP no longer passes an fdt. We introduce a new environment variable
'fastboot_bootcmd' which if set overrides the hardcoded boot command,
setting this then allows the UDP implementation to remain the same. If
after running 'fastboot_bootcmd' the board has not booted, control is
returned to U-Boot and the fastboot process ends.
  - Separate the fastboot protocol handling from the fastboot UDP code in
preparation for reusing it in the USB code.

Changes in v2:
- ensure fastboot syntax is backward compatible - 'fastboot 0' means
  'fastboot usb 0'

 cmd/Kconfig   |   4 +-
 cmd/fastboot.c|  91 +-
 drivers/fastboot/Kconfig  |   7 +
 drivers/fastboot/Makefile |   3 +-
 drivers/fastboot/fb_command.c | 302 
 drivers/fastboot/fb_common.c  |  93 ++
 drivers/fastboot/fb_getvar.c  | 230 
 drivers/fastboot/fb_mmc.c |  84 -
 drivers/fastboot/fb_nand.c|  19 +-
 include/fastboot-internal.h   |  36 
 include/fastboot.h| 104 +++
 include/fb_mmc.h  |  18 +-
 include/fb_nand.h |  19 +-
 include/net.h |   2 +-
 include/net/fastboot.h|  21 +++
 net/Makefile  |   1 +
 net/fastboot.c| 317 ++
 net/net.c |   7 +
 18 files changed, 1338 insertions(+), 20 deletions(-)
 create mode 100644 drivers/fastboot/fb_command.c
 create mode 100644 drivers/fastboot/fb_getvar.c
 create mode 100644 include/fastboot-internal.h
 create mode 100644 include/net/fastboot.h
 create mode 100644 net/fastboot.c

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 98763c9108..51fa0dd08a 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -655,8 +655,8 @@ config CMD_FASTBOOT
  This 

[U-Boot] [PATCH v7 16/18] fastboot: Add support for 'oem format' command

2018-05-24 Thread Alex Kiernan
Introduce 'oem format' which matches the USB implementation, guard this
with CONFIG_FASTBOOT_CMD_OEM_FORMAT so that you can configure it out.

Signed-off-by: Alex Kiernan 
Reviewed-by: Simon Glass 
---

Changes in v7: None
Changes in v6: None
Changes in v5:
- new

Changes in v4: None
Changes in v3: None
Changes in v2: None

 drivers/fastboot/Kconfig  |  8 
 drivers/fastboot/fb_command.c | 33 +
 include/fastboot.h|  3 +++
 3 files changed, 44 insertions(+)

diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig
index 625f016600..bc25ea1d9c 100644
--- a/drivers/fastboot/Kconfig
+++ b/drivers/fastboot/Kconfig
@@ -124,6 +124,14 @@ config FASTBOOT_MBR_NAME
  specified on the "fastboot flash" command line matches the value
  defined here. The default target name for updating MBR is "mbr".
 
+config FASTBOOT_CMD_OEM_FORMAT
+   bool "Enable the 'oem format' command"
+   depends on FASTBOOT_FLASH_MMC && CMD_GPT
+   help
+ Add support for the "oem format" command from a client. This
+ relies on the env variable partitions to contain the list of
+ partitions as required by the gpt command.
+
 endif # FASTBOOT
 
 endmenu
diff --git a/drivers/fastboot/fb_command.c b/drivers/fastboot/fb_command.c
index af4f500694..200f9910c5 100644
--- a/drivers/fastboot/fb_command.c
+++ b/drivers/fastboot/fb_command.c
@@ -34,6 +34,9 @@ static void flash(char *, char *);
 static void erase(char *, char *);
 #endif
 static void reboot_bootloader(char *, char *);
+#if CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_FORMAT)
+static void oem_format(char *, char *);
+#endif
 
 static const struct {
const char *command;
@@ -77,6 +80,12 @@ static const struct {
.command = "set_active",
.dispatch = okay
},
+#if CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_FORMAT)
+   [FASTBOOT_COMMAND_OEM_FORMAT] = {
+   .command = "oem format",
+   .dispatch = oem_format,
+   },
+#endif
 };
 
 /**
@@ -300,3 +309,27 @@ static void reboot_bootloader(char *cmd_parameter, char 
*response)
else
fastboot_okay(NULL, response);
 }
+
+#if CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_FORMAT)
+/**
+ * oem_format() - Execute the OEM format command
+ *
+ * @cmd_parameter: Pointer to command parameter
+ * @response: Pointer to fastboot response buffer
+ */
+static void oem_format(char *cmd_parameter, char *response)
+{
+   char cmdbuf[32];
+
+   if (!env_get("partitions")) {
+   fastboot_fail("partitions not set", response);
+   } else {
+   sprintf(cmdbuf, "gpt write mmc %x $partitions",
+   CONFIG_FASTBOOT_FLASH_MMC_DEV);
+   if (run_command(cmdbuf, 0))
+   fastboot_fail("", response);
+   else
+   fastboot_okay(NULL, response);
+   }
+}
+#endif
diff --git a/include/fastboot.h b/include/fastboot.h
index 9a3d5ba693..1933b1d98e 100644
--- a/include/fastboot.h
+++ b/include/fastboot.h
@@ -33,6 +33,9 @@ enum {
FASTBOOT_COMMAND_REBOOT,
FASTBOOT_COMMAND_REBOOT_BOOTLOADER,
FASTBOOT_COMMAND_SET_ACTIVE,
+#if CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_FORMAT)
+   FASTBOOT_COMMAND_OEM_FORMAT,
+#endif
 
FASTBOOT_COMMAND_COUNT
 };
-- 
2.17.0

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


[U-Boot] [PATCH v7 14/18] mmc: Separate "mmc swrite" from fastboot

2018-05-24 Thread Alex Kiernan
Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan 
Acked-by: Jassi Brar 
---

Changes in v7: None
Changes in v6: None
Changes in v5:
- rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
  and migrate it to Kconfig.

Changes in v4:
- new

Changes in v3: None
Changes in v2: None

 cmd/Kconfig|  8 
 cmd/mmc.c  | 12 ++--
 common/Makefile|  1 -
 drivers/fastboot/Kconfig   |  1 +
 lib/Kconfig| 11 +++
 lib/Makefile   |  1 +
 {common => lib}/image-sparse.c |  6 +-
 scripts/config_whitelist.txt   |  1 -
 8 files changed, 28 insertions(+), 13 deletions(-)
 rename {common => lib}/image-sparse.c (97%)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 91f6dfef92..98763c9108 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -826,6 +826,14 @@ config CMD_MMC
help
  MMC memory mapped support.
 
+config CMD_MMC_SWRITE
+   bool "mmc swrite"
+   depends on CMD_MMC && MMC_WRITE
+   select IMAGE_SPARSE
+   help
+ Enable support for the "mmc swrite" command to write Android sparse
+ images to eMMC.
+
 config CMD_NAND
bool "nand"
default y if NAND_SUNXI
diff --git a/cmd/mmc.c b/cmd/mmc.c
index cc445258c0..66c3ee008d 100644
--- a/cmd/mmc.c
+++ b/cmd/mmc.c
@@ -308,8 +308,7 @@ static int do_mmc_read(cmd_tbl_t *cmdtp, int flag,
return (n == cnt) ? CMD_RET_SUCCESS : CMD_RET_FAILURE;
 }
 
-#if CONFIG_IS_ENABLED(MMC_WRITE)
-#if defined(CONFIG_FASTBOOT_FLASH)
+#if CONFIG_IS_ENABLED(CMD_MMC_SWRITE)
 static lbaint_t mmc_sparse_write(struct sparse_storage *info, lbaint_t blk,
 lbaint_t blkcnt, const void *buffer)
 {
@@ -374,6 +373,7 @@ static int do_mmc_sparse_write(cmd_tbl_t *cmdtp, int flag,
 }
 #endif
 
+#if CONFIG_IS_ENABLED(MMC_WRITE)
 static int do_mmc_write(cmd_tbl_t *cmdtp, int flag,
int argc, char * const argv[])
 {
@@ -868,10 +868,10 @@ static cmd_tbl_t cmd_mmc[] = {
U_BOOT_CMD_MKENT(read, 4, 1, do_mmc_read, "", ""),
 #if CONFIG_IS_ENABLED(MMC_WRITE)
U_BOOT_CMD_MKENT(write, 4, 0, do_mmc_write, "", ""),
-#if defined(CONFIG_FASTBOOT_FLASH)
-   U_BOOT_CMD_MKENT(swrite, 3, 0, do_mmc_sparse_write, "", ""),
-#endif
U_BOOT_CMD_MKENT(erase, 3, 0, do_mmc_erase, "", ""),
+#endif
+#if CONFIG_IS_ENABLED(CMD_MMC_SWRITE)
+   U_BOOT_CMD_MKENT(swrite, 3, 0, do_mmc_sparse_write, "", ""),
 #endif
U_BOOT_CMD_MKENT(rescan, 1, 1, do_mmc_rescan, "", ""),
U_BOOT_CMD_MKENT(part, 1, 1, do_mmc_part, "", ""),
@@ -927,7 +927,7 @@ U_BOOT_CMD(
"info - display info of the current MMC device\n"
"mmc read addr blk# cnt\n"
"mmc write addr blk# cnt\n"
-#if defined(CONFIG_FASTBOOT_FLASH)
+#if CONFIG_IS_ENABLED(CMD_MMC_SWRITE)
"mmc swrite addr blk#\n"
 #endif
"mmc erase blk# cnt\n"
diff --git a/common/Makefile b/common/Makefile
index 9ec40b9d27..b3da72ebb2 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -29,7 +29,6 @@ obj-$(CONFIG_CMD_BOOTI) += bootm.o bootm_os.o
 
 obj-$(CONFIG_CMD_BEDBUG) += bedbug.o
 obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += fdt_support.o
-obj-$(CONFIG_FASTBOOT_FLASH) += image-sparse.o
 obj-$(CONFIG_MII) += miiphyutil.o
 obj-$(CONFIG_CMD_MII) += miiphyutil.o
 obj-$(CONFIG_PHYLIB) += miiphyutil.o
diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig
index 1d7caaff99..0c9ced53de 100644
--- a/drivers/fastboot/Kconfig
+++ b/drivers/fastboot/Kconfig
@@ -57,6 +57,7 @@ config FASTBOOT_FLASH
bool "Enable FASTBOOT FLASH command"
default y if ARCH_SUNXI
depends on MMC || (NAND && CMD_MTDPARTS)
+   select IMAGE_SPARSE
help
  The fastboot protocol includes a "flash" command for writing
  the downloaded image to a non-volatile storage device. Define
diff --git a/lib/Kconfig b/lib/Kconfig
index 1590f7afa4..15c6a52d4a 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -61,6 +61,17 @@ config SPL_STRTO
 config TPL_STRTO
bool
 
+config IMAGE_SPARSE
+   bool
+
+config IMAGE_SPARSE_FILLBUF_SIZE
+   hex "Android sparse image CHUNK_TYPE_FILL buffer size"
+   default 0x8
+   depends on IMAGE_SPARSE
+   help
+ Set the size of the fill buffer used when processing CHUNK_TYPE_FILL
+ chunks.
+
 config USE_PRIVATE_LIBGCC
bool "Use private libgcc"
depends on HAVE_PRIVATE_LIBGCC
diff --git a/lib/Makefile b/lib/Makefile
index d531ea54b3..a4bbe2fb48 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -29,6 +29,7 @@ obj-$(CONFIG_FIT) += fdtdec_common.o
 obj-$(CONFIG_TEST_FDTDEC) += 

[U-Boot] [PATCH v7 12/18] fs: Add fs_get_type_name to return current filesystem name

2018-05-24 Thread Alex Kiernan
Add fs_get_type_name so we can get the current filesystem type.

Signed-off-by: Alex Kiernan 
Reviewed-by: Simon Glass 
Reviewed-by: Joe Hershberger 
---

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4:
- add docbook comments

Changes in v3:
- new

Changes in v2: None

 fs/fs.c  | 13 +
 include/fs.h | 10 ++
 2 files changed, 23 insertions(+)

diff --git a/fs/fs.c b/fs/fs.c
index 94cdc37deb..33808d549e 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -265,6 +265,19 @@ static struct fstype_info *fs_get_info(int fstype)
return info;
 }
 
+/**
+ * fs_get_type_name() - Get type of current filesystem
+ *
+ * Return: Pointer to filesystem name
+ *
+ * Returns a string describing the current filesystem, or the sentinel
+ * "unsupported" for any unrecognised filesystem.
+ */
+const char *fs_get_type_name(void)
+{
+   return fs_get_info(fs_type)->name;
+}
+
 int fs_set_blk_dev(const char *ifname, const char *dev_part_str, int fstype)
 {
struct fstype_info *info;
diff --git a/include/fs.h b/include/fs.h
index d703ed5027..163da103b4 100644
--- a/include/fs.h
+++ b/include/fs.h
@@ -37,6 +37,16 @@ int fs_set_blk_dev(const char *ifname, const char 
*dev_part_str, int fstype);
  */
 int fs_set_blk_dev_with_part(struct blk_desc *desc, int part);
 
+/**
+ * fs_get_type_name() - Get type of current filesystem
+ *
+ * Return: Pointer to filesystem name
+ *
+ * Returns a string describing the current filesystem, or the sentinel
+ * "unsupported" for any unrecognised filesystem.
+ */
+const char *fs_get_type_name(void);
+
 /*
  * Print the list of files on the partition previously set by fs_set_blk_dev(),
  * in directory "dirname".
-- 
2.17.0

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


  1   2   >