]> git.sur5r.net Git - u-boot/log
u-boot
6 years agoboard: laird: add WB45N CPU module
Ben Whitten [Thu, 23 Nov 2017 13:47:47 +0000 (13:47 +0000)]
board: laird: add WB45N CPU module

This board is based on the Atmel 9x5 eval board.
Supporting the following features:
 - Boot from NAND Flash
 - Ethernet
 - FIT
 - SPL

Signed-off-by: Ben Whitten <ben.whitten@lairdtech.com>
Signed-off-by: Dan Kephart <dan.kephart@lairdtech.com>
6 years agoenv: suppress a spurious warning with GCC 7.1
Philipp Tomsich [Tue, 21 Nov 2017 22:29:40 +0000 (23:29 +0100)]
env: suppress a spurious warning with GCC 7.1

GCC 7.1 seems to be smart enough to track val through the various
static inline functions, but not smart enough to see that val will
always be initialised when no error is returned.  This triggers
the following warning:
  env/mmc.c: In function 'mmc_get_env_addr':
  env/mmc.c:121:12: warning: 'val' may be used uninitialized in this function [-Wmaybe-uninitialized]

To make it easier for compiler to understand what is going on, let's
initialise val.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agospl: make CONFIG_OF_EMBED pass dts through fdtgrep
Goldschmidt Simon [Tue, 21 Nov 2017 12:29:56 +0000 (12:29 +0000)]
spl: make CONFIG_OF_EMBED pass dts through fdtgrep

Building spl with CONFIG_OF_EMBED enabled results in an error message
on my board: "SPL image too big". This is because the fdtgrep build
step is only executed for CONFIG_OF_SEPARATE.

Fix this by moving the fdtgrep build step ('cmd_fdtgreo') from
scripts/Makefile.spl to dts/Makefile so that the reduced dtb is
available for all kinds of spl builds.

The resulting variable name for the embedded device tree blob changes,
too, which is why common.h and fdtdec.c have tiny changes.

Signed-off-by: Simon Goldschmidt <sgoldschmidt@de.pepperl-fuchs.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoARM: dts: Rename logicpd-toredp-37xx-devkit in U-Boot
Adam Ford [Mon, 20 Nov 2017 15:56:03 +0000 (09:56 -0600)]
ARM: dts: Rename logicpd-toredp-37xx-devkit in U-Boot

In U-Boot, this device tree is compatible with both the Torpedo and
SOM-LV kits.  Let's rename it in the device tree since the U-Boot code and
show a more generic OMAP3 name.  The code auto detects between the two and
loads the proper DTB file for Linux.  This would eliminate the SOM-LV showing
the name Torpedo during boot and hopefully eliminate some confusion.

Signed-off-by: Adam Ford <aford173@gmail.com>
6 years agofs: avoid possible NULL dereference in fs_devread
Heinrich Schuchardt [Sun, 19 Nov 2017 22:49:21 +0000 (23:49 +0100)]
fs: avoid possible NULL dereference in fs_devread

It is unwise to first dereference a variable
and then to check if it was NULL.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Marek Behun <marek.behun@nic.cz>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
6 years agocmd: blk: remove unreachable code
Heinrich Schuchardt [Sun, 19 Nov 2017 22:25:32 +0000 (23:25 +0100)]
cmd: blk: remove unreachable code

Remove an unreachable return statement.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
6 years agocommon: command: tempory buffer should have size of command line buf
Heinrich Schuchardt [Sun, 19 Nov 2017 22:07:50 +0000 (23:07 +0100)]
common: command: tempory buffer should have size of command line buf

When copying the command line buffer the target array should
at least have the same size.

Cf. definition of console_buffer in common/cli_readline.c.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
6 years agodisk: efi: correct the allocation size for mbr header in stack
Patrick Delaunay [Fri, 17 Nov 2017 09:08:18 +0000 (10:08 +0100)]
disk: efi: correct the allocation size for mbr header in stack

use ALLOC_CACHE_ALIGN_BUFFER_PAD for mbr header allocation
in stack to fix alloc issue in is_gpt_valid()

this patch fix also issue for GPT partition handling
with blocksize != 512 in set_protective_mbr()

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
6 years agoboard: atmel: add sama5d2_ptc_ek board
Ludovic Desroches [Fri, 17 Nov 2017 06:57:12 +0000 (14:57 +0800)]
board: atmel: add sama5d2_ptc_ek board

Add the SAMA5D2 PTC EK board and remove the SAMA5D2 PTC ENGI board
which was a prototype.

Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Signed-off-by: Wenyou Yang <wenyou.yang@microchip.com>
6 years agoARM: at91: add sama5d2 smc header
Ludovic Desroches [Fri, 17 Nov 2017 06:57:11 +0000 (14:57 +0800)]
ARM: at91: add sama5d2 smc header

Add a header for SAMA5D2 SMC since it's not compatible with
SAMA5D3 one.

Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
[wenyou: fix the wrong base address of the SMC register]
Signed-off-by: Wenyou Yang <wenyou.yang@microchip.com>
6 years agommc: atmel_sdhci: not on capabilities to set gck rate
Ludovic Desroches [Fri, 17 Nov 2017 06:51:27 +0000 (14:51 +0800)]
mmc: atmel_sdhci: not on capabilities to set gck rate

The capabilities have default values which doesn't reflect the reality
when it concerns the base clock and the mul value. Use a fixe rate
for the gck. 240 MHz is an arbitrary choice, it is a multiple of the
maximum SD clock frequency handle by the controller and it allows to
get a 400 kHz clock for the card initialisation.

Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Signed-off-by: Wenyou Yang <wenyou.yang@microchip.com>
6 years agoclk: at91: clk-generated: fix incorrect index of clk source
Wenyou Yang [Fri, 17 Nov 2017 06:50:22 +0000 (14:50 +0800)]
clk: at91: clk-generated: fix incorrect index of clk source

Differentiate the generic clock source selection value from the parent
clock index to fix the incorrect assignment of the generic clock
source selection.

Signed-off-by: Wenyou Yang <wenyou.yang@microchip.com>
6 years agoclk: at91: clk-generated: select absolute closest rate
Ludovic Desroches [Fri, 17 Nov 2017 06:50:21 +0000 (14:50 +0800)]
clk: at91: clk-generated: select absolute closest rate

To get the same behavior as the Linux driver, instead of selecting
the closest inferior rate, select the closest inferior or superior
rate

Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Signed-off-by: Wenyou Yang <wenyou.yang@microchip.com>
6 years agoclk: at91: Kconfig: fix the dependency of AT91_UTMI
Wenyou Yang [Fri, 17 Nov 2017 06:46:43 +0000 (14:46 +0800)]
clk: at91: Kconfig: fix the dependency of AT91_UTMI

What the AT91_UTMI depends on SPL_DM isn't right. AT91_UTMI is not
only used in SPL, also in other place, even if SPL_DM isn't enabled.

Signed-off-by: Wenyou Yang <wenyou.yang@microchip.com>
6 years agomach-stm32: Factorize MPU's region config for STM32 SoCs
Patrice Chotard [Thu, 16 Nov 2017 07:59:21 +0000 (08:59 +0100)]
mach-stm32: Factorize MPU's region config for STM32 SoCs

MPU's region setup can be factorized between STM32F4/F7/H7 SoCs family
and used a common MPU's region config.

Only one exception for STM32H7 which doesn't have device area
located at 0xA000 0000.

For STM32F4, configure_clocks() need to be moved from arch_cpu_init()
to board_early_init_f().

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas Manocha <vikas.manocha@st.com>
6 years agostm32: migrate clock structs in include/stm32_rcc.h
Patrice Chotard [Wed, 15 Nov 2017 12:14:53 +0000 (13:14 +0100)]
stm32: migrate clock structs in include/stm32_rcc.h

In order to factorize code between STM32F4 and STM32F7
migrate all structs related to RCC clocks in include/stm32_rcc.h

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas Manocha <vikas.manocha@st.com>
6 years agoclk: clk_stm32fx: add clock configuration for mmc usage
Patrice Chotard [Wed, 15 Nov 2017 12:14:52 +0000 (13:14 +0100)]
clk: clk_stm32fx: add clock configuration for mmc usage

MMC block needs 48Mhz source clock, for that we choose
to select the SAI PLL.
Update also stm32_clock_get_rate() to retrieve the MMC
clock source needed in MMC driver.

STM32F4 uses a different RCC variant than STM32F7. For STM32F4
sdmmc clocks bit are located into dckcfgr register whereas there
are located into dckcfgr2 registers on STM32F7.
In both registers, bits CK48MSEL and SDMMC1SEL are located at
the same position.

Signed-off-by: Christophe Priouzeau <christophe.priouzeau@st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas Manocha <vikas.manocha@st.com>
6 years agodm: misc: bind STM32F4/F7 clock from rcc MFD driver
Patrice Chotard [Wed, 15 Nov 2017 12:14:51 +0000 (13:14 +0100)]
dm: misc: bind STM32F4/F7 clock from rcc MFD driver

Like STM32H7, now STM32F4/F7 clock drivers are binded by
MFD stm32_rcc driver.
This also allows to add reset support to STM32F4/F7 SoCs family.
As Reset driver is not part of SPL supported drivers, don't bind it
in case of SPL to avoid that stm32_rcc_bind() returns an error.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas Manocha <vikas.manocha@st.com>
6 years agoconfigs: stm32f746-disco: enable MISC/DM_RESET/STM32_RESET and STM32_RCC
Patrice Chotard [Wed, 15 Nov 2017 12:14:50 +0000 (13:14 +0100)]
configs: stm32f746-disco: enable MISC/DM_RESET/STM32_RESET and STM32_RCC

This allows to add rcc MFD support to stm32f746-disco board
This rcc MFD driver manages clock and reset for STM32 SoCs family

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas Manocha <vikas.manocha@st.com>
6 years agoclk: stm32fx: migrate define from rcc.h to driver
Patrice Chotard [Wed, 15 Nov 2017 12:14:49 +0000 (13:14 +0100)]
clk: stm32fx: migrate define from rcc.h to driver

STM32F4 doesn't get rcc.h file, to avoid compilation
issue, migrate RCC related defines from rcc.h to driver
file and remove rcc.h file.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas Manocha <vikas.manocha@st.com>
6 years agoclk: stm32f7: rename clk_stm32f7.c to clk_stm32f.c
Patrice Chotard [Wed, 15 Nov 2017 12:14:48 +0000 (13:14 +0100)]
clk: stm32f7: rename clk_stm32f7.c to clk_stm32f.c

Now that clk_stm32f7.c manages clocks for both STM32F4 and F7 SoCs
rename it to a more generic clk_stm32f.c

Fix also some checkpatch errors/warnings.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas Manocha <vikas.manocha@st.com>
6 years agoclk: stm32f7: add STM32F4 support
Patrice Chotard [Wed, 15 Nov 2017 12:14:47 +0000 (13:14 +0100)]
clk: stm32f7: add STM32F4 support

STM32F4 and STM32F7 RCC clock IP are very similar.
Same driver can be used to managed RCC clock for
these 2 SoCs.

Differences between STM32F4 and F7 will be managed using
different compatible string :
 _ overdrive clock is only supported by STM32F7
 _ different sys_pll_psc parameters can be used between STM32F4
   and STM32F7.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas Manocha <vikas.manocha@st.com>
6 years agoARM: DTS: stm32: update rcc compatible for STM32F746
Patrice Chotard [Wed, 15 Nov 2017 12:14:46 +0000 (13:14 +0100)]
ARM: DTS: stm32: update rcc compatible for STM32F746

Align the RCC compatible string with the one used by kernel.
It will allow to use the same clock driver for STM32F4
and STM32F7 and to manage the differences between the 2 SoCs

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas Manocha <vikas.manocha@st.com>
6 years agoclk: stm32f7: add dedicated STM32F7 compatible string
Patrice Chotard [Wed, 15 Nov 2017 12:14:45 +0000 (13:14 +0100)]
clk: stm32f7: add dedicated STM32F7 compatible string

Add a dedicated stm32f7 compatible string to use clk_stm32f7
driver with both STM32F4 and STM32F7 SoCs.
It will be needed to manage differences between these 2 SoCs.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas Manocha <vikas.manocha@st.com>
6 years agoclk: stm32f7: retrieve PWR base address from DT
Patrice Chotard [Wed, 15 Nov 2017 12:14:44 +0000 (13:14 +0100)]
clk: stm32f7: retrieve PWR base address from DT

PWR IP is used to enable over-drive feature in
order to reach a higher frequency.
Get its base address from DT instead of hard-coded value

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas Manocha <vikas.manocha@st.com>
6 years agoARM: DTS: stm32: add pwrcfg node for stm32f746
Patrice Chotard [Wed, 15 Nov 2017 12:14:43 +0000 (13:14 +0100)]
ARM: DTS: stm32: add pwrcfg node for stm32f746

This node is needed to enable performance mode
when system frequency is set up to 200Mhz.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas Manocha <vikas.manocha@st.com>
6 years agotools: env: Add support for direct read/write UBI volumes
S. Lockwood-Childs [Wed, 15 Nov 2017 07:01:26 +0000 (23:01 -0800)]
tools: env: Add support for direct read/write UBI volumes

Up to now we were able to read/write environment data from/to UBI
volumes only indirectly by gluebi driver. This driver creates NAND MTD
on top of UBI volumes, which is quite a workaroung for this use case.

Add support for direct read/write UBI volumes in order to not use
obsolete gluebi driver.

Forward-ported from this patch:
http://patchwork.ozlabs.org/patch/619305/

Original patch:
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Forward port:
Signed-off-by: S. Lockwood-Childs <sjl@vctlabs.com>
6 years agoMerge git://git.denx.de/u-boot-nds32
Tom Rini [Thu, 30 Nov 2017 03:03:26 +0000 (22:03 -0500)]
Merge git://git.denx.de/u-boot-nds32

6 years agonds32: ftsdc010: Fix SD detech fail on AE3XX.
Rick Chen [Fri, 25 Aug 2017 06:03:00 +0000 (14:03 +0800)]
nds32: ftsdc010: Fix SD detech fail on AE3XX.

AE3XX can not support SD high-speed mode.
SW can work-around by removing HS capibility.

Signed-off-by: Rick Chen <rick@andestech.com>
6 years agonds32: ftsdc010: fix wait status error coding.
Rick Chen [Fri, 25 Aug 2017 06:02:13 +0000 (14:02 +0800)]
nds32: ftsdc010: fix wait status error coding.

Bit of DATA_END and DATA_CRC_OK shall be checked for
returning pass or fail of a request.

Signed-off-by: Rick Chen <rick@andestech.com>
6 years agonds32: board: Support ftsdc010 DM.
Rick Chen [Mon, 28 Aug 2017 08:17:13 +0000 (16:17 +0800)]
nds32: board: Support ftsdc010 DM.

AG101P/AE3XX enable ftsdc010 dm flow.

Signed-off-by: Rick Chen <rick@andestech.com>
6 years agonds32: dts: Support ftsdc010 DM.
Rick Chen [Thu, 1 Jun 2017 07:09:25 +0000 (15:09 +0800)]
nds32: dts: Support ftsdc010 DM.

Add dts to support ftsdc010 dm flow on AG101P/AE3XX platform.

Signed-off-by: Rick Chen <rick@andestech.com>
6 years agonds32: ftsdc010: Support ftsdc010 DM.
Rick Chen [Mon, 28 Aug 2017 08:44:11 +0000 (16:44 +0800)]
nds32: ftsdc010: Support ftsdc010 DM.

ftsdc010 support device tree flow.

Signed-off-by: Rick Chen <rick@andestech.com>
6 years agonds32: mmc: Support ftsdc010 DM.
Rick Chen [Tue, 14 Nov 2017 06:47:09 +0000 (14:47 +0800)]
nds32: mmc: Support ftsdc010 DM.

Add nds32_mmc to support ftsdc010 dm flow.

Signed-off-by: Rick Chen <rick@andestech.com>
6 years agodt-bindings: spi: Add andestech atcspi200 spi binding doc
Rick Chen [Wed, 15 Nov 2017 08:03:34 +0000 (16:03 +0800)]
dt-bindings: spi: Add andestech atcspi200 spi binding doc

Add a document to describe Andestech atcspi200 spi and
binding information.

Signed-off-by: Rick Chen <rick@andestech.com>
6 years agocosmetic: atcspi200: Rename function name as atcspi200
Rick Chen [Thu, 23 Nov 2017 06:17:35 +0000 (14:17 +0800)]
cosmetic: atcspi200: Rename function name as atcspi200

Integrate function and struct name from ae3xx to
atcspi200 will be more reasonable.

Signed-off-by: Rick Chen <rick@andestech.com>
6 years agospi: nds_ae3xx: Rename nds_ae3xx_spi as atcspi200_spi
Rick Chen [Thu, 23 Nov 2017 06:19:36 +0000 (14:19 +0800)]
spi: nds_ae3xx: Rename nds_ae3xx_spi as atcspi200_spi

atcspi200 is Andestech spi ip which is embedded in
AE3XX and AE250 platforms. So rename as atcspi200
will be more reasonable to be used in different
platforms.

Signed-off-by: Rick Chen <rick@andestech.com>
6 years agoatcpit100: timer: Remove arch dependency.
Rick Chen [Thu, 23 Nov 2017 04:48:46 +0000 (12:48 +0800)]
atcpit100: timer: Remove arch dependency.

ATCPIT100 is often used in AE3XX platform which is
based on NDS32 architecture recently. But in the future
Andestech will have AE250 platform which is embeded
ATCPIT100 timer based on RISCV architecture.

Signed-off-by: Rick Chen <rick@andestech.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agodt-bindings: timer: Add andestech atcpit100 timer
Rick Chen [Thu, 23 Nov 2017 02:22:17 +0000 (10:22 +0800)]
dt-bindings: timer: Add andestech atcpit100 timer

Add a document to describe Andestech atcpit100 timer and
binding information.

Signed-off-by: rick <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agocosmetic: atcpit100_timer: Use device api to get platdata
Rick Chen [Tue, 28 Nov 2017 01:14:20 +0000 (09:14 +0800)]
cosmetic: atcpit100_timer: Use device api to get platdata

Use dev_get_platdata to get private platdata.

Signed-off-by: rick <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agocosmetic: atcpit100_timer: Rename function name as atcpit100
Rick Chen [Thu, 23 Nov 2017 02:15:20 +0000 (10:15 +0800)]
cosmetic: atcpit100_timer: Rename function name as atcpit100

Integrate function and struct name as atcpit100 will be
more reasonable.

Signed-off-by: rick <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoae3xx: timer: Rename AE3XX to ATCPIT100
Rick Chen [Tue, 28 Nov 2017 01:23:23 +0000 (09:23 +0800)]
ae3xx: timer: Rename AE3XX to ATCPIT100

ATCPIT100 is Andestech timer IP which is embeded
in AE3XX and AE250 boards. So rename AE3XX to
ATCPIT100 will be more make sence.

Signed-off-by: rick <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoae3xx: timer: Fix ae3xx timer work abnormal in 64 bit.
Rick Chen [Thu, 23 Nov 2017 03:04:34 +0000 (11:04 +0800)]
ae3xx: timer: Fix ae3xx timer work abnormal in 64 bit.

It will be work fine with unsigned long declaretion in timer
register struct when system is 32 bit. But it will not work
well when system is 64 bit. Replace it by u32 and verify both
ok in 32/64 bit.

Signed-off-by: Rick Chen <rick@andestech.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoMerge tag 'xilinx-for-v2018.01' of git://www.denx.de/git/u-boot-microblaze
Tom Rini [Wed, 29 Nov 2017 13:26:07 +0000 (08:26 -0500)]
Merge tag 'xilinx-for-v2018.01' of git://www.denx.de/git/u-boot-microblaze

Xilinx changes for v2018.1

Zynq:
- Add support for Syzygy and cc108 boards
- Add support for mini u-boot configurations (cse)
- dts updates
- config/defconfig updates in connection to Kconfig changes
- Fix psu_init handling

ZynqMP:
- SPL fixes
- Remove slcr.c
- Fixing r5 startup sequence
- Add support for external pmufw
- Add support for new ZynqMP chips
- dts updates
- Add support for zcu102 rev1.0 board

Drivers:
- nand: Support external timing setting and board init
- ahci: Fix wording
- axi_emac: Wait for bit, non processor mode, readl/write conversion
- zynq_gem: Fix SGMII/PCS support

6 years agonet: xilinx_axi_emac: Use readl and writel for io ops
Siva Durga Prasad Paladugu [Thu, 23 Nov 2017 06:53:12 +0000 (12:23 +0530)]
net: xilinx_axi_emac: Use readl and writel for io ops

This patch uses readl and writel instead of in_be32 and
out_be32 for io ops as these internally uses readl,
writel for microblaze and for Zynq, ZynqMP there is
no need of endianness conversion and readl, writel
should work straightaway. This patch starts supporting
the driver for Zynq and ZynqMP platforms.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agonet: zynq_gem: Dont enable SGMII and PCS selection
Siva Durga Prasad Paladugu [Thu, 23 Nov 2017 07:26:55 +0000 (12:56 +0530)]
net: zynq_gem: Dont enable SGMII and PCS selection

Dont enable SGMII and PCS selection if internal PCS/PMA
is not used, by getting the info about internal/external
PCS/PMA usage from dt property "is-internal-phy".

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoarm: zynq: Change Zynq/ZynqMP Kconfig description
Michal Simek [Thu, 23 Nov 2017 07:25:41 +0000 (08:25 +0100)]
arm: zynq: Change Zynq/ZynqMP Kconfig description

Use more accurate description for Xilinx Zynq and ZynqMP based platforms.
With using driver model there shouldn't be a need to create separate
Kconfig config options.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agotools: zynqmpimage: adjust ug1085 reference to v1.4 of the document
Jean-Francois Dagenais [Thu, 23 Mar 2017 11:39:14 +0000 (07:39 -0400)]
tools: zynqmpimage: adjust ug1085 reference to v1.4 of the document

The chapter in which the table explaining the image format changed
chapter as the document evolved. This should help people track the
info down faster.

Signed-off-by: Jean-Francois Dagenais <jeff.dagenais@gmail.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agomtd: nand: zynq: Add support for the NAND lock/unlock operation
Joe Hershberger [Tue, 7 Nov 2017 02:16:10 +0000 (18:16 -0800)]
mtd: nand: zynq: Add support for the NAND lock/unlock operation

Zynq NAND driver is not support for NAND lock or unlock operation.
Hence, accidentally write into the critical NAND region might cause
data corruption to occur.

This commit is to add NAND lock/unlock command into NAND SMC register
set for NAND lock/unlock operaion.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Keng Soon Cheah <keng.soon.cheah@ni.com>
Cc: Chen Yee Chew <chen.yee.chew@ni.com>
Cc: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Scott Wood <oss@buserror.net>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agomtd: zynq: nand: Move board_nand_init() function to board.c
Wilson Lee [Wed, 15 Nov 2017 09:14:35 +0000 (01:14 -0800)]
mtd: zynq: nand: Move board_nand_init() function to board.c

Putting board_nand_init() function inside NAND driver was not appropriate
due to it doesn't allow board vendor to customise their NAND
initialization code such as adding NAND lock/unlock code.

This commit was to move the board_nand_init() function from NAND driver
to board.c file. This allow customization of board_nand_init() function.

Signed-off-by: Wilson Lee <wilson.lee@ni.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Keng Soon Cheah <keng.soon.cheah@ni.com>
Cc: Chen Yee Chew <chen.yee.chew@ni.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Cc: Scott Wood <oss@buserror.net>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoarm: zynq: Add ps7_init for cc108
Michal Simek [Fri, 10 Nov 2017 11:41:10 +0000 (12:41 +0100)]
arm: zynq: Add ps7_init for cc108

After some generic cleanup adding ps7_init* to repository
is not big pain now.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoarm: zynq: Show information about silicon version
Michal Simek [Fri, 10 Nov 2017 12:01:10 +0000 (13:01 +0100)]
arm: zynq: Show information about silicon version

Show information about silicon in bootlog.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoarm: zynq: Do not show information from checkboard twice
Michal Simek [Fri, 10 Nov 2017 12:03:50 +0000 (13:03 +0100)]
arm: zynq: Do not show information from checkboard twice

There is no reason to show information about board twice.
Remove boardinfo late calls.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoarm: zynq: Use unsigned type with comparison with ARRAY_SIZE
Michal Simek [Fri, 10 Nov 2017 12:28:07 +0000 (13:28 +0100)]
arm: zynq: Use unsigned type with comparison with ARRAY_SIZE

Sparse is return warning about this:
arch/arm/mach-zynq/slcr.c: In function 'zynq_slcr_get_mio_pin_status':
arch/arm/mach-zynq/slcr.c:185:16: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
  for (i = 0; i < ARRAY_SIZE(mio_periphs); i++) {
                ^

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoarm: zynq: Convert all board to use arch ps7_init code
Michal Simek [Fri, 10 Nov 2017 10:00:42 +0000 (11:00 +0100)]
arm: zynq: Convert all board to use arch ps7_init code

Use generic implementation. It will also reduce config data size for
converted boards.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoarm: zynq: Add support for EMIT_WRITE operation
Michal Simek [Fri, 10 Nov 2017 10:03:47 +0000 (11:03 +0100)]
arm: zynq: Add support for EMIT_WRITE operation

Add proper support for EMIT_WRITE operation which is write only.
Do not use EMIT_MASKWRITE which is read-modify-write.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoarm: zynq: Add ps7GetSiliconVersion() to ps7_spl_init
Michal Simek [Fri, 10 Nov 2017 10:06:02 +0000 (11:06 +0100)]
arm: zynq: Add ps7GetSiliconVersion() to ps7_spl_init

Unfortunately camelcase is coming from ps7_init* format.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoarm: zynq: Move common ps7_init* initialization to arch code
Michal Simek [Fri, 10 Nov 2017 08:47:28 +0000 (09:47 +0100)]
arm: zynq: Move common ps7_init* initialization to arch code

This patch is based on work done in topic board where the first address
word also storing operation which should be done. This is reducing size
of configuration data.
This patch is not breaking an option to copy default ps7_init_gpl* files
from hdf file but it is doing preparation for ps7_init* consolidation.

The patch is also marking ps7_config as weak function.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoarm: zynq: Get rid of ps7_reset_apu() for syzygy board
Michal Simek [Fri, 10 Nov 2017 08:51:17 +0000 (09:51 +0100)]
arm: zynq: Get rid of ps7_reset_apu() for syzygy board

There is no reason to call separate function.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoarm: zynq: Move ps7_* to separate file
Michal Simek [Wed, 8 Nov 2017 15:14:47 +0000 (16:14 +0100)]
arm: zynq: Move ps7_* to separate file

Extract ps7_* from spl code to prepare for extension.
And also return value.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoarm: zynq: Remove ps7_debug code
Michal Simek [Fri, 10 Nov 2017 08:09:48 +0000 (09:09 +0100)]
arm: zynq: Remove ps7_debug code

SPL is not calling this code that's why it is dead code and can be
removed.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoarm: zynq: Enable debug uart on zc706
Michal Simek [Fri, 10 Nov 2017 08:26:40 +0000 (09:26 +0100)]
arm: zynq: Enable debug uart on zc706

Enable debug uart by default.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoarm: zynq: Add missing ps7_post_config declaration
Michal Simek [Wed, 8 Nov 2017 15:10:35 +0000 (16:10 +0100)]
arm: zynq: Add missing ps7_post_config declaration

Add missing declaration to header.

Warning log:
arch/arm/mach-zynq/spl.c:94:12: warning: symbol 'ps7_post_config' was
not declared. Should it be static?

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agonet: xilinx_axi_emac: Add support for non processor mode
Siva Durga Prasad Paladugu [Fri, 6 Jan 2017 10:57:15 +0000 (16:27 +0530)]
net: xilinx_axi_emac: Add support for non processor mode

Add support for non processor mode, this mode doesn't have
access to some of the registers and hence this patch
bypasses it and also length has to be calculated from
status instead of app4 in this mode.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
6 years agoMerge git://git.denx.de/u-boot-mips
Tom Rini [Tue, 28 Nov 2017 21:54:30 +0000 (16:54 -0500)]
Merge git://git.denx.de/u-boot-mips

6 years agoMerge git://git.denx.de/u-boot-uniphier
Tom Rini [Tue, 28 Nov 2017 21:54:09 +0000 (16:54 -0500)]
Merge git://git.denx.de/u-boot-uniphier

6 years agoboston: Add u-boot.mcs make target
Paul Burton [Tue, 21 Nov 2017 22:31:07 +0000 (14:31 -0800)]
boston: Add u-boot.mcs make target

U-Boot is generally flashed to a MIPS Boston development board by means
of a .mcs file which Xilinx Vivado software can write to the flash
present on the board. As such we'd generally want to produce an mcs file
when building U-Boot to target the Boston board. Introduce a make target
for u-boot.mcs which generates it using the srec_cat tool available from
the SRecord project, and build it by default when srec_cat is present.

Signed-off-by: Paul Burton <paul.burton@mips.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
6 years agoboston: Set CONFIG_SYS_LOAD_ADDR to 0x88000000
Paul Burton [Tue, 21 Nov 2017 20:35:31 +0000 (12:35 -0800)]
boston: Set CONFIG_SYS_LOAD_ADDR to 0x88000000

Generally we load Linux kernels on Boston boards in the form of FIT
images containing a compressed kernel binary. Linux is linked at
0x80100000 and so we need to decompress the kernel binary to that
address, however this is our default load address which means that
unless explicitly avoided we hit a decompression error as the
uncompressed kernel binary overwrites its compressed version from the
FIT image.

Avoid this by adjusting CONFIG_SYS_LOAD_ADDR to 0x88000000 (or
0xffffffff88000000 for MIPS64 builds) which avoids the address overlap
between compressed & uncompressed kernel binaries.

Signed-off-by: Paul Burton <paul.burton@mips.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
6 years agoMIPS: Break out of cache loops for unimplemented caches
Paul Burton [Tue, 21 Nov 2017 19:18:39 +0000 (11:18 -0800)]
MIPS: Break out of cache loops for unimplemented caches

If we run on a CPU which doesn't implement a particular cache then we
would previously get stuck in an infinite loop, executing a cache op on
the first "line" of the missing cache & then incrementing the address by
0. This was being avoided for the L2 caches, but not for the L1s. Fix
this by generalising the check for a zero line size & avoiding the cache
op loop when this is the case.

Signed-off-by: Paul Burton <paul.burton@mips.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
6 years agoMIPS: Clear instruction hazards in flush_cache()
Paul Burton [Tue, 21 Nov 2017 19:18:38 +0000 (11:18 -0800)]
MIPS: Clear instruction hazards in flush_cache()

When writing code, for example during relocation, we ensure that the
icache has a coherent view of the new instructions with a call to
flush_cache(). This handles the bulk of the work to ensure the new
instructions will execute as expected, however it does not ensure that
the CPU pipeline doesn't already contain instructions taken from a stale
view of the affected memory. This could theoretically be a problem for
relocation, but in practice typically isn't because we sync caches for
enough code after the entry point of the newly written code that by the
time the CPU pipeline might possibly fetch any of it we'll have long ago
written it back & invalidated any stale icache entries. This is however
a problem for shorter regions of code.

In preparation for later patches which write shorter segments of code,
ensure any instruction hazards are cleared by flush_cache() by
introducing & using a new instruction_hazard_barrier() function which
makes use of the jr.hb instruction to clear the hazard.

Signed-off-by: Paul Burton <paul.burton@mips.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
6 years agoMIPS: Ensure cache ops complete in cache maintenance functions
Paul Burton [Tue, 21 Nov 2017 19:18:37 +0000 (11:18 -0800)]
MIPS: Ensure cache ops complete in cache maintenance functions

A typical use of cache maintenance functions is to force writeback of
data which a device is about to read using DMA - for example a
descriptor or command structure. Such users of cache maintenance
functions require that operations on the cache have completed before
they proceed to instruct a device to read memory. This requires that we
place a completion barrier (ie. sync instruction) between the cache ops
and whatever write informs the device to perform DMA.

Whilst strictly speaking this isn't all users of the cache maintenance
functions & we could instead place the barriers in the drivers that
require them, it would be much more invasive to do so than to just have
the barrier be the default by placing it in the cache functions
themselves. The cost is low enough that it shouldn't matter to us in any
rare cases that we use the cache functions when not performing DMA.

Signed-off-by: Paul Burton <paul.burton@mips.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
6 years agoUpdate Paul Burton's email address
Paul Burton [Mon, 30 Oct 2017 23:58:21 +0000 (16:58 -0700)]
Update Paul Burton's email address

MIPS is no longer a part of Imagination Technologies, and as such my
@imgtec.com email address will soon cease to function. This patch
updates occurrances of it with my new @mips.com email address, and adds
an entry in .mailmap such that git (& tools such as get_maintainer.pl
when examining history) will use the new address.

Signed-off-by: Paul Burton <paul.burton@mips.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
6 years agoMIPS: Drop unused PTR_COUNT_SHIFT from u-boot.lds
Paul Burton [Fri, 15 Sep 2017 18:35:54 +0000 (11:35 -0700)]
MIPS: Drop unused PTR_COUNT_SHIFT from u-boot.lds

The u-boot.lds linker script for MIPS defines a PTR_COUNT_SHIFT macro to
2 or 3 for 32 bit or 64 bit builds respectively. This macro is never
actually used though, so remove the dead code.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
6 years agoboston: Remove unused label in lowlevel_display
Paul Burton [Fri, 15 Sep 2017 18:34:31 +0000 (11:34 -0700)]
boston: Remove unused label in lowlevel_display

The lowlevel_display() function includes a "1:" label which is never
used. Remove it.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
6 years agoboston: Drop unused return value
Paul Burton [Fri, 15 Sep 2017 18:33:53 +0000 (11:33 -0700)]
boston: Drop unused return value

The boston lowlevel_init() function zeroes the return register v0,
despite the function not being expected to return a value & that value
never being used.

Remove the redundant assignment to v0.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
6 years agoARM: uniphier: remove unused NAND CONFIG options
Masahiro Yamada [Mon, 27 Nov 2017 05:13:49 +0000 (14:13 +0900)]
ARM: uniphier: remove unused NAND CONFIG options

The Denali NAND driver does not use these options any more.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agoARM: dts: uniphier: Sync with Linux 4.15-rc1
Masahiro Yamada [Fri, 24 Nov 2017 15:25:35 +0000 (00:25 +0900)]
ARM: dts: uniphier: Sync with Linux 4.15-rc1

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agogpio: uniphier: import dt-binginds header from Linux
Masahiro Yamada [Fri, 24 Nov 2017 15:25:34 +0000 (00:25 +0900)]
gpio: uniphier: import dt-binginds header from Linux

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agoARM: uniphier: remove XIRQ pin settings
Masahiro Yamada [Fri, 24 Nov 2017 15:25:33 +0000 (00:25 +0900)]
ARM: uniphier: remove XIRQ pin settings

The XIRQ pins are now set up on the Linux side by the GPIO hogging.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agoARM: uniphier: remove IRQ settings
Masahiro Yamada [Fri, 24 Nov 2017 15:25:32 +0000 (00:25 +0900)]
ARM: uniphier: remove IRQ settings

This work-around has been here in U-Boot because the AIDET and GPIO
drivers were missing in the upstream Linux.  Both are now available
in Linus' tree:
  - drivers/irqchip/irq-uniphier-aidet.c
  - drivers/gpio/gpio-uniphier.c

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agoARM: uniphier: set CONFIG_LOGLEVEL to 6
Masahiro Yamada [Fri, 24 Nov 2017 15:25:31 +0000 (00:25 +0900)]
ARM: uniphier: set CONFIG_LOGLEVEL to 6

Print out KERN_NOTICE or higher level log messages.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agomtd: nand: denali: sync with Linux 4.15-rc1
Masahiro Yamada [Tue, 21 Nov 2017 17:38:32 +0000 (02:38 +0900)]
mtd: nand: denali: sync with Linux 4.15-rc1

I largely reworked the Denali NAND controller driver in Linux.
This commit imports the improvements from Linux.  The code is
almost synced with Linux 4.15-rc1.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agomtd: nand: introduce NAND_ROW_ADDR_3 flag
Masahiro Yamada [Tue, 21 Nov 2017 17:38:31 +0000 (02:38 +0900)]
mtd: nand: introduce NAND_ROW_ADDR_3 flag

Several drivers check ->chipsize to see if the third row address cycle
is needed.  Instead of embedding magic sizes such as 32MB, 128MB in
drivers, introduce a new flag NAND_ROW_ADDR_3 for clean-up.  Since
nand_scan_ident() knows well about the device, it can handle this
properly.  The flag is set if the row address bit width is greater
than 16.

Delete comments such as "One more address cycle for ..." because
intention is now clear enough from the code.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Wenyou Yang <wenyou.yang@microchip.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
[Linux commit: 14157f861437ebe2d624b0a845b91bbdf8ca9a2d]

6 years agomtd: nand: add a shorthand to generate nand_ecc_caps structure
Masahiro Yamada [Tue, 21 Nov 2017 17:38:30 +0000 (02:38 +0900)]
mtd: nand: add a shorthand to generate nand_ecc_caps structure

struct nand_ecc_caps was designed as flexible as possible to support
multiple stepsizes (like sunxi_nand.c).

So, we need to write multiple arrays even for the simplest case.
I guess many controllers support a single stepsize, so here is a
shorthand macro for the case.

It allows to describe like ...

NAND_ECC_CAPS_SINGLE(denali_pci_ecc_caps, denali_calc_ecc_bytes, 512, 8, 15);

... instead of

static const int denali_pci_ecc_strengths[] = {8, 15};
static const struct nand_ecc_step_info denali_pci_ecc_stepinfo = {
        .stepsize = 512,
        .strengths = denali_pci_ecc_strengths,
        .nstrengths = ARRAY_SIZE(denali_pci_ecc_strengths),
};
static const struct nand_ecc_caps denali_pci_ecc_caps = {
        .stepinfos = &denali_pci_ecc_stepinfo,
        .nstepinfos = 1,
        .calc_ecc_bytes = denali_calc_ecc_bytes,
};

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
[Linux commit: a03c60178c181767ecfb26fb311a88742d228118]

6 years agomtd: nand: add generic helpers to check, match, maximize ECC settings
Masahiro Yamada [Tue, 21 Nov 2017 17:38:29 +0000 (02:38 +0900)]
mtd: nand: add generic helpers to check, match, maximize ECC settings

Driver are responsible for setting up ECC parameters correctly.
Those include:
  - Check if ECC parameters specified (usually by DT) are valid
  - Meet the chip's ECC requirement
  - Maximize ECC strength if NAND_ECC_MAXIMIZE flag is set

The logic can be generalized by factoring out common code.

This commit adds 3 helpers to the NAND framework:
nand_check_ecc_caps - Check if preset step_size and strength are valid
nand_match_ecc_req - Match the chip's requirement
nand_maximize_ecc - Maximize the ECC strength

To use the helpers above, a driver needs to provide:
  - Data array of supported ECC step size and strength
  - A hook that calculates ECC bytes from the combination of
    step_size and strength.

By using those helpers, code duplication among drivers will be
reduced.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
[Linux commit: 2c8f8afa7f92acb07641bf95b940d384ed1d0294]

6 years agomtd: nand: Pass the CS line to ->setup_data_interface()
Boris Brezillon [Tue, 21 Nov 2017 17:38:28 +0000 (02:38 +0900)]
mtd: nand: Pass the CS line to ->setup_data_interface()

Some NAND controllers can assign different NAND timings to different
CS lines. Pass the CS line information to ->setup_data_interface() so
that the NAND controller driver knows which CS line is concerned by
the setup_data_interface() request.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
[Linux commit: 104e442a67cfba4d0cc982384761befb917fb6a1]
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agomtd: nand: allow drivers to request minimum alignment for passed buffer
Masahiro Yamada [Tue, 21 Nov 2017 17:38:27 +0000 (02:38 +0900)]
mtd: nand: allow drivers to request minimum alignment for passed buffer

In some cases, nand_do_{read,write}_ops is passed with unaligned
ops->datbuf.  Drivers using DMA will be unhappy about unaligned
buffer.

The new struct member, buf_align, represents the minimum alignment
the driver require for the buffer.  If the buffer passed from the
upper MTD layer does not have enough alignment, nand_do_*_ops will
use bufpoi.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
[Linux commit: 477544c62a84d3bacd9f90ba75ffc16c04d78071]

6 years agomtd: nand: Wait for PAGEPROG to finish in drivers setting NAND_ECC_CUSTOM_PAGE_ACCESS
Boris Brezillon [Tue, 21 Nov 2017 17:38:26 +0000 (02:38 +0900)]
mtd: nand: Wait for PAGEPROG to finish in drivers setting NAND_ECC_CUSTOM_PAGE_ACCESS

Drivers setting NAND_ECC_CUSTOM_PAGE_ACCESS are supposed to handle the
full read/write page sequence, and waiting for a page to actually be
programmed is part of this write-page sequence.
This is also what is done in ->write_oob_xxx() hooks, so let's do that in
->write_page_xxx() as well to make it consistent.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
[Linux commit: 41145649f4acb30249b636b945053db50c9331c5]
[masahiro:
 There is no driver setting NAND_ECC_CUSTOM_PAGE_ACCESS in U-Boot.
 No driver is affected by this change.]
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agomtd: nand: Drop the ->errstat() hook
Boris Brezillon [Tue, 21 Nov 2017 17:38:25 +0000 (02:38 +0900)]
mtd: nand: Drop the ->errstat() hook

The ->errstat() hook is no longer implemented NAND controller drivers.
Get rid of it before someone starts abusing it.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
[Linux commit: 7d135bcced20be2b50128432c5426a7278ec4f6d]
[masahiro: modify davinci_nand.c for U-Boot]
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agomtd: nand: Drop unused cached programming support
Boris Brezillon [Tue, 21 Nov 2017 17:38:24 +0000 (02:38 +0900)]
mtd: nand: Drop unused cached programming support

Cached programming is always skipped, so drop the associated code until
we decide to really support it.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
[Linux commit: 0b4773fd1649e0d418275557723a7ef54f769dc9]
[masahiro: modify davinci_nand.c for U-Boot]
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agomtd: add mtd_ooblayout_xxx() helper functions
Boris Brezillon [Tue, 21 Nov 2017 17:38:23 +0000 (02:38 +0900)]
mtd: add mtd_ooblayout_xxx() helper functions

In order to make the ecclayout definition completely dynamic we need to
rework the way the OOB layout are defined and iterated.

Create a few mtd_ooblayout_xxx() helpers to ease OOB bytes manipulation
and hide ecclayout internals to their users.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
[Linux commit: 75eb2cec251fda33c9bb716ecc372819abb9278a]
[masahiro:
 cherry-pick more code from adbbc3bc827eb1f43a932d783f09ba55c8ec8379]
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agomtd: nand: Support controllers with custom page
Marc Gonzalez [Tue, 21 Nov 2017 17:38:22 +0000 (02:38 +0900)]
mtd: nand: Support controllers with custom page

If your controller already sends the required NAND commands when
reading or writing a page, then the framework is not supposed to
send READ0 and SEQIN/PAGEPROG respectively.

Signed-off-by: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
[Linux commit: 3371d663bb4579f1b2003a92162edd6d90edd089]
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agomtd: nand: Add a few more timings to nand_sdr_timings
Boris Brezillon [Tue, 21 Nov 2017 17:38:21 +0000 (02:38 +0900)]
mtd: nand: Add a few more timings to nand_sdr_timings

Add the tR_max, tBERS_max, tPROG_max and tCCS_min timings to the
nand_sdr_timings struct.
Assign default/safe values for the statically defined timings, and
extract them from the ONFI parameter table if the NAND is ONFI
compliant.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Tested-by: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
[Linux commit: 204e7ecd47e26cc12d9e8e8a7e7a2eeb9573f0ba
 Fixup commit: 6d29231000bbe0fb9e4893a9c68151ffdd3b5469]
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agomtd: nand: Fix data interface configuration logic
Boris Brezillon [Tue, 21 Nov 2017 17:38:20 +0000 (02:38 +0900)]
mtd: nand: Fix data interface configuration logic

When changing from one data interface setting to another, one has to
ensure a specific sequence which is described in the ONFI spec.

One of these constraints is that the CE line has go high after a reset
before a command can be sent with the new data interface setting, which
is not guaranteed by the current implementation.

Rework the nand_reset() function and all the call sites to make sure the
CE line is asserted and released when required.

Also make sure to actually apply the new data interface setting on the
first die.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Fixes: d8e725dd8311 ("mtd: nand: automate NAND timings selection")
Reviewed-by: Sascha Hauer <s.hauer@pengutronix.de>
Tested-by: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
[Linux commit: 73f907fd5fa56b0066d199bdd7126bbd04f6cd7b]
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agomtd: nand: automate NAND timings selection
Boris Brezillon [Tue, 21 Nov 2017 17:38:19 +0000 (02:38 +0900)]
mtd: nand: automate NAND timings selection

The NAND framework provides several helpers to query timing modes supported
by a NAND chip, but this implies that all NAND controller drivers have
to implement the same timings selection dance. Also currently NAND
devices can be resetted at arbitrary places which also resets the timing
for ONFI chips to timing mode 0.

Provide a common logic to select the best timings based on ONFI or
->onfi_timing_mode_default information. Hook this into nand_reset()
to make sure the new timing is applied each time during a reset.

NAND controller willing to support timings adjustment should just
implement the ->setup_data_interface() method.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
[Linux commit: d8e725dd831186a3595036b2b1df9f68cbc6efa3]
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agomtd: nand: Expose data interface for ONFI mode 0
Sascha Hauer [Tue, 21 Nov 2017 17:38:18 +0000 (02:38 +0900)]
mtd: nand: Expose data interface for ONFI mode 0

The nand layer will need ONFI mode 0 to use it as timing mode
before and right after reset.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
[Linux commit: 6e1f9708dbf3c50a8da93c1952a01a7a2acb5e66]
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agomtd: nand: convert ONFI mode into data interface
Sascha Hauer [Tue, 21 Nov 2017 17:38:17 +0000 (02:38 +0900)]
mtd: nand: convert ONFI mode into data interface

struct nand_data_interface is the designated type to pass to
the NAND drivers to configure the timing. To simplify further
patches convert the onfi_sdr_timings array from type struct
nand_sdr_timings nand_data_interface.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
[Linux commit: b1dd3ca203fccd111926c3f6ac59bf903ec62b05]
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agomtd: nand: Introduce nand_data_interface
Sascha Hauer [Tue, 21 Nov 2017 17:38:16 +0000 (02:38 +0900)]
mtd: nand: Introduce nand_data_interface

Currently we have no data structure to fully describe a NAND timing.
We only have struct nand_sdr_timings for NAND timings in SDR mode,
but nothing for DDR mode and also no container to store both types
of timing.
This patch adds struct nand_data_interface which stores the timing
type and a union of different timings. This can be used to pass to
drivers in order to configure the timing.
Add kerneldoc for struct nand_sdr_timings while touching it anyway.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
[Linux commit: eee64b700e26b9bcc6fce024681c31f5e12271fc]
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agomtd: nand: Create a NAND reset function
Sascha Hauer [Tue, 21 Nov 2017 17:38:15 +0000 (02:38 +0900)]
mtd: nand: Create a NAND reset function

When NAND devices are resetted some initialization may have to be done,
like for example they have to be configured for the timing mode that
shall be used. To get a common place where this initialization can be
implemented create a nand_reset() function. This currently only issues
a NAND_CMD_RESET to the NAND device. The places issuing this command
manually are replaced with a call to nand_reset().

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
[Linux commit: 2f94abfe35b210e7711af9202a3dcfc9e779219a]
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agomtd: nand: remove unnecessary 'extern' from function declarations
Sascha Hauer [Tue, 21 Nov 2017 17:38:14 +0000 (02:38 +0900)]
mtd: nand: remove unnecessary 'extern' from function declarations

'extern' is not necessary for function declarations. To prevent
people from adding the keyword to new declarations remove the
existing ones.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
[Linux commit: 79022591839f110f465cac0223e117b91d47d5db]
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>