Skip to contentSkip to conversation

ARM: OMAP3+: am33xx: Add CM, clock and clockdomain support

PATCH New Vaibhav Hiremath 3 participants 45 messages Apr 3, 2012 – May 24, 2012

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

v3 cover ARM: OMAP3+: am33xx: Add CM, clock and clockdomain support

This patch series adds CM low-level api's, clockdomain data, respective clockdomain operations and complete Clock Tree for AM33XX family of devices.

The earlier versions of patches submitted were,

- Patch-RFC was complete set of patches adding separate implementation for all PRM, CM, Clockdomain, clock tree and HWMOD.
- Patch-V2 was basically reusing existing OMAP4 cminst and clockdomain api's for AM33XX device (without clock tree).

But as aligned and discussed on previous patch submission on AM33XX PRM, we have decided to implement/handle whole AM33xx separately.

Please refer to the AM335x TRM available at -
http://www.ti.com/product/am3359

I would like to bring same question again (but from CM context),

Do we really want to implement CM and clockdomain api's separately?
In case of AM33XX PRM implementation, the reason why we had to do it separately was, due to inconsistency of register offset and bit-offsets. But, it is not the case in CM implementation, we have some consistency there and existing OMAP4 code can be reused for AM33XX.
I personally feel, we should consider Patch-V2 version here. IMO, the only change required there is to rename files,

    cminst44xx.c => cminst_33xx_44xx.c
    clockdomain44xx.c => clockdomain_33xx_44xx.c

Vaibhav Hiremath (3):
ARM: OMAP3+: cm33xx: Introduce AM33xx CM API's and register level
details
ARM: OMAP3+: clockdomain33xx: Add clockdomain data and respective
operations
ARM: OMAP3+: clock33xx: Add AM33XX clock tree data

 arch/arm/mach-omap2/Makefile                  |    6 +
 arch/arm/mach-omap2/clock33xx.h               |   36 +
 arch/arm/mach-omap2/clock33xx_data.c          | 2209 +++++++++++++++++++++++++
 arch/arm/mach-omap2/clockdomain.h             |    2 +
 arch/arm/mach-omap2/clockdomain33xx.c         |   74 +
 arch/arm/mach-omap2/clockdomains33xx_data.c   |  214 +++
 arch/arm/mach-omap2/cm-regbits-33xx.h         |  687 ++++++++
 arch/arm/mach-omap2/cm33xx.c                  |  313 ++++
 arch/arm/mach-omap2/cm33xx.h                  |  420 +++++
 arch/arm/mach-omap2/io.c                      |    4 +-
 arch/arm/mach-omap2/omap_hwmod.c              |   58 +-
 arch/arm/plat-omap/include/plat/clkdev_omap.h |    1 +
 12 files changed, 4006 insertions(+), 18 deletions(-)
 create mode 100644 arch/arm/mach-omap2/clock33xx.h
 create mode 100644 arch/arm/mach-omap2/clock33xx_data.c
 create mode 100644 arch/arm/mach-omap2/clockdomain33xx.c
 create mode 100644 arch/arm/mach-omap2/clockdomains33xx_data.c
 create mode 100644 arch/arm/mach-omap2/cm-regbits-33xx.h
 create mode 100644 arch/arm/mach-omap2/cm33xx.c
 create mode 100644 arch/arm/mach-omap2/cm33xx.h
#1 lore raw

PATCH v3 1/3 ARM: OMAP3+: cm33xx: Introduce AM33xx CM API's and register level details

As far as PRM/CM/PRCM modules are concerned, AM33XX device is different than OMAP3 and OMAP4 architectures; so similar to PRM implementation, handle AM33XX CM separately.

This patch introduces AM33XX CM module low-level api's, used and required by omap clockdomain and hwmod framework. Also, integrate these api's into existing OMAP framework.

Please note that cm-regbits-33xx.h (register bit field offset) and cm33xx.h (register addr offset) files are mostly auto generated.

Cc Kevin Hilman <[email protected]>
Cc Rajendra Nayak <[email protected]>
CC Tony Lindgren <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Benoit Cousson <[email protected]>
---
 arch/arm/mach-omap2/Makefile          |    3 +
 arch/arm/mach-omap2/cm-regbits-33xx.h |  687 +++++++++++++++++++++++++++++++++
 arch/arm/mach-omap2/cm33xx.c          |  313 +++++++++++++++
 arch/arm/mach-omap2/cm33xx.h          |  420 ++++++++++++++++++++
 arch/arm/mach-omap2/omap_hwmod.c      |   58 ++-
 5 files changed, 1464 insertions(+), 17 deletions(-)
 create mode 100644 arch/arm/mach-omap2/cm-regbits-33xx.h
 create mode 100644 arch/arm/mach-omap2/cm33xx.c
 create mode 100644 arch/arm/mach-omap2/cm33xx.h
arch/arm/mach-omap2/Makefile +3 -0
index fd130e5..1695dc8 100644
@@ -85,6 +85,9 @@ obj-y					+= prm_common.o
 obj-$(CONFIG_ARCH_OMAP2)		+= prcm.o cm2xxx_3xxx.o prm2xxx_3xxx.o
 obj-$(CONFIG_ARCH_OMAP3)		+= prcm.o cm2xxx_3xxx.o prm2xxx_3xxx.o \
 					   vc3xxx_data.o vp3xxx_data.o
+
+obj-$(CONFIG_SOC_OMAPAM33XX)		+= cm33xx.o
+
 # XXX The presence of cm2xxx_3xxx.o on the line below is temporary and
 # will be removed once the OMAP4 part of the codebase is converted to
 # use OMAP4-specific PRCM functions.
arch/arm/mach-omap2/cm-regbits-33xx.h new file +687 -0

687 lines not on this page · raw message

arch/arm/mach-omap2/cm33xx.c new file +313 -0

313 lines not on this page · raw message

arch/arm/mach-omap2/cm33xx.h new file +420 -0

420 lines not on this page · raw message

arch/arm/mach-omap2/omap_hwmod.c +41 -17

106 lines not on this page · raw message

--
1.7.0.4

#2 lore raw

PATCH v3 2/3 ARM: OMAP3+: clockdomain33xx: Add clockdomain data and respective operations

In reply to Vaibhav Hiremath

AM33XX PRCM module consist of, various clockdomains, in all total we have 18 clockdomains available, with following controlling options,
- NO Sleep: sleep transition can not be initiated,
- SW Sleep: sw forced sleep transition,
- SW Wakeup: sw forced wakeup transition,
- HW Auto: transitions are based upon hw conditions.

This patch adds all available clockdomain data, respective clockdomain operations for AM33XX family of device, and also integrates it into existing OMAP framework.

Cc Kevin Hilman <[email protected]>
Cc Rajendra Nayak <[email protected]>
CC Tony Lindgren <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Benoit Cousson <[email protected]>
---
 arch/arm/mach-omap2/Makefile                |    2 +
 arch/arm/mach-omap2/clockdomain.h           |    2 +
 arch/arm/mach-omap2/clockdomain33xx.c       |   74 +++++++++
 arch/arm/mach-omap2/clockdomains33xx_data.c |  214 +++++++++++++++++++++++++++
 arch/arm/mach-omap2/io.c                    |    1 +
 5 files changed, 293 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap2/clockdomain33xx.c
 create mode 100644 arch/arm/mach-omap2/clockdomains33xx_data.c
arch/arm/mach-omap2/Makefile +2 -0
index 1695dc8..13838df 100644
@@ -135,6 +135,8 @@ obj-$(CONFIG_ARCH_OMAP3)		+= clockdomain.o \
 					   clockdomain2xxx_3xxx.o \
 					   clockdomains2xxx_3xxx_data.o \
 					   clockdomains3xxx_data.o
+obj-$(CONFIG_SOC_OMAPAM33XX)		+= clockdomain33xx.o \
+					   clockdomains33xx_data.o
 obj-$(CONFIG_ARCH_OMAP4)		+= clockdomain.o \
 					   clockdomain44xx.o \
 					   clockdomains44xx_data.o
arch/arm/mach-omap2/clockdomain.h +2 -0
index f7b5860..72cb12b 100644
@@ -195,6 +195,7 @@ int clkdm_hwmod_disable(struct clockdomain *clkdm, struct omap_hwmod *oh);
 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 __init omap44xx_clockdomains_init(void);
 extern void _clkdm_add_autodeps(struct clockdomain *clkdm);
 extern void _clkdm_del_autodeps(struct clockdomain *clkdm);
@@ -202,6 +203,7 @@ extern void _clkdm_del_autodeps(struct clockdomain *clkdm);
 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_dep gfx_24xx_wkdeps[];
 extern struct clkdm_dep dsp_24xx_wkdeps[];
arch/arm/mach-omap2/clockdomain33xx.c new file +74 -0

74 lines not on this page · raw message

arch/arm/mach-omap2/clockdomains33xx_data.c new file +214 -0

214 lines not on this page · raw message

arch/arm/mach-omap2/io.c +1 -0
index b594918..be08dc7 100644
@@ -474,6 +474,7 @@ void __init am33xx_init_early(void)
 	omap_common_init_early();
 	am33xx_voltagedomains_init();
 	am33xx_powerdomains_init();
+	am33xx_clockdomains_init();
 	omap3xxx_clk_init();
 }
 #endif

--
1.7.0.4

maintainer
#3 lore raw

PATCH v3 2/3 ARM: OMAP3+: clockdomain33xx: Add clockdomain data and respective operations

Hello Vaibhav, Afzal, Vaibhav,

A few questions while reviewing this patch:

Quoted 15 lines · Vaibhav Hiremath

AM33XX PRCM module consist of, various clockdomains, in all total we have 18 clockdomains available, with following controlling options,
- NO Sleep: sleep transition can not be initiated,
- SW Sleep: sw forced sleep transition,
- SW Wakeup: sw forced wakeup transition,
- HW Auto: transitions are based upon hw conditions.

This patch adds all available clockdomain data, respective clockdomain operations for AM33XX family of device, and also integrates it into existing OMAP framework.

...

arch/arm/mach-omap2/clockdomains33xx_data.c line 31

Quoted 7 lines
arch/arm/mach-omap2/clockdomains33xx_data.c new file +7 -0
+static struct clockdomain l4ls_am33xx_clkdm = {
+	.name		= "l4ls_clkdm",
+	.pwrdm		= { .name = "per_pwrdm" },
+	.cm_inst	= AM33XX_CM_PER_MOD,
+	.clkdm_offs	= AM33XX_CM_PER_L4LS_CLKSTCTRL_OFFSET,
+	.clktrctrl_mask	= AM33XX_CLKTRCTRL_MASK,
+	.flags		= (CLKDM_CAN_SWSUP | CLKDM_NO_AUTODEPS),

It looks to me like we don't need the .clktrctrl_mask field, since according to the clockdomains code, the CLKTRCTRL field is at the same bit shift for each clockdomain.

Also, since we're not defining any autodeps for the AM335x platform, we shouldn't need the CLKDM_NO_AUTODEPS flag either? Since no autodeps are defined, the default will be to not set any autodeps.

Another question is about the CLKTRCTRL bitfields. According to _AM335x ARM Cortex-A8 Microprocessors (MPUs) Technical Reference Manual_ Rev. D (SPRUH73D), most of the clockdomains support NO_SLEEP mode (i.e., CLKTRCTRL = 0x0). That means that technically, we should also set the CLKDM_CAN_DISABLE_AUTO flag. Unless the documentation is incorrect here? In another section (Table 8-9 "Clock Transition Mode Settings"), it claims that CLKTRCTRL = 0 is not supported...

Also, a question about the L4_WKUP clockdomain:

arch/arm/mach-omap2/clockdomains33xx_data.c line 122

Quoted 8 lines
arch/arm/mach-omap2/clockdomains33xx_data.c new file +8 -0
+static struct clockdomain l4_wkup_am33xx_clkdm = {
+	.name		= "l4_wkup_clkdm",
+	.pwrdm		= { .name = "wkup_pwrdm" },
+	.cm_inst	= AM33XX_CM_WKUP_MOD,
+	.clkdm_offs	= AM33XX_CM_WKUP_CLKSTCTRL_OFFSET,
+	.clktrctrl_mask	= AM33XX_CLKTRCTRL_MASK,
+	.flags		= (CLKDM_CAN_SWSUP | CLKDM_NO_AUTODEPS),
+};

Table 8-89 "CM_WKUP_CLKSTCTRL Register Field Descriptions" of SPRUH73D claims that this clockdomain supports hardware-supervised automatic clockdomain transitions. Again this conflicts with Table 8-9. Is this a documentation bug, or should we update the patch?

- Paul

#4 lore raw

PATCH v3 2/3 ARM: OMAP3+: clockdomain33xx: Add clockdomain data and respective operations

Quoted 24 lines · Paul Walmsley

Hello Vaibhav, Afzal, Vaibhav,

A few questions while reviewing this patch:

Quoted 15 lines · Vaibhav Hiremath

AM33XX PRCM module consist of, various clockdomains, in all total we have 18 clockdomains available, with following controlling options,
- NO Sleep: sleep transition can not be initiated,
- SW Sleep: sw forced sleep transition,
- SW Wakeup: sw forced wakeup transition,
- HW Auto: transitions are based upon hw conditions.

This patch adds all available clockdomain data, respective clockdomain operations for AM33XX family of device, and also integrates it into existing OMAP framework.

...

Quoted 12 lines

arch/arm/mach-omap2/clockdomains33xx_data.c line 31

Quoted 7 lines
arch/arm/mach-omap2/clockdomains33xx_data.c new file +7 -0
+static struct clockdomain l4ls_am33xx_clkdm = {
+	.name		= "l4ls_clkdm",
+	.pwrdm		= { .name = "per_pwrdm" },
+	.cm_inst	= AM33XX_CM_PER_MOD,
+	.clkdm_offs	= AM33XX_CM_PER_L4LS_CLKSTCTRL_OFFSET,
+	.clktrctrl_mask	= AM33XX_CLKTRCTRL_MASK,
+	.flags		= (CLKDM_CAN_SWSUP | CLKDM_NO_AUTODEPS),

It looks to me like we don't need the .clktrctrl_mask field, since according to the clockdomains code, the CLKTRCTRL field is at the same bit shift for each clockdomain.

Yeah, we actually don't need it, probably I added for completeness. I will remove it in next version.

Quoted 4 lines

Also, since we're not defining any autodeps for the AM335x platform, we shouldn't need the CLKDM_NO_AUTODEPS flag either? Since no autodeps are defined, the default will be to not set any autodeps.

This is required to avoid few "pr_debug", if you don't provide it. For example, without this flag set, you will get,

pr_debug("clockdomain: hardware cannot set/clear sleep "

		"dependency affecting %s from %s\n", clkdm1->name,
             clkdm2->name);

Refer to the file omap_hwmod.c, function, _enable(), the call sequence is,

_enable() => _add_initiator_dep() => clkdm_add_sleepdep() =>leads to warning

Quoted 8 lines

Another question is about the CLKTRCTRL bitfields. According to _AM335x ARM Cortex-A8 Microprocessors (MPUs) Technical Reference Manual_ Rev. D (SPRUH73D), most of the clockdomains support NO_SLEEP mode (i.e., CLKTRCTRL = 0x0). That means that technically, we should also set the CLKDM_CAN_DISABLE_AUTO flag. Unless the documentation is incorrect here? In another section (Table 8-9 "Clock Transition Mode Settings"), it claims that CLKTRCTRL = 0 is not supported...

It is not supported, and should be considered as documentation issue.

Quoted 16 lines

Also, a question about the L4_WKUP clockdomain:

arch/arm/mach-omap2/clockdomains33xx_data.c line 122

Quoted 8 lines
arch/arm/mach-omap2/clockdomains33xx_data.c new file +8 -0
+static struct clockdomain l4_wkup_am33xx_clkdm = {
+	.name		= "l4_wkup_clkdm",
+	.pwrdm		= { .name = "wkup_pwrdm" },
+	.cm_inst	= AM33XX_CM_WKUP_MOD,
+	.clkdm_offs	= AM33XX_CM_WKUP_CLKSTCTRL_OFFSET,
+	.clktrctrl_mask	= AM33XX_CLKTRCTRL_MASK,
+	.flags		= (CLKDM_CAN_SWSUP | CLKDM_NO_AUTODEPS),
+};

Table 8-89 "CM_WKUP_CLKSTCTRL Register Field Descriptions" of SPRUH73D claims that this clockdomain supports hardware-supervised automatic clockdomain transitions. Again this conflicts with Table 8-9. Is this a documentation bug, or should we update the patch?

Ditto, should be considered as doc issue. I have already raised all this documentation issues, and should get fixed.

Thanks,
Vaibhav

Quoted 3 lines

- Paul

maintainer
#5 lore raw

PATCH v3 2/3 ARM: OMAP3+: clockdomain33xx: Add clockdomain data and respective operations

Quoted 36 lines · Vaibhav
Quoted 22 lines · Paul Walmsley

A few questions while reviewing this patch:

Quoted 15 lines · Vaibhav Hiremath

AM33XX PRCM module consist of, various clockdomains, in all total we have 18 clockdomains available, with following controlling options,
- NO Sleep: sleep transition can not be initiated,
- SW Sleep: sw forced sleep transition,
- SW Wakeup: sw forced wakeup transition,
- HW Auto: transitions are based upon hw conditions.

This patch adds all available clockdomain data, respective clockdomain operations for AM33XX family of device, and also integrates it into existing OMAP framework.

...

Quoted 12 lines

arch/arm/mach-omap2/clockdomains33xx_data.c line 31

Quoted 7 lines
arch/arm/mach-omap2/clockdomains33xx_data.c new file +7 -0
+static struct clockdomain l4ls_am33xx_clkdm = {
+	.name		= "l4ls_clkdm",
+	.pwrdm		= { .name = "per_pwrdm" },
+	.cm_inst	= AM33XX_CM_PER_MOD,
+	.clkdm_offs	= AM33XX_CM_PER_L4LS_CLKSTCTRL_OFFSET,
+	.clktrctrl_mask	= AM33XX_CLKTRCTRL_MASK,
+	.flags		= (CLKDM_CAN_SWSUP | CLKDM_NO_AUTODEPS),

It looks to me like we don't need the .clktrctrl_mask field, since according to the clockdomains code, the CLKTRCTRL field is at the same bit shift for each clockdomain.

Quoted 2 lines

Yeah, we actually don't need it, probably I added for completeness. I will remove it in next version.

I've removed them here.

Quoted 8 lines
Quoted 4 lines

Also, since we're not defining any autodeps for the AM335x platform, we shouldn't need the CLKDM_NO_AUTODEPS flag either? Since no autodeps are defined, the default will be to not set any autodeps.

This is required to avoid few "pr_debug", if you don't provide it. For example, without this flag set, you will get,

Quoted 7 lines

pr_debug("clockdomain: hardware cannot set/clear sleep "

		"dependency affecting %s from %s\n", clkdm1->name,
             clkdm2->name);

Refer to the file omap_hwmod.c, function, _enable(), the call sequence is,

_enable() => _add_initiator_dep() => clkdm_add_sleepdep() =>leads to warning

Seems like the better thing to do is to just avoid calling _{add,del}_initiator_dep() on the AM335x.

Quoted 10 lines
Quoted 8 lines

Another question is about the CLKTRCTRL bitfields. According to _AM335x ARM Cortex-A8 Microprocessors (MPUs) Technical Reference Manual_ Rev. D (SPRUH73D), most of the clockdomains support NO_SLEEP mode (i.e., CLKTRCTRL = 0x0). That means that technically, we should also set the CLKDM_CAN_DISABLE_AUTO flag. Unless the documentation is incorrect here? In another section (Table 8-9 "Clock Transition Mode Settings"), it claims that CLKTRCTRL = 0 is not supported...

It is not supported, and should be considered as documentation issue.

Okay so I guess the description for this patch (quoted above) is wrong then also?

- Paul

#6 lore raw

PATCH v3 2/3 ARM: OMAP3+: clockdomain33xx: Add clockdomain data and respective operations

Quoted 38 lines · Paul Walmsley
Quoted 36 lines · Vaibhav
Quoted 34 lines · Paul Walmsley

A few questions while reviewing this patch:

Quoted 15 lines · Vaibhav Hiremath

AM33XX PRCM module consist of, various clockdomains, in all total we have 18 clockdomains available, with following controlling options,
- NO Sleep: sleep transition can not be initiated,
- SW Sleep: sw forced sleep transition,
- SW Wakeup: sw forced wakeup transition,
- HW Auto: transitions are based upon hw conditions.

This patch adds all available clockdomain data, respective clockdomain operations for AM33XX family of device, and also integrates it into existing OMAP framework.

...

arch/arm/mach-omap2/clockdomains33xx_data.c line 31

Quoted 7 lines
arch/arm/mach-omap2/clockdomains33xx_data.c new file +7 -0
+static struct clockdomain l4ls_am33xx_clkdm = {
+	.name		= "l4ls_clkdm",
+	.pwrdm		= { .name = "per_pwrdm" },
+	.cm_inst	= AM33XX_CM_PER_MOD,
+	.clkdm_offs	= AM33XX_CM_PER_L4LS_CLKSTCTRL_OFFSET,
+	.clktrctrl_mask	= AM33XX_CLKTRCTRL_MASK,
+	.flags		= (CLKDM_CAN_SWSUP | CLKDM_NO_AUTODEPS),

It looks to me like we don't need the .clktrctrl_mask field, since according to the clockdomains code, the CLKTRCTRL field is at the same bit shift for each clockdomain.

Quoted 5 lines
Quoted 2 lines

Yeah, we actually don't need it, probably I added for completeness. I will remove it in next version.

I've removed them here.

Thanks.

Quoted 12 lines
Quoted 12 lines
Quoted 4 lines

Also, since we're not defining any autodeps for the AM335x platform, we shouldn't need the CLKDM_NO_AUTODEPS flag either? Since no autodeps are defined, the default will be to not set any autodeps.

This is required to avoid few "pr_debug", if you don't provide it. For example, without this flag set, you will get,

pr_debug("clockdomain: hardware cannot set/clear sleep "

		"dependency affecting %s from %s\n", clkdm1->name,
             clkdm2->name);
Quoted 7 lines
Quoted 3 lines

Refer to the file omap_hwmod.c, function, _enable(), the call sequence is,

_enable() => _add_initiator_dep() => clkdm_add_sleepdep() =>leads to warning

Seems like the better thing to do is to just avoid calling _{add,del}_initiator_dep() on the AM335x.

Don't you think, if flag is doing all the job, why to pollute code with cpu_is_am33xx() checks.

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines

Another question is about the CLKTRCTRL bitfields. According to _AM335x ARM Cortex-A8 Microprocessors (MPUs) Technical Reference Manual_ Rev. D (SPRUH73D), most of the clockdomains support NO_SLEEP mode (i.e., CLKTRCTRL = 0x0). That means that technically, we should also set the CLKDM_CAN_DISABLE_AUTO flag. Unless the documentation is incorrect here? In another section (Table 8-9 "Clock Transition Mode Settings"), it claims that CLKTRCTRL = 0 is not supported...

Quoted 5 lines
Quoted 1 line

It is not supported, and should be considered as documentation issue.

Okay so I guess the description for this patch (quoted above) is wrong then also?

Yeah, I realized it, after your comment; its copy thing...Will correct in next version.

Paul,

I am thinking of separating clocktree patch (PATCH-V3 3/3) from this series, so that clockdomain stuff can get in independently, and clocktree anyway will follow them (it may take some time in review cycle).

Thanks,
Vaibhav

Quoted 3 lines

- Paul

maintainer
#7 lore raw

PATCH v3 2/3 ARM: OMAP3+: clockdomain33xx: Add clockdomain data and respective operations

Quoted 1 line · Vaibhav

On Thu, Apr 26, 2012 at 08:49:28, Paul Walmsley wrote:

(attribution lost)

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 4 lines

Also, since we're not defining any autodeps for the AM335x platform, we shouldn't need the CLKDM_NO_AUTODEPS flag either? Since no autodeps are defined, the default will be to not set any autodeps.

This is required to avoid few "pr_debug", if you don't provide it. For example, without this flag set, you will get,

pr_debug("clockdomain: hardware cannot set/clear sleep "

		"dependency affecting %s from %s\n", clkdm1->name,
             clkdm2->name);

Refer to the file omap_hwmod.c, function, _enable(), the call sequence is,

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

_enable() => _add_initiator_dep() => clkdm_add_sleepdep() =>leads to warning

Seems like the better thing to do is to just avoid calling _{add,del}_initiator_dep() on the AM335x.

Don't you think, if flag is doing all the job, why to pollute code with cpu_is_am33xx() checks.

That's not what that flag was intended to do. It was originally intended for OMAP3xxx, to allow autodeps to be disabled for some clockdomains, while leaving them enabled for others.

If autodeps are completely unneeded, as they are for AM335x, for slower cores like the Cortex-A8, it seems best to avoid executing any superfluous code.

Quoted 2 lines

Yeah, I realized it, after your comment; its copy thing...Will correct in next version.

I've dropped those lines from the description in the local copy here.

Quoted 3 lines

I am thinking of separating clocktree patch (PATCH-V3 3/3) from this series, so that clockdomain stuff can get in independently, and clocktree anyway will follow them (it may take some time in review cycle).

Yes, I was thinking of doing this too. The only aspect that gave me pause is that the clockdomain changes are not 100% separate from the clock tree. So we may have to update the clockdomain data as the clock tree changes.

- Paul

#8 lore raw

PATCH v3 2/3 ARM: OMAP3+: clockdomain33xx: Add clockdomain data and respective operations

Quoted 42 lines · Paul Walmsley
Quoted 1 line · Vaibhav

On Thu, Apr 26, 2012 at 08:49:28, Paul Walmsley wrote:

(attribution lost)

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 4 lines

Also, since we're not defining any autodeps for the AM335x platform, we shouldn't need the CLKDM_NO_AUTODEPS flag either? Since no autodeps are defined, the default will be to not set any autodeps.

This is required to avoid few "pr_debug", if you don't provide it. For example, without this flag set, you will get,

pr_debug("clockdomain: hardware cannot set/clear sleep "

		"dependency affecting %s from %s\n", clkdm1->name,
             clkdm2->name);

Refer to the file omap_hwmod.c, function, _enable(), the call sequence is,

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

_enable() => _add_initiator_dep() => clkdm_add_sleepdep() =>leads to warning

Seems like the better thing to do is to just avoid calling _{add,del}_initiator_dep() on the AM335x.

Don't you think, if flag is doing all the job, why to pollute code with cpu_is_am33xx() checks.

That's not what that flag was intended to do. It was originally intended for OMAP3xxx, to allow autodeps to be disabled for some clockdomains, while leaving them enabled for others.

If autodeps are completely unneeded, as they are for AM335x, for slower cores like the Cortex-A8, it seems best to avoid executing any superfluous code.

Quoted 2 lines

Yeah, I realized it, after your comment; its copy thing...Will correct in next version.

I've dropped those lines from the description in the local copy here.

Quoted 8 lines
Quoted 3 lines

I am thinking of separating clocktree patch (PATCH-V3 3/3) from this series, so that clockdomain stuff can get in independently, and clocktree anyway will follow them (it may take some time in review cycle).

Yes, I was thinking of doing this too. The only aspect that gave me pause is that the clockdomain changes are not 100% separate from the clock tree. So we may have to update the clockdomain data as the clock tree changes.

Why do you say that, clockdomain changes are not 100% separate from clocktree? It is completely independent...

Thanks,
Vaibhav

maintainer
#9 lore raw

PATCH v3 2/3 ARM: OMAP3+: clockdomain33xx: Add clockdomain data and respective operations

Quoted 1 line · Vaibhav

On Thu, Apr 26, 2012 at 14:27:20, Paul Walmsley wrote:

(attribution lost)

Quoted 10 lines
Quoted 7 lines
Quoted 3 lines

I am thinking of separating clocktree patch (PATCH-V3 3/3) from this series, so that clockdomain stuff can get in independently, and clocktree anyway will follow them (it may take some time in review cycle).

Yes, I was thinking of doing this too. The only aspect that gave me pause is that the clockdomain changes are not 100% separate from the clock tree. So we may have to update the clockdomain data as the clock tree changes.

Why do you say that, clockdomain changes are not 100% separate from clocktree? It is completely independent...

Clock enables and disables call clkdm_clk_{enable,disable}() which undertakes the clockdomain enable sequence on the first clock enabled inside the clockdomain, and the clockdomain disable sequence on the last clock inside the clockdomain. The clockdomain is associated with the clock via the struct clk .clkdm and .clkdm_name fields.

So yes, they are interconnected; particularly if the clkdiv32k MODULEMODE "clock" is really needed.

- Paul

#10 lore raw

PATCH v3 2/3 ARM: OMAP3+: clockdomain33xx: Add clockdomain data and respective operations

Quoted 14 lines · Paul Walmsley
Quoted 1 line · Vaibhav

On Thu, Apr 26, 2012 at 14:27:20, Paul Walmsley wrote:

(attribution lost)

Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

I am thinking of separating clocktree patch (PATCH-V3 3/3) from this series, so that clockdomain stuff can get in independently, and clocktree anyway will follow them (it may take some time in review cycle).

Yes, I was thinking of doing this too. The only aspect that gave me pause is that the clockdomain changes are not 100% separate from the clock tree. So we may have to update the clockdomain data as the clock tree changes.

Quoted 9 lines
Quoted 2 lines

Why do you say that, clockdomain changes are not 100% separate from clocktree? It is completely independent...

Clock enables and disables call clkdm_clk_{enable,disable}() which undertakes the clockdomain enable sequence on the first clock enabled inside the clockdomain, and the clockdomain disable sequence on the last clock inside the clockdomain. The clockdomain is associated with the clock via the struct clk .clkdm and .clkdm_name fields.

Paul,

"struct clk" will come into picture when we define clocktree (clock33xx_data.c file), isn't it?

Quoted 1 line

From clockdomain perspective, it is still independent and definite set of

clock domains as per device with respective api's required to control it. Which clock falls down to which domain, is defined in clocktree (clock33xx_data.c file), isn't it?

Quoted 4 lines

So yes, they are interconnected; particularly if the clkdiv32k MODULEMODE "clock" is really needed.

Coming back to example of div32k clock, assuming this as a module with MODULEMODE,

static struct clk clkdiv32k_ick = {

	.name           = "clkdiv32k_ick",
	.clkdm_name     = "clk_24mhz_clkdm",
	.rate           = 32768,
	.parent         = &clk_24mhz,
	.enable_reg     = AM33XX_CM_PER_CLKDIV32K_CLKCTRL,
	.enable_bit     = AM33XX_MODULEMODE_SWCTRL,
	.ops            = &clkops_omap2_dflt,

};

And we have separate domain for div32k clock.

static struct clockdomain clk_24mhz_am33xx_clkdm = {

	.name           = "clk_24mhz_clkdm",
	.pwrdm          = { .name = "per_pwrdm" },
	.cm_inst        = AM33XX_CM_PER_MOD,

.prcm_partition = AM33XX_PRM_PARTITION,
.clkdm_offs = AM33XX_CM_PER_CLK_24MHZ_CLKSTCTRL_OFFSET,
.clktrctrl_mask = AM33XX_CLKTRCTRL_MASK,
.flags = (CLKDM_CAN_SWSUP | CLKDM_NO_AUTODEPS),
};

In any case, I believe we have to define this domain in clockdomain_data, right?

Just FYI, I am about to initiate a mail-chain with design team, on your questions on div32k. Hopefully I will have some input by Monday.

Thanks,
Vaibhav

#11 lore raw

PATCH v3 3/3 ARM: OMAP3+: clock33xx: Add AM33XX clock tree data

In reply to Vaibhav Hiremath

AM33XX clock implementation is different than any existing OMAP family of devices. Although DPLL module is similar to OMAP4 device, but the usage is very much different than OMAP4. AM33XX has different peripheral set and each module gets integrated to the clock framework differently than OMAP family of devices.

This patch adds full Clock tree data for AM33XX family of devices and also integrates it into existing OMAP framework.

Cc Kevin Hilman <[email protected]>
Cc Rajendra Nayak <[email protected]>
CC Tony Lindgren <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Benoit Cousson <[email protected]>

---
In one of the baseport patch, Tony had removed CK_AM33XX flag. I am not sure, different families of same device with some minor/major changes in clock implementation is going to get handled. So, as of now I have added this flag again.
Flag is not required atleast as of now in order to support AM335x device, currently only known device in the family.

 arch/arm/mach-omap2/Makefile                  |    1 +
 arch/arm/mach-omap2/clock33xx.h               |   36 +
 arch/arm/mach-omap2/clock33xx_data.c          | 2209 +++++++++++++++++++++++++
 arch/arm/mach-omap2/io.c                      |    3 +-
 arch/arm/plat-omap/include/plat/clkdev_omap.h |    1 +
 5 files changed, 2249 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-omap2/clock33xx.h
 create mode 100644 arch/arm/mach-omap2/clock33xx_data.c
arch/arm/mach-omap2/Makefile +1 -0
index 13838df..e68f04c 100644
@@ -155,6 +155,7 @@ obj-$(CONFIG_ARCH_OMAP3)		+= $(clock-common) clock3xxx.o \
 					   clock3517.o clock36xx.o \
 					   dpll3xxx.o clock3xxx_data.o \
 					   clkt_iclk.o
+obj-$(CONFIG_SOC_OMAPAM33XX)		+= clock33xx_data.o
 obj-$(CONFIG_ARCH_OMAP4)		+= $(clock-common) clock44xx_data.o \
 					   dpll3xxx.o dpll44xx.o
 
arch/arm/mach-omap2/clock33xx.h new file +36 -0
new file mode 100644
index 0000000..a757575
@@ -0,0 +1,36 @@
+/*
+ * AM33XX clock function prototypes and macros.
+ *
+ * Copyright (C) 2011-2012 Texas Instruments Incorporated - http://www.ti.com/
+ * Vaibhav Hiremath <[email protected]>
+ *
+ * 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.
+ */
+
+#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK33XX_H
+#define __ARCH_ARM_MACH_OMAP2_CLOCK33XX_H
+
+#include "clock.h"
+
+int am33xx_clk_init(void);
+
+/* TRM ERRATA: Timer 3 & 6 default parent (TCLKIN) may not be always
+     physically present, in such a case HWMOD enabling of
+     clock would be failure with default parent. And timer
+     probe thinks clock is already enabled, this leads to
+     crash upon accessing timer 3 & 6 registers in probe.
+     Fix by setting parent of both these timers to master
+     oscillator clock.
+ */
+static inline void am33xx_init_timer_parent(struct clk *clk)
+{
+	omap2_clksel_set_parent(clk, clk->parent);
+}
+#endif
arch/arm/mach-omap2/clock33xx_data.c new file +2209 -0

2,209 lines not on this page · raw message

arch/arm/mach-omap2/io.c +2 -1
index be08dc7..00d7e94 100644
@@ -41,6 +41,7 @@
 #include "clock2xxx.h"
 #include "clock3xxx.h"
 #include "clock44xx.h"
+#include "clock33xx.h"
 
 /*
  * The machine specific code may provide the extra mapping besides the
@@ -475,7 +476,7 @@ void __init am33xx_init_early(void)
 	am33xx_voltagedomains_init();
 	am33xx_powerdomains_init();
 	am33xx_clockdomains_init();
-	omap3xxx_clk_init();
+	am33xx_clk_init();
 }
 #endif
 
arch/arm/plat-omap/include/plat/clkdev_omap.h +1 -0
index b299b8d..7b9a934 100644
@@ -40,6 +40,7 @@ struct omap_clk {
 #define CK_443X		(1 << 11)
 #define CK_TI816X	(1 << 12)
 #define CK_446X		(1 << 13)
+#define CK_AM33XX	(1 << 14)	/* AM33xx specific clocks */
 #define CK_1710		(1 << 15)	/* 1710 extra for rate selection */
 
 

--
1.7.0.4

maintainer
#12 lore raw

PATCH v3 3/3 ARM: OMAP3+: clock33xx: Add AM33XX clock tree data

Hello Vaibhav, Afzal, Vaibhav,

Quoted 9 lines · Vaibhav Hiremath

AM33XX clock implementation is different than any existing OMAP family of devices. Although DPLL module is similar to OMAP4 device, but the usage is very much different than OMAP4. AM33XX has different peripheral set and each module gets integrated to the clock framework differently than OMAP family of devices.

This patch adds full Clock tree data for AM33XX family of devices and also integrates it into existing OMAP framework.

What do you think about the possibility of removing all of the leaf clocks that have AM33XX_MODULEMODE_SWCTRL as their .enable_bit, assuming there are no .fixed_div or .clksel* fields associated with the clocks?

In theory, I don't think they are needed. The drivers should be using runtime PM, and that should enable and disable the module via the hwmod code, rather than the clock code.

Of course some clocks would still be needed for the main_clk fields for the hwmods, but the hwmods should be able to use the leaf clock's parent clocks for that.

That would save quite a few lines of data. And I think Beno?t is planning to do that for OMAP4+.

What do you think?

- Paul

#13 lore raw

PATCH v3 3/3 ARM: OMAP3+: clock33xx: Add AM33XX clock tree data

Quoted 22 lines · Paul Walmsley

Hello Vaibhav, Afzal, Vaibhav,

Quoted 9 lines · Vaibhav Hiremath

AM33XX clock implementation is different than any existing OMAP family of devices. Although DPLL module is similar to OMAP4 device, but the usage is very much different than OMAP4. AM33XX has different peripheral set and each module gets integrated to the clock framework differently than OMAP family of devices.

This patch adds full Clock tree data for AM33XX family of devices and also integrates it into existing OMAP framework.

What do you think about the possibility of removing all of the leaf clocks that have AM33XX_MODULEMODE_SWCTRL as their .enable_bit, assuming there are no .fixed_div or .clksel* fields associated with the clocks?

In theory, I don't think they are needed. The drivers should be using runtime PM, and that should enable and disable the module via the hwmod code, rather than the clock code.

Quoted 9 lines

Of course some clocks would still be needed for the main_clk fields for the hwmods, but the hwmods should be able to use the leaf clock's parent clocks for that.

That would save quite a few lines of data. And I think Beno?t is planning to do that for OMAP4+.

What do you think?

Paul,

Yes, theoretically it is possible to do it. But it will also break some of the existing things, like,

1. DebugFS clock interface

I believe, with this change, you will not have all the leaf nodes as part of clock tree, so they will not be populated in /debug/clock/

2. Enable and disable of the module is one part, but what about, changing the rate of the clock (followparent_recalc)?
With the proper and complete clock tree, you can traverse the clock and driver code doesn't need to know about parent.
Driver can simply call clk_set_rate() on leaf clock, and clock tree will handle it.

If at all we take this path, we have to build the clk node runtime (on-the-fly), AND/OR add new pm_runtime_set_rate() api.

Are you available on IRC chat anytime? We can discuss on this and align quickly.
I am available on linux-omap irc channel (with the name = "hvaibhav")

Thanks,
Vaibhav

Quoted 3 lines

- Paul

#14 lore raw

PATCH v3 3/3 ARM: OMAP3+: clock33xx: Add AM33XX clock tree data

Hi Vaibhav,

Quoted 49 lines · Vaibhav
Quoted 22 lines · Paul Walmsley

Hello Vaibhav, Afzal, Vaibhav,

Quoted 9 lines · Vaibhav Hiremath

AM33XX clock implementation is different than any existing OMAP family of devices. Although DPLL module is similar to OMAP4 device, but the usage is very much different than OMAP4. AM33XX has different peripheral set and each module gets integrated to the clock framework differently than OMAP family of devices.

This patch adds full Clock tree data for AM33XX family of devices and also integrates it into existing OMAP framework.

What do you think about the possibility of removing all of the leaf clocks that have AM33XX_MODULEMODE_SWCTRL as their .enable_bit, assuming there are no .fixed_div or .clksel* fields associated with the clocks?

In theory, I don't think they are needed. The drivers should be using runtime PM, and that should enable and disable the module via the hwmod code, rather than the clock code.

Quoted 9 lines

Of course some clocks would still be needed for the main_clk fields for the hwmods, but the hwmods should be able to use the leaf clock's parent clocks for that.

That would save quite a few lines of data. And I think Beno?t is planning to do that for OMAP4+.

What do you think?

Paul,

Yes, theoretically it is possible to do it. But it will also break some of the existing things, like,

1. DebugFS clock interface

I believe, with this change, you will not have all the leaf nodes as part of clock tree, so they will not be populated in /debug/clock/

2. Enable and disable of the module is one part, but what about, changing the rate of the clock (followparent_recalc)?
With the proper and complete clock tree, you can traverse the clock and driver code doesn't need to know about parent.
Driver can simply call clk_set_rate() on leaf clock, and clock tree will handle it.

Quoted 2 lines

If at all we take this path, we have to build the clk node runtime (on-the-fly), AND/OR add new pm_runtime_set_rate() api.

Not at all. You just have to get the fck of that hwmod and use the clock API.

Quoted 3 lines

Are you available on IRC chat anytime? We can discuss on this and align quickly.
I am available on linux-omap irc channel (with the name = "hvaibhav")

That will not change anything, the point is that MODULEMODE_SWCTRL is uses for module control, not for clock directly, and that's why it is handled by the hwmod.

That will just replace the main_clk from the hwmod with the parent of the current modulemode nodes. Only the enable/disable part will be handled, if that node used to have a div, then the parent will handle that.

Today this module mode clock node is just a duplication of the hwmod node. By removing it, you will reduce the size of the data and have a much mode accurate representation of the reality.

Using the clock tree to handle these nodes was a hack we had to do because the hwmod fmwk was not ready when OMAP4 was introduced and because most drivers were not using pm_runtime.

Regards,
Benoit

#15 lore raw

PATCH v3 3/3 ARM: OMAP3+: clock33xx: Add AM33XX clock tree data

Quoted 70 lines · Benoit

Hi Vaibhav,

Quoted 49 lines · Vaibhav
Quoted 22 lines · Paul Walmsley

Hello Vaibhav, Afzal, Vaibhav,

Quoted 9 lines · Vaibhav Hiremath

AM33XX clock implementation is different than any existing OMAP family of devices. Although DPLL module is similar to OMAP4 device, but the usage is very much different than OMAP4. AM33XX has different peripheral set and each module gets integrated to the clock framework differently than OMAP family of devices.

This patch adds full Clock tree data for AM33XX family of devices and also integrates it into existing OMAP framework.

What do you think about the possibility of removing all of the leaf clocks that have AM33XX_MODULEMODE_SWCTRL as their .enable_bit, assuming there are no .fixed_div or .clksel* fields associated with the clocks?

In theory, I don't think they are needed. The drivers should be using runtime PM, and that should enable and disable the module via the hwmod code, rather than the clock code.

Quoted 9 lines

Of course some clocks would still be needed for the main_clk fields for the hwmods, but the hwmods should be able to use the leaf clock's parent clocks for that.

That would save quite a few lines of data. And I think Beno?t is planning to do that for OMAP4+.

What do you think?

Paul,

Yes, theoretically it is possible to do it. But it will also break some of the existing things, like,

1. DebugFS clock interface

I believe, with this change, you will not have all the leaf nodes as part of clock tree, so they will not be populated in /debug/clock/

2. Enable and disable of the module is one part, but what about, changing the rate of the clock (followparent_recalc)?
With the proper and complete clock tree, you can traverse the clock and driver code doesn't need to know about parent.
Driver can simply call clk_set_rate() on leaf clock, and clock tree will handle it.

Quoted 2 lines

If at all we take this path, we have to build the clk node runtime (on-the-fly), AND/OR add new pm_runtime_set_rate() api.

Not at all. You just have to get the fck of that hwmod and use the clock API.

Quoted 3 lines

Are you available on IRC chat anytime? We can discuss on this and align quickly.
I am available on linux-omap irc channel (with the name = "hvaibhav")

That will not change anything, the point is that MODULEMODE_SWCTRL is uses for module control, not for clock directly, and that's why it is handled by the hwmod.

That will just replace the main_clk from the hwmod with the parent of the current modulemode nodes. Only the enable/disable part will be handled, if that node used to have a div, then the parent will handle that.

Quoted 8 lines

Today this module mode clock node is just a duplication of the hwmod node. By removing it, you will reduce the size of the data and have a much mode accurate representation of the reality.

Using the clock tree to handle these nodes was a hack we had to do because the hwmod fmwk was not ready when OMAP4 was introduced and because most drivers were not using pm_runtime.

Benoit,

I completely understand what are trying to explain here, and I completely agree with you on the fact that, MODULEMODE_SWCTRL is for module control and is clock node is just a duplication.

Module enable and disable is one part, and I am not at all referring to this. My point is, more from other piece of code which are dependent on clocktree. In order to have proper and complete debugfs representation of all the clocks, somebody has to maintain the information of leaf clocks to parent relation, Isn't it?

For example, take OMAP44xx "dss_dss_clk" clock, OR any clock with "followparent_recalc" field, the question I am raising here is,

How would I know the rate of this clock in driver? Say for example, I want to configure my internal divider based on input rate?
OR
I want to change the rate of dss_clk itself?
OR
Looking at debugfs, would I get the rate of dss_clk?
OR
Will I have dss_clk present in /debug/clock/?
OR
Are we expecting user to know parent of such leaf clocks?
OR
Are we planning to export hwmod->main_clk (which is parent clk here) to User in debugfs or something?

Thanks,
Vaibhav

Quoted 7 lines

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

#16 lore raw

PATCH v3 3/3 ARM: OMAP3+: clock33xx: Add AM33XX clock tree data

Quoted 1 line · Vaibhav

On Wed, Apr 25, 2012 at 14:10:49, Cousson, Benoit wrote:

...

Quoted 19 lines
Quoted 8 lines

That will not change anything, the point is that MODULEMODE_SWCTRL is uses for module control, not for clock directly, and that's why it is handled by the hwmod.

That will just replace the main_clk from the hwmod with the parent of the current modulemode nodes. Only the enable/disable part will be handled, if that node used to have a div, then the parent will handle that.

Quoted 8 lines

Today this module mode clock node is just a duplication of the hwmod node. By removing it, you will reduce the size of the data and have a much mode accurate representation of the reality.

Using the clock tree to handle these nodes was a hack we had to do because the hwmod fmwk was not ready when OMAP4 was introduced and because most drivers were not using pm_runtime.

Benoit,

Quoted 7 lines

I completely understand what are trying to explain here, and I completely agree with you on the fact that, MODULEMODE_SWCTRL is for module control and is clock node is just a duplication.

Module enable and disable is one part, and I am not at all referring to this. My point is, more from other piece of code which are dependent on clocktree. In order to have proper and complete debugfs representation of all the clocks, somebody has to maintain the information of leaf clocks to parent relation, Isn't it?

Nope, not at all. All the clocks will stay in the clock tree. The clock consumers a.k.a hwmods does not have to be in the clock tree. Having some fake leaf nodes in the clock tree is just adding some fake intermediate clocks instead of the real consumer. These nodes do not exist, they were added to have a point of control from the driver before runtime_pm was there.

Quoted 1 line

For example, take OMAP44xx "dss_dss_clk" clock, OR any clock with "followparent_recalc" field, the question I am raising here is,

Then it is not an issue. If this is a real clock, it will then stay in the clock data.

Quoted 6 lines

How would I know the rate of this clock in driver? Say for example, I want to configure my internal divider based on input rate?
OR
I want to change the rate of dss_clk itself?
OR
Looking at debugfs, would I get the rate of dss_clk?

No because that clock will not exist anymore, but you will have the real clock rate from the "dss_dss_clk".

Quoted 4 lines

OR
Will I have dss_clk present in /debug/clock/?
OR
Are we expecting user to know parent of such leaf clocks?

Yes, because it is not leaf nodes anymore, but modules.

Quoted 3 lines

OR
Are we planning to export hwmod->main_clk (which is parent clk here) to User in debugfs or something?

Well, I used to have a patch do expose hwmod to debugfs, but this is not that useful.

I think this is a non-issue, we are just removing clock nodes that are not real nodes, so it will not change anything practically speaking.

Regards,
Benoit

#17 lore raw

PATCH v3 3/3 ARM: OMAP3+: clock33xx: Add AM33XX clock tree data

Quoted 5 lines · Benoit
Quoted 1 line · Vaibhav

On Wed, Apr 25, 2012 at 14:10:49, Cousson, Benoit wrote:

...

<snip>

Quoted 11 lines
Quoted 7 lines

How would I know the rate of this clock in driver? Say for example, I want to configure my internal divider based on input rate?
OR
I want to change the rate of dss_clk itself?
OR
Looking at debugfs, would I get the rate of dss_clk?

No because that clock will not exist anymore, but you will have the real clock rate from the "dss_dss_clk".

Thanks Benoit, I think I understand your perspective on Module Vs leaf node and now able to digest as well.
Probably Last Q, which I think clarify all my doubts,

Assume we have complete hwmod instance and built a device using omap_device_build() api, and also the driver is completely using runtime pm api's,
How can driver get the clk handle (required to get the rate)? Is there any api already available for this?

Thanks,
Vaibhav

#18 lore raw

PATCH v3 3/3 ARM: OMAP3+: clock33xx: Add AM33XX clock tree data

Quoted 23 lines · Vaibhav
Quoted 5 lines · Benoit
Quoted 1 line · Vaibhav

On Wed, Apr 25, 2012 at 14:10:49, Cousson, Benoit wrote:

...

<snip>

Quoted 11 lines
Quoted 7 lines

How would I know the rate of this clock in driver? Say for example, I want to configure my internal divider based on input rate?
OR
I want to change the rate of dss_clk itself?
OR
Looking at debugfs, would I get the rate of dss_clk?

No because that clock will not exist anymore, but you will have the real clock rate from the "dss_dss_clk".

Thanks Benoit, I think I understand your perspective on Module Vs leaf node and now able to digest as well.
Probably Last Q, which I think clarify all my doubts,

Quoted 5 lines

Assume we have complete hwmod instance and built a device using omap_device_build() api, and also the driver is completely using runtime pm api's,
How can driver get the clk handle (required to get the rate)? Is there any api already available for this?

The omap_device fmwk will auto-magically create a "fck" clkdev entry for the main_clk.

The API is thus the standard: clk_get(dev, "fck"), to get the clock handle and then you can use the other clock API.

The idea is to enforce the usage of clock alias local to the device and not trying anymore to get the real clock name. It thus allows driver to work on various variant / revision without having to modify the driver.

The fmwk will also create clock alias for any opt_clock present in the hwmod.

Regards,
Benoit

#19 lore raw

PATCH v3 3/3 ARM: OMAP3+: clock33xx: Add AM33XX clock tree data

Quoted 36 lines · Benoit
Quoted 23 lines · Vaibhav
Quoted 5 lines · Benoit
Quoted 1 line · Vaibhav

On Wed, Apr 25, 2012 at 14:10:49, Cousson, Benoit wrote:

...

<snip>

Quoted 11 lines
Quoted 7 lines

How would I know the rate of this clock in driver? Say for example, I want to configure my internal divider based on input rate?
OR
I want to change the rate of dss_clk itself?
OR
Looking at debugfs, would I get the rate of dss_clk?

No because that clock will not exist anymore, but you will have the real clock rate from the "dss_dss_clk".

Thanks Benoit, I think I understand your perspective on Module Vs leaf node and now able to digest as well.
Probably Last Q, which I think clarify all my doubts,

Quoted 5 lines

Assume we have complete hwmod instance and built a device using omap_device_build() api, and also the driver is completely using runtime pm api's,
How can driver get the clk handle (required to get the rate)? Is there any api already available for this?

The omap_device fmwk will auto-magically create a "fck" clkdev entry for the main_clk.

The API is thus the standard: clk_get(dev, "fck"), to get the clock handle and then you can use the other clock API.

Quoted 7 lines

The idea is to enforce the usage of clock alias local to the device and not trying anymore to get the real clock name. It thus allows driver to work on various variant / revision without having to modify the driver.

The fmwk will also create clock alias for any opt_clock present in the hwmod.

Yes, Yes, I missed this. Omap_device_build() internally add "fck" to the clkdev table for both main_clk and opt_clks.

Thanks for describing it for me. I will change AM33XX clock tree for this And submit the next version soon.

Thanks,
Vaibhav

maintainer
#20 lore raw

PATCH v3 3/3 ARM: OMAP3+: clock33xx: Add AM33XX clock tree data

Hi Vaibhav,

Quoted 2 lines · Vaibhav

Thanks for describing it for me. I will change AM33XX clock tree for this And submit the next version soon.

Well I can just remove those leaf clock entries from my copy here, if you're okay with that ?

- Paul

#21 lore raw

PATCH v3 3/3 ARM: OMAP3+: clock33xx: Add AM33XX clock tree data

Quoted 10 lines · Paul Walmsley

Hi Vaibhav,

Quoted 2 lines · Vaibhav

Thanks for describing it for me. I will change AM33XX clock tree for this And submit the next version soon.

Well I can just remove those leaf clock entries from my copy here, if you're okay with that ?

Great...

More that OK :)

Thanks,
Vaibhav

maintainer
#22 lore raw

PATCH v3 3/3 ARM: OMAP3+: clock33xx: Add AM33XX clock tree data

Quoted 6 lines · Vaibhav
Quoted 5 lines · Paul Walmsley
Quoted 2 lines · Vaibhav

Thanks for describing it for me. I will change AM33XX clock tree for this And submit the next version soon.

Quoted 7 lines
Quoted 3 lines

Well I can just remove those leaf clock entries from my copy here, if you're okay with that ?

Great...

More that OK :)

I have taken a first pass at this. The updated patch is below. It has been compile-tested only. Could you please review this and try testing it? It is also in the branch 'am33xx_support_3.5' of
git://git.pwsan.com/linux-2.6.

Here are a few notes:

- Leaf nodes with MODULEMODE clock enable bits were removed, where there were no obvious driver dependencies. Removing these may not be the correct thing to do, considering strange clocks like the CLKDIV32K. It may be that the underlying clockdomain control for this device is very different than the OMAP4, and if so, we need to find this out sooner rather than later.

- Clock nodes with no direct hardware control have been dropped. This has the unfortunate consequence of making the clock tree slightly harder to follow, but, in combination with the MODULEMODE clock removals, reduces the diffstat burden by about 1000 lines.

- Many clksel clocks were missing .init, .set_rate, and .round_rate function pointers; these have been added where it appeared to be appropriate. Also, many clksel clocks had incorrect .recalc function pointers that did not take the clksel fields into consideration; these have been fixed.

- Several common struct clksel_rate blocks were shared with the OMAP4 clock tree.

- The non-inlineable function am33xx_init_timer_parent() was moved from clock33xx.h to clock33xx.c.

- Some multi-line comment formatting and mach-omap2/control.h formatting was cleaned up.

- AM33XX_CONTROL_STATUS_SYSBOOT1_MASK/SHIFT macros were added to remove a magic number from the clock tree.

- The "clk_sel" nomenclature in the original patch was changed to "clksel" to conform with the use in OMAP2/3/4 clock trees.

- The timer mux clock nodes have been split from the timer MODULEMODE nodes.

Still to be done:

* Some clocks seem to be missing clockdomain names. These probably should be added.

* The clkdiv32k clock needs to be revised, depending on feedback from the hardware team.

- Paul

maintainer
#23 lore raw

PATCH v3 3/3 ARM: OMAP3+: clock33xx: Add AM33XX clock tree data

Quoted 4 lines · Paul Walmsley

I have taken a first pass at this. The updated patch is below. It has been compile-tested only. Could you please review this and try testing it? It is also in the branch 'am33xx_support_3.5' of
git://git.pwsan.com/linux-2.6.

Here is the patch.

- Paul

From: Vaibhav Hiremath <[email protected]>
Date: Wed, 18 Apr 2012 15:46:53 -0600
Subject: [PATCH] ARM: OMAP3+: clock33xx: Add AM33XX clock tree data

AM33XX clock implementation is different than any existing OMAP family of devices. Although DPLL module is similar to OMAP4 device, but the usage is very much different than OMAP4. AM33XX has different peripheral set and each module gets integrated to the clock framework differently than OMAP family of devices.

This patch adds full Clock tree data for AM33XX family of devices and also integrates it into existing OMAP framework.

Cc Kevin Hilman <[email protected]>
Cc Rajendra Nayak <[email protected]>
CC Tony Lindgren <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Benoit Cousson <[email protected]>

[paul at pwsan.com: renamed "clk_sel" to "clksel" to conform with other
OMAPs; dropped leaf modulemode clock nodes; dropped empty interface clock nodes; share common clksel_rate blocks between OMAP44xx and AM33xx; added AM33XX_CONTROL_STATUS_SYSBOOT1_MASK/SHIFT macros; fixed some control.h formatting; fixed some multiline comment formatting; moved the non-inlineable function am33xx_init_timer_parent() from clock33xx.h to clock33xx.c; added .set_rate & .round_rate function pointers for many clksel clocks; added .init function pointer to many clksel clocks; changed .recalc function pointer for many clksel clocks; timer fcks have been split from timer mux control clocks]

---
 arch/arm/mach-omap2/Makefile                  |    1 +
 arch/arm/mach-omap2/clock.h                   |   14 +
 arch/arm/mach-omap2/clock33xx_data.c          | 1159 +++++++++++++++++++++++++
 arch/arm/mach-omap2/clock3xxx_data.c          |   20 +-
 arch/arm/mach-omap2/clock44xx_data.c          |   72 --
 arch/arm/mach-omap2/clock_common_data.c       |   77 ++
 arch/arm/mach-omap2/control.h                 |   32 +-
 arch/arm/mach-omap2/io.c                      |    3 +-
 arch/arm/plat-omap/include/plat/clkdev_omap.h |    1 +
 9 files changed, 1274 insertions(+), 105 deletions(-)
 create mode 100644 arch/arm/mach-omap2/clock33xx_data.c
arch/arm/mach-omap2/Makefile +1 -0
index 0fb1eaf..c20498f 100644
@@ -156,6 +156,7 @@ obj-$(CONFIG_ARCH_OMAP3)		+= $(clock-common) clock3xxx.o \
 					   clock3517.o clock36xx.o \
 					   dpll3xxx.o clock3xxx_data.o \
 					   clkt_iclk.o
+obj-$(CONFIG_SOC_OMAPAM33XX)		+= clock33xx_data.o
 obj-$(CONFIG_ARCH_OMAP4)		+= $(clock-common) clock44xx_data.o \
 					   dpll3xxx.o dpll44xx.o
 
arch/arm/mach-omap2/clock.h +14 -0
index b8c2a68..afb0eb4 100644
@@ -163,4 +163,18 @@ extern const struct clkops clkops_omap3_noncore_dpll_ops;
 extern const struct clkops clkops_omap3_core_dpll_ops;
 extern const struct clkops clkops_omap4_dpllmx_ops;
 
+/* clksel_rate blocks shared between OMAP44xx and AM33xx */
+extern const struct clksel_rate div_1_0_rates[];
+extern const struct clksel_rate div_1_1_rates[];
+extern const struct clksel_rate div_1_2_rates[];
+extern const struct clksel_rate div_1_3_rates[];
+extern const struct clksel_rate div_1_4_rates[];
+extern const struct clksel_rate div31_1to31_rates[];
+
+/* clocks shared between various OMAP SoCs */
+extern struct clk virt_19200000_ck;
+extern struct clk virt_26000000_ck;
+
+extern int am33xx_clk_init(void);
+
 #endif
arch/arm/mach-omap2/clock33xx_data.c new file +1159 -0

1,159 lines not on this page · raw message

arch/arm/mach-omap2/clock3xxx_data.c +4 -16
index f4a626f..2643200 100644
@@ -93,18 +93,6 @@ static struct clk virt_16_8m_ck = {
 	.rate		= 16800000,
 };
 
-static struct clk virt_19_2m_ck = {
-	.name		= "virt_19_2m_ck",
-	.ops		= &clkops_null,
-	.rate		= 19200000,
-};
-
-static struct clk virt_26m_ck = {
-	.name		= "virt_26m_ck",
-	.ops		= &clkops_null,
-	.rate		= 26000000,
-};
-
 static struct clk virt_38_4m_ck = {
 	.name		= "virt_38_4m_ck",
 	.ops		= &clkops_null,
@@ -145,8 +133,8 @@ static const struct clksel osc_sys_clksel[] = {
 	{ .parent = &virt_12m_ck,   .rates = osc_sys_12m_rates },
 	{ .parent = &virt_13m_ck,   .rates = osc_sys_13m_rates },
 	{ .parent = &virt_16_8m_ck, .rates = osc_sys_16_8m_rates },
-	{ .parent = &virt_19_2m_ck, .rates = osc_sys_19_2m_rates },
-	{ .parent = &virt_26m_ck,   .rates = osc_sys_26m_rates },
+	{ .parent = &virt_19200000_ck, .rates = osc_sys_19_2m_rates },
+	{ .parent = &virt_26000000_ck, .rates = osc_sys_26m_rates },
 	{ .parent = &virt_38_4m_ck, .rates = osc_sys_38_4m_rates },
 	{ .parent = NULL },
 };
@@ -3229,8 +3217,8 @@ static struct omap_clk omap3xxx_clks[] = {
 	CLK(NULL,	"virt_12m_ck",	&virt_12m_ck,	CK_3XXX),
 	CLK(NULL,	"virt_13m_ck",	&virt_13m_ck,	CK_3XXX),
 	CLK(NULL,	"virt_16_8m_ck", &virt_16_8m_ck, CK_3430ES2PLUS | CK_AM35XX  | CK_36XX),
-	CLK(NULL,	"virt_19_2m_ck", &virt_19_2m_ck, CK_3XXX),
-	CLK(NULL,	"virt_26m_ck",	&virt_26m_ck,	CK_3XXX),
+	CLK(NULL,	"virt_19200000_ck", &virt_19200000_ck, CK_3XXX),
+	CLK(NULL,	"virt_26000000_ck", &virt_26000000_ck, CK_3XXX),
 	CLK(NULL,	"virt_38_4m_ck", &virt_38_4m_ck, CK_3XXX),
 	CLK(NULL,	"osc_sys_ck",	&osc_sys_ck,	CK_3XXX),
 	CLK(NULL,	"sys_ck",	&sys_ck,	CK_3XXX),
arch/arm/mach-omap2/clock44xx_data.c +0 -72

90 lines not on this page · raw message

arch/arm/mach-omap2/clock_common_data.c +77 -0

80 lines not on this page · raw message

arch/arm/mach-omap2/control.h +16 -16
index ec60e9b..c43f03c 100644
@@ -318,15 +318,15 @@
 						OMAP343X_SCRATCHPAD + reg)
 
 /* AM35XX_CONTROL_IPSS_CLK_CTRL bits */
-#define AM35XX_USBOTG_VBUSP_CLK_SHIFT   0
-#define AM35XX_CPGMAC_VBUSP_CLK_SHIFT   1
-#define AM35XX_VPFE_VBUSP_CLK_SHIFT     2
-#define AM35XX_HECC_VBUSP_CLK_SHIFT     3
-#define AM35XX_USBOTG_FCLK_SHIFT        8
-#define AM35XX_CPGMAC_FCLK_SHIFT        9
-#define AM35XX_VPFE_FCLK_SHIFT          10
-
-/*AM35XX CONTROL_LVL_INTR_CLEAR bits*/
+#define AM35XX_USBOTG_VBUSP_CLK_SHIFT	0
+#define AM35XX_CPGMAC_VBUSP_CLK_SHIFT	1
+#define AM35XX_VPFE_VBUSP_CLK_SHIFT	2
+#define AM35XX_HECC_VBUSP_CLK_SHIFT	3
+#define AM35XX_USBOTG_FCLK_SHIFT	8
+#define AM35XX_CPGMAC_FCLK_SHIFT	9
+#define AM35XX_VPFE_FCLK_SHIFT		10
+
+/* AM35XX CONTROL_LVL_INTR_CLEAR bits */
 #define AM35XX_CPGMAC_C0_MISC_PULSE_CLR	BIT(0)
 #define AM35XX_CPGMAC_C0_RX_PULSE_CLR	BIT(1)
 #define AM35XX_CPGMAC_C0_RX_THRESH_CLR	BIT(2)
@@ -336,22 +336,22 @@
 #define AM35XX_VPFE_CCDC_VD1_INT_CLR	BIT(6)
 #define AM35XX_VPFE_CCDC_VD2_INT_CLR	BIT(7)
 
-/*AM35XX CONTROL_IP_SW_RESET bits*/
+/* AM35XX CONTROL_IP_SW_RESET bits */
 #define AM35XX_USBOTGSS_SW_RST		BIT(0)
 #define AM35XX_CPGMACSS_SW_RST		BIT(1)
 #define AM35XX_VPFE_VBUSP_SW_RST	BIT(2)
 #define AM35XX_HECC_SW_RST		BIT(3)
 #define AM35XX_VPFE_PCLK_SW_RST		BIT(4)
 
-/*
- * CONTROL AM33XX STATUS register
- */
+/* AM33XX CONTROL_STATUS register */
 #define AM33XX_CONTROL_STATUS		0x040
 #define AM33XX_CONTROL_SEC_CLK_CTRL	0x1bc
 
-/*
- * CONTROL OMAP STATUS register to identify OMAP3 features
- */
+/* AM33XX CONTROL_STATUS bitfields (partial) */
+#define AM33XX_CONTROL_STATUS_SYSBOOT1_SHIFT		22
+#define AM33XX_CONTROL_STATUS_SYSBOOT1_MASK		(0x3 << 22)
+
+/* CONTROL OMAP STATUS register to identify OMAP3 features */
 #define OMAP3_CONTROL_OMAP_STATUS	0x044c
 
 #define OMAP3_SGX_SHIFT			13
arch/arm/mach-omap2/io.c +2 -1
index 3d06561..1e54705 100644
@@ -37,6 +37,7 @@
 #include "powerdomain.h"
 #include "clockdomain.h"
 #include "common.h"
+#include "clock.h"
 #include "clock2xxx.h"
 #include "clock3xxx.h"
 #include "clock44xx.h"
@@ -460,7 +461,7 @@ void __init am33xx_init_early(void)
 	am33xx_voltagedomains_init();
 	am33xx_powerdomains_init();
 	am33xx_clockdomains_init();
-	omap3xxx_clk_init();
+	am33xx_clk_init();
 }
 
 void __init ti81xx_init_early(void)
arch/arm/plat-omap/include/plat/clkdev_omap.h +1 -0
index b299b8d..7b9a934 100644
@@ -40,6 +40,7 @@ struct omap_clk {
 #define CK_443X		(1 << 11)
 #define CK_TI816X	(1 << 12)
 #define CK_446X		(1 << 13)
+#define CK_AM33XX	(1 << 14)	/* AM33xx specific clocks */
 #define CK_1710		(1 << 15)	/* 1710 extra for rate selection */
 
 
Signature · 1 line
1.7.10
#24 lore raw

PATCH v3 3/3 ARM: OMAP3+: clock33xx: Add AM33XX clock tree data

In reply to Paul Walmsley
Quoted 9 lines · Paul Walmsley

Hi Vaibhav,

Quoted 2 lines · Vaibhav

Thanks for describing it for me. I will change AM33XX clock tree for this And submit the next version soon.

Well I can just remove those leaf clock entries from my copy here, if you're okay with that ?

Please take care of changing the hwmod main_clk as well. But maybe that's not part of that series.

maintainer
#25 lore raw

PATCH v3 3/3 ARM: OMAP3+: clock33xx: Add AM33XX clock tree data

Quoted 2 lines · Benoit

Please take care of changing the hwmod main_clk as well. But maybe that's not part of that series.

It's not part of the series yet.

Vaibhav, could you take care of changing the main_clk in your hwmod data patches, and send those to the list?

- Paul

#26 lore raw

PATCH v3 3/3 ARM: OMAP3+: clock33xx: Add AM33XX clock tree data

Quoted 11 lines · Paul Walmsley
Quoted 2 lines · Benoit

Please take care of changing the hwmod main_clk as well. But maybe that's not part of that series.

It's not part of the series yet.

Vaibhav, could you take care of changing the main_clk in your hwmod data patches, and send those to the list?

Yes, Working on the same now...

Thanks,
Vaibhav

Quoted 2 lines

- Paul

#27 lore raw

PATCH v3 3/3 ARM: OMAP3+: clock33xx: Add AM33XX clock tree data

In reply to Paul Walmsley
Quoted 11 lines · Paul Walmsley
Quoted 2 lines · Benoit

Please take care of changing the hwmod main_clk as well. But maybe that's not part of that series.

It's not part of the series yet.

Vaibhav, could you take care of changing the main_clk in your hwmod data patches, and send those to the list?

Paul,

Just an update on the status,

I used your cleaned version of clocktree data, where you have removed all leaf-nodes and merged multiple clocks nodes into one; but it did not work. I attempted to review the cleanup and tried to debug, but found it bit hard to come back to working clocktree from stripped version. So moved back to my submitted clocktree and started stripping the clock leaf-nodes, same way you had done it. Now I reached to the stage where I have working clocktree without peripheral leaf-nodes and booting on BeagleBone.

I will start working on migrating to common clock framework now, and hoping to finish it soon.

Just FYI (may need your help), I got into some issues (still open) during this cleanup -

1. In cases where we have clock selection option for node-leafs, like, Timers, I removed enable_reg entry from the node, which results into a kernel error message from function omap2_dflt_clk_disable()

clock: clk_disable called on independent clock %s which has no enable_reg

2. clkdm_name entry:
The issue is, two entries available for clockdomain associated for module/clock
- hwmod_data.main_clk and
- clk.clkdm_name

They must match, right? The parent/root clocks flows from one domain to another domain, so I have to keep the nodes just for sake of matching clockdomain entry present in associated main_clk data.

I am still reviewing the code from Rajendra, but one of Rajendra's patch actually will help here, made it to use hwmod_data.clkdm (if available) always, instead of directly using clk.clkdm.

3. If I understand correctly, hwmod_data.main_clk is functional clock and hwmod_ocp_if.clk is interface clock, right?

So currently, I have mentioned same entry in both the places (especially for Peripherals/modules).
I am planning to remove ocp_if/clk entry data for all modules..

Thanks,
Vaibhav

maintainer
#28 lore raw

PATCH v3 3/3 ARM: OMAP3+: clock33xx: Add AM33XX clock tree data

Hi Vaibhav

Quoted 7 lines · Vaibhav

I used your cleaned version of clocktree data, where you have removed all leaf-nodes and merged multiple clocks nodes into one; but it did not work. I attempted to review the cleanup and tried to debug, but found it bit hard to come back to working clocktree from stripped version. So moved back to my submitted clocktree and started stripping the clock leaf-nodes, same way you had done it. Now I reached to the stage where I have working clocktree without peripheral leaf-nodes and booting on BeagleBone.

Okay great, please post that to the list so we can diff it against the version that I did, and also so we can queue it for merging in 3.6?

Quoted 8 lines

Just FYI (may need your help), I got into some issues (still open) during this cleanup -

1. In cases where we have clock selection option for node-leafs, like, Timers, I removed enable_reg entry from the node, which results into a kernel error message from function omap2_dflt_clk_disable()

clock: clk_disable called on independent clock %s which has no enable_reg

Shouldn't those clocks use clkops_null then?

Quoted 6 lines

2. clkdm_name entry:
The issue is, two entries available for clockdomain associated for module/clock
- hwmod_data.main_clk and
- clk.clkdm_name

Quoted 7 lines

They must match, right? The parent/root clocks flows from one domain to another domain, so I have to keep the nodes just for sake of matching clockdomain entry present in associated main_clk data.

I am still reviewing the code from Rajendra, but one of Rajendra's patch actually will help here, made it to use hwmod_data.clkdm (if available) always, instead of directly using clk.clkdm.

Well because of this CLKDIV32K snafu, we'll need to keep the clock framework-based clockdomain control for AM33xx, at the very least for the CLKDIV32K clock.

I'd suggest starting with specifying a clockdomain name for each clock. If nothing else, this should help think through the power management behavior for each clock. Then those can be easily removed later with a simple grep.

Quoted 2 lines

3. If I understand correctly, hwmod_data.main_clk is functional clock and hwmod_ocp_if.clk is interface clock, right?

Basically, yes. To be more precise, in cases where
modules have multiple functional clocks, hwmod_data.main_clk is the functional clock that is needed in order for register reads and writes to the IP block to succeed.

Quoted 3 lines

So currently, I have mentioned same entry in both the places (especially for Peripherals/modules).
I am planning to remove ocp_if/clk entry data for all modules..

Hmmm, could you explain this further?

Every ocp_if structure that you create should have an interface clock specified. And almost all of your hwmods should have a main_clk specified.

- Paul

#29 lore raw

PATCH v3 3/3 ARM: OMAP3+: clock33xx: Add AM33XX clock tree data

Quoted 12 lines · Paul Walmsley

Hi Vaibhav

Quoted 7 lines · Vaibhav

I used your cleaned version of clocktree data, where you have removed all leaf-nodes and merged multiple clocks nodes into one; but it did not work. I attempted to review the cleanup and tried to debug, but found it bit hard to come back to working clocktree from stripped version. So moved back to my submitted clocktree and started stripping the clock leaf-nodes, same way you had done it. Now I reached to the stage where I have working clocktree without peripheral leaf-nodes and booting on BeagleBone.

Quoted 3 lines

Okay great, please post that to the list so we can diff it against the version that I did, and also so we can queue it for merging in 3.6?

Just doing final round of review and cleanup...may be by tomorrow, I should be able to submit it (without common-clock framework).

Quoted 34 lines
Quoted 8 lines

Just FYI (may need your help), I got into some issues (still open) during this cleanup -

1. In cases where we have clock selection option for node-leafs, like, Timers, I removed enable_reg entry from the node, which results into a kernel error message from function omap2_dflt_clk_disable()

clock: clk_disable called on independent clock %s which has no enable_reg

Shouldn't those clocks use clkops_null then?

Quoted 6 lines

2. clkdm_name entry:
The issue is, two entries available for clockdomain associated for module/clock
- hwmod_data.main_clk and
- clk.clkdm_name

Quoted 7 lines

They must match, right? The parent/root clocks flows from one domain to another domain, so I have to keep the nodes just for sake of matching clockdomain entry present in associated main_clk data.

I am still reviewing the code from Rajendra, but one of Rajendra's patch actually will help here, made it to use hwmod_data.clkdm (if available) always, instead of directly using clk.clkdm.

Well because of this CLKDIV32K snafu, we'll need to keep the clock framework-based clockdomain control for AM33xx, at the very least for the CLKDIV32K clock.

I'd suggest starting with specifying a clockdomain name for each clock. If nothing else, this should help think through the power management behavior for each clock. Then those can be easily removed later with a simple grep.

Quoted 8 lines
Quoted 2 lines

3. If I understand correctly, hwmod_data.main_clk is functional clock and hwmod_ocp_if.clk is interface clock, right?

Basically, yes. To be more precise, in cases where
modules have multiple functional clocks, hwmod_data.main_clk is the functional clock that is needed in order for register reads and writes to the IP block to succeed.

I believe register read/write to IP block is depends on only interface Clocks? Atleast in case of OMAP3, it was like that, right??

Another issues is,

I came across situation where, two modules fall into different clock domains but their functional clock is happened to be coming from same source/dpll-divider. So in order to satisfy clkdm match between them, I have kept nodes without enable_regs.

Quoted 6 lines
Quoted 3 lines

So currently, I have mentioned same entry in both the places (especially for Peripherals/modules).
I am planning to remove ocp_if/clk entry data for all modules..

Hmmm, could you explain this further?

what if, module only has interface clock? Should it be present as main_clk or ocp_if.clk or both?? Example would be, TPCC, TPTC, smartreflex, etc...

Thanks,
Vaibhav

Quoted 7 lines

Every ocp_if structure that you create should have an interface clock specified. And almost all of your hwmods should have a main_clk specified.

- Paul

maintainer
#30 lore raw

PATCH v3 3/3 ARM: OMAP3+: clock33xx: Add AM33XX clock tree data

Hi

Quoted 2 lines · Vaibhav

I believe register read/write to IP block is depends on only interface Clocks? Atleast in case of OMAP3, it was like that, right??

No, on OMAP3, most modules need both the interface clock enabled, and at least one of their functional clocks. For modules with multiple functional clocks like the OMAP3 USBHOST, we had to use trial and error to determine which functional clock was the main clock, since it wasn't documented. If we got it wrong, then register accesses to the module would result in an abort.

The AM33xx/OMAP4 behavior should be a little easier in this regard, though, since the MODULEMODE bits should just control everything for a given module, and that should be handled by the hwmod code. Nevertheless it is still good to specify a main_clk so we know how fast the module's registers are clocked and to locate the module in the power management hierarchy.

Quoted 6 lines

Another issues is,

I came across situation where, two modules fall into different clock domains but their functional clock is happened to be coming from same source/dpll-divider. So in order to satisfy clkdm match between them, I have kept nodes without enable_regs.

Could you please provide an example?

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

So currently, I have mentioned same entry in both the places (especially for Peripherals/modules).
I am planning to remove ocp_if/clk entry data for all modules..

Hmmm, could you explain this further?

what if, module only has interface clock? Should it be present as main_clk or ocp_if.clk or both?? Example would be, TPCC, TPTC, smartreflex, etc...

Well it definitely should be present as the ocp_if.clk. I personally think it would be good to list the same clock as the hwmod's main_clk too, but it's currently not strictly necessary. There are some examples in the omap_hwmod_44xx_data.c file, like omap44xx_mailbox_hwmod.

- Paul

#31 lore raw

PATCH v3 3/3 ARM: OMAP3+: clock33xx: Add AM33XX clock tree data

Quoted 7 lines · Paul Walmsley

Hi

Quoted 2 lines · Vaibhav

I believe register read/write to IP block is depends on only interface Clocks? Atleast in case of OMAP3, it was like that, right??

Quoted 7 lines

No, on OMAP3, most modules need both the interface clock enabled, and at least one of their functional clocks. For modules with multiple functional clocks like the OMAP3 USBHOST, we had to use trial and error to determine which functional clock was the main clock, since it wasn't documented. If we got it wrong, then register accesses to the module would result in an abort.

Ok, thanks for the clarification.

Quoted 7 lines

The AM33xx/OMAP4 behavior should be a little easier in this regard, though, since the MODULEMODE bits should just control everything for a given module, and that should be handled by the hwmod code. Nevertheless it is still good to specify a main_clk so we know how fast the module's registers are clocked and to locate the module in the power management hierarchy.

Quoted 9 lines
Quoted 6 lines

Another issues is,

I came across situation where, two modules fall into different clock domains but their functional clock is happened to be coming from same source/dpll-divider. So in order to satisfy clkdm match between them, I have kept nodes without enable_regs.

Could you please provide an example?

In case of AM33xx, clock architecture is,

sysclk1 -> L4_wakeup - wakeup domain modules

sysclk1 -> L4 HS - L4 HS domain modules

sysclk1 -> L4 LS - L4 LS domain modules

and so on...

Now with leaf node cleanup, we are moving upward in the clocktree, more close to dpll output, and is the issue related to clockdomain.

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

So currently, I have mentioned same entry in both the places (especially for Peripherals/modules).
I am planning to remove ocp_if/clk entry data for all modules..

Hmmm, could you explain this further?

Quoted 10 lines
Quoted 3 lines

what if, module only has interface clock? Should it be present as main_clk or ocp_if.clk or both?? Example would be, TPCC, TPTC, smartreflex, etc...

Well it definitely should be present as the ocp_if.clk. I personally think it would be good to list the same clock as the hwmod's main_clk too, but it's currently not strictly necessary. There are some examples in the omap_hwmod_44xx_data.c file, like omap44xx_mailbox_hwmod.

omap44xx_mailbox_hwmod doesn't have main_clk exported in the hwmod_data, so I think I should also follow same thing, right?

The cleaned clocktree (without common-clock fw) and hwmod code is ready, I just need to rebase against Kevin's hwmod cpu_is_xxx cleanup series (was pending in last version). This shouldn't impact anything to above clocktree and hwmod patch.

You can access the code at -
https://github.com/hvaibhav/am335x-linux am335x-upstream-staging

Thanks,
Vaibhav

maintainer
#32 lore raw

PATCH v3 3/3 ARM: OMAP3+: clock33xx: Add AM33XX clock tree data

Quoted 16 lines · Vaibhav
Quoted 8 lines · Paul Walmsley
Quoted 4 lines · Vaibhav

I came across situation where, two modules fall into different clock domains but their functional clock is happened to be coming from same source/dpll-divider. So in order to satisfy clkdm match between them, I have kept nodes without enable_regs.

Could you please provide an example?

In case of AM33xx, clock architecture is,

sysclk1 -> L4_wakeup - wakeup domain modules

sysclk1 -> L4 HS - L4 HS domain modules

Quoted 7 lines

sysclk1 -> L4 LS - L4 LS domain modules

and so on...

Now with leaf node cleanup, we are moving upward in the clocktree, more close to dpll output, and is the issue related to clockdomain.

I don't really understand. Perhaps you could provide an example from one of the modules?

Are you saying that you have a module that should be in a different clockdomain than the clockdomain of the module's main functional clock?

Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

So currently, I have mentioned same entry in both the places (especially for Peripherals/modules).
I am planning to remove ocp_if/clk entry data for all modules..

Hmmm, could you explain this further?

what if, module only has interface clock? Should it be present as main_clk or ocp_if.clk or both?? Example would be, TPCC, TPTC, smartreflex, etc...

Quoted 7 lines
Quoted 4 lines

Well it definitely should be present as the ocp_if.clk. I personally think it would be good to list the same clock as the hwmod's main_clk too, but it's currently not strictly necessary. There are some examples in the omap_hwmod_44xx_data.c file, like omap44xx_mailbox_hwmod.

omap44xx_mailbox_hwmod doesn't have main_clk exported in the hwmod_data, so I think I should also follow same thing, right?

Well please start with specifying the main_clk for all IP blocks. It is potentially ambiguous not to specify it, so unless there is some problem with specifying it, I'd prefer to have them.

Quoted 2 lines

You can access the code at -
https://github.com/hvaibhav/am335x-linux am335x-upstream-staging

I'll wait until it's posted to the lists.

- Paul

maintainer
#33 lore raw

PATCH v3 3/3 ARM: OMAP3+: clock33xx: Add AM33XX clock tree data

In reply to Vaibhav Hiremath

Hi,

arch/arm/mach-omap2/clock33xx_data.c line 724

Quoted 12 lines
arch/arm/mach-omap2/clock33xx_data.c new file +12 -0
+/*
+ * clkdiv32 is generated from fixed division of 732.4219
+ */
+static struct clk clkdiv32k_ick = {
+	.name		= "clkdiv32k_ick",
+	.clkdm_name	= "clk_24mhz_clkdm",
+	.rate		= 32768,
+	.parent		= &clk_24mhz,
+	.enable_reg	= AM33XX_CM_PER_CLKDIV32K_CLKCTRL,
+	.enable_bit	= AM33XX_MODULEMODE_SWCTRL,
+	.ops		= &clkops_omap2_dflt,
+};

While working on this file, this clock seemed quite perplexing. Perhaps you might be able to answer some questions about it.

- The fractional fixed division seems a little bogus. Is this actually an M,N counter? A few moments with PARI revealed a likely M,N of 64,46875. Could you please confirm that this is the case for this clock?

- This clock structure makes this clock appear to be a fixed-frequency clock. But according to SPRUH73D Figure 8-10 "Peripheral PLL Structure", the divider feeding this clock can be switched between an M,N of 64,46875 and 32,46875 depending on the value of CONTROL_CLK32K_DIVRATIO_CTRL. So shouldn't we implement that?

- This clock is feeding downstream clocks, but it's using the MODULEMODE control interface, as if it were a standalone IP block. Do you know why it's using the MODULEMODE control method rather than some optional clock control bits, like OMAP4 does?

- Paul

#34 lore raw

PATCH v3 3/3 ARM: OMAP3+: clock33xx: Add AM33XX clock tree data

Quoted 22 lines · Paul Walmsley

Hi,

arch/arm/mach-omap2/clock33xx_data.c line 724

Quoted 12 lines
arch/arm/mach-omap2/clock33xx_data.c new file +12 -0
+/*
+ * clkdiv32 is generated from fixed division of 732.4219
+ */
+static struct clk clkdiv32k_ick = {
+	.name		= "clkdiv32k_ick",
+	.clkdm_name	= "clk_24mhz_clkdm",
+	.rate		= 32768,
+	.parent		= &clk_24mhz,
+	.enable_reg	= AM33XX_CM_PER_CLKDIV32K_CLKCTRL,
+	.enable_bit	= AM33XX_MODULEMODE_SWCTRL,
+	.ops		= &clkops_omap2_dflt,
+};

While working on this file, this clock seemed quite perplexing. Perhaps you might be able to answer some questions about it.

- The fractional fixed division seems a little bogus. Is this actually an M,N counter? A few moments with PARI revealed a likely M,N of 64,46875. Could you please confirm that this is the case for this clock?

Quoted 6 lines

- This clock structure makes this clock appear to be a fixed-frequency clock. But according to SPRUH73D Figure 8-10 "Peripheral PLL Structure", the divider feeding this clock can be switched between an M,N of 64,46875 and 32,46875 depending on the value of CONTROL_CLK32K_DIVRATIO_CTRL. So shouldn't we implement that?

Unfortunately, this is fractional divider, assuming input clock of 24MHz.

24MHz / 732.4219 = 32KHz (Normal OPP100)
24MHz / 366.2109 = 32KHz (OPP50)

The register control CONTROL_CLK32K_DIVRATIO_CTRL is provided to choose between these two dividers.

As per the Spec, we have some known HW/Si issues to run whole system at OPP50, that's where if you refer to the TRM Table 8-22. Per PLL Typical Frequencies (MHz), it only talks about OPP100, which is 732.4219 divider.

So, technically, if both OPP's (OPP100 and OPP50) works fine, then yes, we should handle it. But given the fact that, OPP50 is not fully functional due to HW/Si issues, from CORE and PER perspective we will always stay at OPP100.

To summarize, I had to make it fixed-frequency due to,

- Fractional divisor value.
- We will always stay at OPP100 in any case, making this divisor constant always.

Quoted 5 lines

- This clock is feeding downstream clocks, but it's using the MODULEMODE control interface, as if it were a standalone IP block. Do you know why it's using the MODULEMODE control method rather than some optional clock control bits, like OMAP4 does?

Yes, this clock is feeding to timers, gpio debounce clocks, etc... Honestly, I do not know the answer to why part of it. (May be another integration/design issue)

Thanks,
Vaibhav

Quoted 3 lines

- Paul

maintainer
#35 lore raw

PATCH v3 3/3 ARM: OMAP3+: clock33xx: Add AM33XX clock tree data

Quoted 4 lines · Vaibhav

Unfortunately, this is fractional divider, assuming input clock of 24MHz.

24MHz / 732.4219 = 32KHz (Normal OPP100)
24MHz / 366.2109 = 32KHz (OPP50)

Yes, I already saw that in the TRM. The question is, how is the fractional divider implemented in the hardware? Is it implemented as an M,N counter? It's rather unlikely to be dividing by 732.4219 directly -- in fact that value isn't even accurate.

Quoted 7 lines

As per the Spec, we have some known HW/Si issues to run whole system at OPP50, that's where if you refer to the TRM Table 8-22. Per PLL Typical Frequencies (MHz), it only talks about OPP100, which is 732.4219 divider.

So, technically, if both OPP's (OPP100 and OPP50) works fine, then yes, we should handle it. But given the fact that, OPP50 is not fully functional due to HW/Si issues, from CORE and PER perspective we will always stay at OPP100.

I see.

Quoted 3 lines

To summarize, I had to make it fixed-frequency due to,

- Fractional divisor value.

This could be implemented as an M,N counter, unless the hardware is doing something more unusual.

Quoted 8 lines
Quoted 4 lines

- This clock is feeding downstream clocks, but it's using the MODULEMODE control interface, as if it were a standalone IP block. Do you know why it's using the MODULEMODE control method rather than some optional clock control bits, like OMAP4 does?

Yes, this clock is feeding to timers, gpio debounce clocks, etc... Honestly, I do not know the answer to why part of it. (May be another integration/design issue)

Could you please check with the AM335x PRCM designers about this to find out what that MODULEMODE bit is actually doing (i.e., is it actually enabling the clock, and if so, why did they not use the OPTFCLKEN bits) ? The AM335x TRM has almost no documentation on what those MODULEMODE bits are doing in this case.

We're trying to remove all of these MODULEMODE clocks from the clock framework, and also remove the accompanying clockdomain control sequence from the clock code. But now it's looking like it may be impossible due to this "clock," which means we'll need to keep that code around, which is unfortunate.

- Paul

#36 lore raw

PATCH v3 3/3 ARM: OMAP3+: clock33xx: Add AM33XX clock tree data

Quoted 4 lines · Paul Walmsley
Quoted 2 lines · Vaibhav

Unfortunately, this is fractional divider, assuming input clock of 24MHz.

Quoted 8 lines
Quoted 2 lines

24MHz / 732.4219 = 32KHz (Normal OPP100)
24MHz / 366.2109 = 32KHz (OPP50)

Yes, I already saw that in the TRM. The question is, how is the fractional divider implemented in the hardware? Is it implemented as an M,N counter? It's rather unlikely to be dividing by 732.4219 directly -- in fact that value isn't even accurate.

Not sure how it is implemented in HW, in any case we do not have control over it. The control is only provided using,
- MODULEMODE (module enable/disable)
- CONTROL_CLK32K_DIVRATIO_CTRL (divisor selection)

Quoted 26 lines
Quoted 7 lines

As per the Spec, we have some known HW/Si issues to run whole system at OPP50, that's where if you refer to the TRM Table 8-22. Per PLL Typical Frequencies (MHz), it only talks about OPP100, which is 732.4219 divider.

So, technically, if both OPP's (OPP100 and OPP50) works fine, then yes, we should handle it. But given the fact that, OPP50 is not fully functional due to HW/Si issues, from CORE and PER perspective we will always stay at OPP100.

I see.

Quoted 3 lines

To summarize, I had to make it fixed-frequency due to,

- Fractional divisor value.

This could be implemented as an M,N counter, unless the hardware is doing something more unusual.

Quoted 8 lines
Quoted 4 lines

- This clock is feeding downstream clocks, but it's using the MODULEMODE control interface, as if it were a standalone IP block. Do you know why it's using the MODULEMODE control method rather than some optional clock control bits, like OMAP4 does?

Yes, this clock is feeding to timers, gpio debounce clocks, etc... Honestly, I do not know the answer to why part of it. (May be another integration/design issue)

Quoted 6 lines

Could you please check with the AM335x PRCM designers about this to find out what that MODULEMODE bit is actually doing (i.e., is it actually enabling the clock, and if so, why did they not use the OPTFCLKEN bits) ? The AM335x TRM has almost no documentation on what those MODULEMODE bits are doing in this case.

I can check, I am certain that, the answer would be to consider this as a separate independent module. And same as other modules, control is provided to the SW.

Quoted 6 lines

We're trying to remove all of these MODULEMODE clocks from the clock framework, and also remove the accompanying clockdomain control sequence from the clock code. But now it's looking like it may be impossible due to this "clock," which means we'll need to keep that code around, which is unfortunate.

I think we have to live with it.

Thanks,
Vaibhav

Quoted 3 lines

- Paul

maintainer
#37 lore raw

PATCH v3 3/3 ARM: OMAP3+: clock33xx: Add AM33XX clock tree data

Quoted 13 lines · Vaibhav
Quoted 11 lines · Paul Walmsley
Quoted 4 lines · Vaibhav

Unfortunately, this is fractional divider, assuming input clock of 24MHz.

24MHz / 732.4219 = 32KHz (Normal OPP100)
24MHz / 366.2109 = 32KHz (OPP50)

Yes, I already saw that in the TRM. The question is, how is the fractional divider implemented in the hardware? Is it implemented as an M,N counter? It's rather unlikely to be dividing by 732.4219 directly -- in fact that value isn't even accurate.

Quoted 4 lines

Not sure how it is implemented in HW, in any case we do not have control over it. The control is only provided using,
- MODULEMODE (module enable/disable)
- CONTROL_CLK32K_DIVRATIO_CTRL (divisor selection)

Right, but the goal is to make the clock tree rate computation independent of the assumptions of the OPP settings.

So placing a fixed clock rate -- one that supposedly does not depend on a parent rate -- in the middle of a clock tree is something we wish to avoid, if possible. It is a hack. Especially considering that the clock's input rate does appear to depend on its parent's rate.

So, could you please double-check to find out if the appropriate abstraction is as an M,N counter? If the public forum is an issue, then if you prefer, you can E-mail me privately with the results.

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 4 lines

- This clock is feeding downstream clocks, but it's using the MODULEMODE control interface, as if it were a standalone IP block. Do you know why it's using the MODULEMODE control method rather than some optional clock control bits, like OMAP4 does?

Yes, this clock is feeding to timers, gpio debounce clocks, etc... Honestly, I do not know the answer to why part of it. (May be another integration/design issue)

Quoted 8 lines
Quoted 5 lines

Could you please check with the AM335x PRCM designers about this to find out what that MODULEMODE bit is actually doing (i.e., is it actually enabling the clock, and if so, why did they not use the OPTFCLKEN bits) ? The AM335x TRM has almost no documentation on what those MODULEMODE bits are doing in this case.

I can check, I am certain that, the answer would be to consider this as a separate independent module.

Yes, please check with the hardware team. The questions would be:

- What does changing the CLKDIV32K_CLKCTRL.MODULEMODE bits do?

- Is it necessary for the MODULEMODE bits to be set to 2 (ENABLE) to generate a clock to the clock nodes downstream of CLKDIV32K, or does the MODULEMODE just affect some other register access by the MPU?

- Will setting the CLKDIV32K_CLKCTRL.MODULEMODE bits to 0 disable the clock from being provided to downstream nodes of the CLKDIV32K, or does it simply affect register access?

- Is it necessary to follow the clockdomain enable sequence before enabling the CLKDIV32K MODULEMODE?

- What clockdomain does the CLKDIV32K module belong to?

Quoted 1 line

And same as other modules, control is provided to the SW.

The problem is that CLKDIV32K does not appear to be a distinct, leaf IP block from a clocking perspective, unlike the other uses of the *_CLKCTRL.MODULEMODE bits in the AM335x and OMAP4 clock trees. So something is very unusual here.

If one of our core framework assumptions for OMAP4+ devices is incorrect, it would be useful for us to know as soon as possible, to avoid churn and broken code.

- Paul

maintainer
#38 lore raw

PATCH v3 3/3 ARM: OMAP3+: clock33xx: Add AM33XX clock tree data

In reply to Vaibhav Hiremath

Hi Vaibhav, Afzal, Vaibhav,

while working on clock33xx_data.c, it became clear that we would not be able to remove the MODULEMODE leaf clocks for several IP blocks that share driver code with other DaVinci chips. This is because:

1. the drivers for these IP blocks only use the clock framework, rather than runtime PM;

and

2. the clk_get() calls in those drivers do not specify a con_id parameter, which could cause problems with the clkdev clk_find()'s fuzzy matching algorithm.

So perhaps your group can work on converting the drivers to use runtime PM? Discussing this with Kevin, it sounds like DaVinci doesn't have runtime PM hooks implemented, but you can probably use OMAP1 as an example of how to do it.

And then if clk_get() is still needed in the drivers, a specific con_id should be supplied, such as "fck", which can also be supplied by the OMAP codebase.

- Paul

#39 lore raw

PATCH v3 3/3 ARM: OMAP3+: clock33xx: Add AM33XX clock tree data

Quoted 16 lines · Paul Walmsley

Hi Vaibhav, Afzal, Vaibhav,

while working on clock33xx_data.c, it became clear that we would not be able to remove the MODULEMODE leaf clocks for several IP blocks that share driver code with other DaVinci chips. This is because:

1. the drivers for these IP blocks only use the clock framework, rather than runtime PM;

and

2. the clk_get() calls in those drivers do not specify a con_id parameter, which could cause problems with the clkdev clk_find()'s fuzzy matching algorithm.

Quoted 10 lines

So perhaps your group can work on converting the drivers to use runtime PM? Discussing this with Kevin, it sounds like DaVinci doesn't have runtime PM hooks implemented, but you can probably use OMAP1 as an example of how to do it.

And then if clk_get() is still needed in the drivers, a specific con_id should be supplied, such as "fck", which can also be supplied by the OMAP codebase.

Honestly, I don't want to block AM33xx stuff getting into mainline due to missing feature in Davinci.

Also, since AM33xx is not fully supported in the mainline (from peripheral perspective), it really should not break anything as of now.

I am expecting, AM33xx core patches will get in by v3.5 and then while adding peripheral support we will take Davinci migration activity, and can make sure that nothing breaks (for all Davinci, OMAP and AM33xx).

Thanks,
Vaibhav

maintainer
#40 lore raw

PATCH v3 3/3 ARM: OMAP3+: clock33xx: Add AM33XX clock tree data

Quoted 27 lines · Vaibhav
Quoted 14 lines · Paul Walmsley

while working on clock33xx_data.c, it became clear that we would not be able to remove the MODULEMODE leaf clocks for several IP blocks that share driver code with other DaVinci chips. This is because:

1. the drivers for these IP blocks only use the clock framework, rather than runtime PM;

and

2. the clk_get() calls in those drivers do not specify a con_id parameter, which could cause problems with the clkdev clk_find()'s fuzzy matching algorithm.

Quoted 8 lines

So perhaps your group can work on converting the drivers to use runtime PM? Discussing this with Kevin, it sounds like DaVinci doesn't have runtime PM hooks implemented, but you can probably use OMAP1 as an example of how to do it.

And then if clk_get() is still needed in the drivers, a specific con_id should be supplied, such as "fck", which can also be supplied by the OMAP codebase.

Honestly, I don't want to block AM33xx stuff getting into mainline due to missing feature in Davinci.

Quoted 6 lines

Also, since AM33xx is not fully supported in the mainline (from peripheral perspective), it really should not break anything as of now.

I am expecting, AM33xx core patches will get in by v3.5 and then while adding peripheral support we will take Davinci migration activity, and can make sure that nothing breaks (for all Davinci, OMAP and AM33xx).

To be clear, I am not suggesting that the AM33xx stuff should be blocked by these changes. I am however suggesting that it be added to the to-do list, so we can remove most or all of the remaining MODULEMODE clocks from the AM33xx clock tree. Sounds like you are planning to work on that at some point, which is good.

- Paul

maintainer
#41 lore raw

PATCH v3 3/3 ARM: OMAP3+: clock33xx: Add AM33XX clock tree data

In reply to Vaibhav Hiremath

Hello Vaibhav,

looking at Table 1-1 "Device Features" of SPRUH73D, it seems that some AM33xx family chips come with some features disabled, such as the PRU-ICSS, the SGX, Ethernet, or USB. How will this affect the clock tree? For example, is it correct for us to include the PRU-ICSS clock control on a clock tree that is booted on an AM3352 or an AM3354?

- Paul

#42 lore raw

PATCH v3 3/3 ARM: OMAP3+: clock33xx: Add AM33XX clock tree data

Quoted 9 lines · Paul Walmsley

Hello Vaibhav,

looking at Table 1-1 "Device Features" of SPRUH73D, it seems that some AM33xx family chips come with some features disabled, such as the PRU-ICSS, the SGX, Ethernet, or USB. How will this affect the clock tree? For example, is it correct for us to include the PRU-ICSS clock control on a clock tree that is booted on an AM3352 or an AM3354?

I thought of this, but if you look at the existing way of handling such Si version based clock registration is supported by "cpu_clkflg", like CK_3XXX, CK_AM35XX, etc...

During my baseport patch submission, Tony had removed CK_AM33XX flag while merging them. I believe, we are trying to get rid of these flags, and that's where Tony had removed them form my baseport patch.
I was not sure on how to handle this, so I decided to continue with full chip support (AM3358 and AM3359).

Thanks,
Vaibhav

maintainer
#43 lore raw

PATCH v3 3/3 ARM: OMAP3+: clock33xx: Add AM33XX clock tree data

Quoted 11 lines · Vaibhav
Quoted 5 lines · Paul Walmsley

looking at Table 1-1 "Device Features" of SPRUH73D, it seems that some AM33xx family chips come with some features disabled, such as the PRU-ICSS, the SGX, Ethernet, or USB. How will this affect the clock tree? For example, is it correct for us to include the PRU-ICSS clock control on a clock tree that is booted on an AM3352 or an AM3354?

I thought of this, but if you look at the existing way of handling such Si version based clock registration is supported by "cpu_clkflg", like CK_3XXX, CK_AM35XX, etc...

Quoted 5 lines

During my baseport patch submission, Tony had removed CK_AM33XX flag while merging them. I believe, we are trying to get rid of these flags, and that's where Tony had removed them form my baseport patch.
I was not sure on how to handle this, so I decided to continue with full chip support (AM3358 and AM3359).

Okay, no problem. Sounds like we should start with full support and then remove clocks later if they cause problems on the lower-end devices.

- Paul

#44 lore raw

PATCH v3 3/3 ARM: OMAP3+: clock33xx: Add AM33XX clock tree data

Quoted 13 lines · Paul Walmsley
Quoted 11 lines · Vaibhav
Quoted 5 lines · Paul Walmsley

looking at Table 1-1 "Device Features" of SPRUH73D, it seems that some AM33xx family chips come with some features disabled, such as the PRU-ICSS, the SGX, Ethernet, or USB. How will this affect the clock tree? For example, is it correct for us to include the PRU-ICSS clock control on a clock tree that is booted on an AM3352 or an AM3354?

I thought of this, but if you look at the existing way of handling such Si version based clock registration is supported by "cpu_clkflg", like CK_3XXX, CK_AM35XX, etc...

Quoted 10 lines
Quoted 5 lines

During my baseport patch submission, Tony had removed CK_AM33XX flag while merging them. I believe, we are trying to get rid of these flags, and that's where Tony had removed them form my baseport patch.
I was not sure on how to handle this, so I decided to continue with full chip support (AM3358 and AM3359).

Okay, no problem. Sounds like we should start with full support and then remove clocks later if they cause problems on the lower-end devices.

That's my plan too.

Thanks,
Vaibhav