ARM: Add Raumfeld/SUE DTS

Add DTS files for Raumfeld Connector v2 and SUE S800 module.
Assorted AM33xx changes.
Raumfeld/am33xx: add defconfig
ARM: omap2: register cpufreq-cpu0 device for am33xx

The cpufreq-cpu0 driver changes to instantiate use platform_driver
mechanism.  The patch is an am33xx platform level adaptation for it.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
musb: hacks
mwifiex: bug: wrong list in list_empty check.

adapter->bss_prio_tbl list has already been checked in outer loop. The
inner loop works with priv_tmp->wmm.tid_tbl_ptr list. Also the lock taken,
gives hint that this is likely a copy-paste error.

Signed-off-by: Andreas Fenkart <andreas.fenkart@streamunlimited.com>
mwifiex: remove unused tid_tbl_lock from mwifiex_tid_tbl.

ra_list_spinlock is used to protect struct mwifiex_wmm_desc and embedded
structures such as ra_list. tid_tbl_lock while more fine grained, is not
used but in one function. That function is not called reentrantly. To
protect ra_list from concurrent modification ra_list_spinlock must be held.

Signed-off-by: Andreas Fenkart <andreas.fenkart@streamunlimited.com>
mwifiex: bug: remove NO_PKT_PRIO_TID.

Using NO_PKT_PRIO_TID and tx_pkts_queued to check for an empty state, can
lead to a contradictory state, resulting in an infinite loop.
Currently queueing and dequeuing of packets is not synchronized, and can
happen concurrently. While tx_pkts_queued is incremented when adding a
packet, max prio is set to NO_PKT when the WMM list is empty. If a packet
is added right after the check for empty, but before setting max prio to
NO_PKT, that packet is trapped and creates an infinite loop.
Because of the new packet, tx_pkts_queued is at least 1, indicating wmm
lists are not empty. Opposing that max prio is NO_PKT, which means "skip
this wmm queue, it has no packets". The infinite loop results, because the
main loop checks the wmm lists for not empty via tx_pkts_queued, but for
dequeing it uses max_prio to see if it can skip current list. This will
never end, unless a new packet is added which will restore max prio to the
level of the trapped packet.
The solution here is to rely on tx_pkts_queued solely for checking wmm
queue to be empty, and drop the NO_PKT define. It does not address the
locking issue.

Signed-off-by: Andreas Fenkart <andreas.fenkart@streamunlimited.com>
mwifiex: bug: hold proper locks when accessing ra_list / bss_prio lists.

Not locking ra_list when dequeuing packets creates race conditions.
When adding a packet 'tx_pkts_queued' is modified before setting
highest_priority_queue. If in-between the main loop starts, it will see
a packet queued (tx_pkts_queued > 0) but will not find it, since max prio
is not set yet. Depending on the scheduling, the thread trying to add the
packet could complete and restore the situation. But this is not something
to rely on.
Another race condition exists, if a new packet, exceeding current max prio
is added. If concurrently a packet is dequeued, the newly set max
prio will be overwritten with the value of the dequeued packet.
This can occur, because selecting a packet and modifying the max prio
is not atomic. The result in an infinite loop unless, a new packet is
added that has at least the priority of the hidden packet.

Same applies to bss_prio_tbl. Forward iteration is no proper lock-free
technique and provides no protection from calls to list_del. Although
BSS are currently not added/removed dynamically, this must not be the
case in the future. Hence always hold proper locks when accessing those
lists.

Signed-off-by: Andreas Fenkart <andreas.fenkart@streamunlimited.com>
mwifiex: replace ra_list_curr by list rotation.

After a packet is successfully transmitted, ra list is rotated, so the ra
next to the one transmitted, will be the first in the list. This way we
pick the ra' in a round robin fashion. This significantly simplifies
iteration in  mwifiex_wmm_get_highest_priolist_ptr to a call to
list_for_each_entry.
List rotation is done via list_move, where the head itself is temporarily
removed and then re-inserted after the item just transferred.

Signed-off-by: Andreas Fenkart <andreas.fenkart@streamunlimited.com>
mwifiex: rework round robin scheduling of bss nodes.

Rotate bss prio list, so the bss next to the one served, will come first
in the list of bss' with equal priority. This way we pick bss nodes in a
round robin fashion. Using list rotation instead of a cur ptr simplifies
iteration to calling list_for_each_entry. List rotation is done via
list_move, where the head itself is temporarily removed and then
re-inserted after the bss just served.

Signed-off-by: Andreas Fenkart <andreas.fenkart@streamunlimited.com>
gpio/omap: implement irq_enable/disable using mask/unmask.

In PM suspend the omap_hsmmc driver can't detect SDIO IRQs. This is
worked around by reconfiguring the SDIO IRQ pin (dat1) as a GPIO
before entering suspend and back upon resume. This requires low
overhead functions for enable/disable of GPIO IRQs.

Signed-off-by: Andreas Fenkart <andreas.fenkart@streamunlimited.com>
mmc: omap_hsmmc: Enable SDIO IRQ using a GPIO in idle mode.

Without functional clock the omap_hsmmc module can't forward
SDIO IRQs to the system. This patch reconfigures dat1 line
as a gpio while the fclk is off. And uses SDIO IRQ detection of
the module, while fclk is present.

Signed-off-by: Andreas Fenkart <andreas.fenkart@streamunlimited.com>
mmc: omap_hsmmc: debugfs entries for GPIO mode.

Signed-off-by: Andreas Fenkart <andreas.fenkart@streamunlimited.com>
mmc: omap_hsmmc: add PSTATE to debugfs regs_show.

PSTATE shows current state of data lines.

Signed-off-by: Andreas Fenkart <andreas.fenkart@streamunlimited.com>
dts: pinmux config for gpio-cirq.

Signed-off-by: Andreas Fenkart <andreas.fenkart@streamunlimited.com>
irq: get_irq_disable_depth.

Used to verify invariant in omap_hsmmc, were a gpio is used to detect
sdio irqs during suspend phase. The ref count from irq_enable/irq_disable
is used to control when the irq should be effectively enabled.

                 irq en     irq dis
            ------------------------
  pm suspend  |    0     |   1
  pm default  |    1     |   2

              irq disable depth

When the sdio irq is enabled AND the module is in runtime suspend,
the ref must be zero so the irq is effectively enabled.

This function helps to verify, that the disable depth has the
right value at different driver states.

Signed-off-by: Andreas Fenkart <andreas.fenkart@streamunlimited.com>
mmc: omap_hsmmc: GPIO CIRQ ref_count runtime checks.

Signed-off-by: Andreas Fenkart <andreas.fenkart@streamunlimited.com>
clk: add si5351 i2c common clock driver

This patch adds a common clock driver for Silicon Labs Si5351a/b/c
i2c programmable clock generators. Currently, the driver does not
support VXCO feature of si5351b. Passing platform_data or DT bindings
selectively allows to overwrite stored Si5351 configuration which is
very helpful for clock generators with empty eeprom configuration.
Corresponding device tree binding documentation is also added.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
hsmmc: Fix problems with wifi module loading in v3.9 kernel.

Old u-boot set correctly pinmux and all other things to have correct
32kHz clock
provided for wifi module. When switching to new kernel all u-boot
specific init was
skipped. Pin dma_event_intr1 for CLKOUT2 is currently set in dts. This
wasn't enough to
have clock on CLKOUT2.

In cclock33xx_data is clk_32768_ck defined as root clock so don't
provide methods
for enable/disable. Use new specified clkout2_ck to have correct output
on CLOKOUT2 pin.

Signed-off-by: Marek Belisko <marek.belisko@streamunlimited.com>