ACPICA: Add acpi_get_properties() public interface

In order to support extracting Device Tree style properties from ACPI
devices a new method _PRP was introduced. This method, when present, is
expected to return a package containing packages with name-value pairs
analogous to their Device Tree counterparts.

A sample _PRP method migh look like this:

  Method (_PRP, 0, NotSerialized)
  {
	  Return (Package () {
		  Package () { "integer-property", 10 },
		  Package () { "string-property", "mystring" },
	  })
  }

Calling acpi_get_properties() will evaluate the _PRP method, validate the
result and return it to the caller if everything went fine.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
ACPI: Add support for device specific properties

Device Tree is used in many embedded systems to describe the system
configuration to the OS. It supports attaching properties or name-value
pairs to the devices it describe. With these properties one can pass
additional information to the drivers that would not be available
otherwise.

ACPI is another configuration mechanism (among other things) typically
seen on but not limited to x86 machines. ACPI allows passing arbitrary
data from methods but there is nothing like Device Tree properties in
the ACPI specification.

In order to facilitate ACPI usage in systems where Device Tree is
typically used, it would be beneficial to standardize a way to retrieve
Device Tree style properties from ACPI devices, which is what we do in
this patch.

If a given device described in ACPI namespace wants to export properties
it must implement _PRP method that returns the properties in a package
of packages. For example:

	Method (_PRP, 0, NotSerialized)
	{
		Return (Package () {
			Package () { "name1", <VALUE1> },
			Package () { "name2", <VALUE2> },
			...
		})
	}

Name must be string but there are no limitations for the value itself.

We add several helper functions that can be used to extract these
properties and convert them to different Linux data types.

The ultimate goal is that we only have one device property API that
retrieves the requested properties from Device Tree or from ACPI
transparent to the caller.

Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
ACPI: Document ACPI device specific properties

This document describes the data format and interfaces of ACPI device
specific properties.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
mfd: add ACPI support

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
gpio_keys_polled: Add ACPI enumeration and MinnowBoard GPIO button support

Add support for the MinnowBoard GPIO buttons described by the ACPI _HID
MNW0002.

This is an experimental mechanism to extract GPIO pins and keycodes from
a custom SSDT. It extracts the pins/buttons from the first GpioIO
resource pin_table. It extracts keycodes from the vendor_data, which
must contain a matching number of keycodes.

There are a number of platform data fields for the gpio_keys* driver
that are not readily implemented with ACPI 5, for these, default values
are assigned.

This mechanism is not idea as it defines how the vendor data must look
for any device looking to use gpio_keys_polled. It also encodes
Linux-specific keycode values into an OS agnostic firmware construct.

A better approach might be to move the pdata generation from ACPI into
its own drivers/platform/x86/ driver which then loads the platform
driver, thus leaving the gpio_keys_polled driver independent from the
ACPI description method. This doesn't scale well, but it would allow
time for the ACPI specification to mature in terms of generic hardware
description before a generic format is defined in the gpio_keys*
drivers.

Signed-off-by: Darren Hart <dvhart@linux.intel.com>
leds-gpio: Add ACPI enumeration and platform data generation

Add support for platform data description via ACPI properties.

Signed-off-by: Darren Hart <dvhart@linux.intel.com>
ACPI: Add MinnowBoard HIDs

Add the MinnowBoard HIDs in support of the gpio-keys-polled and leds-gpio
drivers.  This patch was borrowed from Minnowboard and redone so it could
be used in a Linaro git tree.

Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Al Stone <al.stone@linaro.org>
GUFI: enable acpi for aarch64
GUFI: add kernel config options for GUFI

Introduce the kernel config options to enable the Grand Unified Firmware
Interface (GUFI).  Give the user the option of using only ACPI, only DT,
or searching both with either ACPI or DT being searched first.

Signed-off-by: Al Stone <al.stone@linaro.org>
GUFI: introduce the basic framework

This patch introduces the basic structure of GUFI and sets up an initial
API call (gufi_find_first_node(), specifically).
ARM64: GUFI: add setup_arch() call to gufi_init()

GUFI needs to be initialized after ACPI tables are read, and after
the DT has been unflattened, but before devices get configured.  Insert
the proper call to gufi_init() in setup_arch().
GUFI: MFD: initial change to use one GUFI API call in vexpress-sysreg

Replace a call to of_find_compatible_node() with a GUFI API call.

Signed-off-by: Al Stone <al.stone@linaro.org>
ACPI: GUFI: temporarily use the method "PROP" instead of "_PRP"

In ASL, the name "_PRP" would have to be a predefined name because of the
leading underscore.  If it is a predefined name, we have to change iasl to
recognize it as such so we can build tables.  Getting that change done is
a much longer task; changing the name to "PROP" for the short term allows
us to use iasl as is and continue experimenting with the idea.

Signed-off-by: Al Stone <al.stone@linaro.org>
GUFI: correct gufi_look_for_node() so it updates the data it searches

The gufi_look_for_node() functions searchs a list of gufi_device_nodes
that each have a pointer to a DT and ACPI node.  Make sure those nodes
reflect the latest search results so we don't end up with a list of
GUFI nodes that have either ACPI pointers and null DT pointers, or DT
pointers with null ACPI pointers.

Signed-off-by: Al Stone <al.stone@linaro.org>
GUFI: implement ACPI version of gufi_find_first_node()

The DT version of gufi_find_first_node() is working; this patch adds
the same functionality for ACPI.

Signed-off-by: Al Stone <al.stone@linaro.org>
GUFI: add gufi_node_get(), gufi_node_put() to API

Extend the API to provide reference counting interfaces; for the
protocols that implement them (OF), add in the proper functions and
stub the rest.

Signed-off-by: Al Stone <al.stone@linaro.org>
GUFI: vexpress-sysreg: use GUFI API calls gufi_node_get()/gufi_node_put()

Convert the use of of_node_get()/of_node_put() to GUFI API equivalents.

Signed-off-by: Al Stone <al.stone@linaro.org>
GUFI: fix dead-block in gufi_look_for_node()

Spinlocks must be unlocked before returning from function.

Signed-off-by: Semen Protsenko <semen.protsenko@linaro.org>
GUFI: fix code path in find_first_node()

Signed-off-by: Semen Protsenko <semen.protsenko@linaro.org>
GUFI: remove unneeded semicolons

Remove Bash-style semicolon from "switch" statement.

Signed-off-by: Semen Protsenko <semen.protsenko@linaro.org>