ARM: OMAP4: clock: Initialize USB DPLL

If the bootloader doesn't configure USB DPLL (e.g. in u-boot,
disable CONFIG_USB_EHCI_OMAP), then we get all sorts of problems
like
- division by zero errors at boot [1]
- USB DPLL fails to enter locked state
- USB EHCI Host is non functional
- Device can't enter OFF mode

Initializing the USB DPLL fixes all these issues.

[1]

[    0.000000] clock: dpll_usb_ck failed transition to 'locked'
[    0.000000] Division by zero in kernel.
[    0.000000] [<c001b00c>] (unwind_backtrace+0x0/0xf0) from [<c02b2378>] (Ldiv0+0x8/0x10)
[    0.000000] [<c02b2378>] (Ldiv0+0x8/0x10) from [<c041cf3c>] (clk_divider_set_rate+0x10/0x124)
[    0.000000] [<c041cf3c>] (clk_divider_set_rate+0x10/0x124) from [<c041bfc4>] (clk_change_rate+0x3c/0xb4)
[    0.000000] [<c041bfc4>] (clk_change_rate+0x3c/0xb4) from [<c041c028>] (clk_change_rate+0xa0/0xb4)

Signed-off-by: Roger Quadros <rogerq@ti.com>
ARM: OMAP: clock: Helpers to reparent and init rates

On OMAP, as we move away from bootloaders enabling _all_ clocks to
bootloaders only enabling whats needed, we have had numerous instances
of breakages due to DPLLs not locked, or some clocks not set to the
right rates etc.
We have moved ahead adding a bunch of clk_set_rates(), and clk_set_parents()
all over clock init calls.

This patch just consolidates all and provides helpers which can be called
from SoC clock init code, to set rates for a given set of clocks and reparent
any clocks if needed. Similar to the way, a helper exists to enable clocks
(for memory controller etc) at clock init.

Does not change anything much, but makes code more readable.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
ARM: OMAP2+: Fix sparse warnings

Fixes the following sparse warnings
arch/arm/mach-omap2/omap_hwmod.c:2336:12: warning: symbol '_state_str' was not declared. Should it be static?
arch/arm/mach-omap2/omap4-common.c:406:55: warning: Using plain integer as NULL pointer
arch/arm/mach-omap2/omap-mpuss-lowpower.c:101:6: warning: symbol 'dummy_scu_prepare' was not declared. Should it be static?
arch/arm/mach-omap2/omap-mpuss-lowpower.c:104:19: warning: symbol 'omap_pm_ops' was not declared. Should it be static?

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Merge branch 'platform-base-3.8.y' of git://github.com/hvaibhav/am335x-linux into platform-base-3.8.y
ARM: dts: omap5-uevm: Remove bmp085 dt entry

The omap5 uevm does not contain a bmp085 so remove the
dt entry for the uevm.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
ARM: dts: omap5-uevm: Remove tmp102 dt entry

The omap5 uevm does not contain a tmp102 sensor so remove the
dt entry for the uevm.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
omap: watchdog: Use devm_request_irq instead of request_irq()

The missing free_irq() as part of the driver removal,
for the request_irq() done when the device is probed
results in a crash during the driver/module removal.

[  567.951568] Unable to handle kernel paging request at virtual address bf005088
[  567.959106] pgd = c0004000
[  567.961914] [bf005088] *pgd=aecc8811, *pte=00000000, *ppte=00000000
[  567.968475] Internal error: Oops: 80000007 [#1] SMP ARM
[  567.973907] Modules linked in: [last unloaded: omap_wdt]
[  567.979431] CPU: 0    Not tainted  (3.8.4-00186-ga9a396d #1)
[  567.985321] PC is at 0xbf005088
[  567.988616] LR is at handle_irq_event_percpu+0x64/0x244
[  567.994049] pc : [<bf005088>]    lr : [<c00a9b84>]    psr: 60000193
[  567.994049] sp : c078ded0  ip : 00000000  fp : c082a358
[  568.005981] r10: 00000000  r9 : c082a344  r8 : 00000000
[  568.011413] r7 : 00000070  r6 : 00000070  r5 : ee80aa10  r4 : eee2ba40
[  568.018188] r3 : 00000000  r2 : bf005088  r1 : eed18750  r0 : 00000070
[  568.024993] Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
[...]

Use devm_request_irq() instead of request_irq(), so the
free_irq() is automatically handled during the module removal.

And also avoiding an unnecessary check.
irq field in omap_wdt_dev is used to check if irq is registerd or not.
Since driver probe comes out when request_irq fails, the above field is
not needed. Removing the same.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
omap: watchdog: If enabled stop watchdog during module removal

If user allows kernelpet=1, then watchdog is enabled during
probe. At the time of module removal then watchdog needs to be
stopped. If not system reboots after timer overflow. Driver is missing this.
So if enabled stop watchdog during module removal.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
rtc: OMAP: Add system pm_power_off to rtc driver

Add system power off control to rtc driver which is the in-charge
of controlling the BeagleBone system power. The power_off routine
can be hooked up to "pm_power_off" system call.

System power off sequence:-
* Set PMIC STATUS_OFF when PMIC_POWER_EN is pulled low
* Enable PMIC_POWER_EN in rtc module
* Set rtc ALARM2 time
* Enable ALARM2 interrupt

Signed-off-by: Colin Foe-Parker <colin.foeparker@logicpd.com>
[anilkumar@ti.com: move poweroff additions to rtc driver]
Signed-off-by: AnilKumar Ch <anilkumar@ti.com>
Reviewed-by: Russ Dill <russ.dill@ti.com>
Acked-by: Russ Dill <russ.dill@ti.com>
ARM: dts: AM33XX: Set pmic-shutdown-controller for BeagleBone

Set ti,pmic-shutdown-controller for BeagleBone in am335x-bone.dts
file, this flag is used by the driver to set tps65217 PMIC status
to OFF when PWR_EN toggle.

Signed-off-by: AnilKumar Ch <anilkumar@ti.com>
Reviewed-by: Russ Dill <russ.dill@ti.com>
Acked-by: Russ Dill <russ.dill@ti.com>
ARM: dts: AM33XX: Enable system power off control in am335x-bone

Enable system power off control for BeagleBone in am335x-bone.dts file
under rtc node. RTC is the incharge of controlling the system power.
This flag is used by the driver to hook up the pm_power_off system call.

Signed-off-by: AnilKumar Ch <anilkumar@ti.com>
Reviewed-by: Russ Dill <russ.dill@ti.com>
Acked-by: Russ Dill <russ.dill@ti.com>
ARM: OMAP2+: omap2plus_defconfig: Enable RTC support

AM33XX family of devices use RTC module, one has to manually enable
this support to use RTC features. So this patch enable RTC driver in
omap2plus_defconfig.

Signed-off-by: AnilKumar Ch <anilkumar@ti.com>
Reviewed-by: Russ Dill <russ.dill@ti.com>
Acked-by: Russ Dill <russ.dill@ti.com>