ARM: Add Cross Trigger Interface driver
Subsystems (6)
cover ARM: Add Cross Trigger Interface driver
Adds AMBA driver for ARM Coresight Cross Trigger Interface (CTI) driver and device-tree binding for CTI module.
I have tested the driver on an OMAP4430 device and include the relevant patches needed to enable CTI on OMAP4 devices for reference.
I would like to get some feedback on the binding, CTI APIs and usage of the APB clock for OMAP4. I have seen that there has been some recent discussion around adding other coresight drivers for ARM devices [1] and so it would be also good to align on the appropriate location for coresight drivers in general.
This series is based on the ARM-SOC for-next branch and Will Deacon's patch for the CTI lock registers [2].
[1] http://article.gmane.org/gmane.linux.ports.arm.kernel/204591/match=coresight+bus
[2] http://article.gmane.org/gmane.linux.ports.arm.kernel/200199/match=fix+manipulation+debug+lock+register
Jon Hunter (5):
ARM: CORESIGHT: Add generic lock/unlock helpers
ARM: dts: Add Cross Trigger Interface binding
ARM: CTI: Convert CTI helpers to AMBA bus driver
ARM: dts: OMAP4: Add CTI nodes
ARM: OMAP4: Add AMBA APB Clock
Documentation/devicetree/bindings/arm/cti.txt | 32 +++ arch/arm/boot/dts/omap4.dtsi | 23 ++ arch/arm/include/asm/cti.h | 163 -------------- arch/arm/include/asm/hardware/coresight.h | 16 +- arch/arm/mach-omap2/cclock44xx_data.c | 1 + drivers/Kconfig | 2 + drivers/amba/Kconfig | 20 ++ drivers/amba/Makefile | 1 + drivers/amba/cti.c | 284 +++++++++++++++++++++++++ include/linux/amba/cti.h | 82 +++++++ 10 files changed, 453 insertions(+), 171 deletions(-) create mode 100644 Documentation/devicetree/bindings/arm/cti.txt delete mode 100644 arch/arm/include/asm/cti.h create mode 100644 drivers/amba/Kconfig create mode 100644 drivers/amba/cti.c create mode 100644 include/linux/amba/cti.h
Signature · 1 line
1.7.10.4
RFC 1/5 ARM: CORESIGHT: Add generic lock/unlock helpers
The Cross Trigger Interface (CTI) helpers in cti.h include definitions for the Coresight Lock Access Register (LAR) and Lock Status Register (LSR). These registers are already defined in coresight.h and so rather than having multiple definitions, just use the definitions from coresight.h.
Add the following coresight macros ...
- coresight_unlock() --> Unlocks coresight module
- coresight_lock() --> Locks coresight module
Use the above macros for ETB, ETM and CTI. The do-while(0) statement has been removed from the macro as it is not a multi-line macro.
--- arch/arm/include/asm/cti.h | 16 +++------------- arch/arm/include/asm/hardware/coresight.h | 16 ++++++++-------- 2 files changed, 11 insertions(+), 21 deletions(-)
arch/arm/include/asm/cti.h +3 -13
@@ -2,6 +2,7 @@#define __ASMARM_CTI_H#include <asm/io.h> +#include <asm/hardware/coresight.h> /* The registers' definition is from section 3.2 of * Embedded Cross Trigger Revision: r0p0
@@ -29,17 +30,6 @@#define CTIPCELLID2 0xFF8#define CTIPCELLID3 0xFFC -/* The below are from section 3.6.4 of -* CoreSight v1.0 Architecture Specification -*/ -#define LOCKACCESS 0xFB0 -#define LOCKSTATUS 0xFB4 - -/* write this value to LOCKACCESS will unlock the module, and -* other value will lock the module -*/ -#define LOCKCODE 0xC5ACCE55 -/** * struct cti - cross trigger interface struct * @base: mapped virtual address for the cti base
@@ -146,7 +136,7 @@ static inline void cti_irq_ack(struct cti *cti)*/ static inline void cti_unlock (struct cti *cti) { -__raw_writel (LOCKCODE , cti->base +LOCKACCESS ); +coresight_unlock (cti->base); }/**
@@ -158,6 +148,6 @@ static inline void cti_unlock(struct cti *cti)*/ static inline void cti_lock (struct cti *cti) { -__raw_writel (~LOCKCODE , cti->base +LOCKACCESS ); +coresight_lock (cti->base); }#endif
arch/arm/include/asm/hardware/coresight.h +8 -8
@@ -141,17 +141,17 @@#define ETBFF_TRIGEVT BIT(9)#define ETBFF_TRIGFL BIT(10) -#define etb_writel (t, v, x) \ - (__raw_writel((v), (t)->etb_regs + (x))) +#define etb_writel (t, v, x) (__raw_writel((v), (t)->etb_regs + (x)))#define etb_readl (t, x) (__raw_readl((t)->etb_regs + (x))) -#define etm_lock (t) do { etm_writel((t), 0, CSMR_LOCKACCESS); } while (0) -#define etm_unlock (t) \ - do { etm_writel((t), UNLOCK_MAGIC, CSMR_LOCKACCESS); } while (0) +#define etb_lock (t) coresight_lock((t)->etb_regs) +#define etb_unlock (t) coresight_unlock((t)->etb_regs) +#define etm_lock (t) coresight_lock((t)->etm_regs) +#define etm_unlock (t) coresight_unlock((t)->etm_regs) -#define etb_lock (t) do { etb_writel((t), 0, CSMR_LOCKACCESS); } while (0) -#define etb_unlock (t) \ - do { etb_writel((t), UNLOCK_MAGIC, CSMR_LOCKACCESS); } while (0) +#define coresight_lock (base) (__raw_writel(0, base + CSMR_LOCKACCESS)) +#define coresight_unlock (base) \ + (__raw_writel(UNLOCK_MAGIC, base + CSMR_LOCKACCESS))#endif /* __ASM_HARDWARE_CORESIGHT_H */
Signature · 1 line
1.7.10.4
RFC 1/5 ARM: CORESIGHT: Add generic lock/unlock helpers
Hi Jon,
Quoted 18 lines · Jon Hunter
The Cross Trigger Interface (CTI) helpers in
cti.hinclude definitions for the Coresight Lock Access Register (LAR) and Lock Status Register (LSR). These registers are already defined incoresight.hand so rather than having multiple definitions, just use the definitions fromcoresight.h.Add the following coresight macros ...
-coresight_unlock()--> Unlocks coresight module
-coresight_lock()--> Locks coresight moduleUse the above macros for ETB, ETM and CTI. The do-while(0) statement has been removed from the macro as it is not a multi-line macro.
Signed-off-by Jon Hunter <[email protected]>--- arch/arm/include/asm/cti.h | 16 +++------------- arch/arm/include/asm/hardware/coresight.h | 16 ++++++++-------- 2 files changed, 11 insertions(+), 21 deletions(-)
[...]
Quoted 19 lines
arch/arm/include/asm/hardware/coresight.h +4
-5@@ -141,17 +141,17 @@#define ETBFF_TRIGEVT BIT(9)#define ETBFF_TRIGFL BIT(10) -#define etb_writel (t, v, x) \ - (__raw_writel((v), (t)->etb_regs + (x))) +#define etb_writel (t, v, x) (__raw_writel((v), (t)->etb_regs + (x)))#define etb_readl (t, x) (__raw_readl((t)->etb_regs + (x))) -#define etm_lock (t) do { etm_writel((t), 0, CSMR_LOCKACCESS); } while (0) -#define etm_unlock (t) \ - do { etm_writel((t), UNLOCK_MAGIC, CSMR_LOCKACCESS); } while (0) +#define etb_lock (t) coresight_lock((t)->etb_regs) +#define etb_unlock (t) coresight_unlock((t)->etb_regs) +#define etm_lock (t) coresight_lock((t)->etm_regs)
arch/arm/include/asm/hardware/coresight.h line 156
Quoted 10 lines
arch/arm/include/asm/hardware/coresight.h +4
-3+#define etm_unlock (t) coresight_unlock((t)->etm_regs) -#define etb_lock (t) do { etb_writel((t), 0, CSMR_LOCKACCESS); } while (0) -#define etb_unlock (t) \ - do { etb_writel((t), UNLOCK_MAGIC, CSMR_LOCKACCESS); } while (0) +#define coresight_lock (base) (__raw_writel(0, base + CSMR_LOCKACCESS)) +#define coresight_unlock (base) \ + (__raw_writel(UNLOCK_MAGIC, base + CSMR_LOCKACCESS))#endif /* __ASM_HARDWARE_CORESIGHT_H */
How about we take this opportunity to divorce the more general coresight bits from the etb specific parts, like you've done for the cti. We could move the ETB stuff out into asm/etb.h (although it might be nice to keep all the coresight device headers in one place... answers on a postcard) and just have the architected coresight functionality in this header.
Will
Quoted 4 lines
Signature · 1 line
1.7.10.4
RFC 1/5 ARM: CORESIGHT: Add generic lock/unlock helpers
Quoted 52 lines · Will Deacon
Hi Jon,
Quoted 18 lines · Jon Hunter
The Cross Trigger Interface (CTI) helpers in
cti.hinclude definitions for the Coresight Lock Access Register (LAR) and Lock Status Register (LSR). These registers are already defined incoresight.hand so rather than having multiple definitions, just use the definitions fromcoresight.h.Add the following coresight macros ...
-coresight_unlock()--> Unlocks coresight module
-coresight_lock()--> Locks coresight moduleUse the above macros for ETB, ETM and CTI. The do-while(0) statement has been removed from the macro as it is not a multi-line macro.
Signed-off-by Jon Hunter <[email protected]>--- arch/arm/include/asm/cti.h | 16 +++------------- arch/arm/include/asm/hardware/coresight.h | 16 ++++++++-------- 2 files changed, 11 insertions(+), 21 deletions(-)[...]
Quoted 28 lines
arch/arm/include/asm/hardware/coresight.h +8
-8@@ -141,17 +141,17 @@#define ETBFF_TRIGEVT BIT(9)#define ETBFF_TRIGFL BIT(10) -#define etb_writel (t, v, x) \ - (__raw_writel((v), (t)->etb_regs + (x))) +#define etb_writel (t, v, x) (__raw_writel((v), (t)->etb_regs + (x)))#define etb_readl (t, x) (__raw_readl((t)->etb_regs + (x))) -#define etm_lock (t) do { etm_writel((t), 0, CSMR_LOCKACCESS); } while (0) -#define etm_unlock (t) \ - do { etm_writel((t), UNLOCK_MAGIC, CSMR_LOCKACCESS); } while (0) +#define etb_lock (t) coresight_lock((t)->etb_regs) +#define etb_unlock (t) coresight_unlock((t)->etb_regs) +#define etm_lock (t) coresight_lock((t)->etm_regs) +#define etm_unlock (t) coresight_unlock((t)->etm_regs) -#define etb_lock (t) do { etb_writel((t), 0, CSMR_LOCKACCESS); } while (0) -#define etb_unlock (t) \ - do { etb_writel((t), UNLOCK_MAGIC, CSMR_LOCKACCESS); } while (0) +#define coresight_lock (base) (__raw_writel(0, base + CSMR_LOCKACCESS)) +#define coresight_unlock (base) \ + (__raw_writel(UNLOCK_MAGIC, base + CSMR_LOCKACCESS))
Quoted 7 lines
arch/arm/include/asm/hardware/coresight.h line 156
Quoted 1 line
arch/arm/include/asm/hardware/coresight.h +0
-0#endif /* __ASM_HARDWARE_CORESIGHT_H */ How about we take this opportunity to divorce the more general coresight bits from the etb specific parts, like you've done for the cti. We could move the ETB stuff out into
asm/etb.h(although it might be nice to keep all the coresight device headers in one place... answers on a postcard) and just have the architected coresight functionality in this header.
Yes I have been wondering about that too. Long term it would be good to find a home in the drivers directory for all these coresight devices too. For now, we could extract the etb/etm parts from coresight.h into etb.h and etm.h, respectively.
Cheers
Jon
RFC 1/5 ARM: CORESIGHT: Add generic lock/unlock helpers
Hi Jon, Will,
Quoted 62 lines · Jon Hunter
Quoted 52 lines · Will Deacon
Hi Jon,
Quoted 18 lines · Jon Hunter
The Cross Trigger Interface (CTI) helpers in
cti.hinclude definitions for the Coresight Lock Access Register (LAR) and Lock Status Register (LSR). These registers are already defined incoresight.hand so rather than having multiple definitions, just use the definitions fromcoresight.h.Add the following coresight macros ...
-coresight_unlock()--> Unlocks coresight module
-coresight_lock()--> Locks coresight moduleUse the above macros for ETB, ETM and CTI. The do-while(0) statement has been removed from the macro as it is not a multi-line macro.
Signed-off-by Jon Hunter <[email protected]>--- arch/arm/include/asm/cti.h | 16 +++------------- arch/arm/include/asm/hardware/coresight.h | 16 ++++++++-------- 2 files changed, 11 insertions(+), 21 deletions(-)[...]
Quoted 28 lines
arch/arm/include/asm/hardware/coresight.h +8
-8@@ -141,17 +141,17 @@#define ETBFF_TRIGEVT BIT(9)#define ETBFF_TRIGFL BIT(10) -#define etb_writel (t, v, x) \ - (__raw_writel((v), (t)->etb_regs + (x))) +#define etb_writel (t, v, x) (__raw_writel((v), (t)->etb_regs + (x)))#define etb_readl (t, x) (__raw_readl((t)->etb_regs + (x))) -#define etm_lock (t) do { etm_writel((t), 0, CSMR_LOCKACCESS); } while (0) -#define etm_unlock (t) \ - do { etm_writel((t), UNLOCK_MAGIC, CSMR_LOCKACCESS); } while (0) +#define etb_lock (t) coresight_lock((t)->etb_regs) +#define etb_unlock (t) coresight_unlock((t)->etb_regs) +#define etm_lock (t) coresight_lock((t)->etm_regs) +#define etm_unlock (t) coresight_unlock((t)->etm_regs) -#define etb_lock (t) do { etb_writel((t), 0, CSMR_LOCKACCESS); } while (0) -#define etb_unlock (t) \ - do { etb_writel((t), UNLOCK_MAGIC, CSMR_LOCKACCESS); } while (0) +#define coresight_lock (base) (__raw_writel(0, base + CSMR_LOCKACCESS)) +#define coresight_unlock (base) \ + (__raw_writel(UNLOCK_MAGIC, base + CSMR_LOCKACCESS))Quoted 7 lines
arch/arm/include/asm/hardware/coresight.h line 156
Quoted 1 line
arch/arm/include/asm/hardware/coresight.h +0
-0#endif /* __ASM_HARDWARE_CORESIGHT_H */ How about we take this opportunity to divorce the more general coresight bits from the etb specific parts, like you've done for the cti. We could move the ETB stuff out into
asm/etb.h(although it might be nice to keep all the coresight device headers in one place... answers on a postcard) and just have the architected coresight functionality in this header.
Quoted 4 lines
Yes I have been wondering about that too. Long term it would be good to find a home in the drivers directory for all these coresight devices too. For now, we could extract the etb/etm parts from
coresight.hintoetb.handetm.h, respectively.
I am now writing a HW trace driver that extracts traces from the CMI and PMI IP blocks (and later L2CC). It is still in early development status.
The idea I have in mind is to have the implementation in drivers/power/hw_trace. Eventually this directory would contain the drivers for ETM/ETB, CMI, PMI and also the coresight support. It would be architected so that the lower level drivers export the necessary functions for the higher level code to use the resource. Example: the PMI driver would use the ETB and coresight drivers.
What do you think?
Regards,
Jean
Quoted 7 lines
Cheers
Jon
--
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
RFC 2/5 ARM: dts: Add Cross Trigger Interface binding
In reply to Jon HunterAdds a device-tree binding for the ARM Cross Trigger Interface (CTI). The ARM Cross Trigger Interface provides a way to route events between processor modules. For example, on OMAP4430 we use the CTI module to route PMU events to the GIC interrupt module.
--- Documentation/devicetree/bindings/arm/cti.txt | 32 +++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/cti.txt
Documentation/devicetree/bindings/arm/cti.txt new file +32 -0
@@ -0,0 +1,32 @@ +* ARM Cross Trigger Interface (CTI) + +The ARM Cross Trigger Interface provides a way to route events between +processor modules. For example, debug events from one processor can be +broadcasted to other processors. The events that can be routed between +processors are specific to the device. + +Required properties: + +- compatible: Should be "arm,primecell". +- interrupts: Interrupt associated with CTI module. +- reg: Contains timer register address range (base + address and length). +- arm,cti-name: A unique name for the CTI module, that will be + used when requesting the CTI module instance. + + +Optional properties: + +- arm-primecell-periphid: Primecell peripheral ID associated with CTI + module. + + +Example: + +cti0: cti at 0x54148000 { + compatible = "arm,primecell"; + interrupts = <0 1 0x4>; + reg = <0x54148000 0x1000>; + arm,cti-name = "cti0"; + arm,primecell-periphid = <0x003bb906>; +};
Signature · 1 line
1.7.10.4
RFC 2/5 ARM: dts: Add Cross Trigger Interface binding
Quoted 4 lines · Jon Hunter
Adds a device-tree binding for the ARM Cross Trigger Interface (CTI). The ARM Cross Trigger Interface provides a way to route events between processor modules. For example, on OMAP4430 we use the CTI module to route PMU events to the GIC interrupt module.
Do you need to describe the PMU-CTI-GIC connection in DT?
Rob
Quoted 46 lines
Signed-off-by Jon Hunter <[email protected]>--- Documentation/devicetree/bindings/arm/cti.txt | 32 +++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/cti.txtDocumentation/devicetree/bindings/arm/cti.txt new file +32
-0@@ -0,0 +1,32 @@ +* ARM Cross Trigger Interface (CTI) + +The ARM Cross Trigger Interface provides a way to route events between +processor modules. For example, debug events from one processor can be +broadcasted to other processors. The events that can be routed between +processors are specific to the device. + +Required properties: + +- compatible: Should be "arm,primecell". +- interrupts: Interrupt associated with CTI module. +- reg: Contains timer register address range (base + address and length). +- arm,cti-name: A unique name for the CTI module, that will be + used when requesting the CTI module instance. + + +Optional properties: + +- arm-primecell-periphid: Primecell peripheral ID associated with CTI + module. + + +Example: + +cti0: cti at 0x54148000 { + compatible = "arm,primecell"; + interrupts = <0 1 0x4>; + reg = <0x54148000 0x1000>; + arm,cti-name = "cti0"; + arm,primecell-periphid = <0x003bb906>; +};
RFC 2/5 ARM: dts: Add Cross Trigger Interface binding
Quoted 7 lines · Rob Herring
Quoted 4 lines · Jon Hunter
Adds a device-tree binding for the ARM Cross Trigger Interface (CTI). The ARM Cross Trigger Interface provides a way to route events between processor modules. For example, on OMAP4430 we use the CTI module to route PMU events to the GIC interrupt module.
Do you need to describe the PMU-CTI-GIC connection in DT?
We definitely could. This is achieved by mapping a trigger-input to a trigger-output. So we could list the trigger outputs and inputs in the binding. For omap4430 we would have ...
arm,cti-trigin = <0 1 2 3 4 5 6>; arm,cti-trigin-names = "dbgack", "pmuirq", "ptmextout0",
"ptmextout1", "commtx", "commrx", "ptmtrigger"; arm,cti-trigout = <0 1 2 3 4 6 7>; arm,cti-trigout-names = "edbgreq", "ptmextin0", "ptmextin1", "ptmextin2", "ptmextin3","mpuirq", "dbgrestart";
So to map the PMU to GIC, we would map the "pmuirq" trigger input to the "mpuirq" trigger output. Then we could setup the mapping by name instead of index.
Let me know what you think about that.
Cheers
Jon
RFC 2/5 ARM: dts: Add Cross Trigger Interface binding
Quoted 8 lines · Jon Hunter
Quoted 6 lines · Rob Herring
Quoted 4 lines · Jon Hunter
Adds a device-tree binding for the ARM Cross Trigger Interface (CTI). The ARM Cross Trigger Interface provides a way to route events between processor modules. For example, on OMAP4430 we use the CTI module to route PMU events to the GIC interrupt module.
Quoted 7 lines
Quoted 1 line
Do you need to describe the PMU-CTI-GIC connection in DT?
We definitely could. This is achieved by mapping a trigger-input to a trigger-output. So we could list the trigger outputs and inputs in the binding. For omap4430 we would have ...
arm,cti-trigin = <0 1 2 3 4 5 6>;
I'd prefer to just spell it out: arm,cti-trigger-in
Quoted 11 lines
arm,cti-trigin-names = "dbgack", "pmuirq", "ptmextout0",
"ptmextout1", "commtx", "commrx", "ptmtrigger"; arm,cti-trigout = <0 1 2 3 4 6 7>; arm,cti-trigout-names = "edbgreq", "ptmextin0", "ptmextin1", "ptmextin2", "ptmextin3","mpuirq", "dbgrestart";So to map the PMU to GIC, we would map the "pmuirq" trigger input to the "mpuirq" trigger output. Then we could setup the mapping by name instead of index.
I'm not crazy about the name strings and would prefer something with phandles. The above binding doesn't really describe the connection of the CTI to the GIC. The GIC node would need to define some inputs and then you show the connection to the CTI outputs. This may be similar to an interrupt nexus node.
Rob
RFC 2/5 ARM: dts: Add Cross Trigger Interface binding
In reply to Jon HunterQuoted 28 lines · Jon Hunter
Adds a device-tree binding for the ARM Cross Trigger Interface (CTI). The ARM Cross Trigger Interface provides a way to route events between processor modules. For example, on OMAP4430 we use the CTI module to route PMU events to the GIC interrupt module.
Signed-off-by Jon Hunter <[email protected]>--- Documentation/devicetree/bindings/arm/cti.txt | 32 +++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/cti.txtDocumentation/devicetree/bindings/arm/cti.txt new file +11
-0@@ -0,0 +1,32 @@ +* ARM Cross Trigger Interface (CTI) + +The ARM Cross Trigger Interface provides a way to route events between +processor modules. For example, debug events from one processor can be +broadcasted to other processors. The events that can be routed between +processors are specific to the device. + +Required properties: + +- compatible: Should be "arm,primecell". +- interrupts: Interrupt associated with CTI module.
Documentation/devicetree/bindings/arm/cti.txt line 21
Quoted 10 lines
Documentation/devicetree/bindings/arm/cti.txt new file +10
-0+- reg: Contains timer register address range (base + address and length). +- arm,cti-name: A unique name for the CTI module, that will be + used when requesting the CTI module instance. + + +Optional properties: + +- arm-primecell-periphid: Primecell peripheral ID associated with CTI + module.
For multi-cluster systems, I wouldn't be surprised to see multiple CTI instances, each with different CPU affinities. Can we include an affinity property following Mark's proposed binding?
http://lists.infradead.org/pipermail/linux-arm-kernel/2012-December/137290.html
Will
RFC 2/5 ARM: dts: Add Cross Trigger Interface binding
Quoted 44 lines · Will Deacon
Quoted 28 lines · Jon Hunter
Adds a device-tree binding for the ARM Cross Trigger Interface (CTI). The ARM Cross Trigger Interface provides a way to route events between processor modules. For example, on OMAP4430 we use the CTI module to route PMU events to the GIC interrupt module.
Signed-off-by Jon Hunter <[email protected]>--- Documentation/devicetree/bindings/arm/cti.txt | 32 +++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/cti.txtDocumentation/devicetree/bindings/arm/cti.txt new file +11
-0@@ -0,0 +1,32 @@ +* ARM Cross Trigger Interface (CTI) + +The ARM Cross Trigger Interface provides a way to route events between +processor modules. For example, debug events from one processor can be +broadcasted to other processors. The events that can be routed between +processors are specific to the device. + +Required properties: + +- compatible: Should be "arm,primecell". +- interrupts: Interrupt associated with CTI module.Documentation/devicetree/bindings/arm/cti.txt line 21
Quoted 10 lines
Documentation/devicetree/bindings/arm/cti.txt new file +10
-0+- reg: Contains timer register address range (base + address and length). +- arm,cti-name: A unique name for the CTI module, that will be + used when requesting the CTI module instance. + + +Optional properties: + +- arm-primecell-periphid: Primecell peripheral ID associated with CTI + module.For multi-cluster systems, I wouldn't be surprised to see multiple CTI instances, each with different CPU affinities. Can we include an affinity property following Mark's proposed binding?
Yes I can take a look. Would something like that be applicable to pmu as well or is that unlikely to have different affinities? I am just wondering if there is something that we should implement in general for the various primecell components.
Cheers
Jon
RFC 2/5 ARM: dts: Add Cross Trigger Interface binding
Quoted 46 lines · Jon Hunter
Quoted 44 lines · Will Deacon
Quoted 28 lines · Jon Hunter
Adds a device-tree binding for the ARM Cross Trigger Interface (CTI). The ARM Cross Trigger Interface provides a way to route events between processor modules. For example, on OMAP4430 we use the CTI module to route PMU events to the GIC interrupt module.
Signed-off-by Jon Hunter <[email protected]>--- Documentation/devicetree/bindings/arm/cti.txt | 32 +++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/cti.txtDocumentation/devicetree/bindings/arm/cti.txt new file +11
-0@@ -0,0 +1,32 @@ +* ARM Cross Trigger Interface (CTI) + +The ARM Cross Trigger Interface provides a way to route events between +processor modules. For example, debug events from one processor can be +broadcasted to other processors. The events that can be routed between +processors are specific to the device. + +Required properties: + +- compatible: Should be "arm,primecell". +- interrupts: Interrupt associated with CTI module.Documentation/devicetree/bindings/arm/cti.txt line 21
Quoted 10 lines
Documentation/devicetree/bindings/arm/cti.txt new file +10
-0+- reg: Contains timer register address range (base + address and length). +- arm,cti-name: A unique name for the CTI module, that will be + used when requesting the CTI module instance. + + +Optional properties: + +- arm-primecell-periphid: Primecell peripheral ID associated with CTI + module.For multi-cluster systems, I wouldn't be surprised to see multiple CTI instances, each with different CPU affinities. Can we include an affinity property following Mark's proposed binding?
Quoted 6 lines
Yes I can take a look. Would something like that be applicable to pmu as well or is that unlikely to have different affinities? I am just wondering if there is something that we should implement in general for the various primecell components.
Do you mean for describing the PMU's affinity to the perf subsystem or its wiring to the CTI?
It's certainly applicable for the former; I've been working on a series to enable support for the PMUs in both clusters in a A15x2 A7x3 coretile using the binding, and I intend to post a series shortly. I'm not sure about the latter, as I don't have much of an understanding about the CTI.
I'm not sure how many other components have affinity concerns, but the intention is for the binding to be reusable.
Quoted 4 lines
Cheers
Jon
Thanks,
Mark.
RFC 2/5 ARM: dts: Add Cross Trigger Interface binding
Quoted 49 lines · Mark Rutland
Quoted 48 lines · Jon Hunter
Quoted 45 lines · Will Deacon
Quoted 28 lines · Jon Hunter
Adds a device-tree binding for the ARM Cross Trigger Interface (CTI). The ARM Cross Trigger Interface provides a way to route events between processor modules. For example, on OMAP4430 we use the CTI module to route PMU events to the GIC interrupt module.
Signed-off-by Jon Hunter <[email protected]>--- Documentation/devicetree/bindings/arm/cti.txt | 32 +++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/cti.txtDocumentation/devicetree/bindings/arm/cti.txt new file +11
-0@@ -0,0 +1,32 @@ +* ARM Cross Trigger Interface (CTI) + +The ARM Cross Trigger Interface provides a way to route events between +processor modules. For example, debug events from one processor can be +broadcasted to other processors. The events that can be routed between +processors are specific to the device. + +Required properties: + +- compatible: Should be "arm,primecell". +- interrupts: Interrupt associated with CTI module.Documentation/devicetree/bindings/arm/cti.txt line 21
Quoted 10 lines
Documentation/devicetree/bindings/arm/cti.txt new file +10
-0+- reg: Contains timer register address range (base + address and length). +- arm,cti-name: A unique name for the CTI module, that will be + used when requesting the CTI module instance. + + +Optional properties: + +- arm-primecell-periphid: Primecell peripheral ID associated with CTI + module.For multi-cluster systems, I wouldn't be surprised to see multiple CTI instances, each with different CPU affinities. Can we include an affinity property following Mark's proposed binding?
http://lists.infradead.org/pipermail/linux-arm-kernel/2012-December/137290.html
Quoted 7 lines
Quoted 4 lines
Yes I can take a look. Would something like that be applicable to pmu as well or is that unlikely to have different affinities? I am just wondering if there is something that we should implement in general for the various primecell components.
Do you mean for describing the PMU's affinity to the perf subsystem or its wiring to the CTI?
Yes the PMU's affinity in general, ignoring CTI for now.
Quoted 4 lines
It's certainly applicable for the former; I've been working on a series to enable support for the PMUs in both clusters in a A15x2 A7x3 coretile using the binding, and I intend to post a series shortly. I'm not sure about the latter, as I don't have much of an understanding about the CTI.
Ok great. I think that this use-case of PMU+CTI is a special case for OMAP. CTI could be used for many things and for some reason TI hooked up the PMU interrupt via the CTI on OMAP4430 (which has been giving me grief ;-)
So if there is a general way to describe the affinity of a module, such as PMU, I could re-use this and add to the CTI binding as Will suggested.
Quoted 2 lines
I'm not sure how many other components have affinity concerns, but the intention is for the binding to be reusable.
Great.
Thanks
Jon
RFC 3/5 ARM: CTI: Convert CTI helpers to AMBA bus driver
In reply to Jon HunterConvert the Cross Trigger Interface (CTI) helpers in cti.h into a AMBA bus driver so that we can use device-tree to look-up the hardware specific information such as base address and interrupt number during the device probe. This also add APIs to request, cti_get() and release, cti_put(), a CTI module so that drivers can allocate a module at runtime.
Currently, the driver only supports looking-up the CTI hardware information via device-tree, however, the driver could be extended to support non-device-tree configurations if needed for a particular architecture.
The CTI driver only currently supports CTI modules that have a single CPU interrupt, however, could be extended in the future to support more interrupts if a device requires this.
--- arch/arm/include/asm/cti.h | 153 ------------------------ drivers/Kconfig | 2 + drivers/amba/Kconfig | 20 ++++ drivers/amba/Makefile | 1 + drivers/amba/cti.c | 284 ++++++++++++++++++++++++++++++++++++++++++++ include/linux/amba/cti.h | 82 +++++++++++++ 6 files changed, 389 insertions(+), 153 deletions(-) delete mode 100644 arch/arm/include/asm/cti.h create mode 100644 drivers/amba/Kconfig create mode 100644 drivers/amba/cti.c create mode 100644 include/linux/amba/cti.h
arch/arm/include/asm/cti.h deleted +0 -153
@@ -1,153 +0,0 @@ -#ifndef __ASMARM_CTI_H -#define __ASMARM_CTI_H - -#include <asm/io.h> -#include <asm/hardware/coresight.h> - -/* The registers' definition is from section 3.2 of -* Embedded Cross Trigger Revision: r0p0 -*/ -#define CTICONTROL 0x000 -#define CTISTATUS 0x004 -#define CTILOCK 0x008 -#define CTIPROTECTION 0x00C -#define CTIINTACK 0x010 -#define CTIAPPSET 0x014 -#define CTIAPPCLEAR 0x018 -#define CTIAPPPULSE 0x01c -#define CTIINEN 0x020 -#define CTIOUTEN 0x0A0 -#define CTITRIGINSTATUS 0x130 -#define CTITRIGOUTSTATUS 0x134 -#define CTICHINSTATUS 0x138 -#define CTICHOUTSTATUS 0x13c -#define CTIPERIPHID0 0xFE0 -#define CTIPERIPHID1 0xFE4 -#define CTIPERIPHID2 0xFE8 -#define CTIPERIPHID3 0xFEC -#define CTIPCELLID0 0xFF0 -#define CTIPCELLID1 0xFF4 -#define CTIPCELLID2 0xFF8 -#define CTIPCELLID3 0xFFC - -/** -* struct cti - cross trigger interface struct -* @base: mapped virtual address for the cti base -* @irq: irq number for the cti -* @trig_out_for_irq: triger out number which will cause -* the @irq happen -* -* cti struct used to operate cti registers. -*/ -struct cti { -void __iomem *base; -int irq; -int trig_out_for_irq; -}; - -/** -* cti_init - initialize the cti instance -* @cti: cti instance -* @base: mapped virtual address for the cti base -* @irq: irq number for the cti -* @trig_out: triger out number which will cause -* the @irq happen -* -* called by machine code to pass the board dependent -* @base, @irq and @trig_out to cti. -*/ -static inline void cti_init (struct cti *cti, -void __iomem *base,int irq,int trig_out) -{ - cti->base = base; - cti->irq = irq; - cti->trig_out_for_irq = trig_out; -} - -/** -* cti_map_trigger - use the @chan to map @trig_in to @trig_out -* @cti: cti instance -* @trig_in: trigger in number -* @trig_out: trigger out number -* @channel: channel number -* -* This function maps one trigger in of @trig_in to one trigger -* out of @trig_out using the channel @chan. -*/ -static inline void cti_map_trigger (struct cti *cti, -int trig_in,int trig_out,int chan) -{ -void __iomem *base = cti->base; -unsigned long val; - - val =__raw_readl (base +CTIINEN + trig_in *4 ); - val |=BIT (chan); -__raw_writel (val, base +CTIINEN + trig_in *4 ); - - val =__raw_readl (base +CTIOUTEN + trig_out *4 ); - val |=BIT (chan); -__raw_writel (val, base +CTIOUTEN + trig_out *4 ); -} - -/** -* cti_enable - enable the cti module -* @cti: cti instance -* -* enable the cti module -*/ -static inline void cti_enable (struct cti *cti) -{ -__raw_writel (0x1 , cti->base +CTICONTROL ); -} - -/** -* cti_disable - disable the cti module -* @cti: cti instance -* -* enable the cti module -*/ -static inline void cti_disable (struct cti *cti) -{ -__raw_writel (0 , cti->base +CTICONTROL ); -} - -/** -* cti_irq_ack - clear the cti irq -* @cti: cti instance -* -* clear the cti irq -*/ -static inline void cti_irq_ack (struct cti *cti) -{ -void __iomem *base = cti->base; -unsigned long val; - - val =__raw_readl (base +CTIINTACK ); - val |=BIT (cti->trig_out_for_irq); -__raw_writel (val, base +CTIINTACK ); -} - -/** -* cti_unlock - unlock cti module -* @cti: cti instance -* -* unlock the cti module, or else any writes to the cti -* module is not allowed. -*/ -static inline void cti_unlock (struct cti *cti) -{ -coresight_unlock (cti->base); -} - -/** -* cti_lock - lock cti module -* @cti: cti instance -* -* lock the cti module, so any writes to the cti -* module will be not allowed. -*/ -static inline void cti_lock (struct cti *cti) -{ -coresight_lock (cti->base); -} -#endif
drivers/Kconfig +2 -0
@@ -2,6 +2,8 @@ menu "Device Drivers" source "drivers/base/Kconfig" +source "drivers/amba/Kconfig" + source "drivers/bus/Kconfig" source "drivers/connector/Kconfig"
drivers/amba/Kconfig new file +20 -0
@@ -0,0 +1,20 @@ +# +# AMBA Devices +# + +menu "AMBA devices" + +config ARM_AMBA_CTI + bool "Cross-Trigger Interface" + depends on ARM && OF + select ARM_AMBA + help + The ARM Cross Trigger Interface provides a way to route events + between processor modules. For example, debug events from one + processor can be broadcasted to other processors. The events that + can be routed between processors are specific to the device. + Currently, the driver only supports looking-up the CTI hardware + information (base address and interrupts) from device-tree (and + hence, is dependent upon CONFIG_OF). + +endmenu
drivers/amba/Makefile +1 -0
@@ -1,2 +1,3 @@ obj-$(CONFIG_ARM_AMBA) += bus.o +obj-$(CONFIG_ARM_AMBA_CTI) += cti.o obj-$(CONFIG_TEGRA_AHB) += tegra-ahb.o
drivers/amba/cti.c new file +284 -0
284 lines not on this page · raw message
include/linux/amba/cti.h new file +82 -0
82 lines not on this page · raw message
Signature · 1 line
1.7.10.4
RFC 3/5 ARM: CTI: Convert CTI helpers to AMBA bus driver
Quoted 7 lines · Jon Hunter
Convert the Cross Trigger Interface (CTI) helpers in
cti.hinto a AMBA bus driver so that we can use device-tree to look-up the hardware specific information such as base address and interrupt number during the device probe. This also add APIs to request,cti_get()and release,cti_put(), a CTI module so that drivers can allocate a module at runtime.
Quoted 8 lines
Currently, the driver only supports looking-up the CTI hardware information via device-tree, however, the driver could be extended to support non-device-tree configurations if needed for a particular architecture.
The CTI driver only currently supports CTI modules that have a single CPU interrupt, however, could be extended in the future to support more interrupts if a device requires this.
Aha, so elaborating on my earlier comments, we basically want to do the same thing for ETB I reckon. This does raise the question about namespaces though...
Quoted 21 lines
include/linux/amba/cti.h new file +21
-0+/** +* struct cti - Cross Trigger Interface (CTI) struct +* +* @node: Connects CTI instance to list of CTI instances +* @dev: Pointer to device structure +* @base: Mapped virtual address of the CTI module +* @name: Name associated with CTI instance +* @irq: Interrupt associated with CTI instance +* @trig_out: Trigger output associated with interrupt (@irq) +* @reserved: Used to indicate if CTI instance has been allocated +* @enabled: Used to indicate if CTI instance has been enabled +*/ +struct cti { +struct list_head node; +struct device *dev; +void __iomem *base; +const char *name; +int irq; +int trig_out; +bool reserved; +bool enabled;
include/linux/amba/cti.h line 48
Quoted 10 lines
include/linux/amba/cti.h new file +10
-0+}; + +#ifdef CONFIG_ARM_AMBA_CTI + +int cti_map_trigger (struct cti *cti,int trig_in,int trig_out,int chan); +int cti_enable (struct cti *cti); +int cti_disable (struct cti *cti); +int cti_irq_ack (struct cti *cti); +struct cti *cti_get (const char *name); +void cti_put (struct cti *cti);
I wonder whether we should stick these all into a struct and have a general way to see which coresight devices we have and then retrieve their ops structures (so things like perf can walk a virtual coresight bus containing initialised devices). It might also help if we decide to describe the plumbing in the device tree, like Rob suggested.
What do you reckon?
Will
RFC 3/5 ARM: CTI: Convert CTI helpers to AMBA bus driver
Quoted 49 lines · Will Deacon
Quoted 7 lines · Jon Hunter
Convert the Cross Trigger Interface (CTI) helpers in
cti.hinto a AMBA bus driver so that we can use device-tree to look-up the hardware specific information such as base address and interrupt number during the device probe. This also add APIs to request,cti_get()and release,cti_put(), a CTI module so that drivers can allocate a module at runtime.Quoted 8 lines
Currently, the driver only supports looking-up the CTI hardware information via device-tree, however, the driver could be extended to support non-device-tree configurations if needed for a particular architecture.
The CTI driver only currently supports CTI modules that have a single CPU interrupt, however, could be extended in the future to support more interrupts if a device requires this.
Aha, so elaborating on my earlier comments, we basically want to do the same thing for ETB I reckon. This does raise the question about namespaces though...
Quoted 28 lines
include/linux/amba/cti.h new file +28
-0+/** +* struct cti - Cross Trigger Interface (CTI) struct +* +* @node: Connects CTI instance to list of CTI instances +* @dev: Pointer to device structure +* @base: Mapped virtual address of the CTI module +* @name: Name associated with CTI instance +* @irq: Interrupt associated with CTI instance +* @trig_out: Trigger output associated with interrupt (@irq) +* @reserved: Used to indicate if CTI instance has been allocated +* @enabled: Used to indicate if CTI instance has been enabled +*/ +struct cti { +struct list_head node; +struct device *dev; +void __iomem *base; +const char *name; +int irq; +int trig_out; +bool reserved; +bool enabled; +}; + +#ifdef CONFIG_ARM_AMBA_CTI + +int cti_map_trigger (struct cti *cti,int trig_in,int trig_out,int chan); +int cti_enable (struct cti *cti); +int cti_disable (struct cti *cti);
Quoted 8 lines
include/linux/amba/cti.h line 48
Quoted 3 lines
include/linux/amba/cti.h new file +3
-0+int cti_irq_ack (struct cti *cti); +struct cti *cti_get (const char *name); +void cti_put (struct cti *cti);I wonder whether we should stick these all into a struct and have a general way to see which coresight devices we have and then retrieve their ops structures (so things like perf can walk a virtual coresight bus containing initialised devices).
Yes we could use a struct here. Hopefully, the enable/disable/get/put could be used across coresight devices. I would need to think more about the custom functions such as map_trigger which are specific to CTI.
Quoted 2 lines
It might also help if we decide to describe the
plumbing in the device tree, like Rob suggested.
Yes, I did propose adding more information to the binding for CTI to describe trigger-ins/outs for a device. However, we could go a step further and try and come up with a way to link the devices. Though I am not sure if there are any other possible use-cases for CTI where that may not be suitable and we just want to be able to configure it to map trigger input to trigger output. Anyway, open to any ideas to improve this.
Cheers
Jon
RFC 3/5 ARM: CTI: Convert CTI helpers to AMBA bus driver
In reply to Jon HunterQuoted 6 lines · Jon Hunter
drivers/amba/cti.c new file +6
-0+ +/** +* cti_irq_ack - acknowledges the CTI trigger output +* @cti: CTI instance +* +* Acknowledges the CTI trigger output by writting to the appropriate
drivers/amba/cti.c line 153
Quoted 10 lines
drivers/amba/cti.c new file +10
-0+* bit in the CTI interrupt acknowledge register. +*/ +int cti_irq_ack (struct cti *cti) +{ +u32 v; + +if (!cti || !cti->enabled) +return -EINVAL ; + + v =cti_readl (cti,CTIINTACK );
Just curious if CTIINTACK is a read-write register? This is a read-only for us.
Quoted 19 lines
drivers/amba/cti.c new file +19
-0+ v |=BIT (cti->trig_out); +cti_writel (v, cti,CTIINTACK ); + +return 0 ; +} + + +static int cti_probe (struct amba_device *dev,const struct amba_id *id) +{ +struct cti *cti; +struct device_node *np = dev->dev.of_node; +int rc; + +if (!np) { +dev_err (&dev->dev,"device-tree not found!\n" ); +return -ENODEV ; + } + + cti =devm_kzalloc (&dev->dev,sizeof (struct cti ),GFP_KERNEL );
drivers/amba/cti.c line 234
Quoted 10 lines
drivers/amba/cti.c new file +10
-0+if (!cti) { +dev_err (&dev->dev,"memory allocation failed!\n" ); +return -ENOMEM ; + } + + rc =of_property_read_string_index (np,"arm,cti-name" ,0 , &cti->name); +if (rc) { +dev_err (&dev->dev,"no name found for CTI!\n" ); +return rc; + }
Shouldn't the CTI driver have some kind of clock management that it does for itself?
Quoted 29 lines
drivers/amba/cti.c new file +29
-0+ +if (!dev->irq[0 ]) { +dev_err (&dev->dev,"no CTI interrupt found!\n" ); +return -ENODEV ; + } + + cti->irq = dev->irq[0 ]; + cti->base =of_iomap (np,0 ); +if (!cti->base) { +dev_err (&dev->dev,"unable to map CTI registers!\n" ); +return -ENOMEM ; + } + + cti->dev = &dev->dev; +amba_set_drvdata (dev, cti); +list_add_tail (&cti->node, &cti_list); + +/* +* AMBA bus driver has already enabled RPM and incremented +* use-count, so now we can safely decrement the use-count +* and allow the CTI driver to manage RPM for the device. +*/ +pm_runtime_put (&dev->dev); + +dev_info (&dev->dev,"ARM CTI driver" ); + +return 0 ; +} +
Signature · 3 lines
Employee of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
RFC 3/5 ARM: CTI: Convert CTI helpers to AMBA bus driver
Quoted 12 lines · Pratik Patel
Quoted 11 lines · Jon Hunter
drivers/amba/cti.c new file +11
-0+ +/** +* cti_irq_ack - acknowledges the CTI trigger output +* @cti: CTI instance +* +* Acknowledges the CTI trigger output by writting to the appropriate +* bit in the CTI interrupt acknowledge register. +*/ +int cti_irq_ack (struct cti *cti) +{ +u32 v;
Quoted 9 lines
drivers/amba/cti.c line 153
Quoted 5 lines
drivers/amba/cti.c new file +5
-0+ +if (!cti || !cti->enabled) +return -EINVAL ; + + v =cti_readl (cti,CTIINTACK );Just curious if CTIINTACK is a read-write register? This is a read-only for us.
Mistyped - its a write-only for us
Signature · 3 lines
Employee of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
RFC 3/5 ARM: CTI: Convert CTI helpers to AMBA bus driver
Quoted 22 lines · Pratik Patel
Quoted 12 lines · Pratik Patel
Quoted 11 lines · Jon Hunter
drivers/amba/cti.c new file +11
-0+ +/** +* cti_irq_ack - acknowledges the CTI trigger output +* @cti: CTI instance +* +* Acknowledges the CTI trigger output by writting to the appropriate +* bit in the CTI interrupt acknowledge register. +*/ +int cti_irq_ack (struct cti *cti) +{ +u32 v;Quoted 9 lines
drivers/amba/cti.c line 153
Quoted 5 lines
drivers/amba/cti.c new file +5
-0+ +if (!cti || !cti->enabled) +return -EINVAL ; + + v =cti_readl (cti,CTIINTACK );Just curious if CTIINTACK is a read-write register? This is a read-only for us.
Quoted 1 line
Mistyped - its a write-only for us
You are right. Looking at the ARM documentation this is a write-only register. I had copied this function from the original helpers but had not checked if this was readable. I will correct this.
Cheers
Jon
RFC 3/5 ARM: CTI: Convert CTI helpers to AMBA bus driver
In reply to Pratik PatelQuoted 45 lines · Pratik Patel
Quoted 6 lines · Jon Hunter
drivers/amba/cti.c new file +6
-0+ +/** +* cti_irq_ack - acknowledges the CTI trigger output +* @cti: CTI instance +* +* Acknowledges the CTI trigger output by writting to the appropriate drivers/amba/cti.c line 153
Quoted 10 lines
drivers/amba/cti.c new file +10
-0+* bit in the CTI interrupt acknowledge register. +*/ +int cti_irq_ack (struct cti *cti) +{ +u32 v; + +if (!cti || !cti->enabled) +return -EINVAL ; + + v =cti_readl (cti,CTIINTACK );Just curious if CTIINTACK is a read-write register? This is a read-only for us.
Quoted 24 lines
drivers/amba/cti.c new file +24
-0+ v |=BIT (cti->trig_out); +cti_writel (v, cti,CTIINTACK ); + +return 0 ; +} + + +static int cti_probe (struct amba_device *dev,const struct amba_id *id) +{ +struct cti *cti; +struct device_node *np = dev->dev.of_node; +int rc; + +if (!np) { +dev_err (&dev->dev,"device-tree not found!\n" ); +return -ENODEV ; + } + + cti =devm_kzalloc (&dev->dev,sizeof (struct cti ),GFP_KERNEL ); +if (!cti) { +dev_err (&dev->dev,"memory allocation failed!\n" ); +return -ENOMEM ; + } +
Quoted 8 lines
drivers/amba/cti.c line 234
Quoted 5 lines
drivers/amba/cti.c new file +5
-0+ rc =of_property_read_string_index (np,"arm,cti-name" ,0 , &cti->name); +if (rc) { +dev_err (&dev->dev,"no name found for CTI!\n" ); +return rc; + }Shouldn't the CTI driver have some kind of clock management that it does for itself?
It does by using runtime PM. If you look at the cti_get/put functions, you will see calls to pm_runtime_get/put. These calls will enable the AMBA apb-clock. If you need to enable additional clocks then you could register pm runtime resume/idle call backs to do this.
Cheers
Jon
RFC 3/5 ARM: CTI: Convert CTI helpers to AMBA bus driver
Quoted 56 lines · Jon Hunter
Quoted 45 lines · Pratik Patel
Quoted 6 lines · Jon Hunter
drivers/amba/cti.c new file +6
-0+ +/** +* cti_irq_ack - acknowledges the CTI trigger output +* @cti: CTI instance +* +* Acknowledges the CTI trigger output by writting to the appropriate drivers/amba/cti.c line 153
Quoted 10 lines
drivers/amba/cti.c new file +10
-0+* bit in the CTI interrupt acknowledge register. +*/ +int cti_irq_ack (struct cti *cti) +{ +u32 v; + +if (!cti || !cti->enabled) +return -EINVAL ; + + v =cti_readl (cti,CTIINTACK );Just curious if CTIINTACK is a read-write register? This is a read-only for us.
Quoted 24 lines
drivers/amba/cti.c new file +24
-0+ v |=BIT (cti->trig_out); +cti_writel (v, cti,CTIINTACK ); + +return 0 ; +} + + +static int cti_probe (struct amba_device *dev,const struct amba_id *id) +{ +struct cti *cti; +struct device_node *np = dev->dev.of_node; +int rc; + +if (!np) { +dev_err (&dev->dev,"device-tree not found!\n" ); +return -ENODEV ; + } + + cti =devm_kzalloc (&dev->dev,sizeof (struct cti ),GFP_KERNEL ); +if (!cti) { +dev_err (&dev->dev,"memory allocation failed!\n" ); +return -ENOMEM ; + } +Quoted 8 lines
drivers/amba/cti.c line 234
Quoted 5 lines
drivers/amba/cti.c new file +5
-0+ rc =of_property_read_string_index (np,"arm,cti-name" ,0 , &cti->name); +if (rc) { +dev_err (&dev->dev,"no name found for CTI!\n" ); +return rc; + }Shouldn't the CTI driver have some kind of clock management that it does for itself?
Quoted 5 lines
It does by using runtime PM. If you look at the cti_get/put functions, you will see calls to pm_runtime_get/put. These calls will enable the AMBA apb-clock. If you need to enable additional clocks then you could register pm runtime resume/idle call backs to do this.
Ok
Signature · 3 lines
Employee of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
RFC 4/5 ARM: dts: OMAP4: Add CTI nodes
In reply to Jon HunterAdd device-tree nodes for the two Cross Trigger Interface (CTI) modules in the OMAP4 devices.
--- arch/arm/boot/dts/omap4.dtsi | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
arch/arm/boot/dts/omap4.dtsi +23 -0
@@ -59,6 +59,29 @@ interrupts = <1 13 0x304>; }; + amba { + compatible = "arm,amba-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + cti0: cti at 0x54148000 { + compatible = "arm,primecell"; + interrupts = <0 1 0x4>; + reg = <0x54148000 0x1000>; + arm,cti-name = "cti0"; + arm,primecell-periphid = <0x003bb906>; + }; + + cti1: cti at 0x54149000 { + compatible = "arm,primecell"; + interrupts = <0 2 0x4>; + reg = <0x54149000 0x1000>; + arm,cti-name = "cti1"; + arm,primecell-periphid = <0x003bb906>; + }; + }; + /* * The soc node represents the soc top level view. It is uses for IPs * that are not memory mapped in the MPU view or for the MPU itself.
Signature · 1 line
1.7.10.4
RFC 5/5 ARM: OMAP4: Add AMBA APB Clock
In reply to Jon HunterFor OMAP4 devices, ARM AMBA peripherals such as program trace module (PTM) or cross trigger interface (CTI) require that the DEBUG Sub-system power and clock domain is turned on. Normally, the OMAP device and HMWOD frameworks would be used to enable the power and clock domains, but currently these frameworks only support platform devices and not AMBA devices. Therefore, add a clock alias for the AMBA APB clock for OMAP4 devices to turn on the DEBUGSS power and clock domain.
--- arch/arm/mach-omap2/cclock44xx_data.c | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-omap2/cclock44xx_data.c +1 -0
@@ -1940,6 +1940,7 @@ static struct omap_clk omap44xx_clks[] = {CLK ("4903c000.timer" ,"timer_sys_ck" , &syc_clk_div_ck,CK_443X ),CLK ("4903e000.timer" ,"timer_sys_ck" , &syc_clk_div_ck,CK_443X ),CLK (NULL ,"cpufreq_ck" , &dpll_mpu_ck,CK_443X ), + CLK(NULL, "apb_pclk", &trace_clk_div_ck, CK_443X), }; static const char *enable_init_clks[] = {
Signature · 1 line
1.7.10.4