Re: [U-Boot] [ANN] U-Boot v2018.01 is released

2018-01-15 Thread Wolfgang Denk
Dear Tom,

In message <20180109012807.GI2621@bill-the-cat> you wrote:
> 
> I've released v2018.01 and it's now live on git and FTP and ACD (along
> with PGP sig file).

Sorry for being late with the release statistics.  It't now online
as usual at [1]; here the short summary:

[1] http://www.denx.de/wiki/U-Boot/UbootStat_2018_01


Changes since v2017.11:

Processed 785 csets from 132 developers
29 employers found
A total of 46990 lines added, 31695 removed (delta 15295)

Developers with the most changesets
Heinrich Schuchardt 90 (11.5%)
Michal Simek71 (9.0%)
Simon Glass 56 (7.1%)
Marek Vasut 54 (6.9%)
Philipp Tomsich 51 (6.5%)
Masahiro Yamada 39 (5.0%)
Kever Yang  23 (2.9%)
Patrice Chotard 18 (2.3%)
Jagan Teki  15 (1.9%)
Rick Chen   15 (1.9%)
...

Developers with the most changed lines
Marek Vasut   20756 (29.9%)
Masahiro Yamada   5822 (8.4%)
Michal Simek  4873 (7.0%)
Heinrich Schuchardt   4043 (5.8%)
Kever Yang3956 (5.7%)
Neil Armstrong3425 (4.9%)
Simon Glass   3411 (4.9%)
Tuomas Tynkkynen  2970 (4.3%)
Yogesh Gaur   1333 (1.9%)
Peter Senna Tschudin  1105 (1.6%)
...

Developers with the most lines removed
Marek Vasut   4742 (15.0%)
Tuomas Tynkkynen  2684 (8.5%)
Jagan Teki 594 (1.9%)
Tom Rini   293 (0.9%)
Yogesh Gaur241 (0.8%)
Michal Simek   152 (0.5%)
Naga Sureshkumar Relli  25 (0.1%)
Alexander Graf  21 (0.1%)
Alan Ott20 (0.1%)
Andre Przywara  17 (0.1%)
...

Developers with the most signoffs (total 235)
Alexander Graf  74 (31.5%)
Michal Simek43 (18.3%)
Masahiro Yamada 17 (7.2%)
Stefan Roese14 (6.0%)
Boris Brezillon 10 (4.3%)
Alexey Brodkin   7 (3.0%)
Otavio Salvador  6 (2.6%)
Philipp Tomsich  6 (2.6%)
Martyn Welch 5 (2.1%)
Baruch Siach 4 (1.7%)
...

Developers with the most reviews (total 299)
Simon Glass 92 (30.8%)
York Sun42 (14.0%)
Philipp Tomsich 30 (10.0%)
Fabio Estevam   22 (7.4%)
Bin Meng21 (7.0%)
Vikas Manocha   12 (4.0%)
Jagan Teki  11 (3.7%)
Lukasz Majewski  9 (3.0%)
Stefano Babic7 (2.3%)
Heiko Schocher   7 (2.3%)
...

Developers with the most test credits (total 35)
Andy Yan 6 (17.1%)
Bin Meng 4 (11.4%)
Klaus Goger  3 (8.6%)
Jakob Unterwurzacher 3 (8.6%)
Philipp Tomsich  2 (5.7%)
Marc Gonzalez2 (5.7%)
Heiko Schocher   1 (2.9%)
Peng Fan 1 (2.9%)
Anatolij Gustschin   1 (2.9%)
Marek Vasut  1 (2.9%)
...

Developers who gave the most tested-by credits (total 35)
Philipp Tomsich 13 (37.1%)
Fabio Estevam4 (11.4%)
Boris Brezillon  2 (5.7%)
Jakob Unterwurzacher 1 (2.9%)
Heiko Schocher   1 (2.9%)
Peng Fan 1 (2.9%)
Simon Glass  1 (2.9%)
York Sun 1 (2.9%)
Stefan Roese 1 (2.9%)
Kever Yang   1 (2.9%)
...

Developers with the most report credits (total 13)
Stefan Agner 1 (7.7%)
Jonathan Gray1 (7.7%)
Andy Yan 1 (7.7%)
Michal Simek 1 (7.7%)
Florian Fainelli 1 (7.7%)
Varga Zsolt  1 (7.7%)
Jagan Teki   1 (7.7%)
Yousaf Kaukab1 (7.7%)
Tobi Wulff   1 (7.7%)
Jason Wu 1 (7.7%)
...

Developers who gave the most report credits (total 13)
Alexander Graf   3 (23.1%)
Fabio Estevam2 (15.4%)
Michal Simek 1 (7.7%)
Jagan Teki   1 (7.7%)
Philipp Tomsich  1 (7.7%)
Stephen Warren   1 (7.7%)
Alexey Brodkin   1 (7.7%)
Rob Herring  1 (7.7%)
Chris Packham1 (7.7%)
Siva Durga Prasad Paladugu1 (7.7%)

Top changeset contributors by employer
(Unknown)  385 (49.0%)
Xilinx 106 (13.5%)
NXP 67 (8.5%)
Google, Inc.56 (7.1%)
Socionext Inc.  40 (5.1%)
ST Microelectronics 20 (2.5%)
Free Electrons  14 (1.8%)
Konsulko Group  13 (1.7%)
DENX Software Engineering   11 (1.4%)
Intel7 (0.9%)
...

Top lines changed by employer
(Unknown) 45738 (65.9%)
Socionext Inc.5823 (8.4%)
Xilinx5163 (7.4%)
Google, Inc.  3411 (4.9%)
NXP   

Re: [U-Boot] UEFI on u-boot

2018-01-15 Thread Alexander Graf
Hi Udit,

On 15.01.18 10:09, Udit Kumar wrote:
> Hi Alex, 
> Hope you are doing great, 
> 
> Could you help on UEFI over the u-boot.
> 1- I couldn't locate EFI_DXE_SERVICES in u-boot, do you have plan to add 
> those 

Right now the model is that all device drivers are implemented by U-Boot
and that only exposes their interfaces to EFI applications. Implementing
DXE in U-Boot would open quite a big can of worms, as it would really
only be useful in compilation with PI which is a terrible interface :).

> 2- If I load  a driver (with bootefi) which install few protocols,  is this 
> ok to do with u-boot

It depends on how much the driver does, but in general yes. Heinrich is
currently working on making the iPXE iSCSI driver work, so his EFI
payload would expose an EFI block device to yet another payload running
after his.

> 3- if you say, 2 is ok then I hope these protocols are kept in some data 
> base, and this new protocol can be opened by an application 

Yes, the protocol database is now global and persistent across bootefi
invocations.

> 4- if there is some known limitation, like we cannot run DXE_driver  etc

What exactly are you trying to do? With the U-Boot UEFI implementation
we're trying to find a sweet spot between implementing as much as makes
sense, but not the whole UEFI world, as that would just bloat the code
needlessly.


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


Re: [U-Boot] [PATCH v1 03/05] db820c: add qualcomm dragonboard 820C support

2018-01-15 Thread Jorge Ramirez

On 01/10/2018 11:33 AM, Jorge Ramirez-Ortiz wrote:

From: Jorge Ramirez-Ortiz 

This commit adds support for 96Boards Dragonboard820C.


any feedback please?




The board is based on APQ8086 Qualcomm Soc, complying with the
96Boards specification.

Features
  - 4x Kyro CPU (64 bit) up to 2.15GHz
  - USB2.0
  - USB3.0
  - ISP
  - Qualcomm Hexagon DSP
  - SD 3.0 (UHS-I)
  - UFS 2.0
  - Qualcomm Adreno 530 GPU
  - GPS
  - BT 4.2
  - Wi-Fi 2.4GHz, 5GHz (802.11ac)
  - PCIe 2.0
  - MIPI-CSI, MIPI-DSI
  - I2S

U-Boot boots chained from LK (LK implements the fastboot protocol) in
64-bit mode.

For detailed build instructions see readme.txt in the board directory.

Signed-off-by: Jorge Ramirez-Ortiz 
---
  arch/arm/dts/Makefile  |   3 +-
  arch/arm/dts/dragonboard820c.dts   |  65 +++
  arch/arm/mach-snapdragon/Kconfig   |  10 +
  arch/arm/mach-snapdragon/Makefile  |   2 +
  arch/arm/mach-snapdragon/clock-apq8096.c   |  62 +++
  .../mach-snapdragon/include/mach/sysmap-apq8096.h  |  29 ++
  arch/arm/mach-snapdragon/sysmap-apq8096.c  |  32 ++
  board/qualcomm/dragonboard820c/Kconfig |  15 +
  board/qualcomm/dragonboard820c/MAINTAINERS |   6 +
  board/qualcomm/dragonboard820c/Makefile|   8 +
  board/qualcomm/dragonboard820c/dragonboard820c.c   | 128 ++
  board/qualcomm/dragonboard820c/head.S  |  34 ++
  board/qualcomm/dragonboard820c/readme.txt  | 463 +
  board/qualcomm/dragonboard820c/u-boot.lds  | 106 +
  configs/dragonboard820c_defconfig  |  37 ++
  include/configs/dragonboard820c.h  |  72 
  16 files changed, 1071 insertions(+), 1 deletion(-)
  create mode 100644 arch/arm/dts/dragonboard820c.dts
  create mode 100644 arch/arm/mach-snapdragon/clock-apq8096.c
  create mode 100644 arch/arm/mach-snapdragon/include/mach/sysmap-apq8096.h
  create mode 100644 arch/arm/mach-snapdragon/sysmap-apq8096.c
  create mode 100644 board/qualcomm/dragonboard820c/Kconfig
  create mode 100644 board/qualcomm/dragonboard820c/MAINTAINERS
  create mode 100644 board/qualcomm/dragonboard820c/Makefile
  create mode 100644 board/qualcomm/dragonboard820c/dragonboard820c.c
  create mode 100644 board/qualcomm/dragonboard820c/head.S
  create mode 100644 board/qualcomm/dragonboard820c/readme.txt
  create mode 100644 board/qualcomm/dragonboard820c/u-boot.lds
  create mode 100644 configs/dragonboard820c_defconfig
  create mode 100644 include/configs/dragonboard820c.h

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index a895c70..6d0587e 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -211,7 +211,8 @@ dtb-$(CONFIG_FSL_LSCH2) += fsl-ls1043a-qds-duart.dtb \
fsl-ls1012a-rdb.dtb \
fsl-ls1012a-frdm.dtb

-dtb-$(CONFIG_ARCH_SNAPDRAGON) += dragonboard410c.dtb
+dtb-$(CONFIG_TARGET_DRAGONBOARD410C) += dragonboard410c.dtb
+dtb-$(CONFIG_TARGET_DRAGONBOARD820C) += dragonboard820c.dtb

  dtb-$(CONFIG_STM32F7) += stm32f746-disco.dtb \
stm32f769-disco.dtb
diff --git a/arch/arm/dts/dragonboard820c.dts b/arch/arm/dts/dragonboard820c.dts
new file mode 100644
index 000..bad5a1e
--- /dev/null
+++ b/arch/arm/dts/dragonboard820c.dts
@@ -0,0 +1,65 @@
+/*
+ * Qualcomm APQ8096 based Dragonboard 820C board device tree source
+ *
+ * (C) Copyright 2017 Jorge Ramirez-Ortiz 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+/dts-v1/;
+
+#include "skeleton64.dtsi"
+
+/ {
+   model = "Qualcomm Technologies, Inc. DB820c";
+   compatible = "arrow,apq8096-db820c", "qcom,apq8096-sbc";
+   #address-cells = <2>;
+   #size-cells = <2>;
+
+   aliases {
+   serial0 = &blsp2_uart1;
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   memory {
+   device_type = "memory";
+   reg = <0 0x8000 0 0xc000>;
+   };
+
+   psci {
+   compatible = "arm,psci-1.0";
+   method = "smc";
+   };
+
+   soc: soc {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   ranges = <0 0 0 0x>;
+   compatible = "simple-bus";
+
+   gcc: clock-controller@30 {
+   compatible = "qcom,gcc-msm8996";
+   #clock-cells = <1>;
+   #reset-cells = <1>;
+   #power-domain-cells = <1>;
+   reg = <0x30 0x9>;
+   };
+
+   blsp2_uart1: serial@75b {
+   compatible = "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm";
+   reg = <0x75b 0x1000>;
+   };
+
+   sdhc2: sdhci@74a4900 {
+compatible = "qcom,sdhci-msm-v4";
+reg = <0x74a4900 0x314>, <0x74a4000 0x800>;
+index = <0x0>;
+ 

[U-Boot] [PATCH] arm64: zynqmp: Remove unused empty functions

2018-01-15 Thread Michal Simek
Remove functions which are no longer renerated by PCW.

Signed-off-by: Michal Simek 
---

 board/xilinx/zynqmp/xil_io.h | 12 
 1 file changed, 12 deletions(-)

diff --git a/board/xilinx/zynqmp/xil_io.h b/board/xilinx/zynqmp/xil_io.h
index 679d234b0709..0e4f81064ca8 100644
--- a/board/xilinx/zynqmp/xil_io.h
+++ b/board/xilinx/zynqmp/xil_io.h
@@ -11,18 +11,6 @@
 
 #define xil_printf(...)
 
-void Xil_ICacheEnable(void)
-{}
-
-void Xil_DCacheEnable(void)
-{}
-
-void Xil_ICacheDisable(void)
-{}
-
-void Xil_DCacheDisable(void)
-{}
-
 void Xil_Out32(unsigned long addr, unsigned long val)
 {
writel(val, addr);
-- 
1.9.1

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


[U-Boot] [RESEND PATCH v2 02/27] cfi_flash: Fix style of pointer declarations

2018-01-15 Thread Mario Six
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/mtd/cfi_flash.c | 48 
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 0dc7f4a6ba..a1b217cc0c 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -204,7 +204,7 @@ unsigned long flash_sector_size(flash_info_t *info, 
flash_sect_t sect)
  * create an address based on the offset and the port width
  */
 static inline void *
-flash_map(flash_info_t * info, flash_sect_t sect, uint offset)
+flash_map(flash_info_t *info, flash_sect_t sect, uint offset)
 {
unsigned int byte_offset = offset * info->portwidth;

@@ -283,7 +283,7 @@ static void flash_printqry(struct cfi_qry *qry)
 /*---
  * read a character at a port width address
  */
-static inline uchar flash_read_uchar(flash_info_t * info, uint offset)
+static inline uchar flash_read_uchar(flash_info_t *info, uint offset)
 {
uchar *cp;
uchar retval;
@@ -301,7 +301,7 @@ static inline uchar flash_read_uchar(flash_info_t * info, 
uint offset)
 /*---
  * read a word at a port width address, assume 16bit bus
  */
-static inline ushort flash_read_word(flash_info_t * info, uint offset)
+static inline ushort flash_read_word(flash_info_t *info, uint offset)
 {
ushort *addr, retval;

@@ -316,7 +316,7 @@ static inline ushort flash_read_word(flash_info_t * info, 
uint offset)
  * read a long word by picking the least significant byte of each maximum
  * port size word. Swap for ppc format.
  */
-static ulong flash_read_long (flash_info_t * info, flash_sect_t sect,
+static ulong flash_read_long (flash_info_t *info, flash_sect_t sect,
  uint offset)
 {
uchar *addr;
@@ -402,7 +402,7 @@ static void flash_write_cmd(flash_info_t *info, 
flash_sect_t sect,
flash_unmap(info, sect, offset, addr);
 }

-static void flash_unlock_seq(flash_info_t * info, flash_sect_t sect)
+static void flash_unlock_seq(flash_info_t *info, flash_sect_t sect)
 {
flash_write_cmd(info, sect, info->addr_unlock1, AMD_CMD_UNLOCK_START);
flash_write_cmd(info, sect, info->addr_unlock2, AMD_CMD_UNLOCK_ACK);
@@ -410,7 +410,7 @@ static void flash_unlock_seq(flash_info_t * info, 
flash_sect_t sect)

 /*---
  */
-static int flash_isequal(flash_info_t * info, flash_sect_t sect,
+static int flash_isequal(flash_info_t *info, flash_sect_t sect,
  uint offset, uchar cmd)
 {
void *addr;
@@ -458,7 +458,7 @@ static int flash_isequal(flash_info_t * info, flash_sect_t 
sect,

 /*---
  */
-static int flash_isset(flash_info_t * info, flash_sect_t sect,
+static int flash_isset(flash_info_t *info, flash_sect_t sect,
uint offset, uchar cmd)
 {
void *addr;
@@ -491,7 +491,7 @@ static int flash_isset(flash_info_t * info, flash_sect_t 
sect,

 /*---
  */
-static int flash_toggle(flash_info_t * info, flash_sect_t sect,
+static int flash_toggle(flash_info_t *info, flash_sect_t sect,
 uint offset, uchar cmd)
 {
void *addr;
@@ -529,7 +529,7 @@ static int flash_toggle(flash_info_t * info, flash_sect_t 
sect,
  * This routine checks the status of the chip and returns true if the
  * chip is busy.
  */
-static int flash_is_busy(flash_info_t * info, flash_sect_t sect)
+static int flash_is_busy(flash_info_t *info, flash_sect_t sect)
 {
int retval;

@@ -566,7 +566,7 @@ static int flash_is_busy(flash_info_t * info, flash_sect_t 
sect)
  *  wait for XSR.7 to be set. Time out with an error if it does not.
  *  This routine does not set the flash to read-array mode.
  */
-static int flash_status_check(flash_info_t * info, flash_sect_t sector,
+static int flash_status_check(flash_info_t *info, flash_sect_t sector,
   ulong tout, char *prompt)
 {
ulong start;
@@ -604,7 +604,7 @@ static int flash_status_check(flash_info_t * info, 
flash_sect_t sector,
  *
  * This routine sets the flash to read-array mode.
  */
-static int flash_full_status_check(flash_info_t * info, flash_sect_t sector,
+static int flash_full_status_check(flash_info_t *info, flash_sect_t sector,
ulong tout, char *prompt)
 {
int retcode;
@@ -709,7 +709,7 @@ static int flash_status_poll(flash_info_t *info, void *src, 
void *dst,

 /*---
  */
-static void flash_add_byte(flash_info_t * info, cfiword_t * cword, uchar c)
+static void flash_add_byte(flash_info_t *info, cfiword_t *cword, uchar c)
 {
 #if defined(__LITTLE_ENDIAN) 

[U-Boot] [RESEND PATCH v2 03/27] cfi_flash: Fix Parenthesis spacing

2018-01-15 Thread Mario Six
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/mtd/cfi_flash.c | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index a1b217cc0c..e8f1739254 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -230,7 +230,7 @@ static void flash_make_cmd(flash_info_t *info, u32 cmd, 
void *cmdbuf)
uchar val;
uchar *cp = (uchar *) cmdbuf;

-   for (i = info->portwidth; i > 0; i--){
+   for (i = info->portwidth; i > 0; i--) {
cword_offset = (info->portwidth-i)%info->chipwidth;
 #if defined(__LITTLE_ENDIAN) || defined(CONFIG_SYS_WRITE_SWAPPED_DATA)
cp_offset = info->portwidth - i;
@@ -511,8 +511,8 @@ static int flash_toggle(flash_info_t *info, flash_sect_t 
sect,
retval = flash_read32(addr) != flash_read32(addr);
break;
case FLASH_CFI_64BIT:
-   retval = ( (flash_read32( addr ) != flash_read32( addr )) ||
-  (flash_read32(addr+4) != flash_read32(addr+4)) );
+   retval = ((flash_read32(addr) != flash_read32(addr)) ||
+  (flash_read32(addr+4) != flash_read32(addr+4)));
break;
default:
retval = 0;
@@ -1719,7 +1719,7 @@ static void cmdset_amd_read_jedec_ids(flash_info_t *info)
info->sr_supported = feature & 0x1;
}

-   switch (info->chipwidth){
+   switch (info->chipwidth) {
case FLASH_CFI_8BIT:
info->device_id = flash_read_uchar(info,
FLASH_OFFSET_DEVICE_ID);
@@ -1838,7 +1838,7 @@ static int flash_detect_legacy(phys_addr_t base, int 
banknum)
}
}

-   switch(info->vendor) {
+   switch (info->vendor) {
case CFI_CMDSET_INTEL_PROG_REGIONS:
case CFI_CMDSET_INTEL_STANDARD:
case CFI_CMDSET_INTEL_EXTENDED:
@@ -1925,12 +1925,12 @@ static int __flash_detect_cfi(flash_info_t *info, 
struct cfi_qry *qry)
 * modify the unlock address if we are
 * in compatibility mode
 */
-   if (/* x8/x16 in x8 mode */
-   ((info->chipwidth == FLASH_CFI_BY8) &&
-   (info->interface == FLASH_CFI_X8X16)) ||
-   /* x16/x32 in x16 mode */
-   ((info->chipwidth == FLASH_CFI_BY16) &&
-   (info->interface == FLASH_CFI_X16X32)))
+   if (/* x8/x16 in x8 mode */
+   ((info->chipwidth == FLASH_CFI_BY8) &&
+   (info->interface == FLASH_CFI_X8X16)) ||
+   /* x16/x32 in x16 mode */
+   ((info->chipwidth == FLASH_CFI_BY16) &&
+   (info->interface == FLASH_CFI_X16X32)))
{
info->addr_unlock1 = 0xaaa;
info->addr_unlock2 = 0x555;
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 01/27] cfi_flash: Fix space between function name and parenthesis

2018-01-15 Thread Mario Six
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/mtd/cfi_flash.c | 428 
 1 file changed, 214 insertions(+), 214 deletions(-)

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index f096e039cb..0dc7f4a6ba 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -204,7 +204,7 @@ unsigned long flash_sector_size(flash_info_t *info, 
flash_sect_t sect)
  * create an address based on the offset and the port width
  */
 static inline void *
-flash_map (flash_info_t * info, flash_sect_t sect, uint offset)
+flash_map(flash_info_t * info, flash_sect_t sect, uint offset)
 {
unsigned int byte_offset = offset * info->portwidth;

@@ -247,17 +247,17 @@ static void flash_make_cmd(flash_info_t *info, u32 cmd, 
void *cmdbuf)
 /*---
  * Debug support
  */
-static void print_longlong (char *str, unsigned long long data)
+static void print_longlong(char *str, unsigned long long data)
 {
int i;
char *cp;

cp = (char *) &data;
for (i = 0; i < 8; i++)
-   sprintf (&str[i * 2], "%2.2x", *cp++);
+   sprintf(&str[i * 2], "%2.2x", *cp++);
 }

-static void flash_printqry (struct cfi_qry *qry)
+static void flash_printqry(struct cfi_qry *qry)
 {
u8 *p = (u8 *)qry;
int x, y;
@@ -283,31 +283,31 @@ static void flash_printqry (struct cfi_qry *qry)
 /*---
  * read a character at a port width address
  */
-static inline uchar flash_read_uchar (flash_info_t * info, uint offset)
+static inline uchar flash_read_uchar(flash_info_t * info, uint offset)
 {
uchar *cp;
uchar retval;

-   cp = flash_map (info, 0, offset);
+   cp = flash_map(info, 0, offset);
 #if defined(__LITTLE_ENDIAN) || defined(CONFIG_SYS_WRITE_SWAPPED_DATA)
retval = flash_read8(cp);
 #else
retval = flash_read8(cp + info->portwidth - 1);
 #endif
-   flash_unmap (info, 0, offset, cp);
+   flash_unmap(info, 0, offset, cp);
return retval;
 }

 /*---
  * read a word at a port width address, assume 16bit bus
  */
-static inline ushort flash_read_word (flash_info_t * info, uint offset)
+static inline ushort flash_read_word(flash_info_t * info, uint offset)
 {
ushort *addr, retval;

-   addr = flash_map (info, 0, offset);
-   retval = flash_read16 (addr);
-   flash_unmap (info, 0, offset, addr);
+   addr = flash_map(info, 0, offset);
+   retval = flash_read16(addr);
+   flash_unmap(info, 0, offset, addr);
return retval;
 }

@@ -325,13 +325,13 @@ static ulong flash_read_long (flash_info_t * info, 
flash_sect_t sect,
 #ifdef DEBUG
int x;
 #endif
-   addr = flash_map (info, sect, offset);
+   addr = flash_map(info, sect, offset);

 #ifdef DEBUG
-   debug ("long addr is at %p info->portwidth = %d\n", addr,
+   debug("long addr is at %p info->portwidth = %d\n", addr,
   info->portwidth);
for (x = 0; x < 4 * info->portwidth; x++) {
-   debug ("addr[%x] = 0x%x\n", x, flash_read8(addr + x));
+   debug("addr[%x] = 0x%x\n", x, flash_read8(addr + x));
}
 #endif
 #if defined(__LITTLE_ENDIAN) || defined(CONFIG_SYS_WRITE_SWAPPED_DATA)
@@ -360,22 +360,22 @@ static void flash_write_cmd(flash_info_t *info, 
flash_sect_t sect,
void *addr;
cfiword_t cword;

-   addr = flash_map (info, sect, offset);
-   flash_make_cmd (info, cmd, &cword);
+   addr = flash_map(info, sect, offset);
+   flash_make_cmd(info, cmd, &cword);
switch (info->portwidth) {
case FLASH_CFI_8BIT:
-   debug ("fwc addr %p cmd %x %x 8bit x %d bit\n", addr, cmd,
+   debug("fwc addr %p cmd %x %x 8bit x %d bit\n", addr, cmd,
   cword.w8, info->chipwidth << CFI_FLASH_SHIFT_WIDTH);
flash_write8(cword.w8, addr);
break;
case FLASH_CFI_16BIT:
-   debug ("fwc addr %p cmd %x %4.4x 16bit x %d bit\n", addr,
+   debug("fwc addr %p cmd %x %4.4x 16bit x %d bit\n", addr,
   cmd, cword.w16,
   info->chipwidth << CFI_FLASH_SHIFT_WIDTH);
flash_write16(cword.w16, addr);
break;
case FLASH_CFI_32BIT:
-   debug ("fwc addr %p cmd %x %8.8x 32bit x %d bit\n", addr,
+   debug("fwc addr %p cmd %x %8.8x 32bit x %d bit\n", addr,
   cmd, cword.w32,
   info->chipwidth << CFI_FLASH_SHIFT_WIDTH);
flash_write32(cword.w32, addr);
@@ -385,9 +385,9 @@ static void flash_write_cmd(flash_info_t *info, 
flash_sect_t sect,
{
char str[20];

-   print_longlong (str, cword.w64);
+ 

[U-Boot] [RESEND PATCH v2 04/27] cfi_flash: Fix whitespace with casting

2018-01-15 Thread Mario Six
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/mtd/cfi_flash.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index e8f1739254..2dc6b09cd9 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -234,10 +234,10 @@ static void flash_make_cmd(flash_info_t *info, u32 cmd, 
void *cmdbuf)
cword_offset = (info->portwidth-i)%info->chipwidth;
 #if defined(__LITTLE_ENDIAN) || defined(CONFIG_SYS_WRITE_SWAPPED_DATA)
cp_offset = info->portwidth - i;
-   val = *((uchar*)&cmd_le + cword_offset);
+   val = *((uchar *)&cmd_le + cword_offset);
 #else
cp_offset = i - 1;
-   val = *((uchar*)&cmd + sizeof(u32) - cword_offset - 1);
+   val = *((uchar *)&cmd + sizeof(u32) - cword_offset - 1);
 #endif
cp[cp_offset] = (cword_offset >= sizeof(u32)) ? 0x00 : val;
}
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 09/27] cfi_flash: Fix logical continuations

2018-01-15 Thread Mario Six
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/mtd/cfi_flash.c | 26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index e2469055b8..eebd641e36 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -611,8 +611,8 @@ static int flash_full_status_check(flash_info_t *info, 
flash_sect_t sector,
case CFI_CMDSET_INTEL_PROG_REGIONS:
case CFI_CMDSET_INTEL_EXTENDED:
case CFI_CMDSET_INTEL_STANDARD:
-   if ((retcode == ERR_OK)
-   && !flash_isset(info, sector, 0, FLASH_STATUS_DONE)) {
+   if ((retcode == ERR_OK) &&
+   !flash_isset(info, sector, 0, FLASH_STATUS_DONE)) {
retcode = ERR_INVAL;
printf("Flash %s error at address %lx\n", prompt,
info->start[sector]);
@@ -761,8 +761,8 @@ static flash_sect_t find_sector(flash_info_t *info, ulong 
addr)
if ((info != saved_info) || (sector >= info->sector_count))
sector = 0;

-   while ((info->start[sector] < addr)
-   && (sector < info->sector_count - 1))
+   while ((info->start[sector] < addr) &&
+   (sector < info->sector_count - 1))
sector++;
while ((info->start[sector] > addr) && (sector > 0))
/*
@@ -1435,8 +1435,8 @@ static inline int manufact_match(flash_info_t *info, u32 
manu)

 static int cfi_protect_bugfix(flash_info_t *info, long sector, int prot)
 {
-   if (manufact_match(info, INTEL_MANUFACT)
-   && info->device_id == NUMONYX_256MBIT) {
+   if (manufact_match(info, INTEL_MANUFACT) &&
+   info->device_id == NUMONYX_256MBIT) {
/*
 * see errata called
 * "Numonyx Axcell P33/P30 Specification Update" :)
@@ -1807,8 +1807,8 @@ static int flash_detect_legacy(phys_addr_t base, int 
banknum)
(ulong)map_physmem(base,
   info->portwidth,
   MAP_NOCACHE);
-   if (info->portwidth == FLASH_CFI_8BIT
-   && info->interface == FLASH_CFI_X8X16) {
+   if (info->portwidth == FLASH_CFI_8BIT &&
+   info->interface == FLASH_CFI_X8X16) {
info->addr_unlock1 = 0x2AAA;
info->addr_unlock2 = 0x;
} else {
@@ -1892,9 +1892,9 @@ static int __flash_detect_cfi(flash_info_t *info, struct 
cfi_qry *qry)
 cfi_offset++) {
flash_write_cmd(info, 0, flash_offset_cfi[cfi_offset],
 FLASH_CMD_CFI);
-   if (flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP, 'Q')
-   && flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP + 1, 'R')
-   && flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP + 2, 'Y')) {
+   if (flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP, 'Q') &&
+   flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP + 1, 'R') 
&&
+   flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP + 2, 'Y')) 
{
flash_read_cfi(info, qry, FLASH_OFFSET_CFI_RESP,
sizeof(struct cfi_qry));
info->interface = le16_to_cpu(qry->interface_desc);
@@ -2144,8 +2144,8 @@ ulong flash_get_size(phys_addr_t base, int banknum)

size_ratio = info->portwidth / info->chipwidth;
/* if the chip is x8/x16 reduce the ratio by half */
-   if ((info->interface == FLASH_CFI_X8X16)
-   && (info->chipwidth == FLASH_CFI_BY8)) {
+   if ((info->interface == FLASH_CFI_X8X16) &&
+   (info->chipwidth == FLASH_CFI_BY8)) {
size_ratio >>= 1;
}
debug("size_ratio %d port %d bits chip %d bits\n",
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 06/27] cfi_flash: Fix spacing around casts/operators

2018-01-15 Thread Mario Six
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/mtd/cfi_flash.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index b77fd3c0a2..0d58914e44 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -231,7 +231,7 @@ static void flash_make_cmd(flash_info_t *info, u32 cmd, 
void *cmdbuf)
uchar *cp = (uchar *) cmdbuf;

for (i = info->portwidth; i > 0; i--) {
-   cword_offset = (info->portwidth-i)%info->chipwidth;
+   cword_offset = (info->portwidth - i) % info->chipwidth;
 #if defined(__LITTLE_ENDIAN) || defined(CONFIG_SYS_WRITE_SWAPPED_DATA)
cp_offset = info->portwidth - i;
val = *((uchar *)&cmd_le + cword_offset);
@@ -252,7 +252,7 @@ static void print_longlong(char *str, unsigned long long 
data)
int i;
char *cp;

-   cp = (char *) &data;
+   cp = (char *)&data;
for (i = 0; i < 8; i++)
sprintf(&str[i * 2], "%2.2x", *cp++);
 }
@@ -512,7 +512,7 @@ static int flash_toggle(flash_info_t *info, flash_sect_t 
sect,
break;
case FLASH_CFI_64BIT:
retval = ((flash_read32(addr) != flash_read32(addr)) ||
-  (flash_read32(addr+4) != flash_read32(addr+4)));
+  (flash_read32(addr + 4) != flash_read32(addr + 4)));
break;
default:
retval = 0;
@@ -1212,7 +1212,7 @@ void flash_print_info(flash_info_t *info)
printf("%s flash (%d x %d)",
info->name,
(info->portwidth << 3), (info->chipwidth << 3));
-   if (info->size < 1024*1024)
+   if (info->size < 1024 * 1024)
printf("  Size: %ld kB in %d Sectors\n",
info->size >> 10, info->sector_count);
else
@@ -1888,7 +1888,7 @@ static void __flash_cmd_reset(flash_info_t *info)
flash_write_cmd(info, 0, 0, FLASH_CMD_RESET);
 }
 void flash_cmd_reset(flash_info_t *info)
-   __attribute__((weak,alias("__flash_cmd_reset")));
+   __attribute__((weak, alias("__flash_cmd_reset")));

 static int __flash_detect_cfi(flash_info_t *info, struct cfi_qry *qry)
 {
@@ -2035,7 +2035,7 @@ static void flash_fixup_sst(flash_info_t *info, struct 
cfi_qry *qry)
if (info->device_id == 0x5D23 || /* SST39VF3201B */
info->device_id == 0x5C23) { /* SST39VF3202B */
/* set sector granularity to 4KB */
-   info->cmd_erase_sector=0x50;
+   info->cmd_erase_sector = 0x50;
}
 }

@@ -2093,9 +2093,9 @@ ulong flash_get_size(phys_addr_t base, int banknum)
num_erase_regions = qry.num_erase_regions;

if (info->ext_addr) {
-   info->cfi_version = (ushort) flash_read_uchar(info,
+   info->cfi_version = (ushort)flash_read_uchar(info,
info->ext_addr + 3) << 8;
-   info->cfi_version |= (ushort) flash_read_uchar(info,
+   info->cfi_version |= (ushort)flash_read_uchar(info,
info->ext_addr + 4);
}

@@ -2392,7 +2392,7 @@ unsigned long flash_init(void)
 #ifndef CONFIG_SYS_FLASH_QUIET_TEST
printf("## Unknown flash on Bank %d "
"- Size = 0x%08lx = %ld MB\n",
-   i+1, flash_info[i].size,
+   i + 1, flash_info[i].size,
flash_info[i].size >> 20);
 #endif /* CONFIG_SYS_FLASH_QUIET_TEST */
}
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 05/27] cfi_flash: Fix indent of case statements

2018-01-15 Thread Mario Six
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/mtd/cfi_flash.c | 200 
 1 file changed, 100 insertions(+), 100 deletions(-)

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 2dc6b09cd9..b77fd3c0a2 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -1220,29 +1220,29 @@ void flash_print_info(flash_info_t *info)
info->size >> 20, info->sector_count);
printf("  ");
switch (info->vendor) {
-   case CFI_CMDSET_INTEL_PROG_REGIONS:
-   printf("Intel Prog Regions");
-   break;
-   case CFI_CMDSET_INTEL_STANDARD:
-   printf("Intel Standard");
-   break;
-   case CFI_CMDSET_INTEL_EXTENDED:
-   printf("Intel Extended");
-   break;
-   case CFI_CMDSET_AMD_STANDARD:
-   printf("AMD Standard");
-   break;
-   case CFI_CMDSET_AMD_EXTENDED:
-   printf("AMD Extended");
-   break;
+   case CFI_CMDSET_INTEL_PROG_REGIONS:
+   printf("Intel Prog Regions");
+   break;
+   case CFI_CMDSET_INTEL_STANDARD:
+   printf("Intel Standard");
+   break;
+   case CFI_CMDSET_INTEL_EXTENDED:
+   printf("Intel Extended");
+   break;
+   case CFI_CMDSET_AMD_STANDARD:
+   printf("AMD Standard");
+   break;
+   case CFI_CMDSET_AMD_EXTENDED:
+   printf("AMD Extended");
+   break;
 #ifdef CONFIG_FLASH_CFI_LEGACY
-   case CFI_CMDSET_AMD_LEGACY:
-   printf("AMD Legacy");
-   break;
+   case CFI_CMDSET_AMD_LEGACY:
+   printf("AMD Legacy");
+   break;
 #endif
-   default:
-   printf("Unknown (%d)", info->vendor);
-   break;
+   default:
+   printf("Unknown (%d)", info->vendor);
+   break;
}
printf(" command set, Manufacturer ID: 0x%02X, Device ID: 0x",
info->manufacturer_id);
@@ -1480,94 +1480,94 @@ int flash_real_protect(flash_info_t *info, long sector, 
int prot)
int retcode = 0;

switch (info->vendor) {
-   case CFI_CMDSET_INTEL_PROG_REGIONS:
-   case CFI_CMDSET_INTEL_STANDARD:
-   case CFI_CMDSET_INTEL_EXTENDED:
-   if (!cfi_protect_bugfix(info, sector, prot)) {
+   case CFI_CMDSET_INTEL_PROG_REGIONS:
+   case CFI_CMDSET_INTEL_STANDARD:
+   case CFI_CMDSET_INTEL_EXTENDED:
+   if (!cfi_protect_bugfix(info, sector, prot)) {
+   flash_write_cmd(info, sector, 0,
+FLASH_CMD_CLEAR_STATUS);
+   flash_write_cmd(info, sector, 0,
+   FLASH_CMD_PROTECT);
+   if (prot)
flash_write_cmd(info, sector, 0,
-FLASH_CMD_CLEAR_STATUS);
+   FLASH_CMD_PROTECT_SET);
+   else
flash_write_cmd(info, sector, 0,
-   FLASH_CMD_PROTECT);
-   if (prot)
-   flash_write_cmd(info, sector, 0,
-   FLASH_CMD_PROTECT_SET);
-   else
-   flash_write_cmd(info, sector, 0,
-   FLASH_CMD_PROTECT_CLEAR);
+   FLASH_CMD_PROTECT_CLEAR);

+   }
+   break;
+   case CFI_CMDSET_AMD_EXTENDED:
+   case CFI_CMDSET_AMD_STANDARD:
+   /* U-Boot only checks the first byte */
+   if (manufact_match(info, ATM_MANUFACT)) {
+   if (prot) {
+   flash_unlock_seq(info, 0);
+   flash_write_cmd(info, 0,
+   info->addr_unlock1,
+   ATM_CMD_SOFTLOCK_START);
+   flash_unlock_seq(info, 0);
+   flash_write_cmd(info, sector, 0,
+   ATM_CMD_LOCK_SECT);
+   } else {
+   flash_write_cmd(info, 0,
+   info->addr_unlock1,
+   AMD_CMD_UNLOCK_START);
+   if (info->device_id == ATM_ID_BV6416)
+   flash_write_cmd(info, sector,
+ 

[U-Boot] [RESEND PATCH v2 08/27] cfi_flash: Remove braces for single-statement blocks

2018-01-15 Thread Mario Six
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/mtd/cfi_flash.c | 15 +--
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 9cc1b2b16f..e2469055b8 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -329,9 +329,8 @@ static ulong flash_read_long (flash_info_t *info, 
flash_sect_t sect,
 #ifdef DEBUG
debug("long addr is at %p info->portwidth = %d\n", addr,
   info->portwidth);
-   for (x = 0; x < 4 * info->portwidth; x++) {
+   for (x = 0; x < 4 * info->portwidth; x++)
debug("addr[%x] = 0x%x\n", x, flash_read8(addr + x));
-   }
 #endif
 #if defined(__LITTLE_ENDIAN) || defined(CONFIG_SYS_WRITE_SWAPPED_DATA)
retval = ((flash_read8(addr) << 16) |
@@ -1065,11 +1064,9 @@ int flash_erase(flash_info_t *info, int s_first, int 
s_last)
}

prot = 0;
-   for (sect = s_first; sect <= s_last; ++sect) {
-   if (info->protect[sect]) {
+   for (sect = s_first; sect <= s_last; ++sect)
+   if (info->protect[sect])
prot++;
-   }
-   }
if (prot) {
printf("- Warning: %d protected sectors will not be erased!\n",
prot);
@@ -1396,9 +1393,8 @@ int write_buff(flash_info_t *info, uchar *src, ulong 
addr, ulong cnt)
 #else
while (cnt >= info->portwidth) {
cword.w32 = 0;
-   for (i = 0; i < info->portwidth; i++) {
+   for (i = 0; i < info->portwidth; i++)
flash_add_byte(info, &cword, *src++);
-   }
if ((rc = flash_write_cfiword(info, wp, cword)) != 0)
return rc;
wp += info->portwidth;
@@ -1410,9 +1406,8 @@ int write_buff(flash_info_t *info, uchar *src, ulong 
addr, ulong cnt)
}
 #endif /* CONFIG_SYS_FLASH_USE_BUFFER_WRITE */

-   if (cnt == 0) {
+   if (cnt == 0)
return (0);
-   }

/*
 * handle unaligned tail bytes
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 13/27] cfi_flash: Add missing braces in blocks

2018-01-15 Thread Mario Six
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/mtd/cfi_flash.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 0a24e9173a..53842443eb 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -1154,10 +1154,12 @@ int flash_erase(flash_info_t *info, int s_first, int 
s_last)
st = flash_status_poll(info, &cword, dest,
   info->erase_blk_tout, 
"erase");
flash_unmap(info, sect, 0, dest);
-   } else
+   } else {
st = flash_full_status_check(info, sect,
 
info->erase_blk_tout,
 "erase");
+   }
+
if (st)
rcode = 1;
else if (flash_verbose)
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 07/27] cfi_flash: Fix missing/superfluous lines

2018-01-15 Thread Mario Six
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/mtd/cfi_flash.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 0d58914e44..9cc1b2b16f 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -269,6 +269,7 @@ static void flash_printqry(struct cfi_qry *qry)
debug(" ");
for (y = 0; y < 16; y++) {
unsigned char c = p[x + y];
+
if (c >= 0x20 && c <= 0x7e)
debug("%c", c);
else
@@ -279,7 +280,6 @@ static void flash_printqry(struct cfi_qry *qry)
 }
 #endif

-
 /*---
  * read a character at a port width address
  */
@@ -311,7 +311,6 @@ static inline ushort flash_read_word(flash_info_t *info, 
uint offset)
return retval;
 }

-
 /*---
  * read a long word by picking the least significant byte of each maximum
  * port size word. Swap for ppc format.
@@ -356,7 +355,6 @@ static ulong flash_read_long (flash_info_t *info, 
flash_sect_t sect,
 static void flash_write_cmd(flash_info_t *info, flash_sect_t sect,
uint offset, u32 cmd)
 {
-
void *addr;
cfiword_t cword;

@@ -1048,7 +1046,6 @@ out_unmap:
 }
 #endif /* CONFIG_SYS_FLASH_USE_BUFFER_WRITE */

-
 /*---
  */
 int flash_erase(flash_info_t *info, int s_first, int s_last)
@@ -1080,7 +1077,6 @@ int flash_erase(flash_info_t *info, int s_first, int 
s_last)
putc('\n');
}

-
for (sect = s_first; sect <= s_last; sect++) {
if (ctrlc()) {
printf("\n");
@@ -1154,6 +1150,7 @@ int flash_erase(flash_info_t *info, int s_first, int 
s_last)
if (use_flash_status_poll(info)) {
cfiword_t cword;
void *dest;
+
cword.w64 = 0xULL;
dest = flash_map(info, sect, 0);
st = flash_status_poll(info, &cword, dest,
@@ -1494,7 +1491,6 @@ int flash_real_protect(flash_info_t *info, long sector, 
int prot)
else
flash_write_cmd(info, sector, 0,
FLASH_CMD_PROTECT_CLEAR);
-
}
break;
case CFI_CMDSET_AMD_EXTENDED:
@@ -1579,7 +1575,6 @@ int flash_real_protect(flash_info_t *info, long sector, 
int prot)
if ((retcode =
 flash_full_status_check(info, sector, info->erase_blk_tout,
  prot ? "protect" : "unprotect")) == 0) {
-
info->protect[sector] = prot;

/*
@@ -1887,6 +1882,7 @@ static void __flash_cmd_reset(flash_info_t *info)
udelay(1);
flash_write_cmd(info, 0, 0, FLASH_CMD_RESET);
 }
+
 void flash_cmd_reset(flash_info_t *info)
__attribute__((weak, alias("__flash_cmd_reset")));

@@ -2370,6 +2366,7 @@ unsigned long flash_init(void)
 #ifdef CONFIG_SYS_FLASH_PROTECTION
/* read environment from EEPROM */
char s[64];
+
env_get_f("unlock", s, sizeof(s));
 #endif

--
2.11.0

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


[U-Boot] [RESEND PATCH v2 12/27] cfi_flash: Remove unnecessary braces

2018-01-15 Thread Mario Six
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/mtd/cfi_flash.c | 48 
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index a21c407ed7..0a24e9173a 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -611,7 +611,7 @@ static int flash_full_status_check(flash_info_t *info, 
flash_sect_t sector,
case CFI_CMDSET_INTEL_PROG_REGIONS:
case CFI_CMDSET_INTEL_EXTENDED:
case CFI_CMDSET_INTEL_STANDARD:
-   if ((retcode == ERR_OK) &&
+   if (retcode == ERR_OK &&
!flash_isset(info, sector, 0, FLASH_STATUS_DONE)) {
retcode = ERR_INVAL;
printf("Flash %s error at address %lx\n", prompt,
@@ -758,7 +758,7 @@ static flash_sect_t find_sector(flash_info_t *info, ulong 
addr)
static flash_info_t *saved_info; /* previously used flash bank */
flash_sect_t sector = saved_sector;

-   if ((info != saved_info) || (sector >= info->sector_count))
+   if (info != saved_info || sector >= info->sector_count)
sector = 0;

while ((info->start[sector] < addr) &&
@@ -1059,7 +1059,7 @@ int flash_erase(flash_info_t *info, int s_first, int 
s_last)
puts("Can't erase unknown flash type - aborted\n");
return 1;
}
-   if ((s_first < 0) || (s_first > s_last)) {
+   if (s_first < 0 || s_first > s_last) {
puts("- no sectors to erase\n");
return 1;
}
@@ -1247,7 +1247,7 @@ void flash_print_info(flash_info_t *info)
printf(info->chipwidth == FLASH_CFI_16BIT ? "%04X" : "%02X",
info->device_id2);
}
-   if ((info->vendor == CFI_CMDSET_AMD_STANDARD) && (info->legacy_unlock))
+   if (info->vendor == CFI_CMDSET_AMD_STANDARD && info->legacy_unlock)
printf("\n  Advanced Sector Protection (PPB) enabled");
printf("\n  Erase timeout: %ld ms, write timeout: %ld ms\n",
info->erase_blk_tout,
@@ -1291,7 +1291,7 @@ void flash_print_info(flash_info_t *info)
 #define FLASH_SHOW_PROGRESS(scale, dots, digit, dots_sub) \
if (flash_verbose) { \
dots -= dots_sub; \
-   if ((scale > 0) && (dots <= 0)) { \
+   if (scale > 0 && dots <= 0) { \
if ((digit % 5) == 0) \
printf("%d", digit / 5); \
else \
@@ -1577,7 +1577,7 @@ int flash_real_protect(flash_info_t *info, long sector, 
int prot)
 * On some of Intel's flash chips (marked via legacy_unlock)
 * unprotect unprotects all locking.
 */
-   if ((prot == 0) && (info->legacy_unlock)) {
+   if (prot == 0 && info->legacy_unlock) {
flash_sect_t i;

for (i = 0; i < info->sector_count; i++) {
@@ -1636,10 +1636,10 @@ static void cfi_reverse_geometry(struct cfi_qry *qry)
u32 tmp;

for (i = 0, j = qry->num_erase_regions - 1; i < j; i++, j--) {
-   tmp = get_unaligned(&(qry->erase_region_info[i]));
-   put_unaligned(get_unaligned(&(qry->erase_region_info[j])),
- &(qry->erase_region_info[i]));
-   put_unaligned(tmp, &(qry->erase_region_info[j]));
+   tmp = get_unaligned(&qry->erase_region_info[i]);
+   put_unaligned(get_unaligned(&qry->erase_region_info[j]),
+ &qry->erase_region_info[i]);
+   put_unaligned(tmp, &qry->erase_region_info[j]);
}
 }

@@ -1919,11 +1919,11 @@ static int __flash_detect_cfi(flash_info_t *info, 
struct cfi_qry *qry)
 * in compatibility mode
 */
if (/* x8/x16 in x8 mode */
-   ((info->chipwidth == FLASH_CFI_BY8) &&
-   (info->interface == FLASH_CFI_X8X16)) ||
+   (info->chipwidth == FLASH_CFI_BY8 &&
+   info->interface == FLASH_CFI_X8X16) ||
/* x16/x32 in x16 mode */
-   ((info->chipwidth == FLASH_CFI_BY16) &&
-   (info->interface == FLASH_CFI_X16X32)))
+   (info->chipwidth == FLASH_CFI_BY16 &&
+   info->interface == FLASH_CFI_X16X32))
{
info->addr_unlock1 = 0xaaa;
info->addr_unlock2 = 0x555;
@@ -2040,8 +2040,8 @@ static void flash_fixup_num(flash_info_t *info, struct 
cfi_qry *qry)
 * There's an app note from Numonyx on this issue.
 * So adjust the buffer size for M29EW while operating in 8-bit mode
 */
-   if (((qry->max_buf_write_

[U-Boot] [RESEND PATCH v2 19/27] cfi_flash: Use u8 pointers instead of void pointers

2018-01-15 Thread Mario Six
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/mtd/cfi_flash.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 48086ded5c..fced9847ef 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -491,7 +491,7 @@ static int flash_isset(flash_info_t *info, flash_sect_t 
sect,
 static int flash_toggle(flash_info_t *info, flash_sect_t sect,
 uint offset, uchar cmd)
 {
-   void *addr;
+   u8 *addr;
cfiword_t cword;
int retval;

@@ -872,9 +872,9 @@ static int flash_write_cfibuffer(flash_info_t *info, ulong 
dest, uchar *cp,
flash_sect_t sector;
int cnt;
int retcode;
-   void *src = cp;
-   void *dst = (void *)dest;
-   void *dst2 = dst;
+   u8 *src = cp;
+   u8 *dst = (u8 *)dest;
+   u8 *dst2 = dst;
int flag = 1;
uint offset = 0;
unsigned int shift;
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 4/4] core: Make device_is_compatible live-tree compatible

2018-01-15 Thread Mario Six
Judging from its name and parameters, device_is_compatible looks like it
is compatible with a live device tree, but it actually isn't.

Make it compatible with a live device tree.

Reviewed-by: Simon Glass 
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/core/device.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/core/device.c b/drivers/core/device.c
index 9a46a7bbe5..144ac2a991 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -703,8 +704,12 @@ int device_set_name(struct udevice *dev, const char *name)
 bool device_is_compatible(struct udevice *dev, const char *compat)
 {
const void *fdt = gd->fdt_blob;
+   ofnode node = dev_ofnode(dev);

-   return !fdt_node_check_compatible(fdt, dev_of_offset(dev), compat);
+   if (ofnode_is_np(node))
+   return of_device_is_compatible(ofnode_to_np(node), compat, 
NULL, NULL);
+   else
+   return !fdt_node_check_compatible(fdt, ofnode_to_offset(node), 
compat);
 }

 bool of_machine_is_compatible(const char *compat)
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 16/27] cfi_flash: Fix placement of brace

2018-01-15 Thread Mario Six
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/mtd/cfi_flash.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 5b3c071b30..7aa379b0d8 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -1925,8 +1925,7 @@ static int __flash_detect_cfi(flash_info_t *info, struct 
cfi_qry *qry)
info->interface == FLASH_CFI_X8X16) ||
/* x16/x32 in x16 mode */
(info->chipwidth == FLASH_CFI_BY16 &&
-   info->interface == FLASH_CFI_X16X32))
-   {
+   info->interface == FLASH_CFI_X16X32)) {
info->addr_unlock1 = 0xaaa;
info->addr_unlock2 = 0x555;
}
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 1/2] lib: fdtdec: Fix whitespace style violations

2018-01-15 Thread Mario Six
Fix some whitespace-related style violations in fdtdec.c.

Reviewed-by: Simon Glass 
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 lib/fdtdec.c | 56 ++--
 1 file changed, 30 insertions(+), 26 deletions(-)

diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 30ec6b92b2..7b555189d5 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -83,8 +83,9 @@ const char *fdtdec_get_compatible(enum fdt_compat_id id)
 }

 fdt_addr_t fdtdec_get_addr_size_fixed(const void *blob, int node,
-   const char *prop_name, int index, int na, int ns,
-   fdt_size_t *sizep, bool translate)
+ const char *prop_name, int index, int na,
+ int ns, fdt_size_t *sizep,
+ bool translate)
 {
const fdt32_t *prop, *prop_end;
const fdt32_t *prop_addr, *prop_size, *prop_after_size;
@@ -138,8 +139,9 @@ fdt_addr_t fdtdec_get_addr_size_fixed(const void *blob, int 
node,
 }

 fdt_addr_t fdtdec_get_addr_size_auto_parent(const void *blob, int parent,
-   int node, const char *prop_name, int index, fdt_size_t *sizep,
-   bool translate)
+   int node, const char *prop_name,
+   int index, fdt_size_t *sizep,
+   bool translate)
 {
int na, ns;

@@ -164,8 +166,9 @@ fdt_addr_t fdtdec_get_addr_size_auto_parent(const void 
*blob, int parent,
 }

 fdt_addr_t fdtdec_get_addr_size_auto_noparent(const void *blob, int node,
-   const char *prop_name, int index, fdt_size_t *sizep,
-   bool translate)
+ const char *prop_name, int index,
+ fdt_size_t *sizep,
+ bool translate)
 {
int parent;

@@ -182,7 +185,7 @@ fdt_addr_t fdtdec_get_addr_size_auto_noparent(const void 
*blob, int node,
 }

 fdt_addr_t fdtdec_get_addr_size(const void *blob, int node,
-   const char *prop_name, fdt_size_t *sizep)
+   const char *prop_name, fdt_size_t *sizep)
 {
int ns = sizep ? (sizeof(fdt_size_t) / sizeof(fdt32_t)) : 0;

@@ -191,15 +194,14 @@ fdt_addr_t fdtdec_get_addr_size(const void *blob, int 
node,
  ns, sizep, false);
 }

-fdt_addr_t fdtdec_get_addr(const void *blob, int node,
-   const char *prop_name)
+fdt_addr_t fdtdec_get_addr(const void *blob, int node, const char *prop_name)
 {
return fdtdec_get_addr_size(blob, node, prop_name, NULL);
 }

 #if defined(CONFIG_PCI) && defined(CONFIG_DM_PCI)
 int fdtdec_get_pci_addr(const void *blob, int node, enum fdt_pci_space type,
-   const char *prop_name, struct fdt_pci_addr *addr)
+   const char *prop_name, struct fdt_pci_addr *addr)
 {
const u32 *cell;
int len;
@@ -308,7 +310,7 @@ int fdtdec_get_pci_bar32(struct udevice *dev, struct 
fdt_pci_addr *addr,
 #endif

 uint64_t fdtdec_get_uint64(const void *blob, int node, const char *prop_name,
-   uint64_t default_val)
+  uint64_t default_val)
 {
const uint64_t *cell64;
int length;
@@ -349,14 +351,13 @@ enum fdt_compat_id fdtdec_lookup(const void *blob, int 
node)
return COMPAT_UNKNOWN;
 }

-int fdtdec_next_compatible(const void *blob, int node,
-   enum fdt_compat_id id)
+int fdtdec_next_compatible(const void *blob, int node, enum fdt_compat_id id)
 {
return fdt_node_offset_by_compatible(blob, node, compat_names[id]);
 }

 int fdtdec_next_compatible_subnode(const void *blob, int node,
-   enum fdt_compat_id id, int *depthp)
+  enum fdt_compat_id id, int *depthp)
 {
do {
node = fdt_next_node(blob, node, depthp);
@@ -370,8 +371,8 @@ int fdtdec_next_compatible_subnode(const void *blob, int 
node,
return -FDT_ERR_NOTFOUND;
 }

-int fdtdec_next_alias(const void *blob, const char *name,
-   enum fdt_compat_id id, int *upto)
+int fdtdec_next_alias(const void *blob, const char *name, enum fdt_compat_id 
id,
+ int *upto)
 {
 #define MAX_STR_LEN 20
char str[MAX_STR_LEN + 20];
@@ -393,7 +394,8 @@ int fdtdec_next_alias(const void *blob, const char *name,
 }

 int fdtdec_find_aliases_for_id(const void *blob, const char *name,
-   enum fdt_compat_id id, int *node_list, int maxcount)
+  enum fdt_compat_id id, int *node_list,
+  int maxcount)
 {
memset(node_list, '\0', sizeof(*node_list) * maxcount);

@@ -402,7 +404,8 @@ int fdtdec_find_aliases_for_id(const void *blob, const char 
*name,

 /* TODO: Can we tighten this code up a little? */
 int fdtdec_add_aliases_for_id(const v

[U-Boot] [RESEND PATCH v2 24/27] cfi_flash: Fix long lines

2018-01-15 Thread Mario Six
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/mtd/cfi_flash.c | 31 +++
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 61c2e6379d..88c47cad90 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -175,7 +175,8 @@ __maybe_weak u64 flash_read64(void *addr)

 /*---
  */
-#if defined(CONFIG_ENV_IS_IN_FLASH) || defined(CONFIG_ENV_ADDR_REDUND) || 
(CONFIG_SYS_MONITOR_BASE >= CONFIG_SYS_FLASH_BASE)
+#if defined(CONFIG_ENV_IS_IN_FLASH) || defined(CONFIG_ENV_ADDR_REDUND) || \
+   (CONFIG_SYS_MONITOR_BASE >= CONFIG_SYS_FLASH_BASE)
 static flash_info_t *flash_get_info(ulong base)
 {
int i;
@@ -569,8 +570,9 @@ static int flash_status_check(flash_info_t *info, 
flash_sect_t sector,
ulong start;

 #if CONFIG_SYS_HZ != 1000
+   /* Avoid overflow for large HZ */
if ((ulong)CONFIG_SYS_HZ > 10)
-   tout *= (ulong)CONFIG_SYS_HZ / 1000;  /* for a big HZ, avoid 
overflow */
+   tout *= (ulong)CONFIG_SYS_HZ / 1000;
else
tout = DIV_ROUND_UP(tout * (ulong)CONFIG_SYS_HZ, 1000);
 #endif
@@ -661,8 +663,9 @@ static int flash_status_poll(flash_info_t *info, void *src, 
void *dst,
int ready;

 #if CONFIG_SYS_HZ != 1000
+   /* Avoid overflow for large HZ */
if ((ulong)CONFIG_SYS_HZ > 10)
-   tout *= (ulong)CONFIG_SYS_HZ / 1000;  /* for a big HZ, avoid 
overflow */
+   tout *= (ulong)CONFIG_SYS_HZ / 1000;
else
tout = DIV_ROUND_UP(tout * (ulong)CONFIG_SYS_HZ, 1000);
 #endif
@@ -937,7 +940,8 @@ static int flash_write_cfibuffer(flash_info_t *info, ulong 
dest, uchar *cp,
case CFI_CMDSET_INTEL_STANDARD:
case CFI_CMDSET_INTEL_EXTENDED:
write_cmd = (info->vendor == CFI_CMDSET_INTEL_PROG_REGIONS) ?
-   FLASH_CMD_WRITE_BUFFER_PROG : 
FLASH_CMD_WRITE_TO_BUFFER;
+   FLASH_CMD_WRITE_BUFFER_PROG :
+   FLASH_CMD_WRITE_TO_BUFFER;
flash_write_cmd(info, sector, 0, FLASH_CMD_CLEAR_STATUS);
flash_write_cmd(info, sector, 0, FLASH_CMD_READ_STATUS);
flash_write_cmd(info, sector, 0, write_cmd);
@@ -1152,7 +1156,8 @@ int flash_erase(flash_info_t *info, int s_first, int 
s_last)
cword.w64 = 0xULL;
dest = flash_map(info, sect, 0);
st = flash_status_poll(info, &cword, dest,
-  info->erase_blk_tout, 
"erase");
+  info->erase_blk_tout,
+  "erase");
flash_unmap(info, sect, 0, dest);
} else {
st = flash_full_status_check(info, sect,
@@ -1561,9 +1566,11 @@ int flash_real_protect(flash_info_t *info, long sector, 
int prot)
flash_write_cmd(info, sector, 0, FLASH_CMD_CLEAR_STATUS);
flash_write_cmd(info, sector, 0, FLASH_CMD_PROTECT);
if (prot)
-   flash_write_cmd(info, sector, 0, FLASH_CMD_PROTECT_SET);
+   flash_write_cmd(info, sector, 0,
+   FLASH_CMD_PROTECT_SET);
else
-   flash_write_cmd(info, sector, 0, 
FLASH_CMD_PROTECT_CLEAR);
+   flash_write_cmd(info, sector, 0,
+   FLASH_CMD_PROTECT_CLEAR);
 #endif
};

@@ -1899,9 +1906,9 @@ static int __flash_detect_cfi(flash_info_t *info, struct 
cfi_qry *qry)
flash_write_cmd(info, 0, flash_offset_cfi[cfi_offset],
 FLASH_CMD_CFI);
if (flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP, 'Q') &&
-   flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP + 1, 'R') 
&&
-   flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP + 2, 'Y')) 
{
-   flash_read_cfi(info, qry, FLASH_OFFSET_CFI_RESP,
+   flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP + 1, 'R') &&
+   flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP + 2, 'Y')) {
+   flash_read_cfi(info, qry, FLASH_OFFSET_CFI_RESP,
sizeof(struct cfi_qry));
info->interface = le16_to_cpu(qry->interface_desc);

@@ -2182,8 +2189,8 @@ ulong flash_get_size(phys_addr_t base, int banknum)
tmp >>= 16;
erase_region_size =
(tmp & 0x) ? ((tmp & 0x) * 256) : 128;
-   debug("erase_region_count = %d erase_region_size = 
%

[U-Boot] [RESEND PATCH v2 25/27] cfi_flash: Fix indention

2018-01-15 Thread Mario Six
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/mtd/cfi_flash.c | 238 
 1 file changed, 118 insertions(+), 120 deletions(-)

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 88c47cad90..347382f529 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -213,7 +213,7 @@ flash_map(flash_info_t *info, flash_sect_t sect, uint 
offset)
 }

 static inline void flash_unmap(flash_info_t *info, flash_sect_t sect,
-   unsigned int offset, void *addr)
+  unsigned int offset, void *addr)
 {
 }

@@ -329,7 +329,7 @@ static ulong flash_read_long (flash_info_t *info, 
flash_sect_t sect,

 #ifdef DEBUG
debug("long addr is at %p info->portwidth = %d\n", addr,
-  info->portwidth);
+ info->portwidth);
for (x = 0; x < 4 * info->portwidth; x++)
debug("addr[%x] = 0x%x\n", x, flash_read8(addr + x));
 #endif
@@ -363,19 +363,19 @@ static void flash_write_cmd(flash_info_t *info, 
flash_sect_t sect,
switch (info->portwidth) {
case FLASH_CFI_8BIT:
debug("fwc addr %p cmd %x %x 8bit x %d bit\n", addr, cmd,
-  cword.w8, info->chipwidth << CFI_FLASH_SHIFT_WIDTH);
+ cword.w8, info->chipwidth << CFI_FLASH_SHIFT_WIDTH);
flash_write8(cword.w8, addr);
break;
case FLASH_CFI_16BIT:
debug("fwc addr %p cmd %x %4.4x 16bit x %d bit\n", addr,
-  cmd, cword.w16,
-  info->chipwidth << CFI_FLASH_SHIFT_WIDTH);
+ cmd, cword.w16,
+ info->chipwidth << CFI_FLASH_SHIFT_WIDTH);
flash_write16(cword.w16, addr);
break;
case FLASH_CFI_32BIT:
debug("fwc addr %p cmd %x %8.8x 32bit x %d bit\n", addr,
-  cmd, cword.w32,
-  info->chipwidth << CFI_FLASH_SHIFT_WIDTH);
+ cmd, cword.w32,
+ info->chipwidth << CFI_FLASH_SHIFT_WIDTH);
flash_write32(cword.w32, addr);
break;
case FLASH_CFI_64BIT:
@@ -386,8 +386,8 @@ static void flash_write_cmd(flash_info_t *info, 
flash_sect_t sect,
print_longlong(str, cword.w64);

debug("fwrite addr %p cmd %x %s 64 bit x %d bit\n",
-  addr, cmd, str,
-  info->chipwidth << CFI_FLASH_SHIFT_WIDTH);
+ addr, cmd, str,
+ info->chipwidth << CFI_FLASH_SHIFT_WIDTH);
}
 #endif
flash_write64(cword.w64, addr);
@@ -408,8 +408,8 @@ static void flash_unlock_seq(flash_info_t *info, 
flash_sect_t sect)

 /*---
  */
-static int flash_isequal(flash_info_t *info, flash_sect_t sect,
- uint offset, uchar cmd)
+static int flash_isequal(flash_info_t *info, flash_sect_t sect, uint offset,
+uchar cmd)
 {
void *addr;
cfiword_t cword;
@@ -456,8 +456,8 @@ static int flash_isequal(flash_info_t *info, flash_sect_t 
sect,

 /*---
  */
-static int flash_isset(flash_info_t *info, flash_sect_t sect,
-   uint offset, uchar cmd)
+static int flash_isset(flash_info_t *info, flash_sect_t sect, uint offset,
+  uchar cmd)
 {
void *addr;
cfiword_t cword;
@@ -489,8 +489,8 @@ static int flash_isset(flash_info_t *info, flash_sect_t 
sect,

 /*---
  */
-static int flash_toggle(flash_info_t *info, flash_sect_t sect,
-uint offset, uchar cmd)
+static int flash_toggle(flash_info_t *info, flash_sect_t sect, uint offset,
+   uchar cmd)
 {
u8 *addr;
cfiword_t cword;
@@ -544,12 +544,12 @@ static int flash_is_busy(flash_info_t *info, flash_sect_t 
sect)
 #endif
if (info->sr_supported) {
flash_write_cmd(info, sect, info->addr_unlock1,
-FLASH_CMD_READ_STATUS);
+   FLASH_CMD_READ_STATUS);
retval = !flash_isset(info, sect, 0,
-  FLASH_STATUS_DONE);
+ FLASH_STATUS_DONE);
} else {
retval = flash_toggle(info, sect, 0,
-  AMD_STATUS_TOGGLE);
+ AMD_STATUS_TOGGLE);
}

break;
@@ -565,7 +565,7 @@ static int flash_is_busy(flash_info_t *info, flash_sect_t 
sect)
  *  This routine does not set the flash t

[U-Boot] [RESEND PATCH v2 15/27] cfi_flash: Fix else after break

2018-01-15 Thread Mario Six
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/mtd/cfi_flash.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 4c5e1568e6..5b3c071b30 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -1826,9 +1826,9 @@ static int flash_detect_legacy(phys_addr_t base, int 
banknum)
info->device_id2);
if (jedec_flash_match(info, info->start[0]))
break;
-   else
-   unmap_physmem((void *)info->start[0],
- info->portwidth);
+
+   unmap_physmem((void *)info->start[0],
+ info->portwidth);
}
}

--
2.11.0

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


[U-Boot] [RESEND PATCH v2 2/4] clk: clk_fixed_rate: Fix style violation

2018-01-15 Thread Mario Six
Fix a mis-indented function call in clk_fixed_rate.c

Reviewed-by: Simon Glass 
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/clk/clk_fixed_rate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/clk_fixed_rate.c b/drivers/clk/clk_fixed_rate.c
index 63565b6ed8..9dd6bc5726 100644
--- a/drivers/clk/clk_fixed_rate.c
+++ b/drivers/clk/clk_fixed_rate.c
@@ -31,8 +31,8 @@ const struct clk_ops clk_fixed_rate_ops = {
 static int clk_fixed_rate_ofdata_to_platdata(struct udevice *dev)
 {
 #if !CONFIG_IS_ENABLED(OF_PLATDATA)
-   to_clk_fixed_rate(dev)->fixed_rate = dev_read_u32_default(dev,
-   "clock-frequency", 0);
+   to_clk_fixed_rate(dev)->fixed_rate =
+   dev_read_u32_default(dev, "clock-frequency", 0);
 #endif

return 0;
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 1/4] core: ofnode: Fix style violations

2018-01-15 Thread Mario Six
There are some style violations in ofnode.c; fix those.

Reviewed-by: Simon Glass 
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/core/ofnode.c | 18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index 0030ab962e..ebcf64d867 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -296,7 +296,8 @@ int ofnode_parse_phandle_with_args(ofnode node, const char 
*list_name,
int ret;

ret = of_parse_phandle_with_args(ofnode_to_np(node),
-   list_name, cells_name, index, &args);
+list_name, cells_name, index,
+&args);
if (ret)
return ret;
ofnode_from_of_phandle_args(&args, out_args);
@@ -305,8 +306,9 @@ int ofnode_parse_phandle_with_args(ofnode node, const char 
*list_name,
int ret;

ret = fdtdec_parse_phandle_with_args(gd->fdt_blob,
-   ofnode_to_offset(node), list_name, cells_name,
-   cell_count, index, &args);
+ofnode_to_offset(node),
+list_name, cells_name,
+cell_count, index, &args);
if (ret)
return ret;
ofnode_from_fdtdec_phandle_args(&args, out_args);
@@ -534,10 +536,10 @@ int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space 
type,
addr->phys_mid = fdt32_to_cpu(cell[1]);
addr->phys_lo = fdt32_to_cpu(cell[1]);
break;
-   } else {
-   cell += (FDT_PCI_ADDR_CELLS +
-FDT_PCI_SIZE_CELLS);
}
+
+   cell += (FDT_PCI_ADDR_CELLS +
+FDT_PCI_SIZE_CELLS);
}

if (i == num) {
@@ -546,10 +548,10 @@ int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space 
type,
}

return 0;
-   } else {
-   ret = -EINVAL;
}

+   ret = -EINVAL;
+
 fail:
debug("(not found)\n");
return ret;
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 17/27] cfi_flash: Remove return from void function

2018-01-15 Thread Mario Six
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/mtd/cfi_flash.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 7aa379b0d8..d16357343f 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -1280,7 +1280,6 @@ void flash_print_info(flash_info_t *info)
 #endif
}
putc('\n');
-   return;
 }

 /*---
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 10/27] cfi_flash: Use __func__ macro instead of function name

2018-01-15 Thread Mario Six
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/mtd/cfi_flash.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index eebd641e36..6ae1ac871f 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -555,7 +555,7 @@ static int flash_is_busy(flash_info_t *info, flash_sect_t 
sect)
default:
retval = 0;
}
-   debug("flash_is_busy: %d\n", retval);
+   debug("%s: %d\n", __func__, retval);
return retval;
 }

--
2.11.0

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


[U-Boot] [RESEND PATCH v2 3/4] core: Add {ofnode, dev}_translate_address functions

2018-01-15 Thread Mario Six
Reviewed-by: Simon Glass 
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/core/ofnode.c |  8 
 drivers/core/read.c   |  5 +
 include/dm/ofnode.h   | 13 +
 include/dm/read.h | 17 +
 4 files changed, 43 insertions(+)

diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index ebcf64d867..0b32f9b085 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -644,3 +644,11 @@ int ofnode_read_resource_byname(ofnode node, const char 
*name,

return ofnode_read_resource(node, index, res);
 }
+
+u64 ofnode_translate_address(ofnode node, const fdt32_t *in_addr)
+{
+   if (ofnode_is_np(node))
+   return of_translate_address(ofnode_to_np(node), in_addr);
+   else
+   return fdt_translate_address(gd->fdt_blob, 
ofnode_to_offset(node), in_addr);
+}
diff --git a/drivers/core/read.c b/drivers/core/read.c
index 08955f81fc..19207a3906 100644
--- a/drivers/core/read.c
+++ b/drivers/core/read.c
@@ -188,3 +188,8 @@ int dev_read_resource_byname(struct udevice *dev, const 
char *name,
 {
return ofnode_read_resource_byname(dev_ofnode(dev), name, res);
 }
+
+u64 dev_translate_address(struct udevice *dev, const fdt32_t *in_addr)
+{
+   return ofnode_translate_address(dev_ofnode(dev), in_addr);
+}
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index 8b9932a569..c359a60f95 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -652,4 +652,17 @@ int ofnode_read_resource_byname(ofnode node, const char 
*name,
 ofnode_valid(node); \
 node = ofnode_next_subnode(node))

+/**
+ * ofnode_translate_address() - Tranlate a device-tree address
+ *
+ * Translate an address from the device-tree into a CPU physical address. This
+ * function walks up the tree and applies the various bus mappings along the
+ * way.
+ *
+ * @ofnode: Device tree node giving the context in which to translate the
+ *  address
+ * @in_addr: pointer to the address to translate
+ * @return the translated address; OF_BAD_ADDR on error
+ */
+u64 ofnode_translate_address(ofnode node, const fdt32_t *in_addr);
 #endif
diff --git a/include/dm/read.h b/include/dm/read.h
index 8114037e97..2551e5f0dc 100644
--- a/include/dm/read.h
+++ b/include/dm/read.h
@@ -410,6 +410,18 @@ int dev_read_resource(struct udevice *dev, uint index, 
struct resource *res);
 int dev_read_resource_byname(struct udevice *dev, const char *name,
 struct resource *res);

+/**
+ * dev_translate_address() - Tranlate a device-tree address
+ *
+ * Translate an address from the device-tree into a CPU physical address.  This
+ * function walks up the tree and applies the various bus mappings along the
+ * way.
+ *
+ * @dev: device giving the context in which to translate the address
+ * @in_addr: pointer to the address to translate
+ * @return the translated address; OF_BAD_ADDR on error
+ */
+u64 dev_translate_address(struct udevice *dev, const fdt32_t *in_addr);
 #else /* CONFIG_DM_DEV_READ_INLINE is enabled */

 static inline int dev_read_u32_default(struct udevice *dev,
@@ -582,6 +594,11 @@ static inline int dev_read_resource_byname(struct udevice 
*dev,
return ofnode_read_resource_byname(dev_ofnode(dev), name, res);
 }

+static inline u64 dev_translate_address(struct udevice *dev, const fdt32_t 
*in_addr)
+{
+   return ofnode_translate_address(dev_ofnode(dev), in_addr);
+}
+
 #endif /* CONFIG_DM_DEV_READ_INLINE */

 /**
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 27/27] mtd: cfi_flash: Make live-tree compatible

2018-01-15 Thread Mario Six
Make the cfi_flash driver compatible with a live device tree.

Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/mtd/cfi_flash.c | 21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index da44e6184e..e5509fe353 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -2461,27 +2461,28 @@ unsigned long flash_init(void)
 #ifdef CONFIG_CFI_FLASH /* for driver model */
 static int cfi_flash_probe(struct udevice *dev)
 {
-   void *blob = (void *)gd->fdt_blob;
-   int node = dev_of_offset(dev);
const fdt32_t *cell;
-   phys_addr_t addr;
-   int parent, addrc, sizec;
+   int addrc, sizec;
int len, idx;

-   parent = fdt_parent_offset(blob, node);
-   fdt_support_default_count_cells(blob, parent, &addrc, &sizec);
-   /* decode regs, there may be multiple reg tuples. */
-   cell = fdt_getprop(blob, node, "reg", &len);
+   addrc = dev_read_addr_cells(dev);
+   sizec = dev_read_size_cells(dev);
+
+   /* decode regs; there may be multiple reg tuples. */
+   cell = dev_read_prop(dev, "reg", &len);
if (!cell)
return -ENOENT;
idx = 0;
len /= sizeof(fdt32_t);
while (idx < len) {
-   addr = fdt_translate_address((void *)blob,
-node, cell + idx);
+   phys_addr_t addr;
+
+   addr = dev_translate_address(dev, cell + idx);
+
flash_info[cfi_flash_num_flash_banks].dev = dev;
flash_info[cfi_flash_num_flash_banks].base = addr;
cfi_flash_num_flash_banks++;
+
idx += addrc + sizec;
}
gd->bd->bi_flashstart = flash_info[0].base;
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 18/27] cfi_flash: Remove assignments from if conditions

2018-01-15 Thread Mario Six
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/mtd/cfi_flash.c | 18 +++---
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index d16357343f..48086ded5c 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -1339,7 +1339,8 @@ int write_buff(flash_info_t *info, uchar *src, ulong 
addr, ulong cnt)
wp = (addr & ~(info->portwidth - 1));

/* handle unaligned start */
-   if ((aln = addr - wp) != 0) {
+   aln = addr - wp;
+   if (aln != 0) {
cword.w32 = 0;
p = (uchar *)wp;
for (i = 0; i < aln; ++i)
@@ -1370,7 +1371,8 @@ int write_buff(flash_info_t *info, uchar *src, ulong 
addr, ulong cnt)
cword.w32 = 0;
for (i = 0; i < info->portwidth; i++)
flash_add_byte(info, &cword, *src++);
-   if ((rc = flash_write_cfiword(info, wp, cword)) != 0)
+   rc = flash_write_cfiword(info, wp, cword);
+   if (rc != 0)
return rc;
wp += info->portwidth;
cnt -= info->portwidth;
@@ -1381,7 +1383,8 @@ int write_buff(flash_info_t *info, uchar *src, ulong 
addr, ulong cnt)
i = buffered_size - (wp % buffered_size);
if (i > cnt)
i = cnt;
-   if ((rc = flash_write_cfibuffer(info, wp, src, i)) != ERR_OK)
+   rc = flash_write_cfibuffer(info, wp, src, i);
+   if (rc != ERR_OK)
return rc;
i -= i & (info->portwidth - 1);
wp += i;
@@ -1397,7 +1400,8 @@ int write_buff(flash_info_t *info, uchar *src, ulong 
addr, ulong cnt)
cword.w32 = 0;
for (i = 0; i < info->portwidth; i++)
flash_add_byte(info, &cword, *src++);
-   if ((rc = flash_write_cfiword(info, wp, cword)) != 0)
+   rc = flash_write_cfiword(info, wp, cword);
+   if (rc != 0)
return rc;
wp += info->portwidth;
cnt -= info->portwidth;
@@ -1569,9 +1573,9 @@ int flash_real_protect(flash_info_t *info, long sector, 
int prot)
 * flash_full_status_check() to work correctly
 */
flash_write_cmd(info, sector, 0, FLASH_CMD_READ_STATUS);
-   if ((retcode =
-flash_full_status_check(info, sector, info->erase_blk_tout,
- prot ? "protect" : "unprotect")) == 0) {
+   retcode = flash_full_status_check(info, sector, info->erase_blk_tout,
+ prot ? "protect" : "unprotect");
+   if (retcode == 0) {
info->protect[sector] = prot;

/*
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 26/27] cfi_flash: Always define cfi_flash_num_flash_banks

2018-01-15 Thread Mario Six
The variable cfi_flash_num_flash_banks is defined iff
CONFIG_SYS_MAX_FLASH_BANKS_DETECT is defined, but it is used
unconditionally in the function cfi_flash_init_dm. This leads to a
undefined variable compile error when CONFIG_SYS_MAX_FLASH_BANKS_DETECT
is not defined, but DM is enabled.

Fix this by always defining the cfi_flash_num_flash_banks variable.

Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/mtd/cfi_flash.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 347382f529..da44e6184e 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -91,6 +91,8 @@ static u16 cfi_flash_config_reg(int i)

 #if defined(CONFIG_SYS_MAX_FLASH_BANKS_DETECT)
 int cfi_flash_num_flash_banks = CONFIG_SYS_MAX_FLASH_BANKS_DETECT;
+#else
+int cfi_flash_num_flash_banks;
 #endif

 #ifdef CONFIG_CFI_FLASH /* for driver model */
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 23/27] cfi_flash: Bound-check index before array access

2018-01-15 Thread Mario Six
In a while loop in cfi_flash.c the array "start" is accessed at the index
"sector" before the index variable "sector" is bounds-checked, which
might lead to accesses beyond the bounds of the array.

Swap the order of the checks in the "&&" expression, so that the
short-circuit evaluation prevents out-of-bounds array accesses.

Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/mtd/cfi_flash.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 5ba0c5fdec..61c2e6379d 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -761,8 +761,8 @@ static flash_sect_t find_sector(flash_info_t *info, ulong 
addr)
if (info != saved_info || sector >= info->sector_count)
sector = 0;

-   while ((info->start[sector] < addr) &&
-   (sector < info->sector_count - 1))
+   while ((sector < info->sector_count - 1) &&
+   (info->start[sector] < addr))
sector++;
while ((info->start[sector] > addr) && (sector > 0))
/*
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 14/27] cfi_flash: Fix spelling of "Unknown"

2018-01-15 Thread Mario Six
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/mtd/cfi_flash.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 53842443eb..4c5e1568e6 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -1140,7 +1140,7 @@ int flash_erase(flash_info_t *info, int s_first, int 
s_last)
break;
 #endif
default:
-   debug("Unkown flash vendor %d\n",
+   debug("Unknown flash vendor %d\n",
   info->vendor);
break;
}
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 22/27] flash: Fix spelling of "ERR_TIMOUT"

2018-01-15 Thread Mario Six
checkpatch.pl complains about the spelling of ERR_TIMOUT. Since the
error is only used in a handful of files, we rename the error to
ERR_TIMEOUT.

Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 board/cobra5272/flash.c   | 2 +-
 common/flash.c| 4 ++--
 drivers/mtd/cfi_flash.c   | 4 ++--
 drivers/mtd/pic32_flash.c | 6 +++---
 include/flash.h   | 2 +-
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/board/cobra5272/flash.c b/board/cobra5272/flash.c
index 4fac6880f1..ca27b49a3b 100644
--- a/board/cobra5272/flash.c
+++ b/board/cobra5272/flash.c
@@ -216,7 +216,7 @@ int flash_erase (flash_info_t * info, int s_first, int 
s_last)
goto outahere;
}
if (chip1 == TMO) {
-   rc = ERR_TIMOUT;
+   rc = ERR_TIMEOUT;
goto outahere;
}

diff --git a/common/flash.c b/common/flash.c
index 587ef60158..876677493f 100644
--- a/common/flash.c
+++ b/common/flash.c
@@ -112,7 +112,7 @@ addr2info (ulong addr)
  * and no protected sectors are hit.
  * Returns:
  * ERR_OK  0 - OK
- * ERR_TIMOUT  1 - write timeout
+ * ERR_TIMEOUT 1 - write timeout
  * ERR_NOT_ERASED  2 - Flash not erased
  * ERR_PROTECTED   4 - target range includes protected sectors
  * ERR_INVAL   8 - target address not in Flash memory
@@ -185,7 +185,7 @@ void flash_perror (int err)
switch (err) {
case ERR_OK:
break;
-   case ERR_TIMOUT:
+   case ERR_TIMEOUT:
puts ("Timeout writing to Flash\n");
break;
case ERR_NOT_ERASED:
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index e94a7269e1..5ba0c5fdec 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -588,7 +588,7 @@ static int flash_status_check(flash_info_t *info, 
flash_sect_t sector,
flash_read_long(info, sector, 0));
flash_write_cmd(info, sector, 0, info->cmd_reset);
udelay(1);
-   return ERR_TIMOUT;
+   return ERR_TIMEOUT;
}
udelay(1);  /* also triggers watchdog */
}
@@ -696,7 +696,7 @@ static int flash_status_poll(flash_info_t *info, void *src, 
void *dst,
if (get_timer(start) > tout) {
printf("Flash %s timeout at address %lx data %lx\n",
   prompt, (ulong)dst, (ulong)flash_read8(dst));
-   return ERR_TIMOUT;
+   return ERR_TIMEOUT;
}
udelay(1);  /* also triggers watchdog */
}
diff --git a/drivers/mtd/pic32_flash.c b/drivers/mtd/pic32_flash.c
index e1a8d3bc4b..a6a5d1cc2e 100644
--- a/drivers/mtd/pic32_flash.c
+++ b/drivers/mtd/pic32_flash.c
@@ -69,7 +69,7 @@ static int flash_wait_till_busy(const char *func, ulong 
timeout)
int ret = wait_for_bit(__func__, &nvm_regs_p->ctrl.raw,
   NVM_WR, false, timeout, false);

-   return ret ? ERR_TIMOUT : ERR_OK;
+   return ret ? ERR_TIMEOUT : ERR_OK;
 }

 static inline int flash_complete_operation(void)
@@ -99,7 +99,7 @@ static inline int flash_complete_operation(void)
  * Erase flash sectors, returns:
  * ERR_OK - OK
  * ERR_INVAL - invalid sector arguments
- * ERR_TIMOUT - write timeout
+ * ERR_TIMEOUT - write timeout
  * ERR_NOT_ERASED - Flash not erased
  * ERR_UNKNOWN_FLASH_VENDOR - incorrect flash
  */
@@ -217,7 +217,7 @@ static int write_word(flash_info_t *info, ulong dest, ulong 
word)
 /*
  * Copy memory to flash, returns:
  * ERR_OK - OK
- * ERR_TIMOUT - write timeout
+ * ERR_TIMEOUT - write timeout
  * ERR_NOT_ERASED - Flash not erased
  */
 int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt)
diff --git a/include/flash.h b/include/flash.h
index dc67cb2df6..1a4e879009 100644
--- a/include/flash.h
+++ b/include/flash.h
@@ -122,7 +122,7 @@ extern int jedec_flash_match(flash_info_t *info, ulong 
base);
  * return codes from flash_write():
  */
 #define ERR_OK 0
-#define ERR_TIMOUT 1
+#define ERR_TIMEOUT1
 #define ERR_NOT_ERASED 2
 #define ERR_PROTECTED  4
 #define ERR_INVAL  8
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 1/4] clk: clk-uclass: Fix style violations

2018-01-15 Thread Mario Six
checkpatch.pl complains that the clk_ops structures used in clk-uclass.c
ought to be const, so we mark them as const.

Reviewed-by: Simon Glass 
Signed-off-by: Mario Six 

---

v1 -> v2:
* Changed commit message and text to used the correct word "const"
  instead of "static".

---
 drivers/clk/clk-uclass.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
index 83ba13374c..32be2e85c5 100644
--- a/drivers/clk/clk-uclass.c
+++ b/drivers/clk/clk-uclass.c
@@ -15,9 +15,9 @@

 DECLARE_GLOBAL_DATA_PTR;

-static inline struct clk_ops *clk_dev_ops(struct udevice *dev)
+static inline const struct clk_ops *clk_dev_ops(struct udevice *dev)
 {
-   return (struct clk_ops *)dev->driver->ops;
+   return (const struct clk_ops *)dev->driver->ops;
 }

 #if CONFIG_IS_ENABLED(OF_CONTROL)
@@ -60,7 +60,7 @@ int clk_get_by_index(struct udevice *dev, int index, struct 
clk *clk)
int ret;
struct ofnode_phandle_args args;
struct udevice *dev_clk;
-   struct clk_ops *ops;
+   const struct clk_ops *ops;

debug("%s(dev=%p, index=%d, clk=%p)\n", __func__, dev, index, clk);

@@ -68,7 +68,7 @@ int clk_get_by_index(struct udevice *dev, int index, struct 
clk *clk)
clk->dev = NULL;

ret = dev_read_phandle_with_args(dev, "clocks", "#clock-cells", 0,
- index, &args);
+index, &args);
if (ret) {
debug("%s: fdtdec_parse_phandle_with_args failed: err=%d\n",
  __func__, ret);
@@ -142,7 +142,7 @@ int clk_release_all(struct clk *clk, int count)

 int clk_request(struct udevice *dev, struct clk *clk)
 {
-   struct clk_ops *ops = clk_dev_ops(dev);
+   const struct clk_ops *ops = clk_dev_ops(dev);

debug("%s(dev=%p, clk=%p)\n", __func__, dev, clk);

@@ -156,7 +156,7 @@ int clk_request(struct udevice *dev, struct clk *clk)

 int clk_free(struct clk *clk)
 {
-   struct clk_ops *ops = clk_dev_ops(clk->dev);
+   const struct clk_ops *ops = clk_dev_ops(clk->dev);

debug("%s(clk=%p)\n", __func__, clk);

@@ -168,7 +168,7 @@ int clk_free(struct clk *clk)

 ulong clk_get_rate(struct clk *clk)
 {
-   struct clk_ops *ops = clk_dev_ops(clk->dev);
+   const struct clk_ops *ops = clk_dev_ops(clk->dev);

debug("%s(clk=%p)\n", __func__, clk);

@@ -180,7 +180,7 @@ ulong clk_get_rate(struct clk *clk)

 ulong clk_set_rate(struct clk *clk, ulong rate)
 {
-   struct clk_ops *ops = clk_dev_ops(clk->dev);
+   const struct clk_ops *ops = clk_dev_ops(clk->dev);

debug("%s(clk=%p, rate=%lu)\n", __func__, clk, rate);

@@ -192,7 +192,7 @@ ulong clk_set_rate(struct clk *clk, ulong rate)

 int clk_enable(struct clk *clk)
 {
-   struct clk_ops *ops = clk_dev_ops(clk->dev);
+   const struct clk_ops *ops = clk_dev_ops(clk->dev);

debug("%s(clk=%p)\n", __func__, clk);

@@ -204,7 +204,7 @@ int clk_enable(struct clk *clk)

 int clk_disable(struct clk *clk)
 {
-   struct clk_ops *ops = clk_dev_ops(clk->dev);
+   const struct clk_ops *ops = clk_dev_ops(clk->dev);

debug("%s(clk=%p)\n", __func__, clk);

--
2.11.0

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


[U-Boot] [RESEND PATCH v2 4/7] gpio: mpc85xx: Rename driver file to mpc8xxx

2018-01-15 Thread Mario Six
In preparation to making the MPC85xx GPIO driver useable for a broader
range of SoCs, rename the driver file.

Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/gpio/Makefile   | 2 +-
 drivers/gpio/{mpc85xx_gpio.c => mpc8xxx_gpio.c} | 0
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename drivers/gpio/{mpc85xx_gpio.c => mpc8xxx_gpio.c} (100%)

diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 8525679091..6c08d4c66c 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -38,7 +38,7 @@ obj-$(CONFIG_DA8XX_GPIO)  += da8xx_gpio.o
 obj-$(CONFIG_DM644X_GPIO)  += da8xx_gpio.o
 obj-$(CONFIG_ALTERA_PIO)   += altera_pio.o
 obj-$(CONFIG_MPC83XX_GPIO) += mpc83xx_gpio.o
-obj-$(CONFIG_MPC85XX_GPIO) += mpc85xx_gpio.o
+obj-$(CONFIG_MPC85XX_GPIO) += mpc8xxx_gpio.o
 obj-$(CONFIG_SH_GPIO_PFC)  += sh_pfc.o
 obj-$(CONFIG_OMAP_GPIO)+= omap_gpio.o
 obj-$(CONFIG_DB8500_GPIO)  += db8500_gpio.o
diff --git a/drivers/gpio/mpc85xx_gpio.c b/drivers/gpio/mpc8xxx_gpio.c
similarity index 100%
rename from drivers/gpio/mpc85xx_gpio.c
rename to drivers/gpio/mpc8xxx_gpio.c
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 20/27] cfi_flash: Fix strings split across lines

2018-01-15 Thread Mario Six
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/mtd/cfi_flash.c | 17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index fced9847ef..8040e43de7 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -1255,10 +1255,9 @@ void flash_print_info(flash_info_t *info)
info->erase_blk_tout,
info->write_tout);
if (info->buffer_size > 1) {
-   printf("  Buffer write timeout: %ld ms, "
-   "buffer size: %d bytes\n",
-   info->buffer_write_tout,
-   info->buffer_size);
+   printf("  Buffer write timeout: %ld ms, ",
+   info->buffer_write_tout);
+   printf("buffer size: %d bytes\n", info->buffer_size);
}

puts("\n  Sector Start Addresses:");
@@ -2050,8 +2049,8 @@ static void flash_fixup_num(flash_info_t *info, struct 
cfi_qry *qry)
info->device_id2 == 0x2301 ||
info->device_id2 == 0x2801 ||
info->device_id2 == 0x4801)) {
-   debug("Adjusted buffer size on Numonyx flash"
-   " M29EW family in 8 bit mode\n");
+   debug("Adjusted buffer size on Numonyx flash");
+   debug(" M29EW family in 8 bit mode\n");
qry->max_buf_write_size = 0x8;
}
 }
@@ -2388,9 +2387,9 @@ unsigned long flash_init(void)
size += flash_info[i].size;
if (flash_info[i].flash_id == FLASH_UNKNOWN) {
 #ifndef CONFIG_SYS_FLASH_QUIET_TEST
-   printf("## Unknown flash on Bank %d "
-   "- Size = 0x%08lx = %ld MB\n",
-   i + 1, flash_info[i].size,
+   printf("## Unknown flash on Bank %d ", i + 1);
+   printf("- Size = 0x%08lx = %ld MB\n",
+   flash_info[i].size,
flash_info[i].size >> 20);
 #endif /* CONFIG_SYS_FLASH_QUIET_TEST */
}
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 1/7] gpio: pca953x_gpio: Fix style violations

2018-01-15 Thread Mario Six
Fix some style violations in the pca953x_gpio driver.

Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/gpio/pca953x_gpio.c | 19 +--
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/gpio/pca953x_gpio.c b/drivers/gpio/pca953x_gpio.c
index 791d1d1516..5ea1e05eed 100644
--- a/drivers/gpio/pca953x_gpio.c
+++ b/drivers/gpio/pca953x_gpio.c
@@ -123,7 +123,8 @@ static int pca953x_read_regs(struct udevice *dev, int reg, 
u8 *val)
ret = dm_i2c_read(dev, reg << 1, val, info->bank_count);
} else if (info->gpio_count == 40) {
/* Auto increment */
-   ret = dm_i2c_read(dev, (reg << 3) | 0x80, val, 
info->bank_count);
+   ret = dm_i2c_read(dev, (reg << 3) | 0x80, val,
+ info->bank_count);
} else {
dev_err(dev, "Unsupported now\n");
return -EINVAL;
@@ -143,7 +144,7 @@ static int pca953x_is_output(struct udevice *dev, int 
offset)
return !(info->reg_direction[bank] & (1 << off));
 }

-static int pca953x_get_value(struct udevice *dev, unsigned offset)
+static int pca953x_get_value(struct udevice *dev, uint offset)
 {
int ret;
u8 val = 0;
@@ -157,8 +158,7 @@ static int pca953x_get_value(struct udevice *dev, unsigned 
offset)
return (val >> off) & 0x1;
 }

-static int pca953x_set_value(struct udevice *dev, unsigned offset,
-int value)
+static int pca953x_set_value(struct udevice *dev, uint offset, int value)
 {
struct pca953x_info *info = dev_get_platdata(dev);
int bank = offset / BANK_SZ;
@@ -180,7 +180,7 @@ static int pca953x_set_value(struct udevice *dev, unsigned 
offset,
return 0;
 }

-static int pca953x_set_direction(struct udevice *dev, unsigned offset, int dir)
+static int pca953x_set_direction(struct udevice *dev, uint offset, int dir)
 {
struct pca953x_info *info = dev_get_platdata(dev);
int bank = offset / BANK_SZ;
@@ -202,13 +202,12 @@ static int pca953x_set_direction(struct udevice *dev, 
unsigned offset, int dir)
return 0;
 }

-static int pca953x_direction_input(struct udevice *dev, unsigned offset)
+static int pca953x_direction_input(struct udevice *dev, uint offset)
 {
return pca953x_set_direction(dev, offset, PCA953X_DIRECTION_IN);
 }

-static int pca953x_direction_output(struct udevice *dev, unsigned offset,
-   int value)
+static int pca953x_direction_output(struct udevice *dev, uint offset, int 
value)
 {
/* Configure output value. */
pca953x_set_value(dev, offset, value);
@@ -219,7 +218,7 @@ static int pca953x_direction_output(struct udevice *dev, 
unsigned offset,
return 0;
 }

-static int pca953x_get_function(struct udevice *dev, unsigned offset)
+static int pca953x_get_function(struct udevice *dev, uint offset)
 {
if (pca953x_is_output(dev, offset))
return GPIOF_OUTPUT;
@@ -231,7 +230,7 @@ static int pca953x_xlate(struct udevice *dev, struct 
gpio_desc *desc,
 struct ofnode_phandle_args *args)
 {
desc->offset = args->args[0];
-   desc->flags = args->args[1] & GPIO_ACTIVE_LOW ? GPIOD_ACTIVE_LOW : 0;
+   desc->flags = args->args[1] & (GPIO_ACTIVE_LOW ? GPIOD_ACTIVE_LOW : 0);

return 0;
 }
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 3/6] i2c: fsl_i2c: Make live-tree compatible

2018-01-15 Thread Mario Six
Make the fsl_i2c driver compatible with a live device tree.

Reviewed-by: Heiko Schocher 
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/i2c/fsl_i2c.c | 16 ++--
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/i2c/fsl_i2c.c b/drivers/i2c/fsl_i2c.c
index a7f3ec472f..cb0f5ea233 100644
--- a/drivers/i2c/fsl_i2c.c
+++ b/drivers/i2c/fsl_i2c.c
@@ -574,22 +574,18 @@ static int fsl_i2c_ofdata_to_platdata(struct udevice *bus)
 {
struct fsl_i2c_dev *dev = dev_get_priv(bus);
fdt_addr_t addr;
-   fdt_size_t size;
-   int node = dev_of_offset(bus);

-   addr = fdtdec_get_addr_size_auto_noparent(gd->fdt_blob, node, "reg", 0,
- &size, false);
+   addr = dev_read_u32_default(bus, "reg", -1);

-   dev->base = map_sysmem(CONFIG_SYS_IMMR + addr, size);
+   dev->base = map_sysmem(CONFIG_SYS_IMMR + addr, sizeof(struct 
fsl_i2c_base));

if (!dev->base)
return -ENOMEM;

-   dev->index = fdtdec_get_int(gd->fdt_blob, node, "cell-index", -1);
-   dev->slaveadd = fdtdec_get_int(gd->fdt_blob, node,
-  "u-boot,i2c-slave-addr", 0x7f);
-   dev->speed = fdtdec_get_int(gd->fdt_blob, node, "clock-frequency",
-   40);
+   dev->index = dev_read_u32_default(bus, "cell-index", -1);
+   dev->slaveadd = dev_read_u32_default(bus, "u-boot,i2c-slave-addr",
+0x7f);
+   dev->speed = dev_read_u32_default(bus, "clock-frequency", 40);

dev->i2c_clk = dev->index ? gd->arch.i2c2_clk : gd->arch.i2c1_clk;

--
2.11.0

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


[U-Boot] [RESEND PATCH v2 7/7] gpio: mpc8xxx: Make live-tree compatible

2018-01-15 Thread Mario Six
Make the MPC8xxx GPIO driver compatible with a live device tree.

Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/gpio/mpc8xxx_gpio.c | 17 +++--
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/gpio/mpc8xxx_gpio.c b/drivers/gpio/mpc8xxx_gpio.c
index 0aa72ecd9f..326fd1672d 100644
--- a/drivers/gpio/mpc8xxx_gpio.c
+++ b/drivers/gpio/mpc8xxx_gpio.c
@@ -14,8 +14,6 @@
 #include 
 #include 

-DECLARE_GLOBAL_DATA_PTR;
-
 struct ccsr_gpio {
u32 gpdir;
u32 gpodr;
@@ -181,15 +179,14 @@ static int mpc8xxx_gpio_ofdata_to_platdata(struct udevice 
*dev)
 {
struct mpc8xxx_gpio_plat *plat = dev_get_platdata(dev);
fdt_addr_t addr;
-   fdt_size_t size;
+   u32 reg[2];
+
+   dev_read_u32_array(dev, "reg", reg, 2);
+   addr = dev_translate_address(dev, reg);

-   addr = fdtdec_get_addr_size_auto_noparent(gd->fdt_blob,
- dev_of_offset(dev),
- "reg", 0, &size, false);
plat->addr = addr;
-   plat->size = size;
-   plat->ngpios = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
- "ngpios", 32);
+   plat->size = reg[1];
+   plat->ngpios = dev_read_u32_default(dev, "ngpios", 32);

return 0;
 }
@@ -206,7 +203,7 @@ static int mpc8xxx_gpio_platdata_to_priv(struct udevice 
*dev)
size = 0x100;

priv->addr = plat->addr;
-   priv->base = map_sysmem(CONFIG_SYS_IMMR + plat->addr, size);
+   priv->base = map_sysmem(plat->addr, size);

if (!priv->base)
return -ENOMEM;
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 6/7] gpio: mpc8xxx: Make compatible with more SoCs

2018-01-15 Thread Mario Six
Finally, make the mpc8xxx driver capable of handling more GPIO devices;
this entails adding a special case for the MPC5121 SoC, and adding a set
of new compatible strings.

Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/gpio/mpc8xxx_gpio.c | 23 +--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/mpc8xxx_gpio.c b/drivers/gpio/mpc8xxx_gpio.c
index e4ebbc117c..0aa72ecd9f 100644
--- a/drivers/gpio/mpc8xxx_gpio.c
+++ b/drivers/gpio/mpc8xxx_gpio.c
@@ -11,8 +11,8 @@

 #include 
 #include 
-#include 
 #include 
+#include 

 DECLARE_GLOBAL_DATA_PTR;

@@ -37,6 +37,12 @@ struct mpc8xxx_gpio_data {
 * for output pins
 */
u32 dat_shadow;
+   ulong type;
+};
+
+enum {
+   MPC8XXX_GPIO_TYPE,
+   MPC5121_GPIO_TYPE,
 };

 inline u32 gpio_mask(uint gpio)
@@ -119,6 +125,12 @@ static int mpc8xxx_gpio_set_value(struct udevice *dev, 
uint gpio, int value)
 static int mpc8xxx_gpio_direction_output(struct udevice *dev, uint gpio,
 int value)
 {
+   struct mpc8xxx_gpio_data *data = dev_get_priv(dev);
+
+   /* GPIO 28..31 are input only on MPC5121 */
+   if (data->type == MPC5121_GPIO_TYPE && gpio >= 28)
+   return -EINVAL;
+
return mpc8xxx_gpio_set_value(dev, gpio, value);
 }

@@ -188,6 +200,7 @@ static int mpc8xxx_gpio_platdata_to_priv(struct udevice 
*dev)
struct mpc8xxx_gpio_data *priv = dev_get_priv(dev);
struct mpc8xxx_gpio_plat *plat = dev_get_platdata(dev);
unsigned long size = plat->size;
+   ulong driver_data = dev_get_driver_data(dev);

if (size == 0)
size = 0x100;
@@ -237,7 +250,13 @@ static const struct dm_gpio_ops gpio_mpc8xxx_ops = {
 };

 static const struct udevice_id mpc8xxx_gpio_ids[] = {
-   { .compatible = "fsl,pq3-gpio" },
+   { .compatible = "fsl,pq3-gpio", .data = MPC8XXX_GPIO_TYPE },
+   { .compatible = "fsl,mpc8308-gpio", .data = MPC8XXX_GPIO_TYPE },
+   { .compatible = "fsl,mpc8349-gpio", .data = MPC8XXX_GPIO_TYPE },
+   { .compatible = "fsl,mpc8572-gpio", .data = MPC8XXX_GPIO_TYPE},
+   { .compatible = "fsl,mpc8610-gpio", .data = MPC8XXX_GPIO_TYPE},
+   { .compatible = "fsl,mpc5121-gpio", .data = MPC5121_GPIO_TYPE, },
+   { .compatible = "fsl,qoriq-gpio", .data = MPC8XXX_GPIO_TYPE },
{ /* sentinel */ }
 };

--
2.11.0

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


[U-Boot] [RESEND PATCH v2 4/4] clk: Makefile: Sort entries alphabetically

2018-01-15 Thread Mario Six
The Makefile entries in the clk driver directory were not alphabetically
sorted. Correct this.

Reviewed-by: Simon Glass 
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/clk/Makefile | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
index 876c2b816f..dab106ab7f 100644
--- a/drivers/clk/Makefile
+++ b/drivers/clk/Makefile
@@ -6,21 +6,21 @@
 #

 obj-$(CONFIG_$(SPL_TPL_)CLK) += clk-uclass.o clk_fixed_rate.o
-obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip/
-obj-$(CONFIG_SANDBOX) += clk_sandbox.o
-obj-$(CONFIG_SANDBOX) += clk_sandbox_test.o
-obj-$(CONFIG_MACH_PIC32) += clk_pic32.o
-obj-$(CONFIG_CLK_RENESAS) += renesas/
-obj-$(CONFIG_CLK_ZYNQ) += clk_zynq.o
-obj-$(CONFIG_CLK_ZYNQMP) += clk_zynqmp.o

 obj-y += tegra/
-obj-$(CONFIG_CLK_UNIPHIER) += uniphier/
-obj-$(CONFIG_CLK_EXYNOS) += exynos/
+obj-$(CONFIG_ARCH_ASPEED) += aspeed/
+obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip/
 obj-$(CONFIG_CLK_AT91) += at91/
 obj-$(CONFIG_CLK_BCM6345) += clk_bcm6345.o
 obj-$(CONFIG_CLK_BOSTON) += clk_boston.o
+obj-$(CONFIG_CLK_EXYNOS) += exynos/
 obj-$(CONFIG_CLK_HSDK) += clk-hsdk-cgu.o
-obj-$(CONFIG_ARCH_ASPEED) += aspeed/
+obj-$(CONFIG_CLK_RENESAS) += renesas/
 obj-$(CONFIG_CLK_STM32F) += clk_stm32f.o
+obj-$(CONFIG_CLK_UNIPHIER) += uniphier/
+obj-$(CONFIG_CLK_ZYNQ) += clk_zynq.o
+obj-$(CONFIG_CLK_ZYNQMP) += clk_zynqmp.o
+obj-$(CONFIG_MACH_PIC32) += clk_pic32.o
+obj-$(CONFIG_SANDBOX) += clk_sandbox.o
+obj-$(CONFIG_SANDBOX) += clk_sandbox_test.o
 obj-$(CONFIG_STM32H7) += clk_stm32h7.o
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 21/27] cfi_flash: Rename camel-case variables

2018-01-15 Thread Mario Six
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/mtd/cfi_flash.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 8040e43de7..e94a7269e1 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -1687,8 +1687,8 @@ static int cmdset_intel_init(flash_info_t *info, struct 
cfi_qry *qry)

 static void cmdset_amd_read_jedec_ids(flash_info_t *info)
 {
-   ushort bankId = 0;
-   uchar  manuId;
+   ushort bank_id = 0;
+   uchar  manu_id;
uchar  feature;

flash_write_cmd(info, 0, 0, AMD_CMD_RESET);
@@ -1696,14 +1696,14 @@ static void cmdset_amd_read_jedec_ids(flash_info_t 
*info)
flash_write_cmd(info, 0, info->addr_unlock1, FLASH_CMD_READ_ID);
udelay(1000); /* some flash are slow to respond */

-   manuId = flash_read_uchar(info, FLASH_OFFSET_MANUFACTURER_ID);
+   manu_id = flash_read_uchar(info, FLASH_OFFSET_MANUFACTURER_ID);
/* JEDEC JEP106Z specifies ID codes up to bank 7 */
-   while (manuId == FLASH_CONTINUATION_CODE && bankId < 0x800) {
-   bankId += 0x100;
-   manuId = flash_read_uchar(info,
-   bankId | FLASH_OFFSET_MANUFACTURER_ID);
+   while (manu_id == FLASH_CONTINUATION_CODE && bank_id < 0x800) {
+   bank_id += 0x100;
+   manu_id = flash_read_uchar(info,
+   bank_id | FLASH_OFFSET_MANUFACTURER_ID);
}
-   info->manufacturer_id = manuId;
+   info->manufacturer_id = manu_id;

debug("info->ext_addr = 0x%x, cfi_version = 0x%x\n",
  info->ext_addr, info->cfi_version);
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 3/4] clk: Remove superfluous gd declarations

2018-01-15 Thread Mario Six
The clk uclass was converted to support a live device tree recently,
hence the global data pointer declarations are no longer needed.

Reviewed-by: Simon Glass 
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/clk/clk-uclass.c | 2 --
 drivers/clk/clk_fixed_rate.c | 2 --
 2 files changed, 4 deletions(-)

diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
index 32be2e85c5..fbea72091b 100644
--- a/drivers/clk/clk-uclass.c
+++ b/drivers/clk/clk-uclass.c
@@ -13,8 +13,6 @@
 #include 
 #include 

-DECLARE_GLOBAL_DATA_PTR;
-
 static inline const struct clk_ops *clk_dev_ops(struct udevice *dev)
 {
return (const struct clk_ops *)dev->driver->ops;
diff --git a/drivers/clk/clk_fixed_rate.c b/drivers/clk/clk_fixed_rate.c
index 9dd6bc5726..c9a9f0a20b 100644
--- a/drivers/clk/clk_fixed_rate.c
+++ b/drivers/clk/clk_fixed_rate.c
@@ -8,8 +8,6 @@
 #include 
 #include 

-DECLARE_GLOBAL_DATA_PTR;
-
 struct clk_fixed_rate {
unsigned long fixed_rate;
 };
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 5/6] i2c: ihs_i2c: Make DM compatible

2018-01-15 Thread Mario Six
Make the ihs_i2c driver DM-compatible; for legacy boards, the old functions are
retained within #ifdefs.

No board uses the new DM driver yet; this patch only lays the foundation for
future support.

Signed-off-by: Mario Six 
---

v1 -> v2:
* Use put_unaligned_le32 instead of manual buffer copying
* Make driver live-tree compatible
* Accomodated for FPGA handle changes in gdsys_soc driver
* Re-added accidentially deleted IHS Kconfig entry
* Accomodated for IHS FPGA conversion to fpgamap

---
 drivers/i2c/Kconfig   |   6 ++
 drivers/i2c/ihs_i2c.c | 196 +-
 2 files changed, 199 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig
index 0630712e4a..d18bd077af 100644
--- a/drivers/i2c/Kconfig
+++ b/drivers/i2c/Kconfig
@@ -254,6 +254,12 @@ config SYS_I2C_BUS_MAX
help
  Define the maximum number of available I2C buses.

+config SYS_I2C_IHS
+bool "gdsys IHS I2C driver"
+depends on DM_I2C
+help
+  Support for gdsys IHS I2C driver on FPGA bus.
+
 source "drivers/i2c/muxes/Kconfig"

 endmenu
diff --git a/drivers/i2c/ihs_i2c.c b/drivers/i2c/ihs_i2c.c
index 6fd016339c..b24afa472b 100644
--- a/drivers/i2c/ihs_i2c.c
+++ b/drivers/i2c/ihs_i2c.c
@@ -3,19 +3,39 @@
  * Dirk Eibach,  Guntermann & Drunck GmbH, eib...@gdsys.de
  *
  * SPDX-License-Identifier:GPL-2.0+
- *
- * NOTE: This driver should be converted to driver model before June 2017.
- * Please see doc/driver-model/i2c-howto.txt for instructions.
  */

 #include 
 #include 
+#ifdef CONFIG_DM_I2C
+#include 
+#include 
+#include "../misc/gdsys_soc.h"
+#else
 #include 
+#endif
 #include 

+#ifdef CONFIG_DM_I2C
+struct ihs_i2c_priv {
+   uint speed;
+   phys_addr_t addr;
+};
+
+enum {
+   REG_INTERRUPT_STATUS = 0x00,
+   REG_INTERRUPT_ENABLE_CONTROL = 0x02,
+   REG_WRITE_MAILBOX_EXT = 0x04,
+   REG_WRITE_MAILBOX = 0x06,
+   REG_READ_MAILBOX_EXT = 0x08,
+   REG_READ_MAILBOX = 0x0A,
+};
+
+#else /* !CONFIG_DM_I2C */
 DECLARE_GLOBAL_DATA_PTR;

 #ifdef CONFIG_SYS_I2C_IHS_DUAL
+
 #define I2C_SET_REG(fld, val) \
do { \
if (I2C_ADAP_HWNR & 0x10) \
@@ -40,6 +60,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #define I2C_GET_REG(fld, val) \
FPGA_GET_REG(I2C_ADAP_HWNR, i2c0.fld, val)
 #endif
+#endif /* CONFIG_DM_I2C */

 enum {
I2CINT_ERROR_EV = BIT(13),
@@ -62,33 +83,68 @@ enum {
I2COP_READ = 1,
 };

+#ifdef CONFIG_DM_I2C
+static int wait_for_int(struct udevice *dev, int read)
+#else
 static int wait_for_int(bool read)
+#endif
 {
u16 val;
uint ctr = 0;
+#ifdef CONFIG_DM_I2C
+   struct ihs_i2c_priv *priv = dev_get_priv(dev);
+   struct udevice *fpga;

+   gdsys_soc_get_fpga(dev, &fpga);
+#endif
+
+#ifdef CONFIG_DM_I2C
+   fpgamap_read16(fpga, priv->addr + REG_INTERRUPT_STATUS, &val);
+#else
I2C_GET_REG(interrupt_status, &val);
+#endif
/* Wait until error or receive/transmit interrupt was raised */
while (!(val & (I2CINT_ERROR_EV
   | (read ? I2CINT_RECEIVE_EV : I2CINT_TRANSMIT_EV {
udelay(10);
if (ctr++ > 5000)
return 1;
+#ifdef CONFIG_DM_I2C
+   fpgamap_read16(fpga, priv->addr + REG_INTERRUPT_STATUS, &val);
+#else
I2C_GET_REG(interrupt_status, &val);
+#endif
}

return (val & I2CINT_ERROR_EV) ? 1 : 0;
 }

+#ifdef CONFIG_DM_I2C
+static int ihs_i2c_transfer(struct udevice *dev, uchar chip,
+   uchar *buffer, int len, int read, bool is_last)
+#else
 static int ihs_i2c_transfer(uchar chip, uchar *buffer, int len, bool read,
bool is_last)
+#endif
 {
u16 val;
+#ifdef CONFIG_DM_I2C
+   struct ihs_i2c_priv *priv = dev_get_priv(dev);
+   struct udevice *fpga;
+
+   gdsys_soc_get_fpga(dev, &fpga);
+#endif

/* Clear interrupt status */
+#ifdef CONFIG_DM_I2C
+   fpgamap_write16(fpga, priv->addr + REG_INTERRUPT_STATUS,
+   I2CINT_ERROR_EV | I2CINT_RECEIVE_EV | 
I2CINT_TRANSMIT_EV);
+   fpgamap_read16(fpga, priv->addr + REG_INTERRUPT_STATUS, &val);
+#else
I2C_SET_REG(interrupt_status, I2CINT_ERROR_EV
 | I2CINT_RECEIVE_EV | I2CINT_TRANSMIT_EV);
I2C_GET_REG(interrupt_status, &val);
+#endif

/* If we want to write and have data, write the bytes to the mailbox */
if (!read && len) {
@@ -96,22 +152,43 @@ static int ihs_i2c_transfer(uchar chip, uchar *buffer, int 
len, bool read,

if (len > 1)
val |= buffer[1] << 8;
+#ifdef CONFIG_DM_I2C
+   fpgamap_write16(fpga, priv->addr + REG_WRITE_MAILBOX_EXT, val);
+#else
I2C_SET_REG(write_mailbox_ext, val);
+#endif
}

+#ifdef CONFIG_DM_I2C
+   fpgamap_write16(fpga, priv->addr + REG_WRITE_MAILBOX,
+   I2CMB_NATIVE
+

[U-Boot] [RESEND PATCH v2 7/7] phy: Fix style violations

2018-01-15 Thread Mario Six
Fix some style violations in the generic PHY management code.

Acked-by: Joe Hershberger 
Signed-off-by: Mario Six 

---

v1 -> v2:
* Fixed comment style according to Joe's comments

---
 drivers/net/phy/phy.c | 94 +++
 1 file changed, 57 insertions(+), 37 deletions(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index fd3dd556c8..c576d26b67 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -27,7 +27,7 @@ DECLARE_GLOBAL_DATA_PTR;
 /* Generic PHY support and helper functions */

 /**
- * genphy_config_advert - sanitize and advertise auto-negotation parameters
+ * genphy_config_advert - sanitize and advertise auto-negotiation parameters
  * @phydev: target phy_device struct
  *
  * Description: Writes MII_ADVERTISE with the appropriate values,
@@ -117,7 +117,6 @@ static int genphy_config_advert(struct phy_device *phydev)
return changed;
 }

-
 /**
  * genphy_setup_forced - configures/forces speed/duplex from @phydev
  * @phydev: target phy_device struct
@@ -130,14 +129,15 @@ static int genphy_setup_forced(struct phy_device *phydev)
int err;
int ctl = BMCR_ANRESTART;

-   phydev->pause = phydev->asym_pause = 0;
+   phydev->pause = 0;
+   phydev->asym_pause = 0;

-   if (SPEED_1000 == phydev->speed)
+   if (phydev->speed == SPEED_1000)
ctl |= BMCR_SPEED1000;
-   else if (SPEED_100 == phydev->speed)
+   else if (phydev->speed == SPEED_100)
ctl |= BMCR_SPEED100;

-   if (DUPLEX_FULL == phydev->duplex)
+   if (phydev->duplex == DUPLEX_FULL)
ctl |= BMCR_FULLDPLX;

err = phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR, ctl);
@@ -145,7 +145,6 @@ static int genphy_setup_forced(struct phy_device *phydev)
return err;
 }

-
 /**
  * genphy_restart_aneg - Enable and Restart Autonegotiation
  * @phydev: target phy_device struct
@@ -169,7 +168,6 @@ int genphy_restart_aneg(struct phy_device *phydev)
return ctl;
 }

-
 /**
  * genphy_config_aneg - restart auto-negotiation or write BMCR
  * @phydev: target phy_device struct
@@ -182,7 +180,7 @@ int genphy_config_aneg(struct phy_device *phydev)
 {
int result;

-   if (AUTONEG_ENABLE != phydev->autoneg)
+   if (phydev->autoneg != AUTONEG_ENABLE)
return genphy_setup_forced(phydev);

result = genphy_config_advert(phydev);
@@ -191,8 +189,10 @@ int genphy_config_aneg(struct phy_device *phydev)
return result;

if (result == 0) {
-   /* Advertisment hasn't changed, but maybe aneg was never on to
-* begin with?  Or maybe phy was isolated? */
+   /*
+* Advertisment hasn't changed, but maybe aneg was never on to
+* begin with?  Or maybe phy was isolated?
+*/
int ctl = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMCR);

if (ctl < 0)
@@ -202,8 +202,10 @@ int genphy_config_aneg(struct phy_device *phydev)
result = 1; /* do restart aneg */
}

-   /* Only restart aneg if we are advertising something different
-* than we were before.  */
+   /*
+* Only restart aneg if we are advertising something different
+* than we were before.
+*/
if (result > 0)
result = genphy_restart_aneg(phydev);

@@ -240,7 +242,7 @@ int genphy_update_link(struct phy_device *phydev)
int i = 0;

printf("%s Waiting for PHY auto negotiation to complete",
-   phydev->dev->name);
+  phydev->dev->name);
while (!(mii_reg & BMSR_ANEGCOMPLETE)) {
/*
 * Timeout reached ?
@@ -305,7 +307,8 @@ int genphy_parse_link(struct phy_device *phydev)
 */
gblpa = phy_read(phydev, MDIO_DEVAD_NONE, MII_STAT1000);
if (gblpa < 0) {
-   debug("Could not read MII_STAT1000. Ignoring 
gigabit capability\n");
+   debug("Could not read MII_STAT1000. ");
+   debug("Ignoring gigabit capability\n");
gblpa = 0;
}
gblpa &= phy_read(phydev,
@@ -338,8 +341,9 @@ int genphy_parse_link(struct phy_device *phydev)
if (lpa & LPA_100FULL)
phydev->duplex = DUPLEX_FULL;

-   } else if (lpa & LPA_10FULL)
+   } else if (lpa & LPA_10FULL) {
phydev->duplex = DUPLEX_FULL;
+   }

/*
 * Extended status may indicate that the PHY supports
@@ -577,7 +581,9 @@ static int phy_probe(struct phy_device *phydev)
 {
int err = 0;

-   phydev->advertising = phydev->supported = phydev->drv->feat

[U-Boot] [RESEND PATCH v2 6/7] cmd: mdio: Fix style violations

2018-01-15 Thread Mario Six
Fix some style violations in the MDIO command.

Acked-by: Joe Hershberger 
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 cmd/mdio.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/cmd/mdio.c b/cmd/mdio.c
index 21dc103736..3f11963006 100644
--- a/cmd/mdio.c
+++ b/cmd/mdio.c
@@ -14,7 +14,6 @@
 #include 
 #include 

-
 static char last_op[2];
 static uint last_data;
 static uint last_addr_lo;
@@ -243,13 +242,13 @@ static int do_mdio(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
case 'r':
if (pos > 1)
if (extract_reg_range(argv[pos--], &devadlo, &devadhi,
-   ®lo, ®hi))
+ ®lo, ®hi))
return -1;

default:
if (pos > 1)
-   if (extract_phy_range(&(argv[2]), pos - 1, &bus,
-   &phydev, &addrlo, &addrhi))
+   if (extract_phy_range(&argv[2], pos - 1, &bus,
+ &phydev, &addrlo, &addrhi))
return -1;

break;
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 5/7] gpio: mpc8xxx: Rename Kconfig option, structures, and functions

2018-01-15 Thread Mario Six
Rename the Kconfig option, structures (and their members), as well as
functions of the mpc85xx driver to include mpc8xxx to reflect the more
generic usage.

Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 arch/powerpc/include/asm/arch-mpc85xx/gpio.h |   2 +-
 drivers/gpio/Kconfig |   9 +--
 drivers/gpio/Makefile|   2 +-
 drivers/gpio/mpc8xxx_gpio.c  | 116 ++-
 4 files changed, 64 insertions(+), 65 deletions(-)

diff --git a/arch/powerpc/include/asm/arch-mpc85xx/gpio.h 
b/arch/powerpc/include/asm/arch-mpc85xx/gpio.h
index 76faa22c8b..b2ba31e623 100644
--- a/arch/powerpc/include/asm/arch-mpc85xx/gpio.h
+++ b/arch/powerpc/include/asm/arch-mpc85xx/gpio.h
@@ -18,7 +18,7 @@
 #include 
 #endif

-struct mpc85xx_gpio_plat {
+struct mpc8xxx_gpio_plat {
ulong addr;
unsigned long size;
uint ngpios;
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index b4e859e40c..b121979ddd 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -276,11 +276,11 @@ config DM_PCA953X
  Now, max 24 bits chips and PCA953X compatible chips are
  supported

-config MPC85XX_GPIO
-   bool "Freescale MPC85XX GPIO driver"
+config MPC8XXX_GPIO
+   bool "Freescale MPC8XXX GPIO driver"
depends on DM_GPIO
help
- This driver supports the built-in GPIO controller of MPC85XX CPUs.
+ This driver supports the built-in GPIO controller of MPC8XXX CPUs.
  Each GPIO bank is identified by its own entry in the device tree,
  i.e.

@@ -298,7 +298,4 @@ config MPC85XX_GPIO
  Aside from the standard functions of input/output mode, and output
  value setting, the open-drain feature, which can configure individual
  GPIOs to work as open-drain outputs, is supported.
-
- The driver has been tested on MPC85XX, but it is likely that other
- PowerQUICC III devices will work as well.
 endmenu
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 6c08d4c66c..266c9588ff 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -38,7 +38,7 @@ obj-$(CONFIG_DA8XX_GPIO)  += da8xx_gpio.o
 obj-$(CONFIG_DM644X_GPIO)  += da8xx_gpio.o
 obj-$(CONFIG_ALTERA_PIO)   += altera_pio.o
 obj-$(CONFIG_MPC83XX_GPIO) += mpc83xx_gpio.o
-obj-$(CONFIG_MPC85XX_GPIO) += mpc8xxx_gpio.o
+obj-$(CONFIG_MPC8XXX_GPIO) += mpc8xxx_gpio.o
 obj-$(CONFIG_SH_GPIO_PFC)  += sh_pfc.o
 obj-$(CONFIG_OMAP_GPIO)+= omap_gpio.o
 obj-$(CONFIG_DB8500_GPIO)  += db8500_gpio.o
diff --git a/drivers/gpio/mpc8xxx_gpio.c b/drivers/gpio/mpc8xxx_gpio.c
index 4566c091b7..e4ebbc117c 100644
--- a/drivers/gpio/mpc8xxx_gpio.c
+++ b/drivers/gpio/mpc8xxx_gpio.c
@@ -25,7 +25,7 @@ struct ccsr_gpio {
u32 gpicr;
 };

-struct mpc85xx_gpio_data {
+struct mpc8xxx_gpio_data {
/* The bank's register base in memory */
struct ccsr_gpio __iomem *base;
/* The address of the registers; used to identify the bank */
@@ -44,130 +44,130 @@ inline u32 gpio_mask(uint gpio)
return (1U << (31 - (gpio)));
 }

-static inline u32 mpc85xx_gpio_get_val(struct ccsr_gpio *base, u32 mask)
+static inline u32 mpc8xxx_gpio_get_val(struct ccsr_gpio *base, u32 mask)
 {
return in_be32(&base->gpdat) & mask;
 }

-static inline u32 mpc85xx_gpio_get_dir(struct ccsr_gpio *base, u32 mask)
+static inline u32 mpc8xxx_gpio_get_dir(struct ccsr_gpio *base, u32 mask)
 {
return in_be32(&base->gpdir) & mask;
 }

-static inline void mpc85xx_gpio_set_in(struct ccsr_gpio *base, u32 gpios)
+static inline void mpc8xxx_gpio_set_in(struct ccsr_gpio *base, u32 gpios)
 {
clrbits_be32(&base->gpdat, gpios);
/* GPDIR register 0 -> input */
clrbits_be32(&base->gpdir, gpios);
 }

-static inline void mpc85xx_gpio_set_low(struct ccsr_gpio *base, u32 gpios)
+static inline void mpc8xxx_gpio_set_low(struct ccsr_gpio *base, u32 gpios)
 {
clrbits_be32(&base->gpdat, gpios);
/* GPDIR register 1 -> output */
setbits_be32(&base->gpdir, gpios);
 }

-static inline void mpc85xx_gpio_set_high(struct ccsr_gpio *base, u32 gpios)
+static inline void mpc8xxx_gpio_set_high(struct ccsr_gpio *base, u32 gpios)
 {
setbits_be32(&base->gpdat, gpios);
/* GPDIR register 1 -> output */
setbits_be32(&base->gpdir, gpios);
 }

-static inline int mpc85xx_gpio_open_drain_val(struct ccsr_gpio *base, u32 mask)
+static inline int mpc8xxx_gpio_open_drain_val(struct ccsr_gpio *base, u32 mask)
 {
return in_be32(&base->gpodr) & mask;
 }

-static inline void mpc85xx_gpio_open_drain_on(struct ccsr_gpio *base, u32
+static inline void mpc8xxx_gpio_open_drain_on(struct ccsr_gpio *base, u32
  gpios)
 {
/* GPODR register 1 -> open drain on */
setbits_be32(&base->gpodr, gpios);
 }

-static inline void mpc85xx_gpio_open_drain_off(struct ccsr_gpio *base,

[U-Boot] [RESEND PATCH v2 5/7] net: phy: marvell 88e151x: Fix handling of bare RGMII interface type

2018-01-15 Thread Mario Six
Commit 68e6eca ("net: phy: marvell 88e151x: Fix handling of RGMII
interface types") fixed the initialization of 88e151x phys, but made it
so that interfaces of type PHY_INTERFACE_MODE_RGMII had both RX and TX
delay bits cleared. The default (like in m88es_config) is to have
both bits set.

Hence, this patch changes the behavior in the PHY_INTERFACE_MODE_RGMII
case so that both bits are set.

Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/net/phy/marvell.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 5d9f50a436..8eddf70c68 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -357,7 +357,8 @@ static int m88e1518_config(struct phy_device *phydev)

reg = phy_read(phydev, MDIO_DEVAD_NONE, MIIM_88E151x_PHY_MSCR);
reg &= ~MIIM_88E151x_RGMII_RXTX_DELAY;
-   if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)
+   if (phydev->interface == PHY_INTERFACE_MODE_RGMII ||
+   phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)
reg |= MIIM_88E151x_RGMII_RXTX_DELAY;
else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID)
reg |= MIIM_88E151x_RGMII_RX_DELAY;
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 5/8] spi: Remove CONFIG_OF_SPI_FLASH

2018-01-15 Thread Mario Six
Previous patches removed the last usages of this config variable, so
that it is now obsolete.

This patch removes it from the whitelist.

Reviewed-by: Simon Glass 
Reviewed-by: Jagan Teki 
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 scripts/config_whitelist.txt | 1 -
 1 file changed, 1 deletion(-)

diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index 13d13b6fda..b5cf3e1491 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -1534,7 +1534,6 @@ CONFIG_NUM_PAMU
 CONFIG_ODROID_REV_AIN
 CONFIG_OFF_PADCONF
 CONFIG_OF_
-CONFIG_OF_SPI_FLASH
 CONFIG_OF_STDOUT_PATH
 CONFIG_OMAP_EHCI_PHY1_RESET_GPIO
 CONFIG_OMAP_EHCI_PHY2_RESET_GPIO
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 11/27] cfi_flash: Fix comment style

2018-01-15 Thread Mario Six
Signed-off-by: Mario Six 
---

v1 -> v2:
None

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

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 6ae1ac871f..a21c407ed7 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -946,7 +946,8 @@ static int flash_write_cfibuffer(flash_info_t *info, ulong 
dest, uchar *cp,
  "write to buffer");
if (retcode == ERR_OK) {
/* reduce the number of loops by the width of
-* the port */
+* the port
+*/
cnt = len >> shift;
flash_write_cmd(info, sector, 0, cnt - 1);
while (cnt-- > 0) {
@@ -1793,7 +1794,8 @@ static int flash_detect_legacy(phys_addr_t base, int 
banknum)

if (board_flash_get_legacy(base, banknum, info)) {
/* board code may have filled info completely. If not, we
-  use JEDEC ID probing. */
+* use JEDEC ID probing.
+*/
if (!info->vendor) {
int modes[] = {
CFI_CMDSET_AMD_STANDARD,
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 2/4] core: read: Fix style violations

2018-01-15 Thread Mario Six
There are some whitespace-related style violations in read.c; fix those.

Reviewed-by: Simon Glass 
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/core/read.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/core/read.c b/drivers/core/read.c
index 5d440cee72..08955f81fc 100644
--- a/drivers/core/read.c
+++ b/drivers/core/read.c
@@ -66,7 +66,7 @@ void *dev_read_addr_ptr(struct udevice *dev)
 }

 fdt_addr_t dev_read_addr_size(struct udevice *dev, const char *property,
-   fdt_size_t *sizep)
+ fdt_size_t *sizep)
 {
return ofnode_get_addr_size(dev_ofnode(dev), property, sizep);
 }
@@ -77,7 +77,7 @@ const char *dev_read_name(struct udevice *dev)
 }

 int dev_read_stringlist_search(struct udevice *dev, const char *property,
- const char *string)
+  const char *string)
 {
return ofnode_stringlist_search(dev_ofnode(dev), property, string);
 }
@@ -94,9 +94,8 @@ int dev_read_string_count(struct udevice *dev, const char 
*propname)
 }

 int dev_read_phandle_with_args(struct udevice *dev, const char *list_name,
-   const char *cells_name, int cell_count,
-   int index,
-   struct ofnode_phandle_args *out_args)
+  const char *cells_name, int cell_count,
+  int index, struct ofnode_phandle_args *out_args)
 {
return ofnode_parse_phandle_with_args(dev_ofnode(dev), list_name,
  cells_name, cell_count, index,
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 2/7] gpio: pca953x_gpio: Make live-tree compatible

2018-01-15 Thread Mario Six
Make the pca953x_gpio driver compatible with a live device tree.

Reviewed-by: Simon Glass 
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/gpio/pca953x_gpio.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpio/pca953x_gpio.c b/drivers/gpio/pca953x_gpio.c
index 5ea1e05eed..a8a5a89c05 100644
--- a/drivers/gpio/pca953x_gpio.c
+++ b/drivers/gpio/pca953x_gpio.c
@@ -50,8 +50,6 @@ enum {
 #define MAX_BANK 5
 #define BANK_SZ 8

-DECLARE_GLOBAL_DATA_PTR;
-
 /*
  * struct pca953x_info - Data for pca953x
  *
@@ -253,7 +251,7 @@ static int pca953x_probe(struct udevice *dev)
ulong driver_data;
int ret;

-   addr = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), "reg", 0);
+   addr = dev_read_addr(dev);
if (addr == 0)
return -ENODEV;

--
2.11.0

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


[U-Boot] [RESEND PATCH v2 2/7] net: tsec: Fix memory leak in error path

2018-01-15 Thread Mario Six
tsec_initialize allocates a private driver structure using malloc.
Should the memory allocation of this private structure fail, the
function execution is aborted with a return 0, but the previously
allocated device structure is never freed, hence leaked.

Free the device structure in the error case.

Signed-off-by: Mario Six 
Acked-by: Joe Hershberger 
---

v1 -> v2:
None

---
 drivers/net/tsec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
index 071595218e..44140fb037 100644
--- a/drivers/net/tsec.c
+++ b/drivers/net/tsec.c
@@ -701,8 +701,10 @@ static int tsec_initialize(bd_t *bis, struct 
tsec_info_struct *tsec_info)

priv = (struct tsec_private *)malloc(sizeof(*priv));

-   if (!priv)
+   if (!priv) {
+   free(dev);
return 0;
+   }

priv->regs = tsec_info->regs;
priv->phyregs_sgmii = tsec_info->miiregs_sgmii;
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 3/7] gpio: mpc85xx_gpio: Fix style violations

2018-01-15 Thread Mario Six
Fix some style violations in the MPC85XX GPIO driver.

Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/gpio/mpc85xx_gpio.c | 42 ++
 1 file changed, 22 insertions(+), 20 deletions(-)

diff --git a/drivers/gpio/mpc85xx_gpio.c b/drivers/gpio/mpc85xx_gpio.c
index cfeb6e7632..4566c091b7 100644
--- a/drivers/gpio/mpc85xx_gpio.c
+++ b/drivers/gpio/mpc85xx_gpio.c
@@ -34,11 +34,13 @@ struct mpc85xx_gpio_data {
uint gpio_count;
/* The GPDAT register cannot be used to determine the value of output
 * pins on MPC8572/MPC8536, so we shadow it and use the shadowed value
-* for output pins */
+* for output pins
+*/
u32 dat_shadow;
 };

-inline u32 gpio_mask(unsigned gpio) {
+inline u32 gpio_mask(uint gpio)
+{
return (1U << (31 - (gpio)));
 }

@@ -92,7 +94,7 @@ static inline void mpc85xx_gpio_open_drain_off(struct 
ccsr_gpio *base,
clrbits_be32(&base->gpodr, gpios);
 }

-static int mpc85xx_gpio_direction_input(struct udevice *dev, unsigned gpio)
+static int mpc85xx_gpio_direction_input(struct udevice *dev, uint gpio)
 {
struct mpc85xx_gpio_data *data = dev_get_priv(dev);

@@ -100,8 +102,7 @@ static int mpc85xx_gpio_direction_input(struct udevice 
*dev, unsigned gpio)
return 0;
 }

-static int mpc85xx_gpio_set_value(struct udevice *dev, unsigned gpio,
- int value)
+static int mpc85xx_gpio_set_value(struct udevice *dev, uint gpio, int value)
 {
struct mpc85xx_gpio_data *data = dev_get_priv(dev);

@@ -115,46 +116,46 @@ static int mpc85xx_gpio_set_value(struct udevice *dev, 
unsigned gpio,
return 0;
 }

-static int mpc85xx_gpio_direction_output(struct udevice *dev, unsigned gpio,
+static int mpc85xx_gpio_direction_output(struct udevice *dev, uint gpio,
 int value)
 {
return mpc85xx_gpio_set_value(dev, gpio, value);
 }

-static int mpc85xx_gpio_get_value(struct udevice *dev, unsigned gpio)
+static int mpc85xx_gpio_get_value(struct udevice *dev, uint gpio)
 {
struct mpc85xx_gpio_data *data = dev_get_priv(dev);

if (!!mpc85xx_gpio_get_dir(data->base, gpio_mask(gpio))) {
/* Output -> use shadowed value */
return !!(data->dat_shadow & gpio_mask(gpio));
-   } else {
-   /* Input -> read value from GPDAT register */
-   return !!mpc85xx_gpio_get_val(data->base, gpio_mask(gpio));
}
+
+   /* Input -> read value from GPDAT register */
+   return !!mpc85xx_gpio_get_val(data->base, gpio_mask(gpio));
 }

-static int mpc85xx_gpio_get_open_drain(struct udevice *dev, unsigned gpio)
+static int mpc85xx_gpio_get_open_drain(struct udevice *dev, uint gpio)
 {
struct mpc85xx_gpio_data *data = dev_get_priv(dev);

return !!mpc85xx_gpio_open_drain_val(data->base, gpio_mask(gpio));
 }

-static int mpc85xx_gpio_set_open_drain(struct udevice *dev, unsigned gpio,
+static int mpc85xx_gpio_set_open_drain(struct udevice *dev, uint gpio,
   int value)
 {
struct mpc85xx_gpio_data *data = dev_get_priv(dev);

-   if (value) {
+   if (value)
mpc85xx_gpio_open_drain_on(data->base, gpio_mask(gpio));
-   } else {
+   else
mpc85xx_gpio_open_drain_off(data->base, gpio_mask(gpio));
-   }
+
return 0;
 }

-static int mpc85xx_gpio_get_function(struct udevice *dev, unsigned gpio)
+static int mpc85xx_gpio_get_function(struct udevice *dev, uint gpio)
 {
struct mpc85xx_gpio_data *data = dev_get_priv(dev);
int dir;
@@ -164,14 +165,15 @@ static int mpc85xx_gpio_get_function(struct udevice *dev, 
unsigned gpio)
 }

 #if CONFIG_IS_ENABLED(OF_CONTROL)
-static int mpc85xx_gpio_ofdata_to_platdata(struct udevice *dev) {
+static int mpc85xx_gpio_ofdata_to_platdata(struct udevice *dev)
+{
struct mpc85xx_gpio_plat *plat = dev_get_platdata(dev);
fdt_addr_t addr;
fdt_size_t size;

addr = fdtdec_get_addr_size_auto_noparent(gd->fdt_blob,
-   dev_of_offset(dev), "reg", 0, &size, false);
-
+ dev_of_offset(dev),
+ "reg", 0, &size, false);
plat->addr = addr;
plat->size = size;
plat->ngpios = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
@@ -229,7 +231,7 @@ static const struct dm_gpio_ops gpio_mpc85xx_ops = {
.set_value  = mpc85xx_gpio_set_value,
.get_open_drain = mpc85xx_gpio_get_open_drain,
.set_open_drain = mpc85xx_gpio_set_open_drain,
-   .get_function   = mpc85xx_gpio_get_function,
+   .get_function   = mpc85xx_gpio_get_function,
 };

 static const struct udevice_id mpc85xx_gpio_ids[] = {
--
2.11.0

___
U-Boot mailing list
U-Boot@lists.denx.de

Re: [U-Boot] [RESEND PATCH v2 2/4] clk: clk_fixed_rate: Fix style violation

2018-01-15 Thread Dr. Philipp Tomsich
Tom,

> On 15 Jan 2018, at 11:06, Mario Six  wrote:
> 
> Fix a mis-indented function call in clk_fixed_rate.c

A general question: do we want to have such gardening commits
create an additional indirection in our history for people using
git-blame frequently (e.g. I usually use git-blame to find the last
commit that touched a line and then read the log message to find
out why something was changed… now I’d have to restart this
search whenever I hit a pure formatting change)?

My gut feeling would be that we should try to change lines only
when there is an actual change to the code happening.

Regards,
Philipp.

> 
> Reviewed-by: Simon Glass 
> Signed-off-by: Mario Six 
> ---
> 
> v1 -> v2:
> None
> 
> ---
> drivers/clk/clk_fixed_rate.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/clk/clk_fixed_rate.c b/drivers/clk/clk_fixed_rate.c
> index 63565b6ed8..9dd6bc5726 100644
> --- a/drivers/clk/clk_fixed_rate.c
> +++ b/drivers/clk/clk_fixed_rate.c
> @@ -31,8 +31,8 @@ const struct clk_ops clk_fixed_rate_ops = {
> static int clk_fixed_rate_ofdata_to_platdata(struct udevice *dev)
> {
> #if !CONFIG_IS_ENABLED(OF_PLATDATA)
> - to_clk_fixed_rate(dev)->fixed_rate = dev_read_u32_default(dev,
> - "clock-frequency", 0);
> + to_clk_fixed_rate(dev)->fixed_rate =
> + dev_read_u32_default(dev, "clock-frequency", 0);
> #endif
> 
>   return 0;
> --
> 2.11.0
> 

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


[U-Boot] [RESEND PATCH v2 2/2] lib: fdtdec: Fix some style violations

2018-01-15 Thread Mario Six
Fix some style violations in fdtdec.c, and reduce the scope of some
variables.

Reviewed-by: Simon Glass 
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 lib/fdtdec.c | 29 +++--
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 7b555189d5..986a3525b7 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -233,10 +233,10 @@ int fdtdec_get_pci_addr(const void *blob, int node, enum 
fdt_pci_space type,
addr->phys_mid = fdt32_to_cpu(cell[1]);
addr->phys_lo = fdt32_to_cpu(cell[1]);
break;
-   } else {
-   cell += (FDT_PCI_ADDR_CELLS +
-FDT_PCI_SIZE_CELLS);
}
+
+   cell += (FDT_PCI_ADDR_CELLS +
+FDT_PCI_SIZE_CELLS);
}

if (i == num) {
@@ -245,10 +245,10 @@ int fdtdec_get_pci_addr(const void *blob, int node, enum 
fdt_pci_space type,
}

return 0;
-   } else {
-   ret = -EINVAL;
}

+   ret = -EINVAL;
+
 fail:
debug("(not found)\n");
return ret;
@@ -265,11 +265,9 @@ int fdtdec_get_pci_vendev(const void *blob, int node, u16 
*vendor, u16 *device)

end = list + len;
while (list < end) {
-   char *s;
-
len = strlen(list);
if (len >= strlen("pci,")) {
-   s = strstr(list, "pci");
+   char *s = strstr(list, "pci");

/*
 * check if the string is something like pci,.RR
@@ -299,7 +297,7 @@ int fdtdec_get_pci_bar32(struct udevice *dev, struct 
fdt_pci_addr *addr,

/* extract the bar number from fdt_pci_addr */
barnum = addr->phys_hi & 0xff;
-   if ((barnum < PCI_BASE_ADDRESS_0) || (barnum > PCI_CARDBUS_CIS))
+   if (barnum < PCI_BASE_ADDRESS_0 || barnum > PCI_CARDBUS_CIS)
return -EINVAL;

barnum = (barnum - PCI_BASE_ADDRESS_0) / 4;
@@ -335,7 +333,7 @@ int fdtdec_get_is_enabled(const void *blob, int node)
 */
cell = fdt_getprop(blob, node, "status", NULL);
if (cell)
-   return 0 == strcmp(cell, "okay");
+   return strcmp(cell, "okay") == 0;
return 1;
 }

@@ -345,8 +343,8 @@ enum fdt_compat_id fdtdec_lookup(const void *blob, int node)

/* Search our drivers */
for (id = COMPAT_UNKNOWN; id < COMPAT_COUNT; id++)
-   if (0 == fdt_node_check_compatible(blob, node,
-   compat_names[id]))
+   if (fdt_node_check_compatible(blob, node,
+ compat_names[id]) == 0)
return id;
return COMPAT_UNKNOWN;
 }
@@ -665,12 +663,14 @@ int fdtdec_get_int_array(const void *blob, int node, 
const char *prop_name,
 u32 *array, int count)
 {
const u32 *cell;
-   int i, err = 0;
+   int err = 0;

debug("%s: %s\n", __func__, prop_name);
cell = get_prop_check_min_len(blob, node, prop_name,
  sizeof(u32) * count, &err);
if (!err) {
+   int i;
+
for (i = 0; i < count; i++)
array[i] = fdt32_to_cpu(cell[i]);
}
@@ -975,7 +975,8 @@ int fdt_get_resource(const void *fdt, int node, const char 
*property,

while (ptr + na + ns <= end) {
if (i == index) {
-   res->start = res->end = fdtdec_get_number(ptr, na);
+   res->start = fdtdec_get_number(ptr, na);
+   res->end = res->start;
res->end += fdtdec_get_number(&ptr[na], ns) - 1;
return 0;
}
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 4/7] net: phy: marvell: Fix style violations

2018-01-15 Thread Mario Six
Fix some style violations (mostly wrong indentions) in the Marvell PHY
driver.

Acked-by: Joe Hershberger 
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/net/phy/marvell.c | 44 ++--
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index b7f300e40f..5d9f50a436 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -134,7 +134,7 @@ static int m88e1xxx_parse_status(struct phy_device *phydev)
mii_reg = phy_read(phydev, MDIO_DEVAD_NONE, MIIM_88E1xxx_PHY_STATUS);

if ((mii_reg & MIIM_88E1xxx_PHYSTAT_LINK) &&
-   !(mii_reg & MIIM_88E1xxx_PHYSTAT_SPDDONE)) {
+   !(mii_reg & MIIM_88E1xxx_PHYSTAT_SPDDONE)) {
int i = 0;

puts("Waiting for PHY realtime link");
@@ -150,10 +150,10 @@ static int m88e1xxx_parse_status(struct phy_device 
*phydev)
putc('.');
udelay(1000);
mii_reg = phy_read(phydev, MDIO_DEVAD_NONE,
-   MIIM_88E1xxx_PHY_STATUS);
+  MIIM_88E1xxx_PHY_STATUS);
}
puts(" done\n");
-   udelay(50); /* another 500 ms (results in faster booting) */
+   mdelay(500);/* another 500 ms (results in faster booting) */
} else {
if (mii_reg & MIIM_88E1xxx_PHYSTAT_LINK)
phydev->link = 1;
@@ -201,9 +201,9 @@ static int m88es_config(struct phy_device *phydev)

if (phy_interface_is_rgmii(phydev)) {
reg = phy_read(phydev,
-   MDIO_DEVAD_NONE, MIIM_88E_PHY_EXT_CR);
+  MDIO_DEVAD_NONE, MIIM_88E_PHY_EXT_CR);
if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) ||
-   (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)) {
+   (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)) {
reg |= (MIIM_88E_RX_DELAY | MIIM_88E_TX_DELAY);
} else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) {
reg &= ~MIIM_88E_TX_DELAY;
@@ -214,10 +214,10 @@ static int m88es_config(struct phy_device *phydev)
}

phy_write(phydev,
-   MDIO_DEVAD_NONE, MIIM_88E_PHY_EXT_CR, reg);
+ MDIO_DEVAD_NONE, MIIM_88E_PHY_EXT_CR, reg);

reg = phy_read(phydev,
-   MDIO_DEVAD_NONE, MIIM_88E_PHY_EXT_SR);
+  MDIO_DEVAD_NONE, MIIM_88E_PHY_EXT_SR);

reg &= ~(MIIM_88E_HWCFG_MODE_MASK);

@@ -227,47 +227,47 @@ static int m88es_config(struct phy_device *phydev)
reg |= MIIM_88E_HWCFG_MODE_COPPER_RGMII;

phy_write(phydev,
-   MDIO_DEVAD_NONE, MIIM_88E_PHY_EXT_SR, reg);
+ MDIO_DEVAD_NONE, MIIM_88E_PHY_EXT_SR, reg);
}

if (phydev->interface == PHY_INTERFACE_MODE_SGMII) {
reg = phy_read(phydev,
-   MDIO_DEVAD_NONE, MIIM_88E_PHY_EXT_SR);
+  MDIO_DEVAD_NONE, MIIM_88E_PHY_EXT_SR);

reg &= ~(MIIM_88E_HWCFG_MODE_MASK);
reg |= MIIM_88E_HWCFG_MODE_SGMII_NO_CLK;
reg |= MIIM_88E_HWCFG_FIBER_COPPER_AUTO;

phy_write(phydev, MDIO_DEVAD_NONE,
-   MIIM_88E_PHY_EXT_SR, reg);
+ MIIM_88E_PHY_EXT_SR, reg);
}

if (phydev->interface == PHY_INTERFACE_MODE_RTBI) {
reg = phy_read(phydev,
-   MDIO_DEVAD_NONE, MIIM_88E_PHY_EXT_CR);
+  MDIO_DEVAD_NONE, MIIM_88E_PHY_EXT_CR);
reg |= (MIIM_88E_RX_DELAY | MIIM_88E_TX_DELAY);
phy_write(phydev,
-   MDIO_DEVAD_NONE, MIIM_88E_PHY_EXT_CR, reg);
+ MDIO_DEVAD_NONE, MIIM_88E_PHY_EXT_CR, reg);

reg = phy_read(phydev, MDIO_DEVAD_NONE,
-   MIIM_88E_PHY_EXT_SR);
+  MIIM_88E_PHY_EXT_SR);
reg &= ~(MIIM_88E_HWCFG_MODE_MASK |
MIIM_88E_HWCFG_FIBER_COPPER_RES);
reg |= 0x7 | MIIM_88E_HWCFG_FIBER_COPPER_AUTO;
phy_write(phydev, MDIO_DEVAD_NONE,
-   MIIM_88E_PHY_EXT_SR, reg);
+ MIIM_88E_PHY_EXT_SR, reg);

/* soft reset */
phy_reset(phydev);

reg = phy_read(phydev, MDIO_DEVAD_NONE,
-   MIIM_88E_PHY_EXT_SR);
+  MIIM_88E_PHY_EXT_SR);
  

[U-Boot] [RESEND PATCH v2 1/4] include: dm: Fix 'devioe'/'devuce' typos

2018-01-15 Thread Mario Six
There are some typos in the documentation of some functions in read.h;
fix those.

Signed-off-by: Mario Six 
Reviewed-by: Simon Glass 
---

v1 -> v2:
None

---
 include/dm/read.h | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/dm/read.h b/include/dm/read.h
index 8114037e97..d2f47a678f 100644
--- a/include/dm/read.h
+++ b/include/dm/read.h
@@ -255,7 +255,7 @@ int dev_count_phandle_with_args(struct udevice *dev, const 
char *list_name,
  * This walks back up the tree to find the closest #address-cells property
  * which controls the given node.
  *
- * @dev: devioe to check
+ * @dev: device to check
  * @return number of address cells this node uses
  */
 int dev_read_addr_cells(struct udevice *dev);
@@ -266,7 +266,7 @@ int dev_read_addr_cells(struct udevice *dev);
  * This walks back up the tree to find the closest #size-cells property
  * which controls the given node.
  *
- * @dev: devioe to check
+ * @dev: device to check
  * @return number of size cells this node uses
  */
 int dev_read_size_cells(struct udevice *dev);
@@ -276,7 +276,7 @@ int dev_read_size_cells(struct udevice *dev);
  *
  * This function matches fdt_address_cells().
  *
- * @dev: devioe to check
+ * @dev: device to check
  * @return number of address cells this node uses
  */
 int dev_read_simple_addr_cells(struct udevice *dev);
@@ -286,7 +286,7 @@ int dev_read_simple_addr_cells(struct udevice *dev);
  *
  * This function matches fdt_size_cells().
  *
- * @dev: devioe to check
+ * @dev: device to check
  * @return number of size cells this node uses
  */
 int dev_read_simple_size_cells(struct udevice *dev);
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 6/6] i2c: ihs_i2c: Factor out send_buffer method

2018-01-15 Thread Mario Six
Simplify the driver logic by extracting a common send_buffer method.

Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/i2c/ihs_i2c.c | 50 ++
 1 file changed, 26 insertions(+), 24 deletions(-)

diff --git a/drivers/i2c/ihs_i2c.c b/drivers/i2c/ihs_i2c.c
index b24afa472b..ee96cd50d5 100644
--- a/drivers/i2c/ihs_i2c.c
+++ b/drivers/i2c/ihs_i2c.c
@@ -198,32 +198,48 @@ static int ihs_i2c_transfer(uchar chip, uchar *buffer, 
int len, bool read,
 }

 #ifdef CONFIG_DM_I2C
-static int ihs_i2c_address(struct udevice *dev, uchar chip, u8 *addr, int 
alen, bool hold_bus)
+static int ihs_i2c_send_buffer(struct udevice *dev, uchar chip, u8 *data, int 
len, bool hold_bus, int read)
 #else
-static int ihs_i2c_address(uchar chip, u8 *addr, int alen, bool hold_bus)
+static int ihs_i2c_send_buffer(uchar chip, u8 *data, int len, bool hold_bus,
+  int read)
 #endif
 {
-   while (alen) {
-   int transfer = min(alen, 2);
-   bool is_last = alen <= transfer;
+   while (len) {
+   int transfer = min(len, 2);
+   bool is_last = len <= transfer;

 #ifdef CONFIG_DM_I2C
-   if (ihs_i2c_transfer(dev, chip, addr, transfer, I2COP_WRITE,
+   if (ihs_i2c_transfer(dev, chip, data, transfer, read,
 hold_bus ? false : is_last))
return 1;
 #else
-   if (ihs_i2c_transfer(chip, addr, transfer, I2COP_WRITE,
+   if (ihs_i2c_transfer(chip, data, transfer, read,
 hold_bus ? false : is_last))
return 1;
 #endif

-   alen -= transfer;
+   data += transfer;
+   len -= transfer;
}

return 0;
 }

 #ifdef CONFIG_DM_I2C
+static int ihs_i2c_address(struct udevice *dev, uchar chip, u8 *addr, int alen,
+  bool hold_bus)
+#else
+static int ihs_i2c_address(uchar chip, u8 *addr, int alen, bool hold_bus)
+#endif
+{
+#ifdef CONFIG_DM_I2C
+   return ihs_i2c_send_buffer(dev, chip, addr, alen, hold_bus, 
I2COP_WRITE);
+#else
+   return ihs_i2c_send_buffer(chip, addr, alen, hold_bus, I2COP_WRITE);
+#endif
+}
+
+#ifdef CONFIG_DM_I2C
 static int ihs_i2c_access(struct udevice *dev, uchar chip, u8 *addr,
  int alen, uchar *buffer, int len, int read)
 #else
@@ -240,25 +256,11 @@ static int ihs_i2c_access(struct i2c_adapter *adap, uchar 
chip, u8 *addr,
return 1;
 #endif

-   while (len) {
-   int transfer = min(len, 2);
-   bool is_last = len <= transfer;
-
 #ifdef CONFIG_DM_I2C
-   if (ihs_i2c_transfer(dev, chip, buffer, transfer, read,
-is_last))
-   return 2;
+   return ihs_i2c_send_buffer(dev, chip, buffer, len, false, read);
 #else
-   if (ihs_i2c_transfer(chip, buffer, transfer, read,
-is_last))
-   return 2;
+   return ihs_i2c_send_buffer(chip, buffer, len, false, read);
 #endif
-
-   buffer += transfer;
-   len -= transfer;
-   }
-
-   return 0;
 }

 #ifdef CONFIG_DM_I2C
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 8/8] sf_probe: Merge spi_flash_probe_tail into spi_flash_probe

2018-01-15 Thread Mario Six
spi_flash_probe_tail is now only called from spi_flash_probe, hence we
can merge its body into spi_flash_probe.

Reviewed-by: Simon Glass 
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/mtd/spi/sf_probe.c | 19 +++
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c
index 68009a6328..09143d7868 100644
--- a/drivers/mtd/spi/sf_probe.c
+++ b/drivers/mtd/spi/sf_probe.c
@@ -55,10 +55,16 @@ err_read_id:
 }

 #ifndef CONFIG_DM_SPI_FLASH
-static struct spi_flash *spi_flash_probe_tail(struct spi_slave *bus)
+struct spi_flash *spi_flash_probe(unsigned int busnum, unsigned int cs,
+ unsigned int max_hz, unsigned int spi_mode)
 {
+   struct spi_slave *bus;
struct spi_flash *flash;

+   bus = spi_setup_slave(busnum, cs, max_hz, spi_mode);
+   if (!bus)
+   return NULL;
+
/* Allocate space if needed (not used by sf-uclass */
flash = calloc(1, sizeof(*flash));
if (!flash) {
@@ -76,17 +82,6 @@ static struct spi_flash *spi_flash_probe_tail(struct 
spi_slave *bus)
return flash;
 }

-struct spi_flash *spi_flash_probe(unsigned int busnum, unsigned int cs,
- unsigned int max_hz, unsigned int spi_mode)
-{
-   struct spi_slave *bus;
-
-   bus = spi_setup_slave(busnum, cs, max_hz, spi_mode);
-   if (!bus)
-   return NULL;
-   return spi_flash_probe_tail(bus);
-}
-
 void spi_flash_free(struct spi_flash *flash)
 {
 #ifdef CONFIG_SPI_FLASH_MTD
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 7/8] spi: spi-uclass: Fix style violations

2018-01-15 Thread Mario Six
Remove a superfluous newline, and reduce the scope of a variable.

Reviewed-by: Simon Glass 
Reviewed-by: Jagan Teki 
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/spi/spi-uclass.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c
index 6db0eb02b4..15d90a54a1 100644
--- a/drivers/spi/spi-uclass.c
+++ b/drivers/spi/spi-uclass.c
@@ -50,7 +50,6 @@ int dm_spi_claim_bus(struct udevice *dev)
struct dm_spi_bus *spi = dev_get_uclass_priv(bus);
struct spi_slave *slave = dev_get_parent_priv(dev);
int speed;
-   int ret;

speed = slave->max_hz;
if (spi->max_hz) {
@@ -62,7 +61,8 @@ int dm_spi_claim_bus(struct udevice *dev)
if (!speed)
speed = 10;
if (speed != slave->speed) {
-   ret = spi_set_speed_mode(bus, speed, slave->mode);
+   int ret = spi_set_speed_mode(bus, speed, slave->mode);
+
if (ret)
return ret;
slave->speed = speed;
@@ -129,7 +129,6 @@ static int spi_post_probe(struct udevice *bus)
 #if defined(CONFIG_NEEDS_MANUAL_RELOC)
struct dm_spi_ops *ops = spi_get_ops(bus);

-
if (ops->claim_bus)
ops->claim_bus += gd->reloc_off;
if (ops->release_bus)
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 1/6] i2c: fsl_i2c: Fix style violations

2018-01-15 Thread Mario Six
Fix some style violations in the fsl_i2c I2C driver, and use shorter
type names for variables in some cases.

Reviewed-by: Heiko Schocher 
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/i2c/fsl_i2c.c | 111 +-
 1 file changed, 56 insertions(+), 55 deletions(-)

diff --git a/drivers/i2c/fsl_i2c.c b/drivers/i2c/fsl_i2c.c
index ff3dc25927..d957cf6286 100644
--- a/drivers/i2c/fsl_i2c.c
+++ b/drivers/i2c/fsl_i2c.c
@@ -116,10 +116,10 @@ static const struct {
  *
  * The return value is the actual bus speed that is set.
  */
-static unsigned int set_i2c_bus_speed(const struct fsl_i2c_base *base,
-   unsigned int i2c_clk, unsigned int speed)
+static uint set_i2c_bus_speed(const struct fsl_i2c_base *base,
+ uint i2c_clk, uint speed)
 {
-   unsigned short divider = min(i2c_clk / speed, (unsigned int)USHRT_MAX);
+   ushort divider = min(i2c_clk / speed, (uint)USHRT_MAX);

/*
 * We want to choose an FDR/DFSR that generates an I2C bus speed that
@@ -130,8 +130,8 @@ static unsigned int set_i2c_bus_speed(const struct 
fsl_i2c_base *base,
 #ifdef __PPC__
u8 dfsr, fdr = 0x31; /* Default if no FDR found */
/* a, b and dfsr matches identifiers A,B and C respectively in AN2919 */
-   unsigned short a, b, ga, gb;
-   unsigned long c_div, est_div;
+   ushort a, b, ga, gb;
+   ulong c_div, est_div;

 #ifdef CONFIG_FSL_I2C_CUSTOM_DFSR
dfsr = CONFIG_FSL_I2C_CUSTOM_DFSR;
@@ -151,18 +151,21 @@ static unsigned int set_i2c_bus_speed(const struct 
fsl_i2c_base *base,
for (ga = 0x4, a = 10; a <= 30; ga++, a += 2) {
for (gb = 0; gb < 8; gb++) {
b = 16 << gb;
-   c_div = b * (a + ((3*dfsr)/b)*2);
-   if ((c_div > divider) && (c_div < est_div)) {
-   unsigned short bin_gb, bin_ga;
+   c_div = b * (a + ((3 * dfsr) / b) * 2);
+   if (c_div > divider && c_div < est_div) {
+   ushort bin_gb, bin_ga;

est_div = c_div;
bin_gb = gb << 2;
bin_ga = (ga & 0x3) | ((ga & 0x4) << 3);
fdr = bin_gb | bin_ga;
speed = i2c_clk / est_div;
-   debug("FDR:0x%.2x, div:%ld, ga:0x%x, gb:0x%x, "
- "a:%d, b:%d, speed:%d\n",
- fdr, est_div, ga, gb, a, b, speed);
+
+   debug("FDR: 0x%.2x, ", fdr);
+   debug("div: %ld, ", est_div);
+   debug("ga: 0x%x, gb: 0x%x, ", ga, gb);
+   debug("a: %d, b: %d, speed: %d\n", a, b, speed);
+
/* Condition 2 not accounted for */
debug("Tr <= %d ns\n",
  (b - 3 * dfsr) * 100 /
@@ -174,13 +177,13 @@ static unsigned int set_i2c_bus_speed(const struct 
fsl_i2c_base *base,
if (a == 24)
a += 4;
}
-   debug("divider:%d, est_div:%ld, DFSR:%d\n", divider, est_div, dfsr);
-   debug("FDR:0x%.2x, speed:%d\n", fdr, speed);
+   debug("divider: %d, est_div: %ld, DFSR: %d\n", divider, est_div, dfsr);
+   debug("FDR: 0x%.2x, speed: %d\n", fdr, speed);
 #endif
writeb(dfsr, &base->dfsrr); /* set default filter */
writeb(fdr, &base->fdr);/* set bus speed */
 #else
-   unsigned int i;
+   uint i;

for (i = 0; i < ARRAY_SIZE(fsl_i2c_speed_map); i++)
if (fsl_i2c_speed_map[i].divider >= divider) {
@@ -197,7 +200,7 @@ static unsigned int set_i2c_bus_speed(const struct 
fsl_i2c_base *base,
 }

 #ifndef CONFIG_DM_I2C
-static unsigned int get_i2c_clock(int bus)
+static uint get_i2c_clock(int bus)
 {
if (bus)
return gd->arch.i2c2_clk;   /* I2C2 clock */
@@ -211,10 +214,11 @@ static int fsl_i2c_fixup(const struct fsl_i2c_base *base)
const unsigned long long timeout = usec2ticks(CONFIG_I2C_MBB_TIMEOUT);
unsigned long long timeval = 0;
int ret = -1;
-   unsigned int flags = 0;
+   uint flags = 0;

 #ifdef CONFIG_SYS_FSL_ERRATUM_I2C_A004447
-   unsigned int svr = get_svr();
+   uint svr = get_svr();
+
if ((SVR_SOC_VER(svr) == SVR_8548 && IS_SVR_REV(svr, 3, 1)) ||
(SVR_REV(svr) <= CONFIG_SYS_FSL_A004447_SVR_REV))
flags = I2C_CR_BIT6;
@@ -263,7 +267,7 @@ static void __i2c_init(const struct fsl_i2c_base *base, int 
speed, int
/* Call board specific i2c bus reset routine before accessing the
 * environment, which might be in a chip on that bus. For details
 * about this problem see doc/I2C_Edge_Conditions.
-   */
+

[U-Boot] [RESEND PATCH v2 4/8] spi: Remove spi_setup_slave_fdt

2018-01-15 Thread Mario Six
A previous patch removed the spi_flash_probe_fdt function, which
contained the last call of the spi_setup_slave_fdt function, which is
now equally obsolete.

This patch removes the function.

Reviewed-by: Simon Glass 
Reviewed-by: Jagan Teki 
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/spi/spi-uclass.c | 16 
 include/spi.h| 13 -
 2 files changed, 29 deletions(-)

diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c
index e06a603ab1..6db0eb02b4 100644
--- a/drivers/spi/spi-uclass.c
+++ b/drivers/spi/spi-uclass.c
@@ -348,22 +348,6 @@ err:
 }

 /* Compatibility function - to be removed */
-struct spi_slave *spi_setup_slave_fdt(const void *blob, int node,
- int bus_node)
-{
-   struct udevice *bus, *dev;
-   int ret;
-
-   ret = uclass_get_device_by_of_offset(UCLASS_SPI, bus_node, &bus);
-   if (ret)
-   return NULL;
-   ret = device_get_child_by_of_offset(bus, node, &dev);
-   if (ret)
-   return NULL;
-   return dev_get_parent_priv(dev);
-}
-
-/* Compatibility function - to be removed */
 struct spi_slave *spi_setup_slave(unsigned int busnum, unsigned int cs,
  unsigned int speed, unsigned int mode)
 {
diff --git a/include/spi.h b/include/spi.h
index c6442589a0..832b04ed3c 100644
--- a/include/spi.h
+++ b/include/spi.h
@@ -314,19 +314,6 @@ static inline int spi_w8r8(struct spi_slave *slave, 
unsigned char byte)
return ret < 0 ? ret : din[1];
 }

-/**
- * Set up a SPI slave for a particular device tree node
- *
- * This calls spi_setup_slave() with the correct bus number. Call
- * spi_free_slave() to free it later.
- *
- * @param blob:Device tree blob
- * @param slave_node:  Slave node to use
- * @param spi_node:SPI peripheral node to use
- * @return pointer to new spi_slave structure
- */
-struct spi_slave *spi_setup_slave_fdt(const void *blob, int slave_node,
- int spi_node);
 #ifdef CONFIG_DM_SPI

 /**
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 2/4] serial: ns16550: Fix style violation

2018-01-15 Thread Mario Six
Clarify the computation precedence in two ternary operator
constructions.

Reviewed-by: Simon Glass 
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/serial/ns16550.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
index c702304e79..6f9ce689cf 100644
--- a/drivers/serial/ns16550.c
+++ b/drivers/serial/ns16550.c
@@ -339,9 +339,9 @@ static int ns16550_serial_pending(struct udevice *dev, bool 
input)
struct NS16550 *const com_port = dev_get_priv(dev);

if (input)
-   return serial_in(&com_port->lsr) & UART_LSR_DR ? 1 : 0;
+   return (serial_in(&com_port->lsr) & UART_LSR_DR) ? 1 : 0;
else
-   return serial_in(&com_port->lsr) & UART_LSR_THRE ? 0 : 1;
+   return (serial_in(&com_port->lsr) & UART_LSR_THRE) ? 0 : 1;
 }

 static int ns16550_serial_getc(struct udevice *dev)
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 2/6] i2c: fsl_i2c: Remove inline declarations

2018-01-15 Thread Mario Six
Some functions in the fsl_i2c driver are declared as inline, even though
they are quite large, which needlessly increases the size of the
resulting binary.

This patch removes the inline declarations.

Reviewed-by: Heiko Schocher 
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/i2c/fsl_i2c.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/i2c/fsl_i2c.c b/drivers/i2c/fsl_i2c.c
index d957cf6286..a7f3ec472f 100644
--- a/drivers/i2c/fsl_i2c.c
+++ b/drivers/i2c/fsl_i2c.c
@@ -303,7 +303,7 @@ static int i2c_wait4bus(const struct fsl_i2c_base *base)
return 0;
 }

-static inline int i2c_wait(const struct fsl_i2c_base *base, int write)
+static int i2c_wait(const struct fsl_i2c_base *base, int write)
 {
u32 csr;
unsigned long long timeval = get_ticks();
@@ -340,8 +340,8 @@ static inline int i2c_wait(const struct fsl_i2c_base *base, 
int write)
return -1;
 }

-static inline int i2c_write_addr(const struct fsl_i2c_base *base, u8 dev,
-u8 dir, int rsta)
+static int i2c_write_addr(const struct fsl_i2c_base *base, u8 dev,
+ u8 dir, int rsta)
 {
writeb(I2C_CR_MEN | I2C_CR_MSTA | I2C_CR_MTX
   | (rsta ? I2C_CR_RSTA : 0),
@@ -355,8 +355,8 @@ static inline int i2c_write_addr(const struct fsl_i2c_base 
*base, u8 dev,
return 1;
 }

-static inline int __i2c_write_data(const struct fsl_i2c_base *base, u8 *data,
-  int length)
+static int __i2c_write_data(const struct fsl_i2c_base *base, u8 *data,
+   int length)
 {
int i;

@@ -370,8 +370,8 @@ static inline int __i2c_write_data(const struct 
fsl_i2c_base *base, u8 *data,
return i;
 }

-static inline int __i2c_read_data(const struct fsl_i2c_base *base, u8 *data,
- int length)
+static int __i2c_read_data(const struct fsl_i2c_base *base, u8 *data,
+  int length)
 {
int i;

--
2.11.0

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


[U-Boot] [RESEND PATCH v2 4/6] i2c: ihs_i2c: Prepare DM conversion

2018-01-15 Thread Mario Six
Prepare the function interface of the ihs_i2c driver for DM conversion
in a future patch.

While we're at it, fix some style violations, and make the code more readable.

Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/i2c/ihs_i2c.c | 69 +--
 1 file changed, 40 insertions(+), 29 deletions(-)

diff --git a/drivers/i2c/ihs_i2c.c b/drivers/i2c/ihs_i2c.c
index 29612e69fe..6fd016339c 100644
--- a/drivers/i2c/ihs_i2c.c
+++ b/drivers/i2c/ihs_i2c.c
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#include 

 DECLARE_GLOBAL_DATA_PTR;

@@ -41,30 +42,38 @@ DECLARE_GLOBAL_DATA_PTR;
 #endif

 enum {
-   I2CINT_ERROR_EV = 1 << 13,
-   I2CINT_TRANSMIT_EV = 1 << 14,
-   I2CINT_RECEIVE_EV = 1 << 15,
+   I2CINT_ERROR_EV = BIT(13),
+   I2CINT_TRANSMIT_EV = BIT(14),
+   I2CINT_RECEIVE_EV = BIT(15),
 };

 enum {
+   I2CMB_READ = 0 << 10,
I2CMB_WRITE = 1 << 10,
+   I2CMB_1BYTE = 0 << 11,
I2CMB_2BYTE = 1 << 11,
+   I2CMB_DONT_HOLD_BUS = 0 << 13,
I2CMB_HOLD_BUS = 1 << 13,
I2CMB_NATIVE = 2 << 14,
 };

+enum {
+   I2COP_WRITE = 0,
+   I2COP_READ = 1,
+};
+
 static int wait_for_int(bool read)
 {
u16 val;
-   unsigned int ctr = 0;
+   uint ctr = 0;

I2C_GET_REG(interrupt_status, &val);
+   /* Wait until error or receive/transmit interrupt was raised */
while (!(val & (I2CINT_ERROR_EV
   | (read ? I2CINT_RECEIVE_EV : I2CINT_TRANSMIT_EV {
udelay(10);
-   if (ctr++ > 5000) {
+   if (ctr++ > 5000)
return 1;
-   }
I2C_GET_REG(interrupt_status, &val);
}

@@ -76,10 +85,12 @@ static int ihs_i2c_transfer(uchar chip, uchar *buffer, int 
len, bool read,
 {
u16 val;

+   /* Clear interrupt status */
I2C_SET_REG(interrupt_status, I2CINT_ERROR_EV
 | I2CINT_RECEIVE_EV | I2CINT_TRANSMIT_EV);
I2C_GET_REG(interrupt_status, &val);

+   /* If we want to write and have data, write the bytes to the mailbox */
if (!read && len) {
val = buffer[0];

@@ -98,6 +109,7 @@ static int ihs_i2c_transfer(uchar chip, uchar *buffer, int 
len, bool read,
if (wait_for_int(read))
return 1;

+   /* If we want to read, get the bytes from the mailbox */
if (read) {
I2C_GET_REG(read_mailbox_ext, &val);
buffer[0] = val & 0xff;
@@ -108,55 +120,44 @@ static int ihs_i2c_transfer(uchar chip, uchar *buffer, 
int len, bool read,
return 0;
 }

-static int ihs_i2c_address(uchar chip, uint addr, int alen, bool hold_bus)
+static int ihs_i2c_address(uchar chip, u8 *addr, int alen, bool hold_bus)
 {
-   int shift = (alen-1) * 8;
-
while (alen) {
int transfer = min(alen, 2);
-   uchar buf[2];
bool is_last = alen <= transfer;

-   buf[0] = addr >> shift;
-   if (alen > 1)
-   buf[1] = addr >> (shift - 8);
-
-   if (ihs_i2c_transfer(chip, buf, transfer, false,
+   if (ihs_i2c_transfer(chip, addr, transfer, I2COP_WRITE,
 hold_bus ? false : is_last))
return 1;

-   shift -= 16;
alen -= transfer;
}

return 0;
 }

-static int ihs_i2c_access(struct i2c_adapter *adap, uchar chip, uint addr,
- int alen, uchar *buffer, int len, bool read)
+static int ihs_i2c_access(struct i2c_adapter *adap, uchar chip, u8 *addr,
+ int alen, uchar *buffer, int len, int read)
 {
-   if (len <= 0)
-   return 1;
-
-   if (ihs_i2c_address(chip, addr, alen, len))
+   /* Don't hold the bus if length of data to send/receive is zero */
+   if (len <= 0 || ihs_i2c_address(chip, addr, alen, len))
return 1;

while (len) {
int transfer = min(len, 2);
+   bool is_last = len <= transfer;

if (ihs_i2c_transfer(chip, buffer, transfer, read,
-len <= transfer))
-   return 1;
+is_last))
+   return 2;

buffer += transfer;
-   addr += transfer;
len -= transfer;
}

return 0;
 }

-
 static void ihs_i2c_init(struct i2c_adapter *adap, int speed, int slaveaddr)
 {
 #ifdef CONFIG_SYS_I2C_INIT_BOARD
@@ -173,7 +174,7 @@ static int ihs_i2c_probe(struct i2c_adapter *adap, uchar 
chip)
 {
uchar buffer[2];

-   if (ihs_i2c_transfer(chip, buffer, 0, true, true))
+   if (ihs_i2c_transfer(chip, buffer, 0, I2COP_READ, true))
return 1;

return 0;
@@ -182,13 +183,23 @@ static int ihs_i2c_probe(struct i2c_adapter *adap, uchar 
chip)
 static int ihs_

[U-Boot] [RESEND PATCH v2 3/7] net: tsec: Make live-tree compatible

2018-01-15 Thread Mario Six
Make the tsec ethernet driver compatible with a live device tree.

Reviewed-by: Simon Glass 
Acked-by: Joe Hershberger 
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/net/tsec.c | 41 ++---
 1 file changed, 18 insertions(+), 23 deletions(-)

diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
index 44140fb037..3eb09e93b2 100644
--- a/drivers/net/tsec.c
+++ b/drivers/net/tsec.c
@@ -20,8 +20,6 @@
 #include 
 #include 

-DECLARE_GLOBAL_DATA_PTR;
-
 #ifndef CONFIG_DM_ETH
 /* Default initializations for TSEC controllers. */

@@ -779,45 +777,42 @@ int tsec_probe(struct udevice *dev)
struct tsec_private *priv = dev_get_priv(dev);
struct eth_pdata *pdata = dev_get_platdata(dev);
struct fsl_pq_mdio_info mdio_info;
-   int offset = 0;
-   int reg;
+   struct ofnode_phandle_args phandle_args;
+   ofnode parent;
const char *phy_mode;
int ret;

-   pdata->iobase = (phys_addr_t)devfdt_get_addr(dev);
+   pdata->iobase = (phys_addr_t)dev_read_addr(dev);
priv->regs = (struct tsec *)pdata->iobase;

-   offset = fdtdec_lookup_phandle(gd->fdt_blob, dev_of_offset(dev),
-  "phy-handle");
-   if (offset > 0) {
-   reg = fdtdec_get_int(gd->fdt_blob, offset, "reg", 0);
-   priv->phyaddr = reg;
-   } else {
+   if (dev_read_phandle_with_args(dev, "phy-handle", NULL, 0, 0,
+  &phandle_args)) {
debug("phy-handle does not exist under tsec %s\n", dev->name);
return -ENOENT;
+   } else {
+   int reg = ofnode_read_u32_default(phandle_args.node, "reg", 0);
+   priv->phyaddr = reg;
}

-   offset = fdt_parent_offset(gd->fdt_blob, offset);
-   if (offset > 0) {
-   reg = fdtdec_get_int(gd->fdt_blob, offset, "reg", 0);
+   parent = ofnode_get_parent(phandle_args.node);
+   if (ofnode_valid(parent)) {
+   int reg = ofnode_read_u32_default(parent, "reg", 0);
priv->phyregs_sgmii = (struct tsec_mii_mng *)(reg + 0x520);
} else {
debug("No parent node for PHY?\n");
return -ENOENT;
}

-   offset = fdtdec_lookup_phandle(gd->fdt_blob, dev_of_offset(dev),
-  "tbi-handle");
-   if (offset > 0) {
-   reg = fdtdec_get_int(gd->fdt_blob, offset, "reg",
-CONFIG_SYS_TBIPA_VALUE);
-   priv->tbiaddr = reg;
-   } else {
+   if (dev_read_phandle_with_args(dev, "tbi-handle", NULL, 0, 0,
+  &phandle_args)) {
priv->tbiaddr = CONFIG_SYS_TBIPA_VALUE;
+   } else {
+   int reg = ofnode_read_u32_default(phandle_args.node, "reg",
+ CONFIG_SYS_TBIPA_VALUE);
+   priv->tbiaddr = reg;
}

-   phy_mode = fdt_getprop(gd->fdt_blob, dev_of_offset(dev),
-  "phy-connection-type", NULL);
+   phy_mode = dev_read_prop(dev, "phy-connection-type", NULL);
if (phy_mode)
pdata->phy_interface = phy_get_interface_by_name(phy_mode);
if (pdata->phy_interface == -1) {
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 1/7] net: tsec: Fix style violations

2018-01-15 Thread Mario Six
Signed-off-by: Mario Six 
Acked-by: Joe Hershberger 
---

v1 -> v2:
None

---
 drivers/net/tsec.c | 72 --
 1 file changed, 37 insertions(+), 35 deletions(-)

diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
index 18e7a83d0f..071595218e 100644
--- a/drivers/net/tsec.c
+++ b/drivers/net/tsec.c
@@ -74,11 +74,11 @@ static void tsec_configure_serdes(struct tsec_private *priv)
 * to the register offset used for external PHY accesses
 */
tsec_local_mdio_write(priv->phyregs_sgmii, in_be32(&priv->regs->tbipa),
-   0, TBI_ANA, TBIANA_SETTINGS);
+ 0, TBI_ANA, TBIANA_SETTINGS);
tsec_local_mdio_write(priv->phyregs_sgmii, in_be32(&priv->regs->tbipa),
-   0, TBI_TBICON, TBICON_CLK_SELECT);
+ 0, TBI_TBICON, TBICON_CLK_SELECT);
tsec_local_mdio_write(priv->phyregs_sgmii, in_be32(&priv->regs->tbipa),
-   0, TBI_CR, CONFIG_TSEC_TBICR_SETTINGS);
+ 0, TBI_CR, CONFIG_TSEC_TBICR_SETTINGS);
 }

 #ifdef CONFIG_MCAST_TFTP
@@ -116,7 +116,7 @@ static int tsec_mcast_addr(struct udevice *dev, const u8 
*mcast_mac, int set)
whichbit = (result >> 24) & 0x1f; /* the 5 LSB = which bit to set */
whichreg = result >> 29; /* the 3 MSB = which reg to set it in */

-   value = 1 << (31-whichbit);
+   value = BIT(31 - whichbit);

if (set)
setbits_be32(®s->hash.gaddr0 + whichreg, value);
@@ -171,7 +171,6 @@ static void init_registers(struct tsec __iomem *regs)

out_be32(®s->attr, ATTR_INIT_SETTINGS);
out_be32(®s->attreli, ATTRELI_INIT_SETTINGS);
-
 }

 /*
@@ -222,8 +221,8 @@ static void adjust_link(struct tsec_private *priv, struct 
phy_device *phydev)
out_be32(®s->maccfg2, maccfg2);

printf("Speed: %d, %s duplex%s\n", phydev->speed,
-   (phydev->duplex) ? "full" : "half",
-   (phydev->port == PORT_FIBRE) ? ", fiber mode" : "");
+  (phydev->duplex) ? "full" : "half",
+  (phydev->port == PORT_FIBRE) ? ", fiber mode" : "");
 }

 /*
@@ -240,7 +239,7 @@ static int tsec_send(struct udevice *dev, void *packet, int 
length)
 {
struct tsec_private *priv = (struct tsec_private *)dev->priv;
struct tsec __iomem *regs = priv->regs;
-   uint16_t status;
+   u16 status;
int result = 0;
int i;

@@ -287,7 +286,7 @@ static int tsec_recv(struct eth_device *dev)

while (!(in_be16(&priv->rxbd[priv->rx_idx].status) & RXBD_EMPTY)) {
int length = in_be16(&priv->rxbd[priv->rx_idx].length);
-   uint16_t status = in_be16(&priv->rxbd[priv->rx_idx].status);
+   u16 status = in_be16(&priv->rxbd[priv->rx_idx].status);
uchar *packet = net_rx_packets[priv->rx_idx];

/* Send the packet up if there were no errors */
@@ -323,8 +322,8 @@ static int tsec_recv(struct udevice *dev, int flags, uchar 
**packetp)

if (!(in_be16(&priv->rxbd[priv->rx_idx].status) & RXBD_EMPTY)) {
int length = in_be16(&priv->rxbd[priv->rx_idx].length);
-   uint16_t status = in_be16(&priv->rxbd[priv->rx_idx].status);
-   uint32_t buf;
+   u16 status = in_be16(&priv->rxbd[priv->rx_idx].status);
+   u32 buf;

/* Send the packet up if there were no errors */
if (!(status & RXBD_STATS)) {
@@ -347,7 +346,7 @@ static int tsec_recv(struct udevice *dev, int flags, uchar 
**packetp)
 static int tsec_free_pkt(struct udevice *dev, uchar *packet, int length)
 {
struct tsec_private *priv = (struct tsec_private *)dev->priv;
-   uint16_t status;
+   u16 status;

out_be16(&priv->rxbd[priv->rx_idx].length, 0);

@@ -427,7 +426,8 @@ void redundant_init(struct tsec_private *priv)
clrbits_be32(®s->dmactrl, DMACTRL_GRS | DMACTRL_GTS);

do {
-   uint16_t status;
+   u16 status;
+
tsec_send(priv->dev, (void *)pkt, sizeof(pkt));

/* Wait for buffer to be received */
@@ -478,7 +478,7 @@ void redundant_init(struct tsec_private *priv)
 static void startup_tsec(struct tsec_private *priv)
 {
struct tsec __iomem *regs = priv->regs;
-   uint16_t status;
+   u16 status;
int i;

/* reset the indices to zero */
@@ -532,7 +532,7 @@ static void startup_tsec(struct tsec_private *priv)
  * This allows U-Boot to find the first active controller.
  */
 #ifndef CONFIG_DM_ETH
-static int tsec_init(struct eth_device *dev, bd_t * bd)
+static int tsec_init(struct eth_device *dev, bd_t *bd)
 #else
 static int tsec_init(struct udevice *dev)
 #endif
@@ -616,22 +616,23 @@ static phy_interface_t tsec_get_interface(struct 
tsec_private *priv)
}

if (ecntrl & ECNTRL_REDUCED_MODE) {
+   phy_interface_t interface;

[U-Boot] [RESEND PATCH v2 1/8] spi: Fix style violation and improve code

2018-01-15 Thread Mario Six
This patch fixes a printf specifier style violation, reduces the scope
of a variable, and turns a void pointer that is used with pointer
arithmetic into a u8 pointer.

Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/spi/spi.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 7d81fbd7f8..dea8dcda5b 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -12,7 +12,7 @@
 int spi_set_wordlen(struct spi_slave *slave, unsigned int wordlen)
 {
if (wordlen == 0 || wordlen > 32) {
-   printf("spi: invalid wordlen %d\n", wordlen);
+   printf("spi: invalid wordlen %u\n", wordlen);
return -1;
}

@@ -24,11 +24,12 @@ int spi_set_wordlen(struct spi_slave *slave, unsigned int 
wordlen)
 void *spi_do_alloc_slave(int offset, int size, unsigned int bus,
 unsigned int cs)
 {
-   struct spi_slave *slave;
-   void *ptr;
+   u8 *ptr;

ptr = malloc(size);
if (ptr) {
+   struct spi_slave *slave;
+
memset(ptr, '\0', size);
slave = (struct spi_slave *)(ptr + offset);
slave->bus = bus;
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 4/4] common: board_r: Fix style violations

2018-01-15 Thread Mario Six
Fix some style violations in the board_r file.

Reviewed-by: Simon Glass 
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 common/board_r.c | 27 ++-
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/common/board_r.c b/common/board_r.c
index 09167c13cc..e304bb208e 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -157,9 +157,9 @@ static int initr_reloc_global_data(void)
 #endif
 #ifdef CONFIG_OF_EMBED
/*
-   * The fdt_blob needs to be moved to new relocation address
-   * incase of FDT blob is embedded with in image
-   */
+* The fdt_blob needs to be moved to new relocation address
+* incase of FDT blob is embedded with in image
+*/
gd->fdt_blob += gd->reloc_off;
 #endif
 #ifdef CONFIG_EFI_LOADER
@@ -351,14 +351,16 @@ static int initr_flash(void)
print_size(flash_size, "");
 #ifdef CONFIG_SYS_FLASH_CHECKSUM
/*
-   * Compute and print flash CRC if flashchecksum is set to 'y'
-   *
-   * NOTE: Maybe we should add some WATCHDOG_RESET()? XXX
-   */
+* Compute and print flash CRC if flashchecksum is set to 'y'
+*
+* NOTE: Maybe we should add some WATCHDOG_RESET()? XXX
+*/
if (env_get_yesno("flashchecksum") == 1) {
+   const uchar *flash_base = (const uchar *)CONFIG_SYS_FLASH_BASE;
+
printf("  CRC: %08X", crc32(0,
-   (const unsigned char *) CONFIG_SYS_FLASH_BASE,
-   flash_size));
+   flash_base,
+   flash_size));
}
 #endif /* CONFIG_SYS_FLASH_CHECKSUM */
putc('\n');
@@ -375,7 +377,6 @@ static int initr_flash(void)
update_flash_size(flash_size);
 #endif

-
 #if defined(CONFIG_OXC) || defined(CONFIG_RMU)
/* flash mapped at end of memory map */
bd->bi_flashoffset = CONFIG_SYS_TEXT_BASE + flash_size;
@@ -627,7 +628,7 @@ int initr_mem(void)
 # ifdef CONFIG_PRAM
pram = env_get_ulong("pram", 10, CONFIG_PRAM);
 # endif
-   sprintf(memsz, "%ldk", (long int) ((gd->ram_size / 1024) - pram));
+   sprintf(memsz, "%ldk", (long int)((gd->ram_size / 1024) - pram));
env_set("mem", memsz);

return 0;
@@ -680,7 +681,7 @@ static init_fnc_t init_sequence_r[] = {
initr_caches,
/* Note: For Freescale LS2 SoCs, new MMU table is created in DDR.
 *   A temporary mapping of IFC high region is since removed,
-*   so environmental variables in NOR flash is not availble
+*   so environmental variables in NOR flash is not available
 *   until board_init() is called below to remap IFC to high
 *   region.
 */
@@ -743,7 +744,7 @@ static init_fnc_t init_sequence_r[] = {
 #if defined(CONFIG_PCI) && defined(CONFIG_SYS_EARLY_PCI_INIT)
/*
 * Do early PCI configuration _before_ the flash gets initialised,
-* because PCU ressources are crucial for flash access on some boards.
+* because PCU resources are crucial for flash access on some boards.
 */
initr_pci,
 #endif
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 3/4] common: board_f: Fix style violations

2018-01-15 Thread Mario Six
Fix some style violations in the board_f file.

Reviewed-by: Simon Glass 
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 common/board_f.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/common/board_f.c b/common/board_f.c
index e46eceda7d..df589fd570 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -49,7 +49,7 @@
 #ifdef XTRN_DECLARE_GLOBAL_DATA_PTR
 #undef XTRN_DECLARE_GLOBAL_DATA_PTR
 #define XTRN_DECLARE_GLOBAL_DATA_PTR   /* empty = allocate here */
-DECLARE_GLOBAL_DATA_PTR = (gd_t *) (CONFIG_SYS_INIT_GD_ADDR);
+DECLARE_GLOBAL_DATA_PTR = (gd_t *)(CONFIG_SYS_INIT_GD_ADDR);
 #else
 DECLARE_GLOBAL_DATA_PTR;
 #endif
@@ -136,7 +136,7 @@ static int display_text_info(void)
 #endif

debug("U-Boot code: %08lX -> %08lX  BSS: -> %08lX\n",
-   text_base, bss_start, bss_end);
+ text_base, bss_start, bss_end);
 #endif

return 0;
@@ -413,7 +413,7 @@ static int reserve_malloc(void)
 {
gd->start_addr_sp = gd->start_addr_sp - TOTAL_MALLOC_LEN;
debug("Reserving %dk for malloc() at: %08lx\n",
-   TOTAL_MALLOC_LEN >> 10, gd->start_addr_sp);
+ TOTAL_MALLOC_LEN >> 10, gd->start_addr_sp);
return 0;
 }

@@ -443,7 +443,7 @@ static int reserve_global_data(void)
gd->start_addr_sp -= sizeof(gd_t);
gd->new_gd = (gd_t *)map_sysmem(gd->start_addr_sp, sizeof(gd_t));
debug("Reserving %zu Bytes for Global Data at: %08lx\n",
-   sizeof(gd_t), gd->start_addr_sp);
+ sizeof(gd_t), gd->start_addr_sp);
return 0;
 }

--
2.11.0

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


[U-Boot] [RESEND PATCH v2 6/8] spi: sf_probe: Fix style violations

2018-01-15 Thread Mario Six
Fix two indention-related style violations.

Signed-off-by: Mario Six 
---

v1 -> v2:
None

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

diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c
index e25513b77a..68009a6328 100644
--- a/drivers/mtd/spi/sf_probe.c
+++ b/drivers/mtd/spi/sf_probe.c
@@ -77,7 +77,7 @@ static struct spi_flash *spi_flash_probe_tail(struct 
spi_slave *bus)
 }

 struct spi_flash *spi_flash_probe(unsigned int busnum, unsigned int cs,
-   unsigned int max_hz, unsigned int spi_mode)
+ unsigned int max_hz, unsigned int spi_mode)
 {
struct spi_slave *bus;

@@ -107,7 +107,7 @@ static int spi_flash_std_read(struct udevice *dev, u32 
offset, size_t len,
 }

 static int spi_flash_std_write(struct udevice *dev, u32 offset, size_t len,
-   const void *buf)
+  const void *buf)
 {
struct spi_flash *flash = dev_get_uclass_priv(dev);

--
2.11.0

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


[U-Boot] [RESEND PATCH v2 3/8] spi: Remove spi_flash_probe_fdt

2018-01-15 Thread Mario Six
Commit ba45756 ("dm: x86: spi: Convert ICH SPI driver to driver model")
removed the last usage of the spi_flash_probe_fdt function, rendering it
obsolete.

This patch removes the function.

Reviewed-by: Simon Glass 
Reviewed-by: Jagan Teki 
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/mtd/spi/sf_probe.c | 13 -
 include/spi_flash.h| 12 
 2 files changed, 25 deletions(-)

diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c
index 7b296378d2..e25513b77a 100644
--- a/drivers/mtd/spi/sf_probe.c
+++ b/drivers/mtd/spi/sf_probe.c
@@ -87,19 +87,6 @@ struct spi_flash *spi_flash_probe(unsigned int busnum, 
unsigned int cs,
return spi_flash_probe_tail(bus);
 }

-#ifdef CONFIG_OF_SPI_FLASH
-struct spi_flash *spi_flash_probe_fdt(const void *blob, int slave_node,
- int spi_node)
-{
-   struct spi_slave *bus;
-
-   bus = spi_setup_slave_fdt(blob, slave_node, spi_node);
-   if (!bus)
-   return NULL;
-   return spi_flash_probe_tail(bus);
-}
-#endif
-
 void spi_flash_free(struct spi_flash *flash)
 {
 #ifdef CONFIG_SPI_FLASH_MTD
diff --git a/include/spi_flash.h b/include/spi_flash.h
index be2fe3f84c..f3c4e83424 100644
--- a/include/spi_flash.h
+++ b/include/spi_flash.h
@@ -194,18 +194,6 @@ void sandbox_sf_unbind_emul(struct sandbox_state *state, 
int busnum, int cs);
 struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,
unsigned int max_hz, unsigned int spi_mode);

-/**
- * Set up a new SPI flash from an fdt node
- *
- * @param blob Device tree blob
- * @param slave_node   Pointer to this SPI slave node in the device tree
- * @param spi_node Cached pointer to the SPI interface this node belongs
- * to
- * @return 0 if ok, -1 on error
- */
-struct spi_flash *spi_flash_probe_fdt(const void *blob, int slave_node,
- int spi_node);
-
 void spi_flash_free(struct spi_flash *flash);

 static inline int spi_flash_read(struct spi_flash *flash, u32 offset,
--
2.11.0

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


[U-Boot] [RESEND PATCH v2 2/8] spi: Remove obsolete spi_base_setup_slave_fdt

2018-01-15 Thread Mario Six
0efc024 ("spi_flash: Add spi_flash_probe_fdt() to locate SPI by FDT
node") added a helper function spi_base_setup_slave_fdt to to set up a
SPI slave from a given FDT blob. The only user was the exynos SPI
driver.

But commit 73186c9 ("dm: exynos: Convert SPI to driver model") removed
the use of this function, hence rendering it obsolete.

Remove this function, as well as the CONFIG_OF_SPI option, which guarded
only this function.

Reviewed-by: Simon Glass 
Reviewed-by: Jagan Teki 
Signed-off-by: Mario Six 
---

v1 -> v2:
None

---
 drivers/spi/spi.c| 20 
 include/spi.h| 14 --
 scripts/config_whitelist.txt |  1 -
 3 files changed, 35 deletions(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index dea8dcda5b..45e73d28e4 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -39,23 +39,3 @@ void *spi_do_alloc_slave(int offset, int size, unsigned int 
bus,

return ptr;
 }
-
-#ifdef CONFIG_OF_SPI
-struct spi_slave *spi_base_setup_slave_fdt(const void *blob, int busnum,
-  int node)
-{
-   int cs, max_hz, mode = 0;
-
-   cs = fdtdec_get_int(blob, node, "reg", -1);
-   max_hz = fdtdec_get_int(blob, node, "spi-max-frequency", 10);
-   if (fdtdec_get_bool(blob, node, "spi-cpol"))
-   mode |= SPI_CPOL;
-   if (fdtdec_get_bool(blob, node, "spi-cpha"))
-   mode |= SPI_CPHA;
-   if (fdtdec_get_bool(blob, node, "spi-cs-high"))
-   mode |= SPI_CS_HIGH;
-   if (fdtdec_get_bool(blob, node, "spi-half-duplex"))
-   mode |= SPI_PREAMBLE;
-   return spi_setup_slave(busnum, cs, max_hz, mode);
-}
-#endif
diff --git a/include/spi.h b/include/spi.h
index 08c7480fda..c6442589a0 100644
--- a/include/spi.h
+++ b/include/spi.h
@@ -327,20 +327,6 @@ static inline int spi_w8r8(struct spi_slave *slave, 
unsigned char byte)
  */
 struct spi_slave *spi_setup_slave_fdt(const void *blob, int slave_node,
  int spi_node);
-
-/**
- * spi_base_setup_slave_fdt() - helper function to set up a SPI slace
- *
- * This decodes SPI properties from the slave node to determine the
- * chip select and SPI parameters.
- *
- * @blob:  Device tree blob
- * @busnum:Bus number to use
- * @node:  Device tree node for the SPI bus
- */
-struct spi_slave *spi_base_setup_slave_fdt(const void *blob, int busnum,
-  int node);
-
 #ifdef CONFIG_DM_SPI

 /**
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index 4e87d66bea..13d13b6fda 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -1534,7 +1534,6 @@ CONFIG_NUM_PAMU
 CONFIG_ODROID_REV_AIN
 CONFIG_OFF_PADCONF
 CONFIG_OF_
-CONFIG_OF_SPI
 CONFIG_OF_SPI_FLASH
 CONFIG_OF_STDOUT_PATH
 CONFIG_OMAP_EHCI_PHY1_RESET_GPIO
--
2.11.0

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


Re: [U-Boot] [RESEND PATCH v2 2/4] clk: clk_fixed_rate: Fix style violation

2018-01-15 Thread Mario Six
On Mon, Jan 15, 2018 at 11:19 AM, Dr. Philipp Tomsich
 wrote:
> Tom,
>
>> On 15 Jan 2018, at 11:06, Mario Six  wrote:
>>
>> Fix a mis-indented function call in clk_fixed_rate.c
>
> A general question: do we want to have such gardening commits
> create an additional indirection in our history for people using
> git-blame frequently (e.g. I usually use git-blame to find the last
> commit that touched a line and then read the log message to find
> out why something was changed… now I’d have to restart this
> search whenever I hit a pure formatting change)?
>
> My gut feeling would be that we should try to change lines only
> when there is an actual change to the code happening.
>

From https://www.denx.de/wiki/U-Boot/Patches:

"Non-functional changes, i.e. whitespace and reformatting changes, should be
done in separate patches marked as cosmetic. This separation of functional and
cosmetic changes greatly facilitates the review process."

(granted, I didn't explicitly mark the patches as cosmetic)

I read that as a general permission to post style-fix patches. If there's a
different consensus, I'd like the page modified accordingly.

> Regards,
> Philipp.
>
Best regards,
Mario

>>
>> Reviewed-by: Simon Glass 
>> Signed-off-by: Mario Six 
>> ---
>>
>> v1 -> v2:
>> None
>>
>> ---
>> drivers/clk/clk_fixed_rate.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/clk/clk_fixed_rate.c b/drivers/clk/clk_fixed_rate.c
>> index 63565b6ed8..9dd6bc5726 100644
>> --- a/drivers/clk/clk_fixed_rate.c
>> +++ b/drivers/clk/clk_fixed_rate.c
>> @@ -31,8 +31,8 @@ const struct clk_ops clk_fixed_rate_ops = {
>> static int clk_fixed_rate_ofdata_to_platdata(struct udevice *dev)
>> {
>> #if !CONFIG_IS_ENABLED(OF_PLATDATA)
>> - to_clk_fixed_rate(dev)->fixed_rate = dev_read_u32_default(dev,
>> - "clock-frequency", 0);
>> + to_clk_fixed_rate(dev)->fixed_rate =
>> + dev_read_u32_default(dev, "clock-frequency", 0);
>> #endif
>>
>>   return 0;
>> --
>> 2.11.0
>>
>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 0/9] Add new OPTEE bootm support to u-boot

2018-01-15 Thread Dr. Philipp Tomsich

> On 15 Jan 2018, at 11:24, Dr. Philipp Tomsich 
>  wrote:
> 
>> 
>> On 15 Jan 2018, at 05:39, Kever Yang  wrote:
>> 
>> Hi Bryan,
>> 
>> On 01/12/2018 10:52 PM, Bryan O'Donoghue wrote:
>>> This series adds a new OPTEE bootable image type to u-boot, which is
>>> directly bootable with the bootm command.
>>> 
>>> There is already a TEE image type but, in this case the TEE firmware is
>>> loaded into RAM, jumped into and then back out of.
>> 
>> This is how OP-TEE upstream designed flow, isn't it?
>>> This image type is a
>>> directly bootable image as described here :
>>> http://mrvan.github.io/optee-imx6ul
>> 
>> Still not clear about the detail flow you are using :( I don't understand why
>> we need to support OP-TEE in bootm.
>> Do you make U-Boot working in secure word?
> 
> I would also prefer if we could leave the secure world prior to executing the
> full U-Boot… it reduces the attack surface and will be similar to what we do
> on ARMv8 with ATF.

I forgot to mention that Falcon-mode w/ OPTEE will only be possible if the
OPTEE is loaded from SPL.

As I would like to avoid having two different ways to load an OPTEE within
U-Boot, this seems to also bias the “default boot sequence” towards inserting
OPTEE between SPL and the OS-stage (whether this is IH_OS_U_BOOT,
IH_OS_LINUX or something else).

Regards,
Philipp.

> 
>>> 
>>> Instead of reusing the Linux bootable image type instead a new image type
>>> is defined, which allows us to perform additional image verification, prior
>>> to handing off control via bootm.
>>> 
>>> OPTEE images get linked to a specific address at compile time and must be
>>> loaded to this address too. This series extends out mkimage with a new
>>> image type that allows the OPTEE binary link location to be validated
>>> against CONFIG_OPTEE_TZDRAM_BASE and CONFIG_OPTEE_TZDRAM_SIZE respectively
>>> prior to proceeding through the bootm phase.
>>> 
>>> Once applied you can generate a bootable OPTEE image like this
>>> 
>>> mkimage -A arm -T optee -C none -d ./out/arm-plat-imx/core/tee.bin 
>>> uTee.optee
>>> 
>>> That image can then be booted directly by bootm. bootm will verify the
>>> header contents of the OPTEE binary against the DRAM area carved out in
>>> u-boot. If the defined DRAM area does not match the link address specified
>>> we refuse to boot.
>>> 
>>> Kever - I'd like to suggest that your OPTEE SPL image takes a different
>>> image type IH_TYPE_OPTEE_SPL ? to indicate the different behavior your
>>> image type has versus a directly bootable bootm image.
>> 
>> Well, I think we can decide after everything is clear.
>> 
>> Thanks,
>> -Kever
>>> 
>>> Bryan O'Donoghue (9):
>>>  optee: Add lib entries for sharing OPTEE code across ports
>>>  optee: Add CONFIG_OPTEE_TZDRAM_SIZE
>>>  optee: Make OPTEE_TZDRAM_BASE a mandatory define
>>>  optee: Add optee_image_get_entry_point()
>>>  optee: Add optee_image_get_load_addr()
>>>  tools: mkimage: add optee image type
>>>  optee: Add optee_verify_bootm_image()
>>>  optee: Improve error printout
>>>  bootm: optee: Add mechanism to validate an OPTEE image before boot
>>> 
>>> common/bootm.c| 11 +++-
>>> common/image.c|  1 +
>>> include/image.h   |  1 +
>>> include/tee/optee.h   | 41 ++
>>> lib/Kconfig   |  1 +
>>> lib/Makefile  |  1 +
>>> lib/optee/Kconfig | 16 
>>> lib/optee/Makefile|  7 ++
>>> lib/optee/optee.c | 69 
>>> +++
>>> tools/default_image.c | 25 ++-
>>> 10 files changed, 166 insertions(+), 7 deletions(-)
>>> create mode 100644 lib/optee/Kconfig
>>> create mode 100644 lib/optee/Makefile
>>> create mode 100644 lib/optee/optee.c

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


Re: [U-Boot] [PATCH 0/9] Add new OPTEE bootm support to u-boot

2018-01-15 Thread Dr. Philipp Tomsich

> On 15 Jan 2018, at 05:39, Kever Yang  wrote:
> 
> Hi Bryan,
> 
> On 01/12/2018 10:52 PM, Bryan O'Donoghue wrote:
>> This series adds a new OPTEE bootable image type to u-boot, which is
>> directly bootable with the bootm command.
>> 
>> There is already a TEE image type but, in this case the TEE firmware is
>> loaded into RAM, jumped into and then back out of.
> 
> This is how OP-TEE upstream designed flow, isn't it?
>> This image type is a
>> directly bootable image as described here :
>> http://mrvan.github.io/optee-imx6ul
> 
> Still not clear about the detail flow you are using :( I don't understand why
> we need to support OP-TEE in bootm.
> Do you make U-Boot working in secure word?

I would also prefer if we could leave the secure world prior to executing the
full U-Boot… it reduces the attack surface and will be similar to what we do
on ARMv8 with ATF.

>> 
>> Instead of reusing the Linux bootable image type instead a new image type
>> is defined, which allows us to perform additional image verification, prior
>> to handing off control via bootm.
>> 
>> OPTEE images get linked to a specific address at compile time and must be
>> loaded to this address too. This series extends out mkimage with a new
>> image type that allows the OPTEE binary link location to be validated
>> against CONFIG_OPTEE_TZDRAM_BASE and CONFIG_OPTEE_TZDRAM_SIZE respectively
>> prior to proceeding through the bootm phase.
>> 
>> Once applied you can generate a bootable OPTEE image like this
>> 
>> mkimage -A arm -T optee -C none -d ./out/arm-plat-imx/core/tee.bin uTee.optee
>> 
>> That image can then be booted directly by bootm. bootm will verify the
>> header contents of the OPTEE binary against the DRAM area carved out in
>> u-boot. If the defined DRAM area does not match the link address specified
>> we refuse to boot.
>> 
>> Kever - I'd like to suggest that your OPTEE SPL image takes a different
>> image type IH_TYPE_OPTEE_SPL ? to indicate the different behavior your
>> image type has versus a directly bootable bootm image.
> 
> Well, I think we can decide after everything is clear.
> 
> Thanks,
> -Kever
>> 
>> Bryan O'Donoghue (9):
>>   optee: Add lib entries for sharing OPTEE code across ports
>>   optee: Add CONFIG_OPTEE_TZDRAM_SIZE
>>   optee: Make OPTEE_TZDRAM_BASE a mandatory define
>>   optee: Add optee_image_get_entry_point()
>>   optee: Add optee_image_get_load_addr()
>>   tools: mkimage: add optee image type
>>   optee: Add optee_verify_bootm_image()
>>   optee: Improve error printout
>>   bootm: optee: Add mechanism to validate an OPTEE image before boot
>> 
>>  common/bootm.c| 11 +++-
>>  common/image.c|  1 +
>>  include/image.h   |  1 +
>>  include/tee/optee.h   | 41 ++
>>  lib/Kconfig   |  1 +
>>  lib/Makefile  |  1 +
>>  lib/optee/Kconfig | 16 
>>  lib/optee/Makefile|  7 ++
>>  lib/optee/optee.c | 69 
>> +++
>>  tools/default_image.c | 25 ++-
>>  10 files changed, 166 insertions(+), 7 deletions(-)
>>  create mode 100644 lib/optee/Kconfig
>>  create mode 100644 lib/optee/Makefile
>>  create mode 100644 lib/optee/optee.c
>> 
> 
> 

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


Re: [U-Boot] [PATCH] mmc: fsl_esdhc: Fix i.MX53 eSDHCv3 clock

2018-01-15 Thread Stefano Babic
Hi Benoît,

On 15/01/2018 00:46, Benoît Thébaudeau wrote:
> Commit 4f425280fa71 ("mmc: fsl_esdhc: Allow all supported prescaler
> values") made it possible to set SYSCTL.SDCLKFS to 0 in SDR mode on
> i.MX, thus bypassing the SD clock frequency prescaler, in order to be
> able to get higher SD clock frequencies in some contexts. However, that
> commit missed the fact that this value is illegal on the eSDHCv3
> instance of the i.MX53. This seems to be the only exception on i.MX,
> this value being legal even for the eSDHCv2 instances of the i.MX53.
> 
> Fix this issue by changing the minimum prescaler value for the single
> instance of the i.MX53 eSDHCv3 controller.
> 
> Signed-off-by: Benoît Thébaudeau 
> ---
>  drivers/mmc/fsl_esdhc.c | 7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
> index 499d622c6d..90425e8a30 100644
> --- a/drivers/mmc/fsl_esdhc.c
> +++ b/drivers/mmc/fsl_esdhc.c
> @@ -528,14 +528,19 @@ out:
>  
>  static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint 
> clock)
>  {
> + struct fsl_esdhc *regs = priv->esdhc_regs;
>   int div = 1;
>  #ifdef ARCH_MXC
> +#ifdef CONFIG_MX53
> + /* For i.MX53 eSDHCv3, SYSCTL.SDCLKFS may not be set to 0. */
> + int pre_div = regs == (struct fsl_esdhc *)MMC_SDHC3_BASE_ADDR ? 2 : 1;

It is surely a question of taste - but is it not cleared to surround the
expression with parenthesis ? (regs ==  )


> +#else
>   int pre_div = 1;
> +#endif
>  #else
>   int pre_div = 2;
>  #endif
>   int ddr_pre_div = mmc->ddr_mode ? 2 : 1;
> - struct fsl_esdhc *regs = priv->esdhc_regs;
>   int sdhc_clk = priv->sdhc_clk;
>   uint clk;
>  
> 

Best regards,
Stefano

-- 
=
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] ubi: Fix filesystem corruption on detach when fastmap enabled

2018-01-15 Thread Heiko Schocher

Hello Martin,

Am 12.01.2018 um 20:03 schrieb Martin Townsend:

From d35b7ea298fbd6c9d08b1b7132d43b9289d2b914 Mon Sep 17 00:00:00 2001

From: Martin Townsend 
Date: Fri, 12 Jan 2018 18:59:23 +
Subject: [PATCH] ubi: Fix filesystem corruption on detach when fastmap enabled
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

When detaching using "ubi detach" it calls ubi_detach_mtd_dev which
calls ubi_update_fastmap twice when fastmap is enabled.  The second
invocation was corrupting the ubifs as it was called after uif_close.
Moved all calls to ubi_wl_close before uif_close.

Signed-off-by: Martin Townsend 
---
  drivers/mtd/ubi/build.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index baf4e2d..795ea34 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -1082,9 +1082,9 @@ out_debugfs:
  out_uif:
   get_device(&ubi->dev);
   ubi_assert(ref);
+ ubi_wl_close(ubi);
   uif_close(ubi);
  out_detach:
- ubi_wl_close(ubi);
   ubi_free_internal_volumes(ubi);
   vfree(ubi->vtbl);
  out_free:
@@ -1161,9 +1161,9 @@ int ubi_detach_mtd_dev(int ubi_num, int anyway)
   get_device(&ubi->dev);

   ubi_debugfs_exit_dev(ubi);
+ ubi_wl_close(ubi);
   uif_close(ubi);

- ubi_wl_close(ubi);
   ubi_free_internal_volumes(ubi);
   vfree(ubi->vtbl);
   put_mtd_device(ubi->mtd);



Could you please try the following patch:

diff --git a/drivers/mtd/ubi/fastmap-wl.c b/drivers/mtd/ubi/fastmap-wl.c
index a33d4063e0..2923d21836 100644
--- a/drivers/mtd/ubi/fastmap-wl.c
+++ b/drivers/mtd/ubi/fastmap-wl.c
@@ -339,8 +339,6 @@ static void ubi_fastmap_close(struct ubi_device *ubi)

 #ifndef __UBOOT__
flush_work(&ubi->fm_work);
-#else
-   update_fastmap_work_fn(ubi);
 #endif
return_unused_pool_pebs(ubi, &ubi->fm_pool);
return_unused_pool_pebs(ubi, &ubi->fm_wl_pool);

Your problem is (I think) because U-Boot Code accidentially calls
update_fastmap_work_fn(ubi), but we do not need it here anymore, as
U-Boot does all UBI work immediately.

bye,
Heiko
--
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: h...@denx.de
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] UEFI on u-boot

2018-01-15 Thread Alexander Graf


On 15.01.18 10:32, Udit Kumar wrote:
> Hi Alex
> 
>> -Original Message-
>> From: Alexander Graf [mailto:ag...@suse.de]
>> Sent: Monday, January 15, 2018 2:45 PM
>> To: Udit Kumar 
>>
>> Hi Udit,
>>
>> On 15.01.18 10:09, Udit Kumar wrote:
>>> Hi Alex,
>>> Hope you are doing great,
>>>
>>> Could you help on UEFI over the u-boot.
>>> 1- I couldn't locate EFI_DXE_SERVICES in u-boot, do you have plan to
>>> add those
>>
>> Right now the model is that all device drivers are implemented by U-Boot
>> and that only exposes their interfaces to EFI applications. Implementing DXE
>> in U-Boot would open quite a big can of worms, as it would really only be
>> useful in compilation with PI which is a terrible interface :).
> 
> Ok, 
>  
>>> 2- If I load  a driver (with bootefi) which install few protocols,  is
>>> this ok to do with u-boot
>>
>> It depends on how much the driver does, but in general yes. Heinrich is
>> currently working on making the iPXE iSCSI driver work, so his EFI payload
>> would expose an EFI block device to yet another payload running after his.
> 
> Thanks for this, 
> Heinrich,  in  this driver, are you accessing underneath hardware register 
> by UEFI-Driver and managing UEFI protocols
> or you are relying on some h/w access exposed by u-boot driver
> 
> 
>  
>>> 3- if you say, 2 is ok then I hope these protocols are kept in some
>>> data base, and this new protocol can be opened by an application
>>
>> Yes, the protocol database is now global and persistent across bootefi
>> invocations.
> 
> Thanks 
>  
>>> 4- if there is some known limitation, like we cannot run DXE_driver
>>> etc
>>
>> What exactly are you trying to do? With the U-Boot UEFI implementation
>> we're trying to find a sweet spot between implementing as much as makes
>> sense, but not the whole UEFI world, as that would just bloat the code
>> needlessly.
> 
> I am trying to add a driver (DXE by definition) which 
> a) Access the hardware registers. (I said DXE could due to hardware registers)
> b) Update memory map as well (AddMemorySpace call)
> c) Finally it export a protocol, which could be used by its test application. 
> 
> For b) I am not able to find function call, 

What exactly beyond efi_allocate_pages() do you need? The EFI memory map
is really only used as data source for EFI applications. The actual 1:1
U-Boot map is not influenced by it.

> For a), if I say driver is UEFI and accessing hardware register, will this be 
> acceptable ?  

Yes, definitely. All you'd need to do is set the efi application type to
application, then register your protocols and access hardware registers
using direct MMIO access to their respective regions.


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


Re: [U-Boot] [PATCH v2 0/3] cadence-quadspi: Fix issues with non 32bit aligned accesses

2018-01-15 Thread Vignesh R
Marek,

On 09-Jan-18 6:49 PM, Vignesh R wrote:
> This series reverts use of bounce_buf.c for non-DMA related alignment
> restriction and replaces it with local bounce buffer to handle problems
> with non 32 bit aligned writes on TI platforms.
> Based on top of Jason's series:
> https://patchwork.ozlabs.org/cover/856431/
> 
> Tested on K2G EVM.
> 

Could you ack this series, if you are okay with the changes?

Jagan,
Could you pick this up(along with the above dependent patches) for
2018.03 once Marek's Ack is in place?

> Goldschmidt Simon (1):
>   Revert "spi: cadence_qspi_apb: Use 32 bit indirect read transaction
> when possible"
> 
> Vignesh R (2):
>   Revert "spi: cadence_qspi_apb: Use 32 bit indirect write transaction
> when possible"
>   spi: cadence_qspi_apb: Make flash writes 32 bit aligned
> 
>  drivers/spi/cadence_qspi_apb.c   | 49 
> ++--
>  include/configs/k2g_evm.h|  1 -
>  include/configs/socfpga_common.h |  1 -
>  include/configs/stv0991.h|  1 -
>  4 files changed, 22 insertions(+), 30 deletions(-)
> 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/2] ARM: dts: exynos5: remove the duplicated nodes

2018-01-15 Thread Anand Moon
Hi Jaehoon

On 12 January 2018 at 16:37, Jaehoon Chung  wrote:
> Remove the duplicated gic and combiner nodes in exynos5.dtsi.
>
> Signed-off-by: Jaehoon Chung 

Reviewed-by: Anand Moon 

> ---
>  arch/arm/dts/exynos5.dtsi | 27 ---
>  1 file changed, 27 deletions(-)
>
> diff --git a/arch/arm/dts/exynos5.dtsi b/arch/arm/dts/exynos5.dtsi
> index 8650800f52..8b725c0ddc 100644
> --- a/arch/arm/dts/exynos5.dtsi
> +++ b/arch/arm/dts/exynos5.dtsi
> @@ -45,33 +45,6 @@
> #size-cells = <0>;
> };
>
> -   combiner: interrupt-controller@1044 {
> -   compatible = "samsung,exynos4210-combiner";
> -   #interrupt-cells = <2>;
> -   interrupt-controller;
> -   samsung,combiner-nr = <32>;
> -   reg = <0x1044 0x1000>;
> -   interrupts =<0 0 0>, <0 1 0>, <0 2 0>, <0 3 0>,
> -   <0 4 0>, <0 5 0>, <0 6 0>, <0 7 0>,
> -   <0 8 0>, <0 9 0>, <0 10 0>, <0 11 0>,
> -   <0 12 0>, <0 13 0>, <0 14 0>, <0 15 0>,
> -   <0 16 0>, <0 17 0>, <0 18 0>, <0 19 0>,
> -   <0 20 0>, <0 21 0>, <0 22 0>, <0 23 0>,
> -   <0 24 0>, <0 25 0>, <0 26 0>, <0 27 0>,
> -   <0 28 0>, <0 29 0>, <0 30 0>, <0 31 0>;
> -   };
> -
> -   gic: interrupt-controller@10481000 {
> -   compatible = "arm,cortex-a15-gic", "arm,cortex-a9-gic";
> -   #interrupt-cells = <3>;
> -   interrupt-controller;
> -   reg =   <0x10481000 0x1000>,
> -   <0x10482000 0x1000>,
> -   <0x10484000 0x2000>,
> -   <0x10486000 0x2000>;
> -   interrupts = <1 9 0xf04>;
> -   };
> -
> i2c_0: i2c@12C6 {
> compatible = "samsung,s3c2440-i2c";
> reg = <0x12C6 0x100>;
> --
> 2.15.1
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 0/3] cadence-quadspi: Fix issues with non 32bit aligned accesses

2018-01-15 Thread Marek Vasut
On 01/15/2018 12:36 PM, Vignesh R wrote:
> Marek,
> 
> On 09-Jan-18 6:49 PM, Vignesh R wrote:
>> This series reverts use of bounce_buf.c for non-DMA related alignment
>> restriction and replaces it with local bounce buffer to handle problems
>> with non 32 bit aligned writes on TI platforms.
>> Based on top of Jason's series:
>> https://patchwork.ozlabs.org/cover/856431/
>>
>> Tested on K2G EVM.
>>
> 
> Could you ack this series, if you are okay with the changes?
> 
> Jagan,
> Could you pick this up(along with the above dependent patches) for
> 2018.03 once Marek's Ack is in place?
> 

Acked-by: Marek Vasut 

although you should get ack from Jason and Simon instead, those matter.

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


Re: [U-Boot] [PATCH 2/2] ARM: dts: exynos5: add the interrupt-parent property

2018-01-15 Thread Anand Moon
Hi Jaehoo,

On 12 January 2018 at 16:37, Jaehoon Chung  wrote:
> Add the interrupt-parent property as gic.
>
> Signed-off-by: Jaehoon Chung 
> ---
Please add my

Reviewed-by: Anand Moon 

>  arch/arm/dts/exynos5.dtsi | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/arch/arm/dts/exynos5.dtsi b/arch/arm/dts/exynos5.dtsi
> index 8b725c0ddc..19e0d0a45a 100644
> --- a/arch/arm/dts/exynos5.dtsi
> +++ b/arch/arm/dts/exynos5.dtsi
> @@ -11,6 +11,8 @@
>  / {
> compatible = "samsung,exynos5";
>
> +   interrupt-parent = <&gic>;
> +
> combiner: interrupt-controller@1044 {
> compatible = "samsung,exynos4210-combiner";
> #interrupt-cells = <2>;
> --
> 2.15.1
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 0/3] cadence-quadspi: Fix issues with non 32bit aligned accesses

2018-01-15 Thread Simon Goldschmidt


Pepperl+Fuchs GmbH, Mannheim
Geschaeftsfuehrer/Managing Directors: Dr.-Ing. Gunther Kegel (Vors./CEO), 
Werner Guthier, Mehmet Hatiboglu
Vorsitzender des Aufsichtsrats/Chairman of the supervisory board: Claus Michael
Registergericht/Register Court: AG Mannheim HRB 4713
On 15.01.2018 12:45, Marek Vasut wrote:

On 01/15/2018 12:36 PM, Vignesh R wrote:

Marek,

On 09-Jan-18 6:49 PM, Vignesh R wrote:

This series reverts use of bounce_buf.c for non-DMA related alignment
restriction and replaces it with local bounce buffer to handle problems
with non 32 bit aligned writes on TI platforms.
Based on top of Jason's series:
https://patchwork.ozlabs.org/cover/856431/

Tested on K2G EVM.


Could you ack this series, if you are okay with the changes?

Jagan,
Could you pick this up(along with the above dependent patches) for
2018.03 once Marek's Ack is in place?


Acked-by: Marek Vasut 

although you should get ack from Jason and Simon instead, those matter.



Acked-by: Simon Goldschmidt 

If that "Simon" above was me :-) I thought ack was sent by maintainers 
and TB by me, sorry.


Simon

Wichtiger Hinweis:
Diese E-Mail einschliesslich ihrer Anhaenge enthaelt vertrauliche und rechtlich geschuetzte Informationen, die nur fuer den Adressaten bestimmt sind. 
Sollten Sie nicht der bezeichnete Adressat sein, so teilen Sie dies bitte dem Absender umgehend mit und loeschen Sie diese Nachricht und ihre Anhaenge. Die unbefugte Weitergabe, das Anfertigen von Kopien und jede Veraenderung der E-Mail ist untersagt. Der Absender haftet nicht fuer Inhalte von veraenderten E-Mails.



Important Information:
This e-mail message including its attachments contains confidential and legally 
protected information solely intended for the addressee. If you are not the 
intended addressee of this message, please contact the addresser immediately 
and delete this message including its attachments. The unauthorized 
dissemination, copying and change of this e-mail are strictly forbidden. The 
addresser shall not be liable for the content of such changed e-mails.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v5 0/5] spi: cadence_spi: Adopt Linux DT bindings

2018-01-15 Thread Simon Goldschmidt

On 07.01.2018 12:41, Marek Vasut wrote:

On 01/06/2018 07:17 PM, Jason Rush wrote:

Adopt the Linux DT bindings. This also fixes an issue
with the indaddrtrig register on the Cadence QSPI
device being programmed with the wrong value for the
socfpga arch.

Tested on TI K2G platform:
Tested-by: Vignesh R 

Tested on a socfpga-cyclonev board:
Tested-by: Simon Goldschmidt 

Signed-off-by: Jason Rush 

Jason Rush (5):
   spi: cadence_spi: Sync DT bindings with Linux
   dts: cadence_spi: Sync DT bindings with Linux
   config: cadence_spi: Remove defines read from DT
   dts: k2g: Clean-up indentation
   dts: cadence_spi: Update documentation for DT bindings

  arch/arm/dts/keystone-k2g-evm.dts | 75 +--
  arch/arm/dts/keystone-k2g.dtsi|  5 +-
  arch/arm/dts/socfpga.dtsi |  5 +-
  arch/arm/dts/socfpga_arria10.dtsi |  4 +-
  arch/arm/dts/socfpga_arria5_socdk.dts |  9 ++--
  arch/arm/dts/socfpga_cyclone5_is1.dts |  9 ++--
  arch/arm/dts/socfpga_cyclone5_socdk.dts   |  9 ++--
  arch/arm/dts/socfpga_cyclone5_sockit.dts  |  9 ++--
  arch/arm/dts/socfpga_cyclone5_socrates.dts|  9 ++--
  arch/arm/dts/socfpga_cyclone5_sr1500.dts  |  9 ++--
  arch/arm/dts/socfpga_cyclone5_vining_fpga.dts | 18 +++
  arch/arm/dts/stv0991.dts  | 12 +++--
  doc/device-tree-bindings/spi/spi-cadence.txt  | 13 +++--
  drivers/spi/cadence_qspi.c| 20 ---
  drivers/spi/cadence_qspi.h|  6 ++-
  drivers/spi/cadence_qspi_apb.c| 15 ++
  include/configs/k2g_evm.h |  1 -
  include/configs/socfpga_common.h  |  1 -
  include/configs/stv0991.h |  1 -
  19 files changed, 113 insertions(+), 117 deletions(-)


Whole series

Acked-by: Marek Vasut 

So please apply after 2018.01 is out .
Thanks


Acked-by: Simon Goldschmidt 

Can this be applied now?

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


Re: [U-Boot] [PATCH 0/9] Add new OPTEE bootm support to u-boot

2018-01-15 Thread Peng Fan
On Mon, Jan 15, 2018 at 11:29:41AM +0100, Dr. Philipp Tomsich wrote:
>
>> On 15 Jan 2018, at 11:24, Dr. Philipp Tomsich 
>>  wrote:
>> 
>>> 
>>> On 15 Jan 2018, at 05:39, Kever Yang  wrote:
>>> 
>>> Hi Bryan,
>>> 
>>> On 01/12/2018 10:52 PM, Bryan O'Donoghue wrote:
 This series adds a new OPTEE bootable image type to u-boot, which is
 directly bootable with the bootm command.
 
 There is already a TEE image type but, in this case the TEE firmware is
 loaded into RAM, jumped into and then back out of.
>>> 
>>> This is how OP-TEE upstream designed flow, isn't it?
 This image type is a
 directly bootable image as described here :
 http://mrvan.github.io/optee-imx6ul
>>> 
>>> Still not clear about the detail flow you are using :( I don't understand 
>>> why
>>> we need to support OP-TEE in bootm.
>>> Do you make U-Boot working in secure word?
>> 
>> I would also prefer if we could leave the secure world prior to executing the
>> full U-Boot??? it reduces the attack surface and will be similar to what we 
>> do
>> on ARMv8 with ATF.
>
>I forgot to mention that Falcon-mode w/ OPTEE will only be possible if the
>OPTEE is loaded from SPL.

Falcon-mode is a good feature, but not everyone use Falcon-mode.

>
>As I would like to avoid having two different ways to load an OPTEE within
>U-Boot, this seems to also bias the ???default boot sequence??? towards 
>inserting
>OPTEE between SPL and the OS-stage (whether this is IH_OS_U_BOOT,
>IH_OS_LINUX or something else).


Providing the bootm way gives developer a choice for those that does not
support SPL.  We have been using bootm to boot optee for long time.

Thanks,
Peng

>
>Regards,
>Philipp.
>
>> 
 
 Instead of reusing the Linux bootable image type instead a new image type
 is defined, which allows us to perform additional image verification, prior
 to handing off control via bootm.
 
 OPTEE images get linked to a specific address at compile time and must be
 loaded to this address too. This series extends out mkimage with a new
 image type that allows the OPTEE binary link location to be validated
 against CONFIG_OPTEE_TZDRAM_BASE and CONFIG_OPTEE_TZDRAM_SIZE respectively
 prior to proceeding through the bootm phase.
 
 Once applied you can generate a bootable OPTEE image like this
 
 mkimage -A arm -T optee -C none -d ./out/arm-plat-imx/core/tee.bin 
 uTee.optee
 
 That image can then be booted directly by bootm. bootm will verify the
 header contents of the OPTEE binary against the DRAM area carved out in
 u-boot. If the defined DRAM area does not match the link address specified
 we refuse to boot.
 
 Kever - I'd like to suggest that your OPTEE SPL image takes a different
 image type IH_TYPE_OPTEE_SPL ? to indicate the different behavior your
 image type has versus a directly bootable bootm image.
>>> 
>>> Well, I think we can decide after everything is clear.
>>> 
>>> Thanks,
>>> -Kever
 
 Bryan O'Donoghue (9):
  optee: Add lib entries for sharing OPTEE code across ports
  optee: Add CONFIG_OPTEE_TZDRAM_SIZE
  optee: Make OPTEE_TZDRAM_BASE a mandatory define
  optee: Add optee_image_get_entry_point()
  optee: Add optee_image_get_load_addr()
  tools: mkimage: add optee image type
  optee: Add optee_verify_bootm_image()
  optee: Improve error printout
  bootm: optee: Add mechanism to validate an OPTEE image before boot
 
 common/bootm.c| 11 +++-
 common/image.c|  1 +
 include/image.h   |  1 +
 include/tee/optee.h   | 41 ++
 lib/Kconfig   |  1 +
 lib/Makefile  |  1 +
 lib/optee/Kconfig | 16 
 lib/optee/Makefile|  7 ++
 lib/optee/optee.c | 69 
 +++
 tools/default_image.c | 25 ++-
 10 files changed, 166 insertions(+), 7 deletions(-)
 create mode 100644 lib/optee/Kconfig
 create mode 100644 lib/optee/Makefile
 create mode 100644 lib/optee/optee.c
>
>___
>U-Boot mailing list
>U-Boot@lists.denx.de
>https://lists.denx.de/listinfo/u-boot

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


Re: [U-Boot] [PATCH] ubi: Fix filesystem corruption on detach when fastmap enabled

2018-01-15 Thread Martin Townsend
Hi Heiko,


On Mon, Jan 15, 2018 at 11:30 AM, Heiko Schocher  wrote:
> Hello Martin,
>
>
> Am 12.01.2018 um 20:03 schrieb Martin Townsend:
>>>
>>> From d35b7ea298fbd6c9d08b1b7132d43b9289d2b914 Mon Sep 17 00:00:00 2001
>>
>> From: Martin Townsend 
>> Date: Fri, 12 Jan 2018 18:59:23 +
>> Subject: [PATCH] ubi: Fix filesystem corruption on detach when fastmap
>> enabled
>> MIME-Version: 1.0
>> Content-Type: text/plain; charset=UTF-8
>> Content-Transfer-Encoding: 8bit
>>
>> When detaching using "ubi detach" it calls ubi_detach_mtd_dev which
>> calls ubi_update_fastmap twice when fastmap is enabled.  The second
>> invocation was corrupting the ubifs as it was called after uif_close.
>> Moved all calls to ubi_wl_close before uif_close.
>>
>> Signed-off-by: Martin Townsend 
>> ---
>>   drivers/mtd/ubi/build.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
>> index baf4e2d..795ea34 100644
>> --- a/drivers/mtd/ubi/build.c
>> +++ b/drivers/mtd/ubi/build.c
>> @@ -1082,9 +1082,9 @@ out_debugfs:
>>   out_uif:
>>get_device(&ubi->dev);
>>ubi_assert(ref);
>> + ubi_wl_close(ubi);
>>uif_close(ubi);
>>   out_detach:
>> - ubi_wl_close(ubi);
>>ubi_free_internal_volumes(ubi);
>>vfree(ubi->vtbl);
>>   out_free:
>> @@ -1161,9 +1161,9 @@ int ubi_detach_mtd_dev(int ubi_num, int anyway)
>>get_device(&ubi->dev);
>>
>>ubi_debugfs_exit_dev(ubi);
>> + ubi_wl_close(ubi);
>>uif_close(ubi);
>>
>> - ubi_wl_close(ubi);
>>ubi_free_internal_volumes(ubi);
>>vfree(ubi->vtbl);
>>put_mtd_device(ubi->mtd);
>>
>
> Could you please try the following patch:
>
> diff --git a/drivers/mtd/ubi/fastmap-wl.c b/drivers/mtd/ubi/fastmap-wl.c
> index a33d4063e0..2923d21836 100644
> --- a/drivers/mtd/ubi/fastmap-wl.c
> +++ b/drivers/mtd/ubi/fastmap-wl.c
> @@ -339,8 +339,6 @@ static void ubi_fastmap_close(struct ubi_device *ubi)
>
>  #ifndef __UBOOT__
> flush_work(&ubi->fm_work);
> -#else
> -   update_fastmap_work_fn(ubi);
>  #endif
> return_unused_pool_pebs(ubi, &ubi->fm_pool);
> return_unused_pool_pebs(ubi, &ubi->fm_wl_pool);
>
> Your problem is (I think) because U-Boot Code accidentially calls
> update_fastmap_work_fn(ubi), but we do not need it here anymore, as
> U-Boot does all UBI work immediately.
>
> bye,
> Heiko
> --
> DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: h...@denx.de

That was my original fix so can confirm this also works.
My reasoning for opting for the reordering was: I think the problem is
uif_close frees up some UBI data structures so we have to ensure no
updating of the filesystem occurs after this. What if
ubi_fastmap_close or ubi_wl_close change in future and these changes
result in updates to the filesystem, the same problem will occur and
for our board it corrupts the UBIFS. So I opted to change the order in
build.c.

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


Re: [U-Boot] [PATCH 1/2] arm64: zynqmp: Prepare psu_init rework

2018-01-15 Thread Michal Simek
Hi,

2018-01-10 16:38 GMT+01:00 Michal Simek :

> Move generic functions to common location spl.c. Function declarations
> are added to private header.
> These changes are done in connection to the fact that still files from
> HDF can be copied over and compilation should pass.
>
> Signed-off-by: Michal Simek 
> ---
>
> Depends on previous psu_init patches
>
> ---
>  arch/arm/cpu/armv8/zynqmp/spl.c | 55
> +
>  arch/arm/include/asm/arch-zynqmp/psu_init_gpl.h | 25 +++
>  arch/arm/include/asm/arch-zynqmp/sys_proto.h|  2 -
>  board/xilinx/zynqmp/zynqmp.c|  1 +
>  4 files changed, 81 insertions(+), 2 deletions(-)
>  create mode 100644 arch/arm/include/asm/arch-zynqmp/psu_init_gpl.h
>
> diff --git a/arch/arm/cpu/armv8/zynqmp/spl.c b/arch/arm/cpu/armv8/zynqmp/
> spl.c
> index 41ca74a2be2b..da983458a982 100644
> --- a/arch/arm/cpu/armv8/zynqmp/spl.c
> +++ b/arch/arm/cpu/armv8/zynqmp/spl.c
> @@ -14,6 +14,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>
>  void board_init_f(ulong dummy)
>  {
> @@ -156,3 +157,57 @@ int board_fit_config_name_match(const char *name)
> return 0;
>  }
>  #endif
> +
> +#define PSU_MASK_POLL_TIME 110
> +
> +int __maybe_unused mask_pollonvalue(unsigned long add, u32 mask, u32
> value)
> +{
> +   int i = 0;
> +
> +   while ((__raw_readl(add) & mask) != value) {
> +   if (i == PSU_MASK_POLL_TIME)
> +   return 0;
> +   i++;
> +   }
> +   return 1;
> +}
> +
> +__weak int mask_poll(u32 add, u32 mask)
> +{
> +   int i = 0;
> +   unsigned long addr = add;
> +
> +   while (!(__raw_readl(addr) & mask)) {
> +   if (i == PSU_MASK_POLL_TIME)
> +   return 0;
> +   i++;
> +   }
> +   return 1;
> +}
> +
> +__weak void mask_delay(u32 delay)
> +{
> +   udelay(delay);
> +}
> +
> +__weak void psu_mask_write(unsigned long offset, unsigned long mask,
> +  unsigned long val)
> +{
> +   unsigned long regval = 0;
> +
> +   regval = readl(offset);
> +   regval &= ~(mask);
> +   regval |= (val & mask);
> +   writel(regval, offset);
> +}
> +
> +__weak void prog_reg(unsigned long addr, unsigned long mask,
> +unsigned long shift, unsigned long value)
> +{
> +   int rdata = 0;
> +
> +   rdata = readl(addr);
> +   rdata = rdata & (~mask);
> +   rdata = rdata | (value << shift);
> +   writel(rdata, addr);
> +}
> diff --git a/arch/arm/include/asm/arch-zynqmp/psu_init_gpl.h
> b/arch/arm/include/asm/arch-zynqmp/psu_init_gpl.h
> new file mode 100644
> index ..29ea8ee1aa19
> --- /dev/null
> +++ b/arch/arm/include/asm/arch-zynqmp/psu_init_gpl.h
> @@ -0,0 +1,25 @@
> +/*
> + * SPDX-License-Identifier:GPL-2.0+
> + */
> +
> +#ifndef _PSU_INIT_GPL_H_ /* prevent circular inclusions */
> +#define _PSU_INIT_GPL_H_
> +
> +#include 
> +#include 
> +
> +int mask_pollonvalue(unsigned long add, u32 mask, u32 value);
> +
> +int mask_poll(u32 add, u32 mask);
> +
> +void mask_delay(u32 delay);
> +
> +void psu_mask_write(unsigned long offset, unsigned long mask,
> +   unsigned long val);
> +
> +void prog_reg(unsigned long addr, unsigned long mask,
> + unsigned long shift, unsigned long value);
> +
> +int psu_init(void);
> +
> +#endif /* _PSU_INIT_GPL_H_ */
> diff --git a/arch/arm/include/asm/arch-zynqmp/sys_proto.h
> b/arch/arm/include/asm/arch-zynqmp/sys_proto.h
> index 4dfabba80a5c..084d55a2b01f 100644
> --- a/arch/arm/include/asm/arch-zynqmp/sys_proto.h
> +++ b/arch/arm/include/asm/arch-zynqmp/sys_proto.h
> @@ -33,8 +33,6 @@ enum {
>  int zynq_board_read_rom_ethaddr(unsigned char *ethaddr);
>  unsigned int zynqmp_get_silicon_version(void);
>
> -int psu_init(void);
> -
>  void handoff_setup(void);
>
>  void zynqmp_pmufw_version(void);
> diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
> index db557e880674..824f4ae50fe5 100644
> --- a/board/xilinx/zynqmp/zynqmp.c
> +++ b/board/xilinx/zynqmp/zynqmp.c
> @@ -13,6 +13,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> --
> 1.9.1
>
>
Will send v2 of this patch. Psu init functions should be moved to separate
files as is done for zynq.

M


-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RESEND PATCH v2 2/4] clk: clk_fixed_rate: Fix style violation

2018-01-15 Thread Tom Rini
On Mon, Jan 15, 2018 at 11:44:46AM +0100, Mario Six wrote:
> On Mon, Jan 15, 2018 at 11:19 AM, Dr. Philipp Tomsich
>  wrote:
> > Tom,
> >
> >> On 15 Jan 2018, at 11:06, Mario Six  wrote:
> >>
> >> Fix a mis-indented function call in clk_fixed_rate.c
> >
> > A general question: do we want to have such gardening commits
> > create an additional indirection in our history for people using
> > git-blame frequently (e.g. I usually use git-blame to find the last
> > commit that touched a line and then read the log message to find
> > out why something was changed… now I’d have to restart this
> > search whenever I hit a pure formatting change)?

It does make archaeology harder at times, true.

> > My gut feeling would be that we should try to change lines only
> > when there is an actual change to the code happening.
> >
> 
> From https://www.denx.de/wiki/U-Boot/Patches:
> 
> "Non-functional changes, i.e. whitespace and reformatting changes, should be
> done in separate patches marked as cosmetic. This separation of functional and
> cosmetic changes greatly facilitates the review process."
> 
> (granted, I didn't explicitly mark the patches as cosmetic)
> 
> I read that as a general permission to post style-fix patches. If there's a
> different consensus, I'd like the page modified accordingly.

But this is also true (and yes, so long as the commit is otherwise clear
that it's coding style, etc, fixes, it's not also marked as cosmetic)
that we do in fact want these clean-ups.  The biggest problem I see is
that checkpatch.pl isn't as easily integrated into our workflow as other
CI tools.  So new problems get in.

Now, it's not as hard as it might have been ages ago, and I can drop
checkpatch.pl -q --git origin/master.. into my build scripts and get
something not too bad to review to try and catch pretty bad formatting
problems at least.

-- 
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] FW: u-boot v2016 vs v2013

2018-01-15 Thread Mehmet Ali İPİN
Dear Estevam,

Thank you very much for your answer.
I downloaded u-boot 2018.01. Its make file required gcc 6.0 or later. Then I 
downloaded gcc 7.2.
Building it.

Do you know is there a yocto version which is stable with u-boot 2018?

Thanks and best regards.



-Original Message-
From: Fabio Estevam [mailto:feste...@gmail.com] 
Sent: Friday, January 12, 2018 2:59 PM
To: Mehmet Ali İPİN 
Cc: u-boot@lists.denx.de
Subject: Re: [U-Boot] FW: u-boot v2016 vs v2013

On Fri, Jan 12, 2018 at 4:00 AM, Mehmet Ali İPİN  
wrote:
>
>
> From: Mehmet Ali İPİN
> Sent: Friday, January 12, 2018 8:39 AM
> To: 'u-b...@lists.dex.de' 
> Subject: u-boot v2016 vs v2013
>
> Dear Sir/Madam,
>
> Hello,
>
> We have an i.mx6dl board which was referenced to sabreauto kit, except 
> we use KSZ9021 as phy chip instead of AR8031. We installed the krogoth 
> and jethro versions of yocto; as result u-booth 2016 and 2013 versions 
> were installed accordingly. When downloaded the code
> 2013 u-boot version controlled the phy chip, even we did not touch the 
> ethernet-phy related files.
>
> But for u-boot 2016, even we modified the config and source files according 
> to KSZ9021, even MDO and MDCLK pins are not activated.
>
> I would be very grateful, if anybody knows a solution about this problem 
> and/or give me a direction.

Please try 2018.01 instead.

Another suggestion is to do a similar changes in your board file like this:
http://git.denx.de/?p=u-boot.git;a=commitdiff;h=dac09fc10b71045ac261a9b8a05d34029ebec2ae;hp=0f7c6cdc8143d6cf0577a84bf27bdaadd6229ff4

Regards,

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


Re: [U-Boot] [PATCH 0/9] Add new OPTEE bootm support to u-boot

2018-01-15 Thread Dr. Philipp Tomsich

> On 15 Jan 2018, at 13:03, Peng Fan  wrote:
> 
> On Mon, Jan 15, 2018 at 11:29:41AM +0100, Dr. Philipp Tomsich wrote:
>> 
>>> On 15 Jan 2018, at 11:24, Dr. Philipp Tomsich 
>>>  wrote:
>>> 
 
 On 15 Jan 2018, at 05:39, Kever Yang  wrote:
 
 Hi Bryan,
 
 On 01/12/2018 10:52 PM, Bryan O'Donoghue wrote:
> This series adds a new OPTEE bootable image type to u-boot, which is
> directly bootable with the bootm command.
> 
> There is already a TEE image type but, in this case the TEE firmware is
> loaded into RAM, jumped into and then back out of.
 
 This is how OP-TEE upstream designed flow, isn't it?
> This image type is a
> directly bootable image as described here :
> http://mrvan.github.io/optee-imx6ul
 
 Still not clear about the detail flow you are using :( I don't understand 
 why
 we need to support OP-TEE in bootm.
 Do you make U-Boot working in secure word?
>>> 
>>> I would also prefer if we could leave the secure world prior to executing 
>>> the
>>> full U-Boot??? it reduces the attack surface and will be similar to what we 
>>> do
>>> on ARMv8 with ATF.
>> 
>> I forgot to mention that Falcon-mode w/ OPTEE will only be possible if the
>> OPTEE is loaded from SPL.
> 
> Falcon-mode is a good feature, but not everyone use Falcon-mode.
> 
>> 
>> As I would like to avoid having two different ways to load an OPTEE within
>> U-Boot, this seems to also bias the ???default boot sequence??? towards 
>> inserting
>> OPTEE between SPL and the OS-stage (whether this is IH_OS_U_BOOT,
>> IH_OS_LINUX or something else).
> 
> 
> Providing the bootm way gives developer a choice for those that does not
> support SPL.  We have been using bootm to boot optee for long time.

Interesting to hear. Could you provide some additional feedback on how you
boot these boards today (e.g. how is U-Boot loaded, if there is no SPL; is
U-Boot running in secure mode, as we seem to have inferred from the earlier
conversation)?

> 
> Thanks,
> Peng
> 
>> 
>> Regards,
>> Philipp.
>> 
>>> 
> 
> Instead of reusing the Linux bootable image type instead a new image type
> is defined, which allows us to perform additional image verification, 
> prior
> to handing off control via bootm.
> 
> OPTEE images get linked to a specific address at compile time and must be
> loaded to this address too. This series extends out mkimage with a new
> image type that allows the OPTEE binary link location to be validated
> against CONFIG_OPTEE_TZDRAM_BASE and CONFIG_OPTEE_TZDRAM_SIZE respectively
> prior to proceeding through the bootm phase.
> 
> Once applied you can generate a bootable OPTEE image like this
> 
> mkimage -A arm -T optee -C none -d ./out/arm-plat-imx/core/tee.bin 
> uTee.optee
> 
> That image can then be booted directly by bootm. bootm will verify the
> header contents of the OPTEE binary against the DRAM area carved out in
> u-boot. If the defined DRAM area does not match the link address specified
> we refuse to boot.
> 
> Kever - I'd like to suggest that your OPTEE SPL image takes a different
> image type IH_TYPE_OPTEE_SPL ? to indicate the different behavior your
> image type has versus a directly bootable bootm image.
 
 Well, I think we can decide after everything is clear.
 
 Thanks,
 -Kever
> 
> Bryan O'Donoghue (9):
> optee: Add lib entries for sharing OPTEE code across ports
> optee: Add CONFIG_OPTEE_TZDRAM_SIZE
> optee: Make OPTEE_TZDRAM_BASE a mandatory define
> optee: Add optee_image_get_entry_point()
> optee: Add optee_image_get_load_addr()
> tools: mkimage: add optee image type
> optee: Add optee_verify_bootm_image()
> optee: Improve error printout
> bootm: optee: Add mechanism to validate an OPTEE image before boot
> 
> common/bootm.c| 11 +++-
> common/image.c|  1 +
> include/image.h   |  1 +
> include/tee/optee.h   | 41 ++
> lib/Kconfig   |  1 +
> lib/Makefile  |  1 +
> lib/optee/Kconfig | 16 
> lib/optee/Makefile|  7 ++
> lib/optee/optee.c | 69 
> +++
> tools/default_image.c | 25 ++-
> 10 files changed, 166 insertions(+), 7 deletions(-)
> create mode 100644 lib/optee/Kconfig
> create mode 100644 lib/optee/Makefile
> create mode 100644 lib/optee/optee.c
>> 
>> ___
>> U-Boot mailing list
>> U-Boot@lists.denx.de 
>> https://lists.denx.de/listinfo/u-boot 
> 
> -- 

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


Re: [U-Boot] [PATCH v2 0/3] cadence-quadspi: Fix issues with non 32bit aligned accesses

2018-01-15 Thread Jason Rush
On 1/15/2018 6:01 AM, Simon Goldschmidt wrote:
>
> Pepperl+Fuchs GmbH, Mannheim
> Geschaeftsfuehrer/Managing Directors: Dr.-Ing. Gunther Kegel (Vors./CEO), 
> Werner Guthier, Mehmet Hatiboglu
> Vorsitzender des Aufsichtsrats/Chairman of the supervisory board: Claus 
> Michael
> Registergericht/Register Court: AG Mannheim HRB 4713
> On 15.01.2018 12:45, Marek Vasut wrote:
>> On 01/15/2018 12:36 PM, Vignesh R wrote:
>>> Marek,
>>>
>>> On 09-Jan-18 6:49 PM, Vignesh R wrote:
 This series reverts use of bounce_buf.c for non-DMA related alignment
 restriction and replaces it with local bounce buffer to handle problems
 with non 32 bit aligned writes on TI platforms.
 Based on top of Jason's series:
 https://patchwork.ozlabs.org/cover/856431/

 Tested on K2G EVM.

>>> Could you ack this series, if you are okay with the changes?
>>>
>>> Jagan,
>>> Could you pick this up(along with the above dependent patches) for
>>> 2018.03 once Marek's Ack is in place?
>>>
>> Acked-by: Marek Vasut 
>>
>> although you should get ack from Jason and Simon instead, those matter.
>>
>
> Acked-by: Simon Goldschmidt 
>
> If that "Simon" above was me :-) I thought ack was sent by maintainers and TB 
> by me, sorry.
>
> Simon
>
> Wichtiger Hinweis:
> Diese E-Mail einschliesslich ihrer Anhaenge enthaelt vertrauliche und 
> rechtlich geschuetzte Informationen, die nur fuer den Adressaten bestimmt 
> sind. Sollten Sie nicht der bezeichnete Adressat sein, so teilen Sie dies 
> bitte dem Absender umgehend mit und loeschen Sie diese Nachricht und ihre 
> Anhaenge. Die unbefugte Weitergabe, das Anfertigen von Kopien und jede 
> Veraenderung der E-Mail ist untersagt. Der Absender haftet nicht fuer Inhalte 
> von veraenderten E-Mails.
>
>
> Important Information:
> This e-mail message including its attachments contains confidential and 
> legally protected information solely intended for the addressee. If you are 
> not the intended addressee of this message, please contact the addresser 
> immediately and delete this message including its attachments. The 
> unauthorized dissemination, copying and change of this e-mail are strictly 
> forbidden. The addresser shall not be liable for the content of such changed 
> e-mails.

Looks good to me.  Thanks Vignesh.

Reviewed-by: Jason Rush 
Acked-by: Jason Rush 

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


[U-Boot] [PATCH] checkpatch: Ignore 'short' Kconfig help entries

2018-01-15 Thread Tom Rini
A 2 line help entry for a new Kconfig entry is, at this time, sufficient
in some cases, so lets drop that warning for now.

Signed-off-by: Tom Rini 
---
 .checkpatch.conf | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/.checkpatch.conf b/.checkpatch.conf
index d1d32fac9db5..95f19635d35a 100644
--- a/.checkpatch.conf
+++ b/.checkpatch.conf
@@ -25,3 +25,6 @@
 # Ignore "WARNING: Prefer ether_addr_copy() over memcpy() if the Ethernet
 # addresses are __aligned(2)".
 --ignore PREFER_ETHER_ADDR_COPY
+
+# A bit shorter of a description is OK with us.
+--min-conf-desc-length=2
-- 
2.7.4

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


Re: [U-Boot] [U-Boot, v2, 01/12] riscv: cpu: Add nx25 to support RISC-V

2018-01-15 Thread Tom Rini
On Tue, Dec 26, 2017 at 01:55:48PM +0800, Andes wrote:

> From: Rick Chen 
> 
> Add Andes nx25 cpu core (called AndesStar V5) to support RISC-V arch
> 
> Verifications:
> 1. startup and relocation ok.
> 2. boot from rom or ram both ok.
> 2. timer driver ok.
> 3. uart driver ok
> 4. mmc driver ok
> 5. spi driver ok.
> 6. 32/64 bit both ok.
> 
> Detail verification message please see doc/README.ae250.
> 
> Signed-off-by: Rick Chen 
> Signed-off-by: Rick Chen 
> Signed-off-by: Greentime Hu 
> Cc: Padmarao Begari 

Applied to u-boot/master.

But that said, the whole of arch/riscv/ and board/AndesTech/nx25-ae250/
introduces some checkpatch.pl issues, please investigate and fix
appropriate ones, 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, 02/12] riscv: nx25: lib: Add relative lib funcs to support RISC-V

2018-01-15 Thread Tom Rini
On Tue, Dec 26, 2017 at 01:55:49PM +0800, Andes wrote:

> From: Rick Chen 
> 
> Add makefile, interrupts.c and boot.c,... functions
> to support RISC-V arch.
> 
> Signed-off-by: Rick Chen 
> Signed-off-by: Rick Chen 
> Signed-off-by: Greentime Hu 
> Cc: Padmarao Begari 

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, 04/12] riscv: nx25: include: Add header files to support RISC-V

2018-01-15 Thread Tom Rini
On Tue, Dec 26, 2017 at 01:55:51PM +0800, Andes wrote:

> From: Rick Chen 
> 
> Add header files for RISC-V.
> Cache, ptregs, data type and other definitions are included.
> 
> Signed-off-by: Rick Chen 
> Signed-off-by: Rick Chen 
> Signed-off-by: Greentime Hu 

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, 08/12] riscv: defconfig: Add nx25-ae250 defconfig to support RISC-V

2018-01-15 Thread Tom Rini
On Tue, Dec 26, 2017 at 01:55:55PM +0800, Andes wrote:

> From: Rick Chen 
> 
> Add nx25-ae250 default configuration for RISC-V
> 
> Signed-off-by: Rick Chen 
> Signed-off-by: Rick Chen 
> Signed-off-by: Greentime Hu 

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, 03/12] riscv: nx25: dts: Add AE250 dts to support RISC-V

2018-01-15 Thread Tom Rini
On Tue, Dec 26, 2017 at 01:55:50PM +0800, Andes wrote:

> From: Rick Chen 
> 
> AE250 is the Soc using NX25 cpu core base on RISC-V arch.
> Details please see the doc/README.ae250.
> 
> Signed-off-by: Rick Chen 
> Signed-off-by: Rick Chen 
> Signed-off-by: Greentime Hu 

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] travis.yml: Support RISC-V

2018-01-15 Thread Tom Rini
On Fri, Jan 12, 2018 at 02:57:09PM +0800, Andes wrote:

> From: Rick Chen 
> 
> Enable travis-ci support with a link having built.
> 
> Signed-off-by: Chih-Mao Chen 
> Signed-off-by: Rick Chen 
> Signed-off-by: Rick Chen 
> Signed-off-by: Greentime Hu 

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


  1   2   >