linux/arch/arm/mach-imx
Shawn Guo 63288b721a ARM: imx: fix shared gate clock
Let's say clock A and B are two gate clocks that share the same register
bit in hardware.  Therefore they are registered as shared gate clocks
with imx_clk_gate2_shared().

In a scenario that only clock A is enabled by clk_enable(A) while B is
not used, the shared gate will be unexpectedly disabled in hardware.
It happens because clk_enable(A) increments the share_count from 0 to 1,
while clock B is unused to clock core, and therefore the core function
will just disable B by calling clk->ops->disable() directly.  The
consequence of that call is share_count is decremented to 0 and the gate
is disabled in hardware, even though clock A is still in use.

The patch fixes the issue by initializing the share_count per hardware
state and returns enable state per share_count from .is_enabled() hook,
in case it's a shared gate.

While at it, add a check in clk_gate2_disable() to ensure it's never
called with a zero share_count.

Reported-by: Fabio Estevam <fabio.estevam@freescale.com>
Fixes: f9f28cdf21 ("ARM: imx: add shared gate clock support")
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
Tested-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Olof Johansson <olof@lixom.net>
2014-07-07 21:21:11 -07:00
..
devices ARM: SoC updates for 3.16 (part 1) 2014-06-02 16:15:12 -07:00
3ds_debugboard.c ARM: imx: include hardware.h rather than mach/hardware.h 2012-10-15 10:05:43 +08:00
3ds_debugboard.h ARM: imx: include board headers in the same folder 2012-10-15 09:18:14 +08:00
anatop.c ARM: imx: use imx_init_revision_from_anatop() on imx6sl 2013-10-21 09:13:13 +08:00
avic.c ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
board-mx31lilly.h ARM: imx: include board headers in the same folder 2012-10-15 09:18:14 +08:00
board-mx31lite.h ARM: imx: include board headers in the same folder 2012-10-15 09:18:14 +08:00
board-mx31moboard.h ARM: imx: include board headers in the same folder 2012-10-15 09:18:14 +08:00
board-pcm038.h ARM: imx: include board headers in the same folder 2012-10-15 09:18:14 +08:00
clk-busy.c ARM: arm-soc non-critical fixes for 3.10 2013-05-02 08:56:55 -07:00
clk-fixup-div.c ARM: imx: add common clock support for fixup div 2013-08-16 13:11:24 +08:00
clk-fixup-mux.c ARM: imx: initialize clk_init_data.flags for clk-fixup-mux 2013-09-17 10:04:23 +08:00
clk-gate2.c ARM: imx: fix shared gate clock 2014-07-07 21:21:11 -07:00
clk-imx1.c ARM: i.MX1 clk: Remove clk_register_clkdev() for unused clocks 2014-05-16 15:39:07 +08:00
clk-imx6q.c ARM: imx6q: add the missing esai_ahb clock 2014-05-12 22:58:49 +08:00
clk-imx6sl.c ARM: imx6sl: add missing enet clock for imx6sl 2014-06-17 21:11:18 +08:00
clk-imx6sx.c ARM: imx: add clock driver for imx6sx 2014-05-16 15:35:19 +08:00
clk-imx21.c ARM i.MX: remove PWM platform support 2014-03-05 10:35:09 +08:00
clk-imx25.c ARM: mx25: Add CLKO support 2014-05-16 22:51:34 +08:00
clk-imx27.c ARM: i.MX27 clk: Remove clk_register_clkdev() for unused clocks 2014-05-12 22:58:50 +08:00
clk-imx31.c ARM: i.MX: Remove #ifdef CONFIG_OF 2014-05-12 22:58:47 +08:00
clk-imx35.c ARM: imx: fix function type for CLK_OF_DECLARE 2014-05-20 14:25:21 -05:00
clk-imx51-imx53.c ARM: imx: factor device tree timer initialization 2014-04-30 13:40:28 +08:00
clk-pfd.c ARM: imx: add necessary interface for pfd 2013-12-31 09:36:45 +08:00
clk-pllv1.c ARM: imx: pllv1: Fix PLL calculation for i.MX27 2013-12-31 09:36:29 +08:00
clk-pllv2.c ARM: mach-imx: clk-pllv2: Staticize clk_pllv2_ops 2013-04-01 16:17:50 +08:00
clk-pllv3.c ARM: imx: set up pllv3 POWER and BYPASS sequentially 2013-11-11 22:58:45 +08:00
clk-vf610.c ARM: imx: clk-vf610: Suppress duplicate const sparse warning 2014-03-05 10:35:08 +08:00
clk.c ARM: imx6: change some clocks to fixup clocks 2013-08-16 13:11:25 +08:00
clk.h ARM: imx: add shared gate clock support 2014-05-12 22:58:48 +08:00
common.h ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
cpu-imx5.c ARM: mach-imx: cpu-imx5: Include "common.h" 2013-04-01 16:17:49 +08:00
cpu-imx25.c ARM: imx: include hardware.h rather than mach/hardware.h 2012-10-15 10:05:43 +08:00
cpu-imx27.c ARM: imx: include hardware.h rather than mach/hardware.h 2012-10-15 10:05:43 +08:00
cpu-imx31.c ARM: imx: include hardware.h rather than mach/hardware.h 2012-10-15 10:05:43 +08:00
cpu-imx35.c ARM: imx: include hardware.h rather than mach/hardware.h 2012-10-15 10:05:43 +08:00
cpu.c ARM: imx: add basic imx6sx SoC support 2014-05-16 15:35:25 +08:00
cpuidle-imx5.c ARM: imx: cpuidle: use init/exit common routine 2013-04-23 13:45:23 +02:00
cpuidle-imx6q.c ARM: imx: Use INT_MEM_CLK_LPM as the bit name 2014-03-05 10:34:59 +08:00
cpuidle-imx6sl.c ARM: imx: add cpuidle support for i.mx6sl 2014-03-05 10:35:01 +08:00
cpuidle.h ARM: imx: add cpuidle support for i.mx6sl 2014-03-05 10:35:01 +08:00
crm-regs-imx5.h
crmregs-imx3.h
devices-imx1.h ARM: imx: move platform device code into mach-imx 2012-10-15 09:18:15 +08:00
devices-imx21.h ARM: imx: move platform device code into mach-imx 2012-10-15 09:18:15 +08:00
devices-imx25.h ARM i.MX: remove PWM platform support 2014-03-05 10:35:09 +08:00
devices-imx27.h ARM : i.MX27 : split code for allocation of ressources of camera and eMMA 2012-11-16 16:21:48 +01:00
devices-imx31.h ARM: imx: move platform device code into mach-imx 2012-10-15 09:18:15 +08:00
devices-imx35.h ARM: imx: prepare for removal of flexcan_platform_data 2013-06-27 15:15:08 +02:00
devices-imx51.h ARM i.MX: remove PWM platform support 2014-03-05 10:35:09 +08:00
ehci-imx5.c ARM: imx: include hardware.h rather than mach/hardware.h 2012-10-15 10:05:43 +08:00
ehci-imx25.c Merge branch 'next/cam-samsung' of git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung into next/soc 2012-11-30 09:27:57 -08:00
ehci-imx27.c ARM: imx: include hardware.h rather than mach/hardware.h 2012-10-15 10:05:43 +08:00
ehci-imx31.c ARM: imx: include hardware.h rather than mach/hardware.h 2012-10-15 10:05:43 +08:00
ehci-imx35.c Merge branch 'next/cam-samsung' of git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung into next/soc 2012-11-30 09:27:57 -08:00
epit.c ARM: imx: remove IRQF_DISABLED 2013-10-21 09:11:05 +08:00
eukrea_mbimx27-baseboard.c ARM: cpuimx27 and mbimx27: prepend CONFIG_ to Kconfig macro 2013-04-03 16:50:54 +08:00
eukrea_mbimxsd25-baseboard.c ARM: imx: prepare for removal of flexcan_platform_data 2013-06-27 15:15:08 +02:00
eukrea_mbimxsd35-baseboard.c ARM: imx: prepare for removal of flexcan_platform_data 2013-06-27 15:15:08 +02:00
eukrea-baseboards.h ARM: imx: include board headers in the same folder 2012-10-15 09:18:14 +08:00
gpc.c ARM: imx: ensure dsm_request signal is not asserted when setting LPM 2013-10-21 09:39:26 +08:00
hardware.h ARM: imx: add suspend in ocram support for i.mx6q 2014-03-05 10:35:10 +08:00
headsmp.S ARM: imx6: drop .text.head section annotation from headsmp.S 2014-03-05 10:48:26 +08:00
hotplug.c ARM: imx: do not return from imx_cpu_die() call 2013-10-21 09:37:31 +08:00
iim.h ARM: imx: include iim.h rather than mach/iim.h 2012-10-15 10:03:10 +08:00
imx25-dt.c ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
imx27-dt.c ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
imx31-dt.c ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
imx35-dt.c ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
imx51-dt.c ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
iomux-imx31.c ARM: mach-imx: iomux-imx31: Staticize mxc_pin_alloc_map 2013-04-01 16:17:48 +08:00
iomux-mx1.h ARM: imx: move iomux drivers and headers into mach-imx 2012-10-15 09:18:14 +08:00
iomux-mx2x.h ARM: imx: move iomux drivers and headers into mach-imx 2012-10-15 09:18:14 +08:00
iomux-mx3.h ARM: imx: move iomux drivers and headers into mach-imx 2012-10-15 09:18:14 +08:00
iomux-mx21.h ARM: imx: move iomux drivers and headers into mach-imx 2012-10-15 09:18:14 +08:00
iomux-mx25.h ARM: imx: move iomux drivers and headers into mach-imx 2012-10-15 09:18:14 +08:00
iomux-mx27.h ARM: imx: move iomux drivers and headers into mach-imx 2012-10-15 09:18:14 +08:00
iomux-mx35.h ARM: imx: move iomux drivers and headers into mach-imx 2012-10-15 09:18:14 +08:00
iomux-mx51.h ARM: imx: move iomux drivers and headers into mach-imx 2012-10-15 09:18:14 +08:00
iomux-v1.c ARM: imx: include hardware.h rather than mach/hardware.h 2012-10-15 10:05:43 +08:00
iomux-v1.h ARM: imx: move iomux drivers and headers into mach-imx 2012-10-15 09:18:14 +08:00
iomux-v3.c ARM: imx: include hardware.h rather than mach/hardware.h 2012-10-15 10:05:43 +08:00
iomux-v3.h ARM: imx: move iomux drivers and headers into mach-imx 2012-10-15 09:18:14 +08:00
irq-common.c ARM: imx: irq-common: Include header to avoid sparse warning 2013-06-17 15:45:14 +08:00
irq-common.h ARM: imx: drop support for irq priorisation 2013-12-09 13:18:25 +08:00
Kconfig Merge branch 'fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-arm 2014-06-24 13:59:00 -07:00
mach-apf9328.c ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
mach-armadillo5x0.c ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
mach-bug.c ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
mach-cpuimx27.c ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
mach-cpuimx35.c ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
mach-eukrea_cpuimx25.c ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
mach-imx6q.c ARM i.MX6q: Mark VPU and IPU AXI transfers as cacheable, increase IPU priority 2014-03-05 10:40:48 +08:00
mach-imx6sl.c ARM: imx: add suspend in ocram support for i.mx6q 2014-03-05 10:35:10 +08:00
mach-imx6sx.c ARM: imx: add basic imx6sx SoC support 2014-05-16 15:35:25 +08:00
mach-imx27_visstrim_m10.c ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
mach-imx27ipcam.c ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
mach-imx27lite.c ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
mach-imx50.c ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
mach-imx53.c ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
mach-kzm_arm11_01.c ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
mach-mx1ads.c ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
mach-mx21ads.c ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
mach-mx25_3ds.c ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
mach-mx27_3ds.c ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
mach-mx27ads.c ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
mach-mx31_3ds.c ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
mach-mx31ads.c ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
mach-mx31lilly.c ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
mach-mx31lite.c ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
mach-mx31moboard.c ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
mach-mx35_3ds.c ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
mach-mxt_td60.c ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
mach-pca100.c ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
mach-pcm037_eet.c ARM: imx: include common.h rather than mach/common.h 2012-10-15 10:03:10 +08:00
mach-pcm037.c ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
mach-pcm038.c ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
mach-pcm043.c ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
mach-qong.c ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
mach-scb9328.c ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
mach-vf610.c ARM: l2c: imx vf610: convert to generic l2c OF initialisation 2014-05-30 00:49:28 +01:00
mach-vpr200.c ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
Makefile ARM: imx: add basic imx6sx SoC support 2014-05-16 15:35:25 +08:00
mm-imx1.c ARM: imx: move clk_prepare() out from mxc_restart() 2013-06-17 15:45:10 +08:00
mm-imx3.c Merge branch 'for-linus' of git://git.linaro.org/people/rmk/linux-arm 2013-07-03 09:46:29 -07:00
mm-imx5.c ARM: imx: remove mxc_iomux_v3_init() call from imx53_init_early() 2013-12-09 13:18:24 +08:00
mm-imx21.c ARM: imx: move clk_prepare() out from mxc_restart() 2013-06-17 15:45:10 +08:00
mm-imx25.c ARM: i.MX: remove sdma script address arrays from platform data 2013-08-26 20:47:16 +05:30
mm-imx27.c ARM: imx: move clk_prepare() out from mxc_restart() 2013-06-17 15:45:10 +08:00
mmdc.c ARM: drivers: remove __dev* attributes. 2013-01-03 15:57:04 -08:00
mx1-camera-fiq-ksym.c ARM: imx: move platform_data definitions 2012-09-14 11:17:21 +02:00
mx1-camera-fiq.S
mx1.h ARM: imx: include hardware.h rather than mach/hardware.h 2012-10-15 10:05:43 +08:00
mx2x.h ARM: imx: include hardware.h rather than mach/hardware.h 2012-10-15 10:05:43 +08:00
mx3x.h ARM: imx: include hardware.h rather than mach/hardware.h 2012-10-15 10:05:43 +08:00
mx21.h ARM: imx: include hardware.h rather than mach/hardware.h 2012-10-15 10:05:43 +08:00
mx25.h ARM: imx: include hardware.h rather than mach/hardware.h 2012-10-15 10:05:43 +08:00
mx27.h ARM: i.MX27: Typo fix 2013-07-15 08:28:07 +08:00
mx31.h ARM: imx: include hardware.h rather than mach/hardware.h 2012-10-15 10:05:43 +08:00
mx31lilly-db.c ARM: imx: remove IRQF_DISABLED 2013-10-21 09:11:05 +08:00
mx31lite-db.c ARM: imx: include hardware.h rather than mach/hardware.h 2012-10-15 10:05:43 +08:00
mx31moboard-devboard.c ARM: imx: include hardware.h rather than mach/hardware.h 2012-10-15 10:05:43 +08:00
mx31moboard-marxbot.c ARM: imx: include hardware.h rather than mach/hardware.h 2012-10-15 10:05:43 +08:00
mx31moboard-smartbot.c ARM: imx: include hardware.h rather than mach/hardware.h 2012-10-15 10:05:43 +08:00
mx35.h ARM: imx: include hardware.h rather than mach/hardware.h 2012-10-15 10:05:43 +08:00
mx51.h ARM: imx: include hardware.h rather than mach/hardware.h 2012-10-15 10:05:43 +08:00
mx53.h ARM: imx: include hardware.h rather than mach/hardware.h 2012-10-15 10:05:43 +08:00
mxc.h ARM: imx: add basic imx6sx SoC support 2014-05-16 15:35:25 +08:00
pcm037.h
pcm970-baseboard.c ARM: imx: include hardware.h rather than mach/hardware.h 2012-10-15 10:05:43 +08:00
platsmp.c ARM: clean up cache handling in platform code 2013-12-11 16:24:34 -08:00
pm-imx3.c ARM: imx: include hardware.h rather than mach/hardware.h 2012-10-15 10:05:43 +08:00
pm-imx5.c ARM: mx53: Allow suspend/resume 2013-08-22 23:20:45 +08:00
pm-imx6.c ARM: SoC specific changes 2014-04-05 14:19:54 -07:00
pm-imx27.c ARM: imx: include hardware.h rather than mach/hardware.h 2012-10-15 10:05:43 +08:00
src.c ARM: imx: remove imx_src_prepare_restart() call 2013-11-11 22:58:43 +08:00
ssi-fiq-ksym.c ARM: imx: merge plat-mxc into mach-imx 2012-10-15 10:02:19 +08:00
ssi-fiq.S ARM: imx: merge plat-mxc into mach-imx 2012-10-15 10:02:19 +08:00
suspend-imx6.S ARM: l2c: imx: convert to common l2c310 early resume functionality 2014-05-30 00:49:24 +01:00
system.c ARM: l2c: imx: remove direct write to power control register 2014-05-30 00:49:22 +01:00
time.c ARM: imx: factor device tree timer initialization 2014-04-30 13:40:28 +08:00
tzic.c ARM: i.MX: Setup IRQ handler from IRQ driver 2014-05-12 22:58:51 +08:00
ulpi.h ARM: imx: Remove mxc specific ulpi access ops 2013-06-17 15:45:16 +08:00