Re: [PATCH v2 1/3] fdtdec: optionally add property no-map to created reserved memory node

2020-08-25 Thread Rick Chen
> From: Patrice Chotard [mailto:patrice.chot...@st.com]
> Sent: Tuesday, August 25, 2020 7:29 PM
> To: u-boot@lists.denx.de
> Cc: Patrice CHOTARD; Patrick DELAUNAY; U-Boot STM32; Etienne Carriere; Atish 
> Patra; Bin Meng; Bryan O'Donoghue; Heinrich Schuchardt; Rick Jian-Zhi 
> Chen(陳建志); Simon Glass
> Subject: [PATCH v2 1/3] fdtdec: optionally add property no-map to created 
> reserved memory node
>
> From: Etienne Carriere 
>
> Add boolean input argument @no_map to helper function
> fdtdec_add_reserved_memory() to add "no-map" property for an added
> reserved memory node. This is needed for example when the reserved
> memory relates to secure memory that the dear Linux kernel shall
> not even map unless what non-secure world speculative accesses of the
> CPU can violate the memory firmware configuration.
>
> No function change. A later change will update to OPTEE library to
> add no-map property to OP-TEE reserved memory nodes.
>
> Signed-off-by: Etienne Carriere 
> Signed-off-by: Patrice Chotard 
>- fix dm fdtdec test and arch/riscv/lib/fdt_fixup.c with
>fdtdec_add_reserved_memory() new parameter
>
> ---
>
> (no changes since v1)
>
>  arch/riscv/lib/fdt_fixup.c |  2 +-
>  include/fdtdec.h   |  5 +++--
>  lib/fdtdec.c   | 10 --
>  lib/optee/optee.c  |  2 +-
>  test/dm/fdtdec.c   |  6 +++---
>  5 files changed, 16 insertions(+), 9 deletions(-)

Acked-by: Rick Chen 


[PATCH 3/3] binman: Build FIT image subentries with the section etype

2020-08-25 Thread Alper Nebi Yasak
When reading subentries of each image, the FIT entry type directly
concatenates their contents without padding them according to their
offset, size, align, align-size, align-end, pad-before, pad-after
properties.

This patch makes sure these properties are respected by offloading this
image-data building to the section etype, where each subnode of the
"images" node is processed as a section. Alignments and offsets are
respective to the beginning of each image. For example, the following
fragment can end up having "u-boot-spl" start at 0x88 within the final
FIT binary, while "u-boot" would then end up starting at e.g. 0x20088.

fit {
description = "example";

images {
kernel-1 {
description = "U-Boot with SPL";
type = "kernel";
arch = "arm64";
os = "linux";
compression = "none";

u-boot-spl {
};
u-boot {
align = <0x1>;
};
};
};
}

Signed-off-by: Alper Nebi Yasak 
---

 tools/binman/etype/fit.py | 22 +++
 tools/binman/ftest.py | 24 
 .../test/166_fit_image_subentry_alignment.dts | 57 +++
 3 files changed, 93 insertions(+), 10 deletions(-)
 create mode 100644 tools/binman/test/166_fit_image_subentry_alignment.dts

diff --git a/tools/binman/etype/fit.py b/tools/binman/etype/fit.py
index 75712f4409..f136a2c254 100644
--- a/tools/binman/etype/fit.py
+++ b/tools/binman/etype/fit.py
@@ -62,7 +62,7 @@ class Entry_fit(Entry):
 """
 super().__init__(section, etype, node)
 self._fit = None
-self._fit_content = defaultdict(list)
+self._fit_images = {}
 self._fit_props = {}
 
 def ReadNode(self):
@@ -91,15 +91,18 @@ class Entry_fit(Entry):
 
 rel_path = node.path[len(base_node.path):]
 has_images = depth == 2 and rel_path.startswith('/images/')
+if has_images:
+entry = Entry.Create(self.section, node, etype='section')
+entry.ReadNode()
+self._fit_images[rel_path] = entry
+
 for subnode in node.subnodes:
 if has_images and not (subnode.name.startswith('hash') or
subnode.name.startswith('signature')):
 # This is a content node. We collect all of these together
 # and put them in the 'data' property. They do not appear
 # in the FIT.
-entry = Entry.Create(self.section, subnode)
-entry.ReadNode()
-self._fit_content[rel_path].append(entry)
+pass
 else:
 with fsw.add_node(subnode.name):
 _AddNode(base_node, depth + 1, subnode)
@@ -150,13 +153,12 @@ class Entry_fit(Entry):
 Returns:
 New fdt contents (bytes)
 """
-for path, entries in self._fit_content.items():
+for path, image in self._fit_images.items():
 node = fdt.GetNode(path)
-data = b''
-for entry in entries:
-if not entry.ObtainContents():
-return False
-data += entry.GetData()
+if not image.ObtainContents():
+return False
+image.Pack(0)
+data = image.GetData()
 node.AddData('data', data)
 
 fdt.Sync(auto_resize=True)
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 8edf85c89f..ed573d8991 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -3485,5 +3485,29 @@ class TestFunctional(unittest.TestCase):
 fnode = dtb.GetNode('/images/kernel')
 self.assertNotIn('data', fnode.props)
 
+def testFitImageSubentryAlignment(self):
+"""Test relative alignability of FIT image subentries"""
+entry_args = {
+'test-id': TEXT_DATA,
+}
+data, _, _, _ = 
self._DoReadFileDtb('166_fit_image_subentry_alignment.dts',
+entry_args=entry_args)
+dtb = fdt.Fdt.FromData(data)
+dtb.Scan()
+
+node = dtb.GetNode('/images/kernel')
+data = dtb.GetProps(node)["data"].bytes
+align_pad = 0x10 - (len(U_BOOT_SPL_DATA) % 0x10)
+expected = (tools.GetBytes(0, 0x20) + U_BOOT_SPL_DATA +
+tools.GetBytes(0, align_pad) + U_BOOT_DATA)
+self.assertEqual(expected, data)
+
+node = dtb.GetNode('/images/fdt-1')
+data = dtb.GetProps(node)["data"].bytes
+expected = (U_BOOT_SPL_DTB_DATA + 

[PATCH 2/3] binman: Respect pad-before property of section subentries

2020-08-25 Thread Alper Nebi Yasak
Other relevant properties (pad-after, offset, size, align, align-size,
align-end) already work since Pack() sets correct ranges for subentries'
data (.offset, .size variables), but some padding here is necessary to
align the data within this range to match the pad-before property.

Signed-off-by: Alper Nebi Yasak 
---

 tools/binman/etype/section.py |  2 +-
 tools/binman/ftest.py |  8 +++
 tools/binman/test/165_pad_in_sections.dts | 26 +++
 3 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100644 tools/binman/test/165_pad_in_sections.dts

diff --git a/tools/binman/etype/section.py b/tools/binman/etype/section.py
index c5166a5b57..72600b1ef3 100644
--- a/tools/binman/etype/section.py
+++ b/tools/binman/etype/section.py
@@ -152,7 +152,7 @@ class Entry_section(Entry):
 for entry in self._entries.values():
 data = entry.GetData()
 base = self.pad_before + (entry.offset or 0) - self._skip_at_start
-pad = base - len(section_data)
+pad = base - len(section_data) + (entry.pad_before or 0)
 if pad > 0:
 section_data += tools.GetBytes(self._pad_byte, pad)
 section_data += data
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 5f650b5f94..8edf85c89f 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -1269,6 +1269,14 @@ class TestFunctional(unittest.TestCase):
 U_BOOT_DATA + tools.GetBytes(ord('&'), 4))
 self.assertEqual(expected, data)
 
+def testPadInSections(self):
+"""Test pad-before, pad-after for entries in sections"""
+data = self._DoReadFile('165_pad_in_sections.dts')
+expected = (U_BOOT_DATA + tools.GetBytes(ord('!'), 12) +
+U_BOOT_DATA + tools.GetBytes(ord('!'), 6) +
+U_BOOT_DATA)
+self.assertEqual(expected, data)
+
 def testMap(self):
 """Tests outputting a map of the images"""
 _, _, map_data, _ = self._DoReadFileDtb('055_sections.dts', map=True)
diff --git a/tools/binman/test/165_pad_in_sections.dts 
b/tools/binman/test/165_pad_in_sections.dts
new file mode 100644
index 00..f2b327ff9f
--- /dev/null
+++ b/tools/binman/test/165_pad_in_sections.dts
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   binman {
+   pad-byte = <0x26>;
+   section {
+   pad-byte = <0x21>;
+
+   before {
+   type = "u-boot";
+   };
+   u-boot {
+   pad-before = <12>;
+   pad-after = <6>;
+   };
+   after {
+   type = "u-boot";
+   };
+   };
+   };
+};
-- 
2.28.0



ext2ls zero-length directory entries?

2020-08-25 Thread Joe Buehler
(This is a vendor-modified version of uboot 2011.03.)

I am running into problems using ext2load, the command complains that
the file of interest is not found.  I know it's there though since it is
fine under LINUX.

Doing some poking around, I see that ext2ls is showing mostly zero
length on the subdirs I am interested in loading files from -- thus the
"not found" issues.  Some of the directories have enormous lengths and
crash uboot when attempting to list their content.

I am attempting to load from a large SATA disk partitioned into two
equal-size partitions that add up to the whole disk.  No problems with
the first partition, the second partition has the issue.

Does this ring a bell with anyone?  Perhaps it is a disk size issue and
an old uboot?  LINUX says the following about the disk:

ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 0)
ata1.00: supports DRM functions and may not be fully accessable.
ata1.00: ATA-10: Micron_1100_MTFDDAK256TBN,  M0MU031, max UDMA/133
ata1.00: 500118192 sectors, multi 16: LBA48 NCQ (depth 31/32)
ata1.00: supports DRM functions and may not be fully accessable.
ata1.00: configured for UDMA/100
scsi 0:0:0:0: Direct-Access ATA  Micron_1100_MTFD n/a  PQ: 0 ANSI: 5
sd 0:0:0:0: [sda] 500118192 512-byte logical blocks: (256 GB/238 GiB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't
support DPO or FUA
 sda: sda1 sda2
sd 0:0:0:0: [sda] Attached SCSI disk

Joe Buehler



[PATCH 1/3] binman: Ignore hash*, signature* nodes in sections

2020-08-25 Thread Alper Nebi Yasak
Switch to str.startswith for matching like the FIT etype does since the
current version doesn't ignore 'hash-1', 'hash-2', etc.

Signed-off-by: Alper Nebi Yasak 
---

 tools/binman/etype/section.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/binman/etype/section.py b/tools/binman/etype/section.py
index 73c5553c81..c5166a5b57 100644
--- a/tools/binman/etype/section.py
+++ b/tools/binman/etype/section.py
@@ -83,7 +83,7 @@ class Entry_section(Entry):
 
 def _ReadEntries(self):
 for node in self._node.subnodes:
-if node.name == 'hash':
+if node.name.startswith('hash') or 
node.name.startswith('signature'):
 continue
 entry = Entry.Create(self, node)
 entry.ReadNode()
-- 
2.28.0



[PATCH 0/3] binman: Make FIT image subentries respect offset, alignment and padding

2020-08-25 Thread Alper Nebi Yasak
I've been automating the process in doc/README.chromium-chainload and
while experimenting with whether a "kernel" image with u-boot-spl and
u-boot would work, noticed I couldn't align/offset/pad the two parts.

E.g. in something like the following, binman doesn't add the necessary
padding to place the "u-boot" to the correct offset within the
"kernel-1" data:

fit {
description = "example";

images {
kernel-1 {
description = "U-Boot with SPL";
type = "kernel";
arch = "arm64";
os = "linux";
compression = "none";

u-boot-spl {
};
u-boot {
offset = ;
};
};
};
};

Not sure if that'll ever be really necessary besides my experiment, but
it doesn't seem like skipping the padding was a deliberate choice, so
here are some fixes I wrote for that.


Alper Nebi Yasak (3):
  binman: Ignore hash*, signature* nodes in sections
  binman: Respect pad-before property of section subentries
  binman: Build FIT image subentries with the section etype

 tools/binman/etype/fit.py | 22 +++
 tools/binman/etype/section.py |  4 +-
 tools/binman/ftest.py | 32 +++
 tools/binman/test/165_pad_in_sections.dts | 26 +
 .../test/166_fit_image_subentry_alignment.dts | 57 +++
 5 files changed, 129 insertions(+), 12 deletions(-)
 create mode 100644 tools/binman/test/165_pad_in_sections.dts
 create mode 100644 tools/binman/test/166_fit_image_subentry_alignment.dts

-- 
2.28.0



Re: Please pull u-boot-marvell/master

2020-08-25 Thread Tom Rini
On Tue, Aug 25, 2020 at 03:20:35PM +0200, Stefan Roese wrote:

> Hi Tom,
> 
> please pull the Marvell Octeon TX / TX2 base support. I would have
> liked to send this pull request earlier in the release cycle,
> but it did not work out and I hope, that it's still possible to
> get this included in this rc2 phase. Most changes are located in
> the Octeon TX / TX2 platform code and some IF changes in the
> PCI uclass driver. As mentioned in my last mail, I've removed the
> bigger device drivers for NAND & ethernet for now. This way, they
> have a bit more time for reviews. I've also included the small
> QEMU x86 patch that I sent earlier today, as this patch fixes a
> CI QEMU failure.
> 
> Here the summary log:
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


[PATCH v5 2/2] board: sl28: add board specific nvm command

2020-08-25 Thread Michael Walle
The board supports 16 configuration bits which can be manipulated with
this command. See the board's README for a detailed explanation on each
bit.

Signed-off-by: Michael Walle 
---
 board/kontron/sl28/Makefile |   2 +-
 board/kontron/sl28/README   |  79 
 board/kontron/sl28/cmds.c   | 178 
 3 files changed, 258 insertions(+), 1 deletion(-)
 create mode 100644 board/kontron/sl28/cmds.c

diff --git a/board/kontron/sl28/Makefile b/board/kontron/sl28/Makefile
index 0f1866c874..74d8012f0f 100644
--- a/board/kontron/sl28/Makefile
+++ b/board/kontron/sl28/Makefile
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0+
 
 ifndef CONFIG_SPL_BUILD
-obj-y += sl28.o
+obj-y += sl28.o cmds.o
 endif
 
 obj-y += common.o ddr.o
diff --git a/board/kontron/sl28/README b/board/kontron/sl28/README
index 3ddd9aeeb8..40f3197716 100644
--- a/board/kontron/sl28/README
+++ b/board/kontron/sl28/README
@@ -57,6 +57,85 @@ u-boot (yet). But you can use the i2c command to access it:
  > i2c md 4a 3.1 1
 
 
+Non-volatile Board Configuration Bits
+=
+
+The board has 16 configuration bits which are stored in the CPLD and are
+non-volatile. These can be changed by the `sl28 nvm` command.
+
+| Bit | Description |
+| --- | --- |
+|   0 | Power-on inhibit|
+|   1 | Enable eMMC boot|
+|   2 | Enable watchdog by default  |
+|   3 | Disable failsafe watchdog by default|
+|   4 | Clock generator selection bit 0 |
+|   5 | Clock generator selection bit 1 |
+|   6 | Disable CPU SerDes clock #2 and PCIe-A clock output |
+|   7 | Disable PCIe-B and PCIe-C clock output  |
+|   8 | Keep onboard PHYs in reset  |
+|   9 | Keep USB hub in reset   |
+|  10 | Keep eDP-to-LVDS converter in reset |
+|  11 | Enable I2C stuck recovery on I2C PM and I2C GP busses   |
+|  12 | Enable automatic onboard PHY H/W reset  |
+|  13 | reserved|
+|  14 | Used by the RCW to determine boot source|
+|  15 | Used by the RCW to determine boot source|
+
+Please note, that if the board is in failsafe mode, the bits will have the
+factory defaults, ie. all bits are off.
+
+Power-On Inhibit
+
+
+If this is set, the board doesn't automatically turn on when power is
+applied. Instead, the user has to either toggle the `PWR_BTN#` line or
+use any other wake-up source such as RTC alarm or Wake-on-LAN.
+
+eMMC Boot
+-
+
+If this is set, the RCW will be fetched from the on-board eMMC at offset
+1MiB. For further details, have a look at the [SMARC-sAL28 Reset
+Configuration Word documentation][1].
+
+Watchdog
+
+
+By default, the CPLD watchdog is enabled in failsafe mode. Using bits 2 and
+3, the user can change its mode or disable it altogether.
+
+| Bit 2 | Bit 3 | Description |
+| - | - | --- |
+| 0 | 0 | Watchdog enabled, failsafe mode |
+| 0 | 1 | Watchdog disabled   |
+| 1 | 0 | Watchdog enabled, failsafe mode |
+| 1 | 1 | Watchdog enabled, normal mode   |
+
+Clock Generator Select
+--
+
+The board is prepared to supply different SerDes clock speeds. But for now,
+only setting 0 is supported, otherwise the CPU will hang because the PLL
+will not lock.
+
+Clock Output Disable And Keep Devices In Reset
+--
+
+To safe power, the user might disable different devices and clock output of
+the board. It is not supported to disable the "CPU SerDes clock #2" for
+now, otherwise the CPU will hang because the PLL will not lock.
+
+Automatic reset of the onboard PHYs
+---
+
+By default, there is no hardware reset of the onboard PHY. This is because
+for Wake-on-LAN, some registers have to retain their values. If you don't
+use the WOL feature and a soft reset of the PHY is not enough you can
+enable the hardware reset. The onboard PHY hardware reset follows the
+power-on reset.
+
+
 Vendor Documentation
 
 
diff --git a/board/kontron/sl28/cmds.c b/board/kontron/sl28/cmds.c
new file mode 100644
index 00..046d3b4903
--- /dev/null
+++ b/board/kontron/sl28/cmds.c
@@ -0,0 +1,178 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * sl28 extension commands
+ *
+ * Copyright (c) 2020 Kontron Europe GmbH
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#define 

[PATCH v5 1/2] board: kontron: add sl28 support

2020-08-25 Thread Michael Walle
Add basic support for the Kontron SMARC-sAL28 board. This includes just
the bare minimum to be able to bring up the board and boot linux.

For now, the Single and Dual PHY variant is supported. Other variants
will fall back to the basic variant.

In particular, there is no watchdog support for now. This means that you
have to disable the default watchdog, otherwise you'll end up in the
recovery bootloader. See the board README for details.

Signed-off-by: Michael Walle 
---
 arch/arm/Kconfig  |  11 +
 arch/arm/dts/Makefile |   3 +
 .../dts/fsl-ls1028a-kontron-sl28-u-boot.dtsi  | 135 +
 .../fsl-ls1028a-kontron-sl28-var3-u-boot.dtsi |   2 +
 .../arm/dts/fsl-ls1028a-kontron-sl28-var3.dts |  15 ++
 .../fsl-ls1028a-kontron-sl28-var4-u-boot.dtsi |   2 +
 .../arm/dts/fsl-ls1028a-kontron-sl28-var4.dts |  48 +
 arch/arm/dts/fsl-ls1028a-kontron-sl28.dts | 189 ++
 board/kontron/sl28/Kconfig|  18 ++
 board/kontron/sl28/MAINTAINERS|   6 +
 board/kontron/sl28/Makefile   |   8 +
 board/kontron/sl28/README |  63 ++
 board/kontron/sl28/common.c   |  10 +
 board/kontron/sl28/ddr.c  |  98 +
 board/kontron/sl28/sl28.c |  70 +++
 board/kontron/sl28/spl.c  |  32 +++
 configs/kontron_sl28_defconfig| 106 ++
 include/configs/kontron_sl28.h| 125 
 18 files changed, 941 insertions(+)
 create mode 100644 arch/arm/dts/fsl-ls1028a-kontron-sl28-u-boot.dtsi
 create mode 100644 arch/arm/dts/fsl-ls1028a-kontron-sl28-var3-u-boot.dtsi
 create mode 100644 arch/arm/dts/fsl-ls1028a-kontron-sl28-var3.dts
 create mode 100644 arch/arm/dts/fsl-ls1028a-kontron-sl28-var4-u-boot.dtsi
 create mode 100644 arch/arm/dts/fsl-ls1028a-kontron-sl28-var4.dts
 create mode 100644 arch/arm/dts/fsl-ls1028a-kontron-sl28.dts
 create mode 100644 board/kontron/sl28/Kconfig
 create mode 100644 board/kontron/sl28/MAINTAINERS
 create mode 100644 board/kontron/sl28/Makefile
 create mode 100644 board/kontron/sl28/README
 create mode 100644 board/kontron/sl28/common.c
 create mode 100644 board/kontron/sl28/ddr.c
 create mode 100644 board/kontron/sl28/sl28.c
 create mode 100644 board/kontron/sl28/spl.c
 create mode 100644 configs/kontron_sl28_defconfig
 create mode 100644 include/configs/kontron_sl28.h

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index c5ebd59d34..a9746f87cc 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1615,6 +1615,16 @@ config TARGET_LS1046AFRWY
  development platform that supports the QorIQ LS1046A
  Layerscape Architecture processor.
 
+config TARGET_SL28
+   bool "Support sl28"
+   select ARCH_LS1028A
+   select ARM64
+   select ARMV8_MULTIENTRY
+   select SUPPORT_SPL
+   select BINMAN
+   help
+ Support for Kontron SMARC-sAL28 board.
+
 config TARGET_COLIBRI_PXA270
bool "Support colibri_pxa270"
select CPU_PXA
@@ -1962,6 +1972,7 @@ source "board/hisilicon/hikey/Kconfig"
 source "board/hisilicon/hikey960/Kconfig"
 source "board/hisilicon/poplar/Kconfig"
 source "board/isee/igep003x/Kconfig"
+source "board/kontron/sl28/Kconfig"
 source "board/myir/mys_6ulx/Kconfig"
 source "board/spear/spear300/Kconfig"
 source "board/spear/spear310/Kconfig"
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index f8f529435b..b45eb6a772 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -422,6 +422,9 @@ dtb-$(CONFIG_FSL_LSCH2) += fsl-ls1043a-qds-duart.dtb \
fsl-ls1012a-2g5rdb.dtb \
fsl-ls1012a-frdm.dtb \
fsl-ls1012a-frwy.dtb
+dtb-$(CONFIG_TARGET_SL28) += fsl-ls1028a-kontron-sl28.dtb \
+   fsl-ls1028a-kontron-sl28-var3.dtb \
+   fsl-ls1028a-kontron-sl28-var4.dtb \
 
 dtb-$(CONFIG_TARGET_DRAGONBOARD410C) += dragonboard410c.dtb
 dtb-$(CONFIG_TARGET_DRAGONBOARD820C) += dragonboard820c.dtb
diff --git a/arch/arm/dts/fsl-ls1028a-kontron-sl28-u-boot.dtsi 
b/arch/arm/dts/fsl-ls1028a-kontron-sl28-u-boot.dtsi
new file mode 100644
index 00..2375549c6e
--- /dev/null
+++ b/arch/arm/dts/fsl-ls1028a-kontron-sl28-u-boot.dtsi
@@ -0,0 +1,135 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+#include 
+
+/ {
+   aliases {
+   mmc0 = 
+   mmc1 = 
+   i2c0 = 
+   i2c1 = 
+   i2c2 = 
+   rtc0 = 
+   ethernet0 = 
+   ethernet1 = 
+   ethernet2 = 
+   ethernet3 = 
+   };
+
+   binman {
+   filename = "u-boot.rom";
+   pad-byte = <0xff>;
+
+   u-boot-spl {
+   };
+
+   fit {
+   offset = ;
+   description = "FIT image with multiple configurations";
+
+   images {
+   uboot {
+  

[PATCH v5 0/2] Basic Kontron SMARC-sAL28 board support

2020-08-25 Thread Michael Walle
Add basic board support for the Kontron SMARC-sAL28 board. Please note,
that this board doesn't support TF-a (yet). Therefore, the u-boot SPL is
the first code which is run and it has to set up the RAM.

changes since v4:
 - dropped "armv8: ls1028a: move FSL_LAYERSCAPE to kconfig" as it is
   already upstream
 - new patch "board: sl28: add board specific nvm command"
 - use binman
 - sync device trees with linux
 - use "-u-boot.dtsi" style
 - rebase to lastest master

changes since v3:
 - rebase to latest master
 - use CONFIG_PCI_INIT_R
 - set fdtfile in default environment

changes since v2:
 - add variant 4 support. Since the atheros PHY dt bindings were merged
   into master, we can now use them
 - add environment section in include/configs/kontron_sl28.h
 - add cover letter

changes since v1:
 - fix watchdog device tree reference

Michael Walle (2):
  board: kontron: add sl28 support
  board: sl28: add board specific nvm command

 arch/arm/Kconfig  |  11 +
 arch/arm/dts/Makefile |   3 +
 .../dts/fsl-ls1028a-kontron-sl28-u-boot.dtsi  | 135 +
 .../fsl-ls1028a-kontron-sl28-var3-u-boot.dtsi |   1 +
 .../arm/dts/fsl-ls1028a-kontron-sl28-var3.dts |  15 ++
 .../fsl-ls1028a-kontron-sl28-var4-u-boot.dtsi |   1 +
 .../arm/dts/fsl-ls1028a-kontron-sl28-var4.dts |  48 +
 arch/arm/dts/fsl-ls1028a-kontron-sl28.dts | 189 ++
 board/kontron/sl28/Kconfig|  18 ++
 board/kontron/sl28/MAINTAINERS|   6 +
 board/kontron/sl28/Makefile   |   8 +
 board/kontron/sl28/README | 142 +
 board/kontron/sl28/cmds.c | 176 
 board/kontron/sl28/common.c   |  10 +
 board/kontron/sl28/ddr.c  |  98 +
 board/kontron/sl28/sl28.c |  75 +++
 board/kontron/sl28/spl.c  |  32 +++
 configs/kontron_sl28_defconfig| 106 ++
 include/configs/kontron_sl28.h| 125 
 19 files changed, 1199 insertions(+)
 create mode 100644 arch/arm/dts/fsl-ls1028a-kontron-sl28-u-boot.dtsi
 create mode 100644 arch/arm/dts/fsl-ls1028a-kontron-sl28-var3-u-boot.dtsi
 create mode 100644 arch/arm/dts/fsl-ls1028a-kontron-sl28-var3.dts
 create mode 100644 arch/arm/dts/fsl-ls1028a-kontron-sl28-var4-u-boot.dtsi
 create mode 100644 arch/arm/dts/fsl-ls1028a-kontron-sl28-var4.dts
 create mode 100644 arch/arm/dts/fsl-ls1028a-kontron-sl28.dts
 create mode 100644 board/kontron/sl28/Kconfig
 create mode 100644 board/kontron/sl28/MAINTAINERS
 create mode 100644 board/kontron/sl28/Makefile
 create mode 100644 board/kontron/sl28/README
 create mode 100644 board/kontron/sl28/cmds.c
 create mode 100644 board/kontron/sl28/common.c
 create mode 100644 board/kontron/sl28/ddr.c
 create mode 100644 board/kontron/sl28/sl28.c
 create mode 100644 board/kontron/sl28/spl.c
 create mode 100644 configs/kontron_sl28_defconfig
 create mode 100644 include/configs/kontron_sl28.h

-- 
2.20.1



Re: Z-Turn board support on U-Boot 2020.10-rc2, got some errors.

2020-08-25 Thread Alexandre GRIVEAUX
On 24/08/2020 13:31, Michal Simek wrote :
> Hi,
>
Hi
> It looks like that manufacturer created different versions where they
> are not compatible to each other. Please take a look at this thread.
> https://www.spinics.net/lists/arm-kernel/msg800078.html
>
> I didn't accepted the patch because none else didn't test it on both
> revisions.
> Issue with spi flash can be also related.
>
> Thanks,
> Michal

Seem right to me to test things, I can test on the board (V5), maybe
Alexander Graf could help with V4 [0] ?

As a reminder the board can be populated with a Xilinx XC7Z010 or Xilinx
XC7Z020.

Maybe we need to create another DT ?


Thanks.


[0] I don't know how to get one for testing, that's why i added
Alexander in copy.





Re: [PATCH 4/7] binman: Add support for ATF BL31

2020-08-25 Thread Heinrich Schuchardt
Am 25. August 2020 18:57:57 MESZ schrieb Simon Glass :
>Hi Heinrich,
>
>On Tue, 25 Aug 2020 at 04:16, Heinrich Schuchardt 
>wrote:
>>
>> On 22.08.20 04:36, Simon Glass wrote:
>> > Add an entry for ARM Trusted Firmware's 'BL31' payload, which is
>the
>> > device's main firmware. Typically this is U-Boot.
>> >
>> > Signed-off-by: Simon Glass 
>> > ---
>> >
>> >  tools/binman/README.entries| 10 ++
>> >  tools/binman/etype/atf_bl31.py | 20 
>> >  tools/binman/ftest.py  |  9 +
>> >  tools/binman/test/165_atf_bl31.dts | 16 
>> >  4 files changed, 55 insertions(+)
>> >  create mode 100644 tools/binman/etype/atf_bl31.py
>> >  create mode 100644 tools/binman/test/165_atf_bl31.dts
>> >
>> > diff --git a/tools/binman/README.entries
>b/tools/binman/README.entries
>> > index 97bfae16116..85b8ec9fa73 100644
>> > --- a/tools/binman/README.entries
>> > +++ b/tools/binman/README.entries
>> > @@ -11,6 +11,16 @@ features to produce new behaviours.
>> >
>> >
>> >
>> > +Entry: atf-bl31: Entry containing an ARM Trusted Firmware (ATF)
>BL31 blob
>> >
>+-
>> > +
>> > +Properties / Entry arguments:
>> > +- atf-bl31-path: Filename of file to read into entry
>> > +
>> > +This entry holds the run-time firmware started by ATF.
>>
>> No, BL31 is started by U-Boot SPL on the Sunxi platform.
>
>So perhaps I should reword this to indicate it can go either way?

If SPL is not loading BL31, we don't need this value. Instead we will pass 
U-Boot as BL33 to the TF-A make command.

Best regards

Heinrich

>
>>
>> Best regards
>>
>[..]
>
>Regards,
>Simon



[PATCH v2 1/1] board: ns3: check bnxt chimp handshake status

2020-08-25 Thread Rayagonda Kokatanur
Chimp is a core in Broadcom netxtream controller (bnxt).
Add support to check bnxt's chimp component status.

Signed-off-by: Rayagonda Kokatanur 
---
Changes from V1:
 -Address review comments from Simon,
  Add comment about chimp failure. 

 board/broadcom/bcmns3/ns3.c | 17 +
 1 file changed, 17 insertions(+)

diff --git a/board/broadcom/bcmns3/ns3.c b/board/broadcom/bcmns3/ns3.c
index 0357cd0e32..10ae344a06 100644
--- a/board/broadcom/bcmns3/ns3.c
+++ b/board/broadcom/bcmns3/ns3.c
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /* Default reset-level = 3 and strap-val = 0 */
 #define L3_RESET   30
@@ -210,8 +211,24 @@ void reset_cpu(ulong level)
 #ifdef CONFIG_OF_BOARD_SETUP
 int ft_board_setup(void *fdt, struct bd_info *bd)
 {
+   u32 chimp_hs = CHIMP_HANDSHAKE_WAIT_TIMEOUT;
+
gic_lpi_tables_init();
 
+   /*
+* Check for chimp handshake status.
+* Zero timeout value will actually fall to default timeout.
+*
+* System boot is independent of chimp handshake.
+* chimp handshake failure is not a catastrophic error.
+* Hence continue booting if chimp handshake fails.
+*/
+   chimp_handshake_status_optee(0, _hs);
+   if (chimp_hs == CHIMP_HANDSHAKE_SUCCESS)
+   printf("ChiMP handshake successful\n");
+   else
+   printf("ERROR: ChiMP handshake status 0x%x\n", chimp_hs);
+
return mem_info_parse_fixup(fdt);
 }
 #endif /* CONFIG_OF_BOARD_SETUP */
-- 
2.17.1



Re: [PATCH 0/7] binman: Add support for generating more complex FITs

2020-08-25 Thread Heinrich Schuchardt
On 8/25/20 6:57 PM, Simon Glass wrote:
> Hi Heinrich,
>
> On Tue, 25 Aug 2020 at 04:12, Heinrich Schuchardt  wrote:
>>
>> On 25.08.20 06:07, Heinrich Schuchardt wrote:
>>> On 8/22/20 4:36 AM, Simon Glass wrote:
 This series allows binman to generate FITs that include multiple DTB
 images and the configuration to use them.

 It is then possible to remove the sunxi FIT generator script, so this
 series handles that also.

 With this, sunxi is fully converted to use binman.
>>>
>>> I have applied this patch series and it does not work on my
>>> pine64-lts_defconfig.
>>>
>>> Environment variable BL31 points to my bl31.bin:
>>>
>>> $ echo $BL31
>>> ../trusted-firmware-a/build/sun50i_a64/debug/bl31.bin
>>>
>>> U-Boot SPL 2020.10-rc2-00147-g72293dc579 (Aug 25 2020 - 03:29:28 +)
>>> DRAM: 2048 MiB
>>> Trying to boot from MMC1
>>> No matching DT out of these options:
>>>Configuration to load ATF before U-Boot
>>> No matching DT out of these options:
>>>Configuration to load ATF before U-Boot
>>> mmc_load_image_raw_sector: mmc block read error
>>> SPL: failed to boot from all boot devices
>>> ### ERROR ### Please RESET the board ###
>>>
>>> Without your patches U-Boot works. But CONFIG_SYS_MALLOC_F_LEN=0x400 is
>>> too small. This results in a warning "alloc space exhausted". Cf.
>>> https://patchwork.ozlabs.org/project/uboot/patch/20200725181851.4339-1-xypron.g...@gmx.de/
>>>
>>> U-Boot SPL 2020.10-rc2-00140-g1aa3966173 (Aug 25 2020 - 03:46:36 +)
>>> DRAM: 2048 MiB
>>> Trying to boot from MMC1
>>> NOTICE:  BL31: v2.2():v2.2-1138-g78460ced4
>>> NOTICE:  BL31: Built : 05:50:47, Apr  7 2020
>>> NOTICE:  BL31: Detected Allwinner A64/H64/R18 SoC (1689)
>>> NOTICE:  BL31: Found U-Boot DTB at 0x4092cc8, model: Pine64 LTS
>>> INFO:ARM GICv2 driver initialized
>>> INFO:Configuring SPC Controller
>>> INFO:PMIC: Probing AXP803 on RSB
>>> INFO:PMIC: dcdc1 voltage: 3.300V
>>> INFO:PMIC: dcdc5 voltage: 1.200V
>>> INFO:PMIC: dcdc6 voltage: 1.100V
>>> INFO:PMIC: dldo1 voltage: 3.300V
>>> INFO:PMIC: dldo2 voltage: 3.300V
>>> INFO:PMIC: dldo4 voltage: 3.300V
>>> INFO:PMIC: fldo1 voltage: 1.200V
>>> INFO:PMIC: Enabling DC SW
>>> INFO:BL31: Platform setup done
>>> INFO:BL31: Initializing runtime services
>>> INFO:BL31: cortex_a53: CPU workaround for 843419 was applied
>>> INFO:BL31: cortex_a53: CPU workaround for 855873 was applied
>>> NOTICE:  PSCI: System suspend is unavailable
>>> INFO:BL31: Preparing for EL3 exit to normal world
>>> INFO:Entry point address = 0x4a00
>>> INFO:SPSR = 0x3c9
>>> alloc space exhausted
>>>
>>>
>>> U-Boot 2020.10-rc2-00140-g1aa3966173 (Aug 25 2020 - 03:46:36 +)
>>> Allwinner Technology
>>>
>>> CPU:   Allwinner A64 (SUN50I)
>>> Model: Pine64 LTS
>>> DRAM:  2 GiB
>>> MMC:   mmc@1c0f000: 0, mmc@1c11000: 1
>>> Loading Environment from FAT... Card did not respond to voltage select!
>>> In:serial
>>> Out:   serial
>>> Err:   serial
>>> Net:   phy interface7
>>> eth0: ethernet@1c3
>>> Hit any key to stop autoboot:  0
>>>
>>> Best regards
>>>
>>> Heinrich
>>
>> This is u-boot.its created without your patches:
>>
>> /dts-v1/;
>>
>> / {
>> description = "Configuration to load ATF before U-Boot";
>> #address-cells = <1>;
>>
>> images {
>> uboot {
>> description = "U-Boot (64-bit)";
>> data = /incbin/("u-boot-nodtb.bin");
>> type = "standalone";
>> arch = "arm64";
>> compression = "none";
>> load = <0x4a00>;
>> };
>> atf {
>> description = "ARM Trusted Firmware";
>> data =
>> /incbin/("../trusted-firmware-a/build/sun50i_a64/debug/bl31.bin");
>> type = "firmware";
>> arch = "arm64";
>> compression = "none";
>> load = <0x44000>;
>> entry = <0x44000>;
>> };
>> fdt_1 {
>> description = "sun50i-a64-pine64-lts";
>> data =
>> /incbin/("arch/arm/dts/sun50i-a64-pine64-lts.dtb");
>> type = "flat_dt";
>> compression = "none";
>> };
>> };
>> configurations {
>> default = "config_1";
>>
>> config_1 {
>> description = "sun50i-a64-pine64-lts";
>> firmware = "uboot";
>> loadables = "atf";
>> fdt = "fdt_1";
>> };
>> };
>> };
>>
>> This is the itb that is created with your patches:
>>
>> /dts-v1/;
>>
>> / {
>> description = "Configuration to load ATF before U-Boot";
>> #address-cells = < 0x01 >;
>>
>> 

Re: [PATCH v1 1/1] board: ns3: check bnxt chimp handshake status

2020-08-25 Thread Simon Glass
Hi Rayagonda,

On Mon, 24 Aug 2020 at 10:35, Rayagonda Kokatanur
 wrote:
>
> Hi Simon,
>
> On Sat, Aug 22, 2020 at 8:39 PM Simon Glass  wrote:
> >
> > Hi Rayagonda,
> >
> > On Thu, 20 Aug 2020 at 11:42, Rayagonda Kokatanur
> >  wrote:
> > >
> > > Chimp is a core in Broadcom netxtream controller (bnxt).
> > > Add support to check bnxt's chimp component status.
> > >
> > > Signed-off-by: Rayagonda Kokatanur 
> > > ---
> > >  board/broadcom/bcmns3/ns3.c | 13 +
> > >  1 file changed, 13 insertions(+)
> > >
> > > diff --git a/board/broadcom/bcmns3/ns3.c b/board/broadcom/bcmns3/ns3.c
> > > index 0357cd0e32..8540c99286 100644
> > > --- a/board/broadcom/bcmns3/ns3.c
> > > +++ b/board/broadcom/bcmns3/ns3.c
> > > @@ -12,6 +12,7 @@
> > >  #include 
> > >  #include 
> > >  #include 
> > > +#include 
> > >
> > >  /* Default reset-level = 3 and strap-val = 0 */
> > >  #define L3_RESET   30
> > > @@ -210,8 +211,20 @@ void reset_cpu(ulong level)
> > >  #ifdef CONFIG_OF_BOARD_SETUP
> > >  int ft_board_setup(void *fdt, struct bd_info *bd)
> > >  {
> > > +   u32 chimp_hs = CHIMP_HANDSHAKE_WAIT_TIMEOUT;
> > > +
> > > gic_lpi_tables_init();
> > >
> > > +   /*
> > > +* Check for chimp handshake status.
> > > +* Zero timeout value will actually fall to default timeout.
> > > +*/
> > > +   chimp_handshake_status_optee(0, _hs);
> > > +   if (chimp_hs == CHIMP_HANDSHAKE_SUCCESS)
> > > +   printf("ChiMP handshake successful\n");
> > > +   else
> > > +   printf("ERROR: ChiMP handshake status 0x%x\n", chimp_hs);
> >
> > Where is this error handled? Don't you need to return the error from
> > this function?
>
> System boot is independent of chimp hand shake.
> Chimp/bnxt handshake failure is not a catastrophic error.
> We just want to warn the user that the chimp handshake has failed.

OK then I really think you need some comments here in the code. E.g.
if this fails it means x which is not critical because y...

Regards,
SImon


Re: [PATCH v3 1/1] arm: sunxi: increase SYS_MALLOC_F_LEN

2020-08-25 Thread Simon Glass
On Mon, 24 Aug 2020 at 22:15, Heinrich Schuchardt  wrote:
>
> On 7/25/20 8:18 PM, Heinrich Schuchardt wrote:
> > The current default of 0x400 for SYS_MALLOC_F_LEN is too small if any
> > additional drivers marked as DM_FLAG_PRE_RELOC are loaded before
> > relocation.
> >
> > CONFIG_RSA=y which is needed for UEFI secure boot or for FIT image
> > verification loads the driver mod_exp_sw which has DM_FLAG_PRE_RELOC.
> >
> > CONFIG_LOG=Y is another setting requiring additional early malloc
> > area, cf. log_init().
> >
> > When running pine64-lts_defconfig with CONFIG_RSA=y and debug UART enabled
> > we see as output in main U-Boot
> >
> > alloc_simple() alloc space exhausted
> >
> > With this patch the default values of SYS_MALLOC_F_LEN and
> > SPL_SYS_MALLOC_F_LEN on ARCH_SUNXI are raised to 0x2000.
> >
> > Signed-off-by: Heinrich Schuchardt 
> > Reviewed-by: Jagan Teki 
>
> With current pine64-lts_defconfig we get a warning:
>
> "alloc space exhausted"
>
> So, please, merge the patch.

Reviewed-by: Simon Glass 

>
> Best regards
>
> Heinrich


Re: [PATCH 4/7] binman: Add support for ATF BL31

2020-08-25 Thread Simon Glass
Hi Heinrich,

On Tue, 25 Aug 2020 at 04:16, Heinrich Schuchardt  wrote:
>
> On 22.08.20 04:36, Simon Glass wrote:
> > Add an entry for ARM Trusted Firmware's 'BL31' payload, which is the
> > device's main firmware. Typically this is U-Boot.
> >
> > Signed-off-by: Simon Glass 
> > ---
> >
> >  tools/binman/README.entries| 10 ++
> >  tools/binman/etype/atf_bl31.py | 20 
> >  tools/binman/ftest.py  |  9 +
> >  tools/binman/test/165_atf_bl31.dts | 16 
> >  4 files changed, 55 insertions(+)
> >  create mode 100644 tools/binman/etype/atf_bl31.py
> >  create mode 100644 tools/binman/test/165_atf_bl31.dts
> >
> > diff --git a/tools/binman/README.entries b/tools/binman/README.entries
> > index 97bfae16116..85b8ec9fa73 100644
> > --- a/tools/binman/README.entries
> > +++ b/tools/binman/README.entries
> > @@ -11,6 +11,16 @@ features to produce new behaviours.
> >
> >
> >
> > +Entry: atf-bl31: Entry containing an ARM Trusted Firmware (ATF) BL31 blob
> > +-
> > +
> > +Properties / Entry arguments:
> > +- atf-bl31-path: Filename of file to read into entry
> > +
> > +This entry holds the run-time firmware started by ATF.
>
> No, BL31 is started by U-Boot SPL on the Sunxi platform.

So perhaps I should reword this to indicate it can go either way?

>
> Best regards
>
[..]

Regards,
Simon


Re: [PATCH 0/7] binman: Add support for generating more complex FITs

2020-08-25 Thread Simon Glass
Hi Heinrich,

On Tue, 25 Aug 2020 at 04:12, Heinrich Schuchardt  wrote:
>
> On 25.08.20 06:07, Heinrich Schuchardt wrote:
> > On 8/22/20 4:36 AM, Simon Glass wrote:
> >> This series allows binman to generate FITs that include multiple DTB
> >> images and the configuration to use them.
> >>
> >> It is then possible to remove the sunxi FIT generator script, so this
> >> series handles that also.
> >>
> >> With this, sunxi is fully converted to use binman.
> >
> > I have applied this patch series and it does not work on my
> > pine64-lts_defconfig.
> >
> > Environment variable BL31 points to my bl31.bin:
> >
> > $ echo $BL31
> > ../trusted-firmware-a/build/sun50i_a64/debug/bl31.bin
> >
> > U-Boot SPL 2020.10-rc2-00147-g72293dc579 (Aug 25 2020 - 03:29:28 +)
> > DRAM: 2048 MiB
> > Trying to boot from MMC1
> > No matching DT out of these options:
> >Configuration to load ATF before U-Boot
> > No matching DT out of these options:
> >Configuration to load ATF before U-Boot
> > mmc_load_image_raw_sector: mmc block read error
> > SPL: failed to boot from all boot devices
> > ### ERROR ### Please RESET the board ###
> >
> > Without your patches U-Boot works. But CONFIG_SYS_MALLOC_F_LEN=0x400 is
> > too small. This results in a warning "alloc space exhausted". Cf.
> > https://patchwork.ozlabs.org/project/uboot/patch/20200725181851.4339-1-xypron.g...@gmx.de/
> >
> > U-Boot SPL 2020.10-rc2-00140-g1aa3966173 (Aug 25 2020 - 03:46:36 +)
> > DRAM: 2048 MiB
> > Trying to boot from MMC1
> > NOTICE:  BL31: v2.2():v2.2-1138-g78460ced4
> > NOTICE:  BL31: Built : 05:50:47, Apr  7 2020
> > NOTICE:  BL31: Detected Allwinner A64/H64/R18 SoC (1689)
> > NOTICE:  BL31: Found U-Boot DTB at 0x4092cc8, model: Pine64 LTS
> > INFO:ARM GICv2 driver initialized
> > INFO:Configuring SPC Controller
> > INFO:PMIC: Probing AXP803 on RSB
> > INFO:PMIC: dcdc1 voltage: 3.300V
> > INFO:PMIC: dcdc5 voltage: 1.200V
> > INFO:PMIC: dcdc6 voltage: 1.100V
> > INFO:PMIC: dldo1 voltage: 3.300V
> > INFO:PMIC: dldo2 voltage: 3.300V
> > INFO:PMIC: dldo4 voltage: 3.300V
> > INFO:PMIC: fldo1 voltage: 1.200V
> > INFO:PMIC: Enabling DC SW
> > INFO:BL31: Platform setup done
> > INFO:BL31: Initializing runtime services
> > INFO:BL31: cortex_a53: CPU workaround for 843419 was applied
> > INFO:BL31: cortex_a53: CPU workaround for 855873 was applied
> > NOTICE:  PSCI: System suspend is unavailable
> > INFO:BL31: Preparing for EL3 exit to normal world
> > INFO:Entry point address = 0x4a00
> > INFO:SPSR = 0x3c9
> > alloc space exhausted
> >
> >
> > U-Boot 2020.10-rc2-00140-g1aa3966173 (Aug 25 2020 - 03:46:36 +)
> > Allwinner Technology
> >
> > CPU:   Allwinner A64 (SUN50I)
> > Model: Pine64 LTS
> > DRAM:  2 GiB
> > MMC:   mmc@1c0f000: 0, mmc@1c11000: 1
> > Loading Environment from FAT... Card did not respond to voltage select!
> > In:serial
> > Out:   serial
> > Err:   serial
> > Net:   phy interface7
> > eth0: ethernet@1c3
> > Hit any key to stop autoboot:  0
> >
> > Best regards
> >
> > Heinrich
>
> This is u-boot.its created without your patches:
>
> /dts-v1/;
>
> / {
> description = "Configuration to load ATF before U-Boot";
> #address-cells = <1>;
>
> images {
> uboot {
> description = "U-Boot (64-bit)";
> data = /incbin/("u-boot-nodtb.bin");
> type = "standalone";
> arch = "arm64";
> compression = "none";
> load = <0x4a00>;
> };
> atf {
> description = "ARM Trusted Firmware";
> data =
> /incbin/("../trusted-firmware-a/build/sun50i_a64/debug/bl31.bin");
> type = "firmware";
> arch = "arm64";
> compression = "none";
> load = <0x44000>;
> entry = <0x44000>;
> };
> fdt_1 {
> description = "sun50i-a64-pine64-lts";
> data =
> /incbin/("arch/arm/dts/sun50i-a64-pine64-lts.dtb");
> type = "flat_dt";
> compression = "none";
> };
> };
> configurations {
> default = "config_1";
>
> config_1 {
> description = "sun50i-a64-pine64-lts";
> firmware = "uboot";
> loadables = "atf";
> fdt = "fdt_1";
> };
> };
> };
>
> This is the itb that is created with your patches:
>
> /dts-v1/;
>
> / {
> description = "Configuration to load ATF before U-Boot";
> #address-cells = < 0x01 >;
>
> images {
>
> uboot {
> data = < 0x1f000 ...
>  

Re: [PATCH v4 20/27] Makefile: Warn against using CONFIG_SPL_FIT_GENERATOR

2020-08-25 Thread Simon Glass
Hi Michal,

On Tue, 25 Aug 2020 at 09:13, Michal Simek  wrote:
>
> Hi Simon,
>
> On 25. 08. 20 17:04, Simon Glass wrote:
> > Hi Michal,
> >
> > On Mon, 24 Aug 2020 at 08:12, Michal Simek  wrote:
> >>
> >> Hi Simon,
> >>
> >> On 22. 08. 20 17:08, Simon Glass wrote:
> >>> Hi Michal,
> >>>
> >>> On Mon, 17 Aug 2020 at 00:49, Michal Simek  
> >>> wrote:
> 
>  Hi Simon,
> 
>  On 16. 08. 20 5:39, Simon Glass wrote:
> > Hi Michal,
> >
> > On Fri, 14 Aug 2020 at 07:28, Michal Simek  wrote:
> >>
> >> Hi Simon,
> >>
> >> ne 19. 7. 2020 v 22:06 odesílatel Simon Glass  
> >> napsal:
> >>>
> >>> This option is used to run arch-specific shell scripts which produce 
> >>> .its
> >>> files which are used to produce FIT images. We already have binman 
> >>> which
> >>> is designed to produce firmware images. It is more powerful and has 
> >>> tests.
> >>>
> >>> So this option should be deprecated and not used. Existing uses 
> >>> should be
> >>> migrated.
> >>>
> >>> Mentions of this in code reviews over the last year or so do not seem 
> >>> to
> >>> have resulted in action, and things are getting worse.
> >>>
> >>> So let's add a warning.
> >>>
> >>> Signed-off-by: Simon Glass 
> >>> Reviewed-by: Bin Meng 
> >>> ---
> >>>
> >>> (no changes since v1)
> >>>
> >>>  Makefile | 9 +
> >>>  1 file changed, 9 insertions(+)
> >>>
> >>> diff --git a/Makefile b/Makefile
> >>> index f1b5be1882..d73c10a973 100644
> >>> --- a/Makefile
> >>> +++ b/Makefile
> >>> @@ -1148,6 +1148,13 @@ ifneq ($(CONFIG_DM_ETH),y)
> >>> @echo >&2 "See doc/driver-model/migration.rst for more info."
> >>> @echo >&2 
> >>> ""
> >>>  endif
> >>> +endif
> >>> +ifneq ($(CONFIG_SPL_FIT_GENERATOR),)
> >>> +   @echo >&2 "= WARNING 
> >>> =="
> >>> +   @echo >&2 "This board uses CONFIG_SPL_FIT_GENERATOR. Please 
> >>> migrate"
> >>> +   @echo >&2 "to binman instead, to avoid the proliferation of"
> >>> +   @echo >&2 "arch-specific scripts with no tests."
> >>> +   @echo >&2 
> >>> ""
> >>>  endif
> >>> @# Check that this build does not use CONFIG options that we 
> >>> do not
> >>> @# know about unless they are in Kconfig. All the existing 
> >>> CONFIG
> >>> @@ -1345,6 +1352,8 @@ endif
> >>>
> >>>  # Boards with more complex image requirements can provide an .its 
> >>> source file
> >>>  # or a generator script
> >>> +# NOTE: Please do not use this. We are migrating away from Makefile 
> >>> rules to use
> >>> +# binman instead.
> >>>  ifneq ($(CONFIG_SPL_FIT_SOURCE),"")
> >>>  U_BOOT_ITS := u-boot.its
> >>>  $(U_BOOT_ITS): $(subst ",,$(CONFIG_SPL_FIT_SOURCE))
> >>> --
> >>> 2.28.0.rc0.105.gf9edc3c819-goog
> >>>
> >>
> >> I just got to this conversion and I am curious how that transition
> >> should look like.
> >> I found how FIT image is created which is fine but I didn't find any
> >> reference on how to generate images based on CONFIG_OF_LIST.
> >> If you look at arch/arm/mach-zynqmp/mkimage_fit_atf.sh you will see
> >> that I loop over this entry and create multiple DT nodes and the same
> >> amount of configurations to cover it. Is this supported by binman?
> >> If yes, what's the syntax for it?
> >
> > The easiest way is probably to create a new entry type, like zynq-fit.
> > Then you can generate the DT using the sequence writer functions. See
> > _ReadSubNodes() in fit.py for an example.
> >
> > You can perhaps have a template subnode and use that in a for loop to
> > generate the nodes.
> >
> >>
> >> I tried several configurations and we can use that for generating qspi
> >> images and also images with different configurations to have them
> >> ready
> >> but first I need to be able to handle the case above.
> >
> > I was thinking of converting sunxi which has the same need, but it
> > sounds like you are on the case. Let me know if you need help.
> 
>  Nope. I just saw that message and started to play with it to find out
>  what needs to be done and how this fits to bigger picture. If this
>  doesn't work directly then the work needs to be planned which will take
>  time especially when this utility is new for us and we could have issues
>  with writing code in python. Would be good if you can do the first shot
>  because you know this utility and I am more than happy to test it, try
>  and adopt if needed for our case.
> 
>  Sunxi is very similar case as is zynqmp. Difference is they hardcode
>  default 

[PATCH] efi_loader: log function in image loader

2020-08-25 Thread Heinrich Schuchardt
Use log_err() for error messages.
Replace debug() by EFI_PRINT().

Signed-off-by: Heinrich Schuchardt 
---
 lib/efi_loader/efi_image_loader.c | 44 +++
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/lib/efi_loader/efi_image_loader.c 
b/lib/efi_loader/efi_image_loader.c
index eea42cc204..da50fc31f1 100644
--- a/lib/efi_loader/efi_image_loader.c
+++ b/lib/efi_loader/efi_image_loader.c
@@ -7,9 +7,12 @@
  *  Copyright (c) 2016 Alexander Graf
  */

+#define LOG_CATEGORY LOGC_EFI
+
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -153,14 +156,14 @@ static efi_status_t efi_loader_relocate(const 
IMAGE_BASE_RELOCATION *rel,
case IMAGE_REL_BASED_RISCV_LOW12S:
/* We know that we're 4k aligned */
if (delta & 0xfff) {
-   printf("Unsupported reloc offset\n");
+   log_err("Unsupported reloc offset\n");
return EFI_LOAD_ERROR;
}
break;
 #endif
default:
-   printf("Unknown Relocation off %x type %x\n",
-  offset, type);
+   log_err("Unknown Relocation off %x type %x\n",
+   offset, type);
return EFI_LOAD_ERROR;
}
relocs++;
@@ -202,7 +205,7 @@ static void efi_set_code_and_data_type(
loaded_image_info->image_data_type = EFI_RUNTIME_SERVICES_DATA;
break;
default:
-   printf("%s: invalid image type: %u\n", __func__, image_type);
+   log_err("invalid image type: %u\n", image_type);
/* Let's assume it is an application */
loaded_image_info->image_code_type = EFI_LOADER_CODE;
loaded_image_info->image_data_type = EFI_LOADER_DATA;
@@ -499,7 +502,7 @@ static bool efi_image_authenticate(void *efi, size_t 
efi_size)
size_t new_efi_size, auth_size;
bool ret = false;

-   debug("%s: Enter, %d\n", __func__, ret);
+   EFI_PRINT("%s: Enter, %d\n", __func__, ret);

if (!efi_secure_boot_enabled())
return true;
@@ -645,14 +648,14 @@ static bool efi_image_authenticate(void *efi, size_t 
efi_size)
break;
}

-   debug("Signature was not verified by \"db\"\n");
+   EFI_PRINT("Signature was not verified by \"db\"\n");

if (efi_signature_lookup_digest(regs, db)) {
ret = true;
break;
}

-   debug("Image's digest was not found in \"db\" or \"dbx\"\n");
+   EFI_PRINT("Image's digest was not found in \"db\" or 
\"dbx\"\n");
}

 err:
@@ -662,7 +665,7 @@ err:
free(regs);
free(new_efi);

-   debug("%s: Exit, %d\n", __func__, ret);
+   EFI_PRINT("%s: Exit, %d\n", __func__, ret);
return ret;
 }
 #else
@@ -704,14 +707,14 @@ efi_status_t efi_load_pe(struct efi_loaded_image_obj 
*handle,

/* Sanity check for a file header */
if (efi_size < sizeof(*dos)) {
-   printf("%s: Truncated DOS Header\n", __func__);
+   log_err("Truncated DOS Header\n");
ret = EFI_LOAD_ERROR;
goto err;
}

dos = efi;
if (dos->e_magic != IMAGE_DOS_SIGNATURE) {
-   printf("%s: Invalid DOS Signature\n", __func__);
+   log_err("Invalid DOS Signature\n");
ret = EFI_LOAD_ERROR;
goto err;
}
@@ -722,14 +725,14 @@ efi_status_t efi_load_pe(struct efi_loaded_image_obj 
*handle,
 * of the 64bit header which is longer than the 32bit header.
 */
if (efi_size < dos->e_lfanew + sizeof(IMAGE_NT_HEADERS64)) {
-   printf("%s: Invalid offset for Extended Header\n", __func__);
+   log_err("Invalid offset for Extended Header\n");
ret = EFI_LOAD_ERROR;
goto err;
}

nt = (void *) ((char *)efi + dos->e_lfanew);
if (nt->Signature != IMAGE_NT_SIGNATURE) {
-   printf("%s: Invalid NT Signature\n", __func__);
+   log_err("Invalid NT Signature\n");
ret = EFI_LOAD_ERROR;
goto err;
}
@@ -741,8 +744,8 @@ efi_status_t efi_load_pe(struct efi_loaded_image_obj 
*handle,
}

if (!supported) {
-   printf("%s: Machine type 0x%04x is not supported\n",
-  __func__, nt->FileHeader.Machine);
+   log_err("Machine type 0x%04x is not supported\n",
+   nt->FileHeader.Machine);
ret = 

[PATCH 1/1] fs: convert error and debug messages to log

2020-08-25 Thread Heinrich Schuchardt
Use log functions for error and debug messages of the file-system.

Signed-off-by: Heinrich Schuchardt 
---
 fs/fs.c  | 16 +---
 fs/fs_internal.c | 16 +---
 2 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/fs/fs.c b/fs/fs.c
index 17e4bc33f7..29ad4d1a69 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -3,6 +3,8 @@
  * Copyright (c) 2012, NVIDIA CORPORATION.  All rights reserved.
  */

+#define LOG_CATEGORY LOGC_CORE
+
 #include 
 #include 
 #include 
@@ -34,7 +36,7 @@ static int fs_type = FS_TYPE_ANY;
 static inline int fs_probe_unsupported(struct blk_desc *fs_dev_desc,
  struct disk_partition *fs_partition)
 {
-   printf("** Unrecognized filesystem type **\n");
+   log_err("** Unrecognized filesystem type **\n");
return -1;
 }

@@ -508,7 +510,7 @@ static int fs_read_lmb_check(const char *filename, ulong 
addr, loff_t offset,
if (lmb_alloc_addr(, addr, read_len) == addr)
return 0;

-   printf("** Reading file would overwrite reserved memory **\n");
+   log_err("** Reading file would overwrite reserved memory **\n");
return -ENOSPC;
 }
 #endif
@@ -538,7 +540,7 @@ static int _fs_read(const char *filename, ulong addr, 
loff_t offset, loff_t len,

/* If we requested a specific number of bytes, check we got it */
if (ret == 0 && len && *actread != len)
-   debug("** %s shorter than offset + len **\n", filename);
+   log_debug("** %s shorter than offset + len **\n", filename);
fs_close();

return ret;
@@ -562,7 +564,7 @@ int fs_write(const char *filename, ulong addr, loff_t 
offset, loff_t len,
unmap_sysmem(buf);

if (ret < 0 && len != *actwrite) {
-   printf("** Unable to write file %s **\n", filename);
+   log_err("** Unable to write file %s **\n", filename);
ret = -1;
}
fs_close();
@@ -656,7 +658,7 @@ int fs_ln(const char *fname, const char *target)
ret = info->ln(fname, target);

if (ret < 0) {
-   printf("** Unable to create link %s -> %s **\n", fname, target);
+   log_err("** Unable to create link %s -> %s **\n", fname, 
target);
ret = -1;
}
fs_close();
@@ -737,7 +739,7 @@ int do_load(struct cmd_tbl *cmdtp, int flag, int argc, char 
*const argv[],
ret = _fs_read(filename, addr, pos, bytes, 1, _read);
time = get_timer(time);
if (ret < 0) {
-   printf("Failed to load '%s'\n", filename);
+   log_err("Failed to load '%s'\n", filename);
return 1;
}

@@ -902,7 +904,7 @@ int do_mkdir(struct cmd_tbl *cmdtp, int flag, int argc, 
char *const argv[],

ret = fs_mkdir(argv[3]);
if (ret) {
-   printf("** Unable to create a directory \"%s\" **\n", argv[3]);
+   log_err("** Unable to create a directory \"%s\" **\n", argv[3]);
return 1;
}

diff --git a/fs/fs_internal.c b/fs/fs_internal.c
index 8b19811a63..bfc35c996c 100644
--- a/fs/fs_internal.c
+++ b/fs/fs_internal.c
@@ -5,6 +5,8 @@
  * Derived from code in ext4/dev.c, which was based on reiserfs/dev.c
  */

+#define LOG_CATEGORY LOGC_CORE
+
 #include 
 #include 
 #include 
@@ -19,7 +21,7 @@ int fs_devread(struct blk_desc *blk, struct disk_partition 
*partition,
int log2blksz;
ALLOC_CACHE_ALIGN_BUFFER(char, sec_buf, (blk ? blk->blksz : 0));
if (blk == NULL) {
-   printf("** Invalid Block Device Descriptor (NULL)\n");
+   log_err("** Invalid Block Device Descriptor (NULL)\n");
return 0;
}
log2blksz = blk->log2blksz;
@@ -27,8 +29,8 @@ int fs_devread(struct blk_desc *blk, struct disk_partition 
*partition,
/* Check partition boundaries */
if ((sector + ((byte_offset + byte_len - 1) >> log2blksz))
>= partition->size) {
-   printf("%s read outside partition " LBAFU "\n", __func__,
-  sector);
+   log_err("%s read outside partition " LBAFU "\n", __func__,
+   sector);
return 0;
}

@@ -36,14 +38,14 @@ int fs_devread(struct blk_desc *blk, struct disk_partition 
*partition,
sector += byte_offset >> log2blksz;
byte_offset &= blk->blksz - 1;

-   debug(" <" LBAFU ", %d, %d>\n", sector, byte_offset, byte_len);
+   log_debug(" <" LBAFU ", %d, %d>\n", sector, byte_offset, byte_len);

if (byte_offset != 0) {
int readlen;
/* read first part which isn't aligned with start of sector */
if (blk_dread(blk, partition->start + sector, 1,
  (void *)sec_buf) != 1) {
-   printf(" ** %s read error **\n", __func__);
+   log_err(" ** %s read error **\n", __func__);
return 0;

[PATCH v2] scripts/setlocalversion: sync with linux 5.8

2020-08-25 Thread Rasmus Villemoes
The linux changes since v3.16 are

78283edf2c01 kbuild: setlocalversion: print error to STDERR
b24413180f56 License cleanup: add SPDX GPL-2.0 license identifier to files with 
no license
6147b1cf1965 scripts/setlocalversion: git: Make -dirty check more robust
8ef14c2c41d9 Revert "scripts/setlocalversion: git: Make -dirty check more 
robust"
ff64dd485730 scripts/setlocalversion: Improve -dirty check with git-status 
--no-optional-locks
7a82e3fa28f1 scripts/setlocalversion: clear local variable to make it work for 
sh
991b78fbd223 scripts: setlocalversion: fix a bashism
3c96bdd0ebfa scripts: setlocalversion: replace backquote to dollar parenthesis

and it's ff64dd485730 that is the motivation for this sync. It fixes
false positive "-dirty" added to the version string when building with
Yocto
(https://lists.openembedded.org/g/openembedded-core/message/137702).

There has been one U-Boot specific patch since this was synced with
linux 3.16: 81630a3b38c2 (scripts: setlocalversion: safely extract
variables from auto.conf using awk). However, it seems that since
a356e7a86b (spl: Kconfig: Escape '$(ARCH)' in LDSCRIPT entries),
auto.conf doesn't contain the $(ARCH) string but instead the actual
value of ARCH.

So for now, use the linux version as-is; it should be fairly obvious
if 81630a3b38c2 or something like it does need to be applied on top.

Signed-off-by: Rasmus Villemoes 
---
 scripts/setlocalversion | 45 +++--
 1 file changed, 25 insertions(+), 20 deletions(-)

diff --git a/scripts/setlocalversion b/scripts/setlocalversion
index 8564bedd1a..20f2efd57b 100755
--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -1,4 +1,5 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
 #
 # This scripts adds local version information from the version
 # control systems git, mercurial (hg) and subversion (svn).
@@ -44,11 +45,11 @@ scm_version()
 
# Check for git and a git repo.
if test -z "$(git rev-parse --show-cdup 2>/dev/null)" &&
-  head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
+  head=$(git rev-parse --verify --short HEAD 2>/dev/null); then
 
# If we are at a tagged commit (like "v2.6.30-rc6"), we ignore
# it, because this version is defined in the top level Makefile.
-   if [ -z "`git describe --exact-match 2>/dev/null`" ]; then
+   if [ -z "$(git describe --exact-match 2>/dev/null)" ]; then
 
# If only the short version is requested, don't bother
# running further git commands
@@ -58,7 +59,7 @@ scm_version()
fi
# If we are past a tagged commit (like
# "v2.6.30-rc5-302-g72357d5"), we pretty print it.
-   if atag="`git describe 2>/dev/null`"; then
+   if atag="$(git describe 2>/dev/null)"; then
echo "$atag" | awk -F- '{printf("-%05d-%s", 
$(NF-1),$(NF))}'
 
# If we don't have a tag at all we print -g{commitish}.
@@ -69,11 +70,19 @@ scm_version()
 
# Is this git on svn?
if git config --get svn-remote.svn.url >/dev/null; then
-   printf -- '-svn%s' "`git svn find-rev $head`"
+   printf -- '-svn%s' "$(git svn find-rev $head)"
fi
 
-   # Check for uncommitted changes
-   if git diff-index --name-only HEAD | grep -qv 
"^scripts/package"; then
+   # Check for uncommitted changes.
+   # First, with git-status, but --no-optional-locks is only
+   # supported in git >= 2.14, so fall back to git-diff-index if
+   # it fails. Note that git-diff-index does not refresh the
+   # index, so it may give misleading results. See
+   # git-update-index(1), git-diff-index(1), and git-status(1).
+   if {
+   git --no-optional-locks status -uno --porcelain 
2>/dev/null ||
+   git diff-index --name-only HEAD
+   } | grep -qvE '^(.. )?scripts/package'; then
printf '%s' -dirty
fi
 
@@ -82,15 +91,15 @@ scm_version()
fi
 
# Check for mercurial and a mercurial repo.
-   if test -d .hg && hgid=`hg id 2>/dev/null`; then
+   if test -d .hg && hgid=$(hg id 2>/dev/null); then
# Do we have an tagged version?  If so, latesttagdistance == 1
-   if [ "`hg log -r . --template '{latesttagdistance}'`" == "1" ]; 
then
-   id=`hg log -r . --template '{latesttag}'`
+   if [ "$(hg log -r . --template '{latesttagdistance}')" = "1" ]; 
then
+   id=$(hg log -r . --template '{latesttag}')
printf '%s%s' -hg "$id"
else
-   tag=`printf '%s' "$hgid" | cut -d' ' -f2`
+ 

Re: [PATCH v4 20/27] Makefile: Warn against using CONFIG_SPL_FIT_GENERATOR

2020-08-25 Thread Michal Simek
Hi Simon,

On 25. 08. 20 17:04, Simon Glass wrote:
> Hi Michal,
> 
> On Mon, 24 Aug 2020 at 08:12, Michal Simek  wrote:
>>
>> Hi Simon,
>>
>> On 22. 08. 20 17:08, Simon Glass wrote:
>>> Hi Michal,
>>>
>>> On Mon, 17 Aug 2020 at 00:49, Michal Simek  wrote:

 Hi Simon,

 On 16. 08. 20 5:39, Simon Glass wrote:
> Hi Michal,
>
> On Fri, 14 Aug 2020 at 07:28, Michal Simek  wrote:
>>
>> Hi Simon,
>>
>> ne 19. 7. 2020 v 22:06 odesílatel Simon Glass  napsal:
>>>
>>> This option is used to run arch-specific shell scripts which produce 
>>> .its
>>> files which are used to produce FIT images. We already have binman which
>>> is designed to produce firmware images. It is more powerful and has 
>>> tests.
>>>
>>> So this option should be deprecated and not used. Existing uses should 
>>> be
>>> migrated.
>>>
>>> Mentions of this in code reviews over the last year or so do not seem to
>>> have resulted in action, and things are getting worse.
>>>
>>> So let's add a warning.
>>>
>>> Signed-off-by: Simon Glass 
>>> Reviewed-by: Bin Meng 
>>> ---
>>>
>>> (no changes since v1)
>>>
>>>  Makefile | 9 +
>>>  1 file changed, 9 insertions(+)
>>>
>>> diff --git a/Makefile b/Makefile
>>> index f1b5be1882..d73c10a973 100644
>>> --- a/Makefile
>>> +++ b/Makefile
>>> @@ -1148,6 +1148,13 @@ ifneq ($(CONFIG_DM_ETH),y)
>>> @echo >&2 "See doc/driver-model/migration.rst for more info."
>>> @echo >&2 ""
>>>  endif
>>> +endif
>>> +ifneq ($(CONFIG_SPL_FIT_GENERATOR),)
>>> +   @echo >&2 "= WARNING =="
>>> +   @echo >&2 "This board uses CONFIG_SPL_FIT_GENERATOR. Please 
>>> migrate"
>>> +   @echo >&2 "to binman instead, to avoid the proliferation of"
>>> +   @echo >&2 "arch-specific scripts with no tests."
>>> +   @echo >&2 ""
>>>  endif
>>> @# Check that this build does not use CONFIG options that we do 
>>> not
>>> @# know about unless they are in Kconfig. All the existing 
>>> CONFIG
>>> @@ -1345,6 +1352,8 @@ endif
>>>
>>>  # Boards with more complex image requirements can provide an .its 
>>> source file
>>>  # or a generator script
>>> +# NOTE: Please do not use this. We are migrating away from Makefile 
>>> rules to use
>>> +# binman instead.
>>>  ifneq ($(CONFIG_SPL_FIT_SOURCE),"")
>>>  U_BOOT_ITS := u-boot.its
>>>  $(U_BOOT_ITS): $(subst ",,$(CONFIG_SPL_FIT_SOURCE))
>>> --
>>> 2.28.0.rc0.105.gf9edc3c819-goog
>>>
>>
>> I just got to this conversion and I am curious how that transition
>> should look like.
>> I found how FIT image is created which is fine but I didn't find any
>> reference on how to generate images based on CONFIG_OF_LIST.
>> If you look at arch/arm/mach-zynqmp/mkimage_fit_atf.sh you will see
>> that I loop over this entry and create multiple DT nodes and the same
>> amount of configurations to cover it. Is this supported by binman?
>> If yes, what's the syntax for it?
>
> The easiest way is probably to create a new entry type, like zynq-fit.
> Then you can generate the DT using the sequence writer functions. See
> _ReadSubNodes() in fit.py for an example.
>
> You can perhaps have a template subnode and use that in a for loop to
> generate the nodes.
>
>>
>> I tried several configurations and we can use that for generating qspi
>> images and also images with different configurations to have them
>> ready
>> but first I need to be able to handle the case above.
>
> I was thinking of converting sunxi which has the same need, but it
> sounds like you are on the case. Let me know if you need help.

 Nope. I just saw that message and started to play with it to find out
 what needs to be done and how this fits to bigger picture. If this
 doesn't work directly then the work needs to be planned which will take
 time especially when this utility is new for us and we could have issues
 with writing code in python. Would be good if you can do the first shot
 because you know this utility and I am more than happy to test it, try
 and adopt if needed for our case.

 Sunxi is very similar case as is zynqmp. Difference is they hardcode
 default configuration to config_1. ZynqMP is setting up default based on
 default DT configured at that time.

 In connection to binman I see that there would be a need to generate
 images with ATF and without ATF in configuration node and with different
 default configuration. There could be also a need to add additional
 loadable entry such as bitstreams.

Re: [PATCH v1 06/24] pci: pci-uclass: Add multi entry support for memory regions

2020-08-25 Thread Tom Rini
On Tue, Aug 25, 2020 at 09:04:26AM -0600, Simon Glass wrote:
> Hi,
> 
> On Mon, 24 Aug 2020 at 07:09, Tom Rini  wrote:
> >
> > On Mon, Aug 24, 2020 at 09:36:13AM +0200, Stefan Roese wrote:
> > > Hi Tom,
> > >
> > > On 23.08.20 16:03, Tom Rini wrote:
> > > > On Sun, Aug 23, 2020 at 11:41:41AM +0200, Stefan Roese wrote:
> > > > > Hi Simon,
> > > > > Hi Tom,
> > > > >
> > > > > On 22.08.20 17:09, Simon Glass wrote:
> > > > > > Hi Stefan,
> > > > > >
> > > > > > On Fri, 14 Aug 2020 at 05:40, Stefan Roese  wrote:
> > > > > > >
> > > > > > > Hi Simon,
> > > > > > >
> > > > > > > On 04.08.20 17:05, Simon Glass wrote:
> > > > > > >
> > > > > > > 
> > > > > > >
> > > > > > > > > > > > > Changes in v1:
> > > > > > > > > > > > > - Change patch subject
> > > > > > > > > > > > > - Enhance Kconfig help descrition
> > > > > > > > > > > > > - Use if() instead of #if
> > > > > > > > > > > > >
> > > > > > > > > > > > >   drivers/pci/Kconfig  | 10 ++
> > > > > > > > > > > > >   drivers/pci/pci-uclass.c |  9 ++---
> > > > > > > > > > > > >   2 files changed, 16 insertions(+), 3 
> > > > > > > > > > > > > deletions(-)
> > > > > > > > > > > >
> > > > > > > > > > > > This needs an update to a sandbox test to handle this 
> > > > > > > > > > > > behaviour.
> > > > > > > > > > >
> > > > > > > > > > > Okay. But how should I handle all these defconfig changes 
> > > > > > > > > > > with regard
> > > > > > > > > > > to the other patches in this series, introducing multiple 
> > > > > > > > > > > new PCI
> > > > > > > > > > > related Kconfig options. With 3 new Kconfig options, all 
> > > > > > > > > > > permutations
> > > > > > > > > > > would lead to 8 (2 ^ 3) different defconfig files. This 
> > > > > > > > > > > does not
> > > > > > > > > > > scale.
> > > > > > > > > > >
> > > > > > > > > > > I might be missing something here though - perhaps this 
> > > > > > > > > > > is easier to
> > > > > > > > > > > achieve.
> > > > > > > > > >
> > > > > > > > > > For sandbox, turn on all options and then add a new PCI bus 
> > > > > > > > > > that uses
> > > > > > > > > > this functionality. If there are lots of combinations you 
> > > > > > > > > > could add 8
> > > > > > > > > > new buses, but I'm hoping that isn't necessary?
> > > > > > > > >
> > > > > > > > > If I turn on all new options, sandbox will run with these new 
> > > > > > > > > options
> > > > > > > > > enabled. I don't know with with implications, as it usually 
> > > > > > > > > runs with
> > > > > > > > > the "normal" PCI related Kconfig options. Also the "normal" 
> > > > > > > > > PCI
> > > > > > > > > defconfig (e.g. CONFIG_PCI_REGION_MULTI_ENTRY etc disabled) 
> > > > > > > > > will not
> > > > > > > > > be tested any more via the sandbox tests. So you get either a 
> > > > > > > > > test for
> > > > > > > > > the new Kconfig option enabled or disabled this way.
> > > > > > > > >
> > > > > > > > > Do you really want me to do this?
> > > > > > > >
> > > > > > > > So the Kconfig completely changes the implementation of PCI? 
> > > > > > > > That
> > > > > > > > doesn't make it very testable, as you say.
> > > > > > > >
> > > > > > > > Instead, I think the Kconfig should enable the option, then use 
> > > > > > > > one of
> > > > > > > > three ways to select the option:
> > > > > > > >
> > > > > > > > - a device tree property (on sandbox particularly)
> > > > > > > > - compatible string (where the property is not appropriate
> > > > > > > > - setting a flag in PCI bus (where a driver requires the option 
> > > > > > > > be selected)
> > > > > > > >
> > > > > > > > That way you can write a test for the new feature in sandbox, 
> > > > > > > > without
> > > > > > > > deleting all the other tests.
> > > > > > >
> > > > > > > Coming back to this issue after some time - sorry for the delay.
> > > > > > >
> > > > > > > I'm not sure, if I understand this correctly. Do you suggest that 
> > > > > > > the
> > > > > > > driver code (in this case pci-uclass.c) should be extended to 
> > > > > > > support
> > > > > > > this (sandbox) testing support?
> > > > > >
> > > > > > Not really. I see these things as features that drivers can enable /
> > > > > > disable depending on their needs. If that is correct, then sandbox 
> > > > > > is
> > > > > > no different form other drivers, except that perhaps it might 
> > > > > > support
> > > > > > all combinations rather than just one.
> > > > > >
> > > > > > >
> > > > > > > If yes, I really think that this is counterproductive. As we 
> > > > > > > added (at
> > > > > > > least some of) the Kconfig options explicitly, to not add code to
> > > > > > > pci-uclass.c in the "normal case". So adding code to e.g. check a 
> > > > > > > device
> > > > > > > tree property or a compatible string would increase the code size 
> > > > > > > again.
> > > > > >
> > > > > > How about some flags in struct pci_controller?
> > > > > >
> > > > > > >
> > > > > > > If not, I'm still unsure how you would like to test the "normal 
> > 

Re: [PATCH 1/1] dm: syscon: typo alerady

2020-08-25 Thread Simon Glass
On Fri, 21 Aug 2020 at 23:16, Heinrich Schuchardt  wrote:
>
> * Fix typo: %s/alerady/already/.
> * Add missing 'the'.
> * Reformat a comment.
>
> Signed-off-by: Heinrich Schuchardt 
> ---
>  drivers/core/syscon-uclass.c | 10 +++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>

Reviewed-by: Simon Glass 


> diff --git a/drivers/core/syscon-uclass.c b/drivers/core/syscon-uclass.c
> index b5cd763b6b..9cbda4ebda 100644
> --- a/drivers/core/syscon-uclass.c
> +++ b/drivers/core/syscon-uclass.c
> @@ -18,12 +18,16 @@
>
>  /*
>   * Caution:
> - * This API requires the given device has alerady been bound to syscon 
> driver.
> - * For example,
> + * This API requires the given device has already been bound to the syscon
> + * driver. For example,
> + *
>   *compatible = "syscon", "simple-mfd";
> + *
>   * works, but
> + *
>   *compatible = "simple-mfd", "syscon";
> - * does not.  The behavior is different from Linux.
> + *
> + * does not. The behavior is different from Linux.
>   */
>  struct regmap *syscon_get_regmap(struct udevice *dev)
>  {
> --
> 2.28.0
>


Re: [PATCH] cmd: mem: Remove already removed CONFIG_SYS_MEMTEST_SCRATCH

2020-08-25 Thread Simon Glass
On Mon, 24 Aug 2020 at 05:17, Michal Simek  wrote:
>
> The commit e519f03a1846 ("cmd: mem: Remove CONFIG_SYS_MEMTEST_SCRATCH
> mapping") removed CONFIG_SYS_MEMTEST_SCRATCH but commit 091401131085
> ("command: Remove the cmd_tbl_t typedef") has added it back. That's why
> symbol is still in the tree that's why remove it again.
>
> Fixes: 091401131085 ("command: Remove the cmd_tbl_t typedef
> Signed-off-by: Michal Simek 
> ---
>
>  cmd/mem.c | 4 
>  1 file changed, 4 deletions(-)

Reviewed-by: Simon Glass 


Re: [PATCH] xilinx: drivers: Use '_' instead of '-' in driver name

2020-08-25 Thread Simon Glass
On Mon, 24 Aug 2020 at 06:15, Michal Simek  wrote:
>
> The most of drivers are using '_' instead of '-' in driver name. That's why
> sync up these names to be aligned. It looks quite bad to see both in use.
> It is visible via dm tree command.
>
> Signed-off-by: Michal Simek 
> ---
>
> Simon: Not sure what's the standard here but I have done some greps and it
> looks like that most of drivers are using _ instead of -.
> ---
>  drivers/clk/clk_zynqmp.c   | 2 +-
>  drivers/firmware/firmware-zynqmp.c | 2 +-
>  drivers/i2c/i2c-cdns.c | 2 +-
>  drivers/mailbox/zynqmp-ipi.c   | 2 +-
>  drivers/mtd/nand/raw/arasan_nfc.c  | 2 +-
>  drivers/mtd/nand/raw/zynq_nand.c   | 2 +-
>  6 files changed, 6 insertions(+), 6 deletions(-)

Reviewed-by: Simon Glass 

Bonus points if you can update checkpatch.pl to catch it


Re: [PATCH v2 1/4] firmware: add new driver for SCMI firmwares

2020-08-25 Thread Simon Glass
Hi Etienne,

On Sun, 23 Aug 2020 at 11:07, Etienne Carriere
 wrote:
>
> Hello Simon,
>
> > > This change introduces SCMI agent driver in U-Boot in the firmware
> > > U-class.
> > > (...)
> > > Changes in v2:
> > > (...)
> > >
> > > Note: review comments on defining a uclass and sandbox for SCMI
> > > transport drivers are NOT addressed in this v2. Main issue is that
> > > there is no driver/device defined for SCMI transport layer as well as
> > > and no defined compatible ID in the SCMI DT bindings documentation.
> >
> > I'd still like to see this. You can define an API with a header file.
> > It is certainly easier if the DT binding can cover the transport type
> > with a separate subnode.
>
> The bindings are already defined for scmi (ref is the Linux kernel
> source tree) and there is no sub-node currently defined for the
> scmi driver transport configuration. It's done through the
> compatible property and dedicated optional properties.
> I think changing the scmi DT binding is a bit out of the scope
> of my patch series :)

Fair enough. The bindings are pretty linux-specific of course, since
that is the only user. In general it seems hard to change them for
U-Boot although I haven't tried in years.

>
> > But that doesn't stop you creating a uclass
> > for the transport. It will also allow you to create a sandbox impl so
> > you can add a test for this code.
>
> Ok, thanks, I understand.
>
> >
> > Also the two interfaces should really be in separate files rather than
> > using #ifdefs, I think.
>
> I'll send a v3 with the implementation over several source files and
> the requested uclass/sandbox.
> I think I'll create sub-directory drivers/firmware/scmi/ for the source files.

I think that's a good idea.
>
> Thanks again for the feedback on this v2.

You're welcome.

Regards,
Simon


Re: [PATCH v1 06/24] pci: pci-uclass: Add multi entry support for memory regions

2020-08-25 Thread Simon Glass
Hi,

On Mon, 24 Aug 2020 at 07:09, Tom Rini  wrote:
>
> On Mon, Aug 24, 2020 at 09:36:13AM +0200, Stefan Roese wrote:
> > Hi Tom,
> >
> > On 23.08.20 16:03, Tom Rini wrote:
> > > On Sun, Aug 23, 2020 at 11:41:41AM +0200, Stefan Roese wrote:
> > > > Hi Simon,
> > > > Hi Tom,
> > > >
> > > > On 22.08.20 17:09, Simon Glass wrote:
> > > > > Hi Stefan,
> > > > >
> > > > > On Fri, 14 Aug 2020 at 05:40, Stefan Roese  wrote:
> > > > > >
> > > > > > Hi Simon,
> > > > > >
> > > > > > On 04.08.20 17:05, Simon Glass wrote:
> > > > > >
> > > > > > 
> > > > > >
> > > > > > > > > > > > Changes in v1:
> > > > > > > > > > > > - Change patch subject
> > > > > > > > > > > > - Enhance Kconfig help descrition
> > > > > > > > > > > > - Use if() instead of #if
> > > > > > > > > > > >
> > > > > > > > > > > >   drivers/pci/Kconfig  | 10 ++
> > > > > > > > > > > >   drivers/pci/pci-uclass.c |  9 ++---
> > > > > > > > > > > >   2 files changed, 16 insertions(+), 3 deletions(-)
> > > > > > > > > > >
> > > > > > > > > > > This needs an update to a sandbox test to handle this 
> > > > > > > > > > > behaviour.
> > > > > > > > > >
> > > > > > > > > > Okay. But how should I handle all these defconfig changes 
> > > > > > > > > > with regard
> > > > > > > > > > to the other patches in this series, introducing multiple 
> > > > > > > > > > new PCI
> > > > > > > > > > related Kconfig options. With 3 new Kconfig options, all 
> > > > > > > > > > permutations
> > > > > > > > > > would lead to 8 (2 ^ 3) different defconfig files. This 
> > > > > > > > > > does not
> > > > > > > > > > scale.
> > > > > > > > > >
> > > > > > > > > > I might be missing something here though - perhaps this is 
> > > > > > > > > > easier to
> > > > > > > > > > achieve.
> > > > > > > > >
> > > > > > > > > For sandbox, turn on all options and then add a new PCI bus 
> > > > > > > > > that uses
> > > > > > > > > this functionality. If there are lots of combinations you 
> > > > > > > > > could add 8
> > > > > > > > > new buses, but I'm hoping that isn't necessary?
> > > > > > > >
> > > > > > > > If I turn on all new options, sandbox will run with these new 
> > > > > > > > options
> > > > > > > > enabled. I don't know with with implications, as it usually 
> > > > > > > > runs with
> > > > > > > > the "normal" PCI related Kconfig options. Also the "normal" PCI
> > > > > > > > defconfig (e.g. CONFIG_PCI_REGION_MULTI_ENTRY etc disabled) 
> > > > > > > > will not
> > > > > > > > be tested any more via the sandbox tests. So you get either a 
> > > > > > > > test for
> > > > > > > > the new Kconfig option enabled or disabled this way.
> > > > > > > >
> > > > > > > > Do you really want me to do this?
> > > > > > >
> > > > > > > So the Kconfig completely changes the implementation of PCI? That
> > > > > > > doesn't make it very testable, as you say.
> > > > > > >
> > > > > > > Instead, I think the Kconfig should enable the option, then use 
> > > > > > > one of
> > > > > > > three ways to select the option:
> > > > > > >
> > > > > > > - a device tree property (on sandbox particularly)
> > > > > > > - compatible string (where the property is not appropriate
> > > > > > > - setting a flag in PCI bus (where a driver requires the option 
> > > > > > > be selected)
> > > > > > >
> > > > > > > That way you can write a test for the new feature in sandbox, 
> > > > > > > without
> > > > > > > deleting all the other tests.
> > > > > >
> > > > > > Coming back to this issue after some time - sorry for the delay.
> > > > > >
> > > > > > I'm not sure, if I understand this correctly. Do you suggest that 
> > > > > > the
> > > > > > driver code (in this case pci-uclass.c) should be extended to 
> > > > > > support
> > > > > > this (sandbox) testing support?
> > > > >
> > > > > Not really. I see these things as features that drivers can enable /
> > > > > disable depending on their needs. If that is correct, then sandbox is
> > > > > no different form other drivers, except that perhaps it might support
> > > > > all combinations rather than just one.
> > > > >
> > > > > >
> > > > > > If yes, I really think that this is counterproductive. As we added 
> > > > > > (at
> > > > > > least some of) the Kconfig options explicitly, to not add code to
> > > > > > pci-uclass.c in the "normal case". So adding code to e.g. check a 
> > > > > > device
> > > > > > tree property or a compatible string would increase the code size 
> > > > > > again.
> > > > >
> > > > > How about some flags in struct pci_controller?
> > > > >
> > > > > >
> > > > > > If not, I'm still unsure how you would like to test the "normal 
> > > > > > case",
> > > > > > e.g. with CONFIG_PCI_REGION_MULTI_ENTRY disabled, and with it 
> > > > > > enabled
> > > > > > without adding more sandbox build targets, with all the Kconfig 
> > > > > > options
> > > > > > permutations. As the extra code (in pci-uclass) is either included 
> > > > > > or
> > > > > > not in the sandbox binary.
> > > > >
> > > > > Kconfig 

Re: [PATCH v4 20/27] Makefile: Warn against using CONFIG_SPL_FIT_GENERATOR

2020-08-25 Thread Simon Glass
Hi Michal,

On Mon, 24 Aug 2020 at 08:12, Michal Simek  wrote:
>
> Hi Simon,
>
> On 22. 08. 20 17:08, Simon Glass wrote:
> > Hi Michal,
> >
> > On Mon, 17 Aug 2020 at 00:49, Michal Simek  wrote:
> >>
> >> Hi Simon,
> >>
> >> On 16. 08. 20 5:39, Simon Glass wrote:
> >>> Hi Michal,
> >>>
> >>> On Fri, 14 Aug 2020 at 07:28, Michal Simek  wrote:
> 
>  Hi Simon,
> 
>  ne 19. 7. 2020 v 22:06 odesílatel Simon Glass  napsal:
> >
> > This option is used to run arch-specific shell scripts which produce 
> > .its
> > files which are used to produce FIT images. We already have binman which
> > is designed to produce firmware images. It is more powerful and has 
> > tests.
> >
> > So this option should be deprecated and not used. Existing uses should 
> > be
> > migrated.
> >
> > Mentions of this in code reviews over the last year or so do not seem to
> > have resulted in action, and things are getting worse.
> >
> > So let's add a warning.
> >
> > Signed-off-by: Simon Glass 
> > Reviewed-by: Bin Meng 
> > ---
> >
> > (no changes since v1)
> >
> >  Makefile | 9 +
> >  1 file changed, 9 insertions(+)
> >
> > diff --git a/Makefile b/Makefile
> > index f1b5be1882..d73c10a973 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -1148,6 +1148,13 @@ ifneq ($(CONFIG_DM_ETH),y)
> > @echo >&2 "See doc/driver-model/migration.rst for more info."
> > @echo >&2 ""
> >  endif
> > +endif
> > +ifneq ($(CONFIG_SPL_FIT_GENERATOR),)
> > +   @echo >&2 "= WARNING =="
> > +   @echo >&2 "This board uses CONFIG_SPL_FIT_GENERATOR. Please 
> > migrate"
> > +   @echo >&2 "to binman instead, to avoid the proliferation of"
> > +   @echo >&2 "arch-specific scripts with no tests."
> > +   @echo >&2 ""
> >  endif
> > @# Check that this build does not use CONFIG options that we do 
> > not
> > @# know about unless they are in Kconfig. All the existing 
> > CONFIG
> > @@ -1345,6 +1352,8 @@ endif
> >
> >  # Boards with more complex image requirements can provide an .its 
> > source file
> >  # or a generator script
> > +# NOTE: Please do not use this. We are migrating away from Makefile 
> > rules to use
> > +# binman instead.
> >  ifneq ($(CONFIG_SPL_FIT_SOURCE),"")
> >  U_BOOT_ITS := u-boot.its
> >  $(U_BOOT_ITS): $(subst ",,$(CONFIG_SPL_FIT_SOURCE))
> > --
> > 2.28.0.rc0.105.gf9edc3c819-goog
> >
> 
>  I just got to this conversion and I am curious how that transition
>  should look like.
>  I found how FIT image is created which is fine but I didn't find any
>  reference on how to generate images based on CONFIG_OF_LIST.
>  If you look at arch/arm/mach-zynqmp/mkimage_fit_atf.sh you will see
>  that I loop over this entry and create multiple DT nodes and the same
>  amount of configurations to cover it. Is this supported by binman?
>  If yes, what's the syntax for it?
> >>>
> >>> The easiest way is probably to create a new entry type, like zynq-fit.
> >>> Then you can generate the DT using the sequence writer functions. See
> >>> _ReadSubNodes() in fit.py for an example.
> >>>
> >>> You can perhaps have a template subnode and use that in a for loop to
> >>> generate the nodes.
> >>>
> 
>  I tried several configurations and we can use that for generating qspi
>  images and also images with different configurations to have them
>  ready
>  but first I need to be able to handle the case above.
> >>>
> >>> I was thinking of converting sunxi which has the same need, but it
> >>> sounds like you are on the case. Let me know if you need help.
> >>
> >> Nope. I just saw that message and started to play with it to find out
> >> what needs to be done and how this fits to bigger picture. If this
> >> doesn't work directly then the work needs to be planned which will take
> >> time especially when this utility is new for us and we could have issues
> >> with writing code in python. Would be good if you can do the first shot
> >> because you know this utility and I am more than happy to test it, try
> >> and adopt if needed for our case.
> >>
> >> Sunxi is very similar case as is zynqmp. Difference is they hardcode
> >> default configuration to config_1. ZynqMP is setting up default based on
> >> default DT configured at that time.
> >>
> >> In connection to binman I see that there would be a need to generate
> >> images with ATF and without ATF in configuration node and with different
> >> default configuration. There could be also a need to add additional
> >> loadable entry such as bitstreams.
> >>
> >> Back to zynq-fit new entry type. I don't think it 

Re: [PATCH U-Boot] scripts/setlocalversion: Improve -dirty check with git-status --no-optional-locks

2020-08-25 Thread Tom Rini
On Tue, Aug 25, 2020 at 04:53:36PM +0200, Rasmus Villemoes wrote:
> On 25/08/2020 14.56, Tom Rini wrote:
> > On Tue, Aug 25, 2020 at 01:29:50PM +0200, Rasmus Villemoes wrote:
> > 
> >> From: Brian Norris 
> >>
> >> [linux commit ff64dd4857303dd5550faed9fd598ac90f0f2238]
> >>
> 
> >>  scripts/setlocalversion | 12 ++--
> >>  1 file changed, 10 insertions(+), 2 deletions(-)
> > 
> > It looks like we have one local change to setlocalversion since our sync
> > from v3.16.  Can you please re-sync us to the v5.8 release?  Thanks!
> > 
> 
> Hmm, I suppose I could, but it's not really clear whether we'd still
> need to apply that fix (81630a3b38c2, scripts: setlocalversion: safely
> extract variables from auto.conf using awk), or if that has been
> obsoleted by your a356e7a86b83 (spl: Kconfig: Escape '$(ARCH)' in
> LDSCRIPT entries).

Ah,  it's entirely likely we could just use setlocalversion as-is.

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH U-Boot] scripts/setlocalversion: Improve -dirty check with git-status --no-optional-locks

2020-08-25 Thread Rasmus Villemoes
On 25/08/2020 14.56, Tom Rini wrote:
> On Tue, Aug 25, 2020 at 01:29:50PM +0200, Rasmus Villemoes wrote:
> 
>> From: Brian Norris 
>>
>> [linux commit ff64dd4857303dd5550faed9fd598ac90f0f2238]
>>

>>  scripts/setlocalversion | 12 ++--
>>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> It looks like we have one local change to setlocalversion since our sync
> from v3.16.  Can you please re-sync us to the v5.8 release?  Thanks!
> 

Hmm, I suppose I could, but it's not really clear whether we'd still
need to apply that fix (81630a3b38c2, scripts: setlocalversion: safely
extract variables from auto.conf using awk), or if that has been
obsoleted by your a356e7a86b83 (spl: Kconfig: Escape '$(ARCH)' in
LDSCRIPT entries).

Rasmus


Re: [PATCH v3 1/3] fdtdec: optionally add property no-map to created reserved memory node

2020-08-25 Thread Heinrich Schuchardt
On 25.08.20 13:42, Patrice Chotard wrote:
> From: Etienne Carriere 
>
> Add boolean input argument @no_map to helper function
> fdtdec_add_reserved_memory() to add "no-map" property for an added
> reserved memory node. This is needed for example when the reserved
> memory relates to secure memory that the dear Linux kernel shall
> not even map unless what non-secure world speculative accesses of the

This sentence needs rework. Do you mean "to avoid non-secure world
accesses of the CPU that might reveal the secure-world memory"?

Is there any evidence that mapping memory as reserved can lead to an
information leak and that not mapping solves the problem? Is there a CVE
for it?

> CPU can violate the memory firmware configuration.

Most Linux distributions boot via EFI.

In U-Boot's UEFI sub-system we pass reserved memory as
EFI_RESERVED_MEMORY_TYPE in the memory map to Linux. See function
efi_carve_out_dt_rsv(). We do not consider the no-map attribute in the
device-tree.

Does the Linux kernel care about this no-map attribute in the
device-tree if we are booting via UEFI?

>
> No function change. A later change will update to OPTEE library to
> add no-map property to OP-TEE reserved memory nodes.
>
> Signed-off-by: Etienne Carriere 
> Signed-off-by: Patrice Chotard 
> ---
>
> (no changes since v2)
>
> Changes in v2:
>- fix dm fdtdec test and arch/riscv/lib/fdt_fixup.c with
>fdtdec_add_reserved_memory() new parameter
>
>  arch/riscv/lib/fdt_fixup.c |  2 +-
>  include/fdtdec.h   |  5 +++--
>  lib/fdtdec.c   | 10 --
>  lib/optee/optee.c  |  2 +-
>  test/dm/fdtdec.c   |  6 +++---
>  5 files changed, 16 insertions(+), 9 deletions(-)
>
> diff --git a/arch/riscv/lib/fdt_fixup.c b/arch/riscv/lib/fdt_fixup.c
> index 5b2420243f..d02062fd5b 100644
> --- a/arch/riscv/lib/fdt_fixup.c
> +++ b/arch/riscv/lib/fdt_fixup.c
> @@ -75,7 +75,7 @@ int riscv_fdt_copy_resv_mem_node(const void *src, void *dst)
>   pmp_mem.start = addr;
>   pmp_mem.end = addr + size - 1;
>   err = fdtdec_add_reserved_memory(dst, basename, _mem,
> -  );
> +  , false);

I guess in a future patch we would want to set nomap=true here too as
this is the memory reserved by the secure execution environment (e.g.
OpenSBI).

Best regards

Heinrich

>   if (err < 0 && err != -FDT_ERR_EXISTS) {
>   log_err("failed to add reserved memory: %d\n", err);
>   return err;
> diff --git a/include/fdtdec.h b/include/fdtdec.h
> index bc79389260..f127c7d386 100644
> --- a/include/fdtdec.h
> +++ b/include/fdtdec.h
> @@ -1016,7 +1016,7 @@ static inline int fdtdec_set_phandle(void *blob, int 
> node, uint32_t phandle)
>   * };
>   * uint32_t phandle;
>   *
> - * fdtdec_add_reserved_memory(fdt, "framebuffer", , );
> + * fdtdec_add_reserved_memory(fdt, "framebuffer", , , false);
>   *
>   * This results in the following subnode being added to the top-level
>   * /reserved-memory node:
> @@ -1043,11 +1043,12 @@ static inline int fdtdec_set_phandle(void *blob, int 
> node, uint32_t phandle)
>   * @param carveout   information about the carveout region
>   * @param phandlep   return location for the phandle of the carveout region
>   *   can be NULL if no phandle should be added
> + * @param no_map add "no-map" property if true
>   * @return 0 on success or a negative error code on failure
>   */
>  int fdtdec_add_reserved_memory(void *blob, const char *basename,
>  const struct fdt_memory *carveout,
> -uint32_t *phandlep);
> +uint32_t *phandlep, bool no_map);
>
>  /**
>   * fdtdec_get_carveout() - reads a carveout from an FDT
> diff --git a/lib/fdtdec.c b/lib/fdtdec.c
> index 30a1c6a217..bf40d87cb3 100644
> --- a/lib/fdtdec.c
> +++ b/lib/fdtdec.c
> @@ -1303,7 +1303,7 @@ static int fdtdec_init_reserved_memory(void *blob)
>
>  int fdtdec_add_reserved_memory(void *blob, const char *basename,
>  const struct fdt_memory *carveout,
> -uint32_t *phandlep)
> +uint32_t *phandlep, bool no_map)
>  {
>   fdt32_t cells[4] = {}, *ptr = cells;
>   uint32_t upper, lower, phandle;
> @@ -1403,6 +1403,12 @@ int fdtdec_add_reserved_memory(void *blob, const char 
> *basename,
>   if (err < 0)
>   return err;
>
> + if (no_map) {
> + err = fdt_setprop(blob, node, "no-map", NULL, 0);
> + if (err < 0)
> + return err;
> + }
> +
>   /* return the phandle for the new node for the caller to use */
>   if (phandlep)
>   *phandlep = phandle;
> @@ -1468,7 +1474,7 @@ int fdtdec_set_carveout(void *blob, const char *node, 
> const char *prop_name,
>   fdt32_t value;
>   void *prop;
>
> 

[GIT PULL] Pull request: u-boot-imx u-boot-imx-20200825

2020-08-25 Thread Stefano Babic
Hi Tom,

please pull from u-boot-imx, thanks !


The following changes since commit 789bfb52668ee609b2043de645e2f94bbd24fd1f:

  Merge tag 'efi-2020-10-rc3-2' of
https://gitlab.denx.de/u-boot/custodians/u-boot-efi (2020-08-15 09:01:01
-0400)

are available in the Git repository at:

  https://gitlab.denx.de/u-boot/custodians/u-boot-imx.git
tags/u-boot-imx-20200825

for you to fetch changes up to acbc1d86f16cc8372cccb7b862a0b9dc242f8fe5:

  imx8m: config: convert to bootm_size (2020-08-25 10:26:38 +0200)


For 2020.10
---

- mx6: SOCs user selectable
   Fix for imx6q_logic
   Some DM conversion
- mx7: introduce secondary boot device

Travis: https://travis-ci.org/github/sbabic/u-boot-imx/builds/720918010


Adam Ford (1):
  ARM: imx6q_logic: Fix broken booting by moving fdt_addr_r address

Fabio Estevam (1):
  pico-imx6: Remove unneeded CONFIG_DM_MDIO

Grygorii Tertychnyi (1):
  imx8m: config: convert to bootm_size

Marek Vasut (5):
  ARM: imx: Add bmode support for iMX7
  ARM: imx: Add support for switching primary/secondary boot mode to
bmode
  ARM: imx: Add support for reading out the primary/secondary bmode
  ARM: imx: Add support for reading out the primary/secondary bmode
to MX7
  ARM: imx: ddr: Add deskew register programming

Matthias Schiffer (1):
  tools/imximage: fix DCD Blocks message output order

Tom Rini (1):
  arm: mx6: Make all i.MX6 SoCs user-selectable

Wig Cheng (3):
  configs: pico-imx6ul: convert DM_USB
  configs: pico-imx6ul: convert DM_VIDEO
  pico-imx6ul: convert ethernet function to DM_ETH

 arch/arm/include/asm/arch-mx7/mx7-ddr.h|  16 +---
 arch/arm/include/asm/mach-imx/boot_mode.h  |   2 ++
 arch/arm/include/asm/mach-imx/sys_proto.h  |   8 +++-
 arch/arm/mach-imx/Kconfig  |   2 +-
 arch/arm/mach-imx/cmd_bmode.c  |  12 
 arch/arm/mach-imx/init.c   |  30
++
 arch/arm/mach-imx/mx6/Kconfig  | 134
--
 arch/arm/mach-imx/mx7/ddr.c|   9 +
 arch/arm/mach-imx/mx7/soc.c|  17 +
 board/seco/Kconfig |   6 +++---
 board/tbs/tbs2910/Kconfig  |   3 ---
 board/technexion/pico-imx6ul/pico-imx6ul.c |  53
-
 board/tqc/tqma6/Kconfig|   6 +++---
 configs/apalis_imx6_defconfig  |   3 ++-
 configs/aristainetos2_defconfig|   1 +
 configs/aristainetos2b_defconfig   |   1 +
 configs/aristainetos2bcsl_defconfig|   1 +
 configs/aristainetos2c_defconfig   |   1 +
 configs/brppt2_defconfig   |   1 +
 configs/cgtqmx6eval_defconfig  |   1 +
 configs/cm_fx6_defconfig   |   1 +
 configs/colibri-imx6ull_defconfig  |   3 ++-
 configs/colibri_imx6_defconfig |   3 ++-
 configs/dh_imx6_defconfig  |   1 +
 configs/display5_defconfig |   3 ++-
 configs/display5_factory_defconfig |   3 ++-
 configs/dms-ba16-1g_defconfig  |   1 +
 configs/dms-ba16_defconfig |   1 +
 configs/ge_bx50v3_defconfig|   1 +
 configs/gwventana_emmc_defconfig   |   1 +
 configs/gwventana_gw5904_defconfig |   1 +
 configs/gwventana_nand_defconfig   |   1 +
 configs/imx6dl_icore_nand_defconfig|   1 +
 configs/imx6dl_mamoj_defconfig |   1 +
 configs/imx6q_icore_nand_defconfig |   1 +
 configs/imx6q_logic_defconfig  |   1 +
 configs/imx6qdl_icore_mipi_defconfig   |   1 +
 configs/imx6qdl_icore_mmc_defconfig|   1 +
 configs/imx6qdl_icore_nand_defconfig   |   1 +
 configs/imx6qdl_icore_rqs_defconfig|   1 +
 configs/imx6ul_geam_mmc_defconfig  |   1 +
 configs/imx6ul_geam_nand_defconfig |   1 +
 configs/imx6ul_isiot_emmc_defconfig|   1 +
 configs/imx6ul_isiot_nand_defconfig|   1 +
 configs/kp_imx6q_tpc_defconfig |   1 +
 configs/liteboard_defconfig|   1 +
 configs/marsboard_defconfig|   3 ++-
 configs/mccmon6_nor_defconfig  |   1 +
 configs/mccmon6_sd_defconfig   |   1 +
 configs/mx6cuboxi_defconfig|   1 +
 configs/mx6dlarm2_defconfig|   3 ++-
 configs/mx6dlarm2_lpddr2_defconfig |   3 ++-
 configs/mx6memcal_defconfig|   3 ++-
 configs/mx6qarm2_defconfig |   3 ++-
 configs/mx6qarm2_lpddr2_defconfig  |   3 ++-
 configs/mx6qsabrelite_defconfig|   3 ++-
 configs/mx6sabreauto_defconfig

Re: Pull request: u-boot-rockchip-20200820

2020-08-25 Thread Tom Rini
On Tue, Aug 25, 2020 at 02:39:11PM +0800, Kever Yang wrote:

> Hi Tom,
> 
> Please pull the rockchip updates/fixes:
> - Fix rk3399 evb sdcard support
> - Fix for SPL_LED support
> 
> Gitlab ci:
> https://gitlab.denx.de/u-boot/custodians/u-boot-rockchip/pipelines/4456
> 
> Thanks,
> - Kever
> 
> The following changes since commit 2a4484a5c54cd64d5c4f8fd9aaa56f739d1b2b9d:
> 
>   Merge branch '2020-08-19-mediatek-updates' (2020-08-20 08:38:10 -0400)
> 
> are available in the Git repository at:
> 
>   https://gitlab.denx.de/u-boot/custodians/u-boot-rockchip.git 
> tags/u-boot-rockchip-20200820
> 
> for you to fetch changes up to b5b81f2490628650137c9fee3679c995f5fac757:
> 
>   rockchip: firefly-rk3288: Fix the code support for SPL_LED (2020-08-21 
> 19:56:19 +0800)
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: Pull request: u-boot-riscv/master 20200825

2020-08-25 Thread Tom Rini
On Tue, Aug 25, 2020 at 10:31:04AM +0800, ub...@andestech.com wrote:

> Hi Tom,
> 
> Please pull some riscv updates:
> 
> - Sipeed Maix support S-mode.
> - Provide command sbi.
> - Use fdtdec_get_addr_size_auto_parent to get fu540 cache base address.
> - Fix a compiler error with CONFIG_SPL_SMP=n.
> - Fix sifive ram driver 32 compiler warnings.
> - Fix kendryte/pll.h redefine nop() warning.
> 
> Thanks
> Rick
> 
> https://travis-ci.org/github/rickchen36/u-boot-riscv/builds/720564636
> 
> The following changes since commit 1aa3966173fe92fa3c46638ee8eb8b8491f521d6:
> 
>   Merge tag 'u-boot-clk-24Aug2020' of 
> https://gitlab.denx.de/u-boot/custodians/u-boot-clk (2020-08-24 09:06:02 
> -0400)
> 
> are available in the Git repository at:
> 
>   g...@gitlab.denx.de:u-boot/custodians/u-boot-riscv.git
> 
> for you to fetch changes up to c92b50a44b95e706b9c0c97544bd7504fe6d36e9:
> 
>   cmd: provide command sbi (2020-08-25 09:34:47 +0800)
> 

Applied to u-boot/master, thanks!


-- 
Tom


signature.asc
Description: PGP signature


Re: [U-Boot] Please pull from u-boot-i2c

2020-08-25 Thread Tom Rini
On Tue, Aug 25, 2020 at 01:30:50PM +0200, Heiko Schocher wrote:

> Hello Tom,
> 
> please pull from u-boot-i2c master
> 
> The following changes since commit 1aa3966173fe92fa3c46638ee8eb8b8491f521d6:
> 
>   Merge tag 'u-boot-clk-24Aug2020' of
> https://gitlab.denx.de/u-boot/custodians/u-boot-clk (2020-08-24 09:06:02
> -0400)
> 
> are available in the Git repository at:
> 
>   https://gitlab.denx.de/u-boot/custodians/u-boot-i2c.git 
> tags/i2c-bugfixes-for-v2020.10
> 
> for you to fetch changes up to 660606091f12320210cb7ced018788b8028aab5f:
> 
>   Link failure with CONFIG_SPL and CONFIG_I2C_MUX_PCA954x (2020-08-25 
> 06:25:42 +0200)
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


[PATCH] imx8m: config: convert to bootm_size

2020-08-25 Thread sbabic
> Restrict the memory range available for image processing in the
> "bootm" to 256 MiB so the kernel can access it and FDT or initrd are
> not overwritten on ARM64.
> Signed-off-by: Grygorii Tertychnyi 
> Cc: Peng Fan 
> Cc: Marek Vasut 
> Cc: Andrey Zhizhikin 
> Reviewed-by: Tom Rini 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=
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
=


[v2] arm: mx6: Make all i.MX6 SoCs user-selectable

2020-08-25 Thread sbabic
> We have a number of platforms that are a combination of a carrier board
> and System-on-Module (SoM) that in turn allows for the board to have
> different SoCs on it.  In some cases, this is handled via board-specific
> Kconfig options.  In other cases we make use of
> CONFIG_SYS_EXTRA_OPTIONS.  This latter case however can lead to invalid
> configurations as we will not in turn get options that in Kconfig are
> selected by or depend on that setting.
> To resolve this, make the SoC option a choice in Kconfig and make boards
> depend on what they can support.  This change opens us up for further
> clean-ups in the cases where a single CONFIG_TARGET_xxx can support
> different SoCs and today they do not, or do not cleanly do so.
> Reported-by: Matt Porter 
> Cc: Stefano Babic 
> Cc: Fabio Estevam 
> Cc: "NXP i.MX U-Boot Team" 
> Cc: Soeren Moch 
> Cc: Markus Niebel 
> Cc: Igor Opaniuk 
> Cc: Heiko Schocher 
> Cc: Hannes Schmelzer 
> Cc: Otavio Salvador 
> Cc: Nikita Kiryanov 
> Cc: Andreas Geisreiter 
> Cc: Ludwig Zenz 
> Cc: Lukasz Majewski 
> Cc: Akshay Bhat 
> Cc: Ken Lin 
> Cc: Ian Ray 
> Cc: Tim Harvey 
> Cc: Jagan Teki 
> Cc: Raffaele RECALCATI 
> Cc: Simone CIANNI 
> Cc: Adam Ford 
> Cc: Marcin Niestroj 
> Cc: "Eric Bénard" 
> Cc: Baruch Siach 
> Cc: Jason Liu 
> Cc: Ye Li 
> Cc: Eric Nelson 
> Cc: Troy Kisky 
> Cc: Peng Fan 
> Cc: Parthiban Nallathambi 
> Cc: Marek Vasut 
> Cc: "Sébastien Szymanski" 
> Cc: Christian Gmeiner 
> Cc: Niel Fourie 
> Cc: Martyn Welch 
> Cc: Richard Hu 
> Cc: Stefan Roese 
> Cc: Boris Brezillon 
> Cc: Arkadiusz Karas 
> Cc: Breno Lima 
> Cc: Francesco Montefoschi 
> Cc: Silvio Fricke 
> Tested-by: Matt Porter  [colibri_imx6]
> Signed-off-by: Tom Rini 
> Reviewed-by: Marcin Niestroj 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=
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
=


[PATCH] pico-imx6: Remove unneeded CONFIG_DM_MDIO

2020-08-25 Thread sbabic
> As explained in the CONFIG_DM_MDIO text inside drivers/net/Kconfig:
> 
> "Useful in particular for systems that support
> DM_ETH and have a stand-alone MDIO hardware block shared by multiple
> Ethernet interfaces."
> 
> i.MX6 has a single FEC instance, so there is no need to select
> CONFIG_DM_MDIO.
> Signed-off-by: Fabio Estevam 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=
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
=


[PATCH V2] ARM: imx6q_logic: Fix broken booting by moving fdt_addr_r address

2020-08-25 Thread sbabic
> The loading address is too close to the kernel address, so newer kernels
> may overlap memory space, so loading the device tree may corrupt zImage.
> This patch moves the fdt_addr_r to 0x1400 which is also consistent
> with guidance that the kernel be allocated 32MB.  This places it
> in the same place as the ramdisk, so this patch moves the ramdisk address
> 512KB after the fdt.
> Signed-off-by: Adam Ford 
> Reviewed-by: Tom Rini 
> Reviewed-by: Fabio Estevam 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=
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
=


Re: [PATCH] git-mailrc: Update email address of Maxime Ripard

2020-08-25 Thread Maxime Ripard
On Sun, Aug 09, 2020 at 12:15:02PM +0200, Jonas Smedegaard wrote:
> Update email address of Maxime Ripard in git-mailrc to match more
> recently updated entry in MAINTAINERS.
> commit 9bd9b2bcbee1 ("MAINTAINERS: Update my email address")
> commit bf8f4c4400e3 ("MAINTAINERS: Update email address for Maxime Ripard")
> 
> Signed-off-by: Jonas Smedegaard 

Acked-by: Maxime Ripard 

Thanks!
Maxime


signature.asc
Description: PGP signature


Please pull u-boot-marvell/master

2020-08-25 Thread Stefan Roese

Hi Tom,

please pull the Marvell Octeon TX / TX2 base support. I would have
liked to send this pull request earlier in the release cycle,
but it did not work out and I hope, that it's still possible to
get this included in this rc2 phase. Most changes are located in
the Octeon TX / TX2 platform code and some IF changes in the
PCI uclass driver. As mentioned in my last mail, I've removed the
bigger device drivers for NAND & ethernet for now. This way, they
have a bit more time for reviews. I've also included the small
QEMU x86 patch that I sent earlier today, as this patch fixes a
CI QEMU failure.

Here the summary log:


- Add basic Marvell/Cavium OcteonTX/TX2 support (Suneel)
- Infrastructure changes to PCI uclass to support these SoC's (Suneel)
- Add PCI, MMC & watchdog driver drivers for OcteonTX/TX2 (Suneel)
- Increase CONFIG_SYS_MALLOC_F_LEN for qemu-x86 (Stefan)


Here the Azure build, without any issues:

https://dev.azure.com/sr0718/u-boot/_build/results?buildId=45=results

Thanks,
Stefan


The following changes since commit 1aa3966173fe92fa3c46638ee8eb8b8491f521d6:

  Merge tag 'u-boot-clk-24Aug2020' of 
https://gitlab.denx.de/u-boot/custodians/u-boot-clk (2020-08-24 09:06:02 
-0400)


are available in the Git repository at:

  g...@gitlab.denx.de:u-boot/custodians/u-boot-marvell.git

for you to fetch changes up to 6944937f9c4d21f39dd257bce7b677a0f6849cea:

  x86: qemu-x86_defconfig: Increase CONFIG_SYS_MALLOC_F_LEN (2020-08-25 
11:37:57 +0200)



Stefan Roese (5):
  dm: core: Add API to read PCI bus-range property
  pci: pci-uclass: Remove #ifdef CONFIG_NR_DRAM_BANKS as its always set
  ARM: renesas: Drop unnecessary function ft_board_setup()
  pci: pci-uclass: Dynamically allocate the PCI regions
  x86: qemu-x86_defconfig: Increase CONFIG_SYS_MALLOC_F_LEN

Suneel Garapati (18):
  fdtdec: Add API to read pci bus-range property
  pci: pci-uclass: Fix incorrect argument in map_physmem
  pci: pci-uclass: Make DT subnode parse optional
  pci: pci-uclass: Add multi entry support for memory regions
  pci: pci-uclass: Add support for Enhanced Allocation in Bridges
  pci: pci-uclass: Add support for Single-Root I/O Virtualization
  pci: pci-uclass: Add VF BAR map support for Enhanced Allocation
  pci: pci-uclass: Add support for Alternate-RoutingID capability
  pci: pci-uclass: Check validity of ofnode
  arm: include/asm/io.h: Add 64bit clrbits and setbits helpers
  arm: octeontx: Add headers for OcteonTX
  arm: octeontx2: Add headers for OcteonTX2
  ata: ahci: Add BAR index quirk for Cavium PCI SATA device
  pci: Add PCI controller driver for OcteonTX / TX2
  mmc: Add MMC controller driver for OcteonTX / TX2
  watchdog: Add reset support for OcteonTX / TX2
  arm: octeontx: Add support for OcteonTX SoC platforms
  arm: octeontx2: Add support for OcteonTX2 SoC platforms

 arch/arm/Kconfig   |24 +
 arch/arm/Makefile  | 2 +
 arch/arm/include/asm/arch-octeontx/board.h |   123 +
 arch/arm/include/asm/arch-octeontx/clock.h |25 +
 .../include/asm/arch-octeontx/csrs/csrs-mio_emm.h  |  1193 +++
 arch/arm/include/asm/arch-octeontx/csrs/csrs-xcv.h |   428 +
 arch/arm/include/asm/arch-octeontx/gpio.h  | 6 +
 arch/arm/include/asm/arch-octeontx/smc.h   |20 +
 arch/arm/include/asm/arch-octeontx/soc.h   |33 +
 arch/arm/include/asm/arch-octeontx2/board.h|   128 +
 arch/arm/include/asm/arch-octeontx2/clock.h|24 +
 .../arm/include/asm/arch-octeontx2/csrs/csrs-cgx.h |  7851 ++
 .../arm/include/asm/arch-octeontx2/csrs/csrs-lmt.h |60 +
 .../include/asm/arch-octeontx2/csrs/csrs-mio_emm.h |  1193 +++
 .../arm/include/asm/arch-octeontx2/csrs/csrs-nix.h | 10404 
+++

 .../arm/include/asm/arch-octeontx2/csrs/csrs-npa.h |  2294 
 .../arm/include/asm/arch-octeontx2/csrs/csrs-npc.h |  1629 +++
 .../arm/include/asm/arch-octeontx2/csrs/csrs-rvu.h |  2276 
 arch/arm/include/asm/arch-octeontx2/gpio.h | 6 +
 arch/arm/include/asm/arch-octeontx2/smc-id.h   |32 +
 arch/arm/include/asm/arch-octeontx2/smc.h  |18 +
 arch/arm/include/asm/arch-octeontx2/soc.h  |33 +
 arch/arm/include/asm/io.h  |16 +
 arch/arm/mach-octeontx/Kconfig |23 +
 arch/arm/mach-octeontx/Makefile| 9 +
 arch/arm/mach-octeontx/clock.c |35 +
 arch/arm/mach-octeontx/cpu.c   |76 +
 arch/arm/mach-octeontx/lowlevel_init.S |33 +
 arch/arm/mach-octeontx2/Kconfig|23 +
 arch/arm/mach-octeontx2/Makefile   

Re: [PATCH U-Boot] scripts/setlocalversion: Improve -dirty check with git-status --no-optional-locks

2020-08-25 Thread Tom Rini
On Tue, Aug 25, 2020 at 01:29:50PM +0200, Rasmus Villemoes wrote:

> From: Brian Norris 
> 
> [linux commit ff64dd4857303dd5550faed9fd598ac90f0f2238]
> 
> git-diff-index does not refresh the index for you, so using it for a
> "-dirty" check can give misleading results. Commit 6147b1cf19651
> ("scripts/setlocalversion: git: Make -dirty check more robust") tried to
> fix this by switching to git-status, but it overlooked the fact that
> git-status also writes to the .git directory of the source tree, which
> is definitely not kosher for an out-of-tree (O=) build. That is getting
> reverted.
> 
> Fortunately, git-status now supports avoiding writing to the index via
> the --no-optional-locks flag, as of git 2.14. It still calculates an
> up-to-date index, but it avoids writing it out to the .git directory.
> 
> So, let's retry the solution from commit 6147b1cf19651 using this new
> flag first, and if it fails, we assume this is an older version of git
> and just use the old git-diff-index method.
> 
> It's hairy to get the 'grep -vq' (inverted matching) correct by stashing
> the output of git-status (you have to be careful about the difference
> betwen "empty stdin" and "blank line on stdin"), so just pipe the output
> directly to grep and use a regex that's good enough for both the
> git-status and git-diff-index version.
> 
> Cc: Christian Kujau 
> Cc: Guenter Roeck 
> Suggested-by: Alexander Kapshuk 
> Signed-off-by: Brian Norris 
> Tested-by: Genki Sky 
> Signed-off-by: Masahiro Yamada 
> Signed-off-by: Rasmus Villemoes 
> ---
> This fixes real problems when building U-Boot via Yocto, since
> Yocto creates hard-links to certain files in the source
> repository, causing the "git diff-index" method to report -dirty,
> even if no file contents are actually changed. See e.g.
> 
> https://lists.openembedded.org/g/openembedded-core/message/137702
> 
>  scripts/setlocalversion | 12 ++--
>  1 file changed, 10 insertions(+), 2 deletions(-)

It looks like we have one local change to setlocalversion since our sync
from v3.16.  Can you please re-sync us to the v5.8 release?  Thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] usb: gadget: ether: Fix warnings about unused code

2020-08-25 Thread Tom Rini
On Tue, Aug 25, 2020 at 11:55:17AM +0200, Lukasz Majewski wrote:
> Hi Tom,
> 
> > When building this with clang we see a few new warnings.  There are a
> > handful of structs that we declare and use only in the case of
> > !defined(CONFIG_USB_ETH_CDC) && defined(CONFIG_USB_ETH_SUBSET) so
> > update the guards used to match this as well as cover all members
> > rather than just a few.  Finally, eth_is_promisc() is only called by
> > eth_start_xmit() which is under and #if 0 and immediately follows the
> > function.  Move the #if 0 up.
> > 
> 
> Could you double check this patch and rebase it on top of newest master.
> 
> As it is now it causes following build break:
> https://travis-ci.org/github/lmajewski/u-boot-dfu/jobs/720654040

Lets just set it aside then.  It was fine at the time but I've put down
my experiment of building various targets with clang for now.

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v2 5/5] xen: Code style conformity

2020-08-25 Thread Tom Rini
On Fri, Aug 21, 2020 at 12:10:04PM +0300, Anastasiia Lukianenko wrote:

> From: Anastasiia Lukianenko 
> 
> Cleaning up the following:
> 
> ERROR: do not use assignment in if condition
> #281: FILE: drivers/xen/pvblock.c:260:
> +   if ((err = xenbus_switch_state(XBT_NIL, nodename,
> CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written "err"
> #52: FILE: drivers/xen/pvblock.c:298:
> +   if (err != NULL) {
> ERROR: do not use assignment in if condition
> #176: FILE: drivers/xen/gnttab.c:103:
> +   if ((flags = nflags) & (GTF_reading | GTF_writing)) {
> WARNING: Missing or malformed SPDX-License-Identifier tag in line 1
> #329: FILE: include/xen/gnttab.h:1:
> +/*
> WARNING: Misplaced SPDX-License-Identifier tag - use line 1 instead
> #330: FILE: include/xen/gnttab.h:2:
> + * SPDX-License-Identifier: GPL-2.0
> ERROR: do not use assignment in if condition
> #630: FILE: lib/sscanf.c:558:
> +   if ((n = inr) < width) {
> 
> Signed-off-by: Anastasiia Lukianenko 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v2 4/5] board: xen: Remove unnecessary CONFIG_INITRD_TAG and CONFIG_CMDLINE_TAG

2020-08-25 Thread Tom Rini
On Fri, Aug 21, 2020 at 12:10:03PM +0300, Anastasiia Lukianenko wrote:

> From: Anastasiia Lukianenko 
> 
> Signed-off-by: Anastasiia Lukianenko 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v2 2/5] MAINTAINERS: Add maintainers to XEN section

2020-08-25 Thread Tom Rini
On Fri, Aug 21, 2020 at 12:10:01PM +0300, Anastasiia Lukianenko wrote:

> From: Anastasiia Lukianenko 
> 
> Signed-off-by: Anastasiia Lukianenko 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v2 3/5] board: xen: Remove CONFIG_CMD_RUN define and clean xenguest_arm64_defconfig

2020-08-25 Thread Tom Rini
On Fri, Aug 21, 2020 at 12:10:02PM +0300, Anastasiia Lukianenko wrote:

> From: Anastasiia Lukianenko 
> 
> CONFIG_CMD_RUN is set on by default in Kconfig.
> Create xenguest_arm64_defconfig by using savedefconfig to avoid unnecessary
> options.
> 
> Signed-off-by: Anastasiia Lukianenko 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v6 6/7] arm: dts: mt7622: add USB nodes

2020-08-25 Thread Tom Rini
On Thu, Aug 20, 2020 at 04:37:57PM +0200, Frank Wunderlich wrote:

> From: Frank Wunderlich 
> 
> Add DTS nodes for MT7622/BPI-R64
> 
> Signed-off-by: Frank Wunderlich 
> Reviewed-by: Chunfeng Yun 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v2 1/5] board: xen: Remove unnecessary CONFIG_BOARD_EARLY_INIT_F define and board_early_init_f function

2020-08-25 Thread Tom Rini
On Fri, Aug 21, 2020 at 12:10:00PM +0300, Anastasiia Lukianenko wrote:

> From: Anastasiia Lukianenko 
> 
> Signed-off-by: Anastasiia Lukianenko 
> Reviewed-by: Tom Rini 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v6 7/7] arm: dts: mt7623: add USB nodes

2020-08-25 Thread Tom Rini
On Thu, Aug 20, 2020 at 04:37:58PM +0200, Frank Wunderlich wrote:

> From: Frank Wunderlich 
> 
> This adds USB nodes for MT7623/BPI-R2
> 
> Signed-off-by: Frank Wunderlich 
> Reviewed-by: Chunfeng Yun 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v6 2/7] reset: drop unnecessary comment for pciesys

2020-08-25 Thread Tom Rini
On Thu, Aug 20, 2020 at 04:37:53PM +0200, Frank Wunderlich wrote:

> From: Frank Wunderlich 
> 
> after review from sam this comment should be removed
> 
> Signed-off-by: Frank Wunderlich 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v6 4/7] clk: mt7622: add needed clocks for ssusb-node

2020-08-25 Thread Tom Rini
On Thu, Aug 20, 2020 at 04:37:55PM +0200, Frank Wunderlich wrote:

> From: Frank Wunderlich 
> 
> MT7622 needs additional clock definitions to work properly
> 
> Signed-off-by: Frank Wunderlich 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v6 3/7] ahci: mediatek: fix copyright and author-lines

2020-08-25 Thread Tom Rini
On Thu, Aug 20, 2020 at 04:37:54PM +0200, Frank Wunderlich wrote:

> From: Frank Wunderlich 
> 
> after review of sam copyright should be on one line and link should
> not between author lines
> 
> just remove the link and put ryder first as he is author of linux-driver
> 
> Signed-off-by: Frank Wunderlich 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v6 5/7] arm: dts: rename mt7622-bpi-r64.dts

2020-08-25 Thread Tom Rini
On Thu, Aug 20, 2020 at 04:37:56PM +0200, Frank Wunderlich wrote:

> From: Frank Wunderlich 
> 
> rename mt7622-bpi-r64.dts to mt7622-bananapi-bpi-r64.dts
> to follow naming convensions
> 
> Signed-off-by: Frank Wunderlich 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v6 1/7] phy: mtk-tphy: make shared reg optional for v1

2020-08-25 Thread Tom Rini
On Thu, Aug 20, 2020 at 04:37:52PM +0200, Frank Wunderlich wrote:

> From: Frank Wunderlich 
> 
> make the shared reg optional when version is v1 for sata
> 
> Suggested-by: Chunfeng Yun 
> Signed-off-by: Frank Wunderlich 
> Reviewed-by: Chunfeng Yun 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v4 4/5] fs/squashfs: add support for LZO decompression

2020-08-25 Thread Tom Rini
On Tue, Aug 18, 2020 at 05:17:24PM +0200, Joao Marcos Costa wrote:

> Add call to lzo's lzo1x_decompress_safe() into sqfs_decompress().
> 
> U-Boot's LZO sources may still have some unsolved issues that could make the
> decompression crash when dealing with fragmented files, so those should be
> avoided. The "-no-fragments" option can be passed to mksquashfs.
> 
> Signed-off-by: Joao Marcos Costa 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 1/1] fs/squashfs: Fix Coverity Scan defects

2020-08-25 Thread Tom Rini
On Wed, Aug 19, 2020 at 06:28:41PM +0200, Joao Marcos Costa wrote:

> Fix defects such as uninitialized variables and untrusted pointer
> operations. Most part of the tainted variables and the related defects
> actually comes from Linux's macro get_unaligned_le**, extensively used
> in SquashFS code. Add sanity checks for those variables.
> 
> Signed-off-by: Joao Marcos Costa 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v4 5/5] test/py: Add tests for LZO and ZSTD

2020-08-25 Thread Tom Rini
On Tue, Aug 18, 2020 at 05:17:25PM +0200, Joao Marcos Costa wrote:

> Improve SquashFS tests architecture. Add 'Compression' class. LZO
> algorithm may crash if the file is fragmented, so the fragments are
> disabled when testing LZO.
> 
> Signed-off-by: Joao Marcos Costa 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] virtio_blk: set log2blksz correctly

2020-08-25 Thread Tom Rini
On Wed, Aug 19, 2020 at 06:07:32PM +0900, AKASHI Takahiro wrote:

> 'log2blksz' in blk_desc structure must always be initialized, otherwise
> it will cause a lot of weird failures in file operations.
> 
> For example, fs_set_blk_dev[_with_part]() examines a block device against
> every file system with its probe function. In particular, ext4 file
> system's ext4_probe() will calls fs_devread() to fetch a super block.
> If log2blksz is 0, the actual 'read' size, i.e. block_len >> log2blksz, is
> much bigger than a buffer's size, and it can end up with memory corruption.
> 
> Signed-off-by: AKASHI Takahiro 
> Fixes: f4802209e59d ("virtio: Add block driver support")
> Reviewed-by: Bin Meng 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v4 3/5] fs/squashfs: add support for ZSTD decompression

2020-08-25 Thread Tom Rini
On Tue, Aug 18, 2020 at 05:17:23PM +0200, Joao Marcos Costa wrote:

> Add call to ZSTD's ZSTD_decompressDCtx(). In this use case, the caller
> can upper bound the decompressed size, which will be the SquashFS data
> block (or metadata block) size, so there is no need to use streaming
> API. Add ZSTD's worskpace to squashfs_ctxt structure.
> 
> Signed-off-by: Joao Marcos Costa 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] cmd: fix clone coverity scan

2020-08-25 Thread Tom Rini
On Mon, Aug 17, 2020 at 03:53:01PM +0800, John Chau wrote:

> From: John Chau 
> 
> This patch fixes coverity scan MISSING_BREAK issues, and also an error
> on block size check.
> 
> Signed-off-by: John Chau 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v4 2/5] fs/squashfs: replace sqfs_decompress() parameter

2020-08-25 Thread Tom Rini
On Tue, Aug 18, 2020 at 05:17:22PM +0200, Joao Marcos Costa wrote:

> Replace 'u16 comp_type' by a reference to squashfs_ctxt structure.
> 
> Signed-off-by: Joao Marcos Costa 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v3] firmware: psci: Do not bind driver if U-Boot runs in EL3

2020-08-25 Thread Tom Rini
On Thu, Aug 13, 2020 at 12:43:22PM +0200, Michal Simek wrote:

> There is no reason to bind psci driver if U-Boot runs in EL3 because
> SMC/HVC instructions can't be called. That's why detect this state and
> don't let user to crash from prompt by performing reset or poweroff
> commands (if enabled).
> 
> Signed-off-by: Michal Simek 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v4 1/5] fs/squashfs: Add init and clean-up functions to decompression

2020-08-25 Thread Tom Rini
On Tue, Aug 18, 2020 at 05:17:21PM +0200, Joao Marcos Costa wrote:

> Add sqfs_decompressor_init() and sqfs_decompressor_cleanup(). These
> functions are called respectively in sqfs_probe() and sqfs_close(). For
> now, only ZSTD requires an initialization logic. ZSTD support will be
> added in a follow-up commit.
> 
> Move squashfs_ctxt definition to sqfs_filesystem.h. This structure is
> passed to sqfs_decompressor_init() and sqfs_decompressor_cleanup(), so
> it can no longer be local to sqfs.c.
> 
> Signed-off-by: Joao Marcos Costa 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v3] board: armltd: Add support for Total Compute platform

2020-08-25 Thread Tom Rini
On Wed, Aug 12, 2020 at 04:12:53PM +0100, Usama Arif wrote:

> Total Compute is based on ARM architecture and has
> the following features enabled in u-boot:
> - PL011 UART
> - PL180 MMC
> - NOR Flash
> - FIT image with Signature
> - AVB
> 
> Signed-off-by: Usama Arif 
> Reviewed-by: Tom Rini 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 1/2] avb: Make AVB independent of fastboot

2020-08-25 Thread Tom Rini
On Tue, Aug 11, 2020 at 03:46:03PM +0100, Usama Arif wrote:

> AVB only uses CONFIG_FASTBOOT_BUF_ADDR from fastboot for memory.
> This memory is used for assigning temporary buffers.
> This can be assigned a new variable and used as CONFIG_AVB_BUF_ADDR.
> This is to support future boards that support AVB but dont support
> USB and therefore dont support FASTBOOT.
> 
> Signed-off-by: Usama Arif 
> Cc: Igor Opaniuk 
> Reviewed-by: Tom Rini 
> Acked-by: Igor Opaniuk 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: Pull request for UEFI sub-system for efi-2020-10-rc3 (3)

2020-08-25 Thread Tom Rini
On Mon, Aug 24, 2020 at 09:49:58PM +0200, Heinrich Schuchardt wrote:

> Dear Tom,
> 
> The following changes since commit d584648dad691caec3eccdbfa3f1936878e5:
> 
>   Merge tag 'dm-pull-22aug20' of
> https://gitlab.denx.de/u-boot/custodians/u-boot-dm (2020-08-23 16:06:38
> -0400)
> 
> are available in the Git repository at:
> 
>   https://gitlab.denx.de/u-boot/custodians/u-boot-efi.git
> tags/efi-2020-10-rc3-3
> 
> for you to fetch changes up to 2b3fbcb59f4174e455a6285eaddf1426ed3e76c5:
> 
>   efi_loader: use ':' as separator for setenv -i (2020-08-24 16:37:53 +0200)
> 
> No problems were reported by Gitlab CI and Travis CI:
> 
> https://gitlab.denx.de/u-boot/custodians/u-boot-efi/-/pipelines/4485
> https://travis-ci.org/github/xypron2/u-boot/builds/720671388
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


[PATCH v3 2/3] test: fdtdec: Add test for new no-map fdtdec_add_reserved_memory() parameter

2020-08-25 Thread Patrice Chotard
Add a test to verify that the no-map property is added in reserved-memory
node when fdtdec_add_reserved_memory() no-map parameter is set to true.

Signed-off-by: Patrice Chotard 

---

(no changes since v2)

Changes in v2:
   - Add no-map property test into fdtdec test

 test/dm/fdtdec.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/test/dm/fdtdec.c b/test/dm/fdtdec.c
index 4119003041..017157a2ec 100644
--- a/test/dm/fdtdec.c
+++ b/test/dm/fdtdec.c
@@ -101,10 +101,13 @@ static int dm_test_fdtdec_add_reserved_memory(struct 
unit_test_state *uts)
resv.start = 0x2000;
resv.end = 0x2fff;
ut_assertok(fdtdec_add_reserved_memory(blob, "rsvd_region1",
-  , , false));
+  , , true));
subnode = fdt_path_offset(blob, "/reserved-memory/rsvd_region1");
ut_assert(subnode > 0);
 
+   /* check that no-map property is present */
+   ut_assert(fdt_getprop(blob, subnode, "no-map", NULL) > 0);
+
/* phandles must be different */
ut_assert(phandle != phandle1);
 
-- 
2.17.1



[PATCH v3 3/3] optee: add property no-map to secure reserved memory

2020-08-25 Thread Patrice Chotard
From: Etienne Carriere 

OP-TEE reserved memory node must set property "no-map" to prevent
Linux kernel from mapping secure memory unless what non-secure world
speculative accesses of the CPU can violate the memory firmware
configuration.

Fixes: 6ccb05eae01b ("image: fdt: copy possible optee nodes to a loaded 
devicetree")
Signed-off-by: Etienne Carriere 
Signed-off-by: Patrice Chotard 
---

Changes in v3:
   - Fix changelogs

 lib/optee/optee.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/optee/optee.c b/lib/optee/optee.c
index 963c2ff430..9e6606568f 100644
--- a/lib/optee/optee.c
+++ b/lib/optee/optee.c
@@ -192,7 +192,7 @@ int optee_copy_fdt_nodes(const void *old_blob, void 
*new_blob)
ret = fdtdec_add_reserved_memory(new_blob,
 nodename,
 ,
-NULL, false);
+NULL, true);
free(oldname);
 
if (ret < 0)
-- 
2.17.1



[PATCH v3 1/3] fdtdec: optionally add property no-map to created reserved memory node

2020-08-25 Thread Patrice Chotard
From: Etienne Carriere 

Add boolean input argument @no_map to helper function
fdtdec_add_reserved_memory() to add "no-map" property for an added
reserved memory node. This is needed for example when the reserved
memory relates to secure memory that the dear Linux kernel shall
not even map unless what non-secure world speculative accesses of the
CPU can violate the memory firmware configuration.

No function change. A later change will update to OPTEE library to
add no-map property to OP-TEE reserved memory nodes.

Signed-off-by: Etienne Carriere 
Signed-off-by: Patrice Chotard 
---

(no changes since v2)

Changes in v2:
   - fix dm fdtdec test and arch/riscv/lib/fdt_fixup.c with
   fdtdec_add_reserved_memory() new parameter

 arch/riscv/lib/fdt_fixup.c |  2 +-
 include/fdtdec.h   |  5 +++--
 lib/fdtdec.c   | 10 --
 lib/optee/optee.c  |  2 +-
 test/dm/fdtdec.c   |  6 +++---
 5 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/arch/riscv/lib/fdt_fixup.c b/arch/riscv/lib/fdt_fixup.c
index 5b2420243f..d02062fd5b 100644
--- a/arch/riscv/lib/fdt_fixup.c
+++ b/arch/riscv/lib/fdt_fixup.c
@@ -75,7 +75,7 @@ int riscv_fdt_copy_resv_mem_node(const void *src, void *dst)
pmp_mem.start = addr;
pmp_mem.end = addr + size - 1;
err = fdtdec_add_reserved_memory(dst, basename, _mem,
-);
+, false);
if (err < 0 && err != -FDT_ERR_EXISTS) {
log_err("failed to add reserved memory: %d\n", err);
return err;
diff --git a/include/fdtdec.h b/include/fdtdec.h
index bc79389260..f127c7d386 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -1016,7 +1016,7 @@ static inline int fdtdec_set_phandle(void *blob, int 
node, uint32_t phandle)
  * };
  * uint32_t phandle;
  *
- * fdtdec_add_reserved_memory(fdt, "framebuffer", , );
+ * fdtdec_add_reserved_memory(fdt, "framebuffer", , , false);
  *
  * This results in the following subnode being added to the top-level
  * /reserved-memory node:
@@ -1043,11 +1043,12 @@ static inline int fdtdec_set_phandle(void *blob, int 
node, uint32_t phandle)
  * @param carveout information about the carveout region
  * @param phandlep return location for the phandle of the carveout region
  * can be NULL if no phandle should be added
+ * @param no_map   add "no-map" property if true
  * @return 0 on success or a negative error code on failure
  */
 int fdtdec_add_reserved_memory(void *blob, const char *basename,
   const struct fdt_memory *carveout,
-  uint32_t *phandlep);
+  uint32_t *phandlep, bool no_map);
 
 /**
  * fdtdec_get_carveout() - reads a carveout from an FDT
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 30a1c6a217..bf40d87cb3 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -1303,7 +1303,7 @@ static int fdtdec_init_reserved_memory(void *blob)
 
 int fdtdec_add_reserved_memory(void *blob, const char *basename,
   const struct fdt_memory *carveout,
-  uint32_t *phandlep)
+  uint32_t *phandlep, bool no_map)
 {
fdt32_t cells[4] = {}, *ptr = cells;
uint32_t upper, lower, phandle;
@@ -1403,6 +1403,12 @@ int fdtdec_add_reserved_memory(void *blob, const char 
*basename,
if (err < 0)
return err;
 
+   if (no_map) {
+   err = fdt_setprop(blob, node, "no-map", NULL, 0);
+   if (err < 0)
+   return err;
+   }
+
/* return the phandle for the new node for the caller to use */
if (phandlep)
*phandlep = phandle;
@@ -1468,7 +1474,7 @@ int fdtdec_set_carveout(void *blob, const char *node, 
const char *prop_name,
fdt32_t value;
void *prop;
 
-   err = fdtdec_add_reserved_memory(blob, name, carveout, );
+   err = fdtdec_add_reserved_memory(blob, name, carveout, , false);
if (err < 0) {
debug("failed to add reserved memory: %d\n", err);
return err;
diff --git a/lib/optee/optee.c b/lib/optee/optee.c
index 457d4cca8a..963c2ff430 100644
--- a/lib/optee/optee.c
+++ b/lib/optee/optee.c
@@ -192,7 +192,7 @@ int optee_copy_fdt_nodes(const void *old_blob, void 
*new_blob)
ret = fdtdec_add_reserved_memory(new_blob,
 nodename,
 ,
-NULL);
+NULL, false);
free(oldname);
 
if (ret < 0)
diff --git a/test/dm/fdtdec.c 

Re: [PATCH v2 1/3] fdtdec: optionally add property no-map to created reserved memory node

2020-08-25 Thread Patrice CHOTARD
There is an issue with series-changes tag, i will resend a v3


On 8/25/20 1:28 PM, Patrice Chotard wrote:
> From: Etienne Carriere 
>
> Add boolean input argument @no_map to helper function
> fdtdec_add_reserved_memory() to add "no-map" property for an added
> reserved memory node. This is needed for example when the reserved
> memory relates to secure memory that the dear Linux kernel shall
> not even map unless what non-secure world speculative accesses of the
> CPU can violate the memory firmware configuration.
>
> No function change. A later change will update to OPTEE library to
> add no-map property to OP-TEE reserved memory nodes.
>
> Signed-off-by: Etienne Carriere 
> Signed-off-by: Patrice Chotard 
>- fix dm fdtdec test and arch/riscv/lib/fdt_fixup.c with
>fdtdec_add_reserved_memory() new parameter
>
> ---
>
> (no changes since v1)
>
>  arch/riscv/lib/fdt_fixup.c |  2 +-
>  include/fdtdec.h   |  5 +++--
>  lib/fdtdec.c   | 10 --
>  lib/optee/optee.c  |  2 +-
>  test/dm/fdtdec.c   |  6 +++---
>  5 files changed, 16 insertions(+), 9 deletions(-)
>
> diff --git a/arch/riscv/lib/fdt_fixup.c b/arch/riscv/lib/fdt_fixup.c
> index 5b2420243f..d02062fd5b 100644
> --- a/arch/riscv/lib/fdt_fixup.c
> +++ b/arch/riscv/lib/fdt_fixup.c
> @@ -75,7 +75,7 @@ int riscv_fdt_copy_resv_mem_node(const void *src, void *dst)
>   pmp_mem.start = addr;
>   pmp_mem.end = addr + size - 1;
>   err = fdtdec_add_reserved_memory(dst, basename, _mem,
> -  );
> +  , false);
>   if (err < 0 && err != -FDT_ERR_EXISTS) {
>   log_err("failed to add reserved memory: %d\n", err);
>   return err;
> diff --git a/include/fdtdec.h b/include/fdtdec.h
> index bc79389260..f127c7d386 100644
> --- a/include/fdtdec.h
> +++ b/include/fdtdec.h
> @@ -1016,7 +1016,7 @@ static inline int fdtdec_set_phandle(void *blob, int 
> node, uint32_t phandle)
>   * };
>   * uint32_t phandle;
>   *
> - * fdtdec_add_reserved_memory(fdt, "framebuffer", , );
> + * fdtdec_add_reserved_memory(fdt, "framebuffer", , , false);
>   *
>   * This results in the following subnode being added to the top-level
>   * /reserved-memory node:
> @@ -1043,11 +1043,12 @@ static inline int fdtdec_set_phandle(void *blob, int 
> node, uint32_t phandle)
>   * @param carveout   information about the carveout region
>   * @param phandlep   return location for the phandle of the carveout region
>   *   can be NULL if no phandle should be added
> + * @param no_map add "no-map" property if true
>   * @return 0 on success or a negative error code on failure
>   */
>  int fdtdec_add_reserved_memory(void *blob, const char *basename,
>  const struct fdt_memory *carveout,
> -uint32_t *phandlep);
> +uint32_t *phandlep, bool no_map);
>  
>  /**
>   * fdtdec_get_carveout() - reads a carveout from an FDT
> diff --git a/lib/fdtdec.c b/lib/fdtdec.c
> index 30a1c6a217..bf40d87cb3 100644
> --- a/lib/fdtdec.c
> +++ b/lib/fdtdec.c
> @@ -1303,7 +1303,7 @@ static int fdtdec_init_reserved_memory(void *blob)
>  
>  int fdtdec_add_reserved_memory(void *blob, const char *basename,
>  const struct fdt_memory *carveout,
> -uint32_t *phandlep)
> +uint32_t *phandlep, bool no_map)
>  {
>   fdt32_t cells[4] = {}, *ptr = cells;
>   uint32_t upper, lower, phandle;
> @@ -1403,6 +1403,12 @@ int fdtdec_add_reserved_memory(void *blob, const char 
> *basename,
>   if (err < 0)
>   return err;
>  
> + if (no_map) {
> + err = fdt_setprop(blob, node, "no-map", NULL, 0);
> + if (err < 0)
> + return err;
> + }
> +
>   /* return the phandle for the new node for the caller to use */
>   if (phandlep)
>   *phandlep = phandle;
> @@ -1468,7 +1474,7 @@ int fdtdec_set_carveout(void *blob, const char *node, 
> const char *prop_name,
>   fdt32_t value;
>   void *prop;
>  
> - err = fdtdec_add_reserved_memory(blob, name, carveout, );
> + err = fdtdec_add_reserved_memory(blob, name, carveout, , false);
>   if (err < 0) {
>   debug("failed to add reserved memory: %d\n", err);
>   return err;
> diff --git a/lib/optee/optee.c b/lib/optee/optee.c
> index 457d4cca8a..963c2ff430 100644
> --- a/lib/optee/optee.c
> +++ b/lib/optee/optee.c
> @@ -192,7 +192,7 @@ int optee_copy_fdt_nodes(const void *old_blob, void 
> *new_blob)
>   ret = fdtdec_add_reserved_memory(new_blob,
>nodename,
>,
> -

[U-Boot] Please pull from u-boot-i2c

2020-08-25 Thread Heiko Schocher

Hello Tom,

please pull from u-boot-i2c master

The following changes since commit 1aa3966173fe92fa3c46638ee8eb8b8491f521d6:

  Merge tag 'u-boot-clk-24Aug2020' of https://gitlab.denx.de/u-boot/custodians/u-boot-clk 
(2020-08-24 09:06:02 -0400)


are available in the Git repository at:

  https://gitlab.denx.de/u-boot/custodians/u-boot-i2c.git 
tags/i2c-bugfixes-for-v2020.10

for you to fetch changes up to 660606091f12320210cb7ced018788b8028aab5f:

  Link failure with CONFIG_SPL and CONFIG_I2C_MUX_PCA954x (2020-08-25 06:25:42 
+0200)


i2c bugfixes for v2020.10
- fix some issues with octeon_i2c driver on ARM Octeon TX2
- fix link failure with CONFIG_SPL and CONFIG_I2C_MUX_PCA954x


Stefan Roese (1):
  i2c: octeon_i2c: Misc fixes for ARM Octeon TX2 support

Trommel, Kees (Contractor) (1):
  Link failure with CONFIG_SPL and CONFIG_I2C_MUX_PCA954x

 drivers/i2c/Makefile   |  2 +-
 drivers/i2c/muxes/Makefile |  2 +-
 drivers/i2c/octeon_i2c.c   | 59 
++-
 3 files changed, 28 insertions(+), 35 deletions(-)

Travis build is fine:

https://travis-ci.org/github/hsdenx/u-boot-i2c/builds/720878061

Thanks!

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


[PATCH U-Boot] scripts/setlocalversion: Improve -dirty check with git-status --no-optional-locks

2020-08-25 Thread Rasmus Villemoes
From: Brian Norris 

[linux commit ff64dd4857303dd5550faed9fd598ac90f0f2238]

git-diff-index does not refresh the index for you, so using it for a
"-dirty" check can give misleading results. Commit 6147b1cf19651
("scripts/setlocalversion: git: Make -dirty check more robust") tried to
fix this by switching to git-status, but it overlooked the fact that
git-status also writes to the .git directory of the source tree, which
is definitely not kosher for an out-of-tree (O=) build. That is getting
reverted.

Fortunately, git-status now supports avoiding writing to the index via
the --no-optional-locks flag, as of git 2.14. It still calculates an
up-to-date index, but it avoids writing it out to the .git directory.

So, let's retry the solution from commit 6147b1cf19651 using this new
flag first, and if it fails, we assume this is an older version of git
and just use the old git-diff-index method.

It's hairy to get the 'grep -vq' (inverted matching) correct by stashing
the output of git-status (you have to be careful about the difference
betwen "empty stdin" and "blank line on stdin"), so just pipe the output
directly to grep and use a regex that's good enough for both the
git-status and git-diff-index version.

Cc: Christian Kujau 
Cc: Guenter Roeck 
Suggested-by: Alexander Kapshuk 
Signed-off-by: Brian Norris 
Tested-by: Genki Sky 
Signed-off-by: Masahiro Yamada 
Signed-off-by: Rasmus Villemoes 
---
This fixes real problems when building U-Boot via Yocto, since
Yocto creates hard-links to certain files in the source
repository, causing the "git diff-index" method to report -dirty,
even if no file contents are actually changed. See e.g.

https://lists.openembedded.org/g/openembedded-core/message/137702

 scripts/setlocalversion | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/scripts/setlocalversion b/scripts/setlocalversion
index 8564bedd1a..55f8ace2ee 100755
--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -72,8 +72,16 @@ scm_version()
printf -- '-svn%s' "`git svn find-rev $head`"
fi
 
-   # Check for uncommitted changes
-   if git diff-index --name-only HEAD | grep -qv 
"^scripts/package"; then
+   # Check for uncommitted changes.
+   # First, with git-status, but --no-optional-locks is only
+   # supported in git >= 2.14, so fall back to git-diff-index if
+   # it fails. Note that git-diff-index does not refresh the
+   # index, so it may give misleading results. See
+   # git-update-index(1), git-diff-index(1), and git-status(1).
+   if {
+   git --no-optional-locks status -uno --porcelain 
2>/dev/null ||
+   git diff-index --name-only HEAD
+   } | grep -qvE '^(.. )?scripts/package'; then
printf '%s' -dirty
fi
 
-- 
2.23.0



[PATCH v2 1/3] fdtdec: optionally add property no-map to created reserved memory node

2020-08-25 Thread Patrice Chotard
From: Etienne Carriere 

Add boolean input argument @no_map to helper function
fdtdec_add_reserved_memory() to add "no-map" property for an added
reserved memory node. This is needed for example when the reserved
memory relates to secure memory that the dear Linux kernel shall
not even map unless what non-secure world speculative accesses of the
CPU can violate the memory firmware configuration.

No function change. A later change will update to OPTEE library to
add no-map property to OP-TEE reserved memory nodes.

Signed-off-by: Etienne Carriere 
Signed-off-by: Patrice Chotard 
   - fix dm fdtdec test and arch/riscv/lib/fdt_fixup.c with
   fdtdec_add_reserved_memory() new parameter

---

(no changes since v1)

 arch/riscv/lib/fdt_fixup.c |  2 +-
 include/fdtdec.h   |  5 +++--
 lib/fdtdec.c   | 10 --
 lib/optee/optee.c  |  2 +-
 test/dm/fdtdec.c   |  6 +++---
 5 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/arch/riscv/lib/fdt_fixup.c b/arch/riscv/lib/fdt_fixup.c
index 5b2420243f..d02062fd5b 100644
--- a/arch/riscv/lib/fdt_fixup.c
+++ b/arch/riscv/lib/fdt_fixup.c
@@ -75,7 +75,7 @@ int riscv_fdt_copy_resv_mem_node(const void *src, void *dst)
pmp_mem.start = addr;
pmp_mem.end = addr + size - 1;
err = fdtdec_add_reserved_memory(dst, basename, _mem,
-);
+, false);
if (err < 0 && err != -FDT_ERR_EXISTS) {
log_err("failed to add reserved memory: %d\n", err);
return err;
diff --git a/include/fdtdec.h b/include/fdtdec.h
index bc79389260..f127c7d386 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -1016,7 +1016,7 @@ static inline int fdtdec_set_phandle(void *blob, int 
node, uint32_t phandle)
  * };
  * uint32_t phandle;
  *
- * fdtdec_add_reserved_memory(fdt, "framebuffer", , );
+ * fdtdec_add_reserved_memory(fdt, "framebuffer", , , false);
  *
  * This results in the following subnode being added to the top-level
  * /reserved-memory node:
@@ -1043,11 +1043,12 @@ static inline int fdtdec_set_phandle(void *blob, int 
node, uint32_t phandle)
  * @param carveout information about the carveout region
  * @param phandlep return location for the phandle of the carveout region
  * can be NULL if no phandle should be added
+ * @param no_map   add "no-map" property if true
  * @return 0 on success or a negative error code on failure
  */
 int fdtdec_add_reserved_memory(void *blob, const char *basename,
   const struct fdt_memory *carveout,
-  uint32_t *phandlep);
+  uint32_t *phandlep, bool no_map);
 
 /**
  * fdtdec_get_carveout() - reads a carveout from an FDT
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 30a1c6a217..bf40d87cb3 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -1303,7 +1303,7 @@ static int fdtdec_init_reserved_memory(void *blob)
 
 int fdtdec_add_reserved_memory(void *blob, const char *basename,
   const struct fdt_memory *carveout,
-  uint32_t *phandlep)
+  uint32_t *phandlep, bool no_map)
 {
fdt32_t cells[4] = {}, *ptr = cells;
uint32_t upper, lower, phandle;
@@ -1403,6 +1403,12 @@ int fdtdec_add_reserved_memory(void *blob, const char 
*basename,
if (err < 0)
return err;
 
+   if (no_map) {
+   err = fdt_setprop(blob, node, "no-map", NULL, 0);
+   if (err < 0)
+   return err;
+   }
+
/* return the phandle for the new node for the caller to use */
if (phandlep)
*phandlep = phandle;
@@ -1468,7 +1474,7 @@ int fdtdec_set_carveout(void *blob, const char *node, 
const char *prop_name,
fdt32_t value;
void *prop;
 
-   err = fdtdec_add_reserved_memory(blob, name, carveout, );
+   err = fdtdec_add_reserved_memory(blob, name, carveout, , false);
if (err < 0) {
debug("failed to add reserved memory: %d\n", err);
return err;
diff --git a/lib/optee/optee.c b/lib/optee/optee.c
index 457d4cca8a..963c2ff430 100644
--- a/lib/optee/optee.c
+++ b/lib/optee/optee.c
@@ -192,7 +192,7 @@ int optee_copy_fdt_nodes(const void *old_blob, void 
*new_blob)
ret = fdtdec_add_reserved_memory(new_blob,
 nodename,
 ,
-NULL);
+NULL, false);
free(oldname);
 
if (ret < 0)
diff --git a/test/dm/fdtdec.c b/test/dm/fdtdec.c
index 

[PATCH v2 2/3] test: fdtdec: Add test for new no-map fdtdec_add_reserved_memory() parameter

2020-08-25 Thread Patrice Chotard
Add a test to verify that the no-map property is added in reserved-memory
node when fdtdec_add_reserved_memory() no-map parameter is set to true.

Signed-off-by: Patrice Chotard 

   - Add no-map property test into fdtdec test

---

(no changes since v1)

 test/dm/fdtdec.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/test/dm/fdtdec.c b/test/dm/fdtdec.c
index 4119003041..017157a2ec 100644
--- a/test/dm/fdtdec.c
+++ b/test/dm/fdtdec.c
@@ -101,10 +101,13 @@ static int dm_test_fdtdec_add_reserved_memory(struct 
unit_test_state *uts)
resv.start = 0x2000;
resv.end = 0x2fff;
ut_assertok(fdtdec_add_reserved_memory(blob, "rsvd_region1",
-  , , false));
+  , , true));
subnode = fdt_path_offset(blob, "/reserved-memory/rsvd_region1");
ut_assert(subnode > 0);
 
+   /* check that no-map property is present */
+   ut_assert(fdt_getprop(blob, subnode, "no-map", NULL) > 0);
+
/* phandles must be different */
ut_assert(phandle != phandle1);
 
-- 
2.17.1



[PATCH v2 3/3] optee: add property no-map to secure reserved memory

2020-08-25 Thread Patrice Chotard
From: Etienne Carriere 

OP-TEE reserved memory node must set property "no-map" to prevent
Linux kernel from mapping secure memory unless what non-secure world
speculative accesses of the CPU can violate the memory firmware
configuration.

Fixes: 6ccb05eae01b ("image: fdt: copy possible optee nodes to a loaded 
devicetree")
Signed-off-by: Etienne Carriere 
Signed-off-by: Patrice Chotard 
---

(no changes since v1)

 lib/optee/optee.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/optee/optee.c b/lib/optee/optee.c
index 963c2ff430..9e6606568f 100644
--- a/lib/optee/optee.c
+++ b/lib/optee/optee.c
@@ -192,7 +192,7 @@ int optee_copy_fdt_nodes(const void *old_blob, void 
*new_blob)
ret = fdtdec_add_reserved_memory(new_blob,
 nodename,
 ,
-NULL, false);
+NULL, true);
free(oldname);
 
if (ret < 0)
-- 
2.17.1



[PATCH 00/31] Add DM support for omap PWM backlight

2020-08-25 Thread Dario Binacchi


The series was born from the need to manage the PWM backlight of the
display connected to my beaglebone board. To hit the target, I had to
develop drivers for PWM management which in turn relied on drivers for
managing timers and clocks, all developed according to the driver model.
My intention was to use the SoC-specific API only at strictly necessary
points in the code. My previous patches for migrating the AM335x display
driver to the driver model had required the implementation of additional
functions outside the concerns of the driver, (settings for dividing the
pixel clock rate, configuring the display DPLL rate, ) not being
able to use the API of the related clock drivers. This series shouldn't
have repeated the same kind of mistake. Furthermore, I also wanted to fix
that kind of forced choice. Almost everything should have been accessible
via the driver model API. In the series there are also some patches that
could be submitted separately, but which I have however inserted to avoid
applying future patches to incorporate them.
With this last consideration, I hope I have convincingly justified the
large number of patches in the series.

The patch enabling address translation into a CPU physical address from
device-tree even in case of crossing levels with #size-cells = <0>, is
crucial for the series. The previous implementation was unable to
perform the address translation required by the am33xx device tree.
I tried to apply in a conservative way as few changes as possible and
to verify the execution of all the tests already developed, as well as
the new ones I added for the new feature.


Dario Binacchi (31):
  clk: remove a redundant header
  clk: export generic routines
  arch: sandbox: fix typo in clk.h
  clk: add clk_round_rate()
  clk: ti: add mux clock driver
  arm: ti: am33xx: add DPLL_EN_FAST_RELOCK_BYPASS macro
  clk: ti: am33xx: add DPLL clock drivers
  clk: ti: add divider clock driver
  clk: ti: refactor mux and divider clock drivers
  clk: ti: add gate clock driver
  ti: am33xx: fix do_enable_clocks() to accept NULL parameters
  clk: ti: add support for clkctrl clocks
  clk: ti: move drivers to 'ti' directory
  clk: ti: omap4: add clock manager driver
  clk: ti: am335x: add clock manager driver
  fdt: translate address if #size-cells = <0>
  omap: timer: fix the rate setting
  misc: am33xx: add control module driver
  pwm: ti: am33xx: add enhanced pwm driver
  pwm: ti: am33xx: add subsystem driver
  video: backlight: fix pwm's duty cycle calculation
  video: backlight: fix pwm data structure description
  dm: core: improve uclass_get_device_by_phandle_id() description
  gpio: fix gpio_request_by_name() description
  dm: core: add a function to decode display timings
  video: omap: add panel driver
  video: omap: enable LCD clock domain through DM API
  video: omap: set LCD clock rate through DM API
  video: omap: split the legacy code from the DM code
  video: omap: move drivers to 'ti' directory
  board: ti: am335x-ice: get CDCE913 clock device

 arch/arm/dts/am335x-brppt1-mmc.dts|   3 +-
 arch/arm/dts/am335x-brppt1-nand.dts   |   3 +-
 arch/arm/dts/am335x-brppt1-spi.dts|   3 +-
 arch/arm/dts/am335x-brsmarc1.dts  |   2 +-
 arch/arm/dts/am335x-brxre1.dts|   3 +-
 arch/arm/dts/am335x-evm-u-boot.dtsi   |   7 +-
 arch/arm/dts/am335x-evmsk-u-boot.dtsi |   6 +-
 arch/arm/dts/am335x-guardian-u-boot.dtsi  |   8 +-
 arch/arm/dts/am335x-pdu001-u-boot.dtsi|   8 +-
 arch/arm/dts/am335x-pxm50-u-boot.dtsi |   6 +-
 arch/arm/dts/am335x-rut-u-boot.dtsi   |   6 +-
 arch/arm/dts/am33xx.dtsi  |  12 +
 arch/arm/dts/da850-evm-u-boot.dtsi|   8 +-
 arch/arm/include/asm/arch-am33xx/clock.h  |   1 +
 arch/arm/mach-omap2/am33xx/clock.c|  10 +-
 arch/arm/mach-omap2/am33xx/clock_am33xx.c |   2 +-
 arch/sandbox/dts/test.dts |  67 +++
 arch/sandbox/include/asm/clk.h|  35 +-
 board/ti/am335x/board.c   |   2 +-
 board/ti/am43xx/board.c   |   2 +-
 common/fdt_support.c  |  10 +-
 doc/device-tree-bindings/arm/omap,ctrl.txt|  82 +++
 doc/device-tree-bindings/arm/omap,prcm.txt|  63 +++
 .../clock/clock-bindings.txt  | 186 +++
 .../clock/gpio-gate-clock.txt |  21 +
 .../clock/ti,autoidle.txt |  39 ++
 doc/device-tree-bindings/clock/ti,clkctrl.txt |  61 +++
 .../clock/ti,clockdomain.txt  |  24 +
 doc/device-tree-bindings/clock/ti,divider.txt | 117 +
 doc/device-tree-bindings/clock/ti,dpll.txt|  85 
 doc/device-tree-bindings/clock/ti,gate.txt| 106 
 doc/device-tree-bindings/clock/ti,mux.txt |  79 +++
 .../pinctrl/pinctrl-single.txt| 255 ++
 doc/device-tree-bindings/pwm/ti,ehrpwm.txt|  49 ++
 doc/device-tree-bindings/pwm/ti,pwmss.txt

Re: [PATCH 2/2] arm: mvebu: Espressobin: Setup MTD partitions when booting kernel

2020-08-25 Thread Pali Rohár
On Thursday 20 August 2020 14:09:50 Stefan Roese wrote:
> On 20.08.20 14:03, Pali Rohár wrote:
> > On Thursday 20 August 2020 10:51:28 Pali Rohár wrote:
> > > On Thursday 20 August 2020 10:17:55 Stefan Roese wrote:
> > > > On 20.08.20 09:40, Pali Rohár wrote:
> > > > > Anyway, updating DTS has advantage that it is not needed to update
> > > > > existing boot scripts for OS. There are more distributions for
> > > > > Espressobin which have own boot scripts stored on SD card for loading
> > > > > kernel. And therefore to use command line parameters it would be 
> > > > > needed
> > > > > to update all of them.
> > > > 
> > > > I see. This is an argument I understand. But can't you use the common
> > > > fdt_fixup_mtdparts() then?
> > > > 
> > > > > And I see there another problem. For specifying size of mtd partitions
> > > > > in command line, it is required to know offsets of those partitions. 
> > > > > And
> > > > > e.g. uboot env partition depends on CONFIG_ENV_OFFSET option which is
> > > > > not available for uboot boot script code.
> > > > > 
> > > > > But if you have other idea, I'm open to also other solutions.
> > > > 
> > > > I have not investigated a multi-distribution solution here. Perhaps
> > > > the common fdt_fixup_mtdparts() is able to handle this?
> > > 
> > > In case U-Boot would see MTD SPI partitions, then fdt_fixup_mtdparts()
> > > should work.
> > 
> > It looks like that fdt_fixup_mtdparts() is broken.
> > 
> > I added following config lines
> > 
> > CONFIG_MTDIDS_DEFAULT="nor0=nor0"
> > CONFIG_MTDPARTS_DEFAULT="nor0:4032k(firmware),64k(u-boot-env)"
> > CONFIG_FDT_FIXUP_PARTITIONS=y
> > 
> > Then in uboot console I called 'sf probe' and 'boot'.
> > 
> > And Linux kernel thrown following MTD error:
> > 
> > [1.038352] spi-nor spi0.0: w25q32dw (4096 Kbytes)
> > [1.043403] spi0.0: error parsing ofpart partition 
> > /soc/internal-regs@d000/spi@10600/flash@0/partition@0 
> > (/soc/internal-regs@d000/spi@10600/flash@0)
> 
> I know that passing mtdparts= is working in general. You need the
> correct device names though. Perhaps something is wrong here. Hard
> to say, without looking deeper. Could you please post the complete
> Linux bootlog of this failing boot attempt?

I sent it to you in private email as log is large.

> > So I do not know if it makes sense to continue debugging SF <--> MTD
> > layer in Uboot when passing uboot MTD partitions via
> > fdt_fixup_mtdparts() to Linux kernel does not work...
> 
> I understand. You have a working version and it makes not much sense
> for you to work on an alternative solution. But the fdt_fixup_mtdparts()
> way provides a common way for all (most?) boards and your's needs
> to be rewritten for each board. So from this prospective, it definitely
> makes sense to continue debugging / testing.

Well, currently I do not have time to debug other components to figure
out what is broken in uboot.

For me it looks like a overkill to enable & configure MTD layer, then
attach SF layer to it and all this would be needed only for usage of
fdt_fixup_mtdparts() function. And once these layers would be fixed and
fully working it would same thing as in this my patch.

> > Original patch which in this thread is working fine and kernel correctly
> > see both defined partitions in ft_board_setup() function.
> 
> I understand. Thanks for at looking into this anyways.
> 
> Thanks,
> Stefan


Re: [PATCH] i2c: octeon_i2c: Misc fixes for ARM Octeon TX2 support

2020-08-25 Thread Heiko Schocher

Hello Stefan,

Am 23.07.2020 um 14:09 schrieb Stefan Roese:

This patch fixes a few issues noticed, when testing this new driver on
ARM Octeon TX2 again. Here the details:

- Remove "common.h" header inclusion
- Use correct THP define on Octeon TX2
- Octeon TX2 uses the same compatible as Octeon TX. We can't distinguish
   both platforms this way. Remove the unused "cavium,thunder2-99xx-twsi"
   compatible and add a check to the Octeon TX2 specific
   "cavium,thunderx-i2c" so that the correct driver data is selected.
- Removed "struct pci_device_id" definition and U_BOOT_PCI_DEVICE()
   as its not needed for the PCI based probing on Octeon TX2

Signed-off-by: Stefan Roese 
Cc: Heiko Schocher 
Cc: Daniel Schwierzeck 
Cc: Suneel Garapati 
Cc: Aaron Williams 
Cc: Chandrakala Chavva 
---
  drivers/i2c/octeon_i2c.c | 59 ++--
  1 file changed, 26 insertions(+), 33 deletions(-)


Applied to u-boot-i2c.git

Thanks!

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


Re: [PATCH] Link failure with CONFIG_SPL and CONFIG_I2C_MUX_PCA954x

2020-08-25 Thread Heiko Schocher

Hello Kees,

Am 03.08.2020 um 16:49 schrieb Trommel, Kees (Contractor):

Fix for the case of a U-Boot configuration with CONFIG_SPL,
CONFIG_I2C_MUX, CONFIG_I2C_MUX_PCA954x, no CONFIG_SPL_DM and no
CONFIG_SPL_I2C_MUX. Without this fix linking of pca954x fails because
dm_write_i2c does not exist because CONFIG_SPL_DM is not defined.

Signed-off-by: Kees Trommel 
Cc:  Heiko Schocher 


Please use for further posts a single space after Cc:


---
  drivers/i2c/Makefile   | 2 +-
  drivers/i2c/muxes/Makefile | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)


Applied to u-boot-i2c.git

Thanks!

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


Re: [PATCH 4/7] binman: Add support for ATF BL31

2020-08-25 Thread Heinrich Schuchardt
On 22.08.20 04:36, Simon Glass wrote:
> Add an entry for ARM Trusted Firmware's 'BL31' payload, which is the
> device's main firmware. Typically this is U-Boot.
>
> Signed-off-by: Simon Glass 
> ---
>
>  tools/binman/README.entries| 10 ++
>  tools/binman/etype/atf_bl31.py | 20 
>  tools/binman/ftest.py  |  9 +
>  tools/binman/test/165_atf_bl31.dts | 16 
>  4 files changed, 55 insertions(+)
>  create mode 100644 tools/binman/etype/atf_bl31.py
>  create mode 100644 tools/binman/test/165_atf_bl31.dts
>
> diff --git a/tools/binman/README.entries b/tools/binman/README.entries
> index 97bfae16116..85b8ec9fa73 100644
> --- a/tools/binman/README.entries
> +++ b/tools/binman/README.entries
> @@ -11,6 +11,16 @@ features to produce new behaviours.
>
>
>
> +Entry: atf-bl31: Entry containing an ARM Trusted Firmware (ATF) BL31 blob
> +-
> +
> +Properties / Entry arguments:
> +- atf-bl31-path: Filename of file to read into entry
> +
> +This entry holds the run-time firmware started by ATF.

No, BL31 is started by U-Boot SPL on the Sunxi platform.

Best regards

Heinrich

> +
> +
> +
>  Entry: blob: Entry containing an arbitrary binary blob
>  --
>
> diff --git a/tools/binman/etype/atf_bl31.py b/tools/binman/etype/atf_bl31.py
> new file mode 100644
> index 000..fd7223843b1
> --- /dev/null
> +++ b/tools/binman/etype/atf_bl31.py
> @@ -0,0 +1,20 @@
> +# SPDX-License-Identifier: GPL-2.0+
> +# Copyright (c) 2016 Google, Inc
> +# Written by Simon Glass 
> +#
> +# Entry-type module for Intel Management Engine binary blob
> +#
> +
> +from binman.etype.blob_named_by_arg import Entry_blob_named_by_arg
> +
> +class Entry_atf_bl31(Entry_blob_named_by_arg):
> +"""Entry containing an ARM Trusted Firmware (ATF) BL31 blob
> +
> +Properties / Entry arguments:
> +- atf-bl31-path: Filename of file to read into entry
> +
> +This entry holds the run-time firmware started by ATF.
> +"""
> +def __init__(self, section, etype, node):
> +super().__init__(section, etype, node, 'atf-bl31')
> +self.external = True
> diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
> index 8d687162185..30c9c764327 100644
> --- a/tools/binman/ftest.py
> +++ b/tools/binman/ftest.py
> @@ -75,6 +75,7 @@ REFCODE_DATA  = b'refcode'
>  FSP_M_DATA= b'fsp_m'
>  FSP_S_DATA= b'fsp_s'
>  FSP_T_DATA= b'fsp_t'
> +ATF_BL31_DATA = b'bl31'
>
>  # The expected size for the device tree in some tests
>  EXTRACT_DTB_SIZE = 0x3c9
> @@ -168,6 +169,7 @@ class TestFunctional(unittest.TestCase):
>  os.path.join(cls._indir, 'files'))
>
>  TestFunctional._MakeInputFile('compress', COMPRESS_DATA)
> +TestFunctional._MakeInputFile('bl31.bin', ATF_BL31_DATA)
>
>  # Travis-CI may have an old lz4
>  cls.have_lz4 = True
> @@ -3505,5 +3507,12 @@ class TestFunctional(unittest.TestCase):
>  self.assertIn("Missing required properties/entry args: 
> cros-ec-rw-path",
>str(e.exception))
>
> +def testPackBl31(self):
> +"""Test that an image with an ATF BL31 binary can be created"""
> +data = self._DoReadFile('165_atf_bl31.dts')
> +self.assertEqual(ATF_BL31_DATA, data[:len(ATF_BL31_DATA)])
> +
> +ATF_BL31_DATA
> +
>  if __name__ == "__main__":
>  unittest.main()
> diff --git a/tools/binman/test/165_atf_bl31.dts 
> b/tools/binman/test/165_atf_bl31.dts
> new file mode 100644
> index 000..2b7547d70f9
> --- /dev/null
> +++ b/tools/binman/test/165_atf_bl31.dts
> @@ -0,0 +1,16 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +
> +/dts-v1/;
> +
> +/ {
> + #address-cells = <1>;
> + #size-cells = <1>;
> +
> + binman {
> + size = <16>;
> +
> + atf-bl31 {
> + filename = "bl31.bin";
> + };
> + };
> +};
>



Re: [PATCH 0/7] binman: Add support for generating more complex FITs

2020-08-25 Thread Heinrich Schuchardt
On 25.08.20 06:07, Heinrich Schuchardt wrote:
> On 8/22/20 4:36 AM, Simon Glass wrote:
>> This series allows binman to generate FITs that include multiple DTB
>> images and the configuration to use them.
>>
>> It is then possible to remove the sunxi FIT generator script, so this
>> series handles that also.
>>
>> With this, sunxi is fully converted to use binman.
>
> I have applied this patch series and it does not work on my
> pine64-lts_defconfig.
>
> Environment variable BL31 points to my bl31.bin:
>
> $ echo $BL31
> ../trusted-firmware-a/build/sun50i_a64/debug/bl31.bin
>
> U-Boot SPL 2020.10-rc2-00147-g72293dc579 (Aug 25 2020 - 03:29:28 +)
> DRAM: 2048 MiB
> Trying to boot from MMC1
> No matching DT out of these options:
>Configuration to load ATF before U-Boot
> No matching DT out of these options:
>Configuration to load ATF before U-Boot
> mmc_load_image_raw_sector: mmc block read error
> SPL: failed to boot from all boot devices
> ### ERROR ### Please RESET the board ###
>
> Without your patches U-Boot works. But CONFIG_SYS_MALLOC_F_LEN=0x400 is
> too small. This results in a warning "alloc space exhausted". Cf.
> https://patchwork.ozlabs.org/project/uboot/patch/20200725181851.4339-1-xypron.g...@gmx.de/
>
> U-Boot SPL 2020.10-rc2-00140-g1aa3966173 (Aug 25 2020 - 03:46:36 +)
> DRAM: 2048 MiB
> Trying to boot from MMC1
> NOTICE:  BL31: v2.2():v2.2-1138-g78460ced4
> NOTICE:  BL31: Built : 05:50:47, Apr  7 2020
> NOTICE:  BL31: Detected Allwinner A64/H64/R18 SoC (1689)
> NOTICE:  BL31: Found U-Boot DTB at 0x4092cc8, model: Pine64 LTS
> INFO:ARM GICv2 driver initialized
> INFO:Configuring SPC Controller
> INFO:PMIC: Probing AXP803 on RSB
> INFO:PMIC: dcdc1 voltage: 3.300V
> INFO:PMIC: dcdc5 voltage: 1.200V
> INFO:PMIC: dcdc6 voltage: 1.100V
> INFO:PMIC: dldo1 voltage: 3.300V
> INFO:PMIC: dldo2 voltage: 3.300V
> INFO:PMIC: dldo4 voltage: 3.300V
> INFO:PMIC: fldo1 voltage: 1.200V
> INFO:PMIC: Enabling DC SW
> INFO:BL31: Platform setup done
> INFO:BL31: Initializing runtime services
> INFO:BL31: cortex_a53: CPU workaround for 843419 was applied
> INFO:BL31: cortex_a53: CPU workaround for 855873 was applied
> NOTICE:  PSCI: System suspend is unavailable
> INFO:BL31: Preparing for EL3 exit to normal world
> INFO:Entry point address = 0x4a00
> INFO:SPSR = 0x3c9
> alloc space exhausted
>
>
> U-Boot 2020.10-rc2-00140-g1aa3966173 (Aug 25 2020 - 03:46:36 +)
> Allwinner Technology
>
> CPU:   Allwinner A64 (SUN50I)
> Model: Pine64 LTS
> DRAM:  2 GiB
> MMC:   mmc@1c0f000: 0, mmc@1c11000: 1
> Loading Environment from FAT... Card did not respond to voltage select!
> In:serial
> Out:   serial
> Err:   serial
> Net:   phy interface7
> eth0: ethernet@1c3
> Hit any key to stop autoboot:  0
>
> Best regards
>
> Heinrich

This is u-boot.its created without your patches:

/dts-v1/;

/ {
description = "Configuration to load ATF before U-Boot";
#address-cells = <1>;

images {
uboot {
description = "U-Boot (64-bit)";
data = /incbin/("u-boot-nodtb.bin");
type = "standalone";
arch = "arm64";
compression = "none";
load = <0x4a00>;
};
atf {
description = "ARM Trusted Firmware";
data =
/incbin/("../trusted-firmware-a/build/sun50i_a64/debug/bl31.bin");
type = "firmware";
arch = "arm64";
compression = "none";
load = <0x44000>;
entry = <0x44000>;
};
fdt_1 {
description = "sun50i-a64-pine64-lts";
data =
/incbin/("arch/arm/dts/sun50i-a64-pine64-lts.dtb");
type = "flat_dt";
compression = "none";
};
};
configurations {
default = "config_1";

config_1 {
description = "sun50i-a64-pine64-lts";
firmware = "uboot";
loadables = "atf";
fdt = "fdt_1";
};
};
};

This is the itb that is created with your patches:

/dts-v1/;

/ {
description = "Configuration to load ATF before U-Boot";
#address-cells = < 0x01 >;

images {

uboot {
data = < 0x1f000 ...
description = "U-Boot (64-bit)";
type = "standalone";
arch = "arm64";
compression = "none";
load = < 0x4a00 >;
};

atf {
data = [ f4 ...
description = 

Re: [PATCH 1/2] fdtdec: optionally add property no-map to created reserved memory node

2020-08-25 Thread Patrice CHOTARD
Hi Simon

On 8/22/20 5:09 PM, Simon Glass wrote:
> On Thu, 13 Aug 2020 at 03:47, Patrice Chotard  wrote:
>> From: Etienne Carriere 
>>
>> Add boolean input argument @no_map to helper function
>> fdtdec_add_reserved_memory() to add "no-map" property for an added
>> reserved memory node. This is needed for example when the reserved
>> memory relates to secure memory that the dear Linux kernel shall
>> not even map unless what non-secure world speculative accesses of the
>> CPU can violate the memory firmware configuration.
>>
>> No function change. A later change will update to OPTEE library to
>> add no-map property to OP-TEE reserved memory nodes.
>>
>> Signed-off-by: Etienne Carriere 
>> Signed-off-by: Patrice Chotard 
>> ---
>>
>>  include/fdtdec.h  |  5 +++--
>>  lib/fdtdec.c  | 10 --
>>  lib/optee/optee.c |  2 +-
>>  3 files changed, 12 insertions(+), 5 deletions(-)
> Please can you check this as it seems to have a build error.

Yes, sorry, we forgot to update dm test and other platform piece of code.

A v2 will be send.

Thanks

Patrice




Re: [PATCH] usb: gadget: ether: Fix warnings about unused code

2020-08-25 Thread Lukasz Majewski
Hi Tom,

> When building this with clang we see a few new warnings.  There are a
> handful of structs that we declare and use only in the case of
> !defined(CONFIG_USB_ETH_CDC) && defined(CONFIG_USB_ETH_SUBSET) so
> update the guards used to match this as well as cover all members
> rather than just a few.  Finally, eth_is_promisc() is only called by
> eth_start_xmit() which is under and #if 0 and immediately follows the
> function.  Move the #if 0 up.
> 

Could you double check this patch and rebase it on top of newest master.

As it is now it causes following build break:
https://travis-ci.org/github/lmajewski/u-boot-dfu/jobs/720654040

Thanks in advance,
Łukasz

> Cc: Lukasz Majewski 
> Cc: Marek Vasut 
> Signed-off-by: Tom Rini 
> ---
>  drivers/usb/gadget/ether.c | 11 +++
>  1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
> index 6f04523f15e9..0daaf36f68f7 100644
> --- a/drivers/usb/gadget/ether.c
> +++ b/drivers/usb/gadget/ether.c
> @@ -476,14 +476,12 @@ static const struct usb_cdc_acm_descriptor
> acm_descriptor = { 
>  #endif
>  
> -#ifndef CONFIG_USB_ETH_CDC
> -
> +#if !defined(CONFIG_USB_ETH_CDC) && defined(CONFIG_USB_ETH_SUBSET)
>  /*
>   * "SAFE" loosely follows CDC WMC MDLM, violating the spec in various
>   * ways:  data endpoints live in the control interface, there's no
> data
>   * interface, and it's not used to talk to a cell phone radio.
>   */
> -
>  static const struct usb_cdc_mdlm_desc mdlm_desc = {
>   .bLength =  sizeof mdlm_desc,
>   .bDescriptorType =  USB_DT_CS_INTERFACE,
> @@ -501,7 +499,6 @@ static const struct usb_cdc_mdlm_desc mdlm_desc =
> {
>   * can't really use its struct.  All we do here is say that we're
> using
>   * the submode of "SAFE" which directly matches the CDC Subset.
>   */
> -#ifdef CONFIG_USB_ETH_SUBSET
>  static const u8 mdlm_detail_desc[] = {
>   6,
>   USB_DT_CS_INTERFACE,
> @@ -511,9 +508,6 @@ static const u8 mdlm_detail_desc[] = {
>   0,  /* network control capabilities (none) */
>   0,  /* network data capabilities ("raw" encapsulation)
> */ };
> -#endif
> -
> -#endif
>  
>  static const struct usb_cdc_ether_desc ether_desc = {
>   .bLength =  sizeof(ether_desc),
> @@ -527,6 +521,7 @@ static const struct usb_cdc_ether_desc ether_desc
> = { .wNumberMCFilters =   __constant_cpu_to_le16(0),
>   .bNumberPowerFilters =  0,
>  };
> +#endif
>  
>  #if defined(CONFIG_USB_ETH_CDC) || defined(CONFIG_USB_ETH_RNDIS)
>  
> @@ -1643,6 +1638,7 @@ static void tx_complete(struct usb_ep *ep,
> struct usb_request *req) packet_sent = 1;
>  }
>  
> +#if 0
>  static inline int eth_is_promisc(struct eth_dev *dev)
>  {
>   /* no filters for the CDC subset; always promisc */
> @@ -1651,7 +1647,6 @@ static inline int eth_is_promisc(struct eth_dev
> *dev) return dev->cdc_filter & USB_CDC_PACKET_TYPE_PROMISCUOUS;
>  }
>  
> -#if 0
>  static int eth_start_xmit (struct sk_buff *skb, struct net_device
> *net) {
>   struct eth_dev  *dev = netdev_priv(net);




Best regards,

Lukasz Majewski

--

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


pgpgUSflGDG5S.pgp
Description: OpenPGP digital signature


[PATCH] x86: qemu-x86_defconfig: Increase CONFIG_SYS_MALLOC_F_LEN

2020-08-25 Thread Stefan Roese
With the upcoming increase of the malloc area in U-Boot
("pci: pci-uclass: Dynamically allocate the PCI regions"), the CI QEMU
x86 test fails:

U-Boot 2020.10-rc2-g0a668f6d38 (Aug 25 2020 - 06:12:51 +)

alloc space exhausted
Error binding driver 'cpu_qemu': -12
Some drivers failed to bind
alloc space exhausted
initcall sequence fff6a760 failed at call fff13b3d (err=-19)

This patch now increases CONFIG_SYS_MALLOC_F_LEN to 0x1000, which is
already used on qemu-x86_64_defconfig.

Signed-off-by: Stefan Roese 
Cc: Tom Rini 
Cc: Simon Glass 
Cc: Bin Meng 
---
 configs/qemu-x86_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/qemu-x86_defconfig b/configs/qemu-x86_defconfig
index 6493fef835..218026b739 100644
--- a/configs/qemu-x86_defconfig
+++ b/configs/qemu-x86_defconfig
@@ -1,5 +1,6 @@
 CONFIG_X86=y
 CONFIG_SYS_TEXT_BASE=0xFFF0
+CONFIG_SYS_MALLOC_F_LEN=0x1000
 CONFIG_NR_DRAM_BANKS=8
 CONFIG_ENV_SIZE=0x4
 CONFIG_MAX_CPUS=2
-- 
2.28.0



[PATCH 29/31] video: omap: split the legacy code from the DM code

2020-08-25 Thread Dario Binacchi
The schedule for deprecating the features of the pre-driver-model puts
2019.17 as the deadline for the video subsystem. Furthermore, the latest
patches applied to the am335x-fb.c module have decreased the amount of
code shared with the pre-driver-model implementation. Splitting the two
implementations into two modules improves the readability of the code
and will make it easier to drop the pre-driver-model code.
I have not created a header file with the data structures and the
constants for accessing the LCD controller registers, but I preferred to
keep them inside the two c modules. This is a code replication until the
pre-driver-model version is dropped.

Signed-off-by: Dario Binacchi 
---

 drivers/video/Makefile   |   5 +-
 drivers/video/am335x-fb.c| 350 
 drivers/video/am335x-fb.h|  35 ---
 drivers/video/tilcdc-panel.c |   2 +-
 drivers/video/tilcdc-panel.h |   2 +-
 drivers/video/tilcdc.c   | 438 +++
 drivers/video/tilcdc.h   |  38 +++
 7 files changed, 481 insertions(+), 389 deletions(-)
 create mode 100644 drivers/video/tilcdc.c
 create mode 100644 drivers/video/tilcdc.h

diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 132a63ecea..29f3434f7c 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -16,7 +16,9 @@ obj-$(CONFIG_DM_VIDEO) += video-uclass.o vidconsole-uclass.o
 obj-$(CONFIG_DM_VIDEO) += video_bmp.o
 obj-$(CONFIG_PANEL) += panel-uclass.o
 obj-$(CONFIG_SIMPLE_PANEL) += simple_panel.o
-obj-$(CONFIG_AM335X_LCD) += tilcdc-panel.o
+obj-$(CONFIG_AM335X_LCD) += tilcdc.o tilcdc-panel.o
+else
+obj-$(CONFIG_AM335X_LCD) += am335x-fb.o
 endif
 
 obj-${CONFIG_EXYNOS_FB} += exynos/
@@ -24,7 +26,6 @@ obj-${CONFIG_VIDEO_ROCKCHIP} += rockchip/
 obj-${CONFIG_VIDEO_STM32} += stm32/
 obj-${CONFIG_VIDEO_TEGRA124} += tegra124/
 
-obj-$(CONFIG_AM335X_LCD) += am335x-fb.o
 obj-$(CONFIG_ATI_RADEON_FB) += ati_radeon_fb.o videomodes.o
 obj-$(CONFIG_ATMEL_HLCD) += atmel_hlcdfb.o
 obj-$(CONFIG_ATMEL_LCD) += atmel_lcdfb.o
diff --git a/drivers/video/am335x-fb.c b/drivers/video/am335x-fb.c
index 021da5de3c..eb9d692035 100644
--- a/drivers/video/am335x-fb.c
+++ b/drivers/video/am335x-fb.c
@@ -12,22 +12,15 @@
  * - starts output DMA from gd->fb_base buffer
  */
 #include 
-#include 
-#include 
 #include 
 #include 
-#include 
-#include 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
-#include 
 #include "am335x-fb.h"
-#include "tilcdc-panel.h"
 
 #define LCDC_FMAX  2
 
@@ -115,8 +108,6 @@ struct am335x_lcdhw {
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#if !CONFIG_IS_ENABLED(DM_VIDEO)
-
 #if !defined(LCD_CNTL_BASE)
 #error "hw-base address of LCD-Controller (LCD_CNTL_BASE) not defined!"
 #endif
@@ -323,344 +314,3 @@ int am335xfb_init(struct am335x_lcdpanel *panel)
 
return 0;
 }
-
-#else /* CONFIG_DM_VIDEO */
-
-#define FBSIZE(t, p)   (((t).hactive.typ * (t).vactive.typ * (p).bpp) >> 3)
-
-enum {
-   LCD_MAX_WIDTH   = 2048,
-   LCD_MAX_HEIGHT  = 2048,
-   LCD_MAX_LOG2_BPP= VIDEO_BPP32,
-};
-
-struct am335x_fb_priv {
-   struct am335x_lcdhw *regs;
-   struct clk clkdm;
-   struct clk gclk;
-   struct clk dpll_m2_clk;
-};
-
-static ulong tilcdc_set_pixel_clk_rate(struct udevice *dev, ulong rate)
-{
-   struct am335x_fb_priv *priv = dev_get_priv(dev);
-   struct am335x_lcdhw *regs = priv->regs;
-   ulong mult_rate, mult_round_rate, best_err, err;
-   u32 v;
-   int div, i;
-
-   best_err = rate;
-   div = 0;
-   for (i = 2; i <= 255; i++) {
-   mult_rate = rate * i;
-   mult_round_rate = clk_round_rate(>gclk, mult_rate);
-   if (IS_ERR_VALUE(mult_round_rate))
-   return mult_round_rate;
-
-   err = mult_rate - mult_round_rate;
-   if (err < best_err) {
-   best_err = err;
-   div = i;
-   if (err == 0)
-   break;
-   }
-   }
-
-   if (div == 0) {
-   dev_err(dev, "failed to find a divisor\n");
-   return -EFAULT;
-   }
-
-   mult_rate = clk_set_rate(>gclk, rate * div);
-   v = readl(>ctrl) & ~LCDC_CTRL_CLK_DIVISOR_MASK;
-   v |= LCDC_CTRL_CLK_DIVISOR(div);
-   writel(v, >ctrl);
-   rate = mult_rate / div;
-   dev_dbg(dev, "rate=%ld, div=%d, err=%ld\n", rate, div, err);
-   return rate;
-}
-
-static int am335x_fb_remove(struct udevice *dev)
-{
-   struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev);
-   struct am335x_fb_priv *priv = dev_get_priv(dev);
-
-   uc_plat->base -= 0x20;
-   uc_plat->size += 0x20;
-   clk_release_all(>gclk, 1);
-   clk_release_all(>dpll_m2_clk, 1);
-   clk_release_all(>clkdm, 1);
-   return 0;
-}
-
-static int am335x_fb_probe(struct udevice *dev)
-{
-   struct 

[PATCH 30/31] video: omap: move drivers to 'ti' directory

2020-08-25 Thread Dario Binacchi
Add drivers/video/ti/ folder and move all TI's code in this folder for
better maintenance.

Signed-off-by: Dario Binacchi 
---

 drivers/video/Kconfig |  5 +
 drivers/video/Makefile|  4 +---
 drivers/video/ti/Kconfig  |  8 
 drivers/video/ti/Makefile | 10 ++
 drivers/video/{ => ti}/am335x-fb.c|  0
 drivers/video/{ => ti}/am335x-fb.h|  0
 drivers/video/{ => ti}/tilcdc-panel.c |  0
 drivers/video/{ => ti}/tilcdc-panel.h |  0
 drivers/video/{ => ti}/tilcdc.c   |  0
 drivers/video/{ => ti}/tilcdc.h   |  0
 10 files changed, 20 insertions(+), 7 deletions(-)
 create mode 100644 drivers/video/ti/Kconfig
 create mode 100644 drivers/video/ti/Makefile
 rename drivers/video/{ => ti}/am335x-fb.c (100%)
 rename drivers/video/{ => ti}/am335x-fb.h (100%)
 rename drivers/video/{ => ti}/tilcdc-panel.c (100%)
 rename drivers/video/{ => ti}/tilcdc-panel.h (100%)
 rename drivers/video/{ => ti}/tilcdc.c (100%)
 rename drivers/video/{ => ti}/tilcdc.h (100%)

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index e2e1f9c476..31a6d84e20 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -546,10 +546,7 @@ config ATMEL_HLCD
help
   HLCDC supports video output to an attached LCD panel.
 
-config AM335X_LCD
-   bool "Enable AM335x video support"
-   help
-  Supports video output to an attached LCD panel.
+source "drivers/video/ti/Kconfig"
 
 config LOGICORE_DP_TX
bool "Enable Logicore DP TX driver"
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 29f3434f7c..38e181a779 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -16,15 +16,13 @@ obj-$(CONFIG_DM_VIDEO) += video-uclass.o vidconsole-uclass.o
 obj-$(CONFIG_DM_VIDEO) += video_bmp.o
 obj-$(CONFIG_PANEL) += panel-uclass.o
 obj-$(CONFIG_SIMPLE_PANEL) += simple_panel.o
-obj-$(CONFIG_AM335X_LCD) += tilcdc.o tilcdc-panel.o
-else
-obj-$(CONFIG_AM335X_LCD) += am335x-fb.o
 endif
 
 obj-${CONFIG_EXYNOS_FB} += exynos/
 obj-${CONFIG_VIDEO_ROCKCHIP} += rockchip/
 obj-${CONFIG_VIDEO_STM32} += stm32/
 obj-${CONFIG_VIDEO_TEGRA124} += tegra124/
+obj-${CONFIG_AM335X_LCD} += ti/
 
 obj-$(CONFIG_ATI_RADEON_FB) += ati_radeon_fb.o videomodes.o
 obj-$(CONFIG_ATMEL_HLCD) += atmel_hlcdfb.o
diff --git a/drivers/video/ti/Kconfig b/drivers/video/ti/Kconfig
new file mode 100644
index 00..3081e9e8c0
--- /dev/null
+++ b/drivers/video/ti/Kconfig
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2020 Dario Binacchi 
+#
+config AM335X_LCD
+   bool "Enable AM335x video support"
+   help
+  Supports video output to an attached LCD panel.
diff --git a/drivers/video/ti/Makefile b/drivers/video/ti/Makefile
new file mode 100644
index 00..f0410debf4
--- /dev/null
+++ b/drivers/video/ti/Makefile
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2020 Dario Binacchi 
+#
+
+ifdef CONFIG_DM
+obj-$(CONFIG_AM335X_LCD) += tilcdc.o tilcdc-panel.o
+else
+obj-$(CONFIG_AM335X_LCD) += am335x-fb.o
+endif
diff --git a/drivers/video/am335x-fb.c b/drivers/video/ti/am335x-fb.c
similarity index 100%
rename from drivers/video/am335x-fb.c
rename to drivers/video/ti/am335x-fb.c
diff --git a/drivers/video/am335x-fb.h b/drivers/video/ti/am335x-fb.h
similarity index 100%
rename from drivers/video/am335x-fb.h
rename to drivers/video/ti/am335x-fb.h
diff --git a/drivers/video/tilcdc-panel.c b/drivers/video/ti/tilcdc-panel.c
similarity index 100%
rename from drivers/video/tilcdc-panel.c
rename to drivers/video/ti/tilcdc-panel.c
diff --git a/drivers/video/tilcdc-panel.h b/drivers/video/ti/tilcdc-panel.h
similarity index 100%
rename from drivers/video/tilcdc-panel.h
rename to drivers/video/ti/tilcdc-panel.h
diff --git a/drivers/video/tilcdc.c b/drivers/video/ti/tilcdc.c
similarity index 100%
rename from drivers/video/tilcdc.c
rename to drivers/video/ti/tilcdc.c
diff --git a/drivers/video/tilcdc.h b/drivers/video/ti/tilcdc.h
similarity index 100%
rename from drivers/video/tilcdc.h
rename to drivers/video/ti/tilcdc.h
-- 
2.17.1



[PATCH 28/31] video: omap: set LCD clock rate through DM API

2020-08-25 Thread Dario Binacchi
The patch configures the display DPLL using the functions provided by
the driver model API for the clock. The device tree contains everything
needed to get the DPLL clock. The round rate function developed for
calculating the DPLL multiplier and divisor and the platform routines
for accessing the DPLL registers are removed from the LCD driver code
because they are implemented inside the DPLL clock driver.

Signed-off-by: Dario Binacchi 
---

 drivers/video/am335x-fb.c | 127 ++
 1 file changed, 101 insertions(+), 26 deletions(-)

diff --git a/drivers/video/am335x-fb.c b/drivers/video/am335x-fb.c
index 104f7891cc..021da5de3c 100644
--- a/drivers/video/am335x-fb.c
+++ b/drivers/video/am335x-fb.c
@@ -113,6 +113,27 @@ struct am335x_lcdhw {
unsigned intclkc_reset; /* 0x70 */
 };
 
+DECLARE_GLOBAL_DATA_PTR;
+
+#if !CONFIG_IS_ENABLED(DM_VIDEO)
+
+#if !defined(LCD_CNTL_BASE)
+#error "hw-base address of LCD-Controller (LCD_CNTL_BASE) not defined!"
+#endif
+
+/* Macro definitions */
+#define FBSIZE(x)  (((x)->hactive * (x)->vactive * (x)->bpp) >> 3)
+
+#define LCDC_RASTER_TIMING_2_INVMASK(x)((x) & GENMASK(25, 20))
+
+static struct am335x_lcdhw *lcdhw = (void *)LCD_CNTL_BASE;
+
+int lcd_get_size(int *line_length)
+{
+   *line_length = (panel_info.vl_col * NBITS(panel_info.vl_bpix)) / 8;
+   return *line_length * panel_info.vl_row + 0x20;
+}
+
 struct dpll_data {
unsigned long rounded_rate;
u16 rounded_m;
@@ -120,8 +141,6 @@ struct dpll_data {
u8 rounded_div;
 };
 
-DECLARE_GLOBAL_DATA_PTR;
-
 /**
  * am335x_dpll_round_rate() - Round a target rate for an OMAP DPLL
  *
@@ -200,25 +219,6 @@ static ulong am335x_fb_set_pixel_clk_rate(struct 
am335x_lcdhw *regs, ulong rate)
return round_rate;
 }
 
-#if !CONFIG_IS_ENABLED(DM_VIDEO)
-
-#if !defined(LCD_CNTL_BASE)
-#error "hw-base address of LCD-Controller (LCD_CNTL_BASE) not defined!"
-#endif
-
-/* Macro definitions */
-#define FBSIZE(x)  (((x)->hactive * (x)->vactive * (x)->bpp) >> 3)
-
-#define LCDC_RASTER_TIMING_2_INVMASK(x)((x) & GENMASK(25, 20))
-
-static struct am335x_lcdhw *lcdhw = (void *)LCD_CNTL_BASE;
-
-int lcd_get_size(int *line_length)
-{
-   *line_length = (panel_info.vl_col * NBITS(panel_info.vl_bpix)) / 8;
-   return *line_length * panel_info.vl_row + 0x20;
-}
-
 int am335xfb_init(struct am335x_lcdpanel *panel)
 {
u32 raster_ctrl = 0;
@@ -337,8 +337,49 @@ enum {
 struct am335x_fb_priv {
struct am335x_lcdhw *regs;
struct clk clkdm;
+   struct clk gclk;
+   struct clk dpll_m2_clk;
 };
 
+static ulong tilcdc_set_pixel_clk_rate(struct udevice *dev, ulong rate)
+{
+   struct am335x_fb_priv *priv = dev_get_priv(dev);
+   struct am335x_lcdhw *regs = priv->regs;
+   ulong mult_rate, mult_round_rate, best_err, err;
+   u32 v;
+   int div, i;
+
+   best_err = rate;
+   div = 0;
+   for (i = 2; i <= 255; i++) {
+   mult_rate = rate * i;
+   mult_round_rate = clk_round_rate(>gclk, mult_rate);
+   if (IS_ERR_VALUE(mult_round_rate))
+   return mult_round_rate;
+
+   err = mult_rate - mult_round_rate;
+   if (err < best_err) {
+   best_err = err;
+   div = i;
+   if (err == 0)
+   break;
+   }
+   }
+
+   if (div == 0) {
+   dev_err(dev, "failed to find a divisor\n");
+   return -EFAULT;
+   }
+
+   mult_rate = clk_set_rate(>gclk, rate * div);
+   v = readl(>ctrl) & ~LCDC_CTRL_CLK_DIVISOR_MASK;
+   v |= LCDC_CTRL_CLK_DIVISOR(div);
+   writel(v, >ctrl);
+   rate = mult_rate / div;
+   dev_dbg(dev, "rate=%ld, div=%d, err=%ld\n", rate, div, err);
+   return rate;
+}
+
 static int am335x_fb_remove(struct udevice *dev)
 {
struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev);
@@ -346,6 +387,8 @@ static int am335x_fb_remove(struct udevice *dev)
 
uc_plat->base -= 0x20;
uc_plat->size += 0x20;
+   clk_release_all(>gclk, 1);
+   clk_release_all(>dpll_m2_clk, 1);
clk_release_all(>clkdm, 1);
return 0;
 }
@@ -356,10 +399,10 @@ static int am335x_fb_probe(struct udevice *dev)
struct video_priv *uc_priv = dev_get_uclass_priv(dev);
struct am335x_fb_priv *priv = dev_get_priv(dev);
struct am335x_lcdhw *regs = priv->regs;
-   struct udevice *panel;
+   struct udevice *panel, *clk_dev;
struct tilcdc_panel_info info;
struct display_timing timing;
-   struct cm_dpll *const cmdpll = (struct cm_dpll *)CM_DPLL;
+   ulong rate;
u32 reg;
int err;
 
@@ -432,10 +475,42 @@ static int am335x_fb_probe(struct udevice *dev)
return err;
}
 
-   am335x_fb_set_pixel_clk_rate(regs, 

[PATCH 31/31] board: ti: am335x-ice: get CDCE913 clock device

2020-08-25 Thread Dario Binacchi
With support for other clock drivers, the potentially supported CDCE913
device can no longer be probed without specifying its DT node name.

Signed-off-by: Dario Binacchi 

---

 board/ti/am335x/board.c | 2 +-
 board/ti/am43xx/board.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c
index 984cc5e3ba..e1f64859cf 100644
--- a/board/ti/am335x/board.c
+++ b/board/ti/am335x/board.c
@@ -879,7 +879,7 @@ int board_late_init(void)
}
 
/* Just probe the potentially supported cdce913 device */
-   uclass_get_device(UCLASS_CLK, 0, );
+   uclass_get_device_by_name(UCLASS_CLK, "cdce913@65", );
 
return 0;
 }
diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c
index de49590031..62ed37cb48 100644
--- a/board/ti/am43xx/board.c
+++ b/board/ti/am43xx/board.c
@@ -744,7 +744,7 @@ int board_late_init(void)
 #endif
 
/* Just probe the potentially supported cdce913 device */
-   uclass_get_device(UCLASS_CLK, 0, );
+   uclass_get_device_by_name(UCLASS_CLK, "cdce913@65", );
 
return 0;
 }
-- 
2.17.1



[PATCH 27/31] video: omap: enable LCD clock domain through DM API

2020-08-25 Thread Dario Binacchi
The patch enables/disables the LCD domain clock when the device is
probed/removed.

To get the LCD domain clock, the device tree had to be changed. In the
Beaglebone device tree of the most recent Linux kernels, the LCD
controller node is the child of a node that the documentation explains
to be an interconnect module with one or more devices connected to it,
which manages, among other things, even the clocks.

target-module@e000 {  /* 0x4830e000, ap 72 4a.0 */
compatible = "ti,sysc-omap4", "ti,sysc";
reg = <0xe000 0x4>,
<0xe054 0x4>;
reg-names = "rev", "sysc";
ti,sysc-midle = ,
,
;
ti,sysc-sidle = ,
,
;
/* Domains (P, C): per_pwrdm, lcdc_clkdm */
clocks = <_clkctrl AM3_LCDC_LCDC_CLKCTRL 0>;
clock-names = "fck";
#address-cells = <1>;
#size-cells = <1>;
ranges = <0x0 0xe000 0x1000>;

lcdc: lcdc@0 {
compatible = "ti,am33xx-tilcdc";
reg = <0x0 0x1000>;
interrupts = <36>;
status = "disabled";
};
};

This shows that the domain clock reference is missing in the U-Boot
device tree and that replicating the most recent kernels structure in
U-Boot is now to be avoided. Since the LCD controller node is not the
child of any interconnection node in the current device tree, I added
the domain clock reference inside the LCD controller node. I think
getting the domain clock from the device tree and using the driver
model API is still an improvement. In the future, when possible, we can
move the domain clock in the interconnection module created for the LCD
controller node.

Signed-off-by: Dario Binacchi 
---

 arch/arm/dts/am33xx.dtsi  |  3 +++
 arch/arm/mach-omap2/am33xx/clock_am33xx.c |  2 +-
 drivers/video/am335x-fb.c | 16 
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/arch/arm/dts/am33xx.dtsi b/arch/arm/dts/am33xx.dtsi
index fa7492a9b6..2e123aab87 100644
--- a/arch/arm/dts/am33xx.dtsi
+++ b/arch/arm/dts/am33xx.dtsi
@@ -946,6 +946,9 @@
reg = <0x4830e000 0x1000>;
interrupts = <36>;
ti,hwmods = "lcdc";
+   clocks = <_per_clkctrl AM3_LCDC_CLKCTRL 0>;
+   clock-names = "fck";
+
status = "disabled";
};
 
diff --git a/arch/arm/mach-omap2/am33xx/clock_am33xx.c 
b/arch/arm/mach-omap2/am33xx/clock_am33xx.c
index 2427933c8b..cf71192360 100644
--- a/arch/arm/mach-omap2/am33xx/clock_am33xx.c
+++ b/arch/arm/mach-omap2/am33xx/clock_am33xx.c
@@ -226,7 +226,7 @@ void enable_basic_clocks(void)
>usb0clkctrl,
>emiffwclkctrl,
>emifclkctrl,
-#if CONFIG_IS_ENABLED(AM335X_LCD)
+#if CONFIG_IS_ENABLED(AM335X_LCD) && !CONFIG_IS_ENABLED(DM_VIDEO)
>lcdclkctrl,
>lcdcclkstctrl,
 #endif
diff --git a/drivers/video/am335x-fb.c b/drivers/video/am335x-fb.c
index dc959baa27..104f7891cc 100644
--- a/drivers/video/am335x-fb.c
+++ b/drivers/video/am335x-fb.c
@@ -12,6 +12,7 @@
  * - starts output DMA from gd->fb_base buffer
  */
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -335,14 +336,17 @@ enum {
 
 struct am335x_fb_priv {
struct am335x_lcdhw *regs;
+   struct clk clkdm;
 };
 
 static int am335x_fb_remove(struct udevice *dev)
 {
struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev);
+   struct am335x_fb_priv *priv = dev_get_priv(dev);
 
uc_plat->base -= 0x20;
uc_plat->size += 0x20;
+   clk_release_all(>clkdm, 1);
return 0;
 }
 
@@ -416,6 +420,18 @@ static int am335x_fb_probe(struct udevice *dev)
return -EINVAL;
}
 
+   err = clk_get_by_name(dev, "fck", >clkdm);
+   if (err) {
+   dev_err(dev, "%s: failed to get clock domain\n", __func__);
+   return err;
+   }
+
+   err = clk_enable(>clkdm);
+   if (err) {
+   dev_err(dev, "%s: failed to enable clock domain\n", __func__);
+   return err;
+   }
+
am335x_fb_set_pixel_clk_rate(regs, timing.pixelclock.typ);
 
/* clock source for LCDC from dispPLL M2 */
-- 
2.17.1



[PATCH 26/31] video: omap: add panel driver

2020-08-25 Thread Dario Binacchi
The previous version of am335x-fb.c contained the functionalities of two
drivers that this patch has split. It was a video type driver that used
the same registration compatible string that now registers a panel type
driver. The proof of this is that two compatible strings were referred
to within the same driver.
There are now two drivers, each with its own compatible string,
functions and API.
Furthermore, the panel driver, in addition to decoding the display
timings, is now also able to manage the backlight.

Signed-off-by: Dario Binacchi 
---

 arch/arm/dts/am335x-brppt1-mmc.dts   |   3 +-
 arch/arm/dts/am335x-brppt1-nand.dts  |   3 +-
 arch/arm/dts/am335x-brppt1-spi.dts   |   3 +-
 arch/arm/dts/am335x-brsmarc1.dts |   2 +-
 arch/arm/dts/am335x-brxre1.dts   |   3 +-
 arch/arm/dts/am335x-evm-u-boot.dtsi  |   7 +-
 arch/arm/dts/am335x-evmsk-u-boot.dtsi|   6 +-
 arch/arm/dts/am335x-guardian-u-boot.dtsi |   8 +-
 arch/arm/dts/am335x-pdu001-u-boot.dtsi   |   8 +-
 arch/arm/dts/am335x-pxm50-u-boot.dtsi|   6 +-
 arch/arm/dts/am335x-rut-u-boot.dtsi  |   6 +-
 arch/arm/dts/da850-evm-u-boot.dtsi   |   8 +-
 drivers/video/Makefile   |   1 +
 drivers/video/am335x-fb.c| 255 ++-
 drivers/video/am335x-fb.h|  31 +++
 drivers/video/tilcdc-panel.c | 171 +++
 drivers/video/tilcdc-panel.h |  14 ++
 17 files changed, 347 insertions(+), 188 deletions(-)
 create mode 100644 drivers/video/tilcdc-panel.c
 create mode 100644 drivers/video/tilcdc-panel.h

diff --git a/arch/arm/dts/am335x-brppt1-mmc.dts 
b/arch/arm/dts/am335x-brppt1-mmc.dts
index 6f919711f0..9de48bcdde 100644
--- a/arch/arm/dts/am335x-brppt1-mmc.dts
+++ b/arch/arm/dts/am335x-brppt1-mmc.dts
@@ -53,8 +53,6 @@
bkl-pwm = <>;
bkl-tps = <_bl>;
 
-   u-boot,dm-pre-reloc;
-
panel-info {
ac-bias = <255>;
ac-bias-intrpt  = <0>;
@@ -239,6 +237,7 @@
 };
 
  {
+   u-boot,dm-pre-reloc;
status = "disabled";
 };
 
diff --git a/arch/arm/dts/am335x-brppt1-nand.dts 
b/arch/arm/dts/am335x-brppt1-nand.dts
index 9d4340f591..c09651cf13 100644
--- a/arch/arm/dts/am335x-brppt1-nand.dts
+++ b/arch/arm/dts/am335x-brppt1-nand.dts
@@ -53,8 +53,6 @@
bkl-pwm = <>;
bkl-tps = <_bl>;
 
-   u-boot,dm-pre-reloc;
-
panel-info {
ac-bias = <255>;
ac-bias-intrpt  = <0>;
@@ -229,6 +227,7 @@
 };
 
  {
+   u-boot,dm-pre-reloc;
status = "disabled";
 };
 
diff --git a/arch/arm/dts/am335x-brppt1-spi.dts 
b/arch/arm/dts/am335x-brppt1-spi.dts
index c078af8fba..6c86d56906 100644
--- a/arch/arm/dts/am335x-brppt1-spi.dts
+++ b/arch/arm/dts/am335x-brppt1-spi.dts
@@ -54,8 +54,6 @@
bkl-pwm = <>;
bkl-tps = <_bl>;
 
-   u-boot,dm-pre-reloc;
-
panel-info {
ac-bias = <255>;
ac-bias-intrpt  = <0>;
@@ -260,6 +258,7 @@
 };
 
  {
+   u-boot,dm-pre-reloc;
status = "disabled";
 };
 
diff --git a/arch/arm/dts/am335x-brsmarc1.dts b/arch/arm/dts/am335x-brsmarc1.dts
index 7e9516e8f8..309adbc1ab 100644
--- a/arch/arm/dts/am335x-brsmarc1.dts
+++ b/arch/arm/dts/am335x-brsmarc1.dts
@@ -59,7 +59,6 @@
/*backlight = <_bl>; */
compatible = "ti,tilcdc,panel";
status = "okay";
-   u-boot,dm-pre-reloc;
 
panel-info {
ac-bias = <255>;
@@ -299,6 +298,7 @@
 };
 
  {
+   u-boot,dm-pre-reloc;
status = "okay";
ti,no-reset-on-init;
ti,no-idle-on-init;
diff --git a/arch/arm/dts/am335x-brxre1.dts b/arch/arm/dts/am335x-brxre1.dts
index 6091a12fb7..89e84c8e1a 100644
--- a/arch/arm/dts/am335x-brxre1.dts
+++ b/arch/arm/dts/am335x-brxre1.dts
@@ -79,8 +79,6 @@
 
backlight = <_bl>;
 
-   u-boot,dm-pre-reloc;
-
panel-info {
ac-bias = <255>;
ac-bias-intrpt  = <0>;
@@ -255,6 +253,7 @@
 };
 
  {
+   u-boot,dm-pre-reloc;
status = "okay";
ti,no-reset-on-init;
ti,no-idle-on-init;
diff --git a/arch/arm/dts/am335x-evm-u-boot.dtsi 
b/arch/arm/dts/am335x-evm-u-boot.dtsi
index d7b049ef20..4a61cbbd49 100644
--- a/arch/arm/dts/am335x-evm-u-boot.dtsi
+++ b/arch/arm/dts/am335x-evm-u-boot.dtsi
@@ -3,13 +3,10 @@
  * Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/
  */
 
-/ {
-   panel {
-   u-boot,dm-pre-reloc;
-   };
+ {
+   u-boot,dm-pre-reloc;
 };
 
-
  {
status = "disabled";
 };
diff --git a/arch/arm/dts/am335x-evmsk-u-boot.dtsi 
b/arch/arm/dts/am335x-evmsk-u-boot.dtsi
index 599fb377e6..b15ba0dcae 100644
--- 

[PATCH 25/31] dm: core: add a function to decode display timings

2020-08-25 Thread Dario Binacchi
The patch adds a function to get display timings from the device tree
node attached to the device.

Signed-off-by: Dario Binacchi 
---

 arch/sandbox/dts/test.dts | 46 ++
 drivers/core/read.c   |  6 +++
 include/dm/read.h | 24 
 test/dm/test-fdt.c| 80 +++
 4 files changed, 156 insertions(+)

diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index 7f5d8f3aeb..dcf1a94b82 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -129,6 +129,52 @@
str-value = "test string";
interrupts-extended = < 3 0>;
acpi,name = "GHIJ";
+   display-timings {
+   timing0: 240x320 {
+   clock-frequency = <650>;
+   hactive = <240>;
+   vactive = <320>;
+   hfront-porch = <6>;
+   hback-porch = <7>;
+   hsync-len = <1>;
+   vback-porch = <5>;
+   vfront-porch = <8>;
+   vsync-len = <2>;
+   hsync-active = <1>;
+   vsync-active = <0>;
+   de-active = <1>;
+   pixelclk-active = <1>;
+   interlaced;
+   doublescan;
+   doubleclk;
+   };
+   timing1: 480x800 {
+   clock-frequency = <900>;
+   hactive = <480>;
+   vactive = <800>;
+   hfront-porch = <10>;
+   hback-porch = <59>;
+   hsync-len = <12>;
+   vback-porch = <15>;
+   vfront-porch = <17>;
+   vsync-len = <16>;
+   hsync-active = <0>;
+   vsync-active = <1>;
+   de-active = <0>;
+   pixelclk-active = <0>;
+   };
+   timing2: 800x480 {
+   clock-frequency = <3350>;
+   hactive = <800>;
+   vactive = <480>;
+   hback-porch = <89>;
+   hfront-porch = <164>;
+   vback-porch = <23>;
+   vfront-porch = <10>;
+   hsync-len = <11>;
+   vsync-len = <13>;
+   };
+   };
};
 
junk {
diff --git a/drivers/core/read.c b/drivers/core/read.c
index 8bb456bc3f..27715942d0 100644
--- a/drivers/core/read.c
+++ b/drivers/core/read.c
@@ -359,3 +359,9 @@ int dev_get_child_count(const struct udevice *dev)
 {
return ofnode_get_child_count(dev_ofnode(dev));
 }
+
+int dev_decode_display_timing(const struct udevice *dev, int index,
+ struct display_timing *config)
+{
+   return ofnode_decode_display_timing(dev_ofnode(dev), index, config);
+}
diff --git a/include/dm/read.h b/include/dm/read.h
index 0a7aacd2d0..7c15d51cf2 100644
--- a/include/dm/read.h
+++ b/include/dm/read.h
@@ -680,6 +680,23 @@ int dev_read_alias_highest_id(const char *stem);
  */
 int dev_get_child_count(const struct udevice *dev);
 
+/**
+ * dev_decode_display_timing() - decode display timings
+ *
+ * Decode display timings from the supplied 'display-timings' node.
+ * See doc/device-tree-bindings/video/display-timing.txt for binding
+ * information.
+ *
+ * @dev: device to read DT display timings from. The node linked to the device
+ *   contains a child node called 'display-timings' which in turn contains
+ *   one or more display timing nodes.
+ * @index: index number to read (0=first timing subnode)
+ * @config: place to put timings
+ * @return 0 if OK, -FDT_ERR_NOTFOUND if not found
+ */
+int dev_decode_display_timing(const struct udevice *dev, int index,
+ struct display_timing *config);
+
 #else /* CONFIG_DM_DEV_READ_INLINE is enabled */
 
 static inline int dev_read_u32(const struct udevice *dev,
@@ -1002,6 +1019,13 @@ static inline int dev_get_child_count(const struct 
udevice *dev)
return ofnode_get_child_count(dev_ofnode(dev));
 }
 
+static inline int dev_decode_display_timing(const struct udevice *dev,
+   int index,
+   struct display_timing *config)
+{
+   return ofnode_decode_display_timing(dev_ofnode(dev), index, config);
+}
+
 #endif /* CONFIG_DM_DEV_READ_INLINE */
 
 /**

[PATCH 24/31] gpio: fix gpio_request_by_name() description

2020-08-25 Thread Dario Binacchi
Replace 'dev->dev' with '@desc->dev' in the gpio_request_by_name function
desc parameter description.

Signed-off-by: Dario Binacchi 
---

 include/asm-generic/gpio.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index a57dd2665c..f469564f83 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -496,7 +496,7 @@ int gpio_claim_vector(const int *gpio_num_array, const char 
*fmt);
  * @list_name: Name of GPIO list (e.g. "board-id-gpios")
  * @index: Index number of the GPIO in that list use request (0=first)
  * @desc:  Returns GPIO description information. If there is no such
- * GPIO, dev->dev will be NULL.
+ * GPIO, @desc->dev will be NULL.
  * @flags: Indicates the GPIO input/output settings (GPIOD_...)
  * @return 0 if OK, -ENOENT if the GPIO does not exist, -EINVAL if there is
  * something wrong with the list, or other -ve for another error (e.g.
-- 
2.17.1



[PATCH 19/31] pwm: ti: am33xx: add enhanced pwm driver

2020-08-25 Thread Dario Binacchi
Enhanced high resolution PWM module (EHRPWM) hardware can be used to
generate PWM output over 2 channels. This commit adds PWM driver support
for EHRPWM device present on AM33XX SOC.

The code is based on the drivers/pwm/pwm-tiehrpwm.c driver of the Linux
kernel.

Signed-off-by: Dario Binacchi 
---

 doc/device-tree-bindings/pwm/ti,ehrpwm.txt |  49 +++
 drivers/pwm/Kconfig|   6 +
 drivers/pwm/Makefile   |   1 +
 drivers/pwm/pwm-ti-ehrpwm.c| 465 +
 4 files changed, 521 insertions(+)
 create mode 100644 doc/device-tree-bindings/pwm/ti,ehrpwm.txt
 create mode 100644 drivers/pwm/pwm-ti-ehrpwm.c

diff --git a/doc/device-tree-bindings/pwm/ti,ehrpwm.txt 
b/doc/device-tree-bindings/pwm/ti,ehrpwm.txt
new file mode 100644
index 00..12f1e3bf80
--- /dev/null
+++ b/doc/device-tree-bindings/pwm/ti,ehrpwm.txt
@@ -0,0 +1,49 @@
+TI SOC EHRPWM based PWM controller
+
+Required properties:
+- compatible: Must be "ti,-ehrpwm".
+  for am33xx  - compatible = "ti,am3352-ehrpwm", "ti,am33xx-ehrpwm";
+  for am4372  - compatible = "ti,am4372-ehrpwm", "ti-am3352-ehrpwm", 
"ti,am33xx-ehrpwm";
+  for am654   - compatible = "ti,am654-ehrpwm", "ti-am3352-ehrpwm";
+  for da850   - compatible = "ti,da850-ehrpwm", "ti-am3352-ehrpwm", 
"ti,am33xx-ehrpwm";
+  for dra746 - compatible = "ti,dra746-ehrpwm", "ti-am3352-ehrpwm";
+- #pwm-cells: should be 3. The only third cell flag supported by this binding 
is
+  PWM_POLARITY_INVERTED.
+- reg: physical base address and size of the registers map.
+
+Optional properties:
+- clocks: Handle to the PWM's time-base and functional clock.
+- clock-names: Must be set to "tbclk" and "fck".
+
+Example:
+
+ehrpwm0: pwm@48300200 { /* EHRPWM on am33xx */
+   compatible = "ti,am3352-ehrpwm", "ti,am33xx-ehrpwm";
+   #pwm-cells = <3>;
+   reg = <0x48300200 0x100>;
+   clocks = <_tbclk>, <_gclk>;
+   clock-names = "tbclk", "fck";
+};
+
+ehrpwm0: pwm@48300200 { /* EHRPWM on am4372 */
+   compatible = "ti,am4372-ehrpwm", "ti,am3352-ehrpwm", "ti,am33xx-ehrpwm";
+   #pwm-cells = <3>;
+   reg = <0x48300200 0x80>;
+   clocks = <_tbclk>, <_gclk>;
+   clock-names = "tbclk", "fck";
+   ti,hwmods = "ehrpwm0";
+};
+
+ehrpwm0: pwm@1f0 { /* EHRPWM on da850 */
+   compatible = "ti,da850-ehrpwm", "ti,am3352-ehrpwm", "ti,am33xx-ehrpwm";
+   #pwm-cells = <3>;
+   reg = <0x1f0 0x2000>;
+};
+
+ehrpwm0: pwm@4843e200 { /* EHRPWM on dra746 */
+   compatible = "ti,dra746-ehrpwm", "ti,am3352-ehrpwm";
+   #pwm-cells = <3>;
+   reg = <0x4843e200 0x80>;
+   clocks = <_tbclk>, <_root_clk_div>;
+   clock-names = "tbclk", "fck";
+};
diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
index 61eb468cde..e4ba8b3d80 100644
--- a/drivers/pwm/Kconfig
+++ b/drivers/pwm/Kconfig
@@ -68,3 +68,9 @@ config PWM_SUNXI
help
  This PWM is found on H3, A64 and other Allwinner SoCs. It supports a
  programmable period and duty cycle. A 16-bit counter is used.
+
+config PWM_TI_EHRPWM
+   bool "Enable support for the AM335x EHRPWM"
+   depends on DM_PWM
+   help
+ This enables the AM335x EHRPWM driver support on TI's SoCs.
diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile
index 0f4e84b04d..c5f88f7501 100644
--- a/drivers/pwm/Makefile
+++ b/drivers/pwm/Makefile
@@ -18,3 +18,4 @@ obj-$(CONFIG_PWM_SANDBOX) += sandbox_pwm.o
 obj-$(CONFIG_PWM_SIFIVE)   += pwm-sifive.o
 obj-$(CONFIG_PWM_TEGRA)+= tegra_pwm.o
 obj-$(CONFIG_PWM_SUNXI)+= sunxi_pwm.o
+obj-$(CONFIG_PWM_TI_EHRPWM)+= pwm-ti-ehrpwm.o
diff --git a/drivers/pwm/pwm-ti-ehrpwm.c b/drivers/pwm/pwm-ti-ehrpwm.c
new file mode 100644
index 00..f46eb9ec37
--- /dev/null
+++ b/drivers/pwm/pwm-ti-ehrpwm.c
@@ -0,0 +1,465 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * EHRPWM PWM driver
+ *
+ * Copyright (C) 2020 Dario Binacchi 
+ *
+ * Based on Linux kernel drivers/pwm/pwm-tiehrpwm.c
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define NSEC_PER_SEC   10L
+
+/* Time base module registers */
+#define TI_EHRPWM_TBCTL0x00
+#define TI_EHRPWM_TBPRD0x0A
+
+#define TI_EHRPWM_TBCTL_PRDLD_MASK BIT(3)
+#define TI_EHRPWM_TBCTL_PRDLD_SHDW 0
+#define TI_EHRPWM_TBCTL_PRDLD_IMDT BIT(3)
+#define TI_EHRPWM_TBCTL_CLKDIV_MASKGENMASK(12, 7)
+#define TI_EHRPWM_TBCTL_CTRMODE_MASK   GENMASK(1, 0)
+#define TI_EHRPWM_TBCTL_CTRMODE_UP 0
+#define TI_EHRPWM_TBCTL_CTRMODE_DOWN   BIT(0)
+#define TI_EHRPWM_TBCTL_CTRMODE_UPDOWN BIT(1)
+#define TI_EHRPWM_TBCTL_CTRMODE_FREEZE GENMASK(1, 0)
+
+#define TI_EHRPWM_TBCTL_HSPCLKDIV_SHIFT7
+#define TI_EHRPWM_TBCTL_CLKDIV_SHIFT   10
+
+#define TI_EHRPWM_CLKDIV_MAX   7
+#define 

[PATCH 23/31] dm: core: improve uclass_get_device_by_phandle_id() description

2020-08-25 Thread Dario Binacchi
Complete the devp parameter description.

Signed-off-by: Dario Binacchi 
---

 include/dm/uclass.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/dm/uclass.h b/include/dm/uclass.h
index 67ff7466c8..7188304304 100644
--- a/include/dm/uclass.h
+++ b/include/dm/uclass.h
@@ -224,7 +224,8 @@ int uclass_get_device_by_ofnode(enum uclass_id id, ofnode 
node,
  *
  * @id: uclass ID to look up
  * @phandle_id: the phandle id to look up
- * @devp: Returns pointer to device (there is only one for each node)
+ * @devp: Returns pointer to device (there is only one for each node). NULL if
+ * there is no such device.
  * @return 0 if OK, -ENODEV if there is no device match the phandle, other
  * -ve on error
  */
-- 
2.17.1



[PATCH 22/31] video: backlight: fix pwm data structure description

2020-08-25 Thread Dario Binacchi
The description of the 'max_level' field was incorrectly assigned to the
'min_level' field.

Signed-off-by: Dario Binacchi 
---

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

diff --git a/drivers/video/pwm_backlight.c b/drivers/video/pwm_backlight.c
index 199ccc030f..9519180ceb 100644
--- a/drivers/video/pwm_backlight.c
+++ b/drivers/video/pwm_backlight.c
@@ -33,7 +33,7 @@
  * @cur_level: Current level for the backlight (index or value)
  * @default_level: Default level for the backlight (index or value)
  * @min_level: Minimum level of the backlight (full off)
- * @min_level: Maximum level of the backlight (full on)
+ * @max_level: Maximum level of the backlight (full on)
  * @enabled: true if backlight is enabled
  */
 struct pwm_backlight_priv {
-- 
2.17.1



[PATCH 21/31] video: backlight: fix pwm's duty cycle calculation

2020-08-25 Thread Dario Binacchi
For levels equal to the maximum value, the duty cycle must be equal to
the period.

Signed-off-by: Dario Binacchi 
---

 drivers/video/pwm_backlight.c |  2 +-
 test/dm/panel.c   | 12 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/video/pwm_backlight.c b/drivers/video/pwm_backlight.c
index 468a5703bd..199ccc030f 100644
--- a/drivers/video/pwm_backlight.c
+++ b/drivers/video/pwm_backlight.c
@@ -63,7 +63,7 @@ static int set_pwm(struct pwm_backlight_priv *priv)
int ret;
 
duty_cycle = priv->period_ns * (priv->cur_level - priv->min_level) /
-   (priv->max_level - priv->min_level + 1);
+   (priv->max_level - priv->min_level);
ret = pwm_set_config(priv->pwm, priv->channel, priv->period_ns,
 duty_cycle);
if (ret)
diff --git a/test/dm/panel.c b/test/dm/panel.c
index a840fb4951..49f5ac7169 100644
--- a/test/dm/panel.c
+++ b/test/dm/panel.c
@@ -40,7 +40,7 @@ static int dm_test_panel(struct unit_test_state *uts)
ut_assertok(sandbox_pwm_get_config(pwm, 0, _ns, _ns,
   , ));
ut_asserteq(1000, period_ns);
-   ut_asserteq(170 * 1000 / 256, duty_ns);
+   ut_asserteq(170 * 1000 / 255, duty_ns);
ut_asserteq(true, enable);
ut_asserteq(false, polarity);
ut_asserteq(1, sandbox_gpio_get_value(gpio, 1));
@@ -49,29 +49,29 @@ static int dm_test_panel(struct unit_test_state *uts)
ut_assertok(panel_set_backlight(dev, 40));
ut_assertok(sandbox_pwm_get_config(pwm, 0, _ns, _ns,
   , ));
-   ut_asserteq(64 * 1000 / 256, duty_ns);
+   ut_asserteq(64 * 1000 / 255, duty_ns);
 
ut_assertok(panel_set_backlight(dev, BACKLIGHT_MAX));
ut_assertok(sandbox_pwm_get_config(pwm, 0, _ns, _ns,
   , ));
-   ut_asserteq(255 * 1000 / 256, duty_ns);
+   ut_asserteq(255 * 1000 / 255, duty_ns);
 
ut_assertok(panel_set_backlight(dev, BACKLIGHT_MIN));
ut_assertok(sandbox_pwm_get_config(pwm, 0, _ns, _ns,
   , ));
-   ut_asserteq(0 * 1000 / 256, duty_ns);
+   ut_asserteq(0 * 1000 / 255, duty_ns);
ut_asserteq(1, sandbox_gpio_get_value(gpio, 1));
 
ut_assertok(panel_set_backlight(dev, BACKLIGHT_DEFAULT));
ut_assertok(sandbox_pwm_get_config(pwm, 0, _ns, _ns,
   , ));
ut_asserteq(true, enable);
-   ut_asserteq(170 * 1000 / 256, duty_ns);
+   ut_asserteq(170 * 1000 / 255, duty_ns);
 
ut_assertok(panel_set_backlight(dev, BACKLIGHT_OFF));
ut_assertok(sandbox_pwm_get_config(pwm, 0, _ns, _ns,
   , ));
-   ut_asserteq(0 * 1000 / 256, duty_ns);
+   ut_asserteq(0 * 1000 / 255, duty_ns);
ut_asserteq(0, sandbox_gpio_get_value(gpio, 1));
ut_asserteq(false, regulator_get_enable(reg));
 
-- 
2.17.1



[PATCH 20/31] pwm: ti: am33xx: add subsystem driver

2020-08-25 Thread Dario Binacchi
The TI PWMSS driver is a simple bus driver for providing clock and power
management for the PWM peripherals on TI AM33xx SoCs, namely eCAP,
eHRPWM and eQEP.

Based on more recent versions of the device tree inside the linux kernel,
I added the clock domain for each subsystem in am33x.dtsi so it can be
enabled before probing the peripheral child device and disabled after
its removal.

Signed-off-by: Dario Binacchi 
---

 arch/arm/dts/am33xx.dtsi  |  9 +++
 doc/device-tree-bindings/pwm/ti,pwmss.txt | 58 ++
 drivers/pwm/Kconfig   |  9 ++-
 drivers/pwm/Makefile  |  1 +
 drivers/pwm/pwm-ti-pwmss.c| 95 +++
 5 files changed, 171 insertions(+), 1 deletion(-)
 create mode 100644 doc/device-tree-bindings/pwm/ti,pwmss.txt
 create mode 100644 drivers/pwm/pwm-ti-pwmss.c

diff --git a/arch/arm/dts/am33xx.dtsi b/arch/arm/dts/am33xx.dtsi
index d3dd6a16e7..fa7492a9b6 100644
--- a/arch/arm/dts/am33xx.dtsi
+++ b/arch/arm/dts/am33xx.dtsi
@@ -758,6 +758,9 @@
  0x48300180 0x48300180 0x80   /* EQEP */
  0x48300200 0x48300200 0x80>; /* EHRPWM */
 
+   clocks = <_per_clkctrl AM3_EPWMSS0_CLKCTRL 0>;
+   clock-names = "fck";
+
ecap0: ecap@48300100 {
compatible = "ti,am3352-ecap",
 "ti,am33xx-ecap";
@@ -792,6 +795,9 @@
  0x48302180 0x48302180 0x80   /* EQEP */
  0x48302200 0x48302200 0x80>; /* EHRPWM */
 
+   clocks = <_per_clkctrl AM3_EPWMSS1_CLKCTRL 0>;
+   clock-names = "fck";
+
ecap1: ecap@48302100 {
compatible = "ti,am3352-ecap",
 "ti,am33xx-ecap";
@@ -826,6 +832,9 @@
  0x48304180 0x48304180 0x80   /* EQEP */
  0x48304200 0x48304200 0x80>; /* EHRPWM */
 
+   clocks = <_per_clkctrl AM3_EPWMSS2_CLKCTRL 0>;
+   clock-names = "fck";
+
ecap2: ecap@48304100 {
compatible = "ti,am3352-ecap",
 "ti,am33xx-ecap";
diff --git a/doc/device-tree-bindings/pwm/ti,pwmss.txt 
b/doc/device-tree-bindings/pwm/ti,pwmss.txt
new file mode 100644
index 00..4633697fbd
--- /dev/null
+++ b/doc/device-tree-bindings/pwm/ti,pwmss.txt
@@ -0,0 +1,58 @@
+TI SOC based PWM Subsystem
+
+Required properties:
+- compatible: Must be "ti,-pwmss".
+  for am33xx  - compatible = "ti,am33xx-pwmss";
+  for am4372  - compatible = "ti,am4372-pwmss","ti,am33xx-pwmss";
+  for dra746 - compatible = "ti,dra746-pwmss", "ti,am33xx-pwmss"
+
+- reg: physical base address and size of the registers map.
+- address-cells: Specify the number of u32 entries needed in child nodes.
+ Should set to 1.
+- size-cells: specify number of u32 entries needed to specify child nodes size
+   in reg property. Should set to 1.
+- ranges: describes the address mapping of a memory-mapped bus. Should set to
+  physical address map of child's base address, physical address within
+  parent's address  space and length of the address map. For am33xx,
+  3 set of child register maps present, ECAP register space, EQEP
+  register space, EHRPWM register space.
+
+Also child nodes should also populated under PWMSS DT node.
+
+Example:
+epwmss0: epwmss@4830 { /* PWMSS for am33xx */
+   compatible = "ti,am33xx-pwmss";
+   reg = <0x4830 0x10>;
+   ti,hwmods = "epwmss0";
+   #address-cells = <1>;
+   #size-cells = <1>;
+   ranges = <0x48300100 0x48300100 0x80   /* ECAP */
+ 0x48300180 0x48300180 0x80   /* EQEP */
+ 0x48300200 0x48300200 0x80>; /* EHRPWM */
+
+   /* child nodes go here */
+};
+
+epwmss0: epwmss@4830 { /* PWMSS for am4372 */
+   compatible = "ti,am4372-pwmss","ti,am33xx-pwmss"
+   reg = <0x4830 0x10>;
+   ti,hwmods = "epwmss0";
+   #address-cells = <1>;
+   #size-cells = <1>;
+   ranges = <0x48300100 0x48300100 0x80   /* ECAP */
+ 0x48300180 0x48300180 0x80   /* EQEP */
+ 0x48300200 0x48300200 0x80>; /* EHRPWM */
+
+   /* child nodes go here */
+};
+
+epwmss0: epwmss@4843e000 { /* PWMSS for DRA7xx */
+   compatible = "ti,dra746-pwmss", "ti,am33xx-pwmss";
+   reg = <0x4843e000 0x30>;
+   ti,hwmods = "epwmss0";
+   #address-cells = <1>;
+   #size-cells = <1>;
+   ranges;
+
+   /* child nodes go here */
+};
diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
index e4ba8b3d80..129f5d77ca 100644
--- a/drivers/pwm/Kconfig
+++ b/drivers/pwm/Kconfig
@@ -69,8 +69,15 @@ config 

  1   2   >