ARM: sunxi: Add "allwinner,sun6i-a31s" to mach-sunxi

So fat the A31s is 100% compatible with the A31, still lets do the same
as what we've done for the A13 / A10s and give it its own compatible string,
in case need to differentiate later.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
ARM: dts: sun6i: Add sun6i-a31s.dtsi

Add a dtsi file for A31s based boards. This is a copy of sun6i-a31.dtsi, with:

-The main pinctrl compatible changed to allwinner,sun6i-a31s.dtsi
-The ohci2 controller is present according to the data-sheet, but not routed
 to the outside, so remove it from the dtsi as having an always disabled node
 is not useful.

All the other nodes present in the original sun6i-a31.dtsi are present in
the A31s too, and are 100% compatible.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
ARM: dts: sun6i: Add dts file for CSQ CS908 board

The CSQ CS908 is an A31s based top-set box, with 1G RAM, 8G NAND,
rtl8188etv usb wifi, 2 USB A receptacles (1 connected through the OTG
controller), ethernet, 3.5 mm jack with a/v out and hdmi out.

Note it has no sdcard slot and therefore can only be fel booted.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
clk: sunxi: Give sunxi_factors_register a registers parameter

Before this commit sunxi_factors_register uses of_iomap(node, 0) to get
the clk registers. The sun6i prcm has factor clocks, for which we want to
use sunxi_factors_register, but of_iomap(node, 0) does not work for the prcm
factor clocks, because the prcm uses the mfd framework, so the registers
are not part of the dt-node, instead they are added to the platform_device,
as platform_device resources.

This commit makes getting the registers the callers duty, so that
sunxi_factors_register can be used with mfd instantiated platform device too.

While at it also add error checking to the of_iomap calls.

This commit also drops the __init function from sunxi_factors_register since
platform driver probe functions are not __init.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
clk: sunxi: Make sun4i_a10_mod0_data available outside of clk-mod0.c

The sun6i prcm has mod0 compatible clocks, these need a separate driver
because the prcm uses the mfd framework, but we do want to re-use the
standard mod0 clk handling from clk-mod0.c for this, export
sun4i_a10_mod0_data, so that the prcm mod0 clk driver can use this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
clk: sunxi: Add prcm mod0 clock driver

Add a driver for mod0 clocks found in the prcm. Currently there is only
one mod0 clocks in the prcm, the ir clock.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
rc: sunxi-cir: Add support for an optional reset controller

On sun6i the cir block is attached to the reset controller, add support
for de-asserting the reset if a reset controller is specified in dt.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
rc: sunxi-cir: Add support for the larger fifo found on sun5i and sun6i

Add support for the larger fifo found on sun5i and sun6i, having a separate
compatible for the ir found on sun5i & sun6i also is useful if we ever want
to add ir transmit support, because the sun5i & sun6i version do not have
transmit support.

Note this commits also adds checking for the end-of-packet interrupt flag
(which was already enabled), as the fifo-data-available interrupt flag only
gets set when the trigger-level is exceeded. So far we've been getting away
with not doing this because of the low trigger-level, but this is something
which we should have done since day one.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
ARM: dts: sun6i: Add ir_clk node

Add an ir_clk sub-node to the prcm node.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
ARM: dts: sun6i: Add ir node

Add a node for the ir receiver found on the A31.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
ARM: dts: sun6i: Add pinmux settings for the ir pins

Add pinmux settings for the ir receive pin of the A31.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
ARM: dts: sun6i: Enable ir receiver on the Mele M9

The Mele M9 has an ir receiver, enable it.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
simplefb: Fix build errors when CONFIG_COMMON_CLK is not defined

Both CONFIG_OF and CONFIG_COMMON_CLK must be defined to be able to use of
clocks.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sun6i-prcm-disable-ir-clk

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Revert "ARM: dts: sun6i: Add ir_clk node"

This reverts commit 9fb0cdc3351e1c0316ef844e12ce3fd89e910c9d.
ARM: dts: sun6i: Change prcm node into a simple-bus

The prcm node's purpose is to group the various prcm sub-devices together,
it does not need any special handling beyond that, there is no need to
handle shared resources like a shared (multiplexed) interrupt or a shared
i2c bus.

As such there really is no need to have a separate compatible for it, using
simple-bus for it works fine. This also allows us to specify the register
offsets of the various child-devices directly into the dts, rather then having
to specify them in the OS implementation, putting the register offsets where
the belong.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
ARM: dts: sun6i: Add ir_clk node

Add an ir_clk sub-node to the prcm node.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>