Re: [PATCH 1/8] ARM: dts: AM4372: Reorder the rtc compatible string

2015-08-06 Thread Afzal Mohammed
Hi,

On Wed, Aug 05, 2015 at 11:14:45AM -0500, Felipe Balbi wrote:

 for them. Sure, it wasn't documented, but that's a problem of commit
 73456012734b80442b33916406cfd13bf1b73acb (ARM: dts: AM4372: add few
 nodes) which, essentially, added that compatible flag without
 documenting it.

It was required to be done that way that time, probably author didn't
want to be loyal to the king than the king himself ;), see,

1. http://lists.infradead.org/pipermail/linux-arm-kernel/2013-August/191206.html
2. http://www.mail-archive.com/linux-omap@vger.kernel.org/msg89473.html

Regards
Afzal
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ARM: dts: AM437x GP EVM support

2013-11-12 Thread Afzal Mohammed
From: Lokesh Vutla lokeshvu...@ti.com

AM437x GP EVM DTS with pinmux information to make I2C on EVM usable.

Signed-off-by: Lokesh Vutla lokeshvu...@ti.com
Signed-off-by: Sourav Poddar sourav.pod...@ti.com
Signed-off-by: Afzal Mohammed af...@ti.com
---
 .../devicetree/bindings/arm/omap/omap.txt  |  3 ++
 arch/arm/boot/dts/Makefile |  1 +
 arch/arm/boot/dts/am437x-gp-evm.dts| 47 ++
 3 files changed, 51 insertions(+)
 create mode 100644 arch/arm/boot/dts/am437x-gp-evm.dts

diff --git a/Documentation/devicetree/bindings/arm/omap/omap.txt 
b/Documentation/devicetree/bindings/arm/omap/omap.txt
index 808c154..be5f365 100644
--- a/Documentation/devicetree/bindings/arm/omap/omap.txt
+++ b/Documentation/devicetree/bindings/arm/omap/omap.txt
@@ -61,5 +61,8 @@ Boards:
 - AM43x EPOS EVM
   compatible = ti,am43x-epos-evm, ti,am4372, ti,am43
 
+- AM437x GP EVM
+  compatible = ti,am437x-gp-evm, ti,am4372, ti,am43
+
 - DRA7 EVM:  Software Developement Board for DRA7XX
   compatible = ti,dra7-evm, ti,dra7
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index d57c1a6..85626e4 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -203,6 +203,7 @@ dtb-$(CONFIG_ARCH_OMAP2PLUS) += omap2420-h4.dtb \
am3517-evm.dtb \
am3517_mt_ventoux.dtb \
am43x-epos-evm.dtb \
+   am437x-gp-evm.dtb \
dra7-evm.dtb
 dtb-$(CONFIG_ARCH_ORION5X) += orion5x-lacie-ethernet-disk-mini-v2.dtb
 dtb-$(CONFIG_ARCH_PRIMA2) += prima2-evb.dtb
diff --git a/arch/arm/boot/dts/am437x-gp-evm.dts 
b/arch/arm/boot/dts/am437x-gp-evm.dts
new file mode 100644
index 000..11d93ba
--- /dev/null
+++ b/arch/arm/boot/dts/am437x-gp-evm.dts
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+/* AM437x GP EVM */
+
+/dts-v1/;
+
+#include am4372.dtsi
+#include dt-bindings/pinctrl/am43xx.h
+
+/ {
+   model = TI AM437x GP EVM;
+   compatible = ti,am437x-gp-evm,ti,am4372,ti,am43;
+};
+
+am43xx_pinmux {
+   i2c0_pins: i2c0_pins {
+   pinctrl-single,pins = 
+   0x188 (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0)  
/* i2c0_sda.i2c0_sda */
+   0x18c (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0)  
/* i2c0_scl.i2c0_scl */
+   ;
+   };
+
+   i2c1_pins: i2c1_pins {
+   pinctrl-single,pins = 
+   0x15c (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE2)  
/* spi0_cs0.i2c1_scl */
+   0x158 (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE2)  
/* spi0_d1.i2c1_sda  */
+   ;
+   };
+};
+
+i2c0 {
+status = okay;
+pinctrl-names = default;
+pinctrl-0 = i2c0_pins;
+};
+
+i2c1 {
+status = okay;
+pinctrl-names = default;
+pinctrl-0 = i2c1_pins;
+};
-- 
1.8.3.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ARM: dts: AM437x GP EVM support

2013-11-12 Thread Afzal Mohammed
Hi Felipe,

On Tuesday 12 November 2013 07:52 PM, Felipe Balbi wrote:
 On Tue, Nov 12, 2013 at 04:54:26PM +0530, Afzal Mohammed wrote:
 From: Lokesh Vutla lokeshvu...@ti.com

 AM437x GP EVM DTS with pinmux information to make I2C on EVM usable.

 Signed-off-by: Lokesh Vutla lokeshvu...@ti.com
 Signed-off-by: Sourav Poddar sourav.pod...@ti.com
 Signed-off-by: Afzal Mohammed af...@ti.com

 could you instead send the much more complete version we already have
 at [1] ? It's pointless to repatch all of that in this file if we *know*
 those are already working.

By taking those changes and testing on mainline, I couldn't get mmc
working and was not confident about ethernet changes, I2C changes were
verified and boot test was done (with DT clock series). I posted only
the changes that I felt confident.

Basic DT file and I2C are dependency for others, it was necessary to
remove dependencies at the earliest.

Regards
Afzal

 [1] 
 http://git.ti.com/cgit/cgit.cgi/ti-linux-kernel/ti-linux-kernel.git/tree/arch/arm/boot/dts/am437x-gp-evm.dts?h=ti-linux-3.12.y


--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] ARM: OMAP2+: wakeupgen: AM43x adaptation

2013-10-22 Thread Afzal Mohammed
Hi Tony,

On Saturday 12 October 2013 03:52 PM, Afzal Mohammed wrote:
 On Wednesday 09 October 2013 12:42 PM, Afzal Mohammed wrote:

 AM43x has 224 interrupts and 7 banks, make it as maximum values. Keep
 default values as earlier, if am43x is detected, update interrupts and
 banks accordingly.

 Also AM43x has only one cpu, ensure that clearing bitmask at wakeupgen
 is done only for the single existing cpu, existing code assumes that
 there are two cpu's.

 If bitmask is cleared in wakeupgen for the nonexistent second cpu,
 an imprecise abort happens as soon as Kernel switches to user space.
 It was rootcaused by Sekhar Nori nsek...@ti.com.

 Signed-off-by: Afzal Mohammed af...@ti.com
 ---

 v2:
 1. make AM43x adaptation such that changes required for new SoC addition is 
 less
 2. avoid usage of am43x local variable, use soc_is_am43xx() instead
 
 Seems you missed this one, please consider this for the coming merge
 window. Without this AM43x would not boot to prompt.

Ping

Regards
Afzal

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v6 00/11] ARM: OMAP2+: AM43x PRCM basic support

2013-10-12 Thread Afzal Mohammed
Hi Paul,

This series adds PRCM support (except clock tree) for AM43x SoC's.
Please consider this for inclusion in the coming merge window.

This series has been tested on real silicon in AM43x EPOS EVM board with
the help of Tero's DT clock series and booted to prompt. This has been
tested on AM335x-EVM too.

These changes are made over your for-v3.13/hwmod tag

Changes compared to v5:
1. Rebased over for-v3.13/hwmod tag
2. rtc hwmod has been removed from AM43x hwmod database as rtc had
   issues on EPOS EVM
3. spinlock hwmod has been removed from AM43x hwmod database since
   sysconfig details has been recently added and as it doesn't have dt
   node, that would cause warning, spinlock has to be added after dt
   node has been added
4. Added Acked-by's from Tony and Rajendra
5. Minor fixing in comments

Patch 02/11 ARM: OMAP2+: hwmod: AM335x/AM43x: move common data may
not reach mailing lists due to bigger size, this series is also present
@git://gitorious.org/x0148406-public/linux-kernel.git tags/am43x-prcm-v6

Compared to v4, change is in fixing the powerdomain data.

Major changes compared to rfc v3:
1. All register offsets properly taken care for AM43x (with rfc v3, a
   couple of issues was detected while testing on pre-silicon)
2. There were two patches for common hwmod data movement (one for
   interconnect and other for ip block data), both were combined to have
   a cleaner series that is bisectable.
3. Cleaner seperation of common data

Major changes compared to v2 (v3 was only an rfc for current approach):
1. omap_hwmod_33xx_43xx_interconnect_data.c has the common interconnect
   ocp's structs shared between AM335x and AM43x
2. omap_hwmod_33xx_43xx_ipblock_data.c has the common hwmod structs
   shared between AM335x and AM43x
3. Instances where clock domain or clock topology has changed in the few
   cases, have separate structures for AM335x and AM43x
4. To handle scenarios where register offsets are different, they are
   dynamically init-ed in omap_hwmod_33xx_43xx_ipblock_data.c
5. Register offsets for hwmod's that are present either in AM335x or
   AM43x are updated statically in omap_hwmod_33xx_data.c or
   omap_hwmod_43xx_data.c as that was cleaner.
6. Remove the change that re-introduces SW_SLEEP for OMAP4, this will
   be taken care separately.


Additional details:
AM43x reuses most of the IP's from AM335x, as that is the case, much of
the AM335x hwmod data is reused. As AM43x PRCM register layout differs
from AM335x and is similar to OMAP4, power domain, clock domain  hwmod
operations are reused from OMAP4. Currently there is no public TRM
available for AM43x.

Regards
Afzal


Afzal Mohammed (7):
  ARM: OMAP2+: hwmod: AM335x/AM43x: move common data
  ARM: OMAP2+: hwmod: AM335x: runtime register update
  ARM: OMAP2+: hwmod: AM335x: remove static register offs
  ARM: OMAP2+: PRCM: AM43x definitions
  ARM: OMAP2+: hwmod: AM43x support
  ARM: OMAP2+: hwmod: AM43x operations
  ARM: OMAP2+: AM43x: PRCM kbuild

Ambresh K (3):
  ARM: OMAP2+: PM: AM43x powerdomain data
  ARM: OMAP2+: CM: AM43x clockdomain data
  ARM: OMAP2+: AM43x PRCM init

Ankur Kishore (1):
  ARM: OMAP2+: CM: cm_inst offset s16-u16

 arch/arm/mach-omap2/Makefile   |9 +-
 arch/arm/mach-omap2/clockdomain.h  |4 +-
 arch/arm/mach-omap2/clockdomains43xx_data.c|  196 ++
 arch/arm/mach-omap2/cm33xx.c   |   16 +-
 arch/arm/mach-omap2/cm33xx.h   |   12 +-
 arch/arm/mach-omap2/cminst44xx.c   |   29 +-
 arch/arm/mach-omap2/cminst44xx.h   |   26 +-
 arch/arm/mach-omap2/io.c   |6 +
 arch/arm/mach-omap2/omap_hwmod.c   |8 +
 arch/arm/mach-omap2/omap_hwmod.h   |1 +
 .../mach-omap2/omap_hwmod_33xx_43xx_common_data.h  |  163 ++
 .../omap_hwmod_33xx_43xx_interconnect_data.c   |  643 +++
 .../mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c | 1469 +++
 arch/arm/mach-omap2/omap_hwmod_33xx_data.c | 1979 +---
 arch/arm/mach-omap2/omap_hwmod_43xx_data.c |  619 ++
 arch/arm/mach-omap2/powerdomain.h  |1 +
 arch/arm/mach-omap2/powerdomains43xx_data.c|  136 ++
 arch/arm/mach-omap2/prcm43xx.h |  141 ++
 18 files changed, 3442 insertions(+), 2016 deletions(-)
 create mode 100644 arch/arm/mach-omap2/clockdomains43xx_data.c
 create mode 100644 arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common_data.h
 create mode 100644 arch/arm/mach-omap2/omap_hwmod_33xx_43xx_interconnect_data.c
 create mode 100644 arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
 create mode 100644 arch/arm/mach-omap2/omap_hwmod_43xx_data.c
 create mode 100644 arch/arm/mach-omap2/powerdomains43xx_data.c
 create mode 100644 arch/arm/mach-omap2/prcm43xx.h

-- 
1.8.3.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org

[PATCH v6 01/11] ARM: OMAP2+: CM: cm_inst offset s16-u16

2013-10-12 Thread Afzal Mohammed
From: Ankur Kishore a-kish...@ti.com

Most of the AM43x CM reg address offsets are with MSB bit '1' (on
16-bit value) leading to arithmetic miscalculations while calculating
CLOCK ENABLE register's address because cm_inst field was a type of
const s16, so make it const u16.

Also modify relevant functions so as to take care of the above.

[af...@ti.com: fixup and cleanup]

Signed-off-by: Ankur Kishore a-kish...@ti.com
Signed-off-by: Afzal Mohammed af...@ti.com
Acked-by: Rajendra Nayak rna...@ti.com
Acked-by: Tony Lindgren t...@atomide.com
---
 arch/arm/mach-omap2/clockdomain.h |  2 +-
 arch/arm/mach-omap2/cm33xx.c  | 16 
 arch/arm/mach-omap2/cm33xx.h  | 10 +-
 arch/arm/mach-omap2/cminst44xx.c  | 20 ++--
 arch/arm/mach-omap2/cminst44xx.h  | 26 +-
 5 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/arch/arm/mach-omap2/clockdomain.h 
b/arch/arm/mach-omap2/clockdomain.h
index 4b03394..5431b0c 100644
--- a/arch/arm/mach-omap2/clockdomain.h
+++ b/arch/arm/mach-omap2/clockdomain.h
@@ -132,7 +132,7 @@ struct clockdomain {
u8 _flags;
const u8 dep_bit;
const u8 prcm_partition;
-   const s16 cm_inst;
+   const u16 cm_inst;
const u16 clkdm_offs;
struct clkdm_dep *wkdep_srcs;
struct clkdm_dep *sleepdep_srcs;
diff --git a/arch/arm/mach-omap2/cm33xx.c b/arch/arm/mach-omap2/cm33xx.c
index 325a515..40a22e5 100644
--- a/arch/arm/mach-omap2/cm33xx.c
+++ b/arch/arm/mach-omap2/cm33xx.c
@@ -48,13 +48,13 @@
 /* Private functions */
 
 /* Read a register in a CM instance */
-static inline u32 am33xx_cm_read_reg(s16 inst, u16 idx)
+static inline u32 am33xx_cm_read_reg(u16 inst, u16 idx)
 {
return __raw_readl(cm_base + inst + idx);
 }
 
 /* Write into a register in a CM */
-static inline void am33xx_cm_write_reg(u32 val, s16 inst, u16 idx)
+static inline void am33xx_cm_write_reg(u32 val, u16 inst, u16 idx)
 {
__raw_writel(val, cm_base + inst + idx);
 }
@@ -138,7 +138,7 @@ static bool _is_module_ready(u16 inst, s16 cdoffs, u16 
clkctrl_offs)
  * @c must be the unshifted value for CLKTRCTRL - i.e., this function
  * will handle the shift itself.
  */
-static void _clktrctrl_write(u8 c, s16 inst, u16 cdoffs)
+static void _clktrctrl_write(u8 c, u16 inst, u16 cdoffs)
 {
u32 v;
 
@@ -158,7 +158,7 @@ static void _clktrctrl_write(u8 c, s16 inst, u16 cdoffs)
  * Returns true if the clockdomain referred to by (@inst, @cdoffs)
  * is in hardware-supervised idle mode, or 0 otherwise.
  */
-bool am33xx_cm_is_clkdm_in_hwsup(s16 inst, u16 cdoffs)
+bool am33xx_cm_is_clkdm_in_hwsup(u16 inst, u16 cdoffs)
 {
u32 v;
 
@@ -177,7 +177,7 @@ bool am33xx_cm_is_clkdm_in_hwsup(s16 inst, u16 cdoffs)
  * Put a clockdomain referred to by (@inst, @cdoffs) into
  * hardware-supervised idle mode.  No return value.
  */
-void am33xx_cm_clkdm_enable_hwsup(s16 inst, u16 cdoffs)
+void am33xx_cm_clkdm_enable_hwsup(u16 inst, u16 cdoffs)
 {
_clktrctrl_write(OMAP34XX_CLKSTCTRL_ENABLE_AUTO, inst, cdoffs);
 }
@@ -191,7 +191,7 @@ void am33xx_cm_clkdm_enable_hwsup(s16 inst, u16 cdoffs)
  * software-supervised idle mode, i.e., controlled manually by the
  * Linux OMAP clockdomain code.  No return value.
  */
-void am33xx_cm_clkdm_disable_hwsup(s16 inst, u16 cdoffs)
+void am33xx_cm_clkdm_disable_hwsup(u16 inst, u16 cdoffs)
 {
_clktrctrl_write(OMAP34XX_CLKSTCTRL_DISABLE_AUTO, inst, cdoffs);
 }
@@ -204,7 +204,7 @@ void am33xx_cm_clkdm_disable_hwsup(s16 inst, u16 cdoffs)
  * Put a clockdomain referred to by (@inst, @cdoffs) into idle
  * No return value.
  */
-void am33xx_cm_clkdm_force_sleep(s16 inst, u16 cdoffs)
+void am33xx_cm_clkdm_force_sleep(u16 inst, u16 cdoffs)
 {
_clktrctrl_write(OMAP34XX_CLKSTCTRL_FORCE_SLEEP, inst, cdoffs);
 }
@@ -217,7 +217,7 @@ void am33xx_cm_clkdm_force_sleep(s16 inst, u16 cdoffs)
  * Take a clockdomain referred to by (@inst, @cdoffs) out of idle,
  * waking it up.  No return value.
  */
-void am33xx_cm_clkdm_force_wakeup(s16 inst, u16 cdoffs)
+void am33xx_cm_clkdm_force_wakeup(u16 inst, u16 cdoffs)
 {
_clktrctrl_write(OMAP34XX_CLKSTCTRL_FORCE_WAKEUP, inst, cdoffs);
 }
diff --git a/arch/arm/mach-omap2/cm33xx.h b/arch/arm/mach-omap2/cm33xx.h
index 9d1f4fc..757320b 100644
--- a/arch/arm/mach-omap2/cm33xx.h
+++ b/arch/arm/mach-omap2/cm33xx.h
@@ -377,11 +377,11 @@
 
 
 #ifndef __ASSEMBLER__
-extern bool am33xx_cm_is_clkdm_in_hwsup(s16 inst, u16 cdoffs);
-extern void am33xx_cm_clkdm_enable_hwsup(s16 inst, u16 cdoffs);
-extern void am33xx_cm_clkdm_disable_hwsup(s16 inst, u16 cdoffs);
-extern void am33xx_cm_clkdm_force_sleep(s16 inst, u16 cdoffs);
-extern void am33xx_cm_clkdm_force_wakeup(s16 inst, u16 cdoffs);
+bool am33xx_cm_is_clkdm_in_hwsup(u16 inst, u16 cdoffs);
+void am33xx_cm_clkdm_enable_hwsup(u16 inst, u16 cdoffs);
+void am33xx_cm_clkdm_disable_hwsup(u16 inst, u16 cdoffs);
+void am33xx_cm_clkdm_force_sleep(u16 inst, u16 cdoffs);
+void

[PATCH v6 04/11] ARM: OMAP2+: hwmod: AM335x: remove static register offs

2013-10-12 Thread Afzal Mohammed
Hwmod common to AM43x and AM335x has register offsets different. It is
now updated based on SoC detection at run time, hence remove statically
initialized ones.

Signed-off-by: Afzal Mohammed af...@ti.com
Acked-by: Rajendra Nayak rna...@ti.com
Acked-by: Tony Lindgren t...@atomide.com
---
 .../mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c | 57 --
 1 file changed, 57 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c 
b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
index e66d02a..ffb371ff 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
@@ -44,7 +44,6 @@ struct omap_hwmod am33xx_l3_main_hwmod = {
.main_clk   = l3_gclk,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_PER_L3_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -66,7 +65,6 @@ struct omap_hwmod am33xx_l3_instr_hwmod = {
.main_clk   = l3_gclk,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_PER_L3_INSTR_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -89,7 +87,6 @@ struct omap_hwmod am33xx_l4_ls_hwmod = {
.main_clk   = l4ls_gclk,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_PER_L4LS_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -103,7 +100,6 @@ struct omap_hwmod am33xx_l4_wkup_hwmod = {
.flags  = HWMOD_INIT_NO_IDLE,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_WKUP_L4WKUP_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -124,7 +120,6 @@ struct omap_hwmod am33xx_mpu_hwmod = {
.main_clk   = dpll_mpu_m2_ck,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_MPU_MPU_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -159,8 +154,6 @@ struct omap_hwmod am33xx_pruss_hwmod = {
.main_clk   = pruss_ocp_gclk,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_PER_PRUSS_CLKCTRL_OFFSET,
-   .rstctrl_offs   = AM33XX_RM_PER_RSTCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -185,9 +178,6 @@ struct omap_hwmod am33xx_gfx_hwmod = {
.main_clk   = gfx_fck_div_ck,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_GFX_GFX_CLKCTRL_OFFSET,
-   .rstctrl_offs   = AM33XX_RM_GFX_RSTCTRL_OFFSET,
-   .rstst_offs = AM33XX_RM_GFX_RSTST_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -232,7 +222,6 @@ struct omap_hwmod am33xx_aes0_hwmod = {
.main_clk   = aes0_fck,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_PER_AES0_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -258,7 +247,6 @@ struct omap_hwmod am33xx_sha0_hwmod = {
.main_clk   = l3_gclk,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_PER_SHA0_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -277,7 +265,6 @@ struct omap_hwmod am33xx_ocmcram_hwmod = {
.main_clk   = l3_gclk,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_PER_OCMCRAM_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -296,7 +283,6 @@ struct omap_hwmod am33xx_smartreflex0_hwmod = {
.main_clk   = smartreflex0_fck,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = 
AM33XX_CM_WKUP_SMARTREFLEX0_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -310,7 +296,6 @@ struct omap_hwmod am33xx_smartreflex1_hwmod = {
.main_clk   = smartreflex1_fck,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = 
AM33XX_CM_WKUP_SMARTREFLEX1_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -352,7 +337,6 @@ struct omap_hwmod am33xx_cpgmac0_hwmod = {
.mpu_rt_idx = 1,
.prcm   = {
.omap4

[PATCH v6 07/11] ARM: OMAP2+: CM: AM43x clockdomain data

2013-10-12 Thread Afzal Mohammed
From: Ambresh K ambr...@ti.com

Add the data file to describe clock domains in AM43x SoC.
OMAP4 clockdomain operations is being reused here.

Signed-off-by: Ambresh K ambr...@ti.com
Signed-off-by: Afzal Mohammed af...@ti.com
Acked-by: Rajendra Nayak rna...@ti.com
Acked-by: Tony Lindgren t...@atomide.com
---
 arch/arm/mach-omap2/clockdomain.h   |   2 +
 arch/arm/mach-omap2/clockdomains43xx_data.c | 196 
 arch/arm/mach-omap2/cminst44xx.c|   9 ++
 3 files changed, 207 insertions(+)
 create mode 100644 arch/arm/mach-omap2/clockdomains43xx_data.c

diff --git a/arch/arm/mach-omap2/clockdomain.h 
b/arch/arm/mach-omap2/clockdomain.h
index 5431b0c..f17f006 100644
--- a/arch/arm/mach-omap2/clockdomain.h
+++ b/arch/arm/mach-omap2/clockdomain.h
@@ -218,6 +218,7 @@ extern void __init am33xx_clockdomains_init(void);
 extern void __init omap44xx_clockdomains_init(void);
 extern void __init omap54xx_clockdomains_init(void);
 extern void __init dra7xx_clockdomains_init(void);
+void am43xx_clockdomains_init(void);
 
 extern void clkdm_add_autodeps(struct clockdomain *clkdm);
 extern void clkdm_del_autodeps(struct clockdomain *clkdm);
@@ -226,6 +227,7 @@ extern struct clkdm_ops omap2_clkdm_operations;
 extern struct clkdm_ops omap3_clkdm_operations;
 extern struct clkdm_ops omap4_clkdm_operations;
 extern struct clkdm_ops am33xx_clkdm_operations;
+extern struct clkdm_ops am43xx_clkdm_operations;
 
 extern struct clkdm_dep gfx_24xx_wkdeps[];
 extern struct clkdm_dep dsp_24xx_wkdeps[];
diff --git a/arch/arm/mach-omap2/clockdomains43xx_data.c 
b/arch/arm/mach-omap2/clockdomains43xx_data.c
new file mode 100644
index 000..6d71c60
--- /dev/null
+++ b/arch/arm/mach-omap2/clockdomains43xx_data.c
@@ -0,0 +1,196 @@
+/*
+ * AM43xx Clock domains framework
+ *
+ * Copyright (C) 2013 Texas Instruments, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include linux/kernel.h
+#include linux/io.h
+
+#include clockdomain.h
+#include prcm44xx.h
+#include prcm43xx.h
+
+static struct clockdomain l4_cefuse_43xx_clkdm = {
+   .name = l4_cefuse_clkdm,
+   .pwrdm= { .name = cefuse_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_CEFUSE_INST,
+   .clkdm_offs   = AM43XX_CM_CEFUSE_CEFUSE_CDOFFS,
+   .flags= CLKDM_CAN_SWSUP,
+};
+
+static struct clockdomain mpu_43xx_clkdm = {
+   .name = mpu_clkdm,
+   .pwrdm= { .name = mpu_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_MPU_INST,
+   .clkdm_offs   = AM43XX_CM_MPU_MPU_CDOFFS,
+   .flags= CLKDM_CAN_HWSUP_SWSUP,
+};
+
+static struct clockdomain l4ls_43xx_clkdm = {
+   .name = l4ls_clkdm,
+   .pwrdm= { .name = per_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_PER_INST,
+   .clkdm_offs   = AM43XX_CM_PER_L4LS_CDOFFS,
+   .flags= CLKDM_CAN_SWSUP,
+};
+
+static struct clockdomain tamper_43xx_clkdm = {
+   .name = tamper_clkdm,
+   .pwrdm= { .name = tamper_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_TAMPER_INST,
+   .clkdm_offs   = AM43XX_CM_TAMPER_TAMPER_CDOFFS,
+   .flags= CLKDM_CAN_SWSUP,
+};
+
+static struct clockdomain l4_rtc_43xx_clkdm = {
+   .name = l4_rtc_clkdm,
+   .pwrdm= { .name = rtc_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_RTC_INST,
+   .clkdm_offs   = AM43XX_CM_RTC_RTC_CDOFFS,
+   .flags= CLKDM_CAN_SWSUP,
+};
+
+static struct clockdomain pruss_ocp_43xx_clkdm = {
+   .name = pruss_ocp_clkdm,
+   .pwrdm= { .name = per_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_PER_INST,
+   .clkdm_offs   = AM43XX_CM_PER_ICSS_CDOFFS,
+   .flags= CLKDM_CAN_SWSUP,
+};
+
+static struct clockdomain ocpwp_l3_43xx_clkdm = {
+   .name = ocpwp_l3_clkdm,
+   .pwrdm= { .name = per_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_PER_INST,
+   .clkdm_offs   = AM43XX_CM_PER_OCPWP_L3_CDOFFS,
+   .flags= CLKDM_CAN_SWSUP,
+};
+
+static struct clockdomain l3s_tsc_43xx_clkdm = {
+   .name = l3s_tsc_clkdm,
+   .pwrdm= { .name = wkup_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_WKUP_INST,
+   .clkdm_offs   = AM43XX_CM_WKUP_L3S_TSC_CDOFFS,
+   .flags= CLKDM_CAN_SWSUP,
+};
+
+static struct

[PATCH v6 06/11] ARM: OMAP2+: PM: AM43x powerdomain data

2013-10-12 Thread Afzal Mohammed
From: Ambresh K ambr...@ti.com

Add the data file to describe all power domains in AM43x SoC.
OMAP4 powerdomain operations is being reused here.

Signed-off-by: Ambresh K ambr...@ti.com
Signed-off-by: Afzal Mohammed af...@ti.com
Acked-by: Rajendra Nayak rna...@ti.com
Acked-by: Tony Lindgren t...@atomide.com
---
 arch/arm/mach-omap2/powerdomain.h   |   1 +
 arch/arm/mach-omap2/powerdomains43xx_data.c | 136 
 2 files changed, 137 insertions(+)
 create mode 100644 arch/arm/mach-omap2/powerdomains43xx_data.c

diff --git a/arch/arm/mach-omap2/powerdomain.h 
b/arch/arm/mach-omap2/powerdomain.h
index baf3d8b..da5a59a 100644
--- a/arch/arm/mach-omap2/powerdomain.h
+++ b/arch/arm/mach-omap2/powerdomain.h
@@ -257,6 +257,7 @@ extern void am33xx_powerdomains_init(void);
 extern void omap44xx_powerdomains_init(void);
 extern void omap54xx_powerdomains_init(void);
 extern void dra7xx_powerdomains_init(void);
+void am43xx_powerdomains_init(void);
 
 extern struct pwrdm_ops omap2_pwrdm_operations;
 extern struct pwrdm_ops omap3_pwrdm_operations;
diff --git a/arch/arm/mach-omap2/powerdomains43xx_data.c 
b/arch/arm/mach-omap2/powerdomains43xx_data.c
new file mode 100644
index 000..95fee54
--- /dev/null
+++ b/arch/arm/mach-omap2/powerdomains43xx_data.c
@@ -0,0 +1,136 @@
+/*
+ * AM43xx Power domains framework
+ *
+ * Copyright (C) 2013 Texas Instruments, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include linux/kernel.h
+#include linux/init.h
+
+#include powerdomain.h
+
+#include prcm-common.h
+#include prcm44xx.h
+#include prcm43xx.h
+
+static struct powerdomain gfx_43xx_pwrdm = {
+   .name = gfx_pwrdm,
+   .voltdm   = { .name = core },
+   .prcm_offs= AM43XX_PRM_GFX_INST,
+   .prcm_partition   = AM43XX_PRM_PARTITION,
+   .pwrsts   = PWRSTS_OFF_ON,
+   .banks= 1,
+   .pwrsts_mem_on  = {
+   [0] = PWRSTS_ON,/* gfx_mem */
+   },
+   .flags= PWRDM_HAS_LOWPOWERSTATECHANGE,
+};
+
+static struct powerdomain mpu_43xx_pwrdm = {
+   .name = mpu_pwrdm,
+   .voltdm   = { .name = mpu },
+   .prcm_offs= AM43XX_PRM_MPU_INST,
+   .prcm_partition   = AM43XX_PRM_PARTITION,
+   .pwrsts   = PWRSTS_OFF_RET_ON,
+   .pwrsts_logic_ret = PWRSTS_OFF_RET,
+   .banks= 3,
+   .pwrsts_mem_ret = {
+   [0] = PWRSTS_OFF_RET,   /* mpu_l1 */
+   [1] = PWRSTS_OFF_RET,   /* mpu_l2 */
+   [2] = PWRSTS_OFF_RET,   /* mpu_ram */
+   },
+   .pwrsts_mem_on  = {
+   [0] = PWRSTS_ON,/* mpu_l1 */
+   [1] = PWRSTS_ON,/* mpu_l2 */
+   [2] = PWRSTS_ON,/* mpu_ram */
+   },
+   .flags= PWRDM_HAS_LOWPOWERSTATECHANGE,
+};
+
+static struct powerdomain rtc_43xx_pwrdm = {
+   .name = rtc_pwrdm,
+   .voltdm   = { .name = rtc },
+   .prcm_offs= AM43XX_PRM_RTC_INST,
+   .prcm_partition   = AM43XX_PRM_PARTITION,
+   .pwrsts   = PWRSTS_ON,
+};
+
+static struct powerdomain wkup_43xx_pwrdm = {
+   .name = wkup_pwrdm,
+   .voltdm   = { .name = core },
+   .prcm_offs= AM43XX_PRM_WKUP_INST,
+   .prcm_partition   = AM43XX_PRM_PARTITION,
+   .pwrsts   = PWRSTS_ON,
+   .banks= 1,
+   .pwrsts_mem_on  = {
+   [0] = PWRSTS_ON,/* debugss_mem */
+   },
+};
+
+static struct powerdomain tamper_43xx_pwrdm = {
+   .name = tamper_pwrdm,
+   .voltdm   = { .name = tamper },
+   .prcm_offs= AM43XX_PRM_TAMPER_INST,
+   .prcm_partition   = AM43XX_PRM_PARTITION,
+   .pwrsts   = PWRSTS_ON,
+};
+
+static struct powerdomain cefuse_43xx_pwrdm = {
+   .name = cefuse_pwrdm,
+   .voltdm   = { .name = core },
+   .prcm_offs= AM43XX_PRM_CEFUSE_INST,
+   .prcm_partition   = AM43XX_PRM_PARTITION,
+   .pwrsts   = PWRSTS_OFF_ON,
+   .flags= PWRDM_HAS_LOWPOWERSTATECHANGE,
+};
+
+static struct powerdomain per_43xx_pwrdm = {
+   .name = per_pwrdm,
+   .voltdm   = { .name = core },
+   .prcm_offs= AM43XX_PRM_PER_INST,
+   .prcm_partition   = AM43XX_PRM_PARTITION,
+   .pwrsts   = PWRSTS_OFF_RET_ON,
+   .pwrsts_logic_ret = PWRSTS_OFF_RET,
+   .banks= 4,
+   .pwrsts_mem_ret = {
+   [0] = PWRSTS_OFF_RET,   /* icss_mem */
+   [1] = PWRSTS_OFF_RET,   /* per_mem */
+   [2] = PWRSTS_OFF_RET,   /* ram1_mem */
+   [3] = PWRSTS_OFF_RET,   /* ram2_mem */
+   },
+   .pwrsts_mem_on  = {
+   [0

[PATCH v6 03/11] ARM: OMAP2+: hwmod: AM335x: runtime register update

2013-10-12 Thread Afzal Mohammed
Most of IP's in AM335x is present on AM43x and so in those cases both
will use same hwmod database (except for a few cases where clock related
details differ), but there is difference w.r.t register offset between
these. Update register offsets at runtime based on the SoC detected to
help in sharing otherwise same hwmod.

Signed-off-by: Afzal Mohammed af...@ti.com
Acked-by: Rajendra Nayak rna...@ti.com
Acked-by: Tony Lindgren t...@atomide.com
---
 .../mach-omap2/omap_hwmod_33xx_43xx_common_data.h  |  2 +
 .../mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c | 77 ++
 arch/arm/mach-omap2/omap_hwmod_33xx_data.c |  1 +
 3 files changed, 80 insertions(+)

diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common_data.h 
b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common_data.h
index e873e72..a9a7902 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common_data.h
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common_data.h
@@ -157,4 +157,6 @@ extern struct omap_hwmod_class am33xx_spi_hwmod_class;
 extern struct omap_gpio_dev_attr gpio_dev_attr;
 extern struct omap2_mcspi_dev_attr mcspi_attrib;
 
+void omap_hwmod_am33xx_reg(void);
+
 #endif
diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c 
b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
index 669b7bd..e66d02a 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
@@ -24,6 +24,10 @@
 #include prm33xx.h
 #include omap_hwmod_33xx_43xx_common_data.h
 
+#define CLKCTRL(oh, clkctrl) ((oh).prcm.omap4.clkctrl_offs = (clkctrl))
+#define RSTCTRL(oh, rstctrl) ((oh).prcm.omap4.rstctrl_offs = (rstctrl))
+#define RSTST(oh, rstst) ((oh).prcm.omap4.rstst_offs = (rstst))
+
 /*
  * 'l3' class
  * instance(s): l3_main, l3_s, l3_instr
@@ -1373,3 +1377,76 @@ struct omap_hwmod am33xx_wd_timer1_hwmod = {
},
},
 };
+
+static void omap_hwmod_am33xx_clkctrl(void)
+{
+   CLKCTRL(am33xx_uart2_hwmod, AM33XX_CM_PER_UART1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart3_hwmod, AM33XX_CM_PER_UART2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart4_hwmod, AM33XX_CM_PER_UART3_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart5_hwmod, AM33XX_CM_PER_UART4_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart6_hwmod, AM33XX_CM_PER_UART5_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_dcan0_hwmod, AM33XX_CM_PER_DCAN0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_dcan1_hwmod, AM33XX_CM_PER_DCAN1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_elm_hwmod, AM33XX_CM_PER_ELM_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_epwmss0_hwmod, AM33XX_CM_PER_EPWMSS0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_epwmss1_hwmod, AM33XX_CM_PER_EPWMSS1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_epwmss2_hwmod, AM33XX_CM_PER_EPWMSS2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gpio1_hwmod, AM33XX_CM_PER_GPIO1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gpio2_hwmod, AM33XX_CM_PER_GPIO2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gpio3_hwmod, AM33XX_CM_PER_GPIO3_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_i2c2_hwmod, AM33XX_CM_PER_I2C1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_i2c3_hwmod, AM33XX_CM_PER_I2C2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mailbox_hwmod, AM33XX_CM_PER_MAILBOX0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mcasp0_hwmod, AM33XX_CM_PER_MCASP0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mcasp1_hwmod, AM33XX_CM_PER_MCASP1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mmc0_hwmod, AM33XX_CM_PER_MMC0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mmc1_hwmod, AM33XX_CM_PER_MMC1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_spi0_hwmod, AM33XX_CM_PER_SPI0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_spi1_hwmod, AM33XX_CM_PER_SPI1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_spinlock_hwmod, AM33XX_CM_PER_SPINLOCK_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer2_hwmod, AM33XX_CM_PER_TIMER2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer3_hwmod, AM33XX_CM_PER_TIMER3_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer4_hwmod, AM33XX_CM_PER_TIMER4_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer5_hwmod, AM33XX_CM_PER_TIMER5_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer6_hwmod, AM33XX_CM_PER_TIMER6_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer7_hwmod, AM33XX_CM_PER_TIMER7_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_smartreflex0_hwmod,
+   AM33XX_CM_WKUP_SMARTREFLEX0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_smartreflex1_hwmod,
+   AM33XX_CM_WKUP_SMARTREFLEX1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart1_hwmod, AM33XX_CM_WKUP_UART0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer1_hwmod, AM33XX_CM_WKUP_TIMER1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_i2c1_hwmod, AM33XX_CM_WKUP_I2C0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_wd_timer1_hwmod, AM33XX_CM_WKUP_WDT1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_rtc_hwmod, AM33XX_CM_RTC_RTC_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mmc2_hwmod, AM33XX_CM_PER_MMC2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gpmc_hwmod, AM33XX_CM_PER_GPMC_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_l4_ls_hwmod, AM33XX_CM_PER_L4LS_CLKCTRL_OFFSET);
+   CLKCTRL

[PATCH v6 09/11] ARM: OMAP2+: hwmod: AM43x operations

2013-10-12 Thread Afzal Mohammed
Reuse OMAP4 operations on AM43x.

Context related ops are not used on AM43x, as this would not add value
when using DT and AM43x is DT only boot. This additionally helps not to
add context register offset for each hwmod.

Signed-off-by: Ambresh K ambr...@ti.com
Signed-off-by: Afzal Mohammed af...@ti.com
Acked-by: Rajendra Nayak rna...@ti.com
Acked-by: Tony Lindgren t...@atomide.com
---
 arch/arm/mach-omap2/omap_hwmod.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 1c217e8..e3f0eca 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -4144,6 +4144,14 @@ void __init omap_hwmod_init(void)
soc_ops.init_clkdm = _init_clkdm;
soc_ops.update_context_lost = _omap4_update_context_lost;
soc_ops.get_context_lost = _omap4_get_context_lost;
+   } else if (soc_is_am43xx()) {
+   soc_ops.enable_module = _omap4_enable_module;
+   soc_ops.disable_module = _omap4_disable_module;
+   soc_ops.wait_target_ready = _omap4_wait_target_ready;
+   soc_ops.assert_hardreset = _omap4_assert_hardreset;
+   soc_ops.deassert_hardreset = _omap4_deassert_hardreset;
+   soc_ops.is_hardreset_asserted = _omap4_is_hardreset_asserted;
+   soc_ops.init_clkdm = _init_clkdm;
} else if (soc_is_am33xx()) {
soc_ops.enable_module = _am33xx_enable_module;
soc_ops.disable_module = _am33xx_disable_module;
-- 
1.8.3.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v6 05/11] ARM: OMAP2+: PRCM: AM43x definitions

2013-10-12 Thread Afzal Mohammed
Add AM43x CMINST, CDOFFS, RM_RSTST  RM_RSTCTRL definitions - minimal
ones that would be used.

Signed-off-by: Afzal Mohammed af...@ti.com
Acked-by: Rajendra Nayak rna...@ti.com
Acked-by: Tony Lindgren t...@atomide.com
---
 arch/arm/mach-omap2/prcm43xx.h | 141 +
 1 file changed, 141 insertions(+)
 create mode 100644 arch/arm/mach-omap2/prcm43xx.h

diff --git a/arch/arm/mach-omap2/prcm43xx.h b/arch/arm/mach-omap2/prcm43xx.h
new file mode 100644
index 000..f0636ec
--- /dev/null
+++ b/arch/arm/mach-omap2/prcm43xx.h
@@ -0,0 +1,141 @@
+/*
+ * AM43x PRCM defines
+ *
+ * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed as is without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#ifndef __ARCH_ARM_MACH_OMAP2_PRCM_43XX_H
+#define __ARCH_ARM_MACH_OMAP2_PRCM_43XX_H
+
+#define AM43XX_PRM_PARTITION   1
+#define AM43XX_CM_PARTITION1
+
+/* PRM instances */
+#define AM43XX_PRM_OCP_SOCKET_INST 0x
+#define AM43XX_PRM_MPU_INST0x0300
+#define AM43XX_PRM_GFX_INST0x0400
+#define AM43XX_PRM_RTC_INST0x0500
+#define AM43XX_PRM_TAMPER_INST 0x0600
+#define AM43XX_PRM_CEFUSE_INST 0x0700
+#define AM43XX_PRM_PER_INST0x0800
+#define AM43XX_PRM_WKUP_INST   0x2000
+#define AM43XX_PRM_DEVICE_INST 0x4000
+
+/* RM RSTCTRL offsets */
+#define AM43XX_RM_PER_RSTCTRL_OFFSET   0x0010
+#define AM43XX_RM_GFX_RSTCTRL_OFFSET   0x0010
+#define AM43XX_RM_WKUP_RSTCTRL_OFFSET  0x0010
+
+/* RM RSTST offsets */
+#define AM43XX_RM_GFX_RSTST_OFFSET 0x0014
+#define AM43XX_RM_WKUP_RSTST_OFFSET0x0014
+
+/* CM instances */
+#define AM43XX_CM_WKUP_INST0x2800
+#define AM43XX_CM_DEVICE_INST  0x4100
+#define AM43XX_CM_DPLL_INST0x4200
+#define AM43XX_CM_MPU_INST 0x8300
+#define AM43XX_CM_GFX_INST 0x8400
+#define AM43XX_CM_RTC_INST 0x8500
+#define AM43XX_CM_TAMPER_INST  0x8600
+#define AM43XX_CM_CEFUSE_INST  0x8700
+#define AM43XX_CM_PER_INST 0x8800
+
+/* CD offsets */
+#define AM43XX_CM_WKUP_L3_AON_CDOFFS   0x
+#define AM43XX_CM_WKUP_L3S_TSC_CDOFFS  0x0100
+#define AM43XX_CM_WKUP_L4_WKUP_AON_CDOFFS  0x0200
+#define AM43XX_CM_WKUP_WKUP_CDOFFS 0x0300
+#define AM43XX_CM_MPU_MPU_CDOFFS   0x
+#define AM43XX_CM_GFX_GFX_L3_CDOFFS0x
+#define AM43XX_CM_RTC_RTC_CDOFFS   0x
+#define AM43XX_CM_TAMPER_TAMPER_CDOFFS 0x
+#define AM43XX_CM_CEFUSE_CEFUSE_CDOFFS 0x
+#define AM43XX_CM_PER_L3_CDOFFS0x
+#define AM43XX_CM_PER_L3S_CDOFFS   0x0200
+#define AM43XX_CM_PER_ICSS_CDOFFS  0x0300
+#define AM43XX_CM_PER_L4LS_CDOFFS  0x0400
+#define AM43XX_CM_PER_EMIF_CDOFFS  0x0700
+#define AM43XX_CM_PER_DSS_CDOFFS   0x0a00
+#define AM43XX_CM_PER_CPSW_CDOFFS  0x0b00
+#define AM43XX_CM_PER_OCPWP_L3_CDOFFS  0x0c00
+
+/* CLK CTRL offsets */
+#define AM43XX_CM_PER_UART1_CLKCTRL_OFFSET 0x0580
+#define AM43XX_CM_PER_UART2_CLKCTRL_OFFSET 0x0588
+#define AM43XX_CM_PER_UART3_CLKCTRL_OFFSET 0x0590
+#define AM43XX_CM_PER_UART4_CLKCTRL_OFFSET 0x0598
+#define AM43XX_CM_PER_UART5_CLKCTRL_OFFSET 0x05a0
+#define AM43XX_CM_PER_DCAN0_CLKCTRL_OFFSET 0x0428
+#define AM43XX_CM_PER_DCAN1_CLKCTRL_OFFSET 0x0430
+#define AM43XX_CM_PER_ELM_CLKCTRL_OFFSET   0x0468
+#define AM43XX_CM_PER_EPWMSS0_CLKCTRL_OFFSET   0x0438
+#define AM43XX_CM_PER_EPWMSS1_CLKCTRL_OFFSET   0x0440
+#define AM43XX_CM_PER_EPWMSS2_CLKCTRL_OFFSET   0x0448
+#define AM43XX_CM_PER_GPIO1_CLKCTRL_OFFSET 0x0478
+#define AM43XX_CM_PER_GPIO2_CLKCTRL_OFFSET 0x0480
+#define AM43XX_CM_PER_GPIO3_CLKCTRL_OFFSET 0x0488
+#define AM43XX_CM_PER_I2C1_CLKCTRL_OFFSET  0x04a8
+#define AM43XX_CM_PER_I2C2_CLKCTRL_OFFSET  0x04b0
+#define AM43XX_CM_PER_MAILBOX0_CLKCTRL_OFFSET  0x04b8
+#define AM43XX_CM_PER_MMC0_CLKCTRL_OFFSET  0x04c0
+#define AM43XX_CM_PER_MMC1_CLKCTRL_OFFSET  0x04c8
+#define

[PATCH v6 08/11] ARM: OMAP2+: hwmod: AM43x support

2013-10-12 Thread Afzal Mohammed
Add hwmod support for IP's that are present in AM43x, but not in AM335x.
AM43x additional ones added here are,
1. synctimer
2. timer8-11
3. ehrpwm3-5
4. spi2-4
5. gpio4-5

AM43x pruss interconnect which is different as compared to AM335x, has
been taken care.

And register offsets for same hwmod's shared with AM335x is different,
AM43x register offsets are updated appropriately.

ocp clock of those in l4_wkup is fed from sys_clkin_ck instead of
dpll_core_m4_div2_ck, so ocpif for those in AM43x l4_wkup has been
added seperately.

hwmod's has been added for those that have main clock (wkup_m3, control,
gpio0) and clock domain (l4_hs) different from AM335x. debugss and
adc_tsc that have different clocks and clockdomains repectively has not
been added due to the reasons mentioned below.

AM43x also has IP's like qspi, hdq1w, vpfe, des, rng, usb, dss, debugss,
adc_tsc. These are not handled here due to both/either of following
reasons,
1. To avoid churn; most of them don't have DT bindings, which would
   necessitate adding address space in hwmod, which any way would have
   to be removed once DT bindings happen with driver support.
2. patches would come in from sources other than the author

Signed-off-by: Afzal Mohammed af...@ti.com
Acked-by: Rajendra Nayak rna...@ti.com
Acked-by: Tony Lindgren t...@atomide.com
---
 arch/arm/mach-omap2/omap_hwmod.h   |   1 +
 .../mach-omap2/omap_hwmod_33xx_43xx_common_data.h  |   1 +
 .../mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c |  74 +++
 arch/arm/mach-omap2/omap_hwmod_43xx_data.c | 619 +
 4 files changed, 695 insertions(+)
 create mode 100644 arch/arm/mach-omap2/omap_hwmod_43xx_data.c

diff --git a/arch/arm/mach-omap2/omap_hwmod.h b/arch/arm/mach-omap2/omap_hwmod.h
index d02acf9..0f97d63 100644
--- a/arch/arm/mach-omap2/omap_hwmod.h
+++ b/arch/arm/mach-omap2/omap_hwmod.h
@@ -752,6 +752,7 @@ extern int omap44xx_hwmod_init(void);
 extern int omap54xx_hwmod_init(void);
 extern int am33xx_hwmod_init(void);
 extern int dra7xx_hwmod_init(void);
+int am43xx_hwmod_init(void);
 
 extern int __init omap_hwmod_register_links(struct omap_hwmod_ocp_if **ois);
 
diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common_data.h 
b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common_data.h
index a9a7902..130332c 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common_data.h
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common_data.h
@@ -158,5 +158,6 @@ extern struct omap_gpio_dev_attr gpio_dev_attr;
 extern struct omap2_mcspi_dev_attr mcspi_attrib;
 
 void omap_hwmod_am33xx_reg(void);
+void omap_hwmod_am43xx_reg(void);
 
 #endif
diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c 
b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
index ffb371ff..0f17862 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
@@ -23,6 +23,7 @@
 #include cm33xx.h
 #include prm33xx.h
 #include omap_hwmod_33xx_43xx_common_data.h
+#include prcm43xx.h
 
 #define CLKCTRL(oh, clkctrl) ((oh).prcm.omap4.clkctrl_offs = (clkctrl))
 #define RSTCTRL(oh, rstctrl) ((oh).prcm.omap4.rstctrl_offs = (rstctrl))
@@ -1393,3 +1394,76 @@ void omap_hwmod_am33xx_reg(void)
omap_hwmod_am33xx_clkctrl();
omap_hwmod_am33xx_rst();
 }
+
+static void omap_hwmod_am43xx_clkctrl(void)
+{
+   CLKCTRL(am33xx_uart2_hwmod, AM43XX_CM_PER_UART1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart3_hwmod, AM43XX_CM_PER_UART2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart4_hwmod, AM43XX_CM_PER_UART3_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart5_hwmod, AM43XX_CM_PER_UART4_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart6_hwmod, AM43XX_CM_PER_UART5_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_dcan0_hwmod, AM43XX_CM_PER_DCAN0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_dcan1_hwmod, AM43XX_CM_PER_DCAN1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_elm_hwmod, AM43XX_CM_PER_ELM_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_epwmss0_hwmod, AM43XX_CM_PER_EPWMSS0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_epwmss1_hwmod, AM43XX_CM_PER_EPWMSS1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_epwmss2_hwmod, AM43XX_CM_PER_EPWMSS2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gpio1_hwmod, AM43XX_CM_PER_GPIO1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gpio2_hwmod, AM43XX_CM_PER_GPIO2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gpio3_hwmod, AM43XX_CM_PER_GPIO3_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_i2c2_hwmod, AM43XX_CM_PER_I2C1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_i2c3_hwmod, AM43XX_CM_PER_I2C2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mailbox_hwmod, AM43XX_CM_PER_MAILBOX0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mcasp0_hwmod, AM43XX_CM_PER_MCASP0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mcasp1_hwmod, AM43XX_CM_PER_MCASP1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mmc0_hwmod, AM43XX_CM_PER_MMC0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mmc1_hwmod, AM43XX_CM_PER_MMC1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_spi0_hwmod, AM43XX_CM_PER_SPI0_CLKCTRL_OFFSET

[PATCH v6 10/11] ARM: OMAP2+: AM43x: PRCM kbuild

2013-10-12 Thread Afzal Mohammed
Build AM43x power domain, clock domain and hwmod data.

Many of AM43x IP's and interconnects are similar as that in AM335x,
hence AM335x hwmod data is being reused with necessary changes.

Earlier the plan was to reuse AM335x specific PRCM code, but as AM43x
PRCM register layout is much similar to OMAP4/5, AM335x PRCM is
divorced and instead married with OMAP4/5 PRCM for AM43x.

Signed-off-by: Afzal Mohammed af...@ti.com
Acked-by: Rajendra Nayak rna...@ti.com
Acked-by: Tony Lindgren t...@atomide.com
---
 arch/arm/mach-omap2/Makefile | 7 ++-
 arch/arm/mach-omap2/cm33xx.h | 2 +-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 0746494..cb7b527 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -112,13 +112,13 @@ obj-$(CONFIG_ARCH_OMAP2)  += prm2xxx_3xxx.o 
prm2xxx.o cm2xxx.o
 obj-$(CONFIG_ARCH_OMAP3)   += prm2xxx_3xxx.o prm3xxx.o cm3xxx.o
 obj-$(CONFIG_ARCH_OMAP3)   += vc3xxx_data.o vp3xxx_data.o
 obj-$(CONFIG_SOC_AM33XX)   += prm33xx.o cm33xx.o
-obj-$(CONFIG_SOC_AM43XX)   += prm33xx.o cm33xx.o
 omap-prcm-4-5-common   =  cminst44xx.o cm44xx.o prm44xx.o \
   prcm_mpu44xx.o prminst44xx.o \
   vc44xx_data.o vp44xx_data.o
 obj-$(CONFIG_ARCH_OMAP4)   += $(omap-prcm-4-5-common)
 obj-$(CONFIG_SOC_OMAP5)+= $(omap-prcm-4-5-common)
 obj-$(CONFIG_SOC_DRA7XX)   += $(omap-prcm-4-5-common)
+obj-$(CONFIG_SOC_AM43XX)   += $(omap-prcm-4-5-common)
 
 # OMAP voltage domains
 voltagedomain-common   := voltage.o vc.o vp.o
@@ -146,6 +146,7 @@ obj-$(CONFIG_ARCH_OMAP4)+= 
powerdomains44xx_data.o
 obj-$(CONFIG_SOC_AM33XX)   += $(powerdomain-common)
 obj-$(CONFIG_SOC_AM33XX)   += powerdomains33xx_data.o
 obj-$(CONFIG_SOC_AM43XX)   += $(powerdomain-common)
+obj-$(CONFIG_SOC_AM43XX)   += powerdomains43xx_data.o
 obj-$(CONFIG_SOC_OMAP5)+= $(powerdomain-common)
 obj-$(CONFIG_SOC_OMAP5)+= powerdomains54xx_data.o
 obj-$(CONFIG_SOC_DRA7XX)   += $(powerdomain-common)
@@ -165,6 +166,7 @@ obj-$(CONFIG_ARCH_OMAP4)+= 
clockdomains44xx_data.o
 obj-$(CONFIG_SOC_AM33XX)   += $(clockdomain-common)
 obj-$(CONFIG_SOC_AM33XX)   += clockdomains33xx_data.o
 obj-$(CONFIG_SOC_AM43XX)   += $(clockdomain-common)
+obj-$(CONFIG_SOC_AM43XX)   += clockdomains43xx_data.o
 obj-$(CONFIG_SOC_OMAP5)+= $(clockdomain-common)
 obj-$(CONFIG_SOC_OMAP5)+= clockdomains54xx_data.o
 obj-$(CONFIG_SOC_DRA7XX)   += $(clockdomain-common)
@@ -212,6 +214,9 @@ obj-$(CONFIG_ARCH_OMAP3)+= 
omap_hwmod_3xxx_data.o
 obj-$(CONFIG_SOC_AM33XX)   += omap_hwmod_33xx_data.o
 obj-$(CONFIG_SOC_AM33XX)   += 
omap_hwmod_33xx_43xx_interconnect_data.o
 obj-$(CONFIG_SOC_AM33XX)   += omap_hwmod_33xx_43xx_ipblock_data.o
+obj-$(CONFIG_SOC_AM43XX)   += omap_hwmod_43xx_data.o
+obj-$(CONFIG_SOC_AM43XX)   += 
omap_hwmod_33xx_43xx_interconnect_data.o
+obj-$(CONFIG_SOC_AM43XX)   += omap_hwmod_33xx_43xx_ipblock_data.o
 obj-$(CONFIG_ARCH_OMAP4)   += omap_hwmod_44xx_data.o
 obj-$(CONFIG_SOC_OMAP5)+= omap_hwmod_54xx_data.o
 obj-$(CONFIG_SOC_DRA7XX)   += omap_hwmod_7xx_data.o
diff --git a/arch/arm/mach-omap2/cm33xx.h b/arch/arm/mach-omap2/cm33xx.h
index 757320b..cfb8891 100644
--- a/arch/arm/mach-omap2/cm33xx.h
+++ b/arch/arm/mach-omap2/cm33xx.h
@@ -383,7 +383,7 @@ void am33xx_cm_clkdm_disable_hwsup(u16 inst, u16 cdoffs);
 void am33xx_cm_clkdm_force_sleep(u16 inst, u16 cdoffs);
 void am33xx_cm_clkdm_force_wakeup(u16 inst, u16 cdoffs);
 
-#if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)
+#ifdef CONFIG_SOC_AM33XX
 extern int am33xx_cm_wait_module_idle(u16 inst, s16 cdoffs,
u16 clkctrl_offs);
 extern void am33xx_cm_module_enable(u8 mode, u16 inst, s16 cdoffs,
-- 
1.8.3.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v6 11/11] ARM: OMAP2+: AM43x PRCM init

2013-10-12 Thread Afzal Mohammed
From: Ambresh K ambr...@ti.com

Initialise AM43x HWMOD, powerdomains and clockdomains.

Signed-off-by: Ambresh K ambr...@ti.com
Signed-off-by: Afzal Mohammed af...@ti.com
Acked-by: Rajendra Nayak rna...@ti.com
Acked-by: Tony Lindgren t...@atomide.com
---
 arch/arm/mach-omap2/io.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index ff2113c..c90f647 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -594,7 +594,13 @@ void __init am43xx_init_early(void)
  NULL);
omap2_set_globals_prm(AM33XX_L4_WK_IO_ADDRESS(AM43XX_PRCM_BASE));
omap2_set_globals_cm(AM33XX_L4_WK_IO_ADDRESS(AM43XX_PRCM_BASE), NULL);
+   omap_prm_base_init();
+   omap_cm_base_init();
omap3xxx_check_revision();
+   am43xx_powerdomains_init();
+   am43xx_clockdomains_init();
+   am43xx_hwmod_init();
+   omap_hwmod_init_postsetup();
 }
 #endif
 
-- 
1.8.3.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GIT PULL] ARM: OMAP2+: hwmod changes for v3.13

2013-10-12 Thread Afzal Mohammed
Hi Paul,

On Friday 11 October 2013 10:30 PM, Paul Walmsley wrote:

 The following changes since commit d0e639c9e06d44e713170031fe05fb60ebe680af:
 
   Linux 3.12-rc4 (2013-10-06 14:00:20 -0700)
 
 are available in the git repository at:
 
   git://git.kernel.org/pub/scm/linux/kernel/git/pjw/omap-pending.git 
 tags/for-v3.13/hwmod
 
 for you to fetch changes up to ace1e3ec4a2540c783e65884bb7be9cd45a0a295:
 
   ARM: AM33xx: hwmod: Add RNG module data (2013-10-09 09:02:51 -0600)
 
 - 
 Some OMAP hwmod changes for 3.13.  Significant changes here include:
 
 - - support for moving some of the hwmod flags to DT data
 
 - - support for the SSI, hardware spinlock, USB host/TLL, and RNG IP
   blocks for various OMAPs
 
 - - a fix that again decouples hwmod data changes from unrelated DT data
   patchsets
 
 Basic test logs are available at:
 
 http://www.pwsan.com/omap/testlogs/prcm_fixes_v3.13/20131009094936/
 
 The summary reports that the 4460varsomom boots are failing, but this looks
 incorrect - it's probably a bug in the validation scripts here.
 
 - 

Can you please consider AM43x PRCM basic support also for the coming
merge window. I have rebased the AM43x PRCM series over your
for-v3.13/hwmod tag and posted as v6. The series has been Acked-by
Tony and Rajendra. New version has been tested on real silicon in AM43x
EPOS EVM (previous versions were tested on presilicon platform).

Regards
Afzal
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] ARM: OMAP2+: wakeupgen: AM43x adaptation

2013-10-12 Thread Afzal Mohammed
Hi Tony,

On Wednesday 09 October 2013 12:42 PM, Afzal Mohammed wrote:
 AM43x has 224 interrupts and 7 banks, make it as maximum values. Keep
 default values as earlier, if am43x is detected, update interrupts and
 banks accordingly.
 
 Also AM43x has only one cpu, ensure that clearing bitmask at wakeupgen
 is done only for the single existing cpu, existing code assumes that
 there are two cpu's.
 
 If bitmask is cleared in wakeupgen for the nonexistent second cpu,
 an imprecise abort happens as soon as Kernel switches to user space.
 It was rootcaused by Sekhar Nori nsek...@ti.com.
 
 Signed-off-by: Afzal Mohammed af...@ti.com
 ---
 
 v2:
 1. make AM43x adaptation such that changes required for new SoC addition is 
 less
 2. avoid usage of am43x local variable, use soc_is_am43xx() instead

Seems you missed this one, please consider this for the coming merge
window. Without this AM43x would not boot to prompt.

Regards
Afzal

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] ARM: OMAP2+: wakeupgen: AM43x adaptation

2013-10-09 Thread Afzal Mohammed
AM43x has 224 interrupts and 7 banks, make it as maximum values. Keep
default values as earlier, if am43x is detected, update interrupts and
banks accordingly.

Also AM43x has only one cpu, ensure that clearing bitmask at wakeupgen
is done only for the single existing cpu, existing code assumes that
there are two cpu's.

If bitmask is cleared in wakeupgen for the nonexistent second cpu,
an imprecise abort happens as soon as Kernel switches to user space.
It was rootcaused by Sekhar Nori nsek...@ti.com.

Signed-off-by: Afzal Mohammed af...@ti.com
---

v2:
1. make AM43x adaptation such that changes required for new SoC addition is less
2. avoid usage of am43x local variable, use soc_is_am43xx() instead

 arch/arm/mach-omap2/omap-wakeupgen.c | 18 +-
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-omap2/omap-wakeupgen.c 
b/arch/arm/mach-omap2/omap-wakeupgen.c
index 813c615..3664562 100644
--- a/arch/arm/mach-omap2/omap-wakeupgen.c
+++ b/arch/arm/mach-omap2/omap-wakeupgen.c
@@ -33,8 +33,12 @@
 #include omap4-sar-layout.h
 #include common.h
 
-#define MAX_NR_REG_BANKS   5
-#define MAX_IRQS   160
+#define AM43XX_NR_REG_BANKS7
+#define AM43XX_IRQS224
+#define MAX_NR_REG_BANKS   AM43XX_NR_REG_BANKS
+#define MAX_IRQS   AM43XX_IRQS
+#define DEFAULT_NR_REG_BANKS   5
+#define DEFAULT_IRQS   160
 #define WKG_MASK_ALL   0x
 #define WKG_UNMASK_ALL 0x
 #define CPU_ENA_OFFSET 0x400
@@ -47,8 +51,8 @@ static void __iomem *wakeupgen_base;
 static void __iomem *sar_base;
 static DEFINE_RAW_SPINLOCK(wakeupgen_lock);
 static unsigned int irq_target_cpu[MAX_IRQS];
-static unsigned int irq_banks = MAX_NR_REG_BANKS;
-static unsigned int max_irqs = MAX_IRQS;
+static unsigned int irq_banks = DEFAULT_NR_REG_BANKS;
+static unsigned int max_irqs = DEFAULT_IRQS;
 static unsigned int omap_secure_apis;
 
 /*
@@ -418,12 +422,16 @@ int __init omap_wakeupgen_init(void)
irq_banks = OMAP4_NR_BANKS;
max_irqs = OMAP4_NR_IRQS;
omap_secure_apis = 1;
+   } else if (soc_is_am43xx()) {
+   irq_banks = AM43XX_NR_REG_BANKS;
+   max_irqs = AM43XX_IRQS;
}
 
/* Clear all IRQ bitmasks at wakeupGen level */
for (i = 0; i  irq_banks; i++) {
wakeupgen_writel(0, i, CPU0_ID);
-   wakeupgen_writel(0, i, CPU1_ID);
+   if (!soc_is_am43xx())
+   wakeupgen_writel(0, i, CPU1_ID);
}
 
/*
-- 
1.8.3.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ARM: OMAP2+: wakeupgen: AM43x adaptation

2013-10-09 Thread Afzal Mohammed
Hi Tony,

On Wednesday 09 October 2013 02:54 AM, Tony Lindgren wrote:
 * Afzal Mohammed af...@ti.com [130905 04:03]:

 -#define MAX_NR_REG_BANKS5
 -#define MAX_IRQS160
 +/* maximum value correspond to that of AM43x */
 +#define MAX_NR_REG_BANKS7
 +#define MAX_IRQS224
 +#define DEFAULT_NR_REG_BANKS5
 +#define DEFAULT_IRQS160
  #define WKG_MASK_ALL0x
  #define WKG_UNMASK_ALL  0x
  #define CPU_ENA_OFFSET  0x400
 
 How about define it like this to avoid updating things
 in multiple places for new SoCs:
 
 #define AM43X_NR_REG_BANKS7
 #define MAX_NR_REG_BANKS  AM43X_NR_REG_BANKS

Yes that is better

  for (i = 0; i  irq_banks; i++) {
  wakeupgen_writel(0, i, CPU0_ID);
 -wakeupgen_writel(0, i, CPU1_ID);
 +if (!am43x)
 +wakeupgen_writel(0, i, CPU1_ID);
  }
 
 Why not use soc_is_am43xx() directly here?

Ok, it has been changed in the new version.

Regards
Afzal
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v5 00/11] ARM: OMAP2+: AM43x PRCM basic support

2013-10-01 Thread Afzal Mohammed
Hi Paul, Benoit, Tony,

This series adds PRCM support (except clock tree) for AM43x SoC's.
Please consider this for inclusion in the coming merge window.

Patch 02/11 ARM: OMAP2+: hwmod: AM335x/AM43x: move common data may
not reach mailing lists due to bigger size, this series is also present
@git://gitorious.org/x0148406-public/linux-kernel.git tags/am43x-prcm-v5

Compared to v4, only change is in fixing the powerdomain data.

Major changes compared to rfc v3:
1. All register offsets properly taken care for AM43x (with rfc v3, a
   couple of issues was detected while testing on pre-silicon)
2. There were two patches for common hwmod data movement (one for
   interconnect and other for ip block data), both were combined to have
   a cleaner series that is bisectable.
3. Cleaner seperation of common data

Major changes compared to v2 (v3 was only an rfc for current approach):
1. omap_hwmod_33xx_43xx_interconnect_data.c has the common interconnect
   ocp's structs shared between AM335x and AM43x
2. omap_hwmod_33xx_43xx_ipblock_data.c has the common hwmod structs
   shared between AM335x and AM43x
3. Instances where clock domain or clock topology has changed in the few
   cases, have separate structures for AM335x and AM43x
4. To handle scenarios where register offsets are different, they are
   dynamically init-ed in omap_hwmod_33xx_43xx_ipblock_data.c
5. Register offsets for hwmod's that are present either in AM335x or
   AM43x are updated statically in omap_hwmod_33xx_data.c or
   omap_hwmod_43xx_data.c as that was cleaner.
6. Remove the change that re-introduces SW_SLEEP for OMAP4, this will
   be taken care separately.

This series has been boot tested on pre-silicon platform with the help
of Tero's DT clock tree conversion series. This series has been tested
on AM335x-EVM too.

Additional details:
AM43x reuses most of the IP's from AM335x, as that is the case, much of
the AM335x hwmod data is reused. As AM43x PRCM register layout differs
from AM335x and is similar to OMAP4, power domain, clock domain  hwmod
operations are reused from OMAP4. Currently there is no public TRM
available for AM43x.

Changes based on: v3.12-rc2

Regards
Afzal


Afzal Mohammed (7):
  ARM: OMAP2+: hwmod: AM335x/AM43x: move common data
  ARM: OMAP2+: hwmod: AM335x: runtime register update
  ARM: OMAP2+: hwmod: AM335x: remove static register offs
  ARM: OMAP2+: PRCM: AM43x definitions
  ARM: OMAP2+: hwmod: AM43x support
  ARM: OMAP2+: hwmod: AM43x operations
  ARM: OMAP2+: AM43x: PRCM kbuild

Ambresh K (3):
  ARM: OMAP2+: PM: AM43x powerdomain data
  ARM: OMAP2+: CM: AM43x clockdomain data
  ARM: OMAP2+: AM43x PRCM init

Ankur Kishore (1):
  ARM: OMAP2+: CM: cm_inst offset s16-u16

 arch/arm/mach-omap2/Makefile   |9 +-
 arch/arm/mach-omap2/clockdomain.h  |4 +-
 arch/arm/mach-omap2/clockdomains43xx_data.c|  196 ++
 arch/arm/mach-omap2/cm33xx.c   |   16 +-
 arch/arm/mach-omap2/cm33xx.h   |   12 +-
 arch/arm/mach-omap2/cminst44xx.c   |   29 +-
 arch/arm/mach-omap2/cminst44xx.h   |   26 +-
 arch/arm/mach-omap2/io.c   |6 +
 arch/arm/mach-omap2/omap_hwmod.c   |8 +
 arch/arm/mach-omap2/omap_hwmod.h   |1 +
 .../mach-omap2/omap_hwmod_33xx_43xx_common_data.h  |  163 ++
 .../omap_hwmod_33xx_43xx_interconnect_data.c   |  643 +++
 .../mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c | 1456 +++
 arch/arm/mach-omap2/omap_hwmod_33xx_data.c | 1966 +---
 arch/arm/mach-omap2/omap_hwmod_43xx_data.c |  622 +++
 arch/arm/mach-omap2/powerdomain.h  |1 +
 arch/arm/mach-omap2/powerdomains43xx_data.c|  136 ++
 arch/arm/mach-omap2/prcm43xx.h |  141 ++
 18 files changed, 3432 insertions(+), 2003 deletions(-)
 create mode 100644 arch/arm/mach-omap2/clockdomains43xx_data.c
 create mode 100644 arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common_data.h
 create mode 100644 arch/arm/mach-omap2/omap_hwmod_33xx_43xx_interconnect_data.c
 create mode 100644 arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
 create mode 100644 arch/arm/mach-omap2/omap_hwmod_43xx_data.c
 create mode 100644 arch/arm/mach-omap2/powerdomains43xx_data.c
 create mode 100644 arch/arm/mach-omap2/prcm43xx.h

-- 
1.8.3.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v5 01/11] ARM: OMAP2+: CM: cm_inst offset s16-u16

2013-10-01 Thread Afzal Mohammed
From: Ankur Kishore a-kish...@ti.com

Most of the AM43x CM reg address offsets are with MSB bit '1' (on
16-bit value) leading to arithmetic miscalculations while calculating
CLOCK ENABLE register's address because cm_inst field was a type of
const s16, so make it const u16.

Also modify relevant functions so as to take care of the above.

[af...@ti.com: fixup and cleanup]

Signed-off-by: Ankur Kishore a-kish...@ti.com
Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/clockdomain.h |  2 +-
 arch/arm/mach-omap2/cm33xx.c  | 16 
 arch/arm/mach-omap2/cm33xx.h  | 10 +-
 arch/arm/mach-omap2/cminst44xx.c  | 20 ++--
 arch/arm/mach-omap2/cminst44xx.h  | 26 +-
 5 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/arch/arm/mach-omap2/clockdomain.h 
b/arch/arm/mach-omap2/clockdomain.h
index 4b03394..5431b0c 100644
--- a/arch/arm/mach-omap2/clockdomain.h
+++ b/arch/arm/mach-omap2/clockdomain.h
@@ -132,7 +132,7 @@ struct clockdomain {
u8 _flags;
const u8 dep_bit;
const u8 prcm_partition;
-   const s16 cm_inst;
+   const u16 cm_inst;
const u16 clkdm_offs;
struct clkdm_dep *wkdep_srcs;
struct clkdm_dep *sleepdep_srcs;
diff --git a/arch/arm/mach-omap2/cm33xx.c b/arch/arm/mach-omap2/cm33xx.c
index 325a515..40a22e5 100644
--- a/arch/arm/mach-omap2/cm33xx.c
+++ b/arch/arm/mach-omap2/cm33xx.c
@@ -48,13 +48,13 @@
 /* Private functions */
 
 /* Read a register in a CM instance */
-static inline u32 am33xx_cm_read_reg(s16 inst, u16 idx)
+static inline u32 am33xx_cm_read_reg(u16 inst, u16 idx)
 {
return __raw_readl(cm_base + inst + idx);
 }
 
 /* Write into a register in a CM */
-static inline void am33xx_cm_write_reg(u32 val, s16 inst, u16 idx)
+static inline void am33xx_cm_write_reg(u32 val, u16 inst, u16 idx)
 {
__raw_writel(val, cm_base + inst + idx);
 }
@@ -138,7 +138,7 @@ static bool _is_module_ready(u16 inst, s16 cdoffs, u16 
clkctrl_offs)
  * @c must be the unshifted value for CLKTRCTRL - i.e., this function
  * will handle the shift itself.
  */
-static void _clktrctrl_write(u8 c, s16 inst, u16 cdoffs)
+static void _clktrctrl_write(u8 c, u16 inst, u16 cdoffs)
 {
u32 v;
 
@@ -158,7 +158,7 @@ static void _clktrctrl_write(u8 c, s16 inst, u16 cdoffs)
  * Returns true if the clockdomain referred to by (@inst, @cdoffs)
  * is in hardware-supervised idle mode, or 0 otherwise.
  */
-bool am33xx_cm_is_clkdm_in_hwsup(s16 inst, u16 cdoffs)
+bool am33xx_cm_is_clkdm_in_hwsup(u16 inst, u16 cdoffs)
 {
u32 v;
 
@@ -177,7 +177,7 @@ bool am33xx_cm_is_clkdm_in_hwsup(s16 inst, u16 cdoffs)
  * Put a clockdomain referred to by (@inst, @cdoffs) into
  * hardware-supervised idle mode.  No return value.
  */
-void am33xx_cm_clkdm_enable_hwsup(s16 inst, u16 cdoffs)
+void am33xx_cm_clkdm_enable_hwsup(u16 inst, u16 cdoffs)
 {
_clktrctrl_write(OMAP34XX_CLKSTCTRL_ENABLE_AUTO, inst, cdoffs);
 }
@@ -191,7 +191,7 @@ void am33xx_cm_clkdm_enable_hwsup(s16 inst, u16 cdoffs)
  * software-supervised idle mode, i.e., controlled manually by the
  * Linux OMAP clockdomain code.  No return value.
  */
-void am33xx_cm_clkdm_disable_hwsup(s16 inst, u16 cdoffs)
+void am33xx_cm_clkdm_disable_hwsup(u16 inst, u16 cdoffs)
 {
_clktrctrl_write(OMAP34XX_CLKSTCTRL_DISABLE_AUTO, inst, cdoffs);
 }
@@ -204,7 +204,7 @@ void am33xx_cm_clkdm_disable_hwsup(s16 inst, u16 cdoffs)
  * Put a clockdomain referred to by (@inst, @cdoffs) into idle
  * No return value.
  */
-void am33xx_cm_clkdm_force_sleep(s16 inst, u16 cdoffs)
+void am33xx_cm_clkdm_force_sleep(u16 inst, u16 cdoffs)
 {
_clktrctrl_write(OMAP34XX_CLKSTCTRL_FORCE_SLEEP, inst, cdoffs);
 }
@@ -217,7 +217,7 @@ void am33xx_cm_clkdm_force_sleep(s16 inst, u16 cdoffs)
  * Take a clockdomain referred to by (@inst, @cdoffs) out of idle,
  * waking it up.  No return value.
  */
-void am33xx_cm_clkdm_force_wakeup(s16 inst, u16 cdoffs)
+void am33xx_cm_clkdm_force_wakeup(u16 inst, u16 cdoffs)
 {
_clktrctrl_write(OMAP34XX_CLKSTCTRL_FORCE_WAKEUP, inst, cdoffs);
 }
diff --git a/arch/arm/mach-omap2/cm33xx.h b/arch/arm/mach-omap2/cm33xx.h
index 9d1f4fc..757320b 100644
--- a/arch/arm/mach-omap2/cm33xx.h
+++ b/arch/arm/mach-omap2/cm33xx.h
@@ -377,11 +377,11 @@
 
 
 #ifndef __ASSEMBLER__
-extern bool am33xx_cm_is_clkdm_in_hwsup(s16 inst, u16 cdoffs);
-extern void am33xx_cm_clkdm_enable_hwsup(s16 inst, u16 cdoffs);
-extern void am33xx_cm_clkdm_disable_hwsup(s16 inst, u16 cdoffs);
-extern void am33xx_cm_clkdm_force_sleep(s16 inst, u16 cdoffs);
-extern void am33xx_cm_clkdm_force_wakeup(s16 inst, u16 cdoffs);
+bool am33xx_cm_is_clkdm_in_hwsup(u16 inst, u16 cdoffs);
+void am33xx_cm_clkdm_enable_hwsup(u16 inst, u16 cdoffs);
+void am33xx_cm_clkdm_disable_hwsup(u16 inst, u16 cdoffs);
+void am33xx_cm_clkdm_force_sleep(u16 inst, u16 cdoffs);
+void am33xx_cm_clkdm_force_wakeup(u16 inst, u16 cdoffs);
 
 #if defined(CONFIG_SOC_AM33XX

[PATCH v5 03/11] ARM: OMAP2+: hwmod: AM335x: runtime register update

2013-10-01 Thread Afzal Mohammed
Most of IP's in AM335x is present on AM43x and so in those cases both
will use same hwmod database (except for a few cases where clock related
details differ), but there is difference w.r.t register offset between
these. Update register offsets at runtime based on the SoC detected to
help in sharing otherwise same hwmod.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 .../mach-omap2/omap_hwmod_33xx_43xx_common_data.h  |  2 +
 .../mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c | 77 ++
 arch/arm/mach-omap2/omap_hwmod_33xx_data.c |  1 +
 3 files changed, 80 insertions(+)

diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common_data.h 
b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common_data.h
index e873e72..a9a7902 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common_data.h
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common_data.h
@@ -157,4 +157,6 @@ extern struct omap_hwmod_class am33xx_spi_hwmod_class;
 extern struct omap_gpio_dev_attr gpio_dev_attr;
 extern struct omap2_mcspi_dev_attr mcspi_attrib;
 
+void omap_hwmod_am33xx_reg(void);
+
 #endif
diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c 
b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
index 3e70e9c..da40252 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
@@ -24,6 +24,10 @@
 #include prm33xx.h
 #include omap_hwmod_33xx_43xx_common_data.h
 
+#define CLKCTRL(oh, clkctrl) ((oh).prcm.omap4.clkctrl_offs = (clkctrl))
+#define RSTCTRL(oh, rstctrl) ((oh).prcm.omap4.rstctrl_offs = (rstctrl))
+#define RSTST(oh, rstst) ((oh).prcm.omap4.rstst_offs = (rstst))
+
 /*
  * 'l3' class
  * instance(s): l3_main, l3_s, l3_instr
@@ -1360,3 +1364,76 @@ struct omap_hwmod am33xx_wd_timer1_hwmod = {
},
},
 };
+
+static void omap_hwmod_am33xx_clkctrl(void)
+{
+   CLKCTRL(am33xx_uart2_hwmod, AM33XX_CM_PER_UART1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart3_hwmod, AM33XX_CM_PER_UART2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart4_hwmod, AM33XX_CM_PER_UART3_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart5_hwmod, AM33XX_CM_PER_UART4_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart6_hwmod, AM33XX_CM_PER_UART5_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_dcan0_hwmod, AM33XX_CM_PER_DCAN0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_dcan1_hwmod, AM33XX_CM_PER_DCAN1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_elm_hwmod, AM33XX_CM_PER_ELM_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_epwmss0_hwmod, AM33XX_CM_PER_EPWMSS0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_epwmss1_hwmod, AM33XX_CM_PER_EPWMSS1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_epwmss2_hwmod, AM33XX_CM_PER_EPWMSS2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gpio1_hwmod, AM33XX_CM_PER_GPIO1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gpio2_hwmod, AM33XX_CM_PER_GPIO2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gpio3_hwmod, AM33XX_CM_PER_GPIO3_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_i2c2_hwmod, AM33XX_CM_PER_I2C1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_i2c3_hwmod, AM33XX_CM_PER_I2C2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mailbox_hwmod, AM33XX_CM_PER_MAILBOX0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mcasp0_hwmod, AM33XX_CM_PER_MCASP0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mcasp1_hwmod, AM33XX_CM_PER_MCASP1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mmc0_hwmod, AM33XX_CM_PER_MMC0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mmc1_hwmod, AM33XX_CM_PER_MMC1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_spi0_hwmod, AM33XX_CM_PER_SPI0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_spi1_hwmod, AM33XX_CM_PER_SPI1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_spinlock_hwmod, AM33XX_CM_PER_SPINLOCK_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer2_hwmod, AM33XX_CM_PER_TIMER2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer3_hwmod, AM33XX_CM_PER_TIMER3_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer4_hwmod, AM33XX_CM_PER_TIMER4_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer5_hwmod, AM33XX_CM_PER_TIMER5_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer6_hwmod, AM33XX_CM_PER_TIMER6_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer7_hwmod, AM33XX_CM_PER_TIMER7_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_smartreflex0_hwmod,
+   AM33XX_CM_WKUP_SMARTREFLEX0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_smartreflex1_hwmod,
+   AM33XX_CM_WKUP_SMARTREFLEX1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart1_hwmod, AM33XX_CM_WKUP_UART0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer1_hwmod, AM33XX_CM_WKUP_TIMER1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_i2c1_hwmod, AM33XX_CM_WKUP_I2C0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_wd_timer1_hwmod, AM33XX_CM_WKUP_WDT1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_rtc_hwmod, AM33XX_CM_RTC_RTC_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mmc2_hwmod, AM33XX_CM_PER_MMC2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gpmc_hwmod, AM33XX_CM_PER_GPMC_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_l4_ls_hwmod, AM33XX_CM_PER_L4LS_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_l4_wkup_hwmod, AM33XX_CM_WKUP_L4WKUP_CLKCTRL_OFFSET);
+   CLKCTRL

[PATCH v5 04/11] ARM: OMAP2+: hwmod: AM335x: remove static register offs

2013-10-01 Thread Afzal Mohammed
Hwmod common to AM43x and AM335x has register offsets different. It is
now updated based on SoC detection at run time, hence remove statically
initialized ones.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 .../mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c | 57 --
 1 file changed, 57 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c 
b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
index da40252..598f813 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
@@ -44,7 +44,6 @@ struct omap_hwmod am33xx_l3_main_hwmod = {
.main_clk   = l3_gclk,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_PER_L3_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -66,7 +65,6 @@ struct omap_hwmod am33xx_l3_instr_hwmod = {
.main_clk   = l3_gclk,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_PER_L3_INSTR_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -89,7 +87,6 @@ struct omap_hwmod am33xx_l4_ls_hwmod = {
.main_clk   = l4ls_gclk,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_PER_L4LS_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -103,7 +100,6 @@ struct omap_hwmod am33xx_l4_wkup_hwmod = {
.flags  = (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET),
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_WKUP_L4WKUP_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -124,7 +120,6 @@ struct omap_hwmod am33xx_mpu_hwmod = {
.main_clk   = dpll_mpu_m2_ck,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_MPU_MPU_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -159,8 +154,6 @@ struct omap_hwmod am33xx_pruss_hwmod = {
.main_clk   = pruss_ocp_gclk,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_PER_PRUSS_CLKCTRL_OFFSET,
-   .rstctrl_offs   = AM33XX_RM_PER_RSTCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -185,9 +178,6 @@ struct omap_hwmod am33xx_gfx_hwmod = {
.main_clk   = gfx_fck_div_ck,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_GFX_GFX_CLKCTRL_OFFSET,
-   .rstctrl_offs   = AM33XX_RM_GFX_RSTCTRL_OFFSET,
-   .rstst_offs = AM33XX_RM_GFX_RSTST_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -232,7 +222,6 @@ struct omap_hwmod am33xx_aes0_hwmod = {
.main_clk   = aes0_fck,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_PER_AES0_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -258,7 +247,6 @@ struct omap_hwmod am33xx_sha0_hwmod = {
.main_clk   = l3_gclk,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_PER_SHA0_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -277,7 +265,6 @@ struct omap_hwmod am33xx_ocmcram_hwmod = {
.main_clk   = l3_gclk,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_PER_OCMCRAM_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -296,7 +283,6 @@ struct omap_hwmod am33xx_smartreflex0_hwmod = {
.main_clk   = smartreflex0_fck,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = 
AM33XX_CM_WKUP_SMARTREFLEX0_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -310,7 +296,6 @@ struct omap_hwmod am33xx_smartreflex1_hwmod = {
.main_clk   = smartreflex1_fck,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = 
AM33XX_CM_WKUP_SMARTREFLEX1_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -352,7 +337,6 @@ struct omap_hwmod am33xx_cpgmac0_hwmod = {
.mpu_rt_idx = 1,
.prcm   = {
.omap4  = {
-   .clkctrl_offs

[PATCH v5 05/11] ARM: OMAP2+: PRCM: AM43x definitions

2013-10-01 Thread Afzal Mohammed
Add AM43x CMINST, CDOFFS, RM_RSTST  RM_RSTCTRL definitions - minimal
ones that would be used.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/prcm43xx.h | 141 +
 1 file changed, 141 insertions(+)
 create mode 100644 arch/arm/mach-omap2/prcm43xx.h

diff --git a/arch/arm/mach-omap2/prcm43xx.h b/arch/arm/mach-omap2/prcm43xx.h
new file mode 100644
index 000..f0636ec
--- /dev/null
+++ b/arch/arm/mach-omap2/prcm43xx.h
@@ -0,0 +1,141 @@
+/*
+ * AM43x PRCM defines
+ *
+ * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed as is without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#ifndef __ARCH_ARM_MACH_OMAP2_PRCM_43XX_H
+#define __ARCH_ARM_MACH_OMAP2_PRCM_43XX_H
+
+#define AM43XX_PRM_PARTITION   1
+#define AM43XX_CM_PARTITION1
+
+/* PRM instances */
+#define AM43XX_PRM_OCP_SOCKET_INST 0x
+#define AM43XX_PRM_MPU_INST0x0300
+#define AM43XX_PRM_GFX_INST0x0400
+#define AM43XX_PRM_RTC_INST0x0500
+#define AM43XX_PRM_TAMPER_INST 0x0600
+#define AM43XX_PRM_CEFUSE_INST 0x0700
+#define AM43XX_PRM_PER_INST0x0800
+#define AM43XX_PRM_WKUP_INST   0x2000
+#define AM43XX_PRM_DEVICE_INST 0x4000
+
+/* RM RSTCTRL offsets */
+#define AM43XX_RM_PER_RSTCTRL_OFFSET   0x0010
+#define AM43XX_RM_GFX_RSTCTRL_OFFSET   0x0010
+#define AM43XX_RM_WKUP_RSTCTRL_OFFSET  0x0010
+
+/* RM RSTST offsets */
+#define AM43XX_RM_GFX_RSTST_OFFSET 0x0014
+#define AM43XX_RM_WKUP_RSTST_OFFSET0x0014
+
+/* CM instances */
+#define AM43XX_CM_WKUP_INST0x2800
+#define AM43XX_CM_DEVICE_INST  0x4100
+#define AM43XX_CM_DPLL_INST0x4200
+#define AM43XX_CM_MPU_INST 0x8300
+#define AM43XX_CM_GFX_INST 0x8400
+#define AM43XX_CM_RTC_INST 0x8500
+#define AM43XX_CM_TAMPER_INST  0x8600
+#define AM43XX_CM_CEFUSE_INST  0x8700
+#define AM43XX_CM_PER_INST 0x8800
+
+/* CD offsets */
+#define AM43XX_CM_WKUP_L3_AON_CDOFFS   0x
+#define AM43XX_CM_WKUP_L3S_TSC_CDOFFS  0x0100
+#define AM43XX_CM_WKUP_L4_WKUP_AON_CDOFFS  0x0200
+#define AM43XX_CM_WKUP_WKUP_CDOFFS 0x0300
+#define AM43XX_CM_MPU_MPU_CDOFFS   0x
+#define AM43XX_CM_GFX_GFX_L3_CDOFFS0x
+#define AM43XX_CM_RTC_RTC_CDOFFS   0x
+#define AM43XX_CM_TAMPER_TAMPER_CDOFFS 0x
+#define AM43XX_CM_CEFUSE_CEFUSE_CDOFFS 0x
+#define AM43XX_CM_PER_L3_CDOFFS0x
+#define AM43XX_CM_PER_L3S_CDOFFS   0x0200
+#define AM43XX_CM_PER_ICSS_CDOFFS  0x0300
+#define AM43XX_CM_PER_L4LS_CDOFFS  0x0400
+#define AM43XX_CM_PER_EMIF_CDOFFS  0x0700
+#define AM43XX_CM_PER_DSS_CDOFFS   0x0a00
+#define AM43XX_CM_PER_CPSW_CDOFFS  0x0b00
+#define AM43XX_CM_PER_OCPWP_L3_CDOFFS  0x0c00
+
+/* CLK CTRL offsets */
+#define AM43XX_CM_PER_UART1_CLKCTRL_OFFSET 0x0580
+#define AM43XX_CM_PER_UART2_CLKCTRL_OFFSET 0x0588
+#define AM43XX_CM_PER_UART3_CLKCTRL_OFFSET 0x0590
+#define AM43XX_CM_PER_UART4_CLKCTRL_OFFSET 0x0598
+#define AM43XX_CM_PER_UART5_CLKCTRL_OFFSET 0x05a0
+#define AM43XX_CM_PER_DCAN0_CLKCTRL_OFFSET 0x0428
+#define AM43XX_CM_PER_DCAN1_CLKCTRL_OFFSET 0x0430
+#define AM43XX_CM_PER_ELM_CLKCTRL_OFFSET   0x0468
+#define AM43XX_CM_PER_EPWMSS0_CLKCTRL_OFFSET   0x0438
+#define AM43XX_CM_PER_EPWMSS1_CLKCTRL_OFFSET   0x0440
+#define AM43XX_CM_PER_EPWMSS2_CLKCTRL_OFFSET   0x0448
+#define AM43XX_CM_PER_GPIO1_CLKCTRL_OFFSET 0x0478
+#define AM43XX_CM_PER_GPIO2_CLKCTRL_OFFSET 0x0480
+#define AM43XX_CM_PER_GPIO3_CLKCTRL_OFFSET 0x0488
+#define AM43XX_CM_PER_I2C1_CLKCTRL_OFFSET  0x04a8
+#define AM43XX_CM_PER_I2C2_CLKCTRL_OFFSET  0x04b0
+#define AM43XX_CM_PER_MAILBOX0_CLKCTRL_OFFSET  0x04b8
+#define AM43XX_CM_PER_MMC0_CLKCTRL_OFFSET  0x04c0
+#define AM43XX_CM_PER_MMC1_CLKCTRL_OFFSET  0x04c8
+#define AM43XX_CM_PER_SPI0_CLKCTRL_OFFSET  0x0500
+#define AM43XX_CM_PER_SPI1_CLKCTRL_OFFSET

[PATCH v5 08/11] ARM: OMAP2+: hwmod: AM43x support

2013-10-01 Thread Afzal Mohammed
Add hwmod support for IP's that are present in AM43x, but not in AM335x.
AM43x additional ones added here are,
1. synctimer
2. timer8-11
3. ehrpwm3-5
4. spi2-4
5. gpio4-5

AM43x pruss interconnect which is different as compared to AM335x, has
been taken care.

And register offsets for same hwmod's shared with AM335x is different,
AM43x register offsets are updated appropriately.

ocp clock of those in l4_wkup is fed from sys_clkin_ck instead of
dpll_core_m4_div2_ck, so ocpif for those in AM43x l4_wkup has been
added seperately.

hwmod's has been added for those that have main clock (wkup_m3, control,
gpio0) and clock domain (l4_hs) different from AM335x. debugss and
adc_tsc that have different clocks and clockdomains repectively has not
been added due to the reasons mentioned below.

AM43x also has IP's like qspi, hdq1w, vpfe, des, rng, usb, dss, debugss,
adc_tsc. These are not handled here due to both/either of following
reasons,
1. To avoid churn; most of them don't have DT bindings, which would
   necessitate adding address space in hwmod, which any way would have
   to be removed once DT bindings happen with driver support.
2. patches would come in from sources other than the author

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod.h   |   1 +
 .../mach-omap2/omap_hwmod_33xx_43xx_common_data.h  |   1 +
 .../mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c |  74 +++
 arch/arm/mach-omap2/omap_hwmod_43xx_data.c | 622 +
 4 files changed, 698 insertions(+)
 create mode 100644 arch/arm/mach-omap2/omap_hwmod_43xx_data.c

diff --git a/arch/arm/mach-omap2/omap_hwmod.h b/arch/arm/mach-omap2/omap_hwmod.h
index d02acf9..0f97d63 100644
--- a/arch/arm/mach-omap2/omap_hwmod.h
+++ b/arch/arm/mach-omap2/omap_hwmod.h
@@ -752,6 +752,7 @@ extern int omap44xx_hwmod_init(void);
 extern int omap54xx_hwmod_init(void);
 extern int am33xx_hwmod_init(void);
 extern int dra7xx_hwmod_init(void);
+int am43xx_hwmod_init(void);
 
 extern int __init omap_hwmod_register_links(struct omap_hwmod_ocp_if **ois);
 
diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common_data.h 
b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common_data.h
index a9a7902..130332c 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common_data.h
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common_data.h
@@ -158,5 +158,6 @@ extern struct omap_gpio_dev_attr gpio_dev_attr;
 extern struct omap2_mcspi_dev_attr mcspi_attrib;
 
 void omap_hwmod_am33xx_reg(void);
+void omap_hwmod_am43xx_reg(void);
 
 #endif
diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c 
b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
index 598f813..d080bef 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
@@ -23,6 +23,7 @@
 #include cm33xx.h
 #include prm33xx.h
 #include omap_hwmod_33xx_43xx_common_data.h
+#include prcm43xx.h
 
 #define CLKCTRL(oh, clkctrl) ((oh).prcm.omap4.clkctrl_offs = (clkctrl))
 #define RSTCTRL(oh, rstctrl) ((oh).prcm.omap4.rstctrl_offs = (rstctrl))
@@ -1380,3 +1381,76 @@ void omap_hwmod_am33xx_reg(void)
omap_hwmod_am33xx_clkctrl();
omap_hwmod_am33xx_rst();
 }
+
+static void omap_hwmod_am43xx_clkctrl(void)
+{
+   CLKCTRL(am33xx_uart2_hwmod, AM43XX_CM_PER_UART1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart3_hwmod, AM43XX_CM_PER_UART2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart4_hwmod, AM43XX_CM_PER_UART3_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart5_hwmod, AM43XX_CM_PER_UART4_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart6_hwmod, AM43XX_CM_PER_UART5_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_dcan0_hwmod, AM43XX_CM_PER_DCAN0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_dcan1_hwmod, AM43XX_CM_PER_DCAN1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_elm_hwmod, AM43XX_CM_PER_ELM_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_epwmss0_hwmod, AM43XX_CM_PER_EPWMSS0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_epwmss1_hwmod, AM43XX_CM_PER_EPWMSS1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_epwmss2_hwmod, AM43XX_CM_PER_EPWMSS2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gpio1_hwmod, AM43XX_CM_PER_GPIO1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gpio2_hwmod, AM43XX_CM_PER_GPIO2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gpio3_hwmod, AM43XX_CM_PER_GPIO3_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_i2c2_hwmod, AM43XX_CM_PER_I2C1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_i2c3_hwmod, AM43XX_CM_PER_I2C2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mailbox_hwmod, AM43XX_CM_PER_MAILBOX0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mcasp0_hwmod, AM43XX_CM_PER_MCASP0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mcasp1_hwmod, AM43XX_CM_PER_MCASP1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mmc0_hwmod, AM43XX_CM_PER_MMC0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mmc1_hwmod, AM43XX_CM_PER_MMC1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_spi0_hwmod, AM43XX_CM_PER_SPI0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_spi1_hwmod, AM43XX_CM_PER_SPI1_CLKCTRL_OFFSET);
+   CLKCTRL

[PATCH v5 07/11] ARM: OMAP2+: CM: AM43x clockdomain data

2013-10-01 Thread Afzal Mohammed
From: Ambresh K ambr...@ti.com

Add the data file to describe clock domains in AM43x SoC.
OMAP4 clockdomain operations is being reused here.

Signed-off-by: Ambresh K ambr...@ti.com
Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/clockdomain.h   |   2 +
 arch/arm/mach-omap2/clockdomains43xx_data.c | 196 
 arch/arm/mach-omap2/cminst44xx.c|   9 ++
 3 files changed, 207 insertions(+)
 create mode 100644 arch/arm/mach-omap2/clockdomains43xx_data.c

diff --git a/arch/arm/mach-omap2/clockdomain.h 
b/arch/arm/mach-omap2/clockdomain.h
index 5431b0c..f17f006 100644
--- a/arch/arm/mach-omap2/clockdomain.h
+++ b/arch/arm/mach-omap2/clockdomain.h
@@ -218,6 +218,7 @@ extern void __init am33xx_clockdomains_init(void);
 extern void __init omap44xx_clockdomains_init(void);
 extern void __init omap54xx_clockdomains_init(void);
 extern void __init dra7xx_clockdomains_init(void);
+void am43xx_clockdomains_init(void);
 
 extern void clkdm_add_autodeps(struct clockdomain *clkdm);
 extern void clkdm_del_autodeps(struct clockdomain *clkdm);
@@ -226,6 +227,7 @@ extern struct clkdm_ops omap2_clkdm_operations;
 extern struct clkdm_ops omap3_clkdm_operations;
 extern struct clkdm_ops omap4_clkdm_operations;
 extern struct clkdm_ops am33xx_clkdm_operations;
+extern struct clkdm_ops am43xx_clkdm_operations;
 
 extern struct clkdm_dep gfx_24xx_wkdeps[];
 extern struct clkdm_dep dsp_24xx_wkdeps[];
diff --git a/arch/arm/mach-omap2/clockdomains43xx_data.c 
b/arch/arm/mach-omap2/clockdomains43xx_data.c
new file mode 100644
index 000..6d71c60
--- /dev/null
+++ b/arch/arm/mach-omap2/clockdomains43xx_data.c
@@ -0,0 +1,196 @@
+/*
+ * AM43xx Clock domains framework
+ *
+ * Copyright (C) 2013 Texas Instruments, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include linux/kernel.h
+#include linux/io.h
+
+#include clockdomain.h
+#include prcm44xx.h
+#include prcm43xx.h
+
+static struct clockdomain l4_cefuse_43xx_clkdm = {
+   .name = l4_cefuse_clkdm,
+   .pwrdm= { .name = cefuse_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_CEFUSE_INST,
+   .clkdm_offs   = AM43XX_CM_CEFUSE_CEFUSE_CDOFFS,
+   .flags= CLKDM_CAN_SWSUP,
+};
+
+static struct clockdomain mpu_43xx_clkdm = {
+   .name = mpu_clkdm,
+   .pwrdm= { .name = mpu_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_MPU_INST,
+   .clkdm_offs   = AM43XX_CM_MPU_MPU_CDOFFS,
+   .flags= CLKDM_CAN_HWSUP_SWSUP,
+};
+
+static struct clockdomain l4ls_43xx_clkdm = {
+   .name = l4ls_clkdm,
+   .pwrdm= { .name = per_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_PER_INST,
+   .clkdm_offs   = AM43XX_CM_PER_L4LS_CDOFFS,
+   .flags= CLKDM_CAN_SWSUP,
+};
+
+static struct clockdomain tamper_43xx_clkdm = {
+   .name = tamper_clkdm,
+   .pwrdm= { .name = tamper_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_TAMPER_INST,
+   .clkdm_offs   = AM43XX_CM_TAMPER_TAMPER_CDOFFS,
+   .flags= CLKDM_CAN_SWSUP,
+};
+
+static struct clockdomain l4_rtc_43xx_clkdm = {
+   .name = l4_rtc_clkdm,
+   .pwrdm= { .name = rtc_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_RTC_INST,
+   .clkdm_offs   = AM43XX_CM_RTC_RTC_CDOFFS,
+   .flags= CLKDM_CAN_SWSUP,
+};
+
+static struct clockdomain pruss_ocp_43xx_clkdm = {
+   .name = pruss_ocp_clkdm,
+   .pwrdm= { .name = per_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_PER_INST,
+   .clkdm_offs   = AM43XX_CM_PER_ICSS_CDOFFS,
+   .flags= CLKDM_CAN_SWSUP,
+};
+
+static struct clockdomain ocpwp_l3_43xx_clkdm = {
+   .name = ocpwp_l3_clkdm,
+   .pwrdm= { .name = per_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_PER_INST,
+   .clkdm_offs   = AM43XX_CM_PER_OCPWP_L3_CDOFFS,
+   .flags= CLKDM_CAN_SWSUP,
+};
+
+static struct clockdomain l3s_tsc_43xx_clkdm = {
+   .name = l3s_tsc_clkdm,
+   .pwrdm= { .name = wkup_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_WKUP_INST,
+   .clkdm_offs   = AM43XX_CM_WKUP_L3S_TSC_CDOFFS,
+   .flags= CLKDM_CAN_SWSUP,
+};
+
+static struct clockdomain dss_43xx_clkdm = {
+   .name = dss_clkdm,
+   .pwrdm

[PATCH v5 06/11] ARM: OMAP2+: PM: AM43x powerdomain data

2013-10-01 Thread Afzal Mohammed
From: Ambresh K ambr...@ti.com

Add the data file to describe all power domains in AM43x SoC.
OMAP4 powerdomain operations is being reused here.

Signed-off-by: Ambresh K ambr...@ti.com
Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/powerdomain.h   |   1 +
 arch/arm/mach-omap2/powerdomains43xx_data.c | 136 
 2 files changed, 137 insertions(+)
 create mode 100644 arch/arm/mach-omap2/powerdomains43xx_data.c

diff --git a/arch/arm/mach-omap2/powerdomain.h 
b/arch/arm/mach-omap2/powerdomain.h
index baf3d8b..da5a59a 100644
--- a/arch/arm/mach-omap2/powerdomain.h
+++ b/arch/arm/mach-omap2/powerdomain.h
@@ -257,6 +257,7 @@ extern void am33xx_powerdomains_init(void);
 extern void omap44xx_powerdomains_init(void);
 extern void omap54xx_powerdomains_init(void);
 extern void dra7xx_powerdomains_init(void);
+void am43xx_powerdomains_init(void);
 
 extern struct pwrdm_ops omap2_pwrdm_operations;
 extern struct pwrdm_ops omap3_pwrdm_operations;
diff --git a/arch/arm/mach-omap2/powerdomains43xx_data.c 
b/arch/arm/mach-omap2/powerdomains43xx_data.c
new file mode 100644
index 000..95fee54
--- /dev/null
+++ b/arch/arm/mach-omap2/powerdomains43xx_data.c
@@ -0,0 +1,136 @@
+/*
+ * AM43xx Power domains framework
+ *
+ * Copyright (C) 2013 Texas Instruments, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include linux/kernel.h
+#include linux/init.h
+
+#include powerdomain.h
+
+#include prcm-common.h
+#include prcm44xx.h
+#include prcm43xx.h
+
+static struct powerdomain gfx_43xx_pwrdm = {
+   .name = gfx_pwrdm,
+   .voltdm   = { .name = core },
+   .prcm_offs= AM43XX_PRM_GFX_INST,
+   .prcm_partition   = AM43XX_PRM_PARTITION,
+   .pwrsts   = PWRSTS_OFF_ON,
+   .banks= 1,
+   .pwrsts_mem_on  = {
+   [0] = PWRSTS_ON,/* gfx_mem */
+   },
+   .flags= PWRDM_HAS_LOWPOWERSTATECHANGE,
+};
+
+static struct powerdomain mpu_43xx_pwrdm = {
+   .name = mpu_pwrdm,
+   .voltdm   = { .name = mpu },
+   .prcm_offs= AM43XX_PRM_MPU_INST,
+   .prcm_partition   = AM43XX_PRM_PARTITION,
+   .pwrsts   = PWRSTS_OFF_RET_ON,
+   .pwrsts_logic_ret = PWRSTS_OFF_RET,
+   .banks= 3,
+   .pwrsts_mem_ret = {
+   [0] = PWRSTS_OFF_RET,   /* mpu_l1 */
+   [1] = PWRSTS_OFF_RET,   /* mpu_l2 */
+   [2] = PWRSTS_OFF_RET,   /* mpu_ram */
+   },
+   .pwrsts_mem_on  = {
+   [0] = PWRSTS_ON,/* mpu_l1 */
+   [1] = PWRSTS_ON,/* mpu_l2 */
+   [2] = PWRSTS_ON,/* mpu_ram */
+   },
+   .flags= PWRDM_HAS_LOWPOWERSTATECHANGE,
+};
+
+static struct powerdomain rtc_43xx_pwrdm = {
+   .name = rtc_pwrdm,
+   .voltdm   = { .name = rtc },
+   .prcm_offs= AM43XX_PRM_RTC_INST,
+   .prcm_partition   = AM43XX_PRM_PARTITION,
+   .pwrsts   = PWRSTS_ON,
+};
+
+static struct powerdomain wkup_43xx_pwrdm = {
+   .name = wkup_pwrdm,
+   .voltdm   = { .name = core },
+   .prcm_offs= AM43XX_PRM_WKUP_INST,
+   .prcm_partition   = AM43XX_PRM_PARTITION,
+   .pwrsts   = PWRSTS_ON,
+   .banks= 1,
+   .pwrsts_mem_on  = {
+   [0] = PWRSTS_ON,/* debugss_mem */
+   },
+};
+
+static struct powerdomain tamper_43xx_pwrdm = {
+   .name = tamper_pwrdm,
+   .voltdm   = { .name = tamper },
+   .prcm_offs= AM43XX_PRM_TAMPER_INST,
+   .prcm_partition   = AM43XX_PRM_PARTITION,
+   .pwrsts   = PWRSTS_ON,
+};
+
+static struct powerdomain cefuse_43xx_pwrdm = {
+   .name = cefuse_pwrdm,
+   .voltdm   = { .name = core },
+   .prcm_offs= AM43XX_PRM_CEFUSE_INST,
+   .prcm_partition   = AM43XX_PRM_PARTITION,
+   .pwrsts   = PWRSTS_OFF_ON,
+   .flags= PWRDM_HAS_LOWPOWERSTATECHANGE,
+};
+
+static struct powerdomain per_43xx_pwrdm = {
+   .name = per_pwrdm,
+   .voltdm   = { .name = core },
+   .prcm_offs= AM43XX_PRM_PER_INST,
+   .prcm_partition   = AM43XX_PRM_PARTITION,
+   .pwrsts   = PWRSTS_OFF_RET_ON,
+   .pwrsts_logic_ret = PWRSTS_OFF_RET,
+   .banks= 4,
+   .pwrsts_mem_ret = {
+   [0] = PWRSTS_OFF_RET,   /* icss_mem */
+   [1] = PWRSTS_OFF_RET,   /* per_mem */
+   [2] = PWRSTS_OFF_RET,   /* ram1_mem */
+   [3] = PWRSTS_OFF_RET,   /* ram2_mem */
+   },
+   .pwrsts_mem_on  = {
+   [0] = PWRSTS_ON,/* icss_mem */
+   [1] = PWRSTS_ON

[PATCH v5 09/11] ARM: OMAP2+: hwmod: AM43x operations

2013-10-01 Thread Afzal Mohammed
Reuse OMAP4 operations on AM43x.

Context related ops are not used on AM43x, as this would not add value
when using DT and AM43x is DT only boot. This additionally helps not to
add context register offset for each hwmod.

Signed-off-by: Ambresh K ambr...@ti.com
Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index d9ee0ff..aa593da 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -4125,6 +4125,14 @@ void __init omap_hwmod_init(void)
soc_ops.init_clkdm = _init_clkdm;
soc_ops.update_context_lost = _omap4_update_context_lost;
soc_ops.get_context_lost = _omap4_get_context_lost;
+   } else if (soc_is_am43xx()) {
+   soc_ops.enable_module = _omap4_enable_module;
+   soc_ops.disable_module = _omap4_disable_module;
+   soc_ops.wait_target_ready = _omap4_wait_target_ready;
+   soc_ops.assert_hardreset = _omap4_assert_hardreset;
+   soc_ops.deassert_hardreset = _omap4_deassert_hardreset;
+   soc_ops.is_hardreset_asserted = _omap4_is_hardreset_asserted;
+   soc_ops.init_clkdm = _init_clkdm;
} else if (soc_is_am33xx()) {
soc_ops.enable_module = _am33xx_enable_module;
soc_ops.disable_module = _am33xx_disable_module;
-- 
1.8.3.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v5 10/11] ARM: OMAP2+: AM43x: PRCM kbuild

2013-10-01 Thread Afzal Mohammed
Build AM43x power domain, clock domain and hwmod data.

Many of AM43x IP's and interconnects are similar as that in AM335x,
hence AM335x hwmod data is being reused with necessary changes.

Earlier the plan was to reuse AM335x specific PRCM code, but as AM43x
PRCM register layout is much similar to OMAP4/5, AM335x PRCM is
divorced and instead married with OMAP4/5 PRCM for AM43x.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/Makefile | 7 ++-
 arch/arm/mach-omap2/cm33xx.h | 2 +-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 0746494..cb7b527 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -112,13 +112,13 @@ obj-$(CONFIG_ARCH_OMAP2)  += prm2xxx_3xxx.o 
prm2xxx.o cm2xxx.o
 obj-$(CONFIG_ARCH_OMAP3)   += prm2xxx_3xxx.o prm3xxx.o cm3xxx.o
 obj-$(CONFIG_ARCH_OMAP3)   += vc3xxx_data.o vp3xxx_data.o
 obj-$(CONFIG_SOC_AM33XX)   += prm33xx.o cm33xx.o
-obj-$(CONFIG_SOC_AM43XX)   += prm33xx.o cm33xx.o
 omap-prcm-4-5-common   =  cminst44xx.o cm44xx.o prm44xx.o \
   prcm_mpu44xx.o prminst44xx.o \
   vc44xx_data.o vp44xx_data.o
 obj-$(CONFIG_ARCH_OMAP4)   += $(omap-prcm-4-5-common)
 obj-$(CONFIG_SOC_OMAP5)+= $(omap-prcm-4-5-common)
 obj-$(CONFIG_SOC_DRA7XX)   += $(omap-prcm-4-5-common)
+obj-$(CONFIG_SOC_AM43XX)   += $(omap-prcm-4-5-common)
 
 # OMAP voltage domains
 voltagedomain-common   := voltage.o vc.o vp.o
@@ -146,6 +146,7 @@ obj-$(CONFIG_ARCH_OMAP4)+= 
powerdomains44xx_data.o
 obj-$(CONFIG_SOC_AM33XX)   += $(powerdomain-common)
 obj-$(CONFIG_SOC_AM33XX)   += powerdomains33xx_data.o
 obj-$(CONFIG_SOC_AM43XX)   += $(powerdomain-common)
+obj-$(CONFIG_SOC_AM43XX)   += powerdomains43xx_data.o
 obj-$(CONFIG_SOC_OMAP5)+= $(powerdomain-common)
 obj-$(CONFIG_SOC_OMAP5)+= powerdomains54xx_data.o
 obj-$(CONFIG_SOC_DRA7XX)   += $(powerdomain-common)
@@ -165,6 +166,7 @@ obj-$(CONFIG_ARCH_OMAP4)+= 
clockdomains44xx_data.o
 obj-$(CONFIG_SOC_AM33XX)   += $(clockdomain-common)
 obj-$(CONFIG_SOC_AM33XX)   += clockdomains33xx_data.o
 obj-$(CONFIG_SOC_AM43XX)   += $(clockdomain-common)
+obj-$(CONFIG_SOC_AM43XX)   += clockdomains43xx_data.o
 obj-$(CONFIG_SOC_OMAP5)+= $(clockdomain-common)
 obj-$(CONFIG_SOC_OMAP5)+= clockdomains54xx_data.o
 obj-$(CONFIG_SOC_DRA7XX)   += $(clockdomain-common)
@@ -212,6 +214,9 @@ obj-$(CONFIG_ARCH_OMAP3)+= 
omap_hwmod_3xxx_data.o
 obj-$(CONFIG_SOC_AM33XX)   += omap_hwmod_33xx_data.o
 obj-$(CONFIG_SOC_AM33XX)   += 
omap_hwmod_33xx_43xx_interconnect_data.o
 obj-$(CONFIG_SOC_AM33XX)   += omap_hwmod_33xx_43xx_ipblock_data.o
+obj-$(CONFIG_SOC_AM43XX)   += omap_hwmod_43xx_data.o
+obj-$(CONFIG_SOC_AM43XX)   += 
omap_hwmod_33xx_43xx_interconnect_data.o
+obj-$(CONFIG_SOC_AM43XX)   += omap_hwmod_33xx_43xx_ipblock_data.o
 obj-$(CONFIG_ARCH_OMAP4)   += omap_hwmod_44xx_data.o
 obj-$(CONFIG_SOC_OMAP5)+= omap_hwmod_54xx_data.o
 obj-$(CONFIG_SOC_DRA7XX)   += omap_hwmod_7xx_data.o
diff --git a/arch/arm/mach-omap2/cm33xx.h b/arch/arm/mach-omap2/cm33xx.h
index 757320b..cfb8891 100644
--- a/arch/arm/mach-omap2/cm33xx.h
+++ b/arch/arm/mach-omap2/cm33xx.h
@@ -383,7 +383,7 @@ void am33xx_cm_clkdm_disable_hwsup(u16 inst, u16 cdoffs);
 void am33xx_cm_clkdm_force_sleep(u16 inst, u16 cdoffs);
 void am33xx_cm_clkdm_force_wakeup(u16 inst, u16 cdoffs);
 
-#if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)
+#ifdef CONFIG_SOC_AM33XX
 extern int am33xx_cm_wait_module_idle(u16 inst, s16 cdoffs,
u16 clkctrl_offs);
 extern void am33xx_cm_module_enable(u8 mode, u16 inst, s16 cdoffs,
-- 
1.8.3.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v5 11/11] ARM: OMAP2+: AM43x PRCM init

2013-10-01 Thread Afzal Mohammed
From: Ambresh K ambr...@ti.com

Initialise AM43x HWMOD, powerdomains and clockdomains.

Signed-off-by: Ambresh K ambr...@ti.com
Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/io.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index ff2113c..c90f647 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -594,7 +594,13 @@ void __init am43xx_init_early(void)
  NULL);
omap2_set_globals_prm(AM33XX_L4_WK_IO_ADDRESS(AM43XX_PRCM_BASE));
omap2_set_globals_cm(AM33XX_L4_WK_IO_ADDRESS(AM43XX_PRCM_BASE), NULL);
+   omap_prm_base_init();
+   omap_cm_base_init();
omap3xxx_check_revision();
+   am43xx_powerdomains_init();
+   am43xx_clockdomains_init();
+   am43xx_hwmod_init();
+   omap_hwmod_init_postsetup();
 }
 #endif
 
-- 
1.8.3.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 01/11] ARM: OMAP2+: CM: cm_inst offset s16-u16

2013-09-30 Thread Afzal Mohammed
Hi Paul,

On Monday 30 September 2013 08:53 AM, Paul Walmsley wrote:
 On Thu, 26 Sep 2013, Afzal Mohammed wrote:

 Most of the AM43x CM reg address offsets are with MSB bit '1' (on
 16-bit value) leading to arithmetic miscalculations while calculating
 CLOCK ENABLE register's address because cm_inst field was a type of
 const s16, so make it const u16.

 Also modify relevant functions so as to take care of the above.

 [af...@ti.com: fixup and cleanup]

 Signed-off-by: Ankur Kishore a-kish...@ti.com
 Signed-off-by: Afzal Mohammed af...@ti.com
 ---
  arch/arm/mach-omap2/clockdomain.h |  2 +-
  arch/arm/mach-omap2/cm33xx.c  | 16 
  arch/arm/mach-omap2/cm33xx.h  | 10 +-
  arch/arm/mach-omap2/cminst44xx.c  | 20 ++--
  arch/arm/mach-omap2/cminst44xx.h  | 26 +-
  5 files changed, 37 insertions(+), 37 deletions(-)

 diff --git a/arch/arm/mach-omap2/clockdomain.h 
 b/arch/arm/mach-omap2/clockdomain.h
 index 4b03394..5431b0c 100644
 --- a/arch/arm/mach-omap2/clockdomain.h
 +++ b/arch/arm/mach-omap2/clockdomain.h
 @@ -132,7 +132,7 @@ struct clockdomain {
  u8 _flags;
  const u8 dep_bit;
  const u8 prcm_partition;
 -const s16 cm_inst;
 +const u16 cm_inst;
  const u16 clkdm_offs;
  struct clkdm_dep *wkdep_srcs;
  struct clkdm_dep *sleepdep_srcs;

 OMAP3 has at least one CM_INST that's negative:
 
 ./prcm-common.h:40:#define OMAP3430_IVA2_MOD  -0x800
 
 Have you tested this on OMAP34xx/35xx to ensure that the generated 
 addresses for IVA2_MOD-based addresses doesn't change?  Seems like there's 
 a risk that they might change, due to sign extension.

cm_inst field of clockdomain struct is not being used on OMAP3, but
instead prcm_offs of struct powerdomain is being made use. cm_inst field
of struct clockdomain is being used by OMAP4 types only, hence would
affect OMAP4, OMAP5, DRA7x  AM43x only and these don't have CM_INST
that is negative.

This has been tested on OMAP3 Beagle Xm and verified that it does not
cause any regresions.

Regards
Afzal
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 07/11] ARM: OMAP2+: CM: AM43x clockdomain data

2013-09-30 Thread Afzal Mohammed
Hi Paul,

On Monday 30 September 2013 03:01 PM, Paul Walmsley wrote:
 On Thu, 26 Sep 2013, Afzal Mohammed wrote:

 From: Ambresh K ambr...@ti.com

 Add the data file to describe clock domains in AM43x SoC.
 OMAP4 clockdomain operations is being reused here.

 Signed-off-by: Ambresh K ambr...@ti.com
 Signed-off-by: Afzal Mohammed af...@ti.com
 ---
  arch/arm/mach-omap2/clockdomain.h   |   2 +
  arch/arm/mach-omap2/clockdomains43xx_data.c | 196 
 
  arch/arm/mach-omap2/cminst44xx.c|   9 ++
  3 files changed, 207 insertions(+)
  create mode 100644 arch/arm/mach-omap2/clockdomains43xx_data.c

 
 ...
 
 diff --git a/arch/arm/mach-omap2/clockdomains43xx_data.c 
 b/arch/arm/mach-omap2/clockdomains43xx_data.c
 new file mode 100644
 index 000..6d71c60
 --- /dev/null
 +++ b/arch/arm/mach-omap2/clockdomains43xx_data.c
 @@ -0,0 +1,196 @@
 
 ...
 
 +static struct clockdomain l3s_tsc_43xx_clkdm = {
 +.name = l3s_tsc_clkdm,
 +.pwrdm= { .name = wkup_pwrdm },
 +.prcm_partition   = AM43XX_CM_PARTITION,
 +.cm_inst  = AM43XX_CM_WKUP_INST,
 +.clkdm_offs   = AM43XX_CM_WKUP_L3S_TSC_CDOFFS,
 +.flags= CLKDM_CAN_SWSUP,
 +};

 The references to wkup_pwrdm on some of these clockdomains don't 
 look right to me.  For example, this clockdomain is listed as being in 
 AM43XX_CM_WKUP_INST, but its enclosing powerdomain is listed as being in 
 AM43XX_PRM_WKUP_INST.  Looks to me like it's best to have two different 
 wakeup powerdomains: one CM_WKUP, and one PRM_WKUP.

On AM43x, prcm is a single block as in AM335x and is part of wakeup
domain. This is different from OMAP4 that had separate prm and cm
blocks. Script also generated the same output.

Regards
Afzal
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 07/11] ARM: OMAP2+: CM: AM43x clockdomain data

2013-09-30 Thread Afzal Mohammed
Hi Paul,

On Monday 30 September 2013 04:39 PM, Paul Walmsley wrote:
 On Mon, 30 Sep 2013, Afzal Mohammed wrote:

 The references to wkup_pwrdm on some of these clockdomains don't 
 look right to me.  For example, this clockdomain is listed as being in 
 AM43XX_CM_WKUP_INST, but its enclosing powerdomain is listed as being in 
 AM43XX_PRM_WKUP_INST.  Looks to me like it's best to have two different 
 wakeup powerdomains: one CM_WKUP, and one PRM_WKUP.

 On AM43x, prcm is a single block as in AM335x and is part of wakeup
 domain. This is different from OMAP4 that had separate prm and cm
 blocks. Script also generated the same output.

 Why are there two different address offsets for CM_WKUP and PRM_WKUP?  
 From another patch in the series:
 
 +#define AM43XX_PRM_WKUP_INST   0x2000
 
 ...
 
 +#define AM43XX_CM_WKUP_INST0x2800

AM43XX_PRM_WKUP_INST and AM43XX_CM_WKUP_INST are offsets from PRCM_BASE.
We don't have separate base address for PRM  CM. This is similar to as
that in AM335x, where it is 0xD00 and 0x400 respectively (both from same
base) as in prm33xx.h  cm33xx.h.

Please note that AM43XX_PRM_PARTITION and AM43XX_CM_PARTITION both are '1'.

PRCM register details from TRM (not yet public) is mentioned below.

Regards
Afzal


PRCM Functional Registers
The table below shows the base address and address space for the PRCM
module instances.
Table 2. PRCM Instance Summary
ModuleName  BaseAddress Size
OCP_SOCKET_PRM  0x  256 Bytes
PRM_MPU 0x0300  256 Bytes
PRM_GFX 0x0400  256 Bytes
PRM_RTC 0x0500  256 Bytes
PRM_TAMPER  0x0600  256 Bytes
PRM_CEFUSE  0x0700  256 Bytes
PRM_PER 0x0800  6 KBytes
PRM_WKUP0x2000  2 KBytes
CM_WKUP 0x2800  2 KBytes
PRM_DEVICE  0x4000  256 Bytes
CM_DEVICE   0x4100  256 Bytes
CM_DPLL 0x4200  256 Bytes
CM_MPU  0x8300  256 Bytes
CM_GFX  0x8400  256 Bytes
CM_RTC  0x8500  256 Bytes
CM_TAMPER   0x8600  256 Bytes
CM_CEFUSE   0x8700  256 Bytes
CM_PER  0x8800  6 KBytes



--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 06/11] ARM: OMAP2+: PM: AM43x powerdomain data

2013-09-30 Thread Afzal Mohammed
Hi Paul,

On Monday 30 September 2013 03:57 PM, Paul Walmsley wrote:
 On Thu, 26 Sep 2013, Afzal Mohammed wrote:

 From: Ambresh K ambr...@ti.com

 Add the data file to describe all power domains in AM43x SoC.
 OMAP4 powerdomain operations is being reused here.

 Signed-off-by: Ambresh K ambr...@ti.com
 Signed-off-by: Afzal Mohammed af...@ti.com
 
 ...
 
 --- /dev/null
 +++ b/arch/arm/mach-omap2/powerdomains43xx_data.c
 @@ -0,0 +1,142 @@
 
 ...
 
 +static struct powerdomain per_43xx_pwrdm = {
 +.name = per_pwrdm,
 +.voltdm   = { .name = core },
 +.prcm_offs= AM43XX_PRM_PER_INST,
 +.prcm_partition   = AM43XX_PRM_PARTITION,
 +.pwrsts   = PWRSTS_OFF_RET_ON,
 +.pwrsts_logic_ret = PWRSTS_OFF_RET,
 +.banks= 4,
 +.pwrsts_mem_ret = {
 +[0] = PWRSTS_OFF_RET,   /* icss_mem */
 +[1] = PWRSTS_OFF_RET,   /* per_mem */
 +[2] = PWRSTS_OFF_RET,   /* ram1_mem */
 +[3] = PWRSTS_OFF_RET,   /* ram2_mem */
 +},
 +.pwrsts_mem_on  = {
 +[0] = PWRSTS_OFF_RET,   /* icss_mem */
 +[1] = PWRSTS_ON,/* per_mem */
 +[2] = PWRSTS_OFF_RET,   /* ram1_mem */
 +[3] = PWRSTS_OFF_RET,   /* ram2_mem */
 +},
 +.flags= PWRDM_HAS_LOWPOWERSTATECHANGE,
 +};
 
 The pwrsts_mem_on flags don't make any sense here for banks 0, 2, and 3.  
 They claim that those banks can never be turned on.  Could you please 
 doublecheck these?

Checked it, they should be PWRSTS_ON, I will fix it.

Regards
Afzal
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 00/11] ARM: OMAP2+: AM43x PRCM basic support

2013-09-26 Thread Afzal Mohammed
Hi Paul, Benoit, Tony,

This series adds PRCM support (except clock tree) for AM43x SoC's.
Current version is based on Rajendra's comments and discussions, please
consider this for inclusion in the coming merge window.

Major changes compared to v2 (v3 was only an rfc for current approach):
1. omap_hwmod_33xx_43xx_interconnect_data.c has the common interconnect
   ocp's structs shared between AM335x and AM43x
2. omap_hwmod_33xx_43xx_ipblock_data.c has the common hwmod structs
   shared between AM335x and AM43x
3. Instances where clock domain or clock topology has changed in the few
   cases, have separate structures for AM335x and AM43x
4. To handle scenarios where register offsets are different, they are
   dynamically init-ed in omap_hwmod_33xx_43xx_ipblock_data.c
5. Register offsets for hwmod's that are present either in AM335x or
   AM43x are updated statically in omap_hwmod_33xx_data.c or
   omap_hwmod_43xx_data.c as that was cleaner.

Major changes compared to rfc v3:
1. All register offsets properly taken care for AM43x (with rfc v3, a
   couple of issues was detected while testing on pre-silicon)
2. There were two patches for common hwmod data movement (one for
   interconnect and other for ip block data), both were combined to have
   a cleaner series that is bisectable.
3. Cleaner seperation of common data

This series has been boot tested on pre-silicon platform with the help
of Tero's DT clock tree conversion series. This series has been tested
on AM335x-EVM too.

The change that re-introduces SW_SLEEP for OMAP4 has been left out from
this series as it is the only potential change that affect other
platforms. It will be taken care seperately.

Additional details:
AM43x reuses most of the IP's from AM335x, as that is the case, much of
the AM335x hwmod data is reused. As AM43x PRCM register layout differs
from AM335x and is similar to OMAP4, power domain, clock domain  hwmod
operations are reused from OMAP4. Currently there is no public TRM
available for AM43x.

Changes based on: v3.12-rc2

Regards
Afzal

Afzal Mohammed (7):
  ARM: OMAP2+: hwmod: AM335x/AM43x: move common data
  ARM: OMAP2+: hwmod: AM335x: runtime register update
  ARM: OMAP2+: hwmod: AM335x: remove static register offs
  ARM: OMAP2+: PRCM: AM43x definitions
  ARM: OMAP2+: hwmod: AM43x support
  ARM: OMAP2+: hwmod: AM43x operations
  ARM: OMAP2+: AM43x: PRCM kbuild

Ambresh K (3):
  ARM: OMAP2+: PM: AM43x powerdomain data
  ARM: OMAP2+: CM: AM43x clockdomain data
  ARM: OMAP2+: AM43x PRCM init

Ankur Kishore (1):
  ARM: OMAP2+: CM: cm_inst offset s16-u16

 arch/arm/mach-omap2/Makefile   |9 +-
 arch/arm/mach-omap2/clockdomain.h  |4 +-
 arch/arm/mach-omap2/clockdomains43xx_data.c|  196 ++
 arch/arm/mach-omap2/cm33xx.c   |   16 +-
 arch/arm/mach-omap2/cm33xx.h   |   12 +-
 arch/arm/mach-omap2/cminst44xx.c   |   29 +-
 arch/arm/mach-omap2/cminst44xx.h   |   26 +-
 arch/arm/mach-omap2/io.c   |6 +
 arch/arm/mach-omap2/omap_hwmod.c   |8 +
 arch/arm/mach-omap2/omap_hwmod.h   |1 +
 .../mach-omap2/omap_hwmod_33xx_43xx_common_data.h  |  163 ++
 .../omap_hwmod_33xx_43xx_interconnect_data.c   |  643 +++
 .../mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c | 1456 +++
 arch/arm/mach-omap2/omap_hwmod_33xx_data.c | 1966 +---
 arch/arm/mach-omap2/omap_hwmod_43xx_data.c |  622 +++
 arch/arm/mach-omap2/powerdomain.h  |1 +
 arch/arm/mach-omap2/powerdomains43xx_data.c|  142 ++
 arch/arm/mach-omap2/prcm43xx.h |  141 ++
 18 files changed, 3438 insertions(+), 2003 deletions(-)
 create mode 100644 arch/arm/mach-omap2/clockdomains43xx_data.c
 create mode 100644 arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common_data.h
 create mode 100644 arch/arm/mach-omap2/omap_hwmod_33xx_43xx_interconnect_data.c
 create mode 100644 arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
 create mode 100644 arch/arm/mach-omap2/omap_hwmod_43xx_data.c
 create mode 100644 arch/arm/mach-omap2/powerdomains43xx_data.c
 create mode 100644 arch/arm/mach-omap2/prcm43xx.h

-- 
1.8.3.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 01/11] ARM: OMAP2+: CM: cm_inst offset s16-u16

2013-09-26 Thread Afzal Mohammed
From: Ankur Kishore a-kish...@ti.com

Most of the AM43x CM reg address offsets are with MSB bit '1' (on
16-bit value) leading to arithmetic miscalculations while calculating
CLOCK ENABLE register's address because cm_inst field was a type of
const s16, so make it const u16.

Also modify relevant functions so as to take care of the above.

[af...@ti.com: fixup and cleanup]

Signed-off-by: Ankur Kishore a-kish...@ti.com
Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/clockdomain.h |  2 +-
 arch/arm/mach-omap2/cm33xx.c  | 16 
 arch/arm/mach-omap2/cm33xx.h  | 10 +-
 arch/arm/mach-omap2/cminst44xx.c  | 20 ++--
 arch/arm/mach-omap2/cminst44xx.h  | 26 +-
 5 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/arch/arm/mach-omap2/clockdomain.h 
b/arch/arm/mach-omap2/clockdomain.h
index 4b03394..5431b0c 100644
--- a/arch/arm/mach-omap2/clockdomain.h
+++ b/arch/arm/mach-omap2/clockdomain.h
@@ -132,7 +132,7 @@ struct clockdomain {
u8 _flags;
const u8 dep_bit;
const u8 prcm_partition;
-   const s16 cm_inst;
+   const u16 cm_inst;
const u16 clkdm_offs;
struct clkdm_dep *wkdep_srcs;
struct clkdm_dep *sleepdep_srcs;
diff --git a/arch/arm/mach-omap2/cm33xx.c b/arch/arm/mach-omap2/cm33xx.c
index 325a515..40a22e5 100644
--- a/arch/arm/mach-omap2/cm33xx.c
+++ b/arch/arm/mach-omap2/cm33xx.c
@@ -48,13 +48,13 @@
 /* Private functions */
 
 /* Read a register in a CM instance */
-static inline u32 am33xx_cm_read_reg(s16 inst, u16 idx)
+static inline u32 am33xx_cm_read_reg(u16 inst, u16 idx)
 {
return __raw_readl(cm_base + inst + idx);
 }
 
 /* Write into a register in a CM */
-static inline void am33xx_cm_write_reg(u32 val, s16 inst, u16 idx)
+static inline void am33xx_cm_write_reg(u32 val, u16 inst, u16 idx)
 {
__raw_writel(val, cm_base + inst + idx);
 }
@@ -138,7 +138,7 @@ static bool _is_module_ready(u16 inst, s16 cdoffs, u16 
clkctrl_offs)
  * @c must be the unshifted value for CLKTRCTRL - i.e., this function
  * will handle the shift itself.
  */
-static void _clktrctrl_write(u8 c, s16 inst, u16 cdoffs)
+static void _clktrctrl_write(u8 c, u16 inst, u16 cdoffs)
 {
u32 v;
 
@@ -158,7 +158,7 @@ static void _clktrctrl_write(u8 c, s16 inst, u16 cdoffs)
  * Returns true if the clockdomain referred to by (@inst, @cdoffs)
  * is in hardware-supervised idle mode, or 0 otherwise.
  */
-bool am33xx_cm_is_clkdm_in_hwsup(s16 inst, u16 cdoffs)
+bool am33xx_cm_is_clkdm_in_hwsup(u16 inst, u16 cdoffs)
 {
u32 v;
 
@@ -177,7 +177,7 @@ bool am33xx_cm_is_clkdm_in_hwsup(s16 inst, u16 cdoffs)
  * Put a clockdomain referred to by (@inst, @cdoffs) into
  * hardware-supervised idle mode.  No return value.
  */
-void am33xx_cm_clkdm_enable_hwsup(s16 inst, u16 cdoffs)
+void am33xx_cm_clkdm_enable_hwsup(u16 inst, u16 cdoffs)
 {
_clktrctrl_write(OMAP34XX_CLKSTCTRL_ENABLE_AUTO, inst, cdoffs);
 }
@@ -191,7 +191,7 @@ void am33xx_cm_clkdm_enable_hwsup(s16 inst, u16 cdoffs)
  * software-supervised idle mode, i.e., controlled manually by the
  * Linux OMAP clockdomain code.  No return value.
  */
-void am33xx_cm_clkdm_disable_hwsup(s16 inst, u16 cdoffs)
+void am33xx_cm_clkdm_disable_hwsup(u16 inst, u16 cdoffs)
 {
_clktrctrl_write(OMAP34XX_CLKSTCTRL_DISABLE_AUTO, inst, cdoffs);
 }
@@ -204,7 +204,7 @@ void am33xx_cm_clkdm_disable_hwsup(s16 inst, u16 cdoffs)
  * Put a clockdomain referred to by (@inst, @cdoffs) into idle
  * No return value.
  */
-void am33xx_cm_clkdm_force_sleep(s16 inst, u16 cdoffs)
+void am33xx_cm_clkdm_force_sleep(u16 inst, u16 cdoffs)
 {
_clktrctrl_write(OMAP34XX_CLKSTCTRL_FORCE_SLEEP, inst, cdoffs);
 }
@@ -217,7 +217,7 @@ void am33xx_cm_clkdm_force_sleep(s16 inst, u16 cdoffs)
  * Take a clockdomain referred to by (@inst, @cdoffs) out of idle,
  * waking it up.  No return value.
  */
-void am33xx_cm_clkdm_force_wakeup(s16 inst, u16 cdoffs)
+void am33xx_cm_clkdm_force_wakeup(u16 inst, u16 cdoffs)
 {
_clktrctrl_write(OMAP34XX_CLKSTCTRL_FORCE_WAKEUP, inst, cdoffs);
 }
diff --git a/arch/arm/mach-omap2/cm33xx.h b/arch/arm/mach-omap2/cm33xx.h
index 9d1f4fc..757320b 100644
--- a/arch/arm/mach-omap2/cm33xx.h
+++ b/arch/arm/mach-omap2/cm33xx.h
@@ -377,11 +377,11 @@
 
 
 #ifndef __ASSEMBLER__
-extern bool am33xx_cm_is_clkdm_in_hwsup(s16 inst, u16 cdoffs);
-extern void am33xx_cm_clkdm_enable_hwsup(s16 inst, u16 cdoffs);
-extern void am33xx_cm_clkdm_disable_hwsup(s16 inst, u16 cdoffs);
-extern void am33xx_cm_clkdm_force_sleep(s16 inst, u16 cdoffs);
-extern void am33xx_cm_clkdm_force_wakeup(s16 inst, u16 cdoffs);
+bool am33xx_cm_is_clkdm_in_hwsup(u16 inst, u16 cdoffs);
+void am33xx_cm_clkdm_enable_hwsup(u16 inst, u16 cdoffs);
+void am33xx_cm_clkdm_disable_hwsup(u16 inst, u16 cdoffs);
+void am33xx_cm_clkdm_force_sleep(u16 inst, u16 cdoffs);
+void am33xx_cm_clkdm_force_wakeup(u16 inst, u16 cdoffs);
 
 #if defined(CONFIG_SOC_AM33XX

[PATCH v4 03/11] ARM: OMAP2+: hwmod: AM335x: runtime register update

2013-09-26 Thread Afzal Mohammed
Most of IP's in AM335x is present on AM43x and so in those cases both
will use same hwmod database (except for a few cases where clock related
details differ), but there is difference w.r.t register offset between
these. Update register offsets at runtime based on the SoC detected to
help in sharing otherwise same hwmod.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 .../mach-omap2/omap_hwmod_33xx_43xx_common_data.h  |  2 +
 .../mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c | 77 ++
 arch/arm/mach-omap2/omap_hwmod_33xx_data.c |  1 +
 3 files changed, 80 insertions(+)

diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common_data.h 
b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common_data.h
index e873e72..a9a7902 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common_data.h
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common_data.h
@@ -157,4 +157,6 @@ extern struct omap_hwmod_class am33xx_spi_hwmod_class;
 extern struct omap_gpio_dev_attr gpio_dev_attr;
 extern struct omap2_mcspi_dev_attr mcspi_attrib;
 
+void omap_hwmod_am33xx_reg(void);
+
 #endif
diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c 
b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
index 3e70e9c..da40252 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
@@ -24,6 +24,10 @@
 #include prm33xx.h
 #include omap_hwmod_33xx_43xx_common_data.h
 
+#define CLKCTRL(oh, clkctrl) ((oh).prcm.omap4.clkctrl_offs = (clkctrl))
+#define RSTCTRL(oh, rstctrl) ((oh).prcm.omap4.rstctrl_offs = (rstctrl))
+#define RSTST(oh, rstst) ((oh).prcm.omap4.rstst_offs = (rstst))
+
 /*
  * 'l3' class
  * instance(s): l3_main, l3_s, l3_instr
@@ -1360,3 +1364,76 @@ struct omap_hwmod am33xx_wd_timer1_hwmod = {
},
},
 };
+
+static void omap_hwmod_am33xx_clkctrl(void)
+{
+   CLKCTRL(am33xx_uart2_hwmod, AM33XX_CM_PER_UART1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart3_hwmod, AM33XX_CM_PER_UART2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart4_hwmod, AM33XX_CM_PER_UART3_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart5_hwmod, AM33XX_CM_PER_UART4_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart6_hwmod, AM33XX_CM_PER_UART5_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_dcan0_hwmod, AM33XX_CM_PER_DCAN0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_dcan1_hwmod, AM33XX_CM_PER_DCAN1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_elm_hwmod, AM33XX_CM_PER_ELM_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_epwmss0_hwmod, AM33XX_CM_PER_EPWMSS0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_epwmss1_hwmod, AM33XX_CM_PER_EPWMSS1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_epwmss2_hwmod, AM33XX_CM_PER_EPWMSS2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gpio1_hwmod, AM33XX_CM_PER_GPIO1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gpio2_hwmod, AM33XX_CM_PER_GPIO2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gpio3_hwmod, AM33XX_CM_PER_GPIO3_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_i2c2_hwmod, AM33XX_CM_PER_I2C1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_i2c3_hwmod, AM33XX_CM_PER_I2C2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mailbox_hwmod, AM33XX_CM_PER_MAILBOX0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mcasp0_hwmod, AM33XX_CM_PER_MCASP0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mcasp1_hwmod, AM33XX_CM_PER_MCASP1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mmc0_hwmod, AM33XX_CM_PER_MMC0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mmc1_hwmod, AM33XX_CM_PER_MMC1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_spi0_hwmod, AM33XX_CM_PER_SPI0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_spi1_hwmod, AM33XX_CM_PER_SPI1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_spinlock_hwmod, AM33XX_CM_PER_SPINLOCK_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer2_hwmod, AM33XX_CM_PER_TIMER2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer3_hwmod, AM33XX_CM_PER_TIMER3_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer4_hwmod, AM33XX_CM_PER_TIMER4_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer5_hwmod, AM33XX_CM_PER_TIMER5_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer6_hwmod, AM33XX_CM_PER_TIMER6_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer7_hwmod, AM33XX_CM_PER_TIMER7_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_smartreflex0_hwmod,
+   AM33XX_CM_WKUP_SMARTREFLEX0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_smartreflex1_hwmod,
+   AM33XX_CM_WKUP_SMARTREFLEX1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart1_hwmod, AM33XX_CM_WKUP_UART0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer1_hwmod, AM33XX_CM_WKUP_TIMER1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_i2c1_hwmod, AM33XX_CM_WKUP_I2C0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_wd_timer1_hwmod, AM33XX_CM_WKUP_WDT1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_rtc_hwmod, AM33XX_CM_RTC_RTC_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mmc2_hwmod, AM33XX_CM_PER_MMC2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gpmc_hwmod, AM33XX_CM_PER_GPMC_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_l4_ls_hwmod, AM33XX_CM_PER_L4LS_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_l4_wkup_hwmod, AM33XX_CM_WKUP_L4WKUP_CLKCTRL_OFFSET);
+   CLKCTRL

[PATCH v4 04/11] ARM: OMAP2+: hwmod: AM335x: remove static register offs

2013-09-26 Thread Afzal Mohammed
Hwmod common to AM43x and AM335x has register offsets different. It is
now updated based on SoC detection at run time, hence remove statically
initialized ones.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 .../mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c | 57 --
 1 file changed, 57 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c 
b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
index da40252..598f813 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
@@ -44,7 +44,6 @@ struct omap_hwmod am33xx_l3_main_hwmod = {
.main_clk   = l3_gclk,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_PER_L3_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -66,7 +65,6 @@ struct omap_hwmod am33xx_l3_instr_hwmod = {
.main_clk   = l3_gclk,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_PER_L3_INSTR_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -89,7 +87,6 @@ struct omap_hwmod am33xx_l4_ls_hwmod = {
.main_clk   = l4ls_gclk,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_PER_L4LS_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -103,7 +100,6 @@ struct omap_hwmod am33xx_l4_wkup_hwmod = {
.flags  = (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET),
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_WKUP_L4WKUP_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -124,7 +120,6 @@ struct omap_hwmod am33xx_mpu_hwmod = {
.main_clk   = dpll_mpu_m2_ck,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_MPU_MPU_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -159,8 +154,6 @@ struct omap_hwmod am33xx_pruss_hwmod = {
.main_clk   = pruss_ocp_gclk,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_PER_PRUSS_CLKCTRL_OFFSET,
-   .rstctrl_offs   = AM33XX_RM_PER_RSTCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -185,9 +178,6 @@ struct omap_hwmod am33xx_gfx_hwmod = {
.main_clk   = gfx_fck_div_ck,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_GFX_GFX_CLKCTRL_OFFSET,
-   .rstctrl_offs   = AM33XX_RM_GFX_RSTCTRL_OFFSET,
-   .rstst_offs = AM33XX_RM_GFX_RSTST_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -232,7 +222,6 @@ struct omap_hwmod am33xx_aes0_hwmod = {
.main_clk   = aes0_fck,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_PER_AES0_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -258,7 +247,6 @@ struct omap_hwmod am33xx_sha0_hwmod = {
.main_clk   = l3_gclk,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_PER_SHA0_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -277,7 +265,6 @@ struct omap_hwmod am33xx_ocmcram_hwmod = {
.main_clk   = l3_gclk,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_PER_OCMCRAM_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -296,7 +283,6 @@ struct omap_hwmod am33xx_smartreflex0_hwmod = {
.main_clk   = smartreflex0_fck,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = 
AM33XX_CM_WKUP_SMARTREFLEX0_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -310,7 +296,6 @@ struct omap_hwmod am33xx_smartreflex1_hwmod = {
.main_clk   = smartreflex1_fck,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = 
AM33XX_CM_WKUP_SMARTREFLEX1_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -352,7 +337,6 @@ struct omap_hwmod am33xx_cpgmac0_hwmod = {
.mpu_rt_idx = 1,
.prcm   = {
.omap4  = {
-   .clkctrl_offs

[PATCH v4 05/11] ARM: OMAP2+: PRCM: AM43x definitions

2013-09-26 Thread Afzal Mohammed
Add AM43x CMINST, CDOFFS, RM_RSTST  RM_RSTCTRL definitions - minimal
ones that would be used.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/prcm43xx.h | 141 +
 1 file changed, 141 insertions(+)
 create mode 100644 arch/arm/mach-omap2/prcm43xx.h

diff --git a/arch/arm/mach-omap2/prcm43xx.h b/arch/arm/mach-omap2/prcm43xx.h
new file mode 100644
index 000..f0636ec
--- /dev/null
+++ b/arch/arm/mach-omap2/prcm43xx.h
@@ -0,0 +1,141 @@
+/*
+ * AM43x PRCM defines
+ *
+ * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed as is without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#ifndef __ARCH_ARM_MACH_OMAP2_PRCM_43XX_H
+#define __ARCH_ARM_MACH_OMAP2_PRCM_43XX_H
+
+#define AM43XX_PRM_PARTITION   1
+#define AM43XX_CM_PARTITION1
+
+/* PRM instances */
+#define AM43XX_PRM_OCP_SOCKET_INST 0x
+#define AM43XX_PRM_MPU_INST0x0300
+#define AM43XX_PRM_GFX_INST0x0400
+#define AM43XX_PRM_RTC_INST0x0500
+#define AM43XX_PRM_TAMPER_INST 0x0600
+#define AM43XX_PRM_CEFUSE_INST 0x0700
+#define AM43XX_PRM_PER_INST0x0800
+#define AM43XX_PRM_WKUP_INST   0x2000
+#define AM43XX_PRM_DEVICE_INST 0x4000
+
+/* RM RSTCTRL offsets */
+#define AM43XX_RM_PER_RSTCTRL_OFFSET   0x0010
+#define AM43XX_RM_GFX_RSTCTRL_OFFSET   0x0010
+#define AM43XX_RM_WKUP_RSTCTRL_OFFSET  0x0010
+
+/* RM RSTST offsets */
+#define AM43XX_RM_GFX_RSTST_OFFSET 0x0014
+#define AM43XX_RM_WKUP_RSTST_OFFSET0x0014
+
+/* CM instances */
+#define AM43XX_CM_WKUP_INST0x2800
+#define AM43XX_CM_DEVICE_INST  0x4100
+#define AM43XX_CM_DPLL_INST0x4200
+#define AM43XX_CM_MPU_INST 0x8300
+#define AM43XX_CM_GFX_INST 0x8400
+#define AM43XX_CM_RTC_INST 0x8500
+#define AM43XX_CM_TAMPER_INST  0x8600
+#define AM43XX_CM_CEFUSE_INST  0x8700
+#define AM43XX_CM_PER_INST 0x8800
+
+/* CD offsets */
+#define AM43XX_CM_WKUP_L3_AON_CDOFFS   0x
+#define AM43XX_CM_WKUP_L3S_TSC_CDOFFS  0x0100
+#define AM43XX_CM_WKUP_L4_WKUP_AON_CDOFFS  0x0200
+#define AM43XX_CM_WKUP_WKUP_CDOFFS 0x0300
+#define AM43XX_CM_MPU_MPU_CDOFFS   0x
+#define AM43XX_CM_GFX_GFX_L3_CDOFFS0x
+#define AM43XX_CM_RTC_RTC_CDOFFS   0x
+#define AM43XX_CM_TAMPER_TAMPER_CDOFFS 0x
+#define AM43XX_CM_CEFUSE_CEFUSE_CDOFFS 0x
+#define AM43XX_CM_PER_L3_CDOFFS0x
+#define AM43XX_CM_PER_L3S_CDOFFS   0x0200
+#define AM43XX_CM_PER_ICSS_CDOFFS  0x0300
+#define AM43XX_CM_PER_L4LS_CDOFFS  0x0400
+#define AM43XX_CM_PER_EMIF_CDOFFS  0x0700
+#define AM43XX_CM_PER_DSS_CDOFFS   0x0a00
+#define AM43XX_CM_PER_CPSW_CDOFFS  0x0b00
+#define AM43XX_CM_PER_OCPWP_L3_CDOFFS  0x0c00
+
+/* CLK CTRL offsets */
+#define AM43XX_CM_PER_UART1_CLKCTRL_OFFSET 0x0580
+#define AM43XX_CM_PER_UART2_CLKCTRL_OFFSET 0x0588
+#define AM43XX_CM_PER_UART3_CLKCTRL_OFFSET 0x0590
+#define AM43XX_CM_PER_UART4_CLKCTRL_OFFSET 0x0598
+#define AM43XX_CM_PER_UART5_CLKCTRL_OFFSET 0x05a0
+#define AM43XX_CM_PER_DCAN0_CLKCTRL_OFFSET 0x0428
+#define AM43XX_CM_PER_DCAN1_CLKCTRL_OFFSET 0x0430
+#define AM43XX_CM_PER_ELM_CLKCTRL_OFFSET   0x0468
+#define AM43XX_CM_PER_EPWMSS0_CLKCTRL_OFFSET   0x0438
+#define AM43XX_CM_PER_EPWMSS1_CLKCTRL_OFFSET   0x0440
+#define AM43XX_CM_PER_EPWMSS2_CLKCTRL_OFFSET   0x0448
+#define AM43XX_CM_PER_GPIO1_CLKCTRL_OFFSET 0x0478
+#define AM43XX_CM_PER_GPIO2_CLKCTRL_OFFSET 0x0480
+#define AM43XX_CM_PER_GPIO3_CLKCTRL_OFFSET 0x0488
+#define AM43XX_CM_PER_I2C1_CLKCTRL_OFFSET  0x04a8
+#define AM43XX_CM_PER_I2C2_CLKCTRL_OFFSET  0x04b0
+#define AM43XX_CM_PER_MAILBOX0_CLKCTRL_OFFSET  0x04b8
+#define AM43XX_CM_PER_MMC0_CLKCTRL_OFFSET  0x04c0
+#define AM43XX_CM_PER_MMC1_CLKCTRL_OFFSET  0x04c8
+#define AM43XX_CM_PER_SPI0_CLKCTRL_OFFSET  0x0500
+#define AM43XX_CM_PER_SPI1_CLKCTRL_OFFSET

[PATCH v4 07/11] ARM: OMAP2+: CM: AM43x clockdomain data

2013-09-26 Thread Afzal Mohammed
From: Ambresh K ambr...@ti.com

Add the data file to describe clock domains in AM43x SoC.
OMAP4 clockdomain operations is being reused here.

Signed-off-by: Ambresh K ambr...@ti.com
Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/clockdomain.h   |   2 +
 arch/arm/mach-omap2/clockdomains43xx_data.c | 196 
 arch/arm/mach-omap2/cminst44xx.c|   9 ++
 3 files changed, 207 insertions(+)
 create mode 100644 arch/arm/mach-omap2/clockdomains43xx_data.c

diff --git a/arch/arm/mach-omap2/clockdomain.h 
b/arch/arm/mach-omap2/clockdomain.h
index 5431b0c..f17f006 100644
--- a/arch/arm/mach-omap2/clockdomain.h
+++ b/arch/arm/mach-omap2/clockdomain.h
@@ -218,6 +218,7 @@ extern void __init am33xx_clockdomains_init(void);
 extern void __init omap44xx_clockdomains_init(void);
 extern void __init omap54xx_clockdomains_init(void);
 extern void __init dra7xx_clockdomains_init(void);
+void am43xx_clockdomains_init(void);
 
 extern void clkdm_add_autodeps(struct clockdomain *clkdm);
 extern void clkdm_del_autodeps(struct clockdomain *clkdm);
@@ -226,6 +227,7 @@ extern struct clkdm_ops omap2_clkdm_operations;
 extern struct clkdm_ops omap3_clkdm_operations;
 extern struct clkdm_ops omap4_clkdm_operations;
 extern struct clkdm_ops am33xx_clkdm_operations;
+extern struct clkdm_ops am43xx_clkdm_operations;
 
 extern struct clkdm_dep gfx_24xx_wkdeps[];
 extern struct clkdm_dep dsp_24xx_wkdeps[];
diff --git a/arch/arm/mach-omap2/clockdomains43xx_data.c 
b/arch/arm/mach-omap2/clockdomains43xx_data.c
new file mode 100644
index 000..6d71c60
--- /dev/null
+++ b/arch/arm/mach-omap2/clockdomains43xx_data.c
@@ -0,0 +1,196 @@
+/*
+ * AM43xx Clock domains framework
+ *
+ * Copyright (C) 2013 Texas Instruments, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include linux/kernel.h
+#include linux/io.h
+
+#include clockdomain.h
+#include prcm44xx.h
+#include prcm43xx.h
+
+static struct clockdomain l4_cefuse_43xx_clkdm = {
+   .name = l4_cefuse_clkdm,
+   .pwrdm= { .name = cefuse_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_CEFUSE_INST,
+   .clkdm_offs   = AM43XX_CM_CEFUSE_CEFUSE_CDOFFS,
+   .flags= CLKDM_CAN_SWSUP,
+};
+
+static struct clockdomain mpu_43xx_clkdm = {
+   .name = mpu_clkdm,
+   .pwrdm= { .name = mpu_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_MPU_INST,
+   .clkdm_offs   = AM43XX_CM_MPU_MPU_CDOFFS,
+   .flags= CLKDM_CAN_HWSUP_SWSUP,
+};
+
+static struct clockdomain l4ls_43xx_clkdm = {
+   .name = l4ls_clkdm,
+   .pwrdm= { .name = per_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_PER_INST,
+   .clkdm_offs   = AM43XX_CM_PER_L4LS_CDOFFS,
+   .flags= CLKDM_CAN_SWSUP,
+};
+
+static struct clockdomain tamper_43xx_clkdm = {
+   .name = tamper_clkdm,
+   .pwrdm= { .name = tamper_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_TAMPER_INST,
+   .clkdm_offs   = AM43XX_CM_TAMPER_TAMPER_CDOFFS,
+   .flags= CLKDM_CAN_SWSUP,
+};
+
+static struct clockdomain l4_rtc_43xx_clkdm = {
+   .name = l4_rtc_clkdm,
+   .pwrdm= { .name = rtc_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_RTC_INST,
+   .clkdm_offs   = AM43XX_CM_RTC_RTC_CDOFFS,
+   .flags= CLKDM_CAN_SWSUP,
+};
+
+static struct clockdomain pruss_ocp_43xx_clkdm = {
+   .name = pruss_ocp_clkdm,
+   .pwrdm= { .name = per_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_PER_INST,
+   .clkdm_offs   = AM43XX_CM_PER_ICSS_CDOFFS,
+   .flags= CLKDM_CAN_SWSUP,
+};
+
+static struct clockdomain ocpwp_l3_43xx_clkdm = {
+   .name = ocpwp_l3_clkdm,
+   .pwrdm= { .name = per_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_PER_INST,
+   .clkdm_offs   = AM43XX_CM_PER_OCPWP_L3_CDOFFS,
+   .flags= CLKDM_CAN_SWSUP,
+};
+
+static struct clockdomain l3s_tsc_43xx_clkdm = {
+   .name = l3s_tsc_clkdm,
+   .pwrdm= { .name = wkup_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_WKUP_INST,
+   .clkdm_offs   = AM43XX_CM_WKUP_L3S_TSC_CDOFFS,
+   .flags= CLKDM_CAN_SWSUP,
+};
+
+static struct clockdomain dss_43xx_clkdm = {
+   .name = dss_clkdm,
+   .pwrdm

[PATCH v4 06/11] ARM: OMAP2+: PM: AM43x powerdomain data

2013-09-26 Thread Afzal Mohammed
From: Ambresh K ambr...@ti.com

Add the data file to describe all power domains in AM43x SoC.
OMAP4 powerdomain operations is being reused here.

Signed-off-by: Ambresh K ambr...@ti.com
Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/powerdomain.h   |   1 +
 arch/arm/mach-omap2/powerdomains43xx_data.c | 142 
 2 files changed, 143 insertions(+)
 create mode 100644 arch/arm/mach-omap2/powerdomains43xx_data.c

diff --git a/arch/arm/mach-omap2/powerdomain.h 
b/arch/arm/mach-omap2/powerdomain.h
index baf3d8b..da5a59a 100644
--- a/arch/arm/mach-omap2/powerdomain.h
+++ b/arch/arm/mach-omap2/powerdomain.h
@@ -257,6 +257,7 @@ extern void am33xx_powerdomains_init(void);
 extern void omap44xx_powerdomains_init(void);
 extern void omap54xx_powerdomains_init(void);
 extern void dra7xx_powerdomains_init(void);
+void am43xx_powerdomains_init(void);
 
 extern struct pwrdm_ops omap2_pwrdm_operations;
 extern struct pwrdm_ops omap3_pwrdm_operations;
diff --git a/arch/arm/mach-omap2/powerdomains43xx_data.c 
b/arch/arm/mach-omap2/powerdomains43xx_data.c
new file mode 100644
index 000..febc879
--- /dev/null
+++ b/arch/arm/mach-omap2/powerdomains43xx_data.c
@@ -0,0 +1,142 @@
+/*
+ * AM43xx Power domains framework
+ *
+ * Copyright (C) 2013 Texas Instruments, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include linux/kernel.h
+#include linux/init.h
+
+#include powerdomain.h
+
+#include prcm-common.h
+#include prcm44xx.h
+#include prcm43xx.h
+
+static struct powerdomain gfx_43xx_pwrdm = {
+   .name = gfx_pwrdm,
+   .voltdm   = { .name = core },
+   .prcm_offs= AM43XX_PRM_GFX_INST,
+   .prcm_partition   = AM43XX_PRM_PARTITION,
+   .pwrsts   = PWRSTS_OFF_ON,
+   .banks= 1,
+   .pwrsts_mem_ret = {
+   [0] = PWRSTS_OFF_RET,   /* gfx_mem */
+   },
+   .pwrsts_mem_on  = {
+   [0] = PWRSTS_ON,/* gfx_mem */
+   },
+   .flags= PWRDM_HAS_LOWPOWERSTATECHANGE,
+};
+
+static struct powerdomain mpu_43xx_pwrdm = {
+   .name = mpu_pwrdm,
+   .voltdm   = { .name = mpu },
+   .prcm_offs= AM43XX_PRM_MPU_INST,
+   .prcm_partition   = AM43XX_PRM_PARTITION,
+   .pwrsts   = PWRSTS_OFF_RET_ON,
+   .pwrsts_logic_ret = PWRSTS_OFF_RET,
+   .banks= 3,
+   .pwrsts_mem_ret = {
+   [0] = PWRSTS_OFF_RET,   /* mpu_l1 */
+   [1] = PWRSTS_OFF_RET,   /* mpu_l2 */
+   [2] = PWRSTS_OFF_RET,   /* mpu_ram */
+   },
+   .pwrsts_mem_on  = {
+   [0] = PWRSTS_ON,/* mpu_l1 */
+   [1] = PWRSTS_ON,/* mpu_l2 */
+   [2] = PWRSTS_ON,/* mpu_ram */
+   },
+   .flags= PWRDM_HAS_LOWPOWERSTATECHANGE,
+};
+
+static struct powerdomain rtc_43xx_pwrdm = {
+   .name = rtc_pwrdm,
+   .voltdm   = { .name = rtc },
+   .prcm_offs= AM43XX_PRM_RTC_INST,
+   .prcm_partition   = AM43XX_PRM_PARTITION,
+   .pwrsts   = PWRSTS_ON,
+};
+
+static struct powerdomain wkup_43xx_pwrdm = {
+   .name = wkup_pwrdm,
+   .voltdm   = { .name = core },
+   .prcm_offs= AM43XX_PRM_WKUP_INST,
+   .prcm_partition   = AM43XX_PRM_PARTITION,
+   .pwrsts   = PWRSTS_ON,
+   .banks= 1,
+   .pwrsts_mem_ret = {
+   [0] = PWRSTS_OFF,   /* debugss_mem */
+   },
+   .pwrsts_mem_on  = {
+   [0] = PWRSTS_ON,/* debugss_mem */
+   },
+};
+
+static struct powerdomain tamper_43xx_pwrdm = {
+   .name = tamper_pwrdm,
+   .voltdm   = { .name = tamper },
+   .prcm_offs= AM43XX_PRM_TAMPER_INST,
+   .prcm_partition   = AM43XX_PRM_PARTITION,
+   .pwrsts   = PWRSTS_ON,
+};
+
+static struct powerdomain cefuse_43xx_pwrdm = {
+   .name = cefuse_pwrdm,
+   .voltdm   = { .name = core },
+   .prcm_offs= AM43XX_PRM_CEFUSE_INST,
+   .prcm_partition   = AM43XX_PRM_PARTITION,
+   .pwrsts   = PWRSTS_OFF_ON,
+   .flags= PWRDM_HAS_LOWPOWERSTATECHANGE,
+};
+
+static struct powerdomain per_43xx_pwrdm = {
+   .name = per_pwrdm,
+   .voltdm   = { .name = core },
+   .prcm_offs= AM43XX_PRM_PER_INST,
+   .prcm_partition   = AM43XX_PRM_PARTITION,
+   .pwrsts   = PWRSTS_OFF_RET_ON,
+   .pwrsts_logic_ret = PWRSTS_OFF_RET,
+   .banks= 4,
+   .pwrsts_mem_ret = {
+   [0] = PWRSTS_OFF_RET,   /* icss_mem */
+   [1] = PWRSTS_OFF_RET,   /* per_mem */
+   [2] = PWRSTS_OFF_RET,   /* ram1_mem

[PATCH v4 09/11] ARM: OMAP2+: hwmod: AM43x operations

2013-09-26 Thread Afzal Mohammed
Reuse OMAP4 operations on AM43x.

Context related ops are not used on AM43x, as this would not add value
when using DT and AM43x is DT only boot. This additionally helps not to
add context register offset for each hwmod.

Signed-off-by: Ambresh K ambr...@ti.com
Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index d9ee0ff..aa593da 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -4125,6 +4125,14 @@ void __init omap_hwmod_init(void)
soc_ops.init_clkdm = _init_clkdm;
soc_ops.update_context_lost = _omap4_update_context_lost;
soc_ops.get_context_lost = _omap4_get_context_lost;
+   } else if (soc_is_am43xx()) {
+   soc_ops.enable_module = _omap4_enable_module;
+   soc_ops.disable_module = _omap4_disable_module;
+   soc_ops.wait_target_ready = _omap4_wait_target_ready;
+   soc_ops.assert_hardreset = _omap4_assert_hardreset;
+   soc_ops.deassert_hardreset = _omap4_deassert_hardreset;
+   soc_ops.is_hardreset_asserted = _omap4_is_hardreset_asserted;
+   soc_ops.init_clkdm = _init_clkdm;
} else if (soc_is_am33xx()) {
soc_ops.enable_module = _am33xx_enable_module;
soc_ops.disable_module = _am33xx_disable_module;
-- 
1.8.3.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 08/11] ARM: OMAP2+: hwmod: AM43x support

2013-09-26 Thread Afzal Mohammed
Add hwmod support for IP's that are present in AM43x, but not in AM335x.
AM43x additional ones added here are,
1. synctimer
2. timer8-11
3. ehrpwm3-5
4. spi2-4
5. gpio4-5

AM43x pruss interconnect which is different as compared to AM335x, has
been taken care.

And register offsets for same hwmod's shared with AM335x is different,
AM43x register offsets are updated appropriately.

ocp clock of those in l4_wkup is fed from sys_clkin_ck instead of
dpll_core_m4_div2_ck, so ocpif for those in AM43x l4_wkup has been
added seperately.

hwmod's has been added for those that have main clock (wkup_m3, control,
gpio0) and clock domain (l4_hs) different from AM335x. debugss and
adc_tsc that have different clocks and clockdomains repectively has not
been added due to the reasons mentioned below.

AM43x also has IP's like qspi, hdq1w, vpfe, des, rng, usb, dss, debugss,
adc_tsc. These are not handled here due to both/either of following
reasons,
1. To avoid churn; most of them don't have DT bindings, which would
   necessitate adding address space in hwmod, which any way would have
   to be removed once DT bindings happen with driver support.
2. patches would come in from sources other than the author

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod.h   |   1 +
 .../mach-omap2/omap_hwmod_33xx_43xx_common_data.h  |   1 +
 .../mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c |  74 +++
 arch/arm/mach-omap2/omap_hwmod_43xx_data.c | 622 +
 4 files changed, 698 insertions(+)
 create mode 100644 arch/arm/mach-omap2/omap_hwmod_43xx_data.c

diff --git a/arch/arm/mach-omap2/omap_hwmod.h b/arch/arm/mach-omap2/omap_hwmod.h
index d02acf9..0f97d63 100644
--- a/arch/arm/mach-omap2/omap_hwmod.h
+++ b/arch/arm/mach-omap2/omap_hwmod.h
@@ -752,6 +752,7 @@ extern int omap44xx_hwmod_init(void);
 extern int omap54xx_hwmod_init(void);
 extern int am33xx_hwmod_init(void);
 extern int dra7xx_hwmod_init(void);
+int am43xx_hwmod_init(void);
 
 extern int __init omap_hwmod_register_links(struct omap_hwmod_ocp_if **ois);
 
diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common_data.h 
b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common_data.h
index a9a7902..130332c 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common_data.h
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common_data.h
@@ -158,5 +158,6 @@ extern struct omap_gpio_dev_attr gpio_dev_attr;
 extern struct omap2_mcspi_dev_attr mcspi_attrib;
 
 void omap_hwmod_am33xx_reg(void);
+void omap_hwmod_am43xx_reg(void);
 
 #endif
diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c 
b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
index 598f813..d080bef 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
@@ -23,6 +23,7 @@
 #include cm33xx.h
 #include prm33xx.h
 #include omap_hwmod_33xx_43xx_common_data.h
+#include prcm43xx.h
 
 #define CLKCTRL(oh, clkctrl) ((oh).prcm.omap4.clkctrl_offs = (clkctrl))
 #define RSTCTRL(oh, rstctrl) ((oh).prcm.omap4.rstctrl_offs = (rstctrl))
@@ -1380,3 +1381,76 @@ void omap_hwmod_am33xx_reg(void)
omap_hwmod_am33xx_clkctrl();
omap_hwmod_am33xx_rst();
 }
+
+static void omap_hwmod_am43xx_clkctrl(void)
+{
+   CLKCTRL(am33xx_uart2_hwmod, AM43XX_CM_PER_UART1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart3_hwmod, AM43XX_CM_PER_UART2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart4_hwmod, AM43XX_CM_PER_UART3_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart5_hwmod, AM43XX_CM_PER_UART4_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart6_hwmod, AM43XX_CM_PER_UART5_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_dcan0_hwmod, AM43XX_CM_PER_DCAN0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_dcan1_hwmod, AM43XX_CM_PER_DCAN1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_elm_hwmod, AM43XX_CM_PER_ELM_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_epwmss0_hwmod, AM43XX_CM_PER_EPWMSS0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_epwmss1_hwmod, AM43XX_CM_PER_EPWMSS1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_epwmss2_hwmod, AM43XX_CM_PER_EPWMSS2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gpio1_hwmod, AM43XX_CM_PER_GPIO1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gpio2_hwmod, AM43XX_CM_PER_GPIO2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gpio3_hwmod, AM43XX_CM_PER_GPIO3_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_i2c2_hwmod, AM43XX_CM_PER_I2C1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_i2c3_hwmod, AM43XX_CM_PER_I2C2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mailbox_hwmod, AM43XX_CM_PER_MAILBOX0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mcasp0_hwmod, AM43XX_CM_PER_MCASP0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mcasp1_hwmod, AM43XX_CM_PER_MCASP1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mmc0_hwmod, AM43XX_CM_PER_MMC0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mmc1_hwmod, AM43XX_CM_PER_MMC1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_spi0_hwmod, AM43XX_CM_PER_SPI0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_spi1_hwmod, AM43XX_CM_PER_SPI1_CLKCTRL_OFFSET);
+   CLKCTRL

[PATCH v4 10/11] ARM: OMAP2+: AM43x: PRCM kbuild

2013-09-26 Thread Afzal Mohammed
Build AM43x power domain, clock domain and hwmod data.

Many of AM43x IP's and interconnects are similar as that in AM335x,
hence AM335x hwmod data is being reused with necessary changes.

Earlier the plan was to reuse AM335x specific PRCM code, but as AM43x
PRCM register layout is much similar to OMAP4/5, AM335x PRCM is
divorced and instead married with OMAP4/5 PRCM for AM43x.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/Makefile | 7 ++-
 arch/arm/mach-omap2/cm33xx.h | 2 +-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 0746494..cb7b527 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -112,13 +112,13 @@ obj-$(CONFIG_ARCH_OMAP2)  += prm2xxx_3xxx.o 
prm2xxx.o cm2xxx.o
 obj-$(CONFIG_ARCH_OMAP3)   += prm2xxx_3xxx.o prm3xxx.o cm3xxx.o
 obj-$(CONFIG_ARCH_OMAP3)   += vc3xxx_data.o vp3xxx_data.o
 obj-$(CONFIG_SOC_AM33XX)   += prm33xx.o cm33xx.o
-obj-$(CONFIG_SOC_AM43XX)   += prm33xx.o cm33xx.o
 omap-prcm-4-5-common   =  cminst44xx.o cm44xx.o prm44xx.o \
   prcm_mpu44xx.o prminst44xx.o \
   vc44xx_data.o vp44xx_data.o
 obj-$(CONFIG_ARCH_OMAP4)   += $(omap-prcm-4-5-common)
 obj-$(CONFIG_SOC_OMAP5)+= $(omap-prcm-4-5-common)
 obj-$(CONFIG_SOC_DRA7XX)   += $(omap-prcm-4-5-common)
+obj-$(CONFIG_SOC_AM43XX)   += $(omap-prcm-4-5-common)
 
 # OMAP voltage domains
 voltagedomain-common   := voltage.o vc.o vp.o
@@ -146,6 +146,7 @@ obj-$(CONFIG_ARCH_OMAP4)+= 
powerdomains44xx_data.o
 obj-$(CONFIG_SOC_AM33XX)   += $(powerdomain-common)
 obj-$(CONFIG_SOC_AM33XX)   += powerdomains33xx_data.o
 obj-$(CONFIG_SOC_AM43XX)   += $(powerdomain-common)
+obj-$(CONFIG_SOC_AM43XX)   += powerdomains43xx_data.o
 obj-$(CONFIG_SOC_OMAP5)+= $(powerdomain-common)
 obj-$(CONFIG_SOC_OMAP5)+= powerdomains54xx_data.o
 obj-$(CONFIG_SOC_DRA7XX)   += $(powerdomain-common)
@@ -165,6 +166,7 @@ obj-$(CONFIG_ARCH_OMAP4)+= 
clockdomains44xx_data.o
 obj-$(CONFIG_SOC_AM33XX)   += $(clockdomain-common)
 obj-$(CONFIG_SOC_AM33XX)   += clockdomains33xx_data.o
 obj-$(CONFIG_SOC_AM43XX)   += $(clockdomain-common)
+obj-$(CONFIG_SOC_AM43XX)   += clockdomains43xx_data.o
 obj-$(CONFIG_SOC_OMAP5)+= $(clockdomain-common)
 obj-$(CONFIG_SOC_OMAP5)+= clockdomains54xx_data.o
 obj-$(CONFIG_SOC_DRA7XX)   += $(clockdomain-common)
@@ -212,6 +214,9 @@ obj-$(CONFIG_ARCH_OMAP3)+= 
omap_hwmod_3xxx_data.o
 obj-$(CONFIG_SOC_AM33XX)   += omap_hwmod_33xx_data.o
 obj-$(CONFIG_SOC_AM33XX)   += 
omap_hwmod_33xx_43xx_interconnect_data.o
 obj-$(CONFIG_SOC_AM33XX)   += omap_hwmod_33xx_43xx_ipblock_data.o
+obj-$(CONFIG_SOC_AM43XX)   += omap_hwmod_43xx_data.o
+obj-$(CONFIG_SOC_AM43XX)   += 
omap_hwmod_33xx_43xx_interconnect_data.o
+obj-$(CONFIG_SOC_AM43XX)   += omap_hwmod_33xx_43xx_ipblock_data.o
 obj-$(CONFIG_ARCH_OMAP4)   += omap_hwmod_44xx_data.o
 obj-$(CONFIG_SOC_OMAP5)+= omap_hwmod_54xx_data.o
 obj-$(CONFIG_SOC_DRA7XX)   += omap_hwmod_7xx_data.o
diff --git a/arch/arm/mach-omap2/cm33xx.h b/arch/arm/mach-omap2/cm33xx.h
index 757320b..cfb8891 100644
--- a/arch/arm/mach-omap2/cm33xx.h
+++ b/arch/arm/mach-omap2/cm33xx.h
@@ -383,7 +383,7 @@ void am33xx_cm_clkdm_disable_hwsup(u16 inst, u16 cdoffs);
 void am33xx_cm_clkdm_force_sleep(u16 inst, u16 cdoffs);
 void am33xx_cm_clkdm_force_wakeup(u16 inst, u16 cdoffs);
 
-#if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)
+#ifdef CONFIG_SOC_AM33XX
 extern int am33xx_cm_wait_module_idle(u16 inst, s16 cdoffs,
u16 clkctrl_offs);
 extern void am33xx_cm_module_enable(u8 mode, u16 inst, s16 cdoffs,
-- 
1.8.3.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 11/11] ARM: OMAP2+: AM43x PRCM init

2013-09-26 Thread Afzal Mohammed
From: Ambresh K ambr...@ti.com

Initialise AM43x HWMOD, powerdomains and clockdomains.

Signed-off-by: Ambresh K ambr...@ti.com
Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/io.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index ff2113c..c90f647 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -594,7 +594,13 @@ void __init am43xx_init_early(void)
  NULL);
omap2_set_globals_prm(AM33XX_L4_WK_IO_ADDRESS(AM43XX_PRCM_BASE));
omap2_set_globals_cm(AM33XX_L4_WK_IO_ADDRESS(AM43XX_PRCM_BASE), NULL);
+   omap_prm_base_init();
+   omap_cm_base_init();
omap3xxx_check_revision();
+   am43xx_powerdomains_init();
+   am43xx_clockdomains_init();
+   am43xx_hwmod_init();
+   omap_hwmod_init_postsetup();
 }
 #endif
 
-- 
1.8.3.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 00/11] ARM: OMAP2+: AM43x PRCM basic support

2013-09-26 Thread Afzal Mohammed
Hi,

It seems,
[PATCH v4 02/11] ARM: OMAP2+: hwmod: AM335x/AM43x: move common data
is held on LAKML for moderator approval due to big size.

I will wait for some time to see if moderator approves, if not, will
ping him (believe it is David Woodhouse), but not sure how to get it
into omap list though.

Changes are also available
@git://gitorious.org/x0148406-public/linux-kernel.git tags/am43x-prcm-v4

Regards
Afzal

On Thursday 26 September 2013 02:58 PM, Afzal Mohammed wrote:
 Hi Paul, Benoit, Tony,
 
 This series adds PRCM support (except clock tree) for AM43x SoC's.
 Current version is based on Rajendra's comments and discussions, please
 consider this for inclusion in the coming merge window.
 
 Major changes compared to v2 (v3 was only an rfc for current approach):
 1. omap_hwmod_33xx_43xx_interconnect_data.c has the common interconnect
ocp's structs shared between AM335x and AM43x
 2. omap_hwmod_33xx_43xx_ipblock_data.c has the common hwmod structs
shared between AM335x and AM43x
 3. Instances where clock domain or clock topology has changed in the few
cases, have separate structures for AM335x and AM43x
 4. To handle scenarios where register offsets are different, they are
dynamically init-ed in omap_hwmod_33xx_43xx_ipblock_data.c
 5. Register offsets for hwmod's that are present either in AM335x or
AM43x are updated statically in omap_hwmod_33xx_data.c or
omap_hwmod_43xx_data.c as that was cleaner.
 
 Major changes compared to rfc v3:
 1. All register offsets properly taken care for AM43x (with rfc v3, a
couple of issues was detected while testing on pre-silicon)
 2. There were two patches for common hwmod data movement (one for
interconnect and other for ip block data), both were combined to have
a cleaner series that is bisectable.
 3. Cleaner seperation of common data
 
 This series has been boot tested on pre-silicon platform with the help
 of Tero's DT clock tree conversion series. This series has been tested
 on AM335x-EVM too.
 
 The change that re-introduces SW_SLEEP for OMAP4 has been left out from
 this series as it is the only potential change that affect other
 platforms. It will be taken care seperately.
 
 Additional details:
 AM43x reuses most of the IP's from AM335x, as that is the case, much of
 the AM335x hwmod data is reused. As AM43x PRCM register layout differs
 from AM335x and is similar to OMAP4, power domain, clock domain  hwmod
 operations are reused from OMAP4. Currently there is no public TRM
 available for AM43x.
 
 Changes based on: v3.12-rc2
 
 Regards
 Afzal
 
 Afzal Mohammed (7):
   ARM: OMAP2+: hwmod: AM335x/AM43x: move common data
   ARM: OMAP2+: hwmod: AM335x: runtime register update
   ARM: OMAP2+: hwmod: AM335x: remove static register offs
   ARM: OMAP2+: PRCM: AM43x definitions
   ARM: OMAP2+: hwmod: AM43x support
   ARM: OMAP2+: hwmod: AM43x operations
   ARM: OMAP2+: AM43x: PRCM kbuild
 
 Ambresh K (3):
   ARM: OMAP2+: PM: AM43x powerdomain data
   ARM: OMAP2+: CM: AM43x clockdomain data
   ARM: OMAP2+: AM43x PRCM init
 
 Ankur Kishore (1):
   ARM: OMAP2+: CM: cm_inst offset s16-u16
 
  arch/arm/mach-omap2/Makefile   |9 +-
  arch/arm/mach-omap2/clockdomain.h  |4 +-
  arch/arm/mach-omap2/clockdomains43xx_data.c|  196 ++
  arch/arm/mach-omap2/cm33xx.c   |   16 +-
  arch/arm/mach-omap2/cm33xx.h   |   12 +-
  arch/arm/mach-omap2/cminst44xx.c   |   29 +-
  arch/arm/mach-omap2/cminst44xx.h   |   26 +-
  arch/arm/mach-omap2/io.c   |6 +
  arch/arm/mach-omap2/omap_hwmod.c   |8 +
  arch/arm/mach-omap2/omap_hwmod.h   |1 +
  .../mach-omap2/omap_hwmod_33xx_43xx_common_data.h  |  163 ++
  .../omap_hwmod_33xx_43xx_interconnect_data.c   |  643 +++
  .../mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c | 1456 +++
  arch/arm/mach-omap2/omap_hwmod_33xx_data.c | 1966 
 +---
  arch/arm/mach-omap2/omap_hwmod_43xx_data.c |  622 +++
  arch/arm/mach-omap2/powerdomain.h  |1 +
  arch/arm/mach-omap2/powerdomains43xx_data.c|  142 ++
  arch/arm/mach-omap2/prcm43xx.h |  141 ++
  18 files changed, 3438 insertions(+), 2003 deletions(-)
  create mode 100644 arch/arm/mach-omap2/clockdomains43xx_data.c
  create mode 100644 arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common_data.h
  create mode 100644 
 arch/arm/mach-omap2/omap_hwmod_33xx_43xx_interconnect_data.c
  create mode 100644 arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
  create mode 100644 arch/arm/mach-omap2/omap_hwmod_43xx_data.c
  create mode 100644 arch/arm/mach-omap2/powerdomains43xx_data.c
  create mode 100644 arch/arm/mach-omap2/prcm43xx.h
 

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http

Re: [PATCH RFC v3 08/12] ARM: OMAP2+: CM: AM43x clockdomain data

2013-09-17 Thread Afzal Mohammed
Hi Nishant,

On Monday 16 September 2013 08:56 PM, Nishanth Menon wrote:
 On 09/16/2013 08:48 AM, Afzal Mohammed wrote:

 From: Ambresh K ambr...@ti.com

 Add the data file to describe clock domains in AM43x SoC.
 OMAP4 clockdomain operations is being reused here.

 Signed-off-by: Ambresh K ambr...@ti.com
 Signed-off-by: Afzal Mohammed af...@ti.com
 ---
  arch/arm/mach-omap2/clockdomain.h   |   2 +
  arch/arm/mach-omap2/clockdomains43xx_data.c | 199 
 
  arch/arm/mach-omap2/cminst44xx.c|   9 ++
  3 files changed, 210 insertions(+)
  create mode 100644 arch/arm/mach-omap2/clockdomains43xx_data.c
 
 I suggest we drop this. this can be addressed by Tero's clk series.

Probably you misunderstood clock domain data as clock data, as Tero's
series does not take care of clock domain data, we would require this.

Regards
Afzal

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RFC v3 00/12] ARM: OMAP2+: AM43x PRCM basic support

2013-09-16 Thread Afzal Mohammed
Hi Paul, Benoit,

This series adds PRCM support for AM43x SoC's. It has been modified
as compared to last version based on Rajendra's comments and discussion
with him, please let me know your comments on this series.

Major changes (as compared to v2):
1. omap_hwmod_33xx_43xx_interconnect_data.c has all the common
   interconnect ocp's structs shared between AM335x and AM43x
2. omap_hwmod_33xx_43xx_ipblock_data.c has all the common hwmod structs
   shared between AM335x and AM43x
3. Instances where clock domain or clock topology has changed in the few
   cases, have separate structures for AM335x and AM43x
4. To handle scenarios where register offsets are different, they are
   dynamically init-ed in omap_hwmod_33xx_43xx_ipblock_data.c
5. Register offsets for hwmod's that are present either in AM335x or
   AM43x are updated statically in omap_hwmod_33xx_data.c or
   omap_hwmod_43xx_data.c as that was cleaner.

Please note that this series is only compile tested, yet to be tested on
pre-silicon platform (hence RFC), testing on pre-silicon platform takes
huge amount of time (1 second realtime ~ 1 hour on pre-silicon). Here
the intention is to get early feedback on the approach taken for hwmod.

This series has been boot tested on AM335x-EVM.

And the diffstat is now +1500 (+3500 -2000).

The change that re-introduces SW_SLEEP for OMAP4 has been left out from
this series, it will be properly taken care in the next version - as
here main intention is to know acceptability of approach towards hwmod.


Some more details:
AM43x reuses most of the IP's from AM335x, as that is the case, much of
the AM335x hwmod data is reused. As AM43x PRCM register layout differs
from AM335x and is similar to OMAP4, power domain, clock domain  hwmod
operations are reused from OMAP4. Currently there is no public TRM
available for AM43x.


Regards
Afzal


Afzal Mohammed (8):
  ARM: OMAP2+: hwmod: AM335x/AM43x: move common ocpif
  ARM: OMAP2+: hwmod: AM335x/AM43x: move common hwmod
  ARM: OMAP2+: hwmod: AM335x: runtime register update
  ARM: OMAP2+: hwmod: AM335x: remove static register offs
  ARM: OMAP2+: PRCM: AM43x definitions
  ARM: OMAP2+: hwmod: AM43x support
  ARM: OMAP2+: hwmod: AM43x operations
  ARM: OMAP2+: AM43x: PRCM kbuild

Ambresh K (3):
  ARM: OMAP2+: PM: AM43x powerdomain data
  ARM: OMAP2+: CM: AM43x clockdomain data
  ARM: OMAP2+: AM43x PRCM init

Ankur Kishore (1):
  ARM: OMAP2+: CM: cm_inst offset s16-u16

 arch/arm/mach-omap2/Makefile   |9 +-
 arch/arm/mach-omap2/clockdomain.h  |4 +-
 arch/arm/mach-omap2/clockdomains43xx_data.c|  199 ++
 arch/arm/mach-omap2/cm33xx.c   |   30 +-
 arch/arm/mach-omap2/cm33xx.h   |   28 +-
 arch/arm/mach-omap2/cminst44xx.c   |   40 +-
 arch/arm/mach-omap2/cminst44xx.h   |   25 +-
 arch/arm/mach-omap2/io.c   |6 +
 arch/arm/mach-omap2/omap_hwmod.c   |8 +
 arch/arm/mach-omap2/omap_hwmod.h   |1 +
 arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common.h  |  157 ++
 .../omap_hwmod_33xx_43xx_interconnect_data.c   |  656 +++
 .../mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c | 1475 +++
 arch/arm/mach-omap2/omap_hwmod_33xx_data.c | 1969 +---
 arch/arm/mach-omap2/omap_hwmod_43xx_data.c |  645 +++
 arch/arm/mach-omap2/powerdomain.h  |1 +
 arch/arm/mach-omap2/powerdomains43xx_data.c|  145 ++
 arch/arm/mach-omap2/prcm43xx.h |  141 ++
 18 files changed, 3514 insertions(+), 2025 deletions(-)
 create mode 100644 arch/arm/mach-omap2/clockdomains43xx_data.c
 create mode 100644 arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common.h
 create mode 100644 arch/arm/mach-omap2/omap_hwmod_33xx_43xx_interconnect_data.c
 create mode 100644 arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
 create mode 100644 arch/arm/mach-omap2/omap_hwmod_43xx_data.c
 create mode 100644 arch/arm/mach-omap2/powerdomains43xx_data.c
 create mode 100644 arch/arm/mach-omap2/prcm43xx.h

-- 
1.8.3.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RFC v3 01/12] ARM: OMAP2+: CM: cm_inst offset s16-u16

2013-09-16 Thread Afzal Mohammed
From: Ankur Kishore a-kish...@ti.com

Most of the AM43x CM reg address offsets are with MSB bit '1' (on
16-bit value) leading to arithmetic miscalculations while calculating
CLOCK ENABLE register's address because cm_inst field was a type of
const s16, so make it const u16.

Also modify relevant functions so as to take care of the above.

Signed-off-by: Ankur Kishore a-kish...@ti.com
Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/clockdomain.h |  2 +-
 arch/arm/mach-omap2/cm33xx.c  | 30 +++---
 arch/arm/mach-omap2/cm33xx.h  | 26 +-
 arch/arm/mach-omap2/cminst44xx.c  | 31 ---
 arch/arm/mach-omap2/cminst44xx.h  | 25 +
 5 files changed, 58 insertions(+), 56 deletions(-)

diff --git a/arch/arm/mach-omap2/clockdomain.h 
b/arch/arm/mach-omap2/clockdomain.h
index 4b03394..5431b0c 100644
--- a/arch/arm/mach-omap2/clockdomain.h
+++ b/arch/arm/mach-omap2/clockdomain.h
@@ -132,7 +132,7 @@ struct clockdomain {
u8 _flags;
const u8 dep_bit;
const u8 prcm_partition;
-   const s16 cm_inst;
+   const u16 cm_inst;
const u16 clkdm_offs;
struct clkdm_dep *wkdep_srcs;
struct clkdm_dep *sleepdep_srcs;
diff --git a/arch/arm/mach-omap2/cm33xx.c b/arch/arm/mach-omap2/cm33xx.c
index 325a515..59f276d 100644
--- a/arch/arm/mach-omap2/cm33xx.c
+++ b/arch/arm/mach-omap2/cm33xx.c
@@ -48,13 +48,13 @@
 /* Private functions */
 
 /* Read a register in a CM instance */
-static inline u32 am33xx_cm_read_reg(s16 inst, u16 idx)
+static inline u32 am33xx_cm_read_reg(u16 inst, u16 idx)
 {
return __raw_readl(cm_base + inst + idx);
 }
 
 /* Write into a register in a CM */
-static inline void am33xx_cm_write_reg(u32 val, s16 inst, u16 idx)
+static inline void am33xx_cm_write_reg(u32 val, u16 inst, u16 idx)
 {
__raw_writel(val, cm_base + inst + idx);
 }
@@ -82,7 +82,7 @@ static inline u32 am33xx_cm_clear_reg_bits(u32 bits, s16 
inst, s16 idx)
return am33xx_cm_rmw_reg_bits(bits, 0x0, inst, idx);
 }
 
-static inline u32 am33xx_cm_read_reg_bits(u16 inst, s16 idx, u32 mask)
+static inline u32 am33xx_cm_read_reg_bits(u16 inst, u16 idx, u32 mask)
 {
u32 v;
 
@@ -102,7 +102,7 @@ static inline u32 am33xx_cm_read_reg_bits(u16 inst, s16 
idx, u32 mask)
  * Return the IDLEST bitfield of a CM_*_CLKCTRL register, shifted down to
  * bit 0.
  */
-static u32 _clkctrl_idlest(u16 inst, s16 cdoffs, u16 clkctrl_offs)
+static u32 _clkctrl_idlest(u16 inst, u16 cdoffs, u16 clkctrl_offs)
 {
u32 v = am33xx_cm_read_reg(inst, clkctrl_offs);
v = AM33XX_IDLEST_MASK;
@@ -119,7 +119,7 @@ static u32 _clkctrl_idlest(u16 inst, s16 cdoffs, u16 
clkctrl_offs)
  * Returns true if the module's CM_*_CLKCTRL.IDLEST bitfield is either
  * *FUNCTIONAL or *INTERFACE_IDLE; false otherwise.
  */
-static bool _is_module_ready(u16 inst, s16 cdoffs, u16 clkctrl_offs)
+static bool _is_module_ready(u16 inst, u16 cdoffs, u16 clkctrl_offs)
 {
u32 v;
 
@@ -138,7 +138,7 @@ static bool _is_module_ready(u16 inst, s16 cdoffs, u16 
clkctrl_offs)
  * @c must be the unshifted value for CLKTRCTRL - i.e., this function
  * will handle the shift itself.
  */
-static void _clktrctrl_write(u8 c, s16 inst, u16 cdoffs)
+static void _clktrctrl_write(u8 c, u16 inst, u16 cdoffs)
 {
u32 v;
 
@@ -158,7 +158,7 @@ static void _clktrctrl_write(u8 c, s16 inst, u16 cdoffs)
  * Returns true if the clockdomain referred to by (@inst, @cdoffs)
  * is in hardware-supervised idle mode, or 0 otherwise.
  */
-bool am33xx_cm_is_clkdm_in_hwsup(s16 inst, u16 cdoffs)
+bool am33xx_cm_is_clkdm_in_hwsup(u16 inst, u16 cdoffs)
 {
u32 v;
 
@@ -177,7 +177,7 @@ bool am33xx_cm_is_clkdm_in_hwsup(s16 inst, u16 cdoffs)
  * Put a clockdomain referred to by (@inst, @cdoffs) into
  * hardware-supervised idle mode.  No return value.
  */
-void am33xx_cm_clkdm_enable_hwsup(s16 inst, u16 cdoffs)
+void am33xx_cm_clkdm_enable_hwsup(u16 inst, u16 cdoffs)
 {
_clktrctrl_write(OMAP34XX_CLKSTCTRL_ENABLE_AUTO, inst, cdoffs);
 }
@@ -191,7 +191,7 @@ void am33xx_cm_clkdm_enable_hwsup(s16 inst, u16 cdoffs)
  * software-supervised idle mode, i.e., controlled manually by the
  * Linux OMAP clockdomain code.  No return value.
  */
-void am33xx_cm_clkdm_disable_hwsup(s16 inst, u16 cdoffs)
+void am33xx_cm_clkdm_disable_hwsup(u16 inst, u16 cdoffs)
 {
_clktrctrl_write(OMAP34XX_CLKSTCTRL_DISABLE_AUTO, inst, cdoffs);
 }
@@ -204,7 +204,7 @@ void am33xx_cm_clkdm_disable_hwsup(s16 inst, u16 cdoffs)
  * Put a clockdomain referred to by (@inst, @cdoffs) into idle
  * No return value.
  */
-void am33xx_cm_clkdm_force_sleep(s16 inst, u16 cdoffs)
+void am33xx_cm_clkdm_force_sleep(u16 inst, u16 cdoffs)
 {
_clktrctrl_write(OMAP34XX_CLKSTCTRL_FORCE_SLEEP, inst, cdoffs);
 }
@@ -217,7 +217,7 @@ void am33xx_cm_clkdm_force_sleep(s16 inst, u16 cdoffs)
  * Take a clockdomain referred to by (@inst, @cdoffs) out

[PATCH RFC v3 06/12] ARM: OMAP2+: PRCM: AM43x definitions

2013-09-16 Thread Afzal Mohammed
Add AM43x CMINST, CDOFFS, RM_RSTST  RM_RSTCTRL definitions - minimal
ones that would be used.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/prcm43xx.h | 141 +
 1 file changed, 141 insertions(+)
 create mode 100644 arch/arm/mach-omap2/prcm43xx.h

diff --git a/arch/arm/mach-omap2/prcm43xx.h b/arch/arm/mach-omap2/prcm43xx.h
new file mode 100644
index 000..f0636ec
--- /dev/null
+++ b/arch/arm/mach-omap2/prcm43xx.h
@@ -0,0 +1,141 @@
+/*
+ * AM43x PRCM defines
+ *
+ * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed as is without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#ifndef __ARCH_ARM_MACH_OMAP2_PRCM_43XX_H
+#define __ARCH_ARM_MACH_OMAP2_PRCM_43XX_H
+
+#define AM43XX_PRM_PARTITION   1
+#define AM43XX_CM_PARTITION1
+
+/* PRM instances */
+#define AM43XX_PRM_OCP_SOCKET_INST 0x
+#define AM43XX_PRM_MPU_INST0x0300
+#define AM43XX_PRM_GFX_INST0x0400
+#define AM43XX_PRM_RTC_INST0x0500
+#define AM43XX_PRM_TAMPER_INST 0x0600
+#define AM43XX_PRM_CEFUSE_INST 0x0700
+#define AM43XX_PRM_PER_INST0x0800
+#define AM43XX_PRM_WKUP_INST   0x2000
+#define AM43XX_PRM_DEVICE_INST 0x4000
+
+/* RM RSTCTRL offsets */
+#define AM43XX_RM_PER_RSTCTRL_OFFSET   0x0010
+#define AM43XX_RM_GFX_RSTCTRL_OFFSET   0x0010
+#define AM43XX_RM_WKUP_RSTCTRL_OFFSET  0x0010
+
+/* RM RSTST offsets */
+#define AM43XX_RM_GFX_RSTST_OFFSET 0x0014
+#define AM43XX_RM_WKUP_RSTST_OFFSET0x0014
+
+/* CM instances */
+#define AM43XX_CM_WKUP_INST0x2800
+#define AM43XX_CM_DEVICE_INST  0x4100
+#define AM43XX_CM_DPLL_INST0x4200
+#define AM43XX_CM_MPU_INST 0x8300
+#define AM43XX_CM_GFX_INST 0x8400
+#define AM43XX_CM_RTC_INST 0x8500
+#define AM43XX_CM_TAMPER_INST  0x8600
+#define AM43XX_CM_CEFUSE_INST  0x8700
+#define AM43XX_CM_PER_INST 0x8800
+
+/* CD offsets */
+#define AM43XX_CM_WKUP_L3_AON_CDOFFS   0x
+#define AM43XX_CM_WKUP_L3S_TSC_CDOFFS  0x0100
+#define AM43XX_CM_WKUP_L4_WKUP_AON_CDOFFS  0x0200
+#define AM43XX_CM_WKUP_WKUP_CDOFFS 0x0300
+#define AM43XX_CM_MPU_MPU_CDOFFS   0x
+#define AM43XX_CM_GFX_GFX_L3_CDOFFS0x
+#define AM43XX_CM_RTC_RTC_CDOFFS   0x
+#define AM43XX_CM_TAMPER_TAMPER_CDOFFS 0x
+#define AM43XX_CM_CEFUSE_CEFUSE_CDOFFS 0x
+#define AM43XX_CM_PER_L3_CDOFFS0x
+#define AM43XX_CM_PER_L3S_CDOFFS   0x0200
+#define AM43XX_CM_PER_ICSS_CDOFFS  0x0300
+#define AM43XX_CM_PER_L4LS_CDOFFS  0x0400
+#define AM43XX_CM_PER_EMIF_CDOFFS  0x0700
+#define AM43XX_CM_PER_DSS_CDOFFS   0x0a00
+#define AM43XX_CM_PER_CPSW_CDOFFS  0x0b00
+#define AM43XX_CM_PER_OCPWP_L3_CDOFFS  0x0c00
+
+/* CLK CTRL offsets */
+#define AM43XX_CM_PER_UART1_CLKCTRL_OFFSET 0x0580
+#define AM43XX_CM_PER_UART2_CLKCTRL_OFFSET 0x0588
+#define AM43XX_CM_PER_UART3_CLKCTRL_OFFSET 0x0590
+#define AM43XX_CM_PER_UART4_CLKCTRL_OFFSET 0x0598
+#define AM43XX_CM_PER_UART5_CLKCTRL_OFFSET 0x05a0
+#define AM43XX_CM_PER_DCAN0_CLKCTRL_OFFSET 0x0428
+#define AM43XX_CM_PER_DCAN1_CLKCTRL_OFFSET 0x0430
+#define AM43XX_CM_PER_ELM_CLKCTRL_OFFSET   0x0468
+#define AM43XX_CM_PER_EPWMSS0_CLKCTRL_OFFSET   0x0438
+#define AM43XX_CM_PER_EPWMSS1_CLKCTRL_OFFSET   0x0440
+#define AM43XX_CM_PER_EPWMSS2_CLKCTRL_OFFSET   0x0448
+#define AM43XX_CM_PER_GPIO1_CLKCTRL_OFFSET 0x0478
+#define AM43XX_CM_PER_GPIO2_CLKCTRL_OFFSET 0x0480
+#define AM43XX_CM_PER_GPIO3_CLKCTRL_OFFSET 0x0488
+#define AM43XX_CM_PER_I2C1_CLKCTRL_OFFSET  0x04a8
+#define AM43XX_CM_PER_I2C2_CLKCTRL_OFFSET  0x04b0
+#define AM43XX_CM_PER_MAILBOX0_CLKCTRL_OFFSET  0x04b8
+#define AM43XX_CM_PER_MMC0_CLKCTRL_OFFSET  0x04c0
+#define AM43XX_CM_PER_MMC1_CLKCTRL_OFFSET  0x04c8
+#define AM43XX_CM_PER_SPI0_CLKCTRL_OFFSET  0x0500
+#define AM43XX_CM_PER_SPI1_CLKCTRL_OFFSET

[PATCH RFC v3 05/12] ARM: OMAP2+: hwmod: AM335x: remove static register offs

2013-09-16 Thread Afzal Mohammed
Hwmod common to AM43x and AM335x has register offsets different. It is
now updated based on SoC detection at run time, hence remove statically
initialized ones.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 .../mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c | 50 --
 1 file changed, 50 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c 
b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
index 47e0c0b..db45084 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
@@ -51,7 +51,6 @@ struct omap_hwmod am33xx_l3_main_hwmod = {
.main_clk   = l3_gclk,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_PER_L3_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -73,7 +72,6 @@ struct omap_hwmod am33xx_l3_instr_hwmod = {
.main_clk   = l3_gclk,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_PER_L3_INSTR_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -96,7 +94,6 @@ struct omap_hwmod am33xx_l4_ls_hwmod = {
.main_clk   = l4ls_gclk,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_PER_L4LS_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -110,7 +107,6 @@ struct omap_hwmod am33xx_l4_wkup_hwmod = {
.flags  = (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET),
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_WKUP_L4WKUP_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -131,7 +127,6 @@ struct omap_hwmod am33xx_mpu_hwmod = {
.main_clk   = dpll_mpu_m2_ck,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_MPU_MPU_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -158,7 +153,6 @@ struct omap_hwmod am33xx_pruss_hwmod = {
.main_clk   = pruss_ocp_gclk,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_PER_PRUSS_CLKCTRL_OFFSET,
.rstctrl_offs   = AM33XX_RM_PER_RSTCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
@@ -184,7 +178,6 @@ struct omap_hwmod am33xx_gfx_hwmod = {
.main_clk   = gfx_fck_div_ck,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_GFX_GFX_CLKCTRL_OFFSET,
.rstctrl_offs   = AM33XX_RM_GFX_RSTCTRL_OFFSET,
.rstst_offs = AM33XX_RM_GFX_RSTST_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
@@ -249,7 +242,6 @@ struct omap_hwmod am33xx_aes0_hwmod = {
.main_clk   = aes0_fck,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_PER_AES0_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -275,7 +267,6 @@ struct omap_hwmod am33xx_sha0_hwmod = {
.main_clk   = l3_gclk,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_PER_SHA0_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -294,7 +285,6 @@ struct omap_hwmod am33xx_ocmcram_hwmod = {
.main_clk   = l3_gclk,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_PER_OCMCRAM_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -313,7 +303,6 @@ struct omap_hwmod am33xx_smartreflex0_hwmod = {
.main_clk   = smartreflex0_fck,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = 
AM33XX_CM_WKUP_SMARTREFLEX0_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -327,7 +316,6 @@ struct omap_hwmod am33xx_smartreflex1_hwmod = {
.main_clk   = smartreflex1_fck,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = 
AM33XX_CM_WKUP_SMARTREFLEX1_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -362,7 +350,6 @@ struct omap_hwmod am33xx_cpgmac0_hwmod = {
.mpu_rt_idx = 1,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_PER_CPGMAC0_CLKCTRL_OFFSET,
.modulemode

[PATCH RFC v3 04/12] ARM: OMAP2+: hwmod: AM335x: runtime register update

2013-09-16 Thread Afzal Mohammed
Most of IP's in AM335x is present on AM43x and so in those cases both
will use same hwmod database (except for a few cases where clock related
details differ), but there is difference w.r.t register offset between
these. Update register offsets at runtime based on the SoC detected to
help in sharing otherwise same hwmod.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common.h  |  2 +
 .../mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c | 78 ++
 arch/arm/mach-omap2/omap_hwmod_33xx_data.c |  1 +
 3 files changed, 81 insertions(+)

diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common.h 
b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common.h
index 0a1983e..254a4e5 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common.h
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common.h
@@ -152,3 +152,5 @@ extern struct omap_hwmod_class am33xx_spi_hwmod_class;
 
 extern struct omap_gpio_dev_attr gpio_dev_attr;
 extern struct omap2_mcspi_dev_attr mcspi_attrib;
+
+extern void omap_hwmod_am33xx_reg(void);
diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c 
b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
index f7ae9bd..47e0c0b 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
@@ -31,6 +31,10 @@
 #include wd_timer.h
 #include omap_hwmod_33xx_43xx_common.h
 
+#define CLKCTRL(oh, clkctrl) ((oh).prcm.omap4.clkctrl_offs = (clkctrl))
+#define RSTCTRL(oh, rstctrl) ((oh).prcm.omap4.rstctrl_offs = (rstctrl))
+#define RSTST(oh, rstst) ((oh).prcm.omap4.rstst_offs = (rstst))
+
 /*
  * 'l3' class
  * instance(s): l3_main, l3_s, l3_instr
@@ -1370,3 +1374,77 @@ struct omap_hwmod am33xx_wd_timer1_hwmod = {
},
},
 };
+
+static void omap_hwmod_am33xx_clkctrl(void)
+{
+   CLKCTRL(am33xx_uart2_hwmod, AM33XX_CM_PER_UART1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart3_hwmod, AM33XX_CM_PER_UART2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart4_hwmod, AM33XX_CM_PER_UART3_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart5_hwmod, AM33XX_CM_PER_UART4_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart6_hwmod, AM33XX_CM_PER_UART5_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_dcan0_hwmod, AM33XX_CM_PER_DCAN0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_dcan1_hwmod, AM33XX_CM_PER_DCAN1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_elm_hwmod, AM33XX_CM_PER_ELM_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_epwmss0_hwmod, AM33XX_CM_PER_EPWMSS0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_epwmss1_hwmod, AM33XX_CM_PER_EPWMSS1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_epwmss2_hwmod, AM33XX_CM_PER_EPWMSS2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gpio1_hwmod, AM33XX_CM_PER_GPIO1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gpio2_hwmod, AM33XX_CM_PER_GPIO2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gpio3_hwmod, AM33XX_CM_PER_GPIO3_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_i2c2_hwmod, AM33XX_CM_PER_I2C1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_i2c3_hwmod, AM33XX_CM_PER_I2C2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mailbox_hwmod, AM33XX_CM_PER_MAILBOX0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mcasp0_hwmod, AM33XX_CM_PER_MCASP0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mcasp1_hwmod, AM33XX_CM_PER_MCASP1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mmc0_hwmod, AM33XX_CM_PER_MMC0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mmc1_hwmod, AM33XX_CM_PER_MMC1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_spi0_hwmod, AM33XX_CM_PER_SPI0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_spi1_hwmod, AM33XX_CM_PER_SPI1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_spinlock_hwmod, AM33XX_CM_PER_SPINLOCK_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer2_hwmod, AM33XX_CM_PER_TIMER2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer3_hwmod, AM33XX_CM_PER_TIMER3_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer4_hwmod, AM33XX_CM_PER_TIMER4_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer5_hwmod, AM33XX_CM_PER_TIMER5_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer6_hwmod, AM33XX_CM_PER_TIMER6_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer7_hwmod, AM33XX_CM_PER_TIMER7_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_smartreflex0_hwmod,
+   AM33XX_CM_WKUP_SMARTREFLEX0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_smartreflex1_hwmod,
+   AM33XX_CM_WKUP_SMARTREFLEX1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_rtc_hwmod, AM33XX_CM_RTC_RTC_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mmc2_hwmod, AM33XX_CM_PER_MMC2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gpmc_hwmod, AM33XX_CM_PER_GPMC_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_l4_ls_hwmod, AM33XX_CM_PER_L4LS_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_l4_wkup_hwmod, AM33XX_CM_WKUP_L4WKUP_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_l3_main_hwmod, AM33XX_CM_PER_L3_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_tpcc_hwmod, AM33XX_CM_PER_TPCC_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_tptc0_hwmod, AM33XX_CM_PER_TPTC0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_tptc1_hwmod, AM33XX_CM_PER_TPTC1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_tptc2_hwmod

[PATCH RFC v3 02/12] ARM: OMAP2+: hwmod: AM335x/AM43x: move common ocpif

2013-09-16 Thread Afzal Mohammed
AM335x and AM43x have most of the interconnect's similar. Instead of
adding redundant hwmod data, move interconnects similar between AM335x
and AM43x to a common location. This helps in reuse on AM43x.

AM335x interconnects that has difference and not present in AM43x is
not moved. Ocp clock of those in l4_wkup is fed from a different source
for AM43x. Also pruss interconnect is different.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/Makefile   |   1 +
 arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common.h  |  76 +++
 .../omap_hwmod_33xx_43xx_interconnect_data.c   | 656 +
 arch/arm/mach-omap2/omap_hwmod_33xx_data.c | 625 +---
 4 files changed, 734 insertions(+), 624 deletions(-)
 create mode 100644 arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common.h
 create mode 100644 arch/arm/mach-omap2/omap_hwmod_33xx_43xx_interconnect_data.c

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index afb457c..4bd83da 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -210,6 +210,7 @@ obj-$(CONFIG_ARCH_OMAP3)+= 
omap_hwmod_2xxx_3xxx_ipblock_data.o
 obj-$(CONFIG_ARCH_OMAP3)   += 
omap_hwmod_2xxx_3xxx_interconnect_data.o
 obj-$(CONFIG_ARCH_OMAP3)   += omap_hwmod_3xxx_data.o
 obj-$(CONFIG_SOC_AM33XX)   += omap_hwmod_33xx_data.o
+obj-$(CONFIG_SOC_AM33XX)   += 
omap_hwmod_33xx_43xx_interconnect_data.o
 obj-$(CONFIG_ARCH_OMAP4)   += omap_hwmod_44xx_data.o
 obj-$(CONFIG_SOC_OMAP5)+= omap_hwmod_54xx_data.o
 obj-$(CONFIG_SOC_DRA7XX)   += omap_hwmod_7xx_data.o
diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common.h 
b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common.h
new file mode 100644
index 000..c193d9c
--- /dev/null
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common.h
@@ -0,0 +1,76 @@
+/*
+ *
+ * Copyright (C) 2013 Texas Instruments Incorporated
+ *
+ * Data common for AM335x and AM43x
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed as is WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+extern struct omap_hwmod_ocp_if am33xx_mpu__l3_main;
+extern struct omap_hwmod_ocp_if am33xx_l3_main__l3_s;
+extern struct omap_hwmod_ocp_if am33xx_l3_s__l4_ls;
+extern struct omap_hwmod_ocp_if am33xx_l3_s__l4_wkup;
+extern struct omap_hwmod_ocp_if am33xx_l3_main__l3_instr;
+extern struct omap_hwmod_ocp_if am33xx_mpu__prcm;
+extern struct omap_hwmod_ocp_if am33xx_l3_s__l3_main;
+extern struct omap_hwmod_ocp_if am33xx_pruss__l3_main;
+extern struct omap_hwmod_ocp_if am33xx_gfx__l3_main;
+extern struct omap_hwmod_ocp_if am33xx_l3_main__gfx;
+extern struct omap_hwmod_ocp_if am33xx_l4_wkup__rtc;
+extern struct omap_hwmod_ocp_if am33xx_l4_per__dcan0;
+extern struct omap_hwmod_ocp_if am33xx_l4_per__dcan1;
+extern struct omap_hwmod_ocp_if am33xx_l4_per__gpio1;
+extern struct omap_hwmod_ocp_if am33xx_l4_per__gpio2;
+extern struct omap_hwmod_ocp_if am33xx_l4_per__gpio3;
+extern struct omap_hwmod_ocp_if am33xx_cpgmac0__mdio;
+extern struct omap_hwmod_ocp_if am33xx_l4_ls__elm;
+extern struct omap_hwmod_ocp_if am33xx_l4_ls__epwmss0;
+extern struct omap_hwmod_ocp_if am33xx_epwmss0__ecap0;
+extern struct omap_hwmod_ocp_if am33xx_epwmss0__eqep0;
+extern struct omap_hwmod_ocp_if am33xx_epwmss0__ehrpwm0;
+extern struct omap_hwmod_ocp_if am33xx_l4_ls__epwmss1;
+extern struct omap_hwmod_ocp_if am33xx_epwmss1__ecap1;
+extern struct omap_hwmod_ocp_if am33xx_epwmss1__eqep1;
+extern struct omap_hwmod_ocp_if am33xx_epwmss1__ehrpwm1;
+extern struct omap_hwmod_ocp_if am33xx_l4_ls__epwmss2;
+extern struct omap_hwmod_ocp_if am33xx_epwmss2__ecap2;
+extern struct omap_hwmod_ocp_if am33xx_epwmss2__eqep2;
+extern struct omap_hwmod_ocp_if am33xx_epwmss2__ehrpwm2;
+extern struct omap_hwmod_ocp_if am33xx_l3_s__gpmc;
+extern struct omap_hwmod_ocp_if am33xx_l4_per__i2c2;
+extern struct omap_hwmod_ocp_if am33xx_l4_per__i2c3;
+extern struct omap_hwmod_ocp_if am33xx_l4_per__mailbox;
+extern struct omap_hwmod_ocp_if am33xx_l4_ls__spinlock;
+extern struct omap_hwmod_ocp_if am33xx_l4_ls__mcasp0;
+extern struct omap_hwmod_ocp_if am33xx_l4_ls__mcasp1;
+extern struct omap_hwmod_ocp_if am33xx_l4_ls__mmc0;
+extern struct omap_hwmod_ocp_if am33xx_l4_ls__mmc1;
+extern struct omap_hwmod_ocp_if am33xx_l3_s__mmc2;
+extern struct omap_hwmod_ocp_if am33xx_l4_ls__mcspi0;
+extern struct omap_hwmod_ocp_if am33xx_l4_ls__mcspi1;
+extern struct omap_hwmod_ocp_if am33xx_l4_ls__timer2;
+extern struct omap_hwmod_ocp_if am33xx_l4_ls__timer3;
+extern struct omap_hwmod_ocp_if am33xx_l4_ls__timer4;
+extern

[PATCH RFC v3 09/12] ARM: OMAP2+: hwmod: AM43x support

2013-09-16 Thread Afzal Mohammed
Add hwmod support for IP's that are present in AM43x, but not in AM335x.
AM43x additional ones added here are,
1. synctimer
2. timer8-11
3. ehrpwm3-5
4. spi2-4
5. gpio4-5

AM43x pruss interconnect which is different as compared to AM335x, has
been taken care.

And register offsets for same hwmod's shared with AM335x is different,
AM43x register offsets are updated appropriately.

Ocp clock of those in l4_wkup is fed from sys_clkin_ck instead of
dpll_core_m4_div2_ck, so ocpif for those in AM43x l4_wkup has been
added seperately.

Hwmod's has been added for those that have main clock (wkup_m3, control,
gpio0) and clock domain (l4_hs) different from AM335x.

AM43x also has IP's like qspi, hdq1w, vpfe, des, rng, usb, dss. These
are not handled here due to both/either of following two reasons,
1. To avoid churn; most of them don't have DT bindings, which would
   necessitate adding address space in hwmod, which any way would have
   to be removed once DT bindings happen with driver support.
2. patches would come in from sources other than the author

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod.h   |   1 +
 arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common.h  |   1 +
 .../mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c |  75 +++
 arch/arm/mach-omap2/omap_hwmod_43xx_data.c | 645 +
 4 files changed, 722 insertions(+)
 create mode 100644 arch/arm/mach-omap2/omap_hwmod_43xx_data.c

diff --git a/arch/arm/mach-omap2/omap_hwmod.h b/arch/arm/mach-omap2/omap_hwmod.h
index d02acf9..04ec869 100644
--- a/arch/arm/mach-omap2/omap_hwmod.h
+++ b/arch/arm/mach-omap2/omap_hwmod.h
@@ -751,6 +751,7 @@ extern int omap3xxx_hwmod_init(void);
 extern int omap44xx_hwmod_init(void);
 extern int omap54xx_hwmod_init(void);
 extern int am33xx_hwmod_init(void);
+extern int am43xx_hwmod_init(void);
 extern int dra7xx_hwmod_init(void);
 
 extern int __init omap_hwmod_register_links(struct omap_hwmod_ocp_if **ois);
diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common.h 
b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common.h
index 254a4e5..78fd8ad 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common.h
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common.h
@@ -154,3 +154,4 @@ extern struct omap_gpio_dev_attr gpio_dev_attr;
 extern struct omap2_mcspi_dev_attr mcspi_attrib;
 
 extern void omap_hwmod_am33xx_reg(void);
+extern void omap_hwmod_am43xx_reg(void);
diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c 
b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
index db45084..62bfa1d 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
@@ -25,6 +25,7 @@
 #include control.h
 #include cm33xx.h
 #include prm33xx.h
+#include prcm43xx.h
 #include prm-regbits-33xx.h
 #include i2c.h
 #include mmc.h
@@ -1398,3 +1399,77 @@ void omap_hwmod_am33xx_reg(void)
omap_hwmod_am33xx_rstctrl();
omap_hwmod_am33xx_rstst();
 }
+
+static void omap_hwmod_am43xx_clkctrl(void)
+{
+   CLKCTRL(am33xx_uart2_hwmod, AM43XX_CM_PER_UART1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart3_hwmod, AM43XX_CM_PER_UART2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart4_hwmod, AM43XX_CM_PER_UART3_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart5_hwmod, AM43XX_CM_PER_UART4_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart6_hwmod, AM43XX_CM_PER_UART5_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_dcan0_hwmod, AM43XX_CM_PER_DCAN0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_dcan1_hwmod, AM43XX_CM_PER_DCAN1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_elm_hwmod, AM43XX_CM_PER_ELM_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_epwmss0_hwmod, AM43XX_CM_PER_EPWMSS0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_epwmss1_hwmod, AM43XX_CM_PER_EPWMSS1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_epwmss2_hwmod, AM43XX_CM_PER_EPWMSS2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gpio1_hwmod, AM43XX_CM_PER_GPIO1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gpio2_hwmod, AM43XX_CM_PER_GPIO2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gpio3_hwmod, AM43XX_CM_PER_GPIO3_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_i2c2_hwmod, AM43XX_CM_PER_I2C1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_i2c3_hwmod, AM43XX_CM_PER_I2C2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mailbox_hwmod, AM43XX_CM_PER_MAILBOX0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mcasp0_hwmod, AM43XX_CM_PER_MCASP0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mcasp1_hwmod, AM43XX_CM_PER_MCASP1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mmc0_hwmod, AM43XX_CM_PER_MMC0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mmc1_hwmod, AM43XX_CM_PER_MMC1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_spi0_hwmod, AM43XX_CM_PER_SPI0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_spi1_hwmod, AM43XX_CM_PER_SPI1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_spinlock_hwmod, AM43XX_CM_PER_SPINLOCK_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer2_hwmod, AM43XX_CM_PER_TIMER2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer3_hwmod, AM43XX_CM_PER_TIMER3_CLKCTRL_OFFSET

[PATCH RFC v3 12/12] ARM: OMAP2+: AM43x PRCM init

2013-09-16 Thread Afzal Mohammed
From: Ambresh K ambr...@ti.com

Initialise AM43x HWMOD, powerdomains and clockdomains.

Signed-off-by: Ambresh K ambr...@ti.com
Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/io.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index ff2113c..c90f647 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -594,7 +594,13 @@ void __init am43xx_init_early(void)
  NULL);
omap2_set_globals_prm(AM33XX_L4_WK_IO_ADDRESS(AM43XX_PRCM_BASE));
omap2_set_globals_cm(AM33XX_L4_WK_IO_ADDRESS(AM43XX_PRCM_BASE), NULL);
+   omap_prm_base_init();
+   omap_cm_base_init();
omap3xxx_check_revision();
+   am43xx_powerdomains_init();
+   am43xx_clockdomains_init();
+   am43xx_hwmod_init();
+   omap_hwmod_init_postsetup();
 }
 #endif
 
-- 
1.8.3.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RFC v3 11/12] ARM: OMAP2+: AM43x: PRCM kbuild

2013-09-16 Thread Afzal Mohammed
Build AM43x power domain, clock domain and hwmod data.

Many of AM43x IP's and interconnects are similar as that in AM335x,
hence AM335x hwmod data is being reused with necessary changes.

Earlier the plan was to reuse AM335x specific PRCM code, but as AM43x
PRCM register layout is much similar to OMAP4/5, AM335x PRCM is
divorced and instead married with OMAP4/5 PRCM for AM43x.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/Makefile | 7 ++-
 arch/arm/mach-omap2/cm33xx.h | 2 +-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 0746494..cb7b527 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -112,13 +112,13 @@ obj-$(CONFIG_ARCH_OMAP2)  += prm2xxx_3xxx.o 
prm2xxx.o cm2xxx.o
 obj-$(CONFIG_ARCH_OMAP3)   += prm2xxx_3xxx.o prm3xxx.o cm3xxx.o
 obj-$(CONFIG_ARCH_OMAP3)   += vc3xxx_data.o vp3xxx_data.o
 obj-$(CONFIG_SOC_AM33XX)   += prm33xx.o cm33xx.o
-obj-$(CONFIG_SOC_AM43XX)   += prm33xx.o cm33xx.o
 omap-prcm-4-5-common   =  cminst44xx.o cm44xx.o prm44xx.o \
   prcm_mpu44xx.o prminst44xx.o \
   vc44xx_data.o vp44xx_data.o
 obj-$(CONFIG_ARCH_OMAP4)   += $(omap-prcm-4-5-common)
 obj-$(CONFIG_SOC_OMAP5)+= $(omap-prcm-4-5-common)
 obj-$(CONFIG_SOC_DRA7XX)   += $(omap-prcm-4-5-common)
+obj-$(CONFIG_SOC_AM43XX)   += $(omap-prcm-4-5-common)
 
 # OMAP voltage domains
 voltagedomain-common   := voltage.o vc.o vp.o
@@ -146,6 +146,7 @@ obj-$(CONFIG_ARCH_OMAP4)+= 
powerdomains44xx_data.o
 obj-$(CONFIG_SOC_AM33XX)   += $(powerdomain-common)
 obj-$(CONFIG_SOC_AM33XX)   += powerdomains33xx_data.o
 obj-$(CONFIG_SOC_AM43XX)   += $(powerdomain-common)
+obj-$(CONFIG_SOC_AM43XX)   += powerdomains43xx_data.o
 obj-$(CONFIG_SOC_OMAP5)+= $(powerdomain-common)
 obj-$(CONFIG_SOC_OMAP5)+= powerdomains54xx_data.o
 obj-$(CONFIG_SOC_DRA7XX)   += $(powerdomain-common)
@@ -165,6 +166,7 @@ obj-$(CONFIG_ARCH_OMAP4)+= 
clockdomains44xx_data.o
 obj-$(CONFIG_SOC_AM33XX)   += $(clockdomain-common)
 obj-$(CONFIG_SOC_AM33XX)   += clockdomains33xx_data.o
 obj-$(CONFIG_SOC_AM43XX)   += $(clockdomain-common)
+obj-$(CONFIG_SOC_AM43XX)   += clockdomains43xx_data.o
 obj-$(CONFIG_SOC_OMAP5)+= $(clockdomain-common)
 obj-$(CONFIG_SOC_OMAP5)+= clockdomains54xx_data.o
 obj-$(CONFIG_SOC_DRA7XX)   += $(clockdomain-common)
@@ -212,6 +214,9 @@ obj-$(CONFIG_ARCH_OMAP3)+= 
omap_hwmod_3xxx_data.o
 obj-$(CONFIG_SOC_AM33XX)   += omap_hwmod_33xx_data.o
 obj-$(CONFIG_SOC_AM33XX)   += 
omap_hwmod_33xx_43xx_interconnect_data.o
 obj-$(CONFIG_SOC_AM33XX)   += omap_hwmod_33xx_43xx_ipblock_data.o
+obj-$(CONFIG_SOC_AM43XX)   += omap_hwmod_43xx_data.o
+obj-$(CONFIG_SOC_AM43XX)   += 
omap_hwmod_33xx_43xx_interconnect_data.o
+obj-$(CONFIG_SOC_AM43XX)   += omap_hwmod_33xx_43xx_ipblock_data.o
 obj-$(CONFIG_ARCH_OMAP4)   += omap_hwmod_44xx_data.o
 obj-$(CONFIG_SOC_OMAP5)+= omap_hwmod_54xx_data.o
 obj-$(CONFIG_SOC_DRA7XX)   += omap_hwmod_7xx_data.o
diff --git a/arch/arm/mach-omap2/cm33xx.h b/arch/arm/mach-omap2/cm33xx.h
index 201e507..757b9a1 100644
--- a/arch/arm/mach-omap2/cm33xx.h
+++ b/arch/arm/mach-omap2/cm33xx.h
@@ -383,7 +383,7 @@ extern void am33xx_cm_clkdm_disable_hwsup(u16 inst, u16 
cdoffs);
 extern void am33xx_cm_clkdm_force_sleep(u16 inst, u16 cdoffs);
 extern void am33xx_cm_clkdm_force_wakeup(u16 inst, u16 cdoffs);
 
-#if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)
+#ifdef CONFIG_SOC_AM33XX
 extern int am33xx_cm_wait_module_idle(u16 inst, u16 cdoffs,
u16 clkctrl_offs);
 extern void am33xx_cm_module_enable(u8 mode, u16 inst, u16 cdoffs,
-- 
1.8.3.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RFC v3 10/12] ARM: OMAP2+: hwmod: AM43x operations

2013-09-16 Thread Afzal Mohammed
Reuse OMAP4 operations on AM43x.

Signed-off-by: Ambresh K ambr...@ti.com
Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index d9ee0ff..aa593da 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -4125,6 +4125,14 @@ void __init omap_hwmod_init(void)
soc_ops.init_clkdm = _init_clkdm;
soc_ops.update_context_lost = _omap4_update_context_lost;
soc_ops.get_context_lost = _omap4_get_context_lost;
+   } else if (soc_is_am43xx()) {
+   soc_ops.enable_module = _omap4_enable_module;
+   soc_ops.disable_module = _omap4_disable_module;
+   soc_ops.wait_target_ready = _omap4_wait_target_ready;
+   soc_ops.assert_hardreset = _omap4_assert_hardreset;
+   soc_ops.deassert_hardreset = _omap4_deassert_hardreset;
+   soc_ops.is_hardreset_asserted = _omap4_is_hardreset_asserted;
+   soc_ops.init_clkdm = _init_clkdm;
} else if (soc_is_am33xx()) {
soc_ops.enable_module = _am33xx_enable_module;
soc_ops.disable_module = _am33xx_disable_module;
-- 
1.8.3.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RFC v3 07/12] ARM: OMAP2+: PM: AM43x powerdomain data

2013-09-16 Thread Afzal Mohammed
From: Ambresh K ambr...@ti.com

Add the data file to describe all power domains in AM43x SoC.
OMAP4 powerdomain operations is being reused here.

Signed-off-by: Ambresh K ambr...@ti.com
Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/powerdomain.h   |   1 +
 arch/arm/mach-omap2/powerdomains43xx_data.c | 145 
 2 files changed, 146 insertions(+)
 create mode 100644 arch/arm/mach-omap2/powerdomains43xx_data.c

diff --git a/arch/arm/mach-omap2/powerdomain.h 
b/arch/arm/mach-omap2/powerdomain.h
index baf3d8b..3f37485 100644
--- a/arch/arm/mach-omap2/powerdomain.h
+++ b/arch/arm/mach-omap2/powerdomain.h
@@ -254,6 +254,7 @@ extern void omap242x_powerdomains_init(void);
 extern void omap243x_powerdomains_init(void);
 extern void omap3xxx_powerdomains_init(void);
 extern void am33xx_powerdomains_init(void);
+extern void am43xx_powerdomains_init(void);
 extern void omap44xx_powerdomains_init(void);
 extern void omap54xx_powerdomains_init(void);
 extern void dra7xx_powerdomains_init(void);
diff --git a/arch/arm/mach-omap2/powerdomains43xx_data.c 
b/arch/arm/mach-omap2/powerdomains43xx_data.c
new file mode 100644
index 000..45e4363
--- /dev/null
+++ b/arch/arm/mach-omap2/powerdomains43xx_data.c
@@ -0,0 +1,145 @@
+/*
+ * AM43xx Power domains framework
+ *
+ * Copyright (C) 2013 Texas Instruments, Inc.
+ *
+ * This file is made by modifying the file generated automatically
+ * from the OMAP hardware databases.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include linux/kernel.h
+#include linux/init.h
+
+#include powerdomain.h
+
+#include prcm-common.h
+#include prcm44xx.h
+#include prcm43xx.h
+
+static struct powerdomain gfx_43xx_pwrdm = {
+   .name = gfx_pwrdm,
+   .voltdm   = { .name = core },
+   .prcm_offs= AM43XX_PRM_GFX_INST,
+   .prcm_partition   = AM43XX_PRM_PARTITION,
+   .pwrsts   = PWRSTS_OFF_ON,
+   .banks= 1,
+   .pwrsts_mem_ret = {
+   [0] = PWRSTS_OFF_RET,   /* gfx_mem */
+   },
+   .pwrsts_mem_on  = {
+   [0] = PWRSTS_ON,/* gfx_mem */
+   },
+   .flags= PWRDM_HAS_LOWPOWERSTATECHANGE,
+};
+
+static struct powerdomain mpu_43xx_pwrdm = {
+   .name = mpu_pwrdm,
+   .voltdm   = { .name = mpu },
+   .prcm_offs= AM43XX_PRM_MPU_INST,
+   .prcm_partition   = AM43XX_PRM_PARTITION,
+   .pwrsts   = PWRSTS_OFF_RET_ON,
+   .pwrsts_logic_ret = PWRSTS_OFF_RET,
+   .banks= 3,
+   .pwrsts_mem_ret = {
+   [0] = PWRSTS_OFF_RET,   /* mpu_l1 */
+   [1] = PWRSTS_OFF_RET,   /* mpu_l2 */
+   [2] = PWRSTS_OFF_RET,   /* mpu_ram */
+   },
+   .pwrsts_mem_on  = {
+   [0] = PWRSTS_ON,/* mpu_l1 */
+   [1] = PWRSTS_ON,/* mpu_l2 */
+   [2] = PWRSTS_ON,/* mpu_ram */
+   },
+   .flags= PWRDM_HAS_LOWPOWERSTATECHANGE,
+};
+
+static struct powerdomain rtc_43xx_pwrdm = {
+   .name = rtc_pwrdm,
+   .voltdm   = { .name = rtc },
+   .prcm_offs= AM43XX_PRM_RTC_INST,
+   .prcm_partition   = AM43XX_PRM_PARTITION,
+   .pwrsts   = PWRSTS_ON,
+};
+
+static struct powerdomain wkup_43xx_pwrdm = {
+   .name = wkup_pwrdm,
+   .voltdm   = { .name = core },
+   .prcm_offs= AM43XX_PRM_WKUP_INST,
+   .prcm_partition   = AM43XX_PRM_PARTITION,
+   .pwrsts   = PWRSTS_ON,
+   .banks= 1,
+   .pwrsts_mem_ret = {
+   [0] = PWRSTS_OFF,   /* debugss_mem */
+   },
+   .pwrsts_mem_on  = {
+   [0] = PWRSTS_ON,/* debugss_mem */
+   },
+};
+
+static struct powerdomain tamper_43xx_pwrdm = {
+   .name = tamper_pwrdm,
+   .voltdm   = { .name = tamper },
+   .prcm_offs= AM43XX_PRM_TAMPER_INST,
+   .prcm_partition   = AM43XX_PRM_PARTITION,
+   .pwrsts   = PWRSTS_ON,
+};
+
+static struct powerdomain cefuse_43xx_pwrdm = {
+   .name = cefuse_pwrdm,
+   .voltdm   = { .name = core },
+   .prcm_offs= AM43XX_PRM_CEFUSE_INST,
+   .prcm_partition   = AM43XX_PRM_PARTITION,
+   .pwrsts   = PWRSTS_OFF_ON,
+   .flags= PWRDM_HAS_LOWPOWERSTATECHANGE,
+};
+
+static struct powerdomain per_43xx_pwrdm = {
+   .name = per_pwrdm,
+   .voltdm   = { .name = core },
+   .prcm_offs= AM43XX_PRM_PER_INST,
+   .prcm_partition   = AM43XX_PRM_PARTITION,
+   .pwrsts   = PWRSTS_OFF_RET_ON,
+   .pwrsts_logic_ret = PWRSTS_OFF_RET,
+   .banks= 4,
+   .pwrsts_mem_ret

[PATCH RFC v3 08/12] ARM: OMAP2+: CM: AM43x clockdomain data

2013-09-16 Thread Afzal Mohammed
From: Ambresh K ambr...@ti.com

Add the data file to describe clock domains in AM43x SoC.
OMAP4 clockdomain operations is being reused here.

Signed-off-by: Ambresh K ambr...@ti.com
Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/clockdomain.h   |   2 +
 arch/arm/mach-omap2/clockdomains43xx_data.c | 199 
 arch/arm/mach-omap2/cminst44xx.c|   9 ++
 3 files changed, 210 insertions(+)
 create mode 100644 arch/arm/mach-omap2/clockdomains43xx_data.c

diff --git a/arch/arm/mach-omap2/clockdomain.h 
b/arch/arm/mach-omap2/clockdomain.h
index 5431b0c..69b30b2 100644
--- a/arch/arm/mach-omap2/clockdomain.h
+++ b/arch/arm/mach-omap2/clockdomain.h
@@ -215,6 +215,7 @@ extern void __init omap242x_clockdomains_init(void);
 extern void __init omap243x_clockdomains_init(void);
 extern void __init omap3xxx_clockdomains_init(void);
 extern void __init am33xx_clockdomains_init(void);
+extern void am43xx_clockdomains_init(void);
 extern void __init omap44xx_clockdomains_init(void);
 extern void __init omap54xx_clockdomains_init(void);
 extern void __init dra7xx_clockdomains_init(void);
@@ -226,6 +227,7 @@ extern struct clkdm_ops omap2_clkdm_operations;
 extern struct clkdm_ops omap3_clkdm_operations;
 extern struct clkdm_ops omap4_clkdm_operations;
 extern struct clkdm_ops am33xx_clkdm_operations;
+extern struct clkdm_ops am43xx_clkdm_operations;
 
 extern struct clkdm_dep gfx_24xx_wkdeps[];
 extern struct clkdm_dep dsp_24xx_wkdeps[];
diff --git a/arch/arm/mach-omap2/clockdomains43xx_data.c 
b/arch/arm/mach-omap2/clockdomains43xx_data.c
new file mode 100644
index 000..3ca8b64
--- /dev/null
+++ b/arch/arm/mach-omap2/clockdomains43xx_data.c
@@ -0,0 +1,199 @@
+/*
+ * AM43xx Clock domains framework
+ *
+ * Copyright (C) 2013 Texas Instruments, Inc.
+ *
+ * This file is made by modifying the file generated automatically
+ * from the OMAP hardware databases.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include linux/kernel.h
+#include linux/io.h
+
+#include clockdomain.h
+#include prcm44xx.h
+#include prcm43xx.h
+
+static struct clockdomain l4_cefuse_43xx_clkdm = {
+   .name = l4_cefuse_clkdm,
+   .pwrdm= { .name = cefuse_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_CEFUSE_INST,
+   .clkdm_offs   = AM43XX_CM_CEFUSE_CEFUSE_CDOFFS,
+   .flags= CLKDM_CAN_SWSUP,
+};
+
+static struct clockdomain mpu_43xx_clkdm = {
+   .name = mpu_clkdm,
+   .pwrdm= { .name = mpu_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_MPU_INST,
+   .clkdm_offs   = AM43XX_CM_MPU_MPU_CDOFFS,
+   .flags= CLKDM_CAN_HWSUP_SWSUP,
+};
+
+static struct clockdomain l4ls_43xx_clkdm = {
+   .name = l4ls_clkdm,
+   .pwrdm= { .name = per_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_PER_INST,
+   .clkdm_offs   = AM43XX_CM_PER_L4LS_CDOFFS,
+   .flags= CLKDM_CAN_SWSUP,
+};
+
+static struct clockdomain tamper_43xx_clkdm = {
+   .name = tamper_clkdm,
+   .pwrdm= { .name = tamper_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_TAMPER_INST,
+   .clkdm_offs   = AM43XX_CM_TAMPER_TAMPER_CDOFFS,
+   .flags= CLKDM_CAN_SWSUP,
+};
+
+static struct clockdomain l4_rtc_43xx_clkdm = {
+   .name = l4_rtc_clkdm,
+   .pwrdm= { .name = rtc_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_RTC_INST,
+   .clkdm_offs   = AM43XX_CM_RTC_RTC_CDOFFS,
+   .flags= CLKDM_CAN_SWSUP,
+};
+
+static struct clockdomain pruss_ocp_43xx_clkdm = {
+   .name = pruss_ocp_clkdm,
+   .pwrdm= { .name = per_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_PER_INST,
+   .clkdm_offs   = AM43XX_CM_PER_ICSS_CDOFFS,
+   .flags= CLKDM_CAN_SWSUP,
+};
+
+static struct clockdomain ocpwp_l3_43xx_clkdm = {
+   .name = ocpwp_l3_clkdm,
+   .pwrdm= { .name = per_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_PER_INST,
+   .clkdm_offs   = AM43XX_CM_PER_OCPWP_L3_CDOFFS,
+   .flags= CLKDM_CAN_SWSUP,
+};
+
+static struct clockdomain l3s_tsc_43xx_clkdm = {
+   .name = l3s_tsc_clkdm,
+   .pwrdm= { .name = wkup_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_WKUP_INST,
+   .clkdm_offs

Re: [PATCH RFC 0/6] ARM: OMAP2+: AM43x/AM335x prcm reset driver

2013-09-12 Thread Afzal Mohammed
Hi Philipp,

On Monday 09 September 2013 02:36 PM, Philipp Zabel wrote:

 So if I understand correctly, the only problem is that on OMAP the clock
 needs to be enabled to deassert the reset, but as long as the clock
 domain is in hardware supervised mode, it won't be enabled?

Yes, enabling clock with reset deassertion might not reset the module if
the clock domain is in hardware supervised mode.

 Would it be possible to create an internal API to switch the clock
 domain to software supervised mode, which can be used both by the code
 behind pm_runtime_get_sync and reset_control_deassert?

I will see if that is acceptable.

Another option that would have to be explored is invoking device_reset()
(taking care of clear, deassert  status checking as you suggested)
midway through pm_run_time_get_sync(), when the clockdomain is in
software supervised mode with reset driver taking care of any particular
sequence in the case of multiple reset signals, instead of the IP driver
requiring to take care of it.

Regards
Afzal

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH RFC 0/6] ARM: OMAP2+: AM43x/AM335x prcm reset driver

2013-09-05 Thread Afzal Mohammed
Hi Philipp,

On Thursday 05 September 2013 03:37 PM, Philipp Zabel wrote:
 Am Montag, den 02.09.2013, 19:41 +0530 schrieb Afzal Mohammed:

 Two new reset API's are provided to check whether reset is ready and
 to clear reset. This would be required in case IP needs to mix reset
 handling procedure with power/clock managment procedure to achieve
 proper reset and these procedures are sometimes IP specific that would
 make it difficult to handle reset fully in pm_runtime platform support.

 client IP handling s/w (DT based) should do as follows:

 2. In driver, that require reset to be deasserted,
  (this is the sequence required for gfx on AM43x/AM335x, this would
   depend on requirements of the IP)

  mydriver_probe(struct platform device *pdev)
  {
  :
  :
  reset_control_get(pdev-dev, NULL);
  reset_control_clear_reset();
  reset_control_deassert();
  pm_runtime_get_sync();
  if (reset_control_is_reset() != true)
  goto err;
  reset_control_put();
  :
  :
  }

 if possible, I'd like to move this logic into the reset controller
 driver. Can this be reordered to enable power before deasserting the
 reset line (assuming it is initially asserted)? In this case, I'd
 suggest to just call device_reset:
 
   pm_runtime_get_sync(pdev-dev);
   ret = device_reset(pdev-dev);
   if (ret)
   goto err;
 
 The ops.reset callback in the prcm driver then can handle clearing
 the reset status bit, deasserting the reset control bit, and waiting for
 the reset status bit to be set (or timing out with an error).

I too would have loved to have it in such a clean way and was initially
proceeding in that direction, but there is an issue specific to OMAP
family SoC's, which was required to be taken care of (even though
present use case for AM335x/AM43x would work [as it does not have
hardware supervised clockdomain mode] with a small change in platform
level power management support code - a generic one shared with other
OMAP family SoC's)

For a module to be reset, clock domain to which the module clock belongs
should be set to software supervised mode. During pm_runtime_get_sync,
in OMAP platform level handling code, it first put clockdomain into
software supervised mode, enables clock to module, and once module is
ready, module will be put to hardware supervised mode. In hardware
supervised mode, reset may not happen.

So if device_reset() is done after pm_runtime_get_sync(), reset may not
happen as by the time device_reset() is called, clockdomain would be in
hardware supervised mode. But in other case, as reset is already
deasserted when pm_runtime_get_sync() is called, module would be reset
as it first puts to software supervised mode.

And device reset would happen only upon enabling clock to module (if
reset was deasserted) by pm_runtime_get_sync(), so reset status has to
be checked after pm call, preventing us having device_reset() before
pm_runtime_get_sync(), or else in that case we have to sacrifice on
reset status checking (which may not be reliable)

Another alternative would have been to integrate this reset handling in
low level power management code thus hiding all reset handling from
driver, but as far as I know the reset sequence to be done is sometimes
IP specific, preventing it.

Regards
Afzal
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RFC 0/6] ARM: OMAP2+: AM43x/AM335x prcm reset driver

2013-09-02 Thread Afzal Mohammed
Hi,

This is an attempt to achieve reset on AM43x/AM335x based SoC's with
reset driver making use of the reset framework.

prcm node is added in device tree, which would hold reset bindings.
Initially node was made as a one that represents reset functionality
of SoC. but ended up with node for prcm (which is felt to be natural
choice) instead. I am a bit doubtful whether placement of prcm node in
root node as in this series is the right thing.

Reset driver gets probed for specific prcm node, the same defines
register details to be used for a particular SoC (using .data field
associated with .compatible in driver match table).

Another option to handle different SoC's would be to add register
details to DT and let the driver extract it from DT. I vaguely
remember seeing a thread mentioning that putting register details in
DT is not preferred. But open to putting register level details
instead in DT if that is being generally preferred. This would have
advantage that adding reset support for a new SoC would be easier, but
would have to put more thought before doing so as DT bindings should
not change.

With the approach taken here, for supporting a new SoC with new prcm
register details, driver would have to be updated much like the way a
pci based ethernet driver would have to be updated to handle a new IP
version that is not register level compatible with the existing ones.

In this series out of the three IP's (gfx, m3, pruss) that would need
reset support, here as a proof of concept only gfx is taken care.
Other's can be easily supported by adding new register data array
entries.

Two new reset API's are provided to check whether reset is ready and
to clear reset. This would be required in case IP needs to mix reset
handling procedure with power/clock managment procedure to achieve
proper reset and these procedures are sometimes IP specific that would
make it difficult to handle reset fully in pm_runtime platform support.

*--*
client IP handling s/w (DT based) should do as follows:

1. Specify reset handle in the relevant DT node, for eg.

myip@deadbeef {
:
:
/* here prcm is the handle to reset binding node */
resets = prcm 0;
};

2. In driver, that require reset to be deasserted,
 (this is the sequence required for gfx on AM43x/AM335x, this would
  depend on requirements of the IP)

mydriver_probe(struct platform device *pdev)
{
:
:
reset_control_get(pdev-dev, NULL);
reset_control_clear_reset();
reset_control_deassert();
pm_runtime_get_sync();
if (reset_control_is_reset() != true)
goto err;
reset_control_put();
:
:
}

*--*

May be removing reset handling in hwmod can be considered by making
use of reset driver.

Or as another extreme, perhaps, other logic's in the prcm can be
handled by a new prcm driver and then this reset driver can be a child
of it.

Regards
Afzal


Afzal Mohammed (6):
  reset: is_reset and clear_reset api's
  doc: dt: binding: omap: am43x/am335x prcm reset
  reset: am43x/am335x support
  ARM: OMAP2+: AM43x/AM335x: have reset controller
  ARM: dts: AM335x: prcm node (for reset)
  ARM: dts: AM4372: prcm node (for reset)

 .../devicetree/bindings/arm/omap/prcm.txt  |  13 ++
 arch/arm/boot/dts/am33xx.dtsi  |   6 +
 arch/arm/boot/dts/am4372.dtsi  |   6 +
 arch/arm/mach-omap2/Kconfig|   2 +
 drivers/reset/Kconfig  |  14 ++
 drivers/reset/Makefile |   1 +
 drivers/reset/amx3_reset.c | 157 +
 drivers/reset/core.c   |  32 +
 include/linux/reset-controller.h   |   2 +
 include/linux/reset.h  |   2 +
 10 files changed, 235 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/omap/prcm.txt
 create mode 100644 drivers/reset/amx3_reset.c

-- 
1.8.3.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RFC 1/6] reset: is_reset and clear_reset api's

2013-09-02 Thread Afzal Mohammed
Enhance reset framework with is_reset and clear_reset api's.
is_reset - used by client driver to know reset status
clear_reset - used by client driver to clear reset status

These functionalities may sometimes be achieved by using existing api
like deassert. But in some scenarios, steps to achieve reset requires
clearing reset, deassert reset, enabling clock to module and then
checking reset status. Here enabling clock module is coming in between
reset procedure, hence enhance framework with additional api's.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 drivers/reset/core.c | 32 
 include/linux/reset-controller.h |  2 ++
 include/linux/reset.h|  2 ++
 3 files changed, 36 insertions(+)

diff --git a/drivers/reset/core.c b/drivers/reset/core.c
index d1b6089..ba12171 100644
--- a/drivers/reset/core.c
+++ b/drivers/reset/core.c
@@ -127,6 +127,38 @@ int reset_control_deassert(struct reset_control *rstc)
 EXPORT_SYMBOL_GPL(reset_control_deassert);
 
 /**
+ * reset_control_is_reset - check reset status
+ * @rstc: reset controller
+ *
+ * Returns a boolean or negative error code
+ *
+ */
+int reset_control_is_reset(struct reset_control *rstc)
+{
+   if (rstc-rcdev-ops-is_reset)
+   return rstc-rcdev-ops-is_reset(rstc-rcdev, rstc-id);
+
+   return -ENOSYS;
+}
+EXPORT_SYMBOL_GPL(reset_control_is_reset);
+
+/**
+ * reset_control_clear_reset - clear the reset
+ * @rstc: reset controller
+ *
+ * Returns zero on success or negative error code
+ *
+ */
+int reset_control_clear_reset(struct reset_control *rstc)
+{
+   if (rstc-rcdev-ops-clear_reset)
+   return rstc-rcdev-ops-clear_reset(rstc-rcdev, rstc-id);
+
+   return -ENOSYS;
+}
+EXPORT_SYMBOL_GPL(reset_control_clear_reset);
+
+/**
  * reset_control_get - Lookup and obtain a reference to a reset controller.
  * @dev: device to be reset by the controller
  * @id: reset line name
diff --git a/include/linux/reset-controller.h b/include/linux/reset-controller.h
index 2f61311..c9bbadb 100644
--- a/include/linux/reset-controller.h
+++ b/include/linux/reset-controller.h
@@ -17,6 +17,8 @@ struct reset_control_ops {
int (*reset)(struct reset_controller_dev *rcdev, unsigned long id);
int (*assert)(struct reset_controller_dev *rcdev, unsigned long id);
int (*deassert)(struct reset_controller_dev *rcdev, unsigned long id);
+   int (*is_reset)(struct reset_controller_dev *rcdev, unsigned long id);
+   int (*clear_reset)(struct reset_controller_dev *rcdev, unsigned long i);
 };
 
 struct module;
diff --git a/include/linux/reset.h b/include/linux/reset.h
index 6082247..da59f9f 100644
--- a/include/linux/reset.h
+++ b/include/linux/reset.h
@@ -7,6 +7,8 @@ struct reset_control;
 int reset_control_reset(struct reset_control *rstc);
 int reset_control_assert(struct reset_control *rstc);
 int reset_control_deassert(struct reset_control *rstc);
+int reset_control_is_reset(struct reset_control *rstc);
+int reset_control_clear_reset(struct reset_control *rstc);
 
 struct reset_control *reset_control_get(struct device *dev, const char *id);
 void reset_control_put(struct reset_control *rstc);
-- 
1.8.3.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RFC 2/6] doc: dt: binding: omap: am43x/am335x prcm reset

2013-09-02 Thread Afzal Mohammed
prcm reset binding for AM43x/AM335x SoC's.

This was started with an attempt to add reset binding without a clear
idea on the device node where binding should appear. So a new node
with compatible am4372-reset to represent reset managment in prcm
was added. But finally ended up with a node to represent prcm (with
compatible am4372-prcm) which was felt to be the natural one.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 Documentation/devicetree/bindings/arm/omap/prcm.txt | 13 +
 1 file changed, 13 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/omap/prcm.txt

diff --git a/Documentation/devicetree/bindings/arm/omap/prcm.txt 
b/Documentation/devicetree/bindings/arm/omap/prcm.txt
new file mode 100644
index 000..ad25abc
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/omap/prcm.txt
@@ -0,0 +1,13 @@
+TI Power Reset Clock Manager (PRCM)
+
+Properties:
+- compatible:  ti,am4372-prcm for prcm in am43x SoC's
+   ti,am3352-prcm for prcm in am335x SoC's
+- #reset-cells: 1 (refer generic reset bindings for details)
+
+example:
+   prcm: prcm@44df {
+   compatible = ti,am4372-prcm;
+   reg = 0x44df 0xa000;
+   #reset-cells = 1;
+   };
-- 
1.8.3.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RFC 3/6] reset: am43x/am335x support

2013-09-02 Thread Afzal Mohammed
Driver to handle reset block in prcm of AM43x, AM335x SoC's. There are
three reset's that can be handled by this reset driver - gfx, m3 and
pruss. Of this only gfx has been handled here, adding support for the
remaining only require adding array entries with details of pruss and
m3.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 drivers/reset/Kconfig  |  14 
 drivers/reset/Makefile |   1 +
 drivers/reset/amx3_reset.c | 157 +
 3 files changed, 172 insertions(+)
 create mode 100644 drivers/reset/amx3_reset.c

diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig
index c9d04f7..2af81b9 100644
--- a/drivers/reset/Kconfig
+++ b/drivers/reset/Kconfig
@@ -11,3 +11,17 @@ menuconfig RESET_CONTROLLER
  via GPIOs or SoC-internal reset controller modules.
 
  If unsure, say no.
+
+if RESET_CONTROLLER
+
+config RESET_AMX3
+   bool AMx3 reset controller
+   help
+ Reset controller support for AM43x/AM335x SoC's
+
+ Reset controller found in TI's AM series of SoC's like
+ AM335x and AM43x
+
+ If unsure, say no.
+
+endif
diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile
index 1e2d83f..b8c1afe 100644
--- a/drivers/reset/Makefile
+++ b/drivers/reset/Makefile
@@ -1 +1,2 @@
 obj-$(CONFIG_RESET_CONTROLLER) += core.o
+obj-$(CONFIG_RESET_AMX3) += amx3_reset.o
diff --git a/drivers/reset/amx3_reset.c b/drivers/reset/amx3_reset.c
new file mode 100644
index 000..4e476a5
--- /dev/null
+++ b/drivers/reset/amx3_reset.c
@@ -0,0 +1,157 @@
+/*
+ * PRCM reset driver for AM335x  AM43x SoC's
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+#include linux/device.h
+#include linux/err.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/of_device.h
+#include linux/reset.h
+#include linux/reset-controller.h
+#include linux/platform_device.h
+#include linux/io.h
+
+#define DRIVER_NAME amx3_reset
+
+struct amx3_reset_reg_data {
+   u32 rstctrl_offs;
+   u32 rstst_offs;
+   u8  rstctrl_bit;
+   u8  rstst_bit;
+};
+
+struct amx3_reset_data {
+   struct  amx3_reset_reg_data *reg_data;
+   u8  nr_resets;
+};
+
+static void __iomem *reg_base;
+static const struct amx3_reset_data *amx3_reset_data;
+
+static struct amx3_reset_reg_data am335x_reset_reg_data[] = {
+   {
+   .rstctrl_offs   = 0x1104,
+   .rstst_offs = 0x1114,
+   .rstctrl_bit= 0,
+   .rstst_bit  = 0,
+   },
+};
+
+static struct amx3_reset_data am335x_reset_data = {
+   .reg_data   = am335x_reset_reg_data,
+   .nr_resets  = ARRAY_SIZE(am335x_reset_reg_data),
+};
+
+static struct amx3_reset_reg_data am43x_reset_reg_data[] = {
+   {
+   .rstctrl_offs   = 0x410,
+   .rstst_offs = 0x414,
+   .rstctrl_bit= 0,
+   .rstst_bit  = 0,
+   },
+};
+
+static struct amx3_reset_data am43x_reset_data = {
+   .reg_data   = am43x_reset_reg_data,
+   .nr_resets  = ARRAY_SIZE(am43x_reset_reg_data),
+};
+
+static int amx3_reset_clear_reset(struct reset_controller_dev *rcdev,
+ unsigned long id)
+{
+   void __iomem *reg = amx3_reset_data-reg_data[id].rstst_offs + reg_base;
+   u8 bit = amx3_reset_data-reg_data[id].rstst_bit;
+   u32 val = readl(reg);
+
+   val = ~(1  bit);
+   val |= 1  bit;
+   writel(val, reg);
+   return 0;
+}
+
+static int amx3_reset_is_reset(struct reset_controller_dev *rcdev,
+  unsigned long id)
+{
+   void __iomem *reg = amx3_reset_data-reg_data[id].rstst_offs + reg_base;
+   u8 bit = amx3_reset_data-reg_data[id].rstst_bit;
+   u32 val = readl(reg);
+
+   val = (1  bit);
+   return !!val;
+}
+
+static int amx3_reset_deassert(struct reset_controller_dev *rcdev,
+  unsigned long id)
+{
+   void __iomem *reg = amx3_reset_data-reg_data[id].rstctrl_offs +
+   reg_base;
+   u8 bit = amx3_reset_data-reg_data[id].rstctrl_bit;
+   u32 val = readl(reg);
+
+   val = ~(1  bit);
+   writel(val, reg);
+   return 0;
+}
+
+static struct reset_control_ops amx3_reset_ops = {
+   .deassert = amx3_reset_deassert,
+   .is_reset = amx3_reset_is_reset,
+   .clear_reset = amx3_reset_clear_reset,
+};
+
+static struct reset_controller_dev amx3_reset_controller = {
+   .ops = amx3_reset_ops,
+};
+
+static const struct of_device_id amx3_reset_of_match[] = {
+   { .compatible = ti,am3352-prcm, .data = am335x_reset_data,},
+   { .compatible = ti,am4372-prcm, .data = am43x_reset_data,},
+   {},
+};
+
+static int amx3_reset_probe

[PATCH RFC 4/6] ARM: OMAP2+: AM43x/AM335x: have reset controller

2013-09-02 Thread Afzal Mohammed
AM43x, AM335x have reset block as part of prcm, let reset driver be
usable with these SoC's.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/Kconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 3eed000..fa28d1d 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -72,6 +72,7 @@ config SOC_AM33XX
select CPU_V7
select MULTI_IRQ_HANDLER
select COMMON_CLK
+   select ARCH_HAS_RESET_CONTROLLER
 
 config SOC_AM43XX
bool TI AM43x
@@ -82,6 +83,7 @@ config SOC_AM43XX
select ARM_GIC
select COMMON_CLK
select MACH_OMAP_GENERIC
+   select ARCH_HAS_RESET_CONTROLLER
 
 config ARCH_OMAP2PLUS
bool
-- 
1.8.3.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RFC 6/6] ARM: dts: AM4372: prcm node (for reset)

2013-09-02 Thread Afzal Mohammed
Add AM4372 prcm node with reset binding.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/boot/dts/am4372.dtsi | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/boot/dts/am4372.dtsi b/arch/arm/boot/dts/am4372.dtsi
index 5a68fde..d0d11b3 100644
--- a/arch/arm/boot/dts/am4372.dtsi
+++ b/arch/arm/boot/dts/am4372.dtsi
@@ -411,6 +411,12 @@
ti,hwmods = epwmss5;
status = disabled;
};
+
+   prcm: prcm@44df {
+   compatible = ti,am4372-prcm;
+   reg = 0x44df 0xa000;
+   #reset-cells = 1;
+   };
};
 
clocks {
-- 
1.8.3.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RFC 5/6] ARM: dts: AM335x: prcm node (for reset)

2013-09-02 Thread Afzal Mohammed
Add AM335x prcm node with reset binding.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/boot/dts/am33xx.dtsi | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index 4701e3c..c2ccf94 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -530,6 +530,12 @@
#size-cells = 1;
status = disabled;
};
+
+   prcm: prcm@44e0 {
+   compatible = ti,am3352-prcm;
+   reg = 0x44e0 0x1300;
+   #reset-cells = 1;
+   };
};
 
clocks {
-- 
1.8.3.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 00/13] ARM: OMAP2+: AM43x PRCM support

2013-08-29 Thread Afzal Mohammed
Hi Paul, Benoit,

On Wednesday 21 August 2013 05:14 PM, Rajendra Nayak wrote:
 On Friday 02 August 2013 07:05 PM, Afzal Mohammed wrote:

 Hwmod database of AM335x is reused by moving common elements to a new
 array (most of AM335x IP's are present in AM43x) and keeping separate
 arrays for elements that are specific only to either one of AM335x or
 AM43x. And in the cases where relevant IP is present in both that has
 difference in details like CLKCTRL register offsets, it is being
 updated at runtime based on the SoC detected.
 
 I feel the reuse part is good but we need to structure them such that we
 don't compromise too much on readability of the data.
 
 So what I suggest is
 1. Create something like omap_hwmod_am43_am33_interconnect_data.c and have 
 all common
 interconnect ocp_if structs
 2. Create something like omap_hwmod_am43_am33_ipblock_data.c and have all 
 common
 hwmod structs.
 3. Since most PRCM register offsets are different, have them all inited in 
 *one* place
 (even for the ones which are common), instead of common ones being statically 
 defined
 and others dynamically inited.
 4. For instances like clkdm being different or clock topology has changed 
 (which is in
 rare cases) have seperate structures for am33xx and am43xx. Once we move some 
 of the clocks etc
 to DT we can then move them into common files if needed.
 
 Paul/Benoit, does the above make sense?

I plan to proceed as per the above 4 points mentioned by Rajendra (that
includes his comments on patches 2,3  13), is that okay ?

Regards
Afzal

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 00/13] ARM: OMAP2+: AM43x PRCM support

2013-08-28 Thread Afzal Mohammed
Hi Paul,

On Wednesday 21 August 2013 08:23 AM, Paul Walmsley wrote:

 Currently there is no public TRM available for AM43x.
 
 Can you think of any way that the data can be doublechecked against some 
 reference or against the reality of the chip?

This series has been tested on a pre-silicon platform, and boots to
prompt (along with DT clocks from Tero).

 Can development boards be made available to the OMAP maintainers so we can 
 ensure that the code, once merged, continues to work?

Silicon  boards are not yet ready. I checked internally about your
request, I had been told that once boards are ready, it can be made
available to the maintainers.

 Powerdomain  Clockdomain data has been added separately as it was not
 giving much advantage reusing AM335x ones (runtime updates required
 was getting too ugly). But as AM43x PRCM functionality is similar to
 OMAP4, power domain, clock domain  hwmod operations are reused from
 OMAP4.
 
 Is the AM43xx PRCM design and IP derived from AM33xx, or from OMAP4, or 
 from something else?

PRCM is derived from AM335x, but modified such that it is more aligned
with OMAP4 (especially w.r.t register offsets)

Regards
Afzal

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 06/13] ARM: OMAP2+: PRCM: AM43x definitions

2013-08-28 Thread Afzal Mohammed
Hi Paul,

On Wednesday 21 August 2013 08:50 AM, Paul Walmsley wrote:

 +/* PRM instances */
 +#define AM43XX_PRM_OCP_SOCKET_INST  0x
 +#define AM43XX_PRM_MPU_INST 0x0300
 +#define AM43XX_PRM_GFX_INST 0x0400
 +#define AM43XX_PRM_RTC_INST 0x0500
 +#define AM43XX_PRM_TAMPER_INST  0x0600
 +#define AM43XX_PRM_CEFUSE_INST  0x0700
 +#define AM43XX_PRM_PER_INST 0x0800
 +#define AM43XX_PRM_WKUP_INST0x2000
 +#define AM43XX_PRM_DEVICE_INST  0x4000
 +
 
 ...
 
 +/* CM instances */
 +#define AM43XX_CM_WKUP_INST 0x2800
 +#define AM43XX_CM_DEVICE_INST   0x4100
 +#define AM43XX_CM_DPLL_INST 0x4200
 +#define AM43XX_CM_MPU_INST  0x8300
 +#define AM43XX_CM_GFX_INST  0x8400
 +#define AM43XX_CM_RTC_INST  0x8500
 +#define AM43XX_CM_TAMPER_INST   0x8600
 +#define AM43XX_CM_CEFUSE_INST   0x8700
 +#define AM43XX_CM_PER_INST  0x8800
 
 That's a pretty broad address range to span, in PRCM terms.  Seems pretty 
 unlikely that the whole area is really decoded to a single PRCM IP block?  
 Or is it actually decoded into smaller PRM and CM sub-blocks, similar to 
 OMAP4?
 
 Just by looking at the offsets, it looks to me like you've got:
 
 1. one IP block at 0x-0x1fff? that covers system PRM
 
 2. one IP block at 0x2000-0x3fff? that covers WKUP PRM  CM
   
 3. one IP block at 0x4000-? that covers device  PLL PRM  CM
 
 4. one IP block at 0x8000-? that covers system CM

In AM43x, PRCM is a single entity as in AM335x, but with a mixed address
space for PRM  CM instances.

On AM335x, from the header files, it can be seen that PRM  CM base is
0x44e0, here it is similar case except that the base for both is
0x44df instead.

Also, script too generated the macros as in this change.

Regards
Afzal
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 00/13] ARM: OMAP2+: AM43x PRCM support

2013-08-28 Thread Afzal Mohammed
Hi Benoit,

On Tuesday 20 August 2013 02:48 PM, Benoit Cousson wrote:

 Otherwise, I guess that most of these patches should be non-intrusive
 for other OMAPs beside that one (ARM: OMAP2+: CM: reintroduce SW_SLEEP
 for OMAP4). And for the moment, that's maybe the most important point.
 
 Have you checked that it will not generate any regression for OMAP4 in
 term of PM features: suspend, cpuidle at least?

As noted by Rajendra, there could problem where clockdomain doesn't have
SW_SLEEP and only have HW_AUTO. I have to rework the relevant patch to
handle it properly.

Regards
Afzal

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 01/13] ARM: OMAP2+: CM: reintroduce SW_SLEEP for OMAP4

2013-08-28 Thread Afzal Mohammed
Hi Rajendra,

On Wednesday 21 August 2013 12:43 PM, Rajendra Nayak wrote:

 +void omap4_cminst_clkdm_force_sleep(u8 part, s16 inst, u16 cdoffs)
 +{
 +_clktrctrl_write(OMAP34XX_CLKSTCTRL_FORCE_SLEEP, part, inst, cdoffs);
 
 I guess this won't work on omap4/5 where some clockdomains do not support
 SW_SLEEP and only support HW_AUTO. We might need to have different clkdm
 operations for the different omap4 variants.

Yes, this has to be reworked using clockdomain flag to handle
appropriately the above scenario.

Regards
Afzal

  static int omap4_clkdm_sleep(struct clockdomain *clkdm)
  {
 -omap4_cminst_clkdm_enable_hwsup(clkdm-prcm_partition,
 -clkdm-cm_inst, clkdm-clkdm_offs);
 +omap4_cminst_clkdm_force_sleep(clkdm-prcm_partition,
 +   clkdm-cm_inst, clkdm-clkdm_offs);
  return 0;
  }
  

 

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 10/13] ARM: OMAP2+: hwmod: AM43x operations

2013-08-28 Thread Afzal Mohammed
Hi Rajendra,

On Wednesday 21 August 2013 05:00 PM, Rajendra Nayak wrote:
 On Friday 02 August 2013 07:08 PM, Afzal Mohammed wrote:

 Reuse OMAP4 operations on AM43x.

 Signed-off-by: Ambresh K ambr...@ti.com
 Signed-off-by: Afzal Mohammed af...@ti.com
 ---
  arch/arm/mach-omap2/omap_hwmod.c |8 
  1 file changed, 8 insertions(+)

 diff --git a/arch/arm/mach-omap2/omap_hwmod.c 
 b/arch/arm/mach-omap2/omap_hwmod.c
 index 7f4db12..a1b7e20 100644
 --- a/arch/arm/mach-omap2/omap_hwmod.c
 +++ b/arch/arm/mach-omap2/omap_hwmod.c
 @@ -4123,6 +4123,14 @@ void __init omap_hwmod_init(void)
  soc_ops.init_clkdm = _init_clkdm;
  soc_ops.update_context_lost = _omap4_update_context_lost;
  soc_ops.get_context_lost = _omap4_get_context_lost;
 +} else if (soc_is_am43xx()) {
 +soc_ops.enable_module = _omap4_enable_module;
 +soc_ops.disable_module = _omap4_disable_module;
 +soc_ops.wait_target_ready = _omap4_wait_target_ready;
 +soc_ops.assert_hardreset = _omap4_assert_hardreset;
 +soc_ops.deassert_hardreset = _omap4_deassert_hardreset;
 +soc_ops.is_hardreset_asserted = _omap4_is_hardreset_asserted;
 +soc_ops.init_clkdm = _init_clkdm;
 
 Did you leave out soc_ops.update_context_lost and soc_ops.get_context_lost on
 purpose?

As far as I understand, primarily driver make use of this with the help
of function pointers passed through platform data. And as am43x is a DT
only platform, it was left out.

Regards
Afzal

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: AM335x, early printk

2013-08-20 Thread Afzal Mohammed
Hi Sebastian,

On Tuesday 20 August 2013 03:02 PM, Lokesh Vutla wrote:

 Yes. I do not see the decompress messages but I have an early console
 later on. Unfortunately it stops now right at the serial core:

 |pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
 |Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled

 I guess you are missing the following series from Rajendra. 
 
 http://www.mail-archive.com/linux-omap@vger.kernel.org/msg92515.html

I think Lokesh's suggestion is more likely to help your case than mine.

Regards
Afzal

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 00/13] ARM: OMAP2+: AM43x PRCM support

2013-08-19 Thread Afzal Mohammed
Hi Tony,

On Tuesday 13 August 2013 01:31 PM, Tony Lindgren wrote:

 Hi Paul  Benoit,
 
 Does this series look OK to you guys to queue or ack?


Can you please consider queuing this series for the coming merge window
as we are getting closer to the merge window.

If Paul or Benoit has any comments on this, we can have patches to fix
it up on top of this as required or these patches be reverted in the
worst case.

Regards
Afzal

 
 * Afzal Mohammed af...@ti.com [130802 06:42]:
 Hi,

 AM43x PRCM support (excluding clock tree) is being added with this
 series. AM43x reuses most of the IP's from AM335x, as that is the
 case, much of the AM335x hwmod data is reused.

 I am aware that this series adds around +1K lines to platform. We in
 TI, here are making efforts to clean platform code gradually and keep
 to minumum the code being added to support new SoC's. Please note that
 this SoC support series has positive diffstat of just above 1K only.
 This compared to last SoC that was supported in OMAP family during
 last merge window is way less (this is only around 1/8th postive
 diffstat of it). Clock data is not added in this series, instead
 directly clock tree in DT with driver would be used, this is a work in
 progress. And as seen from recent OMAP clock tree DT conversion
 series, there are serious efforts ongoing to that end. Also we will
 start working on moving hwmod away from platform folders. In addition,
 recently there was a PRCM cleanup by Rajendra Nayak that removed near
 to 11K lines.

 Considering the above facts, I request the maintainers to consider
 this series for the next merge window.

 Currently there is no public TRM available for AM43x.

 Hwmod database of AM335x is reused by moving common elements to a new
 array (most of AM335x IP's are present in AM43x) and keeping separate
 arrays for elements that are specific only to either one of AM335x or
 AM43x. And in the cases where relevant IP is present in both that has
 difference in details like CLKCTRL register offsets, it is being
 updated at runtime based on the SoC detected.

 Powerdomain  Clockdomain data has been added separately as it was not
 giving much advantage reusing AM335x ones (runtime updates required
 was getting too ugly). But as AM43x PRCM functionality is similar to
 OMAP4, power domain, clock domain  hwmod operations are reused from
 OMAP4.

 A single header file has been added to provide all AM43x PRCM defines.

 Here sequencewise, initially AM335x hwmod is modified to have it's
 fields get updated at runtime (wherever element is shared and has
 some difference with AM43x). Then power domain, clock domain for AM43x
 is added and finally AM335x hwmod database is updated with AM43x
 specifics.

 This series is being developed with additional clock tree changes that
 are being DT'fied.

 Additional DTS changes (posted separate from this series) are also
 required for hwmod to get register target address space as most of
 AM335x hwmod address space details has been recently cleaned up and
 moved to DTS.

 Regards
 Afzal

 Afzal Mohammed (8):
   ARM: OMAP2+: hwmod: AM335x: prepare for AM43x reuse
   ARM: OMAP2+: hwmod: AMx3: runtime AM335x handling
   ARM: OMAP2+: hwmod: AMx3: remove common static fields
   ARM: OMAP2+: PRCM: AM43x definitions
   ARM: OMAP2+: hwmod: AMx3: runtime AM43x handling
   ARM: OMAP2+: hwmod: AM43x operations
   ARM: OMAP2+: AM43x: PRCM kbuild
   ARM: OMAP2+: hwmod: AM43x: new w.r.t AM335x

 Ambresh K (3):
   ARM: OMAP2+: PM: AM43x powerdomain data
   ARM: OMAP2+: CM: AM43x clockdomain data
   ARM: OMAP2+: AM43x PRCM init

 Ankur Kishore (1):
   ARM: OMAP2+: CM: cm_inst offset s16-u16

 Vaibhav Bedia (1):
   ARM: OMAP2+: CM: reintroduce SW_SLEEP for OMAP4

  arch/arm/mach-omap2/Makefile|5 +-
  arch/arm/mach-omap2/clockdomain.h   |4 +-
  arch/arm/mach-omap2/clockdomains43xx_data.c |  199 
  arch/arm/mach-omap2/cm33xx.c|   30 +-
  arch/arm/mach-omap2/cm33xx.h|   28 +-
  arch/arm/mach-omap2/cminst44xx.c|   58 ++-
  arch/arm/mach-omap2/cminst44xx.h|   25 +-
  arch/arm/mach-omap2/io.c|6 +
  arch/arm/mach-omap2/omap_hwmod.c|8 +
  arch/arm/mach-omap2/omap_hwmod_33xx_data.c  |  691 
 +++
  arch/arm/mach-omap2/powerdomain.h   |1 +
  arch/arm/mach-omap2/powerdomains43xx_data.c |  145 ++
  arch/arm/mach-omap2/prcm43xx.h  |  141 ++
  13 files changed, 1198 insertions(+), 143 deletions(-)
  create mode 100644 arch/arm/mach-omap2/clockdomains43xx_data.c
  create mode 100644 arch/arm/mach-omap2/powerdomains43xx_data.c
  create mode 100644 arch/arm/mach-omap2/prcm43xx.h

 -- 
 1.7.9.5


--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: AM335x, early printk

2013-08-19 Thread Afzal Mohammed
Hi Sebastian,

On Monday 19 August 2013 06:07 PM, Sebastian Andrzej Siewior wrote:

 Yes. I do not see the decompress messages but I have an early console
 later on. Unfortunately it stops now right at the serial core:
 
 |pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
 |Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled

I vaguely remember facing a similar issue on it's yet to be born sibling
while trying to woke it up in the womb, see if placing dtb at a
different location helps (probably so that images won't get corrupted)

Regards
Afzal
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] ARM: dts: AM4372: add few nodes

2013-08-12 Thread Afzal Mohammed

Hi Mark,

On Saturday 10 August 2013 07:53 PM, Mark Rutland wrote:


+   mac: ethernet@4a10 {
+   compatible = ti,am4372-cpsw,ti,cpsw;



One point worth mentioning is that the ti,am4372-cpsw string isn't
documented. Will the ti,am4372-cpsw binding definitely be a superset
of the ti,cpsw binding, and if you were to take the DT as of this
patch, and attempt to use it with a future kernel, can you guarantee
it'll work?


ti,am4372-cpsw was not documented as OMAP DT maintainer didn't prefer 
documenting only for a new compatible.


For the only patch on this file that went into mainline, in that series 
actually I had posted patches to document ti,am4372-*, but as 
maintainer didn't agree, it was discarded [A].


Regarding whether ti,am4372-cpsw would be a superset of ti,cpsw, 
information I have (am4372 is in pre silicon stage) is that it is a 
reuse from am335x (ti,cpsw should have been named ti,am3352-cpsw or 
something like that, but nothing can be done now) with minor changes and 
all existing functionalities available, Mugunthan can shed more light on 
this, Mugunthan ?


As mentioned at other places in the thread, for cpsw, only a few 
properties to prevent hwmod code crash was added. I am sure that 
currently added properties for cpsw will not make driver functional this 
Kernel version (if this goes in) or future versions. To make driver work 
additional properties are required.



There are many other parameters which are missed here.


Reason has been mentioned in the commit message, quoting relevant here
again,


Actually, as you've marked the nodes disabled, it's probably fine. But
worth considering as properties are added...


There were two factors that was considered while adding cpsw node
1. DT as an ABI
2. While adding DT node, whether all existing required properties has to 
be added


Regarding 1 - DT would not make driver work for this Kernel version and 
also for not any newer Kernel version, I believe this does not go 
against DT an an ABI, although in a negative sense. To make driver work 
more DT properties would have to be added.


Regarding 2 - Currently, I believe most required  optional properties 
in bindings are defined w.r.t driver (bringing in a Linux attachment). 
If DT is only a hardware description, required  optional properties 
should correspond to something that are a must for hardware to work and 
additional features that can be used respectively. In that sense 
interrupts property for many of the peripherals would have to be 
considered optional, as it is possible to work in polling mode. And 
would it be practical for DT in most of the cases to be a complete 
hardware description ?, as to completely describe hardware, we may need 
to have a large amount of properties that may not be relevant to 
software. If requirement is only that DT should describe hardware that 
is relevant for software (this would bring in a software dependency for 
DT), required property for one software may not be required for another 
piece of software or may be an optional property (like in the case of 
interrupts as explained above).


So conclusion arrived within me was that as long as properties are not 
modified, but only added and as long as it does not go against DT as an 
ABI, it is ok.


I would like to hear from DT maintainers what the approach should be.

Regards
Afzal

[A] http://www.mail-archive.com/linux-omap@vger.kernel.org/msg89408.html

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] ARM: dts: AM4372: add few nodes

2013-08-04 Thread Afzal Mohammed

Hi Muguthan,

On Saturday 03 August 2013 05:19 PM, Mugunthan V N wrote:

On 8/2/2013 7:16 PM, Afzal Mohammed wrote:



+   mac: ethernet@4a10 {
+   compatible = ti,am4372-cpsw,ti,cpsw;



compatibility ti,am4372-cpsw is not needed as driver has only ti,cpsw
compatibility


No, please read device tree documentation [1].

DT is a pure hardware description, it does not depend on driver, 
dependency is only vice versa.



+   reg = 0x4a10 0x800
+  0x4a101200 0x100;
+   interrupts = GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH
+ GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH
+ GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH
+ GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH;
+   ti,hwmods = cpgmac0;
+   status = disabled;
+   };



There are many other parameters which are missed here.


Reason has been mentioned in the commit message, quoting relevant here 
again,


 For i2c, spi, cpsw  pwm - only the properties that were sure to be
 correct has been added (main intention is to make hwmod happy and
 avoid any later modification to here added properties).

I really wanted to avoid a later patch that has a line starting with 
minus on DTS.


Since you are working on cpsw support, can you help here with a patch 
for other properties.


Regards
Afzal

[1] 
http://devicetree.org/Device_Tree_Usage#Understanding_the_compatible_Property

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 00/13] ARM: OMAP2+: AM43x PRCM support

2013-08-02 Thread Afzal Mohammed
Hi,

AM43x PRCM support (excluding clock tree) is being added with this
series. AM43x reuses most of the IP's from AM335x, as that is the
case, much of the AM335x hwmod data is reused.

I am aware that this series adds around +1K lines to platform. We in
TI, here are making efforts to clean platform code gradually and keep
to minumum the code being added to support new SoC's. Please note that
this SoC support series has positive diffstat of just above 1K only.
This compared to last SoC that was supported in OMAP family during
last merge window is way less (this is only around 1/8th postive
diffstat of it). Clock data is not added in this series, instead
directly clock tree in DT with driver would be used, this is a work in
progress. And as seen from recent OMAP clock tree DT conversion
series, there are serious efforts ongoing to that end. Also we will
start working on moving hwmod away from platform folders. In addition,
recently there was a PRCM cleanup by Rajendra Nayak that removed near
to 11K lines.

Considering the above facts, I request the maintainers to consider
this series for the next merge window.

Currently there is no public TRM available for AM43x.

Hwmod database of AM335x is reused by moving common elements to a new
array (most of AM335x IP's are present in AM43x) and keeping separate
arrays for elements that are specific only to either one of AM335x or
AM43x. And in the cases where relevant IP is present in both that has
difference in details like CLKCTRL register offsets, it is being
updated at runtime based on the SoC detected.

Powerdomain  Clockdomain data has been added separately as it was not
giving much advantage reusing AM335x ones (runtime updates required
was getting too ugly). But as AM43x PRCM functionality is similar to
OMAP4, power domain, clock domain  hwmod operations are reused from
OMAP4.

A single header file has been added to provide all AM43x PRCM defines.

Here sequencewise, initially AM335x hwmod is modified to have it's
fields get updated at runtime (wherever element is shared and has
some difference with AM43x). Then power domain, clock domain for AM43x
is added and finally AM335x hwmod database is updated with AM43x
specifics.

This series is being developed with additional clock tree changes that
are being DT'fied.

Additional DTS changes (posted separate from this series) are also
required for hwmod to get register target address space as most of
AM335x hwmod address space details has been recently cleaned up and
moved to DTS.

Regards
Afzal

Afzal Mohammed (8):
  ARM: OMAP2+: hwmod: AM335x: prepare for AM43x reuse
  ARM: OMAP2+: hwmod: AMx3: runtime AM335x handling
  ARM: OMAP2+: hwmod: AMx3: remove common static fields
  ARM: OMAP2+: PRCM: AM43x definitions
  ARM: OMAP2+: hwmod: AMx3: runtime AM43x handling
  ARM: OMAP2+: hwmod: AM43x operations
  ARM: OMAP2+: AM43x: PRCM kbuild
  ARM: OMAP2+: hwmod: AM43x: new w.r.t AM335x

Ambresh K (3):
  ARM: OMAP2+: PM: AM43x powerdomain data
  ARM: OMAP2+: CM: AM43x clockdomain data
  ARM: OMAP2+: AM43x PRCM init

Ankur Kishore (1):
  ARM: OMAP2+: CM: cm_inst offset s16-u16

Vaibhav Bedia (1):
  ARM: OMAP2+: CM: reintroduce SW_SLEEP for OMAP4

 arch/arm/mach-omap2/Makefile|5 +-
 arch/arm/mach-omap2/clockdomain.h   |4 +-
 arch/arm/mach-omap2/clockdomains43xx_data.c |  199 
 arch/arm/mach-omap2/cm33xx.c|   30 +-
 arch/arm/mach-omap2/cm33xx.h|   28 +-
 arch/arm/mach-omap2/cminst44xx.c|   58 ++-
 arch/arm/mach-omap2/cminst44xx.h|   25 +-
 arch/arm/mach-omap2/io.c|6 +
 arch/arm/mach-omap2/omap_hwmod.c|8 +
 arch/arm/mach-omap2/omap_hwmod_33xx_data.c  |  691 +++
 arch/arm/mach-omap2/powerdomain.h   |1 +
 arch/arm/mach-omap2/powerdomains43xx_data.c |  145 ++
 arch/arm/mach-omap2/prcm43xx.h  |  141 ++
 13 files changed, 1198 insertions(+), 143 deletions(-)
 create mode 100644 arch/arm/mach-omap2/clockdomains43xx_data.c
 create mode 100644 arch/arm/mach-omap2/powerdomains43xx_data.c
 create mode 100644 arch/arm/mach-omap2/prcm43xx.h

-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 02/13] ARM: OMAP2+: hwmod: AM335x: prepare for AM43x reuse

2013-08-02 Thread Afzal Mohammed
AM335x  AM43x have most of the interconnects, IPs similar. Instead of
adding new hwmod data for AM43x, reuse AM335x hwmod data as much as
possible.

In the hwmod entries that could be reused on AM43x, major changes are
in register offsets and different ocpif clock for most of peripherals
that comes under l4_wkup interconnect.

To achieve reuse, as a first step, bring out ocpif's relevant for both
SoC's to a new array and handle appropriately.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_33xx_data.c |   22 ++
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
index 7a9b492..b0a38f0 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
@@ -29,6 +29,7 @@
 #include i2c.h
 #include mmc.h
 #include wd_timer.h
+#include soc.h
 
 /*
  * IP blocks
@@ -2458,6 +2459,13 @@ static struct omap_hwmod_ocp_if am33xx_l3_main__aes0 = {
 
 static struct omap_hwmod_ocp_if *am33xx_hwmod_ocp_ifs[] __initdata = {
am33xx_l3_main__emif,
+   am33xx_l4_hs__pruss,
+   am33xx_l3_main__lcdc,
+   am33xx_l3_s__usbss,
+   NULL,
+};
+
+static struct omap_hwmod_ocp_if *amx3xx_hwmod_ocp_ifs[] __initdata = {
am33xx_mpu__l3_main,
am33xx_mpu__prcm,
am33xx_l3_s__l4_ls,
@@ -2481,7 +2489,6 @@ static struct omap_hwmod_ocp_if *am33xx_hwmod_ocp_ifs[] 
__initdata = {
am33xx_l4_wkup__gpio0,
am33xx_l4_wkup__adc_tsc,
am33xx_l4_wkup__wd_timer1,
-   am33xx_l4_hs__pruss,
am33xx_l4_per__dcan0,
am33xx_l4_per__dcan1,
am33xx_l4_per__gpio1,
@@ -2522,14 +2529,12 @@ static struct omap_hwmod_ocp_if *am33xx_hwmod_ocp_ifs[] 
__initdata = {
am33xx_epwmss2__eqep2,
am33xx_epwmss2__ehrpwm2,
am33xx_l3_s__gpmc,
-   am33xx_l3_main__lcdc,
am33xx_l4_ls__mcspi0,
am33xx_l4_ls__mcspi1,
am33xx_l3_main__tptc0,
am33xx_l3_main__tptc1,
am33xx_l3_main__tptc2,
am33xx_l3_main__ocmc,
-   am33xx_l3_s__usbss,
am33xx_l4_hs__cpgmac0,
am33xx_cpgmac0__mdio,
am33xx_l3_main__sha0,
@@ -2539,6 +2544,15 @@ static struct omap_hwmod_ocp_if *am33xx_hwmod_ocp_ifs[] 
__initdata = {
 
 int __init am33xx_hwmod_init(void)
 {
+   int ret;
+
omap_hwmod_init();
-   return omap_hwmod_register_links(am33xx_hwmod_ocp_ifs);
+   ret = omap_hwmod_register_links(amx3xx_hwmod_ocp_ifs);
+   if (ret  0)
+   return ret;
+
+   if (soc_is_am33xx())
+   return omap_hwmod_register_links(am33xx_hwmod_ocp_ifs);
+
+   return 0;
 }
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 04/13] ARM: OMAP2+: hwmod: AMx3: remove common static fields

2013-08-02 Thread Afzal Mohammed
Hwmod common to AM43x  AM335x has some of fields different (CLKCTRL,
RSTCTRL, RSTST, ocpif clk and clockdomain). It is now updated based
on SoC detection at run time, hence remove statically initialized
entries.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_33xx_data.c |   79 
 1 file changed, 79 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
index 57234a0..a61032d 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
@@ -79,7 +79,6 @@ static struct omap_hwmod am33xx_l3_main_hwmod = {
.main_clk   = l3_gclk,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_PER_L3_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -101,7 +100,6 @@ static struct omap_hwmod am33xx_l3_instr_hwmod = {
.main_clk   = l3_gclk,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_PER_L3_INSTR_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -124,7 +122,6 @@ static struct omap_hwmod am33xx_l4_ls_hwmod = {
.main_clk   = l4ls_gclk,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_PER_L4LS_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -134,12 +131,10 @@ static struct omap_hwmod am33xx_l4_ls_hwmod = {
 static struct omap_hwmod am33xx_l4_hs_hwmod = {
.name   = l4_hs,
.class  = am33xx_l4_hwmod_class,
-   .clkdm_name = l4hs_clkdm,
.flags  = (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET),
.main_clk   = l4hs_gclk,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_PER_L4HS_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -154,7 +149,6 @@ static struct omap_hwmod am33xx_l4_wkup_hwmod = {
.flags  = (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET),
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_WKUP_L4WKUP_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -175,7 +169,6 @@ static struct omap_hwmod am33xx_mpu_hwmod = {
.main_clk   = dpll_mpu_m2_ck,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_MPU_MPU_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -200,12 +193,8 @@ static struct omap_hwmod am33xx_wkup_m3_hwmod = {
.clkdm_name = l4_wkup_aon_clkdm,
/* Keep hardreset asserted */
.flags  = HWMOD_INIT_NO_RESET | HWMOD_NO_IDLEST,
-   .main_clk   = dpll_core_m4_div2_ck,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_WKUP_WKUP_M3_CLKCTRL_OFFSET,
-   .rstctrl_offs   = AM33XX_RM_WKUP_RSTCTRL_OFFSET,
-   .rstst_offs = AM33XX_RM_WKUP_RSTST_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -234,8 +223,6 @@ static struct omap_hwmod am33xx_pruss_hwmod = {
.main_clk   = pruss_ocp_gclk,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_PER_PRUSS_CLKCTRL_OFFSET,
-   .rstctrl_offs   = AM33XX_RM_PER_RSTCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -260,9 +247,6 @@ static struct omap_hwmod am33xx_gfx_hwmod = {
.main_clk   = gfx_fck_div_ck,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_GFX_GFX_CLKCTRL_OFFSET,
-   .rstctrl_offs   = AM33XX_RM_GFX_RSTCTRL_OFFSET,
-   .rstst_offs = AM33XX_RM_GFX_RSTST_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -306,11 +290,9 @@ static struct omap_hwmod_class am33xx_adc_tsc_hwmod_class 
= {
 static struct omap_hwmod am33xx_adc_tsc_hwmod = {
.name   = adc_tsc,
.class  = am33xx_adc_tsc_hwmod_class,
-   .clkdm_name = l4_wkup_clkdm,
.main_clk   = adc_tsc_fck,
.prcm   = {
.omap4  = {
-   .clkctrl_offs   = AM33XX_CM_WKUP_ADC_TSC_CLKCTRL_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
},
@@ -432,7 +414,6 @@ static struct omap_hwmod am33xx_aes0_hwmod = {
.main_clk

[PATCH v2 03/13] ARM: OMAP2+: hwmod: AMx3: runtime AM335x handling

2013-08-02 Thread Afzal Mohammed
Update AM335x CLKCTRL, RSTCTRL, RSTST offsets, clockdomain  ocpif clk
that differ with AM43x at runtime. This is being done so that static
initialization of these details (which are different between AM335x
and AM43x) can be removed to aid in sharing of hwmod data between both
platforms as much as possible.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_33xx_data.c |  118 
 1 file changed, 118 insertions(+)

diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
index b0a38f0..57234a0 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
@@ -2457,6 +2457,115 @@ static struct omap_hwmod_ocp_if am33xx_l3_main__aes0 = {
.user   = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
+#define CLKCTRL(oh, clkctrl) ((oh).prcm.omap4.clkctrl_offs = (clkctrl))
+
+static void am33xx_hwmod_clkctrl(void)
+{
+   CLKCTRL(am33xx_uart2_hwmod, AM33XX_CM_PER_UART1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart3_hwmod, AM33XX_CM_PER_UART2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart4_hwmod, AM33XX_CM_PER_UART3_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart5_hwmod, AM33XX_CM_PER_UART4_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart6_hwmod, AM33XX_CM_PER_UART5_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_dcan0_hwmod, AM33XX_CM_PER_DCAN0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_dcan1_hwmod, AM33XX_CM_PER_DCAN1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_elm_hwmod, AM33XX_CM_PER_ELM_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_epwmss0_hwmod, AM33XX_CM_PER_EPWMSS0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_epwmss1_hwmod, AM33XX_CM_PER_EPWMSS1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_epwmss2_hwmod, AM33XX_CM_PER_EPWMSS2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gpio1_hwmod, AM33XX_CM_PER_GPIO1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gpio2_hwmod, AM33XX_CM_PER_GPIO2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gpio3_hwmod, AM33XX_CM_PER_GPIO3_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_i2c2_hwmod, AM33XX_CM_PER_I2C1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_i2c3_hwmod, AM33XX_CM_PER_I2C2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mailbox_hwmod, AM33XX_CM_PER_MAILBOX0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mcasp0_hwmod, AM33XX_CM_PER_MCASP0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mcasp1_hwmod, AM33XX_CM_PER_MCASP1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mmc0_hwmod, AM33XX_CM_PER_MMC0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mmc1_hwmod, AM33XX_CM_PER_MMC1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_spi0_hwmod, AM33XX_CM_PER_SPI0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_spi1_hwmod, AM33XX_CM_PER_SPI1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_spinlock_hwmod, AM33XX_CM_PER_SPINLOCK_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer2_hwmod, AM33XX_CM_PER_TIMER2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer3_hwmod, AM33XX_CM_PER_TIMER3_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer4_hwmod, AM33XX_CM_PER_TIMER4_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer5_hwmod, AM33XX_CM_PER_TIMER5_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer6_hwmod, AM33XX_CM_PER_TIMER6_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer7_hwmod, AM33XX_CM_PER_TIMER7_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_wkup_m3_hwmod, AM33XX_CM_WKUP_WKUP_M3_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_control_hwmod, AM33XX_CM_WKUP_CONTROL_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_smartreflex0_hwmod,
+   AM33XX_CM_WKUP_SMARTREFLEX0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_smartreflex1_hwmod,
+   AM33XX_CM_WKUP_SMARTREFLEX1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart1_hwmod, AM33XX_CM_WKUP_UART0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer1_hwmod, AM33XX_CM_WKUP_TIMER1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_i2c1_hwmod, AM33XX_CM_WKUP_I2C0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gpio0_hwmod, AM33XX_CM_WKUP_GPIO0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_adc_tsc_hwmod, AM33XX_CM_WKUP_ADC_TSC_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_wd_timer1_hwmod, AM33XX_CM_WKUP_WDT1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_rtc_hwmod, AM33XX_CM_RTC_RTC_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mmc2_hwmod, AM33XX_CM_PER_MMC2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gpmc_hwmod, AM33XX_CM_PER_GPMC_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_l4_ls_hwmod, AM33XX_CM_PER_L4LS_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_l4_wkup_hwmod, AM33XX_CM_WKUP_L4WKUP_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_l3_main_hwmod, AM33XX_CM_PER_L3_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_tpcc_hwmod, AM33XX_CM_PER_TPCC_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_tptc0_hwmod, AM33XX_CM_PER_TPTC0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_tptc1_hwmod, AM33XX_CM_PER_TPTC1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_tptc2_hwmod, AM33XX_CM_PER_TPTC2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gfx_hwmod, AM33XX_CM_GFX_GFX_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_l4_hs_hwmod, AM33XX_CM_PER_L4HS_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_cpgmac0_hwmod, AM33XX_CM_PER_CPGMAC0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_pruss_hwmod

[PATCH v2 01/13] ARM: OMAP2+: CM: reintroduce SW_SLEEP for OMAP4

2013-08-02 Thread Afzal Mohammed
From: Vaibhav Bedia vaibhav.be...@ti.com

65aa94b ARM: OMAP4: clockdomain/CM code: Update supported transition modes
removed SW_SLEEP mode for clockdomains on OMAP4 class of devices. Not
having SW_SLEEP mode works fine for OMAP4/5 devices but it gets in the
way of reuse for other devices like AM43x which have the same hardware
but where most of clockdomains support only SW_SLEEP/SW_WKUP modes.

This also can help make AM335x (which has custom functions) reuse
OMAP4 PRM/CM functions.

While here also fixup a trivial typo in the comment.

[af...@ti.com: Alter message to refer to AM43x instead of AM335x, this
 was pulled in from series that reuses OMAP4 PRM/CM for AM335x, which
 as of now is not being followed upon]
Signed-off-by: Vaibhav Bedia vaibhav.be...@ti.com
Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/cminst44xx.c |   20 +---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-omap2/cminst44xx.c b/arch/arm/mach-omap2/cminst44xx.c
index f0290f5..35051fd 100644
--- a/arch/arm/mach-omap2/cminst44xx.c
+++ b/arch/arm/mach-omap2/cminst44xx.c
@@ -237,7 +237,7 @@ void omap4_cminst_clkdm_disable_hwsup(u8 part, s16 inst, 
u16 cdoffs)
 }
 
 /**
- * omap4_cminst_clkdm_force_sleep - try to take a clockdomain out of idle
+ * omap4_cminst_clkdm_force_wakeup - try to take a clockdomain out of idle
  * @part: PRCM partition ID that the clockdomain registers exist in
  * @inst: CM instance register offset (*_INST macro)
  * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
@@ -250,6 +250,20 @@ void omap4_cminst_clkdm_force_wakeup(u8 part, s16 inst, 
u16 cdoffs)
_clktrctrl_write(OMAP34XX_CLKSTCTRL_FORCE_WAKEUP, part, inst, cdoffs);
 }
 
+/**
+ * omap4_cminst_clkdm_force_sleep - try to put a clockdomain to idle
+ * @part: PRCM partition ID that the clockdomain registers exist in
+ * @inst: CM instance register offset (*_INST macro)
+ * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
+ *
+ * Put a clockdomain referred to by (@part, @inst, @cdoffs) to idle,
+ * forcing it to sleep.  No return value.
+ */
+void omap4_cminst_clkdm_force_sleep(u8 part, s16 inst, u16 cdoffs)
+{
+   _clktrctrl_write(OMAP34XX_CLKSTCTRL_FORCE_SLEEP, part, inst, cdoffs);
+}
+
 /*
  *
  */
@@ -404,8 +418,8 @@ static int omap4_clkdm_clear_all_wkup_sleep_deps(struct 
clockdomain *clkdm)
 
 static int omap4_clkdm_sleep(struct clockdomain *clkdm)
 {
-   omap4_cminst_clkdm_enable_hwsup(clkdm-prcm_partition,
-   clkdm-cm_inst, clkdm-clkdm_offs);
+   omap4_cminst_clkdm_force_sleep(clkdm-prcm_partition,
+  clkdm-cm_inst, clkdm-clkdm_offs);
return 0;
 }
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 06/13] ARM: OMAP2+: PRCM: AM43x definitions

2013-08-02 Thread Afzal Mohammed
Add AM43x CMINST, CDOFFS, RM_RSTST  RM_RSTCTRL definitions - minimal
ones that would be used.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/prcm43xx.h |  141 
 1 file changed, 141 insertions(+)
 create mode 100644 arch/arm/mach-omap2/prcm43xx.h

diff --git a/arch/arm/mach-omap2/prcm43xx.h b/arch/arm/mach-omap2/prcm43xx.h
new file mode 100644
index 000..f0636ec
--- /dev/null
+++ b/arch/arm/mach-omap2/prcm43xx.h
@@ -0,0 +1,141 @@
+/*
+ * AM43x PRCM defines
+ *
+ * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed as is without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#ifndef __ARCH_ARM_MACH_OMAP2_PRCM_43XX_H
+#define __ARCH_ARM_MACH_OMAP2_PRCM_43XX_H
+
+#define AM43XX_PRM_PARTITION   1
+#define AM43XX_CM_PARTITION1
+
+/* PRM instances */
+#define AM43XX_PRM_OCP_SOCKET_INST 0x
+#define AM43XX_PRM_MPU_INST0x0300
+#define AM43XX_PRM_GFX_INST0x0400
+#define AM43XX_PRM_RTC_INST0x0500
+#define AM43XX_PRM_TAMPER_INST 0x0600
+#define AM43XX_PRM_CEFUSE_INST 0x0700
+#define AM43XX_PRM_PER_INST0x0800
+#define AM43XX_PRM_WKUP_INST   0x2000
+#define AM43XX_PRM_DEVICE_INST 0x4000
+
+/* RM RSTCTRL offsets */
+#define AM43XX_RM_PER_RSTCTRL_OFFSET   0x0010
+#define AM43XX_RM_GFX_RSTCTRL_OFFSET   0x0010
+#define AM43XX_RM_WKUP_RSTCTRL_OFFSET  0x0010
+
+/* RM RSTST offsets */
+#define AM43XX_RM_GFX_RSTST_OFFSET 0x0014
+#define AM43XX_RM_WKUP_RSTST_OFFSET0x0014
+
+/* CM instances */
+#define AM43XX_CM_WKUP_INST0x2800
+#define AM43XX_CM_DEVICE_INST  0x4100
+#define AM43XX_CM_DPLL_INST0x4200
+#define AM43XX_CM_MPU_INST 0x8300
+#define AM43XX_CM_GFX_INST 0x8400
+#define AM43XX_CM_RTC_INST 0x8500
+#define AM43XX_CM_TAMPER_INST  0x8600
+#define AM43XX_CM_CEFUSE_INST  0x8700
+#define AM43XX_CM_PER_INST 0x8800
+
+/* CD offsets */
+#define AM43XX_CM_WKUP_L3_AON_CDOFFS   0x
+#define AM43XX_CM_WKUP_L3S_TSC_CDOFFS  0x0100
+#define AM43XX_CM_WKUP_L4_WKUP_AON_CDOFFS  0x0200
+#define AM43XX_CM_WKUP_WKUP_CDOFFS 0x0300
+#define AM43XX_CM_MPU_MPU_CDOFFS   0x
+#define AM43XX_CM_GFX_GFX_L3_CDOFFS0x
+#define AM43XX_CM_RTC_RTC_CDOFFS   0x
+#define AM43XX_CM_TAMPER_TAMPER_CDOFFS 0x
+#define AM43XX_CM_CEFUSE_CEFUSE_CDOFFS 0x
+#define AM43XX_CM_PER_L3_CDOFFS0x
+#define AM43XX_CM_PER_L3S_CDOFFS   0x0200
+#define AM43XX_CM_PER_ICSS_CDOFFS  0x0300
+#define AM43XX_CM_PER_L4LS_CDOFFS  0x0400
+#define AM43XX_CM_PER_EMIF_CDOFFS  0x0700
+#define AM43XX_CM_PER_DSS_CDOFFS   0x0a00
+#define AM43XX_CM_PER_CPSW_CDOFFS  0x0b00
+#define AM43XX_CM_PER_OCPWP_L3_CDOFFS  0x0c00
+
+/* CLK CTRL offsets */
+#define AM43XX_CM_PER_UART1_CLKCTRL_OFFSET 0x0580
+#define AM43XX_CM_PER_UART2_CLKCTRL_OFFSET 0x0588
+#define AM43XX_CM_PER_UART3_CLKCTRL_OFFSET 0x0590
+#define AM43XX_CM_PER_UART4_CLKCTRL_OFFSET 0x0598
+#define AM43XX_CM_PER_UART5_CLKCTRL_OFFSET 0x05a0
+#define AM43XX_CM_PER_DCAN0_CLKCTRL_OFFSET 0x0428
+#define AM43XX_CM_PER_DCAN1_CLKCTRL_OFFSET 0x0430
+#define AM43XX_CM_PER_ELM_CLKCTRL_OFFSET   0x0468
+#define AM43XX_CM_PER_EPWMSS0_CLKCTRL_OFFSET   0x0438
+#define AM43XX_CM_PER_EPWMSS1_CLKCTRL_OFFSET   0x0440
+#define AM43XX_CM_PER_EPWMSS2_CLKCTRL_OFFSET   0x0448
+#define AM43XX_CM_PER_GPIO1_CLKCTRL_OFFSET 0x0478
+#define AM43XX_CM_PER_GPIO2_CLKCTRL_OFFSET 0x0480
+#define AM43XX_CM_PER_GPIO3_CLKCTRL_OFFSET 0x0488
+#define AM43XX_CM_PER_I2C1_CLKCTRL_OFFSET  0x04a8
+#define AM43XX_CM_PER_I2C2_CLKCTRL_OFFSET  0x04b0
+#define AM43XX_CM_PER_MAILBOX0_CLKCTRL_OFFSET  0x04b8
+#define AM43XX_CM_PER_MMC0_CLKCTRL_OFFSET  0x04c0
+#define AM43XX_CM_PER_MMC1_CLKCTRL_OFFSET  0x04c8
+#define AM43XX_CM_PER_SPI0_CLKCTRL_OFFSET  0x0500
+#define AM43XX_CM_PER_SPI1_CLKCTRL_OFFSET

[PATCH v2 05/13] ARM: OMAP2+: CM: cm_inst offset s16-u16

2013-08-02 Thread Afzal Mohammed
From: Ankur Kishore a-kish...@ti.com

Most of the AM43x CM reg address offsets are with MSB bit '1' (on
16-bit value) leading to arithmetic miscalculations while calculating
CLOCK ENABLE register's address because cm_inst field was a type of
const s16, so make it const u16.

Also modify relevant functions so as to take care of the above.

Signed-off-by: Ankur Kishore a-kish...@ti.com
Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/clockdomain.h |2 +-
 arch/arm/mach-omap2/cm33xx.c  |   30 +++---
 arch/arm/mach-omap2/cm33xx.h  |   26 +-
 arch/arm/mach-omap2/cminst44xx.c  |   31 ---
 arch/arm/mach-omap2/cminst44xx.h  |   25 +
 5 files changed, 58 insertions(+), 56 deletions(-)

diff --git a/arch/arm/mach-omap2/clockdomain.h 
b/arch/arm/mach-omap2/clockdomain.h
index daeecf1..8c22ce6 100644
--- a/arch/arm/mach-omap2/clockdomain.h
+++ b/arch/arm/mach-omap2/clockdomain.h
@@ -132,7 +132,7 @@ struct clockdomain {
u8 _flags;
const u8 dep_bit;
const u8 prcm_partition;
-   const s16 cm_inst;
+   const u16 cm_inst;
const u16 clkdm_offs;
struct clkdm_dep *wkdep_srcs;
struct clkdm_dep *sleepdep_srcs;
diff --git a/arch/arm/mach-omap2/cm33xx.c b/arch/arm/mach-omap2/cm33xx.c
index 325a515..59f276d 100644
--- a/arch/arm/mach-omap2/cm33xx.c
+++ b/arch/arm/mach-omap2/cm33xx.c
@@ -48,13 +48,13 @@
 /* Private functions */
 
 /* Read a register in a CM instance */
-static inline u32 am33xx_cm_read_reg(s16 inst, u16 idx)
+static inline u32 am33xx_cm_read_reg(u16 inst, u16 idx)
 {
return __raw_readl(cm_base + inst + idx);
 }
 
 /* Write into a register in a CM */
-static inline void am33xx_cm_write_reg(u32 val, s16 inst, u16 idx)
+static inline void am33xx_cm_write_reg(u32 val, u16 inst, u16 idx)
 {
__raw_writel(val, cm_base + inst + idx);
 }
@@ -82,7 +82,7 @@ static inline u32 am33xx_cm_clear_reg_bits(u32 bits, s16 
inst, s16 idx)
return am33xx_cm_rmw_reg_bits(bits, 0x0, inst, idx);
 }
 
-static inline u32 am33xx_cm_read_reg_bits(u16 inst, s16 idx, u32 mask)
+static inline u32 am33xx_cm_read_reg_bits(u16 inst, u16 idx, u32 mask)
 {
u32 v;
 
@@ -102,7 +102,7 @@ static inline u32 am33xx_cm_read_reg_bits(u16 inst, s16 
idx, u32 mask)
  * Return the IDLEST bitfield of a CM_*_CLKCTRL register, shifted down to
  * bit 0.
  */
-static u32 _clkctrl_idlest(u16 inst, s16 cdoffs, u16 clkctrl_offs)
+static u32 _clkctrl_idlest(u16 inst, u16 cdoffs, u16 clkctrl_offs)
 {
u32 v = am33xx_cm_read_reg(inst, clkctrl_offs);
v = AM33XX_IDLEST_MASK;
@@ -119,7 +119,7 @@ static u32 _clkctrl_idlest(u16 inst, s16 cdoffs, u16 
clkctrl_offs)
  * Returns true if the module's CM_*_CLKCTRL.IDLEST bitfield is either
  * *FUNCTIONAL or *INTERFACE_IDLE; false otherwise.
  */
-static bool _is_module_ready(u16 inst, s16 cdoffs, u16 clkctrl_offs)
+static bool _is_module_ready(u16 inst, u16 cdoffs, u16 clkctrl_offs)
 {
u32 v;
 
@@ -138,7 +138,7 @@ static bool _is_module_ready(u16 inst, s16 cdoffs, u16 
clkctrl_offs)
  * @c must be the unshifted value for CLKTRCTRL - i.e., this function
  * will handle the shift itself.
  */
-static void _clktrctrl_write(u8 c, s16 inst, u16 cdoffs)
+static void _clktrctrl_write(u8 c, u16 inst, u16 cdoffs)
 {
u32 v;
 
@@ -158,7 +158,7 @@ static void _clktrctrl_write(u8 c, s16 inst, u16 cdoffs)
  * Returns true if the clockdomain referred to by (@inst, @cdoffs)
  * is in hardware-supervised idle mode, or 0 otherwise.
  */
-bool am33xx_cm_is_clkdm_in_hwsup(s16 inst, u16 cdoffs)
+bool am33xx_cm_is_clkdm_in_hwsup(u16 inst, u16 cdoffs)
 {
u32 v;
 
@@ -177,7 +177,7 @@ bool am33xx_cm_is_clkdm_in_hwsup(s16 inst, u16 cdoffs)
  * Put a clockdomain referred to by (@inst, @cdoffs) into
  * hardware-supervised idle mode.  No return value.
  */
-void am33xx_cm_clkdm_enable_hwsup(s16 inst, u16 cdoffs)
+void am33xx_cm_clkdm_enable_hwsup(u16 inst, u16 cdoffs)
 {
_clktrctrl_write(OMAP34XX_CLKSTCTRL_ENABLE_AUTO, inst, cdoffs);
 }
@@ -191,7 +191,7 @@ void am33xx_cm_clkdm_enable_hwsup(s16 inst, u16 cdoffs)
  * software-supervised idle mode, i.e., controlled manually by the
  * Linux OMAP clockdomain code.  No return value.
  */
-void am33xx_cm_clkdm_disable_hwsup(s16 inst, u16 cdoffs)
+void am33xx_cm_clkdm_disable_hwsup(u16 inst, u16 cdoffs)
 {
_clktrctrl_write(OMAP34XX_CLKSTCTRL_DISABLE_AUTO, inst, cdoffs);
 }
@@ -204,7 +204,7 @@ void am33xx_cm_clkdm_disable_hwsup(s16 inst, u16 cdoffs)
  * Put a clockdomain referred to by (@inst, @cdoffs) into idle
  * No return value.
  */
-void am33xx_cm_clkdm_force_sleep(s16 inst, u16 cdoffs)
+void am33xx_cm_clkdm_force_sleep(u16 inst, u16 cdoffs)
 {
_clktrctrl_write(OMAP34XX_CLKSTCTRL_FORCE_SLEEP, inst, cdoffs);
 }
@@ -217,7 +217,7 @@ void am33xx_cm_clkdm_force_sleep(s16 inst, u16 cdoffs)
  * Take a clockdomain referred to by (@inst

[PATCH v2 09/13] ARM: OMAP2+: hwmod: AMx3: runtime AM43x handling

2013-08-02 Thread Afzal Mohammed
Update AM43x CLKCTRL, RSTCTRL, RSTST offsets, clockdomain  ocpif clk
that differ with AM335x at runtime. This helps in reusing much of the
AM335x hwmod data's for AM43x.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_33xx_data.c |  110 
 1 file changed, 110 insertions(+)

diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
index a61032d..7897fec 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
@@ -26,6 +26,7 @@
 #include cm33xx.h
 #include prm33xx.h
 #include prm-regbits-33xx.h
+#include prcm43xx.h
 #include i2c.h
 #include mmc.h
 #include wd_timer.h
@@ -2380,6 +2381,71 @@ static struct omap_hwmod_ocp_if am33xx_l3_main__aes0 = {
 
 #define CLKCTRL(oh, clkctrl) ((oh).prcm.omap4.clkctrl_offs = (clkctrl))
 
+static void am43xx_hwmod_clkctrl(void)
+{
+   CLKCTRL(am33xx_uart2_hwmod, AM43XX_CM_PER_UART1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart3_hwmod, AM43XX_CM_PER_UART2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart4_hwmod, AM43XX_CM_PER_UART3_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart5_hwmod, AM43XX_CM_PER_UART4_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart6_hwmod, AM43XX_CM_PER_UART5_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_dcan0_hwmod, AM43XX_CM_PER_DCAN0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_dcan1_hwmod, AM43XX_CM_PER_DCAN1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_elm_hwmod, AM43XX_CM_PER_ELM_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_epwmss0_hwmod, AM43XX_CM_PER_EPWMSS0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_epwmss1_hwmod, AM43XX_CM_PER_EPWMSS1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_epwmss2_hwmod, AM43XX_CM_PER_EPWMSS2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gpio1_hwmod, AM43XX_CM_PER_GPIO1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gpio2_hwmod, AM43XX_CM_PER_GPIO2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gpio3_hwmod, AM43XX_CM_PER_GPIO3_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_i2c2_hwmod, AM43XX_CM_PER_I2C1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_i2c3_hwmod, AM43XX_CM_PER_I2C2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mailbox_hwmod, AM43XX_CM_PER_MAILBOX0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mmc0_hwmod, AM43XX_CM_PER_MMC0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mmc1_hwmod, AM43XX_CM_PER_MMC1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_spi0_hwmod, AM43XX_CM_PER_SPI0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_spi1_hwmod, AM43XX_CM_PER_SPI1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_spinlock_hwmod, AM43XX_CM_PER_SPINLOCK_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer2_hwmod, AM43XX_CM_PER_TIMER2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer3_hwmod, AM43XX_CM_PER_TIMER3_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer4_hwmod, AM43XX_CM_PER_TIMER4_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer5_hwmod, AM43XX_CM_PER_TIMER5_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer6_hwmod, AM43XX_CM_PER_TIMER6_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer7_hwmod, AM43XX_CM_PER_TIMER7_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_wkup_m3_hwmod, AM43XX_CM_WKUP_WKUP_M3_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_control_hwmod, AM43XX_CM_WKUP_CONTROL_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_smartreflex0_hwmod,
+   AM43XX_CM_WKUP_SMARTREFLEX0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_smartreflex1_hwmod,
+   AM43XX_CM_WKUP_SMARTREFLEX1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_uart1_hwmod, AM43XX_CM_WKUP_UART0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_timer1_hwmod, AM43XX_CM_WKUP_TIMER1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_i2c1_hwmod, AM43XX_CM_WKUP_I2C0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gpio0_hwmod, AM43XX_CM_WKUP_GPIO0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_adc_tsc_hwmod, AM43XX_CM_WKUP_ADC_TSC_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_wd_timer1_hwmod, AM43XX_CM_WKUP_WDT1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_l4_wkup_hwmod, AM43XX_CM_WKUP_L4WKUP_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_rtc_hwmod, AM43XX_CM_RTC_RTC_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mmc2_hwmod, AM43XX_CM_PER_MMC2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gpmc_hwmod, AM43XX_CM_PER_GPMC_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mcasp0_hwmod, AM43XX_CM_PER_MCASP0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mcasp1_hwmod, AM43XX_CM_PER_MCASP1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_l4_ls_hwmod, AM43XX_CM_PER_L4LS_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_l3_main_hwmod, AM43XX_CM_PER_L3_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_tpcc_hwmod, AM43XX_CM_PER_TPCC_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_tptc0_hwmod, AM43XX_CM_PER_TPTC0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_tptc1_hwmod, AM43XX_CM_PER_TPTC1_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_tptc2_hwmod, AM43XX_CM_PER_TPTC2_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_cpgmac0_hwmod, AM43XX_CM_PER_CPGMAC0_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_pruss_hwmod, AM43XX_CM_PER_PRUSS_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_gfx_hwmod, AM43XX_CM_GFX_GFX_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_l4_hs_hwmod, AM43XX_CM_PER_L4HS_CLKCTRL_OFFSET);
+   CLKCTRL(am33xx_mpu_hwmod

[PATCH v2 10/13] ARM: OMAP2+: hwmod: AM43x operations

2013-08-02 Thread Afzal Mohammed
Reuse OMAP4 operations on AM43x.

Signed-off-by: Ambresh K ambr...@ti.com
Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod.c |8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 7f4db12..a1b7e20 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -4123,6 +4123,14 @@ void __init omap_hwmod_init(void)
soc_ops.init_clkdm = _init_clkdm;
soc_ops.update_context_lost = _omap4_update_context_lost;
soc_ops.get_context_lost = _omap4_get_context_lost;
+   } else if (soc_is_am43xx()) {
+   soc_ops.enable_module = _omap4_enable_module;
+   soc_ops.disable_module = _omap4_disable_module;
+   soc_ops.wait_target_ready = _omap4_wait_target_ready;
+   soc_ops.assert_hardreset = _omap4_assert_hardreset;
+   soc_ops.deassert_hardreset = _omap4_deassert_hardreset;
+   soc_ops.is_hardreset_asserted = _omap4_is_hardreset_asserted;
+   soc_ops.init_clkdm = _init_clkdm;
} else if (soc_is_am33xx()) {
soc_ops.enable_module = _am33xx_enable_module;
soc_ops.disable_module = _am33xx_disable_module;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 08/13] ARM: OMAP2+: CM: AM43x clockdomain data

2013-08-02 Thread Afzal Mohammed
From: Ambresh K ambr...@ti.com

Add the data file to describe clock domains in AM43x SoC.
OMAP4 clockdomain operations is being reused here.

Signed-off-by: Ambresh K ambr...@ti.com
Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/clockdomain.h   |2 +
 arch/arm/mach-omap2/clockdomains43xx_data.c |  199 +++
 arch/arm/mach-omap2/cminst44xx.c|9 ++
 3 files changed, 210 insertions(+)
 create mode 100644 arch/arm/mach-omap2/clockdomains43xx_data.c

diff --git a/arch/arm/mach-omap2/clockdomain.h 
b/arch/arm/mach-omap2/clockdomain.h
index 8c22ce6..7397b3f 100644
--- a/arch/arm/mach-omap2/clockdomain.h
+++ b/arch/arm/mach-omap2/clockdomain.h
@@ -215,6 +215,7 @@ extern void __init omap242x_clockdomains_init(void);
 extern void __init omap243x_clockdomains_init(void);
 extern void __init omap3xxx_clockdomains_init(void);
 extern void __init am33xx_clockdomains_init(void);
+extern void am43xx_clockdomains_init(void);
 extern void __init omap44xx_clockdomains_init(void);
 extern void __init omap54xx_clockdomains_init(void);
 
@@ -225,6 +226,7 @@ extern struct clkdm_ops omap2_clkdm_operations;
 extern struct clkdm_ops omap3_clkdm_operations;
 extern struct clkdm_ops omap4_clkdm_operations;
 extern struct clkdm_ops am33xx_clkdm_operations;
+extern struct clkdm_ops am43xx_clkdm_operations;
 
 extern struct clkdm_dep gfx_24xx_wkdeps[];
 extern struct clkdm_dep dsp_24xx_wkdeps[];
diff --git a/arch/arm/mach-omap2/clockdomains43xx_data.c 
b/arch/arm/mach-omap2/clockdomains43xx_data.c
new file mode 100644
index 000..3ca8b64
--- /dev/null
+++ b/arch/arm/mach-omap2/clockdomains43xx_data.c
@@ -0,0 +1,199 @@
+/*
+ * AM43xx Clock domains framework
+ *
+ * Copyright (C) 2013 Texas Instruments, Inc.
+ *
+ * This file is made by modifying the file generated automatically
+ * from the OMAP hardware databases.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include linux/kernel.h
+#include linux/io.h
+
+#include clockdomain.h
+#include prcm44xx.h
+#include prcm43xx.h
+
+static struct clockdomain l4_cefuse_43xx_clkdm = {
+   .name = l4_cefuse_clkdm,
+   .pwrdm= { .name = cefuse_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_CEFUSE_INST,
+   .clkdm_offs   = AM43XX_CM_CEFUSE_CEFUSE_CDOFFS,
+   .flags= CLKDM_CAN_SWSUP,
+};
+
+static struct clockdomain mpu_43xx_clkdm = {
+   .name = mpu_clkdm,
+   .pwrdm= { .name = mpu_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_MPU_INST,
+   .clkdm_offs   = AM43XX_CM_MPU_MPU_CDOFFS,
+   .flags= CLKDM_CAN_HWSUP_SWSUP,
+};
+
+static struct clockdomain l4ls_43xx_clkdm = {
+   .name = l4ls_clkdm,
+   .pwrdm= { .name = per_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_PER_INST,
+   .clkdm_offs   = AM43XX_CM_PER_L4LS_CDOFFS,
+   .flags= CLKDM_CAN_SWSUP,
+};
+
+static struct clockdomain tamper_43xx_clkdm = {
+   .name = tamper_clkdm,
+   .pwrdm= { .name = tamper_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_TAMPER_INST,
+   .clkdm_offs   = AM43XX_CM_TAMPER_TAMPER_CDOFFS,
+   .flags= CLKDM_CAN_SWSUP,
+};
+
+static struct clockdomain l4_rtc_43xx_clkdm = {
+   .name = l4_rtc_clkdm,
+   .pwrdm= { .name = rtc_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_RTC_INST,
+   .clkdm_offs   = AM43XX_CM_RTC_RTC_CDOFFS,
+   .flags= CLKDM_CAN_SWSUP,
+};
+
+static struct clockdomain pruss_ocp_43xx_clkdm = {
+   .name = pruss_ocp_clkdm,
+   .pwrdm= { .name = per_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_PER_INST,
+   .clkdm_offs   = AM43XX_CM_PER_ICSS_CDOFFS,
+   .flags= CLKDM_CAN_SWSUP,
+};
+
+static struct clockdomain ocpwp_l3_43xx_clkdm = {
+   .name = ocpwp_l3_clkdm,
+   .pwrdm= { .name = per_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_PER_INST,
+   .clkdm_offs   = AM43XX_CM_PER_OCPWP_L3_CDOFFS,
+   .flags= CLKDM_CAN_SWSUP,
+};
+
+static struct clockdomain l3s_tsc_43xx_clkdm = {
+   .name = l3s_tsc_clkdm,
+   .pwrdm= { .name = wkup_pwrdm },
+   .prcm_partition   = AM43XX_CM_PARTITION,
+   .cm_inst  = AM43XX_CM_WKUP_INST,
+   .clkdm_offs   = AM43XX_CM_WKUP_L3S_TSC_CDOFFS,
+   .flags

[PATCH v2 07/13] ARM: OMAP2+: PM: AM43x powerdomain data

2013-08-02 Thread Afzal Mohammed
From: Ambresh K ambr...@ti.com

Add the data file to describe all power domains in AM43x SoC.
OMAP4 powerdomain operations is being reused here.

Signed-off-by: Ambresh K ambr...@ti.com
Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/powerdomain.h   |1 +
 arch/arm/mach-omap2/powerdomains43xx_data.c |  145 +++
 2 files changed, 146 insertions(+)
 create mode 100644 arch/arm/mach-omap2/powerdomains43xx_data.c

diff --git a/arch/arm/mach-omap2/powerdomain.h 
b/arch/arm/mach-omap2/powerdomain.h
index e4d7bd6..56ad9f5 100644
--- a/arch/arm/mach-omap2/powerdomain.h
+++ b/arch/arm/mach-omap2/powerdomain.h
@@ -254,6 +254,7 @@ extern void omap242x_powerdomains_init(void);
 extern void omap243x_powerdomains_init(void);
 extern void omap3xxx_powerdomains_init(void);
 extern void am33xx_powerdomains_init(void);
+extern void am43xx_powerdomains_init(void);
 extern void omap44xx_powerdomains_init(void);
 extern void omap54xx_powerdomains_init(void);
 
diff --git a/arch/arm/mach-omap2/powerdomains43xx_data.c 
b/arch/arm/mach-omap2/powerdomains43xx_data.c
new file mode 100644
index 000..45e4363
--- /dev/null
+++ b/arch/arm/mach-omap2/powerdomains43xx_data.c
@@ -0,0 +1,145 @@
+/*
+ * AM43xx Power domains framework
+ *
+ * Copyright (C) 2013 Texas Instruments, Inc.
+ *
+ * This file is made by modifying the file generated automatically
+ * from the OMAP hardware databases.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include linux/kernel.h
+#include linux/init.h
+
+#include powerdomain.h
+
+#include prcm-common.h
+#include prcm44xx.h
+#include prcm43xx.h
+
+static struct powerdomain gfx_43xx_pwrdm = {
+   .name = gfx_pwrdm,
+   .voltdm   = { .name = core },
+   .prcm_offs= AM43XX_PRM_GFX_INST,
+   .prcm_partition   = AM43XX_PRM_PARTITION,
+   .pwrsts   = PWRSTS_OFF_ON,
+   .banks= 1,
+   .pwrsts_mem_ret = {
+   [0] = PWRSTS_OFF_RET,   /* gfx_mem */
+   },
+   .pwrsts_mem_on  = {
+   [0] = PWRSTS_ON,/* gfx_mem */
+   },
+   .flags= PWRDM_HAS_LOWPOWERSTATECHANGE,
+};
+
+static struct powerdomain mpu_43xx_pwrdm = {
+   .name = mpu_pwrdm,
+   .voltdm   = { .name = mpu },
+   .prcm_offs= AM43XX_PRM_MPU_INST,
+   .prcm_partition   = AM43XX_PRM_PARTITION,
+   .pwrsts   = PWRSTS_OFF_RET_ON,
+   .pwrsts_logic_ret = PWRSTS_OFF_RET,
+   .banks= 3,
+   .pwrsts_mem_ret = {
+   [0] = PWRSTS_OFF_RET,   /* mpu_l1 */
+   [1] = PWRSTS_OFF_RET,   /* mpu_l2 */
+   [2] = PWRSTS_OFF_RET,   /* mpu_ram */
+   },
+   .pwrsts_mem_on  = {
+   [0] = PWRSTS_ON,/* mpu_l1 */
+   [1] = PWRSTS_ON,/* mpu_l2 */
+   [2] = PWRSTS_ON,/* mpu_ram */
+   },
+   .flags= PWRDM_HAS_LOWPOWERSTATECHANGE,
+};
+
+static struct powerdomain rtc_43xx_pwrdm = {
+   .name = rtc_pwrdm,
+   .voltdm   = { .name = rtc },
+   .prcm_offs= AM43XX_PRM_RTC_INST,
+   .prcm_partition   = AM43XX_PRM_PARTITION,
+   .pwrsts   = PWRSTS_ON,
+};
+
+static struct powerdomain wkup_43xx_pwrdm = {
+   .name = wkup_pwrdm,
+   .voltdm   = { .name = core },
+   .prcm_offs= AM43XX_PRM_WKUP_INST,
+   .prcm_partition   = AM43XX_PRM_PARTITION,
+   .pwrsts   = PWRSTS_ON,
+   .banks= 1,
+   .pwrsts_mem_ret = {
+   [0] = PWRSTS_OFF,   /* debugss_mem */
+   },
+   .pwrsts_mem_on  = {
+   [0] = PWRSTS_ON,/* debugss_mem */
+   },
+};
+
+static struct powerdomain tamper_43xx_pwrdm = {
+   .name = tamper_pwrdm,
+   .voltdm   = { .name = tamper },
+   .prcm_offs= AM43XX_PRM_TAMPER_INST,
+   .prcm_partition   = AM43XX_PRM_PARTITION,
+   .pwrsts   = PWRSTS_ON,
+};
+
+static struct powerdomain cefuse_43xx_pwrdm = {
+   .name = cefuse_pwrdm,
+   .voltdm   = { .name = core },
+   .prcm_offs= AM43XX_PRM_CEFUSE_INST,
+   .prcm_partition   = AM43XX_PRM_PARTITION,
+   .pwrsts   = PWRSTS_OFF_ON,
+   .flags= PWRDM_HAS_LOWPOWERSTATECHANGE,
+};
+
+static struct powerdomain per_43xx_pwrdm = {
+   .name = per_pwrdm,
+   .voltdm   = { .name = core },
+   .prcm_offs= AM43XX_PRM_PER_INST,
+   .prcm_partition   = AM43XX_PRM_PARTITION,
+   .pwrsts   = PWRSTS_OFF_RET_ON,
+   .pwrsts_logic_ret = PWRSTS_OFF_RET,
+   .banks= 4,
+   .pwrsts_mem_ret = {
+   [0] = PWRSTS_OFF_RET,   /* icss_mem

[PATCH v2 13/13] ARM: OMAP2+: hwmod: AM43x: new w.r.t AM335x

2013-08-02 Thread Afzal Mohammed
Add hwmod support for IP's that are present in AM43x, but not in
AM335x. AM43x additional ones added here are,
1. synctimer
2. timer8-11
3. ehrpwm3-5
4. spi2-4
5. gpio4-5

Also AM43x pruss interconnect is different asc compared to AM335x.

Update hwmod with the above details and register 'ocpif' if platform
being run is AM43x.

AM43x also has IP's like qspi, hdq1w, vpfe, des, rng, usb, dss. These
are not handled here due to either of following two reasons,
1. To avoid churn; most of them don't have DT bindings, which would
   necessitate adding address space in hwmod, which any way would have
   to be removed once DT bindings happen with driver support.
2. patches would come in from sources other than the author

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_33xx_data.c |  366 +++-
 1 file changed, 364 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
index 7897fec..0efafd8 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
@@ -1595,6 +1595,228 @@ static struct omap_hwmod am33xx_usbss_hwmod = {
},
 };
 
+static struct omap_hwmod_class_sysconfig am43xx_synctimer_sysc = {
+   .rev_offs   = 0x0,
+   .sysc_offs  = 0x4,
+   .sysc_flags = SYSC_HAS_SIDLEMODE,
+   .idlemodes  = (SIDLE_FORCE | SIDLE_NO),
+   .sysc_fields= omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class am43xx_synctimer_hwmod_class = {
+   .name   = synctimer,
+   .sysc   = am43xx_synctimer_sysc,
+};
+
+static struct omap_hwmod am43xx_synctimer_hwmod = {
+   .name   = counter_32k,
+   .class  = am43xx_synctimer_hwmod_class,
+   .clkdm_name = l4_wkup_aon_clkdm,
+   .flags  = HWMOD_SWSUP_SIDLE,
+   .main_clk   = synctimer_32kclk,
+   .prcm = {
+   .omap4 = {
+   .clkctrl_offs = AM43XX_CM_WKUP_SYNCTIMER_CLKCTRL_OFFSET,
+   .modulemode   = MODULEMODE_SWCTRL,
+   },
+   },
+};
+
+static struct omap_hwmod am43xx_timer8_hwmod = {
+   .name   = timer8,
+   .class  = am33xx_timer_hwmod_class,
+   .clkdm_name = l4ls_clkdm,
+   .main_clk   = timer8_fck,
+   .prcm   = {
+   .omap4  = {
+   .clkctrl_offs   = AM43XX_CM_PER_TIMER8_CLKCTRL_OFFSET,
+   .modulemode = MODULEMODE_SWCTRL,
+   },
+   },
+};
+
+static struct omap_hwmod am43xx_timer9_hwmod = {
+   .name   = timer9,
+   .class  = am33xx_timer_hwmod_class,
+   .clkdm_name = l4ls_clkdm,
+   .main_clk   = timer9_fck,
+   .prcm   = {
+   .omap4  = {
+   .clkctrl_offs   = AM43XX_CM_PER_TIMER9_CLKCTRL_OFFSET,
+   .modulemode = MODULEMODE_SWCTRL,
+   },
+   },
+};
+
+static struct omap_hwmod am43xx_timer10_hwmod = {
+   .name   = timer10,
+   .class  = am33xx_timer_hwmod_class,
+   .clkdm_name = l4ls_clkdm,
+   .main_clk   = timer10_fck,
+   .prcm   = {
+   .omap4  = {
+   .clkctrl_offs   = AM43XX_CM_PER_TIMER10_CLKCTRL_OFFSET,
+   .modulemode = MODULEMODE_SWCTRL,
+   },
+   },
+};
+
+static struct omap_hwmod am43xx_timer11_hwmod = {
+   .name   = timer11,
+   .class  = am33xx_timer_hwmod_class,
+   .clkdm_name = l4ls_clkdm,
+   .main_clk   = timer11_fck,
+   .prcm   = {
+   .omap4  = {
+   .clkctrl_offs   = AM43XX_CM_PER_TIMER11_CLKCTRL_OFFSET,
+   .modulemode = MODULEMODE_SWCTRL,
+   },
+   },
+};
+
+static struct omap_hwmod am43xx_epwmss3_hwmod = {
+   .name   = epwmss3,
+   .class  = am33xx_epwmss_hwmod_class,
+   .clkdm_name = l4ls_clkdm,
+   .main_clk   = l4ls_gclk,
+   .prcm   = {
+   .omap4  = {
+   .clkctrl_offs = AM43XX_CM_PER_EPWMSS3_CLKCTRL_OFFSET,
+   .modulemode   = MODULEMODE_SWCTRL,
+   },
+   },
+};
+
+static struct omap_hwmod am43xx_ehrpwm3_hwmod = {
+   .name   = ehrpwm3,
+   .class  = am33xx_ehrpwm_hwmod_class,
+   .clkdm_name = l4ls_clkdm,
+   .main_clk   = l4ls_gclk,
+};
+
+static struct omap_hwmod am43xx_epwmss4_hwmod = {
+   .name   = epwmss4,
+   .class  = am33xx_epwmss_hwmod_class,
+   .clkdm_name = l4ls_clkdm,
+   .main_clk   = l4ls_gclk,
+   .prcm   = {
+   .omap4  = {
+   .clkctrl_offs = AM43XX_CM_PER_EPWMSS4_CLKCTRL_OFFSET,
+   .modulemode

[PATCH v2 12/13] ARM: OMAP2+: AM43x PRCM init

2013-08-02 Thread Afzal Mohammed
From: Ambresh K ambr...@ti.com

Initialise AM43x HWMOD, powerdomains and clockdomains.

Signed-off-by: Ambresh K ambr...@ti.com
Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/io.c |6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 4a3f06f..1eff07a 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -594,7 +594,13 @@ void __init am43xx_init_early(void)
  NULL);
omap2_set_globals_prm(AM33XX_L4_WK_IO_ADDRESS(AM43XX_PRCM_BASE));
omap2_set_globals_cm(AM33XX_L4_WK_IO_ADDRESS(AM43XX_PRCM_BASE), NULL);
+   omap_prm_base_init();
+   omap_cm_base_init();
omap3xxx_check_revision();
+   am43xx_powerdomains_init();
+   am43xx_clockdomains_init();
+   am33xx_hwmod_init();
+   omap_hwmod_init_postsetup();
 }
 #endif
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 11/13] ARM: OMAP2+: AM43x: PRCM kbuild

2013-08-02 Thread Afzal Mohammed
Build AM43x power domain, clock domain and hwmod data.

Many of AM43x IP's and interconnects are similar as that in AM335x,
hence AM335x hwmod data is being reused with necessary changes.

Earlier the plan was to reuse AM335x specific PRCM code, but as AM43x
PRCM is much similar to OMAP4/5, AM335x PRCM is divorced and instead
married with OMAP4/5 PRCM for AM43x.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/Makefile |5 -
 arch/arm/mach-omap2/cm33xx.h |2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index d4f6715..bfc1eb7 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -108,12 +108,12 @@ obj-$(CONFIG_ARCH_OMAP2)  += prm2xxx_3xxx.o 
prm2xxx.o cm2xxx.o
 obj-$(CONFIG_ARCH_OMAP3)   += prm2xxx_3xxx.o prm3xxx.o cm3xxx.o
 obj-$(CONFIG_ARCH_OMAP3)   += vc3xxx_data.o vp3xxx_data.o
 obj-$(CONFIG_SOC_AM33XX)   += prm33xx.o cm33xx.o
-obj-$(CONFIG_SOC_AM43XX)   += prm33xx.o cm33xx.o
 omap-prcm-4-5-common   =  cminst44xx.o cm44xx.o prm44xx.o \
   prcm_mpu44xx.o prminst44xx.o \
   vc44xx_data.o vp44xx_data.o
 obj-$(CONFIG_ARCH_OMAP4)   += $(omap-prcm-4-5-common)
 obj-$(CONFIG_SOC_OMAP5)+= $(omap-prcm-4-5-common)
+obj-$(CONFIG_SOC_AM43XX)   += $(omap-prcm-4-5-common)
 
 # OMAP voltage domains
 voltagedomain-common   := voltage.o vc.o vp.o
@@ -141,6 +141,7 @@ obj-$(CONFIG_ARCH_OMAP4)+= 
powerdomains44xx_data.o
 obj-$(CONFIG_SOC_AM33XX)   += $(powerdomain-common)
 obj-$(CONFIG_SOC_AM33XX)   += powerdomains33xx_data.o
 obj-$(CONFIG_SOC_AM43XX)   += $(powerdomain-common)
+obj-$(CONFIG_SOC_AM43XX)   += powerdomains43xx_data.o
 obj-$(CONFIG_SOC_OMAP5)+= $(powerdomain-common)
 obj-$(CONFIG_SOC_OMAP5)+= powerdomains54xx_data.o
 
@@ -158,6 +159,7 @@ obj-$(CONFIG_ARCH_OMAP4)+= 
clockdomains44xx_data.o
 obj-$(CONFIG_SOC_AM33XX)   += $(clockdomain-common)
 obj-$(CONFIG_SOC_AM33XX)   += clockdomains33xx_data.o
 obj-$(CONFIG_SOC_AM43XX)   += $(clockdomain-common)
+obj-$(CONFIG_SOC_AM43XX)   += clockdomains43xx_data.o
 obj-$(CONFIG_SOC_OMAP5)+= $(clockdomain-common)
 obj-$(CONFIG_SOC_OMAP5)+= clockdomains54xx_data.o
 
@@ -201,6 +203,7 @@ obj-$(CONFIG_ARCH_OMAP3)+= 
omap_hwmod_2xxx_3xxx_ipblock_data.o
 obj-$(CONFIG_ARCH_OMAP3)   += 
omap_hwmod_2xxx_3xxx_interconnect_data.o
 obj-$(CONFIG_ARCH_OMAP3)   += omap_hwmod_3xxx_data.o
 obj-$(CONFIG_SOC_AM33XX)   += omap_hwmod_33xx_data.o
+obj-$(CONFIG_SOC_AM43XX)   += omap_hwmod_33xx_data.o
 obj-$(CONFIG_ARCH_OMAP4)   += omap_hwmod_44xx_data.o
 obj-$(CONFIG_SOC_OMAP5)+= omap_hwmod_54xx_data.o
 
diff --git a/arch/arm/mach-omap2/cm33xx.h b/arch/arm/mach-omap2/cm33xx.h
index 201e507..757b9a1 100644
--- a/arch/arm/mach-omap2/cm33xx.h
+++ b/arch/arm/mach-omap2/cm33xx.h
@@ -383,7 +383,7 @@ extern void am33xx_cm_clkdm_disable_hwsup(u16 inst, u16 
cdoffs);
 extern void am33xx_cm_clkdm_force_sleep(u16 inst, u16 cdoffs);
 extern void am33xx_cm_clkdm_force_wakeup(u16 inst, u16 cdoffs);
 
-#if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)
+#ifdef CONFIG_SOC_AM33XX
 extern int am33xx_cm_wait_module_idle(u16 inst, u16 cdoffs,
u16 clkctrl_offs);
 extern void am33xx_cm_module_enable(u8 mode, u16 inst, u16 cdoffs,
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] ARM: dts: AM4372: add few nodes

2013-08-02 Thread Afzal Mohammed
Populate uarts, timers, rtc, wdt, gpio, i2c, spi, cpsw  pwm nodes.

Reason for adding these nodes early - hwmod code required address
space of peripherals corresponding to these nodes (as address space
details are removed from hwmod database).

uart0, timers - 1  2 and synctimer were already present, so here the
remaining uarts  timers are added.

All properties as per the existing binding has been added for uart,
timer, rtc, wdt  gpio. Even though that was not the current scope
of work, felt adding those would reduce or require no effort later
to get these peripherals working.

For i2c, spi, cpsw  pwm - only the properties that were sure to be
correct has been added (main intention is to make hwmod happy and
avoid any later modification to here added properties).

While at it add ti,hwmod property to already existing nodes.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/boot/dts/am4372.dtsi |  343 +
 1 file changed, 343 insertions(+)

diff --git a/arch/arm/boot/dts/am4372.dtsi b/arch/arm/boot/dts/am4372.dtsi
index 4635e7f..0fe393a 100644
--- a/arch/arm/boot/dts/am4372.dtsi
+++ b/arch/arm/boot/dts/am4372.dtsi
@@ -49,6 +49,47 @@
compatible = ti,am4372-uart,ti,omap2-uart;
reg = 0x44e09000 0x2000;
interrupts = GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH;
+   ti,hwmods = uart1;
+   };
+
+   uart1: serial@48022000 {
+   compatible = ti,am4372-uart,ti,omap2-uart;
+   reg = 0x48022000 0x2000;
+   interrupts = GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH;
+   ti,hwmods = uart2;
+   status = disabled;
+   };
+
+   uart2: serial@48024000 {
+   compatible = ti,am4372-uart,ti,omap2-uart;
+   reg = 0x48024000 0x2000;
+   interrupts = GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH;
+   ti,hwmods = uart3;
+   status = disabled;
+   };
+
+   uart3: serial@481a6000 {
+   compatible = ti,am4372-uart,ti,omap2-uart;
+   reg = 0x481a6000 0x2000;
+   interrupts = GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH;
+   ti,hwmods = uart4;
+   status = disabled;
+   };
+
+   uart4: serial@481a8000 {
+   compatible = ti,am4372-uart,ti,omap2-uart;
+   reg = 0x481a8000 0x2000;
+   interrupts = GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH;
+   ti,hwmods = uart5;
+   status = disabled;
+   };
+
+   uart5: serial@481aa000 {
+   compatible = ti,am4372-uart,ti,omap2-uart;
+   reg = 0x481aa000 0x2000;
+   interrupts = GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH;
+   ti,hwmods = uart6;
+   status = disabled;
};
 
timer1: timer@44e31000 {
@@ -56,17 +97,319 @@
reg = 0x44e31000 0x400;
interrupts = GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH;
ti,timer-alwon;
+   ti,hwmods = timer1;
};
 
timer2: timer@4804  {
compatible = ti,am4372-timer,ti,am335x-timer;
reg = 0x4804  0x400;
interrupts = GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH;
+   ti,hwmods = timer2;
+   };
+
+   timer3: timer@48042000 {
+   compatible = ti,am4372-timer,ti,am335x-timer;
+   reg = 0x48042000 0x400;
+   interrupts = GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH;
+   ti,hwmods = timer3;
+   status = disabled;
+   };
+
+   timer4: timer@48044000 {
+   compatible = ti,am4372-timer,ti,am335x-timer;
+   reg = 0x48044000 0x400;
+   interrupts = GIC_SPI 92 IRQ_TYPE_LEVEL_HIGH;
+   ti,timer-pwm;
+   ti,hwmods = timer4;
+   status = disabled;
+   };
+
+   timer5: timer@48046000 {
+   compatible = ti,am4372-timer,ti,am335x-timer;
+   reg = 0x48046000 0x400;
+   interrupts = GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH;
+   ti,timer-pwm;
+   ti,hwmods = timer5;
+   status = disabled;
+   };
+
+   timer6: timer@48048000 {
+   compatible = ti,am4372-timer,ti,am335x-timer;
+   reg = 0x48048000 0x400;
+   interrupts = GIC_SPI 94

[PATCH 1/2] ARM: dts: AM4372: cpu(s) node per latest binding

2013-08-02 Thread Afzal Mohammed
Update AM4372 cpu node to the latest cpus/cpu bindings for ARM.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/boot/dts/am4372.dtsi |4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/am4372.dtsi b/arch/arm/boot/dts/am4372.dtsi
index ddc1df7..4635e7f 100644
--- a/arch/arm/boot/dts/am4372.dtsi
+++ b/arch/arm/boot/dts/am4372.dtsi
@@ -22,8 +22,12 @@
};
 
cpus {
+   #address-cells = 1;
+   #size-cells = 0;
cpu@0 {
compatible = arm,cortex-a9;
+   device_type = cpu;
+   reg = 0;
};
};
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ARM: Kconfig: NR_GPIO AM43x default

2013-08-02 Thread Afzal Mohammed
On an AM43x only config, currently default ARCH_NR_GPIO would be zero.
Default it to that supported by the SoC.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/Kconfig |1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 37c0f4e..c5356c5 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1605,6 +1605,7 @@ config ARCH_NR_GPIO
default 352 if ARCH_VT8500
default 288 if ARCH_SUNXI
default 264 if MACH_H4700
+   default 192 if SOC_AM43XX
default 0
help
  Maximum number of GPIOs in the system.
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] ARM: OMAP2+: hwmod: rt address space index for DT

2013-07-24 Thread Afzal Mohammed

Hi Paul, Benoit,

On 7/5/2013 8:43 PM, Afzal Mohammed wrote:


Address space is being removed from hwmod database and DT information
in reg property is being used. Currently the 0th index of device
address space is used to map for register target address. This is not
always true, eg. cpgmac has it's sysconfig in second address space.

Handle it by specifying index of device address space to be used for
register target. As default value of this field would be zero with
static initialization, existing behaviour of using first address space
for register target while using DT would be kept as such.


This series is required to fix the wrong register target address being 
picked up by hwmod for cpgmac on am335x.


Issue happened during last merge window cleanup, where address space was 
removed from hwmod, and in turn DTS was relied upon for address 
space(Earlier having the address space in hwmod did not cause any issue 
as 'ADDR_TYPE_RT' was used to specify proper address space index).


Please help this series reach mainline for v3.11

Regards
Afzal

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH RFC 00/13] ARM: OMAP2+: AM43x PRCM support

2013-07-18 Thread Afzal Mohammed

Hi Tony, Paul,

On 7/11/2013 12:03 PM, Afzal Mohammed wrote:


AM43x PRCM support (excluding clock tree) is being added with this
series. AM43x reuses most of the IP's from AM335x, as that is the
case, it was felt that reusing AM335x code as much as possible for
AM43x is better - it also helps to keep LOC less.



Major reuse has been with hwmod database of AM335x, moving common
elements to a new array and keeping separate arrays for elements that
are specific only to either one of AM335x or AM43x. And in the cases
where relevant IP is present in both that has difference in details
like CLKCTRL register offsets, it is being updated at runtime based on
the SoC detected.



This series is being developed with additional clock tree changes that
would be DT'fied.



Additional DTS changes are also required for hwmod to get register
target address space as most of AM335x hwmod address space details has
been recently cleaned up and moved to DTS.




 This RFC is being posted to get an early feedback on approach taken
 here mainly w.r.t reusing AM335x hwmod database for AM43x.



Please let me know your comments on this series.

Most of the IP's in AM335x is reused on AM43x and hence out of the
existing 77 hwmod ocpif entries on AM335x, 73 are reused on AM43x by
moving to a common array (only 4 is left AM335x specific).

Even the address space of those peripherals that are common between
AM335x  AM43x is same. And AM43x has only a few newer IP's as
compared to AM335x.

Regards
Afzal
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RFC 00/13] ARM: OMAP2+: AM43x PRCM support

2013-07-11 Thread Afzal Mohammed
Hi,

AM43x PRCM support (excluding clock tree) is being added with this
series. AM43x reuses most of the IP's from AM335x, as that is the
case, it was felt that reusing AM335x code as much as possible for
AM43x is better - it also helps to keep LOC less.



This RFC is being posted to get an early feedback on approach taken
here mainly w.r.t reusing AM335x hwmod database for AM43x.



Major reuse has been with hwmod database of AM335x, moving common
elements to a new array and keeping separate arrays for elements that
are specific only to either one of AM335x or AM43x. And in the cases
where relevant IP is present in both that has difference in details
like CLKCTRL register offsets, it is being updated at runtime based on
the SoC detected.

Powerdomain  Clockdomain data has been added separately as it was not
giving much advantage reusing AM335x ones (runtime updates required
was getting too ugly).

As AM43x PRCM is similar to OMAP4, OMAP4 power domain  clock domain
operations are being reused. This would have to be modified to have
only the required domain operation fields, some thing like reusing
Vaibhav Bedia's newly proposed domain operations for AM335x of [4]
if [1] completely makes it to the mainline (that would require
modifications to power and clock domain data fields of this series
too), otherwise a similar domain operations would have to be added
for AM43x.

Also it has to be ensured that only relevant HWMOD operations are
handled like in [4].

A single header file has been added to provide all AM43x PRCM defines.

Here sequencewise, initially AM335x hwmod is modified to have it's
fields get updated at runtime (wherever element is shared and has
some difference with AM43x). Then power domain, clock domain for AM43x
is added and finally AM335x hwmod database is updated with AM43x
specifics.

This series is being developed with additional clock tree changes that
would be DT'fied.

Additional DTS changes are also required for hwmod to get register
target address space as most of AM335x hwmod address space details has
been recently cleaned up and moved to DTS.

Vaibhav Bedia's [2]  [3] that are part of [1] has been used along
with this series for validating.

Regards
Afzal

[1] Consolidate AM335x and OMAP4 PRM/CM APIs -
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg91511.html
[2] [RFC 2/9] ARM: OMAP2+: CM code: Reintroduce SW_SLEEP for OMAP4 class of 
devices
[3] [RFC 6/9] ARM: OMAP4: CM code: Remove the check for non-zero clkctrl_offs
[4] [RFC 8/9] ARM: OMAP2+: AM335x: Migrate to OMAP4 PRM/CM APIs

Afzal Mohammed (8):
  ARM: OMAP2+: hwmod: AM335x: prepare for AM43x reuse
  ARM: OMAP2+: hwmod: AMx3: runtime AM335x handling
  ARM: OMAP2+: hwmod: AMx3: remove common static fields
  ARM: OMAP2+: PRCM: AM43x definitions
  ARM: OMAP2+: hwmod: AMx3: runtime AM43x handling
  ARM: OMAP2+: AM43x: PRCM kbuild
  ARM: OMAP2+: hwmod: type4 sysc
  ARM: OMAP2+: hwmod: AM43x: new w.r.t AM335x

Ambresh K (4):
  ARM: OMAP2+: PM: AM43x powerdomain data
  ARM: OMAP2+: CM: AM43x clockdomain data
  ARM: OMAP2+: hwmod: AM43x operations
  ARM: OMAP2+: AM43x PRCM init

Ankur Kishore (1):
  ARM: OMAP2+: CM: cm_inst offset s16-u16

 arch/arm/mach-omap2/Makefile |   5 +-
 arch/arm/mach-omap2/clockdomain.h|   3 +-
 arch/arm/mach-omap2/clockdomains43xx_data.c  | 199 +++
 arch/arm/mach-omap2/cm33xx.c |  30 +-
 arch/arm/mach-omap2/cm33xx.h |  28 +-
 arch/arm/mach-omap2/cminst44xx.c |  29 +-
 arch/arm/mach-omap2/cminst44xx.h |  25 +-
 arch/arm/mach-omap2/io.c |   6 +
 arch/arm/mach-omap2/omap_hwmod.c |   2 +-
 arch/arm/mach-omap2/omap_hwmod.h |   5 +
 arch/arm/mach-omap2/omap_hwmod_33xx_data.c   | 850 ---
 arch/arm/mach-omap2/omap_hwmod_common_data.c |   6 +
 arch/arm/mach-omap2/powerdomain.h|   1 +
 arch/arm/mach-omap2/powerdomains43xx_data.c  | 145 +
 arch/arm/mach-omap2/prcm43xx.h   | 148 +
 15 files changed, 1341 insertions(+), 141 deletions(-)
 create mode 100644 arch/arm/mach-omap2/clockdomains43xx_data.c
 create mode 100644 arch/arm/mach-omap2/powerdomains43xx_data.c
 create mode 100644 arch/arm/mach-omap2/prcm43xx.h

-- 
1.8.3.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RFC 01/13] ARM: OMAP2+: hwmod: AM335x: prepare for AM43x reuse

2013-07-11 Thread Afzal Mohammed
AM335x  AM43x have most of the interconnects, IPs similar. Instead of
adding new hwmod data for AM43x, reuse AM335x hwmod data as much as
possible.

In the hwmod entries that could be reused on AM43x, major changes are
in register offsets and different ocpif clock for most of peripherals
that comes under l4_wkup interconnect.

To achieve reuse, as a first step, bring out ocpif's relevant for both
SoC's to a new array and handle appropriately.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_33xx_data.c | 22 ++
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
index 7a9b492..b0a38f0 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
@@ -29,6 +29,7 @@
 #include i2c.h
 #include mmc.h
 #include wd_timer.h
+#include soc.h
 
 /*
  * IP blocks
@@ -2458,6 +2459,13 @@ static struct omap_hwmod_ocp_if am33xx_l3_main__aes0 = {
 
 static struct omap_hwmod_ocp_if *am33xx_hwmod_ocp_ifs[] __initdata = {
am33xx_l3_main__emif,
+   am33xx_l4_hs__pruss,
+   am33xx_l3_main__lcdc,
+   am33xx_l3_s__usbss,
+   NULL,
+};
+
+static struct omap_hwmod_ocp_if *amx3xx_hwmod_ocp_ifs[] __initdata = {
am33xx_mpu__l3_main,
am33xx_mpu__prcm,
am33xx_l3_s__l4_ls,
@@ -2481,7 +2489,6 @@ static struct omap_hwmod_ocp_if *am33xx_hwmod_ocp_ifs[] 
__initdata = {
am33xx_l4_wkup__gpio0,
am33xx_l4_wkup__adc_tsc,
am33xx_l4_wkup__wd_timer1,
-   am33xx_l4_hs__pruss,
am33xx_l4_per__dcan0,
am33xx_l4_per__dcan1,
am33xx_l4_per__gpio1,
@@ -2522,14 +2529,12 @@ static struct omap_hwmod_ocp_if *am33xx_hwmod_ocp_ifs[] 
__initdata = {
am33xx_epwmss2__eqep2,
am33xx_epwmss2__ehrpwm2,
am33xx_l3_s__gpmc,
-   am33xx_l3_main__lcdc,
am33xx_l4_ls__mcspi0,
am33xx_l4_ls__mcspi1,
am33xx_l3_main__tptc0,
am33xx_l3_main__tptc1,
am33xx_l3_main__tptc2,
am33xx_l3_main__ocmc,
-   am33xx_l3_s__usbss,
am33xx_l4_hs__cpgmac0,
am33xx_cpgmac0__mdio,
am33xx_l3_main__sha0,
@@ -2539,6 +2544,15 @@ static struct omap_hwmod_ocp_if *am33xx_hwmod_ocp_ifs[] 
__initdata = {
 
 int __init am33xx_hwmod_init(void)
 {
+   int ret;
+
omap_hwmod_init();
-   return omap_hwmod_register_links(am33xx_hwmod_ocp_ifs);
+   ret = omap_hwmod_register_links(amx3xx_hwmod_ocp_ifs);
+   if (ret  0)
+   return ret;
+
+   if (soc_is_am33xx())
+   return omap_hwmod_register_links(am33xx_hwmod_ocp_ifs);
+
+   return 0;
 }
-- 
1.8.3.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


  1   2   3   4   5   6   7   >