platform/kernel/u-boot.git
4 years agoMerge tag 'efi-2020-10-rc1' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi...
Tom Rini [Sun, 5 Jul 2020 22:13:12 +0000 (18:13 -0400)]
Merge tag 'efi-2020-10-rc1' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi into next

Pull request for UEFI sub-system for efi-2020-10-rc1

This series comprises error corrections for the UEFI subsystem:

* correct consideration of timestamps for variable authentication
* correct collection of data regions for code authentication
* correct unit tests to test loading dbx
* enable FAT_WRITE as required by the UEFI spec

The boot manager uses log functions instead of printf() and debug().

The UEFI intialization state is exported.

4 years agoMerge branch '2020-07-01-kconfig-etc-updates' into next
Tom Rini [Sun, 5 Jul 2020 22:03:32 +0000 (18:03 -0400)]
Merge branch '2020-07-01-kconfig-etc-updates' into next

- Resync Kconfiglib with the v14.1.0 release.
- Re-sync our <linux/compiler*h> files with v5.7-rc5 from upstream.
- Fully resync checkpatch.pl with v5.7 release.

To safely to all of the above, we have a few bugfixes about functions
that need a 'static inline' but weren't.  We also stop setting
CROSS_COMPILE in arch/*/config.mk.  Finally, with the above changes
boards can now opt-in to optimizing inlining and we do this for the
socfpga stratix10 platform for space savings.

4 years agoefi_loader: imply FAT, FAT_WRITE
Heinrich Schuchardt [Sat, 21 Mar 2020 19:45:50 +0000 (20:45 +0100)]
efi_loader: imply FAT, FAT_WRITE

The UEFI spec requires support for the FAT file system.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: export initialization state
Heinrich Schuchardt [Thu, 19 Mar 2020 18:21:58 +0000 (18:21 +0000)]
efi_loader: export initialization state

Export the UEFI sub-system initialization state. This will allow to treat
the setting of UEFI variables during and after initialization differently.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: rtc_mktime() called twice
Heinrich Schuchardt [Tue, 30 Jun 2020 10:02:14 +0000 (12:02 +0200)]
efi_loader: rtc_mktime() called twice

Don't call rtc_mktime() twice with the same argument in
efi_variable_authenticate().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: use log function in boot manager
Heinrich Schuchardt [Sun, 31 May 2020 08:07:31 +0000 (10:07 +0200)]
efi_loader: use log function in boot manager

When booting via the boot manager use log function for user messages
instead of printf() and debug().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: time based authentication
Heinrich Schuchardt [Wed, 1 Jul 2020 13:32:47 +0000 (15:32 +0200)]
efi_loader: time based authentication

When overwriting an existing time base authenticated variable we should
compare to the preceding time value and not to the start of the epoch.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: add missing validation of timestamp
Heinrich Schuchardt [Wed, 1 Jul 2020 10:44:00 +0000 (12:44 +0200)]
efi_loader: add missing validation of timestamp

The UEFI specification requires that when UEFI variables are set using time
based authentication we have to check that unused fields of the timestamp
are zero

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agotest: provide tests for efi_image_region_add()
Heinrich Schuchardt [Wed, 1 Jul 2020 18:01:53 +0000 (20:01 +0200)]
test: provide tests for efi_image_region_add()

Provide unit tests for efi_image_region_add().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: fix efi_image_region_add()
Heinrich Schuchardt [Wed, 1 Jul 2020 18:01:52 +0000 (20:01 +0200)]
efi_loader: fix efi_image_region_add()

Use start and end address consistently as half-open interval.
Simplify the code.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agotest: correct time stamps for UEFI authentication
Heinrich Schuchardt [Thu, 2 Jul 2020 06:25:46 +0000 (08:25 +0200)]
test: correct time stamps for UEFI authentication

A time authenticated variable cannot be overwritten with another value
with the same time stamp. So we must ensure the correct sequence of time
stamps when generating out test data.

Using parameter -t for sign-efi-sig-list gives reproducible results and
avoids sleep statements.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agotest/py: efi_secboot: fix test case 1g of test_authvar
AKASHI Takahiro [Tue, 9 Jun 2020 05:09:43 +0000 (14:09 +0900)]
test/py: efi_secboot: fix test case 1g of test_authvar

In the test case (1g) of test_authvar, "db" is mistakenly used,
and it ends up being the exact same as (1f).
So correct it as "dbx" test case.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agotest/py: efi_secboot: remove all "re.search"
AKASHI Takahiro [Tue, 9 Jun 2020 05:09:42 +0000 (14:09 +0900)]
test/py: efi_secboot: remove all "re.search"

Currently, we don't use any regular expression in matching outputs from
U-Boot. Since its use is just redundant, we can remove all.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: image_loader: replace debug to EFI_PRINT
AKASHI Takahiro [Tue, 9 Jun 2020 05:09:35 +0000 (14:09 +0900)]
efi_loader: image_loader: replace debug to EFI_PRINT

Just for style consistency, replace all the uses of debug() to
EFI_PRINT() in efi_image_loader.c.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: variable: replace debug to EFI_PRINT
AKASHI Takahiro [Tue, 9 Jun 2020 05:09:34 +0000 (14:09 +0900)]
efi_loader: variable: replace debug to EFI_PRINT

Just for style consistency, replace all the uses of debug() to
EFI_PRINT in efi_variable.c.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: signature: replace debug to EFI_PRINT
AKASHI Takahiro [Tue, 9 Jun 2020 05:09:33 +0000 (14:09 +0900)]
efi_loader: signature: replace debug to EFI_PRINT

Just for style consistency, replace all the uses of debug to
EFI_PRINT in efi_signature.c

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoRevert "test: stabilize test_efi_secboot"
AKASHI Takahiro [Tue, 9 Jun 2020 05:09:32 +0000 (14:09 +0900)]
Revert "test: stabilize test_efi_secboot"

This reverts commit 5827c2545849441dd60467565aac11964259972f.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: change efi objects initialization order
AKASHI Takahiro [Tue, 9 Jun 2020 05:09:31 +0000 (14:09 +0900)]
efi_loader: change efi objects initialization order

The simplest solution to revert the commit b32ac16f9a32 ("test/py: fix
test_efi_secboot/conftest.py") is to move efi_console_register()
forward before efi_disk_register().

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed by: Heinrich Schuchardt <xypron.glpk@gmx.de>

4 years agoMerge branch 'next' of https://gitlab.denx.de/u-boot/custodians/u-boot-riscv into...
Tom Rini [Thu, 2 Jul 2020 13:53:34 +0000 (09:53 -0400)]
Merge branch 'next' of https://gitlab.denx.de/u-boot/custodians/u-boot-riscv into next

- Add Sipeed Maix support
- Update clock handler and proper cpu features

4 years agocheckpatch.pl: Fully re-sync with v5.7
Tom Rini [Tue, 16 Jun 2020 14:29:46 +0000 (10:29 -0400)]
checkpatch.pl: Fully re-sync with v5.7

While commit 048a648298b1 ("checkpatch.pl: Update to v5.7") largely
re-syncs us with checkpatch.pl from v5.7 there are a number of things
missing still.  Re-copy the script and again take care to keep our
allowed debug prints and now localized checks intact.

Fixes: 048a648298b1 ("checkpatch.pl: Update to v5.7")
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agokconfig: show compiler version text in the top comment
Tom Rini [Mon, 18 May 2020 18:48:00 +0000 (14:48 -0400)]
kconfig: show compiler version text in the top comment

This is a side-port of commit 21c54b774744 ("kconfig: show compiler
version text in the top comment") from Linux:

"The kernel configuration phase is now tightly coupled with the compiler
in use.  It will be nice to show the compiler information in Kconfig."

We have already had the required makefile logic for this and had not
included printing the value in various user and file visible places.

Cc: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agosocfpga: Enable optimized inlining on stratix10
Tom Rini [Thu, 14 May 2020 12:30:09 +0000 (08:30 -0400)]
socfpga: Enable optimized inlining on stratix10

Enable the new CONFIG_OPTIMIZE_INLINING and CONFIG_SPL_OPTIMIZE_INLINING
options for this platform.  With gcc-9.2 from kernel.org this saves us
1784 bytes in U-Boot and 80 bytes in SPL.

Cc: Marek Vasut <marex@denx.de>
Cc: Chin-Liang See <chin.liang.see@intel.com>
Cc: Dinh Nguyen <dinh.nguyen@intel.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Acked-by: Marek Vasut <marex@denx.de>
4 years agocompilers: Introduce options for forcing inlining on SPL/TPL
Tom Rini [Thu, 14 May 2020 12:30:08 +0000 (08:30 -0400)]
compilers: Introduce options for forcing inlining on SPL/TPL

There are cases where when we allow the compiler to decide about making
inline decisions rather than forcing them it can save us space.

For now, we keep the default values for inlining that we have had
historically.

Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agocompiler_types.h: Re-introduce CONFIG_OPTIMIZE_INLINING for U-Boot
Tom Rini [Thu, 14 May 2020 12:30:07 +0000 (08:30 -0400)]
compiler_types.h: Re-introduce CONFIG_OPTIMIZE_INLINING for U-Boot

In the Linux kernel, support for forcing inline functions to be made
inline, rather than allowing the compiler to make its own choice has
been removed.  With respect to performance, modern GCC (and Clang) do a
good job at deciding when to, or not to, inline code and there are no
run-time requirements in Linux anymore.

There is one downside to this, which is final binary size.  On average
in U-Boot removing this support grows SPL by almost 1 kilobyte.  But
there are cases where it shrinks the binary by making better inline
choices than we had forced.

Start by re-introducing CONFIG_OPTIMIZE_INLINING as a global which
essentially reverts 889b3c1245de ("compiler: remove CONFIG_OPTIMIZE_INLINING entirely")
from Linux.

Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agocompiler*.h: sync include/linux/compiler*.h with Linux 5.7-rc5
Tom Rini [Thu, 14 May 2020 12:30:06 +0000 (08:30 -0400)]
compiler*.h: sync include/linux/compiler*.h with Linux 5.7-rc5

Copy these from Linux v5.7-rc5 tag.

This brings in some handy new attributes and is otherwise important to
keep in sync.

We drop the reference to smp_read_barrier_depends() as it is not
relevant on the architectures we support at this time, based on where
it's implemented in Linux today.  We drop the call to kasan_check_read()
as that is not relevant to U-Boot as well.

Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agopci: rockchip: Mark inline functions as static inline
Tom Rini [Wed, 1 Jul 2020 15:46:45 +0000 (11:46 -0400)]
pci: rockchip: Mark inline functions as static inline

Unless we mark the function as 'static inline' it may end up being
non-inlined by the compiled and result in duplicate functions.

Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agosocfpga: Mark socfpga_fpga_add() as static inline in the non-FPGA case
Tom Rini [Thu, 14 May 2020 12:30:05 +0000 (08:30 -0400)]
socfpga: Mark socfpga_fpga_add() as static inline in the non-FPGA case

Unless we mark the function as 'static inline' it may end up being
non-inlined by the compiled and result in duplicate functions.

Cc: Marek Vasut <marex@denx.de>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Ley Foon Tan <ley.foon.tan@intel.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Acked-by: Marek Vasut <marex@denx.de>
4 years agox86: Convert from ACCESS_ONCE to READ/WRITE_ONCE
Tom Rini [Thu, 14 May 2020 12:30:04 +0000 (08:30 -0400)]
x86: Convert from ACCESS_ONCE to READ/WRITE_ONCE

In order to update our <linux/compiler.h> to a newer version that no
longer provides ACCESS_ONCE() but only READ_ONCE()/WRITE_ONCE() we need
to convert arch/x86/include/asm/atomic.h to the other macros.

Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agotegra: Convert from ACCESS_ONCE to READ/WRITE_ONCE
Tom Rini [Thu, 14 May 2020 12:30:03 +0000 (08:30 -0400)]
tegra: Convert from ACCESS_ONCE to READ/WRITE_ONCE

In order to update our <linux/compiler.h> to a newer version that no
longer provides ACCESS_ONCE() but only READ_ONCE()/WRITE_ONCE() we need
to convert arch/arm/mach-tegra/ivc.c to the other macros.

Cc: Tom Warren <twarren@nvidia.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoDon't start ad-hoc games with -Wno-maybe-initialized
Tom Rini [Thu, 14 May 2020 12:30:02 +0000 (08:30 -0400)]
Don't start ad-hoc games with -Wno-maybe-initialized

Borrowing from Linux commit 78a5255ffb6a ("Stop the ad-hoc games with -Wno-maybe-initialized")
move to have maybe-initialized warnings be handled with building with
W=2 instead of playing more guessing games with newer compilers.

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agokconfig: Add scripts/Kconfig.include from v4.19
Tom Rini [Thu, 14 May 2020 12:30:01 +0000 (08:30 -0400)]
kconfig: Add scripts/Kconfig.include from v4.19

As part of re-syncing our Kconfig logic up to v4.19, we had missed
adding this new file that includes helper macros.  To quote the upstream
commit e1cfdc0e72fc ("kconfig: add basic helper macros to scripts/Kconfig.include"):

Kconfig got text processing tools like we see in Make.  Add Kconfig
helper macros to scripts/Kconfig.include like we collect Makefile
macros in scripts/Kbuild.include.

Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agokconfiglib: Update to the 14.1.0 release
Tom Rini [Thu, 14 May 2020 12:30:00 +0000 (08:30 -0400)]
kconfiglib: Update to the 14.1.0 release

A large number of changes have happened upstream since our last sync
in commit 65e05ddc1ae2 ("kconfiglib: Update to the 12.14.0 release").

The big motivation for this sync is support for user defined macros
within Kconfig.

Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoRemove CROSS_COMPILE default from arch/*/config.mk
Tom Rini [Tue, 19 May 2020 14:32:33 +0000 (10:32 -0400)]
Remove CROSS_COMPILE default from arch/*/config.mk

In order to support the compiler providing information used within
Kconfig itself we cannot have the compiler be determined by
arch/*/config.mk as we will not be able to evaluate that yet.  Given
that most documentation tells people to specify CROSS_COMPILE, remove
these references.

Cc: Huan Wang <alison.wang@nxp.com>
Cc: Angelo Dureghello <angelo@sysam.it>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Rick Chen <rick@andestech.com>
Cc: Thomas Chou <thomas@wytron.com.tw>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Michal Simek <michal.simek@xilinx.com>
4 years agoriscv: cpu: check and append L1 cache to cpu features
Sagar Shrikant Kadam [Sun, 28 Jun 2020 14:45:03 +0000 (07:45 -0700)]
riscv: cpu: check and append L1 cache to cpu features

All cpu cores within FU540-C000 having split I/D caches.
Set the L1 cache feature bit using the i-cache-size or d-cache-size
as one of the property from device tree indicating that L1 cache is
present on the cpu core.

=> cpu detail
  1: cpu@1      rv64imafdc
        ID = 1, freq = 999.100 MHz: L1 cache, MMU
  2: cpu@2      rv64imafdc
        ID = 2, freq = 999.100 MHz: L1 cache, MMU
  3: cpu@3      rv64imafdc
        ID = 3, freq = 999.100 MHz: L1 cache, MMU
  4: cpu@4      rv64imafdc
        ID = 4, freq = 999.100 MHz: L1 cache, MMU

Signed-off-by: Sagar Shrikant Kadam <sagar.kadam@sifive.com>
Reviewed-by: Pragnesh Patel <Pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
4 years agoriscv: cpu: correctly handle the setting of CPU_FEAT_MMU bit
Sagar Shrikant Kadam [Sun, 28 Jun 2020 14:45:02 +0000 (07:45 -0700)]
riscv: cpu: correctly handle the setting of CPU_FEAT_MMU bit

The conditional check to read "mmu-type" from the device tree
is not rightly handled due to which the cpu feature doesn't include
CPU_FEAT_MMU even if it's corresponding entry is present in the device
tree.

The initialization of cpu features is now taken care in cpu-uclass
driver, so no need to zero out cpu_freq in riscv_cpu driver and can be
removed.

Signed-off-by: Sagar Shrikant Kadam <sagar.kadam@sifive.com>
Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
4 years agouclass: cpu: fix to display proper CPU features
Sagar Shrikant Kadam [Sun, 28 Jun 2020 14:45:01 +0000 (07:45 -0700)]
uclass: cpu: fix to display proper CPU features

The cmd "cpu detail" fetches uninitialized cpu feature information
and thus displays wrong / inconsitent details as below.
For eg: FU540-C000 doesn't have any microcode, yet the cmd display's it.

=> cpu detail
  1: cpu@1      rv64imafdc
        ID = 1, freq = 999.100 MHz: L1 cache, MMU, Microcode, Device ID
        Microcode version 0x0
        Device ID 0x0
  2: cpu@2      rv64imafdc
        ID = 2, freq = 999.100 MHz: L1 cache, MMU, Microcode, Device ID
        Microcode version 0x0
        Device ID 0x0
  3: cpu@3      rv64imafdc
        ID = 3, freq = 999.100 MHz: L1 cache, MMU, Microcode, Device ID
        Microcode version 0x0
        Device ID 0x0
  4: cpu@4      rv64imafdc
        ID = 4, freq = 999.100 MHz: L1 cache, MMU, Microcode, Device ID
        Microcode version 0x0
        Device ID 0x0

The L1 cache or MMU entry seen above is also displayed inconsistently.
So initialize cpu information to zero into cpu-uclass itself so that
similar issues can be avoided for other CPU drivers.

We now see correct features as:
=> cpu detail
  1: cpu@1      rv64imafdc
        ID = 1, freq = 999.100 MHz
  2: cpu@2      rv64imafdc
        ID = 2, freq = 999.100 MHz
  3: cpu@3      rv64imafdc
        ID = 3, freq = 999.100 MHz
  4: cpu@4      rv64imafdc
        ID = 4, freq = 999.100 MHz

Signed-off-by: Sagar Shrikant Kadam <sagar.kadam@sifive.com>
Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
4 years agoriscv: dts: hifive-unleashed-a00: add cpu aliases
Sagar Shrikant Kadam [Sun, 28 Jun 2020 14:45:00 +0000 (07:45 -0700)]
riscv: dts: hifive-unleashed-a00: add cpu aliases

Add cpu aliases to U-Boot specific dtsi for hifive-unleashed.
Without aliases we see that the CPU device sequence numbers are set
randomly and the cpu list/detail command will show it as follows:
=> cpu list
  1: cpu@1      rv64imafdc
  2: cpu@2      rv64imafdc
  3: cpu@3      rv64imafdc
  0: cpu@4      rv64imafdc

Seems like CPU probing with dm-model also relies on aliases as observed
in case spi. The fu540-c000-u-boot.dtsi has cpu nodes and so adding
corresponding aliases we can ensure that cpu devices are assigned
proper sequence as follows:

=> cpu list
  1: cpu@1      rv64imafdc
  2: cpu@2      rv64imafdc
  3: cpu@3      rv64imafdc
  4: cpu@4      rv64imafdc

Signed-off-by: Sagar Shrikant Kadam <sagar.kadam@sifive.com>
Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
4 years agoriscv: Add Sipeed Maix support
Sean Anderson [Wed, 24 Jun 2020 10:41:25 +0000 (06:41 -0400)]
riscv: Add Sipeed Maix support

The Sipeed Maix series is a collection of boards built around the RISC-V
Kendryte K210 processor. This processor contains several peripherals to
accelerate neural network processing and other "ai" tasks. This includes a
"KPU" neural network processor, an audio processor supporting beamforming
reception, and a digital video port supporting capture and output at VGA
resolution. Other peripherals include 8M of sram (accessible with and
without caching); remappable pins, including 40 GPIOs; AES, FFT, and SHA256
accelerators; a DMA controller; and I2C, I2S, and SPI controllers. Maix
peripherals vary, but include spi flash; on-board usb-serial bridges; ports
for cameras, displays, and sd cards; and ESP32 chips. Currently, only the
Sipeed Maix Bit V2.0 (bitm) is supported, but the boards are fairly
similar.

Documentation for Maix boards is located at
<http://dl.sipeed.com/MAIX/HDK/>.  Documentation for the Kendryte K210 is
located at <https://kendryte.com/downloads/>. However, hardware details are
rather lacking, so most technical reference has been taken from the
standalone sdk located at
<https://github.com/kendryte/kendryte-standalone-sdk>.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
4 years agodoc: riscv: Add documentation for Sipeed Maix Bit
Sean Anderson [Wed, 24 Jun 2020 10:41:24 +0000 (06:41 -0400)]
doc: riscv: Add documentation for Sipeed Maix Bit

This patch adds documentation for the Sipeed Maix bit, and more generally
for the Kendryte K210 processor.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
4 years agoriscv: Add device tree for K210 and Sipeed Maix BitM
Sean Anderson [Wed, 24 Jun 2020 10:41:23 +0000 (06:41 -0400)]
riscv: Add device tree for K210 and Sipeed Maix BitM

Where possible, I have tried to find compatible drivers based on the layout
of registers. However, many devices remain untested. All untested devices
have been left disabled, but some tentative properties (such as compatible
strings, and clocks, interrupts, and resets properties) have been added.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
4 years agoriscv: Enable cpu clock if it is present
Sean Anderson [Wed, 24 Jun 2020 10:41:22 +0000 (06:41 -0400)]
riscv: Enable cpu clock if it is present

The cpu clock is probably already enabled if we are executing code (though
we could be executing from a different core). This patch prevents the cpu
clock or its parents from being disabled.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agoriscv: Try to get cpu frequency from a "clocks" node if it exists
Sean Anderson [Wed, 24 Jun 2020 10:41:21 +0000 (06:41 -0400)]
riscv: Try to get cpu frequency from a "clocks" node if it exists

Instead of always using the "clock-frequency" property to determine cpu
frequency, try using a clock in "clocks" if it exists. This patch also
fixes a bug where there could be spurious higher frequencies if sizeof(u32)
!= sizeof(ulong).

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agoriscv: Allow use of reset drivers
Sean Anderson [Wed, 24 Jun 2020 10:41:20 +0000 (06:41 -0400)]
riscv: Allow use of reset drivers

Currently, one cannot use a reset driver on RISC-V. Follow the MIPS
example, and disable the default reset handler when the sysreset driver is
enabled.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agoriscv: Add option to support RISC-V privileged spec 1.9
Sean Anderson [Wed, 24 Jun 2020 10:41:19 +0000 (06:41 -0400)]
riscv: Add option to support RISC-V privileged spec 1.9

Some older processors (notably the Kendryte K210) use an older version of
the RISC-V privileged specification. The primary changes between the old
and new are in virtual memory, and in the merging of three separate counter
enable CSRs.  Using the new CSR on an old processor causes an illegal
instruction exception.  This patch adds an option to use the old CSRs
instead of the new one.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agoriscv: Clean up IPI initialization code
Sean Anderson [Wed, 24 Jun 2020 10:41:18 +0000 (06:41 -0400)]
riscv: Clean up IPI initialization code

The previous IPI code initialized the device whenever the first call was
made to a riscv_*_ipi function. This made it difficult to determine when
the IPI device was initialized. This patch introduces a new function
riscv_init_ipi. It is called once during arch_cpu_init_dm. In SPL, it is
called in spl_invoke_opensbi. Before this point, no riscv_*_ipi functions
should be called.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
4 years agoriscv: Clear pending interrupts before enabling IPIs
Sean Anderson [Wed, 24 Jun 2020 10:41:17 +0000 (06:41 -0400)]
riscv: Clear pending interrupts before enabling IPIs

On some platforms (k210), the previous stage bootloader may have not
cleared pending IPIs before transferring control to U-Boot. This can cause
race conditions, as multiple harts all attempt to initialize the IPI
controller at once. This patch clears IPIs before enabling them, ensuring
that only one hart modifies shared memory at once.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
4 years agoriscv: Add headers for asm/global_data.h
Sean Anderson [Wed, 24 Jun 2020 10:41:16 +0000 (06:41 -0400)]
riscv: Add headers for asm/global_data.h

This header depended on bd_t and ulong, but did not include the appropriate
headers.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agolib: Always set errno in hcreate_r
Sean Anderson [Wed, 24 Jun 2020 10:41:15 +0000 (06:41 -0400)]
lib: Always set errno in hcreate_r

This could give a confusing error message if it failed and didn't set
errno.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agoreset: Add generic reset driver
Sean Anderson [Wed, 24 Jun 2020 10:41:14 +0000 (06:41 -0400)]
reset: Add generic reset driver

This patch adds a generic reset driver. It is designed to be useful when
one has a register in a regmap which contains bits that reset other
devices. I thought this seemed like a very generic use, so here is a
generic driver. The overall structure has been modeled on the syscon-reboot
driver.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodm: Fix error handling for dev_read_addr_ptr
Sean Anderson [Wed, 24 Jun 2020 10:41:13 +0000 (06:41 -0400)]
dm: Fix error handling for dev_read_addr_ptr

dev_read_addr_ptr had different semantics depending on whether OF_LIVE was
enabled. This patch converts both implementations to return NULL on error,
and converts all call sites which check for FDT_ADDR_T_NONE to check for
NULL instead. This patch also removes the call to map_physmem, since we
have dev_remap_addr* for those semantics.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodm: Add support for simple-pm-bus
Sean Anderson [Wed, 24 Jun 2020 10:41:12 +0000 (06:41 -0400)]
dm: Add support for simple-pm-bus

This type of bus is used in Linux to designate buses which have power
domains and/or clocks which need to be enabled before their child devices
can be used. Because power domains are automatically enabled before probing
in U-Boot, we just need to enable any clocks present.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoclk: Add K210 clock support
Sean Anderson [Wed, 24 Jun 2020 10:41:11 +0000 (06:41 -0400)]
clk: Add K210 clock support

Due to the large number of clocks, I decided to use the CCF. The overall
structure is modeled after the imx code. Clocks parameters are stored in
several arrays, and are then instantiated at run-time. There are some
translation macros (FOOIFY()) which allow for more dense packing.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
CC: Lukasz Majewski <lukma@denx.de>
4 years agoclk: Add a bypass clock for K210
Sean Anderson [Wed, 24 Jun 2020 10:41:10 +0000 (06:41 -0400)]
clk: Add a bypass clock for K210

This is a small driver to do a software bypass of a clock if hardware
bypass is not working. I have tried to write this in a generic fashion, so
that it could be potentially broken out of the kendryte code at some future
date. For the K210, it is used to have aclk bypass pll0 and use in0 instead
so that the CPU keeps on working.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
CC: Lukasz Majewski <lukma@denx.de>
4 years agoclk: Add K210 pll support
Sean Anderson [Wed, 24 Jun 2020 10:41:09 +0000 (06:41 -0400)]
clk: Add K210 pll support

This pll code is primarily based on the code from the kendryte standalone
sdk in lib/drivers/sysctl.c. k210_pll_calc_config is roughly analogous to
the algorithm used to set the pll frequency, but it has been completely
rewritten to be fixed-point based.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
CC: Lukasz Majewski <lukma@denx.de>
4 years agoclk: Fix clk_get_by_* handling of index
Sean Anderson [Wed, 24 Jun 2020 10:41:08 +0000 (06:41 -0400)]
clk: Fix clk_get_by_* handling of index

clk_get_by_index_nodev only ever fetched clock 1, due to passing a boolean
predicate instead of the index. Other clk_get_by_* functions got the clock
correctly, but passed a predicate instead of the index to clk_get_by_tail.
This could lead to confusing error messages.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
CC: Lukasz Majewski <lukma@denx.de>
4 years agoclk: Check that ops of composite clock components exist before calling
Sean Anderson [Wed, 24 Jun 2020 10:41:07 +0000 (06:41 -0400)]
clk: Check that ops of composite clock components exist before calling

clk_composite_ops was shared between all devices in the composite clock
driver.  If one clock had a feature (such as supporting set_parent) which
another clock did not, it could call a null pointer dereference.

This patch does three things
1. It adds null-pointer checks to all composite clock functions.
2. It makes clk_composite_ops const and sets its functions at compile-time.
3. It adds some basic sanity checks to num_parents.

The combined effect of these changes is that any of mux, rate, or gate can
be NULL, and composite clocks will still function normally. Previously, at
least mux had to exist, since clk_composite_get_parent was used to
determine the parent for clk_register.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Acked-by: Lukasz Majewski <lukma@denx.de>
4 years agoclk: Always use the supplied struct clk
Sean Anderson [Wed, 24 Jun 2020 10:41:06 +0000 (06:41 -0400)]
clk: Always use the supplied struct clk

CCF clocks should always use the struct clock passed to their methods for
extracting the driver-specific clock information struct. Previously, many
functions would use the clk->dev->priv if the device was bound. This could
cause problems with composite clocks. The individual clocks in a composite
clock did not have the ->dev field filled in. This was fine, because the
device-specific clock information would be used. However, since there was
no ->dev, there was no way to get the parent clock. This caused the
recalc_rate method of the CCF divider clock to fail. One option would be to
use the clk->priv field to get the composite clock and from there get the
appropriate parent device. However, this would tie the implementation to
the composite clock. In general, different devices should not rely on the
contents of ->priv from another device.

The simple solution to this problem is to just always use the supplied
struct clock. The composite clock now fills in the ->dev pointer of its
child clocks.  This allows child clocks to make calls like clk_get_parent()
without issue.

imx avoided the above problem by using a custom get_rate function with
composite clocks.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Acked-by: Lukasz Majewski <lukma@denx.de>
4 years agoMerge tag 'efi-2020-07-rc6-2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Tue, 30 Jun 2020 21:15:39 +0000 (17:15 -0400)]
Merge tag 'efi-2020-07-rc6-2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for efi-2020-07-rc6 (2)

Fix an incorrect update of the GD register in efi_get_variable_common().
Fix an incorrect check for an FDT reg property.
Fix a device tree used for Python testing.

4 years agoMerge branch '2020-06-30-minor-TI-board-updates' into next
Tom Rini [Tue, 30 Jun 2020 19:03:25 +0000 (15:03 -0400)]
Merge branch '2020-06-30-minor-TI-board-updates' into next

- Minor updates to some platforms I am the listed maintainer of.
  Notably this removes the ti814x_evm which stopped building with the PXA
  MMC migration series (oops) but hasn't been functional in some time.

4 years agoti814x: Remove platform
Tom Rini [Mon, 25 May 2020 18:34:06 +0000 (14:34 -0400)]
ti814x: Remove platform

The TI814x (DM814x) platform is rather old and in need of a lot of
migration work.  As much of that work is well past the deadline, remove
this platform.

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoti816x_evm: Enable DM_MMC
Tom Rini [Mon, 25 May 2020 18:30:36 +0000 (14:30 -0400)]
ti816x_evm: Enable DM_MMC

This platform is already using DM in general and the MMC controller is
the early generation of what is compatible with "ti,omap4-hsmmc" so
enable DM_MMC (which in turn gets BLK enabled).

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoam335x: Update list of defconfigs
Tom Rini [Mon, 25 May 2020 18:28:43 +0000 (14:28 -0400)]
am335x: Update list of defconfigs

Both the am335x_boneblack and am335x_evm_usbspl configs have been gone
for a while, remove their entries from MAINTAINERS.

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoMerge tag 'mips-pull-2020-06-29' of https://gitlab.denx.de/u-boot/custodians/u-boot...
Tom Rini [Tue, 30 Jun 2020 15:43:18 +0000 (11:43 -0400)]
Merge tag 'mips-pull-2020-06-29' of https://gitlab.denx.de/u-boot/custodians/u-boot-mips into next

- net: pcnet: cleanup and add DM support
- Makefile: add rule to build an endian-swapped U-Boot image
  used by MIPS Malta EL variants
- CI: add Qemu tests for MIPS Malta

4 years agoMerge branch '2020-06-30-pxa-dm_mmc-migration' into next
Tom Rini [Tue, 30 Jun 2020 15:14:41 +0000 (11:14 -0400)]
Merge branch '2020-06-30-pxa-dm_mmc-migration' into next

- Migrate the PXA MMC driver to driver model.

4 years agocolibri_pxa270_defconfig: enable dm_mmc
Marcel Ziswiler [Mon, 20 May 2019 00:45:02 +0000 (02:45 +0200)]
colibri_pxa270_defconfig: enable dm_mmc

Enable CONFIG_DM_MMC.

Signed-off-by: Marcel Ziswiler <marcel@ziswiler.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
4 years agocolibri_pxa270: add mmc platform data
Marcel Ziswiler [Mon, 20 May 2019 00:45:01 +0000 (02:45 +0200)]
colibri_pxa270: add mmc platform data

Add MMC platform data.

While at it also fix trivial checkpatch.pl issues.

Signed-off-by: Marcel Ziswiler <marcel@ziswiler.com>
4 years agocolibri_pxa270_defconfig: enable cmd_dm
Marcel Ziswiler [Mon, 20 May 2019 00:45:00 +0000 (02:45 +0200)]
colibri_pxa270_defconfig: enable cmd_dm

Enable CONFIG_CMD_DM.

Signed-off-by: Marcel Ziswiler <marcel@ziswiler.com>
4 years agoarm: pxa: mmc: add driver model support
Marcel Ziswiler [Mon, 20 May 2019 00:44:59 +0000 (02:44 +0200)]
arm: pxa: mmc: add driver model support

Add driver model (DM) support.

Signed-off-by: Marcel Ziswiler <marcel@ziswiler.com>
4 years agokconfig: mmc: move pxa_mmc_generic to kconfig
Marcel Ziswiler [Mon, 20 May 2019 00:44:58 +0000 (02:44 +0200)]
kconfig: mmc: move pxa_mmc_generic to kconfig

Move CONFIG_PXA_MMC_GENERIC to Kconfig.

Signed-off-by: Marcel Ziswiler <marcel@ziswiler.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: gracefully handle alias seq without of
Marcel Ziswiler [Mon, 20 May 2019 00:44:57 +0000 (02:44 +0200)]
dm: core: gracefully handle alias seq without of

Gracefully handle alias seq in the platform data rather than OF case.

Signed-off-by: Marcel Ziswiler <marcel@ziswiler.com>
4 years agoMakefile: allow dm_mmc without of_control
Marcel Ziswiler [Mon, 20 May 2019 00:44:56 +0000 (02:44 +0200)]
Makefile: allow dm_mmc without of_control

Allow for CONFIG_DM_MMC with platform data rather than
CONFIG_OF_CONTROL.

Signed-off-by: Marcel Ziswiler <marcel@ziswiler.com>
4 years agoserial: pxa: clean-up platform data include file
Marcel Ziswiler [Mon, 20 May 2019 00:44:55 +0000 (02:44 +0200)]
serial: pxa: clean-up platform data include file

Clean-up platform data include file by using BIT macro and converting
indentation with spaces to tabs.

Signed-off-by: Marcel Ziswiler <marcel@ziswiler.com>
4 years agommc: add missing space before comment delimiter
Marcel Ziswiler [Mon, 20 May 2019 00:44:53 +0000 (02:44 +0200)]
mmc: add missing space before comment delimiter

Add missing space before a comment delimiter.

Signed-off-by: Marcel Ziswiler <marcel@ziswiler.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
4 years agotest/py: test_efi_fit: Update #size-cells to 1
Bin Meng [Sun, 28 Jun 2020 01:03:17 +0000 (18:03 -0700)]
test/py: test_efi_fit: Update #size-cells to 1

test_efi_fit tests fail on RISC-V currently. This is due to the
RISC-V arch_fixup_fdt() checks the #size-cells of the root node
in order to correctly fix up the reserved memory node.

Per the DT binding, the /reserved-memory node requires both
<#address-cells> and <#size-cells> and they should use the same
values as the root node. For the root node, it's not very useful
if <#size-cells> is zero.

Update #size-cells to 1 so tests can pass.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
4 years agoefi_loader: incorrect check against FDT_ADDR_T_NONE
Heinrich Schuchardt [Tue, 30 Jun 2020 12:12:43 +0000 (14:12 +0200)]
efi_loader: incorrect check against FDT_ADDR_T_NONE

With commit 0d7c2913fdf7 ("cmd: bootefi: Honor the address & size cells
properties correctly") addr was replaced by fdt_addr. But not in the check
against FDT_ADDR_T_NONE.

Fixes: 0d7c2913fdf7 ("cmd: bootefi: Honor the address & size cells properties
correctly")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years ago.azure-pipelines.yml: add Qemu tests for MIPS Malta board
Daniel Schwierzeck [Sat, 6 Jun 2020 20:21:47 +0000 (22:21 +0200)]
.azure-pipelines.yml: add Qemu tests for MIPS Malta board

Add Qemu tests for the MIPS Malta machine as a replacement for
the deprecated generic MIPS machine.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
4 years ago.travis.yml: add Qemu tests for MIPS Malta board
Daniel Schwierzeck [Sat, 6 Jun 2020 20:21:47 +0000 (22:21 +0200)]
.travis.yml: add Qemu tests for MIPS Malta board

Add Qemu tests for the MIPS Malta machine as a replacement for
the deprecated generic MIPS machine.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
4 years ago.gitlab-ci.yml: add Qemu tests for MIPS Malta board
Daniel Schwierzeck [Sat, 6 Jun 2020 20:21:47 +0000 (22:21 +0200)]
.gitlab-ci.yml: add Qemu tests for MIPS Malta board

Add Qemu tests for the MIPS Malta machine as a replacement for
the deprecated generic MIPS machine.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
4 years agomips: malta: build u-boot-swap.bin
Daniel Schwierzeck [Sat, 6 Jun 2020 20:21:47 +0000 (22:21 +0200)]
mips: malta: build u-boot-swap.bin

The Qemu Malta machine expects the firmware in Big-Endian byte order.
Therefore the Little-Endian variants of the Malta board needs to
be byte swapped.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
4 years agoMakefile: add rule to generate u-boot-swap.bin
Daniel Schwierzeck [Sat, 6 Jun 2020 20:21:47 +0000 (22:21 +0200)]
Makefile: add rule to generate u-boot-swap.bin

This rule generates an u-boot binary file where the byte endianness
is swapped. This will be used by the MIPS Malta Little-Endian variants
to be able to boot with Qemu. The Qemu Malta Machine expects the
firmware in Big-Endian order.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
4 years agotools: add script for byte endianness swapping
Daniel Schwierzeck [Sat, 6 Jun 2020 20:21:47 +0000 (22:21 +0200)]
tools: add script for byte endianness swapping

This can be used to swap the byte endianness of a binary file
from Little-Endian to Big-Endian or vice-versa.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
4 years agonet: pcnet: Add Kconfig entries
Marek Vasut [Sun, 17 May 2020 16:24:25 +0000 (18:24 +0200)]
net: pcnet: Add Kconfig entries

Add Kconfig entries for the pcnet driver and convert MIPS malta
to use those.

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: Add DM support
Marek Vasut [Sun, 17 May 2020 16:24:24 +0000 (18:24 +0200)]
net: pcnet: Add DM support

With all the changes in place, add support for DM into the
pcnet driver.

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: Split common and non-DM functions
Marek Vasut [Sun, 17 May 2020 16:24:23 +0000 (18:24 +0200)]
net: pcnet: Split common and non-DM functions

Pull the common parts of functions out so they can be reused by both
DM and non-DM code paths. The recv() function had to be reworked to
fit into this scheme and this means it now only receives one packet
at a time instead of spinning in an endless loop.

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: Wrap name and enetaddr into private data
Marek Vasut [Sun, 17 May 2020 16:24:22 +0000 (18:24 +0200)]
net: pcnet: Wrap name and enetaddr into private data

Instead of using the non-DM-only name and enetaddr in struct eth_device,
add pointers into the private data which can either point to that non-DM
name or a DM one later on.

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: Wrap iobase into private data
Marek Vasut [Sun, 17 May 2020 16:24:21 +0000 (18:24 +0200)]
net: pcnet: Wrap iobase into private data

Instead of using the non-DM-only iobase in struct eth_device, add
one into the private data to make DM and non-DM operation possible.

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: Pass private data through dev->priv
Marek Vasut [Sun, 17 May 2020 16:24:20 +0000 (18:24 +0200)]
net: pcnet: Pass private data through dev->priv

Get rid of the global point to private data, and rather pass it
thought dev->priv. Also remove the unnecessary check for lp being
non-NULL, since it is always NULL at this point.

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: Wrap devbusfn into private data
Marek Vasut [Sun, 17 May 2020 16:24:19 +0000 (18:24 +0200)]
net: pcnet: Wrap devbusfn into private data

Instead of using eth_device priv for this PCI devbusfn, free it
so it could be used for driver private data, and wrap devbusfn
into those driver private data.

Note that using the name dev for the variable is a trick left for
later, when DM support is in place, so dm_pci_virt_to_mem() can be
used with minimal ifdeffery.

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: Drop useless forward declarations
Marek Vasut [Sun, 17 May 2020 16:24:18 +0000 (18:24 +0200)]
net: pcnet: Drop useless forward declarations

Remove those as they are not needed anymore.

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: Move initialize function at the end
Marek Vasut [Sun, 17 May 2020 16:24:17 +0000 (18:24 +0200)]
net: pcnet: Move initialize function at the end

Move the function at the end of the driver, so we could drop
various forward declarations later. No functional change.

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: Move private data allocation to initialize
Marek Vasut [Sun, 17 May 2020 16:24:16 +0000 (18:24 +0200)]
net: pcnet: Move private data allocation to initialize

The private data allocation does not have to be done every time the
NIC is initialized at run time, move the allocation to initialize
function, which means it will be done only once when the driver
starts.

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 memset+malloc with calloc
Marek Vasut [Sun, 17 May 2020 16:24:15 +0000 (18:24 +0200)]
net: pcnet: Replace memset+malloc with calloc

This combination of functions can be replaced with calloc(),
make it so.

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: Simplify private data allocation
Marek Vasut [Sun, 17 May 2020 16:24:14 +0000 (18:24 +0200)]
net: pcnet: Simplify private data allocation

The current code is horribly complex. Both the RX and TX buffer
descriptors are 16 bytes in size, the init block is 32 bytes in
size, so simplify the code such that the entire private data of
the driver are allocated cache aligned and the RX and TX buffer
descriptors are part of the private data.

This removes multiple malloc calls and cache flushes.

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: Use PCI_DEVICE() to define PCI device compat list
Marek Vasut [Sun, 17 May 2020 16:24:13 +0000 (18:24 +0200)]
net: pcnet: Use PCI_DEVICE() to define PCI device compat list

Use this macro to fully fill the PCI device ID table. This is mandatory
for the DM PCI support, which checks all the fields.

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: Drop PCNET_HAS_PROM
Marek Vasut [Sun, 17 May 2020 16:24:12 +0000 (18:24 +0200)]
net: pcnet: Drop PCNET_HAS_PROM

All of one PCNET users has this option set, make this default
and drop this config option.

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: Drop typedef struct pcnet_priv_t
Marek Vasut [Sun, 17 May 2020 16:24:11 +0000 (18:24 +0200)]
net: pcnet: Drop typedef struct pcnet_priv_t

Use struct pcnet_priv all over the place instead.

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 agoMerge branch '2020-06-26-more-Kconfig-migration' into next
Tom Rini [Mon, 29 Jun 2020 19:58:38 +0000 (15:58 -0400)]
Merge branch '2020-06-26-more-Kconfig-migration' into next

- Bring in the first pass at cleaning up config headers that reference
  symbols that already have Kconfig symbols.
- In order to do that, bring in the small series that adds
  CONFIG_SPL_DM_SPI_FLASH and makes more use of CONFIG_$(SPL_TPL_)DM_SPI
  in order to allow for disabling those features in SPL stuff but using
  them in full U-Boot

4 years agoMerge tag 'rockchip-fix' of https://gitlab.denx.de/u-boot/custodians/u-boot-video
Tom Rini [Mon, 29 Jun 2020 19:58:09 +0000 (15:58 -0400)]
Merge tag 'rockchip-fix' of https://gitlab.denx.de/u-boot/custodians/u-boot-video

- fix "Synchronous Abort" when using rk3399 4K HDMI

4 years agospi: Move DM_SPI_FLASH and SPI_FLASH_DATAFLASH to Kconfig (for ls1021aXXX)
Lukasz Majewski [Thu, 4 Jun 2020 15:11:52 +0000 (23:11 +0800)]
spi: Move DM_SPI_FLASH and SPI_FLASH_DATAFLASH to Kconfig (for ls1021aXXX)

This patch moves the CONFIG_DM_SPI_FLASH and CONFIG_SPI_FLASH_DATAFLASH
to be defined in Kconfig, not in board specific header file
(include/configs/<board>.h).

Before this change the CONFIG_DM_SPI_FLASH was not set in .config (so it
was not possible to use CONFIG_IS_ENABLED(DM_SPI_FLASH) in SPI DM/DTS
converted drivers), but it was set in u-boot.cfg file.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
4 years agospi: Move DM_SPI_FLASH to Kconfig (for NXP's ls1043a)
Lukasz Majewski [Thu, 4 Jun 2020 15:11:51 +0000 (23:11 +0800)]
spi: Move DM_SPI_FLASH to Kconfig (for NXP's ls1043a)

This patch fixes issue with defining the DM_SPI_FLASH in the
configs/include/<board.h> instead of enabling this option in Kconfig.

The problem is that CONFIG_IS_ENABLED(DM_SPI_FLASH) shows false as there
is no DM_SPI_FLASH=y in .config (but the define is set in u-boot.cfg).

As a result conversion of DM_SPI_FLASH to using CONFIG_IS_ENABLED() is not
working properly.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>