Bin Meng [Tue, 22 Aug 2017 15:15:16 +0000 (08:15 -0700)]
nvme: Get rid of the global variable nvme_info
At present the NVMe uclass driver uses a global variable nvme_info
to store global information like namespace id, and NVMe controller
driver's priv struct has a blk_dev_start that is used to calculate
the namespace id based on the global information from nvme_info.
This is not a good design in the DM world and can be replaced with
the following changes:
- Encode the namespace id in the NVMe block device name during
the NVMe uclass post probe
- Extract the namespace id from the device name during the NVMe
block device probe
- Let BLK uclass calculate the devnum for us by passing -1 to
blk_create_devicef() as the devnum
Bin Meng [Tue, 22 Aug 2017 15:15:14 +0000 (08:15 -0700)]
nvme: Apply cache operations on the DMA buffers
So far cache operations are only applied on the submission queue and
completion queue, but they are missing in other places like identify
and block read/write routines.
In order to correctly operate on the caches, the DMA buffer passed
to identify routine must be allocated properly on the stack with the
existing macro ALLOC_CACHE_ALIGN_BUFFER().
Bin Meng [Tue, 22 Aug 2017 15:15:12 +0000 (08:15 -0700)]
nvme: Use macros to access NVMe queues
NVMe driver only uses two queues. The first one is allocated to do
admin stuff, while the second one is for IO stuff. So far the driver
uses magic number (0/1) to access them. Change to use macros.
Bin Meng [Tue, 22 Aug 2017 15:15:11 +0000 (08:15 -0700)]
nvme: Respect timeout when en/disabling the controller
So far the driver unconditionally delays 10ms when en/disabling the
controller and still return 0 if 10ms times out. In fact, spec defines
a timeout value in the CAP register that is the worst case time that
host software shall wait for the controller to become ready.
Bin Meng [Tue, 22 Aug 2017 15:15:07 +0000 (08:15 -0700)]
nvme: Fix getting PCI vendor id of the NVMe block device
The codes currently try to read PCI vendor id of the NVMe block
device by dm_pci_read_config16() with its parameter set as its
root complex controller (ndev->pdev) instead of itself. This is
seriously wrong. We can read the vendor id by passing the correct
udevice parameter to the dm_pci_read_config16() API, however there
is a shortcut by reading the cached vendor id from the PCI device's
struct pci_child_platdata.
While we are here fixing this bug, apparently the quirk stuff handle
codes in nvme_get_info_from_identify() never takes effect since its
logic has never been true at all. Remove these codes completely.
Tom Rini [Sun, 27 Aug 2017 15:50:16 +0000 (11:50 -0400)]
sh: Fix linking of ms7722se
While it is true that we no longer have 'ppcenv' and similar sections,
including env/embedded.o at all results in the text/etc sections being
available for the rest of the link. This in turn is required for the
setup used on ms7722se. This also, likely, needs further fine-tuning.
Fixes: f40ad66fa066 ("arch/sh: don't bring common/env_embedded.o into the link") Signed-off-by: Tom Rini <trini@konsulko.com>
Stefan Agner [Wed, 23 Aug 2017 16:46:17 +0000 (09:46 -0700)]
disk: part: align buffer so it can be used with DMA enabled drivers
When using ISO partitions with a DMA enabled block device driver
reading the ISO partition leads to unaligned DMA operations:
CACHE: Misaligned operation at range [bffb7da8, bffb85a8]
Align the buffer to make sure we pass a buffer which works for
DMA operations.
Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Stephen Boyd [Wed, 23 Aug 2017 01:59:31 +0000 (10:59 +0900)]
scripts: objdiff: Ignore debug info when comparing
If the kernel is configured to be built with debug symbols, or
has bug tables, comparing files may not work if line numbers
change. This makes comparing object files with these options
harder to do. Let's strip out the debug info and drop the
__bug_table here so that we don't see false positives. There may
be other things to drop later, and it may be architecture
specific, but this works for me with my ARM64 build.
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org> Reviewed-by: Jason Cooper <jason@lakedaemon.net> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Tom Rini [Mon, 21 Aug 2017 02:30:15 +0000 (22:30 -0400)]
fs: ext4: Fix journal overrun issue reported by Coverity
While &p_jdb[fs->blksz] is a valid expression (it points *one* char
sized element past the end of the array, e.g. &p_jdb[fs->blksz + 1] is
invalid (according to the C standard (C99/C11)).
Changing this to tag = (struct ext3_journal_block_tag *)(p_jdb + ofs);
Cc: Stefan Brüns <stefan.bruens@rwth-aachen.de> Suggested-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Reported-by: Coverity (CID: 165117, 165110) Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Tom Rini [Mon, 21 Aug 2017 00:05:40 +0000 (20:05 -0400)]
mtdparts: Fix final outstanding issue reported by Coverity
As part of fixing the previously reported issues, it was missed that in
the case of mtdparts_init() we need to make sure that tmp_ep is long
enough to contain PARTITION_MAXLEN and a NULL termination. Then, to be
sure the buffer is NULL terminated, zero the entire buffer rather than
just ensuring the first character is NULL.
Cc: Lothar Waßmann <LW@KARO-electronics.de> Cc: Maxime Ripard <maxime.ripard@free-electrons.com> Reported-by: Coverity (CID: 166329) Signed-off-by: Tom Rini <trini@konsulko.com>
cmd: spl: provide address and size of prepared FDT in environment
Writing prepared FDT to persistent storage should be possible in
scripts. Create environment variables containing address and size
of the updated FDT. Scripts can use these variables after running
'spl export fdt ...' command to write the new blob to persistent
storage.
Pau Pajuelo [Thu, 17 Aug 2017 01:09:14 +0000 (03:09 +0200)]
igep00x0: merge igep0020 and igep0030 defconfigs to igep00x0_defconfig
Update igep00x0 code with the following features:
- Add board and revision detection for the boards:
- IGEP0020-RF
- IGEP0020-RC
- IGEP0030-RG
- IGEP0030-RE
- Merge IGEP0020 and IGEP0030 mux tables
- Add suport to use GPIO_126, GPIO_127 and GPIO_129
- board_name and board_rev environment variables display board and
revision informations
- Move dtb name selection from code to boot script
Ruchika Gupta [Wed, 16 Aug 2017 10:28:10 +0000 (15:58 +0530)]
ARMv8/sec_firmware : Update chosen/kaslr-seed with random number
kASLR support in kernel requires a random number to be passed via
chosen/kaslr-seed propert. sec_firmware generates this random seed
which can then be passed in the device tree node.
sec_firmware reserves JR3 for it's own usage. Node for JR3 is
removed from device-tree.
Thomas Petazzoni [Tue, 15 Aug 2017 20:52:45 +0000 (22:52 +0200)]
arch/arm/cpu/arm926ejs/spear/cpu.c: guard do_switch_ecc() with CONFIG_NAND_FSMC
do_switch_ecc() calls fsmc_nand_switch_ecc(), which is a direct
function call into drivers/mtd/nand/fsmc_nand.c. However, this
function is not guarded by CONFIG_NAND_FSMC, which results to a build
failure if CONFIG_NAND_FSMC is disabled.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Thomas Petazzoni [Tue, 15 Aug 2017 20:52:44 +0000 (22:52 +0200)]
board/spear/common: move code to arch/arm/cpu/arm926ejs/spear/
The code in board/spear/common/ is not board-specific but
SoC-specific. Therefore, boards from other vendors than "spear" may
want to re-use this code, which is currently difficult with the code
being placed in board/spear/common/.
Since this code really is SoC-specific, this commit moves it to
arch/arm/cpu/arm926ejs/spear/, with the rest of the SPEAr related
code.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reno Farnesi [Sun, 13 Aug 2017 19:16:17 +0000 (15:16 -0400)]
fs: fat: fix fatwrite overflow calculation
The overflow calculation was incorrect. Adding the start block of the
partition is not needed because the sectors are already relative to the
beginning of the partition. If you attempted to write a file smaller
than cur_part_info.start blocks on a full partition the old calculation
fails to catch the overflow. This would cause an infinite loop in the
determine_fatent function.
Old, incorrect calculation:
ending sector of new file = start sector + file size (in sectors)
last sector = partition start + total sectors on the partition
Adding the partition start block number is not needed because sectors
are already relative to the start of the partition.
New calculation:
ending sector of new file = start sector + file size (in sectors)
last sector = total sectors on the partition
Suniel Mahesh [Sat, 12 Aug 2017 07:56:38 +0000 (13:26 +0530)]
arm: dts: am33xx: sync DTS with Linux 4.13-rc4
This re-syncs AM33xx DTS file with current file from
Linux v4.13-rc4 to ensure a consistent configuration. Upstream
Linux removed the redundant Interrupt-parent property from mmc,
mac, lcdc and tscadc sub nodes.
Signed-off-by: Suniel Mahesh <sunil.m@techveda.org> Reviewed-by: Tom Rini <trini@konsulko.com>
Simon Glass [Fri, 25 Aug 2017 01:45:31 +0000 (19:45 -0600)]
rpi: Enable USB keyboard support
This is currently disabled, so USB keyboards are not detected in U-Boot.
Enable this option to fix that.
Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Jonathan Gray <jsg@jsg.id.au> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Paul Barker <pbarker@toganlabs.com>
Thomas Petazzoni [Fri, 28 Jul 2017 21:46:36 +0000 (23:46 +0200)]
arch/sh: don't bring common/env_embedded.o into the link
The linker script for SuperH brings the .ppcenv and .ppcenvr section
of common/env_embedded.o into the .text section. However, the .ppcenv
section is only ever filled in by env_embedded.o when
CONFIG_SYS_USE_PPCENV is defined, but no platforms in mainline U-Boot
use this.
In addition, common/env_embedded.o is not always built (when you use
CONFIG_ENV_IS_NOWHERE for example), which causes the following build
failure:
Thomas Petazzoni [Fri, 28 Jul 2017 21:14:28 +0000 (23:14 +0200)]
arch/sh: allow building in big-endian mode
The SuperH architecture allows to be run in either little or big
endian mode. Some SuperH SoCs get the little vs. big endian decision
through mode pins sampled at reset, so if big endian has been choosen
by HW designers, it cannot be easily changed.
Therefore, it makes sense to allow building U-Boot for SuperH in big
endian mode. To allow this, the only change needed is to adjust the
OUTPUT_FORMAT() in the linker script.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Marek Vasut [Sun, 20 Aug 2017 15:13:41 +0000 (17:13 +0200)]
ARM: rmobile: Enable KSZ90X1 PHY on Salvator-X
Commit da3b9e7fd6a1 (Move PHY_MICREL and PHY_MICREL_KSZ90X1 to Kconfig)
broke ethernet support on R8A779x Salvator-X boards by disabling the
KSZ90x1 PHY in Kconfig. Reenable it.
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Alexandru Gagniuc <alex.g@adaptrum.com> Cc: Joe Hershberger <joe.hershberger@ni.com> Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Marek Vasut [Sun, 20 Aug 2017 15:13:39 +0000 (17:13 +0200)]
clk: rmobile: Split R8A7795 and R8A7796 core clock tables
The R8A7795 and R8A7796 tables use different constants to identify
clock in DT, so split the tables and use the correct constants on
R8A7795. This fixes UART clock misconfiguration on R8A7795.
Stefan Roese [Wed, 16 Aug 2017 15:37:18 +0000 (17:37 +0200)]
x86: dfi-bt700: Select SERIAL_RX_BUFFER via Kconfig
To support more input characters (longer stings pasted into the U-Boot
prompt) without dropping, lets selects the recently added UART RX
buffer for these boards.
Signed-off-by: Stefan Roese <sr@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Stefan Roese [Wed, 16 Aug 2017 15:37:17 +0000 (17:37 +0200)]
x86: conga-qeval20-qa3-e3845: Select SERIAL_RX_BUFFER via Kconfig
To support more input characters (longer stings pasted into the U-Boot
prompt) without dropping, lets selects the recently added UART RX
buffer for these boards.
Signed-off-by: Stefan Roese <sr@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Stefan Roese [Wed, 16 Aug 2017 15:37:16 +0000 (17:37 +0200)]
serial: serial-uclass: Add generic serial RX buffer support
Pasting longer lines into the U-Boot console prompt sometimes leads to
characters missing. One problem here is the small 16-byte FIFO of the
legacy NS16550 UART, e.g. on x86 platforms.
This patch now introduces a Kconfig option to enable RX buffer support
for all DM based serial drivers. With this option enabled, I was
able paste really long lines into the U-Boot console, without any
characters missing.
Signed-off-by: Stefan Roese <sr@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Bin Meng <bmeng.cn@gmail.com> Cc: Tom Rini <trini@konsulko.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com>
As Bin Meng has tested and pointed out, we don't need the RX interrupt
for the RX buffer support at all. Just reading all available characters
into a buffer is sufficient to solve the problem with the dropped
characters upon long lines pasted into the U-Boot prompt. Since this
RX buffer support can be implemented in a generic way, without any
device specifica (e.g. for the ns16550), I'll post a new patch with
a new serial RX buffer support for DM, which all DM based serial
drivers can use.
Signed-off-by: Stefan Roese <sr@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Bin Meng <bmeng.cn@gmail.com> Cc: Tom Rini <trini@konsulko.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Bin Meng [Wed, 16 Aug 2017 05:38:31 +0000 (22:38 -0700)]
x86: fsp: Configure SPI opcode registers before SPI is locked down
Some Intel FSP (like Braswell) does SPI lock-down during the call
to fsp_notify(INIT_PHASE_BOOT). But before SPI lock-down is done,
it's bootloader's responsibility to configure the SPI controller's
opcode registers properly otherwise SPI controller driver doesn't
know how to communicate with the SPI flash device.
This introduces a Kconfig option CONFIG_FSP_LOCKDOWN_SPI for such
FSPs. When it is on, U-Boot will configure the SPI opcode registers
before the lock-down.
Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Stefan Roese <sr@denx.de>
Bin Meng [Wed, 16 Aug 2017 05:38:30 +0000 (22:38 -0700)]
x86: ich-spi: Move opcode registers configuration to another routine
At present the ICH SPI opcode registers configuration is done in the
ich_spi_remove() routine, a little bit weird but that's how current.
Linux MTD driver works. This changes to move the opcode registers
configuration to a separate routine ich_spi_config_opcode() which
might be called by U-Boot itself as well.
Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Stefan Roese <sr@denx.de>
Bin Meng [Wed, 16 Aug 2017 05:38:29 +0000 (22:38 -0700)]
x86: ich-spi: Don't read cached lock status
At present the ICH SPI controller driver reads the controller lock
status from its register in the probe routine and saves the lock
status to a member of priv. Later the driver uses the cached status
from priv to judge whether the controller setting is locked and do
different setup.
But such logic is only valid when there is only the SPI controller
driver that touches the SPI hardware. In fact the lock status change
can be trigged outside the driver, eg: during the fsp_notify() call
when Intel FSP is used.
This changes the driver to read the lock status every time when an
SPI transfer is initiated instead of reading the cached one.
Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Stefan Roese <sr@denx.de>
Patrice Chotard [Wed, 9 Aug 2017 12:45:27 +0000 (14:45 +0200)]
i2c: add i2c driver for stm32
Add i2c driver which can be used on both STM32F7 and STM32H7.
This I2C block supports the following features:
_ Slave and master modes
_ Multimaster capability
_ Standard-mode (up to 100 kHz)
_ Fast-mode (up to 400 kHz)
_ Fast-mode Plus (up to 1 MHz)
_ 7-bit and 10-bit addressing mode
_ Multiple 7-bit slave addresses (2 addresses, 1 with configurable mask)
_ All 7-bit addresses acknowledge mode
_ General call
_ Programmable setup and hold times
_ Easy to use event management
_ Optional clock stretching
_ Software reset
Tom Rini [Tue, 22 Aug 2017 12:20:02 +0000 (08:20 -0400)]
fastboot: Ensure we treat CONFIG_FASTBOOT_BUF_ADDR as long
Otherwise:
drivers/usb/gadget/f_fastboot.c:564:32: warning: format "%lx" expects
argument of type "long unsigned int", but argument 3 has type "unsigned
int" [-Wformat=]
Tom Rini [Tue, 15 Aug 2017 01:00:44 +0000 (21:00 -0400)]
fb_mmc.c: Correct blk_dread() return value checks
The function blk_dread will return -ENOSYS on failure or on success the
number of blocks read, which must be the number asked to read (otherwise
it failed somewhere). Correct this check.
Cc: Lukasz Majewski <lukma@denx.de> Signed-off-by: Tom Rini <trini@konsulko.com>
Peter Chubb [Thu, 8 Sep 2016 20:51:57 +0000 (20:51 +0000)]
Fix fastboot boot address
Fastboot loads an image at CONFIG_FASTBOOT_BUF_ADDR, but currently
tells do_bootm() to look for an image at $loadaddr. This breaks if
CONFIG_FASTBOOT_BUF_ADDR is different from the current user-set
loadaddr.
Instead, tell do_bootm() to pick up the image where it was laoded.
Signed-off-by: Peter Chubb <peter.chubb@data61.csiro.au> Reviewed-by: Tom Rini <trini@konsulko.com> Acked-by: Steve Rae <steve.rae@raedomain.com>
Tom Rini [Sun, 20 Aug 2017 02:27:57 +0000 (22:27 -0400)]
env: Correct case of no sub-init function
With the change to the environment code to remove the common init stage
of pointing to the default environment and setting it as valid, combined
with the change to switch gd->env_valid from 0/1/2 to an enum we now
must set env_valid to one of the enum values rather than an int. And in
this case, not only was setting it to an int wrong, it was now the wrong
value. Finally, in the case of ENV_IS_NOWHERE we must still say that
our envionrment is invalid after init for things to continue to
function.
Fixes: 7938822a6b75 ("env: Drop common init() functions") Tested-by: Marek Vasut <marek.vasut@gmail.com> Reported-by: Marek Vasut <marek.vasut@gmail.com> Reported-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Tom Rini <trini@konsulko.com>
---
Changes in v3:
- Actually include changes for env/nowhere.c
Commit bcc51c1512a3 ("ARM: uniphier: move lowlevel debug init code
after page table switch") was intended to support lowlevel debug for
sLD3. Now the sLD3 SoC support has been removed.
Revert it to allow to enable lowlevel debug earlier.
CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Reviewed-by: Vladimir Zapolskiy <vz@mleia.com> Reviewed-by: Simon Glass <sjg@chromium.org>