]> git.karo-electronics.de Git - karo-tx-uboot.git/log
karo-tx-uboot.git
8 years agocmd: qfw: do not require default macros when building qfw command
Miao Yan [Mon, 23 May 2016 02:37:18 +0000 (19:37 -0700)]
cmd: qfw: do not require default macros when building qfw command

The qfw command interface makes use of CONFIG_LOADADDR and
CONFIG_RAMDISKADDR to setup kernel. But not all boards have these macros,
which causes build problem on those platforms.

This patch fixes this issue.

Signed-off-by: Miao Yan <yanmiaobest@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agocmd: qfw: rename qemu_fw_cfg.[c|h] to qfw.[c|h]
Miao Yan [Mon, 23 May 2016 02:37:17 +0000 (19:37 -0700)]
cmd: qfw: rename qemu_fw_cfg.[c|h] to qfw.[c|h]

Make file names consistent with CONFIG_QFW and CONFIG_CMD_QFW

Signed-off-by: Miao Yan <yanmiaobest@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agox86: qemu: add comment about qfw register endianness
Miao Yan [Mon, 23 May 2016 02:37:16 +0000 (19:37 -0700)]
x86: qemu: add comment about qfw register endianness

This patch adds some comments about qfw register endianness for clarity.

Signed-off-by: Miao Yan <yanmiaobest@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agox86: qemu: move x86 specific operations out of qfw core
Miao Yan [Mon, 23 May 2016 02:37:15 +0000 (19:37 -0700)]
x86: qemu: move x86 specific operations out of qfw core

The original implementation of qfw includes several x86 specific
operations, like directly calling outb/inb and using some inline
assembly code which prevents it being ported to other architectures.

This patch adds callback functions and moves those to arch/x86/

Signed-off-by: Miao Yan <yanmiaobest@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agox86: qemu: split qfw command interface and qfw core
Miao Yan [Mon, 23 May 2016 02:37:14 +0000 (19:37 -0700)]
x86: qemu: split qfw command interface and qfw core

This patch splits qfw command interface and qfw core function into two
files, and introduces a new Kconfig option (CONFIG_QFW) for qfw core.

Now when qfw command interface is enabled, it will automatically select
qfw core. This patch also makes the ACPI table generation select
CONFIG_QFW.

Signed-off-by: Miao Yan <yanmiaobest@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agocmd: qfw: make fwcfg_present and fwcfg_dma_present public
Miao Yan [Mon, 23 May 2016 02:37:13 +0000 (19:37 -0700)]
cmd: qfw: make fwcfg_present and fwcfg_dma_present public

This patch is part of the qfw refactor work. This patch makes
qemu_fwcfg_present() and qemu_fwcfg_dma_present() public functions.

Signed-off-by: Miao Yan <yanmiaobest@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agocmd: qfw: remove qemu_fwcfg_free_files()
Miao Yan [Mon, 23 May 2016 02:37:12 +0000 (19:37 -0700)]
cmd: qfw: remove qemu_fwcfg_free_files()

This patch is part of the qfw refactor work.

The qemu_fwcfg_free_files() function is only used in error handling in
ACPI table generation, let's not make this a core function and move it
to the right place.

Signed-off-by: Miao Yan <yanmiaobest@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agocmd: qfw: add API to iterate firmware list
Miao Yan [Mon, 23 May 2016 02:37:11 +0000 (19:37 -0700)]
cmd: qfw: add API to iterate firmware list

This patch is part of the refactor work of qfw. It adds 3 APIs to qfw
core to iterate firmware list.

Signed-off-by: Miao Yan <yanmiaobest@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agox86: qemu: fix ACPI Kconfig options
Miao Yan [Mon, 23 May 2016 02:37:10 +0000 (19:37 -0700)]
x86: qemu: fix ACPI Kconfig options

CONFIG_GENENRATE_ACPI_TABLE controls the generation of ACPI table which
uses U-Boot's built-in methods and CONFIG_QEMU_ACPI_TABLE controls whether
to load ACPI table from QEMU's fw_cfg interface.

But with commit "697ec431469ce0a4c2fc2c02d8685d907491af84 x86: qemu: Drop
our own ACPI implementation", there is only one way to support ACPI table
for QEMU targets which is the fw_cfg interface. Having two Kconfig options
for this purpose is not necessary any more, so this patch consolidates
the two.

Signed-off-by: Miao Yan <yanmiaobest@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agox86: qemu: Move qfw command over to cmd and add Kconfig entry
Tom Rini [Fri, 6 May 2016 14:40:22 +0000 (10:40 -0400)]
x86: qemu: Move qfw command over to cmd and add Kconfig entry

- Move the command portion of arch/x86/cpu/qemu/fw_cfg.c into
  cmd/qemu_fw_cfg.c
- Move arch/x86/include/asm/fw_cfg.h to include/qemu_fw_cfg.h
- Rename ACPI table portion to arch/x86/cpu/qemu/acpi_table.c

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agox86: doc: Document ACPI support
Bin Meng [Sat, 7 May 2016 14:46:37 +0000 (07:46 -0700)]
x86: doc: Document ACPI support

Remove ACPI from the TODO list and add a new section to document
current ACPI support in U-Boot.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agox86: doc: Minor update for accuracy
Bin Meng [Sat, 7 May 2016 14:46:36 +0000 (07:46 -0700)]
x86: doc: Minor update for accuracy

This updates the doc for the following places:
- Mention CRB for Bayley Bay
- Mention Congatec QEVAL 2.0 & conga-QA3/E3845
- Limit part of the QEMU paragraphs to 80 cols
- Correct some typos (drive, it's, Ubuntu)
- Add description for "console=ttyS0,115200"
- Remove CONFIG_BOOTDELAY description which is already
  in x86-common.h

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agox86: Remove acpi=off boot parameter when ACPI is on
Bin Meng [Sat, 7 May 2016 14:46:35 +0000 (07:46 -0700)]
x86: Remove acpi=off boot parameter when ACPI is on

Remove the kernel boot parameter acpi=off so that kernel can turn on
ACPI support.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agox86: baytrail: Add .gitignore for ACPI enabled boards
Bin Meng [Sat, 7 May 2016 14:46:34 +0000 (07:46 -0700)]
x86: baytrail: Add .gitignore for ACPI enabled boards

Let git ignore dsdt.aml, dsdt.asl.tmp and dsdt.c files.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agox86: baytrail: Enable ACPI table generation for all boards
Bin Meng [Sat, 7 May 2016 14:46:33 +0000 (07:46 -0700)]
x86: baytrail: Enable ACPI table generation for all boards

Enable ACPI table generation by creating a DSDT table for all baytrail
boards: conga-qeval20-qa3-e3845, bayleybay and minnowmax.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agox86: baytrail: Generate ACPI FADT/MADT tables
Bin Meng [Sat, 7 May 2016 14:46:32 +0000 (07:46 -0700)]
x86: baytrail: Generate ACPI FADT/MADT tables

FADT/MADT tables are platform specific. Generate them for BayTrail.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agox86: baytrail: Add platform ASL files
Bin Meng [Sat, 7 May 2016 14:46:31 +0000 (07:46 -0700)]
x86: baytrail: Add platform ASL files

This adds basic BayTrail platform ASL files. They are intended to be
included in dsdt.asl of any board that is based on this platform.

Note: ACPI mode support for GPIO/LPSS/SCC/LPE are not supported for
now. They will be added in the future.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agox86: acpi: Return table length in acpi_create_madt_lapics()
Bin Meng [Sat, 7 May 2016 14:46:30 +0000 (07:46 -0700)]
x86: acpi: Return table length in acpi_create_madt_lapics()

Like other MADT table write routines, make acpi_create_madt_lapics()
return how many bytes it has written instead of the table end addr.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agox86: acpi: Add some generic ASL libraries
Bin Meng [Sat, 7 May 2016 14:46:29 +0000 (07:46 -0700)]
x86: acpi: Add some generic ASL libraries

This adds several generic ASL libraries that can be included by
other ASL files, which are:

- debug.asl: for debug output using POST I/O port and legacy serial port
- globutil.asl: for string compare routines
- statdef.asl: for _STA status values

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agox86: acpi: Clean up table header revisions
Bin Meng [Sat, 7 May 2016 14:46:28 +0000 (07:46 -0700)]
x86: acpi: Clean up table header revisions

The comment of initializing table header revision says:

    /* ACPI 1.0/2.0: 1, ACPI 3.0: 2, ACPI 4.0: 3 */

which might mislead it may increase per ACPI spec revision.
However this is not the case. It's actually a fixed number
as defined in ACPI spec, and in the laest ACPI spec 6.1,
some table header revisions are still 1. Clean these up.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agox86: acpi: Align FACS table to a 64 byte boundary
Bin Meng [Sat, 7 May 2016 14:46:27 +0000 (07:46 -0700)]
x86: acpi: Align FACS table to a 64 byte boundary

Per ACPI spec, the FACS table address must be aligned to a 64 byte
boundary (Windows checks this, but Linux does not).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agox86: acpi: Use u32 in table write routines
Bin Meng [Sat, 7 May 2016 14:46:26 +0000 (07:46 -0700)]
x86: acpi: Use u32 in table write routines

Use u32 instead of unsigned long in the table write routines, as
other routines do.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agox86: acpi: Adjust order in acpi_table.c
Bin Meng [Sat, 7 May 2016 14:46:25 +0000 (07:46 -0700)]
x86: acpi: Adjust order in acpi_table.c

Rearrange the routine order a little bit, to follow the order
in which ACPI table is defined in acpi_table.h.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agox86: acpi: Change fill_header()
Bin Meng [Sat, 7 May 2016 14:46:24 +0000 (07:46 -0700)]
x86: acpi: Change fill_header()

Rename fill_header() to acpi_fill_header() for consistency.
Change its signature to remove the 'length' parameter and
make it a public API.

Also remove the unnecessary include files, and improve the
AmlCode[] comment a little bit.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agox86: acpi: Remove acpi_create_ssdt_generator()
Bin Meng [Sat, 7 May 2016 14:46:23 +0000 (07:46 -0700)]
x86: acpi: Remove acpi_create_ssdt_generator()

This acpi_create_ssdt_generator() currently does nothing.
Remove this for now.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agox86: acpi: Reorder code in acpi_table.h
Bin Meng [Sat, 7 May 2016 14:46:22 +0000 (07:46 -0700)]
x86: acpi: Reorder code in acpi_table.h

Reorder the ACPI tables appearance by following the order:
RSDP, RSDT, XSDT, FADT, FACS, MADT, MCFG. And adjust the
table flag defines accordingly.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agox86: acpi: Various changes to acpi_table.h
Bin Meng [Sat, 7 May 2016 14:46:21 +0000 (07:46 -0700)]
x86: acpi: Various changes to acpi_table.h

- Use "U-BOOT" and "U-BOOTBL" for the OEM ID and OEM table ID.
- Do not typedef acpi_header_t, instead use struct acpi_table_hader.
- Use a shorter name aslc_id and aslc-revision.
- Change MCFG base address to use 32-bit value pairs (_l and _h).
- Apply ACPI_APIC_ prefix to MADT APIC type macros and make
  their names to be more readable.
- Apply __packed to struct acpi_madt_irqoverride and struct
  acpi_madt_lapic_nmi tables, as they are not naturally aligned
  by the compiler which leads to wrong sizeof(struct).
- Rename model to res1 as it is reserved after ACPI spec 1.0.
- Apply ACPI_ prefix to the PM profile macros and change them
  to enum.
- Add ospm_flags to FACS structure which is defined since ACPI 4.0.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agox86: acpi: Remove unused codes
Bin Meng [Sat, 7 May 2016 14:46:20 +0000 (07:46 -0700)]
x86: acpi: Remove unused codes

- Remove #include <> header files.
- Remove APM_CNT register defines, which should not be here as
  they are SMI related.
- Remove MP_IRQ_ defines as they are duplicates of the same ones
  in asm/mpspec.h.
- Remove ACTL register defines, which should not be here as they
  are chipset specific.
- Remove functional fixed hardware defines, which are not used.
- Remove dev_scope related defines, which are not used.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agoacpi: Output all errors/warnings/remarks when compiling ASL
Bin Meng [Sat, 7 May 2016 14:46:19 +0000 (07:46 -0700)]
acpi: Output all errors/warnings/remarks when compiling ASL

Remove -va option when invoking IASL compiler so that we can see
errors/warnings/remarks in the build log.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agoacpi: Specify U-Boot include path for ASL files
Bin Meng [Sat, 7 May 2016 14:46:18 +0000 (07:46 -0700)]
acpi: Specify U-Boot include path for ASL files

It will be much easier if we split the whole dsdt.asl file into
multiple smaller ASL parts and have access to U-Boot include files.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agoacpi: Explicitly spell out dsdt.c in the make rule
Bin Meng [Sat, 7 May 2016 14:46:17 +0000 (07:46 -0700)]
acpi: Explicitly spell out dsdt.c in the make rule

Currently the make rule for dsdt.c uses a wildcard, as below:

  $(obj)/%.c:    $(src)/%.asl

To avoid any side effect, explicitly mention dsdt.c as this is
the file we intend to use for ACPI DSDT AML generation.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agoacpi: Change build log for ASL files
Bin Meng [Sat, 7 May 2016 14:46:16 +0000 (07:46 -0700)]
acpi: Change build log for ASL files

Currently when compiling U-Boot with ASL file, the build log says:

  ASL     board/intel/bayleybay/dsdt.c

This looks odd as ASL compiler's input is ASL file, not C file.
Change the make rule to use $< instead.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agox86: dts: Update to include ACTL register details
Bin Meng [Sat, 7 May 2016 14:46:15 +0000 (07:46 -0700)]
x86: dts: Update to include ACTL register details

This updates all x86 boards that currently have IRQ router in the
dts files to include ACTL register details.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agox86: irq: Enable SCI on IRQ9
Bin Meng [Sat, 7 May 2016 14:46:14 +0000 (07:46 -0700)]
x86: irq: Enable SCI on IRQ9

By default SCI is disabled after power on. ACTL is the register to
enable SCI and route it to PIC/APIC. To support both ACPI in PIC
mode and APIC mode, configure SCI to use IRQ9.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
8 years agox86: irq: Reserve IRQ9 for ACPI in PIC mode
Bin Meng [Sat, 7 May 2016 14:46:13 +0000 (07:46 -0700)]
x86: irq: Reserve IRQ9 for ACPI in PIC mode

Reserve IRQ9 which is to be used as SCI interrupt number
for ACPI in PIC mode.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agox86: acpi: Fix compiler warnings in write_acpi_tables()
Bin Meng [Sat, 7 May 2016 14:46:12 +0000 (07:46 -0700)]
x86: acpi: Fix compiler warnings in write_acpi_tables()

Fix the following two build warnings in function 'write_acpi_tables':

  warning: format '%lx' expects argument of type 'long unsigned int',
  but argument 2 has type 'u32' [-Wformat=]

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agox86: Fix build warning in tables.c when CONFIG_SEABIOS
Bin Meng [Sat, 7 May 2016 14:46:11 +0000 (07:46 -0700)]
x86: Fix build warning in tables.c when CONFIG_SEABIOS

The following build warning is seen in tables.c:

  warning: implicit declaration of function 'memalign'

Add the missing header file to fix it.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agox86: Drop asm/acpi.h
Bin Meng [Sat, 7 May 2016 14:46:10 +0000 (07:46 -0700)]
x86: Drop asm/acpi.h

Remove asm/acpi.h which is never used.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agoMerge git://git.denx.de/u-boot-dm
Tom Rini [Tue, 17 May 2016 17:58:27 +0000 (13:58 -0400)]
Merge git://git.denx.de/u-boot-dm

8 years agoMerge branch 'master' of git://www.denx.de/git/u-boot-imx
Tom Rini [Tue, 17 May 2016 16:10:35 +0000 (12:10 -0400)]
Merge branch 'master' of git://www.denx.de/git/u-boot-imx

8 years agodm: mmc: test: Add tests for MMC
Simon Glass [Sun, 1 May 2016 19:52:44 +0000 (13:52 -0600)]
dm: mmc: test: Add tests for MMC

Add a simple test which checks that a sandbox-emulated SD card can be used
correctly. This tests plumbing through the MMC stack's block-device
implementaion.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: sandbox: mmc: Enable building MMC code for sandbox
Simon Glass [Sun, 1 May 2016 19:52:43 +0000 (13:52 -0600)]
dm: sandbox: mmc: Enable building MMC code for sandbox

Enable building the MMC code for sandbox. This increases build
coverage for sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: mmc: sandbox: Add an SD-card emulation
Simon Glass [Sun, 1 May 2016 19:52:42 +0000 (13:52 -0600)]
dm: mmc: sandbox: Add an SD-card emulation

Add an emulation of an SD card to sandbox, allowing MMC to be used in tests.
The emulation is very simple, supporting only card detection and reading
test data.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: mmc: Add support for driver-model block devices
Simon Glass [Sun, 1 May 2016 19:52:41 +0000 (13:52 -0600)]
dm: mmc: Add support for driver-model block devices

Add support for enabling CONFIG_BLK with MMC. This involves changing a
few functions to use struct udevice and adding a MMC block device driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: mmc: Add a way to bind MMC devices with driver model
Simon Glass [Sun, 1 May 2016 19:52:40 +0000 (13:52 -0600)]
dm: mmc: Add a way to bind MMC devices with driver model

Binding an MMC device when CONFIG_BLK is enabled requires that a block
device be bound as a child of the MMC device. Add a function to do this.
The mmc_create() method will be used only when DM_BLK is disabled.

Add an unbind method also.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: mmc: Implement the MMC functions for block devices
Simon Glass [Sun, 1 May 2016 19:52:39 +0000 (13:52 -0600)]
dm: mmc: Implement the MMC functions for block devices

Implement the functions in mmc_legacy.c for driver-model block devices, so
that MMC can use driver model for these. This allows CONFIG_BLK to be enabled
with DM_MMC.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: sandbox: Only enable the sandbox MMC driver when valid
Simon Glass [Sun, 1 May 2016 19:52:38 +0000 (13:52 -0600)]
dm: sandbox: Only enable the sandbox MMC driver when valid

This driver will require generic MMC and block-device support in a future
commit. To avoid test errors, make this change now.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: mmc: Adjust mmc_switch_part() to use a struct mmc
Simon Glass [Sun, 1 May 2016 19:52:37 +0000 (13:52 -0600)]
dm: mmc: Adjust mmc_switch_part() to use a struct mmc

Instead of looking up the MMC device by number, just pass it in. This makes
it possible to use this function with driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: blk: Use the correct error code for blk_get_device_by_str()
Simon Glass [Sun, 1 May 2016 19:52:36 +0000 (13:52 -0600)]
dm: blk: Use the correct error code for blk_get_device_by_str()

Return -EINVAL instead of -1 in this function, to provide a more meaningful
error.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: mmc: Move the device list into a separate file
Simon Glass [Sun, 1 May 2016 19:52:35 +0000 (13:52 -0600)]
dm: mmc: Move the device list into a separate file

At present the MMC subsystem maintains its own list of MMC devices. This
cannot work with driver model, which needs to maintain this itself. Move the
list code into a separate 'legacy' file. The core MMC code remains, and will
be shared with the driver-model implementation.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: mmc: Set up the device pointer when using the MMC uclass
Simon Glass [Sun, 1 May 2016 19:52:34 +0000 (13:52 -0600)]
dm: mmc: Set up the device pointer when using the MMC uclass

Update the existing drivers to set up this new pointer. This will be required
by the MMC uclass.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: blk: Add a comment as to why the bdev member is needed
Simon Glass [Sun, 1 May 2016 19:52:33 +0000 (13:52 -0600)]
dm: blk: Add a comment as to why the bdev member is needed

This member should be explained, since it is not obvious why it is needed.
Add a comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: part: Drop the block_drvr table
Simon Glass [Sun, 1 May 2016 19:52:32 +0000 (13:52 -0600)]
dm: part: Drop the block_drvr table

This is not needed since we can use the functions provided by the legacy
block device support.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: part: Use the legacy block driver for hardware partition support
Simon Glass [Sun, 1 May 2016 19:52:31 +0000 (13:52 -0600)]
dm: part: Use the legacy block driver for hardware partition support

Drop use of the table in part.c for this feature.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: blk: Add functions to select a hardware partition
Simon Glass [Sun, 1 May 2016 19:52:30 +0000 (13:52 -0600)]
dm: blk: Add functions to select a hardware partition

The block device uclass does not currently support selecting a particular
hardware partition but this is needed for MMC. Add it so that the blk API
can support MMC properly.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: mmc: Use the new select_hwpart() API
Simon Glass [Sun, 1 May 2016 19:52:29 +0000 (13:52 -0600)]
dm: mmc: Use the new select_hwpart() API

Avoid calling directly into the MMC code - use the new API call instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: mmc: spl: Use the legacy block interface in SPL
Simon Glass [Sun, 1 May 2016 19:52:28 +0000 (13:52 -0600)]
dm: mmc: spl: Use the legacy block interface in SPL

Bring this in for SPL so that we can use generic code for loading from
block devices.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: mmc: Add a function to obtain the block device
Simon Glass [Sun, 1 May 2016 19:52:27 +0000 (13:52 -0600)]
dm: mmc: Add a function to obtain the block device

The MMC block device is contained within struct mmc. But with driver model
this will not be the case. Add a function to obtain the block device. We
can later implement this for CONFIG_BLK.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: mmc: Implement the select_hwpart() method
Simon Glass [Sun, 1 May 2016 19:52:26 +0000 (13:52 -0600)]
dm: mmc: Implement the select_hwpart() method

Implement this method so that hardware partitions will work correctly with
MMC.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: mmc: Move mmc_switch_part() above its callers
Simon Glass [Sun, 1 May 2016 19:52:25 +0000 (13:52 -0600)]
dm: mmc: Move mmc_switch_part() above its callers

This function is defined after it is used. In preparation for making it
static, move it up a little. Also drop the printf() which should not appear
in a driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: blk: Free the block device name when unbound
Simon Glass [Sun, 1 May 2016 19:52:24 +0000 (13:52 -0600)]
dm: blk: Free the block device name when unbound

Mark the device name as allocated so that it will be freed correctly when the
device is unbound.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: core: Allow device names to be freed automatically
Simon Glass [Sun, 1 May 2016 19:52:23 +0000 (13:52 -0600)]
dm: core: Allow device names to be freed automatically

Some devices have a name that is stored in allocated memory. At present
there is no mechanism to free this memory when the device is unbound.

Add a device flag to track whether a name is allocated and a function to
add the flag. Free the memory when the device is unbound.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: blk: Fix allocation of block-device numbering
Simon Glass [Sun, 1 May 2016 19:52:22 +0000 (13:52 -0600)]
dm: blk: Fix allocation of block-device numbering

Due to code ordering the block devices are not numbered sequentially. Fix
this.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: sandbox: Enable systemace
Simon Glass [Sun, 1 May 2016 17:36:32 +0000 (11:36 -0600)]
dm: sandbox: Enable systemace

Enable building the systemace code for sandbox. This increases build
coverage for sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: systemace: Add driver-mode block-device support
Simon Glass [Sun, 1 May 2016 17:36:31 +0000 (11:36 -0600)]
dm: systemace: Add driver-mode block-device support

Add support for CONFIG_BLK to the systemace driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: systemace: Reorder function to avoid forward declarataions
Simon Glass [Sun, 1 May 2016 17:36:30 +0000 (11:36 -0600)]
dm: systemace: Reorder function to avoid forward declarataions

Move the systemace_get_dev() function below systemace_read() so that we can
avoid a forward declaration.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: blk: Add a easier way to create a named block device
Simon Glass [Sun, 1 May 2016 17:36:29 +0000 (11:36 -0600)]
dm: blk: Add a easier way to create a named block device

Add a function that automatically builds the device name given the parent
and a supplied string. Most callers will want to do this, so putting this
functionality in one place makes more sense.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: blk: Allow blk_create_device() to allocate the device number
Simon Glass [Sun, 1 May 2016 17:36:28 +0000 (11:36 -0600)]
dm: blk: Allow blk_create_device() to allocate the device number

Allow a devnum parameter of -1 to indicate that the device number should be
alocated automatically. The next highest available device number for that
interface type is used.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: sandbox: Enable SATA
Simon Glass [Sun, 1 May 2016 17:36:27 +0000 (11:36 -0600)]
dm: sandbox: Enable SATA

Enable building the SATA code for sandbox. This increases build coverage
for sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: sata: Add support for driver-model block devices
Simon Glass [Sun, 1 May 2016 17:36:26 +0000 (11:36 -0600)]
dm: sata: Add support for driver-model block devices

Add driver-model block-device support to the SATA implementation. This is
just a dummy implementation for now, since the SATA low-level API uses
numbered devices and that doesn't fit with driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: sandbox: Enable SCSI
Simon Glass [Sun, 1 May 2016 17:36:25 +0000 (11:36 -0600)]
dm: sandbox: Enable SCSI

Enable building the SCSI code for sandbox. This increases build coverage
for sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: scsi: Add support for driver-model block devices
Simon Glass [Sun, 1 May 2016 17:36:24 +0000 (11:36 -0600)]
dm: scsi: Add support for driver-model block devices

Add driver-model block-device support to the SCSI implementation.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: sandbox: Enable IDE
Simon Glass [Sun, 1 May 2016 17:36:23 +0000 (11:36 -0600)]
dm: sandbox: Enable IDE

Enable building the IDE code for sandbox. This is for build coverage only.
It does not currently work.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: ide: Add support for driver-model block devices
Simon Glass [Sun, 1 May 2016 17:36:22 +0000 (11:36 -0600)]
dm: ide: Add support for driver-model block devices

Add driver-model block-device support to the IDE implementation.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: part: Drop the get_dev() method
Simon Glass [Sun, 1 May 2016 17:36:21 +0000 (11:36 -0600)]
dm: part: Drop the get_dev() method

This is now handled by the legacy block driver. The get_dev() method is
no-longer used. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: sandbox: Drop the host_get_dev() function
Simon Glass [Sun, 1 May 2016 17:36:20 +0000 (11:36 -0600)]
dm: sandbox: Drop the host_get_dev() function

This function is implemented by the legacy block functions now. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: blk: Drop the systemace.h header
Simon Glass [Sun, 1 May 2016 17:36:19 +0000 (11:36 -0600)]
dm: blk: Drop the systemace.h header

This has nothing of consequence. Remove it and its only inclusion site.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: systemace: Drop the get_dev() function
Simon Glass [Sun, 1 May 2016 17:36:18 +0000 (11:36 -0600)]
dm: systemace: Drop the get_dev() function

This function is implemented by the legacy block functions now. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: sata: Drop the get_dev() function
Simon Glass [Sun, 1 May 2016 17:36:17 +0000 (11:36 -0600)]
dm: sata: Drop the get_dev() function

This function is implemented by the legacy block functions now. Drop it.

We cannot yet make sata_dev_desc[] private to common/sata.c as it is used by
the SATA drivers. This will require the SATA interface to be reworked.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: scsi: Drop the get_dev() function
Simon Glass [Sun, 1 May 2016 17:36:16 +0000 (11:36 -0600)]
dm: scsi: Drop the get_dev() function

This function is implemented by the legacy block functions now. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: mmc: Drop the get_dev() function
Simon Glass [Sun, 1 May 2016 17:36:15 +0000 (11:36 -0600)]
dm: mmc: Drop the get_dev() function

This function is implemented by the legacy block functions now. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: ide: Drop the get_dev() function
Simon Glass [Sun, 1 May 2016 17:36:14 +0000 (11:36 -0600)]
dm: ide: Drop the get_dev() function

This function is implemented by the legacy block functions now. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: usb: Drop the get_dev() function
Simon Glass [Sun, 1 May 2016 17:36:13 +0000 (11:36 -0600)]
dm: usb: Drop the get_dev() function

This function is implemented by the legacy block functions now. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: disk: Use legacy block driver info for block device access
Simon Glass [Sun, 1 May 2016 17:36:12 +0000 (11:36 -0600)]
dm: disk: Use legacy block driver info for block device access

Instead of calling xx_get_dev() functions for each interface type, use the
new legacy block driver which can provide the device through its interface.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: sata: Separate the non-command code into its own file
Simon Glass [Sun, 1 May 2016 17:36:11 +0000 (11:36 -0600)]
dm: sata: Separate the non-command code into its own file

At present the SATA command code includes both the command-processing code
and the core SATA functions and data structures.

Separate the latter into its own file, adding functions as needed to avoid
the command code accessing data structures directly.

With this commit:
- All CONFIG option are referenced from the non-command code
- The concept of a 'current SATA device' is confined to the command code

This will make it easier to convert this code to driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: ide: Separate the non-command code into its own file
Simon Glass [Sun, 1 May 2016 17:36:10 +0000 (11:36 -0600)]
dm: ide: Separate the non-command code into its own file

At present the IDE command code includes both the command-processing code
and the core IDE functions and data structures.

Separate the latter into its own file, adding functions as needed to avoid
the command code accessing data structures directly.

With this commit:
- Most CONFIG option are referenced from the non-command code
- The concept of a 'current IDE device' is confined to the command code

This will make it easier to convert this code to driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: scsi: Separate the non-command code into its own file
Simon Glass [Sun, 1 May 2016 17:36:09 +0000 (11:36 -0600)]
dm: scsi: Separate the non-command code into its own file

At present the SCSI command code includes both the command-processing code
and the core SCSI functions and data structures.

Separate the latter into its own file, adding functions as needed to avoid
the command code accessing data structures directly. This functions use the
new legacy block functions.

With this commit:
- There is no CONFIG option referenced from the command code
- The concept of a 'current SCSI device' is confined to the command code

This will make it easier to convert this code to driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: mmc: Add an implementation of the 'devnum' functions
Simon Glass [Sun, 1 May 2016 17:36:08 +0000 (11:36 -0600)]
dm: mmc: Add an implementation of the 'devnum' functions

Now that the MMC code accesses devices by number, we can implement this same
interface for driver model, allowing MMC to support using driver model for
block devices.

Add the required functions to the uclass.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: mmc: Add a legacy block interface for MMC
Simon Glass [Sun, 1 May 2016 17:36:07 +0000 (11:36 -0600)]
dm: mmc: Add a legacy block interface for MMC

Add a legacy block interface for MMC.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: usb: Add a legacy block interface for USB storage
Simon Glass [Sun, 1 May 2016 17:36:06 +0000 (11:36 -0600)]
dm: usb: Add a legacy block interface for USB storage

Add a legacy block interface for USB storage.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: sandbox: Add a legacy host block interface
Simon Glass [Sun, 1 May 2016 17:36:05 +0000 (11:36 -0600)]
dm: sandbox: Add a legacy host block interface

Add a legacy block interface for sandbox host.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: systemace: Add a legacy block interface
Simon Glass [Sun, 1 May 2016 17:36:04 +0000 (11:36 -0600)]
dm: systemace: Add a legacy block interface

Add a legacy block interface for systemace.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: blk: Add a legacy block interface
Simon Glass [Sun, 1 May 2016 17:36:03 +0000 (11:36 -0600)]
dm: blk: Add a legacy block interface

There is quite a bit of duplicated common code related to block devices
in the IDE and SCSI implementations.

Create some helper functions that can be used to reduce the duplication.
These rely on a linker list of interface-type drivers

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: scsi: Rename CONFIG_CMD_SCSI to CONFIG_SCSI
Simon Glass [Sun, 1 May 2016 17:36:02 +0000 (11:36 -0600)]
dm: scsi: Rename CONFIG_CMD_SCSI to CONFIG_SCSI

This option currently enables both the command and the SCSI functionality.
Rename the existing option to CONFIG_SCSI since most of the code relates
to the feature.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: sata: Fix code style problems in cmd/sata.c
Simon Glass [Sun, 1 May 2016 17:36:01 +0000 (11:36 -0600)]
dm: sata: Fix code style problems in cmd/sata.c

This file has a few coding style problems. Fix these to make future updates
easier.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: ide: Remove the forward declarations
Simon Glass [Sun, 1 May 2016 17:36:00 +0000 (11:36 -0600)]
dm: ide: Remove the forward declarations

Reorder the code to avoid needing forward declarations. Fix up code style
as needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: ide: Correct various code style problems
Simon Glass [Sun, 1 May 2016 17:35:59 +0000 (11:35 -0600)]
dm: ide: Correct various code style problems

Adjust common/ide.c so that it passes most checkpatch.pl checks.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: scsi: Fix up code style
Simon Glass [Sun, 1 May 2016 17:35:58 +0000 (11:35 -0600)]
dm: scsi: Fix up code style

Update the code style of this file so that it passes checkpatch.pl.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: scsi: Remove the forward declarations
Simon Glass [Sun, 1 May 2016 17:35:57 +0000 (11:35 -0600)]
dm: scsi: Remove the forward declarations

Reorder the code to avoid needing forward declarations.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agosandbox: Add dummy SATA functions
Simon Glass [Sun, 1 May 2016 17:35:56 +0000 (11:35 -0600)]
sandbox: Add dummy SATA functions

Add some functions needed by the SATA code. This allows it to be compiled
for sandbox, thus increasing build coverage.

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