oweals/u-boot.git
5 years agomtd: Don't stop MTD partition creation when it fails on one device
Boris Brezillon [Sun, 2 Dec 2018 09:54:30 +0000 (10:54 +0100)]
mtd: Don't stop MTD partition creation when it fails on one device

MTD partition creation code is a bit tricky. It tries to figure out
when things have changed (either MTD dev list or mtdparts/mtdids vars)
and when that happens it first deletes all the partitions that had been
previously created and then creates the new ones based on the new
mtdparts/mtdids values.
But before deleting the old partitions, it ensures that none of the
currently registered parts are being used and bails out when that's
not the case. So, we end up in a situation where, if at least one MTD
dev has one of its partitions used by someone (UBI for instance), the
partitions update logic no longer works for other devs.

Rework the code to relax the logic and allow updates of MTD parts on
devices that are not being used (we still refuse to updates parts on
devices who have at least one of their partitions used by someone).

Fixes: 5db66b3aee6f ("cmd: mtd: add 'mtd' command")
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Tested-by: Heiko Schocher <hs@denx.de>
5 years agomtd: Make sure we don't parse MTD partitions belonging to another dev
Boris Brezillon [Sun, 2 Dec 2018 09:54:29 +0000 (10:54 +0100)]
mtd: Make sure we don't parse MTD partitions belonging to another dev

The mtdparts variable might contain partition definitions for several
MTD devices. Each partition layout is separated by a ';', so let's
make sure we don't pick a wrong name when mtdparts is malformed.

Fixes: 5db66b3aee6f ("cmd: mtd: add 'mtd' command")
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Tested-by: Heiko Schocher <hs@denx.de>
5 years agomtd: Make sure the name passed in mtdparts fits in mtd_name[]
Boris Brezillon [Sun, 2 Dec 2018 09:54:28 +0000 (10:54 +0100)]
mtd: Make sure the name passed in mtdparts fits in mtd_name[]

The local mtd_name[] variable is limited in size. Return an error if
the name passed in mtdparts does not fit in this local var.

Fixes: 5db66b3aee6f ("cmd: mtd: add 'mtd' command")
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Tested-by: Heiko Schocher <hs@denx.de>
5 years agomtd: Be more strict on the "mtdparts=" prefix check
Boris Brezillon [Sun, 2 Dec 2018 09:54:27 +0000 (10:54 +0100)]
mtd: Be more strict on the "mtdparts=" prefix check

strstr() does not guarantee that the string we're searching for is
placed at the beginning. Use strncmp() instead.

Fixes: 5db66b3aee6f ("cmd: mtd: add 'mtd' command")
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Tested-by: Heiko Schocher <hs@denx.de>
5 years agomtd: Use get_mtdids() instead of env_get("mtdids") in mtd_search_alternate_name()
Boris Brezillon [Sun, 2 Dec 2018 09:54:26 +0000 (10:54 +0100)]
mtd: Use get_mtdids() instead of env_get("mtdids") in mtd_search_alternate_name()

The environment is not guaranteed to contain a valid mtdids variable
when called from mtd_search_alternate_name(). Call get_mtdids() instead
of env_get("mtdids").

Fixes: ff4afa8a981e ("mtd: uboot: search for an equivalent MTD name with the mtdids")
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Tested-by: Heiko Schocher <hs@denx.de>
5 years agomtd: sf: Make sure we don't register the same device twice
Boris Brezillon [Sun, 2 Dec 2018 09:54:25 +0000 (10:54 +0100)]
mtd: sf: Make sure we don't register the same device twice

spi_flash_mtd_register() can be called several times and each time it
will register the same mtd_info instance like if it was a new one.
The MTD ID allocation gets crazy when that happens, so let's track the
status of the sf_mtd_info object to avoid that.

Fixes: 9fe6d8716e09 ("mtd, spi: Add MTD layer driver")
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Tested-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Jagan Teki <jagan@openedev.com>
5 years agomtd: Delete partitions attached to the device when a device is deleted
Boris Brezillon [Sun, 2 Dec 2018 09:54:24 +0000 (10:54 +0100)]
mtd: Delete partitions attached to the device when a device is deleted

If we don't do that, partitions might still be exposed while the
underlying device is gone.

Fixes: 2a74930da57f ("mtd: mtdpart: implement proper partition handling")
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Tested-by: Heiko Schocher <hs@denx.de>
5 years agomtd: Parse mtdparts/mtdids again when the MTD list has been updated
Boris Brezillon [Sun, 2 Dec 2018 09:54:23 +0000 (10:54 +0100)]
mtd: Parse mtdparts/mtdids again when the MTD list has been updated

Updates to the MTD device list should trigger a new parsing of the
mtdids/mtdparts vars even if those vars haven't changed.

Fixes: 5db66b3aee6f ("cmd: mtd: add 'mtd' command")
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Tested-by: Heiko Schocher <hs@denx.de>
5 years agomtd: Add a function to report when the MTD dev list has been updated
Boris Brezillon [Sun, 2 Dec 2018 09:54:22 +0000 (10:54 +0100)]
mtd: Add a function to report when the MTD dev list has been updated

We need to parse mtdparts/mtids again everytime a device has been
added/removed from the MTD list, but there's currently no way to know
when such an update has been done.

Add an ->updated field to the idr struct that we set to true every time
a device is added/removed and expose a function returning the value
of this field and resetting it to false.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Tested-by: Heiko Schocher <hs@denx.de>
5 years agoboard_r: Remove initr_spi
Jagan Teki [Wed, 21 Nov 2018 06:44:07 +0000 (12:14 +0530)]
board_r: Remove initr_spi

Drop unused initr_spi, which just return 0, no usage.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agospi: Zap CONFIG_HARD_SPI
Jagan Teki [Sat, 24 Nov 2018 09:01:12 +0000 (14:31 +0530)]
spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agospi: Remove unused mpc8xx code
Jagan Teki [Thu, 22 Nov 2018 16:08:38 +0000 (21:38 +0530)]
spi: Remove unused mpc8xx code

- spi_init_f
- spi_init_r
- spi_read
- spi_write

these spi calls are exclusively for mpc8xx, but
the relevant driver is not available so remove it.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agospi: mpc8xx: Migrate to DM_SPI
Christophe Leroy [Wed, 21 Nov 2018 08:51:57 +0000 (08:51 +0000)]
spi: mpc8xx: Migrate to DM_SPI

Drop non-dm code and migrate into DM_SPI.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
[jagan: Move config menu in DM_SPI area]
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agospi: Remove used spi_init
Jagan Teki [Tue, 20 Nov 2018 08:02:04 +0000 (09:02 +0100)]
spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agospi: Remove unused spi_init
Jagan Teki [Tue, 20 Nov 2018 09:36:35 +0000 (15:06 +0530)]
spi: Remove unused spi_init

Remove spi_init definition which never used on
respective code since from many years.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agodm: platform_data: spi: s/pl022_spi.h/spi_pl022.h
Jagan Teki [Thu, 22 Nov 2018 06:24:08 +0000 (11:54 +0530)]
dm: platform_data: spi: s/pl022_spi.h/spi_pl022.h

Rename platform_data include file as spi_pl022.h from pl022_spi.h,
this is generic notation used for spi platdata include files.

Acked-by: Quentin Schulz <quentin.schulz@bootlin.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agospi: pl022: Drop unnecessary include files
Jagan Teki [Thu, 22 Nov 2018 06:23:23 +0000 (11:53 +0530)]
spi: pl022: Drop unnecessary include files

This patch can drop unnecessary include files in
pl022_spi driver.

Acked-by: Quentin Schulz <quentin.schulz@bootlin.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agospi: pl022: Simplify platdata code
Jagan Teki [Wed, 14 Nov 2018 09:58:05 +0000 (15:28 +0530)]
spi: pl022: Simplify platdata code

pl022 spi driver support both OF_CONTROL and PLATDATA, this
patch is trying to simplify the code that differentiating
platdata vs of_control.
- Move OF_CONTROL code at one place
- Handle clock setup code directly in pl022_spi_ofdata_to_platdata

Acked-by: Quentin Schulz <quentin.schulz@bootlin.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agospi: mtk_qspi: add qspi driver for MT7629 SoC
Guochun Mao [Fri, 12 Oct 2018 07:01:06 +0000 (15:01 +0800)]
spi: mtk_qspi: add qspi driver for MT7629 SoC

This patch adds MT7629 qspi driver for accessing SPI NOR flash.

Signed-off-by: Guochun Mao <guochun.mao@mediatek.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jagan Teki <jagan@openedev.com>
5 years agospi: Add Amlogic Meson SPI Flash Controller driver
Neil Armstrong [Thu, 22 Nov 2018 10:01:05 +0000 (11:01 +0100)]
spi: Add Amlogic Meson SPI Flash Controller driver

The Amlogic Meson SoCs embeds a Flash oriented SPI Controller name SPIFC.
This driver, ported from the Linux meson-spi-spifc driver, add support
for this controller on the Amlogic Meson GX SoCs in U-Boot.

Tested-by: Jerome Brunet <jbrunet@baylibre.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
5 years agotest: regmap: add regmap_read_poll_timeout test
Neil Armstrong [Thu, 22 Nov 2018 10:01:04 +0000 (11:01 +0100)]
test: regmap: add regmap_read_poll_timeout test

Add test to regmap_read_poll_timeout() helper to check the timeout works
properly but cannot test proper condition matching since read/write calls
are not executed in sandbox.

Tested-by: Jerome Brunet <jbrunet@baylibre.com>
Acked-by: Jagan Teki <jagan@openedev.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
5 years agoregmap: add regmap_read_poll_timeout() helper
Neil Armstrong [Thu, 22 Nov 2018 10:01:03 +0000 (11:01 +0100)]
regmap: add regmap_read_poll_timeout() helper

Add the regmap_read_poll_timeout() macro based on the Linux implementation
to simplify register polling with configurable timeout and sleep.

Tested-by: Jerome Brunet <jbrunet@baylibre.com>
Acked-by: Jagan Teki <jagan@openedev.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
5 years agocmd: ubi: Make ubi_detach() static
Stefan Roese [Wed, 31 Oct 2018 11:37:20 +0000 (12:37 +0100)]
cmd: ubi: Make ubi_detach() static

Its only called from this file, so make it static. While at it, remove
some occurances of multiple blank lines as well.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Boris Brezillon <boris.brezillon@bootlin.com>
Cc: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
5 years agomtd: rawnand: pxa3xx: fix 2kiB pages with 8b strength chips layout
Miquel Raynal [Thu, 11 Oct 2018 15:45:44 +0000 (17:45 +0200)]
mtd: rawnand: pxa3xx: fix 2kiB pages with 8b strength chips layout

The initial layout for such NAND chips was the following:

+----------------------------------------------------------------------------+
| 1024 (data) | 30 (ECC) | 1024 (data) | 30 (ECC) | 32 (free OOB) | 30 (ECC) |
+----------------------------------------------------------------------------+

This layout has a weakness: reading empty pages trigger ECC errors
(this is expected), but the hardware ECC engine tries to correct the
data anyway and creates itself bitflips, hence bitflips are detected
in erased pages while actually there are none in the NAND chip.

Two solutions have been found at the same time. One was to enlarge the
free OOB area to 64 bytes, changing the layout to be:

+----------------------------------------------------------------------------+
| 1024 (data) | 30 (ECC) | 1024 (data) | 30 (ECC) | 64 (free OOB) | 30 (ECC) |
+----------------------------------------------------------------------------+
                                                    ^^

The very big drawbacks of this solution are:
1/ It prevents booting from NAND.
2/ The current Linux driver (marvell_nand) does not have such problem
because it already re-reads possible empty pages in raw mode before
checking for bitflips. Using different layouts in U-Boot and Linux
would simply not work.

As this driver does support raw reads now and uses it to check for
empty pages, let's forget about this broken hack and return to the
initial layout with only 32 free OOB bytes.

Fixes: ac56a3b30c ("mtd: nand: pxa3xx: add support for 2KB 8-bit flash")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Jagan Teki <jagan@openedev.com>
5 years agomtd: nand: pxa3xx: re-read a page in raw mode on uncorrectable error
Miquel Raynal [Thu, 11 Oct 2018 15:45:43 +0000 (17:45 +0200)]
mtd: nand: pxa3xx: re-read a page in raw mode on uncorrectable error

This only applies on BCH path.

When an empty page is read, it triggers an uncorrectable error. While
this is expected, the ECC engine might produce itself bitflips in the
read data under certain layouts. To overcome this situation, always
re-read the entire page in raw mode and check for the whole page to be
empty.

Also report the right number of bitflips if there are any.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Jagan Teki <jagan@openedev.com>
5 years agomtd: nand: pxa3xx: add raw read support
Miquel Raynal [Thu, 11 Oct 2018 15:45:42 +0000 (17:45 +0200)]
mtd: nand: pxa3xx: add raw read support

Raw read support is added by editing a few code sections:

    ->handle_data_pio() includes the ECC bytes that are not consumed
    anymore by the ECC engine.

    ->prepare_set_command() is changed so that the ECC bytes are
    requested as part of the data I/O length.

    ->drain_fifo() shall also avoid checking the R/B pin too often
    when in raw mode.

    ->read_page_raw()/->read_oob_raw() are written from scratch.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Jagan Teki <jagan@openedev.com>
5 years agoMerge git://git.denx.de/u-boot-marvell
Tom Rini [Tue, 20 Nov 2018 17:36:47 +0000 (12:36 -0500)]
Merge git://git.denx.de/u-boot-marvell

- Clearfog GT-8K support added by Baruch / Raheeb
- const and sizes cleanup (also in MIPS) from Baruch
- Minor cleanup to db-88f6820 from Chris

5 years agoMerge branch '2018-11-19-master-imports'
Tom Rini [Tue, 20 Nov 2018 17:36:08 +0000 (12:36 -0500)]
Merge branch '2018-11-19-master-imports'

- adc enhancements
- FAT fix

5 years agofs: fat: assign rootdir sector when accessing root directory
Thomas RIENOESSL [Tue, 13 Nov 2018 13:00:59 +0000 (14:00 +0100)]
fs: fat: assign rootdir sector when accessing root directory

This fixes problems accessing drives formated under
Windows as FAT16.

Signed-off-by: Thomas RIENOESSL <thomas.rienoessl@bachmann.info>
[trini: Rebase on top of f528c140c801]
Signed-off-by: Tom Rini <trini@konsulko.com>
5 years agoclk: meson: fix clk81 divider calculation
Jerome Brunet [Tue, 13 Nov 2018 10:38:38 +0000 (11:38 +0100)]
clk: meson: fix clk81 divider calculation

clk81 divider is 0 based (meaning that 0 value in the register means
divide by 1). Fix clk81 rate calculation for this.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
5 years agocmd: adc: add an option to scan some or all available channels
Fabrice Gasnier [Mon, 12 Nov 2018 13:04:01 +0000 (14:04 +0100)]
cmd: adc: add an option to scan some or all available channels

Add new option to 'adc' command to do a single scan of:
- some channel(s), using mask argument
- all channels available on an ADC device (when optional mask is omitted).

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agocmd: adc: print single conversion also in uV
Fabrice Gasnier [Mon, 12 Nov 2018 13:04:00 +0000 (14:04 +0100)]
cmd: adc: print single conversion also in uV

Use newly introduced adc_raw_to_uV() API to print conversion result
both as raw value and micro-volts by default.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agocmd: adc: add info on channel mask
Fabrice Gasnier [Mon, 12 Nov 2018 13:03:59 +0000 (14:03 +0100)]
cmd: adc: add info on channel mask

Enhance adc info command to report also the channel mask.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agodm: adc: add uclass's mask and conversion helpers
Fabrice Gasnier [Mon, 12 Nov 2018 13:03:58 +0000 (14:03 +0100)]
dm: adc: add uclass's mask and conversion helpers

Add two functions to ADC uclass's:
- adc_raw_to_uV() to ease ADC raw value conversion to microvolts
- adc_channel_mask() to get channels on consumer side

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agoARM: mvebu: dts: add Clearfog GT-8K
Rabeeh Khoury [Thu, 25 Oct 2018 17:37:47 +0000 (20:37 +0300)]
ARM: mvebu: dts: add Clearfog GT-8K

The SolidRun Clearfog GT-8K is based on Armada 8040.

https://wiki.solid-run.com/doku.php?id=products:a8040:clearfoggt8k

The config file is identical to the Macchiatobin one
(mvebu_mcbin-88f8040_defconfig) with only the default device-tree
changed.

Signed-off-by: Rabeeh Khoury <rabeeh@solid-run.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoARM: mvebu: db-88f6820: remove redundant comment
Chris Packham [Mon, 19 Nov 2018 06:59:23 +0000 (19:59 +1300)]
ARM: mvebu: db-88f6820: remove redundant comment

After migration to Kconfig the comment about TEXT_BASE has become
redundant.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoarm64: mvebu: a8k: autodetect RAM size
Baruch Siach [Sun, 11 Nov 2018 10:31:04 +0000 (12:31 +0200)]
arm64: mvebu: a8k: autodetect RAM size

Some Armada 8K boards like Macchiatobin and Clearfog GT-8K use RAM from
external DIMM. Hard coding the RAM size in the device-tree is not
convenient. Fortunately, the ATF that initializes the RAM knows the size
of RAM, and U-Boot can query the ATF using a SMC call.

The ATF maps the lower 3G of RAM starting at address 0. Higher RAM is
mapped at 4G. This leaves a 1G hole between 3G and 4G for IO
peripherals. Use a second bi_dram[] entry to describe the higher RAM
area. As a result, CONFIG_NR_DRAM_BANKS must be set to 2 to use more
than 3GB RAM.

This code in this commit is mostly taken from downstream Marvell U-Boot
code by Grzegorz Jaszczyk.

Cc: Grzegorz Jaszczyk <jaz@semihalf.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agolinux/sizes.h: sync from kernel
Baruch Siach [Sun, 11 Nov 2018 10:31:03 +0000 (12:31 +0200)]
linux/sizes.h: sync from kernel

The kernel added SZ_4G macro in commit f2b9ba871b (arm64/kernel: kaslr:
reduce module randomization range to 4 GB).

Include linux/const.h for the _AC macro.

Drop a local SZ_4G definition in tegra code.

Cc: Tom Warren <twarren@nvidia.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoMIPS: drop asm/const.h
Baruch Siach [Sun, 11 Nov 2018 10:31:02 +0000 (12:31 +0200)]
MIPS: drop asm/const.h

Commit 86f21c96f467368 (mips: Use common _AC macro now.) removed the _AC
definition from const.h. All other macros defined in const.h are not
used anywhere, and there is now no user of this header. Remove this
header.

Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoUse _AC and UL macros from linux/const.h
Baruch Siach [Sun, 11 Nov 2018 10:31:01 +0000 (12:31 +0200)]
Use _AC and UL macros from linux/const.h

Drop the _AC and UL macros from common.h. Linux headers is the original
source of this macro, so keep its definition in the same header.

Update existing users of these macros to include const.h directly.

Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Rick Chen <rick@andestech.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agolinux/const.h: import from kernel
Baruch Siach [Sun, 11 Nov 2018 10:31:00 +0000 (12:31 +0200)]
linux/const.h: import from kernel

Combine the uapi/linux/const.h header into the kernel linux/const.h. The
next commit will use the _AC macro this header instead of the common.h
definition.

Based on Linux kernel version 4.19.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoMerge tag 'mips-pull-2018-11-18' of git://git.denx.de/u-boot-mips
Tom Rini [Sun, 18 Nov 2018 20:47:16 +0000 (15:47 -0500)]
Merge tag 'mips-pull-2018-11-18' of git://git.denx.de/u-boot-mips

- tree-wide: introduce LDFLAGS_STANDALONE
- MIPS: fix long-standing issue with linking of standalone programs
- MIPS: MT76xx: add GPIO and WDT drivers
- MIPS: MT76xx: various fixes and updates to gardena-smart-gateway board
- MIPS: MT76xx: various fixes and updates to linkit-smart-7688 board

5 years agoMIPS: fix linking of standalone programs
Daniel Schwierzeck [Sun, 23 Sep 2018 17:15:17 +0000 (19:15 +0200)]
MIPS: fix linking of standalone programs

Use the global MIPS specific u-boot.lds for linking standalone programs
instead of the outdated ones in examples/standalone/. Also pass --gc-sections
in LDFLAGS_STANDALONE to optimize the size of standalone programs.
Finally remove the deprecated config.mk files in arch/mips/cpu/mips[32,64]/.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
5 years agoKbuild: standalone: do not ignore platform-specific OBJCOPYFLAGS
Daniel Schwierzeck [Sun, 23 Sep 2018 17:15:16 +0000 (19:15 +0200)]
Kbuild: standalone: do not ignore platform-specific OBJCOPYFLAGS

Currently the OBJCOPYFLAGS are cleared when assigning "-O srec"
or "-O binary" for standalone programs. All flags set by arch-specific
Makefiles are lost. This is bad if an arch demands arch-specific
flags for the objcopy step.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agoKbuild: add LDFLAGS_STANDALONE
Daniel Schwierzeck [Sun, 23 Sep 2018 17:15:15 +0000 (19:15 +0200)]
Kbuild: add LDFLAGS_STANDALONE

Introduce a new Makefile variable for passing LDFLAGS to standalone
programs. Currently the variable CONFIG_STANDALONE_LOAD_ADDR is
misued on some archs to pass a specific linker script.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>
5 years agomips: mt76xx: linkit-smart-7688: Misc updates to dts/config/defconfig
Stefan Roese [Tue, 9 Oct 2018 06:59:16 +0000 (08:59 +0200)]
mips: mt76xx: linkit-smart-7688: Misc updates to dts/config/defconfig

These misc updates include the following changes:
- Change baudrate from 57600 to 115200
- Enable MIPS_BOOT_CMDLINE_LEGACY
- Enable FIT support
- Enable ethernet support
- Enable SPI support
- Enable GPIO support
- Change max image size from 0x40000 to 0x80000

A note about the baudrate change:

The original Mediatek U-Boot version used 57600 baud. Lets move to a
more common and faster speed of 115200 baud. And remove the "console="
property from the DT as its not needed.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
5 years agomips: mt76xx: linkit-smart-7688: Use ioremap_nocache to get address
Stefan Roese [Tue, 9 Oct 2018 06:59:15 +0000 (08:59 +0200)]
mips: mt76xx: linkit-smart-7688: Use ioremap_nocache to get address

Use the correct function to get the uncached address to access the SoC
registers.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
5 years agomips: mt76xx: gardena-smart-gateway: Misc updates to dts/config/defconfig
Stefan Roese [Tue, 9 Oct 2018 06:59:14 +0000 (08:59 +0200)]
mips: mt76xx: gardena-smart-gateway: Misc updates to dts/config/defconfig

These misc updates include the following changes:
- Change baudrate from 57600 to 115200
- Enable MIPS_BOOT_CMDLINE_LEGACY
- Enable FIT support
- Enable ethernet support
- Enable SPI NOR and NAND support
- Change MTD_UBI_BEB_LIMIT to 22
- Enable MTD Support
- Enable GPIO support
- Enable watchdog support
- Enable bootcounter support
- Enable version variable
- Change max image size from 0x80000 to 0xa0000
- Change SYS_MALLOC_LEN to 16MiB (because of UBI/UBIFS)

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
5 years agomips: mt76xx: gardena-smart-gateway: Add board_late_init() to set LED def state
Stefan Roese [Tue, 9 Oct 2018 06:59:13 +0000 (08:59 +0200)]
mips: mt76xx: gardena-smart-gateway: Add board_late_init() to set LED def state

This is needed to set the LEDs automatically to a default state, as
configured in the dts.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
5 years agomips: mt76xx: gardena-smart-gateway: Add LEDs to dts
Stefan Roese [Tue, 9 Oct 2018 06:59:12 +0000 (08:59 +0200)]
mips: mt76xx: gardena-smart-gateway: Add LEDs to dts

Add the available LEDs to the DTS file so that they can be used.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
5 years agomips: mt76xx: gardena-smart-gateway: Configure GPIOs (digital vs analog)
Stefan Roese [Tue, 9 Oct 2018 06:59:11 +0000 (08:59 +0200)]
mips: mt76xx: gardena-smart-gateway: Configure GPIOs (digital vs analog)

Configure digital vs analog GPIOs as needed on this board.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
5 years agomips: mt76xx: Enable watchdog support
Stefan Roese [Tue, 9 Oct 2018 06:59:10 +0000 (08:59 +0200)]
mips: mt76xx: Enable watchdog support

This patch enables and starts the watchdog on the MT7620 platform.
Currently the WD timeout is configured to 60 seconds.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
[fixed build error due to missing function prototype arch_misc_init]
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
5 years agomips: mt76xx: Kconfig: Add ethernet and GPIO support
Stefan Roese [Tue, 9 Oct 2018 06:59:09 +0000 (08:59 +0200)]
mips: mt76xx: Kconfig: Add ethernet and GPIO support

Imply DM_ETH and DM_GPIO for ARCH_MT7620, as this platform now supports
ethernet and GPIO as well.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
5 years agomips: mt76xx: Add watchdog DT node to mt7628a.dtsi
Stefan Roese [Tue, 9 Oct 2018 06:59:08 +0000 (08:59 +0200)]
mips: mt76xx: Add watchdog DT node to mt7628a.dtsi

Add the watchdog DT node to the DTS file.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
5 years agomips: mt76xx: Add GPIO DT nodes to mt7628a.dtsi
Stefan Roese [Tue, 9 Oct 2018 06:59:07 +0000 (08:59 +0200)]
mips: mt76xx: Add GPIO DT nodes to mt7628a.dtsi

Add the GPIO DT nodes to the DTS file.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
5 years agomips: mt76xx: Add ethernet DT node to mt7628a.dtsi
Stefan Roese [Tue, 9 Oct 2018 06:59:06 +0000 (08:59 +0200)]
mips: mt76xx: Add ethernet DT node to mt7628a.dtsi

Add the ethernet DT node to the DTS file.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
5 years agomips: mt76xx: lowlevel_init.S: Add missing memory controller reset in DDR init
Stefan Roese [Tue, 9 Oct 2018 06:59:04 +0000 (08:59 +0200)]
mips: mt76xx: lowlevel_init.S: Add missing memory controller reset in DDR init

This fixes an issue which has been noticed on the Gardena board, with
the watchdog enabled, where the watdchdog reset (after a system hang)
did result in reporting of 2.9 GiB and a hang after this. With this
patch applied the memory controller is correctly reset and initialized
again even after a watchdog reset.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
5 years agogpio: Add MT7621 GPIO support
Stefan Roese [Mon, 8 Oct 2018 10:38:01 +0000 (12:38 +0200)]
gpio: Add MT7621 GPIO support

This patch adds GPIO support for the Mediatek MT7621 SoC, tested on
MT7688 (Gardena smart-gateway). The driver is loosly based on the
Linux kernel version.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
[fixed checkpatch.pl warnings: Prefer 'unsigned int' to bare use of 'unsigned']
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
5 years agowdt: Add MT7621 watchdog driver
Stefan Roese [Thu, 4 Oct 2018 11:39:07 +0000 (13:39 +0200)]
wdt: Add MT7621 watchdog driver

This patch adds watchdog support for the Mediatek MT7621 SoC. The driver
is loosly based on the Linux kernel version.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
[fixed merge conflict in drivers/watchdog/Kconfig]
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
5 years agoMerge branch '2018-11-16-master-imports'
Tom Rini [Sat, 17 Nov 2018 13:19:40 +0000 (08:19 -0500)]
Merge branch '2018-11-16-master-imports'

- Initial bcm968580xref, am65x_evm_r5 support
- lpc32xx, omap3_logic/am3517_evm updates
- pinctrl command
- fs_loader available for SPL

5 years agosunxi: Update MAINTAINERS file for recent boards
Tom Rini [Fri, 16 Nov 2018 14:32:31 +0000 (09:32 -0500)]
sunxi: Update MAINTAINERS file for recent boards

Add entries for the pine64-lts and pinebook configs.

Cc: Vasily Khoruzhick <anarsoul@gmail.com>
Cc: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
5 years agofdt_region: Ensure that depth never goes below -1
Konrad Beckmann [Wed, 7 Nov 2018 19:51:46 +0000 (14:51 -0500)]
fdt_region: Ensure that depth never goes below -1

A specially crafted FIT image makes it possible to overflow the stack
with controlled values when using the verified boot feature. Depending
on the memory layout, this could be used to overwrite configuration
variables on the heap and setting them to 0, e.g. disable signature
verification, thus bypassing it.

This change fixes a bug in fdt_find_regions where the fdt structure is
parsed. A lower value than -1 of depth can lead to a buffer underflow
write on the stack.

Signed-off-by: Konrad Beckmann <konrad.beckmann@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agoimage-sig: Ensure that hashed-nodes is null-terminated
Konrad Beckmann [Wed, 7 Nov 2018 19:51:45 +0000 (14:51 -0500)]
image-sig: Ensure that hashed-nodes is null-terminated

A specially crafted FIT image leads to memory corruption in the stack
when using the verified boot feature. The function fit_config_check_sig
has a logic error that makes it possible to write past the end of the
stack allocated array node_inc. This could potentially be used to bypass
the signature check when using verified boot.

This change ensures that the number of strings is correct when counted.

Signed-off-by: Konrad Beckmann <konrad.beckmann@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agoAbility to modify distro boot filename
Martyn Welch [Tue, 6 Nov 2018 12:23:53 +0000 (12:23 +0000)]
Ability to modify distro boot filename

Add in the ability to modify the distro boot filename. Whilst not
immediately useful in normal usage, it allows an alternative
configuration to be provided when other u-boot functionality is used, such
as bootcount limit, to fallback to an alternative boot configuration. In
this case we can follow the same boot path as for normal boot, just
using an alternatively named configuration file.

For example, by providing the following `altbootcmd` when bootcount is in
use:

altbootcmd=setenv boot_extlinx_conf extlinux-rollback.conf; \
run distro_bootcmd

Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agomisc: fs_loader: Fix compiler warning
Keerthy [Mon, 5 Nov 2018 06:04:54 +0000 (11:34 +0530)]
misc: fs_loader: Fix compiler warning

Fix compiler warning

drivers/misc/fs_loader.c:193:9: warning: format ‘%d’ expects
argument of type ‘int’, but argument 5 has type ‘size_t
{aka long unsigned int}’ [-Wformat=]

Signed-off-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agomisc: fs_loader: Use device_get_global_by_ofnode to get to node
Keerthy [Mon, 5 Nov 2018 06:04:53 +0000 (11:34 +0530)]
misc: fs_loader: Use device_get_global_by_ofnode to get to node

Instead of two staged ofnode_to_offset followed by
device_get_global_by_of_offset approach, direcly use the
device_get_global_by_ofnode to fetch the device.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agofs: Makefile: Add fs.c under SPL for fs_loader
Keerthy [Mon, 5 Nov 2018 06:04:52 +0000 (11:34 +0530)]
fs: Makefile: Add fs.c under SPL for fs_loader

Add fs.c under SPL as well as it is needed for fs_loader

Signed-off-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
[trini: Add as obj-$(CONFIG_FS_LOADER) for non-SPL_FRAMEWORK builds]
Signed-off-by: Tom Rini <trini@konsulko.com>
5 years agoserial: ns16550: add setconfig support
Simon Goldschmidt [Fri, 2 Nov 2018 20:28:08 +0000 (21:28 +0100)]
serial: ns16550: add setconfig support

Add possibility to update the serial parity used.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Hannes Schmelzer <hannes.schmelzer@br-automation.com>
5 years agodm: serial: fix comment on dm_serial_ops setconfig
Simon Goldschmidt [Fri, 2 Nov 2018 20:08:16 +0000 (21:08 +0100)]
dm: serial: fix comment on dm_serial_ops setconfig

The comment on this function prototype describes nonexistent
parameters. It seems to be copied from 'setparity'.

Update it to match its the parameter list.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agoboard: ti: am65x: Update README to add R5 build support
Lokesh Vutla [Fri, 2 Nov 2018 14:21:11 +0000 (19:51 +0530)]
board: ti: am65x: Update README to add R5 build support

Update the README file to add r5 build support and system
firmware support.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
5 years agoconfigs: am65x_evm_r5: Add initial support
Lokesh Vutla [Fri, 2 Nov 2018 14:21:10 +0000 (19:51 +0530)]
configs: am65x_evm_r5: Add initial support

Add initial defconfig support for AM65x
that runs on R5.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Signed-off-by: Keerthy <j-keerthy@ti.com>
5 years agoarmv7r: dts: am654: Add initial support
Lokesh Vutla [Fri, 2 Nov 2018 14:21:09 +0000 (19:51 +0530)]
armv7r: dts: am654: Add initial support

Add R5 specific dts for am654-evm.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Signed-off-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Schuyler Patton <spatton@ti.com>
Signed-off-by: James Doublesin <doublesin@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agoarm: dts: k3: Sync dts from Linux
Lokesh Vutla [Fri, 2 Nov 2018 14:21:08 +0000 (19:51 +0530)]
arm: dts: k3: Sync dts from Linux

Sync the k3-am654 specific dts files from Linux next with tag
20181019. This changes are in queue for Linux v4.20-rc1

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
5 years agoboard: ti: am654: r5: Add initial support for am654
Lokesh Vutla [Fri, 2 Nov 2018 14:21:07 +0000 (19:51 +0530)]
board: ti: am654: r5: Add initial support for am654

Add initial support for AM654 based EVM running on R5.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
5 years agoarmv7R: K3: am654: Add support for triggering ddr init from SPL
Lokesh Vutla [Fri, 2 Nov 2018 14:21:06 +0000 (19:51 +0530)]
armv7R: K3: am654: Add support for triggering ddr init from SPL

In SPL, DDR should be made available by the end of board_init_f()
so that apis in board_init_r() can use ddr. Adding support
for triggering DDR initialization from board_init_f().

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
5 years agoarmv7R: K3: am654: Add support to start ATF from R5 SPL
Lokesh Vutla [Fri, 2 Nov 2018 14:21:05 +0000 (19:51 +0530)]
armv7R: K3: am654: Add support to start ATF from R5 SPL

Considering the boot time requirements, Cortex-A core
should be able to start immediately after SPL on R5.
Add support for the same.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
5 years agoarmv7R: K3: am654: Add support for generating build targets
Lokesh Vutla [Fri, 2 Nov 2018 14:21:04 +0000 (19:51 +0530)]
armv7R: K3: am654: Add support for generating build targets

Update Makefiles to generate:
- tiboot3.bin: Image format that can be processed by ROM.

Below is the tiboot3.bin image format that is required by ROM:

 _______________________
|  X509 |
|     Certificate |
| ____________________ |
| |       | |
| | u-boot-spl.bin    | |
| |       | |
| |___________________| |
|_______________________|

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
5 years agoarmv7R: K3: am654: Enable MPU regions
Lokesh Vutla [Fri, 2 Nov 2018 14:21:03 +0000 (19:51 +0530)]
armv7R: K3: am654: Enable MPU regions

Enable MPU regions for AM654 evm:
- Region0: 0x00000000 - 0xFFFFFFFF: Device memory, not executable
- Region1: 0x41c00000 - 0x42400000: Normal, executable, WB, Write alloc
- Region2: 0x80000000 - 0xFFFFFFFF: Normal, executable, WB, Write alloc
- region3-15: Disabled

With this dcache can be enabled either in SPL or U-Boot.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
5 years agoram: Introduce K3 AM654 DDR Sub System driver
Lokesh Vutla [Fri, 2 Nov 2018 14:21:02 +0000 (19:51 +0530)]
ram: Introduce K3 AM654 DDR Sub System driver

K3 based AM654 devices has DDR memory subsystem that comprises
Synopys DDR controller, Synopsis DDR phy and wrapper logic to
intergrate these blocks into the device. This DDR subsystem
provides an interface to external SDRAM devices. Adding support
for the initialization of the external SDRAM devices by
configuring the DDRSS registers and using the buitin PHY
routines.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Signed-off-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Schuyler Patton <spatton@ti.com>
Signed-off-by: James Doublesin <doublesin@ti.com>
5 years agoi2c: stm32f7: change setup struct to const
Patrick Delaunay [Mon, 29 Oct 2018 14:31:56 +0000 (15:31 +0100)]
i2c: stm32f7: change setup struct to const

Change static array to const when it is useful to save memory
(move stm32f7_setup=0x18 from .data to .rodata section)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
5 years agoi2c: stm32f7: cosmetic: clean the driver
Patrick Delaunay [Mon, 29 Oct 2018 14:31:55 +0000 (15:31 +0100)]
i2c: stm32f7: cosmetic: clean the driver

Solve alignments issues in the driver to avoid
checkpatch error.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
5 years agoARM: am3517_evm: Remove SPL_OF_CONTROL and OF_PLATDATA
Adam Ford [Sun, 28 Oct 2018 13:49:57 +0000 (08:49 -0500)]
ARM: am3517_evm: Remove SPL_OF_CONTROL and OF_PLATDATA

After the recomendation, some testing shows like these are unnecessary.

Suggested-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Signed-off-by: Adam Ford <aford173@gmail.com>
5 years agoARM: omap3_logic: Remove SPL_OF_CONTROL and OF_PLATDATA
Adam Ford [Sun, 28 Oct 2018 13:49:56 +0000 (08:49 -0500)]
ARM: omap3_logic: Remove SPL_OF_CONTROL and OF_PLATDATA

After the recomendation, some testing shows like these are unnecessary.

Suggested-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Signed-off-by: Adam Ford <aford173@gmail.com>
5 years agoarm: Make arch specific memcpy thumb-safe.
Klaus Goger [Thu, 26 Apr 2018 18:18:10 +0000 (20:18 +0200)]
arm: Make arch specific memcpy thumb-safe.

The current arch implementation of memcpy cannot be called
from thumb code, because it does not use bx instructions on return.
This patch addresses that. Note, that this patch does not touch
the hot loop of memcpy, so performance is not affected.

Tested on MXS (arm926ejs) with and without thumb-mode enabled.

Signed-off-by: Klaus Goger <klaus.goger@theobroma-systems.com>
Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
5 years agotest/py: test pinmux command
Patrice Chotard [Wed, 24 Oct 2018 12:10:23 +0000 (14:10 +0200)]
test/py: test pinmux command

Add pinmux test which test the following commands:
  - pinmux list
  - pinmux dev
  - pinmux status

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
[trini: Mark some tests as sandbox-centric]
Signed-off-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
5 years agopinctrl: sandbox: Add get_pin_muxing ops support
Patrice Chotard [Wed, 24 Oct 2018 12:10:22 +0000 (14:10 +0200)]
pinctrl: sandbox: Add get_pin_muxing ops support

Add get_pin_mux ops support to display the pin muxing
description of the sandbox_pins[]

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agogpio: stm32f7: Add ops get_function
Patrice Chotard [Wed, 24 Oct 2018 12:10:21 +0000 (14:10 +0200)]
gpio: stm32f7: Add ops get_function

This patch adds gpio get_function ops support.
This function reports the state of a gpio.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agopinctrl: stm32: Add get_pin_muxing() ops
Patrice Chotard [Wed, 24 Oct 2018 12:10:20 +0000 (14:10 +0200)]
pinctrl: stm32: Add get_pin_muxing() ops

Add get_pin_muxing() ops to obtain the pin muxing description
a given pin index.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agopinctrl: stm32: Add get_pin_name() ops
Patrice Chotard [Wed, 24 Oct 2018 12:10:19 +0000 (14:10 +0200)]
pinctrl: stm32: Add get_pin_name() ops

Add get_pin_name ops to obtain a pin name given a
pin index of a specified pin-controller.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agopinctrl: stm32: Add get_pins_count() ops
Patrice Chotard [Wed, 24 Oct 2018 12:10:18 +0000 (14:10 +0200)]
pinctrl: stm32: Add get_pins_count() ops

Add get_pins_count ops to obtain the number of pins
owns by a pin-controller.
On STM32 SoCs bindings, each pin-controller owns
several gpio banks. Each GPIO bank can own up to 16 pins.

To obtain the total pins count, walk through each sub-nodes
(ie GPIO banks) and sum each GPIO banks pins number. For that
in probe() we build a list with each GPIO device reference found.
This list will also be used with future get_pin_muxing and get_pin_name
ops to speed up and optimize walk through all GPIO banks.

As this code is common to all STM32 SoCs, this code is put
under SPL_BUILD compilation flag to avoid to increase SPL code size
for STM32F7 which is limited to 32Ko.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agocmd: pinmux: Add pinmux command
Patrice Chotard [Wed, 24 Oct 2018 12:10:17 +0000 (14:10 +0200)]
cmd: pinmux: Add pinmux command

pinmux command allows to :
 - list all pin-controllers available on platforms
 - select a pin-controller
 - display the muxing of all pins of the current pin-controller
   or all pin-controllers depending of given options

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
cmd: pinmux: Fix pinmux command

if "pinmux status" command is used without having
set dev using "pinmux dev", print pinmux usage
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agodm: uclass: Add uclass_foreach_dev_probe
Patrice Chotard [Wed, 24 Oct 2018 12:10:16 +0000 (14:10 +0200)]
dm: uclass: Add uclass_foreach_dev_probe

Add uclass_foreach_dev_probe() which iterates through
devices of a given uclass. Devices are probed if necessary
and are ready to use.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agodm: uclass: Add uclass_next_device_err() to return a valid device
Patrice Chotard [Wed, 24 Oct 2018 12:10:15 +0000 (14:10 +0200)]
dm: uclass: Add uclass_next_device_err() to return a valid device

Similarly to uclass_first_device_err(), add uclass_next_device_err()
which returns an error if there are no next devices in that uclass.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agodm: pinctrl: Add pinctrl_get_pin_name and pinctrl_get_pins_count
Patrice Chotard [Wed, 24 Oct 2018 12:10:14 +0000 (14:10 +0200)]
dm: pinctrl: Add pinctrl_get_pin_name and pinctrl_get_pins_count

Add pinctrl_get_pin_name() and pinctrl_get_pins_count() methods
to obtain pin's name and pin's muxing given a pin reference.

This will be used by the new pinmux command.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agodm: pinctrl: Add get_pin_muxing() ops
Patrice Chotard [Wed, 24 Oct 2018 12:10:13 +0000 (14:10 +0200)]
dm: pinctrl: Add get_pin_muxing() ops

Add get_pin_muxing() which allows to display the muxing
of a given pin belonging to a pin-controller.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agow1-eeprom: Add support for Maxim DS2502 add only memory
Martin Fuzzey [Wed, 24 Oct 2018 08:21:19 +0000 (10:21 +0200)]
w1-eeprom: Add support for Maxim DS2502 add only memory

Signed-off-by: Martin Fuzzey <martin.fuzzey@flowbird.group>
5 years agoARM: omap3_logic: Make CONFIG_SYS_TEXT_BASE match README.omap3
Adam Ford [Sun, 21 Oct 2018 18:58:39 +0000 (13:58 -0500)]
ARM: omap3_logic: Make CONFIG_SYS_TEXT_BASE match README.omap3

README.omap3 has two options.  For option 1, CONFIG_SYS_TEXT_BASE
is set to 0x80100000.  Option 2 lists 0x80008000.  The existing
value is neither of these, so this patch makes it equivalent to
Option 1.

Signed-off-by: Adam Ford <aford173@gmail.com>
5 years agoARM: am3517_evm: Build for Thumb
Adam Ford [Sun, 21 Oct 2018 15:50:59 +0000 (10:50 -0500)]
ARM: am3517_evm: Build for Thumb

In an effort to free up more resources in SPL and U-Boot, building
for Thumb shrinks the code side.

Before:

  text    data     bss     dec     hex filename
  685588  25808  275724  987120   f0ff0 u-boot

  text    data     bss     dec     hex filename
  55324     417   67460  123201   1e141 spl/u-boot-spl

After:

   text    data     bss     dec     hex filename
 515502   25808  275708  817018   c777a u-boot

   text    data     bss     dec     hex filename
  42910     417   67460  110787   1b0c3 spl/u-boot-spl

Signed-off-by: Adam Ford <aford173@gmail.com>
5 years agoconfigs: am3517_evm: Use default OMAP3 memory settings
Adam Ford [Sun, 21 Oct 2018 15:34:49 +0000 (10:34 -0500)]
configs: am3517_evm: Use default OMAP3 memory settings

The AM3517 is mostly am omap3, so this partch removes the custom
memory configurations and just uses the default common entries
for omap3 and armv7.

Signed-off-by: Adam Ford <aford173@gmail.com>
5 years agoARM: DTS: Resync am3517-evm.dts with Linux 4.19
Adam Ford [Sun, 21 Oct 2018 14:09:01 +0000 (09:09 -0500)]
ARM: DTS: Resync am3517-evm.dts with Linux 4.19

Some minor changes have been made to the AM3517-evm and the underlying
am3517.dtsi files.  This patch re-sync's the DTS and DTSI files with
Linux.

Signed-off-by: Adam Ford <aford173@gmail.com>