irqchip: sun4i: Use handle_fasteoi_irq for all interrupts

Since the sun4i irq chip does not require any action and clears the interrupt
when the level goes back to inactive, we don't need to mask / unmask for
non oneshot IRQs, to achieve this we make sun4i_irq_ack a nop for all irqs
except irq 0 and use handle_fasteoi_irq for all interrupts.

Now there might be a case when the device reactivates the interrupt
before the RETI. But that does not matter as we run the primary
interrupt handlers with interrupts disabled.

This also allows us to get rid of needing to use 2 irq_chip structs, this
means that the IRQCHIP_EOI_THREADED | IRQCHIP_EOI_IF_HANDLED will now influence
all interrupts rather then just irq 0, but that does not matter as the eoi
is now a nop anyways for all interrupts but irq 0.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
irqchip: sun4i: simplify sun4i_irq_ack

Now that we only ack irq 0 the code can be simplified a lot.

Also switch from read / modify / write to a simple write clear:
1) This is what the android code does (it has a hack for acking irq 0
  in its unmask code doing this)
2) read / modify / write simply does not make sense for an irq status
  register like this, if the other bits are writeable (and the data sheet says
  they are not) they should be write 1 to clear, since otherwise a read /
  modify / write can race with a device raising an interrupt and then clear
  the pending bit unintentionally

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
ARM: sun7i/sun6i: irqchip: Add irqchip driver for NMI controller

Allwinner A20/A31 SoCs have special registers to control / (un)mask /
acknowledge NMI. This NMI controller is separated and independent from GIC.
This patch adds a new irqchip to manage NMI.

Signed-off-by: Carlo Caione <carlo@caione.org>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
ARM: sun7i/sun6i: dts: Add NMI irqchip support

This patch adds DTS entries for NMI controller as child of GIC.

Signed-off-by: Carlo Caione <carlo@caione.org>
ARM: sun7i/sun6i: irqchip: Update the documentation

Added documentation for NMI irqchip.

Signed-off-by: Carlo Caione <carlo@caione.org>
mfd: AXP20x: Add mfd driver for AXP20x PMIC

This patch introduces the preliminary support for PMICs X-Powers AXP202
and AXP209. The AXP209 and AXP202 are the PMUs (Power Management Unit)
used by A10, A13 and A20 SoCs and developed by X-Powers, a sister company
of Allwinner.

The core enables support for two subsystems:
- PEK (Power Enable Key)
- Regulators

Signed-off-by: Carlo Caione <carlo@caione.org>
mfd: AXP20x: Add bindings documentation

Bindings documentation for the AXP20x driver. In this file also two
sub-nodes (PEK and regulators) are documented.

Signed-off-by: Carlo Caione <carlo@caione.org>
input: misc: Add driver for AXP20x Power Enable Key

This patch add support for the Power Enable Key found on MFD AXP202 and
AXP209. Besides the basic support for the button, the driver adds two
entries in sysfs to configure the time delay for power on/off.

Signed-off-by: Carlo Caione <carlo@caione.org>
input: misc: Add ABI docs for AXP20x PEK

Add ABI entries for the PEK found on PMU X-Powers AXP202 and AXP209.

Signed-off-by: Carlo Caione <carlo@caione.org>
regulator: AXP20x: Add support for regulators subsystem

AXP202 and AXP209 come with two synchronous step-down DC-DCs and five
LDOs. This patch introduces basic support for those regulators.

Signed-off-by: Carlo Caione <carlo@caione.org>
ARM: sun4i: dt: Add address- and size-cells info to i2c controller nodes

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
ARM: sun5i: dt: Add address- and size-cells info to i2c controller nodes

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
ARM: sun7i: dt: Add address- and size-cells info to i2c controller nodes

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
ARM: sunxi: dt: Add x-powers-axp209.dtsi file

This dtsi describes the axp209 PMIC, and is to be included from inside
the i2c controller node to which the axp209 is connected.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
ARM: sun7i: dt: Add AXP209 support to the cubieboard2

AXP209 is the PMU used by Cubieboard2. This patch enables the AXP209
support in the dts file.

This patch requires: "ARM: sun7i/sun6i: irqchip: Add irqchip driver for
NMI controller"

Signed-off-by: Carlo Caione <carlo@caione.org>
ARM: sun4i: dt: Add AXP209 support to various boards

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
ARM: sun7i: dt: Add AXP209 support to cubietruck

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
clk: sunxi: Remove calls to clk_put

Callers of clk_put must disable the clock first. This also means that as long
as the clock is enabled the driver should hold a reference to that clock.
Hence, the call to clk_put here are bogus and should be removed.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
ARM: sunxi: Split out the various machines into separate files

This will allow to add per-SoC hooks more easily.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
ARM: sunxi: Move the clock protection to machine hooks

Since we start to have a lot of clocks to protect, some of them in a few boards
only, it becomes difficult to handle the clock protection without having to add
per machine exceptions.

Move these where they belong, in the machine definition code.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>