[U-Boot] [PATCH 12/24] dtoc: Update fdt_util for Python 3

2019-05-17 Thread Simon Glass
Since we are now using the bytes type in Python 3, the conversion in
fdt32_to_cpu() is not necessary, so drop it.

Also use 'int' instead of 'long' to convert the integer value, since
'long' is not present in Python 3.

With this, test_fdt passes with both Python 2 and 3:

PYTHONPATH=/tmp/b/sandbox_spl/scripts/dtc/pylibfdt python \
./tools/dtoc/test_fdt -t

PYTHONPATH=~/cosarm/dtc/pylibfdt:tools/patman python3 \
./tools/dtoc/test_fdt -t

Signed-off-by: Simon Glass 
---

 tools/dtoc/fdt_util.py | 15 ++-
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/tools/dtoc/fdt_util.py b/tools/dtoc/fdt_util.py
index 5fbfc8877bd..f47879ac006 100644
--- a/tools/dtoc/fdt_util.py
+++ b/tools/dtoc/fdt_util.py
@@ -16,14 +16,6 @@ import tempfile
 import command
 import tools
 
-VERSION3 = sys.version_info > (3, 0)
-
-def get_plain_bytes(val):
-"""Handle Python 3 strings"""
-if isinstance(val, bytes):
-val = val.decode('utf-8')
-return val.encode('raw_unicode_escape')
-
 def fdt32_to_cpu(val):
 """Convert a device tree cell to an integer
 
@@ -33,9 +25,6 @@ def fdt32_to_cpu(val):
 Return:
 A native-endian integer value
 """
-if VERSION3:
-# This code is not reached in Python 2
-val = get_plain_bytes(val)  # pragma: no cover
 return struct.unpack('>I', val)[0]
 
 def fdt_cells_to_cpu(val, cells):
@@ -45,11 +34,11 @@ def fdt_cells_to_cpu(val, cells):
 Value to convert (array of one or more 4-character strings)
 
 Return:
-A native-endian long value
+A native-endian integer value
 """
 if not cells:
 return 0
-out = long(fdt32_to_cpu(val[0]))
+out = int(fdt32_to_cpu(val[0]))
 if cells == 2:
 out = out << 32 | fdt32_to_cpu(val[1])
 return out
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 20/24] binman: Fix up a format string in AssertInList()

2019-05-17 Thread Simon Glass
Add the missing 's' to the required '%s' here.

Signed-off-by: Simon Glass 
---

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

diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 48fec501790..d0a8b751a2c 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -395,7 +395,7 @@ class TestFunctional(unittest.TestCase):
 for grep in grep_list:
 if grep in target:
 return
-self.fail("Error: '%' not found in '%s'" % (grep_list, target))
+self.fail("Error: '%s' not found in '%s'" % (grep_list, target))
 
 def CheckNoGaps(self, entries):
 """Check that all entries fit together without gaps
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 16/24] binman: Convert to use bytes type

2019-05-17 Thread Simon Glass
With Python 3 we want to use the 'bytes' type instead of 'str'. Adjust the
code accordingly so that it works on both Python 2 and Python 3.

Signed-off-by: Simon Glass 
---

 tools/binman/elf_test.py|   5 +-
 tools/binman/etype/_testing.py  |   2 +-
 tools/binman/etype/u_boot_dtb_with_ucode.py |   4 +-
 tools/binman/etype/u_boot_ucode.py  |   4 +-
 tools/binman/etype/vblock.py|   2 +-
 tools/binman/ftest.py   | 132 ++--
 6 files changed, 77 insertions(+), 72 deletions(-)

diff --git a/tools/binman/elf_test.py b/tools/binman/elf_test.py
index 3d55cb1946e..42d94cbbbe2 100644
--- a/tools/binman/elf_test.py
+++ b/tools/binman/elf_test.py
@@ -22,7 +22,7 @@ class FakeEntry:
 """
 def __init__(self, contents_size):
 self.contents_size = contents_size
-self.data = 'a' * contents_size
+self.data = tools.GetBytes(ord('a'), contents_size)
 
 def GetPath(self):
 return 'entry_path'
@@ -122,7 +122,8 @@ class TestElf(unittest.TestCase):
 section = FakeSection(sym_value=None)
 elf_fname = os.path.join(binman_dir, 'test', 'u_boot_binman_syms')
 syms = elf.LookupAndWriteSymbols(elf_fname, entry, section)
-self.assertEqual(tools.GetBytes(255, 16) + 'a' * 4, entry.data)
+self.assertEqual(tools.GetBytes(255, 16) + tools.GetBytes(ord('a'), 4),
+  entry.data)
 
 def testDebug(self):
 """Check that enabling debug in the elf module produced debug output"""
diff --git a/tools/binman/etype/_testing.py b/tools/binman/etype/_testing.py
index 3e345bd9526..ac62d2e2005 100644
--- a/tools/binman/etype/_testing.py
+++ b/tools/binman/etype/_testing.py
@@ -75,7 +75,7 @@ class Entry__testing(Entry):
 def ObtainContents(self):
 if self.return_unknown_contents or not self.return_contents:
 return False
-self.data = 'a'
+self.data = b'a'
 self.contents_size = len(self.data)
 if self.return_contents_once:
 self.return_contents = False
diff --git a/tools/binman/etype/u_boot_dtb_with_ucode.py 
b/tools/binman/etype/u_boot_dtb_with_ucode.py
index 444c51b8b72..18e022b 100644
--- a/tools/binman/etype/u_boot_dtb_with_ucode.py
+++ b/tools/binman/etype/u_boot_dtb_with_ucode.py
@@ -26,7 +26,7 @@ class Entry_u_boot_dtb_with_ucode(Entry_blob_dtb):
 """
 def __init__(self, section, etype, node):
 Entry_blob_dtb.__init__(self, section, etype, node)
-self.ucode_data = ''
+self.ucode_data = b''
 self.collate = False
 self.ucode_offset = None
 self.ucode_size = None
@@ -65,7 +65,7 @@ class Entry_u_boot_dtb_with_ucode(Entry_blob_dtb):
 for node in self.ucode.subnodes:
 data_prop = node.props.get('data')
 if data_prop:
-self.ucode_data += ''.join(data_prop.bytes)
+self.ucode_data += data_prop.bytes
 if self.collate:
 node.DeleteProp('data')
 return True
diff --git a/tools/binman/etype/u_boot_ucode.py 
b/tools/binman/etype/u_boot_ucode.py
index a00e530295b..dee8848db7a 100644
--- a/tools/binman/etype/u_boot_ucode.py
+++ b/tools/binman/etype/u_boot_ucode.py
@@ -69,7 +69,7 @@ class Entry_u_boot_ucode(Entry_blob):
 if entry and entry.target_offset:
 found = True
 if not found:
-self.data = ''
+self.data = b''
 return True
 # Get the microcode from the device tree entry. If it is not available
 # yet, return False so we will be called later. If the section simply
@@ -87,7 +87,7 @@ class Entry_u_boot_ucode(Entry_blob):
 
 if not fdt_entry.collate:
 # This binary can be empty
-self.data = ''
+self.data = b''
 return True
 
 # Write it out to a file
diff --git a/tools/binman/etype/vblock.py b/tools/binman/etype/vblock.py
index 334ff9f966a..91fa2f7808f 100644
--- a/tools/binman/etype/vblock.py
+++ b/tools/binman/etype/vblock.py
@@ -51,7 +51,7 @@ class Entry_vblock(Entry):
 
 def ObtainContents(self):
 # Join up the data files to be signed
-input_data = ''
+input_data = b''
 for entry_phandle in self.content:
 data = self.section.GetContentsByPhandle(entry_phandle, self)
 if data is None:
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 971fade3432..48fec501790 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -29,38 +29,38 @@ import tools
 import tout
 
 # Contents of test files, corresponding to different entry types
-U_BOOT_DATA   = '1234'
-U_BOOT_IMG_DATA   = 'img'
-U_BOOT_SPL_DATA   = '56780123456789abcde'
-U_BOOT_TPL_DATA   = 'tpl'
-BLOB_DATA = '89'
-ME_DATA   = '0abcd'
-VGA_DATA  = 'vga'
-U_BOO

[U-Boot] [PATCH 21/24] binman: Read map files as text

2019-05-17 Thread Simon Glass
These files are text files so should be read as such, so that
string-equality assertions work as expected.

With this binman tests work correctly on Python 2 and Python 3:

PYTHONPATH=/tmp/b/sandbox_spl/scripts/dtc/pylibfdt \
python ./tools/binman/binman -t

Change first line of binman.py to end "python3":

PYTHONPATH=~/cosarm/dtc/pylibfdt:tools/patman \
python3 ./tools/binman/binman -t

Signed-off-by: Simon Glass 
---

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

diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index d0a8b751a2c..cc57ef3e04a 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -1777,7 +1777,7 @@ class TestFunctional(unittest.TestCase):
 # We should not get an inmage, but there should be a map file
 self.assertFalse(os.path.exists(tools.GetOutputFilename('image.bin')))
 self.assertTrue(os.path.exists(map_fname))
-map_data = tools.ReadFile(map_fname)
+map_data = tools.ReadFile(map_fname, binary=False)
 self.assertEqual('''ImagePosOffset  Size  Name
   0007  main-section
    0004  u-boot
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 15/24] binman: Avoid changing a dict during iteration

2019-05-17 Thread Simon Glass
This code works OK in Python 2 but Python 3 complains. Adjust it to avoid
deleting elements from a dict while iterating through it.

Signed-off-by: Simon Glass 
---

 tools/binman/control.py | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/binman/control.py b/tools/binman/control.py
index ce25eb54858..20186ee1980 100644
--- a/tools/binman/control.py
+++ b/tools/binman/control.py
@@ -131,10 +131,13 @@ def Binman(options, args):
 
 if options.image:
 skip = []
+new_images = OrderedDict()
 for name, image in images.items():
-if name not in options.image:
-del images[name]
+if name in options.image:
+new_images[name] = image
+else:
 skip.append(name)
+images = new_images
 if skip and options.verbosity >= 2:
 print('Skipping images: %s' % ', '.join(skip))
 
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 19/24] binman: Update 'text' entry for Python 3

2019-05-17 Thread Simon Glass
This code reads a binary value and then uses it as a string to look up
another value. Add conversions to make this work as expected on Python 3.

Signed-off-by: Simon Glass 
---

 tools/binman/etype/text.py | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tools/binman/etype/text.py b/tools/binman/etype/text.py
index c4aa510a87b..9ee04d7c9d8 100644
--- a/tools/binman/etype/text.py
+++ b/tools/binman/etype/text.py
@@ -7,6 +7,7 @@ from collections import OrderedDict
 
 from entry import Entry, EntryArg
 import fdt_util
+import tools
 
 
 class Entry_text(Entry):
@@ -48,9 +49,11 @@ class Entry_text(Entry):
 """
 def __init__(self, section, etype, node):
 Entry.__init__(self, section, etype, node)
-self.text_label, = self.GetEntryArgsOrProps(
-[EntryArg('text-label', str)])
-self.value, = self.GetEntryArgsOrProps([EntryArg(self.text_label, 
str)])
+label, = self.GetEntryArgsOrProps([EntryArg('text-label', str)])
+self.text_label = tools.ToStr(label) if type(label) != str else label
+value, = self.GetEntryArgsOrProps([EntryArg(self.text_label, str)])
+value = tools.ToBytes(value) if value is not None else value
+self.value = value
 
 def ObtainContents(self):
 if not self.value:
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 22/24] binman: Document parallel tests

2019-05-17 Thread Simon Glass
Since binman can run tests in parallel, document this.

Signed-off-by: Simon Glass 
---

 tools/binman/README | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/tools/binman/README b/tools/binman/README
index 927fa856acf..ac193f16cf7 100644
--- a/tools/binman/README
+++ b/tools/binman/README
@@ -702,6 +702,20 @@ To enable Python test coverage on Debian-type 
distributions (e.g. Ubuntu):
$ sudo apt-get install python-coverage python-pytest
 
 
+Concurrent tests
+
+
+Binman tries to run tests concurrently. This means that the tests make use of
+all available CPUs to run.
+
+ To enable this:
+
+   $ sudo apt-get install python-subunit python3-subunit
+
+Use '-P 1' to disable this. It is automatically disabled when code coverage is
+being used (-T) since they are incompatible.
+
+
 Advanced Features / Technical docs
 --
 
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 10/24] dtoc: Test full 64-bit properties with FdtCellsToCpu()

2019-05-17 Thread Simon Glass
At present this test does not check the upper 32 bits of the returned
value. Add some additional tests to cover this.

Signed-off-by: Simon Glass 
---

 tools/dtoc/test_fdt.py | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py
index 4c39f9a3e28..a5234ce1e88 100755
--- a/tools/dtoc/test_fdt.py
+++ b/tools/dtoc/test_fdt.py
@@ -498,10 +498,17 @@ class TestFdtUtil(unittest.TestCase):
 self.assertEqual(2, fdt_util.fdt_cells_to_cpu(val, 1))
 
 dtb2 = fdt.FdtScan('tools/dtoc/dtoc_test_addr64.dts')
-node2 = dtb2.GetNode('/test1')
-val = node2.props['reg'].value
+node1 = dtb2.GetNode('/test1')
+val = node1.props['reg'].value
 self.assertEqual(0x1234, fdt_util.fdt_cells_to_cpu(val, 2))
 
+node2 = dtb2.GetNode('/test2')
+val = node2.props['reg'].value
+self.assertEqual(0x1234567890123456, fdt_util.fdt_cells_to_cpu(val, 2))
+self.assertEqual(0x9876543210987654, fdt_util.fdt_cells_to_cpu(val[2:],
+   2))
+self.assertEqual(0x12345678, fdt_util.fdt_cells_to_cpu(val, 1))
+
 def testEnsureCompiled(self):
 """Test a degenerate case of this function"""
 dtb = fdt_util.EnsureCompiled('tools/dtoc/dtoc_test_simple.dts')
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 23/24] binman: Update the README.entries file

2019-05-17 Thread Simon Glass
A few minor changes have been made including one new entry. Update the
documentation with:

   $ binman -E >tools/binman/README.entries

Signed-off-by: Simon Glass 
---

 tools/binman/README.entries | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/tools/binman/README.entries b/tools/binman/README.entries
index 9fc2f83280e..357946d6305 100644
--- a/tools/binman/README.entries
+++ b/tools/binman/README.entries
@@ -224,6 +224,20 @@ See README.x86 for information about x86 binary blobs.
 
 
 
+Entry: intel-refcode: Entry containing an Intel Reference Code file
+---
+
+Properties / Entry arguments:
+- filename: Filename of file to read into entry
+
+This file contains code for setting up the platform on some Intel systems.
+This is executed by U-Boot when needed early during startup. A typical
+filename is 'refcode.bin'.
+
+See README.x86 for information about x86 binary blobs.
+
+
+
 Entry: intel-vbt: Entry containing an Intel Video BIOS Table (VBT) file
 ---
 
@@ -627,6 +641,7 @@ Entry: vblock: An entry which contains a Chromium OS 
verified boot block
 
 
 Properties / Entry arguments:
+- content: List of phandles to entries to sign
 - keydir: Directory containing the public keys to use
 - keyblock: Name of the key file to use (inside keydir)
 - signprivate: Name of provide key file to use (inside keydir)
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 13/24] dtoc: Update dtb_platdata to support Python 3

2019-05-17 Thread Simon Glass
The only change needed is to update get_value() to support the 'bytes'
type correctly with Python 3.

With this the dtoc unit tests pass with both Python 2 and 3:

PYTHONPATH=/tmp/b/sandbox_spl/scripts/dtc/pylibfdt python \
./tools/dtoc/dtoc -t

PYTHONPATH=~/cosarm/dtc/pylibfdt:tools/patman python3 \
./tools/dtoc/dtoc -t

Signed-off-by: Simon Glass 
---

 tools/dtoc/dtb_platdata.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py
index 3b66af8df78..037e82c8bbd 100644
--- a/tools/dtoc/dtb_platdata.py
+++ b/tools/dtoc/dtb_platdata.py
@@ -17,6 +17,7 @@ import sys
 
 import fdt
 import fdt_util
+import tools
 
 # When we see these properties we ignore them - i.e. do not create a structure 
member
 PROP_IGNORE_LIST = [
@@ -99,7 +100,7 @@ def get_value(ftype, value):
 if ftype == fdt.TYPE_INT:
 return '%#x' % fdt_util.fdt32_to_cpu(value)
 elif ftype == fdt.TYPE_BYTE:
-return '%#x' % ord(value[0])
+return '%#x' % tools.ToByte(value[0])
 elif ftype == fdt.TYPE_STRING:
 return '"%s"' % value
 elif ftype == fdt.TYPE_BOOL:
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 18/24] patman: Update fmap code for Python 3

2019-05-17 Thread Simon Glass
This needs special care to ensure that the bytes type is used for
binary data. Add conversion code to deal with strings and bytes
correctly.

Signed-off-by: Simon Glass 
---

 tools/binman/etype/fmap.py |  3 ++-
 tools/binman/fmap_util.py  | 12 +---
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/tools/binman/etype/fmap.py b/tools/binman/etype/fmap.py
index bf35a5bbf4e..e6b5c5c74c0 100644
--- a/tools/binman/etype/fmap.py
+++ b/tools/binman/etype/fmap.py
@@ -7,6 +7,7 @@
 
 from entry import Entry
 import fmap_util
+import tools
 
 
 class Entry_fmap(Entry):
@@ -46,7 +47,7 @@ class Entry_fmap(Entry):
 if pos is not None:
 pos -= entry.section.GetRootSkipAtStart()
 areas.append(fmap_util.FmapArea(pos or 0, entry.size or 0,
-entry.name, 0))
+tools.FromUnicode(entry.name), 0))
 
 entries = self.section._image.GetEntries()
 areas = []
diff --git a/tools/binman/fmap_util.py b/tools/binman/fmap_util.py
index be3cbee87bd..d0f956b6221 100644
--- a/tools/binman/fmap_util.py
+++ b/tools/binman/fmap_util.py
@@ -8,9 +8,12 @@
 
 import collections
 import struct
+import sys
+
+import tools
 
 # constants imported from lib/fmap.h
-FMAP_SIGNATURE = '__FMAP__'
+FMAP_SIGNATURE = b'__FMAP__'
 FMAP_VER_MAJOR = 1
 FMAP_VER_MINOR = 0
 FMAP_STRLEN = 32
@@ -50,6 +53,8 @@ FmapArea = collections.namedtuple('FmapArea', FMAP_AREA_NAMES)
 
 
 def NameToFmap(name):
+if type(name) == bytes and sys.version_info[0] >= 3:
+name = name.decode('utf-8')  # pragma: no cover (for Python 2)
 return name.replace('\0', '').replace('-', '_').upper()
 
 def ConvertName(field_names, fields):
@@ -65,7 +70,7 @@ def ConvertName(field_names, fields):
 value: value of that field (string for the ones we support)
 """
 name_index = field_names.index('name')
-fields[name_index] = NameToFmap(fields[name_index])
+fields[name_index] = tools.ToBytes(NameToFmap(fields[name_index]))
 
 def DecodeFmap(data):
 """Decode a flashmap into a header and list of areas
@@ -106,7 +111,8 @@ def EncodeFmap(image_size, name, areas):
 ConvertName(names, params)
 return struct.pack(fmt, *params)
 
-values = FmapHeader(FMAP_SIGNATURE, 1, 0, 0, image_size, name, len(areas))
+values = FmapHeader(FMAP_SIGNATURE, 1, 0, 0, image_size,
+tools.FromUnicode(name), len(areas))
 blob = _FormatBlob(FMAP_HEADER_FORMAT, FMAP_HEADER_NAMES, values)
 for area in areas:
 blob += _FormatBlob(FMAP_AREA_FORMAT, FMAP_AREA_NAMES, area)
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 14/24] patman: Allow reading files in text mode

2019-05-17 Thread Simon Glass
While reading files in binary mode is the norm, sometimes we want to use
text mode. Add an optional parameter to handle this.

Signed-off-by: Simon Glass 
---

 tools/patman/tools.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/patman/tools.py b/tools/patman/tools.py
index bdc1953936c..8e9f22afe8a 100644
--- a/tools/patman/tools.py
+++ b/tools/patman/tools.py
@@ -214,7 +214,7 @@ def Filename(fname):
 # If not found, just return the standard, unchanged path
 return fname
 
-def ReadFile(fname):
+def ReadFile(fname, binary=True):
 """Read and return the contents of a file.
 
 Args:
@@ -223,7 +223,7 @@ def ReadFile(fname):
 Returns:
   data read from file, as a string.
 """
-with open(Filename(fname), 'rb') as fd:
+with open(Filename(fname), binary and 'rb' or 'r') as fd:
 data = fd.read()
 #self._out.Info("Read file '%s' size %d (%#0x)" %
#(fname, len(data), len(data)))
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 24/24] patman: Update cover-coverage tests for Python 3

2019-05-17 Thread Simon Glass
We need slightly different commands to run code coverage with Python 3.
Update the RunTestCoverage() function to handle this.

Signed-off-by: Simon Glass 
---

 tools/patman/test_util.py | 15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/tools/patman/test_util.py b/tools/patman/test_util.py
index e462ec8f72b..ea36cd16339 100644
--- a/tools/patman/test_util.py
+++ b/tools/patman/test_util.py
@@ -17,6 +17,8 @@ try:
 except ImportError:
   from io import StringIO
 
+PYTHON = 'python%d' % sys.version_info[0]
+
 
 def RunTestCoverage(prog, filter_fname, exclude_list, build_dir, 
required=None):
 """Run tests and check that we get 100% coverage
@@ -43,11 +45,12 @@ def RunTestCoverage(prog, filter_fname, exclude_list, 
build_dir, required=None):
 else:
 glob_list = []
 glob_list += exclude_list
-glob_list += ['*libfdt.py', '*site-packages*']
-cmd = ('PYTHONPATH=$PYTHONPATH:%s/sandbox_spl/tools python-coverage run '
-   '--omit "%s" %s -P1 -t' % (build_dir, ','.join(glob_list), prog))
+glob_list += ['*libfdt.py', '*site-packages*', '*dist-packages*']
+cmd = ('PYTHONPATH=$PYTHONPATH:%s/sandbox_spl/tools %s-coverage run '
+   '--omit "%s" %s -P1 -t' % (build_dir, PYTHON, ','.join(glob_list),
+  prog))
 os.system(cmd)
-stdout = command.Output('python-coverage', 'report')
+stdout = command.Output('%s-coverage' % PYTHON, 'report')
 lines = stdout.splitlines()
 if required:
 # Convert '/path/to/name.py' just the module name 'name'
@@ -65,8 +68,8 @@ def RunTestCoverage(prog, filter_fname, exclude_list, 
build_dir, required=None):
 print(coverage)
 if coverage != '100%':
 print(stdout)
-print("Type 'python-coverage html' to get a report in "
-  'htmlcov/index.html')
+print("Type '%s-coverage html' to get a report in "
+  'htmlcov/index.html' % PYTHON)
 print('Coverage error: %s, but should be 100%%' % coverage)
 ok = False
 if not ok:
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 11/24] dtoc: Add a unit test for BytesToValue()

2019-05-17 Thread Simon Glass
Add a simple unit test for one of the cases of this function, so that any
fault can be seen directly, rather than appearing through the failure of
another test.

Signed-off-by: Simon Glass 
---

 tools/dtoc/test_fdt.py | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py
index a5234ce1e88..32a020bad2e 100755
--- a/tools/dtoc/test_fdt.py
+++ b/tools/dtoc/test_fdt.py
@@ -19,7 +19,7 @@ for dirname in ['../patman', '..']:
 
 import command
 import fdt
-from fdt import TYPE_BYTE, TYPE_INT, TYPE_STRING, TYPE_BOOL
+from fdt import TYPE_BYTE, TYPE_INT, TYPE_STRING, TYPE_BOOL, BytesToValue
 import fdt_util
 from fdt_util import fdt32_to_cpu
 import libfdt
@@ -121,6 +121,10 @@ class TestFdt(unittest.TestCase):
 node = self.dtb.GetNode('/spl-test')
 self.assertEqual(self.dtb, node.GetFdt())
 
+def testBytesToValue(self):
+self.assertEqual(BytesToValue(b'this\0is\0'),
+ (TYPE_STRING, ['this', 'is']))
+
 class TestNode(unittest.TestCase):
 """Test operation of the Node class"""
 
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 17/24] binman: Update entry_test to support Python 3

2019-05-17 Thread Simon Glass
The reload() function is in a different place in Python 3. Update the code
to handle this.

Signed-off-by: Simon Glass 
---

 tools/binman/entry_test.py | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/binman/entry_test.py b/tools/binman/entry_test.py
index 1f7ff5b4e41..b30a7beecc8 100644
--- a/tools/binman/entry_test.py
+++ b/tools/binman/entry_test.py
@@ -41,7 +41,11 @@ class TestEntry(unittest.TestCase):
 del sys.modules['importlib']
 global entry
 if entry:
-reload(entry)
+if sys.version_info[0] >= 3:
+import importlib
+importlib.reload(entry)
+else:
+reload(entry)
 else:
 import entry
 entry.Entry.Create(None, self.GetNode(), 'u-boot-spl')
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 05/24] dtoc: Updates BytesToValue() for Python 3

2019-05-17 Thread Simon Glass
The difference between the bytes and str types in Python 3 requires a
number of minor changes to this function. Update it to handle the input
data using the 'bytes' type. Create two useful helper functions which can
be used by other modules too.

Signed-off-by: Simon Glass 
---

 tools/dtoc/fdt.py | 39 ---
 tools/patman/tools.py | 27 +++
 2 files changed, 51 insertions(+), 15 deletions(-)

diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py
index 35453fbed9a..d539248430a 100644
--- a/tools/dtoc/fdt.py
+++ b/tools/dtoc/fdt.py
@@ -30,50 +30,59 @@ def CheckErr(errnum, msg):
 (errnum, libfdt.fdt_strerror(errnum), msg))
 
 
-def BytesToValue(bytes):
+def BytesToValue(data):
 """Converts a string of bytes into a type and value
 
 Args:
-A string containing bytes
+A bytes value (which on Python 2 is an alias for str)
 
 Return:
 A tuple:
 Type of data
 Data, either a single element or a list of elements. Each element
 is one of:
-TYPE_STRING: string value from the property
-TYPE_INT: a byte-swapped integer stored as a 4-byte string
-TYPE_BYTE: a byte stored as a single-byte string
+TYPE_STRING: str/bytes value from the property
+TYPE_INT: a byte-swapped integer stored as a 4-byte str/bytes
+TYPE_BYTE: a byte stored as a single-byte str/bytes
 """
-bytes = str(bytes)
-size = len(bytes)
-strings = bytes.split('\0')
+data = bytes(data)
+size = len(data)
+strings = data.split(b'\0')
 is_string = True
 count = len(strings) - 1
-if count > 0 and not strings[-1]:
+if count > 0 and not len(strings[-1]):
 for string in strings[:-1]:
 if not string:
 is_string = False
 break
 for ch in string:
-if ch < ' ' or ch > '~':
+# Handle Python 2 treating bytes as str
+if type(ch) == str:
+ch = ord(ch)
+if ch < 32 or ch > 127:
 is_string = False
 break
 else:
 is_string = False
 if is_string:
 if count == 1:
-return TYPE_STRING, strings[0]
+if sys.version_info[0] >= 3:
+return TYPE_STRING, strings[0].decode()
+else:
+return TYPE_STRING, strings[0]
 else:
-return TYPE_STRING, strings[:-1]
+if sys.version_info[0] >= 3:
+return TYPE_STRING, [s.decode() for s in strings[:-1]]
+else:
+return TYPE_STRING, strings[:-1]
 if size % 4:
 if size == 1:
-return TYPE_BYTE, bytes[0]
+return TYPE_BYTE, tools.ToChar(data[0])
 else:
-return TYPE_BYTE, list(bytes)
+return TYPE_BYTE, [tools.ToChar(ch) for ch in list(data)]
 val = []
 for i in range(0, size, 4):
-val.append(bytes[i:i + 4])
+val.append(data[i:i + 4])
 if size == 4:
 return TYPE_INT, val[0]
 else:
diff --git a/tools/patman/tools.py b/tools/patman/tools.py
index 7e6a45a3b07..976670ef006 100644
--- a/tools/patman/tools.py
+++ b/tools/patman/tools.py
@@ -290,3 +290,30 @@ def FromUnicode(val):
 if sys.version_info[0] >= 3:
 return val
 return val if isinstance(val, str) else val.encode('utf-8')
+
+def ToByte(ch):
+"""Convert a character to an ASCII value
+
+This is useful because in Python 2 bytes is an alias for str, but in
+Python 3 they are separate types. This function converts the argument to
+an ASCII value in either case.
+
+Args:
+ch: A string (Python 2) or byte (Python 3) value
+
+Returns:
+integer ASCII value for ch
+"""
+return ord(ch) if type(ch) == str else ch
+
+def ToChar(byte):
+"""Convert a byte to a character
+
+This is useful because in Python 2 bytes is an alias for str, but in
+Python 3 they are separate types. This function converts an ASCII value to
+a value with the appropriate type in either case.
+
+Args:
+byte: A byte or str value
+"""
+return chr(byte) if type(byte) != str else byte
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 09/24] dtoc: Use binary mode for reading files

2019-05-17 Thread Simon Glass
The .dtb files are binary so we should open them as binary files. This
allows Python 3 to use the correct 'bytes' type.

Signed-off-by: Simon Glass 
---

 tools/dtoc/test_fdt.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py
index 3cd34b745ed..4c39f9a3e28 100755
--- a/tools/dtoc/test_fdt.py
+++ b/tools/dtoc/test_fdt.py
@@ -85,13 +85,13 @@ class TestFdt(unittest.TestCase):
 def testFlush(self):
 """Check that we can flush the device tree out to its file"""
 fname = self.dtb._fname
-with open(fname) as fd:
+with open(fname, 'rb') as fd:
 data = fd.read()
 os.remove(fname)
 with self.assertRaises(IOError):
-open(fname)
+open(fname, 'rb')
 self.dtb.Flush()
-with open(fname) as fd:
+with open(fname, 'rb') as fd:
 data = fd.read()
 
 def testPack(self):
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 07/24] dtoc: Convert the Fdt.Prop class to Python 3

2019-05-17 Thread Simon Glass
Update this class to work correctly on Python 3 and to pass its unit
tests.

Signed-off-by: Simon Glass 
---

 tools/dtoc/fdt.py | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py
index cbd9cbabe31..f051ce67632 100644
--- a/tools/dtoc/fdt.py
+++ b/tools/dtoc/fdt.py
@@ -98,18 +98,18 @@ class Prop:
 bytes
 type: Value type
 """
-def __init__(self, node, offset, name, bytes):
+def __init__(self, node, offset, name, data):
 self._node = node
 self._offset = offset
 self.name = name
 self.value = None
-self.bytes = str(bytes)
+self.bytes = bytes(data)
 self.dirty = False
-if not bytes:
+if not data:
 self.type = TYPE_BOOL
 self.value = True
 return
-self.type, self.value = BytesToValue(bytes)
+self.type, self.value = BytesToValue(bytes(data))
 
 def RefreshOffset(self, poffset):
 self._offset = poffset
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 06/24] dtoc: Use byte type instead of str in fdt

2019-05-17 Thread Simon Glass
In Python 3 bytes and str are separate types. Use bytes to ensure that
the code functions correctly with Python 3.

Signed-off-by: Simon Glass 
---

 tools/dtoc/fdt.py  | 14 +-
 tools/dtoc/test_fdt.py | 18 +-
 tools/patman/tools.py  | 25 +
 3 files changed, 43 insertions(+), 14 deletions(-)

diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py
index d539248430a..cbd9cbabe31 100644
--- a/tools/dtoc/fdt.py
+++ b/tools/dtoc/fdt.py
@@ -193,7 +193,7 @@ class Prop:
 Args:
 bytes: New property value to set
 """
-self.bytes = str(bytes)
+self.bytes = bytes
 self.type, self.value = BytesToValue(bytes)
 self.dirty = True
 
@@ -398,7 +398,9 @@ class Node:
 prop_name: Name of property to set
 val: String value to set (will be \0-terminated in DT)
 """
-self.props[prop_name].SetData(val + chr(0))
+if sys.version_info[0] >= 3:
+val = bytes(val, 'utf-8')
+self.props[prop_name].SetData(val + b'\0')
 
 def AddString(self, prop_name, val):
 """Add a new string property to a node
@@ -410,7 +412,9 @@ class Node:
 prop_name: Name of property to add
 val: String value of property
 """
-self.props[prop_name] = Prop(self, None, prop_name, val + chr(0))
+if sys.version_info[0] >= 3:
+val = bytes(val, 'utf-8')
+self.props[prop_name] = Prop(self, None, prop_name, val + b'\0')
 
 def AddSubnode(self, name):
 """Add a new subnode to the node
@@ -496,7 +500,7 @@ class Fdt:
 Fdt object containing the data
 """
 fdt = Fdt(None)
-fdt._fdt_obj = libfdt.Fdt(bytearray(data))
+fdt._fdt_obj = libfdt.Fdt(bytes(data))
 return fdt
 
 def LookupPhandle(self, phandle):
@@ -586,7 +590,7 @@ class Fdt:
 Returns:
 The FDT contents as a string of bytes
 """
-return self._fdt_obj.as_bytearray()
+return bytes(self._fdt_obj.as_bytearray())
 
 def GetFdtObj(self):
 """Get the contents of the FDT
diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py
index 79f97d8013c..3cd34b745ed 100755
--- a/tools/dtoc/test_fdt.py
+++ b/tools/dtoc/test_fdt.py
@@ -47,7 +47,7 @@ def _GetPropertyValue(dtb, node, prop_name):
 # Add 12, which is sizeof(struct fdt_property), to get to start of data
 offset = prop.GetOffset() + 12
 data = dtb.GetContents()[offset:offset + len(prop.value)]
-return prop, [chr(x) for x in data]
+return prop, [tools.ToChar(x) for x in data]
 
 
 class TestFdt(unittest.TestCase):
@@ -383,7 +383,7 @@ class TestProp(unittest.TestCase):
 self.node.AddString('string', val)
 self.dtb.Sync(auto_resize=True)
 data = self.fdt.getprop(self.node.Offset(), 'string')
-self.assertEqual(val + '\0', data)
+self.assertEqual(tools.ToBytes(val) + b'\0', data)
 
 self.fdt.pack()
 self.node.SetString('string', val + 'x')
@@ -393,21 +393,21 @@ class TestProp(unittest.TestCase):
 self.node.SetString('string', val[:-1])
 
 prop = self.node.props['string']
-prop.SetData(val)
+prop.SetData(tools.ToBytes(val))
 self.dtb.Sync(auto_resize=False)
 data = self.fdt.getprop(self.node.Offset(), 'string')
-self.assertEqual(val, data)
+self.assertEqual(tools.ToBytes(val), data)
 
 self.node.AddEmptyProp('empty', 5)
 self.dtb.Sync(auto_resize=True)
 prop = self.node.props['empty']
-prop.SetData(val)
+prop.SetData(tools.ToBytes(val))
 self.dtb.Sync(auto_resize=False)
 data = self.fdt.getprop(self.node.Offset(), 'empty')
-self.assertEqual(val, data)
+self.assertEqual(tools.ToBytes(val), data)
 
-self.node.SetData('empty', '123')
-self.assertEqual('123', prop.bytes)
+self.node.SetData('empty', b'123')
+self.assertEqual(b'123', prop.bytes)
 
 def testFromData(self):
 dtb2 = fdt.Fdt.FromData(self.dtb.GetContents())
@@ -508,7 +508,7 @@ class TestFdtUtil(unittest.TestCase):
 self.assertEqual(dtb, fdt_util.EnsureCompiled(dtb))
 
 def testGetPlainBytes(self):
-self.assertEqual('fred', fdt_util.get_plain_bytes('fred'))
+self.assertEqual(b'fred', fdt_util.get_plain_bytes('fred'))
 
 
 def RunTestCoverage():
diff --git a/tools/patman/tools.py b/tools/patman/tools.py
index 976670ef006..bdc1953936c 100644
--- a/tools/patman/tools.py
+++ b/tools/patman/tools.py
@@ -317,3 +317,28 @@ def ToChar(byte):
 byte: A byte or str value
 """
 return chr(byte) if type(byte) != str else byte
+
+def ToChars(byte_list):
+"""Convert a list of bytes to a str/bytes type
+
+Args:
+byte_list: List of ASCII values representing the string
+
+Returns:
+string made by concatenating all the ASCII values
+"""
+re

[U-Boot] [PATCH 03/24] dtoc: Use GetBytes() to obtain repeating bytes

2019-05-17 Thread Simon Glass
Use this helper function which works on both Python 2 and Python 3.

Signed-off-by: Simon Glass 
---

 tools/dtoc/fdt.py  | 6 --
 tools/dtoc/test_fdt.py | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py
index 031b3a00843..9518a287a26 100644
--- a/tools/dtoc/fdt.py
+++ b/tools/dtoc/fdt.py
@@ -11,6 +11,7 @@ import sys
 import fdt_util
 import libfdt
 from libfdt import QUIET_NOTFOUND
+import tools
 
 # This deals with a device tree, presenting it as an assortment of Node and
 # Prop objects, representing nodes and properties, respectively. This file
@@ -334,7 +335,8 @@ class Node:
 Args:
 prop_name: Name of property
 """
-self.props[prop_name] = Prop(self, None, prop_name, '\0' * 4)
+self.props[prop_name] = Prop(self, None, prop_name,
+ tools.GetBytes(0, 4))
 
 def AddEmptyProp(self, prop_name, len):
 """Add a property with a fixed data size, for filling in later
@@ -346,7 +348,7 @@ class Node:
 prop_name: Name of property
 len: Length of data in property
 """
-value = chr(0) * len
+value = tools.GetBytes(0, len)
 self.props[prop_name] = Prop(self, None, prop_name, value)
 
 def SetInt(self, prop_name, val):
diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py
index 2d1d7dc452c..79f97d8013c 100755
--- a/tools/dtoc/test_fdt.py
+++ b/tools/dtoc/test_fdt.py
@@ -279,7 +279,7 @@ class TestProp(unittest.TestCase):
 """Tests the GetEmpty() function for the various supported types"""
 self.assertEqual(True, fdt.Prop.GetEmpty(fdt.TYPE_BOOL))
 self.assertEqual(chr(0), fdt.Prop.GetEmpty(fdt.TYPE_BYTE))
-self.assertEqual(chr(0) * 4, fdt.Prop.GetEmpty(fdt.TYPE_INT))
+self.assertEqual(tools.GetBytes(0, 4), fdt.Prop.GetEmpty(fdt.TYPE_INT))
 self.assertEqual('', fdt.Prop.GetEmpty(fdt.TYPE_STRING))
 
 def testGetOffset(self):
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 04/24] dtoc: Move BytesToValue() out of the Prop class

2019-05-17 Thread Simon Glass
This method does not actually use any members of the Prop class. Move it
out of the class so that it is easier to add unit tests.

Signed-off-by: Simon Glass 
---

 tools/dtoc/fdt.py | 104 +++---
 1 file changed, 53 insertions(+), 51 deletions(-)

diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py
index 9518a287a26..35453fbed9a 100644
--- a/tools/dtoc/fdt.py
+++ b/tools/dtoc/fdt.py
@@ -29,6 +29,57 @@ def CheckErr(errnum, msg):
 raise ValueError('Error %d: %s: %s' %
 (errnum, libfdt.fdt_strerror(errnum), msg))
 
+
+def BytesToValue(bytes):
+"""Converts a string of bytes into a type and value
+
+Args:
+A string containing bytes
+
+Return:
+A tuple:
+Type of data
+Data, either a single element or a list of elements. Each element
+is one of:
+TYPE_STRING: string value from the property
+TYPE_INT: a byte-swapped integer stored as a 4-byte string
+TYPE_BYTE: a byte stored as a single-byte string
+"""
+bytes = str(bytes)
+size = len(bytes)
+strings = bytes.split('\0')
+is_string = True
+count = len(strings) - 1
+if count > 0 and not strings[-1]:
+for string in strings[:-1]:
+if not string:
+is_string = False
+break
+for ch in string:
+if ch < ' ' or ch > '~':
+is_string = False
+break
+else:
+is_string = False
+if is_string:
+if count == 1:
+return TYPE_STRING, strings[0]
+else:
+return TYPE_STRING, strings[:-1]
+if size % 4:
+if size == 1:
+return TYPE_BYTE, bytes[0]
+else:
+return TYPE_BYTE, list(bytes)
+val = []
+for i in range(0, size, 4):
+val.append(bytes[i:i + 4])
+if size == 4:
+return TYPE_INT, val[0]
+else:
+return TYPE_INT, val
+
+
 class Prop:
 """A device tree property
 
@@ -49,7 +100,7 @@ class Prop:
 self.type = TYPE_BOOL
 self.value = True
 return
-self.type, self.value = self.BytesToValue(bytes)
+self.type, self.value = BytesToValue(bytes)
 
 def RefreshOffset(self, poffset):
 self._offset = poffset
@@ -88,55 +139,6 @@ class Prop:
 while len(self.value) < len(newprop.value):
 self.value.append(val)
 
-def BytesToValue(self, bytes):
-"""Converts a string of bytes into a type and value
-
-Args:
-A string containing bytes
-
-Return:
-A tuple:
-Type of data
-Data, either a single element or a list of elements. Each 
element
-is one of:
-TYPE_STRING: string value from the property
-TYPE_INT: a byte-swapped integer stored as a 4-byte string
-TYPE_BYTE: a byte stored as a single-byte string
-"""
-bytes = str(bytes)
-size = len(bytes)
-strings = bytes.split('\0')
-is_string = True
-count = len(strings) - 1
-if count > 0 and not strings[-1]:
-for string in strings[:-1]:
-if not string:
-is_string = False
-break
-for ch in string:
-if ch < ' ' or ch > '~':
-is_string = False
-break
-else:
-is_string = False
-if is_string:
-if count == 1:
-return TYPE_STRING, strings[0]
-else:
-return TYPE_STRING, strings[:-1]
-if size % 4:
-if size == 1:
-return TYPE_BYTE, bytes[0]
-else:
-return TYPE_BYTE, list(bytes)
-val = []
-for i in range(0, size, 4):
-val.append(bytes[i:i + 4])
-if size == 4:
-return TYPE_INT, val[0]
-else:
-return TYPE_INT, val
-
 @classmethod
 def GetEmpty(self, type):
 """Get an empty / zero value of the given type
@@ -183,7 +185,7 @@ class Prop:
 bytes: New property value to set
 """
 self.bytes = str(bytes)
-self.type, self.value = self.BytesToValue(bytes)
+self.type, self.value = BytesToValue(bytes)
 self.dirty = True
 
 def Sync(self, auto_resize=False):
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 02/24] dtoc: Sort platdata output from dtoc

2019-05-17 Thread Simon Glass
At present the order of struct field emitted by this tool depends on the
internal workings of a Python dictionary. Sort the fields to remove this
uncertainty, so that tests are deterministic.

Signed-off-by: Simon Glass 
---

 tools/dtoc/dtb_platdata.py |  3 ++-
 tools/dtoc/test_dtoc.py| 12 ++--
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py
index 4aeeab6fba9..3b66af8df78 100644
--- a/tools/dtoc/dtb_platdata.py
+++ b/tools/dtoc/dtb_platdata.py
@@ -464,7 +464,8 @@ class DtbPlatdata(object):
 var_name = conv_name_to_c(node.name)
 self.buf('static const struct %s%s %s%s = {\n' %
  (STRUCT_PREFIX, struct_name, VAL_PREFIX, var_name))
-for pname, prop in node.props.items():
+for pname in sorted(node.props):
+prop = node.props[pname]
 if pname in PROP_IGNORE_LIST or pname[0] == '#':
 continue
 member_name = conv_name_to_c(prop.name)
diff --git a/tools/dtoc/test_dtoc.py b/tools/dtoc/test_dtoc.py
index ae59a0a52a1..b915b278560 100644
--- a/tools/dtoc/test_dtoc.py
+++ b/tools/dtoc/test_dtoc.py
@@ -199,16 +199,16 @@ struct dtd_sandbox_spl_test_2 {
 data = infile.read()
 self._CheckStrings(C_HEADER + '''
 static const struct dtd_sandbox_spl_test dtv_spl_test = {
+\t.boolval\t\t= true,
 \t.bytearray\t\t= {0x6, 0x0, 0x0},
 \t.byteval\t\t= 0x5,
+\t.intarray\t\t= {0x2, 0x3, 0x4, 0x0},
 \t.intval\t\t\t= 0x1,
-\t.notstring\t\t= {0x20, 0x21, 0x22, 0x10, 0x0},
 \t.longbytearray\t\t= {0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x10,
 \t\t0x11},
-\t.stringval\t\t= "message",
-\t.boolval\t\t= true,
-\t.intarray\t\t= {0x2, 0x3, 0x4, 0x0},
+\t.notstring\t\t= {0x20, 0x21, 0x22, 0x10, 0x0},
 \t.stringarray\t\t= {"multi-word", "message", ""},
+\t.stringval\t\t= "message",
 };
 U_BOOT_DEVICE(spl_test) = {
 \t.name\t\t= "sandbox_spl_test",
@@ -219,12 +219,12 @@ U_BOOT_DEVICE(spl_test) = {
 static const struct dtd_sandbox_spl_test dtv_spl_test2 = {
 \t.bytearray\t\t= {0x1, 0x23, 0x34},
 \t.byteval\t\t= 0x8,
+\t.intarray\t\t= {0x5, 0x0, 0x0, 0x0},
 \t.intval\t\t\t= 0x3,
 \t.longbytearray\t\t= {0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
 \t\t0x0},
-\t.stringval\t\t= "message2",
-\t.intarray\t\t= {0x5, 0x0, 0x0, 0x0},
 \t.stringarray\t\t= {"another", "multi-word", "message"},
+\t.stringval\t\t= "message2",
 };
 U_BOOT_DEVICE(spl_test2) = {
 \t.name\t\t= "sandbox_spl_test",
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 08/24] dtoc: Convert the Fdt.Node class to Python 3

2019-05-17 Thread Simon Glass
Update this class to work correctly on Python 3 and to pass its unit
tests. The only required change is to deal with a difference in the
behaviour of sorting with a None value.

Signed-off-by: Simon Glass 
---

 tools/dtoc/fdt.py | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py
index f051ce67632..26e683c2a4f 100644
--- a/tools/dtoc/fdt.py
+++ b/tools/dtoc/fdt.py
@@ -465,8 +465,11 @@ class Node:
 
 # Sync properties now, whose offsets should not have been disturbed.
 # We do this after subnodes, since this disturbs the offsets of these
-# properties.
-prop_list = sorted(self.props.values(), key=lambda prop: prop._offset,
+# properties. Note that new properties will have an offset of None 
here,
+# which Python 3 cannot sort against int. So use a large value instead
+# to ensure that the new properties are added first.
+prop_list = sorted(self.props.values(),
+   key=lambda prop: prop._offset or 1 << 31,
reverse=True)
 for prop in prop_list:
 prop.Sync(auto_resize)
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 01/24] dtoc: Adjust code for Python 3

2019-05-17 Thread Simon Glass
Update a few things in this tool so that they support Python 3:
- print statements
- iteritems()
- xrange()

Signed-off-by: Simon Glass 
---

 tools/dtoc/dtb_platdata.py | 4 ++--
 tools/dtoc/dtoc.py | 8 +---
 tools/dtoc/test_dtoc.py| 4 +++-
 tools/dtoc/test_fdt.py | 8 +---
 4 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py
index 17a3dccb116..4aeeab6fba9 100644
--- a/tools/dtoc/dtb_platdata.py
+++ b/tools/dtoc/dtb_platdata.py
@@ -449,7 +449,7 @@ class DtbPlatdata(object):
 self.out(';\n')
 self.out('};\n')
 
-for alias, struct_name in self._aliases.iteritems():
+for alias, struct_name in self._aliases.items():
 if alias not in sorted(structs):
 self.out('#define %s%s %s%s\n'% (STRUCT_PREFIX, alias,
  STRUCT_PREFIX, struct_name))
@@ -498,7 +498,7 @@ class DtbPlatdata(object):
 vals.append(get_value(prop.type, val))
 
 # Put 8 values per line to avoid very long lines.
-for i in xrange(0, len(vals), 8):
+for i in range(0, len(vals), 8):
 if i:
 self.buf(',\n\t\t')
 self.buf(', '.join(vals[i:i + 8]))
diff --git a/tools/dtoc/dtoc.py b/tools/dtoc/dtoc.py
index 2277af9bf78..c1a1d3534d4 100755
--- a/tools/dtoc/dtoc.py
+++ b/tools/dtoc/dtoc.py
@@ -25,6 +25,8 @@ options. For more information about the use of this options 
and tool please
 see doc/driver-model/of-plat.txt
 """
 
+from __future__ import print_function
+
 from optparse import OptionParser
 import os
 import sys
@@ -64,11 +66,11 @@ def run_tests(args):
 suite = unittest.TestLoader().loadTestsFromTestCase(module)
 suite.run(result)
 
-print result
+print(result)
 for _, err in result.errors:
-print err
+print(err)
 for _, err in result.failures:
-print err
+print(err)
 
 def RunTestCoverage():
 """Run the tests and check that we get 100% coverage"""
diff --git a/tools/dtoc/test_dtoc.py b/tools/dtoc/test_dtoc.py
index cb6d6e7baf9..ae59a0a52a1 100644
--- a/tools/dtoc/test_dtoc.py
+++ b/tools/dtoc/test_dtoc.py
@@ -8,6 +8,8 @@ This includes unit tests for some functions and functional 
tests for the dtoc
 tool.
 """
 
+from __future__ import print_function
+
 import collections
 import os
 import struct
@@ -97,7 +99,7 @@ class TestDtoc(unittest.TestCase):
 if expected != actual:
 self._WritePythonString('/tmp/binman.expected', expected)
 self._WritePythonString('/tmp/binman.actual', actual)
-print 'Failures written to /tmp/binman.{expected,actual}'
+print('Failures written to /tmp/binman.{expected,actual}')
 self.assertEquals(expected, actual)
 
 def test_name(self):
diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py
index 8d70dd2a294..2d1d7dc452c 100755
--- a/tools/dtoc/test_fdt.py
+++ b/tools/dtoc/test_fdt.py
@@ -4,6 +4,8 @@
 # Written by Simon Glass 
 #
 
+from __future__ import print_function
+
 from optparse import OptionParser
 import glob
 import os
@@ -535,11 +537,11 @@ def RunTests(args):
 suite = unittest.TestLoader().loadTestsFromTestCase(module)
 suite.run(result)
 
-print result
+print(result)
 for _, err in result.errors:
-print err
+print(err)
 for _, err in result.failures:
-print err
+print(err)
 
 if __name__ != '__main__':
 sys.exit(1)
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 00/24] binman: dtoc: Convert to Python 3

2019-05-17 Thread Simon Glass
This series updates both binman and dtoc to support Python 3 as well as
Python 2. This mostly involves moving the code to use the 'bytes' type
on Python 3 (with associated unicode conversions) but there are various
other tweaks required as well.


Simon Glass (24):
  dtoc: Adjust code for Python 3
  dtoc: Sort platdata output from dtoc
  dtoc: Use GetBytes() to obtain repeating bytes
  dtoc: Move BytesToValue() out of the Prop class
  dtoc: Updates BytesToValue() for Python 3
  dtoc: Use byte type instead of str in fdt
  dtoc: Convert the Fdt.Prop class to Python 3
  dtoc: Convert the Fdt.Node class to Python 3
  dtoc: Use binary mode for reading files
  dtoc: Test full 64-bit properties with FdtCellsToCpu()
  dtoc: Add a unit test for BytesToValue()
  dtoc: Update fdt_util for Python 3
  dtoc: Update dtb_platdata to support Python 3
  patman: Allow reading files in text mode
  binman: Avoid changing a dict during iteration
  binman: Convert to use bytes type
  binman: Update entry_test to support Python 3
  patman: Update fmap code for Python 3
  binman: Update 'text' entry for Python 3
  binman: Fix up a format string in AssertInList()
  binman: Read map files as text
  binman: Document parallel tests
  binman: Update the README.entries file
  patman: Update cover-coverage tests for Python 3

 tools/binman/README |  14 ++
 tools/binman/README.entries |  15 ++
 tools/binman/control.py |   7 +-
 tools/binman/elf_test.py|   5 +-
 tools/binman/entry_test.py  |   6 +-
 tools/binman/etype/_testing.py  |   2 +-
 tools/binman/etype/fmap.py  |   3 +-
 tools/binman/etype/text.py  |   9 +-
 tools/binman/etype/u_boot_dtb_with_ucode.py |   4 +-
 tools/binman/etype/u_boot_ucode.py  |   4 +-
 tools/binman/etype/vblock.py|   2 +-
 tools/binman/fmap_util.py   |  12 +-
 tools/binman/ftest.py   | 136 +-
 tools/dtoc/dtb_platdata.py  |  10 +-
 tools/dtoc/dtoc.py  |   8 +-
 tools/dtoc/fdt.py   | 146 +++-
 tools/dtoc/fdt_util.py  |  15 +-
 tools/dtoc/test_dtoc.py |  16 ++-
 tools/dtoc/test_fdt.py  |  51 ---
 tools/patman/test_util.py   |  15 +-
 tools/patman/tools.py   |  56 +++-
 21 files changed, 335 insertions(+), 201 deletions(-)

-- 
2.21.0.1020.gf2820cf01a-goog

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


Re: [U-Boot] [linux-sunxi] [PATCH 0/2] sunxi: A64: enable first USB port on Pine64 boards

2019-05-17 Thread André Przywara
On 17/05/2019 19:41, André Przywara wrote:
> On 17/05/2019 19:15, Vasily Khoruzhick wrote:
>> On Wed, May 15, 2019 at 5:46 PM Andre Przywara  
>> wrote:
>>>
>>> Since the beginning the upper USB port on Pine64 boards (Pine64+, SoPine
>>> baseboard, Pine64-LTS, Pinebook) was not working under U-Boot.
>>> This is due to the PHY for those pins being shared with the OTG
>>> controller, which we didn't even enable for those boards. Also the PHY
>>> code was always connecting the port pins to the OTG controller.
>>>
>>> These two patches fix this, so the upper USB port on said boards can
>>> be used within U-Boot. This allows to use an USB keyboard alongside
>>> an USB flash drive, for instance to install operating systems using
>>> UEFI.
>>
>> Can you also add Pinebook here? It has the same issue.
> 
> Do you mean to change the -pinebook.dts in patch 2/2? Actually the
> Pinebook already had this change (from the very beginning), so it should
> work with just patch 1/2.
> My Pinebook is a somewhat sorry state, something seems fishy with the
> USB hub (keyboard doesn't work, although I have used it in U-Boot on
> another model). I will have a look again, but can you say whether this
> works for you with just patch 1?

I had a look, I guess it's the VBUS power supply missing. Can you type
the following on the U-Boot prompt to enable GPIO0-LDO?
=> mw.l 0x1f0341c 0x01
=> mw.l 0x1f03410 0x90
=> mw.l 0x1f03400 0x80
=> usb reset

And see if that fixes things for you?
My Pinebook reboots at this point (also does in Linux when the AXP
driver comes along that power rail).
If that works for you, I will send an ATF patch.

Cheers,
Andre.

>>>
>>> Andre Przywara (2):
>>>   sunxi: USB PHY: Support shared PHY 0
>>>   sunxi: Pine64: DTS: enable USB PHY 0 for HCI0
>>>
>>>  arch/arm/dts/sun50i-a64-pine64.dts   | 5 -
>>>  arch/arm/dts/sun50i-a64-sopine-baseboard.dts | 5 -
>>>  drivers/phy/allwinner/phy-sun4i-usb.c| 8 +++-
>>>  3 files changed, 15 insertions(+), 3 deletions(-)
>>>
>>> --
>>> 2.14.5
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups 
>>> "linux-sunxi" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an 
>>> email to linux-sunxi+unsubscr...@googlegroups.com.
>>> To view this discussion on the web, visit 
>>> https://groups.google.com/d/msgid/linux-sunxi/20190516004609.25304-1-andre.przywara%40arm.com.
>>> For more options, visit https://groups.google.com/d/optout.
> 

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


Re: [U-Boot] [PATCH 5/5] pci: imx: Add DM and DT support

2019-05-17 Thread Bin Meng
On Sat, May 18, 2019 at 2:26 AM Marek Vasut  wrote:
>
> Add DM support and support for probing the iMX PCI driver from DT.
> The legacy non-DM support is retained, however shall be removed once
> DM PCI is the only option remaining.
>
> Signed-off-by: Marek Vasut 
> Cc: Bin Meng 
> Cc: Fabio Estevam 
> Cc: Stefano Babic 
> ---
>  drivers/pci/pcie_imx.c | 111 ++---
>  1 file changed, 105 insertions(+), 6 deletions(-)
>

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


Re: [U-Boot] [PATCH 3/5] pci: imx: Fix potential 64bit memory access clamping

2019-05-17 Thread Bin Meng
On Sat, May 18, 2019 at 2:26 AM Marek Vasut  wrote:
>
> The driver limits the config space base to 32bit, however it can be
> 64bit on 64bit iMX hardware too. Remove that limitation. This patch
> has no impact on the iMX6, which is the only SoC currently supported
> by this driver.
>
> Signed-off-by: Marek Vasut 
> Cc: Bin Meng 
> Cc: Fabio Estevam 
> Cc: Stefano Babic 
> ---
>  drivers/pci/pcie_imx.c | 20 +++-
>  1 file changed, 11 insertions(+), 9 deletions(-)
>

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


Re: [U-Boot] [PATCH 2/5] pci: imx: Factor out hard-coded register base addresses

2019-05-17 Thread Bin Meng
On Sat, May 18, 2019 at 2:26 AM Marek Vasut  wrote:
>
> Pull out hard-coded register base addresses into driver private
> structure in preparation for DM conversion. No functional change.
>
> Signed-off-by: Marek Vasut 
> Cc: Bin Meng 
> Cc: Fabio Estevam 
> Cc: Stefano Babic 
> ---
>  drivers/pci/pcie_imx.c | 75 +-
>  1 file changed, 44 insertions(+), 31 deletions(-)
>

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


Re: [U-Boot] [PATCH 4/5] pci: imx: Pass driver private data around

2019-05-17 Thread Bin Meng
On Sat, May 18, 2019 at 2:26 AM Marek Vasut  wrote:
>
> Pass the driver private data around the driver as much as possible, instead
> of having it as a static global variable. This is done in preparation for
> the DM conversion, no functional change.
>
> Signed-off-by: Marek Vasut 
> Cc: Bin Meng 
> Cc: Fabio Estevam 
> Cc: Stefano Babic 
> ---
>  drivers/pci/pcie_imx.c | 44 --
>  1 file changed, 25 insertions(+), 19 deletions(-)
>

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


Re: [U-Boot] [PATCH 1/5] ARM: imx: Call imx_pcie_remove() only for non-DM PCI driver

2019-05-17 Thread Bin Meng
On Sat, May 18, 2019 at 2:26 AM Marek Vasut  wrote:
>
> The DM iMX PCI driver has DM_FLAG_OS_PREPARE set and will call
> imx_pcie_remove() from the .remove callback. Do not call it from
> the architecture code again.
>
> Signed-off-by: Marek Vasut 
> Cc: Bin Meng 
> Cc: Fabio Estevam 
> Cc: Stefano Babic 
> ---
>  arch/arm/mach-imx/cpu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

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


Re: [U-Boot] [PATCH V3 05/10] fat: ff: read max contiguous file data

2019-05-17 Thread Stephen Warren

On 10/20/15 1:10 PM, Tom Rini wrote:

On Tue, Oct 20, 2015 at 12:57:32PM -0600, Stephen Warren wrote:

On 10/02/2015 12:06 AM, Stephen Warren wrote:

Enhance f_read() to find the maximum contiguous set of clusters to read,
and read it all at once (which is fast) rather one by one (which is
slow).


Hmm. I had hoped that the author of ff.c would accept this patch
upstream, so we could pick up a later upstream version that included
this patch. However, it seems the author of ff.c has a policy of not
accepting outside contributions:

http://elm-chan.org/fsw/ff/bd/?show=2472
(That's a link to the author's reply to my patch, on the forum
system associated with his/her SW)


The bit about the license is at
http://elm-chan.org/fsw/ff/en/appnote.html#license


I wonder how much of a liability incorporating ff.c into U-Boot will
be, if we can't ever get any fixes merged upstream. Perhaps we just
fork it, although I had hoped we'd be able to keep picking up new
versions.


Arg, that really does take away one of the potential nice features.  I
guess, sadly, at this point I'd rather stick with the version we have
unless you want to deal with re-syncing their releases but still
effectively doing a fork (so that we can also make use of caches which I
think you said before you thought might be part of the performance
problem.

Or we take a look at borrowing the kernel's code, similar to how we
leverage UBIFS today.

Regardless, thanks for the time you've already put in on this!


If anyone is still interested in replacing the FAT code, I just noticed 
that FreeRTOS has been relicensed to MIT along with some/all of its 
extensions, including the FAT code:


https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_FAT/index.html

I'd assume that code is reasonably well maintained and 
embedded-suitable. I have not investigated:


- If it has the same "no contributions" issue that FF had.
- If it's modular enough to plug into other hosts besides FreeRTOS.
- What its performance is like.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 0/2] Add 'bcb' command to read/modify/write Android BCB

2019-05-17 Thread Stephen Finucane
On Fri, 2019-05-17 at 17:24 +0200, Eugeniu Rosca wrote:
> Hi All,
> 
> cc: Stephen, Jeremy
> 
> FWIW/jFYI, the patchwork frontend appears to mangle/skip spaces
> in the patch subjects. Examples:
>  - https://patchwork.ozlabs.org/cover/1101106/
>  - https://patchwork.ozlabs.org/patch/1101108/
>  - https://patchwork.ozlabs.org/patch/1101107/
> 
> The same patches look fine on https://marc.info:
>  - https://marc.info/?l=u-boot&m=155810440206070&w=2
>  - https://marc.info/?l=u-boot&m=155810448306089&w=2
>  - https://marc.info/?l=u-boot&m=155810444306080&w=2
> 

http://patchwork.ozlabs.org/patch/1099264/

We're just waiting for ozlabs to apply that patch.

Stephen

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


[U-Boot] [PATCH 8/8] ARM: imx: vining2000: Enable DM Serial

2019-05-17 Thread Marek Vasut
Enable DM Serial support on iMX6SX VINING|2000.

Signed-off-by: Marek Vasut 
Cc: Fabio Estevam 
Cc: Silvio Fricke 
Cc: Stefano Babic 
---
 board/softing/vining_2000/vining_2000.c | 12 
 configs/vining_2000_defconfig   |  3 +++
 include/configs/vining_2000.h   |  3 ---
 3 files changed, 3 insertions(+), 15 deletions(-)

diff --git a/board/softing/vining_2000/vining_2000.c 
b/board/softing/vining_2000/vining_2000.c
index d960773671..19b9b37276 100644
--- a/board/softing/vining_2000/vining_2000.c
+++ b/board/softing/vining_2000/vining_2000.c
@@ -71,11 +71,6 @@ int dram_init(void)
return 0;
 }
 
-static iomux_v3_cfg_t const uart1_pads[] = {
-   MX6_PAD_GPIO1_IO04__UART1_TX | MUX_PAD_CTRL(UART_PAD_CTRL),
-   MX6_PAD_GPIO1_IO05__UART1_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
-};
-
 static iomux_v3_cfg_t const fec1_pads[] = {
MX6_PAD_ENET1_MDC__ENET1_MDC | MUX_PAD_CTRL(ENET_PAD_CTRL),
MX6_PAD_ENET1_MDIO__ENET1_MDIO | MUX_PAD_CTRL(ENET_PAD_CTRL),
@@ -97,11 +92,6 @@ static iomux_v3_cfg_t const pwm_led_pads[] = {
MX6_PAD_RGMII2_RD3__PWM1_OUT | MUX_PAD_CTRL(NO_PAD_CTRL), /* blue */
 };
 
-static void setup_iomux_uart(void)
-{
-   imx_iomux_v3_setup_multiple_pads(uart1_pads, ARRAY_SIZE(uart1_pads));
-}
-
 #define PHY_RESET IMX_GPIO_NR(5, 9)
 
 int board_eth_init(bd_t *bis)
@@ -419,8 +409,6 @@ int board_late_init(void)
 
 int board_early_init_f(void)
 {
-   setup_iomux_uart();
-
setup_iomux_usb();
 
return 0;
diff --git a/configs/vining_2000_defconfig b/configs/vining_2000_defconfig
index 0a2b042ed1..9e8326e771 100644
--- a/configs/vining_2000_defconfig
+++ b/configs/vining_2000_defconfig
@@ -49,6 +49,9 @@ CONFIG_PCI=y
 CONFIG_DM_PCI=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX6=y
+CONFIG_SPECIFY_CONSOLE_INDEX=y
+CONFIG_DM_SERIAL=y
+CONFIG_MXC_UART=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_STORAGE=y
diff --git a/include/configs/vining_2000.h b/include/configs/vining_2000.h
index fd98c1417e..d4db9b4a56 100644
--- a/include/configs/vining_2000.h
+++ b/include/configs/vining_2000.h
@@ -17,9 +17,6 @@
 /* Size of malloc() pool */
 #define CONFIG_SYS_MALLOC_LEN  (3 * SZ_1M)
 
-#define CONFIG_MXC_UART
-#define CONFIG_MXC_UART_BASE   UART1_BASE
-
 #define BOOT_TARGET_DEVICES(func) \
func(MMC, mmc, 0) \
func(MMC, mmc, 1) \
-- 
2.20.1

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


[U-Boot] [PATCH 2/8] ARM: dts: imx: vining2000: Import VINING|2000 DT from Linux

2019-05-17 Thread Marek Vasut
Import iMX6SX VINING|2000 device tree from Linux 5.1.1 b724e9356404 .
Enable DT control in full U-Boot .

Signed-off-by: Marek Vasut 
Cc: Fabio Estevam 
Cc: Silvio Fricke 
Cc: Stefano Babic 
---
 arch/arm/dts/Makefile   |   3 +-
 arch/arm/dts/imx6sx-softing-vining-2000.dts | 573 
 configs/vining_2000_defconfig   |   6 +-
 3 files changed, 580 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/dts/imx6sx-softing-vining-2000.dts

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 0ec7bc987d..1dcfa9a535 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -565,7 +565,8 @@ dtb-$(CONFIG_MX6SLL) += imx6sll-evk.dtb
 
 dtb-$(CONFIG_MX6SX) += \
imx6sx-sabreauto.dtb \
-   imx6sx-sdb.dtb
+   imx6sx-sdb.dtb \
+   imx6sx-softing-vining-2000.dtb
 
 dtb-$(CONFIG_MX6UL) += \
imx6ul-geam.dtb \
diff --git a/arch/arm/dts/imx6sx-softing-vining-2000.dts 
b/arch/arm/dts/imx6sx-softing-vining-2000.dts
new file mode 100644
index 00..2bc51623a8
--- /dev/null
+++ b/arch/arm/dts/imx6sx-softing-vining-2000.dts
@@ -0,0 +1,573 @@
+/*
+ * Copyright (C) 2016 Christoph Fritz 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+/dts-v1/;
+
+#include 
+#include 
+#include "imx6sx.dtsi"
+
+/ {
+   model = "Softing VIN|ING 2000";
+   compatible = "samtec,imx6sx-vining-2000", "fsl,imx6sx";
+
+   chosen {
+   stdout-path = &uart1;
+   };
+
+   memory@8000 {
+   device_type = "memory";
+   reg = <0x8000 0x4000>;
+   };
+
+   reg_usb_otg1_vbus: regulator-usb_otg1_vbus {
+   compatible = "regulator-fixed";
+   regulator-name = "usb_otg1_vbus";
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_usb_otg1>;
+   regulator-min-microvolt = <500>;
+   regulator-max-microvolt = <500>;
+   gpio = <&gpio1 9 GPIO_ACTIVE_HIGH>;
+   enable-active-high;
+   };
+
+   reg_peri_3v3: regulator-peri_3v3 {
+   compatible = "regulator-fixed";
+   regulator-name = "peri_3v3";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   };
+
+   pwmleds {
+   compatible = "pwm-leds";
+
+   red {
+   label = "red";
+   max-brightness = <255>;
+   pwms = <&pwm6 0 5>;
+   };
+
+   green {
+   label = "green";
+   max-brightness = <255>;
+   pwms = <&pwm2 0 5>;
+   };
+
+   blue {
+   label = "blue";
+   max-brightness = <255>;
+   pwms = <&pwm1 0 5>;
+   };
+   };
+};
+
+&adc1 {
+   vref-supply = <®_peri_3v3>;
+   status = "okay";
+};
+
+&cpu0 {
+   /*
+* This board has a shared rail of reg_arm and reg_soc (supplied by
+* sw1a_reg) which is modeled below, but still this module behaves
+* unstable without higher voltages. Hence, set higher voltages here.
+*/
+   operating-points = <
+   /* kHzuV */
+   996000  125
+   792000  1175000
+   396000  1175000
+   198000  1175000
+   >;
+   fsl,soc-operating-points = <
+   /* ARM kHz  SOC uV */
+   996000  125
+   792000  1175000
+   396000  1175000
+   198000  1175000
+   >;
+};
+
+&ecspi4 {
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_ecspi4>;
+   cs-gpios = <&gpio7 4 GPIO_ACTIVE_HIGH>;
+   status = "okay";
+};
+
+&fec1 {
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_enet1>;
+   phy-supply = <®_peri_3v3>;
+   phy-reset-gpios = <&gpio5 9 GPIO_ACTIVE_LOW>;
+   phy-reset-duration = <5>;
+   phy-mode = "rmii";
+   phy-handle = <ðphy0>;
+   status = "okay";
+
+   mdio {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   ethphy0: ethernet0-phy@0 {
+   reg = <0>;
+   max-speed = <100>;
+   interrupt-parent = <&gpio2>;
+   interrupts = <17 IRQ_TYPE_LEVEL_LOW>;
+   };
+   };
+};
+
+&fec2 {
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_enet2>;
+   phy-supply = <®_peri_3v3>;
+   phy-reset-gpios = <&gpio5 21 GPIO_ACTIVE_LOW>;
+   phy-reset-duration = <5>;
+   phy-mode = "rmii";
+   phy-handle = <ðphy1>;
+   status = "okay";
+
+   mdio {
+   #address-cells = <1>;
+

[U-Boot] [PATCH 7/8] ARM: imx: vining2000: Enable DM PCI

2019-05-17 Thread Marek Vasut
Enable DM PCI support on iMX6SX VINING|2000.

Signed-off-by: Marek Vasut 
Cc: Fabio Estevam 
Cc: Silvio Fricke 
Cc: Stefano Babic 
---
 configs/vining_2000_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/vining_2000_defconfig b/configs/vining_2000_defconfig
index 94df5ac4df..0a2b042ed1 100644
--- a/configs/vining_2000_defconfig
+++ b/configs/vining_2000_defconfig
@@ -46,6 +46,7 @@ CONFIG_FSL_ESDHC=y
 CONFIG_PHYLIB=y
 CONFIG_MII=y
 CONFIG_PCI=y
+CONFIG_DM_PCI=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX6=y
 CONFIG_USB=y
-- 
2.20.1

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


[U-Boot] [PATCH 5/8] ARM: imx: vining2000: Enable DM USB

2019-05-17 Thread Marek Vasut
Enable DM USB support on iMX6SX VINING|2000.

Signed-off-by: Marek Vasut 
Cc: Fabio Estevam 
Cc: Silvio Fricke 
Cc: Stefano Babic 
---
 configs/vining_2000_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/vining_2000_defconfig b/configs/vining_2000_defconfig
index 2bd88149be..02dd223e63 100644
--- a/configs/vining_2000_defconfig
+++ b/configs/vining_2000_defconfig
@@ -48,5 +48,7 @@ CONFIG_PCI=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX6=y
 CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_USB_STORAGE=y
 CONFIG_USB_HOST_ETHER=y
 CONFIG_USB_ETHER_ASIX=y
-- 
2.20.1

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


[U-Boot] [PATCH 4/8] ARM: imx: vining2000: Convert MMC and block to DM

2019-05-17 Thread Marek Vasut
Enable DM block and DM MMC support on iMX6SX VINING|2000 .
Convert board code to match the DM support. This disables
USB mass storage support due to missing DM USB, however
that will be re-enabled in subsequent patch.

Signed-off-by: Marek Vasut 
Cc: Fabio Estevam 
Cc: Silvio Fricke 
Cc: Stefano Babic 
---
 arch/arm/dts/imx6sx-softing-vining-2000.dts |  5 ++
 board/softing/vining_2000/vining_2000.c | 77 -
 configs/vining_2000_defconfig   |  2 +-
 3 files changed, 6 insertions(+), 78 deletions(-)

diff --git a/arch/arm/dts/imx6sx-softing-vining-2000.dts 
b/arch/arm/dts/imx6sx-softing-vining-2000.dts
index 2bc51623a8..371890ff60 100644
--- a/arch/arm/dts/imx6sx-softing-vining-2000.dts
+++ b/arch/arm/dts/imx6sx-softing-vining-2000.dts
@@ -16,6 +16,11 @@
model = "Softing VIN|ING 2000";
compatible = "samtec,imx6sx-vining-2000", "fsl,imx6sx";
 
+   aliases {
+   mmc0 = &usdhc4;
+   mmc1 = &usdhc2;
+   };
+
chosen {
stdout-path = &uart1;
};
diff --git a/board/softing/vining_2000/vining_2000.c 
b/board/softing/vining_2000/vining_2000.c
index f0313b06fb..9ab7fbeddf 100644
--- a/board/softing/vining_2000/vining_2000.c
+++ b/board/softing/vining_2000/vining_2000.c
@@ -76,30 +76,6 @@ static iomux_v3_cfg_t const uart1_pads[] = {
MX6_PAD_GPIO1_IO05__UART1_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
 };
 
-static iomux_v3_cfg_t const usdhc2_pads[] = {
-   MX6_PAD_SD2_CLK__USDHC2_CLK | MUX_PAD_CTRL(USDHC_CLK_PAD_CTRL),
-   MX6_PAD_SD2_CMD__USDHC2_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-   MX6_PAD_SD2_DATA0__USDHC2_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-   MX6_PAD_SD2_DATA1__USDHC2_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-   MX6_PAD_SD2_DATA2__USDHC2_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-   MX6_PAD_SD2_DATA3__USDHC2_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-   MX6_PAD_LCD1_VSYNC__GPIO3_IO_28 | MUX_PAD_CTRL(GPIO_PAD_CTRL),
-};
-
-static iomux_v3_cfg_t const usdhc4_pads[] = {
-   MX6_PAD_SD4_CLK__USDHC4_CLK | MUX_PAD_CTRL(USDHC_CLK_PAD_CTRL),
-   MX6_PAD_SD4_CMD__USDHC4_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-   MX6_PAD_SD4_DATA0__USDHC4_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-   MX6_PAD_SD4_DATA1__USDHC4_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-   MX6_PAD_SD4_DATA2__USDHC4_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-   MX6_PAD_SD4_DATA3__USDHC4_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-   MX6_PAD_SD4_DATA4__USDHC4_DATA4 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-   MX6_PAD_SD4_DATA5__USDHC4_DATA5 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-   MX6_PAD_SD4_DATA6__USDHC4_DATA6 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-   MX6_PAD_SD4_DATA7__USDHC4_DATA7 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-   MX6_PAD_SD4_RESET_B__USDHC4_RESET_B | MUX_PAD_CTRL(USDHC_RESET_CTRL),
-};
-
 static iomux_v3_cfg_t const fec1_pads[] = {
MX6_PAD_ENET1_MDC__ENET1_MDC | MUX_PAD_CTRL(ENET_PAD_CTRL),
MX6_PAD_ENET1_MDIO__ENET1_MDIO | MUX_PAD_CTRL(ENET_PAD_CTRL),
@@ -449,59 +425,6 @@ int board_early_init_f(void)
return 0;
 }
 
-static struct fsl_esdhc_cfg usdhc_cfg[2] = {
-   {USDHC4_BASE_ADDR, 0, 8},
-   {USDHC2_BASE_ADDR, 0, 4},
-};
-
-#define USDHC2_CD_GPIO IMX_GPIO_NR(3, 28)
-
-int board_mmc_getcd(struct mmc *mmc)
-{
-   struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
-
-   if (cfg->esdhc_base == USDHC4_BASE_ADDR)
-   return 1;
-   if (cfg->esdhc_base == USDHC2_BASE_ADDR)
-   return !gpio_get_value(USDHC2_CD_GPIO);
-
-   return -EINVAL;
-}
-
-int board_mmc_init(bd_t *bis)
-{
-   int ret;
-
-   /*
-* According to the board_mmc_init() the following map is done:
-* (U-Boot device node)(Physical Port)
-* mmc0USDHC4
-* mmc1USDHC2
-*/
-   imx_iomux_v3_setup_multiple_pads(
-   usdhc4_pads, ARRAY_SIZE(usdhc4_pads));
-   usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK);
-
-   imx_iomux_v3_setup_multiple_pads(
-   usdhc2_pads, ARRAY_SIZE(usdhc2_pads));
-   gpio_direction_input(USDHC2_CD_GPIO);
-   usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
-
-   ret = fsl_esdhc_initialize(bis, &usdhc_cfg[0]);
-   if (ret) {
-   printf("Warning: failed to initialize USDHC4\n");
-   return ret;
-   }
-
-   ret = fsl_esdhc_initialize(bis, &usdhc_cfg[1]);
-   if (ret) {
-   printf("Warning: failed to initialize USDHC2\n");
-   return ret;
-   }
-
-   return 0;
-}
-
 int board_init(void)
 {
/* Address of boot parameters */
diff --git a/configs/vining_2000_defconfig b/configs/vining_2000_defconfig
index 01736823b8..2bd88149be 100644
--- a/configs/vining_2000_defconfig
+++ b/configs/vining_2000_defconfig
@@ -38,6 +38,7 @@ CONFIG_EFI_PARTITION=y
 CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="imx6sx-softing-vining-2000"
 CONFIG_ENV_VARS_UBOOT

[U-Boot] [PATCH 6/8] ARM: imx: vining2000: Enable DM GPIO

2019-05-17 Thread Marek Vasut
Enable DM GPIO support on iMX6SX VINING|2000 and fix up
board code where applicable.

Signed-off-by: Marek Vasut 
Cc: Fabio Estevam 
Cc: Silvio Fricke 
Cc: Stefano Babic 
---
 board/softing/vining_2000/vining_2000.c | 1 +
 configs/vining_2000_defconfig   | 1 +
 2 files changed, 2 insertions(+)

diff --git a/board/softing/vining_2000/vining_2000.c 
b/board/softing/vining_2000/vining_2000.c
index 9ab7fbeddf..d960773671 100644
--- a/board/softing/vining_2000/vining_2000.c
+++ b/board/softing/vining_2000/vining_2000.c
@@ -133,6 +133,7 @@ int board_eth_init(bd_t *bis)
goto eth_fail;
 
/* reset phy */
+   gpio_request(PHY_RESET, "PHY-reset");
gpio_direction_output(PHY_RESET, 0);
mdelay(16);
gpio_set_value(PHY_RESET, 1);
diff --git a/configs/vining_2000_defconfig b/configs/vining_2000_defconfig
index 02dd223e63..94df5ac4df 100644
--- a/configs/vining_2000_defconfig
+++ b/configs/vining_2000_defconfig
@@ -38,6 +38,7 @@ CONFIG_EFI_PARTITION=y
 CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="imx6sx-softing-vining-2000"
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
+CONFIG_DM_GPIO=y
 CONFIG_DM_MMC=y
 CONFIG_SUPPORT_EMMC_RPMB=y
 CONFIG_SUPPORT_EMMC_BOOT=y
-- 
2.20.1

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


[U-Boot] [PATCH 3/8] ARM: imx: vining2000: Enable DM pin control

2019-05-17 Thread Marek Vasut
Enable DM pin control support on iMX6SX VINING|2000.

Signed-off-by: Marek Vasut 
Cc: Fabio Estevam 
Cc: Silvio Fricke 
Cc: Stefano Babic 
---
 configs/vining_2000_defconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/configs/vining_2000_defconfig b/configs/vining_2000_defconfig
index 958b7bb5ac..01736823b8 100644
--- a/configs/vining_2000_defconfig
+++ b/configs/vining_2000_defconfig
@@ -21,6 +21,7 @@ CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_PART=y
 CONFIG_CMD_PCI=y
+# CONFIG_CMD_PINMUX is not set
 CONFIG_CMD_USB=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_DHCP=y
@@ -43,6 +44,8 @@ CONFIG_FSL_ESDHC=y
 CONFIG_PHYLIB=y
 CONFIG_MII=y
 CONFIG_PCI=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_IMX6=y
 CONFIG_USB=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_HOST_ETHER=y
-- 
2.20.1

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


[U-Boot] [PATCH 1/8] ARM: imx: Rename VINING|2000

2019-05-17 Thread Marek Vasut
The company Samtec was merged into Softing, migrate the board over to
the new name and update copyright headers.

Signed-off-by: Marek Vasut 
Cc: Fabio Estevam 
Cc: Silvio Fricke 
Cc: Stefano Babic 
---
 arch/arm/mach-imx/mx6/Kconfig   | 6 +++---
 board/{samtec => softing}/vining_2000/Kconfig   | 4 ++--
 board/{samtec => softing}/vining_2000/MAINTAINERS   | 4 ++--
 board/{samtec => softing}/vining_2000/Makefile  | 1 +
 board/{samtec => softing}/vining_2000/imximage.cfg  | 1 +
 board/{samtec => softing}/vining_2000/vining_2000.c | 1 +
 configs/vining_2000_defconfig   | 4 ++--
 7 files changed, 12 insertions(+), 9 deletions(-)
 rename board/{samtec => softing}/vining_2000/Kconfig (69%)
 rename board/{samtec => softing}/vining_2000/MAINTAINERS (57%)
 rename board/{samtec => softing}/vining_2000/Makefile (67%)
 rename board/{samtec => softing}/vining_2000/imximage.cfg (97%)
 rename board/{samtec => softing}/vining_2000/vining_2000.c (99%)

diff --git a/arch/arm/mach-imx/mx6/Kconfig b/arch/arm/mach-imx/mx6/Kconfig
index f513c4c06f..1ef0c58c2f 100644
--- a/arch/arm/mach-imx/mx6/Kconfig
+++ b/arch/arm/mach-imx/mx6/Kconfig
@@ -498,8 +498,8 @@ config TARGET_UDOO_NEO
select SUPPORT_SPL
imply CMD_DM
 
-config TARGET_SAMTEC_VINING_2000
-   bool "samtec VIN|ING 2000"
+config TARGET_SOFTING_VINING_2000
+   bool "Softing VIN|ING 2000"
select BOARD_LATE_INIT
select DM
select DM_THERMAL
@@ -580,7 +580,7 @@ source "board/phytec/pfla02/Kconfig"
 source "board/phytec/pcl063/Kconfig"
 source "board/gateworks/gw_ventana/Kconfig"
 source "board/kosagi/novena/Kconfig"
-source "board/samtec/vining_2000/Kconfig"
+source "board/softing/vining_2000/Kconfig"
 source "board/liebherr/display5/Kconfig"
 source "board/liebherr/mccmon6/Kconfig"
 source "board/logicpd/imx6/Kconfig"
diff --git a/board/samtec/vining_2000/Kconfig 
b/board/softing/vining_2000/Kconfig
similarity index 69%
rename from board/samtec/vining_2000/Kconfig
rename to board/softing/vining_2000/Kconfig
index 3447c27fa4..90d45a7f6e 100644
--- a/board/samtec/vining_2000/Kconfig
+++ b/board/softing/vining_2000/Kconfig
@@ -1,10 +1,10 @@
-if TARGET_SAMTEC_VINING_2000
+if TARGET_SOFTING_VINING_2000
 
 config SYS_BOARD
default "vining_2000"
 
 config SYS_VENDOR
-   default "samtec"
+   default "softing"
 
 config SYS_CONFIG_NAME
default "vining_2000"
diff --git a/board/samtec/vining_2000/MAINTAINERS 
b/board/softing/vining_2000/MAINTAINERS
similarity index 57%
rename from board/samtec/vining_2000/MAINTAINERS
rename to board/softing/vining_2000/MAINTAINERS
index 027e52736f..0df78c6b95 100644
--- a/board/samtec/vining_2000/MAINTAINERS
+++ b/board/softing/vining_2000/MAINTAINERS
@@ -1,6 +1,6 @@
 VINING_2000 BOARD
-M: Ingo Schroeck 
+M: Silvio Fricke 
 S: Maintained
-F: board/samtec/vining_2000/
+F: board/softing/vining_2000/
 F: include/configs/vining_2000.h
 F: configs/vining_2000_defconfig
diff --git a/board/samtec/vining_2000/Makefile 
b/board/softing/vining_2000/Makefile
similarity index 67%
rename from board/samtec/vining_2000/Makefile
rename to board/softing/vining_2000/Makefile
index 9650da711d..84f66a67b5 100644
--- a/board/samtec/vining_2000/Makefile
+++ b/board/softing/vining_2000/Makefile
@@ -1,4 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0+
 # (C) Copyright 2016 samtec automotive software & electronics gmbh
+# Copyright (C) 2017-2019 softing automotive electronics gmbH
 
 obj-y  := vining_2000.o
diff --git a/board/samtec/vining_2000/imximage.cfg 
b/board/softing/vining_2000/imximage.cfg
similarity index 97%
rename from board/samtec/vining_2000/imximage.cfg
rename to board/softing/vining_2000/imximage.cfg
index 3e4fcad8ea..f6f59ddf55 100644
--- a/board/samtec/vining_2000/imximage.cfg
+++ b/board/softing/vining_2000/imximage.cfg
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0+ */
 /*
  * Copyright (C) 2016 samtec automotive software & electronics gmbh
+ * Copyright (C) 2017-2019 softing automotive electronics gmbH
  */
 
 #define __ASSEMBLY__
diff --git a/board/samtec/vining_2000/vining_2000.c 
b/board/softing/vining_2000/vining_2000.c
similarity index 99%
rename from board/samtec/vining_2000/vining_2000.c
rename to board/softing/vining_2000/vining_2000.c
index d82b3aeb31..f0313b06fb 100644
--- a/board/samtec/vining_2000/vining_2000.c
+++ b/board/softing/vining_2000/vining_2000.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (C) 2016 samtec automotive software & electronics gmbh
+ * Copyright (C) 2017-2019 softing automotive electronics gmbH
  *
  * Author: Christoph Fritz 
  */
diff --git a/configs/vining_2000_defconfig b/configs/vining_2000_defconfig
index 073ff48329..0f9069381e 100644
--- a/configs/vining_2000_defconfig
+++ b/configs/vining_2000_defconfig
@@ -1,10 +1,10 @@
 CONFIG_ARM=y
 CONFIG_ARCH_MX6=y
 CONFIG_SYS_TEXT_BASE=0x8780
-CONFIG_TARGET_SAMTEC_VINING_2000=y
+CONFIG_TARGET_SOFTIN

[U-Boot] [PATCH 0/8] ARM: imx: Update VINING|2000 to DM/DT

2019-05-17 Thread Marek Vasut
Update Softing VINING|2000 to DM / DT and remove the warnings.
This depends on the following patches / series:

  http://patchwork.ozlabs.org/patch/1101222/
  http://patchwork.ozlabs.org/patch/1101230/
  https://patchwork.ozlabs.org/project/uboot/list/?series=108463

Marek Vasut (8):
  ARM: imx: Rename VINING|2000
  ARM: dts: imx: vining2000: Import VINING|2000 DT from Linux
  ARM: imx: vining2000: Enable DM pin control
  ARM: imx: vining2000: Convert MMC and block to DM
  ARM: imx: vining2000: Enable DM USB
  ARM: imx: vining2000: Enable DM GPIO
  ARM: imx: vining2000: Enable DM PCI
  ARM: imx: vining2000: Enable DM Serial

 arch/arm/dts/Makefile |   3 +-
 arch/arm/dts/imx6sx-softing-vining-2000.dts   | 578 ++
 arch/arm/mach-imx/mx6/Kconfig |   6 +-
 board/{samtec => softing}/vining_2000/Kconfig |   4 +-
 .../vining_2000/MAINTAINERS   |   4 +-
 .../{samtec => softing}/vining_2000/Makefile  |   1 +
 .../vining_2000/imximage.cfg  |   1 +
 .../vining_2000/vining_2000.c |  91 +--
 configs/vining_2000_defconfig |  20 +-
 include/configs/vining_2000.h |   3 -
 10 files changed, 608 insertions(+), 103 deletions(-)
 create mode 100644 arch/arm/dts/imx6sx-softing-vining-2000.dts
 rename board/{samtec => softing}/vining_2000/Kconfig (69%)
 rename board/{samtec => softing}/vining_2000/MAINTAINERS (57%)
 rename board/{samtec => softing}/vining_2000/Makefile (67%)
 rename board/{samtec => softing}/vining_2000/imximage.cfg (97%)
 rename board/{samtec => softing}/vining_2000/vining_2000.c (77%)

Cc: Fabio Estevam 
Cc: Silvio Fricke 
Cc: Stefano Babic 
-- 
2.20.1

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


[U-Boot] [RFC] spl: imx6: Let spl_boot_device return USDHC1 or USDHC2

2019-05-17 Thread Adam Ford
Currently, when the spl_boot_device checks the boot device, it
will only return MMC1 when it's either sd or eMMC regardless
of whether or not it's MMC1 or MMC2.  This is a problem when
booting from MMC2 if MMC isn't being manually configured like in
the DM_SPL case with SPL_OF_CONTROL.

This patch will check the register and return either MMC1 or MMC2.

Signed-off-by: Adam Ford 

diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c
index 9f1e0f6a72..1f230aca33 100644
--- a/arch/arm/mach-imx/spl.c
+++ b/arch/arm/mach-imx/spl.c
@@ -24,6 +24,7 @@ u32 spl_boot_device(void)
 {
unsigned int bmode = readl(&src_base->sbmr2);
u32 reg = imx6_src_get_boot_mode();
+   u32 mmc_index = ((reg >> 11) & 0x03);
 
/*
 * Check for BMODE if serial downloader is enabled
@@ -84,11 +85,12 @@ u32 spl_boot_device(void)
/* SD/eSD: 8.5.3, Table 8-15  */
case IMX6_BMODE_SD:
case IMX6_BMODE_ESD:
-   return BOOT_DEVICE_MMC1;
-   /* MMC/eMMC: 8.5.3 */
case IMX6_BMODE_MMC:
case IMX6_BMODE_EMMC:
-   return BOOT_DEVICE_MMC1;
+   if (mmc_index == 1)
+   return BOOT_DEVICE_MMC2;
+   else
+   return BOOT_DEVICE_MMC1;
/* NAND Flash: 8.5.2, Table 8-10 */
case IMX6_BMODE_NAND_MIN ... IMX6_BMODE_NAND_MAX:
return BOOT_DEVICE_NAND;
-- 
2.17.1

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


[U-Boot] [PATCH] serial: mxc: Add iMX6SX compatible string

2019-05-17 Thread Marek Vasut
Add compatible string for iMX6SX.

Signed-off-by: Marek Vasut 
Cc: Fabio Estevam 
Cc: Silvio Fricke 
Cc: Stefano Babic 
---
 drivers/serial/serial_mxc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/serial/serial_mxc.c b/drivers/serial/serial_mxc.c
index 476df25805..a435e68005 100644
--- a/drivers/serial/serial_mxc.c
+++ b/drivers/serial/serial_mxc.c
@@ -342,6 +342,7 @@ static int mxc_serial_ofdata_to_platdata(struct udevice 
*dev)
 }
 
 static const struct udevice_id mxc_serial_ids[] = {
+   { .compatible = "fsl,imx6sx-uart" },
{ .compatible = "fsl,imx6ul-uart" },
{ .compatible = "fsl,imx7d-uart" },
{ .compatible = "fsl,imx6q-uart" },
-- 
2.20.1

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


Re: [U-Boot] [PATCH] video: Factor out vidconsole_put_string()

2019-05-17 Thread Anatolij Gustschin
On Fri, 17 May 2019 20:22:31 +0200
Marek Vasut ma...@denx.de wrote:

> Pull the vidconsole_put_string() function from DM tests, make it
> available to e.g. boards that want to display information on the
> LCD on boot.
> 
> Signed-off-by: Marek Vasut 
> Cc: Anatolij Gustschin 

Reviewed-by: Anatolij Gustschin 

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


[U-Boot] [PATCH 2/2] mx6sx: vining2000: pinmux usdhc4 reset

2019-05-17 Thread Marek Vasut
From: Christoph Fritz 

This patch configures pinmux for pin usdhc4 reset.

Signed-off-by: Christoph Fritz 
---
 board/softing/vining_2000/vining_2000.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/board/softing/vining_2000/vining_2000.c 
b/board/softing/vining_2000/vining_2000.c
index 77c34e39be..30693c0cdf 100644
--- a/board/softing/vining_2000/vining_2000.c
+++ b/board/softing/vining_2000/vining_2000.c
@@ -58,6 +58,9 @@ DECLARE_GLOBAL_DATA_PTR;
PAD_CTL_PKE |  PAD_CTL_SPEED_MED | PAD_CTL_DSE_80ohm |  \
PAD_CTL_SRE_FAST)
 
+#define USDHC_RESET_CTRL (PAD_CTL_HYS | PAD_CTL_PUS_47K_UP |   \
+   PAD_CTL_PKE |  PAD_CTL_SPEED_MED | PAD_CTL_DSE_80ohm)
+
 #define GPIO_PAD_CTRL  (PAD_CTL_HYS | PAD_CTL_PUS_100K_UP |\
PAD_CTL_PKE)
 
@@ -94,6 +97,7 @@ static iomux_v3_cfg_t const usdhc4_pads[] = {
MX6_PAD_SD4_DATA5__USDHC4_DATA5 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_SD4_DATA6__USDHC4_DATA6 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_SD4_DATA7__USDHC4_DATA7 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+   MX6_PAD_SD4_RESET_B__USDHC4_RESET_B | MUX_PAD_CTRL(USDHC_RESET_CTRL),
 };
 
 static iomux_v3_cfg_t const fec1_pads[] = {
-- 
2.16.1

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


Re: [U-Boot] [linux-sunxi] [PATCH 0/2] sunxi: A64: enable first USB port on Pine64 boards

2019-05-17 Thread André Przywara
On 17/05/2019 19:15, Vasily Khoruzhick wrote:
> On Wed, May 15, 2019 at 5:46 PM Andre Przywara  wrote:
>>
>> Since the beginning the upper USB port on Pine64 boards (Pine64+, SoPine
>> baseboard, Pine64-LTS, Pinebook) was not working under U-Boot.
>> This is due to the PHY for those pins being shared with the OTG
>> controller, which we didn't even enable for those boards. Also the PHY
>> code was always connecting the port pins to the OTG controller.
>>
>> These two patches fix this, so the upper USB port on said boards can
>> be used within U-Boot. This allows to use an USB keyboard alongside
>> an USB flash drive, for instance to install operating systems using
>> UEFI.
> 
> Can you also add Pinebook here? It has the same issue.

Do you mean to change the -pinebook.dts in patch 2/2? Actually the
Pinebook already had this change (from the very beginning), so it should
work with just patch 1/2.
My Pinebook is a somewhat sorry state, something seems fishy with the
USB hub (keyboard doesn't work, although I have used it in U-Boot on
another model). I will have a look again, but can you say whether this
works for you with just patch 1?

Thanks,
Andre.

>>
>> Andre Przywara (2):
>>   sunxi: USB PHY: Support shared PHY 0
>>   sunxi: Pine64: DTS: enable USB PHY 0 for HCI0
>>
>>  arch/arm/dts/sun50i-a64-pine64.dts   | 5 -
>>  arch/arm/dts/sun50i-a64-sopine-baseboard.dts | 5 -
>>  drivers/phy/allwinner/phy-sun4i-usb.c| 8 +++-
>>  3 files changed, 15 insertions(+), 3 deletions(-)
>>
>> --
>> 2.14.5
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "linux-sunxi" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to linux-sunxi+unsubscr...@googlegroups.com.
>> To view this discussion on the web, visit 
>> https://groups.google.com/d/msgid/linux-sunxi/20190516004609.25304-1-andre.przywara%40arm.com.
>> For more options, visit https://groups.google.com/d/optout.

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


[U-Boot] [PATCH V2 6/7] ARM: imx: novena: Enable DM PCI

2019-05-17 Thread Marek Vasut
Enable DM PCI support on iMX6Q Novena.

Signed-off-by: Marek Vasut 
Cc: Fabio Estevam 
Cc: Stefano Babic 
Cc: Vagrant Cascadian 
---
V2: New patch
---
 configs/novena_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/novena_defconfig b/configs/novena_defconfig
index c5dbbb0b4d..bbed972a44 100644
--- a/configs/novena_defconfig
+++ b/configs/novena_defconfig
@@ -56,6 +56,7 @@ CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ90X1=y
 CONFIG_MII=y
 CONFIG_PCI=y
+CONFIG_DM_PCI=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX6=y
 CONFIG_DM_SCSI=y
-- 
2.20.1

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


[U-Boot] [PATCH V2 5/7] ARM: imx: novena: Enable DM USB

2019-05-17 Thread Marek Vasut
Enable DM USB support on iMX6Q Novena.

Signed-off-by: Marek Vasut 
Cc: Fabio Estevam 
Cc: Stefano Babic 
Cc: Vagrant Cascadian 
---
V2: No change
---
 configs/novena_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/novena_defconfig b/configs/novena_defconfig
index fa5fdea278..c5dbbb0b4d 100644
--- a/configs/novena_defconfig
+++ b/configs/novena_defconfig
@@ -60,6 +60,7 @@ CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX6=y
 CONFIG_DM_SCSI=y
 CONFIG_USB=y
+CONFIG_DM_USB=y
 CONFIG_USB_KEYBOARD=y
 CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP=y
 CONFIG_USB_GADGET=y
-- 
2.20.1

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


[U-Boot] [PATCH V2 4/7] ARM: imx: novena: Convert block devices to DM

2019-05-17 Thread Marek Vasut
Enable DM block, DM MMC and DM SATA support on iMX6Q Novena
convert board code to match the DM support.

Signed-off-by: Marek Vasut 
Cc: Fabio Estevam 
Cc: Stefano Babic 
Cc: Vagrant Cascadian 
---
V2: - Drop the ad-hoc sata binding, this is superseded by
  CONFIG_DWC_AHSATA_AHCI=y resp. drivers/ata/dwc_ahsata.c
- Drop dangling setup_sata() call
---
 arch/arm/dts/imx6q-novena.dts |  5 +++
 board/kosagi/novena/novena.c  | 62 +++
 configs/novena_defconfig  |  3 ++
 include/configs/novena.h  |  5 ---
 4 files changed, 12 insertions(+), 63 deletions(-)

diff --git a/arch/arm/dts/imx6q-novena.dts b/arch/arm/dts/imx6q-novena.dts
index 61347a545d..35383c9a2b 100644
--- a/arch/arm/dts/imx6q-novena.dts
+++ b/arch/arm/dts/imx6q-novena.dts
@@ -61,6 +61,11 @@
reg = <0x1000 0>;
};
 
+   aliases {
+   mmc0 = &usdhc3;
+   mmc1 = &usdhc2;
+   };
+
chosen {
stdout-path = &uart2;
};
diff --git a/board/kosagi/novena/novena.c b/board/kosagi/novena/novena.c
index 0750c4667e..d897f8f1cd 100644
--- a/board/kosagi/novena/novena.c
+++ b/board/kosagi/novena/novena.c
@@ -6,6 +6,9 @@
  */
 
 #include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -20,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -101,60 +105,6 @@ int drv_keyboard_init(void)
 }
 #endif
 
-/*
- * SDHC
- */
-#ifdef CONFIG_FSL_ESDHC
-static struct fsl_esdhc_cfg usdhc_cfg[] = {
-   { USDHC3_BASE_ADDR, 0, 4 }, /* Micro SD */
-   { USDHC2_BASE_ADDR, 0, 4 }, /* Big SD */
-};
-
-int board_mmc_getcd(struct mmc *mmc)
-{
-   struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
-
-   /* There is no CD for a microSD card, assume always present. */
-   if (cfg->esdhc_base == USDHC3_BASE_ADDR)
-   return 1;
-   else
-   return !gpio_get_value(NOVENA_SD_CD);
-}
-
-int board_mmc_getwp(struct mmc *mmc)
-{
-   struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
-
-   /* There is no WP for a microSD card, assume always read-write. */
-   if (cfg->esdhc_base == USDHC3_BASE_ADDR)
-   return 0;
-   else
-   return gpio_get_value(NOVENA_SD_WP);
-}
-
-
-int board_mmc_init(bd_t *bis)
-{
-   s32 status = 0;
-   int index;
-
-   usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
-   usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
-
-   /* Big SD write-protect and card-detect */
-   gpio_direction_input(NOVENA_SD_WP);
-   gpio_direction_input(NOVENA_SD_CD);
-
-   for (index = 0; index < ARRAY_SIZE(usdhc_cfg); index++) {
-   status = fsl_esdhc_initialize(bis, &usdhc_cfg[index]);
-   if (status)
-   return status;
-   }
-
-   return status;
-}
-#endif
-
 int board_early_init_f(void)
 {
 #if defined(CONFIG_VIDEO_IPUV3)
@@ -169,10 +119,6 @@ int board_init(void)
/* address of boot parameters */
gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
 
-#ifdef CONFIG_SATA
-   setup_sata();
-#endif
-
return 0;
 }
 
diff --git a/configs/novena_defconfig b/configs/novena_defconfig
index c74f635121..fa5fdea278 100644
--- a/configs/novena_defconfig
+++ b/configs/novena_defconfig
@@ -13,6 +13,7 @@ CONFIG_SPL=y
 CONFIG_SPL_FS_FAT=y
 CONFIG_SPL_LIBDISK_SUPPORT=y
 CONFIG_CMD_HDMIDETECT=y
+CONFIG_AHCI=y
 CONFIG_DISTRO_DEFAULTS=y
 # CONFIG_SYS_MALLOC_F is not set
 CONFIG_FIT=y
@@ -48,6 +49,7 @@ CONFIG_ENV_IS_IN_MMC=y
 CONFIG_DM=y
 CONFIG_DWC_AHSATA=y
 CONFIG_DM_GPIO=y
+CONFIG_DM_MMC=y
 CONFIG_FSL_ESDHC=y
 CONFIG_PHYLIB=y
 CONFIG_PHY_MICREL=y
@@ -56,6 +58,7 @@ CONFIG_MII=y
 CONFIG_PCI=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX6=y
+CONFIG_DM_SCSI=y
 CONFIG_USB=y
 CONFIG_USB_KEYBOARD=y
 CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP=y
diff --git a/include/configs/novena.h b/include/configs/novena.h
index bb5bf808c2..bc7383e957 100644
--- a/include/configs/novena.h
+++ b/include/configs/novena.h
@@ -102,12 +102,7 @@
 #define CONFIG_POWER_PFUZE100_I2C_ADDR 0x08
 
 /* SATA Configs */
-#ifdef CONFIG_CMD_SATA
-#define CONFIG_SYS_SATA_MAX_DEVICE 1
-#define CONFIG_DWC_AHSATA_PORT_ID  0
-#define CONFIG_DWC_AHSATA_BASE_ADDRSATA_ARB_BASE_ADDR
 #define CONFIG_LBA48
-#endif
 
 /* UART */
 #define CONFIG_MXC_UART
-- 
2.20.1

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


[U-Boot] [PATCH V2 7/7] ARM: imx: novena: Convert to DM VIDEO

2019-05-17 Thread Marek Vasut
Enable DM Video support on iMX6Q Novena and fix minor details
to restore previous behavior of the system.

Signed-off-by: Marek Vasut 
Cc: Fabio Estevam 
Cc: Stefano Babic 
Cc: Vagrant Cascadian 
---
V2: Print U-Boot version information on the LCD
---
 board/kosagi/novena/novena.c | 13 +
 configs/novena_defconfig |  6 +++---
 include/configs/novena.h |  4 ++--
 3 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/board/kosagi/novena/novena.c b/board/kosagi/novena/novena.c
index d897f8f1cd..78294b820e 100644
--- a/board/kosagi/novena/novena.c
+++ b/board/kosagi/novena/novena.c
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "novena.h"
 
@@ -125,7 +126,19 @@ int board_init(void)
 int board_late_init(void)
 {
 #if defined(CONFIG_VIDEO_IPUV3)
+   struct udevice *con;
+   char buf[DISPLAY_OPTIONS_BANNER_LENGTH];
+   int ret;
+
setup_display_lvds();
+
+   ret = uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con);
+   if (ret)
+   return ret;
+
+   display_options_get_banner(false, buf, sizeof(buf));
+   vidconsole_position_cursor(con, 0, 0);
+   vidconsole_put_string(con, buf);
 #endif
return 0;
 }
diff --git a/configs/novena_defconfig b/configs/novena_defconfig
index bbed972a44..e649ebb549 100644
--- a/configs/novena_defconfig
+++ b/configs/novena_defconfig
@@ -4,6 +4,7 @@ CONFIG_SYS_TEXT_BASE=0x1780
 CONFIG_SPL_GPIO_SUPPORT=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
+CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_MX6_DDRCAL=y
 CONFIG_TARGET_KOSAGI_NOVENA=y
 CONFIG_SPL_MMC_SUPPORT=y
@@ -15,7 +16,6 @@ CONFIG_SPL_LIBDISK_SUPPORT=y
 CONFIG_CMD_HDMIDETECT=y
 CONFIG_AHCI=y
 CONFIG_DISTRO_DEFAULTS=y
-# CONFIG_SYS_MALLOC_F is not set
 CONFIG_FIT=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg,MX6Q"
 CONFIG_USE_BOOTARGS=y
@@ -71,7 +71,7 @@ CONFIG_USB_ETH_CDC=y
 CONFIG_USB_HOST_ETHER=y
 CONFIG_USB_ETHER_ASIX=y
 CONFIG_USB_ETHER_SMSC95XX=y
+CONFIG_DM_VIDEO=y
+CONFIG_SYS_WHITE_ON_BLACK=y
 CONFIG_VIDEO_IPUV3=y
-CONFIG_VIDEO=y
-# CONFIG_VIDEO_SW_CURSOR is not set
 CONFIG_FAT_WRITE=y
diff --git a/include/configs/novena.h b/include/configs/novena.h
index bc7383e957..cdc437c492 100644
--- a/include/configs/novena.h
+++ b/include/configs/novena.h
@@ -119,14 +119,12 @@
 #endif
 
 /* Video output */
-#ifdef CONFIG_VIDEO
 #define CONFIG_VIDEO_BMP_RLE8
 #define CONFIG_SPLASH_SCREEN
 #define CONFIG_BMP_16BPP
 #define CONFIG_VIDEO_LOGO
 #define CONFIG_IMX_HDMI
 #define CONFIG_IMX_VIDEO_SKIP
-#endif
 
 /* Extra U-Boot environment. */
 #ifndef CONFIG_SPL_BUILD
@@ -144,6 +142,8 @@
"ramdisk_addr_r=0x2800\0"   \
"fdt_addr_r=0x1800\0"   \
"fdtfile=imx6q-novena.dtb\0"\
+   "stdout=serial,vidconsole\0"\
+   "stderr=serial,vidconsole\0"\
"addcons="  \
"setenv bootargs ${bootargs} "  \
"console=${consdev},${baudrate}\0"  \
-- 
2.20.1

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


[U-Boot] [PATCH V2 3/7] ARM: imx: novena: Enable DM GPIO

2019-05-17 Thread Marek Vasut
Enable DM GPIO support on iMX6Q Novena and fix up board code
where applicable.

Signed-off-by: Marek Vasut 
Cc: Fabio Estevam 
Cc: Stefano Babic 
Cc: Vagrant Cascadian 
---
V2: No change
---
 board/kosagi/novena/novena.c | 2 ++
 board/kosagi/novena/video.c  | 3 +++
 configs/novena_defconfig | 1 +
 3 files changed, 6 insertions(+)

diff --git a/board/kosagi/novena/novena.c b/board/kosagi/novena/novena.c
index 9f2586521d..0750c4667e 100644
--- a/board/kosagi/novena/novena.c
+++ b/board/kosagi/novena/novena.c
@@ -83,6 +83,8 @@ int drv_keyboard_init(void)
.tstc   = novena_gpio_button_tstc,
};
 
+   gpio_request(NOVENA_BUTTON_GPIO, "button");
+
error = input_init(&button_input, 0);
if (error) {
debug("%s: Cannot set up input\n", __func__);
diff --git a/board/kosagi/novena/video.c b/board/kosagi/novena/video.c
index f1351b9e28..7083b6e103 100644
--- a/board/kosagi/novena/video.c
+++ b/board/kosagi/novena/video.c
@@ -270,6 +270,7 @@ static void enable_lvds(struct display_info_t const *dev)
return;
 
/* ITE IT6251 power enable. */
+   gpio_request(NOVENA_ITE6251_PWR_GPIO, "ite6251-power");
gpio_direction_output(NOVENA_ITE6251_PWR_GPIO, 0);
mdelay(10);
gpio_direction_output(NOVENA_ITE6251_PWR_GPIO, 1);
@@ -447,6 +448,8 @@ void setup_display_lvds(void)
/* Init the LVDS-to-eDP chip and if it succeeded, enable backlight. */
ret = it6251_init();
if (!ret) {
+   gpio_request(NOVENA_BACKLIGHT_PWR_GPIO, "backlight-power");
+   gpio_request(NOVENA_BACKLIGHT_PWM_GPIO, "backlight-pwm");
/* Backlight power enable. */
gpio_direction_output(NOVENA_BACKLIGHT_PWR_GPIO, 1);
/* PWM backlight pin, always on for full brightness. */
diff --git a/configs/novena_defconfig b/configs/novena_defconfig
index 31a32da0dc..c74f635121 100644
--- a/configs/novena_defconfig
+++ b/configs/novena_defconfig
@@ -47,6 +47,7 @@ CONFIG_DEFAULT_DEVICE_TREE="imx6q-novena"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_DM=y
 CONFIG_DWC_AHSATA=y
+CONFIG_DM_GPIO=y
 CONFIG_FSL_ESDHC=y
 CONFIG_PHYLIB=y
 CONFIG_PHY_MICREL=y
-- 
2.20.1

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


[U-Boot] [PATCH V2 1/7] ARM: dts: imx: novena: Import Novena DT from Linux

2019-05-17 Thread Marek Vasut
Import iMX6Q Novena device tree from Linux 5.1-rc7 37624b58542f .
Enable DT control in full U-Boot .

Signed-off-by: Marek Vasut 
Cc: Fabio Estevam 
Cc: Stefano Babic 
Cc: Vagrant Cascadian 
---
V2: No change
---
 arch/arm/dts/Makefile |   3 +-
 arch/arm/dts/imx6q-novena.dts | 792 ++
 configs/novena_defconfig  |   3 +-
 3 files changed, 796 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/dts/imx6q-novena.dts

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 0ec7bc987d..dad47144e7 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -535,7 +535,8 @@ dtb-$(CONFIG_MX53) += imx53-cx9020.dtb \
 dtb-$(CONFIG_MX6Q) += \
imx6-apalis.dtb \
imx6q-display5.dtb \
-   imx6q-logicpd.dtb
+   imx6q-logicpd.dtb \
+   imx6q-novena.dtb
 
 dtb-$(CONFIG_TARGET_TBS2910) += \
imx6q-tbs2910.dtb
diff --git a/arch/arm/dts/imx6q-novena.dts b/arch/arm/dts/imx6q-novena.dts
new file mode 100644
index 00..61347a545d
--- /dev/null
+++ b/arch/arm/dts/imx6q-novena.dts
@@ -0,0 +1,792 @@
+/*
+ * Copyright 2015 Sutajio Ko-Usagi PTE LTD
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this file; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+/dts-v1/;
+#include "imx6q.dtsi"
+#include 
+#include 
+
+/ {
+   model = "Kosagi Novena Dual/Quad";
+   compatible = "kosagi,imx6q-novena", "fsl,imx6q";
+
+   /* Will be filled by the bootloader */
+   memory@1000 {
+   device_type = "memory";
+   reg = <0x1000 0>;
+   };
+
+   chosen {
+   stdout-path = &uart2;
+   };
+
+   backlight: backlight {
+   compatible = "pwm-backlight";
+   pwms = <&pwm1 0 1000>;
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_backlight_novena>;
+   power-supply = <®_lvds_lcd>;
+   brightness-levels = <0 3 6 12 16 24 32 48 64 96 128 192 255>;
+   default-brightness-level = <12>;
+   };
+
+   gpio-keys {
+   compatible = "gpio-keys";
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_gpio_keys_novena>;
+
+   user-button {
+   label = "User Button";
+   gpios = <&gpio4 14 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+
+   lid {
+   label = "Lid";
+   gpios = <&gpio4 12 GPIO_ACTIVE_LOW>;
+   linux,input-type = <5>; /* EV_SW */
+   linux,code = <0>;   /* SW_LID */
+   };
+   };
+
+   leds {
+   compatible = "gpio-leds";
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_leds_novena>;
+
+   heartbeat {
+   l

[U-Boot] [PATCH V2 0/7] ARM: imx: Update Novena to DM/DT

2019-05-17 Thread Marek Vasut
Update Kosagi Novena to DM / DT and remove the warnings.
This depends on the following patches / series:

  https://patchwork.ozlabs.org/patch/1095618/
  https://patchwork.ozlabs.org/patch/1101171/
  https://patchwork.ozlabs.org/project/uboot/list/?series=108463

Marek Vasut (7):
  ARM: dts: imx: novena: Import Novena DT from Linux
  ARM: imx: novena: Enable DM pin control
  ARM: imx: novena: Enable DM GPIO
  ARM: imx: novena: Convert block devices to DM
  ARM: imx: novena: Enable DM USB
  ARM: imx: novena: Enable DM PCI
  ARM: imx: novena: Convert to DM VIDEO

 arch/arm/dts/Makefile |   3 +-
 arch/arm/dts/imx6q-novena.dts | 797 ++
 board/kosagi/novena/novena.c  |  77 +---
 board/kosagi/novena/video.c   |   3 +
 configs/novena_defconfig  |  18 +-
 include/configs/novena.h  |   9 +-
 6 files changed, 838 insertions(+), 69 deletions(-)
 create mode 100644 arch/arm/dts/imx6q-novena.dts

Cc: Fabio Estevam 
Cc: Stefano Babic 
Cc: Vagrant Cascadian 
-- 
2.20.1

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


[U-Boot] [PATCH V2 2/7] ARM: imx: novena: Enable DM pin control

2019-05-17 Thread Marek Vasut
Enable DM pin control support on iMX6Q Novena.

Signed-off-by: Marek Vasut 
Cc: Fabio Estevam 
Cc: Stefano Babic 
Cc: Vagrant Cascadian 
---
V2: No change
---
 configs/novena_defconfig | 5 +
 1 file changed, 5 insertions(+)

diff --git a/configs/novena_defconfig b/configs/novena_defconfig
index 04c944c6d8..31a32da0dc 100644
--- a/configs/novena_defconfig
+++ b/configs/novena_defconfig
@@ -14,6 +14,7 @@ CONFIG_SPL_FS_FAT=y
 CONFIG_SPL_LIBDISK_SUPPORT=y
 CONFIG_CMD_HDMIDETECT=y
 CONFIG_DISTRO_DEFAULTS=y
+# CONFIG_SYS_MALLOC_F is not set
 CONFIG_FIT=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg,MX6Q"
 CONFIG_USE_BOOTARGS=y
@@ -29,6 +30,7 @@ CONFIG_SPL_I2C_SUPPORT=y
 CONFIG_SPL_WATCHDOG_SUPPORT=y
 CONFIG_CMD_ASKENV=y
 CONFIG_CMD_EEPROM=y
+CONFIG_CMD_DM=y
 # CONFIG_CMD_FLASH is not set
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
@@ -43,6 +45,7 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="imx6q-novena"
 CONFIG_ENV_IS_IN_MMC=y
+CONFIG_DM=y
 CONFIG_DWC_AHSATA=y
 CONFIG_FSL_ESDHC=y
 CONFIG_PHYLIB=y
@@ -50,6 +53,8 @@ CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ90X1=y
 CONFIG_MII=y
 CONFIG_PCI=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_IMX6=y
 CONFIG_USB=y
 CONFIG_USB_KEYBOARD=y
 CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP=y
-- 
2.20.1

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


[U-Boot] [PATCH 5/5] pci: imx: Add DM and DT support

2019-05-17 Thread Marek Vasut
Add DM support and support for probing the iMX PCI driver from DT.
The legacy non-DM support is retained, however shall be removed once
DM PCI is the only option remaining.

Signed-off-by: Marek Vasut 
Cc: Bin Meng 
Cc: Fabio Estevam 
Cc: Stefano Babic 
---
 drivers/pci/pcie_imx.c | 111 ++---
 1 file changed, 105 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/pcie_imx.c b/drivers/pci/pcie_imx.c
index bcee3745f4..e6a396023b 100644
--- a/drivers/pci/pcie_imx.c
+++ b/drivers/pci/pcie_imx.c
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -383,10 +384,9 @@ static void imx_pcie_fix_dabt_handler(bool set)
}
 }
 
-static int imx_pcie_read_config(struct pci_controller *hose, pci_dev_t d,
-   int where, u32 *val)
+static int imx_pcie_read_cfg(struct imx_pcie_priv *priv, pci_dev_t d,
+int where, u32 *val)
 {
-   struct imx_pcie_priv *priv = hose->priv_data;
void __iomem *va_address;
int ret;
 
@@ -413,10 +413,9 @@ static int imx_pcie_read_config(struct pci_controller 
*hose, pci_dev_t d,
return 0;
 }
 
-static int imx_pcie_write_config(struct pci_controller *hose, pci_dev_t d,
-   int where, u32 val)
+static int imx_pcie_write_cfg(struct imx_pcie_priv *priv, pci_dev_t d,
+ int where, u32 val)
 {
-   struct imx_pcie_priv *priv = hose->priv_data;
void __iomem *va_address = NULL;
int ret;
 
@@ -668,6 +667,7 @@ static int imx_pcie_link_up(struct imx_pcie_priv *priv)
return 0;
 }
 
+#if !CONFIG_IS_ENABLED(DM_PCI)
 static struct imx_pcie_priv imx_pcie_priv = {
.dbi_base   = (void __iomem *)MX6_DBI_ADDR,
.cfg_base   = (void __iomem *)MX6_ROOT_ADDR,
@@ -675,6 +675,22 @@ static struct imx_pcie_priv imx_pcie_priv = {
 
 static struct imx_pcie_priv *priv = &imx_pcie_priv;
 
+static int imx_pcie_read_config(struct pci_controller *hose, pci_dev_t d,
+   int where, u32 *val)
+{
+   struct imx_pcie_priv *priv = hose->priv_data;
+
+   return imx_pcie_read_cfg(priv, d, where, val);
+}
+
+static int imx_pcie_write_config(struct pci_controller *hose, pci_dev_t d,
+int where, u32 *val)
+{
+   struct imx_pcie_priv *priv = hose->priv_data;
+
+   return imx_pcie_write_cfg(priv, d, where, val);
+}
+
 void imx_pcie_init(void)
 {
/* Static instance of the controller. */
@@ -730,3 +746,86 @@ void pci_init_board(void)
 {
imx_pcie_init();
 }
+#else
+static int imx_pcie_dm_read_config(struct udevice *dev, pci_dev_t bdf,
+  uint offset, ulong *value,
+  enum pci_size_t size)
+{
+   struct imx_pcie_priv *priv = dev_get_priv(dev);
+   u32 tmpval;
+   int ret;
+
+   ret = imx_pcie_read_cfg(priv, bdf, offset, &tmpval);
+   if (ret)
+   return ret;
+
+   *value = pci_conv_32_to_size(tmpval, offset, size);
+   return 0;
+}
+
+static int imx_pcie_dm_write_config(struct udevice *dev, pci_dev_t bdf,
+   uint offset, ulong value,
+   enum pci_size_t size)
+{
+   struct imx_pcie_priv *priv = dev_get_priv(dev);
+   u32 tmpval, newval;
+   int ret;
+
+   ret = imx_pcie_read_cfg(priv, bdf, offset, &tmpval);
+   if (ret)
+   return ret;
+
+   newval = pci_conv_size_to_32(tmpval, value, offset, size);
+   return imx_pcie_write_cfg(priv, bdf, offset, newval);
+}
+
+static int imx_pcie_dm_probe(struct udevice *dev)
+{
+   struct imx_pcie_priv *priv = dev_get_priv(dev);
+
+   return imx_pcie_link_up(priv);
+}
+
+static int imx_pcie_dm_remove(struct udevice *dev)
+{
+   struct imx_pcie_priv *priv = dev_get_priv(dev);
+
+   imx6_pcie_assert_core_reset(priv, true);
+
+   return 0;
+}
+
+static int imx_pcie_ofdata_to_platdata(struct udevice *dev)
+{
+   struct imx_pcie_priv *priv = dev_get_priv(dev);
+
+   priv->dbi_base = (void __iomem *)devfdt_get_addr_index(dev, 0);
+   priv->cfg_base = (void __iomem *)devfdt_get_addr_index(dev, 1);
+   if (!priv->dbi_base || !priv->cfg_base)
+   return -EINVAL;
+
+   return 0;
+}
+
+static const struct dm_pci_ops imx_pcie_ops = {
+   .read_config= imx_pcie_dm_read_config,
+   .write_config   = imx_pcie_dm_write_config,
+};
+
+static const struct udevice_id imx_pcie_ids[] = {
+   { .compatible = "fsl,imx6q-pcie" },
+   { }
+};
+
+U_BOOT_DRIVER(imx_pcie) = {
+   .name   = "imx_pcie",
+   .id = UCLASS_PCI,
+   .of_match   = imx_pcie_ids,
+   .ops= &imx_pcie_ops,
+   .probe  = imx_pcie_dm_probe,
+   .remove = imx_pcie_dm_remove,
+   .ofdata_to_platdata = imx_pc

[U-Boot] [PATCH 3/5] pci: imx: Fix potential 64bit memory access clamping

2019-05-17 Thread Marek Vasut
The driver limits the config space base to 32bit, however it can be
64bit on 64bit iMX hardware too. Remove that limitation. This patch
has no impact on the iMX6, which is the only SoC currently supported
by this driver.

Signed-off-by: Marek Vasut 
Cc: Bin Meng 
Cc: Fabio Estevam 
Cc: Stefano Babic 
---
 drivers/pci/pcie_imx.c | 20 +++-
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/pci/pcie_imx.c b/drivers/pci/pcie_imx.c
index 173636f48e..76f9e06b36 100644
--- a/drivers/pci/pcie_imx.c
+++ b/drivers/pci/pcie_imx.c
@@ -307,9 +307,11 @@ static int imx_pcie_regions_setup(void)
/* Region #0 is used for Outbound CFG space access. */
writel(0, priv->dbi_base + PCIE_ATU_VIEWPORT);
 
-   writel((u32)priv->cfg_base, priv->dbi_base + PCIE_ATU_LOWER_BASE);
-   writel(0, priv->dbi_base + PCIE_ATU_UPPER_BASE);
-   writel((u32)priv->cfg_base + MX6_ROOT_SIZE,
+   writel(lower_32_bits((uintptr_t)priv->cfg_base),
+  priv->dbi_base + PCIE_ATU_LOWER_BASE);
+   writel(upper_32_bits((uintptr_t)priv->cfg_base),
+  priv->dbi_base + PCIE_ATU_UPPER_BASE);
+   writel(lower_32_bits((uintptr_t)priv->cfg_base + MX6_ROOT_SIZE),
   priv->dbi_base + PCIE_ATU_LIMIT);
 
writel(0, priv->dbi_base + PCIE_ATU_LOWER_TARGET);
@@ -323,9 +325,9 @@ static int imx_pcie_regions_setup(void)
 /*
  * PCI Express accessors
  */
-static uint32_t get_bus_address(pci_dev_t d, int where)
+static void __iomem *get_bus_address(pci_dev_t d, int where)
 {
-   uint32_t va_address;
+   void __iomem *va_address;
 
/* Reconfigure Region #0 */
writel(0, priv->dbi_base + PCIE_ATU_VIEWPORT);
@@ -336,10 +338,10 @@ static uint32_t get_bus_address(pci_dev_t d, int where)
writel(PCIE_ATU_TYPE_CFG1, priv->dbi_base + PCIE_ATU_CR1);
 
if (PCI_BUS(d) == 0) {
-   va_address = (u32)priv->dbi_base;
+   va_address = priv->dbi_base;
} else {
writel(d << 8, priv->dbi_base + PCIE_ATU_LOWER_TARGET);
-   va_address = (u32)priv->cfg_base;
+   va_address = priv->cfg_base;
}
 
va_address += (where & ~0x3);
@@ -390,7 +392,7 @@ static void imx_pcie_fix_dabt_handler(bool set)
 static int imx_pcie_read_config(struct pci_controller *hose, pci_dev_t d,
int where, u32 *val)
 {
-   uint32_t va_address;
+   void __iomem *va_address;
int ret;
 
ret = imx_pcie_addr_valid(d);
@@ -419,7 +421,7 @@ static int imx_pcie_read_config(struct pci_controller 
*hose, pci_dev_t d,
 static int imx_pcie_write_config(struct pci_controller *hose, pci_dev_t d,
int where, u32 val)
 {
-   uint32_t va_address = 0;
+   void __iomem *va_address = NULL;
int ret;
 
ret = imx_pcie_addr_valid(d);
-- 
2.20.1

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


[U-Boot] [PATCH 4/5] pci: imx: Pass driver private data around

2019-05-17 Thread Marek Vasut
Pass the driver private data around the driver as much as possible, instead
of having it as a static global variable. This is done in preparation for
the DM conversion, no functional change.

Signed-off-by: Marek Vasut 
Cc: Bin Meng 
Cc: Fabio Estevam 
Cc: Stefano Babic 
---
 drivers/pci/pcie_imx.c | 44 --
 1 file changed, 25 insertions(+), 19 deletions(-)

diff --git a/drivers/pci/pcie_imx.c b/drivers/pci/pcie_imx.c
index 76f9e06b36..bcee3745f4 100644
--- a/drivers/pci/pcie_imx.c
+++ b/drivers/pci/pcie_imx.c
@@ -97,13 +97,6 @@ struct imx_pcie_priv {
void __iomem*cfg_base;
 };
 
-static struct imx_pcie_priv imx_pcie_priv = {
-   .dbi_base   = (void __iomem *)MX6_DBI_ADDR,
-   .cfg_base   = (void __iomem *)MX6_ROOT_ADDR,
-};
-
-static struct imx_pcie_priv *priv = &imx_pcie_priv;
-
 /*
  * PHY access functions
  */
@@ -237,7 +230,7 @@ static int pcie_phy_write(void __iomem *dbi_base, int addr, 
int data)
return 0;
 }
 
-static int imx6_pcie_link_up(void)
+static int imx6_pcie_link_up(struct imx_pcie_priv *priv)
 {
u32 rc, ltssm;
int rx_valid, temp;
@@ -282,7 +275,7 @@ static int imx6_pcie_link_up(void)
 /*
  * iATU region setup
  */
-static int imx_pcie_regions_setup(void)
+static int imx_pcie_regions_setup(struct imx_pcie_priv *priv)
 {
/*
 * i.MX6 defines 16MB in the AXI address map for PCIe.
@@ -325,7 +318,8 @@ static int imx_pcie_regions_setup(void)
 /*
  * PCI Express accessors
  */
-static void __iomem *get_bus_address(pci_dev_t d, int where)
+static void __iomem *get_bus_address(struct imx_pcie_priv *priv,
+pci_dev_t d, int where)
 {
void __iomem *va_address;
 
@@ -392,6 +386,7 @@ static void imx_pcie_fix_dabt_handler(bool set)
 static int imx_pcie_read_config(struct pci_controller *hose, pci_dev_t d,
int where, u32 *val)
 {
+   struct imx_pcie_priv *priv = hose->priv_data;
void __iomem *va_address;
int ret;
 
@@ -401,7 +396,7 @@ static int imx_pcie_read_config(struct pci_controller 
*hose, pci_dev_t d,
return 0;
}
 
-   va_address = get_bus_address(d, where);
+   va_address = get_bus_address(priv, d, where);
 
/*
 * Read the PCIe config space. We must replace the DABT handler
@@ -421,6 +416,7 @@ static int imx_pcie_read_config(struct pci_controller 
*hose, pci_dev_t d,
 static int imx_pcie_write_config(struct pci_controller *hose, pci_dev_t d,
int where, u32 val)
 {
+   struct imx_pcie_priv *priv = hose->priv_data;
void __iomem *va_address = NULL;
int ret;
 
@@ -428,7 +424,7 @@ static int imx_pcie_write_config(struct pci_controller 
*hose, pci_dev_t d,
if (ret)
return ret;
 
-   va_address = get_bus_address(d, where);
+   va_address = get_bus_address(priv, d, where);
 
/*
 * Write the PCIe config space. We must replace the DABT handler
@@ -445,7 +441,8 @@ static int imx_pcie_write_config(struct pci_controller 
*hose, pci_dev_t d,
 /*
  * Initial bus setup
  */
-static int imx6_pcie_assert_core_reset(bool prepare_for_boot)
+static int imx6_pcie_assert_core_reset(struct imx_pcie_priv *priv,
+  bool prepare_for_boot)
 {
struct iomuxc *iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR;
 
@@ -617,17 +614,17 @@ static int imx6_pcie_deassert_core_reset(void)
return 0;
 }
 
-static int imx_pcie_link_up(void)
+static int imx_pcie_link_up(struct imx_pcie_priv *priv)
 {
struct iomuxc *iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR;
uint32_t tmp;
int count = 0;
 
-   imx6_pcie_assert_core_reset(false);
+   imx6_pcie_assert_core_reset(priv, false);
imx6_pcie_init_phy();
imx6_pcie_deassert_core_reset();
 
-   imx_pcie_regions_setup();
+   imx_pcie_regions_setup(priv);
 
/*
 * By default, the subordinate is set equally to the secondary
@@ -654,7 +651,7 @@ static int imx_pcie_link_up(void)
/* LTSSM enable, starting link. */
setbits_le32(&iomuxc_regs->gpr[12], IOMUXC_GPR12_APPS_LTSSM_ENABLE);
 
-   while (!imx6_pcie_link_up()) {
+   while (!imx6_pcie_link_up(priv)) {
udelay(10);
count++;
if (count >= 4000) {
@@ -671,6 +668,13 @@ static int imx_pcie_link_up(void)
return 0;
 }
 
+static struct imx_pcie_priv imx_pcie_priv = {
+   .dbi_base   = (void __iomem *)MX6_DBI_ADDR,
+   .cfg_base   = (void __iomem *)MX6_ROOT_ADDR,
+};
+
+static struct imx_pcie_priv *priv = &imx_pcie_priv;
+
 void imx_pcie_init(void)
 {
/* Static instance of the controller. */
@@ -680,6 +684,8 @@ void imx_pcie_init(void)
 
memset(&pcc, 0, sizeof(pcc));
 
+   hose->priv_data = priv;
+
/* PCI I/O space */
pci_set_region(&hose->regions[0],
   

[U-Boot] [PATCH 1/5] ARM: imx: Call imx_pcie_remove() only for non-DM PCI driver

2019-05-17 Thread Marek Vasut
The DM iMX PCI driver has DM_FLAG_OS_PREPARE set and will call
imx_pcie_remove() from the .remove callback. Do not call it from
the architecture code again.

Signed-off-by: Marek Vasut 
Cc: Bin Meng 
Cc: Fabio Estevam 
Cc: Stefano Babic 
---
 arch/arm/mach-imx/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/cpu.c b/arch/arm/mach-imx/cpu.c
index 6b83f92662..93e60b2039 100644
--- a/arch/arm/mach-imx/cpu.c
+++ b/arch/arm/mach-imx/cpu.c
@@ -285,7 +285,7 @@ u32 get_ahb_clk(void)
 
 void arch_preboot_os(void)
 {
-#if defined(CONFIG_PCIE_IMX)
+#if defined(CONFIG_PCIE_IMX) && !CONFIG_IS_ENABLED(DM_PCI)
imx_pcie_remove();
 #endif
 #if defined(CONFIG_SATA)
-- 
2.20.1

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


[U-Boot] [PATCH 2/5] pci: imx: Factor out hard-coded register base addresses

2019-05-17 Thread Marek Vasut
Pull out hard-coded register base addresses into driver private
structure in preparation for DM conversion. No functional change.

Signed-off-by: Marek Vasut 
Cc: Bin Meng 
Cc: Fabio Estevam 
Cc: Stefano Babic 
---
 drivers/pci/pcie_imx.c | 75 +-
 1 file changed, 44 insertions(+), 31 deletions(-)

diff --git a/drivers/pci/pcie_imx.c b/drivers/pci/pcie_imx.c
index fcc4ab7139..173636f48e 100644
--- a/drivers/pci/pcie_imx.c
+++ b/drivers/pci/pcie_imx.c
@@ -92,6 +92,18 @@
 #define PCIE_ATU_FUNC(x)   (((x) & 0x7) << 16)
 #define PCIE_ATU_UPPER_TARGET  0x91C
 
+struct imx_pcie_priv {
+   void __iomem*dbi_base;
+   void __iomem*cfg_base;
+};
+
+static struct imx_pcie_priv imx_pcie_priv = {
+   .dbi_base   = (void __iomem *)MX6_DBI_ADDR,
+   .cfg_base   = (void __iomem *)MX6_ROOT_ADDR,
+};
+
+static struct imx_pcie_priv *priv = &imx_pcie_priv;
+
 /*
  * PHY access functions
  */
@@ -231,7 +243,7 @@ static int imx6_pcie_link_up(void)
int rx_valid, temp;
 
/* link is debug bit 36, debug register 1 starts at bit 32 */
-   rc = readl(MX6_DBI_ADDR + PCIE_PHY_DEBUG_R1);
+   rc = readl(priv->dbi_base + PCIE_PHY_DEBUG_R1);
if ((rc & PCIE_PHY_DEBUG_R1_LINK_UP) &&
!(rc & PCIE_PHY_DEBUG_R1_LINK_IN_TRAINING))
return -EAGAIN;
@@ -243,8 +255,8 @@ static int imx6_pcie_link_up(void)
 * && (PHY/rx_valid==0) then pulse PHY/rx_reset. Transition
 * to gen2 is stuck
 */
-   pcie_phy_read((void *)MX6_DBI_ADDR, PCIE_PHY_RX_ASIC_OUT, &rx_valid);
-   ltssm = readl(MX6_DBI_ADDR + PCIE_PHY_DEBUG_R0) & 0x3F;
+   pcie_phy_read(priv->dbi_base, PCIE_PHY_RX_ASIC_OUT, &rx_valid);
+   ltssm = readl(priv->dbi_base + PCIE_PHY_DEBUG_R0) & 0x3F;
 
if (rx_valid & 0x01)
return 0;
@@ -254,15 +266,15 @@ static int imx6_pcie_link_up(void)
 
printf("transition to gen2 is stuck, reset PHY!\n");
 
-   pcie_phy_read((void *)MX6_DBI_ADDR, PHY_RX_OVRD_IN_LO, &temp);
+   pcie_phy_read(priv->dbi_base, PHY_RX_OVRD_IN_LO, &temp);
temp |= (PHY_RX_OVRD_IN_LO_RX_DATA_EN | PHY_RX_OVRD_IN_LO_RX_PLL_EN);
-   pcie_phy_write((void *)MX6_DBI_ADDR, PHY_RX_OVRD_IN_LO, temp);
+   pcie_phy_write(priv->dbi_base, PHY_RX_OVRD_IN_LO, temp);
 
udelay(3000);
 
-   pcie_phy_read((void *)MX6_DBI_ADDR, PHY_RX_OVRD_IN_LO, &temp);
+   pcie_phy_read(priv->dbi_base, PHY_RX_OVRD_IN_LO, &temp);
temp &= ~(PHY_RX_OVRD_IN_LO_RX_DATA_EN | PHY_RX_OVRD_IN_LO_RX_PLL_EN);
-   pcie_phy_write((void *)MX6_DBI_ADDR, PHY_RX_OVRD_IN_LO, temp);
+   pcie_phy_write(priv->dbi_base, PHY_RX_OVRD_IN_LO, temp);
 
return 0;
 }
@@ -285,24 +297,25 @@ static int imx_pcie_regions_setup(void)
 */
 
/* CMD reg:I/O space, MEM space, and Bus Master Enable */
-   setbits_le32(MX6_DBI_ADDR | PCI_COMMAND,
+   setbits_le32(priv->dbi_base + PCI_COMMAND,
 PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);
 
/* Set the CLASS_REV of RC CFG header to PCI_CLASS_BRIDGE_PCI */
-   setbits_le32(MX6_DBI_ADDR + PCI_CLASS_REVISION,
+   setbits_le32(priv->dbi_base + PCI_CLASS_REVISION,
 PCI_CLASS_BRIDGE_PCI << 16);
 
/* Region #0 is used for Outbound CFG space access. */
-   writel(0, MX6_DBI_ADDR + PCIE_ATU_VIEWPORT);
+   writel(0, priv->dbi_base + PCIE_ATU_VIEWPORT);
 
-   writel(MX6_ROOT_ADDR, MX6_DBI_ADDR + PCIE_ATU_LOWER_BASE);
-   writel(0, MX6_DBI_ADDR + PCIE_ATU_UPPER_BASE);
-   writel(MX6_ROOT_ADDR + MX6_ROOT_SIZE, MX6_DBI_ADDR + PCIE_ATU_LIMIT);
+   writel((u32)priv->cfg_base, priv->dbi_base + PCIE_ATU_LOWER_BASE);
+   writel(0, priv->dbi_base + PCIE_ATU_UPPER_BASE);
+   writel((u32)priv->cfg_base + MX6_ROOT_SIZE,
+  priv->dbi_base + PCIE_ATU_LIMIT);
 
-   writel(0, MX6_DBI_ADDR + PCIE_ATU_LOWER_TARGET);
-   writel(0, MX6_DBI_ADDR + PCIE_ATU_UPPER_TARGET);
-   writel(PCIE_ATU_TYPE_CFG0, MX6_DBI_ADDR + PCIE_ATU_CR1);
-   writel(PCIE_ATU_ENABLE, MX6_DBI_ADDR + PCIE_ATU_CR2);
+   writel(0, priv->dbi_base + PCIE_ATU_LOWER_TARGET);
+   writel(0, priv->dbi_base + PCIE_ATU_UPPER_TARGET);
+   writel(PCIE_ATU_TYPE_CFG0, priv->dbi_base + PCIE_ATU_CR1);
+   writel(PCIE_ATU_ENABLE, priv->dbi_base + PCIE_ATU_CR2);
 
return 0;
 }
@@ -315,18 +328,18 @@ static uint32_t get_bus_address(pci_dev_t d, int where)
uint32_t va_address;
 
/* Reconfigure Region #0 */
-   writel(0, MX6_DBI_ADDR + PCIE_ATU_VIEWPORT);
+   writel(0, priv->dbi_base + PCIE_ATU_VIEWPORT);
 
if (PCI_BUS(d) < 2)
-   writel(PCIE_ATU_TYPE_CFG0, MX6_DBI_ADDR + PCIE_ATU_CR1);
+   writel(PCIE_ATU_TYPE_CFG0, priv->dbi_base + PCIE_ATU_CR1);
else
-   writel(PCIE_ATU_TYPE_CFG1, MX6_DBI_ADDR + PCIE_ATU_CR1);
+   writel(PCIE_ATU_T

[U-Boot] [PATCH] video: Factor out vidconsole_put_string()

2019-05-17 Thread Marek Vasut
Pull the vidconsole_put_string() function from DM tests, make it
available to e.g. boards that want to display information on the
LCD on boot.

Signed-off-by: Marek Vasut 
Cc: Anatolij Gustschin 
---
 drivers/video/vidconsole-uclass.c | 17 +++--
 include/video_console.h   | 16 
 test/dm/video.c   |  8 
 3 files changed, 31 insertions(+), 10 deletions(-)

diff --git a/drivers/video/vidconsole-uclass.c 
b/drivers/video/vidconsole-uclass.c
index c31303b56e..af88588904 100644
--- a/drivers/video/vidconsole-uclass.c
+++ b/drivers/video/vidconsole-uclass.c
@@ -529,6 +529,20 @@ int vidconsole_put_char(struct udevice *dev, char ch)
return 0;
 }
 
+int vidconsole_put_string(struct udevice *dev, const char *str)
+{
+   const char *s;
+   int ret;
+
+   for (s = str; *s; s++) {
+   ret = vidconsole_put_char(dev, *s);
+   if (ret)
+   return ret;
+   }
+
+   return 0;
+}
+
 static void vidconsole_putc(struct stdio_dev *sdev, const char ch)
 {
struct udevice *dev = sdev->priv;
@@ -541,8 +555,7 @@ static void vidconsole_puts(struct stdio_dev *sdev, const 
char *s)
 {
struct udevice *dev = sdev->priv;
 
-   while (*s)
-   vidconsole_put_char(dev, *s++);
+   vidconsole_put_string(dev, s);
video_sync(dev->parent, false);
 }
 
diff --git a/include/video_console.h b/include/video_console.h
index 52a41ac200..0936ceaaf1 100644
--- a/include/video_console.h
+++ b/include/video_console.h
@@ -214,6 +214,22 @@ int vidconsole_set_row(struct udevice *dev, uint row, int 
clr);
  */
 int vidconsole_put_char(struct udevice *dev, char ch);
 
+/**
+ * vidconsole_put_string() - Output a string to the current console position
+ *
+ * Outputs a string to the console and advances the cursor. This function
+ * handles wrapping to new lines and scrolling the console. Special
+ * characters are handled also: \n, \r, \b and \t.
+ *
+ * The device always starts with the cursor at position 0,0 (top left). It
+ * can be adjusted manually using vidconsole_position_cursor().
+ *
+ * @dev:   Device to adjust
+ * @str:   String to write
+ * @return 0 if OK, -ve on error
+ */
+int vidconsole_put_string(struct udevice *dev, const char *str);
+
 /**
  * vidconsole_position_cursor() - Move the text cursor
  *
diff --git a/test/dm/video.c b/test/dm/video.c
index 6be5defc53..3151ebb73f 100644
--- a/test/dm/video.c
+++ b/test/dm/video.c
@@ -97,14 +97,6 @@ static int select_vidconsole(struct unit_test_state *uts, 
const char *drv_name)
return 0;
 }
 
-static void vidconsole_put_string(struct udevice *dev, const char *str)
-{
-   const char *s;
-
-   for (s = str; *s; s++)
-   vidconsole_put_char(dev, *s);
-}
-
 /* Test text output works on the video console */
 static int dm_test_video_text(struct unit_test_state *uts)
 {
-- 
2.20.1

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


Re: [U-Boot] [linux-sunxi] [PATCH 0/2] sunxi: A64: enable first USB port on Pine64 boards

2019-05-17 Thread Vasily Khoruzhick
On Wed, May 15, 2019 at 5:46 PM Andre Przywara  wrote:
>
> Since the beginning the upper USB port on Pine64 boards (Pine64+, SoPine
> baseboard, Pine64-LTS, Pinebook) was not working under U-Boot.
> This is due to the PHY for those pins being shared with the OTG
> controller, which we didn't even enable for those boards. Also the PHY
> code was always connecting the port pins to the OTG controller.
>
> These two patches fix this, so the upper USB port on said boards can
> be used within U-Boot. This allows to use an USB keyboard alongside
> an USB flash drive, for instance to install operating systems using
> UEFI.

Can you also add Pinebook here? It has the same issue.

> Cheers,
> Andre.
>
> Andre Przywara (2):
>   sunxi: USB PHY: Support shared PHY 0
>   sunxi: Pine64: DTS: enable USB PHY 0 for HCI0
>
>  arch/arm/dts/sun50i-a64-pine64.dts   | 5 -
>  arch/arm/dts/sun50i-a64-sopine-baseboard.dts | 5 -
>  drivers/phy/allwinner/phy-sun4i-usb.c| 8 +++-
>  3 files changed, 15 insertions(+), 3 deletions(-)
>
> --
> 2.14.5
>
> --
> You received this message because you are subscribed to the Google Groups 
> "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to linux-sunxi+unsubscr...@googlegroups.com.
> To view this discussion on the web, visit 
> https://groups.google.com/d/msgid/linux-sunxi/20190516004609.25304-1-andre.przywara%40arm.com.
> For more options, visit https://groups.google.com/d/optout.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 0/2] Add 'bcb' command to read/modify/write Android BCB

2019-05-17 Thread Eugeniu Rosca
On Fri, May 17, 2019 at 04:26:23PM +0100, Stephen Finucane wrote:
[..]
> http://patchwork.ozlabs.org/patch/1099264/
> 
> We're just waiting for ozlabs to apply that patch.
> 
> Stephen

Thanks!

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


Re: [U-Boot] [PATCH v2 0/2] Add 'bcb' command to read/modify/write Android BCB

2019-05-17 Thread Eugeniu Rosca
Hi All,

cc: Stephen, Jeremy

FWIW/jFYI, the patchwork frontend appears to mangle/skip spaces
in the patch subjects. Examples:
 - https://patchwork.ozlabs.org/cover/1101106/
 - https://patchwork.ozlabs.org/patch/1101108/
 - https://patchwork.ozlabs.org/patch/1101107/

The same patches look fine on https://marc.info:
 - https://marc.info/?l=u-boot&m=155810440206070&w=2
 - https://marc.info/?l=u-boot&m=155810448306089&w=2
 - https://marc.info/?l=u-boot&m=155810444306080&w=2

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


Re: [U-Boot] [PATCH 0/2] Add 'bcb' command to read/modify/write Android BCB

2019-05-17 Thread Eugeniu Rosca
Superseded by https://patchwork.ozlabs.org/cover/1101106/
("[PATCH v2 0/2] Add 'bcb' command to read/modify/write Android BCB")

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


Re: [U-Boot] [PATCH 1/1] toradex apalis/colibri: extend CONFIG_SYS_MALLOC_F_LEN

2019-05-17 Thread Marcel Ziswiler
On Fri, 2019-05-17 at 11:52 -0300, Fabio Estevam wrote:
> Hi Igor,
> 
> On Fri, May 17, 2019 at 11:49 AM Igor Opaniuk <
> igor.opan...@toradex.com> wrote:
> > Extend size of the malloc() pool for use before relocation, from
> > 0x400
> > (default one) to 0x2000 (CONFIG_SYS_MALLOC_F_LEN=0x2000),
> > as adding of DM_FLAG_PRE_RELOC flag to simple-bus driver introduced
> > a
> > regression on multiple boards, because of more intensive usage of
> > malloc()
> > pool and therefore a broken boot as the size of pool isn't
> > sufficient.
> > 
> > Fixes: 3a7c45f6a7 ("simple-bus: add DM_FLAG_PRE_RELOC flag to
> > simple-bus")
> > Signed-off-by: Igor Opaniuk 
> 
> I have already sent a fix for this issue:
> https://lists.denx.de/pipermail/u-boot/2019-May/367839.html

Ah, cool. But I believe on i.MX 8QM not even 0x2000 is/was enough but I
rather had/have to increase it to 0x4000 (which BTW: Peng had already
increased it to on i.MX 8QXP (;-p).

commit e5b8f7e665aa ("imx8qxp: mek: enable dm-spl for pm")

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


Re: [U-Boot] [PATCH 1/1] toradex apalis/colibri: extend CONFIG_SYS_MALLOC_F_LEN

2019-05-17 Thread Marcel Ziswiler
On Fri, 2019-05-17 at 11:52 -0300, Fabio Estevam wrote:
> Hi Igor,
> 
> On Fri, May 17, 2019 at 11:49 AM Igor Opaniuk <
> igor.opan...@toradex.com> wrote:
> > Extend size of the malloc() pool for use before relocation, from
> > 0x400
> > (default one) to 0x2000 (CONFIG_SYS_MALLOC_F_LEN=0x2000),
> > as adding of DM_FLAG_PRE_RELOC flag to simple-bus driver introduced
> > a
> > regression on multiple boards, because of more intensive usage of
> > malloc()
> > pool and therefore a broken boot as the size of pool isn't
> > sufficient.
> > 
> > Fixes: 3a7c45f6a7 ("simple-bus: add DM_FLAG_PRE_RELOC flag to
> > simple-bus")
> > Signed-off-by: Igor Opaniuk 
> 
> I have already sent a fix for this issue:
> https://lists.denx.de/pipermail/u-boot/2019-May/367839.html

And then BTW this also does not fix it should one already manually have
set a different but too small value ins his board configuration!

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


[U-Boot] [PATCH V2 5/8] ARM: imx: dh-imx6: Convert SD/MMC support to DM

2019-05-17 Thread Marek Vasut
Enable DM block and DM MMC support on DHCOM iMX6 PDK2.
Convert board code to match the DM support.

Signed-off-by: Marek Vasut 
Cc: Fabio Estevam 
Cc: Ludwig Zenz 
Cc: Stefano Babic 
---
V2: No change
---
 board/dhelectronics/dh_imx6/dh_imx6.c | 59 +--
 configs/dh_imx6_defconfig |  1 +
 2 files changed, 3 insertions(+), 57 deletions(-)

diff --git a/board/dhelectronics/dh_imx6/dh_imx6.c 
b/board/dhelectronics/dh_imx6/dh_imx6.c
index 44f4ef8130..193bb0eade 100644
--- a/board/dhelectronics/dh_imx6/dh_imx6.c
+++ b/board/dhelectronics/dh_imx6/dh_imx6.c
@@ -6,6 +6,8 @@
  */
 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -189,63 +191,6 @@ int board_eth_init(bd_t *bis)
 }
 #endif
 
-#ifdef CONFIG_FSL_ESDHC
-
-#define USDHC2_CD_GPIO IMX_GPIO_NR(6, 16)
-#define USDHC3_CD_GPIO IMX_GPIO_NR(7, 8)
-
-static struct fsl_esdhc_cfg usdhc_cfg[3] = {
-   { USDHC2_BASE_ADDR },
-   { USDHC3_BASE_ADDR },
-   { USDHC4_BASE_ADDR },
-};
-
-int board_mmc_getcd(struct mmc *mmc)
-{
-   struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
-
-   switch (cfg->esdhc_base) {
-   case USDHC2_BASE_ADDR:
-   return gpio_get_value(USDHC2_CD_GPIO);
-   case USDHC3_BASE_ADDR:
-   return !gpio_get_value(USDHC3_CD_GPIO);
-   case USDHC4_BASE_ADDR:
-   return 1; /* eMMC/uSDHC4 is always present */
-   }
-
-   return 0;
-}
-
-int board_mmc_init(bd_t *bis)
-{
-   int i, ret;
-
-   /*
-* According to the board_mmc_init() the following map is done:
-* (U-Boot device node)(Physical Port)
-* mmc0SD interface
-* mmc1micro SD
-* mmc2eMMC
-*/
-   gpio_request(USDHC2_CD_GPIO, "SD2-CD");
-   gpio_request(USDHC3_CD_GPIO, "SD3-CD");
-   gpio_direction_input(USDHC2_CD_GPIO);
-   gpio_direction_input(USDHC3_CD_GPIO);
-
-   usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
-   usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
-   usdhc_cfg[2].sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK);
-
-   for (i = 0; i < CONFIG_SYS_FSL_USDHC_NUM; i++) {
-   ret = fsl_esdhc_initialize(bis, &usdhc_cfg[i]);
-   if (ret)
-   return ret;
-   }
-
-   return 0;
-}
-#endif
-
 #ifdef CONFIG_USB_EHCI_MX6
 static void setup_usb(void)
 {
diff --git a/configs/dh_imx6_defconfig b/configs/dh_imx6_defconfig
index 9f6ebde777..839963290c 100644
--- a/configs/dh_imx6_defconfig
+++ b/configs/dh_imx6_defconfig
@@ -44,6 +44,7 @@ CONFIG_DWC_AHSATA=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_SYS_BOOTCOUNT_ADDR=0x0090
 CONFIG_DM_GPIO=y
+CONFIG_DM_MMC=y
 CONFIG_FSL_ESDHC=y
 CONFIG_SPI_FLASH=y
 CONFIG_SF_DEFAULT_MODE=0
-- 
2.20.1

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


[U-Boot] [PATCH V2 4/8] ARM: imx: dh-imx6: Enable DM GPIO

2019-05-17 Thread Marek Vasut
Enable DM GPIO support on DHCOM iMX6 PDK2 and fix up board code
where applicable.

Signed-off-by: Marek Vasut 
Cc: Fabio Estevam 
Cc: Ludwig Zenz 
Cc: Stefano Babic 
---
V2: No change
---
 board/dhelectronics/dh_imx6/dh_imx6.c | 10 ++
 configs/dh_imx6_defconfig |  1 +
 2 files changed, 11 insertions(+)

diff --git a/board/dhelectronics/dh_imx6/dh_imx6.c 
b/board/dhelectronics/dh_imx6/dh_imx6.c
index f9ac5c10e1..44f4ef8130 100644
--- a/board/dhelectronics/dh_imx6/dh_imx6.c
+++ b/board/dhelectronics/dh_imx6/dh_imx6.c
@@ -167,6 +167,9 @@ int board_eth_init(bd_t *bis)
struct mii_dev *bus = NULL;
struct phy_device *phydev = NULL;
 
+   gpio_request(IMX_GPIO_NR(5, 0), "PHY-reset");
+   gpio_request(IMX_GPIO_NR(1, 7), "VIO");
+
setup_fec_clock();
 
eth_phy_reset();
@@ -224,6 +227,8 @@ int board_mmc_init(bd_t *bis)
 * mmc1micro SD
 * mmc2eMMC
 */
+   gpio_request(USDHC2_CD_GPIO, "SD2-CD");
+   gpio_request(USDHC3_CD_GPIO, "SD3-CD");
gpio_direction_input(USDHC2_CD_GPIO);
gpio_direction_input(USDHC3_CD_GPIO);
 
@@ -244,6 +249,7 @@ int board_mmc_init(bd_t *bis)
 #ifdef CONFIG_USB_EHCI_MX6
 static void setup_usb(void)
 {
+   gpio_request(IMX_GPIO_NR(3, 31), "USB-VBUS");
/*
 * Set daisy chain for otg_pin_id on MX6Q.
 * For MX6DL, this bit is reserved.
@@ -379,6 +385,10 @@ static int board_get_hwcode(void)
 {
int hw_code;
 
+   gpio_request(HW_CODE_BIT_0, "HW-code-bit-0");
+   gpio_request(HW_CODE_BIT_1, "HW-code-bit-1");
+   gpio_request(HW_CODE_BIT_2, "HW-code-bit-2");
+
gpio_direction_input(HW_CODE_BIT_0);
gpio_direction_input(HW_CODE_BIT_1);
gpio_direction_input(HW_CODE_BIT_2);
diff --git a/configs/dh_imx6_defconfig b/configs/dh_imx6_defconfig
index e048fb2459..9f6ebde777 100644
--- a/configs/dh_imx6_defconfig
+++ b/configs/dh_imx6_defconfig
@@ -43,6 +43,7 @@ CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_DWC_AHSATA=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_SYS_BOOTCOUNT_ADDR=0x0090
+CONFIG_DM_GPIO=y
 CONFIG_FSL_ESDHC=y
 CONFIG_SPI_FLASH=y
 CONFIG_SF_DEFAULT_MODE=0
-- 
2.20.1

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


[U-Boot] [PATCH V2 2/8] ARM: dts: imx: dh-imx6: Fix SPI CS polarity on DHCOM iMX6 PDK2

2019-05-17 Thread Marek Vasut
The SPI nCS signal is active low, make it so.

Signed-off-by: Marek Vasut 
Cc: Fabio Estevam 
Cc: Ludwig Zenz 
Cc: Stefano Babic 
---
V2: No change
---
 arch/arm/dts/imx6q-dhcom-som.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/dts/imx6q-dhcom-som.dtsi 
b/arch/arm/dts/imx6q-dhcom-som.dtsi
index 387801dde0..524cd287c6 100644
--- a/arch/arm/dts/imx6q-dhcom-som.dtsi
+++ b/arch/arm/dts/imx6q-dhcom-som.dtsi
@@ -61,7 +61,7 @@
 };
 
 &ecspi1 {
-   cs-gpios = <&gpio2 30 GPIO_ACTIVE_HIGH>, <&gpio4 11 GPIO_ACTIVE_HIGH>;
+   cs-gpios = <&gpio2 30 GPIO_ACTIVE_LOW>, <&gpio4 11 GPIO_ACTIVE_LOW>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi1>;
status = "okay";
-- 
2.20.1

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


[U-Boot] [PATCH V2 8/8] ARM: imx: dh-imx6: Convert SPI support to DM

2019-05-17 Thread Marek Vasut
Enable DM SPI and SF support on DHCOM iMX6 PDK2.
Convert board code to match the DM support.

Signed-off-by: Marek Vasut 
Cc: Fabio Estevam 
Cc: Ludwig Zenz 
Cc: Stefano Babic 
---
V2: No change
---
 board/dhelectronics/dh_imx6/dh_imx6.c | 10 --
 configs/dh_imx6_defconfig |  4 
 include/configs/dh_imx6.h |  5 +
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/board/dhelectronics/dh_imx6/dh_imx6.c 
b/board/dhelectronics/dh_imx6/dh_imx6.c
index 737d9c6be3..50e3cb50a3 100644
--- a/board/dhelectronics/dh_imx6/dh_imx6.c
+++ b/board/dhelectronics/dh_imx6/dh_imx6.c
@@ -272,16 +272,6 @@ int board_early_init_f(void)
return 0;
 }
 
-#ifdef CONFIG_MXC_SPI
-int board_spi_cs_gpio(unsigned bus, unsigned cs)
-{
-   if (bus == 0 && cs == 0)
-   return IMX_GPIO_NR(2, 30);
-   else
-   return -1;
-}
-#endif
-
 int board_init(void)
 {
struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
diff --git a/configs/dh_imx6_defconfig b/configs/dh_imx6_defconfig
index 9418de10e7..f2bb87132a 100644
--- a/configs/dh_imx6_defconfig
+++ b/configs/dh_imx6_defconfig
@@ -47,13 +47,16 @@ CONFIG_SYS_BOOTCOUNT_ADDR=0x0090
 CONFIG_DM_GPIO=y
 CONFIG_DM_MMC=y
 CONFIG_FSL_ESDHC=y
+CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SF_DEFAULT_MODE=0
 CONFIG_SF_DEFAULT_SPEED=2500
+CONFIG_SPI_FLASH_SFDP_SUPPORT=y
 CONFIG_SPI_FLASH_GIGADEVICE=y
 CONFIG_SPI_FLASH_MACRONIX=y
 CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_WINBOND=y
+CONFIG_SPI_FLASH_MTD=y
 CONFIG_PHYLIB=y
 CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ90X1=y
@@ -63,6 +66,7 @@ CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX6=y
 CONFIG_DM_SCSI=y
 CONFIG_SPI=y
+CONFIG_DM_SPI=y
 CONFIG_MXC_SPI=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
diff --git a/include/configs/dh_imx6.h b/include/configs/dh_imx6.h
index e68467dda3..3b1d0a99a1 100644
--- a/include/configs/dh_imx6.h
+++ b/include/configs/dh_imx6.h
@@ -66,6 +66,11 @@
 #define CONFIG_LBA48
 
 /* SPI Flash Configs */
+#if defined(CONFIG_SPL_BUILD)
+#undef CONFIG_DM_SPI
+#undef CONFIG_DM_SPI_FLASH
+#undef CONFIG_SPI_FLASH_MTD
+#endif
 
 /* UART */
 #define CONFIG_MXC_UART
-- 
2.20.1

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


[U-Boot] [PATCH V2 1/8] ARM: dts: imx: dh-imx6: Import DHCOM iMX6 PDK2 DTs from Linux

2019-05-17 Thread Marek Vasut
Import DHCOM iMX6 PDK2 device tree from Linux 5.1.1 b724e9356404 .
Enable DT control in full U-Boot .

Signed-off-by: Marek Vasut 
Cc: Fabio Estevam 
Cc: Ludwig Zenz 
Cc: Stefano Babic 
---
V2: No change
---
 arch/arm/dts/Makefile |   3 +-
 arch/arm/dts/imx6q-dhcom-pdk2.dts | 151 ++
 arch/arm/dts/imx6q-dhcom-som.dtsi | 477 ++
 configs/dh_imx6_defconfig |   3 +-
 4 files changed, 632 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/dts/imx6q-dhcom-pdk2.dts
 create mode 100644 arch/arm/dts/imx6q-dhcom-som.dtsi

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 0ec7bc987d..98db403c7b 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -586,7 +586,8 @@ dtb-$(CONFIG_MX6ULL) += \
imx6ull-dart-6ul.dtb
 
 dtb-$(CONFIG_ARCH_MX6) += \
-   imx6-colibri.dtb
+   imx6-colibri.dtb \
+   imx6q-dhcom-pdk2.dtb
 
 dtb-$(CONFIG_MX7) += imx7d-sdb.dtb \
imx7d-sdb-qspi.dtb \
diff --git a/arch/arm/dts/imx6q-dhcom-pdk2.dts 
b/arch/arm/dts/imx6q-dhcom-pdk2.dts
new file mode 100644
index 00..9c61e3be2d
--- /dev/null
+++ b/arch/arm/dts/imx6q-dhcom-pdk2.dts
@@ -0,0 +1,151 @@
+// SPDX-License-Identifier: (GPL-2.0+)
+/*
+ * Copyright (C) 2015 DH electronics GmbH
+ * Copyright (C) 2018 Marek Vasut 
+ */
+
+/dts-v1/;
+
+#include "imx6q-dhcom-som.dtsi"
+
+/ {
+   model = "Freescale i.MX6 Quad DHCOM Premium Developer Kit (2)";
+   compatible = "dh,imx6q-dhcom-pdk2", "dh,imx6q-dhcom-som", "fsl,imx6q";
+
+   chosen {
+   stdout-path = &uart1;
+   };
+
+   clk_ext_audio_codec: clock-codec {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <2400>;
+   };
+
+   sound {
+   compatible = "fsl,imx-audio-sgtl5000";
+   model = "imx-sgtl5000";
+   ssi-controller = <&ssi1>;
+   audio-codec = <&sgtl5000>;
+   audio-routing =
+   "MIC_IN", "Mic Jack",
+   "Mic Jack", "Mic Bias",
+   "LINE_IN", "Line In Jack",
+   "Headphone Jack", "HP_OUT";
+   mux-int-port = <1>;
+   mux-ext-port = <3>;
+   };
+};
+
+&audmux {
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_audmux_ext>;
+   status = "okay";
+};
+
+&hdmi {
+   ddc-i2c-bus = <&i2c2>;
+   status = "okay";
+};
+
+&i2c2 {
+   sgtl5000: codec@a {
+   compatible = "fsl,sgtl5000";
+   reg = <0x0a>;
+   #sound-dai-cells = <0>;
+   clocks = <&clk_ext_audio_codec>;
+   VDDA-supply = <®_3p3v>;
+   VDDIO-supply = <®_3p3v>;
+   };
+};
+
+&iomuxc {
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_hog_base &pinctrl_hog>;
+
+   pinctrl_hog: hog-grp {
+   fsl,pins = <
+   MX6QDL_PAD_GPIO_2__GPIO1_IO02   0x400120b0
+   MX6QDL_PAD_GPIO_4__GPIO1_IO04   0x400120b0
+   MX6QDL_PAD_GPIO_5__GPIO1_IO05   0x400120b0
+   MX6QDL_PAD_CSI0_DAT17__GPIO6_IO03   0x400120b0
+   MX6QDL_PAD_GPIO_19__GPIO4_IO05  0x120b0
+   MX6QDL_PAD_DI0_PIN4__GPIO4_IO20 0x400120b0
+   MX6QDL_PAD_EIM_D27__GPIO3_IO27  0x120b0
+   MX6QDL_PAD_KEY_ROW0__GPIO4_IO07 0x120b0
+   MX6QDL_PAD_KEY_COL1__GPIO4_IO08 0x400120b0
+   MX6QDL_PAD_NANDF_CS1__GPIO6_IO140x400120b0
+   MX6QDL_PAD_NANDF_CS2__GPIO6_IO150x400120b0
+   MX6QDL_PAD_KEY_ROW1__GPIO4_IO09 0x400120b0
+   MX6QDL_PAD_SD3_DAT5__GPIO7_IO00 0x400120b0
+   MX6QDL_PAD_SD3_DAT4__GPIO7_IO01 0x400120b0
+   MX6QDL_PAD_CSI0_VSYNC__GPIO5_IO21   0x400120b0
+   MX6QDL_PAD_GPIO_18__GPIO7_IO13  0x400120b0
+   MX6QDL_PAD_SD1_CMD__GPIO1_IO18  0x400120b0
+   MX6QDL_PAD_SD1_DAT0__GPIO1_IO16 0x400120b0
+   MX6QDL_PAD_SD1_DAT1__GPIO1_IO17 0x400120b0
+   MX6QDL_PAD_SD1_DAT2__GPIO1_IO19 0x400120b0
+   MX6QDL_PAD_SD1_CLK__GPIO1_IO20  0x400120b0
+   MX6QDL_PAD_CSI0_PIXCLK__GPIO5_IO18  0x400120b0
+   MX6QDL_PAD_CSI0_MCLK__GPIO5_IO190x400120b0
+   MX6QDL_PAD_KEY_COL0__GPIO4_IO06 0x400120b0
+   >;
+   };
+
+   pinctrl_audmux_ext: audmux-ext-grp {
+   fsl,pins = <
+   MX6QDL_PAD_CSI0_DAT7__AUD3_RXD  0x130b0
+   MX6QDL_PAD_CSI0_DAT4__AUD3_TXC  0x130b0
+   

[U-Boot] [PATCH V2 7/8] ARM: imx: dh-imx6: Convert USB support to DM

2019-05-17 Thread Marek Vasut
Enable DM USB host support on DHCOM iMX6 PDK2.
Convert board code to match the DM support.

Signed-off-by: Marek Vasut 
Cc: Fabio Estevam 
Cc: Ludwig Zenz 
Cc: Stefano Babic 
---
V2: No change
---
 configs/dh_imx6_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/dh_imx6_defconfig b/configs/dh_imx6_defconfig
index dbb396a752..9418de10e7 100644
--- a/configs/dh_imx6_defconfig
+++ b/configs/dh_imx6_defconfig
@@ -65,6 +65,7 @@ CONFIG_DM_SCSI=y
 CONFIG_SPI=y
 CONFIG_MXC_SPI=y
 CONFIG_USB=y
+CONFIG_DM_USB=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_MANUFACTURER="dh"
 CONFIG_USB_GADGET_VENDOR_NUM=0x0525
-- 
2.20.1

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


[U-Boot] [PATCH V2 6/8] ARM: imx: dh-imx6: Convert SATA support to DM

2019-05-17 Thread Marek Vasut
Enable DM SATA support on DHCOM iMX6 PDK2.
Convert board code to match the DM support.

Signed-off-by: Marek Vasut 
Cc: Fabio Estevam 
Cc: Ludwig Zenz 
Cc: Stefano Babic 
---
V2: Drop the ad-hoc sata binding, this is superseded by
CONFIG_DWC_AHSATA_AHCI=y resp. drivers/ata/dwc_ahsata.c
---
 board/dhelectronics/dh_imx6/dh_imx6.c | 6 ++
 configs/dh_imx6_defconfig | 2 ++
 include/configs/dh_imx6.h | 5 -
 3 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/board/dhelectronics/dh_imx6/dh_imx6.c 
b/board/dhelectronics/dh_imx6/dh_imx6.c
index 193bb0eade..737d9c6be3 100644
--- a/board/dhelectronics/dh_imx6/dh_imx6.c
+++ b/board/dhelectronics/dh_imx6/dh_imx6.c
@@ -20,6 +20,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -302,10 +304,6 @@ int board_init(void)
}
 #endif
 
-#ifdef CONFIG_SATA
-   setup_sata();
-#endif
-
setup_dhcom_mac_from_fuse();
 
return 0;
diff --git a/configs/dh_imx6_defconfig b/configs/dh_imx6_defconfig
index 839963290c..dbb396a752 100644
--- a/configs/dh_imx6_defconfig
+++ b/configs/dh_imx6_defconfig
@@ -11,6 +11,7 @@ CONFIG_NR_DRAM_BANKS=1
 CONFIG_SPL=y
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
 CONFIG_SPL_SPI_SUPPORT=y
+CONFIG_AHCI=y
 CONFIG_DISTRO_DEFAULTS=y
 # CONFIG_SYS_MALLOC_F is not set
 CONFIG_FIT=y
@@ -60,6 +61,7 @@ CONFIG_FEC_MXC=y
 CONFIG_MII=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX6=y
+CONFIG_DM_SCSI=y
 CONFIG_SPI=y
 CONFIG_MXC_SPI=y
 CONFIG_USB=y
diff --git a/include/configs/dh_imx6.h b/include/configs/dh_imx6.h
index 3eee382a64..e68467dda3 100644
--- a/include/configs/dh_imx6.h
+++ b/include/configs/dh_imx6.h
@@ -63,12 +63,7 @@
 #define CONFIG_SYS_MMC_ENV_DEV 2 /* 1 = SDHC3, 2 = SDHC4 (eMMC) */
 
 /* SATA Configs */
-#ifdef CONFIG_CMD_SATA
-#define CONFIG_SYS_SATA_MAX_DEVICE 1
-#define CONFIG_DWC_AHSATA_PORT_ID  0
-#define CONFIG_DWC_AHSATA_BASE_ADDRSATA_ARB_BASE_ADDR
 #define CONFIG_LBA48
-#endif
 
 /* SPI Flash Configs */
 
-- 
2.20.1

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


[U-Boot] [PATCH V2 3/8] ARM: imx: dh-imx6: Enable DM pin control

2019-05-17 Thread Marek Vasut
Enable DM pin control support on DHCOM iMX6 PDK2.

Signed-off-by: Marek Vasut 
Cc: Fabio Estevam 
Cc: Ludwig Zenz 
Cc: Stefano Babic 
---
V2: No change
---
 configs/dh_imx6_defconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/configs/dh_imx6_defconfig b/configs/dh_imx6_defconfig
index 9aa08bfbcf..e048fb2459 100644
--- a/configs/dh_imx6_defconfig
+++ b/configs/dh_imx6_defconfig
@@ -12,6 +12,7 @@ CONFIG_SPL=y
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
 CONFIG_SPL_SPI_SUPPORT=y
 CONFIG_DISTRO_DEFAULTS=y
+# CONFIG_SYS_MALLOC_F is not set
 CONFIG_FIT=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg"
 CONFIG_BOOTDELAY=3
@@ -55,6 +56,8 @@ CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ90X1=y
 CONFIG_FEC_MXC=y
 CONFIG_MII=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_IMX6=y
 CONFIG_SPI=y
 CONFIG_MXC_SPI=y
 CONFIG_USB=y
-- 
2.20.1

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


Re: [U-Boot] [PATCH 1/2] mtd: mxs_nand_spl: fix nand_command protocol violation

2019-05-17 Thread Michael Nazzareno Trimarchi
Hi Stefano

On Fri, May 17, 2019 at 4:52 PM Stefano Babic  wrote:
>
> On 14/05/19 22:56, Andrea Scian - DAVE Embedded Systems wrote:
> >
> > Hi Michael,
> > On 14/05/19 20:44, Michael Nazzareno Trimarchi wrote:
> >> Hi all
> >>
> >> On Tue, Jan 29, 2019 at 3:40 PM Andrea Scian 
> >> wrote:
> >>>
> >>> mxs_nand_command() implementation assume that it's working with a
> >>> LP NAND, which is a common case nowadays and thus uses two bytes
> >>> for column address.
> >>>
> >>> However this is wrong for NAND_CMD_READID and NAND_CMD_PARAM, which
> >>> expects only one byte of column address, even for LP NANDs.
> >>> This leads to ONFI detection problem with some NAND manufacturer (like
> >>> Winbond) but not with others (like Samsung and Spansion)
> >>>
> >>> We fix this with a simple workaround to avoid the 2nd byte column
> >>> address
> >>> for those two commands.

We have partially tested on imx28 but we have other problem on it. I
will give test-by when
everything is working correctly

Michael

> >>>
> >>> Also align the code with nand_base to support 16 bit devices.
> >>>
> >>> Tested on an iMX6SX device with:
> >>> * Winbond W29N04GVSIAA
> >>> * Spansion S34ML04G100TF100
> >>> * Samsung K9F4G08U00
> >>>
> >>> Signed-off-by: Andrea Scian 
> >>> CC: Stefano Babic 
> >>
> >> Is this somenthing that is already addressed?
> >
> > AFAIK, this is still an open problem on current master
> > This patch has not been integrated and the code is the same as the one
> > that have the original issue
> >
>
> As far as I see on patchwork, patch was not assigned to any maintainer -
> I have now assigned to Scott (as NAND maintainer).
>
> Stefano
>
> > Andrea SCIAN
> >
> >
> > *DAVE Embedded Systems*
> >
> > via Talponedo 29/A 33080 Porcia (PN) - Italy
> > Telephone: +39.0434.921215
> > Telefax: +39.0434.1994030
> > web: www.dave.eu 
> >
> >
> >>
> >> Michael
> >>
> >>> ---
> >>>   drivers/mtd/nand/raw/mxs_nand_spl.c | 14 +-
> >>>   1 file changed, 13 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/drivers/mtd/nand/raw/mxs_nand_spl.c
> >>> b/drivers/mtd/nand/raw/mxs_nand_spl.c
> >>> index 2d7bbe83cc..ad3b7ade64 100644
> >>> --- a/drivers/mtd/nand/raw/mxs_nand_spl.c
> >>> +++ b/drivers/mtd/nand/raw/mxs_nand_spl.c
> >>> @@ -22,8 +22,20 @@ static void mxs_nand_command(struct mtd_info *mtd,
> >>> unsigned int command,
> >>>
> >>>  /* Serially input address */
> >>>  if (column != -1) {
> >>> +   /* Adjust columns for 16 bit buswidth */
> >>> +   if (chip->options & NAND_BUSWIDTH_16 &&
> >>> +   !nand_opcode_8bits(command))
> >>> +   column >>= 1;
> >>>  chip->cmd_ctrl(mtd, column, NAND_ALE);
> >>> -   chip->cmd_ctrl(mtd, column >> 8, NAND_ALE);
> >>> +
> >>> +   /*
> >>> +* Assume LP NAND here, so use two bytes column address
> >>> +* but not for CMD_READID and CMD_PARAM, which require
> >>> +* only one byte column address
> >>> +*/
> >>> +   if (command != NAND_CMD_READID &&
> >>> +   command != NAND_CMD_PARAM)
> >>> +   chip->cmd_ctrl(mtd, column >> 8, NAND_ALE);
> >>>  }
> >>>  if (page_addr != -1) {
> >>>  chip->cmd_ctrl(mtd, page_addr, NAND_ALE);
> >>> --
> >>> 2.19.2
> >>>
> >>> ___
> >>> U-Boot mailing list
> >>> U-Boot@lists.denx.de
> >>> https://lists.denx.de/listinfo/u-boot
> >>
> >>
> >>
>
>
> --
> =
> 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
> =



-- 
| Michael Nazzareno Trimarchi Amarula Solutions BV |
| COO  -  Founder  Cruquiuskade 47 |
| +31(0)851119172 Amsterdam 1018 AM NL |
|  [`as] http://www.amarulasolutions.com   |
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/1] toradex apalis/colibri: extend CONFIG_SYS_MALLOC_F_LEN

2019-05-17 Thread Fabio Estevam
Hi Igor,

On Fri, May 17, 2019 at 11:49 AM Igor Opaniuk  wrote:
>
> Extend size of the malloc() pool for use before relocation, from 0x400
> (default one) to 0x2000 (CONFIG_SYS_MALLOC_F_LEN=0x2000),
> as adding of DM_FLAG_PRE_RELOC flag to simple-bus driver introduced a
> regression on multiple boards, because of more intensive usage of malloc()
> pool and therefore a broken boot as the size of pool isn't sufficient.
>
> Fixes: 3a7c45f6a7 ("simple-bus: add DM_FLAG_PRE_RELOC flag to simple-bus")
> Signed-off-by: Igor Opaniuk 

I have already sent a fix for this issue:
https://lists.denx.de/pipermail/u-boot/2019-May/367839.html

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


Re: [U-Boot] [PATCH 1/1] toradex apalis/colibri: extend CONFIG_SYS_MALLOC_F_LEN

2019-05-17 Thread Bin Meng
On Fri, May 17, 2019 at 10:49 PM Igor Opaniuk  wrote:
>
> Extend size of the malloc() pool for use before relocation, from 0x400
> (default one) to 0x2000 (CONFIG_SYS_MALLOC_F_LEN=0x2000),
> as adding of DM_FLAG_PRE_RELOC flag to simple-bus driver introduced a
> regression on multiple boards, because of more intensive usage of malloc()
> pool and therefore a broken boot as the size of pool isn't sufficient.
>
> Fixes: 3a7c45f6a7 ("simple-bus: add DM_FLAG_PRE_RELOC flag to simple-bus")
> Signed-off-by: Igor Opaniuk 
> ---
>  configs/apalis-tk1_defconfig| 1 +
>  configs/apalis_imx6_defconfig   | 1 +
>  configs/apalis_t30_defconfig| 1 +
>  configs/colibri-imx6ull_defconfig   | 1 +
>  configs/colibri_imx6_defconfig  | 1 +
>  configs/colibri_imx7_defconfig  | 1 +
>  configs/colibri_imx7_emmc_defconfig | 1 +
>  configs/colibri_pxa270_defconfig| 1 +
>  configs/colibri_t20_defconfig   | 1 +
>  configs/colibri_t30_defconfig   | 1 +
>  configs/colibri_vf_defconfig| 2 +-
>  11 files changed, 11 insertions(+), 1 deletion(-)
>

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


Re: [U-Boot] [PATCH 1/2] mtd: mxs_nand_spl: fix nand_command protocol violation

2019-05-17 Thread Stefano Babic
On 14/05/19 22:56, Andrea Scian - DAVE Embedded Systems wrote:
> 
> Hi Michael,
> On 14/05/19 20:44, Michael Nazzareno Trimarchi wrote:
>> Hi all
>>
>> On Tue, Jan 29, 2019 at 3:40 PM Andrea Scian 
>> wrote:
>>>
>>> mxs_nand_command() implementation assume that it's working with a
>>> LP NAND, which is a common case nowadays and thus uses two bytes
>>> for column address.
>>>
>>> However this is wrong for NAND_CMD_READID and NAND_CMD_PARAM, which
>>> expects only one byte of column address, even for LP NANDs.
>>> This leads to ONFI detection problem with some NAND manufacturer (like
>>> Winbond) but not with others (like Samsung and Spansion)
>>>
>>> We fix this with a simple workaround to avoid the 2nd byte column
>>> address
>>> for those two commands.
>>>
>>> Also align the code with nand_base to support 16 bit devices.
>>>
>>> Tested on an iMX6SX device with:
>>> * Winbond W29N04GVSIAA
>>> * Spansion S34ML04G100TF100
>>> * Samsung K9F4G08U00
>>>
>>> Signed-off-by: Andrea Scian 
>>> CC: Stefano Babic 
>>
>> Is this somenthing that is already addressed?
> 
> AFAIK, this is still an open problem on current master
> This patch has not been integrated and the code is the same as the one
> that have the original issue
> 

As far as I see on patchwork, patch was not assigned to any maintainer -
I have now assigned to Scott (as NAND maintainer).

Stefano

> Andrea SCIAN
> 
> 
> *DAVE Embedded Systems*
> 
> via Talponedo 29/A 33080 Porcia (PN) - Italy
> Telephone: +39.0434.921215
> Telefax: +39.0434.1994030
> web: www.dave.eu 
> 
> 
>>
>> Michael
>>
>>> ---
>>>   drivers/mtd/nand/raw/mxs_nand_spl.c | 14 +-
>>>   1 file changed, 13 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/mtd/nand/raw/mxs_nand_spl.c
>>> b/drivers/mtd/nand/raw/mxs_nand_spl.c
>>> index 2d7bbe83cc..ad3b7ade64 100644
>>> --- a/drivers/mtd/nand/raw/mxs_nand_spl.c
>>> +++ b/drivers/mtd/nand/raw/mxs_nand_spl.c
>>> @@ -22,8 +22,20 @@ static void mxs_nand_command(struct mtd_info *mtd,
>>> unsigned int command,
>>>
>>>  /* Serially input address */
>>>  if (column != -1) {
>>> +   /* Adjust columns for 16 bit buswidth */
>>> +   if (chip->options & NAND_BUSWIDTH_16 &&
>>> +   !nand_opcode_8bits(command))
>>> +   column >>= 1;
>>>  chip->cmd_ctrl(mtd, column, NAND_ALE);
>>> -   chip->cmd_ctrl(mtd, column >> 8, NAND_ALE);
>>> +
>>> +   /*
>>> +    * Assume LP NAND here, so use two bytes column address
>>> +    * but not for CMD_READID and CMD_PARAM, which require
>>> +    * only one byte column address
>>> +    */
>>> +   if (command != NAND_CMD_READID &&
>>> +   command != NAND_CMD_PARAM)
>>> +   chip->cmd_ctrl(mtd, column >> 8, NAND_ALE);
>>>  }
>>>  if (page_addr != -1) {
>>>  chip->cmd_ctrl(mtd, page_addr, NAND_ALE);
>>> -- 
>>> 2.19.2
>>>
>>> ___
>>> U-Boot mailing list
>>> U-Boot@lists.denx.de
>>> https://lists.denx.de/listinfo/u-boot
>>
>>
>>


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


[U-Boot] [PATCH 1/1] toradex apalis/colibri: extend CONFIG_SYS_MALLOC_F_LEN

2019-05-17 Thread Igor Opaniuk
Extend size of the malloc() pool for use before relocation, from 0x400
(default one) to 0x2000 (CONFIG_SYS_MALLOC_F_LEN=0x2000),
as adding of DM_FLAG_PRE_RELOC flag to simple-bus driver introduced a
regression on multiple boards, because of more intensive usage of malloc()
pool and therefore a broken boot as the size of pool isn't sufficient.

Fixes: 3a7c45f6a7 ("simple-bus: add DM_FLAG_PRE_RELOC flag to simple-bus")
Signed-off-by: Igor Opaniuk 
---
 configs/apalis-tk1_defconfig| 1 +
 configs/apalis_imx6_defconfig   | 1 +
 configs/apalis_t30_defconfig| 1 +
 configs/colibri-imx6ull_defconfig   | 1 +
 configs/colibri_imx6_defconfig  | 1 +
 configs/colibri_imx7_defconfig  | 1 +
 configs/colibri_imx7_emmc_defconfig | 1 +
 configs/colibri_pxa270_defconfig| 1 +
 configs/colibri_t20_defconfig   | 1 +
 configs/colibri_t30_defconfig   | 1 +
 configs/colibri_vf_defconfig| 2 +-
 11 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/configs/apalis-tk1_defconfig b/configs/apalis-tk1_defconfig
index be9d55e7d4..946858e48e 100644
--- a/configs/apalis-tk1_defconfig
+++ b/configs/apalis-tk1_defconfig
@@ -1,6 +1,7 @@
 CONFIG_ARM=y
 CONFIG_TEGRA=y
 CONFIG_SYS_TEXT_BASE=0x8011
+CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_NR_DRAM_BANKS=2
 CONFIG_TEGRA124=y
 CONFIG_TARGET_APALIS_TK1=y
diff --git a/configs/apalis_imx6_defconfig b/configs/apalis_imx6_defconfig
index 3292d644aa..bcf7444311 100644
--- a/configs/apalis_imx6_defconfig
+++ b/configs/apalis_imx6_defconfig
@@ -1,6 +1,7 @@
 CONFIG_ARM=y
 CONFIG_ARCH_MX6=y
 CONFIG_SYS_TEXT_BASE=0x1780
+CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_SPL_GPIO_SUPPORT=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
diff --git a/configs/apalis_t30_defconfig b/configs/apalis_t30_defconfig
index 31a763536d..d231ccdb49 100644
--- a/configs/apalis_t30_defconfig
+++ b/configs/apalis_t30_defconfig
@@ -1,6 +1,7 @@
 CONFIG_ARM=y
 CONFIG_TEGRA=y
 CONFIG_SYS_TEXT_BASE=0x8011
+CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_NR_DRAM_BANKS=2
 CONFIG_TEGRA30=y
 CONFIG_TARGET_APALIS_T30=y
diff --git a/configs/colibri-imx6ull_defconfig 
b/configs/colibri-imx6ull_defconfig
index 3dbb4d95b6..133df9e723 100644
--- a/configs/colibri-imx6ull_defconfig
+++ b/configs/colibri-imx6ull_defconfig
@@ -2,6 +2,7 @@ CONFIG_ARM=y
 CONFIG_SYS_THUMB_BUILD=y
 CONFIG_ARCH_MX6=y
 CONFIG_SYS_TEXT_BASE=0x8780
+CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_TARGET_COLIBRI_IMX6ULL=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_DISTRO_DEFAULTS=y
diff --git a/configs/colibri_imx6_defconfig b/configs/colibri_imx6_defconfig
index ba17ec0030..b2f7739725 100644
--- a/configs/colibri_imx6_defconfig
+++ b/configs/colibri_imx6_defconfig
@@ -1,6 +1,7 @@
 CONFIG_ARM=y
 CONFIG_ARCH_MX6=y
 CONFIG_SYS_TEXT_BASE=0x1780
+CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_SPL_GPIO_SUPPORT=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
diff --git a/configs/colibri_imx7_defconfig b/configs/colibri_imx7_defconfig
index 58620ea68f..40f3b99f61 100644
--- a/configs/colibri_imx7_defconfig
+++ b/configs/colibri_imx7_defconfig
@@ -2,6 +2,7 @@ CONFIG_ARM=y
 CONFIG_SYS_THUMB_BUILD=y
 CONFIG_ARCH_MX7=y
 CONFIG_SYS_TEXT_BASE=0x8780
+CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_SECURE_BOOT=y
 CONFIG_TARGET_COLIBRI_IMX7=y
 CONFIG_NR_DRAM_BANKS=1
diff --git a/configs/colibri_imx7_emmc_defconfig 
b/configs/colibri_imx7_emmc_defconfig
index 0617b120a0..f35cabaed6 100644
--- a/configs/colibri_imx7_emmc_defconfig
+++ b/configs/colibri_imx7_emmc_defconfig
@@ -2,6 +2,7 @@ CONFIG_ARM=y
 CONFIG_SYS_THUMB_BUILD=y
 CONFIG_ARCH_MX7=y
 CONFIG_SYS_TEXT_BASE=0x8780
+CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_SECURE_BOOT=y
 CONFIG_TARGET_COLIBRI_IMX7=y
 CONFIG_TARGET_COLIBRI_IMX7_EMMC=y
diff --git a/configs/colibri_pxa270_defconfig b/configs/colibri_pxa270_defconfig
index 6cd948e159..b2beb32320 100644
--- a/configs/colibri_pxa270_defconfig
+++ b/configs/colibri_pxa270_defconfig
@@ -1,6 +1,7 @@
 CONFIG_ARM=y
 CONFIG_TARGET_COLIBRI_PXA270=y
 CONFIG_SYS_TEXT_BASE=0x0
+CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_ENV_VARS_UBOOT_CONFIG=y
 CONFIG_USE_BOOTARGS=y
diff --git a/configs/colibri_t20_defconfig b/configs/colibri_t20_defconfig
index 15fb9555f3..6b8a690ec3 100644
--- a/configs/colibri_t20_defconfig
+++ b/configs/colibri_t20_defconfig
@@ -1,6 +1,7 @@
 CONFIG_ARM=y
 CONFIG_TEGRA=y
 CONFIG_SYS_TEXT_BASE=0x0011
+CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_NR_DRAM_BANKS=2
 CONFIG_TEGRA20=y
 CONFIG_TARGET_COLIBRI_T20=y
diff --git a/configs/colibri_t30_defconfig b/configs/colibri_t30_defconfig
index 2d12fc10c4..99be27823d 100644
--- a/configs/colibri_t30_defconfig
+++ b/configs/colibri_t30_defconfig
@@ -1,6 +1,7 @@
 CONFIG_ARM=y
 CONFIG_TEGRA=y
 CONFIG_SYS_TEXT_BASE=0x8011
+CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_NR_DRAM_BANKS=2
 CONFIG_TEGRA30=y
 CONFIG_TARGET_COLIBRI_T30=y
diff --git a/configs/colibri_vf_defconfig b/configs/colibri_vf_defconfig
index d214a79d23..3a267bdbc6 100644
--- a/configs/colibri_vf_

Re: [U-Boot] U-Boot PXA support

2019-05-17 Thread Marcel Ziswiler
On Thu, 2019-05-16 at 13:49 -0400, Tom Rini wrote:
> On Thu, May 16, 2019 at 02:53:55PM +, Marcel Ziswiler wrote:
> > Hi Tom
> > 
> > On Mon, 2019-05-06 at 09:26 -0400, Tom Rini wrote:
> > > Hey folks,
> ...
> > > So, what should we do about this?  Is there still active interest
> > > in
> > > supporting the PXA platforms?  Thanks folks!
> > 
> > We are actually still shipping Colibri PXA270 modules for another
> > one
> > or two years I believe after which Marvell stops selling us chips.
> > 
> > The strange thing is that I build U-Boot master more or less daily
> > without any known issues currently using the regular gcc 8.2
> > 2019.01
> > tool chain from ARM.
> 
> Oh, that is interesting.  The failure that triggers this comes from
> https://cdn.kernel.org/pub/tools/crosstool/files/bin/x86_64/8.1.0/x86_64-gcc-8.1.0-nolibc-arm-linux-gnueabi.tar.xz
> 
> Can you point me at the gcc-8.2 toolchain you're talking about
> please?

Sure, sorry. I just use the GCC 8.2-2019.01 one from Arm [1] which even
Linaro now links to on their releases download server (e.g. gcc-8 link
on [2]). I also just now tested their very latest one GCC 8.3-2019.03
which works just fine as well. OK?

[1] 
https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads#panel2a
[2] https://releases.linaro.org/components/toolchain/binaries/

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


[U-Boot] [PATCH v2 1/2] include: android_bootloader_message.h: Minimize the diff to AOSP

2019-05-17 Thread Eugeniu Rosca
Perform the following updates:
 - Relocate the commit id from the file to the description of U-Boot
   commit. The AOSP commit is c784ce50e8c10eaf70e1f97e24e8324aef45faf5.
   This is done to avoid stale references in the file itself. The
   reasoning is in https://patchwork.ozlabs.org/patch/1098056/#2170209.
 - Minimize the diff to AOSP, to decrease the effort of the next AOSP
   backports. The background can be found in:
   https://patchwork.ozlabs.org/patch/1080394/#2168454.
 - Guard the static_assert() calls by #ifndef __UBOOT__ ... #endif,
   to avoid compilation failures of files including the header.

Signed-off-by: Eugeniu Rosca 
---
v2:
 - Newly pushed. No changes.
---
 include/android_bootloader_message.h | 126 +++
 1 file changed, 68 insertions(+), 58 deletions(-)

diff --git a/include/android_bootloader_message.h 
b/include/android_bootloader_message.h
index b84789f02227..286d7ab0f31e 100644
--- a/include/android_bootloader_message.h
+++ b/include/android_bootloader_message.h
@@ -2,7 +2,7 @@
  * This is from the Android Project,
  * Repository: https://android.googlesource.com/platform/bootable/recovery
  * File: bootloader_message/include/bootloader_message/bootloader_message.h
- * Commit: c784ce50e8c10eaf70e1f97e24e8324aef45faf5
+ * Commit: See U-Boot commit description
  *
  * Copyright (C) 2008 The Android Open Source Project
  *
@@ -12,18 +12,24 @@
 #ifndef __ANDROID_BOOTLOADER_MESSAGE_H
 #define __ANDROID_BOOTLOADER_MESSAGE_H
 
+#ifndef __UBOOT__
+#include 
+#include 
+#include 
+#else
 /* compiler.h defines the types that otherwise are included from stdint.h and
  * stddef.h
  */
 #include 
+#endif
 
-/* Spaces used by misc partition are as below:
- * 0   - 2K For bootloader_message
- * 2K  - 16KUsed by Vendor's bootloader (the 2K - 4K range may be 
optionally used
- *  as bootloader_message_ab struct)
- * 16K - 64KUsed by uncrypt and recovery to store wipe_package for A/B 
devices
- * Note that these offsets are admitted by bootloader,recovery and uncrypt, so 
they
- * are not configurable without changing all of them. */
+// Spaces used by misc partition are as below:
+// 0   - 2K For bootloader_message
+// 2K  - 16KUsed by Vendor's bootloader (the 2K - 4K range may be 
optionally used
+//  as bootloader_message_ab struct)
+// 16K - 64KUsed by uncrypt and recovery to store wipe_package for A/B 
devices
+// Note that these offsets are admitted by bootloader,recovery and uncrypt, so 
they
+// are not configurable without changing all of them.
 static const size_t BOOTLOADER_MESSAGE_OFFSET_IN_MISC = 0;
 static const size_t WIPE_PACKAGE_OFFSET_IN_MISC = 16 * 1024;
 
@@ -61,17 +67,17 @@ struct bootloader_message {
 char status[32];
 char recovery[768];
 
-/* The 'recovery' field used to be 1024 bytes.  It has only ever
- * been used to store the recovery command line, so 768 bytes
- * should be plenty.  We carve off the last 256 bytes to store the
- * stage string (for multistage packages) and possible future
- * expansion. */
+// The 'recovery' field used to be 1024 bytes.  It has only ever
+// been used to store the recovery command line, so 768 bytes
+// should be plenty.  We carve off the last 256 bytes to store the
+// stage string (for multistage packages) and possible future
+// expansion.
 char stage[32];
 
-/* The 'reserved' field used to be 224 bytes when it was initially
- * carved off from the 1024-byte recovery field. Bump it up to
- * 1184-byte so that the entire bootloader_message struct rounds up
- * to 2048-byte. */
+// The 'reserved' field used to be 224 bytes when it was initially
+// carved off from the 1024-byte recovery field. Bump it up to
+// 1184-byte so that the entire bootloader_message struct rounds up
+// to 2048-byte.
 char reserved[1184];
 };
 
@@ -79,10 +85,12 @@ struct bootloader_message {
  * We must be cautious when changing the bootloader_message struct size,
  * because A/B-specific fields may end up with different offsets.
  */
+#ifndef __UBOOT__
 #if (__STDC_VERSION__ >= 201112L) || defined(__cplusplus)
 static_assert(sizeof(struct bootloader_message) == 2048,
   "struct bootloader_message size changes, which may break A/B 
devices");
 #endif
+#endif /* __UBOOT__ */
 
 /**
  * The A/B-specific bootloader message structure (4-KiB).
@@ -108,7 +116,7 @@ struct bootloader_message_ab {
 char slot_suffix[32];
 char update_channel[128];
 
-/* Round up the entire struct to 4096-byte. */
+// Round up the entire struct to 4096-byte.
 char reserved[1888];
 };
 
@@ -116,26 +124,28 @@ struct bootloader_message_ab {
  * Be cautious about the struct size change, in case we put anything post
  * bootloader_message_ab struct (b/29159185).
  */
+#ifndef __UBOOT__
 #if (__STDC_VERSION__ >= 201112L) || defined(__cplusplus)
 static_assert(sizeof(struct bootloader_message_ab) == 4096,
 

[U-Boot] [PATCH v2 2/2] cmd: Add 'bcb' command to read/modify/write BCB fields

2019-05-17 Thread Eugeniu Rosca
'Bootloader Control Block' (BCB) is a well established term/acronym in
the Android namespace which refers to a location in a dedicated raw
(i.e. FS-unaware) flash (e.g. eMMC) partition, usually called "misc",
which is used as media for exchanging messages between Android userspace
(particularly recovery [1]) and an Android-capable bootloader.

On higher level, this allows implementing a subset of Android Bootloader
Requirements [2], amongst which is the Android-specific bootloader
flow [3]. Regardless how the latter is implemented in U-Boot ([3] being
the most memorable example), reading/writing/dumping the BCB fields in
the development process from inside the U-Boot is a convenient feature.
Hence, make it available to the users.

Some usage examples of the new command recorded on R-Car H3ULCB-KF
('>>>' is an overlay on top of the original console output):

=> bcb
bcb - Load/set/clear/test/dump/store Android BCB fields

Usage:
bcb load  - load  BCB from mmc :
bcb set  - set   BCB  to 
bcb clear []  - clear BCB  or all fields
bcb test - test  BCB  against 
bcb dump  - dump  BCB 
bcb store- store BCB back to mmc

Legend:
   - MMC device index containing the BCB partition
  - MMC partition index or name containing the BCB
 - one of {command,status,recovery,stage,reserved}
- the binary operator used in 'bcb test':
  '=' returns true if  matches the string stored in 
  '~' returns true if  matches a subset of 's string
   - string/text provided as input to bcb {set,test}
  NOTE: any ':' character in  will be replaced by line feed
  during 'bcb set' and used as separator by upper layers

=> bcb dump command
Error: BCB not loaded!
 >>> Users must specify mmc device and partition before any other call

=> bcb load 1 misc
=> bcb load 1 1
 >>> The two calls are equivalent (assuming "misc" has index 1)

=> bcb dump command
: 62 6f 6f 74 6f 6e 63 65 2d 73 68 65 6c 6c 00 72bootonce-shell.r
0010: 79 00 72 00 00 00 00 00 00 00 00 00 00 00 00 00y.r.
 >>> The output is in binary/string format for convenience
 >>> The output size matches the size of inspected BCB field
 >>> (32 bytes in case of 'command')

=> bcb test command = bootonce-shell && echo true
true
=> bcb test command = bootonce-shell- && echo true
=> bcb test command = bootonce-shel && echo true
 >>> The '=' operator returns 'true' on perfect match

=> bcb test command ~ bootonce-shel && echo true
true
=> bcb test command ~ bootonce-shell && echo true
true
 >>> The '~' operator returns 'true' on substring match

=> bcb set command recovery
=> bcb dump command
: 72 65 63 6f 76 65 72 79 00 73 68 65 6c 6c 00 72recovery.shell.r
0010: 79 00 72 00 00 00 00 00 00 00 00 00 00 00 00 00y.r.
 >>> The new value is NULL-terminated and stored in the BCB field

=> bcb set recovery "msg1:msg2:msg3"
=> bcb dump recovery
0040: 6d 73 67 31 0a 6d 73 67 32 0a 6d 73 67 33 00 00msg1.msg2.msg3..
0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 >>> --- snip ---
 >>> Every ':' is replaced by line-feed '\n' (0xA). The latter is used
 >>> as separator between individual commands by Android userspace

=> bcb store
 >>> Flush/store the BCB structure to MMC

[1] https://android.googlesource.com/platform/bootable/recovery
[2] https://source.android.com/devices/bootloader
[3] https://patchwork.ozlabs.org/patch/746835/
("[U-Boot,5/6] Initial support for the Android Bootloader flow")

Signed-off-by: Eugeniu Rosca 
---
v2:
 - [Heinrich Schuchardt] Implement sub-commands via U_BOOT_CMD_MKENT.
 - Polished the code. Ensured no warnings returned by sparse, smatch,
   `cppcheck --force --enable=all --inconclusive`, make W=1.
 - Tested on R-Car-H3-ES20 ULCB-KF.

v1:
 - https://patchwork.ozlabs.org/patch/1080395/
---
 cmd/Kconfig  |  17 +++
 cmd/Makefile |   1 +
 cmd/bcb.c| 330 +++
 3 files changed, 348 insertions(+)
 create mode 100644 cmd/bcb.c

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 0d36da2a5c43..495bc1052f50 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -631,6 +631,23 @@ config CMD_ADC
  Shows ADC device info and permit printing one-shot analog converted
  data from a named Analog to Digital Converter.
 
+config CMD_BCB
+   bool "bcb"
+   depends on MMC
+   depends on PARTITIONS
+   help
+ Read/modify/write the fields of Bootloader Control Block, usually
+ stored on the flash "misc" partition with its structure defined in:
+ https://android.googlesource.com/platform/bootable/recovery/+/master/
+ bootloader_message/include/bootloader_message/bootloader_message.h
+
+ Some real-life use-cases include (but are not limited to):
+ - Determine the "boot reason" (and act accordingly):
+   

[U-Boot] [PATCH v2 0/2] Add 'bcb' command to read/modify/write Android BCB

2019-05-17 Thread Eugeniu Rosca
The motivation behind the 'bcb' command is largely explained
in the second patch. The other patch performs polishing of
https://patchwork.ozlabs.org/patch/1099689/, which is a hard
prerequisite for this series.

v2:
 - [Heinrich Schuchardt] Implement sub-commands via U_BOOT_CMD_MKENT.
 - Polished the code. Ensured no warnings returned by sparse, smatch,
   `cppcheck --force --enable=all --inconclusive`, make W=1.
 - Tested on R-Car-H3-ES20 ULCB-KF.

v1:
 - https://patchwork.ozlabs.org/cover/1080393/

Eugeniu Rosca (2):
  include: android_bootloader_message.h: Minimize the diff to AOSP
  cmd: Add 'bcb' command to read/modify/write BCB fields

 cmd/Kconfig  |  17 ++
 cmd/Makefile |   1 +
 cmd/bcb.c| 330 +++
 include/android_bootloader_message.h | 126 +-
 4 files changed, 416 insertions(+), 58 deletions(-)
 create mode 100644 cmd/bcb.c

-- 
2.21.0

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


Re: [U-Boot] [EXT] Re: [PATCH v2] mtd: spi: Improve spi_nor_write_data() implementation

2019-05-17 Thread Vignesh Raghavendra
Hi Ashish,

> Hi Vignesh
> 

> Is this taken care now, plain text version was posted here
> http://patchwork.ozlabs.org/patch/1090121/
> 

A similar patch[1] was proposed in meantime which has been merged to
mainline U-Boot. So this issue must now be resolved. Let me know if the
issue still persists.


[1]
commit 60e2bf46784ebbd30ff29b3d3c7c97e56b11e86a
Author: Weijie Gao 
Date:   Fri Apr 26 17:22:19 2019 +0800

mtd: spi-nor: fix page program issue when using spi-mem driver



> Regards
> Ashish 
> 
>>
>>>
>>>   drivers/mtd/spi/spi-nor-core.c | 28 ++--
>>>   1 file changed, 10 insertions(+), 18 deletions(-)
>>>
>>> diff --git a/drivers/mtd/spi/spi-nor-core.c
>>> b/drivers/mtd/spi/spi-nor-core.c index c4e2f6a08f..8e754d445d 100644
>>> --- a/drivers/mtd/spi/spi-nor-core.c
>>> +++ b/drivers/mtd/spi/spi-nor-core.c
>>> @@ -116,7 +116,6 @@ static ssize_t spi_nor_write_data(struct spi_nor
>> *nor, loff_t to, size_t len,
>>>  SPI_MEM_OP_ADDR(nor->addr_width, to, 1),
>>>  SPI_MEM_OP_NO_DUMMY,
>>>  SPI_MEM_OP_DATA_OUT(len, buf, 1));
>>> - size_t remaining = len;
>>>   int ret;
>>>
>>>   /* get transfer protocols. */
>>> @@ -127,22 +126,19 @@ static ssize_t spi_nor_write_data(struct spi_nor
>> *nor, loff_t to, size_t len,
>>>   if (nor->program_opcode == SPINOR_OP_AAI_WP && nor-
>>> sst_write_second)
>>>   op.addr.nbytes = 0;
>>>
>>> - while (remaining) {
>>> - op.data.nbytes = remaining < UINT_MAX ? remaining : UINT_MAX;
>>> - ret = spi_mem_adjust_op_size(nor->spi, &op);
>>> - if (ret)
>>> - return ret;
>>> + op.data.nbytes = len < UINT_MAX ? len : UINT_MAX;
>>> + ret = spi_mem_adjust_op_size(nor->spi, &op);
>>> + if (ret)
>>> + return ret;
>>>
>>> - ret = spi_mem_exec_op(nor->spi, &op);
>>> - if (ret)
>>> - return ret;
>>> + ret = spi_mem_exec_op(nor->spi, &op);
>>> + if (ret)
>>> + return ret;
>>>
>>> - op.addr.val += op.data.nbytes;
>>> - remaining -= op.data.nbytes;
>>> - op.data.buf.out += op.data.nbytes;
>>> - }
>>> + op.addr.val += op.data.nbytes;
>>> + op.data.buf.out += op.data.nbytes;
>>>
>>> - return len;
>>> + return op.data.nbytes;
>>>   }
>>>
>>>   /*
>>> @@ -1101,10 +1097,6 @@ static int spi_nor_write(struct mtd_info *mtd,
>> loff_t to, size_t len,
>>>   goto write_err;
>>>   *retlen += written;
>>>   i += written;
>>> - if (written != page_remain) {
>>> - ret = -EIO;
>>> - goto write_err;
>>> - }
>>>   }
>>>
>>>   write_err:
>>>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] dm: arm: bcmstb: Enable driver model MMC support

2019-05-17 Thread Thomas Fitzsimmons
For bcm7445 and bcm7260, this patch enables CONFIG_DM_MMC and updates
the bcmstb SDHCI driver to use the new driver model.  This allows
removal of SDHCI configuration handling from bcmstb.c, and eliminates
a board removal compile warning.

Signed-off-by: Thomas Fitzsimmons 
---
 board/broadcom/bcmstb/bcmstb.c | 65 +-
 configs/bcm7260_defconfig  |  1 +
 configs/bcm7445_defconfig  |  1 +
 drivers/mmc/bcmstb_sdhci.c | 73 +-
 include/configs/bcm7260.h  |  1 -
 include/configs/bcm7445.h  |  1 -
 6 files changed, 58 insertions(+), 84 deletions(-)

diff --git a/board/broadcom/bcmstb/bcmstb.c b/board/broadcom/bcmstb/bcmstb.c
index 56328463ae..7f8e0f951d 100644
--- a/board/broadcom/bcmstb/bcmstb.c
+++ b/board/broadcom/bcmstb/bcmstb.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
  * (C) Copyright 2018  Cisco Systems, Inc.
+ * (C) Copyright 2019  Synamedia
  *
  * Author: Thomas Fitzsimmons 
  */
@@ -9,7 +10,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -80,69 +80,6 @@ void enable_caches(void)
 */
 }
 
-static const phys_addr_t bcmstb_sdhci_address(u32 alias_index)
-{
-   int node = 0;
-   int ret = 0;
-   char sdhci[16] = { 0 };
-   const void *fdt = gd->fdt_blob;
-   const char *path = NULL;
-   struct fdt_resource resource = { 0 };
-
-   if (!fdt) {
-   printf("%s: Invalid gd->fdt_blob\n", __func__);
-   return 0;
-   }
-
-   node = fdt_path_offset(fdt, "/aliases");
-   if (node < 0) {
-   printf("%s: Failed to find /aliases node\n", __func__);
-   return 0;
-   }
-
-   sprintf(sdhci, "sdhci%d", alias_index);
-   path = fdt_getprop(fdt, node, sdhci, NULL);
-   if (!path) {
-   printf("%s: Failed to find alias for %s\n", __func__, sdhci);
-   return 0;
-   }
-
-   node = fdt_path_offset(fdt, path);
-   if (node < 0) {
-   printf("%s: Failed to resolve BCMSTB SDHCI alias\n", __func__);
-   return 0;
-   }
-
-   ret = fdt_get_named_resource(fdt, node, "reg", "reg-names",
-"host", &resource);
-   if (ret) {
-   printf("%s: Failed to read BCMSTB SDHCI host resource\n",
-  __func__);
-   return 0;
-   }
-
-   return resource.start;
-}
-
-int board_mmc_init(bd_t *bis)
-{
-   phys_addr_t sdhci_base_address = 0;
-
-   sdhci_base_address = bcmstb_sdhci_address(CONFIG_BCMSTB_SDHCI_INDEX);
-
-   if (!sdhci_base_address) {
-   sdhci_base_address = BCMSTB_SDHCI_BASE;
-   printf("%s: Assuming BCMSTB SDHCI address: 0x%p\n",
-  __func__, (void *)sdhci_base_address);
-   }
-
-   debug("BCMSTB SDHCI base address: 0x%p\n", (void *)sdhci_base_address);
-
-   bcmstb_sdhci_init(sdhci_base_address);
-
-   return 0;
-}
-
 int timer_init(void)
 {
gd->arch.timer_rate_hz = readl(BCMSTB_TIMER_FREQUENCY);
diff --git a/configs/bcm7260_defconfig b/configs/bcm7260_defconfig
index 263694c58f..6e0266be45 100644
--- a/configs/bcm7260_defconfig
+++ b/configs/bcm7260_defconfig
@@ -11,6 +11,7 @@ CONFIG_SYS_PROMPT="U-Boot>"
 CONFIG_EFI_PARTITION=y
 CONFIG_OF_PRIOR_STAGE=y
 CONFIG_ENV_IS_IN_MMC=y
+CONFIG_DM_MMC=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_BCMSTB=y
 # CONFIG_EFI_LOADER is not set
diff --git a/configs/bcm7445_defconfig b/configs/bcm7445_defconfig
index 97098bf7e2..f22b06e9ce 100644
--- a/configs/bcm7445_defconfig
+++ b/configs/bcm7445_defconfig
@@ -13,6 +13,7 @@ CONFIG_CMD_SF_TEST=y
 CONFIG_CMD_SPI=y
 CONFIG_OF_PRIOR_STAGE=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
+CONFIG_DM_MMC=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_BCMSTB=y
 CONFIG_DM_SPI_FLASH=y
diff --git a/drivers/mmc/bcmstb_sdhci.c b/drivers/mmc/bcmstb_sdhci.c
index 443ae8d481..eef46f3af1 100644
--- a/drivers/mmc/bcmstb_sdhci.c
+++ b/drivers/mmc/bcmstb_sdhci.c
@@ -1,11 +1,13 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
  * (C) Copyright 2018  Cisco Systems, Inc.
+ * (C) Copyright 2019  Synamedia
  *
  * Author: Thomas Fitzsimmons 
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -36,32 +38,67 @@
  */
 #define BCMSTB_SDHCI_MINIMUM_CLOCK_FREQUENCY   40
 
-static char *BCMSTB_SDHCI_NAME = "bcmstb-sdhci";
-
 /*
  * This driver has only been tested with eMMC devices; SD devices may
  * not work.
  */
-int bcmstb_sdhci_init(phys_addr_t regbase)
+struct sdhci_bcmstb_plat {
+   struct mmc_config cfg;
+   struct mmc mmc;
+};
+
+static int sdhci_bcmstb_bind(struct udevice *dev)
+{
+   struct sdhci_bcmstb_plat *plat = dev_get_platdata(dev);
+
+   return sdhci_bind(dev, &plat->mmc, &plat->cfg);
+}
+
+static int sdhci_bcmstb_probe(struct udevice *dev)
 {
-   struct sdhci_host *host = NULL;
+   struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
+   struct sdhci_bcmstb_plat *plat = d

Re: [U-Boot] [PATCH] dm: arm: bcmstb: Enable driver model MMC support

2019-05-17 Thread Stefan Roese

On 17.05.19 14:17, Thomas Fitzsimmons wrote:

For bcm7445 and bcm7260, this patch enables CONFIG_DM_MMC and updates
the bcmstb SDHCI driver to use the new driver model.  This allows
removal of SDHCI configuration handling from bcmstb.c, and eliminates
a board removal compile warning.

Signed-off-by: Thomas Fitzsimmons 
---
  board/broadcom/bcmstb/bcmstb.c | 65 +-
  configs/bcm7260_defconfig  |  1 +
  configs/bcm7445_defconfig  |  1 +
  drivers/mmc/bcmstb_sdhci.c | 73 +-
  include/configs/bcm7260.h  |  1 -
  include/configs/bcm7445.h  |  1 -
  6 files changed, 58 insertions(+), 84 deletions(-)


Nice cleanup. ;)

Reviewed-by: Stefan Roese 

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


[U-Boot] [PATCH v2 6/6] configs: stm32mp15: Enable Ethernet feature

2019-05-17 Thread Christophe Roullier
This allows to enable Ethernet and use driver for
Synopsys Ethernet QoS device

Signed-off-by: Christophe Roullier 
---

Changes in v2:
-remark from Joe Hershberger to replace "int interface" with "phy_interface_t 
interface"
 and manage return values "-1", "0" with PHY_INTERFACE_MODE_NONE and 
PHY_INTERFACE_MODE_MII

 configs/stm32mp15_basic_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/stm32mp15_basic_defconfig 
b/configs/stm32mp15_basic_defconfig
index 0ea9dff43de..7456cc9a163 100644
--- a/configs/stm32mp15_basic_defconfig
+++ b/configs/stm32mp15_basic_defconfig
@@ -55,6 +55,8 @@ CONFIG_LED_GPIO=y
 CONFIG_DM_MMC=y
 CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_STM32_SDMMC2=y
+CONFIG_DM_ETH=y
+CONFIG_DWC_ETH_QOS=y
 CONFIG_PHY=y
 CONFIG_PHY_STM32_USBPHYC=y
 CONFIG_PINCONF=y
-- 
2.17.1

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


[U-Boot] [PATCH v2 5/6] stm32mp1: Add Ethernet support for stm32mp1 board

2019-05-17 Thread Christophe Roullier
Add default SERVERIP address
Enable noncached memory region required by ethernet driver
Add PXE support

Signed-off-by: Christophe Roullier 
---

Changes in v2: None

 include/configs/stm32mp1.h | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/include/configs/stm32mp1.h b/include/configs/stm32mp1.h
index fd6c97a0c61..cc14f6169b9 100644
--- a/include/configs/stm32mp1.h
+++ b/include/configs/stm32mp1.h
@@ -78,6 +78,14 @@
 /*MMC SD*/
 #define CONFIG_SYS_MMC_MAX_DEVICE  3
 
+/* Ethernet need */
+#ifdef CONFIG_DWC_ETH_QOS
+#define CONFIG_SYS_NONCACHED_MEMORY(1 * SZ_1M) /* 1M */
+#define CONFIG_SERVERIP 192.168.1.1
+#define CONFIG_BOOTP_SERVERIP
+#define CONFIG_SYS_AUTOLOAD"no"
+#endif
+
 /*/
 #ifdef CONFIG_DISTRO_DEFAULTS
 /*/
@@ -87,7 +95,9 @@
 #define BOOT_TARGET_DEVICES(func) \
func(MMC, mmc, 1) \
func(MMC, mmc, 0) \
-   func(MMC, mmc, 2)
+   func(MMC, mmc, 2) \
+   func(PXE, pxe, na)
+
 /*
  * bootcmd for stm32mp1:
  * for serial/usb: execute the stm32prog command
-- 
2.17.1

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


Re: [U-Boot] [PATCH v4 12/13] clk: Port Linux common clock framework [CCF] for imx6q to U-boot (tag: 5.0-rc3)

2019-05-17 Thread Lukasz Majewski
On Fri, 17 May 2019 07:31:38 -0500
Adam Ford  wrote:

> On Thu, May 16, 2019 at 9:48 PM Bin Meng  wrote:
> >
> > Hi Lukasz,
> >
> > On Fri, May 17, 2019 at 6:16 AM Lukasz Majewski 
> > wrote:  
> > >
> > > This commit brings the files from Linux kernel to provide clocks
> > > support as it is used on the Linux kernel with common clock
> > > framework [CCF] setup. 
> 
> 
> Two issues / questions:
> 
> 1)  I tried to test this on the imx6q_logic board, and I enabled
> CLK_IMX6Q in the menu config, but when I save the defconfig, it
> appears there are unmet dependencies.
> 
> WARNING: unmet direct dependencies detected for SPL_CLK_CCF
>   Depends on [n]: SPL_CLK [=n]
>   Selected by [y]:
>   - CLK_IMX6Q [=y] && ARCH_MX6 [=y]
> 
> WARNING: unmet direct dependencies detected for SPL_CLK_CCF
>   Depends on [n]: SPL_CLK [=n]
>   Selected by [y]:
>   - CLK_IMX6Q [=y] && ARCH_MX6 [=y]
> 
> you may want to consider implying the correct functions if ARCH_MX6 &&
> CLK_IMX6Q or select the proper SPL_CLK info.  My board doesn't do DM
> in SPL right now, but I assume the CLK driver you ported is using DM.

Ok. I will look into the Kconfig options.

> 
> 2)  I didn't attempt to load the SPL portion, but when I loaded the
> u-boot-dtb.img file, it didn't appear to boot.
> 
> 
> U-Boot SPL 2019.01 (May 13 2019 - 16:57:41 -0500)
> Trying to boot from MMC1
> spl_load_image_fat_os: error reading image args, err - -2
> 
> 
> (hang)
> 
> Other than enabling CLK_IMX6Q, are there other items I need to enable?
>  My board has OF_CONTROL in U-Boot with DM support working in the
> U-Boot portion.
> 

The CCF shall work also with a setup where it is enabled only in u-boot
proper (CONFIG_CLK_CCF).

Please look into following TPC DM/DTS port as a reference:
https://github.com/lmajewski/u-boot-dfu/commits/DM-SPL-TPC70

This board is fully converted and uses DM/DTS in SPL and u-boot proper
(with CCF).

> adam
> > > The directory structure has been preserved. The ported code only
> > > supports reading information from PLL, MUX, Divider, etc and
> > > enabling/disabling the clocks USDHCx/ECSPIx depending on used
> > > bus. Moreover, it is agnostic to the alias numbering as the
> > > information about the clock is read from device tree.
> > >
> > > One needs to pay attention to the comments indicating necessary
> > > for U-boot's  
> >
> > nits: it's U-Boot. Please fix this globally in the commit message,
> > as well as in the code comments in this commit.
> >  
> > > DM changes.
> > >
> > > If needed the code can be extended to support the "set" part of
> > > the clock management.
> > >
> > >
> > > Signed-off-by: Lukasz Majewski 
> > > ---
> > >
> > > Changes in v4:
> > > - Port some more Linux code to facilitate imx8 code porting (most
> > > notably flags)
> > > - Explicitly use container_of() based macro to provide struct clk
> > > in various places (e.g. gate2, mux, etc)
> > >   Following patches has been squashed:
> > >   http://patchwork.ozlabs.org/patch/1093141/
> > >   http://patchwork.ozlabs.org/patch/1093142/
> > >   http://patchwork.ozlabs.org/patch/1093146/
> > >
> > > Changes in v3: None
> > >
> > >  drivers/clk/Kconfig|  14 
> > >  drivers/clk/Makefile   |   2 +
> > >  drivers/clk/clk-divider.c  | 148
> > > ++ drivers/clk/clk-fixed-factor.c
> > > |  87  drivers/clk/clk-mux.c  | 164
> > > +
> > > drivers/clk/clk.c  |  56 +
> > > drivers/clk/imx/Kconfig|   9 +++
> > > drivers/clk/imx/Makefile   |   2 +
> > > drivers/clk/imx/clk-gate2.c| 113 ++
> > > drivers/clk/imx/clk-imx6q.c| 179
> > > +
> > > drivers/clk/imx/clk-pfd.c  |  91 +
> > > drivers/clk/imx/clk-pllv3.c|  83 +++
> > > drivers/clk/imx/clk.h  |  75 +
> > > include/linux/clk-provider.h   | 115 ++
> > > 14 files changed, 1138 insertions(+) create mode 100644
> > > drivers/clk/clk-divider.c create mode 100644
> > > drivers/clk/clk-fixed-factor.c create mode 100644
> > > drivers/clk/clk-mux.c create mode 100644 drivers/clk/clk.c create
> > > mode 100644 drivers/clk/imx/clk-gate2.c create mode 100644
> > > drivers/clk/imx/clk-imx6q.c create mode 100644
> > > drivers/clk/imx/clk-pfd.c create mode 100644
> > > drivers/clk/imx/clk-pllv3.c create mode 100644
> > > drivers/clk/imx/clk.h create mode 100644
> > > include/linux/clk-provider.h 
> >
> > Regards,
> > Bin  




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


pgpYWX7eY6Qfo.pgp
Description: OpenPGP digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
ht

[U-Boot] [PATCH v2 0/6] - Add Ethernet support for stm32mpu

2019-05-17 Thread Christophe Roullier
   Support all PHY config:
 PHY_MODE (MII,GMII, RMII, RGMII)
 Phy wo crystal (25Mhz and 50 Mhz), No 125Mhz from PHY config

Changes in v2:
-remark from Joe Hershberger to replace "int interface" with "phy_interface_t 
interface"
 and manage return values "-1", "0" with PHY_INTERFACE_MODE_NONE and 
PHY_INTERFACE_MODE_MII

Christophe Roullier (5):
  board: stm32mp1: Add board_interface_eth_init
  net: dwc_eth_qos: add Ethernet stm32mp1 support
  ARM: dts: stm32: Add Ethernet support on stm32mp1
  stm32mp1: Add Ethernet support for stm32mp1 board
  configs: stm32mp15: Enable Ethernet feature

Patrick Delaunay (1):
  stm32mp1: clk: use the correct identifier for ethck

 arch/arm/dts/stm32mp157-pinctrl.dtsi |   9 +-
 arch/arm/dts/stm32mp157c-ev1.dts |   2 +-
 arch/arm/dts/stm32mp157c.dtsi|  16 +-
 board/st/stm32mp1/stm32mp1.c |  68 -
 configs/stm32mp15_basic_defconfig|   2 +
 drivers/clk/clk_stm32mp1.c   |   2 +-
 drivers/net/dwc_eth_qos.c| 435 +++
 include/configs/stm32mp1.h   |  12 +-
 8 files changed, 480 insertions(+), 66 deletions(-)

-- 
2.17.1

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


[U-Boot] [PATCH v2 4/6] ARM: dts: stm32: Add Ethernet support on stm32mp1

2019-05-17 Thread Christophe Roullier
This patch add Ethernet support on stm32mp157 eval board

Signed-off-by: Christophe Roullier 
---

Changes in v2: None

 arch/arm/dts/stm32mp157-pinctrl.dtsi |  9 +++--
 arch/arm/dts/stm32mp157c-ev1.dts |  2 +-
 arch/arm/dts/stm32mp157c.dtsi| 16 ++--
 3 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/arch/arm/dts/stm32mp157-pinctrl.dtsi 
b/arch/arm/dts/stm32mp157-pinctrl.dtsi
index 0aae69b0a04..1962267033d 100644
--- a/arch/arm/dts/stm32mp157-pinctrl.dtsi
+++ b/arch/arm/dts/stm32mp157-pinctrl.dtsi
@@ -173,13 +173,18 @@
 , 
/* ETH_RGMII_TXD2 */
 , 
/* ETH_RGMII_TXD3 */
 , 
/* ETH_RGMII_TX_CTL */
-, 
/* ETH_MDIO */
 ; 
/* ETH_MDC */
bias-disable;
drive-push-pull;
-   slew-rate = <3>;
+   slew-rate = <2>;
};
pins2 {
+   pinmux = ; 
/* ETH_MDIO */
+   bias-disable;
+   drive-push-pull;
+   slew-rate = <0>;
+   };
+   pins3 {
pinmux = , 
/* ETH_RGMII_RXD0 */
 , 
/* ETH_RGMII_RXD1 */
 , 
/* ETH_RGMII_RXD2 */
diff --git a/arch/arm/dts/stm32mp157c-ev1.dts b/arch/arm/dts/stm32mp157c-ev1.dts
index a6ee37924fe..d2232004410 100644
--- a/arch/arm/dts/stm32mp157c-ev1.dts
+++ b/arch/arm/dts/stm32mp157c-ev1.dts
@@ -78,7 +78,7 @@
pinctrl-0 = <ðernet0_rgmii_pins_a>;
pinctrl-1 = <ðernet0_rgmii_pins_sleep_a>;
pinctrl-names = "default", "sleep";
-   phy-mode = "rgmii";
+   phy-mode = "rgmii-id";
max-speed = <1000>;
phy-handle = <&phy0>;
 
diff --git a/arch/arm/dts/stm32mp157c.dtsi b/arch/arm/dts/stm32mp157c.dtsi
index 94634336a5e..82177b50afe 100644
--- a/arch/arm/dts/stm32mp157c.dtsi
+++ b/arch/arm/dts/stm32mp157c.dtsi
@@ -1087,21 +1087,25 @@
compatible = "st,stm32mp1-dwmac", "snps,dwmac-4.20a";
reg = <0x5800a000 0x2000>;
reg-names = "stmmaceth";
-   interrupts-extended = <&intc GIC_SPI 61 
IRQ_TYPE_LEVEL_HIGH>;
-   interrupt-names = "macirq";
+   interrupts-extended =
+   <&intc GIC_SPI 61 IRQ_TYPE_LEVEL_HIGH>,
+   <&intc GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>,
+   <&exti 70 1>;
+   interrupt-names = "macirq",
+ "eth_wake_irq",
+ "stm32_pwr_wakeup";
clock-names = "stmmaceth",
  "mac-clk-tx",
  "mac-clk-rx",
- "ethstp",
- "syscfg-clk";
+ "ethstp";
clocks = <&rcc ETHMAC>,
 <&rcc ETHTX>,
 <&rcc ETHRX>,
-<&rcc ETHSTP>,
-<&rcc SYSCFG>;
+<&rcc ETHSTP>;
st,syscon = <&syscfg 0x4>;
snps,mixed-burst;
snps,pbl = <2>;
+   snps,en-tx-lpi-clockgating;
snps,axi-config = <&stmmac_axi_config_0>;
snps,tso;
status = "disabled";
-- 
2.17.1

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


[U-Boot] [PATCH v2 2/6] board: stm32mp1: Add board_interface_eth_init

2019-05-17 Thread Christophe Roullier
Called to configure Ethernet PHY interface selection and
configure clock selection in RCC Ethernet clock tree.

Signed-off-by: Christophe Roullier 
---

Changes in v2: None

 board/st/stm32mp1/stm32mp1.c | 68 ++--
 1 file changed, 65 insertions(+), 3 deletions(-)

diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
index 76917b022ed..e120fc57223 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -51,9 +51,9 @@
 #define SYSCFG_PMCSETR_ETH_SELMII  BIT(20)
 
 #define SYSCFG_PMCSETR_ETH_SEL_MASKGENMASK(23, 21)
-#define SYSCFG_PMCSETR_ETH_SEL_GMII_MII(0 << 21)
-#define SYSCFG_PMCSETR_ETH_SEL_RGMII   (1 << 21)
-#define SYSCFG_PMCSETR_ETH_SEL_RMII(4 << 21)
+#define SYSCFG_PMCSETR_ETH_SEL_GMII_MII0
+#define SYSCFG_PMCSETR_ETH_SEL_RGMII   BIT(21)
+#define SYSCFG_PMCSETR_ETH_SEL_RMIIBIT(23)
 
 /*
  * Get a global data pointer
@@ -504,3 +504,65 @@ void board_quiesce_devices(void)
 {
setup_led(LEDST_OFF);
 }
+
+/* board interface eth init */
+/* this is a weak define that we are overriding */
+int board_interface_eth_init(phy_interface_t interface_type,
+bool eth_clk_sel_reg, bool eth_ref_clk_sel_reg)
+{
+   u8 *syscfg;
+   u32 value;
+
+   syscfg = (u8 *)syscon_get_first_range(STM32MP_SYSCON_SYSCFG);
+
+   if (!syscfg)
+   return -ENODEV;
+
+   switch (interface_type) {
+   case PHY_INTERFACE_MODE_MII:
+   value = SYSCFG_PMCSETR_ETH_SEL_GMII_MII |
+   SYSCFG_PMCSETR_ETH_REF_CLK_SEL;
+   debug("%s: PHY_INTERFACE_MODE_MII\n", __func__);
+   break;
+   case PHY_INTERFACE_MODE_GMII:
+   if (eth_clk_sel_reg)
+   value = SYSCFG_PMCSETR_ETH_SEL_GMII_MII |
+   SYSCFG_PMCSETR_ETH_CLK_SEL;
+   else
+   value = SYSCFG_PMCSETR_ETH_SEL_GMII_MII;
+   debug("%s: PHY_INTERFACE_MODE_GMII\n", __func__);
+   break;
+   case PHY_INTERFACE_MODE_RMII:
+   if (eth_ref_clk_sel_reg)
+   value = SYSCFG_PMCSETR_ETH_SEL_RMII |
+   SYSCFG_PMCSETR_ETH_REF_CLK_SEL;
+   else
+   value = SYSCFG_PMCSETR_ETH_SEL_RMII;
+   debug("%s: PHY_INTERFACE_MODE_RMII\n", __func__);
+   break;
+   case PHY_INTERFACE_MODE_RGMII:
+   case PHY_INTERFACE_MODE_RGMII_ID:
+   case PHY_INTERFACE_MODE_RGMII_RXID:
+   case PHY_INTERFACE_MODE_RGMII_TXID:
+   if (eth_clk_sel_reg)
+   value = SYSCFG_PMCSETR_ETH_SEL_RGMII |
+   SYSCFG_PMCSETR_ETH_CLK_SEL;
+   else
+   value = SYSCFG_PMCSETR_ETH_SEL_RGMII;
+   debug("%s: PHY_INTERFACE_MODE_RGMII\n", __func__);
+   break;
+   default:
+   debug("%s: Do not manage %d interface\n",
+ __func__, interface_type);
+   /* Do not manage others interfaces */
+   return -EINVAL;
+   }
+
+   /* clear and set ETH configuration bits */
+   writel(SYSCFG_PMCSETR_ETH_SEL_MASK | SYSCFG_PMCSETR_ETH_SELMII |
+  SYSCFG_PMCSETR_ETH_REF_CLK_SEL | SYSCFG_PMCSETR_ETH_CLK_SEL,
+  syscfg + SYSCFG_PMCCLRR);
+   writel(value, syscfg + SYSCFG_PMCSETR);
+
+   return 0;
+}
-- 
2.17.1

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


[U-Boot] [PATCH v2 3/6] net: dwc_eth_qos: add Ethernet stm32mp1 support

2019-05-17 Thread Christophe Roullier
Synopsys GMAC 4.20 is used. And Phy mode for eval and disco is RMII
with PHY Realtek RTL8211 (RGMII)
We also support some other PHY config on stm32mp157c
PHY_MODE(MII,GMII, RMII, RGMII) and in normal,
PHY wo crystal (25Mhz and 50Mhz), No 125Mhz from PHY config

Signed-off-by: Christophe Roullier 
---

Changes in v2: None

 drivers/net/dwc_eth_qos.c | 435 +-
 1 file changed, 383 insertions(+), 52 deletions(-)

diff --git a/drivers/net/dwc_eth_qos.c b/drivers/net/dwc_eth_qos.c
index 9f1c5af46e9..cee16ffd256 100644
--- a/drivers/net/dwc_eth_qos.c
+++ b/drivers/net/dwc_eth_qos.c
@@ -26,7 +26,6 @@
  *supports a single RGMII PHY. This configuration also has SW control over
  *all clock and reset signals to the HW block.
  */
-
 #include 
 #include 
 #include 
@@ -95,6 +94,7 @@ struct eqos_mac_regs {
 #define EQOS_MAC_RXQ_CTRL0_RXQ0EN_MASK 3
 #define EQOS_MAC_RXQ_CTRL0_RXQ0EN_NOT_ENABLED  0
 #define EQOS_MAC_RXQ_CTRL0_RXQ0EN_ENABLED_DCB  2
+#define EQOS_MAC_RXQ_CTRL0_RXQ0EN_ENABLED_AV   1
 
 #define EQOS_MAC_RXQ_CTRL2_PSRQ0_SHIFT 0
 #define EQOS_MAC_RXQ_CTRL2_PSRQ0_MASK  0xff
@@ -108,6 +108,7 @@ struct eqos_mac_regs {
 #define EQOS_MAC_MDIO_ADDRESS_RDA_SHIFT16
 #define EQOS_MAC_MDIO_ADDRESS_CR_SHIFT 8
 #define EQOS_MAC_MDIO_ADDRESS_CR_20_35 2
+#define EQOS_MAC_MDIO_ADDRESS_CR_250_300   5
 #define EQOS_MAC_MDIO_ADDRESS_SKAP BIT(4)
 #define EQOS_MAC_MDIO_ADDRESS_GOC_SHIFT2
 #define EQOS_MAC_MDIO_ADDRESS_GOC_READ 3
@@ -260,6 +261,29 @@ struct eqos_desc {
 
 struct eqos_config {
bool reg_access_always_ok;
+   int mdio_wait;
+   int swr_wait;
+   int config_mac;
+   int config_mac_mdio;
+   phy_interface_t (*interface)(struct udevice *dev);
+   struct eqos_ops *ops;
+};
+
+struct eqos_ops {
+   void (*eqos_inval_desc)(void *desc);
+   void (*eqos_flush_desc)(void *desc);
+   void (*eqos_inval_buffer)(void *buf, size_t size);
+   void (*eqos_flush_buffer)(void *buf, size_t size);
+   int (*eqos_probe_resources)(struct udevice *dev);
+   int (*eqos_remove_resources)(struct udevice *dev);
+   int (*eqos_stop_resets)(struct udevice *dev);
+   int (*eqos_start_resets)(struct udevice *dev);
+   void (*eqos_stop_clks)(struct udevice *dev);
+   int (*eqos_start_clks)(struct udevice *dev);
+   int (*eqos_calibrate_pads)(struct udevice *dev);
+   int (*eqos_disable_calibration)(struct udevice *dev);
+   int (*eqos_set_tx_clk_speed)(struct udevice *dev);
+   ulong (*eqos_get_tick_clk_rate)(struct udevice *dev);
 };
 
 struct eqos_priv {
@@ -276,6 +300,7 @@ struct eqos_priv {
struct clk clk_rx;
struct clk clk_ptp_ref;
struct clk clk_tx;
+   struct clk clk_ck;
struct clk clk_slave_bus;
struct mii_dev *mii;
struct phy_device *phy;
@@ -327,7 +352,7 @@ static void eqos_free_descs(void *descs)
 #endif
 }
 
-static void eqos_inval_desc(void *desc)
+static void eqos_inval_desc_tegra186(void *desc)
 {
 #ifndef CONFIG_SYS_NONCACHED_MEMORY
unsigned long start = (unsigned long)desc & ~(ARCH_DMA_MINALIGN - 1);
@@ -338,14 +363,36 @@ static void eqos_inval_desc(void *desc)
 #endif
 }
 
-static void eqos_flush_desc(void *desc)
+static void eqos_inval_desc_stm32(void *desc)
+{
+#ifndef CONFIG_SYS_NONCACHED_MEMORY
+   unsigned long start = rounddown((unsigned long)desc, ARCH_DMA_MINALIGN);
+   unsigned long end = roundup((unsigned long)desc + EQOS_DESCRIPTOR_SIZE,
+   ARCH_DMA_MINALIGN);
+
+   invalidate_dcache_range(start, end);
+#endif
+}
+
+static void eqos_flush_desc_tegra186(void *desc)
 {
 #ifndef CONFIG_SYS_NONCACHED_MEMORY
flush_cache((unsigned long)desc, EQOS_DESCRIPTOR_SIZE);
 #endif
 }
 
-static void eqos_inval_buffer(void *buf, size_t size)
+static void eqos_flush_desc_stm32(void *desc)
+{
+#ifndef CONFIG_SYS_NONCACHED_MEMORY
+   unsigned long start = rounddown((unsigned long)desc, ARCH_DMA_MINALIGN);
+   unsigned long end = roundup((unsigned long)desc + EQOS_DESCRIPTOR_SIZE,
+   ARCH_DMA_MINALIGN);
+
+   flush_dcache_range(start, end);
+#endif
+}
+
+static void eqos_inval_buffer_tegra186(void *buf, size_t size)
 {
unsigned long start = (unsigned long)buf & ~(ARCH_DMA_MINALIGN - 1);
unsigned long end = ALIGN(start + size, ARCH_DMA_MINALIGN);
@@ -353,11 +400,29 @@ static void eqos_inval_buffer(void *buf, size_t size)
invalidate_dcache_range(start, end);
 }
 
-static void eqos_flush_buffer(void *buf, size_t size)
+static void eqos_inval_buffer_stm32(void *buf, size_t size)
+{
+   unsigned long start = rounddown((unsigned long)buf, ARCH_DMA_MINALIGN);
+   unsigned long end = roundup((unsigned long)buf + size,
+ 

[U-Boot] [PATCH v2 1/6] stm32mp1: clk: use the correct identifier for ethck

2019-05-17 Thread Christophe Roullier
From: Patrick Delaunay 

ETHCK_K is the identifier the kernel clock for ETH in kernel
binding, selected by ETHKSELR / gated by ETHCKEN = BIT(7).
U-Boot driver need to use the same identifier, so change ETHCK
to ETHCK_K.

Signed-off-by: Patrick Delaunay 
Signed-off-by: Christophe Roullier 
---

Changes in v2: None

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

diff --git a/drivers/clk/clk_stm32mp1.c b/drivers/clk/clk_stm32mp1.c
index 24859fd054e..422176f3dde 100644
--- a/drivers/clk/clk_stm32mp1.c
+++ b/drivers/clk/clk_stm32mp1.c
@@ -555,7 +555,7 @@ static const struct stm32mp1_clk_gate stm32mp1_clk_gate[] = 
{
 
STM32MP1_CLK_SET_CLR(RCC_MP_AHB5ENSETR, 0, GPIOZ, _UNKNOWN_SEL),
 
-   STM32MP1_CLK_SET_CLR(RCC_MP_AHB6ENSETR, 7, ETHCK, _ETH_SEL),
+   STM32MP1_CLK_SET_CLR(RCC_MP_AHB6ENSETR, 7, ETHCK_K, _ETH_SEL),
STM32MP1_CLK_SET_CLR(RCC_MP_AHB6ENSETR, 8, ETHTX, _UNKNOWN_SEL),
STM32MP1_CLK_SET_CLR(RCC_MP_AHB6ENSETR, 9, ETHRX, _UNKNOWN_SEL),
STM32MP1_CLK_SET_CLR_F(RCC_MP_AHB6ENSETR, 10, ETHMAC, _ACLK),
-- 
2.17.1

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


Re: [U-Boot] MMC boot broken on OMAP-L138 LCDK

2019-05-17 Thread Adam Ford
On Fri, May 17, 2019 at 7:36 AM Sekhar Nori  wrote:
>
> Hi Adam,
>
> MMC/SD boot is broken on OMAP-L138 LCDK. This is since v2018.11.
> v2018.09 is fine.
>
> The first breakage occurred with commit 21af33ed0319 ("ARM: davinci:
> omapl138_lcdk: Enable DM_MMC"). This commit moved to DM_MMC for U-Boot
> while keeping legacy mode for SPL.

I am going to preface this by stating I don't have the LCDK.  Peter
Howard (added in CC) asked me to submit this on his behalf, so I
reviewed his patch and submitted it which is why both our names are on
the s-o-b.

>
> The "#ifndef CONFIG_DM_MMC" introduced by this commit is incorrect I
> think because CONFIG_DM_MMC is defined in SPL build too and because of
> this board_mmc_init() never gets defined. I think the intent was to
> define board_mmc_init() for SPL case, and for that the following diff
> should do:
>
> diff --git a/board/davinci/da8xxevm/omapl138_lcdk.c 
> b/board/davinci/da8xxevm/omapl138_lcdk.c
> index 2c2f885d43e4..fe1bf4410145 100644
> --- a/board/davinci/da8xxevm/omapl138_lcdk.c
> +++ b/board/davinci/da8xxevm/omapl138_lcdk.c
> @@ -353,7 +353,7 @@ int misc_init_r(void)
> return 0;
>  }
>
> -#ifndef CONFIG_DM_MMC
> +#if !CONFIG_IS_ENABLED(DM_MMC)
>  #ifdef CONFIG_MMC_DAVINCI
>  static struct davinci_mmc mmc_sd0 = {
> .reg_base = (struct davinci_mmc_regs *)DAVINCI_MMC_SD0_BASE,
>

I would agree that the #ifndef should be replaced with if
!CONFIG_IS_ENABLED(DM_MMC), but I would recomend checking into
migrating the LCDK to DM. and DM_MMC.
>
> With this fixed, MMC/SD boot is still broken after commit 15b8c7505819
> ("davinci: da850evm/omapl138-lcdk: Move BSS to SDRAM because SRAM is
> full").
>
> After this commit, mmc_initialize() in drivers/mmc/mmc.c fails because
> the static variable 'initialized' does not get initialized to 0 as
> intended in code and gets set to a random value because of which no
> MMC/SD device gets registered. I did notice that 'initialized' is in
> BSS, so I believe after this commit BSS is not getting set to 0.

I sent Peter H a list of patches to consider because I spent a lot of
time trying to modernize the da850_evm using DM, and DM_SPL and
eventually SPL_OF_CONTROL which ultimately eliminated a lot of the
manual initializing of the various drivers.

See:
commit a4670f8ebb5b4df6afeb5155fb5b44c1d1d154b9 Enable DM and device
tree support for da850-evm
commit c4fa049a121457ff38b74daac32e18d7afbd4538 shrunk SPL by 6.5k
commit 391328dc30b78be6f0d1181088eda0fd7febd5f3 removed DM_I2C_COMPAT
commit cb19c29398cb84e72236ab6bae3763028fce5d44 board: da8xxevm: Add
SPL DM for serial, spi (with platdata)
commit 591353d011b5ff6dbc8511b7a839cddf5b610495 ARM: da850evm:
Increase Malloc Size
commit 15b8c7505819fa48dd99fb51e91b9536f341fde1 moved BSS to SDRAM
because SRAM is full
commit f7c1d53605d9ec528abacda9ba1763c67221fc88 ARM: davinci:
da850evm: Enable SPL_OF_CONTROL without PLATDATA
commit fd3c26f3f921ad7addf95857cdb99a883c6e497a ARM: da850evm: Fix
broken SPI Flash

Having said that, the hardware I have for the da850 EVM doesn't
support MMC booting, so I cannot verify whether or not MMC initializes
properly in SPL.  I know the MMC initializes in U-Boot once it's
booted from SPI flash.

If someone wants to send me an LCDK, I'd be happy to look at
attempting to modernize the U-Boot for it.  Otherwise, we may want to
consider splitting the linker scripts between  LCDK and da850 evm so
da850evm can use SPL_OF_CONTROL with enough memory and LCDK can keep
it's legacy code status in SPL.

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


Re: [U-Boot] Cannot boot mx6qsabred with 2019.07-rc2

2019-05-17 Thread Lukasz Majewski
On Fri, 17 May 2019 09:39:31 -0300
Fabio Estevam  wrote:

> On Thu, May 16, 2019 at 11:29 PM Peng Fan  wrote:
> 
> > You could enable DEBUG in SPL, and disable SPL_SDP because of size
> > will exceeds. Then see what happends.  
> 
> Even without DEBUG enabled we get useful error messages:
> 
> U-Boot SPL 2019.07-rc2 (May 17 2019 - 09:30:33 -0300)
> Trying to boot from MMC1
> spl: could not find mmc device 0. error: -19

I had similar issue on imx53 (hsc). The problem was with not properly
set GPIO pin by DM/DTS in SPL. The GPIO was responsible for eMMC card
detect, so the SPL code after checking this got the impression that the
card is missing -> hence the -19 error.

Interesting commit: SHA1: 7a0425dd969c44e6afb6936bf8205c8770e9dea9


> SPL: failed to boot from all boot devices
> ### ERROR ### Please RESET the board ###
> 
> This means that
> err = uclass_get_device(UCLASS_MMC, mmc_dev, &dev); fails inside
> common/spl/spl_mmc.c
> 
> Why does this happen?
> 
> About the size difference:
> 
> Original defconfig generates an SPL of 76800 bytes
> With CONFIG_SPL_DM=y removed the SPL size goes to 68608 bytes.
> 
> > I have no idea, then. My board is REV C4, chip 1.5  
> 
> Mine is rev C2 with i.MX6Q rev1.2




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


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


Re: [U-Boot] [PATCH v3] spi: Zap sh_spi driver-related code

2019-05-17 Thread Marek Vasut
On 5/17/19 8:39 AM, Jagan Teki wrote:
> On Fri, May 17, 2019 at 2:06 AM Marek Vasut  wrote:
>>
>> On 4/19/19 9:00 AM, Jagan Teki wrote:
>>
>> Hello Jagan,
>>
>>> Dropped
>>> - sh_spi driver
>>> - CONFIG_SH_SPI,SH_SPI_BASE
>>>
>>> Dropped due to:
>>> - no active updates
>>> - no dm conversion
>>> - multiple pings for asking dm-conversion
>>> - no response for dm converted patch
>>> - driver-model migration expiry
>>>
>>> Signed-off-by: Jagan Teki 
>>> ---
>>> Changes for v3:
>>> - rebase on master
>>
>> I was complaining about not being CCed, specifically regarding this
>> driver [1], before. Why am I not being CCed _again_ ?
>>
>> [1] https://marc.info/?l=u-boot&m=154316928918863&w=2
> 
> I didn't see any text "regarding you to CC" in previous email
> (otherwise I would do). My patman didn't pick you since these changes
> are not maintained by you. Now this would be part of broken series
> which we are trying to send an updated version. If you are interested,
> I will CC you manually in next version.

I think [1] would suggest that. Thank you.

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


Re: [U-Boot] Cannot boot mx6qsabred with 2019.07-rc2

2019-05-17 Thread Fabio Estevam
On Thu, May 16, 2019 at 11:29 PM Peng Fan  wrote:

> You could enable DEBUG in SPL, and disable SPL_SDP because of size will 
> exceeds.
> Then see what happends.

Even without DEBUG enabled we get useful error messages:

U-Boot SPL 2019.07-rc2 (May 17 2019 - 09:30:33 -0300)
Trying to boot from MMC1
spl: could not find mmc device 0. error: -19
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###

This means that
err = uclass_get_device(UCLASS_MMC, mmc_dev, &dev); fails inside
common/spl/spl_mmc.c

Why does this happen?

About the size difference:

Original defconfig generates an SPL of 76800 bytes
With CONFIG_SPL_DM=y removed the SPL size goes to 68608 bytes.

> I have no idea, then. My board is REV C4, chip 1.5

Mine is rev C2 with i.MX6Q rev1.2
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] MMC boot broken on OMAP-L138 LCDK

2019-05-17 Thread Sekhar Nori
Hi Adam,

MMC/SD boot is broken on OMAP-L138 LCDK. This is since v2018.11. 
v2018.09 is fine.

The first breakage occurred with commit 21af33ed0319 ("ARM: davinci: 
omapl138_lcdk: Enable DM_MMC"). This commit moved to DM_MMC for U-Boot 
while keeping legacy mode for SPL.

The "#ifndef CONFIG_DM_MMC" introduced by this commit is incorrect I 
think because CONFIG_DM_MMC is defined in SPL build too and because of 
this board_mmc_init() never gets defined. I think the intent was to 
define board_mmc_init() for SPL case, and for that the following diff 
should do:

diff --git a/board/davinci/da8xxevm/omapl138_lcdk.c 
b/board/davinci/da8xxevm/omapl138_lcdk.c
index 2c2f885d43e4..fe1bf4410145 100644
--- a/board/davinci/da8xxevm/omapl138_lcdk.c
+++ b/board/davinci/da8xxevm/omapl138_lcdk.c
@@ -353,7 +353,7 @@ int misc_init_r(void)
return 0;
 }
 
-#ifndef CONFIG_DM_MMC
+#if !CONFIG_IS_ENABLED(DM_MMC)
 #ifdef CONFIG_MMC_DAVINCI
 static struct davinci_mmc mmc_sd0 = {
.reg_base = (struct davinci_mmc_regs *)DAVINCI_MMC_SD0_BASE,


With this fixed, MMC/SD boot is still broken after commit 15b8c7505819 
("davinci: da850evm/omapl138-lcdk: Move BSS to SDRAM because SRAM is 
full").

After this commit, mmc_initialize() in drivers/mmc/mmc.c fails because 
the static variable 'initialized' does not get initialized to 0 as 
intended in code and gets set to a random value because of which no 
MMC/SD device gets registered. I did notice that 'initialized' is in 
BSS, so I believe after this commit BSS is not getting set to 0.

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


  1   2   >