oweals/u-boot.git
4 years agonet: pcnet: fix I/O primitives for memory access
Daniel Schwierzeck [Sun, 3 May 2020 17:43:32 +0000 (19:43 +0200)]
net: pcnet: fix I/O primitives for memory access

Commit 69529c912059 ("net: pcnet: Switch to PCI memory access")
switched from PCI IO access to PCI memory access without updating
the I/O primitives. Contrary to SH, the primitives for memory
access and IO access are implemented differently. Thus doing
memory access with IO port primitives breaks the driver on
MIPS Malta board.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
4 years agoMerge tag 'u-boot-rockchip-20200501' of https://gitlab.denx.de/u-boot/custodians...
Tom Rini [Mon, 4 May 2020 11:28:14 +0000 (07:28 -0400)]
Merge tag 'u-boot-rockchip-20200501' of https://gitlab.denx.de/u-boot/custodians/u-boot-rockchip

- dts clean up to use -u-boot for px30, rk3399 boards
- dts sycn from upstream kernel for rk3328, rk3399
- add rockchip rng driver
- new board support: rk3328-roc-cc, rk3399-roc-pc,Nanopi M4 2GB

4 years agoMerge branch 'next' of git://git.denx.de/u-boot-sh
Tom Rini [Fri, 1 May 2020 21:58:31 +0000 (17:58 -0400)]
Merge branch 'next' of git://git.denx.de/u-boot-sh

This is part 1 of big network cleanup / DM conversion.
The dc2114x/rtl8139/pcnet/tulip PCI adapter drivers received checkpatch
cleanups in preparation for DM conversion. The smc911x is converted to
DM completely. The dwc_eth_qos cache fixes are applied.

4 years agomkimage: fit: Do not tail-pad fitImage with external data
Marek Vasut [Fri, 1 May 2020 15:40:25 +0000 (17:40 +0200)]
mkimage: fit: Do not tail-pad fitImage with external data

There is no reason to tail-pad fitImage with external data to 4-bytes,
while fitImage without external data does not have any such padding and
is often unaligned. DT spec also does not mandate any such padding.

Moreover, the tail-pad fills the last few bytes with uninitialized data,
which could lead to a potential information leak.

$ echo -n xy > /tmp/data ; \
./tools/mkimage -E -f auto -d /tmp/data /tmp/fitImage ; \
hexdump -vC /tmp/fitImage | tail -n 3

before:
00000260  61 2d 6f 66 66 73 65 74  00 64 61 74 61 2d 73 69  |a-offset.data-si|
00000270  7a 65 00 00 78 79 64 64                           |ze..xydd|
                   ^^       ^^ ^^
after:
00000260  61 2d 6f 66 66 73 65 74  00 64 61 74 61 2d 73 69  |a-offset.data-si|
00000270  7a 65 00 78 79                                    |ze.xy|

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Tom Rini <trini@konsulko.com>
4 years agoMerge branch '2020-05-01-master-imports'
Tom Rini [Fri, 1 May 2020 20:43:15 +0000 (16:43 -0400)]
Merge branch '2020-05-01-master-imports'

- Assorted bug fixes
- Framework for enabling D-CACHE in SPL on ARM

4 years ago.readthedocs.yml: fix type docs/
Heinrich Schuchardt [Fri, 1 May 2020 20:06:17 +0000 (22:06 +0200)]
.readthedocs.yml: fix type docs/

Out documentation directory is doc/ and not docs/.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoactions: Fix syntax for enabling SYS_RELOC_GD_ENV_ADDR
Tom Rini [Fri, 1 May 2020 14:52:11 +0000 (10:52 -0400)]
actions: Fix syntax for enabling SYS_RELOC_GD_ENV_ADDR

The correct syntax is 'select SYS_...' and not 'select CONFIG_SYS...'

Fixes: d5c819b885c2 ("actions: Move defconfig options to Kconfig")
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agocommon/board_r: Drop initr_bedbug wrapper
Ovidiu Panait [Mon, 20 Apr 2020 07:31:46 +0000 (10:31 +0300)]
common/board_r: Drop initr_bedbug wrapper

Drop initr_bedbug wrapper and call bedbug_init directly during the init
sequence.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agocmd/bedbug.c: Make bedbug_init have a return value
Ovidiu Panait [Mon, 20 Apr 2020 07:31:45 +0000 (10:31 +0300)]
cmd/bedbug.c: Make bedbug_init have a return value

Do this as a preparation for removing initr_bedbug wrapper from
common/board_r.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agocommon/board_r: arm: Merge initr_enable_interrupts into interrupts_init
Ovidiu Panait [Mon, 20 Apr 2020 07:31:44 +0000 (10:31 +0300)]
common/board_r: arm: Merge initr_enable_interrupts into interrupts_init

initr_enable_interrupts() is an ARM-specific wrapper over
enable_interrupts(), which is run during the common init sequence. It can
be eliminated by moving the enable_interrupts() call to the end of
interrupt_init() function, in arch/arm/lib/interrupts*.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agomalloc: dlmalloc: add an ability for the malloc to be re-init/init multiple times
Marek Bykowski [Wed, 29 Apr 2020 16:23:07 +0000 (18:23 +0200)]
malloc: dlmalloc: add an ability for the malloc to be re-init/init multiple times

Malloc gets initialized with a call to mem_malloc_init() with the address
the allocation starts to and its size. Currently it is not possible to
move the malloc from one memory area to another as the malloc would eventually
fail.

This patch adds in the ability to re-init the malloc with the updated
start address and the size.

One of the use cases of this feature is SPL U-Boot running from within
the static memory and calling to malloc init from within board_init_f():

arch/arm/cpu/armv8/start.S:reset vector
arch/arm/cpu/armv8/start.S:main()
arch/arm/lib/crt0_64.S:board_init_f()
board/<my_board>/common/spl.c:board_init_f()
        board/<my_board>/common/spl.c:mem_malloc_init((ulong)CONFIG_SYS_SPL_MALLOC_START,
                        CONFIG_SYS_SPL_MALLOC_SIZE);

Shortly after the DDR (main) memory is init and ready we call to malloc init
again but this time with the start address in the DDR memory and a much greater
size for moving the allocation off the static to the DDR memory:

board/<my_board>/common/spl.c:mem_malloc_init((ulong)CONFIG_SPL_MALLOC_OFFSET,
CONFIG_SPL_MALLOC_SIZE);

Where CONFIG_SYS_SPL_MALLOC_START and CONFIG_SPL_MALLOC_OFFSET are the start
addresses of the malloc in the static and DDR memories respectively and
CONFIG_SYS_SPL_MALLOC_SIZE=SZ_16K and CONFIG_SPL_MALLOC_SIZE=SZ_2M are
the sizes of the mallocs in these memories. Note, now we have a much greater
memory, enlarging from 16K to 2M, available for allocation.

There is an alternative approach already existing in U-Boot with the use of
an early (simplified) malloc and the proper (dlamalloc) malloc however
necessitating managing the two mallocs whereas this approach proposes using
a single dlmalloc.

Signed-off-by: Marek Bykowski <marek.bykowski@gmail.com>
4 years agorsa: sig: fix config signature check for fit with padding
Philippe Reynes [Wed, 29 Apr 2020 13:26:17 +0000 (15:26 +0200)]
rsa: sig: fix config signature check for fit with padding

The signature check on config node is broken on fit with padding.
To compute the signature for config node, U-Boot compute the
signature on all properties of requested node for this config,
except for the property "data". But, when padding is used for
binary in a fit, there isn't a property "data" but two properties:
"data-offset" and "data-size". So to fix the check of signature,
we also don't use the properties "data-offset" and "data-size"
when checking the signature on config node.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
4 years agotest/py: vboot: add a test to check fit signature on fit with padding
Philippe Reynes [Wed, 29 Apr 2020 13:26:16 +0000 (15:26 +0200)]
test/py: vboot: add a test to check fit signature on fit with padding

The pytest vboot does all his tests on fit without padding.
We add the same tests on fit with padding.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
4 years agohush: avoid NULL check before free()
Heinrich Schuchardt [Tue, 28 Apr 2020 19:56:10 +0000 (21:56 +0200)]
hush: avoid NULL check before free()

free() checks if its argument is NULL. Don't duplicate this in the calling
code.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agofs: ext4: avoid NULL check before free()
Heinrich Schuchardt [Tue, 28 Apr 2020 19:50:02 +0000 (21:50 +0200)]
fs: ext4: avoid NULL check before free()

free() checks if its argument is NULL. Don't duplicate this in the calling
code.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agocmd/gpt: avoid NULL check before free()
Heinrich Schuchardt [Tue, 28 Apr 2020 19:40:13 +0000 (21:40 +0200)]
cmd/gpt: avoid NULL check before free()

free() checks if its argument is NULL. Do not duplicate this in the calling
code.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agotools/fit-image: print a warning when cmd-line for dtc might be truncated
Sven Roederer [Mon, 27 Apr 2020 00:08:39 +0000 (02:08 +0200)]
tools/fit-image: print a warning when cmd-line for dtc might be truncated

Signed-off-by: Sven Roederer <devel-sven@geroedel.de>
4 years agotools/mkimage: fix handling long filenames
Sven Roederer [Mon, 27 Apr 2020 00:08:38 +0000 (02:08 +0200)]
tools/mkimage: fix handling long filenames

The cmdline for calling the dtc was cut-off when using long filenames (e.g.
245 bytes) for output-file and datafile of "-f" parameter.
For FIT-images cmd[MKIMAGE_MAX_DTC_CMDLINE_LEN] is declared (hardcoded 512 bytes),
and contains some static values, the path of a tmpfile and a datafile. tmpfile is
max MKIMAGE_MAX_TMPFILE_LEN (256) and datafile might be also this size. Having two
very long pathname results in a truncation os the executed shell command, as the
truncated datafile path will not be found.
Redefine MKIMAGE_MAX_DTC_CMDLINE_LEN to "2 * MKIMAGE_MAX_TMPFILE_LEN + 35 for the
parameters.
This likely applies to the "-d" parameter, too.

Signed-off-by: Sven Roederer <devel-sven@geroedel.de>
4 years agoarm: enable distro boot for bananapi-r2
Matthias Brugger [Sat, 25 Apr 2020 23:17:46 +0000 (01:17 +0200)]
arm: enable distro boot for bananapi-r2

This patch enables distro boot for the bananapi-r2, based on
a MediaTek mt7623n.

Signed-off-by: Matthias Brugger <mbrugger@suse.com>
4 years agowatchdog MediaTek add upstream compatible
Matthias Brugger [Sat, 25 Apr 2020 23:17:45 +0000 (01:17 +0200)]
watchdog MediaTek add upstream compatible

The upstream compatible is called mt6589-wdt.
Add this compatible to the driver.

Signed-off-by: Matthias Brugger <mbrugger@suse.com>
4 years agotimer MediaTek use upstream compatible
Matthias Brugger [Sat, 25 Apr 2020 23:17:44 +0000 (01:17 +0200)]
timer MediaTek use upstream compatible

The timers compatible string in upstream is called
mt6577-timer. Add this compatible to the driver.

Signed-off-by: Matthias Brugger <mbrugger@suse.com>
4 years agodoc: describe the analysis of crash dumps
Heinrich Schuchardt [Fri, 24 Apr 2020 21:31:20 +0000 (23:31 +0200)]
doc: describe the analysis of crash dumps

Provide an overview of the analysis of U-Boot crash dumps.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
4 years agortc: pcf2127: don't add/subtract 1 to tm_mon
Rasmus Villemoes [Fri, 1 May 2020 13:24:50 +0000 (15:24 +0200)]
rtc: pcf2127: don't add/subtract 1 to tm_mon

As noted in rtc_def.h, the tm_mon field in struct rtc_time is 1-12,
unlike in struct tm where it is 0-11. Currently, running "date" prints
the wrong

Date: 2020-04-01 (Friday)    Time: 13:05:30

and setting the RTC via the date command is also broken.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
4 years agoarm: caches: manage phys_addr_t overflow in mmu_set_region_dcache_behaviour
Patrick Delaunay [Fri, 24 Apr 2020 18:20:17 +0000 (20:20 +0200)]
arm: caches: manage phys_addr_t overflow in mmu_set_region_dcache_behaviour

Solved the overflow on phys_addr_t type for start + size in
mmu_set_region_dcache_behaviour() function.

This overflow is avoided by dividing start and end by 2 before addition,
and we only expecting that start and size are even.

This patch doesn't change the current function behavior if the
parameters (start or size) are not aligned on MMU_SECTION_SIZE.

For example, this overflow occurs on ARM32 with:
start = 0xC0000000 and size = 0x40000000
then start + size = 0x100000000 and end = 0x0.

For information the function behavior change with risk of regression,
if we just shift start and size before the addition.
Example with 2MB section size:
  MMU_SECTION_SIZE 0x200000 and MMU_SECTION_SHIFT = 21
  with start = 0x1000000, size = 0x1000000,
  - with the proposed patch, start = 0 and end = 0x1 as previously
  - with the more simple patch:
    end = (start >> MMU_SECTION_SHIFT) + (size >> MMU_SECTION_SHIFT)
    the value of end change:
    start >> 21 = 0, size >> 21 = 0 and end = 0x0 !!!

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoarm: caches: add DCACHE_DEFAULT_OPTION
Patrick Delaunay [Fri, 24 Apr 2020 18:20:16 +0000 (20:20 +0200)]
arm: caches: add DCACHE_DEFAULT_OPTION

Add the new flags DCACHE_DEFAULT_OPTION to define the default
option to use according the compilation flags
CONFIG_SYS_ARM_CACHE_*.

This new compilation flag allows to simplify dram_bank_mmu_setup()
and can be used as third parameter (option=dcache option to select)
of mmu_set_region_dcache_behaviour function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoarm: caches: protect dram_bank_mmu_setup access to bi_dram
Patrick Delaunay [Fri, 24 Apr 2020 18:20:15 +0000 (20:20 +0200)]
arm: caches: protect dram_bank_mmu_setup access to bi_dram

Add protection in dram_bank_mmu_setup() to avoid access to bd->bi_dram
before relocation.

This patch allow to use the generic weak function dram_bank_mmu_setup
to activate the MMU and the data cache in SPL or in U-Boot before
relocation, when bd->bi_dram is not yet initialized.

In this cases, the MMU must be initialized explicitly with
mmu_set_region_dcache_behaviour function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoconfigs: migrate CONFIG_SYS_ARM_CACHE_* in Kconfig
Patrick Delaunay [Fri, 10 Apr 2020 14:02:02 +0000 (16:02 +0200)]
configs: migrate CONFIG_SYS_ARM_CACHE_* in Kconfig

Move CONFIG_SYS_ARM_CACHE_WRITETHROUGH and
CONFIG_SYS_ARM_CACHE_WRITEALLOC into Kconfig done by moveconfig.py.

Kconfig uses a choice between the 3 values supported in U-Boot,
including the new configuration CONFIG_SYS_ARM_CACHE_WRITEBACK
(the default configuration).

The patch also avoids to select simultaneously 2 configurations.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agotiny-printf: Support %i
Marek Vasut [Fri, 10 Apr 2020 18:54:49 +0000 (20:54 +0200)]
tiny-printf: Support %i

The most basic printf("%i", value) formating string was missing,
add it for the sake of convenience.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stefan Roese <sr@denx.de>
4 years agonet: smc911x: Add DM support
Marek Vasut [Sun, 15 Mar 2020 16:39:01 +0000 (17:39 +0100)]
net: smc911x: Add DM support

Add support for U-Boot DM and DT probing. Furthermore, build the
SMC911x standalone EEPROM example only for the non-DM case, as it
is not converted yet.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
4 years agonet: smc911x: Split non-DM specific bits from common code
Marek Vasut [Sun, 15 Mar 2020 16:25:27 +0000 (17:25 +0100)]
net: smc911x: Split non-DM specific bits from common code

Split network handling functions into non-DM specific parts and
common code in preparation for conversion to DM.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: smc911x: Clean up the status handling in smc911x_recv()
Marek Vasut [Sun, 15 Mar 2020 16:02:05 +0000 (17:02 +0100)]
net: smc911x: Clean up the status handling in smc911x_recv()

Invert the status handling logic in smc911x_recv(), to make the
function easier to read, no functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
4 years agonet: smc911x: Pass around driver private data
Marek Vasut [Sun, 15 Mar 2020 14:36:09 +0000 (15:36 +0100)]
net: smc911x: Pass around driver private data

Introduce a private data structure for this driver with embedded
struct eth_device and pass it around. This prepares the driver to
work with both DM and non-DM systems.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
4 years agonet: smc911x: Convert IO accessors to {read,write}{w,l}()
Marek Vasut [Sun, 15 Mar 2020 13:42:23 +0000 (14:42 +0100)]
net: smc911x: Convert IO accessors to {read,write}{w,l}()

Convert the IO accessors to standard ones instead of using volatile
void pointers, as those do not cover all the bus access details.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
4 years agonet: smc911x: Drop weak alias from 32bit accessors
Marek Vasut [Sun, 15 Mar 2020 13:38:59 +0000 (14:38 +0100)]
net: smc911x: Drop weak alias from 32bit accessors

These accessors are not overridden by any board, and even if they were,
this is something which should be handled via DM now, so remove the
weak alias option. Moreover, drop the inline keyword, as the compiler
can decide better.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
4 years agonet: smc911x: Inline all functions from header file
Marek Vasut [Sun, 15 Mar 2020 14:03:07 +0000 (15:03 +0100)]
net: smc911x: Inline all functions from header file

Inline all the functions from the header file, as they are not used
outside of the driver or the standalone EEPROM example.

Note that this does introduce considerable amount of duplication in
the standalone EEPROM example, however that one has to be rewritten
anyway, roughly such that the SMC911x driver would expose DM EEPROM
interface and the standalone example would use that.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
4 years agonet: smc911x: Pull MII registration into separate function
Marek Vasut [Sat, 21 Mar 2020 16:25:41 +0000 (17:25 +0100)]
net: smc911x: Pull MII registration into separate function

Pull the MII interface registration into separate function to avoid the
ifdeffery in smc911x_initialize(). Moreover, adjust the fail path such
that we use goto labels.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
4 years agonet: smc911x: Fix potential memleak() in init fail path
Marek Vasut [Sun, 15 Mar 2020 14:57:14 +0000 (15:57 +0100)]
net: smc911x: Fix potential memleak() in init fail path

Fix memleak in the init fail path, where if allocation or registration
of MDIO bus fails, then ethernet interface is not unregistered and the
private data are not freed, yet the probe function reports a failure.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
4 years agonet: smc911x: Invert the logic in smc911x_miiphy_{read,write}()
Marek Vasut [Sun, 15 Mar 2020 14:43:20 +0000 (15:43 +0100)]
net: smc911x: Invert the logic in smc911x_miiphy_{read,write}()

Invert the logic in the aforementioned functions to reduce indent,
no functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
4 years agonet: smc911x: Rename smc911x_rx() to smc911x_recv()
Marek Vasut [Sun, 15 Mar 2020 14:40:15 +0000 (15:40 +0100)]
net: smc911x: Rename smc911x_rx() to smc911x_recv()

Rename the function to keep the naming scheme consistent,
no functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
4 years agonet: smc911x: Replace malloc()+memset() with calloc()
Marek Vasut [Sun, 15 Mar 2020 14:14:18 +0000 (15:14 +0100)]
net: smc911x: Replace malloc()+memset() with calloc()

Replace combination of malloc()+memset() with calloc() as the behavior
is exactly the same and the amount of code is reduced.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
4 years agonet: smc911x: Remove pkt_data_{push,pull}
Marek Vasut [Sat, 14 Mar 2020 23:08:31 +0000 (00:08 +0100)]
net: smc911x: Remove pkt_data_{push,pull}

These functions are never used and are likely a pre-DM remnant
from times long past, just remove them.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
4 years agonet: rtl8139: Fill in SPDX tag
Marek Vasut [Sun, 12 Apr 2020 21:49:25 +0000 (23:49 +0200)]
net: rtl8139: Fill in SPDX tag

The rtl8139 driver is derived from Etherboot driver, which is in
turn derived from Linux 8139too driver added in Linux 2.2.18pre14.
An undocumented change in Linux 2.4.10.2 added a new field to the
driver, MODULE_LICENSE("GPL"); . According to current Linux kernel
licensing rules, Documentation/process/license-rules.rst, quote:

"GPL" Module is licensed under GPL version 2. This
does not express any distinction between
GPL-2.0-only or GPL-2.0-or-later. The exact
license information can only be determined
via the license information in the
corresponding source files.

And since the code does not contain any "future" clause, the tag
is therefore GPL-2.0 only.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: rtl8139: Move functions around
Marek Vasut [Sun, 12 Apr 2020 21:12:11 +0000 (23:12 +0200)]
net: rtl8139: Move functions around

Just move functions around in preparation for easy DM conversion,
rename rtl_bcast_addr() to rtl8139_bcast_addr(), no functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: rtl8139: Finish cleanup
Marek Vasut [Sun, 12 Apr 2020 21:01:45 +0000 (23:01 +0200)]
net: rtl8139: Finish cleanup

Finish the checkpatch cleanup of the driver, fix the remaining issues
in probe and init function and in global variables, rename the probe
function to rtl8139_init(), no functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: rtl8139: Factor out hardware reset
Marek Vasut [Sun, 12 Apr 2020 20:58:27 +0000 (22:58 +0200)]
net: rtl8139: Factor out hardware reset

This hardware reset and reset-wait implementation was twice in the
driver, factor it out into a separate function. This really should
use wait_for_bit() eventually and return -ETIMEDOUT, but thus far,
handling of any of this is missing from the driver. This must be
added later. Thus far, no functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: rtl8139: Minor cleanup of rtl_disable()
Marek Vasut [Sun, 12 Apr 2020 20:55:40 +0000 (22:55 +0200)]
net: rtl8139: Minor cleanup of rtl_disable()

Rename the function to rtl8139_stop(), clean up checkpatch errors in
the stop polling function. No functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: rtl8139: Minor cleanup of rtl_poll()
Marek Vasut [Sun, 12 Apr 2020 20:43:16 +0000 (22:43 +0200)]
net: rtl8139: Minor cleanup of rtl_poll()

Rename the function to rtl8139_recv(), clean up various checkpatch errors,
line-over-80 conditions, and malformed comments. No functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: rtl8139: Minor cleanup of rtl_transmit()
Marek Vasut [Sun, 12 Apr 2020 20:40:45 +0000 (22:40 +0200)]
net: rtl8139: Minor cleanup of rtl_transmit()

Rename the function to rtl8139_send(), clean up the TX polling, the TX
OK condition at the end, overuse of typecasts, and various line-over-80
problems. No functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: rtl8139: Minor cleanup of rtl_reset()
Marek Vasut [Sun, 12 Apr 2020 19:41:56 +0000 (21:41 +0200)]
net: rtl8139: Minor cleanup of rtl_reset()

Rename the function to rtl8139_reset(), clean up the reset polling
and various line-over-80 problems. No functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: rtl8139: Minor cleanup of set_rx_mode()
Marek Vasut [Sun, 12 Apr 2020 19:35:12 +0000 (21:35 +0200)]
net: rtl8139: Minor cleanup of set_rx_mode()

Rename the function to rtl8139_set_rx_mode(), use unsigned variables
where applicable and inline mc_filter[] values. No functional chanage.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: rtl8139: Consistently use rtl8139_rx_config
Marek Vasut [Sun, 12 Apr 2020 19:30:38 +0000 (21:30 +0200)]
net: rtl8139: Consistently use rtl8139_rx_config

This string of macros is exactly the same thing as rtl8139_rx_config,
so just use rtl8139_rx_config. No functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: rtl8139: Minor cleanup of read_eeprom()
Marek Vasut [Sun, 12 Apr 2020 19:28:30 +0000 (21:28 +0200)]
net: rtl8139: Minor cleanup of read_eeprom()

Rename the function to rtl8139_read_eeprom() to keep the naming
consistent, keep the variables sorted in reverse xmas tree. No
functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: rtl8139: Rework eeprom_delay() macro
Marek Vasut [Sun, 12 Apr 2020 19:20:31 +0000 (21:20 +0200)]
net: rtl8139: Rework eeprom_delay() macro

The macro assumes ee_addr variable to be present when it's being
used. Rework the macro into a function instead and pass it an
argument specifying the register base address, to make it future
proof for DM conversion.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: rtl8139: Register macro cleanup
Marek Vasut [Sun, 12 Apr 2020 18:47:26 +0000 (20:47 +0200)]
net: rtl8139: Register macro cleanup

Clean up the horrible register definitions in the RTL8139 driver.
This does create a couple of checkpatch errors, but the driver is
full of them anyway, and those will be cleaned up later.

No functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: dwc_eth_qos: Prevent DMA from writing updated RX DMA descriptor
Marek Vasut [Mon, 23 Mar 2020 01:11:46 +0000 (02:11 +0100)]
net: dwc_eth_qos: Prevent DMA from writing updated RX DMA descriptor

The DMA may attempt to write a DMA descriptor in the ring while it is
being updated. By writing the DMA descriptor buffer address to 0, it
is assured the DMA will not use such a buffer and the buffer can be
updated without any interference.

Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
4 years agonet: dwc_eth_qos: Invalidate RX packet DMA buffer
Marek Vasut [Mon, 23 Mar 2020 01:09:55 +0000 (02:09 +0100)]
net: dwc_eth_qos: Invalidate RX packet DMA buffer

This patch prevents an issue where the RX packet might have been
accessed by the CPU, which now has cached data from the packet in
the caches and possibly various write buffers, and these data may
be evicted from the caches into the DRAM while the buffer is also
written by the DMA.

By invalidating the buffer after the CPU accessed it and before the
DMA populates the buffer, it is assured that the buffer will not be
corrupted.

Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
4 years agonet: dwc_eth_qos: Invalidate RX descriptor before reading
Marek Vasut [Mon, 23 Mar 2020 01:09:21 +0000 (02:09 +0100)]
net: dwc_eth_qos: Invalidate RX descriptor before reading

The current code polls the RX desciptor ring for new packets by reading
the RX descriptor status. This works by accident, as the RX descriptors
are often in non-cacheable memory. However, the driver does support use
of RX descriptors in cacheable memory.

This patch adds a missing RX descriptor invalidation, which assures the
CPU will read a fresh copy of the RX descriptor instead of a cached one.

Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
4 years agonet: dwc_eth_qos: Flush the RX descriptors on init
Marek Vasut [Mon, 23 Mar 2020 01:09:01 +0000 (02:09 +0100)]
net: dwc_eth_qos: Flush the RX descriptors on init

Currently the code only flushes the first RX descriptor, not every entry
in the RX descriptor ring. Fix this, to make sure the DMA engine can pick
the RX descriptors correctly.

Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
4 years agonet: dwc_eth_qos: Correctly wrap around TX descriptor tail pointer
Marek Vasut [Mon, 23 Mar 2020 01:03:50 +0000 (02:03 +0100)]
net: dwc_eth_qos: Correctly wrap around TX descriptor tail pointer

This code programs the next descriptor in the TX descriptor ring into
the hardware as the last valid TX descriptor. The problem is that if
the currenty descriptor is the last one in the array, the code will
not wrap around correctly and use TX descriptor 0 again, but instead
will use TX descriptor at address right past the TX descriptor ring,
which is the first descriptor in the RX ring.

Fix this by adding the necessary wrap-around.

Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
4 years agonet: dwc_eth_qos: Fully rewrite RX descriptor field 3
Marek Vasut [Mon, 23 Mar 2020 01:02:57 +0000 (02:02 +0100)]
net: dwc_eth_qos: Fully rewrite RX descriptor field 3

The RX descriptor field 3 should contain only OWN and BUF1V bits before
being used for receiving data by the DMA engine. However, right now, if
the descriptor was already used for receiving data and is being cleared,
the field 3 is only modified and the aforementioned two bits are ORRed
into the field. This could lead to a residual dirty bits being left in
the field 3 from previous transfer, and it generally does. Fully set the
field 3 instead to clear those residual dirty bits.

Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
4 years agonet: dc2114x: Switch DEBUG_SROM{,2} to debug_cond()
Marek Vasut [Sun, 19 Apr 2020 02:05:44 +0000 (04:05 +0200)]
net: dc2114x: Switch DEBUG_SROM{,2} to debug_cond()

Replace the adhoc debugging ifdeffery with debug_cond() and an
internal SROM_DEBUG macro to select the debug level.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: dc2114x: Reorganize driver
Marek Vasut [Sun, 19 Apr 2020 02:00:49 +0000 (04:00 +0200)]
net: dc2114x: Reorganize driver

Move the functions in the driver around to better fit future DM
conversion, drop function forward declarations. No functional
change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: dc2114x: Clean up INL/OUTL functions
Marek Vasut [Sun, 19 Apr 2020 01:40:03 +0000 (03:40 +0200)]
net: dc2114x: Clean up INL/OUTL functions

Rename these functions to dc2114x_{inl,outl}(), use u32 values in
them instead of plain signed integers as all those values are in
fact register values and the driver code does bitwise operations
on them. No functional change intended.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: dc2114x: Clean up DE4X5 macros
Marek Vasut [Sun, 19 Apr 2020 01:36:46 +0000 (03:36 +0200)]
net: dc2114x: Clean up DE4X5 macros

Replace these macros with static functions to permit the compiler to
do type checking on the functions. The INL()/OUTL() functions have to
be moved in this patch as well, as those DE4X5 macros are using them.
No functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: dc2114x: Clean up remaining driver code
Marek Vasut [Sun, 19 Apr 2020 01:09:26 +0000 (03:09 +0200)]
net: dc2114x: Clean up remaining driver code

Clean up the remaining driver code, macro space alignment, function
declaration indent, replace __attribute__((aligned(32))) with plain
__aligned(32). No functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: dc2114x: Clean up SROM operations
Marek Vasut [Sun, 19 Apr 2020 01:11:06 +0000 (03:11 +0200)]
net: dc2114x: Clean up SROM operations

Clean up the SROM accessors to bring them up to standards with
U-Boot coding style. Sort variable into reverse xmas tree. No
functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: dc2114x: Clean up send_setup_frame()
Marek Vasut [Sun, 19 Apr 2020 01:10:50 +0000 (03:10 +0200)]
net: dc2114x: Clean up send_setup_frame()

Clean up the send_setup_frame() to bring it up to standards with
U-Boot coding style, invert the loops where applicable to cut
down the level of indent. No functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: dc2114x: Clean up dc21x4x_halt()
Marek Vasut [Sun, 19 Apr 2020 01:10:30 +0000 (03:10 +0200)]
net: dc2114x: Clean up dc21x4x_halt()

Clean up the driver halt code to bring it up to standards with
U-Boot coding style. No functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: dc2114x: Clean up dc21x4x_recv()
Marek Vasut [Sun, 19 Apr 2020 01:10:25 +0000 (03:10 +0200)]
net: dc2114x: Clean up dc21x4x_recv()

Clean up the driver recv code to bring it up to standards with
U-Boot coding style. No functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: dc2114x: Clean up dc21x4x_send()
Marek Vasut [Sun, 19 Apr 2020 01:10:14 +0000 (03:10 +0200)]
net: dc2114x: Clean up dc21x4x_send()

Clean up the driver send code to bring it up to standards with
U-Boot coding style, invert the loops where applicable to cut
down the level of indent. No functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: dc2114x: Clean up init code
Marek Vasut [Sun, 19 Apr 2020 01:09:47 +0000 (03:09 +0200)]
net: dc2114x: Clean up init code

Clean up the driver init code to bring it up to standards with
U-Boot coding style, no functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: pcnet: Switch to PCI memory access
Marek Vasut [Sat, 18 Apr 2020 03:11:05 +0000 (05:11 +0200)]
net: pcnet: Switch to PCI memory access

Replace the PCI IO access with PCI memory access, the card
supports both, but the former does not work with QEMU SH4.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: pcnet: Replace mips-specific accessors
Marek Vasut [Sat, 18 Apr 2020 00:32:19 +0000 (02:32 +0200)]
net: pcnet: Replace mips-specific accessors

Replace mips-specific UNCACHED_SDRAM() macro with standard
map_physmem(), which permits the driver to work on other
systems than mips.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: tulip: Remove CONFIG_TULIP_*
Marek Vasut [Fri, 17 Apr 2020 23:56:51 +0000 (01:56 +0200)]
net: tulip: Remove CONFIG_TULIP_*

These macros are not used by any board, remove them to simplify
the driver. The EEPROM accessors are still retained however, as
those might still be useful.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: pcnet: Remove CONFIG_PCNET_79C97x
Marek Vasut [Fri, 17 Apr 2020 23:44:12 +0000 (01:44 +0200)]
net: pcnet: Remove CONFIG_PCNET_79C97x

These macros guard one switch-case statement, which grows mips malta
by some 20 bytes if debug is enabled, and even less if it is not. To
make the code simpler, just support all the NICs and be done with it.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: Fix warning when including netdev.h on DM systems
Marek Vasut [Sat, 4 Apr 2020 10:21:57 +0000 (12:21 +0200)]
net: Fix warning when including netdev.h on DM systems

If the DM_ETH is enabled and netdev.h is included somewhere, the
struct eth_device may not be defined, yet it is used in the header
file as an argument to fecmxc_register_mii_postcall. Add forward
declaration to remove the warning.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
4 years agorockchip: rk3399: Add Nanopi M4 2GB board support
Deepak Das [Sun, 26 Apr 2020 10:41:50 +0000 (16:11 +0530)]
rockchip: rk3399: Add Nanopi M4 2GB board support

commit b2f5da9dd068 ("rockchip: rk3399: Add Nanopi M4 board support") added
support for Nanopi M4 board with Dual-Channel 4GB LPDDR3-1866 RAM.
This patch adds another variant of NanoPi M4 board with Dual-Channel
2GB DDR3-1866 RAM.

Signed-off-by: Deepak Das <deepakdas.linux@gmail.com>
4 years agork3399: Add ROC-RK3399-PC Mezzanine board
Suniel Mahesh [Tue, 28 Apr 2020 10:00:19 +0000 (15:30 +0530)]
rk3399: Add ROC-RK3399-PC Mezzanine board

Add Firefly ROC-RK3399-PC Mezzanine board which is an
extension board on top of roc-rk3399-pc.

Will drop the separate defconfig file, once we support
the board detection at runtime.

Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoarm: dts: rk3399: Sync roc-pc-mezzanine from v5.7-rc1
Jagan Teki [Tue, 28 Apr 2020 10:00:18 +0000 (15:30 +0530)]
arm: dts: rk3399: Sync roc-pc-mezzanine from v5.7-rc1

Sync Firefly ROC-RK3399-PC Mezzanine Board dts file
from Linux v5.7-rc1.

Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoarm64: dts: rk3399: Sync v5.7-rc1 from Linux
Jagan Teki [Tue, 28 Apr 2020 10:00:17 +0000 (15:30 +0530)]
arm64: dts: rk3399: Sync v5.7-rc1 from Linux

Sync rk3399 dts(i) files from v5.7-rc1 linux-next.

Reason:
To get updated PCIe nodes and properties on respective
dts(i) files.

Summary:
- sync won't include new board dts(i)
- sync will add required files used on respective dts(i)
- rk3399-puma-u-boot.dtsi spiflash label changed to norflash
- move puma.dtsi bios_enable into rk3399-puma-u-boot.dtsi
- move legacy max-frequency of sdhci into rk3399-u-boot.dtsi
- update cross-ec-[keyboard|sbs].dtsi path as per U-Boot
- keep roc-rk3399-pc dc_12v changes to -u-boot.dtsi

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoclk: rk3399: Set empty for HCLK_SD assigned-clocks
Jagan Teki [Tue, 28 Apr 2020 10:00:16 +0000 (15:30 +0530)]
clk: rk3399: Set empty for HCLK_SD assigned-clocks

Due to v5.7-rc1 sync the SD controller nodes in rk3399.dtsi
have HCLK_SD assigned-clocks which are usually required for
Linux and don't require to handle them in U-Boot.

 assigned-clocks = <&cru HCLK_SD>;

So, mark them as empty in clock otherwise device probe on
those SD controllers would fail.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoarm64: dts: rk3399-evb: Move u-boot properties into -u-boot.dtsi
Jagan Teki [Tue, 28 Apr 2020 10:00:15 +0000 (15:30 +0530)]
arm64: dts: rk3399-evb: Move u-boot properties into -u-boot.dtsi

Move U-Boot specific properties into rk3399-evb u-boot
specific dtsi file.

This would help to sync the devicetrees from Linux whenever
required instead of adding specific nodes.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoarm64: dts: rk3399-puma: Move u-boot properties into -u-boot.dtsi
Jagan Teki [Tue, 28 Apr 2020 10:00:14 +0000 (15:30 +0530)]
arm64: dts: rk3399-puma: Move u-boot properties into -u-boot.dtsi

Move U-Boot specific properties into rk3399-puma u-boot
specific dtsi file.

This would help to sync the devicetrees from Linux whenever
required instead of adding specific nodes.

Cc: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: dts: rock64: Fix XHCI usage
Chen-Yu Tsai [Mon, 27 Apr 2020 06:52:54 +0000 (14:52 +0800)]
rockchip: dts: rock64: Fix XHCI usage

If the VBUS regulator is always-on, XHCI will fail to detect USB 3.0
devices; USB 2.0 devices will work however.

Make the VBUS regulator controllable and tie it to only the XHCI. This
makes all three USB ports usable.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: rk3328: Add support for ROC-RK3328-CC board
Chen-Yu Tsai [Mon, 27 Apr 2020 06:52:53 +0000 (14:52 +0800)]
rockchip: rk3328: Add support for ROC-RK3328-CC board

The ROC-RK3328-CC from Firefly and Libre Computer Project is a credit
card size development board based on the Rockchip RK3328 SoC, with:

  - 1/2/4 GB DDR4 DRAM
  - eMMC connector for optional module
  - micro SD card slot
  - 1 x USB 3.0 host port
  - 2 x USB 2.0 host port
  - 1 x USB 2.0 OTG port
  - HDMI video output
  - TRRS connector with audio and composite video output
  - gigabit Ethernet
  - consumer IR receiver
  - debug UART pins

The ROC-RK3328-CC has the enable pin of the SD card power switch tied
to GPIO_0_D6. This pin also has the function SDMMC0_PWREN, which is
muxed by default. SDMMC0_PWREN is an active high signal controlled by
the MMC controller, however the switch enable is active low, and
pulled low (enabled) by default to make things work on boot.

As such, we need to mux away from SDMMC0_PWREN and use GPIO to enable
power to the card. The default GPIO state for the pin is pull-down and
input, which doesn't require extra configuration when paired with the
external pull-down and active low switch.

Deal with this by enabling regulator support in SPL, and setting
"u-boot,dm-spl" for the regulator and other device nodes needed for
muxing the pin.

The device tree file is synced from the Linux kernel next-20200324.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: dts: rk3328: Sync device tree files from Linux
Chen-Yu Tsai [Mon, 27 Apr 2020 06:52:52 +0000 (14:52 +0800)]
rockchip: dts: rk3328: Sync device tree files from Linux

This syncs rk3328 device tree files from the Linux kernel next-20200324.
The last commit to touch these files is:

    b2411befed60 ("arm64: dts: add bus to rockchip amba nodenames")

Additional changes not yet in the Linux kernel include:

    arm64: dts: rockchip: rk3328: drop #address-cells, #size-cells from grf node
    arm64: dts: rockchip: rk3328: drop non-existent gmac2phy pinmux options
    arm64: dts: rockchip: rk3328: Replace RK805 PMIC node name with "pmic"

Changes include:

  - conversion of raw pin numbers to macros
  - removal of deprecated RK_FUNC_* macros
  - update of device tree binding headers
  - new devices
  - device tree cleanups
  - gmac2phy disabled in -u-boot.dtsi as it is not supported in U-boot

This includes a re-ordering of the USB device nodes compared to upstream
Linux, moving the dwc2 OTG controller after the EHCI/OHCI nodes. This is
currently required as otherwise the dwc2 controller would not be able to
detect devices in some cases. This may be due to lack of USB PHY support
in U-boot.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
4 years agorockchip: rk3328: Disable generic PHY support
Chen-Yu Tsai [Mon, 27 Apr 2020 06:52:51 +0000 (14:52 +0800)]
rockchip: rk3328: Disable generic PHY support

The USB PHYs on the RK3328 aren't supported, nor are any other generic
PHYs. Because upstream Linux device trees already include the USB PHYs
and references in the USB hosts, this would result in various calls
to the generic PHY API to fail.

Instead, just disable generic PHY support for now.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agodt-bindings: power: rk3328-power: sync from upstream Linux kernel
Chen-Yu Tsai [Mon, 27 Apr 2020 06:52:50 +0000 (14:52 +0800)]
dt-bindings: power: rk3328-power: sync from upstream Linux kernel

This syncs the rk3328 power domain header file from Linux kernel
next-20200324, to support newer hardware blocks when syncing the
device tree files.

The last non-merge commit to touch it was

    b24413180f56 ("License cleanup: add SPDX GPL-2.0 license identifier to files with no license")

Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Tested-by: Loic Devulder <ldevulder@suse.com>
Tested-by: Peter Geis <pgwipeout@gmail.com>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
4 years agodt-bindings: clock: rk3328: sync from upstream Linux kernel
Chen-Yu Tsai [Mon, 27 Apr 2020 06:52:49 +0000 (14:52 +0800)]
dt-bindings: clock: rk3328: sync from upstream Linux kernel

This syncs the rk3328 clock header file from Linux kernel next-20200324,
to support newer hardware blocks when syncing the device tree files.

The last non-merge commit to touch it was

    0dc14b013f79 ("clk: rockchip: add clock id for watchdog pclk on rk3328")

Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Tested-by: Loic Devulder <ldevulder@suse.com>
Tested-by: Peter Geis <pgwipeout@gmail.com>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
4 years agorockchip: dts: rk3328: Move OTG node's hnp-srp-disable to rk3328-u-boot.dtsi
Chen-Yu Tsai [Mon, 27 Apr 2020 06:52:48 +0000 (14:52 +0800)]
rockchip: dts: rk3328: Move OTG node's hnp-srp-disable to rk3328-u-boot.dtsi

The "hnp-srp-disable" property for dwc2 is specific to U-boot, not part
of upstream Linux's device tree bindings.

Move it to rk3328-u-boot.dtsi to avoid losing it when syncing device
tree files.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: dts: rk3328-evb: Move gmac2io related nodes to -u-boot.dtsi
Chen-Yu Tsai [Mon, 27 Apr 2020 06:52:47 +0000 (14:52 +0800)]
rockchip: dts: rk3328-evb: Move gmac2io related nodes to -u-boot.dtsi

The device tree file for rk3328-evb in the Linux kernel does not have
gmac2io enabled. Instead, gmac2phy is enabled, but that is not supported
in U-boot.

Move the gmac2io related nodes to rk3328-evb-u-boot.dtsi to preserve the
current functionality. When the device tree files are synced, gmac2phy
should be marked as "broken" in -u-boot.dtsi files.

Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Tested-by: Loic Devulder <ldevulder@suse.com>
Tested-by: Peter Geis <pgwipeout@gmail.com>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
4 years agorockchip: dts: rk3328-evb: Move vcc5v0-host-xhci-drv to -u-boot.dtsi
Chen-Yu Tsai [Mon, 27 Apr 2020 06:52:46 +0000 (14:52 +0800)]
rockchip: dts: rk3328-evb: Move vcc5v0-host-xhci-drv to -u-boot.dtsi

USB 3.0 is only supported in U-boot, not in the Linux kernel where the
device tree files are ultimately synced from. While the xhci node was
moved, the external vbus regulator was not.

Move it as well.

Fixes: 2e91e2025c1b ("rockchip: rk3328: migrate u-boot node to -u-boot.dtsi")
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Tested-by: Loic Devulder <ldevulder@suse.com>
Tested-by: Peter Geis <pgwipeout@gmail.com>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
4 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-spi
Tom Rini [Thu, 30 Apr 2020 22:05:15 +0000 (18:05 -0400)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-spi

- distro boot support for SPI flash
- sifive spi flash driver

4 years agoMerge tag 'efi-2020-07-rc2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Thu, 30 Apr 2020 19:11:06 +0000 (15:11 -0400)]
Merge tag 'efi-2020-07-rc2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for efi-2020-07-rc2

This pull request contains bug fixes needed due to the merged changes for
EFI secure boot.

Patches are supplied to identify EFI system partitions.

4 years agosifive: fu540: Enable spi-nor flash support
Jagan Teki [Wed, 29 Apr 2020 15:33:53 +0000 (21:03 +0530)]
sifive: fu540: Enable spi-nor flash support

HiFive Unleashed A00 support is25wp256 spi-nor flash,
So enable the same and add test result log for future
reference.

Tested on SiFive FU540 board.

Thanks to Sagar for various use cases and tests.

[QUAD mode in dt with spi-tx-bus-width: <4>]
 pp opcode      = 0x34 [QUAD MODE]
 read opcode  = 0x6c  [QUAD MODE]
 erase opcode = 0x21

SPI-NOR:
1. erase entire flash: Pass
2. write entire flash: Pass
3. read entire flash: Pass
4. cmp 32MiB read back data: Pass
5. MMC: Booted Linux and dtb from mmc

[SPI MODE in dt with spi-tx-bus-width: <1>]
pp opcode     = 0x12 [SPI MODE]
read opcode  = 0xc   [SPI MODE]
erase opcode = 0x21

SPI-NOR:
1. erase entire flash: Pass
2. write entire flash: Pass
3. read entire flash: Pass
4. cmp 32MiB read back data: Pass
5. MMC: Booted Linux and dtb from mmc

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Sagar Kadam <sagar.kadam@sifive.com>
4 years agoriscv: dts: hifive-unleashed-a00: Add -u-boot.dtsi
Jagan Teki [Thu, 23 Apr 2020 17:00:56 +0000 (22:30 +0530)]
riscv: dts: hifive-unleashed-a00: Add -u-boot.dtsi

Add U-Boot specific dts file for hifive-unleashed-a00, this
would help to add u-boot specific properties and other node
changes without touching the base dts(i) files which are easy
to sync from Linux.

Added spi2 alias for qspi2 as an initial u-boot specific
property change.

spi probing in current dm model is very much rely on aliases
numbering. Even though the qspi2 can't come under any associated
spi nor flash it would require to specify the same to make proper
binding happen for other spi slaves.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Sagar Kadam <sagar.kadam@sifive.com>
4 years agospi: sifive: Fix QPP transfer
Jagan Teki [Thu, 23 Apr 2020 17:00:55 +0000 (22:30 +0530)]
spi: sifive: Fix QPP transfer

The guessed reason is that the existing logic of filling
tx fifo with data, rx fifo with NULL for tx transfer and
filling rx fifo with data, tx fifo with NULL for rx transfer
is not clear enough to support the Quad Page Program.
   
SiFive SPI controllers have specific sets of watermark
registers and SPI I/O directions bits in order to program
SPI controllers clear enough to support all sets of operating
modes.
   
Here is the exact programing sequence that would follow on this
patch and tested via SPI-NOR and MMC_SPI.
   
- set the frame format proto, endian
- set the frame format dir, set it for tx and clear it for rx
- TX transfer:
  fill tx fifo with data.
  wait for TX watermark bit to clear.
- RX transfer:
  fill tx fifo with 0xff.
  write nbytes to rx watermark register
  wait for rx watermark bit to clear.
  read the rx fifo data.

So, this patch adopts this program sequence and fixes the existing
I/O direction bit.

Cc: Vignesh R <vigneshr@ti.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Tested-by: Sagar Kadam <sagar.kadam@sifive.com>
4 years agospi: sifive: Fix format register proto field
Jagan Teki [Thu, 23 Apr 2020 17:00:54 +0000 (22:30 +0530)]
spi: sifive: Fix format register proto field

SiFive SPI controller has a proto bit field in frame format
register which would be used to configure the SPI I/O protocol
lines used on specific transfer. 

Right now the driver is configuring this proto using slave->mode,
for all types of transctions. This makes the driver unable to
function since the proto needs to configure dynamically for
each and every transaction separately at runtime.

Now, the controller driver supports per transfer via spi-mem
exec_opo, so add the fmt_proto flag and fill the per transfer
buswidth so that the controller configures the proto bit at
runtime.

This patch fixes the SPI controller works with SPI NOR flash
on quad read with page program.

Cc: Vignesh R <vigneshr@ti.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Tested-by: Sagar Kadam <sagar.kadam@sifive.com>
4 years agospi: sifive: Add spi-mem exec op
Jagan Teki [Thu, 23 Apr 2020 17:00:53 +0000 (22:30 +0530)]
spi: sifive: Add spi-mem exec op

SiFive SPI controller is responsible to handle the
slave devices like mmc spi and spi nor flash.

The controller is designed such a way that it would
handle the slave transactions based on the I/O protocol
numbers, example if spi nor slave send quad write opcode
it has to send alone with I/O protocol number of 4 and
if it try to send data it has to send I/O protocol number
along with 4 line data.

But the current spi-xfer code from spi-mem is combining
the opcode and address in a single transaction, so the
SPI controller will be unable to identify the I/O protocol
number of opcode vs address.

So, add the spi-mem exec_op with spi-xfer of opcode, address
and data as a separate transaction. This doesn't remove
the .xfer of dm_spi_ops since mmc spi will make use of it.

Note: This code might have moved to the spi-mem core area
once we have done the dedicated tests on other controllers
and have real reason to move.

Cc: Vignesh R <vigneshr@ti.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Tested-by: Sagar Kadam <sagar.kadam@sifive.com>
4 years agomtd: spi-nor-ids: Add Spansion s25fs512s flash entry
Kuldeep Singh [Fri, 3 Apr 2020 06:57:42 +0000 (12:27 +0530)]
mtd: spi-nor-ids: Add Spansion s25fs512s flash entry

Spansion "s25fs512s" flash is incorrectly decoded as "s25fl512s" on
various platforms as former is not present. Add the entry.

Linux already has both the flashes present. A snippet below:
{ "s25fl512s",  INFO6(0x010220, 0x4d0080, 256 * 1024, 256...},
{ "s25fs512s",  INFO6(0x010220, 0x4d0081, 256 * 1024, 256...},

Signed-off-by: Kuldeep Singh <kuldeep.singh@nxp.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>