Re: [U-Boot] [RFC] Make U-Boot log great again

2018-03-22 Thread Bin Meng
Hi,

On Sat, Feb 17, 2018 at 3:49 AM, Robert Nelson  wrote:
> On Fri, Feb 16, 2018 at 1:01 PM, Sam Protsenko
>  wrote:
>> Hi guys,
>>
>> TL;DR This is a suggestion about fixing U-Boot log, which has got
>> worse recently.
>>
>> Right now U-Boot and SPL logs are cluttered with bogus warnings like
>> these (on X15 board, but I'm pretty sure it should appear on many
>> others):
>>
>> Loading Environment from FAT...
>> *** Warning - bad CRC, using default environment
>> Failed (-5)
>

Do we plan to fix this "Failed (-5)" message? It's very confusing.
Like previous U-Boot just printing "*** Warning - bad CRC, using
default environment" is enough I think.

> This one seems to cause the most confusion with end users.  They like
> to think it's a real bug, when in reality, "saveenv" and friends was
> just never run from within u-boot or a separate environment partition
> wasn't pre-programmed.
>
> It's one of those bugs, users asked 10 years ago when the Beagle first
> launched, yet users still ask from time to time..
>
>>
>> Those are the consequences of next commit:
>>
>> fb69464eae1e ("env: Allow to build multiple environments in Kconfig")
>>
>> Because of this commit, I can see following changes in my .config file:
>>
>> +CONFIG_ENV_IS_IN_FAT=y
>> +CONFIG_ENV_FAT_INTERFACE="mmc"
>> +CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
>> +CONFIG_ENV_FAT_FILE="uboot.env"
>>
>> which led U-Boot to try and load the environment from different
>> sources. I agree that it's good thing to do and can be useful, but the
>> problem is that the code for loading the environment wasn't changed to
>> handle errors properly.
>>
>> How I suggest to handle that case:
>>
>>  1. If we have two sources for the environment (e.g. FAT partition on
>> SD card and some raw partition on eMMC), we shouldn't print error
>> messages if we were unable to load the environment from one source
>>  2. We should probably print some human-readable information that we
>> didn't find the environment there, let's skip and look for next source
>> (but don't print those warnings/failed messages)
>>  3. And only print the error message in case when U-Boot environment
>> wasn't found at all (on all possible sources).
>>
>> I don't have enough time to fix this by my own right now. But let's
>> discuss how to approach this issue in a best way possible. And if
>> someone wants to step forward and do that -- would be really nice. If
>> no -- I can look into that later. But let's collect some opinions
>> here, first.
>
> I've also found, when you are dealing with multiple sources, it's nice
> to print "where" you came from.
>
> Otherwise, I've been known to make things way to verbose, but it's
> easier to debug years later, when your adding a new family, or
> overhauling when/how "overlays" are handled...
>

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


Re: [U-Boot] Pull request: u-boot-net.git master

2018-03-22 Thread Tom Rini
On Thu, Mar 22, 2018 at 03:39:39PM -0500, Joe Hershberger wrote:

> Hi Tom,
> 
> The following changes since commit 2511930193a420eb8bb6cfa9c60912626f68ae67:
> 
>   Merge git://git.denx.de/u-boot-mips (2018-03-21 18:58:03 -0400)
> 
> are available in the git repository at:
> 
> 
>   git://git.denx.de/u-boot-net.git master
> 
> for you to fetch changes up to d04791dfa5e14183148c4b966a392de7a9869a10:
> 
>   net: Drop CONFIG_ENC28J60 (2018-03-22 15:05:32 -0500)
> 

Applied to u-boot/master, thanks!

-- 
Tom


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


[U-Boot] [PATCH] omap3: spi: Correct ti, pindir-d0-out-d1-in parsing

2018-03-22 Thread Sjoerd Simons
The ti,pindir-d0-out-d1-in property is not expected to have a value
according to the device-tree binding, so treat it as a boolean not a
uint property.

Signed-off-by: Sjoerd Simons 
---

 drivers/spi/omap3_spi.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/omap3_spi.c b/drivers/spi/omap3_spi.c
index 053a67bbe0..1ac691a68e 100644
--- a/drivers/spi/omap3_spi.c
+++ b/drivers/spi/omap3_spi.c
@@ -630,8 +630,10 @@ static int omap3_spi_probe(struct udevice *dev)
(struct omap2_mcspi_platform_config*)dev_get_driver_data(dev);
 
priv->regs = (struct mcspi *)(devfdt_get_addr(dev) + data->regs_offset);
-   priv->pin_dir = fdtdec_get_uint(blob, node, "ti,pindir-d0-out-d1-in",
-   MCSPI_PINDIR_D0_IN_D1_OUT);
+   if (fdtdec_get_bool(blob, node, "ti,pindir-d0-out-d1-in"))
+   priv->pin_dir = MCSPI_PINDIR_D0_OUT_D1_IN;
+   else
+   priv->pin_dir = MCSPI_PINDIR_D0_IN_D1_OUT;
priv->wordlen = SPI_DEFAULT_WORDLEN;
return 0;
 }
-- 
2.16.2

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


[U-Boot] [PATCH] env: Properly check for BLK support

2018-03-22 Thread Sjoerd Simons
Use CONFIG_IS_ENABLED to see if CONFIG_BLK is enabled. Otherwise
SPL compilation breaks on boards which do have CONFIG_BLK enabled but
not DM_MMC for the SPL as follows:

env/mmc.c: In function ‘init_mmc_for_env’:
env/mmc.c:164:6: warning: implicit declaration of function 
‘blk_get_from_parent’; did you mean ‘efi_get_ram_base’? 
[-Wimplicit-function-declaration]
  if (blk_get_from_parent(mmc->dev, ))
  ^~~
  efi_get_ram_base
env/mmc.c:164:29: error: ‘struct mmc’ has no member named ‘dev’
  if (blk_get_from_parent(mmc->dev, ))
 ^~

Signed-off-by: Sjoerd Simons 
---

 env/mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/env/mmc.c b/env/mmc.c
index 6f11deccb1..bf7015cd14 100644
--- a/env/mmc.c
+++ b/env/mmc.c
@@ -158,7 +158,7 @@ static const char *init_mmc_for_env(struct mmc *mmc)
if (!mmc)
return "!No MMC card found";
 
-#ifdef CONFIG_BLK
+#if CONFIG_IS_ENABLED(BLK)
struct udevice *dev;
 
if (blk_get_from_parent(mmc->dev, ))
-- 
2.16.2

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


[U-Boot] [PATCH 2/3] configs: k2e_hs_evm: Resync defconfig with non-HS defconfig

2018-03-22 Thread Andrew F. Davis
Signed-off-by: Andrew F. Davis 
---
 configs/k2e_hs_evm_defconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/configs/k2e_hs_evm_defconfig b/configs/k2e_hs_evm_defconfig
index a79ce6060f..6224222129 100644
--- a/configs/k2e_hs_evm_defconfig
+++ b/configs/k2e_hs_evm_defconfig
@@ -11,6 +11,7 @@ CONFIG_OF_BOARD_SETUP=y
 # CONFIG_USE_BOOTCOMMAND is not set
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_VERSION_VARIABLE=y
+CONFIG_BOARD_EARLY_INIT_F=y
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_GPIO is not set
 # CONFIG_CMD_GPT is not set
@@ -21,6 +22,8 @@ CONFIG_MTDIDS_DEFAULT="nand0=davinci_nand.0"
 
CONFIG_MTDPARTS_DEFAULT="mtdparts=davinci_nand.0:1024k(bootloader)ro,512k(params)ro,-(ubifs)"
 CONFIG_CMD_UBI=y
 CONFIG_OF_CONTROL=y
+CONFIG_DTB_RESELECT=y
+CONFIG_MULTI_DTB_FIT=y
 CONFIG_ENV_IS_IN_NAND=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM=y
-- 
2.16.2

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


[U-Boot] [PATCH 3/3] configs: k2hk_hs_evm: Resync defconfig with non-HS defconfig

2018-03-22 Thread Andrew F. Davis
Signed-off-by: Andrew F. Davis 
---
 configs/k2hk_hs_evm_defconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/configs/k2hk_hs_evm_defconfig b/configs/k2hk_hs_evm_defconfig
index 09ac21e8f3..1cca0caef8 100644
--- a/configs/k2hk_hs_evm_defconfig
+++ b/configs/k2hk_hs_evm_defconfig
@@ -11,6 +11,7 @@ CONFIG_OF_BOARD_SETUP=y
 # CONFIG_USE_BOOTCOMMAND is not set
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_VERSION_VARIABLE=y
+CONFIG_BOARD_EARLY_INIT_F=y
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_GPIO is not set
 # CONFIG_CMD_GPT is not set
@@ -21,6 +22,8 @@ CONFIG_MTDIDS_DEFAULT="nand0=davinci_nand.0"
 
CONFIG_MTDPARTS_DEFAULT="mtdparts=davinci_nand.0:1024k(bootloader)ro,512k(params)ro,-(ubifs)"
 CONFIG_CMD_UBI=y
 CONFIG_OF_CONTROL=y
+CONFIG_DTB_RESELECT=y
+CONFIG_MULTI_DTB_FIT=y
 CONFIG_ENV_IS_IN_NAND=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM=y
-- 
2.16.2

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


[U-Boot] [PATCH 1/3] configs: k2g_hs_evm: Resync defconfig with non-HS defconfig

2018-03-22 Thread Andrew F. Davis
Signed-off-by: Andrew F. Davis 
---
 configs/k2g_hs_evm_defconfig | 4 
 1 file changed, 4 insertions(+)

diff --git a/configs/k2g_hs_evm_defconfig b/configs/k2g_hs_evm_defconfig
index 5402cd3214..b0c0e08584 100644
--- a/configs/k2g_hs_evm_defconfig
+++ b/configs/k2g_hs_evm_defconfig
@@ -11,6 +11,7 @@ CONFIG_OF_BOARD_SETUP=y
 # CONFIG_USE_BOOTCOMMAND is not set
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_VERSION_VARIABLE=y
+CONFIG_BOARD_EARLY_INIT_F=y
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_GPIO is not set
 # CONFIG_CMD_GPT is not set
@@ -20,6 +21,9 @@ CONFIG_MTDIDS_DEFAULT="nand0=davinci_nand.0"
 
CONFIG_MTDPARTS_DEFAULT="mtdparts=davinci_nand.0:1024k(bootloader)ro,512k(params)ro,-(ubifs)"
 CONFIG_CMD_UBI=y
 CONFIG_OF_CONTROL=y
+CONFIG_OF_LIST="keystone-k2g-generic keystone-k2g-evm keystone-k2g-ice"
+CONFIG_DTB_RESELECT=y
+CONFIG_MULTI_DTB_FIT=y
 CONFIG_DM=y
 # CONFIG_BLK is not set
 CONFIG_DM_MMC=y
-- 
2.16.2

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


Re: [U-Boot] [PATCH] sunxi: Add support for LiNova1 CTP 7" HMI

2018-03-22 Thread Giulio Benetti

Hi,

please drop this patch, I've made confusion on sending.
Sorry

--
Giulio Benetti
CTO

MICRONOVA SRL
Sede: Via A. Niedda 3 - 35010 Vigonza (PD)
Tel. 049/8931563 - Fax 049/8931346
Cod.Fiscale - P.IVA 02663420285
Capitale Sociale € 26.000 i.v.
Iscritta al Reg. Imprese di Padova N. 02663420285
Numero R.E.A. 258642

Il 22/03/2018 21:38, Giulio Benetti ha scritto:

The A20-Linova1-7 HMI, also called Q027_2_F which is printed on production
label, is an industrial Human Machine Interface.
It features:
- 512MB DDR RAM
- 1 Sd-card >= 4GB
- 1 Usb otg(programmable via software) with A-Usb Connector
- 1 Usb host
- 1 Buzzer
- 1 Input for LiPo
- 1 Relay to signal absence of power supply
- 1 External Rtc with 56 bytes of ram + CR2032 battery
- 1 7" 24-bits Tft 800x480 with PCap on
- 1 Mono audio 1-watt amplifier
- 1 RS485 port
- 1 Power On Line through +12Vdc reaching 57.600baud,
   from where it can be supplied and placed in a network of 50 units
- exposed jtag pins

HMI is supplied from +12Vdc.
It comes in different flavours for connector types and can be found with
umounted features as requested by customers.

Signed-off-by: Giulio Benetti 
---
  arch/arm/dts/sun7i-a20-linova1-ctp-7i.dts | 213 ++
  configs/A20-LiNova1-CTP-7i_defconfig  |  32 +
  2 files changed, 245 insertions(+)
  create mode 100644 arch/arm/dts/sun7i-a20-linova1-ctp-7i.dts
  create mode 100644 configs/A20-LiNova1-CTP-7i_defconfig

diff --git a/arch/arm/dts/sun7i-a20-linova1-ctp-7i.dts 
b/arch/arm/dts/sun7i-a20-linova1-ctp-7i.dts
new file mode 100644
index 000..8a0e437
--- /dev/null
+++ b/arch/arm/dts/sun7i-a20-linova1-ctp-7i.dts
@@ -0,0 +1,213 @@
+/*
+ * This is based on sun7i-a20-linova1-ctp-7i.dts
+ *
+ * Copyright 2014 - Hans de Goede 
+ * Copyright (c) 2014 FUKAUMI Naoki 
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "sun7i-a20.dtsi"
+#include "sunxi-common-regulators.dtsi"
+
+#include 
+#include 
+
+/ {
+   model = "Micronova srl LiNova1 CTP 7i";
+   compatible = "micronova,a20-linova1-ctp-7i", "allwinner,sun7i-a20";
+
+   aliases {
+   serial0 = 
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   panel: panel {
+   compatible = "cdtech,s070wv95-ct16", "simple-panel";
+   power-supply = <_vcc3v3>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port@0 {
+   reg = <0>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   panel_input: endpoint@0 {
+   reg = <0>;
+   remote-endpoint = <_out_panel>;
+   };
+   };
+   };
+
+   reserved-memory {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   ranges;
+
+   display_pool: cma {
+   

[U-Boot] [PATCH] sunxi: Add support for LiNova1 CTP 7" HMI

2018-03-22 Thread Giulio Benetti
The A20-Linova1-7 HMI, also called Q027_2_F which is printed on production
label, is an industrial Human Machine Interface.
It features:
- 512MB DDR RAM
- 1 Sd-card >= 4GB
- 1 Usb otg(programmable via software) with A-Usb Connector
- 1 Usb host
- 1 Buzzer
- 1 Input for LiPo
- 1 Relay to signal absence of power supply
- 1 External Rtc with 56 bytes of ram + CR2032 battery
- 1 7" 24-bits Tft 800x480 with PCap on
- 1 Mono audio 1-watt amplifier
- 1 RS485 port
- 1 Power On Line through +12Vdc reaching 57.600baud,
  from where it can be supplied and placed in a network of 50 units
- exposed jtag pins

HMI is supplied from +12Vdc.
It comes in different flavours for connector types and can be found with
umounted features as requested by customers.

Signed-off-by: Giulio Benetti 
---
 arch/arm/dts/sun7i-a20-linova1-ctp-7i.dts | 213 ++
 configs/A20-LiNova1-CTP-7i_defconfig  |  32 +
 2 files changed, 245 insertions(+)
 create mode 100644 arch/arm/dts/sun7i-a20-linova1-ctp-7i.dts
 create mode 100644 configs/A20-LiNova1-CTP-7i_defconfig

diff --git a/arch/arm/dts/sun7i-a20-linova1-ctp-7i.dts 
b/arch/arm/dts/sun7i-a20-linova1-ctp-7i.dts
new file mode 100644
index 000..8a0e437
--- /dev/null
+++ b/arch/arm/dts/sun7i-a20-linova1-ctp-7i.dts
@@ -0,0 +1,213 @@
+/*
+ * This is based on sun7i-a20-linova1-ctp-7i.dts
+ *
+ * Copyright 2014 - Hans de Goede 
+ * Copyright (c) 2014 FUKAUMI Naoki 
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "sun7i-a20.dtsi"
+#include "sunxi-common-regulators.dtsi"
+
+#include 
+#include 
+
+/ {
+   model = "Micronova srl LiNova1 CTP 7i";
+   compatible = "micronova,a20-linova1-ctp-7i", "allwinner,sun7i-a20";
+
+   aliases {
+   serial0 = 
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   panel: panel {
+   compatible = "cdtech,s070wv95-ct16", "simple-panel";
+   power-supply = <_vcc3v3>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port@0 {
+   reg = <0>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   panel_input: endpoint@0 {
+   reg = <0>;
+   remote-endpoint = <_out_panel>;
+   };
+   };
+   };
+
+   reserved-memory {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   ranges;
+
+   display_pool: cma {
+   compatible = "shared-dma-pool";
+   size = <0x800>;
+   alignment = <0x2000>;
+   reusable;
+   linux,cma-default;
+   };
+   };
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins_a>;
+   

Re: [U-Boot] [U-Boot,v4,7/7] test/py: add spi_flash tests

2018-03-22 Thread Tom Rini
On Wed, Mar 14, 2018 at 07:15:16PM -0400, Liam Beguin wrote:

> Add basic tests for the spi_flash subsystem.
> 
> Signed-off-by: Liam Beguin 
> Reviewed-by: Stephen Warren 

With a minor spelling fix, 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] [U-Boot, 2/2] configs: am335x_evm: Increase SPL_SYS_MALLOC_F_LEN to accomodate gpio_devices

2018-03-22 Thread Tom Rini
On Thu, Mar 15, 2018 at 09:11:35PM +0530, Faiz Abbas wrote:

> With gpio devices getting created in SPL, the size of the heap is
> no longer sufficient. Therefore, increase SPL_SYS_MALLOC_F_LEN
> to 0x1000.
> 
> Signed-off-by: Faiz Abbas 
> Reviewed-by: Tom Rini 

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] [U-Boot, 1/2] gpio: omap_gpio: Add DM_FLAG_PRE_RELOC flag

2018-03-22 Thread Tom Rini
On Thu, Mar 15, 2018 at 09:11:34PM +0530, Faiz Abbas wrote:

> With DM enabled in SPL, DM_FLAG_PRE_RELOC is required for
> the omap_gpio driver to be bound to the gpio devices.
> 
> Therefore, add DM_FLAG_PRE_RELOC flag to the omap_gpio driver.
> 
> Signed-off-by: Faiz Abbas 
> Reviewed-by: Tom Rini 

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] [U-Boot,v4,6/7] test/py: add generic CRC32 function

2018-03-22 Thread Tom Rini
On Wed, Mar 14, 2018 at 07:15:15PM -0400, Liam Beguin wrote:

> Add a generic function which can be used to compute the CRC32 value of
> a region of RAM.
> 
> Signed-off-by: Liam Beguin 
> Reviewed-by: Stephen Warren 

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] [U-Boot,2/2] configs: omapl138: Enable DM and DT

2018-03-22 Thread Tom Rini
On Fri, Mar 16, 2018 at 06:52:21PM +0530, Lokesh Vutla wrote:

> Enable Driver Model and Device-tree support for omapl138 board
> in U-Boot. Also enable DM_SERIAL and DM_I2C.
> 
> Signed-off-by: Lokesh Vutla 
> Reviewed-by: Tom Rini 

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] [U-Boot,v2] davinci: Enable DDR_INIT for DA8XX

2018-03-22 Thread Tom Rini
On Fri, Mar 16, 2018 at 02:22:12PM +0530, Lokesh Vutla wrote:

> Commit 6aa4ad8e3820 ("Convert CONFIG_SOC_DA8XX et al to Kconfig")
> converted SOC_DA8XX to Kconfig but missed enabling DDR_INIT for
> SOC_DA8XX, which broke OMAPL138 to boot.
> 
> Commit 2e87980580d0 ("davinci: Fix omapl138_lcdk builds") disabled
> DDR_INIT for all DA850 SoCs. This failed all DA850 boards to boot
> as ddr is not being initialized.
> 
> Enable SYS_DA850_DDR_INIT for DA8XX so that all DA850 and OMAPL138
> will have ddr initialized
> 
> Fixes: 2e87980580d0 ("davinci: Fix omapl138_lcdk builds")
> Fixes: 6aa4ad8e3820 ("Convert CONFIG_SOC_DA8XX et al to Kconfig")
> Reported-by: Sekhar Nori 
> Tested-by: Sekhar Nori 
> Signed-off-by: Lokesh Vutla 
> Reviewed-by: David Lechner 
> Reviewed-by: Tom Rini 

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] scripts/check-config.sh: fix "command not found" error handling

2018-03-22 Thread Tom Rini
On Thu, Mar 15, 2018 at 11:08:56AM +0100, Luca Ceresoli wrote:

> scripts/check-config.sh exits successfully and silently without doing
> any checks when the 'comm' command is not found.
> 
> The problem triggers from the command around line 39:
> 
>   comm -23 ${suspects} ${ok} >${new_adhoc}
> 
> This statement fails when 'comm' is not in $PATH, creating an empty
> ${new_adhoc} file. But the script continues and the following line,
> which is supposed to detect an error:
> 
>   if [ -s ${new_adhoc} ]; then
> 
> will always be false since the file is empty, and the script will exit
> successfully as if everything were OK.
> 
> The case where 'comm' in not in $PATH is not theoretical. It used to
> happen on yocto until a recent fix [0], and still happens on the
> current stable branch (rocko).
> 
> Fix by setting the errexit flag to exit with error when a statement
> fails, so that at least the problem is noticed.
> 
> For additional safety also set the nounset flag to detect expansion
> errors.
> 
> [0] 
> http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=fe0b4cb5b48580d4a3f3c0eb82bfa6f1b13801e4
> 
> Signed-off-by: Luca Ceresoli 
> Reviewed-by: Simon Glass 

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] [U-Boot,v4,2/7] cmd: sf: fix map_physmem check

2018-03-22 Thread Tom Rini
On Wed, Mar 14, 2018 at 07:15:11PM -0400, Liam Beguin wrote:

> Make sure 0x00 is a valid address to read to. If `addr` is 0x00 then
> map_physmem() will return 0 which should be a valid address.
> 
> Signed-off-by: Liam Beguin 
> Reviewed-by: Stephen Warren 

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] [U-Boot, 1/2] ARM: dts: da850-lcdk: Sync from Linux 4.16

2018-03-22 Thread Tom Rini
On Fri, Mar 16, 2018 at 06:52:20PM +0530, Lokesh Vutla wrote:

> Sync dts from Linux 4.16 and also add u-boot specific
> dtsi for OMAPl138 board.
> 
> Signed-off-by: Lokesh Vutla 
> Reviewed-by: Tom Rini 

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] [U-Boot,v4,3/7] test/py: README: fix typo

2018-03-22 Thread Tom Rini
On Wed, Mar 14, 2018 at 07:15:12PM -0400, Liam Beguin wrote:

> Fix a minor typo causing vim (and possibly other) to get confused with
> coloring.
> 
> Signed-off-by: Liam Beguin 
> Reviewed-by: Stephen Warren 

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] [U-Boot, v4, 5/7] test/py: do not import pytest multiple times

2018-03-22 Thread Tom Rini
On Wed, Mar 14, 2018 at 07:15:14PM -0400, Liam Beguin wrote:

> Signed-off-by: Liam Beguin 
> Reviewed-by: Stephen Warren 

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] [U-Boot, v4, 4/7] test/py: README: add HOSTNAME to PYTHONPATH

2018-03-22 Thread Tom Rini
On Wed, Mar 14, 2018 at 07:15:13PM -0400, Liam Beguin wrote:

> As opposed to PATH, HOSTNAME is not appended to PYTHONPATH
> automatically. Lets add it to the examples to make it more
> obvious to new users.
> 
> Signed-off-by: Liam Beguin 
> Reviewed-by: Stephen Warren 

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] davinci: omapl138_lcdk: fix PLL0 frequency

2018-03-22 Thread Tom Rini
On Wed, Mar 14, 2018 at 08:36:30PM -0500, David Lechner wrote:

> commit 1601dd97edc6 ("davinci: omapl138_lcdk: increase PLL0 frequency")
> changed the PLL0 frequency to 456MHz, which is needed for the LCDC IP
> block. However, in doing so, it caused the PLLOUT clock to be outside
> of the allowable specifications given in the OMAP-L138 data sheet. (It
> says PLLOUT must be 600MHz max). It also uses a PLLM value outside of
> the range given in the TRM (it says PLLM must in the range 0 to 0x1f).
> 
> So here is what we have currently:
> 
> PLLOUT = 24 / (0 + 1) * (37 + 1) = 912MHz (out of spec)
>  ^ ^ ^
>CLKIN PREDIVPLLM (out of spec)
> 
> input to PLLDIVn = 912 / (1 + 1) = 456MHz (desired result)
> ^ ^
>  PLLOUT POSTDIV
> 
> This changes the PLLM value to 18 and the POSTDIV value to 0 so that
> PLLOUT is now within specification but we still get the desired
> result.
> 
> PLLOUT = 24 / (0 + 1) * (18 + 1) = 456MHz (within spec)
>  ^ ^ ^
>CLKIN PREDIV PLLM
> 
> input to PLLDIVn = 456 / (0 + 1) = 456MHz (desired result)
> ^ ^
>  PLLOUT POSTDIV
> 
> Fixes: 1601dd97edc6 ("davinci: omapl138_lcdk: increase PLL0 frequency")
> Signed-off-by: David Lechner 
> Reported-by: Sekhar Nori 
> Tested-by: Sekhar Nori 

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] [U-Boot, v4, 1/7] spi: spi_flash: do not fail silently on bad user input

2018-03-22 Thread Tom Rini
On Wed, Mar 14, 2018 at 07:15:10PM -0400, Liam Beguin wrote:

> Make sure the user is notified instead of silently returning an error.
> 
> Signed-off-by: Liam Beguin 
> Reviewed-by: Stephen Warren 

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] tools: Make kwboot build if HOST_TOOLS_ALL=y

2018-03-22 Thread Tom Rini
On Tue, Mar 13, 2018 at 03:23:04PM +0200, Tuomas Tynkkynen wrote:

> The kwboot tool for Marvell devices isn't currently being built even if
> HOST_TOOLS_ALL is set. It doesn't appear to depend on any CONFIG_
> options, so it seems appropriate to enable building it here.
> 
> Signed-off-by: Tuomas Tynkkynen 

Applied to u-boot/master, thanks!

-- 
Tom


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


[U-Boot] Pull request: u-boot-net.git master

2018-03-22 Thread Joe Hershberger
Hi Tom,

The following changes since commit 2511930193a420eb8bb6cfa9c60912626f68ae67:

  Merge git://git.denx.de/u-boot-mips (2018-03-21 18:58:03 -0400)

are available in the git repository at:


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

for you to fetch changes up to d04791dfa5e14183148c4b966a392de7a9869a10:

  net: Drop CONFIG_ENC28J60 (2018-03-22 15:05:32 -0500)


Alexander Graf (2):
  net: Only access network devices after init
  lan7xxx: Require phylib

Calvin Johnson (12):
  drivers: net: phy: Fix aquantia compilation with DM
  drivers: net: pfe_eth: LS1012A PFE driver introduction
  drivers: net: pfe_eth: provide pfe commands
  drivers: net: pfe_eth: LS1012A PFE headers
  board: freescale: ls1012aqds: enable network support on ls1012aqds
  board: freescale: ls1012afrdm: enable network support on ls1012afrdm
  board: freescale: ls1012ardb: enable network support on ls1012ardb
  board: freescale: ls1012a2g5rdb: enable network support on ls1012a2g5rdb
  armv8: fsl-lsch2: add pfe macros and update ccsr_scfg structure
  armv8: fsl-lsch2: configure pfe's DDR and HDBUS interfaces and ECC
  armv8: layerscape: csu: enable ns access to PFE registers
  configs: ls1012a: add pfe configuration for LS1012A

Heinrich Schuchardt (3):
  net: mvpp2x: add check after calloc
  drivers: net: cpsw: remove superfluous assignment.
  net: macb: remove superfluous logical constraint

Leonid Iziumtsev (1):
  net: Fix netretry condition

Prabhakar Kushwaha (1):
  armv8: fsl-layerscape: Add support of GPIO structure

Priyanka Jain (2):
  net/phy/cortina.c: Update get_phy_id implementation
  net/phy/cortina: Add No firmware upload option

Tuomas Tynkkynen (1):
  net: Drop CONFIG_ENC28J60

kev...@freebsd.org (2):
  net: phy: Add PHY_RTL8211E_PINE64_GIGABIT_FIX for realtek phys
  Configs: Use the newly added PHY_RTL8211E_PINE64_GIGABIT_FIX

 arch/arm/cpu/armv8/fsl-layerscape/soc.c|  23 +
 .../include/asm/arch-fsl-layerscape/immap_lsch2.h  |  63 +-
 .../include/asm/arch-fsl-layerscape/ns_access.h|   2 +
 arch/arm/include/asm/arch-fsl-layerscape/soc.h |   3 +
 board/freescale/ls1012afrdm/Kconfig|  29 +
 board/freescale/ls1012afrdm/Makefile   |   1 +
 board/freescale/ls1012afrdm/eth.c  | 124 +++
 board/freescale/ls1012afrdm/ls1012afrdm.c  |   5 -
 board/freescale/ls1012aqds/Kconfig |  45 +
 board/freescale/ls1012aqds/Makefile|   1 +
 board/freescale/ls1012aqds/eth.c   | 309 +++
 board/freescale/ls1012aqds/ls1012aqds.c|  97 +-
 board/freescale/ls1012aqds/ls1012aqds_pfe.h|  45 +
 board/freescale/ls1012aqds/ls1012aqds_qixis.h  |   2 +-
 board/freescale/ls1012ardb/Kconfig |  59 ++
 board/freescale/ls1012ardb/Makefile|   1 +
 board/freescale/ls1012ardb/eth.c   | 135 +++
 board/freescale/ls1012ardb/ls1012ardb.c|   4 -
 configs/ls1012a2g5rdb_qspi_defconfig   |   2 +
 configs/ls1012afrdm_qspi_defconfig |   2 +
 configs/ls1012aqds_qspi_defconfig  |   2 +
 configs/ls1012ardb_qspi_defconfig  |   2 +
 configs/pine64_plus_defconfig  |   2 +
 drivers/net/Kconfig|   1 +
 drivers/net/Makefile   |   2 +-
 drivers/net/cpsw.c |   2 +-
 drivers/net/enc28j60.c | 959 
 drivers/net/enc28j60.h | 238 -
 drivers/net/macb.c |   2 +-
 drivers/net/mvpp2.c|   4 +
 drivers/net/pfe_eth/Kconfig|  12 +
 drivers/net/pfe_eth/Makefile   |  12 +
 drivers/net/pfe_eth/pfe_cmd.c  | 497 ++
 drivers/net/pfe_eth/pfe_driver.c   | 643 +
 drivers/net/pfe_eth/pfe_eth.c  | 297 ++
 drivers/net/pfe_eth/pfe_firmware.c | 230 +
 drivers/net/pfe_eth/pfe_hw.c   | 999 +
 drivers/net/pfe_eth/pfe_mdio.c | 291 ++
 drivers/net/phy/Kconfig|  10 +
 drivers/net/phy/aquantia.c |   1 +
 drivers/net/phy/cortina.c  |  59 +-
 drivers/net/phy/realtek.c  |  34 +
 drivers/usb/eth/Kconfig|   2 +
 include/configs/ls1012a2g5rdb.h|  11 +-
 include/configs/ls1012a_common.h   |   6 +-
 include/configs/ls1012afrdm.h  |   2 +-
 include/configs/ls1012ardb.h   |   6 +-
 include/dm/platform_data/pfe_dm_eth.h  |  21 +
 

Re: [U-Boot] [PATCH] ARC: HSDK: add platform-specific commands

2018-03-22 Thread Alexey Brodkin
Hi Eugeniy,

To start from your patch doesn't apply on u-boot-arc/next:
-->8-
git am \[PATCH\]_ARC\:_HSDK\:_add_platform-specific_commands.mbox
Applying: ARC: HSDK: add platform-specific commands
/home/abrodkin/Projects/sources/git/u-boot/.git/worktrees/tmp-mainline-test/rebase-apply/patch:868:
 space before tab in indent.
: /* no output */
error: patch failed: board/synopsys/hsdk/hsdk.c:1
error: board/synopsys/hsdk/hsdk.c: patch does not apply
Patch failed at 0001 ARC: HSDK: add platform-specific commands
The copy of the patch that failed is found in: 
/home/abrodkin/Projects/sources/git/u-boot/.git/worktrees/tmp-mainline-test/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
# git am --abort 
# git s
On branch staging-arc
Your branch is up-to-date with 'u-boot-arc/next'.

Untracked files:
  (use "git add ..." to include in what will be committed)

[PATCH]_ARC:_HSDK:_add_platform-specific_commands.mbox

nothing added to commit but untracked files present (use "git add" to track)
-->8-

I had to apply it manually, remove stuff related to hsdk.c and rm hsdk.c.
Care to check what's wrong there.
Also patch complained a lot on trailing CRs:
-->8-
(Stripping trailing CRs from patch; use --binary to disable.)
patching file arch/arc/dts/hsdk.dts
(Stripping trailing CRs from patch; use --binary to disable.)
patching file board/synopsys/hsdk/MAINTAINERS
(Stripping trailing CRs from patch; use --binary to disable.)
patching file board/synopsys/hsdk/Makefile
(Stripping trailing CRs from patch; use --binary to disable.)
patching file board/synopsys/hsdk/clk-lib.c
(Stripping trailing CRs from patch; use --binary to disable.)
patching file board/synopsys/hsdk/clk-lib.h
(Stripping trailing CRs from patch; use --binary to disable.)
patching file board/synopsys/hsdk/env-lib.c
(Stripping trailing CRs from patch; use --binary to disable.)
patching file board/synopsys/hsdk/env-lib.h
(Stripping trailing CRs from patch; use --binary to disable.)
patching file board/synopsys/hsdk/hsdk-cmd.c
(Stripping trailing CRs from patch; use --binary to disable.)
-->8-

Also there're obvious extra spaces, did you run checkpatch?
I guess no:
-->8-
total: 5 errors, 65 warnings, 11 checks, 1619 lines checked
-->8-

On Wed, 2018-03-21 at 21:46 +0300, Eugeniy Paltsev wrote:
> Signed-off-by: Eugeniy Paltsev 
> ---
>  arch/arc/dts/hsdk.dts   |  56 +++
>  board/synopsys/hsdk/MAINTAINERS |   6 +-
>  board/synopsys/hsdk/Makefile|   4 +-
>  board/synopsys/hsdk/clk-lib.c   |  68 +++
>  board/synopsys/hsdk/clk-lib.h   |  17 +
>  board/synopsys/hsdk/env-lib.c   | 295 
>  board/synopsys/hsdk/env-lib.h   |  51 ++
>  board/synopsys/hsdk/hsdk-cmd.c  | 995 
> 
>  board/synopsys/hsdk/hsdk.c  |  95 
>  configs/hsdk_defconfig  |  15 +
>  include/configs/hsdk.h  |  38 +-
>  11 files changed, 1538 insertions(+), 102 deletions(-)
>  create mode 100644 board/synopsys/hsdk/clk-lib.c
>  create mode 100644 board/synopsys/hsdk/clk-lib.h
>  create mode 100644 board/synopsys/hsdk/env-lib.c
>  create mode 100644 board/synopsys/hsdk/env-lib.h
>  create mode 100644 board/synopsys/hsdk/hsdk-cmd.c
>  delete mode 100644 board/synopsys/hsdk/hsdk.c
> 
> diff --git a/arch/arc/dts/hsdk.dts b/arch/arc/dts/hsdk.dts
> index 67dfb93ca8..d9151ed646 100644
> --- a/arch/arc/dts/hsdk.dts
> +++ b/arch/arc/dts/hsdk.dts
> @@ -6,6 +6,7 @@
>  /dts-v1/;
>  
>  #include "skeleton.dtsi"
> +#include "dt-bindings/clock/snps,hsdk-cgu.h"
>  
>  / {
>   #address-cells = <1>;
> @@ -13,6 +14,7 @@
>  
>   aliases {
>   console = 
> + spi0 = "/spi@f002";

Maybe spi0 = ?

...
spi0: spi@f002 {
...

>   };
>  
>   cpu_card {
> @@ -24,6 +26,35 @@
>   };
>   };
>  
> + clk-fmeas {
> + clocks = <_clk CLK_ARC_PLL>, <_clk CLK_SYS_PLL>,
> +  <_clk CLK_TUN_PLL>, <_clk CLK_DDR_PLL>,
> +  <_clk CLK_ARC>, <_clk CLK_HDMI_PLL>,
> +  <_clk CLK_TUN_TUN>, <_clk CLK_HDMI>,
> +  <_clk CLK_SYS_APB>, <_clk CLK_SYS_AXI>,
> +  <_clk CLK_SYS_ETH>, <_clk CLK_SYS_USB>,
> +  <_clk CLK_SYS_SDIO>, <_clk CLK_SYS_HDMI>,
> +  <_clk CLK_SYS_GFX_CORE>, <_clk 
> CLK_SYS_GFX_DMA>,
> +  <_clk CLK_SYS_GFX_CFG>, <_clk 
> 

[U-Boot] [PATCH v2 13/17] cpu: bmips: convert to use live dt

2018-03-22 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 drivers/cpu/bmips_cpu.c | 12 +++-
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/cpu/bmips_cpu.c b/drivers/cpu/bmips_cpu.c
index 6c612bacdc..f766be22e6 100644
--- a/drivers/cpu/bmips_cpu.c
+++ b/drivers/cpu/bmips_cpu.c
@@ -14,8 +14,6 @@
 #include 
 #include 
 
-DECLARE_GLOBAL_DATA_PTR;
-
 #define REV_CHIPID_SHIFT   16
 #define REV_CHIPID_MASK(0x << REV_CHIPID_SHIFT)
 #define REV_LONG_CHIPID_SHIFT  12
@@ -398,8 +396,7 @@ int bmips_cpu_bind(struct udevice *dev)
 {
struct cpu_platdata *plat = dev_get_parent_platdata(dev);
 
-   plat->cpu_id = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
-   "reg", -1);
+   plat->cpu_id = dev_read_u32_default(dev, "reg", -1);
plat->device_id = read_c0_prid();
 
return 0;
@@ -410,14 +407,11 @@ int bmips_cpu_probe(struct udevice *dev)
struct bmips_cpu_priv *priv = dev_get_priv(dev);
const struct bmips_cpu_hw *hw =
(const struct bmips_cpu_hw *)dev_get_driver_data(dev);
-   fdt_addr_t addr;
-   fdt_size_t size;
 
-   addr = devfdt_get_addr_size_index(dev_get_parent(dev), 0, );
-   if (addr == FDT_ADDR_T_NONE)
+   priv->regs = dev_remap_addr(dev);
+   if (!priv->regs)
return -EINVAL;
 
-   priv->regs = ioremap(addr, size);
priv->hw = hw;
 
return 0;
-- 
2.11.0

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


[U-Boot] [PATCH v2 14/17] phy: bcm6348-usbh: convert to use live dt

2018-03-22 Thread Álvaro Fernández Rojas
Also fix bad accents in my name.

Signed-off-by: Álvaro Fernández Rojas 
---
 drivers/phy/bcm6348-usbh-phy.c | 10 +++---
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/phy/bcm6348-usbh-phy.c b/drivers/phy/bcm6348-usbh-phy.c
index 169ee0ecec..a0134c3e43 100644
--- a/drivers/phy/bcm6348-usbh-phy.c
+++ b/drivers/phy/bcm6348-usbh-phy.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2018 Álvaro Fernández Rojas 
+ * Copyright (C) 2018 Álvaro Fernández Rojas 
  *
  * Derived from linux/arch/mips/bcm63xx/usb-common.c:
  * Copyright 2008 Maxime Bizon 
@@ -45,16 +45,12 @@ static int bcm6348_usbh_probe(struct udevice *dev)
struct bcm6348_usbh_priv *priv = dev_get_priv(dev);
struct reset_ctl rst_ctl;
struct clk clk;
-   fdt_addr_t addr;
-   fdt_size_t size;
int ret;
 
-   addr = devfdt_get_addr_size_index(dev, 0, );
-   if (addr == FDT_ADDR_T_NONE)
+   priv->regs = dev_remap_addr(dev);
+   if (!priv->regs)
return -EINVAL;
 
-   priv->regs = ioremap(addr, size);
-
/* enable usbh clock */
ret = clk_get_by_name(dev, "usbh", );
if (ret < 0)
-- 
2.11.0

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


[U-Boot] [PATCH v2 04/17] clk: bcm6345: convert to use live dt

2018-03-22 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
Reviewed-by: Simon Glass 
---
 v2: Introduce changes suggested by Daniel Schwierzeck:
  - Use generic dev_remap_addr function.

 drivers/clk/clk_bcm6345.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/clk/clk_bcm6345.c b/drivers/clk/clk_bcm6345.c
index 93603fa825..7c31ca325e 100644
--- a/drivers/clk/clk_bcm6345.c
+++ b/drivers/clk/clk_bcm6345.c
@@ -56,15 +56,11 @@ static const struct udevice_id bcm6345_clk_ids[] = {
 static int bcm63xx_clk_probe(struct udevice *dev)
 {
struct bcm6345_clk_priv *priv = dev_get_priv(dev);
-   fdt_addr_t addr;
-   fdt_size_t size;
 
-   addr = devfdt_get_addr_size_index(dev, 0, );
-   if (addr == FDT_ADDR_T_NONE)
+   priv->regs = dev_remap_addr(dev);
+   if (!priv->regs)
return -EINVAL;
 
-   priv->regs = ioremap(addr, size);
-
return 0;
 }
 
-- 
2.11.0

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


[U-Boot] [PATCH v2 17/17] phy: bcm6318-usbh: convert to use live dt

2018-03-22 Thread Álvaro Fernández Rojas
Also fix bad accents in my name.

Signed-off-by: Álvaro Fernández Rojas 
---
 drivers/phy/bcm6318-usbh-phy.c | 10 +++---
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/phy/bcm6318-usbh-phy.c b/drivers/phy/bcm6318-usbh-phy.c
index 6d54214581..043d8ff842 100644
--- a/drivers/phy/bcm6318-usbh-phy.c
+++ b/drivers/phy/bcm6318-usbh-phy.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2018 Álvaro Fernández Rojas 
+ * Copyright (C) 2018 Álvaro Fernández Rojas 
  *
  * Derived from linux/arch/mips/bcm63xx/usb-common.c:
  * Copyright 2008 Maxime Bizon 
@@ -80,16 +80,12 @@ static int bcm6318_usbh_probe(struct udevice *dev)
struct power_domain pwr_dom;
struct reset_ctl rst_ctl;
struct clk clk;
-   fdt_addr_t addr;
-   fdt_size_t size;
int ret;
 
-   addr = devfdt_get_addr_size_index(dev, 0, );
-   if (addr == FDT_ADDR_T_NONE)
+   priv->regs = dev_remap_addr(dev);
+   if (!priv->regs)
return -EINVAL;
 
-   priv->regs = ioremap(addr, size);
-
/* enable usbh clock */
ret = clk_get_by_name(dev, "usbh", );
if (ret < 0)
-- 
2.11.0

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


[U-Boot] [PATCH v2 12/17] ram: bmips: convert to use live dt

2018-03-22 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
Reviewed-by: Simon Glass 
---
 v2: Introduce changes suggested by Daniel Schwierzeck:
  - Use generic dev_remap_addr function.

 drivers/ram/bmips_ram.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/ram/bmips_ram.c b/drivers/ram/bmips_ram.c
index 7a5dfac4ab..22b08715a5 100644
--- a/drivers/ram/bmips_ram.c
+++ b/drivers/ram/bmips_ram.c
@@ -151,14 +151,11 @@ static int bmips_ram_probe(struct udevice *dev)
struct bmips_ram_priv *priv = dev_get_priv(dev);
const struct bmips_ram_hw *hw =
(const struct bmips_ram_hw *)dev_get_driver_data(dev);
-   fdt_addr_t addr;
-   fdt_size_t size;
 
-   addr = devfdt_get_addr_size_index(dev, 0, );
-   if (addr == FDT_ADDR_T_NONE)
+   priv->regs = dev_remap_addr(dev);
+   if (!priv->regs)
return -EINVAL;
 
-   priv->regs = ioremap(addr, size);
priv->hw = hw;
 
return 0;
-- 
2.11.0

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


[U-Boot] [PATCH v2 10/17] spi: bcm63xx_spi: convert to use live dt

2018-03-22 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
Reviewed-by: Simon Glass 
---
 v2: Introduce changes suggested by Daniel Schwierzeck and Simon Glass:
  - Use generic dev_remap_addr function.
  - Fix bcm63xx_spi conversion.

 drivers/spi/bcm63xx_spi.c | 12 +++-
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/spi/bcm63xx_spi.c b/drivers/spi/bcm63xx_spi.c
index f0df6871d8..c61c5d49b4 100644
--- a/drivers/spi/bcm63xx_spi.c
+++ b/drivers/spi/bcm63xx_spi.c
@@ -16,8 +16,6 @@
 #include 
 #include 
 
-DECLARE_GLOBAL_DATA_PTR;
-
 /* BCM6348 SPI core */
 #define SPI_6348_CLK   0x06
 #define SPI_6348_CMD   0x00
@@ -374,18 +372,14 @@ static int bcm63xx_spi_probe(struct udevice *dev)
(const unsigned long *)dev_get_driver_data(dev);
struct reset_ctl rst_ctl;
struct clk clk;
-   fdt_addr_t addr;
-   fdt_size_t size;
int ret;
 
-   addr = devfdt_get_addr_size_index(dev, 0, );
-   if (addr == FDT_ADDR_T_NONE)
+   priv->base = dev_remap_addr(dev);
+   if (!priv->base)
return -EINVAL;
 
priv->regs = regs;
-   priv->base = ioremap(addr, size);
-   priv->num_cs = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
-  "num-cs", 8);
+   priv->num_cs = dev_read_u32_default(dev, "num-cs", 8);
 
/* enable clock */
ret = clk_get_by_index(dev, 0, );
-- 
2.11.0

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


[U-Boot] [PATCH v2 09/17] power: domain: bcm6328: convert to use live dt

2018-03-22 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
Reviewed-by: Simon Glass 
---
 v2: Introduce changes suggested by Daniel Schwierzeck:
  - Use generic dev_remap_addr function.

 drivers/power/domain/bcm6328-power-domain.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/power/domain/bcm6328-power-domain.c 
b/drivers/power/domain/bcm6328-power-domain.c
index 776afa3d43..6a64f6bb2c 100644
--- a/drivers/power/domain/bcm6328-power-domain.c
+++ b/drivers/power/domain/bcm6328-power-domain.c
@@ -49,15 +49,11 @@ static int bcm6328_power_domain_off(struct power_domain 
*power_domain)
 static int bcm6328_power_domain_probe(struct udevice *dev)
 {
struct bcm6328_power_domain *priv = dev_get_priv(dev);
-   fdt_addr_t addr;
-   fdt_size_t size;
 
-   addr = devfdt_get_addr_size_index(dev, 0, );
-   if (addr == FDT_ADDR_T_NONE)
+   priv->regs = dev_remap_addr(dev);
+   if (!priv->regs)
return -EINVAL;
 
-   priv->regs = ioremap(addr, size);
-
return 0;
 }
 
-- 
2.11.0

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


[U-Boot] [PATCH v2 15/17] phy: bcm6358-usbh: convert to use live dt

2018-03-22 Thread Álvaro Fernández Rojas
Also fix bad accents in my name.

Signed-off-by: Álvaro Fernández Rojas 
---
 drivers/phy/bcm6358-usbh-phy.c | 10 +++---
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/phy/bcm6358-usbh-phy.c b/drivers/phy/bcm6358-usbh-phy.c
index e000316a93..00637ece51 100644
--- a/drivers/phy/bcm6358-usbh-phy.c
+++ b/drivers/phy/bcm6358-usbh-phy.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2018 Álvaro Fernández Rojas 
+ * Copyright (C) 2018 Álvaro Fernández Rojas 
  *
  * Derived from linux/arch/mips/bcm63xx/usb-common.c:
  * Copyright 2008 Maxime Bizon 
@@ -58,16 +58,12 @@ static int bcm6358_usbh_probe(struct udevice *dev)
 {
struct bcm6358_usbh_priv *priv = dev_get_priv(dev);
struct reset_ctl rst_ctl;
-   fdt_addr_t addr;
-   fdt_size_t size;
int ret;
 
-   addr = devfdt_get_addr_size_index(dev, 0, );
-   if (addr == FDT_ADDR_T_NONE)
+   priv->regs = dev_remap_addr(dev);
+   if (!priv->regs)
return -EINVAL;
 
-   priv->regs = ioremap(addr, size);
-
/* perform reset */
ret = reset_get_by_index(dev, 0, _ctl);
if (ret < 0)
-- 
2.11.0

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


[U-Boot] [PATCH v2 11/17] spi: bcm63xx_hsspi: convert to use live dt

2018-03-22 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
Reviewed-by: Simon Glass 
---
 v2: Introduce changes suggested by Daniel Schwierzeck:
  - Use generic dev_remap_addr function.

 drivers/spi/bcm63xx_hsspi.c | 12 +++-
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/spi/bcm63xx_hsspi.c b/drivers/spi/bcm63xx_hsspi.c
index 3393166a1e..a4eecc9b19 100644
--- a/drivers/spi/bcm63xx_hsspi.c
+++ b/drivers/spi/bcm63xx_hsspi.c
@@ -16,8 +16,6 @@
 #include 
 #include 
 
-DECLARE_GLOBAL_DATA_PTR;
-
 #define HSSPI_PP   0
 
 #define SPI_MAX_SYNC_CLOCK 3000
@@ -338,17 +336,13 @@ static int bcm63xx_hsspi_probe(struct udevice *dev)
struct bcm63xx_hsspi_priv *priv = dev_get_priv(dev);
struct reset_ctl rst_ctl;
struct clk clk;
-   fdt_addr_t addr;
-   fdt_size_t size;
int ret;
 
-   addr = devfdt_get_addr_size_index(dev, 0, );
-   if (addr == FDT_ADDR_T_NONE)
+   priv->regs = dev_remap_addr(dev);
+   if (!priv->regs)
return -EINVAL;
 
-   priv->regs = ioremap(addr, size);
-   priv->num_cs = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
-  "num-cs", 8);
+   priv->num_cs = dev_read_u32_default(dev, "num-cs", 8);
 
/* enable clock */
ret = clk_get_by_name(dev, "hsspi", );
-- 
2.11.0

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


[U-Boot] [PATCH v2 02/17] watchdog: bcm6345: convert to use live dt

2018-03-22 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 v2: Introduce changes suggested by Daniel Schwierzeck:
  - Use generic dev_remap_addr function.

 drivers/watchdog/bcm6345_wdt.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/watchdog/bcm6345_wdt.c b/drivers/watchdog/bcm6345_wdt.c
index 3ef7d438a6..2e33b24331 100644
--- a/drivers/watchdog/bcm6345_wdt.c
+++ b/drivers/watchdog/bcm6345_wdt.c
@@ -86,15 +86,11 @@ static const struct udevice_id bcm6345_wdt_ids[] = {
 static int bcm6345_wdt_probe(struct udevice *dev)
 {
struct bcm6345_wdt_priv *priv = dev_get_priv(dev);
-   fdt_addr_t addr;
-   fdt_size_t size;
 
-   addr = devfdt_get_addr_size_index(dev, 0, );
-   if (addr == FDT_ADDR_T_NONE)
+   priv->regs = dev_remap_addr(dev);
+   if (!priv->regs)
return -EINVAL;
 
-   priv->regs = ioremap(addr, size);
-
bcm6345_wdt_stop(dev);
 
return 0;
-- 
2.11.0

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


[U-Boot] [PATCH v2 16/17] phy: bcm6368-usbh: convert to use live dt

2018-03-22 Thread Álvaro Fernández Rojas
Also fix bad accents in my name.

Signed-off-by: Álvaro Fernández Rojas 
---
 drivers/phy/bcm6368-usbh-phy.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/phy/bcm6368-usbh-phy.c b/drivers/phy/bcm6368-usbh-phy.c
index 71abc0fcc4..2c4288c9b8 100644
--- a/drivers/phy/bcm6368-usbh-phy.c
+++ b/drivers/phy/bcm6368-usbh-phy.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2018 Álvaro Fernández Rojas 
+ * Copyright (C) 2018 Álvaro Fernández Rojas 
  *
  * Derived from linux/arch/mips/bcm63xx/usb-common.c:
  * Copyright 2008 Maxime Bizon 
@@ -117,15 +117,12 @@ static int bcm6368_usbh_probe(struct udevice *dev)
 #endif
struct reset_ctl rst_ctl;
struct clk clk;
-   fdt_addr_t addr;
-   fdt_size_t size;
int ret;
 
-   addr = devfdt_get_addr_size_index(dev, 0, );
-   if (addr == FDT_ADDR_T_NONE)
+   priv->regs = dev_remap_addr(dev);
+   if (!priv->regs)
return -EINVAL;
 
-   priv->regs = ioremap(addr, size);
priv->hw = hw;
 
/* enable usbh clock */
-- 
2.11.0

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


[U-Boot] [PATCH v2 06/17] gpio: bcm6345: convert to use live dt

2018-03-22 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
Reviewed-by: Simon Glass 
---
 v2: Introduce changes suggested by Daniel Schwierzeck:
  - Use generic dev_remap_addr_index function.

 drivers/gpio/bcm6345_gpio.c | 18 +-
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/drivers/gpio/bcm6345_gpio.c b/drivers/gpio/bcm6345_gpio.c
index b9100cdc58..847b6ca076 100644
--- a/drivers/gpio/bcm6345_gpio.c
+++ b/drivers/gpio/bcm6345_gpio.c
@@ -14,8 +14,6 @@
 #include 
 #include 
 
-DECLARE_GLOBAL_DATA_PTR;
-
 struct bcm6345_gpio_priv {
void __iomem *reg_dirout;
void __iomem *reg_data;
@@ -91,22 +89,16 @@ static int bcm6345_gpio_probe(struct udevice *dev)
 {
struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
struct bcm6345_gpio_priv *priv = dev_get_priv(dev);
-   fdt_addr_t data_addr, dirout_addr;
-   fdt_size_t data_size, dirout_size;
 
-   dirout_addr = devfdt_get_addr_size_index(dev, 0, _size);
-   if (dirout_addr == FDT_ADDR_T_NONE)
+   priv->reg_dirout = dev_remap_addr_index(dev, 0);
+   if (!priv->reg_dirout)
return -EINVAL;
 
-   data_addr = devfdt_get_addr_size_index(dev, 1, _size);
-   if (data_addr == FDT_ADDR_T_NONE)
+   priv->reg_data = dev_remap_addr_index(dev, 1);
+   if (!priv->reg_data)
return -EINVAL;
 
-   priv->reg_data = ioremap(data_addr, data_size);
-   priv->reg_dirout = ioremap(dirout_addr, dirout_size);
-
-   uc_priv->gpio_count = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
- "ngpios", 32);
+   uc_priv->gpio_count = dev_read_u32_default(dev, "ngpios", 32);
uc_priv->bank_name = dev->name;
 
return 0;
-- 
2.11.0

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


[U-Boot] [PATCH v2 07/17] led: bcm6358: convert to use live dt

2018-03-22 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 v2: Introduce changes suggested by Daniel Schwierzeck:
  - Use generic dev_remap_addr function.

 drivers/led/led_bcm6358.c | 44 +++-
 1 file changed, 15 insertions(+), 29 deletions(-)

diff --git a/drivers/led/led_bcm6358.c b/drivers/led/led_bcm6358.c
index e8a3b64e68..86ec7aba75 100644
--- a/drivers/led/led_bcm6358.c
+++ b/drivers/led/led_bcm6358.c
@@ -32,8 +32,6 @@
 #define LED_CTRL_BUSY_SHIFT3
 #define LED_CTRL_BUSY_MASK (1 << LED_CTRL_BUSY_SHIFT)
 
-DECLARE_GLOBAL_DATA_PTR;
-
 struct bcm6358_led_priv {
void __iomem *regs;
uint8_t pin;
@@ -115,8 +113,6 @@ static const struct led_ops bcm6358_led_ops = {
 static int bcm6358_led_probe(struct udevice *dev)
 {
struct led_uc_plat *uc_plat = dev_get_uclass_platdata(dev);
-   fdt_addr_t addr;
-   fdt_size_t size;
 
/* Top-level LED node */
if (!uc_plat->label) {
@@ -124,17 +120,14 @@ static int bcm6358_led_probe(struct udevice *dev)
unsigned int clk_div;
u32 set_bits = 0;
 
-   addr = devfdt_get_addr_size_index(dev, 0, );
-   if (addr == FDT_ADDR_T_NONE)
+   regs = dev_remap_addr(dev);
+   if (!regs)
return -EINVAL;
 
-   regs = ioremap(addr, size);
-
-   if (fdtdec_get_bool(gd->fdt_blob, dev_of_offset(dev),
-   "brcm,clk-dat-low"))
+   if (dev_read_bool(dev, "brcm,clk-dat-low"))
set_bits |= LED_CTRL_POL_MASK;
-   clk_div = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
- "brcm,clk-div", LED_CTRL_CLK_1);
+   clk_div = dev_read_u32_default(dev, "brcm,clk-div",
+  LED_CTRL_CLK_1);
switch (clk_div) {
case 8:
set_bits |= LED_CTRL_CLK_8;
@@ -158,21 +151,17 @@ static int bcm6358_led_probe(struct udevice *dev)
struct bcm6358_led_priv *priv = dev_get_priv(dev);
unsigned int pin;
 
-   addr = devfdt_get_addr_size_index(dev_get_parent(dev), 0,
- );
-   if (addr == FDT_ADDR_T_NONE)
+   priv->regs = dev_remap_addr(dev);
+   if (!priv->regs)
return -EINVAL;
 
-   pin = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev), "reg",
- LEDS_MAX);
+   pin = dev_read_u32_default(dev, "reg", LEDS_MAX);
if (pin >= LEDS_MAX)
return -EINVAL;
 
-   priv->regs = ioremap(addr, size);
priv->pin = pin;
 
-   if (fdtdec_get_bool(gd->fdt_blob, dev_of_offset(dev),
-   "active-low"))
+   if (dev_read_bool(dev, "active-low"))
priv->active_low = true;
}
 
@@ -181,27 +170,24 @@ static int bcm6358_led_probe(struct udevice *dev)
 
 static int bcm6358_led_bind(struct udevice *parent)
 {
-   const void *blob = gd->fdt_blob;
-   int node;
+   ofnode node;
 
-   for (node = fdt_first_subnode(blob, dev_of_offset(parent));
-node > 0;
-node = fdt_next_subnode(blob, node)) {
+   dev_for_each_subnode(node, parent) {
struct led_uc_plat *uc_plat;
struct udevice *dev;
const char *label;
int ret;
 
-   label = fdt_getprop(blob, node, "label", NULL);
+   label = ofnode_read_string(node, "label");
if (!label) {
debug("%s: node %s has no label\n", __func__,
- fdt_get_name(blob, node, NULL));
+ ofnode_get_name(node));
return -EINVAL;
}
 
ret = device_bind_driver_to_node(parent, "bcm6358-led",
-fdt_get_name(blob, node, NULL),
-offset_to_ofnode(node), );
+ofnode_get_name(node),
+node, );
if (ret)
return ret;
 
-- 
2.11.0

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


[U-Boot] [PATCH v2 05/17] reset: bcm6345: convert to use live dt

2018-03-22 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
Reviewed-by: Simon Glass 
---
 v2: Introduce changes suggested by Daniel Schwierzeck:
  - Use generic dev_remap_addr function.

 drivers/reset/reset-bcm6345.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/reset/reset-bcm6345.c b/drivers/reset/reset-bcm6345.c
index ebf6bee9e6..fb9978a116 100644
--- a/drivers/reset/reset-bcm6345.c
+++ b/drivers/reset/reset-bcm6345.c
@@ -67,15 +67,11 @@ static const struct udevice_id bcm6345_reset_ids[] = {
 static int bcm6345_reset_probe(struct udevice *dev)
 {
struct bcm6345_reset_priv *priv = dev_get_priv(dev);
-   fdt_addr_t addr;
-   fdt_size_t size;
 
-   addr = devfdt_get_addr_size_index(dev, 0, );
-   if (addr == FDT_ADDR_T_NONE)
+   priv->regs = dev_remap_addr(dev);
+   if (!priv->regs)
return -EINVAL;
 
-   priv->regs = ioremap(addr, size);
-
return 0;
 }
 
-- 
2.11.0

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


[U-Boot] [PATCH v2 03/17] serial: bcm6345: convert to use live dt

2018-03-22 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
Reviewed-by: Simon Glass 
---
 v2: Introduce changes suggested by Daniel Schwierzeck:
  - Use generic dev_remap_addr function.

 drivers/serial/serial_bcm6345.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/serial/serial_bcm6345.c b/drivers/serial/serial_bcm6345.c
index 20f67f4b7e..4b8d09d241 100644
--- a/drivers/serial/serial_bcm6345.c
+++ b/drivers/serial/serial_bcm6345.c
@@ -228,17 +228,13 @@ static int bcm6345_serial_probe(struct udevice *dev)
 {
struct bcm6345_serial_priv *priv = dev_get_priv(dev);
struct clk clk;
-   fdt_addr_t addr;
-   fdt_size_t size;
int ret;
 
/* get address */
-   addr = devfdt_get_addr_size_index(dev, 0, );
-   if (addr == FDT_ADDR_T_NONE)
+   priv->base = dev_remap_addr(dev);
+   if (!priv->base)
return -EINVAL;
 
-   priv->base = ioremap(addr, size);
-
/* get clock rate */
ret = clk_get_by_index(dev, 0, );
if (ret < 0)
-- 
2.11.0

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


[U-Boot] [PATCH v2 08/17] led: bcm6328: convert to use live dt

2018-03-22 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
Reviewed-by: Simon Glass 
---
 v2: Introduce changes suggested by Daniel Schwierzeck:
  - Use generic dev_remap_addr function.

 drivers/led/led_bcm6328.c | 52 ---
 1 file changed, 17 insertions(+), 35 deletions(-)

diff --git a/drivers/led/led_bcm6328.c b/drivers/led/led_bcm6328.c
index 5d545c5096..a8cc5c5167 100644
--- a/drivers/led/led_bcm6328.c
+++ b/drivers/led/led_bcm6328.c
@@ -38,8 +38,6 @@
 #define LED_MODE_OFF   3
 #define LED_MODE_MASK  0x3
 
-DECLARE_GLOBAL_DATA_PTR;
-
 struct bcm6328_led_priv {
void __iomem *regs;
void __iomem *mode;
@@ -150,34 +148,25 @@ static const struct led_ops bcm6328_led_ops = {
 static int bcm6328_led_probe(struct udevice *dev)
 {
struct led_uc_plat *uc_plat = dev_get_uclass_platdata(dev);
-   fdt_addr_t addr;
-   fdt_size_t size;
 
/* Top-level LED node */
if (!uc_plat->label) {
void __iomem *regs;
u32 set_bits = 0;
 
-   addr = devfdt_get_addr_size_index(dev, 0, );
-   if (addr == FDT_ADDR_T_NONE)
+   regs = dev_remap_addr(dev);
+   if (!regs)
return -EINVAL;
 
-   regs = ioremap(addr, size);
-
-   if (fdtdec_get_bool(gd->fdt_blob, dev_of_offset(dev),
-   "brcm,serial-leds"))
+   if (dev_read_bool(dev, "brcm,serial-leds"))
set_bits |= LED_INIT_SLEDEN_MASK;
-   if (fdtdec_get_bool(gd->fdt_blob, dev_of_offset(dev),
-   "brcm,serial-mux"))
+   if (dev_read_bool(dev, "brcm,serial-mux"))
set_bits |= LED_INIT_SLEDMUX_MASK;
-   if (fdtdec_get_bool(gd->fdt_blob, dev_of_offset(dev),
-   "brcm,serial-clk-low"))
+   if (dev_read_bool(dev, "brcm,serial-clk-low"))
set_bits |= LED_INIT_SLEDCLKNPOL_MASK;
-   if (!fdtdec_get_bool(gd->fdt_blob, dev_of_offset(dev),
-"brcm,serial-dat-low"))
+   if (!dev_read_bool(dev, "brcm,serial-dat-low"))
set_bits |= LED_INIT_SLEDDATANPOL_MASK;
-   if (!fdtdec_get_bool(gd->fdt_blob, dev_of_offset(dev),
-"brcm,serial-shift-inv"))
+   if (!dev_read_bool(dev, "brcm,serial-shift-inv"))
set_bits |= LED_INIT_SLEDSHIFTDIR_MASK;
 
clrsetbits_be32(regs + LED_INIT_REG, ~0, set_bits);
@@ -185,17 +174,14 @@ static int bcm6328_led_probe(struct udevice *dev)
struct bcm6328_led_priv *priv = dev_get_priv(dev);
unsigned int pin;
 
-   addr = devfdt_get_addr_size_index(dev_get_parent(dev), 0,
- );
-   if (addr == FDT_ADDR_T_NONE)
+   priv->regs = dev_remap_addr(dev);
+   if (!priv->regs)
return -EINVAL;
 
-   pin = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev), "reg",
- LEDS_MAX);
+   pin = dev_read_u32_default(dev, "reg", LEDS_MAX);
if (pin >= LEDS_MAX)
return -EINVAL;
 
-   priv->regs = ioremap(addr, size);
if (pin < 8) {
/* LEDs 0-7 (bits 47:32) */
priv->mode = priv->regs + LED_MODE_REG_HI;
@@ -206,8 +192,7 @@ static int bcm6328_led_probe(struct udevice *dev)
priv->shift = ((pin - 8) << 1);
}
 
-   if (fdtdec_get_bool(gd->fdt_blob, dev_of_offset(dev),
-   "active-low"))
+   if (dev_read_bool(dev, "active-low"))
priv->active_low = true;
}
 
@@ -216,27 +201,24 @@ static int bcm6328_led_probe(struct udevice *dev)
 
 static int bcm6328_led_bind(struct udevice *parent)
 {
-   const void *blob = gd->fdt_blob;
-   int node;
+   ofnode node;
 
-   for (node = fdt_first_subnode(blob, dev_of_offset(parent));
-node > 0;
-node = fdt_next_subnode(blob, node)) {
+   dev_for_each_subnode(node, parent) {
struct led_uc_plat *uc_plat;
struct udevice *dev;
const char *label;
int ret;
 
-   label = fdt_getprop(blob, node, "label", NULL);
+   label = ofnode_read_string(node, "label");
if (!label) {
debug("%s: node %s has no label\n", __func__,
- fdt_get_name(blob, node, NULL));
+ ofnode_get_name(node));
return -EINVAL;
}
 
ret = 

[U-Boot] [PATCH v2 01/17] dm: core: add functions to get memory-mapped I/O addreses

2018-03-22 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 drivers/core/fdtaddr.c | 12 
 drivers/core/read.c| 12 
 include/dm/fdtaddr.h   | 22 ++
 include/dm/read.h  | 32 
 4 files changed, 78 insertions(+)

diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c
index 3847dd836e..8a8332 100644
--- a/drivers/core/fdtaddr.c
+++ b/drivers/core/fdtaddr.c
@@ -132,6 +132,18 @@ void *devfdt_get_addr_ptr(struct udevice *dev)
return (void *)(uintptr_t)devfdt_get_addr_index(dev, 0);
 }
 
+void *devfdt_remap_addr_index(struct udevice *dev, int index)
+{
+   fdt_addr_t addr = devfdt_get_addr_index(dev, index);
+
+   return (addr == FDT_ADDR_T_NONE) ? NULL : ioremap(addr, 0);
+}
+
+void *devfdt_remap_addr(struct udevice *dev)
+{
+   return devfdt_remap_addr_index(dev, 0);
+}
+
 void *devfdt_map_physmem(struct udevice *dev, unsigned long size)
 {
fdt_addr_t addr = devfdt_get_addr(dev);
diff --git a/drivers/core/read.c b/drivers/core/read.c
index 601d1322d6..0d338563ad 100644
--- a/drivers/core/read.c
+++ b/drivers/core/read.c
@@ -58,6 +58,13 @@ fdt_addr_t dev_read_addr_index(struct udevice *dev, int 
index)
return devfdt_get_addr_index(dev, index);
 }
 
+void *dev_remap_addr_index(struct udevice *dev, int index)
+{
+   fdt_addr_t addr = dev_read_addr_index(dev, index);
+
+   return (addr == FDT_ADDR_T_NONE) ? NULL : ioremap(addr, 0);
+}
+
 fdt_addr_t dev_read_addr(struct udevice *dev)
 {
return dev_read_addr_index(dev, 0);
@@ -70,6 +77,11 @@ void *dev_read_addr_ptr(struct udevice *dev)
return (addr == FDT_ADDR_T_NONE) ? NULL : map_sysmem(addr, 0);
 }
 
+void * dev_remap_addr(struct udevice *dev)
+{
+   return dev_remap_addr_index(dev, 0);
+}
+
 fdt_addr_t dev_read_addr_size(struct udevice *dev, const char *property,
  fdt_size_t *sizep)
 {
diff --git a/include/dm/fdtaddr.h b/include/dm/fdtaddr.h
index c46f0e91d0..82fc5f931d 100644
--- a/include/dm/fdtaddr.h
+++ b/include/dm/fdtaddr.h
@@ -35,6 +35,28 @@ fdt_addr_t devfdt_get_addr(struct udevice *dev);
 void *devfdt_get_addr_ptr(struct udevice *dev);
 
 /**
+ * devfdt_remap_addr() - Return pointer to the memory-mapped I/O address
+ *   of the reg property of a device
+ *
+ * @dev: Pointer to a device
+ *
+ * @return Pointer to addr, or NULL if there is no such property
+ */
+void *devfdt_remap_addr(struct udevice *dev);
+
+/**
+ * devfdt_remap_addr_index() - Return indexed pointer to the memory-mapped
+ * I/O address of the reg property of a device
+ * @index: the 'reg' property can hold a list of  pairs
+ *and @index is used to select which one is required
+ *
+ * @dev: Pointer to a device
+ *
+ * @return Pointer to addr, or NULL if there is no such property
+ */
+void *devfdt_remap_addr_index(struct udevice *dev, int index);
+
+/**
  * devfdt_map_physmem() - Read device address from reg property of the
  * device node and map the address into CPU address
  * space.
diff --git a/include/dm/read.h b/include/dm/read.h
index f14c7a7ba8..42eb585137 100644
--- a/include/dm/read.h
+++ b/include/dm/read.h
@@ -114,6 +114,18 @@ int dev_read_size(struct udevice *dev, const char 
*propname);
 fdt_addr_t dev_read_addr_index(struct udevice *dev, int index);
 
 /**
+ * dev_remap_addr_index() - Get the indexed reg property of a device
+ *   as a memory-mapped I/O pointer
+ *
+ * @dev: Device to read from
+ * @index: the 'reg' property can hold a list of  pairs
+ *and @index is used to select which one is required
+ *
+ * @return pointer or NULL if not found
+ */
+void * dev_remap_addr_index(struct udevice *dev, int index);
+
+/**
  * dev_read_addr() - Get the reg property of a device
  *
  * @dev: Device to read from
@@ -133,6 +145,16 @@ fdt_addr_t dev_read_addr(struct udevice *dev);
 void *dev_read_addr_ptr(struct udevice *dev);
 
 /**
+ * dev_remap_addr() - Get the reg property of a device as a
+ * memory-mapped I/O pointer
+ *
+ * @dev: Device to read from
+ *
+ * @return pointer or NULL if not found
+ */
+void * dev_remap_addr(struct udevice *dev);
+
+/**
  * dev_read_addr_size() - get address and size from a device property
  *
  * This does no address translation. It simply reads an property that contains
@@ -483,6 +505,16 @@ static inline void *dev_read_addr_ptr(struct udevice *dev)
return devfdt_get_addr_ptr(dev);
 }
 
+static inline void *dev_remap_addr(struct udevice *dev)
+{
+   return devfdt_remap_addr(dev);
+}
+
+static inline void *dev_remap_addr_index(struct udevice *dev, int index)
+{
+   return devfdt_remap_addr_index(dev, index);
+}
+
 static inline fdt_addr_t dev_read_addr_size(struct udevice *dev,
const char *propname,
 

[U-Boot] [PATCH v2 00/17] bmips: convert to use live-dt

2018-03-22 Thread Álvaro Fernández Rojas
Convert bmips drivers to use live device tree instead of flattened device tree.

v2: Introduce changes suggested by Daniel Schwierzeck and Simon Glass:
 - Add generic dev_remap_addr/dev_remap_addr_index functions.
 - Fix bcm63xx_spi conversion.
 - Convert remaining bmips drivers (cpu, usbh-phy).

Álvaro Fernández Rojas (17):
  dm: core: add functions to get memory-mapped I/O addreses
  watchdog: bcm6345: convert to use live dt
  serial: bcm6345: convert to use live dt
  clk: bcm6345: convert to use live dt
  reset: bcm6345: convert to use live dt
  gpio: bcm6345: convert to use live dt
  led: bcm6358: convert to use live dt
  led: bcm6328: convert to use live dt
  power: domain: bcm6328: convert to use live dt
  spi: bcm63xx_spi: convert to use live dt
  spi: bcm63xx_hsspi: convert to use live dt
  ram: bmips: convert to use live dt
  cpu: bmips: convert to use live dt
  phy: bcm6348-usbh: convert to use live dt
  phy: bcm6358-usbh: convert to use live dt
  phy: bcm6368-usbh: convert to use live dt
  phy: bcm6318-usbh: convert to use live dt

 drivers/clk/clk_bcm6345.c   |  8 ++---
 drivers/core/fdtaddr.c  | 12 +++
 drivers/core/read.c | 12 +++
 drivers/cpu/bmips_cpu.c | 12 ++-
 drivers/gpio/bcm6345_gpio.c | 18 +++---
 drivers/led/led_bcm6328.c   | 52 ++---
 drivers/led/led_bcm6358.c   | 44 +---
 drivers/phy/bcm6318-usbh-phy.c  | 10 ++
 drivers/phy/bcm6348-usbh-phy.c  | 10 ++
 drivers/phy/bcm6358-usbh-phy.c  | 10 ++
 drivers/phy/bcm6368-usbh-phy.c  |  9 ++---
 drivers/power/domain/bcm6328-power-domain.c |  8 ++---
 drivers/ram/bmips_ram.c |  7 ++--
 drivers/reset/reset-bcm6345.c   |  8 ++---
 drivers/serial/serial_bcm6345.c |  8 ++---
 drivers/spi/bcm63xx_hsspi.c | 12 ++-
 drivers/spi/bcm63xx_spi.c   | 12 ++-
 drivers/watchdog/bcm6345_wdt.c  |  8 ++---
 include/dm/fdtaddr.h| 22 
 include/dm/read.h   | 32 ++
 20 files changed, 148 insertions(+), 166 deletions(-)

-- 
2.11.0

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


Re: [U-Boot] [PATCH V2 4/5] net: fec: sharing MDIO for two enet controllers

2018-03-22 Thread Joe Hershberger
On Thu, Mar 22, 2018 at 5:49 AM, Calvin Johnson  wrote:
> Hi Joe,
>
>> >>>
>> >>> No, I think we can do this with adding new DM MDIO similar to DM PHY
>> which
>> >>> recently done. May be some sort of efforts but it is permanent.
>> >> We do not have that driver now, so could we first have this patch? When
>> >> DM MDIO ready, this piece code could be removed then?
>> >
>> > ie. up to Joe. Honestly this macro become removed in future, my point
>> > here is why we need to maintain dead macro instead of adding proper
>> > maintainable stuff. I'm pretty sure adding DM_MDIO is straight forward
>> > and as of now just add what we need and rest will implement future.
>> > You may become victim to others to move DM_ETH as soon as possible :)
>>
>> It would be ideal if you wanted to implement DM MDIO, but I can also
>> appreciate that this is not already there for you to use. As I
>> commented when I acked this, the I'm OK with this approach at this
>> time due to the state of the DM support in eth.
>>
>> As a side note, maybe moving other boards that use this NIC to DM_ETH
>> and removing non-DM support would be a better cleanup to start with.
>
> Is someone already working on DM MDIO?
> Are there any patches already submitted for this? I couldn't find any.

I have a rough start on it, but I'm not happy with it so far.

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


Re: [U-Boot] [PATCH V2 5/5] net: fex_mxc: add i.MX6UL/SX/SL compatible

2018-03-22 Thread Joe Hershberger
On Wed, Mar 21, 2018 at 8:23 PM, Peng Fan  wrote:
>
>
>> -Original Message-
>> From: Joe Hershberger [mailto:joe.hershber...@ni.com]
>> Sent: 2018年3月22日 3:54
>> To: Peng Fan ; Jagan Teki 
>> Cc: Joe Hershberger ; u-boot 
>> Subject: Re: [U-Boot] [PATCH V2 5/5] net: fex_mxc: add i.MX6UL/SX/SL
>> compatible
>>
>> Hi Peng,
>>
>> On Wed, Mar 21, 2018 at 4:01 AM, Peng Fan  wrote:
>> > Add i.MX6UL/SX/SL compatible.
>>
>> In case you didn't notice and it is still an issue in v2 (I just kicked off 
>> a build of it)
>> there are a number of failures as a result of this series...
>> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftravis-c
>> i.org%2Fjhershbe%2Fu-boot%2Fbuilds%2F356027749=02%7C01%7Cpeng.
>> fan%40nxp.com%7C6cf39da22b8d40e068fe08d58f65838d%7C686ea1d3bc2b4c
>> 6fa92cd99c5c301635%7C0%7C0%7C636572588531154502=BMZiLVVhe
>> 1By6MXjTkW19RgTK171D8%2BYaEWRjuCmvx8%3D=0
>
> Sorry for this. I should run buildman before send patchset out. I'll fix them.

FYI, v2 still has an issue:
https://travis-ci.org/jhershbe/u-boot/builds/356535940
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 0/5] DW SPI: fixes and improvements

2018-03-22 Thread Alexey Brodkin
Cool,thanks!

-Alexey

On Thu, 2018-03-22 at 23:42 +0530, Jagan Teki wrote:
> On Thu, Mar 22, 2018 at 11:05 PM, Alexey Brodkin
>  wrote:
> > Hi Jagan,
> > 
> > On Thu, 2018-03-22 at 23:03 +0530, Jagan Teki wrote:
> > > On Thu, Mar 22, 2018 at 4:20 PM, Eugeniy Paltsev
> > >  wrote:
> > > > Various fixes and improvements of designware spi driver.
> > > > 
> > > > Changes v1->v2:
> > > >   * Use readl_poll_timeout macros instead of custom code.
> > > > 
> > > > Eugeniy Paltsev (5):
> > > >DW SPI: fix tx data loss on FIFO flush
> > > >DW SPI: fix transmit only mode
> > > >DW SPI: refactor poll_transfer functions
> > > >DW SPI: add option to use external gpio for chip select
> > > >DW SPI: use 32 bit access instead of 16 and 32 bit mix
> > > > 
> > > >   drivers/spi/designware_spi.c | 132 
> > > > ---
> > > >   1 file changed, 87 insertions(+), 45 deletions(-)
> > > 
> > > Applied to u-boot-spi/master
> > 
> > I guess that will be merged in U-Boot master tree sometime soon so
> > that will be a part of the next u-boot release, right?
> 
> Yes, I will send PR soon.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 0/5] DW SPI: fixes and improvements

2018-03-22 Thread Jagan Teki
On Thu, Mar 22, 2018 at 11:05 PM, Alexey Brodkin
 wrote:
> Hi Jagan,
>
> On Thu, 2018-03-22 at 23:03 +0530, Jagan Teki wrote:
>> On Thu, Mar 22, 2018 at 4:20 PM, Eugeniy Paltsev
>>  wrote:
>> > Various fixes and improvements of designware spi driver.
>> >
>> > Changes v1->v2:
>> >   * Use readl_poll_timeout macros instead of custom code.
>> >
>> > Eugeniy Paltsev (5):
>> >DW SPI: fix tx data loss on FIFO flush
>> >DW SPI: fix transmit only mode
>> >DW SPI: refactor poll_transfer functions
>> >DW SPI: add option to use external gpio for chip select
>> >DW SPI: use 32 bit access instead of 16 and 32 bit mix
>> >
>> >   drivers/spi/designware_spi.c | 132 
>> > ---
>> >   1 file changed, 87 insertions(+), 45 deletions(-)
>>
>> Applied to u-boot-spi/master
>
> I guess that will be merged in U-Boot master tree sometime soon so
> that will be a part of the next u-boot release, right?

Yes, I will send PR soon.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 0/5] DW SPI: fixes and improvements

2018-03-22 Thread Jagan Teki
On Thu, Mar 22, 2018 at 4:20 PM, Eugeniy Paltsev
 wrote:
> Various fixes and improvements of designware spi driver.
>
> Changes v1->v2:
>  * Use readl_poll_timeout macros instead of custom code.
>
> Eugeniy Paltsev (5):
>   DW SPI: fix tx data loss on FIFO flush
>   DW SPI: fix transmit only mode
>   DW SPI: refactor poll_transfer functions
>   DW SPI: add option to use external gpio for chip select
>   DW SPI: use 32 bit access instead of 16 and 32 bit mix
>
>  drivers/spi/designware_spi.c | 132 
> ---
>  1 file changed, 87 insertions(+), 45 deletions(-)

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


Re: [U-Boot] [PATCH v2 0/5] DW SPI: fixes and improvements

2018-03-22 Thread Alexey Brodkin
Hi Jagan,

On Thu, 2018-03-22 at 23:03 +0530, Jagan Teki wrote:
> On Thu, Mar 22, 2018 at 4:20 PM, Eugeniy Paltsev
>  wrote:
> > Various fixes and improvements of designware spi driver.
> > 
> > Changes v1->v2:
> >   * Use readl_poll_timeout macros instead of custom code.
> > 
> > Eugeniy Paltsev (5):
> >DW SPI: fix tx data loss on FIFO flush
> >DW SPI: fix transmit only mode
> >DW SPI: refactor poll_transfer functions
> >DW SPI: add option to use external gpio for chip select
> >DW SPI: use 32 bit access instead of 16 and 32 bit mix
> > 
> >   drivers/spi/designware_spi.c | 132 
> > ---
> >   1 file changed, 87 insertions(+), 45 deletions(-)
> 
> Applied to u-boot-spi/master

I guess that will be merged in U-Boot master tree sometime soon so
that will be a part of the next u-boot release, right?

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


[U-Boot] [PATCH] drivers: spi: migrate cf_spi to DM

2018-03-22 Thread Angelo Dureghello
This patch adds DM support to cf_spi.c.
To be able to build spi driver with DM support, a new config
option has been introdiced (DM_NO_DT) since m68k architecture
does not support fdt.

Signed-off-by: Angelo Dureghello 
---
 arch/Kconfig|   1 +
 drivers/core/Kconfig|   4 +
 drivers/spi/cf_spi.c| 408 
 drivers/spi/spi-uclass.c|  12 +-
 include/dm/platform_data/spi_coldfire.h |  22 ++
 5 files changed, 291 insertions(+), 156 deletions(-)
 create mode 100644 include/dm/platform_data/spi_coldfire.h

diff --git a/arch/Kconfig b/arch/Kconfig
index e599e7a39c..735669921b 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -28,6 +28,7 @@ config M68K
select HAVE_PRIVATE_LIBGCC
select SYS_BOOT_GET_CMDLINE
select SYS_BOOT_GET_KBD
+   select DM_NO_OF
 
 config MICROBLAZE
bool "MicroBlaze architecture"
diff --git a/drivers/core/Kconfig b/drivers/core/Kconfig
index e8ba20ca82..47960a8a6a 100644
--- a/drivers/core/Kconfig
+++ b/drivers/core/Kconfig
@@ -244,4 +244,8 @@ config DM_DEV_READ_INLINE
bool
default y if !OF_LIVE
 
+config DM_NO_OF
+   bool
+   default n
+
 endmenu
diff --git a/drivers/spi/cf_spi.c b/drivers/spi/cf_spi.c
index 7be9427781..2c0298eeeb 100644
--- a/drivers/spi/cf_spi.c
+++ b/drivers/spi/cf_spi.c
@@ -6,16 +6,23 @@
  * Copyright (C) 2004-2009 Freescale Semiconductor, Inc.
  * TsiChung Liew (tsi-chung.l...@freescale.com)
  *
+ * Support for device model:
+ * Copyright (C) 2018 Angelo Dureghello 
+ *
  * SPDX-License-Identifier:GPL-2.0+
  */
 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
 
-struct cf_spi_slave {
+struct coldfire_spi_priv {
+#ifndef CONFIG_DM_SPI
struct spi_slave slave;
+#endif
uint baudrate;
int charbit;
 };
@@ -39,12 +46,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #define SPI_MODE_MOD   0x0020
 #define SPI_DBLRATE0x0010
 
-static inline struct cf_spi_slave *to_cf_spi_slave(struct spi_slave *slave)
-{
-   return container_of(slave, struct cf_spi_slave, slave);
-}
-
-static void cfspi_init(void)
+static void __spi_init(void)
 {
volatile dspi_t *dspi = (dspi_t *) MMAP_DSPI;
 
@@ -82,7 +84,123 @@ static void cfspi_init(void)
 #endif
 }
 
-static void cfspi_tx(u32 ctrl, u16 data)
+int __spi_set_speed(struct coldfire_spi_priv *cfspi, uint bus, uint mode)
+{
+   /*
+* bit definition for mode:
+* bit 31 - 28: Transfer size 3 to 16 bits
+* 27 - 26: PCS to SCK delay prescaler
+* 25 - 24: After SCK delay prescaler
+* 23 - 22: Delay after transfer prescaler
+* 21 : Allow overwrite for bit 31-22 and bit 20-8
+* 20 : Double baud rate
+* 19 - 16: PCS to SCK delay scaler
+* 15 - 12: After SCK delay scaler
+* 11 -  8: Delay after transfer scaler
+*  7 -  0: SPI_CPHA, SPI_CPOL, SPI_LSB_FIRST
+*/
+   volatile dspi_t *dspi = (dspi_t *)MMAP_DSPI;
+   int prescaler[] = { 2, 3, 5, 7 };
+   int scaler[] = {
+   2, 4, 6, 8,
+   16, 32, 64, 128,
+   256, 512, 1024, 2048,
+   4096, 8192, 16384, 32768
+   };
+   int i, j, pbrcnt, brcnt, diff, tmp, dbr = 0;
+   int best_i, best_j, bestmatch = 0x7FFF, baud_speed;
+   u32 bus_setup = 0;
+
+   tmp = (prescaler[3] * scaler[15]);
+   /* Maximum and minimum baudrate it can handle */
+   if ((cfspi->baudrate > (gd->bus_clk >> 1)) ||
+   (cfspi->baudrate < (gd->bus_clk / tmp))) {
+   printf("Exceed baudrate limitation: Max %d - Min %d\n",
+  (int)(gd->bus_clk >> 1), (int)(gd->bus_clk / tmp));
+   return -1;
+   }
+
+   /* Activate Double Baud when it exceed 1/4 the bus clk */
+   if ((CONFIG_SYS_DSPI_CTAR0 & DSPI_CTAR_DBR) ||
+   (cfspi->baudrate > (gd->bus_clk / (prescaler[0] * scaler[0] {
+   bus_setup |= DSPI_CTAR_DBR;
+   dbr = 1;
+   }
+
+   /* Overwrite default value set in platform configuration file */
+   if (mode & SPI_MODE_MOD) {
+   /*
+* Check to see if it is enabled by default in platform
+* config, or manual setting passed by mode parameter
+*/
+   if (mode & SPI_DBLRATE) {
+   bus_setup |= DSPI_CTAR_DBR;
+   dbr = 1;
+   }
+   }
+
+   pbrcnt = sizeof(prescaler) / sizeof(int);
+   brcnt = sizeof(scaler) / sizeof(int);
+
+   /* baudrate calculation - to closer value, may not be exact match */
+   for (best_i = 0, best_j = 0, i = 0; i < pbrcnt; i++) {
+   baud_speed = gd->bus_clk / prescaler[i];
+   for (j = 0; j < brcnt; j++) {
+   tmp = (baud_speed / scaler[j]) * (1 + 

Re: [U-Boot] [PULL] u-boot-mips/master

2018-03-22 Thread Tom Rini
On Wed, Mar 21, 2018 at 11:31:14PM +0100, Daniel Schwierzeck wrote:

> Hi Tom,
> 
> please pull following changes:
> 
> - add initial support for Broadcom BCM6362 SoC and Netgear DGND3700v2 board
> - add USB support for all Broadcom MIPS SoCs
> - fix an array bounds check
> 
> 
> The following changes since commit 9c0e2f6ed391f199ba1bf30c7d0b71123a012958:
> 
>   Merge git://git.denx.de/u-boot-fsl-qoriq (2018-03-20 18:39:27 -0400)
> 
> are available in the Git repository at:
> 
>   git://git.denx.de/u-boot-mips.git master
> 
> for you to fetch changes up to 358daa5b22f27d0e130ad1eb159b8b2c3c9e1011:
> 
>   mips: bmips: add ar-5315 usb support (2018-03-21 23:23:13 +0100)
> 

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] arm: dts: am4372: fix DTC warnings

2018-03-22 Thread Tom Rini
On Thu, Mar 22, 2018 at 09:57:46AM +0200, Felipe Balbi wrote:
> 
> Hi,
> 
> Tom Rini  writes:
> > On Wed, Mar 21, 2018 at 03:44:45PM +0200, Felipe Balbi wrote:
> >> The following warnings are fixed:
> >> 
> >> arch/arm/dts/am43x-epos-evm.dtb: Warning (interrupts_property): interrupts 
> >> size is (8), expected multiple of 12 in /ocp/mcasp@48038000
> >> arch/arm/dts/am43x-epos-evm.dtb: Warning (interrupts_property): interrupts 
> >> size is (8), expected multiple of 12 in /ocp/mcasp@4803C000
> >> arch/arm/dts/am43x-epos-evm.dtb: Warning (interrupts_property): Missing 
> >> interrupt-controller or interrupt-map property in /ocp/gpmc@5000
> >> arch/arm/dts/am43x-epos-evm.dtb: Warning (interrupts_property): Missing 
> >> #interrupt-cells in interrupt-parent /ocp/gpmc@5000
> >> arch/arm/dts/am437x-gp-evm.dtb: Warning (interrupts_property): interrupts 
> >> size is (8), expected multiple of 12 in /ocp/mcasp@48038000
> >> arch/arm/dts/am437x-gp-evm.dtb: Warning (interrupts_property): interrupts 
> >> size is (8), expected multiple of 12 in /ocp/mcasp@4803C000
> >> arch/arm/dts/am437x-idk-evm.dtb: Warning (interrupts_property): interrupts 
> >> size is (8), expected multiple of 12 in /ocp/mcasp@48038000
> >> arch/arm/dts/am437x-idk-evm.dtb: Warning (interrupts_property): interrupts 
> >> size is (8), expected multiple of 12 in /ocp/mcasp@4803C000
> >> arch/arm/dts/am437x-sk-evm.dtb: Warning (interrupts_property): interrupts 
> >> size is (8), expected multiple of 12 in /ocp/mcasp@48038000
> >> arch/arm/dts/am437x-sk-evm.dtb: Warning (interrupts_property): interrupts 
> >> size is (8), expected multiple of 12 in /ocp/mcasp@4803C000
> >> 
> >> The fix was basically to copy the missing data from mainline linux.
> >
> > Shouldn't we just re-sync with v4.16-rc? Thanks!
> 
> sure, if you prefer doing that. But in that case, it seems like
> extracting Linux's DTS to its own project (linux-dts.git??) and using
> that as submodule would be far better.

Except we also have our own files in arch/*/dts/ so we expect people to
just sync the DTS files they use as-needed.

-- 
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 v2 4/5] DW SPI: add option to use external gpio for chip select

2018-03-22 Thread Eugeniy Paltsev
DW SPI internal chip select management has limitation:
it hold CS line in active state only when the FIFO is not
empty. If the FIFO freed before we add new data the SPI transaction will
be broken.

So add option to use external gpio for chip select. Gpio can be added
via device tree using standard gpio bindings.

Signed-off-by: Eugeniy Paltsev 
---
Changes v1->v2:
 * None.

 drivers/spi/designware_spi.c | 51 +++-
 1 file changed, 50 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/designware_spi.c b/drivers/spi/designware_spi.c
index b51242c862..06f777461e 100644
--- a/drivers/spi/designware_spi.c
+++ b/drivers/spi/designware_spi.c
@@ -10,6 +10,7 @@
  * SPDX-License-Identifier:GPL-2.0
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -98,6 +99,8 @@ struct dw_spi_priv {
struct clk clk;
unsigned long bus_clk_rate;
 
+   struct gpio_desc cs_gpio;   /* External chip-select gpio */
+
int bits_per_word;
u8 cs;  /* chip select pin */
u8 tmode;   /* TR/TO/RO/EEPROM */
@@ -131,6 +134,32 @@ static inline void dw_writew(struct dw_spi_priv *priv, u32 
offset, u16 val)
__raw_writew(val, priv->regs + offset);
 }
 
+static int request_gpio_cs(struct udevice *bus)
+{
+#if defined(CONFIG_DM_GPIO) && !defined(CONFIG_SPL_BUILD)
+   struct dw_spi_priv *priv = dev_get_priv(bus);
+   int ret;
+
+   /* External chip select gpio line is optional */
+   ret = gpio_request_by_name(bus, "cs-gpio", 0, >cs_gpio, 0);
+   if (ret == -ENOENT)
+   return 0;
+
+   if (ret < 0) {
+   printf("Error: %d: Can't get %s gpio!\n", ret, bus->name);
+   return ret;
+   }
+
+   if (dm_gpio_is_valid(>cs_gpio)) {
+   dm_gpio_set_dir_flags(>cs_gpio,
+ GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE);
+   }
+
+   debug("%s: used external gpio for CS management\n", __func__);
+#endif
+   return 0;
+}
+
 static int dw_spi_ofdata_to_platdata(struct udevice *bus)
 {
struct dw_spi_platdata *plat = bus->platdata;
@@ -145,7 +174,7 @@ static int dw_spi_ofdata_to_platdata(struct udevice *bus)
debug("%s: regs=%p max-frequency=%d\n", __func__, plat->regs,
  plat->frequency);
 
-   return 0;
+   return request_gpio_cs(bus);
 }
 
 static inline void spi_enable_chip(struct dw_spi_priv *priv, int enable)
@@ -316,6 +345,18 @@ static int poll_transfer(struct dw_spi_priv *priv)
return 0;
 }
 
+static void external_cs_manage(struct udevice *dev, bool on)
+{
+#if defined(CONFIG_DM_GPIO) && !defined(CONFIG_SPL_BUILD)
+   struct dw_spi_priv *priv = dev_get_priv(dev->parent);
+
+   if (!dm_gpio_is_valid(>cs_gpio))
+   return;
+
+   dm_gpio_set_value(>cs_gpio, on ? 1 : 0);
+#endif
+}
+
 static int dw_spi_xfer(struct udevice *dev, unsigned int bitlen,
   const void *dout, void *din, unsigned long flags)
 {
@@ -334,6 +375,10 @@ static int dw_spi_xfer(struct udevice *dev, unsigned int 
bitlen,
return -1;
}
 
+   /* Start the transaction if necessary. */
+   if (flags & SPI_XFER_BEGIN)
+   external_cs_manage(dev, false);
+
cr0 = (priv->bits_per_word - 1) | (priv->type << SPI_FRF_OFFSET) |
(priv->mode << SPI_MODE_OFFSET) |
(priv->tmode << SPI_TMOD_OFFSET);
@@ -395,6 +440,10 @@ static int dw_spi_xfer(struct udevice *dev, unsigned int 
bitlen,
ret = -ETIMEDOUT;
}
 
+   /* Stop the transaction if necessary */
+   if (flags & SPI_XFER_END)
+   external_cs_manage(dev, true);
+
return ret;
 }
 
-- 
2.14.3

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


[U-Boot] [PATCH v2 5/5] DW SPI: use 32 bit access instead of 16 and 32 bit mix

2018-03-22 Thread Eugeniy Paltsev
Current DW SPI driver uses 32 bit access for some registers and
16 bit access for others. So if DW SPI IP is connected via bus
which doesn't support 16 bit access we will get bus error.

Fix that by switching to 32 bit access only instead of 16 and 32 bit mix

Additional Documentation to Support this Change:
The DW_apb_ssi databook states:
"All registers in the DW_apb_ssi are addressed at 32-bit boundaries
to remain consistent with the AHB bus. Where the physical size of
any register is less than 32-bits wide, the upper unused bits of
the 32-bit boundary are reserved. Writing to these bits has no
effect; reading from these bits returns 0." [1]

[1] Section 6.1 of dw_apb_ssi.pdf (version 3.22a)

Signed-off-by: Eugeniy Paltsev 
---
Changes v1->v2:
 * None.

 drivers/spi/designware_spi.c | 40 +++-
 1 file changed, 15 insertions(+), 25 deletions(-)

diff --git a/drivers/spi/designware_spi.c b/drivers/spi/designware_spi.c
index 06f777461e..0e93b62eee 100644
--- a/drivers/spi/designware_spi.c
+++ b/drivers/spi/designware_spi.c
@@ -114,26 +114,16 @@ struct dw_spi_priv {
void *rx_end;
 };
 
-static inline u32 dw_readl(struct dw_spi_priv *priv, u32 offset)
+static inline u32 dw_read(struct dw_spi_priv *priv, u32 offset)
 {
return __raw_readl(priv->regs + offset);
 }
 
-static inline void dw_writel(struct dw_spi_priv *priv, u32 offset, u32 val)
+static inline void dw_write(struct dw_spi_priv *priv, u32 offset, u32 val)
 {
__raw_writel(val, priv->regs + offset);
 }
 
-static inline u16 dw_readw(struct dw_spi_priv *priv, u32 offset)
-{
-   return __raw_readw(priv->regs + offset);
-}
-
-static inline void dw_writew(struct dw_spi_priv *priv, u32 offset, u16 val)
-{
-   __raw_writew(val, priv->regs + offset);
-}
-
 static int request_gpio_cs(struct udevice *bus)
 {
 #if defined(CONFIG_DM_GPIO) && !defined(CONFIG_SPL_BUILD)
@@ -179,14 +169,14 @@ static int dw_spi_ofdata_to_platdata(struct udevice *bus)
 
 static inline void spi_enable_chip(struct dw_spi_priv *priv, int enable)
 {
-   dw_writel(priv, DW_SPI_SSIENR, (enable ? 1 : 0));
+   dw_write(priv, DW_SPI_SSIENR, (enable ? 1 : 0));
 }
 
 /* Restart the controller, disable all interrupts, clean rx fifo */
 static void spi_hw_init(struct dw_spi_priv *priv)
 {
spi_enable_chip(priv, 0);
-   dw_writel(priv, DW_SPI_IMR, 0xff);
+   dw_write(priv, DW_SPI_IMR, 0xff);
spi_enable_chip(priv, 1);
 
/*
@@ -197,13 +187,13 @@ static void spi_hw_init(struct dw_spi_priv *priv)
u32 fifo;
 
for (fifo = 1; fifo < 256; fifo++) {
-   dw_writew(priv, DW_SPI_TXFLTR, fifo);
-   if (fifo != dw_readw(priv, DW_SPI_TXFLTR))
+   dw_write(priv, DW_SPI_TXFLTR, fifo);
+   if (fifo != dw_read(priv, DW_SPI_TXFLTR))
break;
}
 
priv->fifo_len = (fifo == 1) ? 0 : fifo;
-   dw_writew(priv, DW_SPI_TXFLTR, 0);
+   dw_write(priv, DW_SPI_TXFLTR, 0);
}
debug("%s: fifo_len=%d\n", __func__, priv->fifo_len);
 }
@@ -272,7 +262,7 @@ static inline u32 tx_max(struct dw_spi_priv *priv)
u32 tx_left, tx_room, rxtx_gap;
 
tx_left = (priv->tx_end - priv->tx) / (priv->bits_per_word >> 3);
-   tx_room = priv->fifo_len - dw_readw(priv, DW_SPI_TXFLR);
+   tx_room = priv->fifo_len - dw_read(priv, DW_SPI_TXFLR);
 
/*
 * Another concern is about the tx/rx mismatch, we
@@ -293,7 +283,7 @@ static inline u32 rx_max(struct dw_spi_priv *priv)
 {
u32 rx_left = (priv->rx_end - priv->rx) / (priv->bits_per_word >> 3);
 
-   return min_t(u32, rx_left, dw_readw(priv, DW_SPI_RXFLR));
+   return min_t(u32, rx_left, dw_read(priv, DW_SPI_RXFLR));
 }
 
 static void dw_writer(struct dw_spi_priv *priv)
@@ -309,7 +299,7 @@ static void dw_writer(struct dw_spi_priv *priv)
else
txw = *(u16 *)(priv->tx);
}
-   dw_writew(priv, DW_SPI_DR, txw);
+   dw_write(priv, DW_SPI_DR, txw);
debug("%s: tx=0x%02x\n", __func__, txw);
priv->tx += priv->bits_per_word >> 3;
}
@@ -321,7 +311,7 @@ static void dw_reader(struct dw_spi_priv *priv)
u16 rxw;
 
while (max--) {
-   rxw = dw_readw(priv, DW_SPI_DR);
+   rxw = dw_read(priv, DW_SPI_DR);
debug("%s: rx=0x%02x\n", __func__, rxw);
 
/* Care about rx if the transfer's original "rx" is not null */
@@ -410,8 +400,8 @@ static int dw_spi_xfer(struct udevice *dev, unsigned int 
bitlen,
 
debug("%s: cr0=%08x\n", __func__, cr0);
/* Reprogram cr0 only if changed */
-   if (dw_readw(priv, DW_SPI_CTRL0) != cr0)
-   dw_writew(priv, DW_SPI_CTRL0, cr0);
+   if (dw_read(priv, DW_SPI_CTRL0) != 

[U-Boot] [PATCH v2 3/5] DW SPI: refactor poll_transfer functions

2018-03-22 Thread Eugeniy Paltsev
There is no sense in waiting for RX data in dw_reader function:
there is no chance that RX data will appear in RX FIFO if
RX FIFO is empty after previous TX write in dw_writer function.
So get rid of this waiting. After that we can get rid of dw_reader
return value and make it returning void. After that we can get rid
of dw_reader return value check in poll_transfer function.

With these changes we're getting closer to Linux DW SPI driver.

Signed-off-by: Eugeniy Paltsev 
---
Changes v1->v2:
 * None.

 drivers/spi/designware_spi.c | 26 --
 1 file changed, 4 insertions(+), 22 deletions(-)

diff --git a/drivers/spi/designware_spi.c b/drivers/spi/designware_spi.c
index 3296441606..b51242c862 100644
--- a/drivers/spi/designware_spi.c
+++ b/drivers/spi/designware_spi.c
@@ -286,28 +286,16 @@ static void dw_writer(struct dw_spi_priv *priv)
}
 }
 
-static int dw_reader(struct dw_spi_priv *priv)
+static void dw_reader(struct dw_spi_priv *priv)
 {
-   unsigned start = get_timer(0);
-   u32 max;
+   u32 max = rx_max(priv);
u16 rxw;
 
-   /* Wait for rx data to be ready */
-   while (rx_max(priv) == 0) {
-   if (get_timer(start) > RX_TIMEOUT)
-   return -ETIMEDOUT;
-   }
-
-   max = rx_max(priv);
-
while (max--) {
rxw = dw_readw(priv, DW_SPI_DR);
debug("%s: rx=0x%02x\n", __func__, rxw);
 
-   /*
-* Care about rx only if the transfer's original "rx" is
-* not null
-*/
+   /* Care about rx if the transfer's original "rx" is not null */
if (priv->rx_end - priv->len) {
if (priv->bits_per_word == 8)
*(u8 *)(priv->rx) = rxw;
@@ -316,19 +304,13 @@ static int dw_reader(struct dw_spi_priv *priv)
}
priv->rx += priv->bits_per_word >> 3;
}
-
-   return 0;
 }
 
 static int poll_transfer(struct dw_spi_priv *priv)
 {
-   int ret;
-
do {
dw_writer(priv);
-   ret = dw_reader(priv);
-   if (ret < 0)
-   return ret;
+   dw_reader(priv);
} while (priv->rx_end > priv->rx);
 
return 0;
-- 
2.14.3

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


[U-Boot] [PATCH v2 0/5] DW SPI: fixes and improvements

2018-03-22 Thread Eugeniy Paltsev
Various fixes and improvements of designware spi driver.

Changes v1->v2:
 * Use readl_poll_timeout macros instead of custom code.

Eugeniy Paltsev (5):
  DW SPI: fix tx data loss on FIFO flush
  DW SPI: fix transmit only mode
  DW SPI: refactor poll_transfer functions
  DW SPI: add option to use external gpio for chip select
  DW SPI: use 32 bit access instead of 16 and 32 bit mix

 drivers/spi/designware_spi.c | 132 ---
 1 file changed, 87 insertions(+), 45 deletions(-)

-- 
2.14.3

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


[U-Boot] [PATCH v2 2/5] DW SPI: fix transmit only mode

2018-03-22 Thread Eugeniy Paltsev
In current implementation we get -ETIMEDOUT error when we try to use
transmit only mode (SPI_TMOD_TO)
This happens because in transmit only mode input FIFO never gets any data
which breaks our logic in dw_reader(): we are waiting until RX data will be
ready in dw_reader, but this newer happens, so we return with error.

Fix that by using SPI_TMOD_TR instead of SPI_TMOD_TO which allows to use
RX FIFO.

Signed-off-by: Eugeniy Paltsev 
---
Changes v1->v2:
 * None.

 drivers/spi/designware_spi.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/designware_spi.c b/drivers/spi/designware_spi.c
index 5e196b21c9..3296441606 100644
--- a/drivers/spi/designware_spi.c
+++ b/drivers/spi/designware_spi.c
@@ -361,7 +361,11 @@ static int dw_spi_xfer(struct udevice *dev, unsigned int 
bitlen,
else if (rx)
priv->tmode = SPI_TMOD_RO;
else
-   priv->tmode = SPI_TMOD_TO;
+   /*
+* In transmit only mode (SPI_TMOD_TO) input FIFO never gets
+* any data which breaks our logic in poll_transfer() above.
+*/
+   priv->tmode = SPI_TMOD_TR;
 
cr0 &= ~SPI_TMOD_MASK;
cr0 |= (priv->tmode << SPI_TMOD_OFFSET);
-- 
2.14.3

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


[U-Boot] [PATCH v2 1/5] DW SPI: fix tx data loss on FIFO flush

2018-03-22 Thread Eugeniy Paltsev
In current implementation if some data still exists in Tx FIFO it
can be silently flushed, i.e. dropped on disabling of the controller,
which happens when writing 0 to DW_SPI_SSIENR (it happens in the
beginning of new transfer)

So add wait for current transmit operation to complete to be sure
that current transmit operation is finished before new one.

Signed-off-by: Eugeniy Paltsev 
---
Changes v1->v2:
 * Use readl_poll_timeout macros instead of custom code.

 drivers/spi/designware_spi.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/drivers/spi/designware_spi.c b/drivers/spi/designware_spi.c
index c501aeea16..5e196b21c9 100644
--- a/drivers/spi/designware_spi.c
+++ b/drivers/spi/designware_spi.c
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -342,6 +343,7 @@ static int dw_spi_xfer(struct udevice *dev, unsigned int 
bitlen,
u8 *rx = din;
int ret = 0;
u32 cr0 = 0;
+   u32 val;
u32 cs;
 
/* spi core configured to do 8 bit transfers */
@@ -394,6 +396,19 @@ static int dw_spi_xfer(struct udevice *dev, unsigned int 
bitlen,
/* Start transfer in a polling loop */
ret = poll_transfer(priv);
 
+   /*
+* Wait for current transmit operation to complete.
+* Otherwise if some data still exists in Tx FIFO it can be
+* silently flushed, i.e. dropped on disabling of the controller,
+* which happens when writing 0 to DW_SPI_SSIENR which happens
+* in the beginning of new transfer.
+*/
+   if (readl_poll_timeout(priv->regs + DW_SPI_SR, val,
+  !(val & SR_TF_EMPT) || (val & SR_BUSY),
+  RX_TIMEOUT * 1000)) {
+   ret = -ETIMEDOUT;
+   }
+
return ret;
 }
 
-- 
2.14.3

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


Re: [U-Boot] [PATCH V2 4/5] net: fec: sharing MDIO for two enet controllers

2018-03-22 Thread Calvin Johnson
Hi Joe,

> >>>
> >>> No, I think we can do this with adding new DM MDIO similar to DM PHY
> which
> >>> recently done. May be some sort of efforts but it is permanent.
> >> We do not have that driver now, so could we first have this patch? When
> >> DM MDIO ready, this piece code could be removed then?
> >
> > ie. up to Joe. Honestly this macro become removed in future, my point
> > here is why we need to maintain dead macro instead of adding proper
> > maintainable stuff. I'm pretty sure adding DM_MDIO is straight forward
> > and as of now just add what we need and rest will implement future.
> > You may become victim to others to move DM_ETH as soon as possible :)
> 
> It would be ideal if you wanted to implement DM MDIO, but I can also
> appreciate that this is not already there for you to use. As I
> commented when I acked this, the I'm OK with this approach at this
> time due to the state of the DM support in eth.
> 
> As a side note, maybe moving other boards that use this NIC to DM_ETH
> and removing non-DM support would be a better cleanup to start with.

Is someone already working on DM MDIO? 
Are there any patches already submitted for this? I couldn't find any.

Thanks
Calvin


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


Re: [U-Boot] [PATCH] bootvx: use program header for loading

2018-03-22 Thread Bin Meng
On Tue, Mar 20, 2018 at 9:18 PM, Christian Gmeiner
 wrote:
> The section header address is a VMA whereas the address found in
> the program header is a physical one. With this change it is
> possible to load and start a vx7 intel generic based image.
>
> $ readelf -l /tmp/vx7
>
> Elf file type is EXEC (Executable file)
> Entry point 0x408000
> There are 2 program headers, starting at offset 52
>
> Program Headers:
>   Type   Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
>   LOAD   0x001000 0x00408000 0x00408000 0x04000 0x04000 RWE 0x1000
>   LOAD   0x005000 0xe040c000 0x0040c000 0x583a84 0x5ccc70 RWE 0x1000
>
>  Section to Segment mapping:
>   Segment Sections...
>00 .text.locore .data.locore
>01 .text .eh_frame .wrs_build_vars .data .tls_data .tls_vars .bss
>
> $ readelf -S /tmp/vx7
> There are 13 section headers, starting at offset 0x588af8:
>
> Section Headers:
>   [Nr] Name  TypeAddr OffSize   ES Flg Lk Inf 
> Al
>   [ 0]   NULL 00 00 00  0   0 
>  0
>   [ 1] .text.locore  PROGBITS00408000 001000 00011e 00  AX  0   0 
> 16
>   [ 2] .data.locore  PROGBITS00409000 002000 003000 00  WA  0   0 
> 4096
>   [ 3] .text PROGBITSe040c000 005000 4802a0 00 WAX  0   0 
> 32
>   [ 4] .eh_frame PROGBITSe088c2a0 4852a0 0a1ed0 00   A  0   0 
>  4
>   [ 5] .wrs_build_vars   PROGBITSe092e170 527170 000190 00  Ax  0   0 
>  1
>   [ 6] .data PROGBITSe092f000 528000 060a70 00  WA  0   0 
> 4096
>   [ 7] .tls_data PROGBITSe098fa70 588a70 04 00   A  0   0 
>  4
>   [ 8] .tls_vars PROGBITSe098fa78 588a78 0c 00  WA  0   0 
>  4
>   [ 9] .bss  NOBITS  e098faa0 588a84 0491d0 00  WA  0   0 
> 32
>   [10] .shstrtab STRTAB   588a84 74 00  0   0 
>  1
>   [11] .symtab   SYMTAB   588d00 056ee0 10 12 
> 9758  4
>   [12] .strtab   STRTAB   5dfbe0 05f48a 00  0   0 
>  1
> Key to Flags:
>   W (write), A (alloc), X (execute), M (merge), S (strings)
>   I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
>   O (extra OS processing required) o (OS specific), p (processor specific)
>
> For completeness here are the same information for an old vx5 based image. 
> After
> this change it is possible to boot vx5 and vx7 (intel generic) images.
>
> $ readelf -l /tmp/vx5
>
> Elf file type is EXEC (Executable file)
> Entry point 0x308000
> There are 1 program headers, starting at offset 52
>
> Program Headers:
>  Type   Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
>  LOAD   0x60 0x00308000 0x00308000 0x3513a0 0x757860 RWE 0x20
>
> Section to Segment mapping:
>  Segment Sections...
>   00 .text .data .bss
> [christian@chgm-pc ~]$ readelf -S /tmp/vx5
> There are 12 section headers, starting at offset 0x356580:
>
> Section Headers:
>  [Nr] Name  TypeAddr OffSize   ES Flg Lk Inf 
> Al
>  [ 0]   NULL 00 00 00  0   0  > 0
>  [ 1] .text PROGBITS00308000 60 319b10 00 WAX  0   0 
> 32
>  [ 2] .data PROGBITS00621b20 319b80 037880 00  WA  0   0 
> 32
>  [ 3] .bss  NOBITS  006593a0 351400 4064c0 00  WA  0   0 
> 16
>  [ 4] .debug_arangesPROGBITS 351400 60 00  0   0  
> 1
>  [ 5] .debug_pubnames   PROGBITS 351460 00018b 00  0   0  
> 1
>  [ 6] .debug_info   PROGBITS 3515eb 003429 00  0   0  
> 1
>  [ 7] .debug_abbrev PROGBITS 354a14 000454 00  0   0  
> 1
>  [ 8] .debug_line   PROGBITS 354e68 0016a4 00  0   0  
> 1
>  [ 9] .shstrtab STRTAB   35650c 71 00  0   0  
> 1
>  [10] .symtab   SYMTAB   356760 0440e0 10 11 8574 
>  4
>  [11] .strtab   STRTAB   39a840 03e66c 00  0   0  
> 1
> Key to Flags:
>  W (write), A (alloc), X (execute), M (merge), S (strings)
>  I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
>  O (extra OS processing required) o (OS specific), p (processor specific)
>
> Signed-off-by: Christian Gmeiner 
> ---
>  cmd/elf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

Reviewed-by: Bin Meng 

Tested on MinnowMax with a VxWorks 6.9 image and a VxWorks 7 image
Tested-by: Bin Meng 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] pci: Fix decode regions for memory banks

2018-03-22 Thread Bin Meng
Hi,

On Thu, Feb 15, 2018 at 3:59 PM, Bernhard Messerklinger
 wrote:
> Since memory banks may not be located behind each other we need to add
> them separately.
>
> Signed-off-by: Bernhard Messerklinger 
> 
> ---
>
>  drivers/pci/pci-uclass.c | 17 -
>  1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
> index 5a24eb6428..ad43e8a27c 100644
> --- a/drivers/pci/pci-uclass.c
> +++ b/drivers/pci/pci-uclass.c
> @@ -815,7 +815,6 @@ static int decode_regions(struct pci_controller *hose, 
> ofnode parent_node,
>   ofnode node)
>  {
> int pci_addr_cells, addr_cells, size_cells;
> -   phys_addr_t base = 0, size;
> int cells_per_record;
> const u32 *prop;
> int len;
> @@ -874,6 +873,21 @@ static int decode_regions(struct pci_controller *hose, 
> ofnode parent_node,
> }
>
> /* Add a region for our local memory */
> +#ifdef CONFIG_NR_DRAM_BANKS
> +   bd_t *bd = gd->bd;
> +
> +   for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
> +   if (bd->bi_dram[i].size) {
> +   pci_set_region(hose->regions + hose->region_count++,
> +  bd->bi_dram[i].start,
> +  bd->bi_dram[i].start,
> +  bd->bi_dram[i].size,
> +  PCI_REGION_MEM | 
> PCI_REGION_SYS_MEMORY);
> +   }
> +   }
> +#else

Sorry for jumping out. With this commit, Intel Galileo board does not
boot any more. x86 defines CONFIG_NR_DRAM_BANKS in x86-common.h, so
this commit forces x86 to use the new logic instead of the old one,
which breaks things. I have not debugged this on how to fix it. Any
ideas?

> +   phys_addr_t base = 0, size;
> +
> size = gd->ram_size;
>  #ifdef CONFIG_SYS_SDRAM_BASE
> base = CONFIG_SYS_SDRAM_BASE;
> @@ -882,6 +896,7 @@ static int decode_regions(struct pci_controller *hose, 
> ofnode parent_node,
> size = gd->pci_ram_top - base;
> pci_set_region(hose->regions + hose->region_count++, base, base,
>size, PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
> +#endif
>
> return 0;
>  }
> --

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


Re: [U-Boot] [PATCH] arm: dts: am4372: fix DTC warnings

2018-03-22 Thread Felipe Balbi

Hi,

Tom Rini  writes:
> On Wed, Mar 21, 2018 at 03:44:45PM +0200, Felipe Balbi wrote:
>> The following warnings are fixed:
>> 
>> arch/arm/dts/am43x-epos-evm.dtb: Warning (interrupts_property): interrupts 
>> size is (8), expected multiple of 12 in /ocp/mcasp@48038000
>> arch/arm/dts/am43x-epos-evm.dtb: Warning (interrupts_property): interrupts 
>> size is (8), expected multiple of 12 in /ocp/mcasp@4803C000
>> arch/arm/dts/am43x-epos-evm.dtb: Warning (interrupts_property): Missing 
>> interrupt-controller or interrupt-map property in /ocp/gpmc@5000
>> arch/arm/dts/am43x-epos-evm.dtb: Warning (interrupts_property): Missing 
>> #interrupt-cells in interrupt-parent /ocp/gpmc@5000
>> arch/arm/dts/am437x-gp-evm.dtb: Warning (interrupts_property): interrupts 
>> size is (8), expected multiple of 12 in /ocp/mcasp@48038000
>> arch/arm/dts/am437x-gp-evm.dtb: Warning (interrupts_property): interrupts 
>> size is (8), expected multiple of 12 in /ocp/mcasp@4803C000
>> arch/arm/dts/am437x-idk-evm.dtb: Warning (interrupts_property): interrupts 
>> size is (8), expected multiple of 12 in /ocp/mcasp@48038000
>> arch/arm/dts/am437x-idk-evm.dtb: Warning (interrupts_property): interrupts 
>> size is (8), expected multiple of 12 in /ocp/mcasp@4803C000
>> arch/arm/dts/am437x-sk-evm.dtb: Warning (interrupts_property): interrupts 
>> size is (8), expected multiple of 12 in /ocp/mcasp@48038000
>> arch/arm/dts/am437x-sk-evm.dtb: Warning (interrupts_property): interrupts 
>> size is (8), expected multiple of 12 in /ocp/mcasp@4803C000
>> 
>> The fix was basically to copy the missing data from mainline linux.
>
> Shouldn't we just re-sync with v4.16-rc? Thanks!

sure, if you prefer doing that. But in that case, it seems like
extracting Linux's DTS to its own project (linux-dts.git??) and using
that as submodule would be far better.

-- 
balbi


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


[U-Boot] [PATCH] spi: fsl_qspi: Introduce is_controller_busy function

2018-03-22 Thread Rajat Srivastava
Some SoCs have different endianness of QSPI IP if compared
to endianness of core. The function is_controller_busy()
checks if the QSPI controller is busy or not, considering
the endianness of the QSPI IP.

Signed-off-by: Rajat Srivastava 
Reviewed-by: York Sun 
---
 drivers/spi/fsl_qspi.c | 31 +--
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/drivers/spi/fsl_qspi.c b/drivers/spi/fsl_qspi.c
index c201c7f823..e264709a3f 100644
--- a/drivers/spi/fsl_qspi.c
+++ b/drivers/spi/fsl_qspi.c
@@ -156,6 +156,25 @@ static void qspi_write32(u32 flags, u32 *addr, u32 val)
out_be32(addr, val) : out_le32(addr, val);
 }
 
+static inline int is_controller_busy(const struct fsl_qspi_priv *priv)
+{
+   u32 val;
+   const u32 mask = QSPI_SR_BUSY_MASK | QSPI_SR_AHB_ACC_MASK |
+QSPI_SR_IP_ACC_MASK;
+   unsigned int retry = 5;
+
+   do {
+   val = qspi_read32(priv->flags, >regs->sr);
+
+   if ((~val & mask) == mask)
+   return 0;
+
+   udelay(1);
+   } while (--retry);
+
+   return -ETIMEDOUT;
+}
+
 /* QSPI support swapping the flash read/write data
  * in hardware for LS102xA, but not for VF610 */
 static inline u32 qspi_endian_xchg(u32 data)
@@ -1020,11 +1039,7 @@ static int fsl_qspi_probe(struct udevice *bus)
priv->num_chipselect = plat->num_chipselect;
 
/* make sure controller is not busy anywhere */
-   ret = wait_for_bit_le32(>regs->sr,
-   QSPI_SR_BUSY_MASK |
-   QSPI_SR_AHB_ACC_MASK |
-   QSPI_SR_IP_ACC_MASK,
-   false, 100, false);
+   ret = is_controller_busy(priv);
 
if (ret) {
debug("ERROR : The controller is busy\n");
@@ -1187,11 +1202,7 @@ static int fsl_qspi_claim_bus(struct udevice *dev)
priv = dev_get_priv(bus);
 
/* make sure controller is not busy anywhere */
-   ret = wait_for_bit_le32(>regs->sr,
-   QSPI_SR_BUSY_MASK |
-   QSPI_SR_AHB_ACC_MASK |
-   QSPI_SR_IP_ACC_MASK,
-   false, 100, false);
+   ret = is_controller_busy(priv);
 
if (ret) {
debug("ERROR : The controller is busy\n");
-- 
2.14.1

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