project/bcm63xx/u-boot.git
5 years agoriscv: Fix context restore before returning from trap handler
Bin Meng [Wed, 12 Dec 2018 14:12:42 +0000 (06:12 -0800)]
riscv: Fix context restore before returning from trap handler

sp cannot be loaded before restoring other registers.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Reviewed-by: Anup Patel <anup@brainfault.org>
5 years agoriscv: Move trap handler codes to mtrap.S
Bin Meng [Wed, 12 Dec 2018 14:12:41 +0000 (06:12 -0800)]
riscv: Move trap handler codes to mtrap.S

Currently the M-mode trap handler codes are in start.S. For future
extension, move them to a separate file mtrap.S.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Reviewed-by: Anup Patel <anup@brainfault.org>
5 years agoriscv: Do some basic architecture level cpu initialization
Bin Meng [Wed, 12 Dec 2018 14:12:40 +0000 (06:12 -0800)]
riscv: Do some basic architecture level cpu initialization

In arch_cpu_init_dm() do some basic architecture level cpu
initialization, like FPU enable, etc.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Reviewed-by: Anup Patel <anup@brainfault.org>
5 years agoriscv: Add indirect stringification to csr_xxx ops
Bin Meng [Wed, 12 Dec 2018 14:12:39 +0000 (06:12 -0800)]
riscv: Add indirect stringification to csr_xxx ops

With current csr_xxx ops, we cannot pass a macro to parameter
'csr', hence we need add another level to allow the parameter
to be a macro itself, aka indirect stringification.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Reviewed-by: Anup Patel <anup@brainfault.org>
5 years agoriscv: Update supports_extension() to use desc from cpu driver
Bin Meng [Wed, 12 Dec 2018 14:12:38 +0000 (06:12 -0800)]
riscv: Update supports_extension() to use desc from cpu driver

This updates supports_extension() implementation to use the desc
string from the cpu driver whenever possible, which avoids the
reading of misa CSR for S-mode U-Boot.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Reviewed-by: Anup Patel <anup@brainfault.org>
5 years agoriscv: Add exception codes for xcause register
Bin Meng [Wed, 12 Dec 2018 14:12:37 +0000 (06:12 -0800)]
riscv: Add exception codes for xcause register

This adds all exception codes in encoding.h.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Reviewed-by: Anup Patel <anup@brainfault.org>
5 years agoriscv: Add CSR numbers
Bin Meng [Wed, 12 Dec 2018 14:12:36 +0000 (06:12 -0800)]
riscv: Add CSR numbers

The standard RISC-V ISA sets aside a 12-bit encoding space for up
to 4096 CSRs. This adds all known CSR numbers as defined in the
RISC-V Privileged Architecture Version 1.10.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Reviewed-by: Anup Patel <anup@brainfault.org>
5 years agoriscv: Remove non-DM version of print_cpuinfo()
Bin Meng [Wed, 12 Dec 2018 14:12:35 +0000 (06:12 -0800)]
riscv: Remove non-DM version of print_cpuinfo()

With DM CPU driver, the non-DM version of print_cpuinfo() is no
longer needed.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Reviewed-by: Anup Patel <anup@brainfault.org>
5 years agoriscv: Probe cpus during boot
Bin Meng [Wed, 12 Dec 2018 14:12:34 +0000 (06:12 -0800)]
riscv: Probe cpus during boot

This calls cpu_probe_all() to probe all available cpus.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Reviewed-by: Anup Patel <anup@brainfault.org>
5 years agoriscv: Enlarge the default SYS_MALLOC_F_LEN
Bin Meng [Wed, 12 Dec 2018 14:12:33 +0000 (06:12 -0800)]
riscv: Enlarge the default SYS_MALLOC_F_LEN

Increase the heap size for the pre-relocation stage, so that CPU
driver can be loaded.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Reviewed-by: Anup Patel <anup@brainfault.org>
5 years agoriscv: qemu: Add platform-specific Kconfig options
Bin Meng [Wed, 12 Dec 2018 14:12:32 +0000 (06:12 -0800)]
riscv: qemu: Add platform-specific Kconfig options

Add the QEMU RISC-V platform-specific Kconfig options, to include
CPU and timer drivers.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Reviewed-by: Anup Patel <anup@brainfault.org>
5 years agoriscv: Implement riscv_get_time() API using rdtime instruction
Anup Patel [Wed, 12 Dec 2018 14:12:31 +0000 (06:12 -0800)]
riscv: Implement riscv_get_time() API using rdtime instruction

This adds an implementation of riscv_get_time() API that is using
rdtime instruction.

This is the case for S-mode U-Boot, and is useful for processors
that support rdtime in M-mode too.

Signed-off-by: Anup Patel <anup@brainfault.org>
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
5 years agoriscv: Add a SYSCON driver for SiFive's Core Local Interruptor
Bin Meng [Wed, 12 Dec 2018 14:12:30 +0000 (06:12 -0800)]
riscv: Add a SYSCON driver for SiFive's Core Local Interruptor

This adds U-Boot syscon driver for SiFive's Core Local Interruptor
(CLINT). The CLINT block holds memory-mapped control and status
registers associated with software and timer interrupts.

This driver implements the riscv_get_time() API as required by
the generic RISC-V timer driver, as well as some other APIs that
are needed for handling IPI.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Reviewed-by: Anup Patel <anup@brainfault.org>
5 years agoriscv: Introduce a Kconfig option for machine mode
Anup Patel [Wed, 12 Dec 2018 14:12:29 +0000 (06:12 -0800)]
riscv: Introduce a Kconfig option for machine mode

So far we have a Kconfig option for supervisor mode. This adds an
option for the machine mode.

Signed-off-by: Anup Patel <anup@brainfault.org>
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
5 years agoriscv: ax25: Hide the ax25-specific Kconfig option
Bin Meng [Wed, 12 Dec 2018 14:12:28 +0000 (06:12 -0800)]
riscv: ax25: Hide the ax25-specific Kconfig option

There is no need to expose RISCV_NDS to the Kconfig menu as it is
an ax25-specific option. Introduce a dedicated Kconfig option for
the cache ops of ax25 platform and use that to guard the cache ops.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Reviewed-by: Rick Chen <rick@andestech.com>
5 years agotimer: Add generic driver for RISC-V privileged architecture defined timer
Bin Meng [Wed, 12 Dec 2018 14:12:27 +0000 (06:12 -0800)]
timer: Add generic driver for RISC-V privileged architecture defined timer

RISC-V privileged architecture v1.10 defines a real-time counter,
exposed as a memory-mapped machine-mode register - mtime. mtime must
run at constant frequency, and the platform must provide a mechanism
for determining the timebase of mtime. The mtime register has a
64-bit precision on all RV32, RV64, and RV128 systems.

Different platform may have different implementation of the mtime
block hence an API riscv_get_time() is required by this driver for
platform codes to hide such implementation details. For example,
on some platforms mtime is provided by the CLINT module, while on
some other platforms a simple 'rdtime' can be used to get the timer
counter.

With this timer driver the U-Boot timer functionalities like delay
works correctly now.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Reviewed-by: Anup Patel <anup@brainfault.org>
5 years agocpu: Add a RISC-V CPU driver
Bin Meng [Wed, 12 Dec 2018 14:12:26 +0000 (06:12 -0800)]
cpu: Add a RISC-V CPU driver

This adds a driver for RISC-V CPU. Note the driver will bind
a RISC-V timer driver if "timebase-frequency" property is
present in the device tree.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Reviewed-by: Anup Patel <anup@brainfault.org>
5 years agoriscv: qemu: Create a simple-bus driver for the soc node
Bin Meng [Wed, 12 Dec 2018 14:12:25 +0000 (06:12 -0800)]
riscv: qemu: Create a simple-bus driver for the soc node

To enumerate devices on the /soc/ node, create a "simple-bus"
driver to match "riscv-virtio-soc".

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Reviewed-by: Anup Patel <anup@brainfault.org>
5 years agodm: cpu: Add timebase frequency to the platdata
Bin Meng [Wed, 12 Dec 2018 14:12:24 +0000 (06:12 -0800)]
dm: cpu: Add timebase frequency to the platdata

This adds a timebase_freq member to the 'struct cpu_platdata', to
hold the "timebase-frequency" value in the cpu or /cpus node.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Reviewed-by: Anup Patel <anup@brainfault.org>
5 years agoriscv: add Kconfig entries for the code model
Lukas Auer [Wed, 12 Dec 2018 14:12:23 +0000 (06:12 -0800)]
riscv: add Kconfig entries for the code model

RISC-V has two code models, medium low (medlow) and medium any (medany).
Medlow limits addressable memory to a single 2 GiB range between the
absolute addresses -2 GiB and +2 GiB. Medany limits addressable memory
to any single 2 GiB address range.

By default, medlow is selected for U-Boot on both 32-bit and 64-bit
systems.

The -mcmodel compiler flag is selected according to the Kconfig
configuration.

Signed-off-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
[bmeng: adjust to make medlow the default code model for U-Boot]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
5 years agoPrepare v2019.01-rc2
Tom Rini [Tue, 18 Dec 2018 01:25:24 +0000 (20:25 -0500)]
Prepare v2019.01-rc2

Signed-off-by: Tom Rini <trini@konsulko.com>
5 years agoarm: ti: boot: Increase system partition size
Sam Protsenko [Tue, 11 Dec 2018 16:20:21 +0000 (18:20 +0200)]
arm: ti: boot: Increase system partition size

Android code base is growing, so since Android "Pie" the size of
system.img grew up to be about 740 MiB. Let's increase system.img to
1 GiB to accommodate for those changes and leave some margin for future
changes. We don't want to make it more than 1 GiB, because we should
keep userdata partition big enough (for user files, like media etc.),
and eMMC size on BeagleBoard-X15 is only 3.5 GiB.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Acked-by: Praneeth Bajjuri <praneeth@ti.com>
5 years agoMakefile: output migration warnings to stderr
Chris Packham [Fri, 14 Dec 2018 22:35:54 +0000 (11:35 +1300)]
Makefile: output migration warnings to stderr

Output the device model migration warnings to stderr. This allows tools
like buildman to pick them up rather than suppressing them along with
the normal build output on stdout.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
5 years agoRestore compatibility of image type IDs
Stefano Babic [Mon, 17 Dec 2018 10:02:00 +0000 (11:02 +0100)]
Restore compatibility of image type IDs

Commit a2b96ece5be146f4995d737f047e5bbb76079b8f breaks the enumeration
of the Image Types. New image types can be appended, but they cannot be
inserted in the list else backward compatibility is broken.

This restores the images types as before 2018.11 and move i.MX8 related
images at the end.

Signed-off-by: Robert Berger <robert.berger@ReliableEmbeddedSystems.com>
Signed-off-by: Stefano Babic <sbabic@denx.de>
CC: Tom Rini <trini@konsulko.com>
5 years agoMerge tag 'for-master-20181216' of git://git.denx.de/u-boot-rockchip
Tom Rini [Mon, 17 Dec 2018 01:49:46 +0000 (20:49 -0500)]
Merge tag 'for-master-20181216' of git://git.denx.de/u-boot-rockchip

Improvements and fixes or u-boot-rockchip:
- new board: adds rv1108-elgin-r1 board support
- rk3288-evb: dts: remove 'vmmc' from emmc node
- rk3399-puma: dts: remove obsolete DTS node 'vcc5v0_host'

5 years agoARM: rockchip: Add rv1108-elgin-r1 board support
Otavio Salvador [Sat, 1 Dec 2018 14:05:54 +0000 (12:05 -0200)]
ARM: rockchip: Add rv1108-elgin-r1 board support

Add the initial support for Elgin R1 board, which is based on the
RV1108 SoC and has the following features currently supported in
U-Boot:

- UART
- eMMC
- USB

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
5 years agoMerge branch 'master' of git://git.denx.de/u-boot-usb
Tom Rini [Sat, 15 Dec 2018 22:49:49 +0000 (17:49 -0500)]
Merge branch 'master' of git://git.denx.de/u-boot-usb

- Second half of the USB Gadget DM conversion

5 years agoMerge branch '2018-12-15-master-imports'
Tom Rini [Sat, 15 Dec 2018 22:47:28 +0000 (17:47 -0500)]
Merge branch '2018-12-15-master-imports'

- Introduce tools-only build for host tools
- Bugfixes to poplar, syscon and the hashtable, a tee return code
- Fix a warning on gcc-8 by reworking part of mtk_image to be not unsafe
  wrt strings.
- serial_stm32 reset support

5 years agorockchip: rk3288-evb: dts: remove 'vmmc' from emmc node
Kever Yang [Fri, 14 Dec 2018 01:37:12 +0000 (09:37 +0800)]
rockchip: rk3288-evb: dts: remove 'vmmc' from emmc node

This is a sync with kernel mainline dts.

The U-Boot eMMC does not need to care about the power for Rockchip
SoCs, because if the board is using eMMC, the power will default on
(for bootrom), so the 'vmmc', 'vqmmc' is only useful for SD in U-Boot.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
5 years agorockchip: rk3399-puma: Remove obsolete DTS node 'vcc5v0_host'.
Christoph Muellner [Wed, 12 Dec 2018 00:32:59 +0000 (01:32 +0100)]
rockchip: rk3399-puma: Remove obsolete DTS node 'vcc5v0_host'.

vcc5v0_host and usbhub_enable share gpio4 RK_PA3,
which is a problem during probing (the second probe
will trigger a -EBUSY, when trying to get the gpio handle).

An analysis of the situation shows, that both regulators
are actually describing the same supply.

This patch removes the (currenlty not successful probing)
regulator vcc5v0_host from the DTS and adds the pinctrl-*
setting to usbhub_enable.

Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
Reviewed-by: Phiilipp Tomsich <philipp.tomsich@theobroma-systems.com>
5 years agosyscon: update syscon_node_to_regmap to use the DM functions
Patrick Delaunay [Wed, 31 Oct 2018 15:49:03 +0000 (16:49 +0100)]
syscon: update syscon_node_to_regmap to use the DM functions

+ Update the function syscon_node_to_regmap() to force bound on
  syscon uclass and directly use the list of device from DM.
+ Remove the static list syscon_list.

This patch avoid issue (crash) when syscon_node_to_regmap() is called
before and after reallocation (list content is invalid).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
5 years agotools: mtk_image: replace strncpy(d, s, sizeof(d)) with snprintf()
Andy Shevchenko [Tue, 11 Dec 2018 14:41:43 +0000 (16:41 +0200)]
tools: mtk_image: replace strncpy(d, s, sizeof(d)) with snprintf()

Starting from version 8 the GCC, i.e. C compiler, starts complaining about
possible '\0' terminator loss or, as in this case, garbage copy.

In function ‘mtk_image_set_gen_header’,
    inlined from ‘mtk_image_set_header’ at tools/mtk_image.c:733:3:
tools/mtk_image.c:659:2: warning: ‘strncpy’ specified bound 12 equals destination size [-Wstringop-truncation]
  strncpy(hdr->boot.name, bootname, sizeof(hdr->boot.name));
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘mtk_brom_parse_imagename’,
    inlined from ‘mtk_image_check_params’ at tools/mtk_image.c:388:9:
tools/mtk_image.c:325:5: warning: ‘strncpy’ specified bound 32 equals destination size [-Wstringop-truncation]
     strncpy(lk_name, val, sizeof(lk_name));
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Replace it with snprintf() to tell compiler how much room we have in the
destination buffer for source string.

Fixes: 3b975a147c3c ("tools: MediaTek: add MTK boot header generation to mkimage")
Cc: Ryder Lee <ryder.lee@mediatek.com>
Cc: Weijie Gao <weijie.gao@mediatek.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Weijie Gao <weijie.gao@mediatek.com>
5 years agoserial: serial_stm32: Add reset support
Patrice Chotard [Tue, 4 Dec 2018 13:11:36 +0000 (14:11 +0100)]
serial: serial_stm32: Add reset support

In some cases, UART is configured by early boot stage.
To be sure of the initial state of UART and to avoid
spurious chars on console, reset the serial block before
configuring it.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agopoplar: fix boot failure caused by serial driver change
Shawn Guo [Wed, 12 Dec 2018 07:24:44 +0000 (15:24 +0800)]
poplar: fix boot failure caused by serial driver change

Commit 4687919684e0 ("serial: Remove DM_FLAG_PRE_RELOC flag in various
drivers") essentially drops flag DM_FLAG_PRE_RELOC from serial_pl01x
driver for Poplar platform, because the platform falls into the
following strategy category made by the commit.

  Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for
  drivers that support both statically declared devices and
  configuration from device tree

Before the commit lands, Poplar platform works by statically declaring
pl011 serial device via U_BOOT_DEVICE() with DM_FLAG_PRE_RELOC flag set
in the driver.  But since Poplar also supports device configuration from
device tree, the commit practically drops the flag for Poplar, and hence
breaks the platform from booting.

This patch changes platform code and device tree to initiate pl011
serial device from device tree rather than static declaration, so that
above strategy about DM_FLAG_PRE_RELOC applies to Poplar, and therefore
the reported boot failure gets fixed.

Reported-by: Igor Opaniuk <igor.opaniuk@linaro.org>
Fixes: 4687919684e0 ("serial: Remove DM_FLAG_PRE_RELOC flag in various drivers")
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Reviewed-by: Igor Opaniuk <igor.opaniuk@linaro.org>
Tested-by: Igor Opaniuk <igor.opaniuk@linaro.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agopoplar: add a co-maintainer for poplar board
Shawn Guo [Thu, 13 Dec 2018 09:10:43 +0000 (17:10 +0800)]
poplar: add a co-maintainer for poplar board

Add myself as co-maintainer for poplar board, as I'm actively working
on the board.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
5 years agotools: add a generic config for native tools building
Otavio Salvador [Sat, 8 Dec 2018 00:00:41 +0000 (19:00 -0500)]
tools: add a generic config for native tools building

The motivation for this is to allow distributions to distribute all
possible tools in a generic way, avoiding the need of specific tools
building for each machine.

Especially on OpenEmbedded / Yocto Project ecosystem, it is very
common each BSP to end providing their specific tools when they need
to generate images for some SoC (e.g MX23 / MX28 in meta-freescale
case).

Using this, we can package the tools doing:

$: make tools-only_defconfig
$: make tools-only

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
[trini: Add MAINTAINERS entry for myself, add to .travis.yml, make
U-Boot itself buildable to not trip up other frameworks]
Signed-off-by: Tom Rini <trini@konsulko.com>
5 years agotest: Only descend into test/ when CONFIG_UNIT_TEST is enabled
Tom Rini [Sat, 8 Dec 2018 00:00:40 +0000 (19:00 -0500)]
test: Only descend into test/ when CONFIG_UNIT_TEST is enabled

The contents of the test subdirectories only make sense when we have
CONFIG_UNIT_TEST set.  We will otherwise attempt to build code on for
example sandbox that needs CONFIG_UNIT_TEST otherwise and rather than
complicate the Makefiles simply leave them out when we can.

Signed-off-by: Tom Rini <trini@konsulko.com>
5 years agocmd: Move the "dm" command from test/dm/ to cmd/
Tom Rini [Sat, 8 Dec 2018 00:00:39 +0000 (19:00 -0500)]
cmd: Move the "dm" command from test/dm/ to cmd/

The "dm" command under CONFIG_CMD_DM should live under cmd/ rather than
test/dm/ so move it.

Signed-off-by: Tom Rini <trini@konsulko.com>
5 years agohashtable: fix length calculation in hexport_r
AKASHI Takahiro [Fri, 14 Dec 2018 09:42:51 +0000 (18:42 +0900)]
hashtable: fix length calculation in hexport_r

The commit below incorrectly fixed hexport_r();
 > size = totlen + 1;
One extra byte is necessary to NULL-terminate a whole buffer, "resp."

Fixes: f1b20acb4a03 ("hashtable: Fix length calculation in hexport_r")
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
5 years agotee: change return code for REE FS supplicant cmd
Igor Opaniuk [Tue, 4 Dec 2018 12:37:19 +0000 (14:37 +0200)]
tee: change return code for REE FS supplicant cmd

If OP-TEE core is compiled with support of REE FS and RPMB
at the same time (CFG_RPMB_FS ?= y; CFG_RPMB_FS ?= y), and persistent
storage API is used with TEE_STORAGE_PRIVATE storage id, it will
lead to TA panic.

E/TC:? 0 TA panicked with code 0xffff0009
.....
E/TC:? 0 Call stack:
E/TC:? 0  0x000000004002f2f8 TEE_OpenPersistentObject at
lib/libutee/tee_api_objects.c:422

In this particular case TEE_ERROR_STORAGE_NOT_AVAILABLE is more suitable
than TEE_ERROR_NOT_IMPLEMENTED, as it provides to a TA a possibility
to handle this error code [1].

>From GPD TEE Internal Core specification [2]:
TEE_ERROR_STORAGE_NOT_AVAILABLE - if the persistent object is stored in a
storage area which is currently inaccessible. It may be associated with
the device but unplugged, busy, or inaccessible for some other reason.

[1]: https://github.com/OP-TEE/optee_os/blob/94db01ef448d1e552161c2d861d57a5f8bda0cc0/lib/libutee/tee_api_objects.c#L419
[2]: https://globalplatform.org/wp-content/uploads/2018/06/GPD_TEE_Internal_Core_API_Specification_v1.1.2.50_PublicReview.pdf

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
5 years agoMerge tag 'dm-pull-14dec18' of git://git.denx.de/u-boot-dm
Tom Rini [Fri, 14 Dec 2018 19:18:47 +0000 (14:18 -0500)]
Merge tag 'dm-pull-14dec18' of git://git.denx.de/u-boot-dm

Complete conversion of sound to driver model

5 years agousb: musb-new: sunxi: Fix null pointer access
Stefan Mavrodiev [Wed, 5 Dec 2018 12:49:44 +0000 (14:49 +0200)]
usb: musb-new: sunxi: Fix null pointer access

When the device is in peripheral mode there is no
struct usb_bus_priv allocated pointer, as the uclass driver
("usb_dev_generic") doesn't call per_device_auto_alloc_size.

This results in writing to the internal SDRAM at
priv->desc_before_addr = true;

Signed-off-by: Stefan Mavrodiev <stefan@olimex.com>
5 years agousb: composite: Fix max packet size for USB3.0
Siva Durga Prasad Paladugu [Thu, 13 Dec 2018 09:46:36 +0000 (15:16 +0530)]
usb: composite: Fix max packet size for USB3.0

For USB3.0, the max packetsize for GET_DESCRIPTOR should be
sent as exponent value for 2. This means for 512, max packet
size should be filled with 9(2^9=512). Also, fill the USB
version field with 3.0 if speed is negotiated to Superspeed.
This fixes the issue of DFU gadget download failure with
superspeed. Without this patch, the max packet size is
overflowed to zero as the bMaxPacketsize is of u8 and hence
host is not able to detect this device.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agoconfigs: am335x_boneblack_vboot: enable DM_USB and RNDIS boot in SPl
Jean-Jacques Hiblot [Tue, 4 Dec 2018 10:31:00 +0000 (11:31 +0100)]
configs: am335x_boneblack_vboot: enable DM_USB and RNDIS boot in SPl

Enable DM_USB and DM_USB_GADGET for this platform. Also enable RNDIS boot
support (SPL load u-boot over USB RNDIS).
This is an example of how to use DM_USB on a am335x-based board.
A subsequent series will take this a step further and modify more
defconfigs.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agoconfigs: am335x_evm: Do not disable DM_USB in SPL
Jean-Jacques Hiblot [Tue, 4 Dec 2018 10:30:59 +0000 (11:30 +0100)]
configs: am335x_evm: Do not disable DM_USB in SPL

DM_USB is now supported in the SPL. Do not undef it
Besides to support DM_USB in SPL, one now has to use SPL_DM_USB

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agoarm: am33xx: Register USB controllers if DM_USB is used but not OF_CONTROL
Jean-Jacques Hiblot [Tue, 4 Dec 2018 10:30:58 +0000 (11:30 +0100)]
arm: am33xx: Register USB controllers if DM_USB is used but not OF_CONTROL

When DM_USB is used, either the USB controllers are bound when the DTB
is parsed (when OF_CONTROL is enabled) or they are bound using the
U_BOOT_DEVICES() macro.
In the later case, the platform data is passed in a struct ti_musb_platdata
because it cannot be read from the DTB.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agousb: musb-new: Add support for DM_USB
Jean-Jacques Hiblot [Tue, 4 Dec 2018 10:30:57 +0000 (11:30 +0100)]
usb: musb-new: Add support for DM_USB

Enable DM for USB peripheral in the musb-new driver.
Also make sure that the driver can be used in the SPL.
This implies that:
* the driver must work with and without the OF_CONTROL option. That
in turn, implies that the platform data can be passed in a struct
ti_musb_platdata or be read from the dtb
* usb.o is linked in the SPL if host support is enabled

Another change is that the driver does not fail to bind (and stop the boot
process) if one of the child driver does not bind. Reporting the error is
enough. This kind of error would appear if the port is configured in the
DTS but the driver is not activated in the config.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agousb: musb-new: Allow the diver not to use the set_phy_power() callback
Jean-Jacques Hiblot [Tue, 4 Dec 2018 10:30:56 +0000 (11:30 +0100)]
usb: musb-new: Allow the diver not to use the set_phy_power() callback

The set_phy_power() callback is part of struct omap_musb_board_data. This
structure is part of the platform data passed to the musb-new driver. This
does not really fit with the Driver Model, so allow not to use struct
omap_musb_board_data to turn the phy on or off.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agoconfigs: am43xx: Enable RNDIS support in SPL
Jean-Jacques Hiblot [Tue, 4 Dec 2018 10:30:55 +0000 (11:30 +0100)]
configs: am43xx: Enable RNDIS support in SPL

The AM43xx SOCs have the ability to download the SPl through USB (RNDIS).
Adding support for RNDIS in SPL allows to also download u-boot through USB.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agoconfigs: am43xx_evm: Enable DM_USB and DM_USB_GADGET
Jean-Jacques Hiblot [Tue, 4 Dec 2018 10:30:54 +0000 (11:30 +0100)]
configs: am43xx_evm: Enable DM_USB and DM_USB_GADGET

Enable DM_USB and DM_USB_GADGET for AM43xx EVM boards.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agodts: am4372: Enable USB1 in SPL
Jean-Jacques Hiblot [Tue, 4 Dec 2018 10:30:53 +0000 (11:30 +0100)]
dts: am4372: Enable USB1 in SPL

USB1 can be used by the romboot on all am4372 platforms to download a
firmware (SPL in our case).
It makes sense to enable USB1 in the SPL to download u-boot.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agodts: Add a u-boot specific dtsi file for the am4372
Jean-Jacques Hiblot [Tue, 4 Dec 2018 10:30:52 +0000 (11:30 +0100)]
dts: Add a u-boot specific dtsi file for the am4372

This file is used to override the values found in am4372.dtsi
Use it to fix the "compatible" options for the controllers used
to support the USB (parent bus and syscons).

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agoboard: ti: am43xx: turn on USB clocks
Jean-Jacques Hiblot [Tue, 4 Dec 2018 10:30:51 +0000 (11:30 +0100)]
board: ti: am43xx: turn on USB clocks

Enable USB clocks in late init stage to support ports under DM_USB.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agodwc3-generic: Add support for the am437x
Jean-Jacques Hiblot [Tue, 4 Dec 2018 10:30:50 +0000 (11:30 +0100)]
dwc3-generic: Add support for the am437x

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agophy: omap_usb2: Add support for am437x
Jean-Jacques Hiblot [Tue, 4 Dec 2018 10:30:49 +0000 (11:30 +0100)]
phy: omap_usb2: Add support for am437x

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agospl: net: dm: usb: bind the gadget before attempting to load the image
Jean-Jacques Hiblot [Tue, 4 Dec 2018 10:30:48 +0000 (11:30 +0100)]
spl: net: dm: usb: bind the gadget before attempting to load the image

If DM_USB_GADGET is used, the usb ethernet gadget driver must be bound to a
controller before the image can be downloaded over the network.
In u-boot this can be done with the bind command. In SPL it must be done
programmatically.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agospl: drivers: Link usb common library to SPL if USB gadget is enabled
Jean-Jacques Hiblot [Tue, 4 Dec 2018 10:30:47 +0000 (11:30 +0100)]
spl: drivers: Link usb common library to SPL if USB gadget is enabled

Some drivers might need to access common USB functions such as
usb_get_maximum_speed() or usb_get_dr_mode().

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agoconfigs: k2g_evm: Enable DFU on K2G EVM
Jean-Jacques Hiblot [Tue, 4 Dec 2018 10:13:01 +0000 (11:13 +0100)]
configs: k2g_evm: Enable DFU on K2G EVM

The K2G evm uses the generic DWC3 driver. DFU can thus be enabled.
Enabling DFU for easier firmware update.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agousb: host: replace xhci-keystone driver by the generic dwc3 driver
Jean-Jacques Hiblot [Tue, 4 Dec 2018 10:13:00 +0000 (11:13 +0100)]
usb: host: replace xhci-keystone driver by the generic dwc3 driver

The keystone platforms can use the generic DC3 driver. Removing the
keystone-spcecific xchi driver and add the configuration options to enable
the generic DWC3 driver on all K2 platforms.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agoPHY: Add phy driver for the keystone USB PHY
Jean-Jacques Hiblot [Tue, 4 Dec 2018 10:12:59 +0000 (11:12 +0100)]
PHY: Add phy driver for the keystone USB PHY

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agoARM: dts: k2g-evm: enable USB0 and USB1
Jean-Jacques Hiblot [Tue, 4 Dec 2018 10:12:58 +0000 (11:12 +0100)]
ARM: dts: k2g-evm: enable USB0 and USB1

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agoboard: ks2_evm: Enable the USB clocks if DM_USB is used
Jean-Jacques Hiblot [Tue, 4 Dec 2018 10:12:57 +0000 (11:12 +0100)]
board: ks2_evm: Enable the USB clocks if DM_USB is used

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agousb: dwc3-generic: make it compatible with "ti, keystone-dwc3"
Jean-Jacques Hiblot [Tue, 4 Dec 2018 10:12:56 +0000 (11:12 +0100)]
usb: dwc3-generic: make it compatible with "ti, keystone-dwc3"

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agousb: musb: Remove legacy CONFIG_USB_DA8XX
Adam Ford [Wed, 12 Dec 2018 14:17:41 +0000 (08:17 -0600)]
usb: musb: Remove legacy CONFIG_USB_DA8XX

There don't appear to be any boards enabling CONFIG_USB_DA8XX,
and there is a newer version of the MUSB driver, so let's remove
the legacy version of it.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
5 years agousb: musb: Remove Legacy CONFIG_USB_DAVINCI
Adam Ford [Wed, 12 Dec 2018 14:17:22 +0000 (08:17 -0600)]
usb: musb: Remove Legacy CONFIG_USB_DAVINCI

This patch removes CONFIG_USB_DAVINCI.  It's a legacy option
that isn't defined anywhere, and there is a newer MUSB driver.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
5 years agousb: Don't enable CONFIG_SPL_DM_USB for non-DM SPL
Martyn Welch [Mon, 10 Dec 2018 11:05:16 +0000 (11:05 +0000)]
usb: Don't enable CONFIG_SPL_DM_USB for non-DM SPL

When CONFIG_SPL_DM_USB was added, it was added defaulted on without
protection to ensure it didn't get set for non-DM SPL builds.

This leads to unexpected and confusing failures when building a DM based
U-Boot but with a non-DM SPL, as the defconfig is unlikely to have
CONFIG_SPL_DM_USB actively disabled.

Tweak the Kconfig to not enable this setting unless CONFIG_SPL_DM is set.

Signed-off-by: Martyn Welch <martyn.welch@collabora.com>
5 years agousb: composite: Move bitmap related operations to ./include/linux/bitmap.h
Lukasz Majewski [Fri, 23 Nov 2018 16:36:19 +0000 (17:36 +0100)]
usb: composite: Move bitmap related operations to ./include/linux/bitmap.h

The BITMAP related operations can now be moved to ./include/linux/bitmap.h
file to mimic the Linux kernel directory tree.

This change also allows to remove the lin_gadget_compat.h header file
(which is a legacy code only for composite U-boot layer).
It was also possible to remove #includes from several USB gadget drivers.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Stefan Agner <stefan.agner@toradex.com>
5 years agousb: gadget: f_sdp: Provide filesize env variable for downloaded images
Petr Štetiar [Fri, 23 Nov 2018 13:37:52 +0000 (14:37 +0100)]
usb: gadget: f_sdp: Provide filesize env variable for downloaded images

Currently it's not possible to get filesize of downloaded images and
it's impossible to automate some tasks in scripts. So this patch adds
`filesize` environment variable with size (as hex number in bytes) of
the last successfully downloaded file via `sdp` command.

Cc: Lukasz Majewski <lukma@denx.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Stefan Agner <stefan.agner@toradex.com>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
Reviewed-by: Stefan Agner <stefan.agner@toradex.com>
5 years agodm: sound: Use the correct number of channels for sound
Simon Glass [Mon, 10 Dec 2018 17:37:51 +0000 (10:37 -0700)]
dm: sound: Use the correct number of channels for sound

At present the 'beep' sound generates a waveform for only one channel even
if two are being used. This means that the beep is twice the frequency it
should be. Correct this by making it a parameter.

The fix in a previous commit was correct for sandbox but not for other
boards.

Fixes: 03f11e87a8 ("sound: Correct data output in sound_create_square_wave()")
Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sandbox: Allow selection of sample rate and channels
Simon Glass [Mon, 10 Dec 2018 17:37:50 +0000 (10:37 -0700)]
dm: sandbox: Allow selection of sample rate and channels

At present these parameters are hard-coded in the sdl interface code.
Allow them to be specified by the driver instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: max98095: Tidy up error codes
Simon Glass [Mon, 10 Dec 2018 17:37:49 +0000 (10:37 -0700)]
dm: sound: max98095: Tidy up error codes

Return a valid error code instead of -1.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: Fix license headers
Simon Glass [Mon, 10 Dec 2018 17:37:48 +0000 (10:37 -0700)]
dm: sound: Fix license headers

Fix a few files whos license headers were not converted to SPDX.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: Complete migration to driver model
Simon Glass [Mon, 10 Dec 2018 17:37:47 +0000 (10:37 -0700)]
dm: sound: Complete migration to driver model

All users of sound are converted to use driver model. Drop the old code
and the CONFIG_DM_SOUND option.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: exynos: Drop CONFIG_DM_I2C_COMPAT
Simon Glass [Mon, 10 Dec 2018 17:37:46 +0000 (10:37 -0700)]
dm: exynos: Drop CONFIG_DM_I2C_COMPAT

This option is not needed anymore for all exynos boards except arndale.
Update the config.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sandbox: sound: Convert to use driver model
Simon Glass [Mon, 10 Dec 2018 17:37:45 +0000 (10:37 -0700)]
dm: sandbox: sound: Convert to use driver model

Update sandbox's device tree and config to use driver model for sound. Use
the double buffer for sound output so that we don't need to wait for the
sound to complete before returning.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: exynos: sound: Convert to use driver model
Simon Glass [Mon, 10 Dec 2018 17:37:44 +0000 (10:37 -0700)]
dm: exynos: sound: Convert to use driver model

Update snow's device tree and config to use driver model for sound. Also
update the others as best we can.

Spring does not appear to have audio support in the kernel. The smdk5250
and smdk5420 boards use a wolfson codec which I cannot test with. So the
only boards that is tested and known to work are snow, pit and pi.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: exynos: Add support for max98090
Simon Glass [Mon, 10 Dec 2018 17:37:43 +0000 (10:37 -0700)]
dm: sound: exynos: Add support for max98090

Add support for this new codec which is used by pit.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: Move common code out of maxim98095
Simon Glass [Mon, 10 Dec 2018 17:37:42 +0000 (10:37 -0700)]
dm: sound: Move common code out of maxim98095

The register-access code is useful for any maxim codec. Move it out into
its own file.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agoexynos: Add support for exynos5420 i2s pinmux
Simon Glass [Mon, 10 Dec 2018 17:37:41 +0000 (10:37 -0700)]
exynos: Add support for exynos5420 i2s pinmux

Allow setting the i2s pinmux correctly on exyno5420 so that i2c can be
used on that SoC. Also rename EXYNOS_AUDSS to something consistent with
other naming.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agoexynos: Add proid_is_exynos542x() for common 542x
Simon Glass [Mon, 10 Dec 2018 17:37:40 +0000 (10:37 -0700)]
exynos: Add proid_is_exynos542x() for common 542x

Add a convenience function for any Exynos 542x chip.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: Add conversion to driver model
Simon Glass [Mon, 10 Dec 2018 17:37:39 +0000 (10:37 -0700)]
dm: sound: Add conversion to driver model

Move the existing hardware drivers over to use driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: Start i2c IDs from 0
Simon Glass [Mon, 10 Dec 2018 17:37:38 +0000 (10:37 -0700)]
dm: sound: Start i2c IDs from 0

The current ID enums start from 1 but there does not seem to be any reason
that they cannot start with 0. Adjust the code to avoid the +1 in
codec_init().

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: core: Add a function to read into a unsigned int
Simon Glass [Mon, 10 Dec 2018 17:37:37 +0000 (10:37 -0700)]
dm: core: Add a function to read into a unsigned int

The current dev_read...() functions use s32 and u32 which are convenient
for device tree but not so useful for normal code, which often wants to
use normal integers for values.

Add a helper which supports returning an unsigned int. Also add signed
versions of the unsigned readers.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: Create a uclass for sound
Simon Glass [Mon, 10 Dec 2018 17:37:36 +0000 (10:37 -0700)]
dm: sound: Create a uclass for sound

The sound driver pulls together the audio codec and i2s drivers in order
to actually make sounds. It supports setup() and play() methods. The
sound_find_codec_i2s() function allows locating the linked codec and i2s
devices. They can be referred to from uclass-private data.

Add a uclass and a test for sound.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sandbox: Update sound to use two buffers
Simon Glass [Mon, 10 Dec 2018 17:37:35 +0000 (10:37 -0700)]
dm: sandbox: Update sound to use two buffers

At present we use a single buffer for sound which means we cannot be
playing one sound while queueing up the next. This wouldn't matter except
that a long sound (more than a second) has to be created as a single
buffer, thus using a lot of memory. To better mimic what real sound
drivers do, add support for double buffering in sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: Create a uclass for i2s
Simon Glass [Mon, 10 Dec 2018 17:37:34 +0000 (10:37 -0700)]
dm: sound: Create a uclass for i2s

The i2s bus is commonly used with audio codecs. It provides a way to
stream digital data sychronously in both directions. U-Boot only supports
audio output, so this uclass is very simple, with a single tx_data()
method.

Add a uclass and a test for i2s.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: Create a uclass for audio codecs
Simon Glass [Mon, 10 Dec 2018 17:37:33 +0000 (10:37 -0700)]
dm: sound: Create a uclass for audio codecs

An audio codec provides a way to convert digital data to sound and vice
versa. Add a simple uclass which just supports setting the parameters for
the codec.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: Rename samsung_i2s_priv to i2s_uc_priv
Simon Glass [Mon, 10 Dec 2018 17:37:32 +0000 (10:37 -0700)]
dm: sound: Rename samsung_i2s_priv to i2s_uc_priv

This structure contains information that is likely needed by any i2s
driver so it seems useful to attach it to the (forthcoming) i2c uclass.
For now, just rename it.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: Create an option to use driver model for sound
Simon Glass [Mon, 10 Dec 2018 17:37:31 +0000 (10:37 -0700)]
dm: sound: Create an option to use driver model for sound

The U-Boot sound system provides basic support for beeping. At present it
does not use driver model, but it needs to be converted. Add an option to
enable driver model for sound. For now it is not connected to anything.
Future work will add drivers which use this option. It will then be
removed once everything is converted.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: exynos: Correct codec bus addresses
Simon Glass [Mon, 10 Dec 2018 17:37:30 +0000 (10:37 -0700)]
dm: sound: exynos: Correct codec bus addresses

For snow the codec is at address 0x11 on the i2c bus, in 7-bit format.
The device tree and code are in 8-bit format (i.e. shifted left one bit).
Fix both. Fix pit in a similar way.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: Fix up header ordering
Simon Glass [Mon, 3 Dec 2018 11:37:34 +0000 (04:37 -0700)]
dm: sound: Fix up header ordering

Tidy up the ordering of header files in the sounds files.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: wm8994: Drop wm8994_i2c_init()
Simon Glass [Mon, 3 Dec 2018 11:37:33 +0000 (04:37 -0700)]
dm: sound: wm8994: Drop wm8994_i2c_init()

This function has only one line in it. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: max98095: Drop g_codec_info and g_max98095_info
Simon Glass [Mon, 3 Dec 2018 11:37:32 +0000 (04:37 -0700)]
dm: sound: max98095: Drop g_codec_info and g_max98095_info

These are only used in two functions so can be made local.

Also change the first argument of max98095_do_init() to suit.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: wm8994: Drop g_codec_info and g_wm8994_info
Simon Glass [Mon, 3 Dec 2018 11:37:31 +0000 (04:37 -0700)]
dm: sound: wm8994: Drop g_codec_info and g_wm8994_info

These are only used in two functions so can be made local.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: max98095: Drop global i2c-address variable
Simon Glass [Mon, 3 Dec 2018 11:37:30 +0000 (04:37 -0700)]
dm: sound: max98095: Drop global i2c-address variable

We can put this in the private structure and avoid a global.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: wm8994: Drop global i2c-address variable
Simon Glass [Mon, 3 Dec 2018 11:37:29 +0000 (04:37 -0700)]
dm: sound: wm8994: Drop global i2c-address variable

We can put this in the private structure and avoid a global.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: max98095: Split out interface setup code
Simon Glass [Mon, 3 Dec 2018 11:37:28 +0000 (04:37 -0700)]
dm: sound: max98095: Split out interface setup code

With driver model we want to do a minimal probe when the device is probed
and then set up the codec interface later when a sound is actully played.

Split this setup code out into its own function to help with this.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: wm899c: Split out interface setup code
Simon Glass [Mon, 3 Dec 2018 11:37:27 +0000 (04:37 -0700)]
dm: sound: wm899c: Split out interface setup code

With driver model we want to do a minimal probe when the device is probed
and then set up the codec interface later when a sound is actully played.

Split this setup code out into its own function to help with this.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: wm8994: Create a new common init function
Simon Glass [Mon, 3 Dec 2018 11:37:26 +0000 (04:37 -0700)]
dm: sound: wm8994: Create a new common init function

With driver model we cannot pass in the global struct, but instead want
to pass in the driver-private data. Split some of the code out of
wm8994_init() to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: max98095: Pass private data to internal functions
Simon Glass [Mon, 3 Dec 2018 11:37:25 +0000 (04:37 -0700)]
dm: sound: max98095: Pass private data to internal functions

At present the driver-private data is global. To allow this code to be
used with driver model, change it to pass the data down to each function.
Use the name 'priv' consistently throughout.

Also rename max98095_update_bits() to max98095_bic_or() which is more
descriptive and shorter, thus breaking fewer lines with the parameter
addition.

Signed-off-by: Simon Glass <sjg@chromium.org>