Add the driver for Intel Keem Bay SoC timer block
Subsystems (2)
v8 cover Add the driver for Intel Keem Bay SoC timer block
From: Shruthi Sanil <[email protected]>
The timer block supports 1 64-bit free running counter and 8 32-bit general purpose timers.
Patch 1 holds the device tree binding documentation. Patch 2 holds the device driver.
This driver is tested on the Keem Bay evaluation module board.
Changes since v7:
- Added back the compatible string "intel,keembay-gpt-creg" as an enum to the mfd device node in the device tree bindings.
- As the timer is used as a broadcast timer during CPU idle, only one timer is needed. Hence updated the driver accordingly incorporating the review comments.
Changes since v6:
- Removed the unused compatible string from the mfd device node to fix the error thrown by the make dt-binding command.
Changes since v5:
- Created a MFD device for the common configuration register in the device tree bindings.
- Updated the timer driver with the MFD framework to access the common configuration register.
Changes since v4:
- Updated the description in the device tree bindings.
- Updated the unit address of all the timers and counter in the device tree binding.
Changes since v3:
- Update in KConfig file to support COMPILE_TEST for Keem Bay timer.
- Update in device tree bindings to remove status field.
- Update in device tree bindings to remove 64-bit address space for the child nodes by using non-empty ranges.
Changes since v2:
- Add multi timer support.
- Update in the device tree binding to support multi timers.
- Code optimization.
Changes since v1:
- Add support for KEEMBAY_TIMER to get selected through Kconfig.platforms.
- Add CLOCK_EVT_FEAT_DYNIRQ as part of clockevent feature.
- Avoid overlapping reg regions across 2 device nodes.
- Simplify 2 device nodes as 1 because both are from same IP block.
- Adapt the driver code according to the new simplified devicetree.
Shruthi Sanil (2):
dt-bindings: timer: Add bindings for Intel Keem Bay SoC Timer
clocksource: Add Intel Keem Bay timer support
.../bindings/timer/intel,keembay-timer.yaml | 128 ++++++++++ MAINTAINERS | 6 + drivers/clocksource/Kconfig | 11 + drivers/clocksource/Makefile | 1 + drivers/clocksource/timer-keembay.c | 230 ++++++++++++++++++ 5 files changed, 376 insertions(+) create mode 100644 Documentation/devicetree/bindings/timer/intel,keembay-timer.yaml create mode 100644 drivers/clocksource/timer-keembay.c
base-commit: cfb92440ee71adcc2105b0890bb01ac3cddb8507
Signature · 1 line
2.17.1
PATCH v8 1/2 dt-bindings: timer: Add bindings for Intel Keem Bay SoC Timer
From: Shruthi Sanil <[email protected]>
Add Device Tree bindings for the Timer IP, which can be used as clocksource and clockevent device in the Intel Keem Bay SoC.
--- .../bindings/timer/intel,keembay-timer.yaml | 128 ++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 Documentation/devicetree/bindings/timer/intel,keembay-timer.yaml
Documentation/devicetree/bindings/timer/intel,keembay-timer.yaml new file +128 -0
@@ -0,0 +1,128 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/timer/intel,keembay-timer.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Intel Keem Bay SoC Timers + +maintainers: + - Shruthi Sanil <[email protected]> + +description: | + The Intel Keem Bay timer driver supports 1 free running counter and 8 timers. + Each timer is capable of generating inividual interrupt. + Both the features are enabled through the timer general config register. + + The parent node represents the common general configuration details and + the child nodes represents the counter and timers. + +properties: + compatible: + oneOf: + - items: + - enum: + - intel,keembay-gpt-creg + - const: simple-mfd + + reg: + description: General configuration register address and length. + maxItems: 1 + + ranges: true + + "#address-cells": + const: 1 + + "#size-cells": + const: 1 + +required: + - compatible + - reg + - ranges + - "#address-cells" + - "#size-cells" + +patternProperties: + "^counter@[0-9a-f]+$": + description: Properties for Intel Keem Bay counter. + type: object + properties: + compatible: + oneOf: + - items: + - enum: + - intel,keembay-counter + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + required: + - compatible + - reg + - clocks + + "^timer@[0-9a-f]+$": + description: Properties for Intel Keem Bay timer + type: object + properties: + compatible: + oneOf: + - items: + - enum: + - intel,keembay-timer + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clocks: + maxItems: 1 + + required: + - compatible + - reg + - interrupts + - clocks + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/interrupt-controller/irq.h> + #define KEEM_BAY_A53_TIM + + soc { + #address-cells = <0x2>; + #size-cells = <0x2>; + + gpt@20331000 { + compatible = "intel,keembay-gpt-creg", "simple-mfd"; + reg = <0x0 0x20331000 0x0 0xc>; + ranges = <0x0 0x0 0x20330000 0xF0>; + #address-cells = <0x1>; + #size-cells = <0x1>; + + counter@e8 { + compatible = "intel,keembay-counter"; + reg = <0xe8 0x8>; + clocks = <&scmi_clk KEEM_BAY_A53_TIM>; + }; + + timer@30 { + compatible = "intel,keembay-timer"; + reg = <0x30 0xc>; + interrupts = <GIC_SPI 0x5 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&scmi_clk KEEM_BAY_A53_TIM>; + }; + }; + }; + +...
Signature · 1 line
2.17.1
Rob Herring
maintainerRe: [PATCH v8 1/2] dt-bindings: timer: Add bindings for Intel Keem Bay SoC Timer
Quoted 21 lines · On Tue, Feb 22, 2022 at 03:26:53PM +0530, [email protected] wrote:
From: Shruthi Sanil <[email protected]>
Add Device Tree bindings for the Timer IP, which can be used as clocksource and clockevent device in the Intel Keem Bay SoC.
Reviewed-by Andy Shevchenko <[email protected]>Signed-off-by Shruthi Sanil <[email protected]>--- .../bindings/timer/intel,keembay-timer.yaml | 128 ++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 Documentation/devicetree/bindings/timer/intel,keembay-timer.yamlDocumentation/devicetree/bindings/timer/intel,keembay-timer.yaml new file +3
-0@@ -0,0 +1,128 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +---
Documentation/devicetree/bindings/timer/intel,keembay-timer.yaml line 13
Quoted 10 lines
Documentation/devicetree/bindings/timer/intel,keembay-timer.yaml new file +10
-0+$id: http://devicetree.org/schemas/timer/intel,keembay-timer.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Intel Keem Bay SoC Timers + +maintainers: + - Shruthi Sanil <[email protected]> + +description: | + The Intel Keem Bay timer driver supports 1 free running counter and 8 timers.
Bindings describe the h/w, not what drivers support.
Documentation/devicetree/bindings/timer/intel,keembay-timer.yaml line 23
Quoted 10 lines
Documentation/devicetree/bindings/timer/intel,keembay-timer.yaml new file +10
-0+ Each timer is capable of generating inividual interrupt. + Both the features are enabled through the timer general config register. + + The parent node represents the common general configuration details and + the child nodes represents the counter and timers. + +properties: + compatible: + oneOf: + - items:
Don't need oneOf with only 1 entry.
Quoted 20 lines
Documentation/devicetree/bindings/timer/intel,keembay-timer.yaml new file +20
-0+ - enum: + - intel,keembay-gpt-creg + - const: simple-mfd + + reg: + description: General configuration register address and length. + maxItems: 1 + + ranges: true + + "#address-cells": + const: 1 + + "#size-cells": + const: 1 + +required: + - compatible + - reg + - ranges
Documentation/devicetree/bindings/timer/intel,keembay-timer.yaml line 53
Quoted 10 lines
Documentation/devicetree/bindings/timer/intel,keembay-timer.yaml new file +10
-0+ - "#address-cells" + - "#size-cells" + +patternProperties: + "^counter@[0-9a-f]+$": + description: Properties for Intel Keem Bay counter. + type: object + properties: + compatible: + oneOf:
Don't need oneOf.
Quoted 44 lines
Documentation/devicetree/bindings/timer/intel,keembay-timer.yaml new file +44
-0+ - items: + - enum: + - intel,keembay-counter + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + required: + - compatible + - reg + - clocks + + "^timer@[0-9a-f]+$": + description: Properties for Intel Keem Bay timer + type: object + properties: + compatible: + oneOf: + - items: + - enum: + - intel,keembay-timer + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clocks: + maxItems: 1 + + required: + - compatible + - reg + - interrupts + - clocks + +additionalProperties: false + +examples: + - |
Documentation/devicetree/bindings/timer/intel,keembay-timer.yaml line 107
Quoted 10 lines
Documentation/devicetree/bindings/timer/intel,keembay-timer.yaml new file +10
-0+ #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/interrupt-controller/irq.h> + #define KEEM_BAY_A53_TIM + + soc { + #address-cells = <0x2>; + #size-cells = <0x2>; + + gpt@20331000 { + compatible = "intel,keembay-gpt-creg", "simple-mfd";
It looks like you are splitting things based on Linux implementation details. Does this h/w block have different combinations of timers and counters? If not, then you don't need the child nodes at all. There's plenty of h/w blocks that get used as both a clocksource and clockevent.
Maybe I already raised this, but assume I don't remember and this patch needs to address any questions I already asked.
Quoted 25 lines
Documentation/devicetree/bindings/timer/intel,keembay-timer.yaml new file +21
-0+ reg = <0x0 0x20331000 0x0 0xc>; + ranges = <0x0 0x0 0x20330000 0xF0>; + #address-cells = <0x1>; + #size-cells = <0x1>; + + counter@e8 { + compatible = "intel,keembay-counter"; + reg = <0xe8 0x8>; + clocks = <&scmi_clk KEEM_BAY_A53_TIM>; + }; + + timer@30 { + compatible = "intel,keembay-timer"; + reg = <0x30 0xc>; + interrupts = <GIC_SPI 0x5 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&scmi_clk KEEM_BAY_A53_TIM>; + }; + }; + }; + +...Signature · 1 line
2.17.1
RE: [PATCH v8 1/2] dt-bindings: timer: Add bindings for Intel Keem Bay SoC Timer
Quoted 50 lines
-----Original Message-----
From: Rob Herring <[email protected]>
Sent: Wednesday, February 23, 2022 4:44 AM
To: Sanil, Shruthi <[email protected]>
Cc: [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; Thokala, Srikanth <[email protected]>; Raja Subramanian, Lakshmi Bai <[email protected]>; Sangannavar, Mallikarjunappa <[email protected]>
Subject: Re: [PATCH v8 1/2] dt-bindings: timer: Add bindings for Intel Keem Bay SoC TimerDocumentation/devicetree/bindings/timer/intel,keembay-
Quoted 20 lines · On Tue, Feb 22, 2022 at 03:26:53PM +0530, [email protected] wrote:
From: Shruthi Sanil <[email protected]>
Add Device Tree bindings for the Timer IP, which can be used as clocksource and clockevent device in the Intel Keem Bay SoC.
Reviewed-by Andy Shevchenko <[email protected]>Signed-off-by Shruthi Sanil <[email protected]>--- .../bindings/timer/intel,keembay-timer.yaml | 128 ++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644
Documentation/devicetree/bindings/timer/intel,keembay-timer.yamldiff --git
a/Documentation/devicetree/bindings/timer/intel,keembay-timer.yamlb/Documentation/devicetree/bindings/timer/intel,keembay-timer.yamlnew file mode 100644
index 000000000000..9e6d46ecc2dcDocumentation/devicetree/bindings/timer/intel,keembay- new file +0
-0
timer.yamlDocumentation/devicetree/bindings/timer/intel,keembay- line 12
Quoted 13 lines
Documentation/devicetree/bindings/timer/intel,keembay- new file +12
-0@@ -0,0 +1,128 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) %YAML 1.2 +--- +$id: http://devicetree.org/schemas/timer/intel,keembay-timer.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Intel Keem Bay SoC Timers + +maintainers: + - Shruthi Sanil <[email protected]> + +description: | + The Intel Keem Bay timer driver supports 1 free running counter and 8timers.
Quoted 1 line
Bindings describe the h/w, not what drivers support.
Sorry for adding the word driver here.
Actually the Keem Bay timer IP has 1 free running counter and 8 timers. I'll correct the description explaining clearly that the above are the H/W details.
Quoted 13 lines
Documentation/devicetree/bindings/timer/intel,keembay- line 22
Quoted 11 lines
Documentation/devicetree/bindings/timer/intel,keembay- new file +10
-0+ Each timer is capable of generating inividual interrupt. + Both the features are enabled through the timer general config register. + + The parent node represents the common general configuration details + and the child nodes represents the counter and timers. + +properties: + compatible: + oneOf: + - items:Don't need oneOf with only 1 entry.
OK, I'll correct it in my next patch.
Quoted 25 lines
Quoted 25 lines
Documentation/devicetree/bindings/timer/intel,keembay- new file +24
-0+ - enum: + - intel,keembay-gpt-creg + - const: simple-mfd + + reg: + description: General configuration register address and length. + maxItems: 1 + + ranges: true + + "#address-cells": + const: 1 + + "#size-cells": + const: 1 + +required: + - compatible + - reg + - ranges + - "#address-cells" + - "#size-cells" + +patternProperties:
Quoted 8 lines
Documentation/devicetree/bindings/timer/intel,keembay- line 52
Quoted 6 lines
Documentation/devicetree/bindings/timer/intel,keembay- new file +6
-0+ "^counter@[0-9a-f]+$": + description: Properties for Intel Keem Bay counter. + type: object + properties: + compatible: + oneOf:Don't need oneOf.
OK, I'll correct it in my next patch.
Quoted 52 lines
Quoted 52 lines
Documentation/devicetree/bindings/timer/intel,keembay- new file +51
-0+ - items: + - enum: + - intel,keembay-counter + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + required: + - compatible + - reg + - clocks + + "^timer@[0-9a-f]+$": + description: Properties for Intel Keem Bay timer + type: object + properties: + compatible: + oneOf: + - items: + - enum: + - intel,keembay-timer + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clocks: + maxItems: 1 + + required: + - compatible + - reg + - interrupts + - clocks + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/interrupt-controller/irq.h> + #define KEEM_BAY_A53_TIM + + soc { + #address-cells = <0x2>; + #size-cells = <0x2>;
Quoted 9 lines
Documentation/devicetree/bindings/timer/intel,keembay- line 106
Quoted 3 lines
Documentation/devicetree/bindings/timer/intel,keembay- new file +3
-0+ + gpt@20331000 { + compatible = "intel,keembay-gpt-creg", "simple-mfd";It looks like you are splitting things based on Linux implementation details. Does this h/w block have different combinations of timers and counters? If not, then you don't need the child nodes at all. There's plenty of h/w blocks that get used as both a clocksource and clockevent.
Yes, the Timer H/W block has 1 free running counter and 8 timers.
These timers and counter are enabled using a common configuration register. Hence we have a parent node which has the details of this common configuration register And the child nodes with their register and interrupt details.
Quoted 2 lines
Maybe I already raised this, but assume I don't remember and this patch needs to address any questions I already asked.
All the review comments given by you in the series of this patch are addressed.
In the example below, I have just added the details of one timer. But in actual we have a total of 8 timers.
I can update all the 8 if that's required to be updated.
Quoted 26 lines
Quoted 26 lines
Documentation/devicetree/bindings/timer/intel,keembay- new file +21
-1+ reg = <0x0 0x20331000 0x0 0xc>; + ranges = <0x0 0x0 0x20330000 0xF0>; + #address-cells = <0x1>; + #size-cells = <0x1>; + + counter@e8 { + compatible = "intel,keembay-counter"; + reg = <0xe8 0x8>; + clocks = <&scmi_clk KEEM_BAY_A53_TIM>; + }; + + timer@30 { + compatible = "intel,keembay-timer"; + reg = <0x30 0xc>; + interrupts = <GIC_SPI 0x5 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&scmi_clk KEEM_BAY_A53_TIM>; + }; + }; + }; + +... --2.17.1
Re: [PATCH v8 1/2] dt-bindings: timer: Add bindings for Intel Keem Bay SoC Timer
In reply to Rob HerringQuoted 5 lines · Rob Herring
Quoted 4 lines · On Tue, Feb 22, 2022 at 03:26:53PM +0530, [email protected] wrote:
From: Shruthi Sanil <[email protected]>
Add Device Tree bindings for the Timer IP, which can be used as clocksource and clockevent device in the Intel Keem Bay SoC.
...
Quoted 7 lines
Documentation/devicetree/bindings/timer/intel,keembay-timer.yaml line 107
Quoted 6 lines
Documentation/devicetree/bindings/timer/intel,keembay-timer.yaml new file +6
-0+ soc { + #address-cells = <0x2>; + #size-cells = <0x2>; + + gpt@20331000 { + compatible = "intel,keembay-gpt-creg", "simple-mfd";
Quoted 7 lines
It looks like you are splitting things based on Linux implementation details. Does this h/w block have different combinations of timers and counters? If not, then you don't need the child nodes at all. There's plenty of h/w blocks that get used as both a clocksource and clockevent.
Maybe I already raised this, but assume I don't remember and this patch needs to address any questions I already asked.
I dunno if I mentioned that hardware seems to have 5 or so devices behind the block, so ideally it should be one device node that represents the global register spaces and several children nodes.
However, I am not familiar with the established practices in DT world, but above seems to me the right thing to do since it describes the hardware as is (without any linuxisms).
Quoted 19 lines
Quoted 19 lines
Documentation/devicetree/bindings/timer/intel,keembay-timer.yaml new file +19
-0+ reg = <0x0 0x20331000 0x0 0xc>; + ranges = <0x0 0x0 0x20330000 0xF0>; + #address-cells = <0x1>; + #size-cells = <0x1>; + + counter@e8 { + compatible = "intel,keembay-counter"; + reg = <0xe8 0x8>; + clocks = <&scmi_clk KEEM_BAY_A53_TIM>; + }; + + timer@30 { + compatible = "intel,keembay-timer"; + reg = <0x30 0xc>; + interrupts = <GIC_SPI 0x5 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&scmi_clk KEEM_BAY_A53_TIM>; + }; + }; + };
Signature · 2 lines
With Best Regards, Andy Shevchenko
Rob Herring
maintainerRe: [PATCH v8 1/2] dt-bindings: timer: Add bindings for Intel Keem Bay SoC Timer
Quoted 22 lines · Andy Shevchenko
Quoted 5 lines · Rob Herring
Quoted 4 lines · On Tue, Feb 22, 2022 at 03:26:53PM +0530, [email protected] wrote:
From: Shruthi Sanil <[email protected]>
Add Device Tree bindings for the Timer IP, which can be used as clocksource and clockevent device in the Intel Keem Bay SoC.
...
Quoted 12 lines
Documentation/devicetree/bindings/timer/intel,keembay-timer.yaml line 107
Quoted 6 lines
Documentation/devicetree/bindings/timer/intel,keembay-timer.yaml new file +6
-0+ soc { + #address-cells = <0x2>; + #size-cells = <0x2>; + + gpt@20331000 { + compatible = "intel,keembay-gpt-creg", "simple-mfd";It looks like you are splitting things based on Linux implementation details. Does this h/w block have different combinations of timers and counters? If not, then you don't need the child nodes at all. There's plenty of h/w blocks that get used as both a clocksource and clockevent.
Quoted 6 lines
Quoted 2 lines
Maybe I already raised this, but assume I don't remember and this patch needs to address any questions I already asked.
I dunno if I mentioned that hardware seems to have 5 or so devices behind the block, so ideally it should be one device node that represents the global register spaces and several children nodes.
Is it 5 devices or 9 devices?
Quoted 3 lines
However, I am not familiar with the established practices in DT world, but above seems to me the right thing to do since it describes the hardware as is (without any linuxisms).
The Linuxism in these cases defining 1 node per driver because that's what is convenient for automatic probing. That appears to be exactly the case here. The red flag is nodes with a compatible and nothing else. The next question is whether the sub-devices are blocks that will be assembled in varying combinations and quantities. If not, then not much point subdividing the h/w blocks.
There's also many cases of having multiple 'identical' timers and wanting to encode which timer gets assigned to clocksource vs. clockevent. But those 'identical' timers aren't if you care about which timer gets assigned where. I *think* that's not the case here unless you are trying to pick the timer for the clockevent by not defining the other timers.
Without having a complete picture of what's in 'gpt-creg', I can't give better advice.
Rob
Re: [PATCH v8 1/2] dt-bindings: timer: Add bindings for Intel Keem Bay SoC Timer
Quoted 24 lines · Rob Herring
Quoted 22 lines · Andy Shevchenko
Quoted 5 lines · Rob Herring
Quoted 4 lines · On Tue, Feb 22, 2022 at 03:26:53PM +0530, [email protected] wrote:
From: Shruthi Sanil <[email protected]>
Add Device Tree bindings for the Timer IP, which can be used as clocksource and clockevent device in the Intel Keem Bay SoC.
...
Quoted 12 lines
Documentation/devicetree/bindings/timer/intel,keembay-timer.yaml line 107
Quoted 6 lines
Documentation/devicetree/bindings/timer/intel,keembay-timer.yaml new file +6
-0+ soc { + #address-cells = <0x2>; + #size-cells = <0x2>; + + gpt@20331000 { + compatible = "intel,keembay-gpt-creg", "simple-mfd";It looks like you are splitting things based on Linux implementation details. Does this h/w block have different combinations of timers and counters? If not, then you don't need the child nodes at all. There's plenty of h/w blocks that get used as both a clocksource and clockevent.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Maybe I already raised this, but assume I don't remember and this patch needs to address any questions I already asked.
I dunno if I mentioned that hardware seems to have 5 or so devices behind the block, so ideally it should be one device node that represents the global register spaces and several children nodes.
Is it 5 devices or 9 devices?
5 devices, one of which is a timer block out of 8 timers. You may count them as 12 altogether.
Quoted 10 lines
Quoted 3 lines
However, I am not familiar with the established practices in DT world, but above seems to me the right thing to do since it describes the hardware as is (without any linuxisms).
The Linuxism in these cases defining 1 node per driver because that's what is convenient for automatic probing. That appears to be exactly the case here. The red flag is nodes with a compatible and nothing else. The next question is whether the sub-devices are blocks that will be assembled in varying combinations and quantities. If not, then not much point subdividing the h/w blocks.
AFAIU the hardware architecture the amount of timers is dependent on the IP synthesis configuration. On this platform it's 8, but it may be 1 or 2, for example.
Quoted 9 lines
There's also many cases of having multiple 'identical' timers and wanting to encode which timer gets assigned to clocksource vs. clockevent. But those 'identical' timers aren't if you care about which timer gets assigned where. I *think* that's not the case here unless you are trying to pick the timer for the clockevent by not defining the other timers.
Without having a complete picture of what's in 'gpt-creg', I can't give better advice.
I guess they need to share TRM, if possible, to show what this block is.
Signature · 2 lines
With Best Regards, Andy Shevchenko
RE: [PATCH v8 1/2] dt-bindings: timer: Add bindings for Intel Keem Bay SoC Timer
Quoted 64 lines
-----Original Message-----
From: Andy Shevchenko <[email protected]>
Sent: Tuesday, March 8, 2022 3:44 PM
To: Rob Herring <[email protected]>
Cc: Sanil, Shruthi <[email protected]>; Daniel Lezcano <[email protected]>; Thomas Gleixner <[email protected]>; linux- [email protected]; [email protected]; Mark Gross <[email protected]>; Thokala, Srikanth <[email protected]>; Raja Subramanian, Lakshmi Bai <[email protected]>; Sangannavar, Mallikarjunappa <[email protected]>
Subject: Re: [PATCH v8 1/2] dt-bindings: timer: Add bindings for Intel Keem Bay SoC TimerQuoted 5 lines · Rob Herring
Quoted 3 lines · Andy Shevchenko
Quoted 1 line · Rob Herring
On Tue, Feb 22, 2022 at 03:26:53PM +0530, [email protected]
Quoted 15 lines · wrote:
Quoted 15 lines
Quoted 4 lines
Quoted 4 lines
From: Shruthi Sanil <[email protected]>
Add Device Tree bindings for the Timer IP, which can be used as clocksource and clockevent device in the Intel Keem Bay SoC.
...
Quoted 8 lines
Quoted 7 lines
Documentation/devicetree/bindings/timer/intel,keembay-timer.yaml new file +7
-0+ soc { + #address-cells = <0x2>; + #size-cells = <0x2>; + + gpt@20331000 { + compatible = "intel,keembay-gpt-creg", + "simple-mfd";Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
It looks like you are splitting things based on Linux implementation details. Does this h/w block have different combinations of timers and counters? If not, then you don't need the child nodes at all. There's plenty of h/w blocks that get used as both
a clocksource and clockevent.
Quoted 9 lines
Quoted 7 lines
Quoted 3 lines
Maybe I already raised this, but assume I don't remember and this patch needs to address any questions I already asked.
I dunno if I mentioned that hardware seems to have 5 or so devices behind the block, so ideally it should be one device node that represents the global register spaces and several children nodes.
Is it 5 devices or 9 devices?
5 devices, one of which is a timer block out of 8 timers. You may count them as 12 altogether.
Quoted 10 lines
Quoted 3 lines
However, I am not familiar with the established practices in DT world, but above seems to me the right thing to do since it describes the hardware as is (without any linuxisms).
The Linuxism in these cases defining 1 node per driver because that's what is convenient for automatic probing. That appears to be exactly the case here. The red flag is nodes with a compatible and nothing else. The next question is whether the sub-devices are blocks that will be assembled in varying combinations and quantities. If not, then not much point subdividing the h/w blocks.
Quoted 3 lines
AFAIU the hardware architecture the amount of timers is dependent on the IP synthesis configuration. On this platform it's 8, but it may be 1 or 2, for example.
Yes, the number of timers can vary between platforms.
For eg., Intel Keem Bay SoC has 8 timers where as in Intel Thunder Bay SoC has 6 timers.
Quoted 8 lines
Quoted 8 lines
There's also many cases of having multiple 'identical' timers and wanting to encode which timer gets assigned to clocksource vs. clockevent. But those 'identical' timers aren't if you care about which timer gets assigned where. I *think* that's not the case here unless you are trying to pick the timer for the clockevent by not defining the other timers.
Quoted 5 lines
Quoted 2 lines
Without having a complete picture of what's in 'gpt-creg', I can't give better advice.
I guess they need to share TRM, if possible, to show what this block is.
I would like to explain briefly about the Timer IP in the Keem Bay Soc.
The Timers block contains 8 general purpose timers, a free running counter. Each general purpose timer can generate an individual interrupt to the interrupt controller. The timer block consists of secure and non-secure timers. Hence there are secure and non-secure registers in separate address banks.
The secure register bank consists of the common control register where the timers and counters need to be enabled.
From the driver we try to check if these bits are enabled to continue with the initialization of the driver.
Hence we need to pass the base address of both the address banks to the driver from the DTB.
The control register is common for both timer and counter. Hence we went for parent child module in DTB. 'gpt-creg' represents this control register.
Quoted 4 lines
--
With Best Regards,
Andy Shevchenko
RE: [PATCH v8 1/2] dt-bindings: timer: Add bindings for Intel Keem Bay SoC Timer
In reply to Andy ShevchenkoHi Rob,
I tried to the technical manual that could be shared publicly, but couldn't find one which had the timer IP details. In the email below I have tried to answer your question. Could you please let me know if I was able to answer your question? Can we try to discuss and close it in the best possible way? Need your help in taking this patch forward?
Regards,
Shruthi
Quoted 122 lines
-----Original Message-----
From: Sanil, Shruthi
Sent: Friday, March 18, 2022 11:07 AM
To: Andy Shevchenko <[email protected]>; Rob Herring <[email protected]>
Cc: Daniel Lezcano <[email protected]>; Thomas Gleixner <[email protected]>; [email protected]; [email protected]; Mark Gross <[email protected]>; Thokala, Srikanth <[email protected]>; Raja Subramanian, Lakshmi Bai <[email protected]>; Sangannavar, Mallikarjunappa <[email protected]>
Subject: RE: [PATCH v8 1/2] dt-bindings: timer: Add bindings for Intel Keem Bay SoC TimerQuoted 67 lines
-----Original Message-----
From: Andy Shevchenko <[email protected]>
Sent: Tuesday, March 8, 2022 3:44 PM
To: Rob Herring <[email protected]>
Cc: Sanil, Shruthi <[email protected]>; Daniel Lezcano <[email protected]>; Thomas Gleixner <[email protected]>; linux- [email protected]; [email protected]; Mark Gross <[email protected]>; Thokala, Srikanth <[email protected]>; Raja Subramanian, Lakshmi Bai <[email protected]>;
Sangannavar, Mallikarjunappa <[email protected]>
Subject: Re: [PATCH v8 1/2] dt-bindings: timer: Add bindings for Intel Keem Bay SoC TimerQuoted 6 lines · Rob Herring
Quoted 4 lines · Andy Shevchenko
Quoted 2 lines · Rob Herring
On Tue, Feb 22, 2022 at 03:26:53PM +0530,
[email protected]Quoted 15 lines · wrote:
Quoted 15 lines
Quoted 4 lines
Quoted 4 lines
From: Shruthi Sanil <[email protected]>
Add Device Tree bindings for the Timer IP, which can be used as clocksource and clockevent device in the Intel Keem Bay SoC.
...
Quoted 8 lines
Quoted 7 lines
Documentation/devicetree/bindings/timer/intel,keembay-timer.yaml new file +7
-0+ soc { + #address-cells = <0x2>; + #size-cells = <0x2>; + + gpt@20331000 { + compatible = "intel,keembay-gpt-creg", + "simple-mfd";Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
It looks like you are splitting things based on Linux implementation details. Does this h/w block have different combinations of timers and counters? If not, then you don't need the child nodes at all. There's plenty of h/w blocks that get used as both
a clocksource and clockevent.
Quoted 9 lines
Quoted 7 lines
Quoted 3 lines
Maybe I already raised this, but assume I don't remember and this patch needs to address any questions I already asked.
I dunno if I mentioned that hardware seems to have 5 or so devices behind the block, so ideally it should be one device node that represents the global register spaces and several children nodes.
Is it 5 devices or 9 devices?
5 devices, one of which is a timer block out of 8 timers. You may count them as 12 altogether.
Quoted 10 lines
Quoted 3 lines
However, I am not familiar with the established practices in DT world, but above seems to me the right thing to do since it describes the hardware as is (without any linuxisms).
The Linuxism in these cases defining 1 node per driver because that's what is convenient for automatic probing. That appears to be exactly the case here. The red flag is nodes with a compatible and nothing else. The next question is whether the sub-devices are blocks that will be assembled in varying combinations and quantities. If not, then not much point subdividing the h/w blocks.
Quoted 3 lines
AFAIU the hardware architecture the amount of timers is dependent on the IP synthesis configuration. On this platform it's 8, but it may be 1 or 2, for example.
Yes, the number of timers can vary between platforms.
For eg., Intel Keem Bay SoC has 8 timers where as in Intel Thunder Bay SoC has 6 timers.Quoted 8 lines
Quoted 8 lines
There's also many cases of having multiple 'identical' timers and wanting to encode which timer gets assigned to clocksource vs. clockevent. But those 'identical' timers aren't if you care about which timer gets assigned where. I *think* that's not the case here unless you are trying to pick the timer for the clockevent by not defining the other timers.
Quoted 5 lines
Quoted 2 lines
Without having a complete picture of what's in 'gpt-creg', I can't give better advice.
I guess they need to share TRM, if possible, to show what this block is.
I would like to explain briefly about the Timer IP in the Keem Bay Soc. The Timers block contains 8 general purpose timers, a free running counter. Each general purpose timer can generate an individual interrupt to the interrupt controller.
The timer block consists of secure and non-secure timers. Hence there are secure and non-secure registers in separate address banks.
The secure register bank consists of the common control register where the timers and counters need to be enabled.
From the driver we try to check if these bits are enabled to continue with the initialization of the driver.
Hence we need to pass the base address of both the address banks to the driver from the DTB.
The control register is common for both timer and counter. Hence we went for parent child module in DTB. 'gpt-creg' represents this control register.Quoted 4 lines
--
With Best Regards,
Andy Shevchenko
RE: [PATCH v8 1/2] dt-bindings: timer: Add bindings for Intel Keem Bay SoC Timer
In reply to Andy ShevchenkoHi Rob,
Quoted 103 lines
-----Original Message-----
From: Sanil, Shruthi
Sent: Friday, March 18, 2022 11:07 AM
To: Andy Shevchenko <[email protected]>; Rob Herring <[email protected]>
Cc: Daniel Lezcano <[email protected]>; Thomas Gleixner <[email protected]>; [email protected]; [email protected]; Mark Gross <[email protected]>; Thokala, Srikanth <[email protected]>; Raja Subramanian, Lakshmi Bai <[email protected]>; Sangannavar, Mallikarjunappa <[email protected]>
Subject: RE: [PATCH v8 1/2] dt-bindings: timer: Add bindings for Intel Keem Bay SoC TimerQuoted 67 lines
-----Original Message-----
From: Andy Shevchenko <[email protected]>
Sent: Tuesday, March 8, 2022 3:44 PM
To: Rob Herring <[email protected]>
Cc: Sanil, Shruthi <[email protected]>; Daniel Lezcano <[email protected]>; Thomas Gleixner <[email protected]>; linux- [email protected]; [email protected]; Mark Gross <[email protected]>; Thokala, Srikanth <[email protected]>; Raja Subramanian, Lakshmi Bai <[email protected]>;
Sangannavar, Mallikarjunappa <[email protected]>
Subject: Re: [PATCH v8 1/2] dt-bindings: timer: Add bindings for Intel Keem Bay SoC TimerQuoted 6 lines · Rob Herring
Quoted 4 lines · Andy Shevchenko
Quoted 2 lines · Rob Herring
On Tue, Feb 22, 2022 at 03:26:53PM +0530,
[email protected]Quoted 15 lines · wrote:
Quoted 15 lines
Quoted 4 lines
Quoted 4 lines
From: Shruthi Sanil <[email protected]>
Add Device Tree bindings for the Timer IP, which can be used as clocksource and clockevent device in the Intel Keem Bay SoC.
...
Quoted 8 lines
Quoted 7 lines
Documentation/devicetree/bindings/timer/intel,keembay-timer.yaml new file +7
-0+ soc { + #address-cells = <0x2>; + #size-cells = <0x2>; + + gpt@20331000 { + compatible = "intel,keembay-gpt-creg", + "simple-mfd";Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
It looks like you are splitting things based on Linux implementation details. Does this h/w block have different combinations of timers and counters? If not, then you don't need the child nodes at all. There's plenty of h/w blocks that get used as both
a clocksource and clockevent.
Quoted 9 lines
Quoted 7 lines
Quoted 3 lines
Maybe I already raised this, but assume I don't remember and this patch needs to address any questions I already asked.
I dunno if I mentioned that hardware seems to have 5 or so devices behind the block, so ideally it should be one device node that represents the global register spaces and several children nodes.
Is it 5 devices or 9 devices?
5 devices, one of which is a timer block out of 8 timers. You may count them as 12 altogether.
Quoted 10 lines
Quoted 3 lines
However, I am not familiar with the established practices in DT world, but above seems to me the right thing to do since it describes the hardware as is (without any linuxisms).
The Linuxism in these cases defining 1 node per driver because that's what is convenient for automatic probing. That appears to be exactly the case here. The red flag is nodes with a compatible and nothing else. The next question is whether the sub-devices are blocks that will be assembled in varying combinations and quantities. If not, then not much point subdividing the h/w blocks.
Quoted 3 lines
AFAIU the hardware architecture the amount of timers is dependent on the IP synthesis configuration. On this platform it's 8, but it may be 1 or 2, for example.
Yes, the number of timers can vary between platforms.
For eg., Intel Keem Bay SoC has 8 timers where as in Intel Thunder Bay SoC has 6 timers.Quoted 8 lines
Quoted 8 lines
There's also many cases of having multiple 'identical' timers and wanting to encode which timer gets assigned to clocksource vs. clockevent. But those 'identical' timers aren't if you care about which timer gets assigned where. I *think* that's not the case here unless you are trying to pick the timer for the clockevent by not defining the other timers.
Quoted 5 lines
Quoted 2 lines
Without having a complete picture of what's in 'gpt-creg', I can't give better advice.
I guess they need to share TRM, if possible, to show what this block is.
Quoted 15 lines
I would like to explain briefly about the Timer IP in the Keem Bay Soc. The Timers block contains 8 general purpose timers, a free running counter. Each general purpose timer can generate an individual interrupt to the interrupt controller.
The timer block consists of secure and non-secure timers. Hence there are secure and non-secure registers in separate address banks.
The secure register bank consists of the common control register where the timers and counters need to be enabled.
From the driver we try to check if these bits are enabled to continue with the initialization of the driver.
Hence we need to pass the base address of both the address banks to the driver from the DTB.
The control register is common for both timer and counter. Hence we went for parent child module in DTB. 'gpt-creg' represents this control register.
I tried to get the technical manual that could be shared publicly, but couldn't find one which has the timer IP details.
In the previous reply above, I have tried to explain the details of the Timer IP. Could you please let me know if I was able to answer your question?
I think the concern point here is the common register that needs to be accessed by the timer during initialization. Same address cannot be defined in multiple timer nodes and also we cannot have this in the driver too as offset because this offset is changing from platform to platform. Hence we have gone with the parent child approach. I need your help here on whats the best possible way to do this?
I need your support in taking this patch forward?
Quoted 4 lines
Quoted 4 lines
--
With Best Regards,
Andy Shevchenko
PATCH v8 2/2 clocksource: Add Intel Keem Bay timer support
In reply to [email protected]From: Shruthi Sanil <[email protected]>
The Intel Keem Bay timer driver supports clocksource and clockevent features for the timer IP used in Intel Keem Bay SoC.
The timer block supports 1 free running counter and 8 timers. The free running counter can be used as a clocksource and the timers can be used as clockevent. Each timer is capable of generating individual interrupt.
Both the features are enabled through the timer general config register.
--- MAINTAINERS | 6 + drivers/clocksource/Kconfig | 11 ++ drivers/clocksource/Makefile | 1 + drivers/clocksource/timer-keembay.c | 230 ++++++++++++++++++++++++++++ 4 files changed, 248 insertions(+) create mode 100644 drivers/clocksource/timer-keembay.c
MAINTAINERS +6 -0
@@ -9796,6 +9796,12 @@ F: drivers/crypto/keembay/keembay-ocs-hcu-core.c F: drivers/crypto/keembay/ocs-hcu.c F: drivers/crypto/keembay/ocs-hcu.h +INTEL KEEM BAY TIMER DRIVER +M: Shruthi Sanil <[email protected]> +S: Maintained +F: Documentation/devicetree/bindings/timer/intel,keembay-timer.yaml +F: drivers/clocksource/timer-keembay.c + INTEL THUNDER BAY EMMC PHY DRIVER M: Nandhini Srikandan <[email protected]> M: Rashmi A <[email protected]>
drivers/clocksource/Kconfig +11 -0
@@ -721,4 +721,15 @@ config MICROCHIP_PIT64B modes and high resolution. It is used as a clocksource and a clockevent. +config KEEMBAY_TIMER + bool "Intel Keem Bay timer" + depends on ARCH_KEEMBAY || COMPILE_TEST + select TIMER_OF + help + This option enables the support for the Intel Keem Bay + general purpose timer and free running counter driver. + Each timer can generate an individual interrupt and + supports oneshot and periodic modes. + The 64-bit counter can be used as a clock source. + endmenu
drivers/clocksource/Makefile +1 -0
@@ -89,3 +89,4 @@ obj-$(CONFIG_GX6605S_TIMER) += timer-gx6605s.o obj-$(CONFIG_HYPERV_TIMER) += hyperv_timer.o obj-$(CONFIG_MICROCHIP_PIT64B) += timer-microchip-pit64b.o obj-$(CONFIG_MSC313E_TIMER) += timer-msc313e.o +obj-$(CONFIG_KEEMBAY_TIMER) += timer-keembay.o
drivers/clocksource/timer-keembay.c new file +230 -0
230 lines not on this page · raw message
Signature · 1 line
2.17.1
RE: [PATCH v8 2/2] clocksource: Add Intel Keem Bay timer support
Hello Daniel and Thomas,
Could you please help review this patch?
Regards,
Shruthi
Quoted 312 lines
-----Original Message-----
From: Sanil, Shruthi <[email protected]>
Sent: Tuesday, February 22, 2022 3:27 PM
To: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; Thokala, Srikanth <[email protected]>; Raja Subramanian, Lakshmi Bai <[email protected]>; Sangannavar, Mallikarjunappa <[email protected]>; Sanil, Shruthi <[email protected]>
Subject: [PATCH v8 2/2] clocksource: Add Intel Keem Bay timer supportFrom: Shruthi Sanil <[email protected]>
The Intel Keem Bay timer driver supports clocksource and clockevent features for the timer IP used in Intel Keem Bay SoC.
The timer block supports 1 free running counter and 8 timers.
The free running counter can be used as a clocksource and the timers can be used as clockevent. Each timer is capable of generating individual interrupt. Both the features are enabled through the timer general config register.Reviewed-by Andy Shevchenko <[email protected]>Signed-off-by Shruthi Sanil <[email protected]>--- MAINTAINERS | 6 + drivers/clocksource/Kconfig | 11 ++ drivers/clocksource/Makefile | 1 + drivers/clocksource/timer-keembay.c | 230 ++++++++++++++++++++++++++++ 4 files changed, 248 insertions(+) create mode 100644 drivers/clocksource/timer-keembay.cMAINTAINERS +0
-0@@ -9796,6 +9796,12 @@ F: drivers/crypto/keembay/keembay-ocs-hcu-
core.c
F:drivers/crypto/keembay/ocs-hcu.c
F:drivers/crypto/keembay/ocs-hcu.hMAINTAINERS +4
-0+INTEL KEEM BAY TIMER DRIVER +M: Shruthi Sanil <[email protected]> +S: Maintained +F: Documentation/devicetree/bindings/timer/intel,keembay-
timer.yamlMAINTAINERS +2
-0+F: drivers/clocksource/timer-keembay.c + INTEL THUNDER BAY EMMC PHY DRIVER M: Nandhini Srikandan <[email protected]> M: Rashmi A <[email protected]>drivers/clocksource/Kconfig index renamed from drivers/clocksource/Kconfig +0
-0
cfb8ea0df3b1..65b6cf916e5a100644drivers/clocksource/Kconfig +11
-0@@ -721,4 +721,15 @@ config MICROCHIP_PIT64B modes and high resolution. It is used as a clocksource and a clockevent. +config KEEMBAY_TIMER + bool "Intel Keem Bay timer" + depends on ARCH_KEEMBAY || COMPILE_TEST + select TIMER_OF + help + This option enables the support for the Intel Keem Bay + general purpose timer and free running counter driver. + Each timer can generate an individual interrupt and + supports oneshot and periodic modes. + The 64-bit counter can be used as a clock source. + endmenudrivers/clocksource/Makefile +0
-0@@ -89,3 +89,4 @@ obj-$(CONFIG_GX6605S_TIMER) += timer-gx6605s.o
obj-$(CONFIG_HYPERV_TIMER) += hyperv_timer.o
obj-$(CONFIG_MICROCHIP_PIT64B) += timer-microchip-pit64b.o
obj-$(CONFIG_MSC313E_TIMER) += timer-msc313e.odrivers/clocksource/Makefile +1
-0+obj-$(CONFIG_KEEMBAY_TIMER) += timer-keembay.odrivers/clocksource/timer-keembay.c new file +70
-0@@ -0,0 +1,230 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Intel Keem Bay Timer driver +* +* Copyright (C) 2020 Intel Corporation */ + +#include <linux/bitops.h> +#include <linux/interrupt.h> +#include <linux/io-64-nonatomic-lo-hi.h> #include <linux/mfd/syscon.h> +#include <linux/module.h> #include <linux/of_address.h> #include +<linux/sizes.h> #include <linux/slab.h> #include <linux/regmap.h> + +#include "timer-of.h" + +/* Timer register offset */ +#define TIM_CNT_VAL_OFFSET 0x0 +#define TIM_RELOAD_VAL_OFFSET 0x4 +#define TIM_CONFIG_OFFSET 0x8 + +/* Bit fields of timer general config register */ +#define TIM_CONFIG_PRESCALER_ENABLE BIT(2) +#define TIM_CONFIG_COUNTER_ENABLE BIT(0) + +/* Bit fields of timer config register */ +#define TIM_CONFIG_INTERRUPT_PENDING BIT(4) +#define TIM_CONFIG_INTERRUPT_ENABLE BIT(2) +#define TIM_CONFIG_RESTART BIT(1) +#define TIM_CONFIG_ENABLE BIT(0) + +#define TIM_GEN_MASK GENMASK(31, 12) +#define TIM_RATING 200 +#define TIM_CLKSRC_MASK_BITS 64 + +#define TIMER_NAME_SIZE 25 + +static inline void keembay_timer_enable (void __iomem *base,u32 flags) +{ +writel (TIM_CONFIG_ENABLE | flags, base +TIM_CONFIG_OFFSET ); } + +static inline void keembay_timer_disable (void __iomem *base) { +writel (0x0 , base +TIM_CONFIG_OFFSET ); } + +static inline void keembay_timer_update_counter (void __iomem *base,u32 +val) { +writel (val, base +TIM_CNT_VAL_OFFSET ); +writel (val, base +TIM_RELOAD_VAL_OFFSET ); } + +static inline void keembay_timer_clear_pending_int (void __iomem *base) +{ +u32 val; + + val =readl (base +TIM_CONFIG_OFFSET ); + val &= ~TIM_CONFIG_INTERRUPT_PENDING ; +writel (val, base +TIM_CONFIG_OFFSET ); } + +static int keembay_timer_set_next_event (unsigned long evt,struct +clock_event_device *ce) { +u32 flags =TIM_CONFIG_INTERRUPT_ENABLE ; +struct timer_of *to =to_timer_of (ce); +void __iomem *tim_base =timer_of_base (to); + +keembay_timer_disable (tim_base); +keembay_timer_update_counter (tim_base, evt); +keembay_timer_enable (tim_base, flags); + +return 0 ; +} + +static int keembay_timer_periodic (struct clock_event_device *ce) { + u32 flags = TIM_CONFIG_INTERRUPT_ENABLE |
TIM_CONFIG_RESTART;drivers/clocksource/timer-keembay.c new file +64
-0+struct timer_of *to =to_timer_of (ce); +void __iomem *tim_base =timer_of_base (to); + +keembay_timer_disable (tim_base); +keembay_timer_update_counter (tim_base,timer_of_period (to)); +keembay_timer_enable (tim_base, flags); + +return 0 ; +} + +static int keembay_timer_shutdown (struct clock_event_device *ce) { +struct timer_of *to =to_timer_of (ce); + +keembay_timer_disable (timer_of_base (to)); + +return 0 ; +} + +static irqreturn_t keembay_timer_isr (int irq,void *dev_id) { +struct clock_event_device *evt = dev_id; +struct timer_of *to =to_timer_of (evt); +void __iomem *tim_base =timer_of_base (to); +u32 val; + + val =readl (tim_base +TIM_CONFIG_OFFSET ); + +if (val &TIM_CONFIG_RESTART ) { +/* Clear interrupt for periodic timer*/ +keembay_timer_clear_pending_int (tim_base); + }else { +/* Disable the timer for one shot timer */ +keembay_timer_disable (tim_base); + } + + evt->event_handler (evt); + +return IRQ_HANDLED ; +} + +static int __init keembay_clockevent_init (struct device_node *np) { +struct timer_of *keembay_ce_to; +struct regmap *regmap; +int ret; +u32 val; + + regmap =device_node_to_regmap (np->parent); +if (IS_ERR (regmap)) +return PTR_ERR (regmap); + + ret =regmap_read (regmap,TIM_CONFIG_OFFSET , &val); +if (ret) +return ret; + +/* Prescaler bit must be enabled for the timer to function */ +if (!(val &TIM_CONFIG_PRESCALER_ENABLE )) { +pr_err ("%pOF: Prescaler is not enabled\n" , np); + ret = -ENODEV ; + } + + keembay_ce_to =kzalloc (sizeof (*keembay_ce_to),GFP_KERNEL ); +if (!keembay_ce_to) + ret = -ENOMEM ; + + keembay_ce_to->flags = TIMER_OF_IRQ | TIMER_OF_BASE |
TIMER_OF_CLOCK;drivers/clocksource/timer-keembay.c new file +7
-0+ keembay_ce_to->clkevt.name ="keembay_timer" ; + keembay_ce_to->clkevt.cpumask = cpu_possible_mask; + keembay_ce_to->clkevt.features =CLOCK_EVT_FEAT_PERIODIC | +CLOCK_EVT_FEAT_ONESHOT | +CLOCK_EVT_FEAT_DYNIRQ ; + keembay_ce_to->clkevt.rating =TIM_RATING ; + keembay_ce_to->clkevt.set_next_event =
keembay_timer_set_next_event;drivers/clocksource/timer-keembay.c new file +1
-0+ keembay_ce_to->clkevt.set_state_periodic =
keembay_timer_periodic;drivers/clocksource/timer-keembay.c new file +1
-0+ keembay_ce_to->clkevt.set_state_shutdown =
keembay_timer_shutdown;drivers/clocksource/timer-keembay.c new file +12
-0+ keembay_ce_to->of_irq.handler = keembay_timer_isr; + keembay_ce_to->of_irq.flags =IRQF_TIMER ; + + ret =timer_of_init (np, keembay_ce_to); +if (ret) + goto err_keembay_ce_to_free; + + ret =regmap_read (regmap,TIM_RELOAD_VAL_OFFSET , &val); +if (ret) + goto err_keembay_ce_to_free; + + keembay_ce_to->of_clk.rate = keembay_ce_to->of_clk.rate / (val +1);
drivers/clocksource/timer-keembay.c new file +45
-0+ +clockevents_config_and_register (&keembay_ce_to->clkevt, +timer_of_rate (keembay_ce_to), +1 , +U32_MAX ); + +return 0 ; + +err_keembay_ce_to_free: +kfree (keembay_ce_to); + +return ret; +} + +static struct timer_of keembay_cs_to = { + .flags =TIMER_OF_BASE |TIMER_OF_CLOCK , +}; + +static u64 notrace keembay_clocksource_read(struct clocksource *cs) { +return lo_hi_readq (timer_of_base (&keembay_cs_to)); +} + +static struct clocksource keembay_counter = { + .name ="keembay_sys_counter" , + .rating =TIM_RATING , + .read = keembay_clocksource_read, + .mask =CLOCKSOURCE_MASK (TIM_CLKSRC_MASK_BITS ), + .flags =CLOCK_SOURCE_IS_CONTINUOUS | +CLOCK_SOURCE_SUSPEND_NONSTOP , +}; + +static int __init keembay_clocksource_init (struct device_node *np) { +struct regmap *regmap; +u32 val; +int ret; + + regmap =device_node_to_regmap (np->parent); +if (IS_ERR (regmap)) +return PTR_ERR (regmap); + + ret =regmap_read (regmap,TIM_CONFIG_OFFSET , &val); +if (ret) +return ret; + +/* Free Running Counter bit must be enabled for counter to function */
drivers/clocksource/timer-keembay.c new file +15
-1+if (!(val &TIM_CONFIG_COUNTER_ENABLE )) { +pr_err ("%pOF: free running counter is not enabled\n" , np); +return -ENODEV ; + } + + ret =timer_of_init (np, &keembay_cs_to); +if (ret) +return ret; + +return clocksource_register_hz (&keembay_counter, +timer_of_rate (&keembay_cs_to)); } + +TIMER_OF_DECLARE (keembay_clockevent,"intel,keembay-timer" , +keembay_clockevent_init);TIMER_OF_DECLARE (keembay_clocksource, +"intel,keembay-counter" , keembay_clocksource_init); --2.17.1
Re: [PATCH v8 2/2] clocksource: Add Intel Keem Bay timer support
In reply to [email protected]Quoted 173 lines · On 22/02/2022 10:56, [email protected] wrote:
From: Shruthi Sanil <[email protected]>
The Intel Keem Bay timer driver supports clocksource and clockevent features for the timer IP used in Intel Keem Bay SoC.
The timer block supports 1 free running counter and 8 timers. The free running counter can be used as a clocksource and the timers can be used as clockevent. Each timer is capable of generating individual interrupt.
Both the features are enabled through the timer general config register.Reviewed-by Andy Shevchenko <[email protected]>Signed-off-by Shruthi Sanil <[email protected]>--- MAINTAINERS | 6 + drivers/clocksource/Kconfig | 11 ++ drivers/clocksource/Makefile | 1 + drivers/clocksource/timer-keembay.c | 230 ++++++++++++++++++++++++++++ 4 files changed, 248 insertions(+)create mode 100644
drivers/clocksource/timer-keembay.cMAINTAINERS +6
-0@@ -9796,6 +9796,12 @@ F: drivers/crypto/keembay/keembay-ocs-hcu-core.c F: drivers/crypto/keembay/ocs-hcu.c F: drivers/crypto/keembay/ocs-hcu.h +INTEL KEEM BAY TIMER DRIVER +M: Shruthi Sanil <[email protected]> +S: Maintained +F: Documentation/devicetree/bindings/timer/intel,keembay-timer.yaml +F: drivers/clocksource/timer-keembay.c + INTEL THUNDER BAY EMMC PHY DRIVER M: Nandhini Srikandan <[email protected]> M: Rashmi A <[email protected]>drivers/clocksource/Kconfig +11
-0@@ -721,4 +721,15 @@ config MICROCHIP_PIT64B modes and high resolution. It is used as a clocksource and a clockevent. +config KEEMBAY_TIMER + bool "Intel Keem Bay timer" + depends on ARCH_KEEMBAY || COMPILE_TEST + select TIMER_OF + help + This option enables the support for the Intel Keem Bay + general purpose timer and free running counter driver. + Each timer can generate an individual interrupt and + supports oneshot and periodic modes. + The 64-bit counter can be used as a clock source. + endmenudrivers/clocksource/Makefile +1
-0@@ -89,3 +89,4 @@ obj-$(CONFIG_GX6605S_TIMER) += timer-gx6605s.o obj-$(CONFIG_HYPERV_TIMER) += hyperv_timer.o obj-$(CONFIG_MICROCHIP_PIT64B) += timer-microchip-pit64b.o obj-$(CONFIG_MSC313E_TIMER) += timer-msc313e.o +obj-$(CONFIG_KEEMBAY_TIMER) += timer-keembay.odrivers/clocksource/timer-keembay.c new file +101
-0@@ -0,0 +1,230 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Intel Keem Bay Timer driver +* +* Copyright (C) 2020 Intel Corporation +*/ + +#include <linux/bitops.h> +#include <linux/interrupt.h> +#include <linux/io-64-nonatomic-lo-hi.h> +#include <linux/mfd/syscon.h> +#include <linux/module.h> +#include <linux/of_address.h> +#include <linux/sizes.h> +#include <linux/slab.h> +#include <linux/regmap.h> + +#include "timer-of.h" + +/* Timer register offset */ +#define TIM_CNT_VAL_OFFSET 0x0 +#define TIM_RELOAD_VAL_OFFSET 0x4 +#define TIM_CONFIG_OFFSET 0x8 + +/* Bit fields of timer general config register */ +#define TIM_CONFIG_PRESCALER_ENABLE BIT(2) +#define TIM_CONFIG_COUNTER_ENABLE BIT(0) + +/* Bit fields of timer config register */ +#define TIM_CONFIG_INTERRUPT_PENDING BIT(4) +#define TIM_CONFIG_INTERRUPT_ENABLE BIT(2) +#define TIM_CONFIG_RESTART BIT(1) +#define TIM_CONFIG_ENABLE BIT(0) + +#define TIM_GEN_MASK GENMASK(31, 12) +#define TIM_RATING 200 +#define TIM_CLKSRC_MASK_BITS 64 + +#define TIMER_NAME_SIZE 25 + +static inline void keembay_timer_enable (void __iomem *base,u32 flags) +{ +writel (TIM_CONFIG_ENABLE | flags, base +TIM_CONFIG_OFFSET ); +} + +static inline void keembay_timer_disable (void __iomem *base) +{ +writel (0x0 , base +TIM_CONFIG_OFFSET ); +} + +static inline void keembay_timer_update_counter (void __iomem *base,u32 val) +{ +writel (val, base +TIM_CNT_VAL_OFFSET ); +writel (val, base +TIM_RELOAD_VAL_OFFSET ); +} + +static inline void keembay_timer_clear_pending_int (void __iomem *base) +{ +u32 val; + + val =readl (base +TIM_CONFIG_OFFSET ); + val &= ~TIM_CONFIG_INTERRUPT_PENDING ; +writel (val, base +TIM_CONFIG_OFFSET ); +} + +static int keembay_timer_set_next_event (unsigned long evt,struct clock_event_device *ce) +{ +u32 flags =TIM_CONFIG_INTERRUPT_ENABLE ; +struct timer_of *to =to_timer_of (ce); +void __iomem *tim_base =timer_of_base (to); + +keembay_timer_disable (tim_base); +keembay_timer_update_counter (tim_base, evt); +keembay_timer_enable (tim_base, flags); + +return 0 ; +} + +static int keembay_timer_periodic (struct clock_event_device *ce) +{ +u32 flags =TIM_CONFIG_INTERRUPT_ENABLE |TIM_CONFIG_RESTART ; +struct timer_of *to =to_timer_of (ce); +void __iomem *tim_base =timer_of_base (to); + +keembay_timer_disable (tim_base); +keembay_timer_update_counter (tim_base,timer_of_period (to)); +keembay_timer_enable (tim_base, flags); + +return 0 ; +} + +static int keembay_timer_shutdown (struct clock_event_device *ce) +{ +struct timer_of *to =to_timer_of (ce); + +keembay_timer_disable (timer_of_base (to)); + +return 0 ; +} + +static irqreturn_t keembay_timer_isr (int irq,void *dev_id)
drivers/clocksource/timer-keembay.c line 111
Quoted 10 lines
drivers/clocksource/timer-keembay.c new file +10
-0+{ +struct clock_event_device *evt = dev_id; +struct timer_of *to =to_timer_of (evt); +void __iomem *tim_base =timer_of_base (to); +u32 val; + + val =readl (tim_base +TIM_CONFIG_OFFSET ); + +if (val &TIM_CONFIG_RESTART ) { +/* Clear interrupt for periodic timer*/
nit: comment format is:
/*
* my comment
*/
One line comment format is usually for the network subsystem
drivers/clocksource/timer-keembay.c line 114
Quoted 3 lines
drivers/clocksource/timer-keembay.c new file +3
-0+keembay_timer_clear_pending_int (tim_base); + }else { +/* Disable the timer for one shot timer */
comment format
Quoted 14 lines
drivers/clocksource/timer-keembay.c new file +14
-0+keembay_timer_disable (tim_base); + } + + evt->event_handler (evt); + +return IRQ_HANDLED ; +} + +static int __init keembay_clockevent_init (struct device_node *np) +{ +struct timer_of *keembay_ce_to; +struct regmap *regmap; +int ret; +u32 val;
drivers/clocksource/timer-keembay.c line 138
Quoted 10 lines
drivers/clocksource/timer-keembay.c new file +10
-0+ + regmap =device_node_to_regmap (np->parent); +if (IS_ERR (regmap)) +return PTR_ERR (regmap); + + ret =regmap_read (regmap,TIM_CONFIG_OFFSET , &val); +if (ret) +return ret; + +/* Prescaler bit must be enabled for the timer to function */
comment format
drivers/clocksource/timer-keembay.c line 142
Quoted 4 lines
drivers/clocksource/timer-keembay.c new file +4
-0+if (!(val &TIM_CONFIG_PRESCALER_ENABLE )) { +pr_err ("%pOF: Prescaler is not enabled\n" , np); + ret = -ENODEV ; + }
Why bail out instead of enabling the prescalar ?
drivers/clocksource/timer-keembay.c line 146
Quoted 3 lines
drivers/clocksource/timer-keembay.c new file +3
-0+ keembay_ce_to =kzalloc (sizeof (*keembay_ce_to),GFP_KERNEL ); +if (!keembay_ce_to) + ret = -ENOMEM ;
As your convenience but I suggest global static variable initialization, that will simplify the init function regarding the error path.
Quoted 59 lines
drivers/clocksource/timer-keembay.c new file +59
-0+ keembay_ce_to->flags =TIMER_OF_IRQ |TIMER_OF_BASE |TIMER_OF_CLOCK ; + keembay_ce_to->clkevt.name ="keembay_timer" ; + keembay_ce_to->clkevt.cpumask = cpu_possible_mask; + keembay_ce_to->clkevt.features =CLOCK_EVT_FEAT_PERIODIC | +CLOCK_EVT_FEAT_ONESHOT | +CLOCK_EVT_FEAT_DYNIRQ ; + keembay_ce_to->clkevt.rating =TIM_RATING ; + keembay_ce_to->clkevt.set_next_event = keembay_timer_set_next_event; + keembay_ce_to->clkevt.set_state_periodic = keembay_timer_periodic; + keembay_ce_to->clkevt.set_state_shutdown = keembay_timer_shutdown; + keembay_ce_to->of_irq.handler = keembay_timer_isr; + keembay_ce_to->of_irq.flags =IRQF_TIMER ; + + ret =timer_of_init (np, keembay_ce_to); +if (ret) + goto err_keembay_ce_to_free; + + ret =regmap_read (regmap,TIM_RELOAD_VAL_OFFSET , &val); +if (ret) + goto err_keembay_ce_to_free; + + keembay_ce_to->of_clk.rate = keembay_ce_to->of_clk.rate / (val +1 ); + +clockevents_config_and_register (&keembay_ce_to->clkevt, +timer_of_rate (keembay_ce_to), +1 , +U32_MAX ); + +return 0 ; + +err_keembay_ce_to_free: +kfree (keembay_ce_to); + +return ret; +} + +static struct timer_of keembay_cs_to = { + .flags =TIMER_OF_BASE |TIMER_OF_CLOCK , +}; + +static u64 notrace keembay_clocksource_read(struct clocksource *cs) +{ +return lo_hi_readq (timer_of_base (&keembay_cs_to)); +} + +static struct clocksource keembay_counter = { + .name ="keembay_sys_counter" , + .rating =TIM_RATING , + .read = keembay_clocksource_read, + .mask =CLOCKSOURCE_MASK (TIM_CLKSRC_MASK_BITS ), + .flags =CLOCK_SOURCE_IS_CONTINUOUS | +CLOCK_SOURCE_SUSPEND_NONSTOP , +}; + +static int __init keembay_clocksource_init (struct device_node *np) +{ +struct regmap *regmap; +u32 val; +int ret;
drivers/clocksource/timer-keembay.c line 216
Quoted 10 lines
drivers/clocksource/timer-keembay.c new file +10
-0+ + regmap =device_node_to_regmap (np->parent); +if (IS_ERR (regmap)) +return PTR_ERR (regmap); + + ret =regmap_read (regmap,TIM_CONFIG_OFFSET , &val); +if (ret) +return ret; + +/* Free Running Counter bit must be enabled for counter to function */
comment format
drivers/clocksource/timer-keembay.c line 220
Quoted 4 lines
drivers/clocksource/timer-keembay.c new file +4
-0+if (!(val &TIM_CONFIG_COUNTER_ENABLE )) { +pr_err ("%pOF: free running counter is not enabled\n" , np); +return -ENODEV ; + }
Same comment as above. Why not enable the counter ?
Other than that, the driver is having a good shape
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
RE: [PATCH v8 2/2] clocksource: Add Intel Keem Bay timer support
Quoted 193 lines
-----Original Message-----
From: Daniel Lezcano <[email protected]>
Sent: Wednesday, March 2, 2022 2:39 AM
To: Sanil, Shruthi <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; Thokala, Srikanth <[email protected]>; Raja Subramanian, Lakshmi Bai <[email protected]>; Sangannavar, Mallikarjunappa <[email protected]>
Subject: Re: [PATCH v8 2/2] clocksource: Add Intel Keem Bay timer supportQuoted 10 lines · On 22/02/2022 10:56, [email protected] wrote:
From: Shruthi Sanil <[email protected]>
The Intel Keem Bay timer driver supports clocksource and clockevent features for the timer IP used in Intel Keem Bay SoC.
The timer block supports 1 free running counter and 8 timers. The free running counter can be used as a clocksource and the timers can be used as clockevent. Each timer is capable of generating individual interrupt.
Both the features are enabled through the timer general config register.Quoted 7 lines
Reviewed-by Andy Shevchenko <[email protected]>Signed-off-by Shruthi Sanil <[email protected]>--- MAINTAINERS | 6 + drivers/clocksource/Kconfig | 11 ++ drivers/clocksource/Makefile | 1 + drivers/clocksource/timer-keembay.c | 230++++++++++++++++++++++++++++
MAINTAINERS F: drivers/crypto/keembay/keembay-ocs-hcu-
Quoted 8 lines
4 files changed, 248 insertions(+)create mode 100644
drivers/clocksource/timer-keembay.cMAINTAINERS index renamed from MAINTAINERS +0
-0
777cd6fa2b3d..73c0029dcdf7100644MAINTAINERS +0
-0@@ -9796,6 +9796,12 @@ F: drivers/crypto/keembay/keembay-ocs-hcu-
core.cMAINTAINERS F: drivers/crypto/keembay/keembay-ocs-hcu-core.c
Quoted 7 lines
MAINTAINERS +4
-0F: drivers/crypto/keembay/ocs-hcu.c F: drivers/crypto/keembay/ocs-hcu.h +INTEL KEEM BAY TIMER DRIVER +M: Shruthi Sanil <[email protected]> +S: Maintained +F: Documentation/devicetree/bindings/timer/intel,keembay-
timer.yamldrivers/clocksource/Makefile obj-$(CONFIG_GX6605S_TIMER) +=
Quoted 30 lines
MAINTAINERS +2
-0+F: drivers/clocksource/timer-keembay.c + INTEL THUNDER BAY EMMC PHY DRIVER M: Nandhini Srikandan <[email protected]> M: Rashmi A <[email protected]>drivers/clocksource/Kconfig +11
-0@@ -721,4 +721,15 @@ config MICROCHIP_PIT64B modes and high resolution. It is used as a clocksource and a clockevent. +config KEEMBAY_TIMER + bool "Intel Keem Bay timer" + depends on ARCH_KEEMBAY || COMPILE_TEST + select TIMER_OF + help + This option enables the support for the Intel Keem Bay + general purpose timer and free running counter driver. + Each timer can generate an individual interrupt and + supports oneshot and periodic modes. + The 64-bit counter can be used as a clock source. + endmenu(quoted diff) +0
-0b/drivers/clocksource/Makefile index
fa5f624eadb6..dff6458ef9e5100644drivers/clocksource/Makefile +0
-0@@ -89,3 +89,4 @@ obj-$(CONFIG_GX6605S_TIMER) +=timer-gx6605s.o
Quoted 72 lines
drivers/clocksource/Makefile +1
-0obj-$(CONFIG_HYPERV_TIMER) += hyperv_timer.o obj-$(CONFIG_MICROCHIP_PIT64B) += timer-microchip-pit64b.o obj-$(CONFIG_MSC313E_TIMER) += timer-msc313e.o +obj-$(CONFIG_KEEMBAY_TIMER) += timer-keembay.odrivers/clocksource/timer-keembay.c new file +61
-0@@ -0,0 +1,230 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Intel Keem Bay Timer driver +* +* Copyright (C) 2020 Intel Corporation */ + +#include <linux/bitops.h> +#include <linux/interrupt.h> +#include <linux/io-64-nonatomic-lo-hi.h> #include +<linux/mfd/syscon.h> #include <linux/module.h> #include +<linux/of_address.h> #include <linux/sizes.h> #include <linux/slab.h> +#include <linux/regmap.h> + +#include "timer-of.h" + +/* Timer register offset */ +#define TIM_CNT_VAL_OFFSET 0x0 +#define TIM_RELOAD_VAL_OFFSET 0x4 +#define TIM_CONFIG_OFFSET 0x8 + +/* Bit fields of timer general config register */ +#define TIM_CONFIG_PRESCALER_ENABLE BIT(2) +#define TIM_CONFIG_COUNTER_ENABLE BIT(0) + +/* Bit fields of timer config register */ +#define TIM_CONFIG_INTERRUPT_PENDING BIT(4) +#define TIM_CONFIG_INTERRUPT_ENABLE BIT(2) +#define TIM_CONFIG_RESTART BIT(1) +#define TIM_CONFIG_ENABLE BIT(0) + +#define TIM_GEN_MASK GENMASK(31, 12) +#define TIM_RATING 200 +#define TIM_CLKSRC_MASK_BITS 64 + +#define TIMER_NAME_SIZE 25 + +static inline void keembay_timer_enable (void __iomem *base,u32 +flags) { +writel (TIM_CONFIG_ENABLE | flags, base +TIM_CONFIG_OFFSET ); } + +static inline void keembay_timer_disable (void __iomem *base) { +writel (0x0 , base +TIM_CONFIG_OFFSET ); } + +static inline void keembay_timer_update_counter (void __iomem *base, +u32 val) { +writel (val, base +TIM_CNT_VAL_OFFSET ); +writel (val, base +TIM_RELOAD_VAL_OFFSET ); } + +static inline void keembay_timer_clear_pending_int (void __iomem +*base) { +u32 val; + + val =readl (base +TIM_CONFIG_OFFSET ); + val &= ~TIM_CONFIG_INTERRUPT_PENDING ; +writel (val, base +TIM_CONFIG_OFFSET ); } + +static int keembay_timer_set_next_event (unsigned long evt,struct +clock_event_device *ce) { +u32 flags =TIM_CONFIG_INTERRUPT_ENABLE ; +struct timer_of *to =to_timer_of (ce); +void __iomem *tim_base =timer_of_base (to);drivers/clocksource/timer-keembay.c line 71
Quoted 10 lines
drivers/clocksource/timer-keembay.c new file +10
-0+ +keembay_timer_disable (tim_base); +keembay_timer_update_counter (tim_base, evt); +keembay_timer_enable (tim_base, flags); + +return 0 ; +} + +static int keembay_timer_periodic (struct clock_event_device *ce) { + u32 flags = TIM_CONFIG_INTERRUPT_ENABLE |
TIM_CONFIG_RESTART;Quoted 18 lines
drivers/clocksource/timer-keembay.c new file +18
-0+struct timer_of *to =to_timer_of (ce); +void __iomem *tim_base =timer_of_base (to); + +keembay_timer_disable (tim_base); +keembay_timer_update_counter (tim_base,timer_of_period (to)); +keembay_timer_enable (tim_base, flags); + +return 0 ; +} + +static int keembay_timer_shutdown (struct clock_event_device *ce) { +struct timer_of *to =to_timer_of (ce); + +keembay_timer_disable (timer_of_base (to)); + +return 0 ; +} +drivers/clocksource/timer-keembay.c line 111
Quoted 10 lines
drivers/clocksource/timer-keembay.c new file +10
-0+static irqreturn_t keembay_timer_isr (int irq,void *dev_id) { +struct clock_event_device *evt = dev_id; +struct timer_of *to =to_timer_of (evt); +void __iomem *tim_base =timer_of_base (to); +u32 val; + + val =readl (tim_base +TIM_CONFIG_OFFSET ); + +if (val &TIM_CONFIG_RESTART ) { +/* Clear interrupt for periodic timer*/ nit: comment format is:
Quoted 5 lines
/*
* my comment
*/One line comment format is usually for the network subsystem
OK. I'll update the comment format.
Quoted 6 lines
drivers/clocksource/timer-keembay.c line 114
Quoted 4 lines
drivers/clocksource/timer-keembay.c new file +3
-0+keembay_timer_clear_pending_int (tim_base); + }else { +/* Disable the timer for one shot timer */ comment format
I'll update the comment format.
Quoted 18 lines
Quoted 18 lines
drivers/clocksource/timer-keembay.c new file +17
-0+keembay_timer_disable (tim_base); + } + + evt->event_handler (evt); + +return IRQ_HANDLED ; +} + +static int __init keembay_clockevent_init (struct device_node *np) { +struct timer_of *keembay_ce_to; +struct regmap *regmap; +int ret; +u32 val; + + regmap =device_node_to_regmap (np->parent); +if (IS_ERR (regmap)) +return PTR_ERR (regmap);
Quoted 8 lines
drivers/clocksource/timer-keembay.c line 138
Quoted 6 lines
drivers/clocksource/timer-keembay.c new file +6
-0+ + ret =regmap_read (regmap,TIM_CONFIG_OFFSET , &val); +if (ret) +return ret; + +/* Prescaler bit must be enabled for the timer to function */ comment format
I'll update the comment format.
Quoted 7 lines
drivers/clocksource/timer-keembay.c line 142
Quoted 5 lines
drivers/clocksource/timer-keembay.c new file +4
-0+if (!(val &TIM_CONFIG_PRESCALER_ENABLE )) { +pr_err ("%pOF: Prescaler is not enabled\n" , np); + ret = -ENODEV ; + }Why bail out instead of enabling the prescalar ?
Because it is a secure register and it would be updated by the bootloader.
Quoted 7 lines
drivers/clocksource/timer-keembay.c line 146
Quoted 4 lines
drivers/clocksource/timer-keembay.c new file +3
-0+ keembay_ce_to =kzalloc (sizeof (*keembay_ce_to),GFP_KERNEL ); +if (!keembay_ce_to) + ret = -ENOMEM ;As your convenience but I suggest global static variable initialization, that will simplify the init function regarding the error path.
Yes, I can update this to have a global static variable. This was updated like this considering multiple timers.
Quoted 68 lines
drivers/clocksource/timer-keembay.c line 133
Quoted 2 lines
drivers/clocksource/timer-keembay.c new file +1
-0+ keembay_ce_to->flags = TIMER_OF_IRQ | TIMER_OF_BASE |
TIMER_OF_CLOCK;drivers/clocksource/timer-keembay.c
Quoted 7 lines
drivers/clocksource/timer-keembay.c new file +7
-0+ keembay_ce_to->clkevt.name ="keembay_timer" ; + keembay_ce_to->clkevt.cpumask = cpu_possible_mask; + keembay_ce_to->clkevt.features =CLOCK_EVT_FEAT_PERIODIC | +CLOCK_EVT_FEAT_ONESHOT | +CLOCK_EVT_FEAT_DYNIRQ ; + keembay_ce_to->clkevt.rating =TIM_RATING ; + keembay_ce_to->clkevt.set_next_event =
keembay_timer_set_next_event;drivers/clocksource/timer-keembay.c line 141
Quoted 1 line
drivers/clocksource/timer-keembay.c new file +1
-0+ keembay_ce_to->clkevt.set_state_periodic =
keembay_timer_periodic;drivers/clocksource/timer-keembay.c line 142
Quoted 1 line
drivers/clocksource/timer-keembay.c new file +1
-0+ keembay_ce_to->clkevt.set_state_shutdown =
keembay_timer_shutdown;drivers/clocksource/timer-keembay.c
Quoted 12 lines
drivers/clocksource/timer-keembay.c new file +12
-0+ keembay_ce_to->of_irq.handler = keembay_timer_isr; + keembay_ce_to->of_irq.flags =IRQF_TIMER ; + + ret =timer_of_init (np, keembay_ce_to); +if (ret) + goto err_keembay_ce_to_free; + + ret =regmap_read (regmap,TIM_RELOAD_VAL_OFFSET , &val); +if (ret) + goto err_keembay_ce_to_free; + + keembay_ce_to->of_clk.rate = keembay_ce_to->of_clk.rate / (val +1);
Quoted 40 lines
drivers/clocksource/timer-keembay.c new file +40
-0+ +clockevents_config_and_register (&keembay_ce_to->clkevt, +timer_of_rate (keembay_ce_to), +1 , +U32_MAX ); + +return 0 ; + +err_keembay_ce_to_free: +kfree (keembay_ce_to); + +return ret; +} + +static struct timer_of keembay_cs_to = { + .flags =TIMER_OF_BASE |TIMER_OF_CLOCK , +}; + +static u64 notrace keembay_clocksource_read(struct clocksource *cs) { +return lo_hi_readq (timer_of_base (&keembay_cs_to)); +} + +static struct clocksource keembay_counter = { + .name ="keembay_sys_counter" , + .rating =TIM_RATING , + .read = keembay_clocksource_read, + .mask =CLOCKSOURCE_MASK (TIM_CLKSRC_MASK_BITS ), + .flags =CLOCK_SOURCE_IS_CONTINUOUS | +CLOCK_SOURCE_SUSPEND_NONSTOP , +}; + +static int __init keembay_clocksource_init (struct device_node *np) { +struct regmap *regmap; +u32 val; +int ret; + + regmap =device_node_to_regmap (np->parent); +if (IS_ERR (regmap)) +return PTR_ERR (regmap); +
Quoted 8 lines
drivers/clocksource/timer-keembay.c
Quoted 6 lines
drivers/clocksource/timer-keembay.c new file +6
-0+ ret =regmap_read (regmap,TIM_CONFIG_OFFSET , &val); +if (ret) +return ret; + +/* Free Running Counter bit must be enabled for counter to function +*/ comment format
I'll update the comment format.
Quoted 7 lines
drivers/clocksource/timer-keembay.c line 220
Quoted 5 lines
drivers/clocksource/timer-keembay.c new file +4
-0+if (!(val &TIM_CONFIG_COUNTER_ENABLE )) { +pr_err ("%pOF: free running counter is not enabled\n" , np); +return -ENODEV ; + }Same comment as above. Why not enable the counter ?
Because it is a secure register and it would be updated by the bootloader.
Quoted 2 lines
Other than that, the driver is having a good shape
Thank You!
Regards,
Shruthi
Quoted 8 lines
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCsFollow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-
blog/> Blog
Re: [PATCH v8 2/2] clocksource: Add Intel Keem Bay timer support
On 02/03/2022 11:12, Sanil, Shruthi wrote:
[ ... ]
Quoted 8 lines
Quoted 6 lines
drivers/clocksource/timer-keembay.c line 142
Quoted 4 lines
drivers/clocksource/timer-keembay.c new file +4
-0+if (!(val &TIM_CONFIG_PRESCALER_ENABLE )) { +pr_err ("%pOF: Prescaler is not enabled\n" , np); + ret = -ENODEV ; + }Why bail out instead of enabling the prescalar ?
Because it is a secure register and it would be updated by the bootloader.
Should it be considered as a firmware bug ?
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
RE: [PATCH v8 2/2] clocksource: Add Intel Keem Bay timer support
Quoted 23 lines
-----Original Message-----
From: Daniel Lezcano <[email protected]>
Sent: Wednesday, March 2, 2022 3:54 PM
To: Sanil, Shruthi <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; Thokala, Srikanth <[email protected]>; Raja Subramanian, Lakshmi Bai <[email protected]>; Sangannavar, Mallikarjunappa <[email protected]>
Subject: Re: [PATCH v8 2/2] clocksource: Add Intel Keem Bay timer supportOn 02/03/2022 11:12, Sanil, Shruthi wrote:
[ ... ]
Quoted 7 lines
Quoted 6 lines
drivers/clocksource/timer-keembay.c line 142
Quoted 4 lines
drivers/clocksource/timer-keembay.c new file +4
-0+if (!(val &TIM_CONFIG_PRESCALER_ENABLE )) { +pr_err ("%pOF: Prescaler is not enabled\n" , np); + ret = -ENODEV ; + }Why bail out instead of enabling the prescalar ?
Quoted 2 lines
Quoted 1 line
Because it is a secure register and it would be updated by the bootloader.
Should it be considered as a firmware bug ?
No. This is a common driver across products in the series and enablement of this bit depends on the project requirements. Hence to be sure from driver, we added this check to avoid initialization of the driver in the case where it cannot be functional.
Quoted 7 lines
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCsFollow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-
blog/> Blog
Re: [PATCH v8 2/2] clocksource: Add Intel Keem Bay timer support
Quoted 17 lines · Shruthi
Quoted 17 lines
-----Original Message----- From: Daniel Lezcano
<[email protected]> Sent: Wednesday, March 2, 2022 3:54 PM To: Sanil, Shruthi <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected] Cc: [email protected]; [email protected]; Thokala, Srikanth
<[email protected]>; Raja Subramanian, Lakshmi Bai <[email protected]>; Sangannavar,
Mallikarjunappa <[email protected]> Subject:
Re: [PATCH v8 2/2] clocksource: Add Intel Keem Bay timer supportOn 02/03/2022 11:12, Sanil, Shruthi wrote:
[ ... ]
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
(quoted diff) +1
-0+ if (!(val & TIM_CONFIG_PRESCALER_ENABLE)) { +
pr_err("%pOF: Prescaler is not enabled\n", np); + ret =-ENODEV; + }Why bail out instead of enabling the prescalar ?
Quoted 8 lines
Quoted 3 lines
Quoted 2 lines
Because it is a secure register and it would be updated by the bootloader.
Should it be considered as a firmware bug ?
No. This is a common driver across products in the series and enablement of this bit depends on the project requirements. Hence to be sure from driver, we added this check to avoid initialization of the driver in the case where it cannot be functional.
I'm not sure to get the meaning of 'project requirements' but (for my understanding) why not describe the timer in the DT for such projects?
Quoted 5 lines
Quoted 5 lines
-- <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro- blog/> Blog
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
RE: [PATCH v8 2/2] clocksource: Add Intel Keem Bay timer support
Regards,
Shruthi
Quoted 38 lines
-----Original Message-----
From: Daniel Lezcano <[email protected]>
Sent: Wednesday, March 2, 2022 9:57 PM
To: Sanil, Shruthi <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; Thokala, Srikanth <[email protected]>; Raja Subramanian, Lakshmi Bai <[email protected]>; Sangannavar, Mallikarjunappa <[email protected]>
Subject: Re: [PATCH v8 2/2] clocksource: Add Intel Keem Bay timer supportQuoted 25 lines · Shruthi
Quoted 24 lines
-----Original Message----- From: Daniel Lezcano <[email protected]> Sent: Wednesday, March 2, 2022 3:54 PM
To: Sanil, Shruthi <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected] Cc: [email protected]; [email protected]; Thokala, Srikanth <[email protected]>; Raja Subramanian, Lakshmi Bai <[email protected]>; Sangannavar, Mallikarjunappa <[email protected]> Subject:
Re: [PATCH v8 2/2] clocksource: Add Intel Keem Bay timer supportOn 02/03/2022 11:12, Sanil, Shruthi wrote:
[ ... ]
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
(quoted diff) +1
-0+ if (!(val & TIM_CONFIG_PRESCALER_ENABLE)) { +
pr_err("%pOF: Prescaler is not enabled\n", np); + ret =-ENODEV; + }Why bail out instead of enabling the prescalar ?
Because it is a secure register and it would be updated by the bootloader.
Should it be considered as a firmware bug ?
Quoted 8 lines
Quoted 4 lines
No. This is a common driver across products in the series and enablement of this bit depends on the project requirements. Hence to be sure from driver, we added this check to avoid initialization of the driver in the case where it cannot be functional.
I'm not sure to get the meaning of 'project requirements' but (for my understanding) why not describe the timer in the DT for such projects?
OK, I understand your point now. We can control the driver initialization from device tree binding rather than add a check in the driver. But isn't it good to have a check, if enabling of the bit is missed out in the FW? This can help in debugging.
Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
-- <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro- blog/> Blog--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCsFollow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
Re: [PATCH v8 2/2] clocksource: Add Intel Keem Bay timer support
On 03/03/2022 07:18, Sanil, Shruthi wrote:
[ ... ]
Quoted 20 lines
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
(quoted diff) +1
-0+ if (!(val & TIM_CONFIG_PRESCALER_ENABLE)) { +
pr_err("%pOF: Prescaler is not enabled\n", np); + ret =-ENODEV; + }Why bail out instead of enabling the prescalar ?
Because it is a secure register and it would be updated by the bootloader.
Should it be considered as a firmware bug ?
Quoted 9 lines
Quoted 4 lines
No. This is a common driver across products in the series and enablement of this bit depends on the project requirements. Hence to be sure from driver, we added this check to avoid
initialization of the driver in the case where it cannot be
functional.I'm not sure to get the meaning of 'project requirements' but (for my understanding) why not describe the timer in the DT for such projects?
Quoted 4 lines
OK, I understand your point now. We can control the driver initialization from device tree binding rather than add a check in the driver. But isn't it good to have a check, if enabling of the bit is missed out in the FW? This can help in debugging.
So if the description is in the DT but the prescaler bit is not enabled then the firmware is buggy, IIUC. Yeah, this check would help, may be add more context in the error message, eg. "Firmware has not enabled the prescaler bit" or something like that
Thanks for the clarification
-- D.
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
RE: [PATCH v8 2/2] clocksource: Add Intel Keem Bay timer support
Quoted 36 lines
-----Original Message-----
From: Daniel Lezcano <[email protected]>
Sent: Thursday, March 3, 2022 3:48 PM
To: Sanil, Shruthi <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; Thokala, Srikanth <[email protected]>; Raja Subramanian, Lakshmi Bai <[email protected]>; Sangannavar, Mallikarjunappa <[email protected]>
Subject: Re: [PATCH v8 2/2] clocksource: Add Intel Keem Bay timer supportOn 03/03/2022 07:18, Sanil, Shruthi wrote:
[ ... ]
Quoted 20 lines
Quoted 19 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
(quoted diff) +1
-0+ if (!(val & TIM_CONFIG_PRESCALER_ENABLE)) { +
pr_err("%pOF: Prescaler is not enabled\n", np); + ret =-ENODEV; + }Why bail out instead of enabling the prescalar ?
Quoted 8 lines
Quoted 3 lines
Quoted 2 lines
Because it is a secure register and it would be updated by the bootloader.
Should it be considered as a firmware bug ?
No. This is a common driver across products in the series and enablement of this bit depends on the project requirements. Hence to be sure from driver, we added this check to avoid initialization of the driver in the case where it cannot be functional.
I'm not sure to get the meaning of 'project requirements' but (for my understanding) why not describe the timer in the DT for such projects?
Quoted 7 lines
Quoted 4 lines
OK, I understand your point now. We can control the driver initialization from device tree binding rather than add a check in the driver. But isn't it good to have a check, if enabling of the bit is missed out in the FW? This can help in debugging.
So if the description is in the DT but the prescaler bit is not enabled then the firmware is buggy, IIUC. Yeah, this check would help, may be add more
Yes, right. It would mean the FW is buggy.
Quoted 4 lines
context in the error message, eg. "Firmware has not enabled the prescaler bit" or something like that
Thanks for the clarification
Yes, Sure. I'll update the comment accordingly.
Thank you 😊
Quoted 11 lines
-- D.--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCsFollow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-
blog/> Blog
Re: [PATCH v8 2/2] clocksource: Add Intel Keem Bay timer support
Quoted 3 lines · Shruthi
Quoted 3 lines
From: Daniel Lezcano <[email protected]>
Sent: Thursday, March 3, 2022 3:48 PM
On 03/03/2022 07:18, Sanil, Shruthi wrote:
...
Quoted 3 lines
Quoted 2 lines
So if the description is in the DT but the prescaler bit is not enabled then the firmware is buggy, IIUC. Yeah, this check would help, may be add more
Yes, right. It would mean the FW is buggy.
Make use of FW_BUG prefix instead of "Firmware" in the message.
Signature · 2 lines
With Best Regards, Andy Shevchenko
RE: [PATCH v8 2/2] clocksource: Add Intel Keem Bay timer support
Quoted 18 lines
-----Original Message-----
From: [email protected] <[email protected]>
Sent: Thursday, March 3, 2022 4:18 PM
To: Sanil, Shruthi <[email protected]>
Cc: Daniel Lezcano <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Thokala, Srikanth <[email protected]>; Raja Subramanian, Lakshmi Bai <[email protected]>; Sangannavar, Mallikarjunappa <[email protected]>
Subject: Re: [PATCH v8 2/2] clocksource: Add Intel Keem Bay timer supportQuoted 3 lines · Shruthi
Quoted 3 lines
From: Daniel Lezcano <[email protected]>
Sent: Thursday, March 3, 2022 3:48 PM On 03/03/2022 07:18, Sanil, Shruthi wrote:
Quoted 8 lines
...
Quoted 4 lines
Quoted 3 lines
So if the description is in the DT but the prescaler bit is not enabled then the firmware is buggy, IIUC. Yeah, this check would help, may be add more
Yes, right. It would mean the FW is buggy.
Make use of
FW_BUGprefix instead of "Firmware" in the message.
Sure. I'll update accordingly.
Quoted 5 lines
--
With Best Regards,
Andy Shevchenko
Re: [PATCH v8 2/2] clocksource: Add Intel Keem Bay timer support
In reply to Daniel LezcanoQuoted 29 lines · Daniel Lezcano
Quoted 22 lines · Shruthi
Quoted 17 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Review
Quoted 3 lines
(quoted diff) +1
-0+ if (!(val & TIM_CONFIG_PRESCALER_ENABLE)) { +
pr_err("%pOF: Prescaler is not enabled\n", np);(quoted diff) +1
-0+ ret = -ENODEV; + }Why bail out instead of enabling the prescalar ?
Because it is a secure register and it would be updated by the bootloader.
Quoted 8 lines
Quoted 1 line
Should it be considered as a firmware bug ?
No. This is a common driver across products in the series and enablement of this bit depends on the project requirements. Hence
to be sure from driver, we added this check to avoid initialization of the driver in the case where it cannot be functional.Quoted 4 lines
I'm not sure to get the meaning of 'project requirements' but (for my understanding) why not describe the timer in the DT for such projects?
Quoted 4 lines
OK, I understand your point now. We can control the driver initialization from device tree binding rather than add a check in the driver. But isn't it good to have a check, if enabling of the bit is missed out in the FW? This can help in debugging.
Quoted 4 lines
So if the description is in the DT but the prescaler bit is not enabled then the firmware is buggy, IIUC. Yeah, this check would help, may be add more context in the error message, eg. "Firmware has not enabled the prescaler bit" or something like that
For this we also use a FW_BUG prefix to printf()-like functions.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v8 2/2] clocksource: Add Intel Keem Bay timer support
Quoted 30 lines · On 03/03/2022 11:47, [email protected] wrote:
Quoted 29 lines · Daniel Lezcano
Quoted 26 lines · Shruthi
Quoted 17 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Review
Quoted 3 lines
(quoted diff) +1
-0+ if (!(val & TIM_CONFIG_PRESCALER_ENABLE)) { +
pr_err("%pOF: Prescaler is not enabled\n", np);(quoted diff) +1
-0+ ret = -ENODEV; + }Why bail out instead of enabling the prescalar ?
Because it is a secure register and it would be updated by the bootloader.
Quoted 8 lines
Quoted 1 line
Should it be considered as a firmware bug ?
No. This is a common driver across products in the series and enablement of this bit depends on the project requirements. Hence
to be sure from driver, we added this check to avoid initialization of the driver in the case where it cannot be functional.Quoted 4 lines
I'm not sure to get the meaning of 'project requirements' but (for my understanding) why not describe the timer in the DT for such projects?
OK, I understand your point now. We can control the driver initialization from device tree binding rather than add a check in the driver. But isn't it good to have a check, if enabling of the bit is missed out in the FW? This can help in debugging.
Quoted 6 lines
Quoted 4 lines
So if the description is in the DT but the prescaler bit is not enabled then the firmware is buggy, IIUC. Yeah, this check would help, may be add more context in the error message, eg. "Firmware has not enabled the prescaler bit" or something like that
For this we also use a
FW_BUGprefix to printf()-like functions.
Thanks for the information, I was unaware of this prefix.
Good to know ;)
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
Re: [PATCH v8 2/2] clocksource: Add Intel Keem Bay timer support
In reply to Sanil, ShruthiQuoted 4 lines · Shruthi
Quoted 4 lines
From: Daniel Lezcano <[email protected]>
Sent: Wednesday, March 2, 2022 2:39 AM
Subject: Re: [PATCH v8 2/2] clocksource: Add Intel Keem Bay timer support On 22/02/2022 10:56, [email protected] wrote:
...
Quoted 3 lines
Quoted 1 line
One line comment format is usually for the network subsystem
OK. I'll update the comment format.
Hold on, we need a proof from documentation.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v8 2/2] clocksource: Add Intel Keem Bay timer support
In reply to Daniel LezcanoQuoted 11 lines · Daniel Lezcano
drivers/clocksource/timer-keembay.c line 111
Quoted 1 line · On 22/02/2022 10:56, [email protected] wrote:
drivers/clocksource/timer-keembay.c new file +1
-0+/* Clear interrupt for periodic timer*/ nit: comment format is:
/*
* my comment
*/One line comment format is usually for the network subsystem
Huh?
Any pointers to the documentation, please?
Quoted 8 lines
drivers/clocksource/timer-keembay.c line 114
Quoted 3 lines
drivers/clocksource/timer-keembay.c new file +3
-0+keembay_timer_clear_pending_int (tim_base); + }else { +/* Disable the timer for one shot timer */ comment format
Quoted 2 lines
(quoted diff) +2
-0+ keembay_timer_disable(tim_base); + }
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v8 2/2] clocksource: Add Intel Keem Bay timer support
Quoted 7 lines · Andy Shevchenko
Quoted 6 lines · Daniel Lezcano
drivers/clocksource/timer-keembay.c line 111
Quoted 1 line · On 22/02/2022 10:56, [email protected] wrote:
drivers/clocksource/timer-keembay.c new file +1
-0+/* Clear interrupt for periodic timer*/ nit: comment format is:
Quoted 8 lines
Quoted 5 lines
/*
* my comment
*/One line comment format is usually for the network subsystem
Huh?
Any pointers to the documentation, please?
Well actually it is for multi line, so I may have confused with these one line comments.
On the other hand having one line comment telling what does the function right after is not really useful. The function names are self-explanatory.
Quoted 9 lines
Quoted 8 lines
drivers/clocksource/timer-keembay.c line 114
Quoted 3 lines
drivers/clocksource/timer-keembay.c new file +3
-0+keembay_timer_clear_pending_int (tim_base); + }else { +/* Disable the timer for one shot timer */ comment format
Quoted 2 lines
(quoted diff) +2
-0+ keembay_timer_disable(tim_base); + }
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
Re: [PATCH v8 2/2] clocksource: Add Intel Keem Bay timer support
Quoted 3 lines · Daniel Lezcano
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · Daniel Lezcano
On 22/02/2022 10:56, [email protected] wrote:
...
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
One line comment format is usually for the network subsystem
Any pointers to the documentation, please?
Well actually it is for multi line, so I may have confused with these one line comments.
Seems so.
Quoted 2 lines
On the other hand having one line comment telling what does the function right after is not really useful. The function names are self-explanatory.
Agree on this.
Signature · 2 lines
With Best Regards, Andy Shevchenko