dect
/
linux-2.6
Archived
13
0
Fork 0
Commit Graph

230 Commits

Author SHA1 Message Date
Magnus Damm a0ec360f6b sh: convert cpg code to sh_clk_ops
Convert the CPG code to use sh_clk_ops.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
2012-03-12 22:19:07 +01:00
Rob Herring 0f55239348 sh: intc: remove dependency on NR_IRQS
SH intc has a compile time dependency on NR_IRQS. Make this dependency a
local define so that shmobile (and ARM in general) can have run-time
NR_IRQS setting.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2012-01-25 20:37:48 -06:00
Paul Mundt b59f9f9775 sh: intc: optimize intc IRQ lookup
This ensures that the sense/prio lists are sorted at registration time,
enabling us to use a simple binary search for an optimized lookup
(something that had been on the TODO for some time).

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-01-24 17:41:55 +09:00
Paul Mundt 3037764213 sh: intc: Use IRQ_SET_MASK_OK_NOCOPY for intc_set_affinity.
intc_set_affinity() updates the cpumask in place, so there's no need for
the upper layer to do this itself.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-01-24 16:55:57 +09:00
Paul Mundt 29775df10f sh: intc: Kill off superfluous irq_shutdown hooking.
This already gets handled via disable, as per the notes in linux/irq.h.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-01-24 15:38:57 +09:00
Paul Mundt 5bbda4e4ac sh: intc: Prefer IRQCHIP_SKIP_SET_WAKE over a dummy set_wake callback.
It's possible to use IRQCHIP_SKIP_SET_WAKE to get the behaviour that
we're after, without having to bother with a dummy ->set_wake() callback
for the IRQ chip.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-01-24 14:54:10 +09:00
Paul Mundt 5fbebcbdb3 sh: intc: Make global intc controller counter static.
No need to expose this globally since it's only used for core accounting.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-01-24 14:07:18 +09:00
Kuninori Morimoto 64dea57588 sh: clkfwk: bugfix: use clk_reparent() for div6 clocks
Various problems will happen if clk parent was set up directly.
it should use clk_reparent()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-01-24 10:44:49 +09:00
Linus Torvalds 4c4d285ad5 SH/R-Mobile updates for 3.3 merge window.
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.15 (GNU/Linux)
 
 iEYEABECAAYFAk8Obj8ACgkQGkmNcg7/o7hzngCfS5az4ZP3D+e/cvatHZm/nAzn
 0mIAoKbYyXpLXGkEN+yDkd5YZAYwQjVR
 =kryV
 -----END PGP SIGNATURE-----

Merge tag 'rmobile-for-linus' of git://github.com/pmundt/linux-sh

SH/R-Mobile updates for 3.3 merge window.

* tag 'rmobile-for-linus' of git://github.com/pmundt/linux-sh: (32 commits)
  arm: mach-shmobile: add a resource name for shdma
  ARM: mach-shmobile: r8a7779 SMP support V3
  ARM: mach-shmobile: Add kota2 defconfig.
  ARM: mach-shmobile: Add marzen defconfig.
  ARM: mach-shmobile: r8a7779 power domain support V2
  ARM: mach-shmobile: Fix up marzen build for recent GIC changes.
  ARM: mach-shmobile: r8a7779 PFC function support
  ARM: mach-shmobile: Flush caches in platform_cpu_die()
  ARM: mach-shmobile: Allow SoC specific CPU kill code
  ARM: mach-shmobile: Fix headsmp.S code to use CPUINIT
  ARM: mach-shmobile: clock-r8a7779: clkz/clkzs support
  ARM: mach-shmobile: clock-r8a7779: add DIV4 clock support
  ARM: mach-shmobile: Marzen LAN89218 support
  ARM: mach-shmobile: Marzen SCIF2/SCIF4 support
  ARM: mach-shmobile: r8a7779 PFC GPIO-only support V2
  ARM: mach-shmobile: r8a7779 and Marzen base support V2
  sh: pfc: Unlock register support
  sh: pfc: Variable bitfield width config register support
  sh: pfc: Add config_reg_helper() function
  sh: pfc: Convert index to field and value pair
  ...
2012-01-11 23:29:20 -08:00
Paul Mundt 9f06cf38ec Merge branch 'sh/pm-runtime' into sh-latest
Conflicts:
	arch/sh/kernel/cpu/sh4a/clock-sh7723.c

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-01-12 12:57:32 +09:00
Guennadi Liakhovetski d3442b2bb7 sh: also without PM_RUNTIME pm_runtime.o must be built
When CONFIG_PM_RUNTIME is off, drivers/sh/pm_runtime.o still has to be
built on sh platforms, because then it provides means to statically
switch on device PM clocks.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-01-12 12:25:51 +09:00
Paul Mundt 4414d38a88 Merge branch 'common/clkfwk' into sh-latest 2012-01-10 13:31:09 +09:00
Kuninori Morimoto 7784f4da1a sh: clkfwk: sh_clk_init_parent() should be called after clk_register()
sh_clk_init_parent() are using clk->mapped_reg
which is mapped in clk_register()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-01-10 13:30:30 +09:00
Paul Mundt ca371d2854 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux into sh-latest
Conflicts:
	arch/arm/mach-shmobile/clock-sh73a0.c

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-01-09 11:12:55 +09:00
Paul Mundt e0a23ce20e Merge branches 'common/pfc' and 'common/clkfwk' into rmobile/marzen
Conflicts:
	arch/arm/mach-shmobile/clock-sh73a0.c

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-01-09 10:03:09 +09:00
Magnus Damm e499ada829 sh: pfc: Unlock register support
Add PFC support for a 32-bit unlock register. Needed to
drive the r8a7779 PFC that comes with a funky PMMR register.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-01-09 09:33:57 +09:00
Magnus Damm f78a26f55b sh: pfc: Variable bitfield width config register support
Add support for variable config reg hardware by adding
the macro PINMUX_CFG_REG_VAR(). The width of each bitfield
needs to be passed to the macro, and the correct space must
be consumed by each bitfield in the enum table following the
macro. Data registers still need to have fixed bitfields.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-01-09 09:33:55 +09:00
Magnus Damm 18925e118b sh: pfc: Add config_reg_helper() function
Add a helper function for shared config reg access
calculations. This allows us to reduce the amount
of duplicated code, and at the same time prepare
for a common place for future variable bitwidth
config reg support.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-01-09 09:33:52 +09:00
Magnus Damm ad4a07ff8d sh: pfc: Convert index to field and value pair
Update the way the PFC code is passing bitfield
selection between configure register functions.

Convert the code from using index only to bitfield
number and selected value. First step towards future
variable bitfield width support.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-01-09 09:33:51 +09:00
Magnus Damm 92554d97c6 sh: pfc: Add gpio_read_bit() for data register access
Introduce gpio_read_bit() for data register read access
and modify sh_gpio_get_value() to make use of the new
function instead of gpio_read_reg(). The purpose of
this change is to update the code to only use the
gpio_read_reg() function for config register access.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-01-09 09:33:50 +09:00
Linus Torvalds eb59c505f8 Merge branch 'pm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
* 'pm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (76 commits)
  PM / Hibernate: Implement compat_ioctl for /dev/snapshot
  PM / Freezer: fix return value of freezable_schedule_timeout_killable()
  PM / shmobile: Allow the A4R domain to be turned off at run time
  PM / input / touchscreen: Make st1232 use device PM QoS constraints
  PM / QoS: Introduce dev_pm_qos_add_ancestor_request()
  PM / shmobile: Remove the stay_on flag from SH7372's PM domains
  PM / shmobile: Don't include SH7372's INTCS in syscore suspend/resume
  PM / shmobile: Add support for the sh7372 A4S power domain / sleep mode
  PM: Drop generic_subsys_pm_ops
  PM / Sleep: Remove forward-only callbacks from AMBA bus type
  PM / Sleep: Remove forward-only callbacks from platform bus type
  PM: Run the driver callback directly if the subsystem one is not there
  PM / Sleep: Make pm_op() and pm_noirq_op() return callback pointers
  PM/Devfreq: Add Exynos4-bus device DVFS driver for Exynos4210/4212/4412.
  PM / Sleep: Merge internal functions in generic_ops.c
  PM / Sleep: Simplify generic system suspend callbacks
  PM / Hibernate: Remove deprecated hibernation snapshot ioctls
  PM / Sleep: Fix freezer failures due to racy usermodehelper_is_disabled()
  ARM: S3C64XX: Implement basic power domain support
  PM / shmobile: Use common always on power domain governor
  ...

Fix up trivial conflict in fs/xfs/xfs_buf.c due to removal of unused
XBT_FORCE_SLEEP bit
2012-01-08 13:10:57 -08:00
Greg Kroah-Hartman ff4b8a57f0 Merge branch 'driver-core-next' into Linux 3.2
This resolves the conflict in the arch/arm/mach-s3c64xx/s3c6400.c file,
and it fixes the build error in the arch/x86/kernel/microcode_core.c
file, that the merge did not catch.

The microcode_core.c patch was provided by Stephen Rothwell
<sfr@canb.auug.org.au> who was invaluable in the merge issues involved
with the large sysdev removal process in the driver-core tree.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2012-01-06 11:42:52 -08:00
Rafael J. Wysocki 0f966d74cf PM / shmobile: Don't include SH7372's INTCS in syscore suspend/resume
Since the SH7372's INTCS in included into syscore suspend/resume,
which causes the chip to be accessed when PM domains have been
turned off during system suspend, the A4R domain containing the
INTCS has to stay on during system sleep, which is suboptimal
from the power consumption point of view.

For this reason, add a new INTC flag, skip_syscore_suspend, to mark
the INTCS for intc_suspend() and intc_resume(), so that they don't
touch it.  This allows the A4R domain to be turned off during
system suspend and the INTCS state is resrored during system
resume by the A4R's "power on" code.

Suggested-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Magnus Damm <damm@opensource.se>
2011-12-25 23:39:11 +01:00
Kay Sievers f4e73bfcd9 sh: intc - convert sysdev_class to a regular subsystem
After all sysdev classes are ported to regular driver core entities, the
sysdev implementation will be entirely removed from the kernel.

Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Magnus Damm <magnus.damm@gmail.com>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-12-21 15:09:52 -08:00
Paul Mundt 0d376945d0 Merge branches 'common/clkfwk', 'common/pfc' and 'common/serial-rework' into sh-latest 2011-12-09 18:11:09 +09:00
Magnus Damm b0e10211cb sh: pfc: ioremap() support
Add support for non-entity mapped PFC registers through
the use of struct resource and ioremap()/iounmap().

The PFC main data structure gets updated with a pointer
to a struct resources array that point out all register
windows used by the PFC instance. The register definitions
are kept as physical addresses but the PFC code will do
transparent conversion into virtual addresses whenever
register windows are specified using with struct resource.

To introduce as little performance penalty as possible the
virtual address of each data register is cached in memory.
The virtual address of each configuration register is however
calculated during run time. This because the configuration
is considered slow path so focus is instead put on keeping
memory foot print as small as possible.

The PFC register access  code is in this patch updated from
__raw_readN() / __raw_writeN() into ioreadN() / iowriteN().

This patch is needed to support the PFC block in r8a7779.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-12-09 18:07:15 +09:00
Magnus Damm 2dacb97d92 sh: use ioread32/iowrite32 and mapped_reg for div6
Convert the CPG DIV6 helper code to use the new mapped_reg
together with ioread32() and iowrite32().

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-12-09 18:04:14 +09:00
Magnus Damm 0e027376f8 sh: use ioread32/iowrite32 and mapped_reg for div4
Convert the CPG DIV4 helper code to use the new mapped_reg
together with ioread32() and iowrite32().

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-12-09 18:01:07 +09:00
Magnus Damm b3ab82b3eb sh: use ioread32/iowrite32 and mapped_reg for mstp32
Convert the CPG MSTP32 helper code to use the new mapped_reg
together with ioread32() and iowrite32().

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-12-09 18:01:06 +09:00
Magnus Damm eda2030a5b sh: extend clock struct with mapped_reg member
Add a "mapped_reg" member to struct clk and use that
to keep the ioremapped register based on enable_reg.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-12-09 18:01:05 +09:00
Kuninori Morimoto 56242a1fc5 sh: clkfwk: setup clock parent from current register value
Some clocks can select its parent clock by CPG register.
But it might have been modified by boot-loader or something.
This patch removed fixed initial parent clock,
and setup it from their current register settings.
It works on div6 reparent clocks for now.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-11-24 17:15:23 +09:00
Paul Mundt 62d3ba8bba sh: Kill off remaining private runtime PM bits.
This kills of the now unused runtime PM stub in favour of the generic
one.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-11-18 16:05:52 +09:00
Guennadi Liakhovetski 7fa4632db8 sh: sh7723: use runtime PM implementation, common with arm/mach-shmobile
Switch sh7723 to a runtime PM implementation, common with ARM-based
sh-mobile platforms.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-11-18 04:12:29 +09:00
Guennadi Liakhovetski 6a06d5bf26 sh: sh7722: use runtime PM implementation, common with arm/mach-shmobile
Switch sh7722 to a runtime PM implementation, common with ARM-based
sh-mobile platforms.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-11-18 04:12:28 +09:00
Guennadi Liakhovetski 8cc88a55b0 sh: sh7724: use runtime PM implementation, common with arm/mach-shmobile
Switch sh7724 to a runtime PM implementation, common with ARM-based
sh-mobile platforms.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-11-18 04:12:28 +09:00
Paul Mundt 37bef8f989 Merge branches 'sh/pm-runtime' and 'common/clkfwk' into sh-fixes-for-linus 2011-11-11 16:16:25 +09:00
Paul Mundt 79e7066415 sh: clkfwk: Kill off remaining debugfs cruft.
Now that all of the named string association with clocks has been
migrated to clkdev lookups there's no meaningful named topology that can
be constructed for a debugfs tree view. Get rid of the left over bits,
and shrink struct clk a bit in the process.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-11-11 16:11:41 +09:00
Paul Mundt d03299ee60 drivers: sh: Kill off dead pathname for runtime PM stub.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-11-11 15:58:50 +09:00
Paul Mundt 750a7eee73 drivers: sh: Generalize runtime PM platform stub.
The runtime PM platform support stub in use by ARM-based SH/R-Mobile
platforms contains nothing that's specifically ARM-related and instead of
wholly generic to anything using the clock framework.

The recent runtime PM changes interact rather badly with the lazy
disabling of clocks late in the boot process through the clock framework,
leading to situations where the runtime suspend/resume paths are entered
without a clock being actively driven due to having been lazily gated
off.

In order to correct this we can trivially tie in the aforementioned stub
as a general fallback for all SH platforms that don't presently have
their own runtime PM implementations (the corner case being SH-based
SH-Mobile platforms, which have their own stub through the hwblk API --
which in turn has bitrotted and will be subsequently adapted to use the
same stub as everyone else), regardless of whether the platforms choose
to define power domains of their own or not.

This fixes up regressions for clock framework users who also build in
runtime PM support without any specific power domains of their own, which
was previously causing the serial console to be lost when warring with
lazy clock disabling.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-11-11 15:41:50 +09:00
Linus Torvalds 32aaeffbd4 Merge branch 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux
* 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux: (230 commits)
  Revert "tracing: Include module.h in define_trace.h"
  irq: don't put module.h into irq.h for tracking irqgen modules.
  bluetooth: macroize two small inlines to avoid module.h
  ip_vs.h: fix implicit use of module_get/module_put from module.h
  nf_conntrack.h: fix up fallout from implicit moduleparam.h presence
  include: replace linux/module.h with "struct module" wherever possible
  include: convert various register fcns to macros to avoid include chaining
  crypto.h: remove unused crypto_tfm_alg_modname() inline
  uwb.h: fix implicit use of asm/page.h for PAGE_SIZE
  pm_runtime.h: explicitly requires notifier.h
  linux/dmaengine.h: fix implicit use of bitmap.h and asm/page.h
  miscdevice.h: fix up implicit use of lists and types
  stop_machine.h: fix implicit use of smp.h for smp_processor_id
  of: fix implicit use of errno.h in include/linux/of.h
  of_platform.h: delete needless include <linux/module.h>
  acpi: remove module.h include from platform/aclinux.h
  miscdevice.h: delete unnecessary inclusion of module.h
  device_cgroup.h: delete needless include <linux/module.h>
  net: sch_generic remove redundant use of <linux/module.h>
  net: inet_timewait_sock doesnt need <linux/module.h>
  ...

Fix up trivial conflicts (other header files, and  removal of the ab3550 mfd driver) in
 - drivers/media/dvb/frontends/dibx000_common.c
 - drivers/media/video/{mt9m111.c,ov6650.c}
 - drivers/mfd/ab3550-core.c
 - include/linux/dmaengine.h
2011-11-06 19:44:47 -08:00
Magnus Damm 7d377b170a sh: intc: Allow triggering on both edges for ARM SoCs
Enable IRQ_TYPE_EDGE_BOTH on all R/SH-Mobile ARM SoCs.
This hardware feature is supported by sh7367, sh7377,
sh7372 and sh73a0.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-11-05 00:57:48 +09:00
Kuninori Morimoto dd2c0ca1b1 sh: clkfwk: add clk_rate_mult_range_round()
This provides a clk_rate_mult_range_round() helper for use by some of the
CPG PLL ranged multipliers, following the same approach as used by the
div ranges.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-11-05 00:49:27 +09:00
Paul Gortmaker 07c9273945 drivers/sh: Add export.h for EXPORT_SYMBOL to intc/virq.c
This is exporting symbols and will fail to build once we remove
the implicit presence of module.h

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2011-10-31 19:31:58 -04:00
Paul Gortmaker f7be345515 sh: Add export.h to arch/sh specific files as required.
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2011-10-31 19:31:05 -04:00
Paul Gortmaker db4e83957f sh: Add module.h to arch/sh specific files as required.
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2011-10-31 19:31:04 -04:00
Paul Gortmaker 0c43871b40 sh: fix implicit use of stat.h in arch/sh specific files
To fix:

arch/sh/drivers/dma/dma-sysfs.c:45:8: error: 'S_IRUGO' undeclared here (not in a function)
arch/sh/drivers/dma/dma-sysfs.c:75:8: error: 'S_IWUSR' undeclared here (not in a function)
make[4]: *** [arch/sh/drivers/dma/dma-sysfs.o] Error 1

drivers/sh/intc/core.c:449: error: 'S_IRUGO' undeclared here (not in a function)
make[5]: *** [drivers/sh/intc/core.o] Error 1

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2011-10-31 19:31:04 -04:00
Nobuhiro Iwamatsu a102a08887 sh: userimask.c needs linux/stat.h
This fix the problem that S_IRUSR and S_IWUSR are not solved in userimask.c.

-----
CC      drivers/usb/host/r8a66597-hcd.o
drivers/sh/intc/userimask.c:57: error: ‘S_IRUSR’ undeclared here (not in a function)
drivers/sh/intc/userimask.c:57: error: ‘S_IWUSR’ undeclared here (not in a function)
CC      drivers/watchdog/shwdt.o
-----

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-10-28 15:03:54 +09:00
Magnus Damm ad2a8e7ea4 sh: pfc: Add GPIO IRQ support
Add GPIO IRQ support to the shared PFC code in drivers/sh/pfc.c

The enums pointed out by a certain GPIO will be matched against
a table for IRQ to enum mappings.

Only the shared PFC code is updated by this patch. SoC specific
changes are also needed to allow platforms to make use of this
feature.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-10-28 15:03:52 +09:00
Magnus Damm c63bcc6ff1 sh: pfc: get_config_reg() shift clean up
Clean up the f_width shift code in get_config_reg().

Reported-by: Ryusuke Sakato <ryusuke.sakato.bx@renesas.com>
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-10-28 14:39:26 +09:00
Magnus Damm 52e3124f24 sh: intc: Add IRQ trigger bit field check
R-Mobile SoCs such as sh73a0 include PINT blocks in INTC
that come with 2-bit IRQ trigger support. Add code to make
sure the bit width is checked so 4-bit only modes like for
instance EDGE_BOTH will fail for PINT.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-10-28 14:39:24 +09:00
Paul Mundt e80ca144ea Merge branch 'common/core' into sh-latest 2011-08-08 16:33:54 +09:00
Linus Torvalds e10b87d2b5 Merge branch 'sh-latest' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-3.x
* 'sh-latest' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-3.x: (39 commits)
  SH: static should be at beginning of declaration
  sh: move CLKDEV_xxx_ID macro to sh_clk.h
  sh: clock-shx3: add CLKDEV_ICK_ID for cleanup
  sh: clock-sh7786: add CLKDEV_ICK_ID for cleanup
  sh: clock-sh7785: add CLKDEV_ICK_ID for cleanup
  sh: clock-sh7757: add CLKDEV_ICK_ID for cleanup
  sh: clock-sh7366: add CLKDEV_ICK_ID for cleanup
  sh: clock-sh7343: add CLKDEV_ICK_ID for cleanup
  sh: clock-sh7722: add CLKDEV_ICK_ID for cleanup
  sh: clock-sh7724: add CLKDEV_ICK_ID for cleanup
  sh: clock-sh7366: modify I2C clock settings
  sh: clock-sh7343: modify I2C clock settings
  sh: clock-sh7723: modify I2C clock settings
  sh: clock-sh7722: modify I2C clock settings
  sh: clock-sh7724: modify I2C clock settings
  serial: sh-sci: Fix up pretty name printing for port IRQs.
  serial: sh-sci: Kill off per-port enable/disable callbacks.
  serial: sh-sci: Add missing module description/author bits.
  serial: sh-sci: Regtype probing doesn't need to be fatal.
  sh: Tidy up pre-clkdev clk_get() error handling.
  ...
2011-08-01 06:10:16 -10:00
Magnus Damm 9a14a92c93 sh: intc: enable both edges GPIO interrupts on sh7372
IRQ-capable GPIOs on sh7372 can be configured to produce interrupts on
both edges.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-07-21 16:53:24 +09:00
Al Viro 12520c438f switch assorted clock drivers to debugfs_remove_recursive()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 20:47:51 -04:00
Paul Mundt 225ca45c3c sh: clkfwk: Convert to IS_ERR_OR_NULL.
Trivial cleanup.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-06-24 17:35:40 +09:00
Magnus Damm 794d78fea5 drivers: sh: late disabling of clocks V2
This V2 patch changes the clock disabling behavior during boot.
Two different changes are made:

1) Delay disabling of clocks until late in the boot process.
   This fixes an existing issue where in-use clocks without
   software reference are disabled by mistake during boot.
   One example of this is the handling of the Mackerel serial
   console output that shares clock with the I2C controller.

2) Write out the "disabled" state to the hardware for clocks
   that not have been used by the kernel. In other words,
   make sure so far unused clocks actually get turned off.

Signed-off-by: Magnus Damm <damm@opensource.se>
Acked-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-06-24 16:27:07 +09:00
Magnus Damm 583af252ab drivers: sh: resume enabled clocks fix
Extend the SH / SH-Mobile ARM clock framework to only
resume clocks that have been enabled.

Without this fix divide-by-zero is triggering on sh7372
FSIDIV during system wide resume of Suspend-to-RAM.

Signed-off-by: Magnus Damm <damm@opensource.se>
Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-06-14 15:15:25 +09:00
Paul Mundt 972b1943be Merge branch 'sh/genirq-threading' into sh-latest 2011-05-23 11:36:14 +09:00
Paul Mundt 442f56d917 sh: intc: Set virtual IRQs as nothread.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-04-27 14:35:44 +09:00
Kuninori Morimoto 52c10ad22b sh: clkfwk: fixup clk_rate_table_build parameter in div6 clock
div6 clock should not use arch_flags for clk_rate_table_build,
because SH_CLK_DIV6_EXT doesn't care .arch_flags.
clk->freq_table[] will be all CPUFREQ_ENTRY_INVALID without this patch.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: stable@kernel.org
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-04-18 18:33:31 +09:00
Thomas Gleixner 286b9bfe8e sh: Fix irq cleanup fallout
I missed that coccinelle does not fix up header files by default.

Reported-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: <lethal@linux-sh.org>
2011-03-30 00:15:49 +02:00
Thomas Gleixner fcb8918fd2 sh: Convert to new function names
Scripted with coccinelle.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2011-03-29 14:48:13 +02:00
Thomas Gleixner a821b2793e sh: Use the proper accessor functions
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2011-03-29 14:48:13 +02:00
Rafael J. Wysocki a696b89c58 sh: Use struct syscore_ops instead of sysdevs
Convert the SuperH clocks framework and shared interrupt handling
code to using struct syscore_ops instead of a sysdev classes and
sysdevs for power managment.

This reduces the code size significantly and simplifies it.  The
optimizations causing things not to be restored after creating a
hibernation image are removed, but they might lead to undesirable
effects during resume from hibernation (e.g. the clocks would be left
as the boot kernel set them, which might be not the same way as the
hibernated kernel had seen them before the hibernation).

This also is necessary for removing sysdevs from the kernel entirely
in the future.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-03-23 18:57:37 +09:00
Magnus Damm 8a5a778665 sh: update INTC to clear IRQ sense valid flag
Clear the valid flag is in the INTC code.
Without this fix bit 7 of the sense register
is mistakenly set.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-01-19 19:02:35 +09:00
Alexey Dobriyan 57cc7215b7 headers: kobject.h redux
Remove kobject.h from files which don't need it, notably,
sched.h and fs.h.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-01-10 08:51:44 -08:00
Paul Mundt 30f2ba3801 sh: intc: Initialize radix tree gfp mask explicitly.
Presently the root node is initialized by way of kzalloc on the parent
data structure, which by chance happens to do the bulk of what an
explicit initialization does with GFP_NOWAIT semantics. This however is
more by luck than by design, and as we ideally want to permit radix node
allocations access to the emergency pools anyways, add in the proper
initializer with the desired mask.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-12-24 19:38:37 +09:00
Paul Mundt dfcd6e4389 Merge branch 'common/clkfwk' into sh-fixes-for-linus 2010-11-19 16:43:23 +09:00
Paul Mundt f278ea849e sh: clkfwk: Build fix for non-legacy CPG changes.
The disabling of the init op for non-legacy clocks neglected to do the
same in the core clock framework, resulting in a build failure. Fix it
up.

Reported-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-11-19 16:40:35 +09:00
Paul Mundt 849653372d Merge branch 'common/clkfwk' into sh-fixes-for-linus 2010-11-16 10:11:20 +09:00
Paul Mundt 35a96c739f sh: clkfwk: Kill off now unused algo_id in set_rate op.
Now that clk_set_rate_ex() is gone, there is also no way to get at rate
setting algo id, which is now also completely unused. Kill it off before
new clock ops start using it.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-11-15 18:25:17 +09:00
Paul Mundt 9a1683d1dd sh: clkfwk: Kill off unused clk_set_rate_ex().
With the refactoring of the SH7722 clock framework some time ago this
abstraction has become unecessary. Kill it off before anyone else gets
the bright idea to start using it.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-11-15 18:25:12 +09:00
Paul Mundt 6318af900c sh: intc: Fix up build failure introduced by radix tree changes.
The radix tree retry logic got a bit of an overhaul and subsequently
broke the virtual IRQ subgroup build. Simply switch over to
radix_tree_deref_retry() as per the filemap changes, which the virq
lookup logic was modelled after in the first place.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-11-15 14:30:30 +09:00
Paul Mundt ed10b490ea sh: clkfwk: fix up compiler warnings.
CC      drivers/sh/clk/core.o
drivers/sh/clk/core.c: In function 'clk_round_parent':
drivers/sh/clk/core.c:574: warning: format '%lu' expects type 'long unsigned int', but argument 2 has type 'unsigned int'
drivers/sh/clk/core.c:594: warning: format '%lu' expects type 'long unsigned int', but argument 2 has type 'unsigned int'

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-11-10 18:02:25 +09:00
Paul Mundt 21e1426628 Merge branches 'sh/pio-death', 'sh/nommu', 'sh/clkfwk', 'sh/core' and 'sh/intc-extension' into sh-fixes-for-linus 2010-11-08 09:42:43 +09:00
Paul Mundt a766b29790 sh: clkfwk: Fix up checkpatch warnings.
The clk_round_parent() change introduced various checkpatch warnings,
tidy them up.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-11-08 09:40:23 +09:00
Guennadi Liakhovetski 6af26c6c99 sh: add clk_round_parent() to optimize parent clock rate
Sometimes it is possible and reasonable to adjust the parent clock rate to
improve precision of the child clock, e.g., if the child clock has no siblings.
clk_round_parent() is a new addition to the SH clock-framework API, that
implements such an optimization for child clocks with divisors, taking all
integer values in a range.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-11-08 09:35:26 +09:00
Paul Mundt 20f95e0b22 sh: intc: Update for single IRQ reservation helper.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-11-01 16:10:48 -04:00
Paul Mundt 5aefa34fad sh: clkfwk: Fix up rate rounding error handling.
According to the linux/clk.h definition we should be handing back an
errno value or a valid rate. This fixes up the case where 0 can be
returned for invalid frequencies or cases where rounding has no
selectable candidate.

Reported-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-11-01 15:30:31 -04:00
Paul Mundt 63111a3a70 sh: intc: switch irq_desc iteration to new active IRQ iterator.
There's no need to iterative over every single irq_desc when we can
already work out which IRQs have a backing descriptor via the shiny new
for_each_active_irq(). Switch to that instead.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-10-28 11:36:31 +09:00
Paul Mundt 26599a94dc sh: intc: irq_data conversion.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-10-27 15:42:10 +09:00
Paul Mundt c053784454 sh: maple: ctrl_in/outX to __raw_read/writeX conversion.
The ctrl_xxx routines are deprecated, switch over to the __raw_xxx
versions.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-10-27 14:34:41 +09:00
Paul Mundt 38ab13441c sh: Switch dynamic IRQ creation to generic irq allocator.
Now that the genirq code provides an IRQ bitmap of its own and the
necessary API to manipulate it, there's no need to keep our own version
around anymore.

In the process we kill off some unused IRQ reservation code, with future
users now having to tie in to the genirq API as normal.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-10-26 16:05:08 +09:00
Thomas Gleixner c4318baf00 sh: Sanitize sparse irq
Switch over to the new allocator functions.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-10-26 15:01:52 +09:00
Paul Mundt de9186c257 sh: clkfwk: Shuffle around to match the intc split up.
This shuffles the clock framework code around to a drivers/sh/clk subdir,
to follow the intc split up. This will make it easier to subsequently
break things out as well as plug in different helpers for non-CPG users.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-10-18 21:32:58 +09:00
Kuninori Morimoto c2590f4a8d sh: clkfwk: modify for_each_frequency end condition
The end condition of for_each_frequency should care about
both clk_rate_table_round and clk_rate_div_range_round,
and using "correct max size" is a natural idea in later function.
To avoid data over flow, this patch didn't modify
clk_rate_div_range_round side as .max = div_max + 1.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-10-18 20:33:10 +09:00
Paul Mundt e5690e0dcf sh: clkfwk: Fix fault in frequency iterator.
When updating the iterator macro an old argument assignment was used on
the initial assignment causing a fault on the table rounding. Fix it up.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-10-16 00:51:05 +09:00
Paul Mundt 8e122db61c sh: clkfwk: Add a helper for rate rounding by divisor ranges.
This adds a new clk_rate_div_range_round() for implementing rate rounding
by divisor ranges. This can be used trivially by clocks that support
arbitrary ranged divisors without the need for rate table construction.

This should only be used by clocks that both have large divisor ranges in
addition to clocks that will never be arbitrarily scaled, as the lack of
a backing frequency table will prevent cpufreq from being able to do much
of anything with them.

Primarily intended for use as a ->recalc helper.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-10-15 18:33:24 +09:00
Paul Mundt f586903d27 sh: clkfwk: Abstract rate rounding helper.
Presently the only assisted rate rounding is frequency table backed, but
there are cases where it's impractical to use a frequency table for
certain clocks (such as the FSIDIV case, which supports 65535 divisors),
and we wish to reuse the same rate rounding algorithm.

This breaks out the core of the rate rounding logic in to its own helper
routine and shuffles the frequency table logic around, switching to using
an iterator for the generic helper routine.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-10-15 18:17:35 +09:00
Paul Mundt 28085bc5de sh: clkfwk: support clock remapping.
This implements support for ioremapping of register windows that
encapsulate clock control registers used by a struct clk, with
transparent sibling inheritance.

Root clocks at the top of a given topology often encapsulate the entire
register space of all of their sibling clocks, so this mapping can be
done once and handed down. A given clock enable/disable case maps out to
a single bit in a shared register, so this prevents creating multiple
overlapping mappings.

The mapping case breaks down in to a couple of different situations:

	- Sibling clocks without a specific mapping.
	- Root clocks without a specific mapping.
	- Any of sibling/root clocks with a specific mapping.

Sibling clocks with no specified mapping will grovel up the clock chain
and install the root clock mapping unconditionally at registration time.

Root clocks without their own mappings have a dummy BSS-initialized
mapping inserted that is handed down the chain just like any other
mapping. This permits all of the sibling clock ops to read/write using
the mapping offsets without any special configuration, enabling them to
not care whether access ultimately goes through translatable or
untranslatable memory.

Any clock with its own mapping will have the window initialized at
registration time and be ready for use by its clock ops. Failure to
establish the mapping will prevent registration, so no additional sanity
checks are needed. Sibling clocks that double as parents for the moment
will not propagate their mapping down, but this is easily tunable if the
need arises.

All clock mappings are kref refcounted, with each instance of mapping
inheritance incrementing the refcount.

Tested-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-10-15 16:46:37 +09:00
Paul Mundt 550a1ef18a sh: use pr_fmt for clock framework, too.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-10-13 19:24:55 +09:00
Magnus Damm 69395396a0 sh: remove name and id from struct clk
Remove "name" and "id" from drivers/sh/ struct clk.

The struct clk members "name" and "id" are not used
now when matching is done through clkdev.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-10-13 19:23:05 +09:00
Paul Mundt 6966fed9d8 sh: intc: Fix build with IRQ balancing disabled.
The balancing stubs obviously need to be static inline..

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-10-06 16:44:10 +09:00
Paul Mundt 33fc1a211c sh: intc: Add missing files.
The Kconfig and Makefile were overlooked, add those in now to improve
odds of building.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-10-06 15:38:16 +09:00
Paul Mundt 2be6bb0c79 sh: intc: Split up the INTC code.
This splits up the sh intc core in to something more vaguely resembling
a subsystem. Most of the functionality was alread fairly well
compartmentalized, and there were only a handful of interdependencies
that needed to be resolved in the process.

This also serves as future-proofing for the genirq and sparseirq rework,
which will make some of the split out functionality wholly generic,
allowing things to be killed off in place with minimal migration pain.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-10-05 22:10:30 +09:00
Paul Mundt d74310d3b1 sh: intc: Handle early lookups of subgroup IRQs.
If lookups happen while the radix node still points to a subgroup
mapping, an IRQ hasn't yet been made available for the specified id, so
error out accordingly. Once the slot is replaced with an IRQ mapping and
the tag is discarded, lookup can commence as normal.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-10-05 18:13:23 +09:00
Paul Mundt c1e30ad98f sh: intc: Support virtual mappings for IRQ subgroups.
Many interrupts that share a single mask source but are on different
hardware vectors will have an associated register tied to an INTEVT that
denotes the precise cause for the interrupt exception being triggered.

This introduces the concept of IRQ subgroups in the intc core, where
a virtual IRQ map is constructed for each of the pre-defined cause bits,
and a higher level chained handler takes control of the parent INTEVT.
This enables CPUs with heavily muxed IRQ vectors (especially across
disjoint blocks) to break things out in to a series of managed chained
handlers while being able to dynamically lookup and adopt the IRQs
created for them.

This is largely an opt-in interface, requiring CPUs to manually submit
IRQs for subgroup splitting, in addition to providing identifiers in
their enum maps that can be used for lazy lookup via the radix tree.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-10-05 04:47:03 +09:00
Paul Mundt 44629f57ac sh: intc: Implement reverse mapping for IRQs to per-controller IDs.
This implements a scheme roughly analogous to the PowerPC virtual to
hardware IRQ mapping, which we use for IRQ to per-controller ID mapping.
This makes it possible for drivers to use the IDs directly for lookup
instead of hardcoding the vector.

The main motivation for this work is as a building block for dynamically
allocating virtual IRQs for demuxing INTC events sharing a single INTEVT
in addition to a common masking source.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-10-05 01:15:47 +09:00
Paul Mundt e8184a47c9 sh: pfc: Fix up BUG() triggered by gpiolib debugfs lookups.
The gpiolib debugfs entry takes a hammer approach and iterates over all
of the potential GPIOs, regardless of their type. The SH PFC code on the
other hand contains a variable mismash of input/output/function types
spread out sparsely, leading to situations where the debug code can
trigger an out of range enum for the type. Since we already have an error
path for out of range enums, we can just hand that up to the higher level
instead of the current BUG() behaviour.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-10-04 05:15:20 +09:00
Paul Mundt b72421d8aa sh: pfc: support pinmux deregistration.
Presently the pinmux code is a one-way thing, but there's nothing
preventing an unregistration if no one has grabbed any of the pins.
This will permit us to save a bit of memory on systems that require pin
demux for certain peripherals in the case where registration of those
peripherals fails, or they are otherwise not attached to the system.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-10-04 03:54:56 +09:00