Commit graph

233079 commits

Author SHA1 Message Date
Olof Johansson
0ec1b606c0 ARM: tegra: harmony: move over to tegra_gpio_config
Move harmony over to use the new gpio config table instead of having
separate settings in various parts of the code.

(The tegra sdhci driver should have the tegra_gpio_* ops removed, but
that will be done separately from this change.)

Signed-off-by: Olof Johansson <olof@lixom.net>
Acked-by: Erik Gilling <konkers@android.com>
2011-02-22 17:28:06 -08:00
Olof Johansson
632095ea15 ARM: tegra: add tegra_gpio_table and tegra_gpio_config
To give one place to setup the pins that are used as GPIOs instead
of as their pinmuxed functions. Specifying enabled as false explicitly
disables the gpio mode of that pin (if left on by firmware).

This should remove the need for calling these from specific drivers and
thus reduce tegra-specific code from them.

Signed-off-by: Olof Johansson <olof@lixom.net>
Acked-by: Erik Gilling <konkers@android.com>
2011-02-22 17:27:11 -08:00
Mark Brown
38376866a1 ARM: tegra: Hide EMC scaling config behind ARCH_TEGRA
The option isn't terribly useful on other ARM platforms.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
2011-02-22 14:48:44 -08:00
Stephen Warren
e19e881fcb ARM: tegra: Fix typo in TEGRA_IRQ_TO_GPIO
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Colin Cross <ccross@android.com>
2011-02-22 14:48:42 -08:00
Colin Cross
cd51d0edec ARM: tegra: common: Enable core clocks
Enable the cpu, emc (memory controller) and csite (debug and
trace controller) clocks during init to prevent them from
being disabled by the bootloader clock disabling code.

Signed-off-by: Colin Cross <ccross@android.com>
Acked-by: Olof Johansson <olof@lixom.net>
2011-02-22 14:48:37 -08:00
Colin Cross
62248ae826 ARM: tegra: timer: Enable timer and rtc clocks
Enable the timer and rtc clocks to prevent them being
turned off by the bootloader clock disabling code.

Signed-off-by: Colin Cross <ccross@android.com>
Acked-by: Olof Johansson <olof@lixom.net>
2011-02-22 14:48:27 -08:00
Colin Cross
0cf6230af9 ARM: tegra: Move tegra_common_init to tegra_init_early
Move tegra_common_init to tegra_init_early, and set it
as the init_early entry in the machine struct.
Initializes the clocks earlier so that timers can enable
their clocks.

Also reorders the members in the Harmony and Trimslice
boards' machine structs to match the order they are
called in.

Signed-off-by: Colin Cross <ccross@android.com>
Acked-by: Olof Johansson <olof@lixom.net>
2011-02-22 11:25:12 -08:00
Colin Cross
1be3d05375 ARM: tegra: clock: prevent accidental disables of cpu clock
Peripheral clocks that have no clock enable bit in the
enable registers have their clk_num set to 0.  Bit 0
in the clock enable registers is the CPU clock.
Prevent disables on these peripheral clocks from
accidentally disabling the CPU clock.

Signed-off-by: Colin Cross <ccross@android.com>
Acked-by: Olof Johansson <olof@lixom.net>
2011-02-22 11:25:07 -08:00
Colin Cross
421186e710 ARM: tegra: clock: Round rate before setting rate
Call the clock's round_rate op, if it exists, before calling
the set_rate op.  This will help later when dvfs is added,
dvfs needs to know what the final rate will be before the
frequency changes.

Also requires fixes to the round rate functions to ensure
calling round rate and then set rate will not cause the
frequency to be rounded down twice.  When picking clock
divider values, the clock framework picks the closest
frequency that is lower than the requested frequency.  If
the new frequency calculated from the divider value is
rounded down, and then passed to set_rate, it will get
rounded down again, possibly resulting in a frequency two
steps lower than the original requested frequency.

Fix the problem by rounding up when calculating the frequency
coming out of a clock divider, so if that frequency is
requested again, the same divider value will be picked.

Signed-off-by: Colin Cross <ccross@android.com>
Acked-by: Olof Johansson <olof@lixom.net>
2011-02-22 11:22:34 -08:00
Colin Cross
78f379b574 ARM: tegra: clock: Refcount periph clock enables
Some peripheral clocks share enable bits.  Refcount the enables so
that calling clk_disable on one clock will not turn off another
clock.

Signed-off-by: Colin Cross <ccross@android.com>
Acked-by: Olof Johansson <olof@lixom.net>
2011-02-22 11:22:24 -08:00
Colin Cross
9c7dc562cd ARM: tegra: clock: Miscellaneous clock updates
Correct max rates for pclk and sclk (Originally fixed by
  Dima Zavin <dima@android.com>)

Correct max rate for plla (Originally fixed by
  Stephen Warren <swarren@nvidia.com>)

Remove unnecessary no-op set_rate on audio clocks

Add clock lookup entries for grhost, bsea, and vde clocks

Update clock clookup entries for vcp, bsea, and vde clocks

Add shared clock entries for sclk and emc

Add a virtual cop clock to provide a reset op (Originally fixed by
  Dima Zavin <dima@android.com>)

Pass set_rate on super clocks through to parent

Fix pllx frequency table entry for 608 MHz

Remove incorrect plla frequency table entries

Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
2011-02-21 00:16:48 -08:00
Colin Cross
c2f44a9df9 ARM: tegra: clock: Fix clock issues in suspend
The PLLP registers are now being restored by the low-level resume code,
and the CPU may be running off PLLP, so don't touch them during clock
resume.

Save plld, plls, pllu, and audio clock during suspend (originally
fixed by Mayuresh Kulkarni <mkulkarni@nvidia.com>)

The lock time for plld is 1000 us, so increase the delay after
setting the PLLs.

Add a BUG_ON to ensure the size of the suspend context area is
correct.

Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
2011-02-21 00:16:47 -08:00
Colin Cross
9743b38969 ARM: tegra: clock: Add function to set SDMMC tap delay
The SDMMC controllers have extra bits in the clock source
register that adjust the delay between the clock and data
to compenstate for delays on the PCB.  The values need to
be set from the clock code so the clock can be locked
during the read-modify-write on the clock source register.

Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
2011-02-21 00:16:47 -08:00
Colin Cross
7a28128412 ARM: tegra: cpufreq: Adjust memory frequency with cpu frequency
Adjusts the minimum memory frequency when the cpu frequency
changes.  The values are currently hardcoded to a reasonable
default.  If memory frequency scaling is not enabled this
patch will have no effect.

Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
2011-02-21 00:16:46 -08:00
Colin Cross
6d2968284f ARM: tegra: clocks: Add emc scaling
Add clock ops on the emc peripheral clock that call into the
emc driver to update the memory controller registers for the
new frequency.  Tegra has an interlock between the clock
controller and the memory controller that prevents the new
register values from taking effect until the clock frequency
update occurs.

Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
2011-02-21 00:16:45 -08:00
Colin Cross
efdf72ad5c ARM: tegra: Add external memory controller driver
The frequency memory bus on Tegra can be adjusted without
disabling accesses to memory by updating the memory
configuration registers from a per-board table, and then
changing the clock frequency.  The clock controller and
memory controller have an interlock that prevents the
new memory registers from taking effect until the
clock frequency change.

Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
2011-02-21 00:16:45 -08:00
Colin Cross
4db4afb4df ARM: tegra: clock: Minor cleanups
Remove unnecessary uses of #ifdef CONFIG_DEBUG_FS
Convert bool assignments from 1 to true

Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
2011-02-21 00:10:46 -08:00
Colin Cross
310992ca4b ARM: tegra: clock: Add shared bus clock type
Some clocks may have multiple downstream users that need to request a
higher clock rate.  Shared bus clocks provide a unique shared_bus_user
clock to each user.  The frequency of the bus is set to the highest
enabled shared_bus_user clock, with a minimum value set by the
shared bus.  Drivers can use clk_enable and clk_disable to enable
or disable their requirement, and clk_set_rate to set the minimum rate.

Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
2011-02-21 00:10:46 -08:00
Colin Cross
89a5fb84da ARM: tegra: cpufreq: Take an extra reference to pllx
During cpu frequency changes, take an extra reference to pllx so
that it doesn't turn off and on while the cpu is temporarily on
pllp.  If the cpu is moved to pllp permanently, pllx will be
turned off.

Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
2011-02-21 00:10:45 -08:00
Colin Cross
4729fd7a7d ARM: tegra: clock: Convert global lock to a lock per clock
Give each clock its own lock, and remove all lock traversals from
parent to child clocks to prevent AB-BA deadlocks.

This brings the locking in line with the common struct clk
patches and should make conversion simple.

Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
2011-02-21 00:10:43 -08:00
Colin Cross
f151961173 ARM: tegra: clock: Move unshared clk struct members into union
Creates a union of a struct for each type of clock to reduce memory
usage and clarify which members are used by all clocks and which are
used by a single type.

Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
2011-02-21 00:10:11 -08:00
Colin Cross
3ec349fbf1 ARM: tegra: clock: Rearrange static clock tables
Make the static clocks look more like the array of clocks
so they can all be initalized with the same helper function.

Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
2011-02-21 00:10:10 -08:00
Colin Cross
41cfe3676d ARM: tegra: clock: Drop CPU dvfs
The existing version did not extend well to core dvfs, drop it
for now until the new clk api with clk_prepare and clk_unprepare
is ready and non-atomic clocks are possible.

Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
2011-02-21 00:10:06 -08:00
Colin Cross
f035530b79 ARM: tegra: clock: Initialize clocks that have no enable
Assume that any clock that has no enable op is always on.

Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
2011-02-21 00:09:12 -08:00
Colin Cross
35c47c3bba ARM: tegra: clock: Don't use PLL lock bits
The PLL lock bits are not reliable, use per-PLL timeouts instead.

Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
2011-02-20 23:36:50 -08:00
Colin Cross
bd41ef55e8 ARM: tegra: clock: Drop debugging
Drop the unnecessary pr_debug calls to avoid having to maintain them.

Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
2011-02-20 23:36:50 -08:00
Colin Cross
14133add42 ARM: tegra: clock: Don't BUG on changing an enabled PLL
When updating the CPU PLL frequency, keeping the PLL enabled avoids
ramping the PLL all the way down and back up again.  Remove the BUG_ON
in tegra2_pll_clk_set_rate to allow the rate to change while the PLL
is enabled.

Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
2011-02-20 23:36:50 -08:00
Dima Zavin
2b84cb4faa ARM: tegra: clock: enable clk reset for non-peripheral clocks
Add a new 'reset' clk op. This can be provided for any clock,
not just peripherals.

Signed-off-by: Dima Zavin <dima@android.com>
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
2011-02-20 23:36:49 -08:00
Simon Glass
375b19cd34 ARM: tegra: Fix hang on reboot
This seems to be a regression in 2.6.37.

We cannot use writel() here since the resulting wmb() calls l2x0_cache_sync()
which uses a spinlock and L1 cache may be off at this point.

http://lists.infradead.org/pipermail/linux-arm-kernel/2011-February/041909.html

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Colin Cross <ccross@android.com>
2011-02-20 20:04:16 -08:00
Stephen Warren
1ca00347c5 ARM: tegra: APB DMA: Enable clock and remove reset.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Colin Cross <ccross@android.com>
2011-02-20 20:04:15 -08:00
Stephen Warren
499ef7a5c4 ARM: tegra: Prevent requeuing in-progress DMA requests
If a request already in the queue is passed to tegra_dma_enqueue_req,
tegra_dma_req.node->{next,prev} will end up pointing to itself instead
of at tegra_dma_channel.list, which is the way a the end-of-list
should be set up. When the DMA request completes and is list_del'd,
the list head will still point at it, yet the node's next/prev will
contain the list poison values. When the next DMA request completes,
a kernel panic will occur when those poison values are dereferenced.

This makes the DMA driver more robust in the face of buggy clients.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Colin Cross <ccross@android.com>
2011-02-19 14:35:52 -08:00
Colin Cross
fe92a026e3 Merge branch 'tegra-arch' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound-2.6 into outside-for-next 2011-02-19 14:35:16 -08:00
Mike Rapoport
cca414b263 ARM: tegra: add TrimSlice board
Add basic support for CompuLab TrimSlice platform

Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Colin Cross <ccross@android.com>
2011-02-10 18:36:51 -08:00
Colin Cross
535371c3fb ARM: tegra: Use writel_relaxed in tegra_init_cache
Signed-off-by: Colin Cross <ccross@android.com>
2011-02-10 17:50:43 -08:00
Olof Johansson
f2b6133ffc ARM: tegra: add tegra_defconfig
Adding one single defconfig for the tegra family of boards, to over time
cover the superset of supported platform and drivers.

Signed-off-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
2011-02-10 17:50:42 -08:00
Colin Cross
5789fee934 ARM: tegra: dma: Fix critical data corruption bugs
Sometimes, due to high interrupt latency in the continuous mode
of DMA transfer, the half buffer complete interrupt is handled
after DMA has transferred the full buffer.  When this is detected,
stop DMA immediately and restart with the next buffer if the next
buffer is ready.

originally fixed by Victor(Weiguo) Pan <wpan@nvidia.com>

In place of using the simple spin_lock()/spi_unlock() in the
interrupt thread, using the spin_lock_irqsave() and
spin_unlock_irqrestore(). The lock is shared between the normal
process context and interrupt context.

originally fixed by Laxman Dewangan (ldewangan@nvidia.com)

The use of shadow registers caused memory corruption at physical
address 0 because the enable bit was not shadowed, and assuming it
needed to be set would enable an unconfigured dma block.  Most of the
register accesses don't need to know the previous state of the
registers, and the few places that do need to modify only a few bits
in the registers are the same ones that were sometimes incorrectly
setting the enable bit.  This patch convert tegra_dma_update_hardware
to set the entire register, and the other users to read-modify-write,
and drops the shadow registers completely.

Also fixes missing locking in tegra_dma_allocate_channel

Signed-off-by: Colin Cross <ccross@android.com>
2011-02-10 17:50:41 -08:00
Colin Cross
699fe145d6 ARM: tegra: Allow overriding arch_reset
Signed-off-by: Colin Cross <ccross@android.com>
2011-02-10 17:50:41 -08:00
Colin Cross
1eb2ecf1d5 ARM: tegra: cpufreq: Disable cpufreq during suspend
On Tegra, calling clk_set_rate on the CPU clock may call into the
regulator API.  If the regulator driver that controls the CPU
voltage rail has been suspended, this can lead to attempted
communication with a hardware block that has already been turned
off.

Adds a SUSPEND_PREPARE notification hook to drop the frequency to
the lowest possible during suspend.

Also adds 216MHz (off of PLLP) as the lowest CPU frequency, which
allows PLLX to be turned off.

Signed-off-by: Colin Cross <ccross@android.com>
2011-02-10 17:50:40 -08:00
Gary King
537f5af0f6 ARM: tegra: iomap: Add missing devices
Adds gart, hdmi, avp, host1x, and pwm controllers to mach/iomap.h

Signed-off-by: Gary King <gking@nvidia.com>
Signed-off-by: Colin Cross <ccross@android.com>
2011-02-10 17:50:23 -08:00
Colin Cross
26d902c0c6 ARM: tegra: irq: Implement retrigger
Signed-off-by: Colin Cross <ccross@android.com>
2011-02-09 22:18:30 -08:00
Colin Cross
3524b70ef3 ARM: tegra: irq: Add support for suspend wake sources
Signed-off-by: Colin Cross <ccross@android.com>
2011-02-09 22:18:21 -08:00
Colin Cross
093617851c ARM: tegra: timer: Add idle and suspend support to timers
Implement read_persistent_clock by reading the Tegra RTC
registers that stay running during suspend.

Save and restore the timer configuration register in
suspend.

Signed-off-by: Colin Cross <ccross@android.com>
2011-02-09 22:17:38 -08:00
Gary King
3c3895b4bf ARM: tegra: pinmux: Add missing drive pingroups and fix suspend
Adds missing drive pingroups, saves all drive pingroups in
suspend, and restores the pinmux registers in the proper order.

Signed-off-by: Gary King <gking@nvidia.com>
Signed-off-by: Colin Cross <ccross@android.com>
2011-02-09 21:57:02 -08:00
Colin Cross
cea62c878d ARM: tegra: clock: Suspend fixes, and add new clocks
Save and restore pll and osc state during suspend
Add digital audio clocks
Update clk dev associations
Correct max clock frequencies
Add pll_p as additional cpu clock state
Add values to plld table
Fix register offset for sdmmc4 clock
Add blink timer to tegra2_clocks

Signed-off-by: Colin Cross <ccross@android.com>
2011-02-09 21:57:02 -08:00
Colin Cross
2ea67fd145 ARM: tegra: Add prototypes for subsystem suspend functions
Signed-off-by: Colin Cross <ccross@android.com>
2011-02-09 21:57:01 -08:00
Colin Cross
538bd3cc19 ARM: tegra: irqs: Update irq list
Fixes typo in INT_CPU1_PMU_INTR (original fix from Will Deacon)
Adds board irqs

Signed-off-by: Colin Cross <ccross@android.com>
2011-02-09 21:57:01 -08:00
Colin Cross
ce1e326269 ARM: tegra: Add api to control internal powergating
Signed-off-by: Colin Cross <ccross@android.com>
2011-02-09 21:57:00 -08:00
Colin Cross
d377eb0d95 ARM: tegra: Centralize macros to define debug uart base
Signed-off-by: Colin Cross <ccross@android.com>
2011-02-09 21:56:59 -08:00
Linus Torvalds
100b33c8bd Linux 2.6.38-rc4 2011-02-07 16:03:55 -08:00
Linus Torvalds
65d9055ea3 Merge master.kernel.org:/home/rmk/linux-2.6-arm
* master.kernel.org:/home/rmk/linux-2.6-arm:
  ALSA: AACI: allow writes to MAINCR to take effect
  ARM: Update mach-types
  ARM: 6652/1: ep93xx: correct the end address of the AC97 memory resource
  ARM: mxs/imx28: remove now unused clock lookup "fec.0"
  ARM: mxs: fix clock base address missing
  ARM: mxs: acknowledge gpio irq
  ARM: mach-imx/mach-mx25_3ds: Fix section type
  ARM: imx: Add VPR200 and MX51_3DS entries to uncompress.h
  ARM i.MX23: use correct register for setting the rate
  ARM i.MX23/28: remove secondary field from struct clk. It's unused
  ARM i.MX28: use correct register for setting the rate
  ARM i.MX28: fix bit operation
2011-02-07 15:20:11 -08:00